@renproject/rentx
Version:
XState Statemachines for tracking RenVM transactions reactively
64 lines (63 loc) • 1.69 kB
TypeScript
import { Actor } from "xstate";
import RenJS from "@renproject/ren";
import { GatewaySession, GatewayTransaction } from "../types/transaction";
import { LockChain, MintChain } from "@renproject/interfaces";
import { depositMachine } from "./deposit";
export interface GatewayMachineContext {
tx: GatewaySession;
signatureRequest?: string;
depositMachines?: {
[key in string]: Actor<typeof depositMachine>;
};
depositListenerRef?: Actor<any>;
providers: any;
fromChainMap: {
[key in string]: (context: GatewayMachineContext) => LockChain<any>;
};
toChainMap: {
[key in string]: (context: GatewayMachineContext) => MintChain<any>;
};
sdk: RenJS;
}
export interface GatewayMachineSchema {
states: {
restoring: {};
creating: {};
srcInitializeError: {};
listening: {};
requestingSignature: {};
completed: {};
};
}
export declare type GatewayMachineEvent = {
type: "CLAIMABLE";
data: GatewayTransaction;
} | {
type: "DEPOSIT";
data: GatewayTransaction;
} | {
type: "DEPOSIT_UPDATE";
data: GatewayTransaction;
} | {
type: "DEPOSIT_COMPLETED";
data: GatewayTransaction;
} | {
type: "REQUEST_SIGNATURE";
data: GatewayTransaction;
} | {
type: "SIGN";
data: GatewayTransaction;
} | {
type: "EXPIRED";
data: GatewayTransaction;
} | {
type: "ACKNOWLEDGE";
data: any;
} | {
type: "RESTORE";
data: GatewayTransaction;
};
export declare const mintMachine: import("xstate").StateMachine<GatewayMachineContext, GatewayMachineSchema, GatewayMachineEvent, {
value: any;
context: GatewayMachineContext;
}>;