@b3dotfun/sdk 0.0.20 → 0.0.21-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/index.native.d.ts +0 -2
- package/dist/cjs/anyspend/index.native.js +0 -4
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/AnySpend.js +43 -55
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +159 -84
- package/dist/cjs/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendFingerprintWrapper.js +2 -5
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +1 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +4 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +50 -102
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -9
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +1 -3
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +42 -0
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.example.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.example.js +27 -0
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +36 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +12 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +25 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +5 -5
- package/dist/cjs/anyspend/react/index.d.ts +1 -1
- package/dist/cjs/anyspend/react/index.js +1 -1
- package/dist/cjs/anyspend/react/providers/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/providers/index.js +18 -0
- package/dist/cjs/anyspend/types/api.d.ts +35 -56
- package/dist/cjs/anyspend/utils/chain.d.ts +1 -1
- package/dist/cjs/anyspend/utils/chain.js +122 -15
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +5 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useProfile.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/useProfile.js +9 -7
- package/dist/cjs/shared/constants/index.js +5 -3
- package/dist/cjs/shared/utils/formatUsername.d.ts +1 -1
- package/dist/cjs/shared/utils/formatUsername.js +3 -1
- package/dist/esm/anyspend/index.native.d.ts +0 -2
- package/dist/esm/anyspend/index.native.js +0 -4
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +3 -3
- package/dist/esm/anyspend/react/components/AnySpend.js +46 -58
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +163 -88
- package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendFingerprintWrapper.js +2 -5
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +1 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +4 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +52 -104
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -10
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +1 -3
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +42 -0
- package/dist/esm/anyspend/react/components/common/RecipientSelection.example.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/RecipientSelection.example.js +22 -0
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +33 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +12 -0
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +22 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +5 -5
- package/dist/esm/anyspend/react/index.d.ts +1 -1
- package/dist/esm/anyspend/react/index.js +1 -1
- package/dist/esm/anyspend/react/providers/index.d.ts +2 -0
- package/dist/esm/anyspend/react/providers/index.js +2 -0
- package/dist/esm/anyspend/types/api.d.ts +35 -56
- package/dist/esm/anyspend/utils/chain.d.ts +1 -1
- package/dist/esm/anyspend/utils/chain.js +122 -15
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +5 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useProfile.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/useProfile.js +9 -7
- package/dist/esm/shared/constants/index.js +5 -3
- package/dist/esm/shared/utils/formatUsername.d.ts +1 -1
- package/dist/esm/shared/utils/formatUsername.js +3 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/index.native.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +3 -3
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendFingerprintWrapper.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +4 -4
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +42 -0
- package/dist/types/anyspend/react/components/common/RecipientSelection.example.d.ts +7 -0
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +12 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +5 -5
- package/dist/types/anyspend/react/index.d.ts +1 -1
- package/dist/types/anyspend/react/providers/index.d.ts +2 -0
- package/dist/types/anyspend/types/api.d.ts +35 -56
- package/dist/types/anyspend/utils/chain.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +5 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useProfile.d.ts +2 -1
- package/dist/types/shared/utils/formatUsername.d.ts +1 -1
- package/package.json +2 -2
- package/src/anyspend/index.native.ts +0 -6
- package/src/anyspend/react/components/AnySpend.tsx +110 -134
- package/src/anyspend/react/components/AnySpendCustom.tsx +488 -196
- package/src/anyspend/react/components/AnySpendFingerprintWrapper.tsx +4 -8
- package/src/anyspend/react/components/AnySpendNFT.tsx +1 -1
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +76 -108
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +1 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +12 -13
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +1 -3
- package/src/anyspend/react/components/common/RecipientSelection.example.tsx +52 -0
- package/src/anyspend/react/components/common/RecipientSelection.tsx +146 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +1 -0
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useConnectedUserProfile.ts +26 -0
- package/src/anyspend/react/index.ts +1 -1
- package/src/anyspend/react/providers/index.ts +2 -0
- package/src/anyspend/types/api.ts +37 -58
- package/src/anyspend/utils/chain.ts +126 -18
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -1
- package/src/global-account/react/hooks/index.ts +1 -1
- package/src/global-account/react/hooks/useProfile.ts +10 -5
- package/src/shared/constants/index.ts +5 -3
- package/src/shared/utils/formatUsername.ts +3 -2
|
@@ -1,118 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.CryptoPaymentMethodType = void 0;
|
|
5
5
|
exports.CryptoPaymentMethod = CryptoPaymentMethod;
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const b3Chain_1 = require("../../../../shared/constants/chains/b3Chain");
|
|
8
9
|
const cn_1 = require("../../../../shared/utils/cn");
|
|
9
10
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
11
|
+
const thirdweb_1 = require("../../../../shared/utils/thirdweb");
|
|
10
12
|
const lucide_react_1 = require("lucide-react");
|
|
11
13
|
const react_2 = require("react");
|
|
14
|
+
const react_dom_1 = require("react-dom");
|
|
12
15
|
const sonner_1 = require("sonner");
|
|
13
16
|
const react_3 = require("thirdweb/react");
|
|
17
|
+
const wallets_1 = require("thirdweb/wallets");
|
|
14
18
|
const wagmi_1 = require("wagmi");
|
|
15
|
-
var
|
|
16
|
-
(function (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})(
|
|
19
|
+
var CryptoPaymentMethodType;
|
|
20
|
+
(function (CryptoPaymentMethodType) {
|
|
21
|
+
CryptoPaymentMethodType["NONE"] = "none";
|
|
22
|
+
CryptoPaymentMethodType["CONNECT_WALLET"] = "connect_wallet";
|
|
23
|
+
CryptoPaymentMethodType["TRANSFER_CRYPTO"] = "transfer_crypto";
|
|
24
|
+
})(CryptoPaymentMethodType || (exports.CryptoPaymentMethodType = CryptoPaymentMethodType = {}));
|
|
21
25
|
function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
|
|
22
|
-
const {
|
|
23
|
-
const
|
|
24
|
-
const { address: globalAddress, connectedEOAWallet, isActiveEOAWallet, wallet: globalWallet } = (0, react_1.useAccountWallet)();
|
|
26
|
+
const { wallet: globalWallet } = (0, react_1.useAccountWallet)();
|
|
27
|
+
const activeWallet = (0, react_3.useActiveWallet)();
|
|
25
28
|
const { disconnect } = (0, wagmi_1.useDisconnect)();
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(0,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
sonner_1.toast.error(`Failed to connect wallet: ${connectError.message}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, [connectError, globalAddress, wagmiAccount.address, setSelectedPaymentMethod, onSelectPaymentMethod]);
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [!globalAddress ? (
|
|
71
|
-
// Not connected - show single connect button
|
|
72
|
-
(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
73
|
-
// Prevent connecting if already connecting or if there's already a connection
|
|
74
|
-
if (isConnecting)
|
|
75
|
-
return;
|
|
76
|
-
try {
|
|
77
|
-
// Check if wagmi already has a connection
|
|
78
|
-
if (wagmiAccount.isConnected && wagmiAccount.address) {
|
|
79
|
-
// Already connected via wagmi, just proceed with selection
|
|
80
|
-
console.log("Wagmi already connected, proceeding with selection");
|
|
81
|
-
setSelectedPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
82
|
-
onSelectPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
// Check if global address exists (b3 account system)
|
|
86
|
-
if (globalAddress) {
|
|
87
|
-
// Already connected via global account, just proceed with selection
|
|
88
|
-
console.log("Global address already exists, proceeding with selection");
|
|
89
|
-
setSelectedPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
90
|
-
onSelectPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
// Use the first available connector or a preferred one
|
|
94
|
-
const preferredConnector = connectors.find(c => c.name.toLowerCase().includes("metamask")) || connectors[0];
|
|
95
|
-
if (preferredConnector) {
|
|
96
|
-
connect({ connector: preferredConnector });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
console.error("Connection error:", error);
|
|
101
|
-
sonner_1.toast.error("Failed to connect wallet. Please try again.");
|
|
102
|
-
}
|
|
103
|
-
}, disabled: isConnecting, className: "bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-blue-600" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start text-left", children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/60 text-sm", children: "Connect your wallet to continue" })] })] }), isConnecting ? ((0, jsx_runtime_1.jsx)("div", { className: "border-as-primary/20 border-t-as-primary h-5 w-5 animate-spin rounded-full border-2" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" }))] })) : (
|
|
104
|
-
// Connected - show wallet info
|
|
105
|
-
(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary border-as-border-secondary rounded-xl border", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet.meta.icon, alt: "Connected Wallet", className: "h-8 w-8 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-green-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-green-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Connected Wallet" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
106
|
-
setSelectedPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
107
|
-
onSelectPaymentMethod(PaymentMethod.CONNECT_WALLET);
|
|
108
|
-
}, className: "bg-as-brand hover:bg-as-brand/90 rounded-lg px-3 py-1.5 text-sm font-medium text-white transition-colors", children: "Use Wallet" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
109
|
-
disconnect();
|
|
110
|
-
sonner_1.toast.success("Wallet disconnected");
|
|
111
|
-
if (selectedPaymentMethod === PaymentMethod.CONNECT_WALLET) {
|
|
112
|
-
setSelectedPaymentMethod(PaymentMethod.NONE);
|
|
113
|
-
}
|
|
114
|
-
}, className: "text-as-primary/60 hover:text-as-primary/80 rounded-lg p-1.5 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] })] }) })), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
115
|
-
setSelectedPaymentMethod(PaymentMethod.TRANSFER_CRYPTO);
|
|
116
|
-
onSelectPaymentMethod(PaymentMethod.TRANSFER_CRYPTO);
|
|
117
|
-
}, disabled: isCreatingOrder, className: "bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] })] })] }) }));
|
|
29
|
+
const [showWalletModal, setShowWalletModal] = (0, react_2.useState)(false);
|
|
30
|
+
// Define available wallets for the modal
|
|
31
|
+
const availableWallets = [
|
|
32
|
+
(0, wallets_1.createWallet)("io.metamask"),
|
|
33
|
+
// createWallet("com.coinbase.wallet"),
|
|
34
|
+
(0, wallets_1.createWallet)("me.rainbow"),
|
|
35
|
+
(0, wallets_1.createWallet)("walletConnect"),
|
|
36
|
+
(0, wallets_1.createWallet)("io.rabby"),
|
|
37
|
+
(0, wallets_1.createWallet)("app.phantom"),
|
|
38
|
+
];
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto h-fit w-[460px] max-w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3", children: [!activeWallet ? (
|
|
40
|
+
// Not connected - show single connect button
|
|
41
|
+
(0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowWalletModal(true), className: "bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-blue-600" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start text-left", children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/60 text-sm", children: "Choose from multiple wallet options" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] })) : (
|
|
42
|
+
// Connected - show wallet info
|
|
43
|
+
(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary border-as-border-secondary rounded-xl border", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? ((0, jsx_runtime_1.jsx)("img", { src: globalWallet.meta.icon, alt: "Connected Wallet", className: "h-8 w-8 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-green-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-4 w-4 text-green-600" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Connected Wallet" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(activeWallet.getAccount()?.address || "") })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
44
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
45
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
46
|
+
}, className: "bg-as-brand hover:bg-as-brand/90 rounded-lg px-3 py-1.5 text-sm font-medium text-white transition-colors", children: "Use Wallet" }), (0, jsx_runtime_1.jsx)("button", { onClick: async () => {
|
|
47
|
+
disconnect();
|
|
48
|
+
sonner_1.toast.success("Wallet disconnected");
|
|
49
|
+
if (selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
50
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
51
|
+
}
|
|
52
|
+
}, className: "text-as-primary/60 hover:text-as-primary/80 rounded-lg p-1.5 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] })] }) })), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
53
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
54
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
55
|
+
}, disabled: isCreatingOrder, className: "bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start text-left", children: (0, jsx_runtime_1.jsx)("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] })] })] }), showWalletModal &&
|
|
56
|
+
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "pointer-events-auto fixed inset-0 z-[9999] flex items-center justify-center bg-black/50", children: (0, jsx_runtime_1.jsxs)("div", { className: "max-h-[80vh] w-[400px] max-w-[90vw] overflow-auto rounded-xl bg-white p-6 dark:bg-gray-900", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Connect Wallet" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setShowWalletModal(false), className: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }) })] }), (0, jsx_runtime_1.jsx)(react_3.ConnectEmbed, { client: thirdweb_1.client, chain: b3Chain_1.thirdwebB3Mainnet, wallets: availableWallets, showThirdwebBranding: false, theme: (0, react_3.lightTheme)(), onConnect: async (wallet) => {
|
|
57
|
+
console.log("Wallet connected:", wallet);
|
|
58
|
+
// setShowWalletModal(false);
|
|
59
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
60
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
61
|
+
setShowWalletModal(false);
|
|
62
|
+
}, style: {
|
|
63
|
+
width: "100%",
|
|
64
|
+
minHeight: "300px",
|
|
65
|
+
} })] }) }), typeof window !== "undefined" ? document.getElementById("b3-root") || document.body : document.body)] }));
|
|
118
66
|
}
|
|
@@ -53,7 +53,7 @@ function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
53
53
|
id: FiatPaymentMethod.STRIPE,
|
|
54
54
|
name: "Stripe",
|
|
55
55
|
description: "Credit or debit card payment",
|
|
56
|
-
badge: stripeFee ? `$${stripeFee} fee` : "Standard Fee",
|
|
56
|
+
badge: stripeFee ? `$${Number(stripeFee).toFixed(2)} fee` : "Standard Fee",
|
|
57
57
|
badgeColor: "bg-yellow-100 text-yellow-800",
|
|
58
58
|
available: true,
|
|
59
59
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
|
-
import {
|
|
2
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
3
3
|
interface OrderDetailsProps {
|
|
4
4
|
isMainnet: boolean;
|
|
5
5
|
mode?: "modal" | "page";
|
|
@@ -8,7 +8,7 @@ interface OrderDetailsProps {
|
|
|
8
8
|
relayTx: components["schemas"]["RelayTx"] | null;
|
|
9
9
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
10
10
|
refundTxs: components["schemas"]["RefundTx"][] | null;
|
|
11
|
-
|
|
11
|
+
cryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
12
12
|
onBack?: () => void;
|
|
13
13
|
}
|
|
14
14
|
export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
|
|
@@ -126,12 +126,12 @@ function roundTokenAmount(amount) {
|
|
|
126
126
|
const roundedDecimalPart = digits.join("");
|
|
127
127
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
128
128
|
}
|
|
129
|
-
exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs,
|
|
129
|
+
exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, cryptoPaymentMethod, onBack, }) {
|
|
130
130
|
const router = (0, hooks_1.useRouter)();
|
|
131
131
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
132
|
-
// Read payment method from URL parameters
|
|
133
|
-
const
|
|
134
|
-
const
|
|
132
|
+
// Read crypto payment method from URL parameters
|
|
133
|
+
const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
|
|
134
|
+
const effectiveCryptoPaymentMethod = cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE;
|
|
135
135
|
const setB3ModalOpen = (0, react_1.useModalStore)((state) => state.setB3ModalOpen);
|
|
136
136
|
const srcToken = order.metadata.srcToken;
|
|
137
137
|
const dstToken = order.metadata.dstToken;
|
|
@@ -476,7 +476,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
476
476
|
? `Waiting for payment`
|
|
477
477
|
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] })] }));
|
|
478
478
|
}
|
|
479
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { isMainnet: isMainnet, order: order, dstTokenSymbol: dstToken.symbol })) :
|
|
479
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { isMainnet: isMainnet, order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ? ((0, jsx_runtime_1.jsx)(ConnectWalletPayment_1.default, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
480
480
|
// Transfer Crypto Payment Method - Show new card-based UI
|
|
481
481
|
(0, jsx_runtime_1.jsx)(TransferCryptoDetails_1.TransferCryptoDetails, { order: order, recipientName: recipientName, srcToken: srcToken, dstToken: dstToken, tournament: tournament, nft: nft, onBack: handleBack })) : ((0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50", children: "Please send" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0", children: [(0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: roundedUpSrcAmount, onCopy: () => {
|
|
482
482
|
sonner_1.toast.success("Copied to clipboard");
|
|
@@ -488,11 +488,9 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
488
488
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
489
489
|
: (0, centerTruncate_1.default)(account?.address || "", 6)] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
490
490
|
// Default case - existing QR code flow
|
|
491
|
-
(0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), (0, jsx_runtime_1.jsxs)("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
491
|
+
(0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), (0, jsx_runtime_1.jsxs)("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
492
492
|
});
|
|
493
493
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
494
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-b3-react-background relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg
|
|
495
|
-
boxShadow: "0 0 15px 5px rgba(138, 43, 226, 0.2)",
|
|
496
|
-
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "text-as-primary h-3 w-3" }) })) }), (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, children: title })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary", children: title })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-1", children: tx ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: (0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(chainId, tx.txHash), target: "_blank", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 font-mono text-xs", children: (0, centerTruncate_1.default)(tx?.txHash, 6) }) }) })) : null })] }));
|
|
494
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-b3-react-background relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "text-as-primary h-3 w-3" }) })) }), (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, children: title })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary", children: title })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-1", children: tx ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: (0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(chainId, tx.txHash), target: "_blank", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 font-mono text-xs", children: (0, centerTruncate_1.default)(tx?.txHash, 6) }) }) })) : null })] }));
|
|
497
495
|
}
|
|
498
496
|
exports.OrderDetailsLoadingView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsxs)(react_1.Badge, { variant: "default", className: "hover:bg-b3-react-background flex items-center gap-3 border-white/20 bg-white/10 px-4 py-1 text-base transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-8 w-48" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "ml-4 h-8 w-32" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mt-4 h-8 w-24" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-4 h-12 w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)(react_1.Skeleton, { className: "rounded-lg p-6 pb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[200px] w-[200px]" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 flex items-center justify-center gap-2", children: (0, jsx_runtime_1.jsx)("div", { className: "h-5 w-5 rounded-full" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" }, i))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background mt-8 w-full rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-3 h-4 w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" })] }));
|
|
@@ -23,10 +23,10 @@ exports.OrderStatus = (0, react_1.memo)(function OrderStatus({ order }) {
|
|
|
23
23
|
description: description,
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
|
-
if (order.status
|
|
26
|
+
if (["waiting_stripe_payment"].includes(order.status)) {
|
|
27
27
|
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
|
|
28
28
|
}
|
|
29
|
-
if (order.status
|
|
29
|
+
if (["relay", "sending_token_from_vault"].includes(order.status)) {
|
|
30
30
|
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
|
|
31
31
|
}
|
|
32
32
|
if (!isComplete && displayStatus !== "failure") {
|
|
@@ -87,9 +87,7 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
87
87
|
try {
|
|
88
88
|
const result = (await stripe.confirmPayment({
|
|
89
89
|
elements,
|
|
90
|
-
|
|
91
|
-
return_url: `${window.location.origin}/?orderId=${order.id}&waitingForDeposit=true&fromStripe=true`,
|
|
92
|
-
},
|
|
90
|
+
redirect: "if_required",
|
|
93
91
|
}));
|
|
94
92
|
if (result.error) {
|
|
95
93
|
// This point will only be reached if there is an immediate error.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface RecipientSelectionProps {
|
|
2
|
+
/**
|
|
3
|
+
* Initial recipient address value
|
|
4
|
+
*/
|
|
5
|
+
initialValue?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Placeholder text for the input field
|
|
8
|
+
*/
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Title text displayed in the header
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Description text displayed below the title
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Text for the confirm button
|
|
20
|
+
*/
|
|
21
|
+
confirmText?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when back button is clicked
|
|
24
|
+
*/
|
|
25
|
+
onBack: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when recipient address is confirmed
|
|
28
|
+
* @param address - The recipient address entered by the user
|
|
29
|
+
*/
|
|
30
|
+
onConfirm: (address: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the component should auto-focus the input
|
|
33
|
+
*/
|
|
34
|
+
autoFocus?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Custom validation function for the address
|
|
37
|
+
* @param address - The address to validate
|
|
38
|
+
* @returns true if valid, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
validateAddress?: (address: string) => boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function RecipientSelection({ initialValue, placeholder, title, description, confirmText, onBack, onConfirm, autoFocus, validateAddress, }: RecipientSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example usage of the RecipientSelection component
|
|
3
|
+
* This file demonstrates various ways to use the component with different props
|
|
4
|
+
*/
|
|
5
|
+
export declare function BasicRecipientSelection(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function CustomRecipientSelection(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ENSRecipientSelection(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasicRecipientSelection = BasicRecipientSelection;
|
|
4
|
+
exports.CustomRecipientSelection = CustomRecipientSelection;
|
|
5
|
+
exports.ENSRecipientSelection = ENSRecipientSelection;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Example usage of the RecipientSelection component
|
|
9
|
+
* This file demonstrates various ways to use the component with different props
|
|
10
|
+
*/
|
|
11
|
+
const viem_1 = require("viem");
|
|
12
|
+
const RecipientSelection_1 = require("./RecipientSelection");
|
|
13
|
+
// Basic usage example
|
|
14
|
+
function BasicRecipientSelection() {
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(RecipientSelection_1.RecipientSelection, { onBack: () => console.log("Back clicked"), onConfirm: address => console.log("Address confirmed:", address) }));
|
|
16
|
+
}
|
|
17
|
+
// Custom styling and validation example
|
|
18
|
+
function CustomRecipientSelection() {
|
|
19
|
+
const validateEthereumAddress = (address) => {
|
|
20
|
+
return (0, viem_1.isAddress)(address);
|
|
21
|
+
};
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(RecipientSelection_1.RecipientSelection, { initialValue: "0x...", placeholder: "Enter Ethereum address", title: "Send to Ethereum Address", description: "Enter a valid Ethereum address to send tokens", confirmText: "Confirm Ethereum Address", validateAddress: validateEthereumAddress, autoFocus: false, onBack: () => console.log("Going back"), onConfirm: address => console.log("Valid Ethereum address:", address) }));
|
|
23
|
+
}
|
|
24
|
+
// ENS-focused example
|
|
25
|
+
function ENSRecipientSelection() {
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(RecipientSelection_1.RecipientSelection, { placeholder: "Enter ENS name (e.g., vitalik.eth)", title: "Send to ENS Address", description: "Enter an ENS name or Ethereum address", confirmText: "Confirm ENS Address", onBack: () => console.log("Back to previous view"), onConfirm: address => console.log("ENS or address:", address) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RecipientSelection = RecipientSelection;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const lucide_react_1 = require("lucide-react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
function RecipientSelection({ initialValue = "", placeholder = "Enter recipient address", title = "Add recipient address or ENS", description = "Swap and send tokens to another address", confirmText = "Confirm recipient address", onBack, onConfirm, autoFocus = true, validateAddress, }) {
|
|
9
|
+
const [recipientAddress, setRecipientAddress] = (0, react_1.useState)(initialValue);
|
|
10
|
+
// Update internal state when initialValue changes
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
setRecipientAddress(initialValue);
|
|
13
|
+
}, [initialValue]);
|
|
14
|
+
const handlePaste = async () => {
|
|
15
|
+
try {
|
|
16
|
+
const text = await navigator.clipboard.readText();
|
|
17
|
+
setRecipientAddress(text);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
console.error("Failed to read clipboard:", err);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const handleConfirm = () => {
|
|
24
|
+
if (recipientAddress && (!validateAddress || validateAddress(recipientAddress))) {
|
|
25
|
+
onConfirm(recipientAddress);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const handleKeyDown = (e) => {
|
|
29
|
+
if (e.key === "Enter" && recipientAddress) {
|
|
30
|
+
handleConfirm();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const isAddressValid = !validateAddress || !recipientAddress || validateAddress(recipientAddress);
|
|
34
|
+
const canConfirm = recipientAddress && isAddressValid;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-around", children: [(0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-secondary border-l", children: (0, jsx_runtime_1.jsx)("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && ((0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), (0, jsx_runtime_1.jsx)("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
|
|
36
|
+
}
|
|
@@ -69,5 +69,5 @@ exports.TransferCryptoDetails = (0, react_3.memo)(function TransferCryptoDetails
|
|
|
69
69
|
transition: "stroke-dashoffset 1s linear",
|
|
70
70
|
} })] }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Amount" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
71
71
|
sonner_1.toast.success("Amount copied to clipboard");
|
|
72
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain), className: "bg-as-surface-secondary max-h-48 max-w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), (0, jsx_runtime_1.jsx)("div", { className: "place-self-end", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-3", children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
72
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "bg-as-surface-secondary max-h-48 max-w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), (0, jsx_runtime_1.jsx)("div", { className: "place-self-end", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-3", children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
73
73
|
});
|
|
@@ -16,6 +16,7 @@ export { OrderHistoryItem } from "./common/OrderHistoryItem";
|
|
|
16
16
|
export { OrderStatus } from "./common/OrderStatus";
|
|
17
17
|
export { OrderToken } from "./common/OrderToken";
|
|
18
18
|
export { OrderTokenAmount } from "./common/OrderTokenAmount";
|
|
19
|
+
export { RecipientSelection } from "./common/RecipientSelection";
|
|
19
20
|
export { StepProgress } from "./common/StepProgress";
|
|
20
21
|
export { TokenBalance } from "./common/TokenBalance";
|
|
21
22
|
export { TransferCryptoDetails } from "./common/TransferCryptoDetails";
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
17
|
+
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
18
18
|
// Components
|
|
19
19
|
var AnySpend_1 = require("./AnySpend");
|
|
20
20
|
Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
|
|
@@ -52,6 +52,8 @@ var OrderToken_1 = require("./common/OrderToken");
|
|
|
52
52
|
Object.defineProperty(exports, "OrderToken", { enumerable: true, get: function () { return OrderToken_1.OrderToken; } });
|
|
53
53
|
var OrderTokenAmount_1 = require("./common/OrderTokenAmount");
|
|
54
54
|
Object.defineProperty(exports, "OrderTokenAmount", { enumerable: true, get: function () { return OrderTokenAmount_1.OrderTokenAmount; } });
|
|
55
|
+
var RecipientSelection_1 = require("./common/RecipientSelection");
|
|
56
|
+
Object.defineProperty(exports, "RecipientSelection", { enumerable: true, get: function () { return RecipientSelection_1.RecipientSelection; } });
|
|
55
57
|
var StepProgress_1 = require("./common/StepProgress");
|
|
56
58
|
Object.defineProperty(exports, "StepProgress", { enumerable: true, get: function () { return StepProgress_1.StepProgress; } });
|
|
57
59
|
var TokenBalance_1 = require("./common/TokenBalance");
|
|
@@ -5,6 +5,7 @@ export * from "./useAnyspendOrderHistory";
|
|
|
5
5
|
export * from "./useAnyspendQuote";
|
|
6
6
|
export * from "./useAnyspendTokens";
|
|
7
7
|
export * from "./useCoinbaseOnrampOptions";
|
|
8
|
+
export * from "./useConnectedUserProfile";
|
|
8
9
|
export * from "./useGeoOnrampOptions";
|
|
9
10
|
export * from "./useGetGeo";
|
|
10
11
|
export * from "./useSigMint";
|
|
@@ -21,6 +21,7 @@ __exportStar(require("./useAnyspendOrderHistory"), exports);
|
|
|
21
21
|
__exportStar(require("./useAnyspendQuote"), exports);
|
|
22
22
|
__exportStar(require("./useAnyspendTokens"), exports);
|
|
23
23
|
__exportStar(require("./useCoinbaseOnrampOptions"), exports);
|
|
24
|
+
__exportStar(require("./useConnectedUserProfile"), exports);
|
|
24
25
|
__exportStar(require("./useGeoOnrampOptions"), exports);
|
|
25
26
|
__exportStar(require("./useGetGeo"), exports);
|
|
26
27
|
__exportStar(require("./useSigMint"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that provides connected user's address, profile, and cleaned display name
|
|
3
|
+
* Combines logic for getting connected address from either global account or thirdweb wallets
|
|
4
|
+
*/
|
|
5
|
+
export declare function useConnectedUserProfile(): {
|
|
6
|
+
address: string | undefined;
|
|
7
|
+
profile: import("@tanstack/react-query").UseQueryResult<import("../../../global-account/react").CombinedProfile, Error>;
|
|
8
|
+
name: string | null | undefined;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useConnectedUserProfile = useConnectedUserProfile;
|
|
4
|
+
const react_1 = require("../../../global-account/react");
|
|
5
|
+
const react_2 = require("thirdweb/react");
|
|
6
|
+
/**
|
|
7
|
+
* Hook that provides connected user's address, profile, and cleaned display name
|
|
8
|
+
* Combines logic for getting connected address from either global account or thirdweb wallets
|
|
9
|
+
*/
|
|
10
|
+
function useConnectedUserProfile() {
|
|
11
|
+
const { address: globalAddress } = (0, react_1.useAccountWallet)();
|
|
12
|
+
const connectedWallets = (0, react_2.useConnectedWallets)();
|
|
13
|
+
// Get connected address from global account or first connected wallet
|
|
14
|
+
const connectedAddress = globalAddress || connectedWallets?.[0]?.getAccount()?.address;
|
|
15
|
+
// Fetch profile data for the connected address with cleaned name
|
|
16
|
+
const connectedProfile = (0, react_1.useProfile)({ address: connectedAddress });
|
|
17
|
+
return {
|
|
18
|
+
address: connectedAddress,
|
|
19
|
+
profile: connectedProfile,
|
|
20
|
+
name: connectedProfile.data?.name,
|
|
21
|
+
isLoading: connectedProfile.isLoading,
|
|
22
|
+
isError: connectedProfile.isError,
|
|
23
|
+
error: connectedProfile.error,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -16,13 +16,13 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
|
|
|
16
16
|
creator?: string | undefined;
|
|
17
17
|
signatureRequestBody?: {
|
|
18
18
|
currency?: string | undefined;
|
|
19
|
-
price?: string | undefined;
|
|
20
|
-
clonePrice?: string | undefined;
|
|
21
|
-
primarySaleRecipient?: string | undefined;
|
|
22
19
|
royaltyRecipient?: string | undefined;
|
|
23
20
|
royaltyBps?: number | undefined;
|
|
21
|
+
primarySaleRecipient?: string | undefined;
|
|
24
22
|
validityStartTimestamp?: number | undefined;
|
|
25
23
|
validityEndTimestamp?: number | undefined;
|
|
24
|
+
price?: string | undefined;
|
|
25
|
+
clonePrice?: string | undefined;
|
|
26
26
|
metadata: {
|
|
27
27
|
name?: string | undefined;
|
|
28
28
|
description?: string | undefined;
|
|
@@ -38,9 +38,9 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
|
|
|
38
38
|
maxSupply?: number | undefined;
|
|
39
39
|
conditions?: {
|
|
40
40
|
chainId: number;
|
|
41
|
-
tokenAddress: string;
|
|
42
41
|
conditionType: "user-owns-tokens";
|
|
43
42
|
isOnchain: boolean;
|
|
43
|
+
tokenAddress: string;
|
|
44
44
|
tokenAmount: string;
|
|
45
45
|
}[] | undefined;
|
|
46
46
|
isFreeMint?: boolean | undefined;
|
|
@@ -90,9 +90,9 @@ export declare const useSigMintCollection: ({ address, chainId }: FindByAddressP
|
|
|
90
90
|
description?: string | undefined;
|
|
91
91
|
name?: string | undefined;
|
|
92
92
|
image?: string | undefined;
|
|
93
|
+
attributes?: any;
|
|
93
94
|
externalLink?: string | undefined;
|
|
94
95
|
appUri?: string | undefined;
|
|
95
|
-
attributes?: any;
|
|
96
96
|
backgroundColor?: string | undefined;
|
|
97
97
|
promptImageUrl?: string | undefined;
|
|
98
98
|
};
|