Skip to content

EthereumWalletAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / EthereumWalletAdapter

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9903

Ethereum wallet adapter implementation

const adapter = new EthereumWalletAdapter({
wallet: 'metamask',
chainId: 1,
})
await adapter.connect()
const balance = await adapter.getBalance()

new EthereumWalletAdapter(config?): EthereumWalletAdapter

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9913

EthereumAdapterConfig

EthereumWalletAdapter

BaseWalletAdapter.constructor

readonly chain: "ethereum"

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9904

Chain this adapter connects to

BaseWalletAdapter.chain


readonly name: string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9905

Wallet name/identifier (e.g., ‘phantom’, ‘metamask’)

BaseWalletAdapter.name

get address(): string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8930

Current address (empty string if not connected)

string

Current address (empty string if not connected)

BaseWalletAdapter.address


get publicKey(): "" | `0x${string}`

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8931

Public key (hex encoded, empty string if not connected)

"" | `0x${string}`

Public key (hex encoded, empty string if not connected)

BaseWalletAdapter.publicKey


get connectionState(): WalletConnectionState

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8932

Current connection state

WalletConnectionState

Current connection state

BaseWalletAdapter.connectionState

on<T>(event, handler): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8937

Subscribe to wallet events

T extends WalletEventType

T

WalletEventHandler<Extract<WalletConnectEvent, { type: T; }> | Extract<WalletDisconnectEvent, { type: T; }> | Extract<WalletAccountChangedEvent, { type: T; }> | Extract<WalletChainChangedEvent, { type: T; }> | Extract<WalletErrorEvent, { type: T; }>>

void

BaseWalletAdapter.on


off<T>(event, handler): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8943

Unsubscribe from wallet events

T extends WalletEventType

T

WalletEventHandler<Extract<WalletConnectEvent, { type: T; }> | Extract<WalletDisconnectEvent, { type: T; }> | Extract<WalletAccountChangedEvent, { type: T; }> | Extract<WalletChainChangedEvent, { type: T; }> | Extract<WalletErrorEvent, { type: T; }>>

void

BaseWalletAdapter.off


isConnected(): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8973

Check if wallet is connected

boolean

BaseWalletAdapter.isConnected


getChainId(): number

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9917

Get current chain ID

number


getRpcEndpoint(): string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9921

Get RPC endpoint URL

string


setRpcEndpoint(endpoint): void

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9925

Set RPC endpoint URL

string

void


connect(): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9929

Connect to Ethereum wallet

Promise<void>

BaseWalletAdapter.connect


disconnect(): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9933

Disconnect from wallet

Promise<void>

BaseWalletAdapter.disconnect


signMessage(message): Promise<Signature>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9937

Sign a message

Uint8Array

Promise<Signature>

BaseWalletAdapter.signMessage


signTypedData(typedData): Promise<Signature>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9941

Sign typed data (EIP-712)

EIP712TypedData

Promise<Signature>


signTransaction(tx): Promise<SignedTransaction>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9945

Sign a transaction without sending

UnsignedTransaction

Promise<SignedTransaction>

BaseWalletAdapter.signTransaction


signAndSendTransaction(tx): Promise<TransactionReceipt>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9949

Sign and send a transaction

UnsignedTransaction

Promise<TransactionReceipt>

BaseWalletAdapter.signAndSendTransaction


getBalance(): Promise<bigint>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9953

Get ETH balance

Promise<bigint>

BaseWalletAdapter.getBalance


getTokenBalance(asset): Promise<bigint>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9957

Get ERC-20 token balance

Asset

Promise<bigint>

BaseWalletAdapter.getTokenBalance


switchChain(chainId): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9961

Switch to a different chain

number

Promise<void>


waitForTransaction(txHash, confirmations?): Promise<EthereumTransactionReceipt>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9965

Wait for transaction confirmation

string

number

Promise<EthereumTransactionReceipt>