@b3dotfun/sdk 0.0.29 → 0.0.30-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/constants/index.d.ts +1 -0
- package/dist/cjs/anyspend/constants/index.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +17 -10
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +9 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +130 -41
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +6 -4
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaySection.js +6 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +34 -3
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/cjs/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/cjs/bondkit/constants.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -4
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +1 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +19 -12
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +133 -44
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +7 -4
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +7 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaySection.js +7 -5
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -4
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/esm/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/esm/bondkit/constants.js +1 -1
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -4
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/types/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/types/shared/constants/chains/supported.d.ts +4 -4
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +2 -0
- package/src/anyspend/react/components/AnySpend.tsx +1 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +142 -130
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +9 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +289 -103
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -3
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +10 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +9 -2
- package/src/anyspend/react/components/common/PaySection.tsx +9 -7
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +41 -3
- package/src/bondkit/abis/BondkitTokenABI.ts +41 -9
- package/src/bondkit/abis/BondkitTokenFactoryABI.ts +0 -9
- package/src/bondkit/constants.ts +1 -1
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +26 -10
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +5 -1
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +4 -2
- package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/cjs/anyspend/abis/bondKit.js +0 -29
- package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/esm/anyspend/abis/bondKit.js +0 -26
- package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
- package/src/anyspend/abis/bondKit.ts +0 -26
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
3
|
+
exports.DEPOSIT_HYPE_ACTION = exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
4
|
const chains_1 = require("viem/chains");
|
|
5
5
|
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
6
6
|
exports.RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -81,3 +81,4 @@ exports.VENDOR_DISPLAY_NAMES = {
|
|
|
81
81
|
stripe: "Stripe",
|
|
82
82
|
unknown: "Unknown Vendor",
|
|
83
83
|
};
|
|
84
|
+
exports.DEPOSIT_HYPE_ACTION = "deposit_hype";
|
|
@@ -657,7 +657,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
657
657
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
658
658
|
}, [activePanel]);
|
|
659
659
|
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => setActivePanel(PanelView.MAIN), onSelectOrder: onSelectOrder }) }));
|
|
660
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: () => {
|
|
660
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: () => {
|
|
661
661
|
setOrderId(undefined);
|
|
662
662
|
setActivePanel(PanelView.MAIN);
|
|
663
663
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
|
-
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl,
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AnySpendBondKit = AnySpendBondKit;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const bondkit_1 = require("../../../bondkit");
|
|
6
5
|
const react_1 = require("../../../global-account/react");
|
|
7
6
|
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
8
7
|
const react_2 = require("motion/react");
|
|
9
8
|
const react_3 = require("react");
|
|
10
9
|
const viem_1 = require("viem");
|
|
11
|
-
const
|
|
10
|
+
const bondkit_1 = require("../../../bondkit");
|
|
12
11
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
13
12
|
// Debounce utility function
|
|
14
13
|
function debounce(func, wait) {
|
|
@@ -24,11 +23,11 @@ function formatNumberWithCommas(x) {
|
|
|
24
23
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
25
24
|
return parts.join(".");
|
|
26
25
|
}
|
|
27
|
-
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl,
|
|
26
|
+
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
|
|
28
27
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
29
|
-
const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!
|
|
30
|
-
const [
|
|
31
|
-
const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!
|
|
28
|
+
const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!initialB3Amount);
|
|
29
|
+
const [b3Amount, setB3Amount] = (0, react_3.useState)(initialB3Amount || "");
|
|
30
|
+
const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!initialB3Amount);
|
|
32
31
|
const [validationError, setValidationError] = (0, react_3.useState)("");
|
|
33
32
|
const [tokenName, setTokenName] = (0, react_3.useState)("");
|
|
34
33
|
const [tokenSymbol, setTokenSymbol] = (0, react_3.useState)("");
|
|
@@ -60,12 +59,12 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
60
59
|
const [name, symbol] = await Promise.all([
|
|
61
60
|
basePublicClient.readContract({
|
|
62
61
|
address: contractAddress,
|
|
63
|
-
abi:
|
|
62
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
64
63
|
functionName: "name",
|
|
65
64
|
}),
|
|
66
65
|
basePublicClient.readContract({
|
|
67
66
|
address: contractAddress,
|
|
68
|
-
abi:
|
|
67
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
69
68
|
functionName: "symbol",
|
|
70
69
|
}),
|
|
71
70
|
]);
|
|
@@ -82,8 +81,8 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
82
81
|
fetchTokenName();
|
|
83
82
|
}
|
|
84
83
|
}, [contractAddress, basePublicClient]);
|
|
85
|
-
// Get
|
|
86
|
-
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "
|
|
84
|
+
// Get b3 token data
|
|
85
|
+
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
|
|
87
86
|
// Convert token data to AnySpend Token type
|
|
88
87
|
const dstToken = (0, react_3.useMemo)(() => {
|
|
89
88
|
if (!tokenData)
|
|
@@ -119,16 +118,16 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
119
118
|
setIsLoadingQuote(false);
|
|
120
119
|
}
|
|
121
120
|
}, 500), [bondkitTokenClient]);
|
|
122
|
-
// Fetch initial quote if
|
|
121
|
+
// Fetch initial quote if b3Amount is provided
|
|
123
122
|
(0, react_3.useEffect)(() => {
|
|
124
|
-
if (
|
|
125
|
-
debouncedGetQuote(
|
|
123
|
+
if (initialB3Amount && bondkitTokenClient) {
|
|
124
|
+
debouncedGetQuote(initialB3Amount);
|
|
126
125
|
}
|
|
127
|
-
}, [
|
|
126
|
+
}, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
|
|
128
127
|
const validateAndSetAmount = (value) => {
|
|
129
128
|
// Allow empty input
|
|
130
129
|
if (value === "") {
|
|
131
|
-
|
|
130
|
+
setB3Amount("");
|
|
132
131
|
setIsAmountValid(false);
|
|
133
132
|
setValidationError("");
|
|
134
133
|
setQuote(null);
|
|
@@ -144,14 +143,14 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
144
143
|
if ((value.match(/\./g) || []).length > 1) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
// Prevent more than 18 decimal places (
|
|
146
|
+
// Prevent more than 18 decimal places (B3 precision)
|
|
148
147
|
const parts = value.split(".");
|
|
149
148
|
if (parts[1] && parts[1].length > 18) {
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
151
|
// Clean the input - remove leading zeros if not decimal
|
|
153
152
|
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
154
|
-
|
|
153
|
+
setB3Amount(cleanedValue);
|
|
155
154
|
try {
|
|
156
155
|
const parsedAmount = (0, viem_1.parseEther)(cleanedValue);
|
|
157
156
|
if (parsedAmount <= BigInt(0)) {
|
|
@@ -169,7 +168,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
169
168
|
setValidationError("Please enter a valid amount");
|
|
170
169
|
}
|
|
171
170
|
};
|
|
172
|
-
const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-6", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-[28px] font-bold", children: [
|
|
171
|
+
const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-6", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-[28px] font-bold", children: [b3Amount, " B3"] }), quote && ((0, jsx_runtime_1.jsxs)("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
|
|
173
172
|
// Show loading state while fetching token data
|
|
174
173
|
if (isLoading) {
|
|
175
174
|
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
|
|
@@ -191,18 +190,18 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
191
190
|
opacity: hasMounted ? 1 : 0,
|
|
192
191
|
y: hasMounted ? 0 : 20,
|
|
193
192
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
194
|
-
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "
|
|
195
|
-
if (isAmountValid &&
|
|
193
|
+
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "B3 Amount" }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: b3Amount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && b3Amount && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [b3Amount || "0", " B3"] }) })] }), isLoadingQuote ? ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => {
|
|
194
|
+
if (isAmountValid && b3Amount) {
|
|
196
195
|
setShowAmountPrompt(false);
|
|
197
196
|
}
|
|
198
|
-
}, disabled: !isAmountValid || !
|
|
197
|
+
}, disabled: !isAmountValid || !b3Amount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
|
|
199
198
|
}
|
|
200
199
|
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
201
|
-
abi:
|
|
200
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
202
201
|
functionName: "buyFor",
|
|
203
|
-
args: [recipientAddress, BigInt(minTokensOut)],
|
|
202
|
+
args: [recipientAddress, (0, viem_1.parseEther)(b3Amount), BigInt(minTokensOut)],
|
|
204
203
|
});
|
|
205
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(
|
|
204
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
206
205
|
type: "custom",
|
|
207
206
|
action: "BondKit Buy",
|
|
208
207
|
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
@@ -419,7 +419,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
419
419
|
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
|
|
420
420
|
setActivePanel(PanelView.HISTORY);
|
|
421
421
|
}, onSelectOrder: onSelectOrder }) }));
|
|
422
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
422
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
423
423
|
setOrderId(undefined);
|
|
424
424
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
425
425
|
// Remove orderId from URL when canceling
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface AnySpendDepositHypeProps {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
4
|
recipientAddress: string;
|
|
@@ -7,4 +7,6 @@ export declare function AnySpendDepositHype(props: {
|
|
|
7
7
|
sourceTokenChainId?: number;
|
|
8
8
|
onSuccess?: () => void;
|
|
9
9
|
depositContractAddress?: string;
|
|
10
|
-
|
|
10
|
+
mainFooter?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,6 +27,7 @@ const RecipientSelection_1 = require("./common/RecipientSelection");
|
|
|
27
27
|
const escrow_1 = require("../../../anyspend/abis/escrow");
|
|
28
28
|
const lucide_react_1 = require("lucide-react");
|
|
29
29
|
const PanelOnramp_1 = require("./common/PanelOnramp");
|
|
30
|
+
const SLIPPAGE_PERCENT = 3;
|
|
30
31
|
function generateEncodedDataForDepositHype(amount, beneficiary) {
|
|
31
32
|
(0, invariant_1.default)(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
32
33
|
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
@@ -40,9 +41,9 @@ function AnySpendDepositHype(props) {
|
|
|
40
41
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
41
42
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendDepositHypeInner, { ...props }) }));
|
|
42
43
|
}
|
|
43
|
-
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, depositContractAddress, }) {
|
|
44
|
+
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, depositContractAddress, mainFooter, }) {
|
|
44
45
|
// Use shared flow hook
|
|
45
|
-
const { activePanel, setActivePanel, orderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
|
|
46
|
+
const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
|
|
46
47
|
paymentType,
|
|
47
48
|
recipientAddress,
|
|
48
49
|
loadOrder,
|
|
@@ -50,6 +51,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
50
51
|
onTransactionSuccess: onSuccess,
|
|
51
52
|
sourceTokenAddress,
|
|
52
53
|
sourceTokenChainId,
|
|
54
|
+
slippage: SLIPPAGE_PERCENT,
|
|
53
55
|
});
|
|
54
56
|
// Button state logic
|
|
55
57
|
const btnInfo = (0, react_3.useMemo)(() => {
|
|
@@ -122,6 +124,10 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
122
124
|
await handleFiatOrder();
|
|
123
125
|
}
|
|
124
126
|
};
|
|
127
|
+
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? ((0, jsx_runtime_1.jsx)(PaySection_1.PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : ((0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", className: (0, cn_1.cn)("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: anyspend_1.B3_TOKEN, selectedDstChainId: chains_1.base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
|
|
128
|
+
setIsSrcInputDirty(false);
|
|
129
|
+
setSrcAmount(value);
|
|
130
|
+
}, anyspendQuote: anyspendQuote }))] }) }), (0, jsx_runtime_1.jsx)(ErrorSection_1.ErrorSection, { error: getAnyspendQuoteError }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
|
|
125
131
|
// Handle crypto order creation
|
|
126
132
|
const handleCryptoOrder = async () => {
|
|
127
133
|
try {
|
|
@@ -129,7 +135,10 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
129
135
|
(0, invariant_1.default)(selectedRecipientAddress, "Recipient address is not found");
|
|
130
136
|
(0, invariant_1.default)(depositContractAddress, "Deposit contract address is not found");
|
|
131
137
|
const srcAmountBigInt = BigInt(activeInputAmountInWei);
|
|
132
|
-
|
|
138
|
+
// TODO: temp subtract 3% for slippage
|
|
139
|
+
const originalDepositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
140
|
+
const depositAmountWei = ((BigInt(originalDepositAmountWei) * BigInt(100 - SLIPPAGE_PERCENT)) /
|
|
141
|
+
BigInt(100)).toString();
|
|
133
142
|
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
134
143
|
createOrder({
|
|
135
144
|
recipientAddress: selectedRecipientAddress,
|
|
@@ -144,7 +153,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
144
153
|
amount: depositAmountWei,
|
|
145
154
|
data: encodedData,
|
|
146
155
|
to: depositContractAddress,
|
|
147
|
-
action:
|
|
156
|
+
action: anyspend_1.DEPOSIT_HYPE_ACTION,
|
|
148
157
|
},
|
|
149
158
|
});
|
|
150
159
|
}
|
|
@@ -206,7 +215,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
206
215
|
amount: depositAmountWei,
|
|
207
216
|
data: encodedData,
|
|
208
217
|
to: depositContractAddress,
|
|
209
|
-
action:
|
|
218
|
+
action: anyspend_1.DEPOSIT_HYPE_ACTION,
|
|
210
219
|
},
|
|
211
220
|
});
|
|
212
221
|
}
|
|
@@ -216,7 +225,8 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
216
225
|
}
|
|
217
226
|
};
|
|
218
227
|
// Order details view
|
|
219
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
228
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTx: oat.data.relayTx, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
229
|
+
setOrderId(undefined);
|
|
220
230
|
setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
|
|
221
231
|
onSuccess?.();
|
|
222
232
|
} })] })) }) }));
|
|
@@ -250,10 +260,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
250
260
|
center: { x: 0, opacity: 1 },
|
|
251
261
|
exit: { x: -300, opacity: 0 },
|
|
252
262
|
}, transition: { type: "spring", stiffness: 300, damping: 30 }, children: [
|
|
253
|
-
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children:
|
|
254
|
-
setIsSrcInputDirty(false);
|
|
255
|
-
setSrcAmount(value);
|
|
256
|
-
}, anyspendQuote: anyspendQuote }))] }) }), (0, jsx_runtime_1.jsx)(ErrorSection_1.ErrorSection, { error: getAnyspendQuoteError }), (0, jsx_runtime_1.jsx)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) })] }) }, "main-view"),
|
|
263
|
+
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: mainView }, "main-view"),
|
|
257
264
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
|
|
258
265
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
259
266
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: recipientSelectionView }, "recipient-selection-view"),
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.default = ConnectWalletPayment;
|
|
5
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
9
|
const anyspend_1 = require("../../../../anyspend");
|
|
7
10
|
const react_1 = require("../../../../global-account/react");
|
|
11
|
+
const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
|
|
8
12
|
const number_1 = require("../../../../shared/utils/number");
|
|
9
13
|
const framer_motion_1 = require("framer-motion");
|
|
10
14
|
const lucide_react_1 = require("lucide-react");
|
|
15
|
+
const wagmi_1 = require("wagmi");
|
|
11
16
|
const OrderDetailsCollapsible_1 = require("./OrderDetailsCollapsible");
|
|
12
17
|
function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, }) {
|
|
13
18
|
const profile = (0, react_1.useProfile)({ address: order.recipientAddress });
|
|
14
19
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
20
|
+
const { address: connectedAddress } = (0, wagmi_1.useAccount)();
|
|
15
21
|
const srcToken = order.metadata.srcToken;
|
|
16
22
|
const dstToken = order.metadata.dstToken;
|
|
17
23
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
@@ -26,5 +32,7 @@ function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecut
|
|
|
26
32
|
}
|
|
27
33
|
return ((0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col items-center gap-6", children: (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { delay: 0.5 }, className: "flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Transaction Pending", (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
28
34
|
? "Pay from Phantom Wallet"
|
|
29
|
-
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.
|
|
35
|
+
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.jsxs)("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
36
|
+
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
37
|
+
: (0, centerTruncate_1.default)(connectedAddress || "")] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4", children: (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }) })] }) }));
|
|
30
38
|
}
|
|
@@ -5,16 +5,12 @@ 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");
|
|
9
8
|
const cn_1 = require("../../../../shared/utils/cn");
|
|
10
9
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
11
|
-
const thirdweb_1 = require("../../../../shared/utils/thirdweb");
|
|
12
10
|
const lucide_react_1 = require("lucide-react");
|
|
13
11
|
const react_2 = require("react");
|
|
14
12
|
const react_dom_1 = require("react-dom");
|
|
15
13
|
const sonner_1 = require("sonner");
|
|
16
|
-
const react_3 = require("thirdweb/react");
|
|
17
|
-
const wallets_1 = require("thirdweb/wallets");
|
|
18
14
|
const wagmi_1 = require("wagmi");
|
|
19
15
|
var CryptoPaymentMethodType;
|
|
20
16
|
(function (CryptoPaymentMethodType) {
|
|
@@ -24,45 +20,138 @@ var CryptoPaymentMethodType;
|
|
|
24
20
|
})(CryptoPaymentMethodType || (exports.CryptoPaymentMethodType = CryptoPaymentMethodType = {}));
|
|
25
21
|
function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
|
|
26
22
|
const { wallet: globalWallet } = (0, react_1.useAccountWallet)();
|
|
27
|
-
const
|
|
23
|
+
const { address, isConnected, connector } = (0, wagmi_1.useAccount)();
|
|
24
|
+
const { connect, connectors, isPending } = (0, wagmi_1.useConnect)();
|
|
28
25
|
const { disconnect } = (0, wagmi_1.useDisconnect)();
|
|
29
|
-
const {
|
|
26
|
+
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
30
27
|
const [showWalletModal, setShowWalletModal] = (0, react_2.useState)(false);
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
const [selectedWalletConnector, setSelectedWalletConnector] = (0, react_2.useState)(null);
|
|
29
|
+
const [modalStep, setModalStep] = (0, react_2.useState)("wallet-selection");
|
|
30
|
+
// Define available wallet connectors
|
|
31
|
+
const availableConnectors = connectors.filter(connector => ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow"].includes(connector.name));
|
|
32
|
+
// Define wallet options with icons and info
|
|
33
|
+
const walletOptions = [
|
|
34
|
+
{
|
|
35
|
+
id: "metamask",
|
|
36
|
+
name: "MetaMask",
|
|
37
|
+
icon: "🦊",
|
|
38
|
+
description: "Connect using MetaMask browser extension",
|
|
39
|
+
connector: availableConnectors.find(c => c.name === "MetaMask"),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "coinbase",
|
|
43
|
+
name: "Coinbase Wallet",
|
|
44
|
+
icon: "🔵",
|
|
45
|
+
description: "Connect using Coinbase Wallet",
|
|
46
|
+
connector: availableConnectors.find(c => c.name === "Coinbase Wallet"),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "rainbow",
|
|
50
|
+
name: "Rainbow",
|
|
51
|
+
icon: "🌈",
|
|
52
|
+
description: "Connect using Rainbow wallet",
|
|
53
|
+
connector: availableConnectors.find(c => c.name === "Rainbow"),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "walletconnect",
|
|
57
|
+
name: "WalletConnect",
|
|
58
|
+
icon: "🔗",
|
|
59
|
+
description: "Connect using WalletConnect protocol",
|
|
60
|
+
connector: availableConnectors.find(c => c.name === "WalletConnect"),
|
|
61
|
+
},
|
|
62
|
+
].filter(wallet => wallet.connector); // Only show wallets that have available connectors
|
|
63
|
+
// Reset modal state when closing
|
|
64
|
+
const handleCloseModal = () => {
|
|
65
|
+
setShowWalletModal(false);
|
|
66
|
+
setModalStep("wallet-selection");
|
|
67
|
+
setSelectedWalletConnector(null);
|
|
68
|
+
};
|
|
69
|
+
// Function to request wallet permissions for specific wallet
|
|
70
|
+
const requestWalletPermissions = async (walletConnector) => {
|
|
71
|
+
try {
|
|
72
|
+
// If a specific wallet connector is provided and it's different from current
|
|
73
|
+
if (walletConnector && connector?.name !== walletConnector.name) {
|
|
74
|
+
// Disconnect current and connect to the selected wallet
|
|
75
|
+
// if (isConnected) {
|
|
76
|
+
// disconnect();
|
|
77
|
+
// // Small delay to ensure disconnection
|
|
78
|
+
// await new Promise(resolve => setTimeout(resolve, 100));
|
|
79
|
+
// }
|
|
80
|
+
await connect({ connector: walletConnector });
|
|
81
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
82
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
83
|
+
sonner_1.toast.success(`Connected to ${walletConnector.name}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// If same wallet or no specific wallet, request permissions for account switching
|
|
87
|
+
if (walletClient && "request" in walletClient) {
|
|
88
|
+
await walletClient.request({
|
|
89
|
+
method: "wallet_requestPermissions",
|
|
90
|
+
params: [{ eth_accounts: {} }],
|
|
91
|
+
});
|
|
92
|
+
sonner_1.toast.success("Account selection completed");
|
|
93
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
94
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Fallback: show modal for manual wallet selection
|
|
98
|
+
setShowWalletModal(true);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error("Failed to request wallet permissions:", error);
|
|
103
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
104
|
+
const errorMessage = error.message.toLowerCase();
|
|
105
|
+
if (errorMessage.includes("rejected") ||
|
|
106
|
+
errorMessage.includes("denied") ||
|
|
107
|
+
errorMessage.includes("cancelled")) {
|
|
108
|
+
sonner_1.toast.error("Account selection cancelled");
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
sonner_1.toast.error("Failed to open account selection");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
sonner_1.toast.error("Failed to open account selection");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-method 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: "Select a payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-methods flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
120
|
+
// Always show wallet selection modal first
|
|
121
|
+
setShowWalletModal(true);
|
|
122
|
+
}, className: "crypto-payment-method-connect-wallet 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: "wallet-icon 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.jsx)("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)(lucide_react_1.ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
55
123
|
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
56
124
|
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
57
|
-
}, disabled: isCreatingOrder, className: "crypto-payment-method-transfer 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" })] })
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
125
|
+
}, disabled: isCreatingOrder, className: "crypto-payment-method-transfer 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: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ZapIcon, { className: "h-4 w-4" }) }), (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" })] }), isConnected && ((0, jsx_runtime_1.jsxs)("div", { className: "installed-wallets", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
126
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
127
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
128
|
+
sonner_1.toast.success(`Selected ${connector?.name || "wallet"}`);
|
|
129
|
+
}, className: (0, cn_1.cn)("crypto-payment-method-connect-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
|
|
130
|
+
? "connected-wallet border-as-brand bg-as-brand/5"
|
|
131
|
+
: "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", 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: "Wallet", className: "h-10 w-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-blue-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-blue-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: connector?.name || "Connected Wallet" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(address || "") })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })), (0, jsx_runtime_1.jsx)("button", { onClick: e => {
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
disconnect();
|
|
134
|
+
sonner_1.toast.success("Wallet disconnected");
|
|
135
|
+
if (selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
136
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
137
|
+
}
|
|
138
|
+
}, 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" }) })] })] }) }) })] }))] })] }), showWalletModal &&
|
|
139
|
+
(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.jsxs)("div", { className: "flex items-center gap-2", children: [modalStep === "account-selection" && ((0, jsx_runtime_1.jsx)("button", { onClick: () => setModalStep("wallet-selection"), 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.ChevronLeft, { className: "h-5 w-5" }) })), (0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: modalStep === "wallet-selection"
|
|
140
|
+
? "Select a payment method"
|
|
141
|
+
: `Connect ${selectedWalletConnector?.name}` })] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCloseModal, 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)("div", { className: "space-y-4", children: modalStep === "wallet-selection" ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: isConnected ? "Switch wallet or account" : "Choose wallet to connect" }), walletOptions.map(walletOption => {
|
|
142
|
+
const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
|
|
143
|
+
return ((0, jsx_runtime_1.jsx)("button", { onClick: async () => {
|
|
144
|
+
setSelectedWalletConnector(walletOption.connector);
|
|
145
|
+
setModalStep("account-selection");
|
|
146
|
+
}, disabled: isPending, className: `w-full rounded-xl border p-4 text-left transition-all hover:shadow-md disabled:opacity-50 ${isCurrentWallet
|
|
147
|
+
? "border-blue-500 bg-blue-50 dark:bg-blue-900/20"
|
|
148
|
+
: "border-gray-200 bg-white hover:border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `flex h-12 w-12 items-center justify-center rounded-xl text-xl ${isCurrentWallet ? "bg-blue-100 dark:bg-blue-800" : "bg-gray-100 dark:bg-gray-700"}`, children: walletOption.icon }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-semibold text-gray-900 dark:text-white", children: walletOption.name }), isCurrentWallet && ((0, jsx_runtime_1.jsx)("span", { className: "rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 dark:bg-blue-800 dark:text-blue-200", children: "Connected" }))] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: isCurrentWallet ? "Switch account or reconnect" : walletOption.description })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "h-5 w-5 text-gray-400" })] }) }, walletOption.id));
|
|
149
|
+
})] }) })) : (
|
|
150
|
+
/* Account Selection Step */
|
|
151
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: ["Connect to ", selectedWalletConnector?.name, " to view available accounts"] }), (0, jsx_runtime_1.jsx)("button", { onClick: async () => {
|
|
152
|
+
handleCloseModal();
|
|
153
|
+
await requestWalletPermissions(selectedWalletConnector);
|
|
154
|
+
}, disabled: isPending, className: "w-full rounded-lg border border-gray-200 bg-white p-4 text-center transition-all hover:border-gray-300 hover:shadow-md disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-700", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-gray-600 dark:text-gray-400" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: isPending
|
|
155
|
+
? `Connecting to ${selectedWalletConnector?.name}...`
|
|
156
|
+
: `Connect ${selectedWalletConnector?.name}` }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: isPending ? "Please check your wallet" : "Click to connect and select account" })] })] }) })] })) })] }) }), typeof window !== "undefined" ? document.getElementById("b3-root") || document.body : document.body)] }));
|
|
68
157
|
}
|