@daimo/pay 1.6.3 → 1.6.4

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
@@ -484,7 +484,10 @@ type WalletConfigProps = {
484
484
  safari?: string;
485
485
  };
486
486
  getWalletConnectDeeplink?: (uri: string) => string;
487
+ walletDeepLink?: string;
487
488
  shouldDeeplinkDesktop?: boolean;
489
+ showInMobileConnectors?: boolean;
490
+ isWcMobileConnector?: boolean;
488
491
  };
489
492
 
490
493
  type SolanaWalletName = WalletName<string>;
package/build/index.js CHANGED
@@ -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.6.3";
25
+ var version = "1.6.4";
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.6.3",
64
+ "@daimo/pay-common": "1.6.4",
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",
@@ -4467,8 +4467,10 @@ function useWalletConnectConnector() {
4467
4467
 
4468
4468
  // Organised in alphabetical order by key
4469
4469
  const walletConfigs = {
4470
+ //TODO: update new wallet configs with favorite wallets
4470
4471
  mock: {
4471
4472
  icon: jsx(Logos$1.Mock, {}),
4473
+ showInMobileConnectors: false,
4472
4474
  },
4473
4475
  argent: {
4474
4476
  name: "Argent",
@@ -4478,6 +4480,7 @@ const walletConfigs = {
4478
4480
  android: "https://play.google.com/store/apps/details?id=im.argent.contractwalletclient",
4479
4481
  ios: "https://apps.apple.com/app/argent/id1358741926",
4480
4482
  },
4483
+ showInMobileConnectors: false,
4481
4484
  getWalletConnectDeeplink: (uri) => {
4482
4485
  return `https://argent.link/app/wc?uri=${encodeURIComponent(uri)}`;
4483
4486
  },
@@ -4494,6 +4497,7 @@ const walletConfigs = {
4494
4497
  ios: "https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",
4495
4498
  chrome: "https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",
4496
4499
  },
4500
+ showInMobileConnectors: false,
4497
4501
  getWalletConnectDeeplink: (uri) => {
4498
4502
  return `https://go.cb-w.com/wc?uri=${encodeURIComponent(uri)}`;
4499
4503
  },
@@ -4510,6 +4514,7 @@ const walletConfigs = {
4510
4514
  ios: "https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",
4511
4515
  chrome: "https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",
4512
4516
  },
4517
+ showInMobileConnectors: false,
4513
4518
  getWalletConnectDeeplink: (uri) => {
4514
4519
  return `https://go.cb-w.com/wc?uri=${encodeURIComponent(uri)}`;
4515
4520
  },
@@ -4517,6 +4522,7 @@ const walletConfigs = {
4517
4522
  "com.crypto.wallet": {
4518
4523
  name: "Crypto.com",
4519
4524
  shortName: "Crypto",
4525
+ showInMobileConnectors: false,
4520
4526
  },
4521
4527
  dawn: {
4522
4528
  name: "Dawn Wallet",
@@ -4526,6 +4532,7 @@ const walletConfigs = {
4526
4532
  website: "https://www.dawnwallet.xyz/",
4527
4533
  ios: "https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782",
4528
4534
  },
4535
+ showInMobileConnectors: false,
4529
4536
  },
4530
4537
  "co.family.wallet": {
4531
4538
  name: "Family",
@@ -4540,6 +4547,8 @@ const walletConfigs = {
4540
4547
  getWalletConnectDeeplink: (uri) => {
4541
4548
  return `familywallet://wc?uri=${encodeURIComponent(uri)}`;
4542
4549
  },
4550
+ walletDeepLink: "familywallet://",
4551
+ showInMobileConnectors: true,
4543
4552
  },
4544
4553
  frame: {
4545
4554
  name: "Frame",
@@ -4552,6 +4561,7 @@ const walletConfigs = {
4552
4561
  firefox: "https://addons.mozilla.org/en-US/firefox/addon/frame-extension",
4553
4562
  brave: "https://chrome.google.com/webstore/detail/frame-companion/ldcoohedfbjoobcadoglnnmmfbdlmmhf",
4554
4563
  },
4564
+ showInMobileConnectors: false,
4555
4565
  getWalletConnectDeeplink: (uri) => uri,
4556
4566
  },
4557
4567
  frontier: {
@@ -4565,6 +4575,7 @@ const walletConfigs = {
4565
4575
  website: "https://frontier.xyz/",
4566
4576
  chrome: "https://chrome.google.com/webstore/detail/frontier-wallet/kppfdiipphfccemcignhifpjkapfbihd",
4567
4577
  },
4578
+ showInMobileConnectors: false,
4568
4579
  getWalletConnectDeeplink: (uri) => {
4569
4580
  return `frontier://wc?uri=${encodeURIComponent(uri)}`;
4570
4581
  },
@@ -4573,6 +4584,7 @@ const walletConfigs = {
4573
4584
  name: "Browser Wallet",
4574
4585
  shortName: "Browser",
4575
4586
  icon: jsx(Logos$1.Injected, {}),
4587
+ showInMobileConnectors: false,
4576
4588
  },
4577
4589
  "metaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK": {
4578
4590
  name: "MetaMask",
@@ -4589,6 +4601,7 @@ const walletConfigs = {
4589
4601
  brave: "https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",
4590
4602
  edge: "https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",
4591
4603
  },
4604
+ showInMobileConnectors: false,
4592
4605
  getWalletConnectDeeplink: (uri) => {
4593
4606
  return `https://metamask.app.link/wc?uri=${encodeURIComponent(uri)}`;
4594
4607
  },
@@ -4596,6 +4609,7 @@ const walletConfigs = {
4596
4609
  "app.phantom": {
4597
4610
  name: "Phantom",
4598
4611
  iconShape: "squircle",
4612
+ showInMobileConnectors: false,
4599
4613
  },
4600
4614
  "me.rainbow": {
4601
4615
  name: "Rainbow Wallet",
@@ -4611,6 +4625,7 @@ const walletConfigs = {
4611
4625
  edge: "https://rainbow.me/extension?utm_source=daimopay",
4612
4626
  brave: "https://rainbow.me/extension?utm_source=daimopay",
4613
4627
  },
4628
+ showInMobileConnectors: true,
4614
4629
  getWalletConnectDeeplink: (uri) => {
4615
4630
  return `https://rnbwapp.com/wc?uri=${encodeURIComponent(uri)}&connector=daimopay`;
4616
4631
  },
@@ -4622,6 +4637,7 @@ const walletConfigs = {
4622
4637
  website: "https://rabby.io",
4623
4638
  chrome: "https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch",
4624
4639
  },
4640
+ showInMobileConnectors: false,
4625
4641
  },
4626
4642
  safe: {
4627
4643
  name: "Safe",
@@ -4632,6 +4648,7 @@ const walletConfigs = {
4632
4648
  ios: "https://apps.apple.com/app/id1515759131",
4633
4649
  android: "https://play.google.com/store/apps/details?id=io.gnosis.safe",
4634
4650
  },
4651
+ showInMobileConnectors: false,
4635
4652
  getWalletConnectDeeplink: (uri) => {
4636
4653
  return `https://gnosis-safe.io/wc?uri=${encodeURIComponent(uri)}`;
4637
4654
  },
@@ -4646,6 +4663,7 @@ const walletConfigs = {
4646
4663
  chrome: "https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",
4647
4664
  firefox: "https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/",
4648
4665
  },
4666
+ showInMobileConnectors: false,
4649
4667
  },
4650
4668
  "com.trustwallet.app": {
4651
4669
  name: "Trust Wallet",
@@ -4657,6 +4675,7 @@ const walletConfigs = {
4657
4675
  android: "https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
4658
4676
  ios: "https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",
4659
4677
  },
4678
+ showInMobileConnectors: false,
4660
4679
  getWalletConnectDeeplink(uri) {
4661
4680
  return `https://link.trustwallet.com/wc?uri=${encodeURIComponent(uri)}`;
4662
4681
  },
@@ -4672,6 +4691,7 @@ const walletConfigs = {
4672
4691
  brave: "https://infinitywallet.io/download",
4673
4692
  edge: "https://infinitywallet.io/download",
4674
4693
  },
4694
+ showInMobileConnectors: false,
4675
4695
  },
4676
4696
  imToken: {
4677
4697
  name: "imToken",
@@ -4682,6 +4702,7 @@ const walletConfigs = {
4682
4702
  android: "https://play.google.com/store/apps/details?id=im.token.app",
4683
4703
  ios: "https://itunes.apple.com/us/app/imtoken2/id1384798940",
4684
4704
  },
4705
+ showInMobileConnectors: false,
4685
4706
  getWalletConnectDeeplink: (uri) => {
4686
4707
  return `imtokenv2://wc?uri=${encodeURIComponent(uri)}`;
4687
4708
  },
@@ -4694,6 +4715,7 @@ const walletConfigs = {
4694
4715
  ios: "https://apps.apple.com/app/bank-bitcoin-wallet/id1447619907",
4695
4716
  android: "https://play.google.com/store/apps/details?id=io.horizontalsystems.bankwallet",
4696
4717
  },
4718
+ showInMobileConnectors: false,
4697
4719
  getWalletConnectDeeplink: (uri) => {
4698
4720
  return `https://unstoppable.money/wc?uri=${encodeURIComponent(uri)}`;
4699
4721
  },
@@ -4707,6 +4729,7 @@ const walletConfigs = {
4707
4729
  android: "https://play.google.com/store/apps/details?id=com.github.ontio.onto",
4708
4730
  website: "https://onto.app/en/download/",
4709
4731
  },
4732
+ showInMobileConnectors: false,
4710
4733
  getWalletConnectDeeplink: (uri) => {
4711
4734
  return `https://onto.app/wc?uri=${encodeURIComponent(uri)}`;
4712
4735
  },
@@ -4720,6 +4743,7 @@ const walletConfigs = {
4720
4743
  ios: "https://apps.apple.com/app/steakwallet/id1569375204",
4721
4744
  website: "https://steakwallet.fi/download",
4722
4745
  },
4746
+ showInMobileConnectors: false,
4723
4747
  getWalletConnectDeeplink: (uri) => {
4724
4748
  return `https://links.steakwallet.fi/wc?uri=${encodeURIComponent(uri)}`;
4725
4749
  },
@@ -4734,6 +4758,7 @@ const walletConfigs = {
4734
4758
  android: "https://play.google.com/store/apps/details?id=com.ledger.live",
4735
4759
  ios: "https://apps.apple.com/app/ledger-live-web3-wallet/id1361671700",
4736
4760
  },
4761
+ showInMobileConnectors: true,
4737
4762
  getWalletConnectDeeplink: (uri) => {
4738
4763
  return `ledgerlive://wc?uri=${encodeURIComponent(uri)}`;
4739
4764
  },
@@ -4751,6 +4776,7 @@ const walletConfigs = {
4751
4776
  getWalletConnectDeeplink: (uri) => {
4752
4777
  return `https://app.zerion.io/wc?uri=${encodeURIComponent(uri)}`;
4753
4778
  },
4779
+ showInMobileConnectors: true,
4754
4780
  },
4755
4781
  slope: {
4756
4782
  name: "Slope",
@@ -4762,6 +4788,7 @@ const walletConfigs = {
4762
4788
  chrome: "https://chrome.google.com/webstore/detail/slope-wallet/pocmplpaccanhmnllbbkpgfliimjljgo",
4763
4789
  website: "https://slope.finance/",
4764
4790
  },
4791
+ showInMobileConnectors: false,
4765
4792
  getWalletConnectDeeplink: (uri) => {
4766
4793
  return `https://slope.finance/app/wc?uri=${encodeURIComponent(uri)}`;
4767
4794
  },
@@ -4776,6 +4803,7 @@ const walletConfigs = {
4776
4803
  ios: "https://apps.apple.com/us/app/tp-global-wallet/id6444625622",
4777
4804
  chrome: "https://chrome.google.com/webstore/detail/tokenpocket/mfgccjchihfkkindfppnaooecgfneiii",
4778
4805
  },
4806
+ showInMobileConnectors: false,
4779
4807
  },
4780
4808
  talisman: {
4781
4809
  name: "Talisman",
@@ -4786,6 +4814,7 @@ const walletConfigs = {
4786
4814
  chrome: "https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld",
4787
4815
  firefox: "https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/",
4788
4816
  },
4817
+ showInMobileConnectors: false,
4789
4818
  },
4790
4819
  walletConnect: {
4791
4820
  name: "Other Wallets",
@@ -4794,6 +4823,7 @@ const walletConfigs = {
4794
4823
  iconConnector: jsx(Logos$1.OtherWallets, {}),
4795
4824
  iconShape: "square",
4796
4825
  getWalletConnectDeeplink: (uri) => uri,
4826
+ showInMobileConnectors: false,
4797
4827
  },
4798
4828
  };
4799
4829
 
@@ -8120,7 +8150,7 @@ const CopyToClipboard = ({ string, children, variant }) => {
8120
8150
  const MoreIcon = (jsx("svg", { width: "60", height: "60", viewBox: "0 0 60 60", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M30 42V19M19 30.5H42", stroke: "var(--ck-body-color-muted)", strokeWidth: "3", strokeLinecap: "round" }) }));
8121
8151
  const MobileConnectors = () => {
8122
8152
  const context = usePayContext();
8123
- const { log, paymentState } = context;
8153
+ const { log } = context;
8124
8154
  const locales = useLocales();
8125
8155
  const { connect: { getUri }, } = useWeb3();
8126
8156
  const wcUri = getUri();
@@ -8133,6 +8163,8 @@ const MobileConnectors = () => {
8133
8163
  return false;
8134
8164
  if (!wallet.getWalletConnectDeeplink)
8135
8165
  return false;
8166
+ if (!wallet.showInMobileConnectors)
8167
+ return false;
8136
8168
  return true;
8137
8169
  }) ?? [];
8138
8170
  const connectWallet = (wallet) => {
@@ -9669,7 +9701,7 @@ const TokenLogoSpinner = ({ token, showSpinner = true, }) => {
9669
9701
 
9670
9702
  var PayState$1;
9671
9703
  (function (PayState) {
9672
- PayState["RequestingPayment"] = "Requesting Payment";
9704
+ PayState["RequestingPayment"] = "Waiting For Payment";
9673
9705
  PayState["SwitchingChain"] = "Switching Chain";
9674
9706
  PayState["RequestCancelled"] = "Payment Cancelled";
9675
9707
  PayState["RequestSuccessful"] = "Payment Successful";
@@ -9677,7 +9709,7 @@ var PayState$1;
9677
9709
  const PayWithToken = () => {
9678
9710
  const { isMobile, isIOS } = useIsMobile();
9679
9711
  const { triggerResize, paymentState, setRoute, log, wcWallet } = usePayContext();
9680
- const { selectedTokenOption, payWithToken } = paymentState;
9712
+ const { payWithToken, selectedTokenOption } = paymentState;
9681
9713
  const [payState, setPayState] = useState(PayState$1.RequestingPayment);
9682
9714
  const walletChainId = useChainId();
9683
9715
  const { switchChainAsync } = useSwitchChain();
@@ -9764,11 +9796,19 @@ const PayWithToken = () => {
9764
9796
  return () => {
9765
9797
  clearTimeout(transferTimeout);
9766
9798
  };
9767
- }, []);
9799
+ }, [selectedTokenOption]);
9768
9800
  useEffect(() => {
9769
9801
  triggerResize();
9770
9802
  }, [payState]);
9771
- return (jsxs(PageContent, { children: [selectedTokenOption && (jsx(TokenLogoSpinner, { token: selectedTokenOption.required.token })), jsxs(ModalContent, { style: { paddingBottom: 0 }, "$preserveDisplay": true, children: [jsx(ModalH1, { children: payState }), selectedTokenOption && (jsx(PaymentBreakdown, { paymentOption: selectedTokenOption })), payState === PayState$1.RequestingPayment && wcWallet && isMobile && (jsxs(Button, { icon: jsx(ExternalLinkIcon, {}), href: wcWallet.getWalletConnectDeeplink?.(""), children: ["Pay with ", wcWallet.name] })), payState === PayState$1.RequestCancelled && (jsx(Button, { onClick: () => selectedTokenOption ? handleTransfer(selectedTokenOption) : null, children: "Retry Payment" }))] })] }));
9803
+ if (selectedTokenOption == null) {
9804
+ return jsx(PageContent, {});
9805
+ }
9806
+ return (jsxs(PageContent, { children: [jsx(TokenLogoSpinner, { token: selectedTokenOption.required.token }), jsxs(ModalContent, { style: { paddingBottom: 0 }, "$preserveDisplay": true, children: [jsx(ModalH1, { children: payState }), jsx(PaymentBreakdown, { paymentOption: selectedTokenOption }), payState === PayState$1.RequestingPayment && wcWallet && isMobile && (jsxs(Button, { icon: jsx(ExternalLinkIcon, {}), onClick: wcWallet.isWcMobileConnector
9807
+ ? () => handleTransfer(selectedTokenOption)
9808
+ : undefined, href: wcWallet.isWcMobileConnector
9809
+ ? undefined
9810
+ : wcWallet.walletDeepLink ||
9811
+ wcWallet.getWalletConnectDeeplink?.(""), children: ["Pay with ", wcWallet.name] })), payState === PayState$1.RequestCancelled && (jsx(Button, { onClick: () => handleTransfer(selectedTokenOption), children: "Retry Payment" }))] })] }));
9772
9812
  };
9773
9813
 
9774
9814
  /**
@@ -10423,6 +10463,39 @@ const AmountInputContainer = styled.div `
10423
10463
  justify-content: center;
10424
10464
  `;
10425
10465
 
10466
+ /** Extracts wcWallet from the current WalletConnect connector. */
10467
+ function useExtractWcWallet() {
10468
+ const { connector } = useAccount();
10469
+ const { wcWallet, setWcWallet, log } = usePayContext();
10470
+ // Extract the currently connect WalletConnect, avoid having the old wcWallet
10471
+ // context in the button "pay with"
10472
+ useEffect(() => {
10473
+ connector?.getProvider()?.then((p) => {
10474
+ let name = p.session?.peer?.metadata?.name;
10475
+ if (p.isCoinbaseWallet)
10476
+ name = "Coinbase Wallet";
10477
+ if (name == null)
10478
+ name = "Unknown";
10479
+ const wallet = Object.values(walletConfigs).find((c) => c.name === name || name.includes(c.shortName ?? c.name));
10480
+ // If the wallet is not in the walletConfigs, it is a new wallet given by
10481
+ // the WalletConnect provider.
10482
+ if (wallet === undefined) {
10483
+ const newWallet = {
10484
+ name: name,
10485
+ icon: p.session?.peer?.metadata?.icons[0],
10486
+ showInMobileConnectors: false,
10487
+ isWcMobileConnector: true,
10488
+ };
10489
+ setWcWallet(newWallet);
10490
+ }
10491
+ if (wallet?.name != null) {
10492
+ setWcWallet(wallet);
10493
+ }
10494
+ log(`[EXTRACT_WC_WALLET] name: ${name} wcWallet: ${wcWallet?.name}`, p);
10495
+ });
10496
+ }, [connector]);
10497
+ }
10498
+
10426
10499
  const WalletChainLogo = ({ walletIcon, walletName, chainLogo, }) => {
10427
10500
  const walletIconElement = typeof walletIcon === "string" ? (jsx("img", { src: walletIcon, alt: walletName })) : (walletIcon);
10428
10501
  return (jsxs(WalletChainContainer, { children: [walletIconElement, jsx(ChainContainer$2, { children: chainLogo })] }));
@@ -10441,81 +10514,15 @@ const ChainContainer$2 = styled(motion.div) `
10441
10514
  right: -4px;
10442
10515
  `;
10443
10516
 
10444
- // Get 3 icons, skipping the one that is already connected
10445
- function getBestUnconnectedWalletIcons(connector) {
10446
- const icons = [];
10447
- const strippedId = connector?.id.toLowerCase(); // some connector ids can have weird casing and or suffixes and prefixes
10448
- const [isMetaMask, isRainbow, isCoinbase] = [
10449
- strippedId?.includes("metamask"),
10450
- strippedId?.includes("rainbow"),
10451
- strippedId?.includes("coinbase"),
10452
- ];
10453
- if (!isMetaMask)
10454
- icons.push(jsx(MetaMask, {}));
10455
- if (!isRainbow)
10456
- icons.push(jsx(Rainbow, {}));
10457
- if (!isCoinbase)
10458
- icons.push(jsx(Coinbase, {}));
10459
- if (icons.length < 3)
10460
- icons.push(jsx(Rabby, {}));
10461
- return icons;
10462
- }
10463
- function getSolanaOption(isOnIOS) {
10464
- const { wallets } = useWallet$1();
10465
- const { setRoute } = usePayContext();
10466
- if (wallets.length === 0 && !isOnIOS)
10467
- return null;
10468
- return {
10469
- id: "solana",
10470
- title: "Pay on Solana",
10471
- icons: [jsx(Solana, {})],
10472
- onClick: () => {
10473
- setRoute(ROUTES.SOLANA_CONNECT);
10474
- },
10475
- };
10476
- }
10477
- function getDepositAddressOption(depositAddressOptions) {
10478
- const { setRoute, paymentState } = usePayContext();
10479
- // TODO: API should serve the subtitle and disabled
10480
- const disabled = !paymentState.isDepositFlow &&
10481
- !depositAddressOptions.loading &&
10482
- depositAddressOptions.options.length === 0;
10483
- const subtitle = disabled ? "Minimum $20.00" : "Bitcoin, Tron, Zcash...";
10484
- return {
10485
- id: "depositAddress",
10486
- title: "Pay on another chain",
10487
- subtitle,
10488
- icons: [jsx(Bitcoin, {}), jsx(Tron, {}), jsx(Zcash, {})],
10489
- onClick: () => {
10490
- setRoute(ROUTES.SELECT_DEPOSIT_ADDRESS_CHAIN);
10491
- },
10492
- disabled,
10493
- };
10494
- }
10495
- const SelectMethod = () => {
10517
+ function SelectMethod() {
10496
10518
  const { isMobile, isIOS } = useIsMobile();
10497
10519
  const { address, chain, isConnected: isEthConnected, connector, } = useAccount();
10498
10520
  const { connected: isSolanaConnected, wallet: solanaWallet, publicKey, } = useWallet$1();
10499
- const { setRoute, paymentState, wcWallet, setWcWallet, log, setConnector } = usePayContext();
10521
+ const { setRoute, paymentState, wcWallet, log } = usePayContext();
10500
10522
  const { disconnectAsync } = useDisconnect();
10501
10523
  const { daimoPayOrder, setSelectedExternalOption, externalPaymentOptions, depositAddressOptions, senderEnsName, } = paymentState;
10502
10524
  const paymentOptions = daimoPayOrder?.metadata.payer?.paymentOptions;
10503
- // Extract the currently connect WalletConnect wallet
10504
- useEffect(() => {
10505
- connector?.getProvider()?.then((p) => {
10506
- let name = p.session?.peer?.metadata?.name;
10507
- if (p.isCoinbaseWallet)
10508
- name = "Coinbase Wallet";
10509
- if (name == null)
10510
- name = "Unknown";
10511
- const wallet = Object.values(walletConfigs).find((c) => c.name === name || name.includes(c.shortName ?? c.name));
10512
- log(`[SELECT_METHOD] name: ${name} wcWallet: ${wallet?.name}`, p);
10513
- //case MetaMask
10514
- if (wallet?.name != null) {
10515
- setWcWallet(wallet);
10516
- }
10517
- });
10518
- }, [connector]);
10525
+ useExtractWcWallet();
10519
10526
  const getConnectedWalletOptions = () => {
10520
10527
  const showChainLogo = isEthConnected && isSolanaConnected;
10521
10528
  const connectedOptions = [];
@@ -10527,8 +10534,8 @@ const SelectMethod = () => {
10527
10534
  walletIcon = (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: jsx("img", { src: connector.icon, alt: connector.name }) }));
10528
10535
  }
10529
10536
  else if (wcWallet?.icon) {
10530
- log("[SELECT_METHOD] wcWallet?.icon", wcWallet?.icon);
10531
- walletIcon = (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: wcWallet.icon }));
10537
+ log("[SELECT_METHOD] wcWallet.icon", wcWallet.icon);
10538
+ walletIcon = (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: typeof wcWallet.icon === "string" ? (jsx("img", { src: wcWallet.icon, alt: wcWallet.name })) : (wcWallet.icon) }));
10532
10539
  }
10533
10540
  else {
10534
10541
  log("[SELECT_METHOD] else");
@@ -10629,7 +10636,58 @@ const SelectMethod = () => {
10629
10636
  options.push(depositAddressOption);
10630
10637
  }
10631
10638
  return (jsxs(PageContent, { children: [jsx(OrderHeader, {}), jsx(OptionsList, { requiredSkeletons: isMobile ? 4 : 3, isLoading: externalPaymentOptions.loading, options: externalPaymentOptions.loading ? [] : options }), jsx(PoweredByFooter, {})] }));
10632
- };
10639
+ }
10640
+ // Get 3 icons, skipping the one that is already connected
10641
+ function getBestUnconnectedWalletIcons(connector) {
10642
+ const icons = [];
10643
+ const strippedId = connector?.id.toLowerCase(); // some connector ids can have weird casing and or suffixes and prefixes
10644
+ const [isMetaMask, isRainbow, isCoinbase] = [
10645
+ strippedId?.includes("metamask"),
10646
+ strippedId?.includes("rainbow"),
10647
+ strippedId?.includes("coinbase"),
10648
+ ];
10649
+ if (!isMetaMask)
10650
+ icons.push(jsx(MetaMask, {}));
10651
+ if (!isRainbow)
10652
+ icons.push(jsx(Rainbow, {}));
10653
+ if (!isCoinbase)
10654
+ icons.push(jsx(Coinbase, {}));
10655
+ if (icons.length < 3)
10656
+ icons.push(jsx(Rabby, {}));
10657
+ return icons;
10658
+ }
10659
+ function getSolanaOption(isOnIOS) {
10660
+ const { wallets } = useWallet$1();
10661
+ const { setRoute } = usePayContext();
10662
+ if (wallets.length === 0 && !isOnIOS)
10663
+ return null;
10664
+ return {
10665
+ id: "solana",
10666
+ title: "Pay on Solana",
10667
+ icons: [jsx(Solana, {})],
10668
+ onClick: () => {
10669
+ setRoute(ROUTES.SOLANA_CONNECT);
10670
+ },
10671
+ };
10672
+ }
10673
+ function getDepositAddressOption(depositAddressOptions) {
10674
+ const { setRoute, paymentState } = usePayContext();
10675
+ // TODO: API should serve the subtitle and disabled
10676
+ const disabled = !paymentState.isDepositFlow &&
10677
+ !depositAddressOptions.loading &&
10678
+ depositAddressOptions.options.length === 0;
10679
+ const subtitle = disabled ? "Minimum $20.00" : "Bitcoin, Tron, Zcash...";
10680
+ return {
10681
+ id: "depositAddress",
10682
+ title: "Pay on another chain",
10683
+ subtitle,
10684
+ icons: [jsx(Bitcoin, {}), jsx(Tron, {}), jsx(Zcash, {})],
10685
+ onClick: () => {
10686
+ setRoute(ROUTES.SELECT_DEPOSIT_ADDRESS_CHAIN);
10687
+ },
10688
+ disabled,
10689
+ };
10690
+ }
10633
10691
 
10634
10692
  const TokenChainLogo = ({ token }) => {
10635
10693
  return (jsxs(TokenChainContainer, { children: [jsx("img", { src: token.logoURI, alt: token.symbol, style: { borderRadius: 9999 } }), jsx(ChainContainer$1, { children: chainToLogo[token.chainId] })] }));
@@ -10648,13 +10706,11 @@ const ChainContainer$1 = styled(motion.div) `
10648
10706
  right: 0px;
10649
10707
  `;
10650
10708
 
10651
- function getDaimoTokenKey(token) {
10652
- return `${token.chainId}-${token.token}`;
10653
- }
10654
- const SelectToken = () => {
10709
+ function SelectToken() {
10655
10710
  const { isMobile, isIOS } = useIsMobile();
10656
- const { setRoute, paymentState, wcWallet } = usePayContext();
10711
+ const { setRoute, paymentState, wcWallet, setWcWallet, log } = usePayContext();
10657
10712
  const { isDepositFlow, walletPaymentOptions, setSelectedTokenOption } = paymentState;
10713
+ useExtractWcWallet();
10658
10714
  const optionsList = walletPaymentOptions.options?.map((option) => {
10659
10715
  const chainName = getChainName(option.balance.token.chainId);
10660
10716
  const titlePrice = isDepositFlow
@@ -10685,7 +10741,15 @@ const SelectToken = () => {
10685
10741
  else {
10686
10742
  setRoute(ROUTES.PAY_WITH_TOKEN, meta);
10687
10743
  if (isMobile && isIOS) {
10688
- window.open(wcWallet?.getWalletConnectDeeplink?.(""), "_blank");
10744
+ if (wcWallet?.walletDeepLink) {
10745
+ window.open(wcWallet?.walletDeepLink, "_blank");
10746
+ }
10747
+ else {
10748
+ //If the wallet is a wc mobile connector we don't have the deep link
10749
+ if (!wcWallet?.isWcMobileConnector) {
10750
+ window.open(wcWallet?.getWalletConnectDeeplink?.(""), "_blank");
10751
+ }
10752
+ }
10689
10753
  }
10690
10754
  }
10691
10755
  },
@@ -10699,7 +10763,10 @@ const SelectToken = () => {
10699
10763
  paddingTop: 16,
10700
10764
  paddingBottom: 16,
10701
10765
  }, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD), children: "Select Another Method" })] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: walletPaymentOptions.isLoading, options: optionsList })] }));
10702
- };
10766
+ }
10767
+ function getDaimoTokenKey(token) {
10768
+ return `${token.chainId}-${token.token}`;
10769
+ }
10703
10770
 
10704
10771
  const ConnectSolana$1 = () => {
10705
10772
  const solanaWallets = useWallet$1();
@@ -10816,7 +10883,7 @@ const ConnectSolana = () => {
10816
10883
 
10817
10884
  var PayState;
10818
10885
  (function (PayState) {
10819
- PayState["RequestingPayment"] = "Requesting Payment";
10886
+ PayState["RequestingPayment"] = "Waiting For Payment";
10820
10887
  PayState["RequestCancelled"] = "Payment Cancelled";
10821
10888
  PayState["RequestFailed"] = "Payment Failed";
10822
10889
  PayState["RequestSuccessful"] = "Payment Successful";
@@ -10996,7 +11063,7 @@ const WaitingExternal = () => {
10996
11063
  if (!selectedExternalOption) {
10997
11064
  return jsx(PageContent, {});
10998
11065
  }
10999
- return (jsxs(PageContent, { children: [jsx(ExternalPaymentSpinner, { logoURI: selectedExternalOption.logoURI, logoShape: selectedExternalOption.logoShape }), jsxs(ModalContent, { style: { marginLeft: 24, marginRight: 24 }, children: [jsx(ModalH1, { children: "Waiting for Payment" }), paymentWaitingMessage && (jsx(ModalBody, { style: { marginTop: 12, marginBottom: 12 }, children: paymentWaitingMessage }))] }), jsx(Button, { icon: jsx(ExternalLinkIcon, {}), onClick: () => {
11066
+ return (jsxs(PageContent, { children: [jsx(ExternalPaymentSpinner, { logoURI: selectedExternalOption.logoURI, logoShape: selectedExternalOption.logoShape }), jsxs(ModalContent, { style: { marginLeft: 24, marginRight: 24 }, children: [jsx(ModalH1, { children: "Waiting For Payment" }), paymentWaitingMessage && (jsx(ModalBody, { style: { marginTop: 12, marginBottom: 12 }, children: paymentWaitingMessage }))] }), jsx(Button, { icon: jsx(ExternalLinkIcon, {}), onClick: () => {
11000
11067
  if (externalURL)
11001
11068
  window.open(externalURL, "_blank");
11002
11069
  }, children: selectedExternalOption.cta })] }));