Skip to content

IWalletAdapter

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / IWalletAdapter

Defined in: @sip-protocol/types/dist/index.d.ts:2955

Core wallet adapter interface

Chain-agnostic interface that all wallet implementations must support. Provides basic wallet operations: connection, signing, and balance queries.

class SolanaWalletAdapter implements WalletAdapter {
readonly chain = 'solana'
async connect(): Promise<void> {
// Connect to Phantom, Solflare, etc.
}
async signMessage(message: Uint8Array): Promise<Signature> {
// Sign using connected wallet
}
}

readonly chain: ChainId

Defined in: @sip-protocol/types/dist/index.d.ts:2957

Chain this adapter connects to


readonly name: string

Defined in: @sip-protocol/types/dist/index.d.ts:2959

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


readonly address: string

Defined in: @sip-protocol/types/dist/index.d.ts:2961

Current address (empty string if not connected)


readonly publicKey: "" | `0x${string}`

Defined in: @sip-protocol/types/dist/index.d.ts:2963

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


readonly connectionState: WalletConnectionState

Defined in: @sip-protocol/types/dist/index.d.ts:2967

Current connection state

connect(): Promise<void>

Defined in: @sip-protocol/types/dist/index.d.ts:2973

Connect to the wallet

Promise<void>

If connection fails


disconnect(): Promise<void>

Defined in: @sip-protocol/types/dist/index.d.ts:2977

Disconnect from the wallet

Promise<void>


isConnected(): boolean

Defined in: @sip-protocol/types/dist/index.d.ts:2981

Check if wallet is connected

boolean


signMessage(message): Promise<Signature>

Defined in: @sip-protocol/types/dist/index.d.ts:2989

Sign an arbitrary message

Uint8Array

The message bytes to sign

Promise<Signature>

The signature

If signing fails or wallet not connected


signTransaction(tx): Promise<SignedTransaction>

Defined in: @sip-protocol/types/dist/index.d.ts:2997

Sign a transaction

UnsignedTransaction

The unsigned transaction

Promise<SignedTransaction>

The signed transaction

If signing fails or wallet not connected


signAndSendTransaction(tx): Promise<TransactionReceipt>

Defined in: @sip-protocol/types/dist/index.d.ts:3005

Sign and broadcast a transaction

UnsignedTransaction

The unsigned transaction

Promise<TransactionReceipt>

The transaction receipt

If signing or broadcast fails


getBalance(): Promise<bigint>

Defined in: @sip-protocol/types/dist/index.d.ts:3012

Get native token balance

Promise<bigint>

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

If query fails


getTokenBalance(asset): Promise<bigint>

Defined in: @sip-protocol/types/dist/index.d.ts:3020

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


on<T>(event, handler): void

Defined in: @sip-protocol/types/dist/index.d.ts:3027

Subscribe to wallet events

T extends WalletEventType

T

Event type to subscribe to

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

Event handler function

void


off<T>(event, handler): void

Defined in: @sip-protocol/types/dist/index.d.ts:3036

Unsubscribe from wallet events

T extends WalletEventType

T

Event type to unsubscribe from

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

Event handler to remove

void