@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
15 lines (14 loc) • 686 B
TypeScript
import { createStore } from "../stateStore";
import { PaymentEvent, PaymentState } from "./paymentFsm";
export type PaymentStore = ReturnType<typeof createStore<PaymentState, PaymentEvent>>;
export declare function createPaymentStore(): PaymentStore;
/**
* Wait for the `PaymentStore` to enter a state matching any of `validTypes`,
* or reject as soon as it hits the `"error"` state.
*
* @returns Promise<T> resolving with the first matching state or rejecting with
* the error message
*/
export declare function waitForPaymentState<const T extends readonly PaymentState["type"][]>(store: PaymentStore, ...validTypes: T): Promise<Extract<PaymentState, {
type: T[number];
}>>;