@okcontract/sdk
Version:
One-stop-shop permissionless SDK for building any blockchain frontend
57 lines (56 loc) • 2.33 kB
TypeScript
import type { TransactionReceipt } from "viem";
import { type AnyCell, type Cellified, type MapCell } from "@okcontract/cells";
import { type OKWidgetStepType } from "@okcontract/coredata";
import { type Environment, type ValueDefinition } from "@okcontract/lambdascript";
import type { OKPage } from "./instance";
import { type AnyContractQuery, OKContractManager } from "./okcontract";
import { OKTransaction } from "./oktransaction";
import type { Step, TXRequest } from "./steps";
import type { SentTransaction } from "./tx";
type FlattenedStep = {
okTX: OKTransaction<AnyContractQuery>;
idx: [number, number];
};
export declare class Stepper {
private _instance;
private core;
private proxy;
private allowance;
private _okc;
/** stepper cursor (can trigger cursor changes manually) */
/** cursor position in flatSteps */
readonly doneCursor: MapCell<number, true>;
/** stepper cursor */
readonly cursor: AnyCell<[number, number]>;
/** the list of OKTransaction steps */
readonly steps: MapCell<MapCell<OKTransaction<AnyContractQuery>[], boolean>[], boolean>;
/** the flatten list of OKTransaction */
readonly flatSteps: MapCell<FlattenedStep[], boolean>;
/** current step */
readonly current: AnyCell<OKTransaction<AnyContractQuery>>;
/** if a tx is currently processing */
readonly isSending: MapCell<number, true>;
/** check if the current step is the last */
readonly isLastStep: AnyCell<boolean>;
/** check if the current sent TX is the last */
readonly isLastTX: MapCell<boolean, true>;
/** if steps are all done */
readonly isDone: MapCell<boolean, boolean>;
/** the transaction requests */
readonly txr: MapCell<AnyCell<TXRequest>[], false>;
/** the desired chain */
/** env of the current step */
readonly env: MapCell<Environment, false>;
/** all receipts */
readonly receipts: MapCell<TransactionReceipt[][], false>;
/** list of sent transactions */
readonly sentTXs: MapCell<SentTransaction[][], false>;
constructor(instance: OKPage, okSteps: Cellified<Step<OKWidgetStepType>[]>, options?: {
extraEnv?: ValueDefinition[];
forceTXGeneration: boolean;
okc?: OKContractManager;
});
private _approvalStep;
private _approvalTxs;
}
export {};