CSPLClient
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / CSPLClient
Class: CSPLClient
Section titled “Class: CSPLClient”Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21090
Implements
Section titled “Implements”ICSPLClient
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CSPLClient(
config?):CSPLClient
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21101
Create a new C-SPL client
Parameters
Section titled “Parameters”config?
Section titled “config?”Client configuration
Returns
Section titled “Returns”CSPLClient
Methods
Section titled “Methods”connect()
Section titled “connect()”connect(
rpcUrl?):Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21105
Initialize connection to Solana
Parameters
Section titled “Parameters”rpcUrl?
Section titled “rpcUrl?”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”ICSPLClient.connect
disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21109
Disconnect from Solana
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”ICSPLClient.disconnect
isConnected()
Section titled “isConnected()”isConnected():
boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21113
Check if client is connected
Returns
Section titled “Returns”boolean
getOrCreateAccount()
Section titled “getOrCreateAccount()”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.
Parameters
Section titled “Parameters”string
Account owner address
CSPLToken
C-SPL token configuration
Returns
Section titled “Returns”Promise<ConfidentialTokenAccount>
Confidential token account
Implementation of
Section titled “Implementation of”ICSPLClient.getOrCreateAccount
getBalance()
Section titled “getBalance()”getBalance(
owner,token):Promise<ConfidentialBalance>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21131
Get confidential balance for an account
Parameters
Section titled “Parameters”string
Account owner address
CSPLToken
C-SPL token configuration
Returns
Section titled “Returns”Promise<ConfidentialBalance>
Confidential balance
Implementation of
Section titled “Implementation of”ICSPLClient.getBalance
wrapToken()
Section titled “wrapToken()”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.
Parameters
Section titled “Parameters”params
Section titled “params”WrapTokenParams
Wrap parameters
Returns
Section titled “Returns”Promise<WrapTokenResult>
Wrap result
Implementation of
Section titled “Implementation of”ICSPLClient.wrapToken
unwrapToken()
Section titled “unwrapToken()”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.
Parameters
Section titled “Parameters”params
Section titled “params”UnwrapTokenParams
Unwrap parameters
Returns
Section titled “Returns”Promise<UnwrapTokenResult>
Unwrap result
Implementation of
Section titled “Implementation of”ICSPLClient.unwrapToken
transfer()
Section titled “transfer()”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.
Parameters
Section titled “Parameters”params
Section titled “params”ConfidentialTransferParams
Transfer parameters
Returns
Section titled “Returns”Promise<ConfidentialTransferResult>
Transfer result
Implementation of
Section titled “Implementation of”ICSPLClient.transfer
encryptAmount()
Section titled “encryptAmount()”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.
Parameters
Section titled “Parameters”params
Section titled “params”CSPLEncryptionParams
Encryption parameters
Returns
Section titled “Returns”Promise<EncryptedAmount>
Encrypted amount
Implementation of
Section titled “Implementation of”ICSPLClient.encryptAmount
decryptAmount()
Section titled “decryptAmount()”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.
Parameters
Section titled “Parameters”params
Section titled “params”CSPLDecryptionParams
Decryption parameters
Returns
Section titled “Returns”Promise<bigint>
Decrypted amount
Implementation of
Section titled “Implementation of”ICSPLClient.decryptAmount
applyPendingBalance()
Section titled “applyPendingBalance()”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.
Parameters
Section titled “Parameters”string
Account owner
CSPLToken
C-SPL token
Returns
Section titled “Returns”Promise<ConfidentialTransferResult>
Transfer result
Implementation of
Section titled “Implementation of”ICSPLClient.applyPendingBalance
getKnownToken()
Section titled “getKnownToken()”getKnownToken(
symbol):Partial<CSPLToken> |undefined
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21193
Get token configuration for a known mint
Parameters
Section titled “Parameters”symbol
Section titled “symbol”string
Token symbol (e.g., ‘C-USDC’)
Returns
Section titled “Returns”Partial<CSPLToken> | undefined
Token configuration or undefined
listKnownTokens()
Section titled “listKnownTokens()”listKnownTokens():
string[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21197
List all known C-SPL tokens
Returns
Section titled “Returns”string[]
estimateCost()
Section titled “estimateCost()”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.
Parameters
Section titled “Parameters”operation
Section titled “operation”Operation type
"transfer" | "createAccount" | "wrap" | "unwrap" | "applyPending"
Returns
Section titled “Returns”Promise<bigint>
Estimated cost in lamports
estimateTime()
Section titled “estimateTime()”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.
Parameters
Section titled “Parameters”operation
Section titled “operation”Operation type
"transfer" | "swap" | "wrap" | "unwrap"
Returns
Section titled “Returns”Promise<number>
Estimated time in milliseconds
getConfig()
Section titled “getConfig()”getConfig():
Readonly<CSPLClientConfig>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21221
Get current configuration (deeply frozen copy)
Returns
Section titled “Returns”Readonly<CSPLClientConfig>
getProgramIds()
Section titled “getProgramIds()”getProgramIds():
object
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21225
Get program IDs
Returns
Section titled “Returns”TOKEN_PROGRAM
Section titled “TOKEN_PROGRAM”
readonlyTOKEN_PROGRAM:"PLACEHLDRCSPLTokenProgram111111111111111111"
C-SPL token program (PLACEHOLDER - TBD)
ATA_PROGRAM
Section titled “ATA_PROGRAM”
readonlyATA_PROGRAM:"PLACEHLDRCSPLAtaProgram1111111111111111111"
C-SPL associated token account program (PLACEHOLDER - TBD)
CONFIDENTIAL_TRANSFER
Section titled “CONFIDENTIAL_TRANSFER”
readonlyCONFIDENTIAL_TRANSFER:"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
Confidential transfer extension (REAL Solana Token-2022 program)
clearCache()
Section titled “clearCache()”clearCache():
void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21257
Clear all caches
Returns
Section titled “Returns”void
getCacheStats()
Section titled “getCacheStats()”getCacheStats():
object
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21263
Get cache entry counts (backward compatible)
Returns
Section titled “Returns”object
Number of entries in each cache
accounts
Section titled “accounts”accounts:
number
balances
Section titled “balances”balances:
number
getDetailedCacheStats()
Section titled “getDetailedCacheStats()”getDetailedCacheStats():
CSPLCacheStats
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21272
Get detailed cache statistics including LRU metrics
Returns
Section titled “Returns”CSPLCacheStats
Detailed cache stats with hit rates and eviction counts
getCacheConfig()
Section titled “getCacheConfig()”getCacheConfig():
Readonly<CSPLCacheConfig>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21278
Get cache configuration
Returns
Section titled “Returns”Readonly<CSPLCacheConfig>
Current cache configuration
pruneExpiredCache()
Section titled “pruneExpiredCache()”pruneExpiredCache():
object
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:21284
Prune expired entries from all caches
Returns
Section titled “Returns”object
Number of entries pruned from each cache
accounts
Section titled “accounts”accounts:
number
balances
Section titled “balances”balances:
number