Skip to content
API reference

Balances, history and sync

The three functions that bring the device up to date and read the private balance and past payments from it.

The private balance and its history live on the user's device. A sync brings them up to date, and the reads return what it left. Balances, History and Sync walk through each.

readBalances

Use it whenever you show the private balance. It is cheap enough to call after every sync.

function readBalances(
  session: NimbusSession,
  _args?: Readonly<Record<string, never>>,
  options?: { readonly zone?: number },
): Promise<readonly Balance[]>;

Types used: NimbusSession, Balance

Example

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

declare const : NimbusSession;
const  = await (, {});
const  = .(() => . === "available");

Parameters

Prop

Type

Returns

Promise<readonly Balance[]>

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

readHistory

Use it to show the user's past payments, one page at a time.

function readHistory(
  session: NimbusSession,
  _args?: Readonly<Record<string, never>>,
  options?: { readonly limit?: number; readonly after?: HistoryPosition },
): Promise<HistoryPage>;

Types used: NimbusSession, HistoryPosition, HistoryPage

Example

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

declare const : NimbusSession;
const  = await (, {}, { : 10 });
if (.. === "more") {
  await (, {}, { : .., : 10 });
}

Parameters

Prop

Type

Returns

Promise<HistoryPage>

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

syncNoteStore

Use it before you read the balance or history, and on a timer while your app is open.

function syncNoteStore(
  session: NimbusSession,
  _args?: Readonly<Record<string, never>>,
  options?: SyncNoteStoreOptions,
): Promise<NoteStoreSyncResult>;

Types used: NimbusSession, SyncNoteStoreOptions, NoteStoreSyncResult

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

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

Last updated

On this page