Accounts
| Account | Writable | Signer | Description |
|---|---|---|---|
payer | ✓ | ✓ | Fee payer for the transaction |
user | ✓ | Token owner making the deposit | |
instance | Escrow instance PDA | ||
mint | SPL token mint | ||
allowed_mint | PDA verifying the mint is permitted on this instance | ||
user_ata | ✓ | User’s associated token account (source) | |
instance_ata | ✓ | Escrow’s associated token account (destination) | |
system_program | System Program | ||
token_program | SPL Token Program | ||
associated_token_program | Associated Token Program | ||
event_authority | Event authority PDA for EmitEvent CPI | ||
private_channel_escrow_program | Escrow Program (self-reference for CPI) |
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | u64 | Amount of tokens to deposit, in the token’s smallest unit |
recipient | Option<Pubkey> | Optional onchain recipient; if None, credits the depositing user’s channel balance |
Returns
Returns aTransactionBuilder that can be used to build and send the
transaction.
Example
Important Notes
- Program ID:
9tgHa1DcnaSSUtmMsst8ovKTe1Gfxzezn27KnH9xXYeU - For Token-2022 mints, pass
tokenProgram: TOKEN_2022_PROGRAM_ADDRESSexplicitly, since it defaults to the standard SPL Token Program - The
allowed_mintPDA must exist (created byAllowMint); depositing an unlisted mint throwsInvalidAllowedMint - When
recipientisNone, the depositing user’s channel balance is credited; when provided, the specified wallet’s balance is credited instead - Both
payerandusermust sign the transaction - The
instance_atamust already exist (created byAllowMintfor this mint)