deposit()
deposit() is a function from privacycash/utils used to deposit SOL into the PrivacyCash protocol.
Parameters
Thedeposit() function takes a single configuration object with the following properties:
| Parameter | Type | Description |
|---|---|---|
lightWasm | any | The Poseidon hasher instance (usually from @lightprotocol/hasher.rs). |
connection | Connection | Solana web3 connection object. |
amount_in_lamports | number | The amount of SOL to deposit, specified in lamports. |
keyBasePath | string | The base path for loading circuit zkeys (e.g., '/circuit2'). |
publicKey | PublicKey | The user’s Solana public key. |
transactionSigner | Function | A callback function to sign the generated transaction: (tx: VersionedTransaction) => Promise<VersionedTransaction>. |
storage | Storage | A storage object that implements the Web Storage API (e.g., localStorage). |
encryptionService | EncryptionService | An instance of the EncryptionService used for encrypting UTXO data. |
referrer | string | (Optional) The Solana address of the referrer. |
Example Usage
depositSPL()
depositSPL() is used to deposit SPL tokens (like USDC) into the PrivacyCash protocol.
Parameters
ThedepositSPL() function takes a configuration object with the following properties:
| Parameter | Type | Description |
|---|---|---|
mintAddress | PublicKey | The mint address of the SPL token to deposit. |
base_units | number | The amount of tokens to deposit, specified in base units (e.g., amount * 10^decimals). |
lightWasm | any | The Poseidon hasher instance. |
connection | Connection | Solana web3 connection object. |
keyBasePath | string | The base path for loading circuit zkeys (e.g., '/circuit2'). |
publicKey | PublicKey | The user’s Solana public key. |
transactionSigner | Function | A callback function to sign the generated transaction. |
storage | Storage | A storage object (e.g., localStorage). |
encryptionService | EncryptionService | An instance of the EncryptionService. |
referrer | string | (Optional) The Solana address of the referrer. |
