Skip to content
API reference

Withdraw

The two functions a withdrawal uses, its context and the withdrawal itself.

A withdrawal runs in a context made from the session. Withdraw walks through the flow.

createWithdrawalContext

Create one from the session before a withdrawal. It picks the pool the withdrawal spends from.

function createWithdrawalContext(
  session: NimbusSession,
  options?: NimbusContextOptions,
): Promise<WithdrawalContext>;

Types used: NimbusSession, NimbusContextOptions, WithdrawalContext

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<WithdrawalContext>

Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/contexts.ts.

withdraw

Use it to move tokens out of the private balance to any Solana address.

function withdraw(
  context: WithdrawalContext,
  args: {
    readonly mint: Address;
    readonly amount: bigint;
    readonly recipient: Address;
  },
  options?: WithdrawOptions,
): Promise<WithdrawalResult>;

Types used: WithdrawalContext, WithdrawOptions, WithdrawalResult

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 : ;
const  = await (await (), {
  : 500_000n,
  ,
  : .,
});

Parameters

Prop

Type

Returns

Promise<WithdrawalResult>

Generated from the TSDoc in sdks/typescript/nimbus-solana-web/src/flows.ts.

Last updated

On this page