Skip to content

CSPLClient

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / CSPLClient

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

  • ICSPLClient

new CSPLClient(config?): CSPLClient

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

Create a new C-SPL client

CSPLClientConfig

Client configuration

CSPLClient

connect(rpcUrl?): Promise<void>

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

Initialize connection to Solana

string

Promise<void>

ICSPLClient.connect


disconnect(): Promise<void>

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

Disconnect from Solana

Promise<void>

ICSPLClient.disconnect


isConnected(): boolean

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

Check if client is connected

boolean


getOrCreateAccount(owner, token): Promise<ConfidentialTokenAccount>

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

Get or create a confidential token account

Creates the account automatically if it doesn’t exist.

string

Account owner address

CSPLToken

C-SPL token configuration

Promise<ConfidentialTokenAccount>

Confidential token account

ICSPLClient.getOrCreateAccount


getBalance(owner, token): Promise<ConfidentialBalance>

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

Get confidential balance for an account

string

Account owner address

CSPLToken

C-SPL token configuration

Promise<ConfidentialBalance>

Confidential balance

ICSPLClient.getBalance


wrapToken(params): Promise<WrapTokenResult>

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

Wrap SPL tokens to C-SPL

Converts regular SPL tokens to their confidential version.

WrapTokenParams

Wrap parameters

Promise<WrapTokenResult>

Wrap result

ICSPLClient.wrapToken


unwrapToken(params): Promise<UnwrapTokenResult>

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

Unwrap C-SPL back to regular SPL tokens

Converts confidential tokens back to their public version.

UnwrapTokenParams

Unwrap parameters

Promise<UnwrapTokenResult>

Unwrap result

ICSPLClient.unwrapToken


transfer(params): Promise<ConfidentialTransferResult>

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

Execute a confidential transfer

Transfers C-SPL tokens with encrypted amounts.

ConfidentialTransferParams

Transfer parameters

Promise<ConfidentialTransferResult>

Transfer result

ICSPLClient.transfer


encryptAmount(params): Promise<EncryptedAmount>

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

Encrypt an amount for transfer

Uses Twisted ElGamal or AES-GCM depending on configuration.

CSPLEncryptionParams

Encryption parameters

Promise<EncryptedAmount>

Encrypted amount

ICSPLClient.encryptAmount


decryptAmount(params): Promise<bigint>

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

Decrypt an encrypted amount

Only the account owner can decrypt their balance.

CSPLDecryptionParams

Decryption parameters

Promise<bigint>

Decrypted amount

ICSPLClient.decryptAmount


applyPendingBalance(owner, token): Promise<ConfidentialTransferResult>

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

Apply pending balance to available balance

Required after receiving transfers to make funds spendable.

string

Account owner

CSPLToken

C-SPL token

Promise<ConfidentialTransferResult>

Transfer result

ICSPLClient.applyPendingBalance


getKnownToken(symbol): Partial<CSPLToken> | undefined

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

Get token configuration for a known mint

string

Token symbol (e.g., ‘C-USDC’)

Partial<CSPLToken> | undefined

Token configuration or undefined


listKnownTokens(): string[]

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

List all known C-SPL tokens

string[]


estimateCost(operation): Promise<bigint>

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

Estimate cost for an operation

Returns the estimated cost in lamports. Made async for consistency with other privacy backend cost estimation methods.

Operation type

"transfer" | "createAccount" | "wrap" | "unwrap" | "applyPending"

Promise<bigint>

Estimated cost in lamports


estimateTime(operation): Promise<number>

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

Estimate time for an operation

Returns the estimated time in milliseconds. Made async for consistency with other privacy backend estimation methods.

Operation type

"transfer" | "swap" | "wrap" | "unwrap"

Promise<number>

Estimated time in milliseconds


getConfig(): Readonly<CSPLClientConfig>

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

Get current configuration (deeply frozen copy)

Readonly<CSPLClientConfig>


getProgramIds(): object

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

Get program IDs

readonly TOKEN_PROGRAM: "PLACEHLDRCSPLTokenProgram111111111111111111"

C-SPL token program (PLACEHOLDER - TBD)

readonly ATA_PROGRAM: "PLACEHLDRCSPLAtaProgram1111111111111111111"

C-SPL associated token account program (PLACEHOLDER - TBD)

readonly CONFIDENTIAL_TRANSFER: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"

Confidential transfer extension (REAL Solana Token-2022 program)


clearCache(): void

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

Clear all caches

void


getCacheStats(): object

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

Get cache entry counts (backward compatible)

object

Number of entries in each cache

accounts: number

balances: number


getDetailedCacheStats(): CSPLCacheStats

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

Get detailed cache statistics including LRU metrics

CSPLCacheStats

Detailed cache stats with hit rates and eviction counts


getCacheConfig(): Readonly<CSPLCacheConfig>

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

Get cache configuration

Readonly<CSPLCacheConfig>

Current cache configuration


pruneExpiredCache(): object

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

Prune expired entries from all caches

object

Number of entries pruned from each cache

accounts: number

balances: number