@daimo/pay 1.7.6 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +30 -65
- package/build/index.js +961 -606
- package/build/index.js.map +1 -1
- package/package.json +4 -4
package/build/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
4
4
|
import { CreateConfigParameters } from '@wagmi/core';
|
|
5
5
|
import { CreateConnectorFn } from 'wagmi';
|
|
6
6
|
import { CoinbaseWalletParameters } from 'wagmi/connectors';
|
|
7
|
-
import { DaimoPayOrderView, DaimoPayUserMetadata, DaimoPayIntentStatus, DaimoPayOrderMode, DepositAddressPaymentOptionMetadata, PlatformType, ExternalPaymentOptionMetadata, WalletPaymentOption,
|
|
8
|
-
import {
|
|
7
|
+
import { DaimoPayOrderView, PaymentStartedEvent, PaymentCompletedEvent, PaymentBouncedEvent, ExternalPaymentOptionsString, DaimoPayUserMetadata, DaimoPayIntentStatus, DaimoPayOrderMode, DepositAddressPaymentOptionMetadata, PlatformType, ExternalPaymentOptionMetadata, WalletPaymentOption, DaimoPayOrderWithOrg, ExternalPaymentOptions, DepositAddressPaymentOptions, DepositAddressPaymentOptionData, SolanaPublicKey } from '@daimo/pay-common';
|
|
8
|
+
import { Address, Hex } from 'viem';
|
|
9
9
|
import { WalletName } from '@solana/wallet-adapter-base';
|
|
10
10
|
import { AppRouter } from '@daimo/pay-api';
|
|
11
11
|
import { CreateTRPCClient } from '@trpc/client';
|
|
@@ -70,8 +70,6 @@ type DaimoPayModalOptions = {
|
|
|
70
70
|
closeOnSuccess?: boolean;
|
|
71
71
|
resetOnSuccess?: boolean;
|
|
72
72
|
};
|
|
73
|
-
/** Additional payment options. Onchain payments are always enabled. */
|
|
74
|
-
type PaymentOption = "Daimo" | "Coinbase" | "Binance" | "RampNetwork" | "Solana" | "ExternalChains" | "Lemon";
|
|
75
73
|
|
|
76
74
|
type types_All = All;
|
|
77
75
|
type types_CustomAvatarProps = CustomAvatarProps;
|
|
@@ -80,10 +78,9 @@ type types_DaimoPayContextOptions = DaimoPayContextOptions;
|
|
|
80
78
|
type types_DaimoPayModalOptions = DaimoPayModalOptions;
|
|
81
79
|
type types_Languages = Languages;
|
|
82
80
|
type types_Mode = Mode;
|
|
83
|
-
type types_PaymentOption = PaymentOption;
|
|
84
81
|
type types_Theme = Theme;
|
|
85
82
|
declare namespace types {
|
|
86
|
-
export type { types_All as All, types_CustomAvatarProps as CustomAvatarProps, types_CustomTheme as CustomTheme, types_DaimoPayContextOptions as DaimoPayContextOptions, types_DaimoPayModalOptions as DaimoPayModalOptions, types_Languages as Languages, types_Mode as Mode,
|
|
83
|
+
export type { types_All as All, types_CustomAvatarProps as CustomAvatarProps, types_CustomTheme as CustomTheme, types_DaimoPayContextOptions as DaimoPayContextOptions, types_DaimoPayModalOptions as DaimoPayModalOptions, types_Languages as Languages, types_Mode as Mode, types_Theme as Theme };
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
type useConnectCallbackProps = {
|
|
@@ -133,48 +130,6 @@ declare const defaultConfig: ({ appName, appIcon, appDescription, appUrl, wallet
|
|
|
133
130
|
|
|
134
131
|
/** Payment details and status. */
|
|
135
132
|
type DaimoPayment = DaimoPayOrderView;
|
|
136
|
-
/** Passed to both `onPayment*` event handlers and webhooks. */
|
|
137
|
-
type DaimoPayEvent = {
|
|
138
|
-
/**
|
|
139
|
-
* A payment is started once the user has sent payment. Completed means
|
|
140
|
-
* the payment was sent on the destination chain and custom contract call,
|
|
141
|
-
* if any, was successful. Bounced means that a destination contract call
|
|
142
|
-
* reverted and funds were refunded.
|
|
143
|
-
*/
|
|
144
|
-
type: "payment_started" | "payment_completed" | "payment_bounced";
|
|
145
|
-
/**
|
|
146
|
-
* The unique ID for this payment.
|
|
147
|
-
*/
|
|
148
|
-
paymentId: string;
|
|
149
|
-
/**
|
|
150
|
-
* The chain for this event--source chain for payment_started, destination
|
|
151
|
-
* chain for payment_completed/payment_bounced.
|
|
152
|
-
*/
|
|
153
|
-
chainId: number;
|
|
154
|
-
/**
|
|
155
|
-
* Payment details.
|
|
156
|
-
*/
|
|
157
|
-
payment: DaimoPayment;
|
|
158
|
-
};
|
|
159
|
-
type DaimoPayStartedEvent = DaimoPayEvent & {
|
|
160
|
-
type: "payment_started";
|
|
161
|
-
/**
|
|
162
|
-
* The transaction hash sent by the user, if found. (There are rare edge cases
|
|
163
|
-
* where a payment can be paid without a txhash.) Hex for all EVM events,
|
|
164
|
-
* Base58 for payment_started on Solana.
|
|
165
|
-
*/
|
|
166
|
-
txHash: Hex | string | null;
|
|
167
|
-
};
|
|
168
|
-
type DaimoPayCompletedEvent = DaimoPayEvent & {
|
|
169
|
-
type: "payment_completed";
|
|
170
|
-
/** The transaction hash completing this payment. */
|
|
171
|
-
txHash: Hex;
|
|
172
|
-
};
|
|
173
|
-
type DaimoPayBouncedEvent = DaimoPayEvent & {
|
|
174
|
-
type: "payment_bounced";
|
|
175
|
-
/** The transaction hash containing the reverted final call and refund. */
|
|
176
|
-
txHash: Hex;
|
|
177
|
-
};
|
|
178
133
|
/** Props for DaimoPayButton. */
|
|
179
134
|
type PayButtonPaymentProps = {
|
|
180
135
|
/**
|
|
@@ -210,7 +165,7 @@ type PayButtonPaymentProps = {
|
|
|
210
165
|
/**
|
|
211
166
|
* Payment options. By default, all are enabled.
|
|
212
167
|
*/
|
|
213
|
-
paymentOptions?:
|
|
168
|
+
paymentOptions?: ExternalPaymentOptionsString[];
|
|
214
169
|
/**
|
|
215
170
|
* Preferred chain IDs. Assets on these chains will appear first.
|
|
216
171
|
*/
|
|
@@ -241,14 +196,18 @@ type PayButtonPaymentProps = {
|
|
|
241
196
|
} | {
|
|
242
197
|
/** The payment ID, generated via the Daimo Pay API. Replaces params above. */
|
|
243
198
|
payId: string;
|
|
199
|
+
/**
|
|
200
|
+
* Payment options. By default, all are enabled.
|
|
201
|
+
*/
|
|
202
|
+
paymentOptions?: ExternalPaymentOptionsString[];
|
|
244
203
|
};
|
|
245
204
|
type PayButtonCommonProps = PayButtonPaymentProps & {
|
|
246
205
|
/** Called when user sends payment and transaction is seen on chain */
|
|
247
|
-
onPaymentStarted?: (event:
|
|
206
|
+
onPaymentStarted?: (event: PaymentStartedEvent) => void;
|
|
248
207
|
/** Called when destination transfer or call completes successfully */
|
|
249
|
-
onPaymentCompleted?: (event:
|
|
208
|
+
onPaymentCompleted?: (event: PaymentCompletedEvent) => void;
|
|
250
209
|
/** Called when destination call reverts and funds are refunded */
|
|
251
|
-
onPaymentBounced?: (event:
|
|
210
|
+
onPaymentBounced?: (event: PaymentBouncedEvent) => void;
|
|
252
211
|
/** Called when the modal is opened. */
|
|
253
212
|
onOpen?: () => void;
|
|
254
213
|
/** Called when the modal is closed. */
|
|
@@ -333,7 +292,10 @@ declare enum ROUTES {
|
|
|
333
292
|
SELECT_AMOUNT = "daimoPaySelectAmount",
|
|
334
293
|
SELECT_EXTERNAL_AMOUNT = "daimoPaySelectExternalAmount",
|
|
335
294
|
SELECT_DEPOSIT_ADDRESS_AMOUNT = "daimoPaySelectDepositAddressAmount",
|
|
295
|
+
SELECT_WALLET_AMOUNT = "daimoPaySelectWalletAmount",
|
|
296
|
+
SELECT_ZKP2P = "daimoPaySelectZKP2P",
|
|
336
297
|
WAITING_EXTERNAL = "daimoPayWaitingExternal",
|
|
298
|
+
WAITING_WALLET = "daimoPayWaitingWallet",
|
|
337
299
|
SELECT_DEPOSIT_ADDRESS_CHAIN = "daimoPaySelectDepositAddressChain",
|
|
338
300
|
WAITING_DEPOSIT_ADDRESS = "daimoPayWaitingDepositAddress",
|
|
339
301
|
PAY_WITH_TOKEN = "daimoPayPayWithToken",
|
|
@@ -352,11 +314,6 @@ declare enum ROUTES {
|
|
|
352
314
|
SWITCHNETWORKS = "switchNetworks"
|
|
353
315
|
}
|
|
354
316
|
|
|
355
|
-
/**
|
|
356
|
-
* EIP-6963: Multi Injected Provider Discovery
|
|
357
|
-
* https://eips.ethereum.org/EIPS/eip-6963
|
|
358
|
-
*
|
|
359
|
-
*/
|
|
360
317
|
type WalletConfigProps = {
|
|
361
318
|
name?: string;
|
|
362
319
|
shortName?: string;
|
|
@@ -377,7 +334,8 @@ type WalletConfigProps = {
|
|
|
377
334
|
safari?: string;
|
|
378
335
|
};
|
|
379
336
|
getWalletConnectDeeplink?: (uri: string) => string;
|
|
380
|
-
|
|
337
|
+
deeplinkScheme?: string;
|
|
338
|
+
getDaimoPayDeeplink?: (payId: string) => string;
|
|
381
339
|
shouldDeeplinkDesktop?: boolean;
|
|
382
340
|
showInMobileConnectors?: boolean;
|
|
383
341
|
isWcMobileConnector?: boolean;
|
|
@@ -401,7 +359,7 @@ declare function useExternalPaymentOptions({ trpc, filterIds, platform, usdRequi
|
|
|
401
359
|
usdRequired: number | undefined;
|
|
402
360
|
mode: DaimoPayOrderMode | undefined;
|
|
403
361
|
}): {
|
|
404
|
-
options: ExternalPaymentOptionMetadata[]
|
|
362
|
+
options: Map<"external" | "zkp2p", ExternalPaymentOptionMetadata[]>;
|
|
405
363
|
loading: boolean;
|
|
406
364
|
};
|
|
407
365
|
|
|
@@ -455,7 +413,7 @@ interface PayParams {
|
|
|
455
413
|
/** The intent verb, such as Pay, Deposit, or Purchase. Default: Pay */
|
|
456
414
|
intent?: string;
|
|
457
415
|
/** Payment options. By default, all are enabled. */
|
|
458
|
-
paymentOptions?:
|
|
416
|
+
paymentOptions?: ExternalPaymentOptionsString[];
|
|
459
417
|
/** Preferred chain IDs. */
|
|
460
418
|
preferredChains?: number[];
|
|
461
419
|
/** Preferred tokens. These appear first in the token list. */
|
|
@@ -474,15 +432,19 @@ interface PayParams {
|
|
|
474
432
|
}
|
|
475
433
|
/** Creates (or loads) a payment and manages the corresponding modal. */
|
|
476
434
|
interface PaymentState {
|
|
477
|
-
setPayId: (id: string | undefined) => void;
|
|
478
|
-
setPayParams: (payParams: PayParams | undefined) => void;
|
|
479
|
-
payParams: PayParams | undefined;
|
|
480
435
|
generatePreviewOrder: (payParams: PayParams) => void;
|
|
481
436
|
resetOrder: () => void;
|
|
482
|
-
|
|
437
|
+
buttonProps: PayButtonPaymentProps | undefined;
|
|
438
|
+
setButtonProps: (props: PayButtonPaymentProps | undefined) => void;
|
|
439
|
+
setPayId: (id: string | undefined) => void;
|
|
440
|
+
payParams: PayParams | undefined;
|
|
441
|
+
setPayParams: (payParams: PayParams | undefined) => void;
|
|
442
|
+
daimoPayOrder: DaimoPayOrderWithOrg | undefined;
|
|
483
443
|
isDepositFlow: boolean;
|
|
484
444
|
paymentWaitingMessage: string | undefined;
|
|
485
445
|
externalPaymentOptions: ReturnType<typeof useExternalPaymentOptions>;
|
|
446
|
+
selectedWallet: WalletConfigProps | undefined;
|
|
447
|
+
selectedWalletDeepLink: string | undefined;
|
|
486
448
|
showSolanaPaymentMethod: boolean;
|
|
487
449
|
walletPaymentOptions: ReturnType<typeof useWalletPaymentOptions>;
|
|
488
450
|
solanaPaymentOptions: ReturnType<typeof useSolanaPaymentOptions>;
|
|
@@ -493,6 +455,8 @@ interface PaymentState {
|
|
|
493
455
|
selectedDepositAddressOption: DepositAddressPaymentOptionMetadata | undefined;
|
|
494
456
|
getOrderUsdLimit: () => number;
|
|
495
457
|
setPaymentWaitingMessage: (message: string | undefined) => void;
|
|
458
|
+
setSelectedWallet: (wallet: WalletConfigProps | undefined) => void;
|
|
459
|
+
setSelectedWalletDeepLink: (deepLink: string | undefined) => void;
|
|
496
460
|
setSelectedExternalOption: (option: ExternalPaymentOptionMetadata | undefined) => void;
|
|
497
461
|
setSelectedTokenOption: (option: WalletPaymentOption | undefined) => void;
|
|
498
462
|
setSelectedSolanaTokenOption: (option: WalletPaymentOption | undefined) => void;
|
|
@@ -502,6 +466,7 @@ interface PaymentState {
|
|
|
502
466
|
payWithExternal: (option: ExternalPaymentOptions) => Promise<string>;
|
|
503
467
|
payWithDepositAddress: (option: DepositAddressPaymentOptions) => Promise<DepositAddressPaymentOptionData | null>;
|
|
504
468
|
payWithSolanaToken: (inputToken: SolanaPublicKey) => Promise<string | undefined>;
|
|
469
|
+
payWithWallet: (wallet?: WalletConfigProps, amountUsd?: number) => Promise<void>;
|
|
505
470
|
refreshOrder: () => Promise<void>;
|
|
506
471
|
senderEnsName: string | undefined;
|
|
507
472
|
}
|
|
@@ -562,4 +527,4 @@ type PayContextValue = {
|
|
|
562
527
|
} & useConnectCallbackProps;
|
|
563
528
|
|
|
564
529
|
export { Avatar, Chain as ChainIcon, DaimoPayButton, PayContext as DaimoPayContext, DaimoPayProvider, types as Types, daimoPayVersion, defaultConfig as getDefaultConfig, useDaimoPayStatus, usePayContext, wallets };
|
|
565
|
-
export type { All, CustomAvatarProps, CustomTheme,
|
|
530
|
+
export type { All, CustomAvatarProps, CustomTheme, DaimoPayButtonCustomProps, DaimoPayButtonProps, DaimoPayContextOptions, DaimoPayModalOptions, DaimoPayment, Languages, Mode, Theme };
|