Skip to content

MockWalletAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / 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.

const mockWallet = new MockWalletAdapter({
chain: 'solana',
address: 'SoLaNaAddReSS...',
balance: 1000000000n, // 1 SOL
})
await mockWallet.connect()
const balance = await mockWallet.getBalance()

new MockWalletAdapter(options): MockWalletAdapter

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

ChainId

string

`0x${string}`

bigint

Record<string, bigint>

string

boolean

boolean

MockWalletAdapter

BaseWalletAdapter.constructor

readonly chain: ChainId

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

Chain this adapter connects to

BaseWalletAdapter.chain


readonly name: string

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

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


connect(): Promise<void>

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

Connect to the wallet

Promise<void>

If connection fails

BaseWalletAdapter.connect


disconnect(): Promise<void>

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

Disconnect from the wallet

Promise<void>

BaseWalletAdapter.disconnect


signMessage(message): Promise<Signature>

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

Sign an arbitrary message

Uint8Array

The message bytes to sign

Promise<Signature>

The signature

If signing fails or wallet not connected

BaseWalletAdapter.signMessage


signTransaction(tx): Promise<SignedTransaction>

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

Sign a transaction

UnsignedTransaction

The unsigned transaction

Promise<SignedTransaction>

The signed transaction

If signing fails or wallet not connected

BaseWalletAdapter.signTransaction


signAndSendTransaction(tx): Promise<TransactionReceipt>

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

Sign and broadcast a transaction

UnsignedTransaction

The unsigned transaction

Promise<TransactionReceipt>

The transaction receipt

If signing or broadcast fails

BaseWalletAdapter.signAndSendTransaction


getBalance(): Promise<bigint>

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

Get native token balance

Promise<bigint>

Balance in smallest unit (lamports, wei, etc.)

If query fails

BaseWalletAdapter.getBalance


getTokenBalance(asset): Promise<bigint>

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

Get token balance for a specific asset

Asset

The asset to query balance for

Promise<bigint>

Balance in smallest unit

If query fails or asset not supported

BaseWalletAdapter.getTokenBalance


setMockBalance(balance): void

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

Set mock balance (for testing)

bigint

void


setMockTokenBalance(asset, balance): void

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

Set mock token balance (for testing)

Asset

bigint

void


simulateAccountChange(newAddress): void

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

Simulate account change (for testing)

string

void