@b3dotfun/sdk 0.0.33-alpha.5 → 0.0.33-alpha.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/react/components/AnySpend.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +40 -36
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/types/api.d.ts +130 -14
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +1 -0
- package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +40 -36
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/types/api.d.ts +130 -14
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.js +1 -0
- package/dist/esm/anyspend/utils/orderPayload.js +7 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/types/anyspend/types/api.d.ts +130 -14
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +1 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +85 -64
- package/src/anyspend/react/components/common/OrderStatus.tsx +1 -1
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/types/api.ts +131 -11
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/format.ts +1 -0
- package/src/anyspend/utils/orderPayload.ts +7 -0
- package/src/global-account/react/stores/useModalStore.ts +0 -2
|
@@ -657,7 +657,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
657
657
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
658
658
|
}, [activePanel]);
|
|
659
659
|
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => setActivePanel(PanelView.MAIN), onSelectOrder: onSelectOrder }) }));
|
|
660
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
660
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: () => {
|
|
661
661
|
setOrderId(undefined);
|
|
662
662
|
setActivePanel(PanelView.MAIN);
|
|
663
663
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
@@ -419,7 +419,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
419
419
|
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
|
|
420
420
|
setActivePanel(PanelView.HISTORY);
|
|
421
421
|
}, onSelectOrder: onSelectOrder }) }));
|
|
422
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
422
|
+
const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
423
423
|
setOrderId(undefined);
|
|
424
424
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
425
425
|
// Remove orderId from URL when canceling
|
|
@@ -10,7 +10,6 @@ export interface AnySpendDepositHypeProps {
|
|
|
10
10
|
sourceTokenAddress?: string;
|
|
11
11
|
sourceTokenChainId?: number;
|
|
12
12
|
onSuccess?: () => void;
|
|
13
|
-
depositContractAddress?: string;
|
|
14
13
|
mainFooter?: React.ReactNode;
|
|
15
14
|
}
|
|
16
15
|
export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,6 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
13
13
|
const react_2 = require("motion/react");
|
|
14
14
|
const react_3 = require("react");
|
|
15
15
|
const sonner_1 = require("sonner");
|
|
16
|
-
const viem_1 = require("viem");
|
|
17
16
|
const chains_1 = require("viem/chains");
|
|
18
17
|
const useAnyspendFlow_1 = require("../hooks/useAnyspendFlow");
|
|
19
18
|
const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
|
|
@@ -25,7 +24,6 @@ const OrderDetails_1 = require("./common/OrderDetails");
|
|
|
25
24
|
const OrderStatus_1 = require("./common/OrderStatus");
|
|
26
25
|
const PaySection_1 = require("./common/PaySection");
|
|
27
26
|
const RecipientSelection_1 = require("./common/RecipientSelection");
|
|
28
|
-
const escrow_1 = require("../../../anyspend/abis/escrow");
|
|
29
27
|
const lucide_react_1 = require("lucide-react");
|
|
30
28
|
const PanelOnramp_1 = require("./common/PanelOnramp");
|
|
31
29
|
const SLIPPAGE_PERCENT = 3;
|
|
@@ -33,20 +31,11 @@ exports.HYPE_TOKEN_DETAILS = {
|
|
|
33
31
|
SYMBOL: "HYPE",
|
|
34
32
|
LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
|
|
35
33
|
};
|
|
36
|
-
function generateEncodedDataForDepositHype(amount, beneficiary) {
|
|
37
|
-
(0, invariant_1.default)(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
38
|
-
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
39
|
-
abi: escrow_1.ESCROW_ABI,
|
|
40
|
-
functionName: "depositFor",
|
|
41
|
-
args: [beneficiary, anyspend_1.B3_TOKEN.address, BigInt(amount)],
|
|
42
|
-
});
|
|
43
|
-
return encodedData;
|
|
44
|
-
}
|
|
45
34
|
function AnySpendDepositHype(props) {
|
|
46
35
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
47
36
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendDepositHypeInner, { ...props }) }));
|
|
48
37
|
}
|
|
49
|
-
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess,
|
|
38
|
+
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, }) {
|
|
50
39
|
// Use shared flow hook
|
|
51
40
|
const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = (0, useAnyspendFlow_1.useAnyspendFlow)({
|
|
52
41
|
paymentType,
|
|
@@ -139,28 +128,17 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
139
128
|
try {
|
|
140
129
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
141
130
|
(0, invariant_1.default)(selectedRecipientAddress, "Recipient address is not found");
|
|
142
|
-
(0, invariant_1.default)(depositContractAddress, "Deposit contract address is not found");
|
|
143
131
|
const srcAmountBigInt = BigInt(activeInputAmountInWei);
|
|
144
|
-
// TODO: temp subtract 3% for slippage
|
|
145
|
-
const originalDepositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
146
|
-
const depositAmountWei = ((BigInt(originalDepositAmountWei) * BigInt(100 - SLIPPAGE_PERCENT)) /
|
|
147
|
-
BigInt(100)).toString();
|
|
148
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
149
132
|
createOrder({
|
|
150
133
|
recipientAddress: selectedRecipientAddress,
|
|
151
|
-
orderType: "
|
|
134
|
+
orderType: "hype_duel",
|
|
152
135
|
srcChain: selectedSrcChainId,
|
|
153
136
|
dstChain: chains_1.base.id,
|
|
154
137
|
srcToken: selectedSrcToken,
|
|
155
138
|
dstToken: anyspend_1.B3_TOKEN,
|
|
156
139
|
srcAmount: srcAmountBigInt.toString(),
|
|
140
|
+
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
157
141
|
creatorAddress: globalAddress,
|
|
158
|
-
payload: {
|
|
159
|
-
amount: depositAmountWei,
|
|
160
|
-
data: encodedData,
|
|
161
|
-
to: depositContractAddress,
|
|
162
|
-
action: anyspend_1.DEPOSIT_HYPE_ACTION,
|
|
163
|
-
},
|
|
164
142
|
});
|
|
165
143
|
}
|
|
166
144
|
catch (err) {
|
|
@@ -173,7 +151,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
173
151
|
try {
|
|
174
152
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
175
153
|
(0, invariant_1.default)(selectedRecipientAddress, "Recipient address is not found");
|
|
176
|
-
(0, invariant_1.default)(depositContractAddress, "Deposit contract address is not found");
|
|
177
154
|
if (!srcAmount || parseFloat(srcAmount) <= 0) {
|
|
178
155
|
sonner_1.toast.error("Please enter a valid amount");
|
|
179
156
|
return;
|
|
@@ -201,11 +178,9 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
201
178
|
sonner_1.toast.error("Please select a payment method");
|
|
202
179
|
return;
|
|
203
180
|
}
|
|
204
|
-
const depositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
205
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
206
181
|
createOnrampOrder({
|
|
207
182
|
recipientAddress: selectedRecipientAddress,
|
|
208
|
-
orderType: "
|
|
183
|
+
orderType: "hype_duel",
|
|
209
184
|
dstChain: chains_1.base.id,
|
|
210
185
|
dstToken: anyspend_1.B3_TOKEN,
|
|
211
186
|
srcFiatAmount: srcAmount,
|
|
@@ -217,12 +192,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
217
192
|
},
|
|
218
193
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
219
194
|
creatorAddress: globalAddress,
|
|
220
|
-
payload: {
|
|
221
|
-
amount: depositAmountWei,
|
|
222
|
-
data: encodedData,
|
|
223
|
-
to: depositContractAddress,
|
|
224
|
-
action: anyspend_1.DEPOSIT_HYPE_ACTION,
|
|
225
|
-
},
|
|
226
195
|
});
|
|
227
196
|
}
|
|
228
197
|
catch (err) {
|
|
@@ -231,7 +200,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
231
200
|
}
|
|
232
201
|
};
|
|
233
202
|
// Order details view
|
|
234
|
-
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
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.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
235
204
|
setOrderId(undefined);
|
|
236
205
|
setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
|
|
237
206
|
}, disableUrlParamManagement: true })] })) }) }));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
interface InsufficientDepositPaymentProps {
|
|
3
|
+
order: components["schemas"]["Order"];
|
|
4
|
+
srcToken: components["schemas"]["Token"];
|
|
5
|
+
depositDeficit: bigint;
|
|
6
|
+
phantomWalletAddress: string | null;
|
|
7
|
+
txLoading: boolean;
|
|
8
|
+
isSwitchingOrExecuting: boolean;
|
|
9
|
+
onPayment: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function InsufficientDepositPayment({ order, srcToken, depositDeficit, phantomWalletAddress, txLoading, isSwitchingOrExecuting, onPayment, }: InsufficientDepositPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InsufficientDepositPayment = InsufficientDepositPayment;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
7
|
+
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const utils_1 = require("../../../../shared/utils");
|
|
9
|
+
const chains_1 = require("viem/chains");
|
|
10
|
+
const number_1 = require("../../../../shared/utils/number");
|
|
11
|
+
const react_2 = require("@web3icons/react");
|
|
12
|
+
const lucide_react_1 = require("lucide-react");
|
|
13
|
+
const react_3 = require("motion/react");
|
|
14
|
+
const qrcode_react_1 = require("qrcode.react");
|
|
15
|
+
const sonner_1 = require("sonner");
|
|
16
|
+
function InsufficientDepositPayment({ order, srcToken, depositDeficit, phantomWalletAddress, txLoading, isSwitchingOrExecuting, onPayment, }) {
|
|
17
|
+
const depositDeficitAmount = (0, number_1.formatUnits)(depositDeficit.toString(), srcToken.decimals);
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "insufficient-deposit-payment relative flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "insufficient-deposit-payment-text text-as-primary/50", children: "Please send remaining" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0", children: [(0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: depositDeficitAmount, onCopy: () => {
|
|
19
|
+
sonner_1.toast.success("Copied to clipboard");
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl", children: [depositDeficitAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), (0, jsx_runtime_1.jsxs)(react_1.Badge, { variant: "outline", className: "flex h-10 items-center gap-2 px-3 py-1 pr-2 text-sm", children: ["on ", (0, anyspend_1.getChainName)(order.srcChain), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") })] })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 mb-1 mt-2", children: " to the address:" })] }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: order.globalAddress, onCopy: () => {
|
|
21
|
+
sonner_1.toast.success("Copied to clipboard");
|
|
22
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "payment-address bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "payment-buttons mt-4 flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Transaction Pending", (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
23
|
+
? "Pay from Phantom Wallet"
|
|
24
|
+
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.jsx)("div", { children: "Or" }), (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: "qr-code flex flex-col items-center rounded-lg pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_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" })] })] })] }) })] })] }));
|
|
25
|
+
}
|
|
@@ -3,10 +3,10 @@ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
|
3
3
|
interface OrderDetailsProps {
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
order: components["schemas"]["Order"];
|
|
6
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
7
|
-
|
|
6
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
7
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
8
8
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
9
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
9
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
10
10
|
cryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
11
11
|
onBack?: () => void;
|
|
12
12
|
disableUrlParamManagement?: boolean;
|
|
@@ -27,6 +27,7 @@ const wagmi_1 = require("wagmi");
|
|
|
27
27
|
const Accordion_1 = require("./Accordion");
|
|
28
28
|
const ConnectWalletPayment_1 = __importDefault(require("./ConnectWalletPayment"));
|
|
29
29
|
const CryptoPaymentMethod_1 = require("./CryptoPaymentMethod");
|
|
30
|
+
const InsufficientDepositPayment_1 = require("./InsufficientDepositPayment");
|
|
30
31
|
const OrderDetailsCollapsible_1 = require("./OrderDetailsCollapsible");
|
|
31
32
|
const PaymentVendorUI_1 = __importDefault(require("./PaymentVendorUI"));
|
|
32
33
|
const TransferCryptoDetails_1 = require("./TransferCryptoDetails");
|
|
@@ -53,6 +54,9 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, dstT
|
|
|
53
54
|
}
|
|
54
55
|
actionText = order.metadata.action || `executed contract`;
|
|
55
56
|
return `Successfully ${actionText}`;
|
|
57
|
+
case "hype_duel":
|
|
58
|
+
actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
|
|
59
|
+
return `Successfully ${actionText} to ${recipient}`;
|
|
56
60
|
default:
|
|
57
61
|
throw new Error("Invalid order type");
|
|
58
62
|
}
|
|
@@ -129,7 +133,7 @@ function roundTokenAmount(amount) {
|
|
|
129
133
|
const roundedDecimalPart = digits.join("");
|
|
130
134
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
131
135
|
}
|
|
132
|
-
exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal", order, depositTxs,
|
|
136
|
+
exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, onBack, disableUrlParamManagement = false, }) {
|
|
133
137
|
const router = (0, hooks_1.useRouter)();
|
|
134
138
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
135
139
|
// Get theme from B3Provider context
|
|
@@ -159,22 +163,37 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
159
163
|
: undefined;
|
|
160
164
|
return roundTokenAmount(formattedSrcAmount);
|
|
161
165
|
}, [order.srcAmount, srcToken]);
|
|
166
|
+
// Calculate deposit amounts - moved here to be used in useCallback hooks
|
|
167
|
+
const depositedAmount = (0, react_4.useMemo)(() => {
|
|
168
|
+
return depositTxs ? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0)) : BigInt(0);
|
|
169
|
+
}, [depositTxs]);
|
|
170
|
+
const depositDeficit = (0, react_4.useMemo)(() => {
|
|
171
|
+
return BigInt(order.srcAmount) - depositedAmount;
|
|
172
|
+
}, [order.srcAmount, depositedAmount]);
|
|
173
|
+
const depositEnoughAmount = (0, react_4.useMemo)(() => {
|
|
174
|
+
return depositDeficit <= BigInt(0);
|
|
175
|
+
}, [depositDeficit]);
|
|
176
|
+
const formattedDepositDeficit = (0, react_4.useMemo)(() => {
|
|
177
|
+
return (0, number_1.formatTokenAmount)(BigInt(depositDeficit), srcToken.decimals);
|
|
178
|
+
}, [depositDeficit, srcToken.decimals]);
|
|
162
179
|
// Unified payment handler for both EOA and AA wallets
|
|
163
180
|
const handleUnifiedPaymentProcess = (0, react_4.useCallback)(async () => {
|
|
164
181
|
let txData;
|
|
165
182
|
let value;
|
|
166
183
|
let to;
|
|
184
|
+
// Use the existing depositDeficit calculation to determine amount to send
|
|
185
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit : BigInt(order.srcAmount);
|
|
167
186
|
if ((0, anyspend_1.isNativeToken)(order.srcTokenAddress)) {
|
|
168
187
|
// Native token transfer
|
|
169
188
|
to = order.globalAddress;
|
|
170
|
-
value =
|
|
189
|
+
value = amountToSend;
|
|
171
190
|
}
|
|
172
191
|
else {
|
|
173
192
|
// ERC20 token transfer - encode the transfer function call using proper ABI
|
|
174
193
|
txData = (0, viem_1.encodeFunctionData)({
|
|
175
194
|
abi: viem_1.erc20Abi,
|
|
176
195
|
functionName: "transfer",
|
|
177
|
-
args: [order.globalAddress,
|
|
196
|
+
args: [order.globalAddress, amountToSend],
|
|
178
197
|
});
|
|
179
198
|
to = order.srcTokenAddress;
|
|
180
199
|
value = BigInt(0);
|
|
@@ -183,12 +202,14 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
183
202
|
if (txHash) {
|
|
184
203
|
setTxHash(txHash);
|
|
185
204
|
}
|
|
186
|
-
}, [order, switchChainAndExecuteWithEOA]);
|
|
205
|
+
}, [order, switchChainAndExecuteWithEOA, depositDeficit]);
|
|
187
206
|
// Main payment handler that triggers chain switch and payment
|
|
188
207
|
const handlePayment = async () => {
|
|
189
208
|
console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
|
|
190
209
|
if (order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
191
|
-
|
|
210
|
+
// Use the existing depositDeficit calculation to determine amount to send
|
|
211
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
212
|
+
await initiatePhantomTransfer(amountToSend, order.srcTokenAddress, order.globalAddress);
|
|
192
213
|
}
|
|
193
214
|
else {
|
|
194
215
|
// Use unified payment process for both EOA and AA wallets
|
|
@@ -261,12 +282,6 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
261
282
|
const formattedActualDstAmount = actualDstAmount
|
|
262
283
|
? (0, number_1.formatTokenAmount)(BigInt(actualDstAmount), dstToken.decimals)
|
|
263
284
|
: undefined;
|
|
264
|
-
const depositedAmount = depositTxs
|
|
265
|
-
? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0))
|
|
266
|
-
: BigInt(0);
|
|
267
|
-
const depositDeficit = BigInt(order.srcAmount) - depositedAmount;
|
|
268
|
-
const depositEnoughAmount = depositDeficit <= BigInt(0);
|
|
269
|
-
const formattedDepositDeficit = (0, number_1.formatTokenAmount)(BigInt(depositDeficit), srcToken.decimals);
|
|
270
285
|
const { text: statusText, status: statusDisplay } = (0, anyspend_1.getStatusDisplay)(order);
|
|
271
286
|
const initiatePhantomTransfer = async (amountLamports, tokenAddress, recipientAddress) => {
|
|
272
287
|
try {
|
|
@@ -399,7 +414,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
399
414
|
}
|
|
400
415
|
}
|
|
401
416
|
};
|
|
402
|
-
if (refundTxs) {
|
|
417
|
+
if (refundTxs.length > 0) {
|
|
403
418
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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: "w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "refund-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "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
|
|
404
419
|
? depositTxs.map(dTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
405
420
|
? `Received payment`
|
|
@@ -413,7 +428,9 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
413
428
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
414
429
|
? `Received payment`
|
|
415
430
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
416
|
-
: null,
|
|
431
|
+
: null, relayTxs
|
|
432
|
+
? relayTxs.map(relayTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, tx: relayTx, delay: 0.5, isProcessing: false }, relayTx.txHash)))
|
|
433
|
+
: null, (0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.type === "swap"
|
|
417
434
|
? "Processed Swap"
|
|
418
435
|
: order.type === "mint_nft"
|
|
419
436
|
? "Minted NFT"
|
|
@@ -430,35 +447,22 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
430
447
|
centerTruncate: centerTruncate_1.default,
|
|
431
448
|
}), (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 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") }))] }));
|
|
432
449
|
}
|
|
433
|
-
if (
|
|
450
|
+
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
434
451
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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: "w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "more-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "More Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "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
|
|
435
452
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
436
453
|
? `Received payment`
|
|
437
454
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
438
|
-
: null,
|
|
439
|
-
? "
|
|
455
|
+
: null, relayTxs.map(relayTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, isProcessing: false, tx: relayTx, delay: 0.5 }))), order.status === "executing" && ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.type === "swap"
|
|
456
|
+
? "Processing Swap"
|
|
440
457
|
: order.type === "mint_nft"
|
|
441
|
-
? "
|
|
458
|
+
? "Minting NFT"
|
|
442
459
|
: order.type === "join_tournament"
|
|
443
|
-
? "
|
|
460
|
+
? "Joining Tournament"
|
|
444
461
|
: order.type === "fund_tournament"
|
|
445
|
-
? "
|
|
446
|
-
:
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
? "Minting NFT"
|
|
450
|
-
: order.type === "join_tournament"
|
|
451
|
-
? "Joining Tournament"
|
|
452
|
-
: order.type === "fund_tournament"
|
|
453
|
-
? "Funding Tournament"
|
|
454
|
-
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: executeTx, delay: 1 })] }))] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-8", children: (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "link", asChild: true, children: (0, jsx_runtime_1.jsxs)("a", { href: (0, anyspend_1.getExplorerTxUrl)(order.dstChain, relayTx.txHash), target: "_blank", className: "order-success-text text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
|
|
455
|
-
order,
|
|
456
|
-
tournament,
|
|
457
|
-
formattedActualDstAmount,
|
|
458
|
-
dstToken,
|
|
459
|
-
recipientName,
|
|
460
|
-
centerTruncate: centerTruncate_1.default,
|
|
461
|
-
}), (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 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") }))] }));
|
|
462
|
+
? "Funding Tournament"
|
|
463
|
+
: order.type === "hype_duel"
|
|
464
|
+
? "Depositing Hype Duel"
|
|
465
|
+
: "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: null, delay: 1 }))] }) })] }) }), 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 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") }))] }));
|
|
462
466
|
}
|
|
463
467
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
464
468
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
@@ -475,7 +479,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
475
479
|
? "Funding Tournament"
|
|
476
480
|
: "Processing Transaction", chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 })) : ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
477
481
|
? `Waiting for payment`
|
|
478
|
-
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) })] }));
|
|
482
|
+
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) }), !depositEnoughAmount && order.status !== "expired" && ((0, jsx_runtime_1.jsx)(InsufficientDepositPayment_1.InsufficientDepositPayment, { order: order, srcToken: srcToken, depositDeficit: depositDeficit, phantomWalletAddress: phantomWalletAddress, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, onPayment: handlePayment }))] }));
|
|
479
483
|
}
|
|
480
484
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ? ((0, jsx_runtime_1.jsx)(ConnectWalletPayment_1.default, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
481
485
|
// Transfer Crypto Payment Method - Show new card-based UI
|
|
@@ -32,7 +32,7 @@ exports.OrderStatus = (0, react_2.memo)(function OrderStatus({ order, selectedCr
|
|
|
32
32
|
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
if (["relay", "sending_token_from_vault"].includes(order.status)) {
|
|
35
|
+
if (["relay", "executing", "sending_token_from_vault"].includes(order.status)) {
|
|
36
36
|
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
|
|
37
37
|
}
|
|
38
38
|
if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
|
|
@@ -31,10 +31,10 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
31
31
|
message: string;
|
|
32
32
|
data: {
|
|
33
33
|
order: components["schemas"]["Order"];
|
|
34
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
35
|
-
|
|
34
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
35
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
36
36
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
37
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
37
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
38
38
|
};
|
|
39
39
|
statusCode: number;
|
|
40
40
|
} | undefined;
|
|
@@ -4,10 +4,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
|
|
|
4
4
|
message: string;
|
|
5
5
|
data: {
|
|
6
6
|
order: import("../..").components["schemas"]["Order"];
|
|
7
|
-
depositTxs: import("../..").components["schemas"]["DepositTx"][]
|
|
8
|
-
|
|
7
|
+
depositTxs: import("../..").components["schemas"]["DepositTx"][];
|
|
8
|
+
relayTxs: import("../..").components["schemas"]["RelayTx"][];
|
|
9
9
|
executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
|
|
10
|
-
refundTxs: import("../..").components["schemas"]["RefundTx"][]
|
|
10
|
+
refundTxs: import("../..").components["schemas"]["RefundTx"][];
|
|
11
11
|
};
|
|
12
12
|
statusCode: number;
|
|
13
13
|
} | undefined;
|
|
@@ -18,10 +18,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
|
|
|
18
18
|
message: string;
|
|
19
19
|
data: {
|
|
20
20
|
order: import("../..").components["schemas"]["Order"];
|
|
21
|
-
depositTxs: import("../..").components["schemas"]["DepositTx"][]
|
|
22
|
-
|
|
21
|
+
depositTxs: import("../..").components["schemas"]["DepositTx"][];
|
|
22
|
+
relayTxs: import("../..").components["schemas"]["RelayTx"][];
|
|
23
23
|
executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
|
|
24
|
-
refundTxs: import("../..").components["schemas"]["RefundTx"][]
|
|
24
|
+
refundTxs: import("../..").components["schemas"]["RefundTx"][];
|
|
25
25
|
};
|
|
26
26
|
statusCode: number;
|
|
27
27
|
}, Error>>;
|
|
@@ -8,7 +8,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
8
8
|
srcTokenAddress: string;
|
|
9
9
|
dstTokenAddress: string;
|
|
10
10
|
srcAmount: string;
|
|
11
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
11
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
12
12
|
errorDetails: string | null;
|
|
13
13
|
createdAt: number;
|
|
14
14
|
expiredAt: number;
|
|
@@ -30,7 +30,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
30
30
|
srcTokenAddress: string;
|
|
31
31
|
dstTokenAddress: string;
|
|
32
32
|
srcAmount: string;
|
|
33
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
33
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
34
|
+
errorDetails: string | null;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
expiredAt: number;
|
|
37
|
+
creatorAddress: string | null;
|
|
38
|
+
partnerId: string | null;
|
|
39
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
40
|
+
oneClickBuyUrl: string | null;
|
|
41
|
+
stripePaymentIntentId: string | null;
|
|
42
|
+
} & {
|
|
43
|
+
type: "hype_duel";
|
|
44
|
+
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
45
|
+
metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
|
|
46
|
+
}) | ({
|
|
47
|
+
id: string;
|
|
48
|
+
recipientAddress: string;
|
|
49
|
+
globalAddress: string;
|
|
50
|
+
srcChain: number;
|
|
51
|
+
dstChain: number;
|
|
52
|
+
srcTokenAddress: string;
|
|
53
|
+
dstTokenAddress: string;
|
|
54
|
+
srcAmount: string;
|
|
55
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
34
56
|
errorDetails: string | null;
|
|
35
57
|
createdAt: number;
|
|
36
58
|
expiredAt: number;
|
|
@@ -52,7 +74,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
52
74
|
srcTokenAddress: string;
|
|
53
75
|
dstTokenAddress: string;
|
|
54
76
|
srcAmount: string;
|
|
55
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
77
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
56
78
|
errorDetails: string | null;
|
|
57
79
|
createdAt: number;
|
|
58
80
|
expiredAt: number;
|
|
@@ -74,7 +96,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
74
96
|
srcTokenAddress: string;
|
|
75
97
|
dstTokenAddress: string;
|
|
76
98
|
srcAmount: string;
|
|
77
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
99
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
78
100
|
errorDetails: string | null;
|
|
79
101
|
createdAt: number;
|
|
80
102
|
expiredAt: number;
|
|
@@ -96,7 +118,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
96
118
|
srcTokenAddress: string;
|
|
97
119
|
dstTokenAddress: string;
|
|
98
120
|
srcAmount: string;
|
|
99
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
121
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
100
122
|
errorDetails: string | null;
|
|
101
123
|
createdAt: number;
|
|
102
124
|
expiredAt: number;
|
|
@@ -121,7 +143,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
121
143
|
srcTokenAddress: string;
|
|
122
144
|
dstTokenAddress: string;
|
|
123
145
|
srcAmount: string;
|
|
124
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
146
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
125
147
|
errorDetails: string | null;
|
|
126
148
|
createdAt: number;
|
|
127
149
|
expiredAt: number;
|
|
@@ -143,7 +165,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
143
165
|
srcTokenAddress: string;
|
|
144
166
|
dstTokenAddress: string;
|
|
145
167
|
srcAmount: string;
|
|
146
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
168
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
169
|
+
errorDetails: string | null;
|
|
170
|
+
createdAt: number;
|
|
171
|
+
expiredAt: number;
|
|
172
|
+
creatorAddress: string | null;
|
|
173
|
+
partnerId: string | null;
|
|
174
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
175
|
+
oneClickBuyUrl: string | null;
|
|
176
|
+
stripePaymentIntentId: string | null;
|
|
177
|
+
} & {
|
|
178
|
+
type: "hype_duel";
|
|
179
|
+
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
180
|
+
metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
|
|
181
|
+
}) | ({
|
|
182
|
+
id: string;
|
|
183
|
+
recipientAddress: string;
|
|
184
|
+
globalAddress: string;
|
|
185
|
+
srcChain: number;
|
|
186
|
+
dstChain: number;
|
|
187
|
+
srcTokenAddress: string;
|
|
188
|
+
dstTokenAddress: string;
|
|
189
|
+
srcAmount: string;
|
|
190
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
147
191
|
errorDetails: string | null;
|
|
148
192
|
createdAt: number;
|
|
149
193
|
expiredAt: number;
|
|
@@ -165,7 +209,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
165
209
|
srcTokenAddress: string;
|
|
166
210
|
dstTokenAddress: string;
|
|
167
211
|
srcAmount: string;
|
|
168
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
212
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
169
213
|
errorDetails: string | null;
|
|
170
214
|
createdAt: number;
|
|
171
215
|
expiredAt: number;
|
|
@@ -187,7 +231,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
187
231
|
srcTokenAddress: string;
|
|
188
232
|
dstTokenAddress: string;
|
|
189
233
|
srcAmount: string;
|
|
190
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
234
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
191
235
|
errorDetails: string | null;
|
|
192
236
|
createdAt: number;
|
|
193
237
|
expiredAt: number;
|
|
@@ -209,7 +253,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
209
253
|
srcTokenAddress: string;
|
|
210
254
|
dstTokenAddress: string;
|
|
211
255
|
srcAmount: string;
|
|
212
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
256
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
213
257
|
errorDetails: string | null;
|
|
214
258
|
createdAt: number;
|
|
215
259
|
expiredAt: number;
|