Skip to content

PrivateWalletAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / PrivateWalletAdapter

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

Privacy-enhanced wallet adapter

Extends WalletAdapter with privacy features:

  • Stealth address generation and scanning
  • Viewing key export for compliance
  • Shielded transaction support
class ZcashPrivateWallet implements PrivateWalletAdapter {
// ... WalletAdapter methods ...
getStealthMetaAddress(): StealthMetaAddress {
return this.stealthMeta
}
async shieldedSend(params: ShieldedSendParams): Promise<ShieldedSendResult> {
// Use Zcash shielded pool
}
}

readonly chain: ChainId

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

Chain this adapter connects to

IWalletAdapter.chain


readonly name: string

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

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

IWalletAdapter.name


readonly address: string

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

Current address (empty string if not connected)

IWalletAdapter.address


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

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

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

IWalletAdapter.publicKey


readonly connectionState: WalletConnectionState

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

Current connection state

IWalletAdapter.connectionState

connect(): Promise<void>

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

Connect to the wallet

Promise<void>

If connection fails

IWalletAdapter.connect


disconnect(): Promise<void>

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

Disconnect from the wallet

Promise<void>

IWalletAdapter.disconnect


isConnected(): boolean

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

Check if wallet is connected

boolean

IWalletAdapter.isConnected


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

IWalletAdapter.signMessage


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

IWalletAdapter.signTransaction


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

IWalletAdapter.signAndSendTransaction


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

IWalletAdapter.getBalance


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

IWalletAdapter.getTokenBalance


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

IWalletAdapter.on


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

IWalletAdapter.off


supportsStealthAddresses(): boolean

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

Check if wallet supports stealth addresses

boolean


getStealthMetaAddress(): StealthMetaAddress

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

Get the stealth meta-address for receiving private payments

The meta-address contains spending and viewing public keys that senders use to derive one-time stealth addresses.

StealthMetaAddress

The stealth meta-address

If stealth addresses not supported


deriveStealthAddress(ephemeralPubKey): StealthAddress

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

Generate a one-time stealth address from an ephemeral public key

Used by senders to derive a unique receiving address.

`0x${string}`

Sender’s ephemeral public key

StealthAddress

The derived stealth address


checkStealthAddress(stealthAddress, ephemeralPubKey): boolean

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

Check if a stealth address belongs to this wallet

`0x${string}`

The address to check

`0x${string}`

The ephemeral public key used

boolean

True if this wallet can spend from the address


scanStealthPayments(fromBlock?, toBlock?): Promise<object[]>

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

Scan for received stealth payments

Scans announcements/transactions to find payments to this wallet’s stealth addresses.

bigint

Optional starting block

bigint

Optional ending block

Promise<object[]>

Array of detected stealth addresses with amounts


supportsViewingKeys(): boolean

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

Check if wallet supports viewing key export

boolean


exportViewingKey(): ViewingKey

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

Export viewing key for selective disclosure

Allows third parties (auditors, regulators) to view transaction details without spending capability.

ViewingKey

The viewing key

If viewing keys not supported


supportsShieldedTransactions(): boolean

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

Check if wallet supports shielded transactions

boolean


getShieldedBalance(): Promise<bigint>

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

Get shielded balance (in shielded pools, if applicable)

Promise<bigint>

Shielded balance in smallest unit


shieldedSend(params): Promise<WalletShieldedSendResult>

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

Send tokens with maximum privacy

Uses shielded pools and/or stealth addresses depending on the target chain’s capabilities.

WalletShieldedSendParams

Shielded send parameters

Promise<WalletShieldedSendResult>

The transaction result

If shielded send fails