import { ForeignToken } from "@daimo/contract"; import { Address, Hex } from "viem"; import z from "zod"; import { BigIntStr } from "./model"; export declare enum DaimoPayOrderStatusSource { WAITING_PAYMENT = "waiting_payment", PENDING_PROCESSING = "pending_processing", START_SUBMITTED = "start_submitted", PROCESSED = "processed" } export declare enum DaimoPayOrderStatusDest { PENDING = "pending", FAST_FINISH_SUBMITTED = "fast_finish_submitted", FAST_FINISHED = "fast_finished", CLAIM_SUCCESSFUL = "claimed" } export declare enum DaimoPayOrderMode { SALE = "sale",// product or item sale CHOOSE_AMOUNT = "choose_amount",// let the user specify the amount to pay HYDRATED = "hydrated" } /** * Status values: * - `payment_unpaid` - the user has not paid yet * - `payment_started` - the user has paid & payment is in progress. This status * typically lasts a few seconds. * - `payment_completed` - the final call or transfer succeeded * - `payment_bounced` - the final call or transfer reverted. Funds were sent * to the payment's configured refund address on the destination chain. */ export declare enum DaimoPayIntentStatus { UNPAID = "payment_unpaid", STARTED = "payment_started", COMPLETED = "payment_completed", BOUNCED = "payment_bounced" } /** Order updates used by services outside orderProcessor to listen for any * relevant or interesting changes to the order status. */ export type DaimoPayOrderUpdate = { type: "mode"; value: DaimoPayOrderMode; } | { type: "source"; value: DaimoPayOrderStatusSource; txHash: string | undefined; } | { type: "dest"; value: DaimoPayOrderStatusDest; txHash: Hex; } | { type: "intent"; value: DaimoPayIntentStatus; txHash: Hex; }; export interface DaimoPayOrderItem { name: string; description: string; image?: string; } export declare const zBridgeTokenOutOptions: z.ZodArray; amount: z.ZodEffects, bigint, string>; }, "strip", z.ZodTypeAny, { amount: bigint; token: `0x${string}`; }, { amount: string; token: string; }>, "many">; export type BridgeTokenOutOptions = z.infer; export declare const zDaimoPayOrderMetadata: z.ZodObject<{ style: z.ZodOptional; }, "strip", z.ZodTypeAny, { background?: string | undefined; }, { background?: string | undefined; }>>; orgLogo: z.ZodOptional; intent: z.ZodString; items: z.ZodArray; price: z.ZodOptional; priceDetails: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; description: string; image?: string | undefined; price?: string | undefined; priceDetails?: string | undefined; }, { name: string; description: string; image?: string | undefined; price?: string | undefined; priceDetails?: string | undefined; }>, "many">; payer: z.ZodOptional>; preferredTokens: z.ZodOptional, `0x${string}`, string>; }, "strip", z.ZodTypeAny, { chain: number; address: `0x${string}`; }, { chain: number; address: string; }>, "many">>; evmChains: z.ZodOptional>; paymentOptions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { preferredChains?: number[] | undefined; preferredTokens?: { chain: number; address: `0x${string}`; }[] | undefined; evmChains?: number[] | undefined; paymentOptions?: string[] | undefined; }, { preferredChains?: number[] | undefined; preferredTokens?: { chain: number; address: string; }[] | undefined; evmChains?: number[] | undefined; paymentOptions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { intent: string; items: { name: string; description: string; image?: string | undefined; price?: string | undefined; priceDetails?: string | undefined; }[]; style?: { background?: string | undefined; } | undefined; orgLogo?: string | undefined; payer?: { preferredChains?: number[] | undefined; preferredTokens?: { chain: number; address: `0x${string}`; }[] | undefined; evmChains?: number[] | undefined; paymentOptions?: string[] | undefined; } | undefined; }, { intent: string; items: { name: string; description: string; image?: string | undefined; price?: string | undefined; priceDetails?: string | undefined; }[]; style?: { background?: string | undefined; } | undefined; orgLogo?: string | undefined; payer?: { preferredChains?: number[] | undefined; preferredTokens?: { chain: number; address: string; }[] | undefined; evmChains?: number[] | undefined; paymentOptions?: string[] | undefined; } | undefined; }>; export type DaimoPayOrderMetadata = z.infer; /** * The user-passed metadata must meet these criteria: * - All keys must be strings * - All values must be strings * - At most 50 key-value pairs * - Maximum of 40 characters per key * - Maximum of 500 characters per value */ export declare const zDaimoPayUserMetadata: z.ZodEffects>, Record | null, Record | null>; export type DaimoPayUserMetadata = z.infer; export type DaimoPayDehydratedOrder = { mode: DaimoPayOrderMode.SALE | DaimoPayOrderMode.CHOOSE_AMOUNT; id: bigint; destFinalCallTokenAmount: DaimoPayTokenAmount; destFinalCall: OnChainCall; destNonce: bigint; redirectUri: string | null; orgId: string | null; createdAt: number | null; lastUpdatedAt: number | null; intentStatus: DaimoPayIntentStatus; metadata: DaimoPayOrderMetadata; externalId: string | null; userMetadata: DaimoPayUserMetadata | null; }; export type DaimoPayHydratedOrder = { mode: DaimoPayOrderMode.HYDRATED; id: bigint; intentAddr: Address; escrowContractAddress: Address | null; /** * @deprecated included for backcompat with old paykit versions. Remove once * new paykit version is deployed. * */ handoffAddr: Address; bridgeTokenOutOptions: DaimoPayTokenAmount[]; selectedBridgeTokenOutAddr: Address | null; selectedBridgeTokenOutAmount: bigint | null; destFinalCallTokenAmount: DaimoPayTokenAmount; destFinalCall: OnChainCall; usdValue: number; destRefundAddr: Address; destNonce: bigint; sourceFulfillerAddr: Address | SolanaPublicKey | null; sourceTokenAmount: DaimoPayTokenAmount | null; sourceInitiateTxHash: Hex | null; sourceStartTxHash: Hex | null; sourceStatus: DaimoPayOrderStatusSource; destStatus: DaimoPayOrderStatusDest; destFastFinishTxHash: Hex | null; destClaimTxHash: Hex | null; redirectUri: string | null; orgId: string | null; createdAt: number | null; lastUpdatedAt: number | null; intentStatus: DaimoPayIntentStatus; metadata: DaimoPayOrderMetadata; externalId: string | null; userMetadata: DaimoPayUserMetadata | null; }; export type DaimoPayHydratedOrderWithoutIntentAddr = Omit; export type DaimoPayOrder = DaimoPayDehydratedOrder | DaimoPayHydratedOrder; export type DaimoPayOrderView = { id: DaimoPayOrderID; status: DaimoPayIntentStatus; createdAt: string; display: { intent: string; paymentValue: string; currency: "USD"; }; source: { payerAddress: Address | SolanaPublicKey | null; txHash: Hex | string; chainId: string; amountUnits: string; tokenSymbol: string; tokenAddress: Address | string; } | null; destination: { destinationAddress: Address; txHash: Hex | null; chainId: string; amountUnits: string; tokenSymbol: string; tokenAddress: Address; callData: Hex | null; }; externalId: string | null; metadata: DaimoPayUserMetadata | null; }; export declare function getOrderSourceChainId(order: DaimoPayHydratedOrder): number | null; export declare function getOrderDestChainId(order: DaimoPayOrder | DaimoPayHydratedOrderWithoutIntentAddr): number; export declare function getDaimoPayOrderView(order: DaimoPayOrder): DaimoPayOrderView; export type WalletPaymentOption = { required: DaimoPayTokenAmount; balance: DaimoPayTokenAmount; minimumRequired: DaimoPayTokenAmount; fees: DaimoPayTokenAmount; disabledReason?: string; }; export type ExternalPaymentOptionMetadata = { id: ExternalPaymentOptions; cta: string; logoURI: string; logoShape: "circle" | "squircle"; paymentToken: DaimoPayToken; disabled: boolean; message?: string; minimumUsd?: number; }; export declare enum ExternalPaymentOptions { Daimo = "Daimo", Coinbase = "Coinbase", RampNetwork = "RampNetwork", Binance = "Binance", Solana = "Solana", ExternalChains = "ExternalChains", Lemon = "Lemon" } export type ExternalPaymentOptionData = { url: string; waitingMessage: string; }; export declare enum DepositAddressPaymentOptions { BITCOIN = "Bitcoin", TRON_USDT = "USDT on Tron", TON = "TON", MONERO = "Monero", DOGE = "Doge", LITECOIN = "Litecoin", ZCASH = "Zcash", DASH = "Dash" } export type DepositAddressPaymentOptionMetadata = { id: DepositAddressPaymentOptions; logoURI: string; }; export type DepositAddressPaymentOptionData = { address: string; uri: string; amount: string; suffix: string; }; export interface DaimoPayToken extends ForeignToken { token: Address | SolanaPublicKey; usd: number; displayDecimals: number; fiatSymbol?: string; } export interface DaimoPayTokenAmount { token: DaimoPayToken; amount: BigIntStr; usd: number; } export type OnChainCall = { to: Address; data: Hex; value: bigint; }; export declare const emptyOnChainCall: OnChainCall; declare const zDaimoPayOrderID: z.ZodString; export type DaimoPayOrderID = z.infer; /** * Read a base58-encoded id into a bigint. */ export declare function readDaimoPayOrderID(id: string): bigint; /** * Write a bigint into a base58-encoded id. */ export declare function writeDaimoPayOrderID(id: bigint): string; export declare const zUUID: z.ZodString; export type UUID = z.infer; export type PaymentStartedEvent = { type: "payment_started"; isTestEvent?: boolean; paymentId: DaimoPayOrderID; chainId: number; txHash: Hex | string | null; payment: DaimoPayOrderView; }; export type PaymentCompletedEvent = { type: "payment_completed"; isTestEvent?: boolean; paymentId: DaimoPayOrderID; chainId: number; txHash: Hex | string; payment: DaimoPayOrderView; }; export type PaymentBouncedEvent = { type: "payment_bounced"; isTestEvent?: boolean; paymentId: DaimoPayOrderID; chainId: number; txHash: Hex | string; payment: DaimoPayOrderView; }; export type DaimoPayEvent = PaymentStartedEvent | PaymentCompletedEvent | PaymentBouncedEvent; export interface WebhookEndpoint { id: UUID; orgId: UUID; url: string; token: string; createdAt: Date; deletedAt: Date | null; } export declare enum WebhookEventStatus { PENDING = "pending",// waiting to be delivered RETRYING = "retrying",// currently in exponential backoff queue SUCCESSFUL = "successful",// successfully delivered FAILED = "failed" } export interface WebhookEvent { id: UUID; endpoint: WebhookEndpoint; isTestEvent: boolean; body: DaimoPayEvent; status: WebhookEventStatus; deliveries: WebhookDelivery[]; createdAt: Date; } export interface WebhookDelivery { id: UUID; eventId: UUID; httpStatus: number | null; body: string | null; createdAt: Date; } export declare const zSolanaPublicKey: z.ZodString; export type SolanaPublicKey = z.infer; export {};