Skip to content

Abstract Class: BaseWalletAdapter

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / BaseWalletAdapter

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12522

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()
class MyWalletAdapter extends BaseWalletAdapter {
readonly chain = 'solana'
readonly name = 'my-wallet'
async connect(): Promise<void> {
// Implementation
}
// ... other required methods
}

new BaseWalletAdapter(): BaseWalletAdapter

BaseWalletAdapter

abstract readonly chain: ChainId

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12523

Chain this adapter connects to

IWalletAdapter.chain


abstract readonly name: string

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12524

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

IWalletAdapter.name

get address(): string

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12528

Current address (empty string if not connected)

string

Current address (empty string if not connected)

IWalletAdapter.address


get publicKey(): "" | `0x${string}`

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12529

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

"" | `0x${string}`

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

IWalletAdapter.publicKey


get connectionState(): WalletConnectionState

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12530

Current connection state

WalletConnectionState

Current connection state

IWalletAdapter.connectionState

on<T>(event, handler): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12535

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

IWalletAdapter.on


off<T>(event, handler): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12541

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

IWalletAdapter.off


isConnected(): boolean

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12571

Check if wallet is connected

boolean

IWalletAdapter.isConnected


abstract connect(): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12588

Connect to the wallet

Promise<void>

If connection fails

IWalletAdapter.connect


abstract disconnect(): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12589

Disconnect from the wallet

Promise<void>

IWalletAdapter.disconnect


abstract signMessage(message): Promise<Signature>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12590

Sign an arbitrary message

Uint8Array

The message bytes to sign

Promise<Signature>

The signature

If signing fails or wallet not connected

IWalletAdapter.signMessage


abstract signTransaction(tx): Promise<SignedTransaction>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12591

Sign a transaction

UnsignedTransaction

The unsigned transaction

Promise<SignedTransaction>

The signed transaction

If signing fails or wallet not connected

IWalletAdapter.signTransaction


abstract signAndSendTransaction(tx): Promise<TransactionReceipt>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12592

Sign and broadcast a transaction

UnsignedTransaction

The unsigned transaction

Promise<TransactionReceipt>

The transaction receipt

If signing or broadcast fails

IWalletAdapter.signAndSendTransaction


abstract getBalance(): Promise<bigint>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12593

Get native token balance

Promise<bigint>

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

If query fails

IWalletAdapter.getBalance


abstract getTokenBalance(asset): Promise<bigint>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:12594

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

IWalletAdapter.getTokenBalance