MockWalletAdapter
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / MockWalletAdapter
Class: MockWalletAdapter
Section titled “Class: MockWalletAdapter”Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9016
Mock wallet adapter for testing
Provides a complete wallet implementation with mock data. Useful for testing and development without real wallet connections.
Example
Section titled “Example”const mockWallet = new MockWalletAdapter({ chain: 'solana', address: 'SoLaNaAddReSS...', balance: 1000000000n, // 1 SOL})
await mockWallet.connect()const balance = await mockWallet.getBalance()Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MockWalletAdapter(
options):MockWalletAdapter
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9025
Parameters
Section titled “Parameters”options
Section titled “options”address?
Section titled “address?”string
publicKey?
Section titled “publicKey?”`0x${string}`
balance?
Section titled “balance?”bigint
tokenBalances?
Section titled “tokenBalances?”Record<string, bigint>
string
shouldFailConnect?
Section titled “shouldFailConnect?”boolean
shouldFailSign?
Section titled “shouldFailSign?”boolean
Returns
Section titled “Returns”MockWalletAdapter
Overrides
Section titled “Overrides”Properties
Section titled “Properties”
readonlychain:ChainId
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9017
Chain this adapter connects to
Overrides
Section titled “Overrides”
readonlyname:string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9018
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”connect()
Section titled “connect()”connect():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9035
Connect to the wallet
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”If connection fails
Overrides
Section titled “Overrides”disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9036
Disconnect from the 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:9037
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
Overrides
Section titled “Overrides”signTransaction()
Section titled “signTransaction()”signTransaction(
tx):Promise<SignedTransaction>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9038
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
Overrides
Section titled “Overrides”BaseWalletAdapter.signTransaction
signAndSendTransaction()
Section titled “signAndSendTransaction()”signAndSendTransaction(
tx):Promise<TransactionReceipt>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9039
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
Overrides
Section titled “Overrides”BaseWalletAdapter.signAndSendTransaction
getBalance()
Section titled “getBalance()”getBalance():
Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9040
Get native token balance
Returns
Section titled “Returns”Promise<bigint>
Balance in smallest unit (lamports, wei, etc.)
Throws
Section titled “Throws”If query fails
Overrides
Section titled “Overrides”getTokenBalance()
Section titled “getTokenBalance()”getTokenBalance(
asset):Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9041
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
Overrides
Section titled “Overrides”BaseWalletAdapter.getTokenBalance
setMockBalance()
Section titled “setMockBalance()”setMockBalance(
balance):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9045
Set mock balance (for testing)
Parameters
Section titled “Parameters”balance
Section titled “balance”bigint
Returns
Section titled “Returns”void
setMockTokenBalance()
Section titled “setMockTokenBalance()”setMockTokenBalance(
asset,balance):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9049
Set mock token balance (for testing)
Parameters
Section titled “Parameters”balance
Section titled “balance”bigint
Returns
Section titled “Returns”void
simulateAccountChange()
Section titled “simulateAccountChange()”simulateAccountChange(
newAddress):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:9053
Simulate account change (for testing)
Parameters
Section titled “Parameters”newAddress
Section titled “newAddress”string
Returns
Section titled “Returns”void