@b3dotfun/sdk 0.0.7-alpha.9 → 0.0.7
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.js +2 -5
- package/dist/cjs/anyspend/index.d.ts +0 -1
- package/dist/cjs/anyspend/index.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +33 -33
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +43 -80
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +3 -5
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +3 -4
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -3
- package/dist/cjs/anyspend/services/anyspend.js +1 -1
- package/dist/cjs/anyspend/types/index.d.ts +0 -1
- package/dist/cjs/anyspend/types/index.js +0 -1
- package/dist/cjs/anyspend/types/nft.d.ts +0 -7
- package/dist/cjs/anyspend/types/nft.js +0 -2
- package/dist/cjs/anyspend/types/order.d.ts +0 -10
- package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/cjs/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/cjs/anyspend/types/req-res/getQuote.js +1 -4
- package/dist/cjs/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/cjs/anyspend/utils/orderPayload.js +4 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +16 -11
- package/dist/cjs/global-account/react/components/StyleRoot.js +1 -0
- package/dist/cjs/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/cjs/global-account/react/hooks/useB3EnsName.js +22 -22
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/cjs/shared/constants/chains/supported.js +0 -3
- package/dist/cjs/shared/constants/index.d.ts +0 -1
- package/dist/cjs/shared/constants/index.js +1 -2
- package/dist/cjs/shared/utils/index.d.ts +0 -9
- package/dist/cjs/shared/utils/index.js +0 -17
- package/dist/esm/anyspend/constants/index.js +2 -5
- package/dist/esm/anyspend/index.d.ts +0 -1
- package/dist/esm/anyspend/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +5 -5
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +20 -57
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +3 -5
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +4 -5
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -3
- package/dist/esm/anyspend/services/anyspend.js +1 -1
- package/dist/esm/anyspend/types/index.d.ts +0 -1
- package/dist/esm/anyspend/types/index.js +0 -1
- package/dist/esm/anyspend/types/nft.d.ts +0 -7
- package/dist/esm/anyspend/types/nft.js +0 -2
- package/dist/esm/anyspend/types/order.d.ts +0 -10
- package/dist/esm/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/esm/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/esm/anyspend/types/req-res/getQuote.js +1 -4
- package/dist/esm/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/esm/anyspend/utils/orderPayload.js +5 -19
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +12 -7
- package/dist/esm/global-account/react/components/StyleRoot.js +1 -0
- package/dist/esm/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/esm/global-account/react/hooks/useB3EnsName.js +21 -24
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/shared/constants/chains/supported.js +0 -3
- package/dist/esm/shared/constants/index.d.ts +0 -1
- package/dist/esm/shared/constants/index.js +0 -1
- package/dist/esm/shared/utils/index.d.ts +0 -9
- package/dist/esm/shared/utils/index.js +0 -15
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -2
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +0 -4
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +0 -4
- package/dist/types/anyspend/services/anyspend.d.ts +1 -3
- package/dist/types/anyspend/types/index.d.ts +0 -1
- package/dist/types/anyspend/types/nft.d.ts +0 -7
- package/dist/types/anyspend/types/order.d.ts +0 -10
- package/dist/types/anyspend/types/req-res/createOrder.d.ts +0 -28
- package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -18
- package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +0 -14
- package/dist/types/anyspend/types/req-res/getQuote.d.ts +0 -11
- package/dist/types/anyspend/utils/orderPayload.d.ts +3 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useB3EnsName.d.ts +4 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/shared/constants/index.d.ts +0 -1
- package/dist/types/shared/utils/index.d.ts +0 -9
- package/package.json +3 -22
- package/src/anyspend/constants/index.ts +3 -5
- package/src/anyspend/index.ts +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +7 -8
- package/src/anyspend/react/components/AnySpendCustom.tsx +24 -73
- package/src/anyspend/react/components/AnySpendNFT.tsx +4 -9
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +6 -7
- package/src/anyspend/react/components/AnySpendTournament.tsx +1 -4
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -6
- package/src/anyspend/services/anyspend.ts +2 -2
- package/src/anyspend/types/index.ts +0 -1
- package/src/anyspend/types/nft.ts +0 -3
- package/src/anyspend/types/req-res/getQuote.ts +1 -4
- package/src/anyspend/utils/orderPayload.ts +5 -17
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +27 -15
- package/src/global-account/react/components/StyleRoot.tsx +1 -0
- package/src/global-account/react/hooks/useB3EnsName.ts +32 -26
- package/src/global-account/react/stores/useModalStore.ts +0 -2
- package/src/shared/constants/chains/supported.ts +0 -5
- package/src/shared/constants/index.ts +0 -2
- package/src/shared/utils/index.ts +0 -16
- package/dist/cjs/anyspend/types/metadata.d.ts +0 -26
- package/dist/cjs/anyspend/types/metadata.js +0 -16
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +0 -50
- package/dist/cjs/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/cjs/global-account/react/components/custom/Icon.js +0 -52
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +0 -20
- package/dist/cjs/index.d.ts +0 -0
- package/dist/cjs/index.js +0 -2
- package/dist/esm/anyspend/types/metadata.d.ts +0 -26
- package/dist/esm/anyspend/types/metadata.js +0 -11
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +0 -44
- package/dist/esm/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/esm/global-account/react/components/custom/Icon.js +0 -50
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +0 -17
- package/dist/esm/index.d.ts +0 -0
- package/dist/esm/index.js +0 -2
- package/dist/types/anyspend/types/metadata.d.ts +0 -26
- package/dist/types/global-account/react/components/SignInWithB3/SignIn.d.ts +0 -14
- package/dist/types/global-account/react/components/custom/Icon.d.ts +0 -7
- package/dist/types/global-account/react/components/custom/ManageAccountButton.d.ts +0 -4
- package/dist/types/index.d.ts +0 -0
- package/src/anyspend/types/metadata.ts +0 -41
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +0 -190
- package/src/global-account/react/components/custom/Icon.tsx +0 -102
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +0 -33
- package/src/index.ts +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = 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_TESTNET_BASE_URL = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
|
-
const types_1 = require("../../anyspend/types");
|
|
5
4
|
const chains_1 = require("viem/chains");
|
|
6
5
|
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
7
6
|
exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
@@ -40,8 +39,7 @@ exports.NFT_CONTRACTS = [
|
|
|
40
39
|
imageUrl: "https://storage.googleapis.com/nftimagebucket/base/tokens/0x80f0e6644723abb03aa8867d21e32bd854b2a2d9/preview/TVRjME1EUTRORFl4T0E9PV8zNjcy.jpg",
|
|
41
40
|
name: "Downhill Ski",
|
|
42
41
|
description: "Downhill Ski",
|
|
43
|
-
tokenId: null
|
|
44
|
-
type: types_1.NftType.ERC721
|
|
42
|
+
tokenId: null
|
|
45
43
|
},
|
|
46
44
|
{
|
|
47
45
|
chainId: chains_1.base.id,
|
|
@@ -52,8 +50,7 @@ exports.NFT_CONTRACTS = [
|
|
|
52
50
|
imageUrl: "https://cdn.b3.fun/game-weapon-demo.png",
|
|
53
51
|
name: "Eclipse Venom",
|
|
54
52
|
description: "The Eclipse Venom's crystalline blade channels imprisoned astral toxins through swirling currents of violet and teal light, synchronizing with its wielder's heartbeat for strikes that bypass conventional armor. Wounds from this otherworldly weapon resist healing as victims describe being consumed from within by liquid darkness, their final moments filled with visions of infinite cosmic depths.",
|
|
55
|
-
tokenId: null
|
|
56
|
-
type: types_1.NftType.ERC721
|
|
53
|
+
tokenId: null
|
|
57
54
|
}
|
|
58
55
|
];
|
|
59
56
|
exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS[1];
|
|
@@ -20,7 +20,6 @@ __exportStar(require("./react/hooks"), exports);
|
|
|
20
20
|
__exportStar(require("./react/providers/AnyspendProvider"), exports);
|
|
21
21
|
// Types
|
|
22
22
|
__exportStar(require("./types"), exports);
|
|
23
|
-
__exportStar(require("./types/metadata"), exports);
|
|
24
23
|
// Utils
|
|
25
24
|
__exportStar(require("./utils/address"), exports);
|
|
26
25
|
__exportStar(require("./utils/chain"), exports);
|
|
@@ -6,19 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AnySpendBuySpin = AnySpendBuySpin;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const anyspend_1 = require("../../../anyspend");
|
|
9
|
-
const react_1 = require("../../../global-account/react");
|
|
10
9
|
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
10
|
+
const EthIcon_1 = require("./icons/EthIcon");
|
|
11
|
+
const SolIcon_1 = require("./icons/SolIcon");
|
|
12
|
+
const USDCIcon_1 = require("./icons/USDCIcon");
|
|
13
|
+
const react_1 = require("../../../global-account/react");
|
|
14
|
+
const react_2 = require("../../../global-account/react");
|
|
11
15
|
const framer_motion_1 = require("framer-motion");
|
|
12
16
|
const invariant_1 = __importDefault(require("invariant"));
|
|
13
17
|
const lucide_react_1 = require("lucide-react");
|
|
14
|
-
const
|
|
18
|
+
const react_3 = require("react");
|
|
15
19
|
const sonner_1 = require("sonner");
|
|
16
20
|
const viem_1 = require("viem");
|
|
17
21
|
const wagmi_1 = require("wagmi");
|
|
18
22
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
19
|
-
const EthIcon_1 = require("./icons/EthIcon");
|
|
20
|
-
const SolIcon_1 = require("./icons/SolIcon");
|
|
21
|
-
const USDCIcon_1 = require("./icons/USDCIcon");
|
|
22
23
|
const SPIN_WHEEL_ABI = [
|
|
23
24
|
{
|
|
24
25
|
inputs: [],
|
|
@@ -94,24 +95,24 @@ const basePublicClient = (0, viem_1.createPublicClient)({
|
|
|
94
95
|
transport: (0, viem_1.http)()
|
|
95
96
|
});
|
|
96
97
|
function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess }) {
|
|
97
|
-
const hasMounted = (0,
|
|
98
|
-
const { setB3ModalOpen } = (0,
|
|
98
|
+
const hasMounted = (0, react_2.useHasMounted)();
|
|
99
|
+
const { setB3ModalOpen } = (0, react_2.useModalStore)();
|
|
99
100
|
// Payment config state
|
|
100
|
-
const [paymentConfig, setPaymentConfig] = (0,
|
|
101
|
-
const [isLoadingConfig, setIsLoadingConfig] = (0,
|
|
102
|
-
const [configError, setConfigError] = (0,
|
|
103
|
-
const [wheelInfo, setWheelInfo] = (0,
|
|
101
|
+
const [paymentConfig, setPaymentConfig] = (0, react_3.useState)(null);
|
|
102
|
+
const [isLoadingConfig, setIsLoadingConfig] = (0, react_3.useState)(true);
|
|
103
|
+
const [configError, setConfigError] = (0, react_3.useState)("");
|
|
104
|
+
const [wheelInfo, setWheelInfo] = (0, react_3.useState)(null);
|
|
104
105
|
// Fetch B3 token balance
|
|
105
|
-
const { formattedBalance: b3Balance, isLoading: isBalanceLoading, rawBalance: b3RawBalance } = (0,
|
|
106
|
+
const { formattedBalance: b3Balance, isLoading: isBalanceLoading, rawBalance: b3RawBalance } = (0, react_2.useTokenBalance)({
|
|
106
107
|
token: anyspend_1.B3_TOKEN
|
|
107
108
|
});
|
|
108
109
|
// Wagmi hooks
|
|
109
110
|
const { address } = (0, wagmi_1.useAccount)();
|
|
110
111
|
const { writeContractAsync } = (0, wagmi_1.useWriteContract)();
|
|
111
|
-
const { switchChainAndExecute } = (0,
|
|
112
|
+
const { switchChainAndExecute } = (0, react_2.useChainSwitchWithAction)();
|
|
112
113
|
// State for direct buying flow (when user has B3 tokens)
|
|
113
|
-
const [isBuying, setIsBuying] = (0,
|
|
114
|
-
const [buyingTxHash, setBuyingTxHash] = (0,
|
|
114
|
+
const [isBuying, setIsBuying] = (0, react_3.useState)(false);
|
|
115
|
+
const [buyingTxHash, setBuyingTxHash] = (0, react_3.useState)("");
|
|
115
116
|
const { isLoading: isTxPending, isSuccess: isTxSuccess, isError: isTxError, error: txError } = (0, wagmi_1.useWaitForTransactionReceipt)({
|
|
116
117
|
hash: buyingTxHash,
|
|
117
118
|
query: {
|
|
@@ -119,7 +120,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
// Handle transaction status
|
|
122
|
-
(0,
|
|
123
|
+
(0, react_3.useEffect)(() => {
|
|
123
124
|
if (!buyingTxHash)
|
|
124
125
|
return;
|
|
125
126
|
if (isTxSuccess) {
|
|
@@ -136,14 +137,14 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
136
137
|
}
|
|
137
138
|
}, [isTxSuccess, isTxError, buyingTxHash, onSuccess, setB3ModalOpen, txError]);
|
|
138
139
|
// Spin quantity state
|
|
139
|
-
const [userSpinQuantity, setUserSpinQuantity] = (0,
|
|
140
|
-
const [showAmountPrompt, setShowAmountPrompt] = (0,
|
|
141
|
-
const [isQuantityValid, setIsQuantityValid] = (0,
|
|
142
|
-
const [validationError, setValidationError] = (0,
|
|
143
|
-
const [displayQuantity, setDisplayQuantity] = (0,
|
|
144
|
-
const [debouncedQuantity, setDebouncedQuantity] = (0,
|
|
145
|
-
const [debouncedUserSpinQuantity, setDebouncedUserSpinQuantity] = (0,
|
|
146
|
-
(0,
|
|
140
|
+
const [userSpinQuantity, setUserSpinQuantity] = (0, react_3.useState)("");
|
|
141
|
+
const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(true);
|
|
142
|
+
const [isQuantityValid, setIsQuantityValid] = (0, react_3.useState)(false);
|
|
143
|
+
const [validationError, setValidationError] = (0, react_3.useState)("");
|
|
144
|
+
const [displayQuantity, setDisplayQuantity] = (0, react_3.useState)("");
|
|
145
|
+
const [debouncedQuantity, setDebouncedQuantity] = (0, react_3.useState)("");
|
|
146
|
+
const [debouncedUserSpinQuantity, setDebouncedUserSpinQuantity] = (0, react_3.useState)("");
|
|
147
|
+
(0, react_3.useEffect)(() => {
|
|
147
148
|
if (prefillQuantity && wheelInfo) {
|
|
148
149
|
const remainingSpins = wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_;
|
|
149
150
|
const adjustedQuantity = BigInt(prefillQuantity) > remainingSpins ? remainingSpins.toString() : prefillQuantity;
|
|
@@ -153,7 +154,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
153
154
|
// Calculate total cost
|
|
154
155
|
const totalCost = paymentConfig && userSpinQuantity ? paymentConfig.pricePerEntry * BigInt(userSpinQuantity) : BigInt(0);
|
|
155
156
|
// Fetch payment configuration and wheel info
|
|
156
|
-
const fetchPaymentConfig = (0,
|
|
157
|
+
const fetchPaymentConfig = (0, react_3.useCallback)(async () => {
|
|
157
158
|
if (!basePublicClient || !spinwheelContractAddress)
|
|
158
159
|
return;
|
|
159
160
|
try {
|
|
@@ -204,11 +205,11 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
204
205
|
}
|
|
205
206
|
}, [spinwheelContractAddress, chainId]);
|
|
206
207
|
// Fetch config on mount and when dependencies change
|
|
207
|
-
(0,
|
|
208
|
+
(0, react_3.useEffect)(() => {
|
|
208
209
|
fetchPaymentConfig();
|
|
209
210
|
}, [fetchPaymentConfig]);
|
|
210
211
|
// Debounce the quantity for balance checks
|
|
211
|
-
(0,
|
|
212
|
+
(0, react_3.useEffect)(() => {
|
|
212
213
|
const timer = setTimeout(() => {
|
|
213
214
|
setDebouncedQuantity(displayQuantity);
|
|
214
215
|
setDebouncedUserSpinQuantity(userSpinQuantity);
|
|
@@ -321,7 +322,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
321
322
|
setShowAmountPrompt(false);
|
|
322
323
|
}
|
|
323
324
|
};
|
|
324
|
-
const header = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto size-32", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), (0, jsx_runtime_1.jsxs)(
|
|
325
|
+
const header = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto size-32", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), (0, jsx_runtime_1.jsxs)(react_2.GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-blue-500/10 to-purple-600/10 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", className: "size-full", src: "https://cdn.b3.fun/b3-coin-3d.png" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Buy ", userSpinQuantity || "", " Spin", userSpinQuantity !== "1" ? "s" : ""] }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm", children: "Pay with B3 \u2022 Get spin wheel entries" })] })] })] }));
|
|
325
326
|
const onFocusQuantityInput = () => {
|
|
326
327
|
window.scrollTo(0, 0);
|
|
327
328
|
document.body.scrollTop = 0;
|
|
@@ -332,7 +333,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
332
333
|
}
|
|
333
334
|
// Error state
|
|
334
335
|
if (configError || !paymentConfig) {
|
|
335
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center justify-center p-8", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-red mb-4 text-center", children: configError || "Failed to load configuration" }), (0, jsx_runtime_1.jsx)(
|
|
336
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center justify-center p-8", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-red mb-4 text-center", children: configError || "Failed to load configuration" }), (0, jsx_runtime_1.jsx)(react_2.Button, { onClick: fetchPaymentConfig, variant: "outline", children: "Retry" })] }) }));
|
|
336
337
|
}
|
|
337
338
|
// Render quantity input prompt
|
|
338
339
|
if (showAmountPrompt) {
|
|
@@ -383,17 +384,16 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
383
384
|
opacity: hasMounted ? 1 : 0,
|
|
384
385
|
y: hasMounted ? 0 : 20,
|
|
385
386
|
filter: hasMounted ? "blur(0px)" : "blur(10px)"
|
|
386
|
-
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: isActive ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "Number of spins" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary/50 flex items-center gap-1 text-sm", children: ["Available: ", isBalanceLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-3 w-3 animate-spin" }) : `${b3Balance} B3`] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(
|
|
387
|
+
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: isActive ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "Number of spins" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary/50 flex items-center gap-1 text-sm", children: ["Available: ", isBalanceLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-3 w-3 animate-spin" }) : `${b3Balance} B3`] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(react_2.Input, { onFocus: onFocusQuantityInput, type: "text", placeholder: "1", value: displayQuantity, onChange: e => validateAndSetQuantity(e.target.value), className: `h-14 px-4 pr-20 text-lg ${!isQuantityValid && displayQuantity ? "border-as-red" : "border-b3-react-border"}` }), (0, jsx_runtime_1.jsx)("div", { className: "font-pack absolute right-4 top-1/2 -translate-y-1/2 text-lg font-medium text-blue-500/70", children: displayQuantity === "1" ? "Spin" : "Spins" })] }), !isQuantityValid && displayQuantity && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsx)("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: [displayQuantity && isQuantityValid ? (0, viem_1.formatUnits)(totalCost, 18) : "0", " B3"] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4", children: (() => {
|
|
387
388
|
const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
|
|
388
389
|
if (!hasEnoughBalance && debouncedQuantity) {
|
|
389
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 flex flex-col items-center gap-2 rounded-lg p-4 pb-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: "Swap & buy from any token" }), (0, jsx_runtime_1.jsxs)(
|
|
390
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 flex flex-col items-center gap-2 rounded-lg p-4 pb-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: "Swap & buy from any token" }), (0, jsx_runtime_1.jsxs)(react_2.TextLoop, { children: [(0, jsx_runtime_1.jsx)(EthIcon_1.EthIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(SolIcon_1.SolIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(USDCIcon_1.UsdcIcon, { className: "h-8 w-8" })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: "text-as-primary h-4 w-4" }), (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3-coin-3d.png", className: "h-7 w-7", alt: "B3 Token" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/50 text-sm font-medium", children: "No problem, we'll help you swap to B3 for your spins!" })] }));
|
|
390
391
|
}
|
|
391
|
-
})() }), (0, jsx_runtime_1.jsx)(
|
|
392
|
+
})() }), (0, jsx_runtime_1.jsx)(react_2.Button, { onClick: confirmQuantity, disabled: !isQuantityValid || !displayQuantity || isBuying || isTxPending, 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: isBuying ? "Buying..." : isTxPending ? "Confirming..." : "Continue" })] })) : null })] }) }));
|
|
392
393
|
}
|
|
393
394
|
// AnySpend flow for when user needs to swap to B3
|
|
394
395
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
395
396
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: anyspend_1.OrderType.Custom, dstChainId: chainId, dstToken: anyspend_1.B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
396
|
-
type: anyspend_1.OrderType.Custom,
|
|
397
397
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`
|
|
398
398
|
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
399
399
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetQuoteResponse, OrderType, Token } from "../../../anyspend";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient }: {
|
|
4
4
|
isMainnet?: boolean;
|
|
@@ -12,7 +12,7 @@ export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAd
|
|
|
12
12
|
dstAmount: string;
|
|
13
13
|
contractAddress: string;
|
|
14
14
|
encodedData: string;
|
|
15
|
-
metadata:
|
|
15
|
+
metadata: any;
|
|
16
16
|
header: ({ anyspendPrice, isLoadingAnyspendPrice }: {
|
|
17
17
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
18
18
|
isLoadingAnyspendPrice: boolean;
|
|
@@ -7,6 +7,9 @@ exports.AnySpendCustom = AnySpendCustom;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const anyspend_1 = require("../../../anyspend");
|
|
9
9
|
const react_1 = require("../../../global-account/react");
|
|
10
|
+
const react_2 = require("../../../global-account/react");
|
|
11
|
+
const react_3 = require("../../../global-account/react");
|
|
12
|
+
const react_4 = require("../../../global-account/react");
|
|
10
13
|
const utils_1 = require("../../../shared/utils");
|
|
11
14
|
const centerTruncate_1 = __importDefault(require("../../../shared/utils/centerTruncate"));
|
|
12
15
|
const number_1 = require("../../../shared/utils/number");
|
|
@@ -14,7 +17,7 @@ const simplehash_1 = require("../../../shared/utils/simplehash");
|
|
|
14
17
|
const framer_motion_1 = require("framer-motion");
|
|
15
18
|
const invariant_1 = __importDefault(require("invariant"));
|
|
16
19
|
const lucide_react_1 = require("lucide-react");
|
|
17
|
-
const
|
|
20
|
+
const react_5 = require("react");
|
|
18
21
|
const sonner_1 = require("sonner");
|
|
19
22
|
const chains_1 = require("viem/chains");
|
|
20
23
|
const OrderDetails_1 = require("./common/OrderDetails");
|
|
@@ -29,7 +32,7 @@ var PanelView;
|
|
|
29
32
|
PanelView[PanelView["ORDER_DETAILS"] = 2] = "ORDER_DETAILS";
|
|
30
33
|
PanelView[PanelView["LOADING"] = 3] = "LOADING";
|
|
31
34
|
})(PanelView || (PanelView = {}));
|
|
32
|
-
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress,
|
|
35
|
+
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress, encodedData, spenderAddress }) {
|
|
33
36
|
switch (orderType) {
|
|
34
37
|
case anyspend_1.OrderType.MintNFT: {
|
|
35
38
|
return {
|
|
@@ -39,9 +42,7 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
39
42
|
dstChain: dstChainId,
|
|
40
43
|
dstTokenAddress: dstToken.address,
|
|
41
44
|
price: dstAmount,
|
|
42
|
-
contractAddress: contractAddress
|
|
43
|
-
tokenId: tokenId,
|
|
44
|
-
contractType: contractType
|
|
45
|
+
contractAddress: contractAddress
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
case anyspend_1.OrderType.JoinTournament: {
|
|
@@ -87,15 +88,15 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true }) {
|
|
90
|
-
const { setB3ModalOpen, setB3ModalContentType } = (0,
|
|
91
|
-
const hasMounted = (0,
|
|
92
|
-
const searchParams = (0,
|
|
93
|
-
const router = (0,
|
|
94
|
-
const [activePanel, setActivePanel] = (0,
|
|
95
|
-
const [activeTab, setActiveTab] = (0,
|
|
91
|
+
const { setB3ModalOpen, setB3ModalContentType } = (0, react_2.useModalStore)();
|
|
92
|
+
const hasMounted = (0, react_2.useHasMounted)();
|
|
93
|
+
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
94
|
+
const router = (0, react_2.useRouter)();
|
|
95
|
+
const [activePanel, setActivePanel] = (0, react_5.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
96
|
+
const [activeTab, setActiveTab] = (0, react_5.useState)("crypto");
|
|
96
97
|
// Get current user's wallet
|
|
97
|
-
const currentWallet = (0,
|
|
98
|
-
const recipientPropsProfile = (0,
|
|
98
|
+
const currentWallet = (0, react_2.useAccountWallet)();
|
|
99
|
+
const recipientPropsProfile = (0, react_2.useBsmntProfile)({ address: recipientAddressProps });
|
|
99
100
|
const recipientAddress = recipientAddressProps || currentWallet.address;
|
|
100
101
|
const recipientEnsName = recipientAddressProps
|
|
101
102
|
? recipientPropsProfile.data?.username?.replaceAll(".b3.fun", "")
|
|
@@ -103,19 +104,19 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
103
104
|
const recipientImageUrl = recipientAddressProps
|
|
104
105
|
? recipientPropsProfile.data?.avatar
|
|
105
106
|
: currentWallet.wallet.meta?.icon;
|
|
106
|
-
const [orderId, setOrderId] = (0,
|
|
107
|
-
const [srcChainId, setSrcChainId] = (0,
|
|
107
|
+
const [orderId, setOrderId] = (0, react_5.useState)(loadOrder);
|
|
108
|
+
const [srcChainId, setSrcChainId] = (0, react_5.useState)(isMainnet ? chains_1.base.id : chains_1.baseSepolia.id);
|
|
108
109
|
// Get token list for token balance check
|
|
109
|
-
const chainName = (0,
|
|
110
|
+
const chainName = (0, react_5.useMemo)(() => (0, simplehash_1.simpleHashChainToChainName)(srcChainId), [srcChainId]);
|
|
110
111
|
const { data: tokenList } = (0, anyspend_1.useAnyspendTokenList)(isMainnet, srcChainId, "");
|
|
111
112
|
// Get token balances for the selected chain
|
|
112
|
-
const { nativeTokens, fungibleTokens } = (0,
|
|
113
|
+
const { nativeTokens, fungibleTokens } = (0, react_2.useTokenBalancesByChain)({
|
|
113
114
|
address: currentWallet?.wallet?.address || "",
|
|
114
115
|
chainsIds: [srcChainId],
|
|
115
116
|
enabled: !!currentWallet?.wallet?.address && !!chainName
|
|
116
117
|
});
|
|
117
118
|
// Find a token with a balance, prioritizing tokens the user already owns
|
|
118
|
-
const getTokenWithBalance = (0,
|
|
119
|
+
const getTokenWithBalance = (0, react_5.useCallback)(() => {
|
|
119
120
|
if (!currentWallet?.wallet?.address || (!nativeTokens && !fungibleTokens) || !tokenList) {
|
|
120
121
|
return (0, anyspend_1.getDefaultToken)(srcChainId);
|
|
121
122
|
}
|
|
@@ -145,10 +146,10 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
145
146
|
return (0, anyspend_1.getDefaultToken)(srcChainId);
|
|
146
147
|
}, [currentWallet?.wallet?.address, nativeTokens, fungibleTokens, tokenList, srcChainId]);
|
|
147
148
|
// Set the selected token with preference for tokens user owns
|
|
148
|
-
const [srcToken, setSrcToken] = (0,
|
|
149
|
-
const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0,
|
|
149
|
+
const [srcToken, setSrcToken] = (0, react_5.useState)((0, anyspend_1.getDefaultToken)(srcChainId));
|
|
150
|
+
const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0, react_5.useState)(false);
|
|
150
151
|
// Update token when chain changes or token balances are loaded
|
|
151
|
-
(0,
|
|
152
|
+
(0, react_5.useEffect)(() => {
|
|
152
153
|
if (tokenList?.length && !dirtySelectSrcToken) {
|
|
153
154
|
const tokenWithBalance = getTokenWithBalance();
|
|
154
155
|
if ((0, anyspend_1.eqci)(tokenWithBalance.address, dstToken.address) === false) {
|
|
@@ -165,8 +166,6 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
165
166
|
dstToken: dstToken,
|
|
166
167
|
dstAmount: dstAmount,
|
|
167
168
|
contractAddress: contractAddress,
|
|
168
|
-
tokenId: (0, anyspend_1.isNftMetadata)(metadata) ? metadata.nftContract.tokenId : undefined,
|
|
169
|
-
contractType: (0, anyspend_1.isNftMetadata)(metadata) ? metadata.nftContract.type : undefined,
|
|
170
169
|
encodedData: encodedData,
|
|
171
170
|
spenderAddress: spenderAddress
|
|
172
171
|
});
|
|
@@ -182,11 +181,11 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
182
181
|
params.set("orderId", selectedOrderId);
|
|
183
182
|
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
184
183
|
};
|
|
185
|
-
const [srcAmount, setSrcAmount] = (0,
|
|
184
|
+
const [srcAmount, setSrcAmount] = (0, react_5.useState)(null);
|
|
186
185
|
const formattedSrcAmount = srcAmount ? (0, number_1.formatTokenAmount)(srcAmount, srcToken.decimals, 6, false) : null;
|
|
187
186
|
// Update the selected src token to USDC and chain to base when the active tab is fiat,
|
|
188
187
|
// also force not to update srcToken by setting dirtySelectSrcToken to true.
|
|
189
|
-
(0,
|
|
188
|
+
(0, react_5.useEffect)(() => {
|
|
190
189
|
if (activeTab === "fiat") {
|
|
191
190
|
setSrcChainId(chains_1.base.id);
|
|
192
191
|
setSrcToken(anyspend_1.USDC_BASE);
|
|
@@ -194,7 +193,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
194
193
|
}
|
|
195
194
|
}, [activeTab]);
|
|
196
195
|
// Update dependent amount when relay price changes
|
|
197
|
-
(0,
|
|
196
|
+
(0, react_5.useEffect)(() => {
|
|
198
197
|
if (anyspendQuote?.data &&
|
|
199
198
|
anyspendQuote.data.currencyIn?.amount &&
|
|
200
199
|
anyspendQuote.data.currencyIn?.currency?.decimals) {
|
|
@@ -206,7 +205,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
206
205
|
setSrcAmount(null);
|
|
207
206
|
}
|
|
208
207
|
}, [anyspendQuote?.data]);
|
|
209
|
-
(0,
|
|
208
|
+
(0, react_5.useEffect)(() => {
|
|
210
209
|
if (oat?.data?.order.status === anyspend_1.OrderStatus.Executed) {
|
|
211
210
|
console.log("Calling onSuccess");
|
|
212
211
|
const txHash = oat?.data?.executeTx?.txHash;
|
|
@@ -246,40 +245,21 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
246
245
|
srcAmount: srcAmount.toString(),
|
|
247
246
|
recipientAddress,
|
|
248
247
|
creatorAddress: currentWallet?.wallet?.address,
|
|
249
|
-
nft:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
nftPrice: dstAmount
|
|
259
|
-
}
|
|
260
|
-
: {
|
|
261
|
-
type: anyspend_1.NftType.ERC721,
|
|
262
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
263
|
-
contractType: metadata.nftContract.type,
|
|
264
|
-
nftPrice: dstAmount,
|
|
265
|
-
name: metadata.nftContract.name,
|
|
266
|
-
description: metadata.nftContract.description,
|
|
267
|
-
imageUrl: metadata.nftContract.imageUrl
|
|
268
|
-
}
|
|
269
|
-
: undefined,
|
|
270
|
-
tournament: (0, anyspend_1.isTournamentMetadata)(metadata)
|
|
271
|
-
? {
|
|
272
|
-
...metadata.tournament,
|
|
273
|
-
contractAddress: contractAddress,
|
|
274
|
-
entryPriceOrFundAmount: dstAmount
|
|
275
|
-
}
|
|
276
|
-
: undefined,
|
|
248
|
+
nft: {
|
|
249
|
+
...metadata.nftContract,
|
|
250
|
+
type: anyspend_1.NftType.ERC721
|
|
251
|
+
},
|
|
252
|
+
tournament: {
|
|
253
|
+
...metadata.tournament,
|
|
254
|
+
contractAddress: contractAddress,
|
|
255
|
+
entryPriceOrFundAmount: dstAmount
|
|
256
|
+
},
|
|
277
257
|
payload: {
|
|
278
258
|
amount: dstAmount,
|
|
279
259
|
data: encodedData,
|
|
280
260
|
spenderAddress: spenderAddress,
|
|
281
261
|
to: contractAddress,
|
|
282
|
-
action:
|
|
262
|
+
action: metadata.action
|
|
283
263
|
}
|
|
284
264
|
};
|
|
285
265
|
if (onramp) {
|
|
@@ -347,7 +327,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
347
327
|
? "Receive NFT at"
|
|
348
328
|
: orderType === anyspend_1.OrderType.JoinTournament
|
|
349
329
|
? "Join for"
|
|
350
|
-
: "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(
|
|
330
|
+
: "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", className: "w-full justify-between border-none p-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { children: (0, centerTruncate_1.default)(recipientAddress) })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] })) : null;
|
|
351
331
|
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: () => {
|
|
352
332
|
setActivePanel(PanelView.HISTORY);
|
|
353
333
|
}, onSelectOrder: onSelectOrder }) }));
|
|
@@ -359,9 +339,9 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
359
339
|
params.delete("orderId");
|
|
360
340
|
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
361
341
|
} })] })), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }));
|
|
362
|
-
const loadingView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background"), children: [(0, jsx_runtime_1.jsxs)(
|
|
342
|
+
const loadingView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background"), children: [(0, jsx_runtime_1.jsxs)(react_2.Badge, { variant: "default", className: "bg-b3-react-muted/30 border-b3-react-border hover:bg-b3-react-muted/50 flex items-center gap-3 px-4 py-1 text-base transition-all", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-react-foreground size-4 animate-spin" }), (0, jsx_runtime_1.jsx)(react_3.TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-8 w-48" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "ml-4 h-8 w-32" })] }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mt-4 h-8 w-24" })] }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mb-4 h-12 w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)(react_2.Skeleton, { className: "rounded-lg bg-white/5 p-6 pb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "size-[200px]" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 flex items-center justify-center gap-2", children: (0, jsx_runtime_1.jsx)("div", { className: "size-5 rounded-full" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 w-full" }, i))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-muted/30 mt-8 w-full rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "mb-3 h-4 w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 flex-1" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 flex-1" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-3", children: [1, 2, 3, 4, 5].map(i => ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between", children: [(0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-4 w-32" })] }, i))) }), (0, jsx_runtime_1.jsx)(react_2.Skeleton, { className: "h-10 w-full" }), mode === "page" && (0, jsx_runtime_1.jsx)("div", { className: "h-12" })] }));
|
|
363
343
|
// Confirm order view.
|
|
364
|
-
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(
|
|
344
|
+
const confirmOrderView = ((0, jsx_runtime_1.jsxs)("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_2.Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background w-full p-5", children: [isOnrampSupported || activeTab === "fiat" ? ((0, jsx_runtime_1.jsxs)(react_2.TabsList, { hideGradient: true, className: "justify-center", children: [(0, jsx_runtime_1.jsx)(react_2.TabTrigger, { value: "crypto", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with crypto" }) }), (0, jsx_runtime_1.jsx)(react_2.TabTrigger, { value: "fiat", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Pay with fiat" }) })] })) : null, (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
|
|
365
345
|
opacity: hasMounted ? 1 : 0,
|
|
366
346
|
y: hasMounted ? 0 : 20,
|
|
367
347
|
filter: hasMounted ? "blur(0px)" : "blur(10px)"
|
|
@@ -376,26 +356,9 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
376
356
|
opacity: hasMounted ? 1 : 0,
|
|
377
357
|
y: hasMounted ? 0 : 20,
|
|
378
358
|
filter: hasMounted ? "blur(0px)" : "blur(10px)"
|
|
379
|
-
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(
|
|
380
|
-
? metadata.
|
|
381
|
-
|
|
382
|
-
type: anyspend_1.NftType.ERC1155,
|
|
383
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
384
|
-
tokenId: metadata.nftContract.tokenId,
|
|
385
|
-
imageUrl: metadata.nftContract.imageUrl,
|
|
386
|
-
name: metadata.nftContract.name,
|
|
387
|
-
description: metadata.nftContract.description,
|
|
388
|
-
price: dstAmount
|
|
389
|
-
}
|
|
390
|
-
: {
|
|
391
|
-
type: anyspend_1.NftType.ERC721,
|
|
392
|
-
contractAddress: metadata.nftContract.contractAddress,
|
|
393
|
-
name: metadata.nftContract.name,
|
|
394
|
-
description: metadata.nftContract.description,
|
|
395
|
-
imageUrl: metadata.nftContract.imageUrl,
|
|
396
|
-
price: dstAmount
|
|
397
|
-
}
|
|
398
|
-
: undefined, payload: (0, anyspend_1.isCustomTxMetadata)(metadata)
|
|
359
|
+
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsx)("div", { className: "mt-6 flex w-full flex-col gap-6", children: (0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.nftContract ? { ...metadata.nftContract, price: dstAmount } : undefined, tournament: metadata.tournament
|
|
360
|
+
? { ...metadata.tournament, contractAddress: contractAddress, entryPriceOrFundAmount: dstAmount }
|
|
361
|
+
: undefined, payload: metadata.action
|
|
399
362
|
? {
|
|
400
363
|
...metadata,
|
|
401
364
|
amount: dstAmount,
|
|
@@ -405,7 +368,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
405
368
|
}
|
|
406
369
|
: undefined, recipientEnsName: recipientEnsName, recipientImageUrl: recipientImageUrl }) }) })] })] }));
|
|
407
370
|
// Return the TransitionPanel with all views
|
|
408
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(
|
|
371
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_4.TransitionPanel, { activeIndex: orderId
|
|
409
372
|
? oat
|
|
410
373
|
? PanelView.ORDER_DETAILS
|
|
411
374
|
: PanelView.LOADING
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NftContract } from "../../../anyspend/types";
|
|
2
|
-
export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract
|
|
2
|
+
export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract }: {
|
|
3
3
|
isMainnet?: boolean;
|
|
4
4
|
loadOrder?: string;
|
|
5
5
|
mode?: "modal" | "page";
|
|
6
6
|
recipientAddress?: string;
|
|
7
|
-
nftContract
|
|
8
|
-
onSuccess?: (txHash?: string) => void;
|
|
7
|
+
nftContract?: NftContract;
|
|
9
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AnySpendNFT = AnySpendNFT;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const anyspend_1 = require("../../../anyspend");
|
|
6
|
+
const constants_1 = require("../../../anyspend/constants");
|
|
6
7
|
const react_1 = require("../../../global-account/react");
|
|
7
8
|
const utils_1 = require("../../../shared/utils");
|
|
8
9
|
const ipfs_1 = require("../../../shared/utils/ipfs");
|
|
@@ -12,14 +13,11 @@ const lucide_react_1 = require("lucide-react");
|
|
|
12
13
|
const react_2 = require("react");
|
|
13
14
|
const chains_1 = require("viem/chains");
|
|
14
15
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
15
|
-
function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract
|
|
16
|
+
function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract = constants_1.DEFAULT_NFT_CONTRACT }) {
|
|
16
17
|
const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative size-[200px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCard, { className: "overflow-hidden", children: [(0, jsx_runtime_1.jsx)("img", { src: (0, ipfs_1.getIpfsUrl)(nftContract.imageUrl), alt: nftContract.name, className: "size-full object-cover" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), (0, jsx_runtime_1.jsx)(DropdownMenu, { nftContract: nftContract })] }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
|
|
17
18
|
"opacity-0": isLoadingAnyspendPrice
|
|
18
19
|
}), children: (0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[36px] w-full" })) })] })] })] }));
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: anyspend_1.OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
20
|
-
type: anyspend_1.OrderType.MintNFT,
|
|
21
|
-
nftContract: nftContract
|
|
22
|
-
}, header: header, onSuccess: onSuccess }));
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: anyspend_1.OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: { nftContract }, header: header }));
|
|
23
21
|
}
|
|
24
22
|
function DropdownMenu({ nftContract }) {
|
|
25
23
|
const [open, setOpen] = (0, react_2.useState)(false);
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AnySpendStakeB3 = AnySpendStakeB3;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const anyspend_1 = require("../../../anyspend");
|
|
9
|
+
const EthIcon_1 = require("./icons/EthIcon");
|
|
10
|
+
const SolIcon_1 = require("./icons/SolIcon");
|
|
11
|
+
const USDCIcon_1 = require("./icons/USDCIcon");
|
|
9
12
|
const react_1 = require("../../../global-account/react");
|
|
10
13
|
const number_1 = require("../../../shared/utils/number");
|
|
11
14
|
const framer_motion_1 = require("framer-motion");
|
|
@@ -17,9 +20,6 @@ const viem_1 = require("viem");
|
|
|
17
20
|
const chains_1 = require("viem/chains");
|
|
18
21
|
const wagmi_1 = require("wagmi");
|
|
19
22
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
20
|
-
const EthIcon_1 = require("./icons/EthIcon");
|
|
21
|
-
const SolIcon_1 = require("./icons/SolIcon");
|
|
22
|
-
const USDCIcon_1 = require("./icons/USDCIcon");
|
|
23
23
|
const basePublicClient = (0, viem_1.createPublicClient)({
|
|
24
24
|
chain: chains_1.base,
|
|
25
25
|
transport: (0, viem_1.http)()
|
|
@@ -256,7 +256,6 @@ function AnySpendStakeB3({ isMainnet = true, loadOrder, mode = "modal", recipien
|
|
|
256
256
|
}
|
|
257
257
|
const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
|
|
258
258
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: anyspend_1.OrderType.Custom, dstChainId: chains_1.base.id, dstToken: anyspend_1.B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
|
|
259
|
-
type: anyspend_1.OrderType.Custom,
|
|
260
259
|
action: "stake B3"
|
|
261
260
|
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
262
261
|
}
|
|
@@ -14,8 +14,5 @@ function AnySpendTournament(props) {
|
|
|
14
14
|
const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "z-10 mt-[-100px] flex h-[270px] w-full items-end justify-center", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/tournament-play.svg", alt: "Tournament Play", className: "h-[200px] w-[360px] object-cover object-center" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[100px] w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-1 p-6 pt-0", children: [(0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-center text-lg font-semibold", children: [action === "join" ? "Pay entry fee to join " : "Pay to fund ", " ", tournamentMetadata.name] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 flex w-fit items-center gap-1", children: anyspendPrice ? ((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { mode: "wait", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-as-primary group flex items-center text-2xl font-semibold transition-all", {
|
|
15
15
|
"opacity-0": isLoadingAnyspendPrice
|
|
16
16
|
}), children: [(0, number_1.formatDisplayNumber)(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }), " (", (0, number_1.formatTokenAmount)(BigInt(dstAmount), dstToken.decimals, 6, true), " ", dstToken.symbol, ")"] }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-[32px] w-full" })) })] })] })] }));
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? anyspend_1.OrderType.JoinTournament : anyspend_1.OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: {
|
|
18
|
-
type: action === "join" ? anyspend_1.OrderType.JoinTournament : anyspend_1.OrderType.FundTournament,
|
|
19
|
-
tournament: tournamentMetadata
|
|
20
|
-
}, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? anyspend_1.OrderType.JoinTournament : anyspend_1.OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: { tournament: tournamentMetadata }, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
|
|
21
18
|
}
|