@daimo/pay 1.7.6 → 1.7.7

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 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, DaimoPayOrder, ExternalPaymentOptions, DepositAddressPaymentOptions, DepositAddressPaymentOptionData, SolanaPublicKey } from '@daimo/pay-common';
8
- import { Hex, Address } from 'viem';
7
+ import { DaimoPayOrderView, PaymentStartedEvent, PaymentCompletedEvent, PaymentBouncedEvent, 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';
@@ -133,48 +133,6 @@ declare const defaultConfig: ({ appName, appIcon, appDescription, appUrl, wallet
133
133
 
134
134
  /** Payment details and status. */
135
135
  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
136
  /** Props for DaimoPayButton. */
179
137
  type PayButtonPaymentProps = {
180
138
  /**
@@ -244,11 +202,11 @@ type PayButtonPaymentProps = {
244
202
  };
245
203
  type PayButtonCommonProps = PayButtonPaymentProps & {
246
204
  /** Called when user sends payment and transaction is seen on chain */
247
- onPaymentStarted?: (event: DaimoPayStartedEvent) => void;
205
+ onPaymentStarted?: (event: PaymentStartedEvent) => void;
248
206
  /** Called when destination transfer or call completes successfully */
249
- onPaymentCompleted?: (event: DaimoPayCompletedEvent) => void;
207
+ onPaymentCompleted?: (event: PaymentCompletedEvent) => void;
250
208
  /** Called when destination call reverts and funds are refunded */
251
- onPaymentBounced?: (event: DaimoPayBouncedEvent) => void;
209
+ onPaymentBounced?: (event: PaymentBouncedEvent) => void;
252
210
  /** Called when the modal is opened. */
253
211
  onOpen?: () => void;
254
212
  /** Called when the modal is closed. */
@@ -479,7 +437,7 @@ interface PaymentState {
479
437
  payParams: PayParams | undefined;
480
438
  generatePreviewOrder: (payParams: PayParams) => void;
481
439
  resetOrder: () => void;
482
- daimoPayOrder: DaimoPayOrder | undefined;
440
+ daimoPayOrder: DaimoPayOrderWithOrg | undefined;
483
441
  isDepositFlow: boolean;
484
442
  paymentWaitingMessage: string | undefined;
485
443
  externalPaymentOptions: ReturnType<typeof useExternalPaymentOptions>;
@@ -562,4 +520,4 @@ type PayContextValue = {
562
520
  } & useConnectCallbackProps;
563
521
 
564
522
  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, DaimoPayBouncedEvent, DaimoPayButtonCustomProps, DaimoPayButtonProps, DaimoPayCompletedEvent, DaimoPayContextOptions, DaimoPayEvent, DaimoPayModalOptions, DaimoPayStartedEvent, DaimoPayment, Languages, Mode, PaymentOption, Theme };
523
+ export type { All, CustomAvatarProps, CustomTheme, DaimoPayButtonCustomProps, DaimoPayButtonProps, DaimoPayContextOptions, DaimoPayModalOptions, DaimoPayment, Languages, Mode, PaymentOption, Theme };
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { ExternalPaymentOptions, assert, assertNotNull, debugJson, supportedChains, ethereum, isCCTPV1Chain, getOrderDestChainId, readDaimoPayOrderID, getChainName, arbitrum as arbitrum$1, base as base$2, blast as blast$1, bsc as bsc$1, linea as linea$1, mantle as mantle$1, optimism as optimism$1, polygon as polygon$1, worldchain as worldchain$1, getAddressContraction, writeDaimoPayOrderID, DaimoPayOrderMode, DaimoPayOrderStatusDest, getChainExplorerTxUrl, DaimoPayIntentStatus, retryBackoff, DaimoPayOrderStatusSource, getDaimoPayOrderView } from '@daimo/pay-common';
2
+ import { ExternalPaymentOptions, assert, assertNotNull, debugJson, supportedChains, ethereum, isCCTPV1Chain, getOrderDestChainId, readDaimoPayOrderID, getChainName, arbitrum as arbitrum$1, base as base$2, blast as blast$1, bsc as bsc$1, linea as linea$1, mantle as mantle$1, optimism as optimism$1, polygon as polygon$1, worldchain as worldchain$1, getAddressContraction, writeDaimoPayOrderID, DaimoPayOrderMode, DaimoPayOrderStatusDest, getChainExplorerTxUrl, DaimoPayIntentStatus, retryBackoff, DaimoPayOrderStatusSource, DaimoPayEventType, getDaimoPayOrderView } from '@daimo/pay-common';
3
3
  import { Buffer } from 'buffer';
4
4
  import React, { useState, useEffect, createContext, useRef, useCallback, useLayoutEffect, useMemo, createElement } from 'react';
5
5
  import styled$1, { css, keyframes, ThemeProvider } from 'styled-components';
@@ -22,7 +22,7 @@ import { WalletSignTransactionError, WalletSendTransactionError } from '@solana/
22
22
  import { normalize } from 'viem/ens';
23
23
 
24
24
  var name = "@daimo/pay";
25
- var version = "1.7.6";
25
+ var version = "1.7.7";
26
26
  var author = "Daimo";
27
27
  var homepage = "https://pay.daimo.com";
28
28
  var license = "BSD-2-Clause license";
@@ -61,7 +61,7 @@ var keywords = [
61
61
  "crypto"
62
62
  ];
63
63
  var dependencies = {
64
- "@daimo/pay-common": "1.7.6",
64
+ "@daimo/pay-common": "1.7.7",
65
65
  "@rollup/plugin-typescript": "^12.1.2",
66
66
  "@solana/wallet-adapter-base": "^0.9.23",
67
67
  "@solana/wallet-adapter-react": "^0.15.35",
@@ -7488,8 +7488,9 @@ const OrderHeader = ({ minified = false, showEth = false, showSolana = false, })
7488
7488
  }
7489
7489
  })();
7490
7490
  const renderIcon = (icon, name, size = 32) => {
7491
- if (!icon)
7492
- return jsx(MetaMask, {});
7491
+ if (!icon) {
7492
+ return null;
7493
+ }
7493
7494
  return (jsx(LogoContainer$4, { "$size": size, "$zIndex": 1, style: { borderRadius: "22.5%" }, children: typeof icon === "string" ? (jsx("img", { src: icon, alt: name || "wallet", style: { maxWidth: "100%", maxHeight: "100%" } })) : (icon) }));
7494
7495
  };
7495
7496
  let walletIcon = renderIcon(connector?.icon || wcWallet?.icon, wcWallet?.name);
@@ -12006,7 +12007,7 @@ function DaimoPayButtonCustom(props) {
12006
12007
  if (!sentStart.current && hydOrder.sourceTokenAmount) {
12007
12008
  sentStart.current = true;
12008
12009
  onPaymentStarted?.({
12009
- type: DaimoPayIntentStatus.STARTED,
12010
+ type: DaimoPayEventType.PaymentStarted,
12010
12011
  paymentId: writeDaimoPayOrderID(hydOrder.id),
12011
12012
  chainId: hydOrder.sourceTokenAmount?.token.chainId,
12012
12013
  txHash: hydOrder.sourceInitiateTxHash ?? null,
@@ -12015,8 +12016,11 @@ function DaimoPayButtonCustom(props) {
12015
12016
  }
12016
12017
  if (intentStatus === DaimoPayIntentStatus.COMPLETED ||
12017
12018
  intentStatus === DaimoPayIntentStatus.BOUNCED) {
12019
+ const eventType = intentStatus === DaimoPayIntentStatus.COMPLETED
12020
+ ? DaimoPayEventType.PaymentCompleted
12021
+ : DaimoPayEventType.PaymentBounced;
12018
12022
  const event = {
12019
- type: intentStatus,
12023
+ type: eventType,
12020
12024
  paymentId: writeDaimoPayOrderID(hydOrder.id),
12021
12025
  chainId: hydOrder.destFinalCallTokenAmount.token.chainId,
12022
12026
  txHash: assertNotNull(hydOrder.destFastFinishTxHash ?? hydOrder.destClaimTxHash, `[PAY BUTTON] dest tx hash null on order ${hydOrder.id} when intent status is ${intentStatus}`),