UNPKG

@ledgerhq/coin-tester

Version:
40 lines 1.94 kB
import { AccountBridge, Account, TransactionCommon, SignOperationEvent, CurrencyBridge, Operation } from "@ledgerhq/types-live"; import { BridgeStrategy } from "./types"; export type ScenarioTransaction<T extends TransactionCommon, A extends Account> = Partial<T> & { name: string; /** * * @description assert the account state after the transaction * @param previousAccount previousAccount returned by the latest sync before broadcasting this transaction * @param currentAccount currentAccount synced after broadcasting this transaction * @returns void */ expect?: (previousAccount: A, currentAccount: A) => void; /** * FOR DEV ONLY * if you want to temporarily disable the expect for a transaction * You should push a transaction with a xexpect */ xexpect?: (previousAccount: A, currentAccount: A) => void; }; export type Scenario<T extends TransactionCommon, A extends Account> = { name: string; setup: (strategy: BridgeStrategy) => Promise<{ accountBridge: AccountBridge<T, A>; currencyBridge: CurrencyBridge; account: A; retryInterval?: number; retryLimit?: number; onSignerConfirmation?: (e?: SignOperationEvent) => Promise<void>; }>; getTransactions: (address: string) => ScenarioTransaction<T, A>[]; beforeSync?: () => Promise<void> | void; mockIndexer?: (account: Account, optimistic: Operation) => Promise<void>; beforeAll?: (account: Account) => Promise<void> | void; afterAll?: (account: Account) => Promise<void> | void; beforeEach?: (account: Account) => Promise<void> | void; afterEach?: (account: Account) => Promise<void> | void; teardown?: () => Promise<void> | void; }; export declare function executeScenario<T extends TransactionCommon, A extends Account>(scenario: Scenario<T, A>, strategy?: BridgeStrategy): Promise<void>; //# sourceMappingURL=main.d.ts.map