@b3dotfun/sdk 0.0.49-alpha.1 → 0.0.49-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +1 -0
- package/dist/cjs/anyspend/constants/index.js +12 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +10 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/cjs/anyspend/types/api.d.ts +14 -2
- package/dist/cjs/anyspend/utils/chain.js +4 -4
- package/dist/cjs/bondkit/bondkitToken.d.ts +3 -1
- package/dist/cjs/bondkit/bondkitToken.js +19 -0
- package/dist/cjs/bondkit/components/TradingView.d.ts +1 -1
- package/dist/cjs/bondkit/components/TradingView.js +14 -3
- package/dist/cjs/bondkit/components/index.d.ts +1 -1
- package/dist/cjs/bondkit/components/index.js +1 -1
- package/dist/cjs/bondkit/components/types.d.ts +1 -0
- package/dist/cjs/bondkit/config.d.ts +1 -0
- package/dist/cjs/bondkit/config.js +1 -0
- package/dist/cjs/bondkit/index.d.ts +1 -1
- package/dist/cjs/bondkit/index.js +2 -6
- package/dist/cjs/bondkit/types.d.ts +15 -0
- 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/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/cjs/shared/generated/chain-networks.json +40 -7
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +10 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -3
- package/dist/esm/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/esm/anyspend/types/api.d.ts +14 -2
- package/dist/esm/anyspend/utils/chain.js +4 -4
- package/dist/esm/bondkit/bondkitToken.d.ts +3 -1
- package/dist/esm/bondkit/bondkitToken.js +19 -0
- package/dist/esm/bondkit/components/TradingView.d.ts +1 -1
- package/dist/esm/bondkit/components/TradingView.js +14 -3
- package/dist/esm/bondkit/components/index.d.ts +1 -1
- package/dist/esm/bondkit/components/index.js +1 -1
- package/dist/esm/bondkit/components/types.d.ts +1 -0
- package/dist/esm/bondkit/config.d.ts +1 -0
- package/dist/esm/bondkit/config.js +1 -0
- package/dist/esm/bondkit/index.d.ts +1 -1
- package/dist/esm/bondkit/index.js +1 -1
- package/dist/esm/bondkit/types.d.ts +15 -0
- 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/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/esm/shared/generated/chain-networks.json +40 -7
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/types/anyspend/types/api.d.ts +14 -2
- package/dist/types/bondkit/bondkitToken.d.ts +3 -1
- package/dist/types/bondkit/components/TradingView.d.ts +1 -1
- package/dist/types/bondkit/components/index.d.ts +1 -1
- package/dist/types/bondkit/components/types.d.ts +1 -0
- package/dist/types/bondkit/config.d.ts +1 -0
- package/dist/types/bondkit/index.d.ts +1 -1
- package/dist/types/bondkit/types.d.ts +15 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/package.json +3 -3
- package/src/anyspend/constants/index.ts +12 -1
- package/src/anyspend/react/components/AnySpend.tsx +13 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +1 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +17 -9
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +33 -6
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -0
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +16 -0
- package/src/anyspend/react/components/common/OrderToken.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +1 -1
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +2 -2
- package/src/anyspend/types/api.ts +14 -2
- package/src/anyspend/utils/chain.ts +4 -4
- package/src/bondkit/bondkitToken.ts +24 -0
- package/src/bondkit/components/TradingView.tsx +15 -3
- package/src/bondkit/components/index.ts +1 -1
- package/src/bondkit/components/types.ts +1 -0
- package/src/bondkit/config.ts +2 -0
- package/src/bondkit/index.ts +1 -1
- package/src/bondkit/types.ts +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -1
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +2 -2
- package/src/shared/generated/chain-networks.json +40 -7
|
@@ -6,6 +6,7 @@ export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
|
6
6
|
export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
7
7
|
export declare const SOLANA_TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
8
8
|
export declare const B3_TOKEN: components["schemas"]["Token"];
|
|
9
|
+
export declare const ANYSPEND_TOKEN: components["schemas"]["Token"];
|
|
9
10
|
export declare const USDC_BASE: components["schemas"]["Token"];
|
|
10
11
|
export declare const ETH_BASE: components["schemas"]["Token"];
|
|
11
12
|
export declare const NFT_CONTRACTS: components["schemas"]["NftContract"][];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
3
|
+
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.ANYSPEND_TOKEN = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
4
|
const chains_1 = require("viem/chains");
|
|
5
5
|
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
6
6
|
exports.RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -9,7 +9,7 @@ exports.RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
|
9
9
|
exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
10
10
|
exports.SOLANA_TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
11
11
|
exports.B3_TOKEN = {
|
|
12
|
-
chainId:
|
|
12
|
+
chainId: chains_1.base.id,
|
|
13
13
|
address: "0xb3b32f9f8827d4634fe7d973fa1034ec9fddb3b3",
|
|
14
14
|
decimals: 18,
|
|
15
15
|
name: "B3",
|
|
@@ -18,6 +18,16 @@ exports.B3_TOKEN = {
|
|
|
18
18
|
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/35690.png",
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
+
exports.ANYSPEND_TOKEN = {
|
|
22
|
+
chainId: chains_1.base.id,
|
|
23
|
+
address: "0xc17dda248e2d50fc006d8febb5a406dd31972712",
|
|
24
|
+
decimals: 18,
|
|
25
|
+
name: "Anyspend",
|
|
26
|
+
symbol: "ANY",
|
|
27
|
+
metadata: {
|
|
28
|
+
logoURI: "https://cdn.b3.fun/anyspend_64x64.png",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
21
31
|
exports.USDC_BASE = {
|
|
22
32
|
symbol: "USDC",
|
|
23
33
|
chainId: chains_1.base.id,
|
|
@@ -467,10 +467,18 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
467
467
|
sonner_1.toast.error("Failed to create order: " + error.message);
|
|
468
468
|
},
|
|
469
469
|
});
|
|
470
|
+
// Check if it's a same-chain same-token swap
|
|
471
|
+
const isSameChainSameToken = (0, react_4.useMemo)(() => {
|
|
472
|
+
return (activeTab === "crypto" &&
|
|
473
|
+
selectedSrcChainId === selectedDstChainId &&
|
|
474
|
+
selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
|
|
475
|
+
}, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
|
|
470
476
|
// Determine button state and text
|
|
471
477
|
const btnInfo = (0, react_4.useMemo)(() => {
|
|
472
478
|
if (activeInputAmountInWei === "0")
|
|
473
479
|
return { text: "Enter an amount", disable: true, error: false, loading: false };
|
|
480
|
+
if (isSameChainSameToken)
|
|
481
|
+
return { text: "Select a different token or chain", disable: true, error: false, loading: false };
|
|
474
482
|
if (isLoadingAnyspendQuote)
|
|
475
483
|
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
476
484
|
if (!recipientAddress)
|
|
@@ -504,6 +512,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
504
512
|
return { text: "Buy", disable: false, error: false, loading: false };
|
|
505
513
|
}, [
|
|
506
514
|
activeInputAmountInWei,
|
|
515
|
+
isSameChainSameToken,
|
|
507
516
|
isLoadingAnyspendQuote,
|
|
508
517
|
recipientAddress,
|
|
509
518
|
isCreatingOrder,
|
|
@@ -720,7 +729,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
720
729
|
};
|
|
721
730
|
}, [activePanel, navigateBack]);
|
|
722
731
|
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
|
|
723
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
732
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
|
|
724
733
|
setOrderId(undefined);
|
|
725
734
|
navigateBack();
|
|
726
735
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
@@ -203,7 +203,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
203
203
|
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
204
204
|
setOrderId(undefined);
|
|
205
205
|
setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
|
|
206
|
-
}, disableUrlParamManagement: true })) }) }));
|
|
206
|
+
}, disableUrlParamManagement: true, points: oat.data.points || undefined })) }) }));
|
|
207
207
|
// Loading view
|
|
208
208
|
const loadingView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-full flex-col items-center gap-4 p-5", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: "Loading order details..." }) }));
|
|
209
209
|
// Panel views
|
|
@@ -25,32 +25,38 @@ function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, select
|
|
|
25
25
|
(() => {
|
|
26
26
|
const calculatePriceImpact = (inputUsd, outputUsd) => {
|
|
27
27
|
if (!inputUsd || !outputUsd) {
|
|
28
|
-
return { percentage: "0.00", isNegative: false };
|
|
28
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
29
29
|
}
|
|
30
30
|
const input = Number(inputUsd);
|
|
31
31
|
const output = Number(outputUsd);
|
|
32
32
|
// Handle edge cases
|
|
33
33
|
if (input === 0 || isNaN(input) || isNaN(output) || input <= output) {
|
|
34
|
-
return { percentage: "0.00", isNegative: false };
|
|
34
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
35
35
|
}
|
|
36
36
|
const percentageValue = ((output - input) / input) * 100;
|
|
37
37
|
// Handle the -0.00% case
|
|
38
38
|
if (percentageValue > -0.005 && percentageValue < 0) {
|
|
39
|
-
return { percentage: "0.00", isNegative: false };
|
|
39
|
+
return { percentage: "0.00", percentageNum: 0, isNegative: false };
|
|
40
40
|
}
|
|
41
41
|
return {
|
|
42
42
|
percentage: Math.abs(percentageValue).toFixed(2),
|
|
43
|
+
percentageNum: Math.abs(percentageValue),
|
|
43
44
|
isNegative: percentageValue < 0,
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
|
-
const { percentage, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
|
|
47
|
-
//
|
|
48
|
-
const
|
|
49
|
-
//
|
|
50
|
-
|
|
47
|
+
const { percentage, percentageNum, isNegative } = calculatePriceImpact(anyspendQuote.data.currencyIn.amountUsd, anyspendQuote.data.currencyOut.amountUsd);
|
|
48
|
+
// Get the fee percentage if available
|
|
49
|
+
const feePercent = anyspendQuote.data.fee?.finalFeeBps ? anyspendQuote.data.fee.finalFeeBps / 100 : 0;
|
|
50
|
+
// Calculate actual slippage (price impact minus fee)
|
|
51
|
+
const actualSlippage = percentageNum - feePercent;
|
|
52
|
+
// Show warning based on actual slippage, not total impact
|
|
53
|
+
const yellowThreshold = 1; // 1% actual slippage
|
|
54
|
+
const redThreshold = 2; // 2% actual slippage
|
|
55
|
+
// Don't show if actual slippage is less than yellow threshold
|
|
56
|
+
if (actualSlippage < yellowThreshold) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
53
59
|
// Using inline style to ensure color displays
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color:
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: actualSlippage >= redThreshold ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
|
|
55
61
|
})()] }), featureFlags.showPoints && anyspendQuote?.data?.pointsAmount > 0 && ((0, jsx_runtime_1.jsx)(PointsBadge_1.PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] })] }));
|
|
56
62
|
}
|
|
@@ -70,7 +70,7 @@ function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
|
|
|
70
70
|
if (!showAllFeeTiers && currentTierIndex !== -1 && idx > currentTierIndex) {
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [(0, jsx_runtime_1.jsx)("span", { children: tier.label }), (0, jsx_runtime_1.jsxs)("span", { children: ["
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-center justify-between rounded-lg px-3 py-2.5 text-sm transition-colors", isCurrentTier ? "bg-as-brand/10 text-as-brand font-semibold" : "text-as-primary/60"), children: [(0, jsx_runtime_1.jsx)("span", { children: tier.label }), (0, jsx_runtime_1.jsxs)("span", { children: ["Credit Card Fee + ", tier.fee] })] }, idx));
|
|
74
74
|
})
|
|
75
75
|
: CRYPTO_FEE_TIERS.map((tier, idx) => {
|
|
76
76
|
const isCurrentTier = currentCryptoTier?.label === tier.label;
|
|
@@ -112,5 +112,5 @@ function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
|
|
|
112
112
|
return ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowAllDiscountTiers(!showAllDiscountTiers), className: "text-as-primary/60 hover:text-as-primary mt-2 flex w-full items-center justify-center gap-1 text-xs transition-colors", children: [(0, jsx_runtime_1.jsx)("span", { children: showAllDiscountTiers ? "Show less" : "Show all tiers" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: (0, cn_1.cn)("h-3.5 w-3.5 transition-transform", showAllDiscountTiers && "rotate-180") })] }));
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
|
-
})()] })) })] })), transactionAmountUsd && ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-secondary", children: "Transaction" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", transactionAmountUsd.toFixed(2)] })] }), isStripeFee &&
|
|
115
|
+
})()] })) })] })), transactionAmountUsd && ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-secondary", children: "Transaction" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-semibold", children: ["$", transactionAmountUsd.toFixed(2)] })] }), isStripeFee && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary", children: ["Credit Card Fee (", fee.stripeFeeBps ? `${bpsToPercent(fee.stripeFeeBps)}%` : "0%", " + $", fee.stripeFeeUsd?.toFixed(2) || "0.00", ")"] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.stripeFeeBps || 0)) / 10000 + (fee.stripeFeeUsd || 0)).toFixed(2)] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary", children: ["AnySpend Fee (", fee.anyspendFeeBps ? `${bpsToPercent(fee.anyspendFeeBps)}%` : "0%", fee.anyspendFeeUsd && fee.anyspendFeeUsd > 0 ? ` + $${fee.anyspendFeeUsd.toFixed(2)}` : "", ")"] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * (fee.anyspendFeeBps || 0)) / 10000 + (fee.anyspendFeeUsd || 0)).toFixed(2)] })] }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-secondary border-t pt-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * (fee.finalFeeBps || 0)) / 10000 + (fee.finalFeeUsd || 0)).toFixed(2)] })] }) })] })), !isStripeFee && currentCryptoTier && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary", children: ["Base Fee (", bpsToPercent(currentCryptoTier.bps), "%)"] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary font-medium", children: ["$", ((transactionAmountUsd * currentCryptoTier.bps) / 10000).toFixed(2)] })] }), hasWhaleDiscount && currentWhaleTier && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-green-600", children: ["Discount (", currentWhaleTier.discountPercent, "% off)"] }), (0, jsx_runtime_1.jsxs)("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * currentWhaleTier.discountPercent) / 100 / 10000).toFixed(2)] })] })), hasPartnerDiscount && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-green-600", children: ["Partner Discount (", partnerDiscountPercent, "% off)"] }), (0, jsx_runtime_1.jsxs)("span", { className: "font-medium text-green-600", children: ["-$", ((transactionAmountUsd * baseFee * partnerDiscountPercent) / 100 / 10000).toFixed(2)] })] })), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-secondary border-t pt-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary font-semibold", children: "Total Fee" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-brand font-semibold", children: ["$", ((transactionAmountUsd * fee.finalFeeBps) / 10000).toFixed(2)] })] }) })] }))] }) })), (0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: (0, cn_1.cn)("as-main-button !bg-as-brand relative w-full"), textClassName: (0, cn_1.cn)("text-white"), children: ["Back to ", isStripeFee ? "Payment" : "Swap"] })] }) }));
|
|
116
116
|
}
|
|
@@ -12,6 +12,7 @@ interface OrderDetailsProps {
|
|
|
12
12
|
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
13
13
|
onBack?: () => void;
|
|
14
14
|
disableUrlParamManagement?: boolean;
|
|
15
|
+
points?: number | undefined;
|
|
15
16
|
}
|
|
16
17
|
export declare const OrderDetails: import("react").NamedExoticComponent<OrderDetailsProps>;
|
|
17
18
|
export declare const OrderDetailsLoadingView: import("react/jsx-runtime").JSX.Element;
|
|
@@ -131,7 +131,7 @@ function roundTokenAmount(amount) {
|
|
|
131
131
|
const roundedDecimalPart = digits.join("");
|
|
132
132
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
133
133
|
}
|
|
134
|
-
exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, }) {
|
|
134
|
+
exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, selectedCryptoPaymentMethod, onPaymentMethodChange, onBack, disableUrlParamManagement = false, points, }) {
|
|
135
135
|
const router = (0, hooks_1.useRouter)();
|
|
136
136
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
137
137
|
// Get theme from B3Provider context
|
|
@@ -417,7 +417,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
419
|
if (refundTxs.length > 0) {
|
|
420
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
420
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "refund-details", className: "order-details-refund-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
421
421
|
? depositTxs.map(dTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
422
422
|
? `Received payment`
|
|
423
423
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
@@ -426,7 +426,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
426
426
|
: null] }) })] }) }), order.errorDetails && ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: (0, anyspend_1.getErrorDisplay)(order.errorDetails) }) })), (0, jsx_runtime_1.jsx)("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
|
|
427
427
|
}
|
|
428
428
|
if (executeTx) {
|
|
429
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
429
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
430
430
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
431
431
|
? `Received payment`
|
|
432
432
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
@@ -451,7 +451,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
451
451
|
}), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && ((0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4", children: "Continue to Tournament" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && ((0, jsx_runtime_1.jsx)("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
|
|
452
452
|
}
|
|
453
453
|
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
454
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", className: "order-details-more-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
454
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", className: "order-details-more-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
|
|
455
455
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
456
456
|
? `Received payment`
|
|
457
457
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
@@ -470,7 +470,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
470
470
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
471
471
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
472
472
|
if (depositTxs?.length || waitingForDeposit) {
|
|
473
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
473
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "deposit-details", className: "order-details-deposit-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1, ease: "easeInOut" } }) }), (depositTxs || []).map((dTxs, index) => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
474
474
|
? `Received payment`
|
|
475
475
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount }, dTxs.txHash))), statusDisplay === "failure" ? ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: statusText, chainId: order.srcChain, tx: null, isProcessing: false, delay: 0.5 })) : depositEnoughAmount ? ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.type === "swap"
|
|
476
476
|
? "Processing Swap"
|
|
@@ -497,7 +497,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
497
497
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
498
498
|
: (0, centerTruncate_1.default)(account?.address || "", 6)] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
499
499
|
// Default case - existing QR code flow
|
|
500
|
-
(0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), (0, jsx_runtime_1.jsxs)("button", { className: "order-details-cancel-btn flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
500
|
+
(0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), (0, jsx_runtime_1.jsxs)("button", { className: "order-details-cancel-btn flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
501
501
|
});
|
|
502
502
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
503
503
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), (0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, children: title })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary", children: title })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-1", children: tx ? ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: (0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(chainId, tx.txHash), target: "_blank", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 font-mono text-xs", children: (0, centerTruncate_1.default)(tx?.txHash, 6) }) }) })) : null })] }));
|
|
@@ -13,6 +13,7 @@ interface OrderDetailsCollapsibleProps {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
showTotal?: boolean;
|
|
15
15
|
totalAmount?: string;
|
|
16
|
+
points?: number;
|
|
16
17
|
}
|
|
17
18
|
export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
|
|
18
19
|
export {};
|
|
@@ -10,13 +10,14 @@ const anyspend_1 = require("../../../../anyspend");
|
|
|
10
10
|
const react_1 = require("../../../../global-account/react");
|
|
11
11
|
const utils_1 = require("../../../../shared/utils");
|
|
12
12
|
const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
|
|
13
|
+
const formatNumber_1 = require("../../../../shared/utils/formatNumber");
|
|
13
14
|
const number_1 = require("../../../../shared/utils/number");
|
|
14
15
|
const lucide_react_1 = require("lucide-react");
|
|
15
16
|
const react_2 = require("motion/react");
|
|
16
17
|
const react_3 = require("react");
|
|
17
18
|
const sonner_1 = require("sonner");
|
|
18
19
|
const chains_1 = require("viem/chains");
|
|
19
|
-
exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, }) {
|
|
20
|
+
exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, points, }) {
|
|
20
21
|
const [showOrderDetails, setShowOrderDetails] = (0, react_3.useState)(true);
|
|
21
22
|
// Calculate expected amount if not provided
|
|
22
23
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
@@ -39,5 +40,5 @@ exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollaps
|
|
|
39
40
|
? order.metadata.action
|
|
40
41
|
? (0, anyspend_1.capitalizeFirstLetter)(order.metadata.action)
|
|
41
42
|
: "Contract execution"
|
|
42
|
-
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
43
|
+
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", (0, formatNumber_1.formatNumber)(points), " pts"] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
43
44
|
});
|
|
@@ -8,7 +8,7 @@ const react_1 = require("../../../../global-account/react");
|
|
|
8
8
|
const utils_1 = require("../../../../shared/utils");
|
|
9
9
|
const number_1 = require("../../../../shared/utils/number");
|
|
10
10
|
const simplehash_1 = require("../../../../shared/utils/simplehash");
|
|
11
|
-
const relay_kit_ui_1 = require("@
|
|
11
|
+
const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
|
|
12
12
|
const lucide_react_1 = require("lucide-react");
|
|
13
13
|
const react_2 = require("react");
|
|
14
14
|
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
@@ -9,7 +9,7 @@ const react_number_format_1 = require("react-number-format");
|
|
|
9
9
|
const anyspend_1 = require("../../../../anyspend");
|
|
10
10
|
const react_2 = require("../../../../global-account/react");
|
|
11
11
|
const utils_1 = require("../../../../shared/utils");
|
|
12
|
-
const relay_kit_ui_1 = require("@
|
|
12
|
+
const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
|
|
13
13
|
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
14
14
|
function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }) {
|
|
15
15
|
// Track previous token to detect changes
|
|
@@ -8,7 +8,7 @@ const react_1 = require("react");
|
|
|
8
8
|
const react_number_format_1 = require("react-number-format");
|
|
9
9
|
const anyspend_1 = require("../../../../anyspend");
|
|
10
10
|
const utils_1 = require("../../../../shared/utils");
|
|
11
|
-
const relay_kit_ui_1 = require("@
|
|
11
|
+
const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
|
|
12
12
|
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
13
13
|
function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, className, }) {
|
|
14
14
|
// Track previous token to detect changes
|
|
@@ -9,7 +9,7 @@ const react_number_format_1 = require("react-number-format");
|
|
|
9
9
|
const anyspend_1 = require("../../../../anyspend");
|
|
10
10
|
const react_2 = require("../../../../global-account/react");
|
|
11
11
|
const utils_1 = require("../../../../shared/utils");
|
|
12
|
-
const relay_kit_ui_1 = require("@
|
|
12
|
+
const relay_kit_ui_1 = require("@relayprotocol/relay-kit-ui");
|
|
13
13
|
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
14
14
|
function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, showAsReceiveAmount = false, }) {
|
|
15
15
|
// Track previous token to detect changes
|
|
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const FeatureFlagsContext = (0, react_1.createContext)(undefined);
|
|
9
9
|
const defaultFeatureFlags = {
|
|
10
|
-
showPoints:
|
|
10
|
+
showPoints: true,
|
|
11
11
|
};
|
|
12
12
|
function FeatureFlagsProvider({ children, featureFlags = defaultFeatureFlags }) {
|
|
13
13
|
return (0, jsx_runtime_1.jsx)(FeatureFlagsContext.Provider, { value: { featureFlags }, children: children });
|
|
@@ -20,7 +20,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
20
20
|
oneClickBuyUrl: string | null;
|
|
21
21
|
stripePaymentIntentId: string | null;
|
|
22
22
|
settlement: {
|
|
23
|
-
actualDstAmount
|
|
23
|
+
actualDstAmount?: string;
|
|
24
|
+
relay?: Record<string, never>;
|
|
24
25
|
} | null;
|
|
25
26
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
26
27
|
} & {
|
|
@@ -48,7 +49,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
48
49
|
oneClickBuyUrl: string | null;
|
|
49
50
|
stripePaymentIntentId: string | null;
|
|
50
51
|
settlement: {
|
|
51
|
-
actualDstAmount
|
|
52
|
+
actualDstAmount?: string;
|
|
53
|
+
relay?: Record<string, never>;
|
|
52
54
|
} | null;
|
|
53
55
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
54
56
|
} & {
|
|
@@ -76,7 +78,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
76
78
|
oneClickBuyUrl: string | null;
|
|
77
79
|
stripePaymentIntentId: string | null;
|
|
78
80
|
settlement: {
|
|
79
|
-
actualDstAmount
|
|
81
|
+
actualDstAmount?: string;
|
|
82
|
+
relay?: Record<string, never>;
|
|
80
83
|
} | null;
|
|
81
84
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
82
85
|
} & {
|
|
@@ -104,7 +107,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
104
107
|
oneClickBuyUrl: string | null;
|
|
105
108
|
stripePaymentIntentId: string | null;
|
|
106
109
|
settlement: {
|
|
107
|
-
actualDstAmount
|
|
110
|
+
actualDstAmount?: string;
|
|
111
|
+
relay?: Record<string, never>;
|
|
108
112
|
} | null;
|
|
109
113
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
110
114
|
} & {
|
|
@@ -132,7 +136,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
132
136
|
oneClickBuyUrl: string | null;
|
|
133
137
|
stripePaymentIntentId: string | null;
|
|
134
138
|
settlement: {
|
|
135
|
-
actualDstAmount
|
|
139
|
+
actualDstAmount?: string;
|
|
140
|
+
relay?: Record<string, never>;
|
|
136
141
|
} | null;
|
|
137
142
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
138
143
|
} & {
|
|
@@ -160,7 +165,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
160
165
|
oneClickBuyUrl: string | null;
|
|
161
166
|
stripePaymentIntentId: string | null;
|
|
162
167
|
settlement: {
|
|
163
|
-
actualDstAmount
|
|
168
|
+
actualDstAmount?: string;
|
|
169
|
+
relay?: Record<string, never>;
|
|
164
170
|
} | null;
|
|
165
171
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
166
172
|
} & {
|
|
@@ -191,7 +197,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
191
197
|
oneClickBuyUrl: string | null;
|
|
192
198
|
stripePaymentIntentId: string | null;
|
|
193
199
|
settlement: {
|
|
194
|
-
actualDstAmount
|
|
200
|
+
actualDstAmount?: string;
|
|
201
|
+
relay?: Record<string, never>;
|
|
195
202
|
} | null;
|
|
196
203
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
197
204
|
} & {
|
|
@@ -219,7 +226,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
219
226
|
oneClickBuyUrl: string | null;
|
|
220
227
|
stripePaymentIntentId: string | null;
|
|
221
228
|
settlement: {
|
|
222
|
-
actualDstAmount
|
|
229
|
+
actualDstAmount?: string;
|
|
230
|
+
relay?: Record<string, never>;
|
|
223
231
|
} | null;
|
|
224
232
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
225
233
|
} & {
|
|
@@ -247,7 +255,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
247
255
|
oneClickBuyUrl: string | null;
|
|
248
256
|
stripePaymentIntentId: string | null;
|
|
249
257
|
settlement: {
|
|
250
|
-
actualDstAmount
|
|
258
|
+
actualDstAmount?: string;
|
|
259
|
+
relay?: Record<string, never>;
|
|
251
260
|
} | null;
|
|
252
261
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
253
262
|
} & {
|
|
@@ -275,7 +284,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
275
284
|
oneClickBuyUrl: string | null;
|
|
276
285
|
stripePaymentIntentId: string | null;
|
|
277
286
|
settlement: {
|
|
278
|
-
actualDstAmount
|
|
287
|
+
actualDstAmount?: string;
|
|
288
|
+
relay?: Record<string, never>;
|
|
279
289
|
} | null;
|
|
280
290
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
281
291
|
} & {
|
|
@@ -303,7 +313,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
303
313
|
oneClickBuyUrl: string | null;
|
|
304
314
|
stripePaymentIntentId: string | null;
|
|
305
315
|
settlement: {
|
|
306
|
-
actualDstAmount
|
|
316
|
+
actualDstAmount?: string;
|
|
317
|
+
relay?: Record<string, never>;
|
|
307
318
|
} | null;
|
|
308
319
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
309
320
|
} & {
|
|
@@ -331,7 +342,8 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
331
342
|
oneClickBuyUrl: string | null;
|
|
332
343
|
stripePaymentIntentId: string | null;
|
|
333
344
|
settlement: {
|
|
334
|
-
actualDstAmount
|
|
345
|
+
actualDstAmount?: string;
|
|
346
|
+
relay?: Record<string, never>;
|
|
335
347
|
} | null;
|
|
336
348
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
337
349
|
} & {
|
|
@@ -1317,10 +1317,22 @@ export interface components {
|
|
|
1317
1317
|
/** @description Settlement information for executed orders */
|
|
1318
1318
|
settlement: {
|
|
1319
1319
|
/**
|
|
1320
|
-
* @description Actual received amount after execution
|
|
1320
|
+
* @description Actual received amount after execution (only for swap/hypeduel orders). Optional - only present for swap/hypeduel orders.
|
|
1321
1321
|
* @example 990000
|
|
1322
1322
|
*/
|
|
1323
|
-
actualDstAmount
|
|
1323
|
+
actualDstAmount?: string;
|
|
1324
|
+
/**
|
|
1325
|
+
* @description Complete relay API response data. Contains transaction details, state changes, fees, and execution status. Optional - can be backfilled by querying Relay API /requests/v2 endpoint.
|
|
1326
|
+
* @example {
|
|
1327
|
+
* "status": "success",
|
|
1328
|
+
* "metadata": {
|
|
1329
|
+
* "currencyOut": {
|
|
1330
|
+
* "amount": "990000"
|
|
1331
|
+
* }
|
|
1332
|
+
* }
|
|
1333
|
+
* }
|
|
1334
|
+
*/
|
|
1335
|
+
relay?: Record<string, never>;
|
|
1324
1336
|
} | null;
|
|
1325
1337
|
/** @description Fee structure for the order including Stripe and AnySpend fees */
|
|
1326
1338
|
fee?: Omit<components["schemas"]["Fee"], "type"> | null;
|
|
@@ -107,7 +107,7 @@ exports.EVM_MAINNET = {
|
|
|
107
107
|
viem: getCustomEvmChain(chains_1.polygon, "https://purple-young-field.matic.quiknode.pro/ca54f365c1a4c7f970223eb8087e0fc579feba12/"),
|
|
108
108
|
pollingInterval: 1000, // 1 second for Polygon
|
|
109
109
|
zapperEnum: "POLYGON_MAINNET",
|
|
110
|
-
coingeckoName: "
|
|
110
|
+
coingeckoName: "polygon_pos",
|
|
111
111
|
},
|
|
112
112
|
[chains_1.avalanche.id]: {
|
|
113
113
|
id: chains_1.avalanche.id,
|
|
@@ -121,7 +121,7 @@ exports.EVM_MAINNET = {
|
|
|
121
121
|
viem: getCustomEvmChain(chains_1.avalanche, "https://avalanche-c-chain-rpc.publicnode.com"),
|
|
122
122
|
pollingInterval: 1000, // 1 second for Avalanche
|
|
123
123
|
zapperEnum: "AVALANCHE_MAINNET",
|
|
124
|
-
coingeckoName: "
|
|
124
|
+
coingeckoName: "avax",
|
|
125
125
|
},
|
|
126
126
|
[chains_1.bsc.id]: {
|
|
127
127
|
id: chains_1.bsc.id,
|
|
@@ -162,8 +162,8 @@ exports.EVM_MAINNET = {
|
|
|
162
162
|
nativeToken: (0, token_1.getEthToken)(chains_1.abstract.id),
|
|
163
163
|
viem: getCustomEvmChain(chains_1.abstract, "https://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/"),
|
|
164
164
|
pollingInterval: 3000, // 3 seconds for Abstract
|
|
165
|
-
zapperEnum: "
|
|
166
|
-
coingeckoName: "
|
|
165
|
+
zapperEnum: "ABSTRACT_MAINNET",
|
|
166
|
+
coingeckoName: "abstract",
|
|
167
167
|
},
|
|
168
168
|
};
|
|
169
169
|
exports.EVM_TESTNET = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, EIP1193Provider, GetContractReturnType, Hex, PublicClient, WalletClient } from "viem";
|
|
2
2
|
import { BondkitTokenABI } from "./abis";
|
|
3
|
-
import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions, SwapQuote, TokenDetails, TransactionResponse } from "./types";
|
|
3
|
+
import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions, MarketCapChartResponse, SwapQuote, TokenDetails, TransactionResponse } from "./types";
|
|
4
4
|
import { TokenStatus } from "./types";
|
|
5
5
|
type ExecuteWriteOptions = {
|
|
6
6
|
value?: bigint;
|
|
@@ -16,6 +16,7 @@ export declare class BondkitToken {
|
|
|
16
16
|
private walletKey?;
|
|
17
17
|
private rpcUrl;
|
|
18
18
|
private apiEndpoint;
|
|
19
|
+
private chartApiEndpoint;
|
|
19
20
|
private walletClientInstance;
|
|
20
21
|
private connectedProvider?;
|
|
21
22
|
private tradingToken?;
|
|
@@ -56,6 +57,7 @@ export declare class BondkitToken {
|
|
|
56
57
|
threshold: number;
|
|
57
58
|
} | undefined>;
|
|
58
59
|
getTransactionHistory(options?: GetTransactionHistoryOptions): Promise<TransactionResponse | undefined>;
|
|
60
|
+
getMarketCapChartData(): Promise<MarketCapChartResponse | undefined>;
|
|
59
61
|
private executeWrite;
|
|
60
62
|
/** Helper method to wait for transaction confirmation with OKX wallet fallback */
|
|
61
63
|
waitForTransaction(hash: Hex): Promise<import("viem").TransactionReceipt>;
|