EthereumWalletAdapter
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / EthereumWalletAdapter
Class: EthereumWalletAdapter
Section titled “Class: EthereumWalletAdapter”Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9903
Ethereum wallet adapter implementation
Example
Section titled “Example”const adapter = new EthereumWalletAdapter({ wallet: 'metamask', chainId: 1,})
await adapter.connect()const balance = await adapter.getBalance()Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EthereumWalletAdapter(
config?):EthereumWalletAdapter
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9913
Parameters
Section titled “Parameters”config?
Section titled “config?”Returns
Section titled “Returns”EthereumWalletAdapter
Overrides
Section titled “Overrides”Properties
Section titled “Properties”
readonlychain:"ethereum"
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9904
Chain this adapter connects to
Overrides
Section titled “Overrides”
readonlyname:string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9905
Wallet name/identifier (e.g., ‘phantom’, ‘metamask’)
Overrides
Section titled “Overrides”Accessors
Section titled “Accessors”address
Section titled “address”Get Signature
Section titled “Get Signature”get address():
string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8930
Current address (empty string if not connected)
Returns
Section titled “Returns”string
Current address (empty string if not connected)
Inherited from
Section titled “Inherited from”publicKey
Section titled “publicKey”Get Signature
Section titled “Get Signature”get publicKey():
""|`0x${string}`
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8931
Public key (hex encoded, empty string if not connected)
Returns
Section titled “Returns”"" | `0x${string}`
Public key (hex encoded, empty string if not connected)
Inherited from
Section titled “Inherited from”connectionState
Section titled “connectionState”Get Signature
Section titled “Get Signature”get connectionState():
WalletConnectionState
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8932
Current connection state
Returns
Section titled “Returns”Current connection state
Inherited from
Section titled “Inherited from”BaseWalletAdapter.connectionState
Methods
Section titled “Methods”on<
T>(event,handler):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8937
Subscribe to wallet events
Type Parameters
Section titled “Type Parameters”T extends WalletEventType
Parameters
Section titled “Parameters”T
handler
Section titled “handler”WalletEventHandler<Extract<WalletConnectEvent, { type: T; }> | Extract<WalletDisconnectEvent, { type: T; }> | Extract<WalletAccountChangedEvent, { type: T; }> | Extract<WalletChainChangedEvent, { type: T; }> | Extract<WalletErrorEvent, { type: T; }>>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”off<
T>(event,handler):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8943
Unsubscribe from wallet events
Type Parameters
Section titled “Type Parameters”T extends WalletEventType
Parameters
Section titled “Parameters”T
handler
Section titled “handler”WalletEventHandler<Extract<WalletConnectEvent, { type: T; }> | Extract<WalletDisconnectEvent, { type: T; }> | Extract<WalletAccountChangedEvent, { type: T; }> | Extract<WalletChainChangedEvent, { type: T; }> | Extract<WalletErrorEvent, { type: T; }>>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”isConnected()
Section titled “isConnected()”isConnected():
boolean
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8973
Check if wallet is connected
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”getChainId()
Section titled “getChainId()”getChainId():
number
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9917
Get current chain ID
Returns
Section titled “Returns”number
getRpcEndpoint()
Section titled “getRpcEndpoint()”getRpcEndpoint():
string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9921
Get RPC endpoint URL
Returns
Section titled “Returns”string
setRpcEndpoint()
Section titled “setRpcEndpoint()”setRpcEndpoint(
endpoint):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9925
Set RPC endpoint URL
Parameters
Section titled “Parameters”endpoint
Section titled “endpoint”string
Returns
Section titled “Returns”void
connect()
Section titled “connect()”connect():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9929
Connect to Ethereum wallet
Returns
Section titled “Returns”Promise<void>
Overrides
Section titled “Overrides”disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9933
Disconnect from wallet
Returns
Section titled “Returns”Promise<void>
Overrides
Section titled “Overrides”signMessage()
Section titled “signMessage()”signMessage(
message):Promise<Signature>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9937
Sign a message
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
Returns
Section titled “Returns”Promise<Signature>
Overrides
Section titled “Overrides”signTypedData()
Section titled “signTypedData()”signTypedData(
typedData):Promise<Signature>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9941
Sign typed data (EIP-712)
Parameters
Section titled “Parameters”typedData
Section titled “typedData”Returns
Section titled “Returns”Promise<Signature>
signTransaction()
Section titled “signTransaction()”signTransaction(
tx):Promise<SignedTransaction>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9945
Sign a transaction without sending
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<SignedTransaction>
Overrides
Section titled “Overrides”BaseWalletAdapter.signTransaction
signAndSendTransaction()
Section titled “signAndSendTransaction()”signAndSendTransaction(
tx):Promise<TransactionReceipt>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9949
Sign and send a transaction
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<TransactionReceipt>
Overrides
Section titled “Overrides”BaseWalletAdapter.signAndSendTransaction
getBalance()
Section titled “getBalance()”getBalance():
Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9953
Get ETH balance
Returns
Section titled “Returns”Promise<bigint>
Overrides
Section titled “Overrides”getTokenBalance()
Section titled “getTokenBalance()”getTokenBalance(
asset):Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9957
Get ERC-20 token balance
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<bigint>
Overrides
Section titled “Overrides”BaseWalletAdapter.getTokenBalance
switchChain()
Section titled “switchChain()”switchChain(
chainId):Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9961
Switch to a different chain
Parameters
Section titled “Parameters”chainId
Section titled “chainId”number
Returns
Section titled “Returns”Promise<void>
waitForTransaction()
Section titled “waitForTransaction()”waitForTransaction(
txHash,confirmations?):Promise<EthereumTransactionReceipt>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9965
Wait for transaction confirmation
Parameters
Section titled “Parameters”txHash
Section titled “txHash”string
confirmations?
Section titled “confirmations?”number
Returns
Section titled “Returns”Promise<EthereumTransactionReceipt>