@b3dotfun/sdk 0.0.40-alpha.13 → 0.0.40-alpha.14
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/react/components/common/CryptoPaySection.js +7 -7
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +8 -8
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -7
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +8 -8
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +9 -8
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +46 -40
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
|
@@ -9,18 +9,18 @@ const number_1 = require("../../../../shared/utils/number");
|
|
|
9
9
|
const lucide_react_1 = require("lucide-react");
|
|
10
10
|
const react_2 = require("motion/react");
|
|
11
11
|
const react_3 = require("react");
|
|
12
|
-
const wagmi_1 = require("wagmi");
|
|
13
12
|
const CryptoPaymentMethod_1 = require("./CryptoPaymentMethod");
|
|
14
13
|
const OrderTokenAmount_1 = require("./OrderTokenAmount");
|
|
15
14
|
const TokenBalance_1 = require("./TokenBalance");
|
|
16
15
|
function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }) {
|
|
17
|
-
const {
|
|
18
|
-
const { data: profileData } = (0, react_1.useProfile)({ address: connectedAddress });
|
|
19
|
-
const connectedName = profileData?.displayName;
|
|
20
|
-
const { address: globalAddress } = (0, react_1.useAccountWallet)();
|
|
16
|
+
const { connectedSmartWallet, connectedEOAWallet } = (0, react_1.useAccountWallet)();
|
|
21
17
|
const { data: srcTokenMetadata } = (0, react_1.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
22
18
|
// Determine which address to use based on payment method
|
|
23
|
-
const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET
|
|
19
|
+
const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET
|
|
20
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
21
|
+
: connectedEOAWallet?.getAccount()?.address || connectedSmartWallet?.getAccount()?.address;
|
|
22
|
+
const { data: profileData } = (0, react_1.useProfile)({ address: walletAddress });
|
|
23
|
+
const connectedName = profileData?.displayName;
|
|
24
24
|
// Add ref to track if we've applied metadata
|
|
25
25
|
const appliedSrcMetadataRef = (0, react_3.useRef)(false);
|
|
26
26
|
// Update source token with metadata
|
|
@@ -45,7 +45,7 @@ function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedS
|
|
|
45
45
|
(0, react_3.useEffect)(() => {
|
|
46
46
|
appliedSrcMetadataRef.current = false;
|
|
47
47
|
}, [selectedSrcToken.address, selectedSrcToken.chainId]);
|
|
48
|
-
return ((0, jsx_runtime_1.jsxs)(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" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(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" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [walletAddress ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: connectedName ? (0, utils_1.formatUsername)(connectedName) : (0, formatAddress_1.shortenAddress)(walletAddress || "") })) : ("Connect wallet"), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Global Account", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Transfer crypto", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Select payment method", (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) })] }), (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
|
|
49
49
|
setIsSrcInputDirty(true);
|
|
50
50
|
setSrcAmount(value);
|
|
51
51
|
}, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
@@ -170,13 +170,7 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
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-
|
|
174
|
-
// Always show wallet selection modal first
|
|
175
|
-
setShowWalletModal(true);
|
|
176
|
-
}, 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: () => {
|
|
177
|
-
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
178
|
-
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
179
|
-
}, 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" })] }), (shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && ((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.jsxs)("div", { className: "space-y-2", children: [shouldShowConnectedEOA && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
173
|
+
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-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && ((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.jsxs)("div", { className: "space-y-2", children: [shouldShowConnectedEOA && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
180
174
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
181
175
|
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
182
176
|
setActiveWallet(connectedEOAWallet);
|
|
@@ -216,7 +210,13 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
216
210
|
sonner_1.toast.success("Selected B3 Account");
|
|
217
211
|
}, className: (0, cn_1.cn)("crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
218
212
|
? "connected-wallet border-as-brand bg-as-brand/5"
|
|
219
|
-
: "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: "Global Account", 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-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-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: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] }))
|
|
213
|
+
: "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: "Global Account", 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-purple-100", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-5 w-5 text-purple-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: "Global Account" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/60 text-sm", children: (0, formatAddress_1.shortenAddress)(globalAddress || "") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "other-payment-methods", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
214
|
+
// Always show wallet selection modal first
|
|
215
|
+
setShowWalletModal(true);
|
|
216
|
+
}, 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: () => {
|
|
217
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
218
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
219
|
+
}, 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" })] })] })] })] })] }), showWalletModal &&
|
|
220
220
|
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "wallet-connection-modal 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: isConnected ? "Switch wallet or account" : "Choose wallet to connect" }), (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: (0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: walletOptions.map(walletOption => {
|
|
221
221
|
const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
|
|
222
222
|
return ((0, jsx_runtime_1.jsx)("button", { onClick: async () => {
|
|
@@ -6,8 +6,8 @@ async function fetchSimBalance(address) {
|
|
|
6
6
|
if (!address)
|
|
7
7
|
throw new Error("Address is required");
|
|
8
8
|
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
|
|
9
|
-
if (process.env.
|
|
10
|
-
url += `&localkey=${process.env.
|
|
9
|
+
if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
|
|
10
|
+
url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
|
|
11
11
|
}
|
|
12
12
|
const response = await fetch(url);
|
|
13
13
|
if (!response.ok) {
|
|
@@ -6,18 +6,18 @@ import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
|
6
6
|
import { ChevronRight } from "lucide-react";
|
|
7
7
|
import { motion } from "motion/react";
|
|
8
8
|
import { useEffect, useRef } from "react";
|
|
9
|
-
import { useAccount } from "wagmi";
|
|
10
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
11
10
|
import { OrderTokenAmount } from "./OrderTokenAmount.js";
|
|
12
11
|
import { TokenBalance } from "./TokenBalance.js";
|
|
13
12
|
export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }) {
|
|
14
|
-
const {
|
|
15
|
-
const { data: profileData } = useProfile({ address: connectedAddress });
|
|
16
|
-
const connectedName = profileData?.displayName;
|
|
17
|
-
const { address: globalAddress } = useAccountWallet();
|
|
13
|
+
const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
|
|
18
14
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
19
15
|
// Determine which address to use based on payment method
|
|
20
|
-
const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
16
|
+
const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
17
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
18
|
+
: connectedEOAWallet?.getAccount()?.address || connectedSmartWallet?.getAccount()?.address;
|
|
19
|
+
const { data: profileData } = useProfile({ address: walletAddress });
|
|
20
|
+
const connectedName = profileData?.displayName;
|
|
21
21
|
// Add ref to track if we've applied metadata
|
|
22
22
|
const appliedSrcMetadataRef = useRef(false);
|
|
23
23
|
// Update source token with metadata
|
|
@@ -42,7 +42,7 @@ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, se
|
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
appliedSrcMetadataRef.current = false;
|
|
44
44
|
}, [selectedSrcToken.address, selectedSrcToken.chainId]);
|
|
45
|
-
return (_jsxs(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" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [
|
|
45
|
+
return (_jsxs(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" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [walletAddress ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
|
|
46
46
|
setIsSrcInputDirty(true);
|
|
47
47
|
setSrcAmount(value);
|
|
48
48
|
}, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
@@ -166,13 +166,7 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_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: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-
|
|
170
|
-
// Always show wallet selection modal first
|
|
171
|
-
setShowWalletModal(true);
|
|
172
|
-
}, 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: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: _jsx(Wallet, { className: "h-4 w-4 text-blue-600" }) }), _jsx("div", { className: "flex flex-col items-start text-left", children: _jsx("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), _jsx(ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), _jsxs("button", { onClick: () => {
|
|
173
|
-
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
174
|
-
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
175
|
-
}, 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: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100", children: _jsx(ZapIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "flex flex-col items-start text-left", children: _jsx("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) })] }), _jsx(ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), (shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
|
|
169
|
+
return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_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: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
|
|
176
170
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
177
171
|
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
178
172
|
setActiveWallet(connectedEOAWallet);
|
|
@@ -212,7 +206,13 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
212
206
|
toast.success("Selected B3 Account");
|
|
213
207
|
}, className: cn("crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
214
208
|
? "connected-wallet border-as-brand bg-as-brand/5"
|
|
215
|
-
: "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? (_jsx("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : (_jsx("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: _jsx(Wallet, { className: "h-5 w-5 text-purple-600" }) })), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Global Account" }), _jsx("span", { className: "text-as-primary/60 text-sm", children: shortenAddress(globalAddress || "") })] })] }), _jsx("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && (_jsx("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] }))
|
|
209
|
+
: "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80"), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-3", children: [globalWallet?.meta?.icon ? (_jsx("img", { src: globalWallet.meta.icon, alt: "Global Account", className: "h-10 w-10 rounded-full" })) : (_jsx("div", { className: "wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100", children: _jsx(Wallet, { className: "h-5 w-5 text-purple-600" }) })), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "text-as-primary font-semibold", children: "Global Account" }), _jsx("span", { className: "text-as-primary/60 text-sm", children: shortenAddress(globalAddress || "") })] })] }), _jsx("div", { className: "flex items-center gap-2", children: selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && (_jsx("div", { className: "h-2 w-2 rounded-full bg-green-500" })) })] }) }))] })] })), _jsxs("div", { className: "other-payment-methods", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Payment methods" }), _jsxs("div", { className: "space-y-3", children: [_jsxs("button", { onClick: () => {
|
|
210
|
+
// Always show wallet selection modal first
|
|
211
|
+
setShowWalletModal(true);
|
|
212
|
+
}, 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: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100", children: _jsx(Wallet, { className: "h-4 w-4 text-blue-600" }) }), _jsx("div", { className: "flex flex-col items-start text-left", children: _jsx("h4", { className: "text-as-primary font-semibold", children: "Connect wallet" }) })] }), _jsx(ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] }), _jsxs("button", { onClick: () => {
|
|
213
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
214
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
215
|
+
}, 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: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100", children: _jsx(ZapIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "flex flex-col items-start text-left", children: _jsx("h4", { className: "text-as-primary font-semibold", children: "Transfer crypto" }) })] }), _jsx(ChevronRightCircle, { className: "text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" })] })] })] })] })] }), showWalletModal &&
|
|
216
216
|
createPortal(_jsx("div", { className: "wallet-connection-modal pointer-events-auto fixed inset-0 z-[9999] flex items-center justify-center bg-black/50", children: _jsxs("div", { className: "max-h-[80vh] w-[400px] max-w-[90vw] overflow-auto rounded-xl bg-white p-6 dark:bg-gray-900", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: isConnected ? "Switch wallet or account" : "Choose wallet to connect" }), _jsx("button", { onClick: handleCloseModal, className: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: _jsx(X, { className: "h-5 w-5" }) })] }), _jsx("div", { className: "space-y-4", children: _jsx("div", { className: "space-y-3", children: walletOptions.map(walletOption => {
|
|
217
217
|
const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
|
|
218
218
|
return (_jsx("button", { onClick: async () => {
|
|
@@ -3,8 +3,8 @@ async function fetchSimBalance(address) {
|
|
|
3
3
|
if (!address)
|
|
4
4
|
throw new Error("Address is required");
|
|
5
5
|
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
|
|
6
|
-
if (process.env.
|
|
7
|
-
url += `&localkey=${process.env.
|
|
6
|
+
if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
|
|
7
|
+
url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
|
|
8
8
|
}
|
|
9
9
|
const response = await fetch(url);
|
|
10
10
|
if (!response.ok) {
|
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
|
5
5
|
import { ChevronRight } from "lucide-react";
|
|
6
6
|
import { motion } from "motion/react";
|
|
7
7
|
import { useEffect, useRef } from "react";
|
|
8
|
-
import { useAccount } from "wagmi";
|
|
9
8
|
import { components } from "../../../types/api";
|
|
10
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
11
10
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
@@ -39,15 +38,17 @@ export function CryptoPaySection({
|
|
|
39
38
|
onSelectCryptoPaymentMethod,
|
|
40
39
|
anyspendQuote,
|
|
41
40
|
}: CryptoPaySectionProps) {
|
|
42
|
-
const {
|
|
43
|
-
const { data: profileData } = useProfile({ address: connectedAddress });
|
|
44
|
-
const connectedName = profileData?.displayName;
|
|
45
|
-
const { address: globalAddress } = useAccountWallet();
|
|
41
|
+
const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
|
|
46
42
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
47
43
|
|
|
48
44
|
// Determine which address to use based on payment method
|
|
49
45
|
const walletAddress =
|
|
50
|
-
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
46
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
47
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
48
|
+
: connectedEOAWallet?.getAccount()?.address || connectedSmartWallet?.getAccount()?.address;
|
|
49
|
+
|
|
50
|
+
const { data: profileData } = useProfile({ address: walletAddress });
|
|
51
|
+
const connectedName = profileData?.displayName;
|
|
51
52
|
|
|
52
53
|
// Add ref to track if we've applied metadata
|
|
53
54
|
const appliedSrcMetadataRef = useRef(false);
|
|
@@ -92,9 +93,9 @@ export function CryptoPaySection({
|
|
|
92
93
|
>
|
|
93
94
|
{selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
|
|
94
95
|
<>
|
|
95
|
-
{
|
|
96
|
+
{walletAddress ? (
|
|
96
97
|
<div className="flex items-center gap-1">
|
|
97
|
-
{connectedName ? formatUsername(connectedName) : shortenAddress(
|
|
98
|
+
{connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "")}
|
|
98
99
|
</div>
|
|
99
100
|
) : (
|
|
100
101
|
"Connect wallet"
|
|
@@ -220,46 +220,7 @@ export function CryptoPaymentMethod({
|
|
|
220
220
|
</div>
|
|
221
221
|
|
|
222
222
|
{/* Payment Methods */}
|
|
223
|
-
<div className="crypto-payment-methods flex flex-col gap-
|
|
224
|
-
{/* Connect Wallet Section */}
|
|
225
|
-
<button
|
|
226
|
-
onClick={() => {
|
|
227
|
-
// Always show wallet selection modal first
|
|
228
|
-
setShowWalletModal(true);
|
|
229
|
-
}}
|
|
230
|
-
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"
|
|
231
|
-
>
|
|
232
|
-
<div className="flex items-center gap-3">
|
|
233
|
-
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100">
|
|
234
|
-
<Wallet className="h-4 w-4 text-blue-600" />
|
|
235
|
-
</div>
|
|
236
|
-
<div className="flex flex-col items-start text-left">
|
|
237
|
-
<h4 className="text-as-primary font-semibold">Connect wallet</h4>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
<ChevronRightCircle className="text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" />
|
|
241
|
-
</button>
|
|
242
|
-
|
|
243
|
-
{/* Transfer Crypto Section */}
|
|
244
|
-
<button
|
|
245
|
-
onClick={() => {
|
|
246
|
-
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
247
|
-
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
248
|
-
}}
|
|
249
|
-
disabled={isCreatingOrder}
|
|
250
|
-
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"
|
|
251
|
-
>
|
|
252
|
-
<div className="flex items-center gap-3">
|
|
253
|
-
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100">
|
|
254
|
-
<ZapIcon className="h-4 w-4" />
|
|
255
|
-
</div>
|
|
256
|
-
<div className="flex flex-col items-start text-left">
|
|
257
|
-
<h4 className="text-as-primary font-semibold">Transfer crypto</h4>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
<ChevronRightCircle className="text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" />
|
|
261
|
-
</button>
|
|
262
|
-
|
|
223
|
+
<div className="crypto-payment-methods flex flex-col gap-4">
|
|
263
224
|
{/* Installed Wallets Section */}
|
|
264
225
|
{(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (
|
|
265
226
|
<div className="installed-wallets">
|
|
@@ -413,6 +374,51 @@ export function CryptoPaymentMethod({
|
|
|
413
374
|
</div>
|
|
414
375
|
</div>
|
|
415
376
|
)}
|
|
377
|
+
|
|
378
|
+
{/* Other Payment Methods Section */}
|
|
379
|
+
<div className="other-payment-methods">
|
|
380
|
+
<h3 className="text-as-primary/80 mb-3 text-sm font-medium">Payment methods</h3>
|
|
381
|
+
<div className="space-y-3">
|
|
382
|
+
{/* Connect Wallet Section */}
|
|
383
|
+
<button
|
|
384
|
+
onClick={() => {
|
|
385
|
+
// Always show wallet selection modal first
|
|
386
|
+
setShowWalletModal(true);
|
|
387
|
+
}}
|
|
388
|
+
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"
|
|
389
|
+
>
|
|
390
|
+
<div className="flex items-center gap-3">
|
|
391
|
+
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100">
|
|
392
|
+
<Wallet className="h-4 w-4 text-blue-600" />
|
|
393
|
+
</div>
|
|
394
|
+
<div className="flex flex-col items-start text-left">
|
|
395
|
+
<h4 className="text-as-primary font-semibold">Connect wallet</h4>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
<ChevronRightCircle className="text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" />
|
|
399
|
+
</button>
|
|
400
|
+
|
|
401
|
+
{/* Transfer Crypto Section */}
|
|
402
|
+
<button
|
|
403
|
+
onClick={() => {
|
|
404
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
405
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
406
|
+
}}
|
|
407
|
+
disabled={isCreatingOrder}
|
|
408
|
+
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"
|
|
409
|
+
>
|
|
410
|
+
<div className="flex items-center gap-3">
|
|
411
|
+
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-orange-100">
|
|
412
|
+
<ZapIcon className="h-4 w-4" />
|
|
413
|
+
</div>
|
|
414
|
+
<div className="flex flex-col items-start text-left">
|
|
415
|
+
<h4 className="text-as-primary font-semibold">Transfer crypto</h4>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
<ChevronRightCircle className="text-as-primary/40 group-hover:text-as-primary/60 h-5 w-5 transition-colors" />
|
|
419
|
+
</button>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
416
422
|
</div>
|
|
417
423
|
</div>
|
|
418
424
|
|
|
@@ -30,8 +30,8 @@ async function fetchSimBalance(address: string): Promise<SimBalanceResponse> {
|
|
|
30
30
|
if (!address) throw new Error("Address is required");
|
|
31
31
|
|
|
32
32
|
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
|
|
33
|
-
if (process.env.
|
|
34
|
-
url += `&localkey=${process.env.
|
|
33
|
+
if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
|
|
34
|
+
url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const response = await fetch(url);
|