@renproject/rentx
Version:
XState Statemachines for tracking RenVM transactions reactively
66 lines (65 loc) • 1.63 kB
TypeScript
import { Actor } from "xstate";
import RenJS from "@renproject/ren";
import { GatewaySession, GatewayTransaction } from "../types/transaction";
import { LockChain, MintChain } from "@renproject/interfaces";
export interface DepositMachineContext {
deposit: GatewayTransaction;
tx: GatewaySession;
depositListenerRef?: Actor<any>;
providers: any;
fromChainMap: {
[key in string]: (context: Omit<DepositMachineContext, "deposit">) => LockChain<any>;
};
toChainMap: {
[key in string]: (context: Omit<DepositMachineContext, "deposit">) => MintChain<any>;
};
sdk: RenJS;
}
export interface DepositMachineSchema {
states: {
restoringDeposit: {};
errorRestoring: {};
restoredDeposit: {};
srcSettling: {};
srcConfirmed: {};
accepted: {};
claiming: {};
destInitiated: {};
completed: {};
rejected: {};
};
}
export declare type DepositMachineEvent = {
type: "NOOP";
} | {
type: "LISTENING";
} | {
type: "DETECTED";
} | {
type: "RESTORE";
data: string;
} | {
type: "RESTORED";
data: string;
} | {
type: "CONFIRMED";
} | {
type: "CONFIRMATION";
data: GatewayTransaction;
} | {
type: "SIGNED";
data: GatewayTransaction;
} | {
type: "CLAIM";
} | {
type: "REJECT";
} | {
type: "SUBMITTED";
data: GatewayTransaction;
} | {
type: "ACKNOWLEDGE";
};
export declare const depositMachine: import("xstate").StateMachine<DepositMachineContext, DepositMachineSchema, DepositMachineEvent, {
value: any;
context: DepositMachineContext;
}>;