@coin-voyage/paykit
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
40 lines (39 loc) • 1.87 kB
TypeScript
import React from "react";
import type { PaymentState } from "../../../hooks/usePaymentState";
import type { CustomTheme, Languages, Mode, PayKitOptions, PayModalOptions, Theme } from "../../../types";
import type { ROUTES } from "../../../types/routes";
import { useConnectCallbackProps } from "@coin-voyage/crypto/hooks/use-connect-callback";
import { WalletPermission } from "@coin-voyage/crypto/types/wallet";
export type PayContextValue = {
theme: Theme;
setTheme: React.Dispatch<React.SetStateAction<Theme>>;
mode: Mode;
setMode: React.Dispatch<React.SetStateAction<Mode>>;
customTheme: CustomTheme | undefined;
setCustomTheme: React.Dispatch<React.SetStateAction<CustomTheme | undefined>>;
lang: Languages;
setLang: React.Dispatch<React.SetStateAction<Languages>>;
setOnOpen: (fn?: () => void) => void;
setOnClose: (fn?: () => void) => void;
open: boolean;
setOpen: (open: boolean) => void;
onSuccess: () => void;
route: string;
setRoute: React.Dispatch<React.SetStateAction<ROUTES>>;
errorMessage: string | React.ReactNode | null;
debugMode?: boolean;
log: (...props: any) => void;
displayError: (message: string | React.ReactNode | null, code?: any) => void;
resize: number;
triggerResize: () => void;
/** Global options, across all pay buttons and payments. */
options?: PayKitOptions;
/** Loads a payment, then shows the modal to complete payment. */
showPayment: (modalOptions: PayModalOptions) => void;
/** Payment status & callbacks. */
paymentState: PaymentState;
/** Allowed wallets for the current payment. */
allowedWallets: WalletPermission[] | null;
} & Omit<useConnectCallbackProps, "setAllowedWallets">;
export declare const PayContext: React.Context<PayContextValue | null>;
export default function usePayContext(): PayContextValue;