Abstract Class: BaseWalletAdapter
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / BaseWalletAdapter
Abstract Class: BaseWalletAdapter
Section titled “Abstract Class: BaseWalletAdapter”Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8924
Abstract base class for wallet adapters
Provides:
- Event emitter infrastructure
- Connection state management
- Common validation logic
Subclasses must implement:
- connect() / disconnect()
- signMessage() / signTransaction() / signAndSendTransaction()
- getBalance() / getTokenBalance()
Example
Section titled “Example”class MyWalletAdapter extends BaseWalletAdapter { readonly chain = 'solana' readonly name = 'my-wallet'
async connect(): Promise<void> { // Implementation }
// ... other required methods}Extended by
Section titled “Extended by”EthereumWalletAdapterLedgerWalletAdapterMockEthereumAdapterMockLedgerAdapterMockSolanaAdapterMockTrezorAdapterMockWalletAdapterSolanaWalletAdapterTrezorWalletAdapter
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BaseWalletAdapter():
BaseWalletAdapter
Returns
Section titled “Returns”BaseWalletAdapter
Properties
Section titled “Properties”
abstractreadonlychain:ChainId
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8925
Chain this adapter connects to
Implementation of
Section titled “Implementation of”
abstractreadonlyname:string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8926
Wallet name/identifier (e.g., ‘phantom’, ‘metamask’)
Implementation of
Section titled “Implementation of”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)
Implementation of
Section titled “Implementation of”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)
Implementation of
Section titled “Implementation of”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
Implementation of
Section titled “Implementation of”IWalletAdapter.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
Implementation of
Section titled “Implementation of”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
Implementation of
Section titled “Implementation of”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
Implementation of
Section titled “Implementation of”connect()
Section titled “connect()”
abstractconnect():Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8990
Connect to the wallet
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”If connection fails
Implementation of
Section titled “Implementation of”disconnect()
Section titled “disconnect()”
abstractdisconnect():Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8991
Disconnect from the wallet
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”signMessage()
Section titled “signMessage()”
abstractsignMessage(message):Promise<Signature>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8992
Sign an arbitrary message
Parameters
Section titled “Parameters”message
Section titled “message”Uint8Array
The message bytes to sign
Returns
Section titled “Returns”Promise<Signature>
The signature
Throws
Section titled “Throws”If signing fails or wallet not connected
Implementation of
Section titled “Implementation of”signTransaction()
Section titled “signTransaction()”
abstractsignTransaction(tx):Promise<SignedTransaction>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8993
Sign a transaction
Parameters
Section titled “Parameters”The unsigned transaction
Returns
Section titled “Returns”Promise<SignedTransaction>
The signed transaction
Throws
Section titled “Throws”If signing fails or wallet not connected
Implementation of
Section titled “Implementation of”IWalletAdapter.signTransaction
signAndSendTransaction()
Section titled “signAndSendTransaction()”
abstractsignAndSendTransaction(tx):Promise<TransactionReceipt>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8994
Sign and broadcast a transaction
Parameters
Section titled “Parameters”The unsigned transaction
Returns
Section titled “Returns”Promise<TransactionReceipt>
The transaction receipt
Throws
Section titled “Throws”If signing or broadcast fails
Implementation of
Section titled “Implementation of”IWalletAdapter.signAndSendTransaction
getBalance()
Section titled “getBalance()”
abstractgetBalance():Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8995
Get native token balance
Returns
Section titled “Returns”Promise<bigint>
Balance in smallest unit (lamports, wei, etc.)
Throws
Section titled “Throws”If query fails
Implementation of
Section titled “Implementation of”getTokenBalance()
Section titled “getTokenBalance()”
abstractgetTokenBalance(asset):Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:8996
Get token balance for a specific asset
Parameters
Section titled “Parameters”The asset to query balance for
Returns
Section titled “Returns”Promise<bigint>
Balance in smallest unit
Throws
Section titled “Throws”If query fails or asset not supported