Transfer
The two functions a Private Send uses, its context and the payment itself.
A Private Send runs in a context made from the session. Private Send walks through the flow.
createTransferContext
Create one from the session before a Private Send. It picks the pool the payment uses.
function createTransferContext(
session: NimbusSession,
options?: NimbusContextOptions,
): Promise<TransferContext>;Types used: NimbusSession, NimbusContextOptions, TransferContext
Example
import { } from "@umbra/nimbus-solana-web";
import type { NimbusSession } from "@umbra/nimbus-solana-web";
declare const : NimbusSession;
const = await ();Parameters
Prop
Type
Returns
Promise<TransferContext>
The context.
NimbusSdkError with reason "misconfigured" when an option is out of range or no
pool is open; "service-unavailable" or "unreadable" when the RPC cannot be read.
Creates the context a session transfers in.
Without options.poolIndex the pools' accounts are read from the RPC once, and the highest open
pool is chosen; the nodes and guardian cluster default to the cluster's preset.
Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/contexts.ts.
transfer
Use it to pay another registered user from the private balance, so the tokens arrive in theirs.
function transfer(
context: TransferContext,
args: {
readonly mint: Address;
readonly amount: bigint;
readonly recipient: Address;
},
options?: TransferOptions,
): Promise<TransferResult>;Types used: TransferContext, TransferOptions, TransferResult
Example
import { , } from "@umbra/nimbus-solana-web";
import type { NimbusSession } from "@umbra/nimbus-solana-web";
import type { } from "@solana/kit";
declare const : NimbusSession;
declare const : ;
declare const : ;
const = await (await (), {
: 250_000n,
,
: ,
});Parameters
Prop
Type
Returns
Promise<TransferResult>
As withdraw returns, the payee's note known made once the settlement is
landed.
NimbusSdkError as withdraw throws, and with reason
"recipient-unregistered" when the context API answers that recipient has no registration in
the pool; NimbusSolanaFlowError when the protocol refuses the transfer.
Transfers amount of mint from the session's notes in the context's pool to recipient, a
registered identity's wallet address, as a note sealed to its identity, through the relayer.
The context API resolves the recipient to its identity; a wallet that has not registered is
refused with reason "recipient-unregistered" before any note is merged or anything relayed.
Syncs first, spends, and follows the relay as withdraw does, merging notes first when it
must.
Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/flows.ts.
Last updated