Skip to content

IWalletAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / IWalletAdapter

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

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:2617

Chain this adapter connects to


readonly name: string

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

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


readonly address: string

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

Current address (empty string if not connected)


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

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

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


readonly connectionState: WalletConnectionState

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

Current connection state

connect(): Promise<void>

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

Connect to the wallet

Promise<void>

If connection fails


disconnect(): Promise<void>

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

Disconnect from the wallet

Promise<void>


isConnected(): boolean

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

Check if wallet is connected

boolean


signMessage(message): Promise<Signature>

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

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:2657

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:2665

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:2672

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:2680

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:2687

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:2696

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