@daimo/pay 0.3.9 → 0.3.11

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.es.js CHANGED
@@ -1,13 +1,13 @@
1
- import { http, useConfig, useAccountEffect, useConnectors as useConnectors$1, useAccount, useWriteContract, useSendTransaction, useSwitchChain, useConnect as useConnect$1, createConfig, useEnsAddress, useEnsName, useEnsAvatar, useDisconnect, useBalance, useChainId, WagmiContext } from 'wagmi';
2
- import { mainnet, base as base$1, polygon, optimism, arbitrum, linea, sepolia, baseSepolia } from 'wagmi/chains';
1
+ import { http, useConfig, useAccountEffect, useConnectors as useConnectors$1, useAccount, useEnsName, useWriteContract, useSendTransaction, useSwitchChain, useConnect as useConnect$1, createConfig, useEnsAddress, useEnsAvatar, useDisconnect, useBalance, useChainId, WagmiContext } from 'wagmi';
2
+ import { mainnet, base as base$1, polygon, optimism, arbitrum, linea, bsc, sepolia, baseSepolia } from 'wagmi/chains';
3
3
  import { safe, injected, coinbaseWallet, walletConnect } from '@wagmi/connectors';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { detect } from 'detect-browser';
6
6
  import React, { useEffect, useState, useCallback, useRef, useLayoutEffect, useMemo, createContext, createElement } from 'react';
7
7
  import { Buffer } from 'buffer';
8
- import { readDaimoPayOrderID, assert, assertNotNull, DaimoPayOrderMode, DaimoPayOrderStatusDest, ExternalPaymentOptions, getAddressContraction, capitalize, getDisplayPrice, DaimoPayOrderStatusSource, DaimoPayIntentStatus, retryBackoff, debugJson, writeDaimoPayOrderID } from '@daimo/common';
8
+ import { ExternalPaymentOptions, readDaimoPayOrderID, assert, assertNotNull, DaimoPayOrderMode, DaimoPayOrderStatusDest, getAddressContraction, capitalize, getDisplayPrice, DaimoPayOrderStatusSource, DaimoPayIntentStatus, retryBackoff, debugJson, writeDaimoPayOrderID } from '@daimo/common';
9
9
  import styled$1, { css, keyframes, ThemeProvider } from 'styled-components';
10
- import { erc20Abi, getChainName, ethereum, arbitrum as arbitrum$1, base as base$2, optimism as optimism$1, polygon as polygon$1, ethereumSepolia, baseSepolia as baseSepolia$1, getChainExplorerTxUrl } from '@daimo/contract';
10
+ import { ethereum, erc20Abi, getChainName, arbitrum as arbitrum$1, base as base$2, optimism as optimism$1, polygon as polygon$1, ethereumSepolia, baseSepolia as baseSepolia$1, linea as linea$1, bsc as bsc$1, getChainExplorerTxUrl } from '@daimo/contract';
11
11
  import { zeroAddress, parseUnits } from 'viem';
12
12
  import { createTRPCClient, httpBatchLink } from '@trpc/client';
13
13
  import { motion, AnimatePresence, MotionConfig } from 'framer-motion';
@@ -70,6 +70,7 @@ const REQUIRED_CHAINS = [
70
70
  optimism,
71
71
  arbitrum,
72
72
  linea,
73
+ bsc,
73
74
  sepolia,
74
75
  baseSepolia,
75
76
  ];
@@ -900,9 +901,93 @@ const trpc = createTRPCClient({
900
901
  ],
901
902
  });
902
903
 
903
- function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
904
+ const DEFAULT_EXTERNAL_PAYMENT_OPTIONS = [
905
+ ExternalPaymentOptions.Coinbase,
906
+ ExternalPaymentOptions.Binance,
907
+ ExternalPaymentOptions.Daimo,
908
+ ExternalPaymentOptions.RampNetwork,
909
+ ];
910
+ function useExternalPaymentOptions({ filterIds, usdRequired, platform, }) {
911
+ const [options, setOptions] = useState([]);
912
+ const [loading, setLoading] = useState(false);
913
+ useEffect(() => {
914
+ const refreshExternalPaymentOptions = async (usd) => {
915
+ if (!platform)
916
+ return;
917
+ setLoading(true);
918
+ try {
919
+ const newOptions = await trpc.getExternalPaymentOptions.query({
920
+ usdRequired: usd,
921
+ platform,
922
+ });
923
+ // Filter out options not in options JSON
924
+ const enabledExtPaymentOptions = filterIds || DEFAULT_EXTERNAL_PAYMENT_OPTIONS;
925
+ const filteredOptions = newOptions.filter((option) => enabledExtPaymentOptions.includes(option.id));
926
+ setOptions(filteredOptions);
927
+ }
928
+ catch (error) {
929
+ console.error(error);
930
+ }
931
+ finally {
932
+ setLoading(false);
933
+ }
934
+ };
935
+ if (usdRequired != null) {
936
+ refreshExternalPaymentOptions(usdRequired);
937
+ }
938
+ }, [usdRequired, filterIds, platform]);
939
+ return {
940
+ options,
941
+ loading,
942
+ };
943
+ }
944
+
945
+ function useWalletPaymentOptions({ address, usdRequired, destChainId, }) {
946
+ const [options, setOptions] = useState(null);
947
+ const [isLoading, setIsLoading] = useState(false);
948
+ useEffect(() => {
949
+ const refreshWalletPaymentOptions = async () => {
950
+ setOptions(null);
951
+ setIsLoading(true);
952
+ try {
953
+ const newOptions = await trpc.getWalletPaymentOptions.query({
954
+ payerAddress: address,
955
+ usdRequired,
956
+ destChainId,
957
+ });
958
+ setOptions(newOptions);
959
+ }
960
+ catch (error) {
961
+ console.error(error);
962
+ }
963
+ finally {
964
+ setIsLoading(false);
965
+ }
966
+ };
967
+ if (!address || !usdRequired || !destChainId)
968
+ return;
969
+ if (address && usdRequired != null && destChainId) {
970
+ refreshWalletPaymentOptions();
971
+ }
972
+ }, [address, usdRequired, destChainId]);
973
+ return {
974
+ options,
975
+ isLoading,
976
+ };
977
+ }
978
+
979
+ function usePaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
980
+ // Browser state.
981
+ const [platform, setPlatform] = useState();
982
+ useEffect(() => {
983
+ setPlatform(detectPlatform(window.navigator.userAgent));
984
+ }, []);
904
985
  // Wallet state.
905
986
  const { address: senderAddr } = useAccount();
987
+ const { data: senderEnsName } = useEnsName({
988
+ chainId: ethereum.chainId,
989
+ address: senderAddr,
990
+ });
906
991
  const { writeContractAsync } = useWriteContract();
907
992
  const { sendTransactionAsync } = useSendTransaction();
908
993
  // Daimo Pay order state.
@@ -910,14 +995,24 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
910
995
  // Payment UI config.
911
996
  const [modalOptions, setModalOptions] = useState({});
912
997
  // UI state. Selection for external payment (Binance, etc) vs wallet payment.
998
+ const externalPaymentOptions = useExternalPaymentOptions({
999
+ filterIds: daimoPayOrder?.metadata.payer?.paymentOptions,
1000
+ usdRequired: daimoPayOrder?.destFinalCallTokenAmount.usd,
1001
+ platform,
1002
+ });
1003
+ const walletPaymentOptions = useWalletPaymentOptions({
1004
+ address: senderAddr,
1005
+ usdRequired: daimoPayOrder?.destFinalCallTokenAmount.usd,
1006
+ destChainId: daimoPayOrder?.destFinalCallTokenAmount.token.chainId,
1007
+ });
913
1008
  const [selectedExternalOption, setSelectedExternalOption] = useState();
914
1009
  const [selectedTokenOption, setSelectedTokenOption] = useState();
915
1010
  const payWithToken = async (tokenAmount) => {
916
- assert(!!daimoPayOrder);
1011
+ assert(!!daimoPayOrder && !!platform);
917
1012
  const { hydratedOrder } = await trpc.hydrateOrder.query({
918
1013
  id: daimoPayOrder.id.toString(),
919
1014
  chosenFinalTokenAmount: daimoPayOrder.destFinalCallTokenAmount.amount,
920
- platform: detectPlatform(window.navigator.userAgent),
1015
+ platform,
921
1016
  refundAddress: senderAddr,
922
1017
  });
923
1018
  log(`[CHECKOUT] Hydrated order: ${JSON.stringify(hydratedOrder)}, checking out with ${tokenAmount.token.token}`);
@@ -925,7 +1020,7 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
925
1020
  try {
926
1021
  if (tokenAmount.token.token === zeroAddress) {
927
1022
  return await sendTransactionAsync({
928
- to: hydratedOrder.handoffAddr,
1023
+ to: hydratedOrder.intentAddr,
929
1024
  value: BigInt(tokenAmount.amount),
930
1025
  });
931
1026
  }
@@ -934,7 +1029,7 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
934
1029
  abi: erc20Abi,
935
1030
  address: tokenAmount.token.token,
936
1031
  functionName: "transfer",
937
- args: [hydratedOrder.handoffAddr, BigInt(tokenAmount.amount)],
1032
+ args: [hydratedOrder.intentAddr, BigInt(tokenAmount.amount)],
938
1033
  });
939
1034
  }
940
1035
  }
@@ -959,12 +1054,12 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
959
1054
  }
960
1055
  };
961
1056
  const payWithExternal = async (option) => {
962
- assert(!!daimoPayOrder);
1057
+ assert(!!daimoPayOrder && !!platform);
963
1058
  const { hydratedOrder, externalPaymentOptionData } = await trpc.hydrateOrder.query({
964
1059
  id: daimoPayOrder.id.toString(),
965
1060
  externalPaymentOption: option,
966
1061
  chosenFinalTokenAmount: daimoPayOrder.destFinalCallTokenAmount.amount,
967
- platform: detectPlatform(window.navigator.userAgent),
1062
+ platform,
968
1063
  });
969
1064
  assert(!!externalPaymentOptionData);
970
1065
  setPaymentWaitingMessage(externalPaymentOptionData.waitingMessage);
@@ -1025,6 +1120,8 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
1025
1120
  paymentWaitingMessage,
1026
1121
  selectedExternalOption,
1027
1122
  selectedTokenOption,
1123
+ externalPaymentOptions,
1124
+ walletPaymentOptions,
1028
1125
  setSelectedExternalOption,
1029
1126
  setSelectedTokenOption,
1030
1127
  setChosenUsd,
@@ -1032,6 +1129,7 @@ function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
1032
1129
  payWithExternal,
1033
1130
  refreshOrder,
1034
1131
  onSuccess,
1132
+ senderEnsName: senderEnsName ?? undefined,
1035
1133
  };
1036
1134
  }
1037
1135
 
@@ -2176,7 +2274,7 @@ const ResetContainer = styled(motion.div) `
2176
2274
  `;
2177
2275
 
2178
2276
  var name = "@daimo/pay";
2179
- var version = "0.3.9";
2277
+ var version = "0.3.11";
2180
2278
  var author = "Daimo";
2181
2279
  var homepage = "https://pay.daimo.com";
2182
2280
  var license = "BSD-2-Clause license";
@@ -2215,8 +2313,8 @@ var keywords = [
2215
2313
  "crypto"
2216
2314
  ];
2217
2315
  var dependencies = {
2218
- "@daimo/common": "0.3.6",
2219
- "@daimo/contract": "0.3.6",
2316
+ "@daimo/common": "0.3.11",
2317
+ "@daimo/contract": "0.3.11",
2220
2318
  "@trpc/client": "^11.0.0-next-beta.318",
2221
2319
  "@trpc/server": "^11.0.0-next-beta.318",
2222
2320
  buffer: "^6.0.3",
@@ -6909,6 +7007,7 @@ const Zora = ({ testnet, ...props }) => (jsxs("svg", { ...props, width: "44", he
6909
7007
  }, children: [jsx("mask", { id: "ck_zora_mask_a", style: {
6910
7008
  maskType: "alpha",
6911
7009
  }, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "44", height: "44", children: jsx("path", { d: "M22 44C34.1503 44 44 34.1503 44 22C44 9.84974 34.1503 0 22 0C9.84974 0 0 9.84974 0 22C0 34.1503 9.84974 44 22 44Z", fill: "#D9D9D9" }) }), jsxs("g", { mask: "url(#ck_zora_mask_a)", children: [jsx("path", { d: "M51.4558 -9.56445H-6.78906V48.6804H51.4558V-9.56445Z", fill: "#A1723A" }), jsx("g", { filter: "url(#ck_zora_filter_a)", children: jsx("path", { d: "M23.6807 43.0752C36.6464 43.0752 47.157 32.5675 47.157 19.6058C47.157 6.64397 36.6464 -3.86365 23.6807 -3.86365C10.7152 -3.86365 0.20459 6.64397 0.20459 19.6058C0.20459 32.5675 10.7152 43.0752 23.6807 43.0752Z", fill: "#531002" }) }), jsx("g", { filter: "url(#ck_zora_filter_b)", children: jsx("path", { d: "M26.2112 35.6464C36.7271 35.6464 45.2521 27.1185 45.2521 16.5988C45.2521 6.07904 36.7271 -2.44885 26.2112 -2.44885C15.6953 -2.44885 7.17041 6.07904 7.17041 16.5988C7.17041 27.1185 15.6953 35.6464 26.2112 35.6464Z", fill: "#2B5DF0" }) }), jsx("g", { filter: "url(#ck_zora_filter_c)", children: jsx("path", { d: "M25.8644 36.7348C36.8276 36.7348 45.7149 27.8444 45.7149 16.8777C45.7149 5.91084 36.8276 -2.97949 25.8644 -2.97949C14.9015 -2.97949 6.01416 5.91084 6.01416 16.8777C6.01416 27.8444 14.9015 36.7348 25.8644 36.7348Z", fill: "url(#paint0_radial_3914_1946)" }) }), jsx("g", { filter: "url(#ck_zora_filter_d)", children: jsx("path", { d: "M29.1567 21.8779C34.6797 21.8779 39.1567 17.4008 39.1567 11.8779C39.1567 6.35509 34.6797 1.87793 29.1567 1.87793C23.6338 1.87793 19.1567 6.35509 19.1567 11.8779C19.1567 17.4008 23.6338 21.8779 29.1567 21.8779Z", fill: "#FCB8D4" }) }), jsx("g", { filter: "url(#ck_zora_filter_e)", children: jsx("path", { d: "M29.15 15.8642C31.3555 15.8642 33.1432 14.0765 33.1432 11.871C33.1432 9.66562 31.3555 7.87781 29.15 7.87781C26.9445 7.87781 25.1567 9.66562 25.1567 11.871C25.1567 14.0765 26.9445 15.8642 29.15 15.8642Z", fill: "white" }) }), jsx("g", { filter: "url(#ck_zora_filter_f)", children: jsx("path", { d: "M26.4967 51.7416C46.3151 51.7416 62.3811 35.6757 62.3811 15.8573C62.3811 -3.96109 46.3151 -20.0271 26.4967 -20.0271C6.67829 -20.0271 -9.3877 -3.96109 -9.3877 15.8573C-9.3877 35.6757 6.67829 51.7416 26.4967 51.7416Z", fill: "url(#paint1_radial_3914_1946)", fillOpacity: "0.9" }) })] }), jsxs("defs", { children: [jsxs("filter", { id: "ck_zora_filter_a", x: "-5.23758", y: "-9.30581", width: "57.837", height: "57.8232", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "2.72108", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("filter", { id: "ck_zora_filter_b", x: "-3.71395", y: "-13.3332", width: "59.8503", height: "59.8639", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "5.44218", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("filter", { id: "ck_zora_filter_c", x: "1.93251", y: "-7.06114", width: "47.864", height: "47.8775", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "2.04082", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("filter", { id: "ck_zora_filter_d", x: "10.9935", y: "-6.28533", width: "36.3265", height: "36.3265", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "4.08163", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("filter", { id: "ck_zora_filter_e", x: "19.7146", y: "2.43564", width: "18.8707", height: "18.8708", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "2.72108", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("filter", { id: "ck_zora_filter_f", x: "-13.4693", y: "-24.1087", width: "79.9318", height: "79.9321", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), jsx("feGaussianBlur", { stdDeviation: "2.04082", result: "effect1_foregroundBlur_3914_1946" })] }), jsxs("radialGradient", { id: "paint0_radial_3914_1946", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(29.2127 11.2756) rotate(128.228) scale(37.4897 37.4867)", children: [jsx("stop", { offset: "0.286458", stopColor: "#387AFA" }), jsx("stop", { offset: "0.647782", stopColor: "#387AFA", stopOpacity: "0" })] }), jsxs("radialGradient", { id: "paint1_radial_3914_1946", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(26.4967 15.8573) rotate(90) scale(35.8844 35.8844)", children: [jsx("stop", { offset: "0.598958", stopOpacity: "0" }), jsx("stop", { offset: "0.671875" }), jsx("stop", { offset: "0.734375", stopOpacity: "0" })] })] })] }));
7010
+ const Linea = ({ testnet, ...props }) => (jsxs("svg", { ...props, width: "44", height: "44", viewBox: "0 0 200 200", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M200 0H0V200H200V0Z", fill: "#121212" }), jsx("mask", { id: "mask0_267_10", style: { maskType: "luminance" }, maskUnits: "userSpaceOnUse", x: "50", y: "48", width: "100", height: "104", children: jsx("path", { d: "M149.541 48H50V151.977H149.541V48Z", fill: "white" }) }), jsxs("g", { mask: "url(#mask0_267_10)", children: [jsx("path", { d: "M132.669 151.977H50V64.8721H68.9147V135.096H132.669V151.968V151.977Z", fill: "white" }), jsx("path", { d: "M132.669 81.7441C141.987 81.7441 149.541 74.1902 149.541 64.8721C149.541 55.5539 141.987 48 132.669 48C123.35 48 115.797 55.5539 115.797 64.8721C115.797 74.1902 123.35 81.7441 132.669 81.7441Z", fill: "white" })] })] }));
6912
7011
  const chainToLogo = {
6913
7012
  [ethereum.chainId]: jsx(Ethereum, {}),
6914
7013
  [arbitrum$1.chainId]: jsx(Arbitrum, {}),
@@ -6917,6 +7016,8 @@ const chainToLogo = {
6917
7016
  [polygon$1.chainId]: jsx(Polygon, {}),
6918
7017
  [ethereumSepolia.chainId]: jsx(Ethereum, {}),
6919
7018
  [baseSepolia$1.chainId]: jsx(Base, {}),
7019
+ [linea$1.chainId]: jsx(Linea, {}),
7020
+ [bsc$1.chainId]: jsx(BinanceSmartChain, {}),
6920
7021
  };
6921
7022
  var ChainIcons = {
6922
7023
  UnknownChain,
@@ -10544,12 +10645,6 @@ const IconStackItem = styled(motion.div) `
10544
10645
  border-radius: 22.5%;
10545
10646
  `;
10546
10647
 
10547
- const DEFAULT_EXTERNAL_PAYMENT_OPTIONS = [
10548
- ExternalPaymentOptions.Coinbase,
10549
- ExternalPaymentOptions.Binance,
10550
- ExternalPaymentOptions.Daimo,
10551
- ExternalPaymentOptions.RampNetwork,
10552
- ];
10553
10648
  // Get 3 icons, skipping the one that is already connected
10554
10649
  function getBestUnconnectedWalletIcons(connector) {
10555
10650
  const icons = [];
@@ -10573,13 +10668,9 @@ const SelectMethod = () => {
10573
10668
  const isMobile = useIsMobile();
10574
10669
  const { address, isConnected, connector } = useAccount();
10575
10670
  const { disconnectAsync } = useDisconnect();
10576
- const { data: ensName } = useEnsName({
10577
- chainId: ethereum.chainId,
10578
- address: address,
10579
- });
10580
- const displayName = ensName ?? (address ? getAddressContraction(address) : "wallet");
10581
- const { setRoute, paymentInfo } = useContext();
10582
- const { daimoPayOrder, setSelectedExternalOption } = paymentInfo;
10671
+ const { setRoute, paymentInfo, log } = useContext();
10672
+ const { setSelectedExternalOption, externalPaymentOptions, senderEnsName } = paymentInfo;
10673
+ const displayName = senderEnsName ?? (address ? getAddressContraction(address) : "wallet");
10583
10674
  const connectedWalletOption = isConnected
10584
10675
  ? {
10585
10676
  id: "connectedWallet",
@@ -10602,30 +10693,10 @@ const SelectMethod = () => {
10602
10693
  const walletOptions = connectedWalletOption
10603
10694
  ? [connectedWalletOption, unconnectedWalletOption]
10604
10695
  : [unconnectedWalletOption];
10605
- const [externalPaymentOptions, setExternalPaymentOptions] = useState([]);
10606
- const [loadingExternalPaymentOptions, setLoadingExternalPaymentOptions] = useState(true);
10607
- useEffect(() => {
10608
- const refreshExternalPaymentOptions = async (usd) => {
10609
- setLoadingExternalPaymentOptions(true);
10610
- const options = await trpc.getExternalPaymentOptions.query({
10611
- usdRequired: usd,
10612
- platform: detectPlatform(window.navigator.userAgent),
10613
- });
10614
- // Filter out options not in options JSON
10615
- const enabledExtPaymentOptions = daimoPayOrder?.metadata.payer?.paymentOptions ||
10616
- DEFAULT_EXTERNAL_PAYMENT_OPTIONS;
10617
- const filteredOptions = options.filter((option) => enabledExtPaymentOptions.includes(option.id));
10618
- setExternalPaymentOptions(filteredOptions);
10619
- setLoadingExternalPaymentOptions(false);
10620
- };
10621
- const usd = daimoPayOrder?.destFinalCallTokenAmount.usd;
10622
- if (usd != null) {
10623
- refreshExternalPaymentOptions(usd);
10624
- }
10625
- }, [daimoPayOrder?.destFinalCallTokenAmount.usd]);
10626
- return (jsxs(PageContent, { children: [jsx(OrderHeader, {}), jsx(OptionsList, { requiredSkeletons: isMobile ? 4 : 3, isLoading: loadingExternalPaymentOptions, options: [
10696
+ log(`[SELECT_METHOD] loading: ${externalPaymentOptions.loading}, options: ${JSON.stringify(externalPaymentOptions.options)}`);
10697
+ return (jsxs(PageContent, { children: [jsx(OrderHeader, {}), jsx(OptionsList, { requiredSkeletons: isMobile ? 4 : 3, isLoading: externalPaymentOptions.loading, options: [
10627
10698
  ...walletOptions,
10628
- ...(externalPaymentOptions ?? []).map((option) => ({
10699
+ ...(externalPaymentOptions.options ?? []).map((option) => ({
10629
10700
  id: option.id,
10630
10701
  title: option.cta,
10631
10702
  icons: [option.logoURI],
@@ -10658,32 +10729,15 @@ const ChainContainer = styled(motion.div) `
10658
10729
  `;
10659
10730
  const SelectToken = () => {
10660
10731
  const { setRoute, paymentInfo } = useContext();
10661
- const { daimoPayOrder, setSelectedTokenOption } = paymentInfo;
10662
- const { address: payerAddress } = useAccount();
10663
- const [paymentOptions, setPaymentOptions] = useState(null);
10664
- const [isLoadingOptions, setIsLoadingOptions] = useState(true);
10665
- useEffect(() => {
10666
- if (!payerAddress || !daimoPayOrder)
10667
- return;
10668
- setPaymentOptions(null);
10669
- setIsLoadingOptions(true);
10670
- const destChainId = daimoPayOrder.destFinalCallTokenAmount.token.chainId;
10671
- trpc.getWalletPaymentOptions
10672
- .query({
10673
- payerAddress,
10674
- usdRequired: daimoPayOrder.destFinalCallTokenAmount.usd,
10675
- destChainId,
10676
- })
10677
- .then(setPaymentOptions)
10678
- .finally(() => setIsLoadingOptions(false));
10679
- }, [payerAddress, daimoPayOrder]);
10680
- return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), !isLoadingOptions && paymentOptions?.length === 0 && (jsxs(ModalContent, { style: {
10732
+ const { setSelectedTokenOption, walletPaymentOptions } = paymentInfo;
10733
+ return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), walletPaymentOptions.isLoading &&
10734
+ walletPaymentOptions.options?.length === 0 && (jsxs(ModalContent, { style: {
10681
10735
  display: "flex",
10682
10736
  alignItems: "center",
10683
10737
  justifyContent: "center",
10684
10738
  paddingTop: 16,
10685
10739
  paddingBottom: 16,
10686
- }, children: [jsx(ModalH1, { children: "Insufficient balance. Please select an alternative payment method." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD), children: "Select Another Method" })] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: isLoadingOptions, options: paymentOptions?.map((option) => {
10740
+ }, children: [jsx(ModalH1, { children: "Insufficient balance. Please select an alternative payment method." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD), children: "Select Another Method" })] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: walletPaymentOptions.isLoading, options: walletPaymentOptions.options?.map((option) => {
10687
10741
  const capitalizedChainName = capitalize(getChainName(option.required.token.chainId));
10688
10742
  const title = `${getDisplayPrice(option.required)} ${option.required.token.symbol} on ${capitalizedChainName}`;
10689
10743
  const subtitle = `Balance: ${getDisplayPrice(option.balance)} ${option.balance.token.symbol}`;
@@ -10990,7 +11044,7 @@ const DaimoPayProvider = ({ children, theme = "auto", mode = "auto", customTheme
10990
11044
  // downstream hooks like useDaimoPayStatus() to work correctly, we must set
10991
11045
  // set refresh context when payment status changes; done via setDaimoPayOrder.
10992
11046
  const [daimoPayOrder, setDaimoPayOrder] = useState();
10993
- const paymentInfo = getPaymentInfo({
11047
+ const paymentInfo = usePaymentInfo({
10994
11048
  daimoPayOrder,
10995
11049
  setDaimoPayOrder,
10996
11050
  setOpen,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { CustomTheme, DaimoPayContextOptions, DaimoPayModalOptions, Languages, Mode, Theme } from "../types";
3
3
  import { useConnectCallbackProps } from "../hooks/useConnectCallback";
4
- import { PaymentInfo } from "../utils/getPaymentInfo";
4
+ import { PaymentInfo } from "../hooks/usePaymentInfo";
5
5
  export declare enum ROUTES {
6
6
  SELECT_METHOD = "daimoPaySelectMethod",
7
7
  SELECT_TOKEN = "daimoPaySelectToken",
@@ -0,0 +1,9 @@
1
+ import { ExternalPaymentOptionMetadata, PlatformType } from "@daimo/common";
2
+ export declare function useExternalPaymentOptions({ filterIds, usdRequired, platform, }: {
3
+ filterIds: string[] | undefined;
4
+ usdRequired: number | undefined;
5
+ platform: PlatformType | undefined;
6
+ }): {
7
+ options: ExternalPaymentOptionMetadata[];
8
+ loading: boolean;
9
+ };
@@ -1,8 +1,8 @@
1
1
  import { DaimoPayOrder, DaimoPayTokenAmount, ExternalPaymentOptionMetadata, ExternalPaymentOptions } from "@daimo/common";
2
2
  import { DaimoPayModalOptions } from "../types";
3
- import { trpc } from "./trpc";
4
- /** Wallet payment options. User picks one. */
5
- export type PaymentOption = Awaited<ReturnType<typeof trpc.getWalletPaymentOptions.query>>[0];
3
+ import { trpc } from "../utils/trpc";
4
+ import { useExternalPaymentOptions } from "./useExternalPaymentOptions";
5
+ import { useWalletPaymentOptions, WalletPaymentOption } from "./useWalletPaymentOptions";
6
6
  /** Wallet payment details, sent to processSourcePayment after submitting tx. */
7
7
  export type SourcePayment = Parameters<typeof trpc.processSourcePayment.mutate>[0];
8
8
  /** Loads a DaimoPayOrder + manages the corresponding modal. */
@@ -12,10 +12,12 @@ export interface PaymentInfo {
12
12
  modalOptions: DaimoPayModalOptions;
13
13
  setModalOptions: (modalOptions: DaimoPayModalOptions) => void;
14
14
  paymentWaitingMessage: string | undefined;
15
+ externalPaymentOptions: ReturnType<typeof useExternalPaymentOptions>;
16
+ walletPaymentOptions: ReturnType<typeof useWalletPaymentOptions>;
15
17
  selectedExternalOption: ExternalPaymentOptionMetadata | undefined;
16
- selectedTokenOption: PaymentOption | undefined;
18
+ selectedTokenOption: WalletPaymentOption | undefined;
17
19
  setSelectedExternalOption: (option: ExternalPaymentOptionMetadata | undefined) => void;
18
- setSelectedTokenOption: (option: PaymentOption | undefined) => void;
20
+ setSelectedTokenOption: (option: WalletPaymentOption | undefined) => void;
19
21
  setChosenUsd: (amount: number) => void;
20
22
  payWithToken: (tokenAmount: DaimoPayTokenAmount) => Promise<void>;
21
23
  payWithExternal: (option: ExternalPaymentOptions) => Promise<string>;
@@ -24,28 +26,11 @@ export interface PaymentInfo {
24
26
  txHash: string;
25
27
  txURL?: string;
26
28
  }) => void;
29
+ senderEnsName: string | undefined;
27
30
  }
28
- export declare function getPaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }: {
31
+ export declare function usePaymentInfo({ daimoPayOrder, setDaimoPayOrder, setOpen, log, }: {
29
32
  daimoPayOrder: DaimoPayOrder | undefined;
30
33
  setDaimoPayOrder: (o: DaimoPayOrder) => void;
31
34
  setOpen: (showModal: boolean) => void;
32
35
  log: (...args: any[]) => void;
33
- }): {
34
- setPayId: (payId: string | null) => Promise<void>;
35
- daimoPayOrder: DaimoPayOrder | undefined;
36
- modalOptions: DaimoPayModalOptions;
37
- setModalOptions: import("react").Dispatch<import("react").SetStateAction<DaimoPayModalOptions>>;
38
- paymentWaitingMessage: string | undefined;
39
- selectedExternalOption: ExternalPaymentOptionMetadata | undefined;
40
- selectedTokenOption: any;
41
- setSelectedExternalOption: import("react").Dispatch<import("react").SetStateAction<ExternalPaymentOptionMetadata | undefined>>;
42
- setSelectedTokenOption: import("react").Dispatch<any>;
43
- setChosenUsd: (usdAmount: number) => void;
44
- payWithToken: (tokenAmount: DaimoPayTokenAmount) => Promise<void>;
45
- payWithExternal: (option: ExternalPaymentOptions) => Promise<any>;
46
- refreshOrder: () => Promise<void>;
47
- onSuccess: ({ txHash, txURL }: {
48
- txHash: string;
49
- txURL?: string;
50
- }) => void;
51
- };
36
+ }): PaymentInfo;
@@ -0,0 +1,11 @@
1
+ import { trpc } from "../utils/trpc";
2
+ /** Wallet payment options. User picks one. */
3
+ export type WalletPaymentOption = Awaited<ReturnType<typeof trpc.getWalletPaymentOptions.query>>[0];
4
+ export declare function useWalletPaymentOptions({ address, usdRequired, destChainId, }: {
5
+ address: string | undefined;
6
+ usdRequired: number | undefined;
7
+ destChainId: number | undefined;
8
+ }): {
9
+ options: any[] | null;
10
+ isLoading: boolean;
11
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daimo/pay",
3
3
  "private": false,
4
- "version": "0.3.9",
4
+ "version": "0.3.11",
5
5
  "author": "Daimo",
6
6
  "homepage": "https://pay.daimo.com",
7
7
  "license": "BSD-2-Clause license",
@@ -40,8 +40,8 @@
40
40
  "crypto"
41
41
  ],
42
42
  "dependencies": {
43
- "@daimo/common": "0.3.6",
44
- "@daimo/contract": "0.3.6",
43
+ "@daimo/common": "0.3.11",
44
+ "@daimo/contract": "0.3.11",
45
45
  "@trpc/client": "^11.0.0-next-beta.318",
46
46
  "@trpc/server": "^11.0.0-next-beta.318",
47
47
  "buffer": "^6.0.3",
@@ -1,2 +0,0 @@
1
- declare const ConnectUsing: () => import("react/jsx-runtime").JSX.Element;
2
- export default ConnectUsing;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- export declare const states: {
3
- CONNECTED: string;
4
- CONNECTING: string;
5
- EXPIRING: string;
6
- FAILED: string;
7
- REJECTED: string;
8
- NOTCONNECTED: string;
9
- UNAVAILABLE: string;
10
- };
11
- declare const ConnectWithInjector: React.FC<{
12
- switchConnectMethod: (id?: string) => void;
13
- forceState?: typeof states;
14
- }>;
15
- export default ConnectWithInjector;
@@ -1,6 +0,0 @@
1
- export declare const Content: any;
2
- export declare const Container: any;
3
- export declare const ConnectingContainer: any;
4
- export declare const ConnectingAnimation: any;
5
- export declare const RetryButton: any;
6
- export declare const RetryIconContainer: any;
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- declare const ConnectWithQRCode: React.FC<{
3
- switchConnectMethod: (id?: string) => void;
4
- }>;
5
- export default ConnectWithQRCode;
@@ -1,8 +0,0 @@
1
- import { CustomTheme, Languages, Mode, Theme } from "../../types";
2
- declare const ConnectModal: React.FC<{
3
- mode?: Mode;
4
- theme?: Theme;
5
- customTheme?: CustomTheme;
6
- lang?: Languages;
7
- }>;
8
- export default ConnectModal;