Skip to content

Abstract Class: BaseWalletAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / BaseWalletAdapter

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

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-BYZbDjal.d.ts:8925

Chain this adapter connects to

IWalletAdapter.chain


abstract readonly name: string

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

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

IWalletAdapter.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)

IWalletAdapter.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)

IWalletAdapter.publicKey


get connectionState(): WalletConnectionState

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

Current connection state

WalletConnectionState

Current connection state

IWalletAdapter.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

IWalletAdapter.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

IWalletAdapter.off


isConnected(): boolean

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

Check if wallet is connected

boolean

IWalletAdapter.isConnected


abstract connect(): Promise<void>

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

Connect to the wallet

Promise<void>

If connection fails

IWalletAdapter.connect


abstract disconnect(): Promise<void>

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

Disconnect from the wallet

Promise<void>

IWalletAdapter.disconnect


abstract signMessage(message): Promise<Signature>

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

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-BYZbDjal.d.ts:8993

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-BYZbDjal.d.ts:8994

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-BYZbDjal.d.ts:8995

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-BYZbDjal.d.ts:8996

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