@daimo/pay 1.7.0 → 1.7.2
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.js +118 -101
- package/build/index.js.map +1 -1
- package/package.json +2 -2
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, 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, writeDaimoPayOrderID, DaimoPayOrderMode, DaimoPayOrderStatusDest, getChainExplorerTxUrl,
|
|
2
|
+
import { ExternalPaymentOptions, assert, assertNotNull, debugJson, supportedChains, ethereum, 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';
|
|
3
3
|
import { Buffer } from 'buffer';
|
|
4
4
|
import React, { useState, useEffect, createContext, useCallback, useRef, 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.
|
|
25
|
+
var version = "1.7.2";
|
|
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.
|
|
64
|
+
"@daimo/pay-common": "1.7.2",
|
|
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",
|
|
@@ -6706,7 +6706,7 @@ const ScrollArea = ({ children, height, backgroundColor, mobileDirection, hideBo
|
|
|
6706
6706
|
const { log } = usePayContext();
|
|
6707
6707
|
const ref = useRef(null);
|
|
6708
6708
|
const moreRef = useRef(null);
|
|
6709
|
-
const
|
|
6709
|
+
const isMobileFormat = isMobile() || window?.innerWidth < defaultTheme.mobileWidth;
|
|
6710
6710
|
useEffect(() => {
|
|
6711
6711
|
const el = ref.current;
|
|
6712
6712
|
if (!el)
|
|
@@ -6745,7 +6745,7 @@ const ScrollArea = ({ children, height, backgroundColor, mobileDirection, hideBo
|
|
|
6745
6745
|
el.removeEventListener("scroll", handleScroll);
|
|
6746
6746
|
};
|
|
6747
6747
|
}, [ref.current]);
|
|
6748
|
-
return (jsxs(ScrollContainer, { children: [jsx(ScrollAreaContainer, { ref: ref, "$mobile":
|
|
6748
|
+
return (jsxs(ScrollContainer, { children: [jsx(ScrollAreaContainer, { ref: ref, "$mobile": isMobileFormat, "$height": height, "$backgroundColor": backgroundColor, "$mobileDirection": mobileDirection, "$hideBottomLine": hideBottomLine, "$totalItems": totalItems, children: children }), jsx(MoreIndicator, { ref: moreRef, className: "hide", onClick: () => {
|
|
6749
6749
|
if (ref.current) {
|
|
6750
6750
|
ref.current.scrollTo({
|
|
6751
6751
|
top: ref.current.scrollHeight,
|
|
@@ -7432,8 +7432,13 @@ function tokenAmountToRoundedUsd(amount, token, round = "nearest") {
|
|
|
7432
7432
|
}
|
|
7433
7433
|
|
|
7434
7434
|
/** Shows payment amount. */
|
|
7435
|
-
const OrderHeader = ({ minified = false }) => {
|
|
7436
|
-
const { paymentState, route } = usePayContext();
|
|
7435
|
+
const OrderHeader = ({ minified = false, showEth = false, showSolana = false, }) => {
|
|
7436
|
+
const { paymentState, route, wcWallet } = usePayContext();
|
|
7437
|
+
const { isConnected: isEthConnected, address, connector } = useAccount();
|
|
7438
|
+
const { connected: isSolanaConnected, publicKey, wallet: solanaWallet, } = useWallet$1();
|
|
7439
|
+
const { senderEnsName } = paymentState;
|
|
7440
|
+
const ethWalletDisplayName = senderEnsName ?? (address ? getAddressContraction(address) : "wallet");
|
|
7441
|
+
const solWalletDisplayName = getAddressContraction(publicKey?.toBase58() ?? "");
|
|
7437
7442
|
const orderUsd = paymentState.daimoPayOrder?.destFinalCallTokenAmount.usd;
|
|
7438
7443
|
const titleAmountContent = (() => {
|
|
7439
7444
|
if (paymentState.isDepositFlow) {
|
|
@@ -7446,9 +7451,16 @@ const OrderHeader = ({ minified = false }) => {
|
|
|
7446
7451
|
return orderUsd != null ? (jsx("span", { children: formatUsd(orderUsd, "nearest") })) : null;
|
|
7447
7452
|
}
|
|
7448
7453
|
})();
|
|
7454
|
+
const renderIcon = (icon, name, size = 32) => {
|
|
7455
|
+
if (!icon)
|
|
7456
|
+
return jsx(MetaMask, {});
|
|
7457
|
+
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) }));
|
|
7458
|
+
};
|
|
7459
|
+
let walletIcon = renderIcon(connector?.icon || wcWallet?.icon, wcWallet?.name);
|
|
7460
|
+
let solanaIcon = renderIcon(solanaWallet?.adapter.icon || jsx(Solana, {}), solanaWallet?.adapter.name);
|
|
7449
7461
|
if (minified) {
|
|
7450
7462
|
if (titleAmountContent != null) {
|
|
7451
|
-
return (jsxs(MinifiedContainer, { children: [jsx(MinifiedTitleAmount, { children: titleAmountContent }), jsx(CoinLogos, { "$size": 32 })] }));
|
|
7463
|
+
return (jsxs(MinifiedContainer, { children: [jsx(MinifiedTitleAmount, { children: titleAmountContent }), showEth && isEthConnected && (jsx(Fragment, { children: jsxs(SubtitleContainer, { children: [jsx(Subtitle, { children: ethWalletDisplayName }), walletIcon] }) })), showSolana && isSolanaConnected && (jsx(Fragment, { children: jsxs(SubtitleContainer, { children: [jsx(Subtitle, { children: solWalletDisplayName }), solanaIcon] }) })), !showEth && !showSolana && (jsx(Fragment, { children: jsx(CoinLogos, { "$size": 32 }) }))] }));
|
|
7452
7464
|
}
|
|
7453
7465
|
else {
|
|
7454
7466
|
return (jsxs(MinifiedContainer, { children: [jsx(CoinLogos, {}), jsx(Subtitle, { children: "1000+ tokens accepted" })] }));
|
|
@@ -7547,6 +7559,12 @@ const Logos = styled(motion.div) `
|
|
|
7547
7559
|
align-items: center;
|
|
7548
7560
|
justify-content: center;
|
|
7549
7561
|
`;
|
|
7562
|
+
const SubtitleContainer = styled.div `
|
|
7563
|
+
display: flex;
|
|
7564
|
+
align-items: center;
|
|
7565
|
+
justify-content: flex-end;
|
|
7566
|
+
gap: 8px;
|
|
7567
|
+
`;
|
|
7550
7568
|
|
|
7551
7569
|
const Wallets = () => {
|
|
7552
7570
|
const context = usePayContext();
|
|
@@ -10318,7 +10336,7 @@ const OptionIcon = styled(motion.div) `
|
|
|
10318
10336
|
border-radius: 0;
|
|
10319
10337
|
}
|
|
10320
10338
|
`;
|
|
10321
|
-
const OptionsContainer = styled.div `
|
|
10339
|
+
const OptionsContainer$1 = styled.div `
|
|
10322
10340
|
transition: opacity 300ms ease;
|
|
10323
10341
|
display: flex;
|
|
10324
10342
|
flex-direction: column;
|
|
@@ -10331,7 +10349,7 @@ const OptionsContainer = styled.div `
|
|
|
10331
10349
|
`}
|
|
10332
10350
|
`;
|
|
10333
10351
|
|
|
10334
|
-
const OptionsList = ({ options, isLoading, requiredSkeletons,
|
|
10352
|
+
const OptionsList = ({ options, isLoading, requiredSkeletons, scrollHeight = 300, orDivider = false, }) => {
|
|
10335
10353
|
const { triggerResize, log } = usePayContext();
|
|
10336
10354
|
const optionsLength = options.length;
|
|
10337
10355
|
useEffect(() => {
|
|
@@ -10344,10 +10362,10 @@ const OptionsList = ({ options, isLoading, requiredSkeletons, shortScroll, orDiv
|
|
|
10344
10362
|
const skeletonCount = requiredSkeletons
|
|
10345
10363
|
? Math.max(requiredSkeletons - optionsLength, 0)
|
|
10346
10364
|
: 0;
|
|
10347
|
-
return (jsxs(OptionsContainer, { "$totalResults": options.length, children: [options.map((option) => (jsx(OptionItem, { option: option }, option.id))), isLoading &&
|
|
10365
|
+
return (jsxs(OptionsContainer$1, { "$totalResults": options.length, children: [options.map((option) => (jsx(OptionItem, { option: option }, option.id))), isLoading &&
|
|
10348
10366
|
Array.from({ length: skeletonCount }).map((_, index) => (jsx(SkeletonOptionItem, {}, index)))] }));
|
|
10349
10367
|
}
|
|
10350
|
-
return (jsxs(Fragment, { children: [jsx(ScrollArea, { mobileDirection: "vertical", height:
|
|
10368
|
+
return (jsxs(Fragment, { children: [jsx(ScrollArea, { mobileDirection: "vertical", height: scrollHeight, hideBottomLine: orDivider, totalItems: options.length, children: jsx(OptionsContainer$1, { "$totalResults": options.length, children: options.map((option) => (jsx(OptionItem, { option: option }, option.id))) }) }), orDivider && jsx(OrDivider, {})] }));
|
|
10351
10369
|
};
|
|
10352
10370
|
const SkeletonOptionItem = () => {
|
|
10353
10371
|
return (jsxs(OptionButton, { type: "button", children: [jsx(SkeletonIcon, {}), jsx(SkeletonLabel, {})] }));
|
|
@@ -10426,6 +10444,84 @@ const IconStackItem = styled(motion.div) `
|
|
|
10426
10444
|
border-radius: 22.5%;
|
|
10427
10445
|
`;
|
|
10428
10446
|
|
|
10447
|
+
const OptionsContainer = styled$1.div `
|
|
10448
|
+
width: 100%;
|
|
10449
|
+
margin-top: 1rem;
|
|
10450
|
+
`;
|
|
10451
|
+
function SelectAnotherMethodButton() {
|
|
10452
|
+
const { paymentState, setRoute } = usePayContext();
|
|
10453
|
+
const { externalPaymentOptions, daimoPayOrder } = paymentState;
|
|
10454
|
+
const { connector } = useAccount();
|
|
10455
|
+
const { disconnectAsync } = useDisconnect();
|
|
10456
|
+
const paymentOptions = daimoPayOrder?.metadata.payer?.paymentOptions;
|
|
10457
|
+
const allPaymentOptions = [
|
|
10458
|
+
...externalPaymentOptions.options.map((option) => option.id),
|
|
10459
|
+
...(paymentOptions ?? []),
|
|
10460
|
+
].flat();
|
|
10461
|
+
const includeSolana = paymentOptions == null ||
|
|
10462
|
+
paymentOptions.includes(ExternalPaymentOptions.Solana);
|
|
10463
|
+
// Deposit address options, e.g. Bitcoin, Tron, Zcash, etc.
|
|
10464
|
+
// Include by default if paymentOptions not provided
|
|
10465
|
+
const includeDepositAddressOption = paymentOptions == null ||
|
|
10466
|
+
paymentOptions.includes(ExternalPaymentOptions.ExternalChains);
|
|
10467
|
+
const selectMethodOption = {
|
|
10468
|
+
id: "select-method",
|
|
10469
|
+
title: `Pay with another method`,
|
|
10470
|
+
icons: getBestPaymentMethodIcons(),
|
|
10471
|
+
onClick: () => {
|
|
10472
|
+
setRoute(ROUTES.SELECT_METHOD);
|
|
10473
|
+
},
|
|
10474
|
+
};
|
|
10475
|
+
const selectWalletOption = {
|
|
10476
|
+
id: "select-wallet",
|
|
10477
|
+
title: "Pay with another wallet",
|
|
10478
|
+
icons: getBestUnconnectedWalletIcons(connector),
|
|
10479
|
+
onClick: async () => {
|
|
10480
|
+
await disconnectAsync();
|
|
10481
|
+
setRoute(ROUTES.CONNECTORS);
|
|
10482
|
+
},
|
|
10483
|
+
};
|
|
10484
|
+
function getBestUnconnectedWalletIcons(connector) {
|
|
10485
|
+
const icons = [];
|
|
10486
|
+
const strippedId = connector?.id.toLowerCase(); // some connector ids can have weird casing and or suffixes and prefixes
|
|
10487
|
+
const [isMetaMask, isRainbow, isCoinbase] = [
|
|
10488
|
+
strippedId?.includes("metamask"),
|
|
10489
|
+
strippedId?.includes("rainbow"),
|
|
10490
|
+
strippedId?.includes("coinbase"),
|
|
10491
|
+
];
|
|
10492
|
+
if (!isRainbow)
|
|
10493
|
+
icons.push(jsx(Rainbow, {}));
|
|
10494
|
+
if (!isMetaMask)
|
|
10495
|
+
icons.push(jsx(MetaMask, {}));
|
|
10496
|
+
if (!isCoinbase)
|
|
10497
|
+
icons.push(jsx(Coinbase, {}));
|
|
10498
|
+
if (icons.length < 3)
|
|
10499
|
+
icons.push(jsx(Rabby, {}));
|
|
10500
|
+
return icons;
|
|
10501
|
+
}
|
|
10502
|
+
function getBestPaymentMethodIcons() {
|
|
10503
|
+
let icons = externalPaymentOptions.options
|
|
10504
|
+
.filter((option) => option.id !== ExternalPaymentOptions.Daimo)
|
|
10505
|
+
.map((option) => (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: jsx("img", { src: option.logoURI, alt: "" }) }, option.id)));
|
|
10506
|
+
if (icons.length < 3) {
|
|
10507
|
+
const additionalIcons = [];
|
|
10508
|
+
if (includeSolana)
|
|
10509
|
+
additionalIcons.push(jsx(Solana, {}));
|
|
10510
|
+
if (includeDepositAddressOption && additionalIcons.length < 3)
|
|
10511
|
+
additionalIcons.push(jsx(Bitcoin, {}));
|
|
10512
|
+
if (includeDepositAddressOption && additionalIcons.length < 3)
|
|
10513
|
+
additionalIcons.push(jsx(Tron, {}));
|
|
10514
|
+
if (additionalIcons.length < 3)
|
|
10515
|
+
additionalIcons.push(...getBestUnconnectedWalletIcons(connector));
|
|
10516
|
+
icons = [...icons, ...additionalIcons.slice(0, 3 - icons.length)];
|
|
10517
|
+
}
|
|
10518
|
+
return icons;
|
|
10519
|
+
}
|
|
10520
|
+
return (jsx(OptionsContainer, { children: jsx(OptionsList, { options: allPaymentOptions.length > 0
|
|
10521
|
+
? [selectMethodOption]
|
|
10522
|
+
: [selectWalletOption] }) }));
|
|
10523
|
+
}
|
|
10524
|
+
|
|
10429
10525
|
const SelectDepositAddressChain = () => {
|
|
10430
10526
|
const { setRoute, paymentState } = usePayContext();
|
|
10431
10527
|
const { isDepositFlow, setSelectedDepositAddressOption, depositAddressOptions, } = paymentState;
|
|
@@ -10436,7 +10532,7 @@ const SelectDepositAddressChain = () => {
|
|
|
10436
10532
|
justifyContent: "center",
|
|
10437
10533
|
paddingTop: 16,
|
|
10438
10534
|
paddingBottom: 16,
|
|
10439
|
-
}, children: [jsx(ModalH1, { children: "Chains unavailable." }), jsx(
|
|
10535
|
+
}, children: [jsx(ModalH1, { children: "Chains unavailable." }), jsx(SelectAnotherMethodButton, {})] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: depositAddressOptions.loading, options: depositAddressOptions.options?.map((option) => {
|
|
10440
10536
|
return {
|
|
10441
10537
|
id: option.id,
|
|
10442
10538
|
title: option.id,
|
|
@@ -10696,80 +10792,6 @@ function getDepositAddressOption(depositAddressOptions) {
|
|
|
10696
10792
|
};
|
|
10697
10793
|
}
|
|
10698
10794
|
|
|
10699
|
-
function SelectAnotherMethodButton() {
|
|
10700
|
-
const { paymentState, setRoute } = usePayContext();
|
|
10701
|
-
const { externalPaymentOptions, daimoPayOrder } = paymentState;
|
|
10702
|
-
const { connector } = useAccount();
|
|
10703
|
-
const { disconnectAsync } = useDisconnect();
|
|
10704
|
-
const paymentOptions = daimoPayOrder?.metadata.payer?.paymentOptions;
|
|
10705
|
-
const allPaymentOptions = [
|
|
10706
|
-
...externalPaymentOptions.options.map((option) => option.id),
|
|
10707
|
-
...(paymentOptions ?? []),
|
|
10708
|
-
].flat();
|
|
10709
|
-
const includeSolana = paymentOptions == null ||
|
|
10710
|
-
paymentOptions.includes(ExternalPaymentOptions.Solana);
|
|
10711
|
-
// Deposit address options, e.g. Bitcoin, Tron, Zcash, etc.
|
|
10712
|
-
// Include by default if paymentOptions not provided
|
|
10713
|
-
const includeDepositAddressOption = paymentOptions == null ||
|
|
10714
|
-
paymentOptions.includes(ExternalPaymentOptions.ExternalChains);
|
|
10715
|
-
const selectMethodOption = {
|
|
10716
|
-
id: "select-method",
|
|
10717
|
-
title: `Pay with another method`,
|
|
10718
|
-
icons: getBestPaymentMethodIcons(),
|
|
10719
|
-
onClick: () => {
|
|
10720
|
-
setRoute(ROUTES.SELECT_METHOD);
|
|
10721
|
-
},
|
|
10722
|
-
};
|
|
10723
|
-
const selectWalletOption = {
|
|
10724
|
-
id: "select-wallet",
|
|
10725
|
-
title: "Pay with another wallet",
|
|
10726
|
-
icons: getBestUnconnectedWalletIcons(connector),
|
|
10727
|
-
onClick: async () => {
|
|
10728
|
-
await disconnectAsync();
|
|
10729
|
-
setRoute(ROUTES.CONNECTORS);
|
|
10730
|
-
},
|
|
10731
|
-
};
|
|
10732
|
-
function getBestUnconnectedWalletIcons(connector) {
|
|
10733
|
-
const icons = [];
|
|
10734
|
-
const strippedId = connector?.id.toLowerCase(); // some connector ids can have weird casing and or suffixes and prefixes
|
|
10735
|
-
const [isMetaMask, isRainbow, isCoinbase] = [
|
|
10736
|
-
strippedId?.includes("metamask"),
|
|
10737
|
-
strippedId?.includes("rainbow"),
|
|
10738
|
-
strippedId?.includes("coinbase"),
|
|
10739
|
-
];
|
|
10740
|
-
if (!isRainbow)
|
|
10741
|
-
icons.push(jsx(Rainbow, {}));
|
|
10742
|
-
if (!isMetaMask)
|
|
10743
|
-
icons.push(jsx(MetaMask, {}));
|
|
10744
|
-
if (!isCoinbase)
|
|
10745
|
-
icons.push(jsx(Coinbase, {}));
|
|
10746
|
-
if (icons.length < 3)
|
|
10747
|
-
icons.push(jsx(Rabby, {}));
|
|
10748
|
-
return icons;
|
|
10749
|
-
}
|
|
10750
|
-
function getBestPaymentMethodIcons() {
|
|
10751
|
-
let icons = externalPaymentOptions.options
|
|
10752
|
-
.filter((option) => option.id !== ExternalPaymentOptions.Daimo)
|
|
10753
|
-
.map((option) => (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: jsx("img", { src: option.logoURI, alt: "" }) }, option.id)));
|
|
10754
|
-
if (icons.length < 3) {
|
|
10755
|
-
const additionalIcons = [];
|
|
10756
|
-
if (includeSolana)
|
|
10757
|
-
additionalIcons.push(jsx(Solana, {}));
|
|
10758
|
-
if (includeDepositAddressOption && additionalIcons.length < 3)
|
|
10759
|
-
additionalIcons.push(jsx(Bitcoin, {}));
|
|
10760
|
-
if (includeDepositAddressOption && additionalIcons.length < 3)
|
|
10761
|
-
additionalIcons.push(jsx(Tron, {}));
|
|
10762
|
-
if (additionalIcons.length < 3)
|
|
10763
|
-
additionalIcons.push(...getBestUnconnectedWalletIcons(connector));
|
|
10764
|
-
icons = [...icons, ...additionalIcons.slice(0, 3 - icons.length)];
|
|
10765
|
-
}
|
|
10766
|
-
return icons;
|
|
10767
|
-
}
|
|
10768
|
-
return (jsx(OptionsList, { options: allPaymentOptions.length > 0
|
|
10769
|
-
? [selectMethodOption]
|
|
10770
|
-
: [selectWalletOption] }));
|
|
10771
|
-
}
|
|
10772
|
-
|
|
10773
10795
|
const TokenChainLogo = ({ token }) => {
|
|
10774
10796
|
return (jsxs(TokenChainContainer, { children: [jsx("img", { src: token.logoURI, alt: token.symbol, style: { borderRadius: 9999 } }), jsx(ChainContainer$1, { children: chainToLogo[token.chainId] })] }));
|
|
10775
10797
|
};
|
|
@@ -10789,6 +10811,7 @@ const ChainContainer$1 = styled(motion.div) `
|
|
|
10789
10811
|
|
|
10790
10812
|
function SelectToken() {
|
|
10791
10813
|
const { isMobile, isIOS } = useIsMobile();
|
|
10814
|
+
const isMobileFormat = useIsMobile() || window?.innerWidth < defaultTheme.mobileWidth;
|
|
10792
10815
|
const { setRoute, paymentState, wcWallet } = usePayContext();
|
|
10793
10816
|
const { isDepositFlow, walletPaymentOptions, setSelectedTokenOption } = paymentState;
|
|
10794
10817
|
const optionsList = walletPaymentOptions.options?.map((option) => {
|
|
@@ -10836,13 +10859,13 @@ function SelectToken() {
|
|
|
10836
10859
|
disabled,
|
|
10837
10860
|
};
|
|
10838
10861
|
}) ?? [];
|
|
10839
|
-
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), !walletPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
10862
|
+
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true, showEth: true }), !walletPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
10840
10863
|
display: "flex",
|
|
10841
10864
|
alignItems: "center",
|
|
10842
10865
|
justifyContent: "center",
|
|
10843
10866
|
paddingTop: 16,
|
|
10844
10867
|
paddingBottom: 16,
|
|
10845
|
-
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(
|
|
10868
|
+
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(SelectAnotherMethodButton, {})] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: walletPaymentOptions.isLoading, options: optionsList, scrollHeight: isMobileFormat ? 225 : 300, orDivider: optionsList.length != 0 }), optionsList.length != 0 && jsx(SelectAnotherMethodButton, {})] }));
|
|
10846
10869
|
}
|
|
10847
10870
|
function getDaimoTokenKey(token) {
|
|
10848
10871
|
return `${token.chainId}-${token.token}`;
|
|
@@ -10949,7 +10972,7 @@ const ConnectSolana = () => {
|
|
|
10949
10972
|
paddingTop: 16,
|
|
10950
10973
|
paddingBottom: 16,
|
|
10951
10974
|
gap: 16,
|
|
10952
|
-
}, children: [jsx(ModalH1, { children: "No Solana wallets detected." }), jsx(
|
|
10975
|
+
}, children: [jsx(ModalH1, { children: "No Solana wallets detected." }), jsx(SelectAnotherMethodButton, {})] })), isMobile() &&
|
|
10953
10976
|
(solanaWallets.wallets.length === 0 ||
|
|
10954
10977
|
(solanaWallets.wallets.length > 0 &&
|
|
10955
10978
|
solanaWallets.wallets[0].adapter.name ===
|
|
@@ -11004,11 +11027,7 @@ const PayWithSolanaToken = () => {
|
|
|
11004
11027
|
useEffect(() => {
|
|
11005
11028
|
triggerResize();
|
|
11006
11029
|
}, [payState]);
|
|
11007
|
-
return (jsxs(PageContent, { children: [selectedSolanaTokenOption && (jsx(TokenLogoSpinner, { token: selectedSolanaTokenOption.required.token })), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ModalH1, { children: payState }), selectedSolanaTokenOption && (jsx(PaymentBreakdown, { paymentOption: selectedSolanaTokenOption })), payState === PayState.RequestCancelled && (jsx(Button, { onClick: handleTransfer, children: "Retry Payment" })), payState === PayState.RequestFailed &&
|
|
11008
|
-
assert(payParams != null, "[PAY SOLANA] payParams cannot be null in deposit flow");
|
|
11009
|
-
generatePreviewOrder(payParams);
|
|
11010
|
-
setRoute(ROUTES.SELECT_METHOD, { event: "click-select-another" });
|
|
11011
|
-
}, children: "Select Another Method" }))] })] }));
|
|
11030
|
+
return (jsxs(PageContent, { children: [selectedSolanaTokenOption && (jsx(TokenLogoSpinner, { token: selectedSolanaTokenOption.required.token })), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ModalH1, { children: payState }), selectedSolanaTokenOption && (jsx(PaymentBreakdown, { paymentOption: selectedSolanaTokenOption })), payState === PayState.RequestCancelled && (jsx(Button, { onClick: handleTransfer, children: "Retry Payment" })), payState === PayState.RequestFailed && jsx(SelectAnotherMethodButton, {})] })] }));
|
|
11012
11031
|
};
|
|
11013
11032
|
|
|
11014
11033
|
const SelectSolanaAmount = () => {
|
|
@@ -11026,6 +11045,7 @@ function getDaimoSolanaTokenKey(token) {
|
|
|
11026
11045
|
const SelectSolanaToken = () => {
|
|
11027
11046
|
const { paymentState, setRoute } = usePayContext();
|
|
11028
11047
|
const { isDepositFlow, solanaPaymentOptions, setSelectedSolanaTokenOption } = paymentState;
|
|
11048
|
+
const isMobileFormat = useIsMobile() || window?.innerWidth < defaultTheme.mobileWidth;
|
|
11029
11049
|
const optionsList = solanaPaymentOptions.options?.map((option) => {
|
|
11030
11050
|
const titlePrice = isDepositFlow
|
|
11031
11051
|
? formatUsd(option.balance.usd)
|
|
@@ -11059,13 +11079,13 @@ const SelectSolanaToken = () => {
|
|
|
11059
11079
|
disabled,
|
|
11060
11080
|
};
|
|
11061
11081
|
}) ?? [];
|
|
11062
|
-
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), !solanaPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
11082
|
+
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true, showSolana: true }), !solanaPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
11063
11083
|
display: "flex",
|
|
11064
11084
|
alignItems: "center",
|
|
11065
11085
|
justifyContent: "center",
|
|
11066
11086
|
paddingTop: 16,
|
|
11067
11087
|
paddingBottom: 16,
|
|
11068
|
-
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(SelectAnotherMethodButton, {})] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: solanaPaymentOptions.isLoading, options: optionsList, orDivider: optionsList.length != 0 }), optionsList.length != 0 &&
|
|
11088
|
+
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(SelectAnotherMethodButton, {})] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: solanaPaymentOptions.isLoading, options: optionsList, scrollHeight: isMobileFormat ? 225 : 300, orDivider: optionsList.length != 0 }), optionsList.length != 0 && jsx(SelectAnotherMethodButton, {})] }));
|
|
11069
11089
|
};
|
|
11070
11090
|
|
|
11071
11091
|
const WaitingDepositAddress = () => {
|
|
@@ -11103,7 +11123,7 @@ const WaitingDepositAddress = () => {
|
|
|
11103
11123
|
useEffect(() => {
|
|
11104
11124
|
triggerResize();
|
|
11105
11125
|
}, [details]);
|
|
11106
|
-
return (jsx(PageContent, { children: failed ? (jsxs(ModalContent, { style: { marginLeft: 24, marginRight: 24 }, children: [jsxs(ModalH1, { children: [selectedDepositAddressOption?.id, " unavailable"] }), jsxs(ModalBody, { children: ["We're unable to process ", selectedDepositAddressOption?.id, " payments at this time. Please select another payment method."] }), jsx(
|
|
11126
|
+
return (jsx(PageContent, { children: failed ? (jsxs(ModalContent, { style: { marginLeft: 24, marginRight: 24 }, children: [jsxs(ModalH1, { children: [selectedDepositAddressOption?.id, " unavailable"] }), jsxs(ModalBody, { children: ["We're unable to process ", selectedDepositAddressOption?.id, " payments at this time. Please select another payment method."] }), jsx(SelectAnotherMethodButton, {})] })) : (jsxs(ModalContent, { children: [jsx(CustomQRCode, { value: details?.uri, image: jsx("img", { src: selectedDepositAddressOption?.logoURI, width: "100%", height: "100%" }), tooltipMessage: jsxs(Fragment, { children: [jsx(ScanIconWithLogos, { logo: jsx("img", { src: selectedDepositAddressOption?.logoURI }) }), jsxs("span", { children: ["Use a ", selectedDepositAddressOption?.id, " wallet to scan"] })] }) }), details && (jsxs(Fragment, { children: [jsx(OrDivider, {}), jsxs(ModalBody, { children: ["Send exactly ", details.amount, " ", details.suffix, " to", " ", getAddressContraction(details.address), " and return to this page. Confirmation should appear in a few minutes."] }), jsx(CopyToClipboard, { variant: "button", string: details.address, children: "Copy Address" }), jsx(CopyToClipboard, { variant: "left", string: details.amount, children: "Copy Amount" })] }))] })) }));
|
|
11107
11127
|
};
|
|
11108
11128
|
|
|
11109
11129
|
const WaitingExternal = () => {
|
|
@@ -11312,9 +11332,6 @@ const DaimoPayModal = ({ mode = "auto", theme = "auto", customTheme = customThem
|
|
|
11312
11332
|
!isEthConnected &&
|
|
11313
11333
|
context.wcWallet === undefined &&
|
|
11314
11334
|
includeSolana) {
|
|
11315
|
-
console.log("solana connected on open");
|
|
11316
|
-
console.log("isEthConnected ", isEthConnected);
|
|
11317
|
-
console.log("context.wcWallet ", context.wcWallet);
|
|
11318
11335
|
if (context.route === ROUTES.SELECT_METHOD) {
|
|
11319
11336
|
context.setRoute(ROUTES.SOLANA_SELECT_TOKEN, {
|
|
11320
11337
|
event: "solana_connected_on_open",
|