Skip to content
API reference

Deposit

The four functions a deposit uses, from creating its context to refunding what an older wallet left behind.

A deposit runs in a context made from the session. Deposit walks through the flow, and Pending and stranded deposits covers what can be left over.

createDepositContext

Create one from the session before you deposit. resolvePendingDeposit and refundStrandedDeposit take the same kind of context.

function createDepositContext(
  session: NimbusSession,
  options?: NimbusContextOptions,
): Promise<DepositContext>;

Types used: NimbusSession, NimbusContextOptions, DepositContext

Example

import {  } from "@umbra/nimbus-solana-web";
import type { NimbusSession } from "@umbra/nimbus-solana-web";

declare const : NimbusSession;
const  = await (, { : 1 });

Parameters

Prop

Type

Returns

Promise<DepositContext>

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

deposit

Use it to move tokens from the connected wallet into a private balance, the user's own or another registered user's.

function deposit(
  context: DepositContext,
  args: {
    readonly mint: Address;
    readonly amount: bigint;
    readonly recipient: Address;
  },
  options?: DepositOptions,
): Promise<DepositResult>;

Types used: DepositContext, DepositOptions, DepositResult

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 (), {
  : 1_000_000n,
  ,
  : .,
});

Parameters

Prop

Type

Returns

Promise<DepositResult>

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

resolvePendingDeposit

Use it when a deposit's submission came back unknown, to learn whether it landed.

function resolvePendingDeposit(
  context: DepositContext,
  args: { readonly submission: DepositSubmission },
  _options?: Readonly<Record<string, never>>,
): Promise<PendingDepositResolutionResult>;

Types used: DepositContext, DepositSubmission, PendingDepositResolutionResult

Example

import {  } from "@umbra/nimbus-solana-web";
import type { DepositContext,  } from "@umbra/nimbus-solana-web";

declare const : DepositContext;
declare const : ;
if (. === "submitted" && ... === "unknown") {
  await (, { : . });
}

Parameters

Prop

Type

Returns

Promise<PendingDepositResolutionResult>

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

refundStrandedDeposit

Use it to return funds a version 0 deposit left halfway, once every deposit of that token has settled.

function refundStrandedDeposit(
  context: DepositContext,
  args: { readonly mint: Address },
  options?: StrandedDepositRefundOptions,
): Promise<StrandedDepositRefundResult>;

Types used: DepositContext, StrandedDepositRefundOptions, StrandedDepositRefundResult

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 (), {  });

Parameters

Prop

Type

Returns

Promise<StrandedDepositRefundResult>

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

Last updated

On this page