@b3dotfun/sdk 0.0.16 → 0.0.17-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +264 -55
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +25 -29
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +15 -0
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +49 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +20 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +118 -0
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +15 -0
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +71 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +41 -60
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +18 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +42 -0
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +28 -5
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.d.ts +13 -0
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +50 -0
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.d.ts +16 -0
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +63 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +11 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +53 -15
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -12
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -12
- package/dist/cjs/anyspend/react/components/common/StepProgress.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +22 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +16 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +73 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/index.js +7 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -10
- package/dist/cjs/anyspend/utils/format.d.ts +1 -0
- package/dist/cjs/anyspend/utils/format.js +23 -10
- package/dist/cjs/anyspend/utils/number.d.ts +7 -0
- package/dist/cjs/anyspend/utils/number.js +18 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -2
- package/dist/esm/anyspend/react/components/AnySpend.js +266 -57
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +27 -31
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +15 -0
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +46 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +20 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +114 -0
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +15 -0
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +67 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +43 -62
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +18 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +36 -0
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +27 -4
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.d.ts +13 -0
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +47 -0
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.d.ts +16 -0
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +60 -0
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +11 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +54 -16
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -12
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +7 -15
- package/dist/esm/anyspend/react/components/common/StepProgress.d.ts +11 -0
- package/dist/esm/anyspend/react/components/common/StepProgress.js +19 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +16 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +70 -0
- package/dist/esm/anyspend/react/components/index.d.ts +3 -0
- package/dist/esm/anyspend/react/components/index.js +3 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -10
- package/dist/esm/anyspend/utils/format.d.ts +1 -0
- package/dist/esm/anyspend/utils/format.js +23 -10
- package/dist/esm/anyspend/utils/number.d.ts +7 -0
- package/dist/esm/anyspend/utils/number.js +17 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -2
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +15 -0
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +20 -0
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +15 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +18 -0
- package/dist/types/anyspend/react/components/common/OrderTokenAmountFiat.d.ts +13 -0
- package/dist/types/anyspend/react/components/common/OrderTokenAmountNew.d.ts +16 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +11 -1
- package/dist/types/anyspend/react/components/common/StepProgress.d.ts +11 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +16 -0
- package/dist/types/anyspend/react/components/index.d.ts +3 -0
- package/dist/types/anyspend/utils/format.d.ts +1 -0
- package/dist/types/anyspend/utils/number.d.ts +7 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +535 -177
- package/src/anyspend/react/components/AnySpendCustom.tsx +33 -38
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +124 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +227 -0
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +173 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +123 -250
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +156 -0
- package/src/anyspend/react/components/common/OrderStatus.tsx +47 -24
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +147 -0
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +215 -0
- package/src/anyspend/react/components/common/PanelOnramp.tsx +215 -62
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -14
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +42 -99
- package/src/anyspend/react/components/common/StepProgress.tsx +104 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +261 -0
- package/src/anyspend/react/components/index.ts +3 -0
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +1 -11
- package/src/anyspend/utils/format.ts +24 -11
- package/src/anyspend/utils/number.ts +18 -0
- package/src/styles/index.css +30 -11
|
@@ -25,7 +25,11 @@ const sonner_1 = require("sonner");
|
|
|
25
25
|
const viem_1 = require("viem");
|
|
26
26
|
const chains_1 = require("viem/chains");
|
|
27
27
|
const wagmi_1 = require("wagmi");
|
|
28
|
+
const ConnectWalletPayment_1 = __importDefault(require("./ConnectWalletPayment"));
|
|
29
|
+
const CryptoPaymentMethod_1 = require("./CryptoPaymentMethod");
|
|
30
|
+
const OrderDetailsCollapsible_1 = require("./OrderDetailsCollapsible");
|
|
28
31
|
const PaymentVendorUI_1 = __importDefault(require("./PaymentVendorUI"));
|
|
32
|
+
const TransferCryptoDetails_1 = require("./TransferCryptoDetails");
|
|
29
33
|
// Add this helper function near the top or just above the component
|
|
30
34
|
function getOrderSuccessText({ order, tournament, formattedActualDstAmount, dstToken, recipientName, centerTruncate, }) {
|
|
31
35
|
const recipient = recipientName || centerTruncate(order.recipientAddress, 8);
|
|
@@ -122,10 +126,13 @@ function roundTokenAmount(amount) {
|
|
|
122
126
|
const roundedDecimalPart = digits.join("");
|
|
123
127
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
124
128
|
}
|
|
125
|
-
exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, onBack, }) {
|
|
129
|
+
exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, paymentMethod = CryptoPaymentMethod_1.PaymentMethod.NONE, onBack, }) {
|
|
126
130
|
const router = (0, hooks_1.useRouter)();
|
|
127
131
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
128
|
-
|
|
132
|
+
// Read payment method from URL parameters
|
|
133
|
+
const paymentMethodFromUrl = searchParams.get("paymentMethod");
|
|
134
|
+
const effectivePaymentMethod = paymentMethodFromUrl || paymentMethod || CryptoPaymentMethod_1.PaymentMethod.NONE;
|
|
135
|
+
const setB3ModalOpen = (0, react_1.useModalStore)((state) => state.setB3ModalOpen);
|
|
129
136
|
const srcToken = order.metadata.srcToken;
|
|
130
137
|
const dstToken = order.metadata.dstToken;
|
|
131
138
|
const nft = order.type === "mint_nft" ? order.metadata.nft : undefined;
|
|
@@ -155,6 +162,10 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
155
162
|
}
|
|
156
163
|
console.log("Processing transaction on chain:", currentWalletClient.chain.id);
|
|
157
164
|
const signer = currentWalletClient.account;
|
|
165
|
+
if (!signer) {
|
|
166
|
+
sonner_1.toast.error("No account connected");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
158
169
|
// Send transaction
|
|
159
170
|
if ((0, anyspend_1.isNativeToken)(order.srcTokenAddress)) {
|
|
160
171
|
const hash = await currentWalletClient.sendTransaction({
|
|
@@ -198,6 +209,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
198
209
|
const params = new URLSearchParams(searchParams.toString());
|
|
199
210
|
params.delete("waitingForDeposit");
|
|
200
211
|
params.delete("orderId");
|
|
212
|
+
params.delete("paymentMethod");
|
|
201
213
|
// Only update URL if params were actually removed
|
|
202
214
|
if (params.toString() !== searchParams.toString()) {
|
|
203
215
|
router.push(`?${params}`);
|
|
@@ -219,7 +231,6 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
219
231
|
setTxHash(undefined);
|
|
220
232
|
}
|
|
221
233
|
}, [setWaitingForDeposit, txSuccess]);
|
|
222
|
-
const [showOrderDetails, setShowOrderDetails] = (0, react_5.useState)(false);
|
|
223
234
|
const isPhantomMobile = (0, react_5.useMemo)(() => navigator.userAgent.includes("Phantom"), []);
|
|
224
235
|
const isPhantomBrowser = (0, react_5.useMemo)(() => window.phantom?.solana?.isPhantom, []);
|
|
225
236
|
// Get connected Phantom wallet address if available
|
|
@@ -256,13 +267,6 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
256
267
|
const depositEnoughAmount = depositDeficit <= BigInt(0);
|
|
257
268
|
const formattedDepositDeficit = (0, number_1.formatTokenAmount)(BigInt(depositDeficit), srcToken.decimals);
|
|
258
269
|
const { text: statusText, status: statusDisplay } = (0, anyspend_1.getStatusDisplay)(order);
|
|
259
|
-
const permalink = window.location.origin === "https://basement.fun"
|
|
260
|
-
? window.location.origin + "/deposit/" + order.id
|
|
261
|
-
: window.location.origin + "?orderId=" + order.id;
|
|
262
|
-
const handleCoinbaseRedirect = () => {
|
|
263
|
-
const coinbaseUrl = `https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(permalink)}`;
|
|
264
|
-
return coinbaseUrl;
|
|
265
|
-
};
|
|
266
270
|
const initiatePhantomTransfer = async (amountLamports, tokenAddress, recipientAddress) => {
|
|
267
271
|
try {
|
|
268
272
|
if (!isPhantomBrowser && !isPhantomMobile) {
|
|
@@ -401,7 +405,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
401
405
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
402
406
|
: null, refundTxs
|
|
403
407
|
? refundTxs.map(rTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: `Refunded ${(0, number_1.formatTokenAmount)(BigInt(rTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: rTx, isProcessing: false }, rTx.txHash)))
|
|
404
|
-
: 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: "bg-as-
|
|
408
|
+
: 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: "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") })] }));
|
|
405
409
|
}
|
|
406
410
|
if (executeTx) {
|
|
407
411
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mt-4 flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.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.5, ease: "easeInOut" } }) }), depositTxs
|
|
@@ -423,10 +427,10 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
423
427
|
dstToken,
|
|
424
428
|
recipientName,
|
|
425
429
|
centerTruncate: centerTruncate_1.default,
|
|
426
|
-
}), (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: "bg-as-
|
|
430
|
+
}), (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: "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
431
|
}
|
|
428
432
|
if (relayTx && relayTx.status === "success") {
|
|
429
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative mt-4 flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.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.5, ease: "easeInOut" } }) }), depositTxs
|
|
433
|
+
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.jsxs)("div", { className: "relative mt-4 flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.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.5, ease: "easeInOut" } }) }), depositTxs
|
|
430
434
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
431
435
|
? `Received payment`
|
|
432
436
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
@@ -453,61 +457,38 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
453
457
|
dstToken,
|
|
454
458
|
recipientName,
|
|
455
459
|
centerTruncate: centerTruncate_1.default,
|
|
456
|
-
}), (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: "bg-as-
|
|
460
|
+
}), (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: "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") }))] }));
|
|
457
461
|
}
|
|
458
462
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
459
463
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
460
464
|
if (depositTxs?.length || waitingForDeposit) {
|
|
461
|
-
return ((0, jsx_runtime_1.
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
465
|
+
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.jsxs)("div", { className: "relative mt-4 flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_4.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"
|
|
466
|
+
? `Received payment`
|
|
467
|
+
: `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"
|
|
468
|
+
? "Processing Swap"
|
|
469
|
+
: order.type === "mint_nft"
|
|
470
|
+
? "Minting NFT"
|
|
471
|
+
: order.type === "join_tournament"
|
|
472
|
+
? "Joining Tournament"
|
|
473
|
+
: order.type === "fund_tournament"
|
|
474
|
+
? "Funding Tournament"
|
|
475
|
+
: "Processing Transaction", chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 })) : ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
476
|
+
? `Waiting for payment`
|
|
477
|
+
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] })] }));
|
|
474
478
|
}
|
|
475
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [statusDisplay === "
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
479
|
+
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, { isMainnet: isMainnet, order: order, dstTokenSymbol: dstToken.symbol })) : effectivePaymentMethod === CryptoPaymentMethod_1.PaymentMethod.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 })) : effectivePaymentMethod === CryptoPaymentMethod_1.PaymentMethod.TRANSFER_CRYPTO ? (
|
|
480
|
+
// Transfer Crypto Payment Method - Show new card-based UI
|
|
481
|
+
(0, jsx_runtime_1.jsx)(TransferCryptoDetails_1.TransferCryptoDetails, { order: order, recipientName: recipientName, srcToken: srcToken, dstToken: dstToken, tournament: tournament, nft: nft, onBack: handleBack })) : ((0, jsx_runtime_1.jsxs)("div", { className: "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: "text-as-primary/50", children: "Please send" }), (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: roundedUpSrcAmount, onCopy: () => {
|
|
482
|
+
sonner_1.toast.success("Copied to clipboard");
|
|
483
|
+
}, 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: [roundedUpSrcAmount, " ", 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: () => {
|
|
484
|
+
sonner_1.toast.success("Copied to clipboard");
|
|
485
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "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" })] }) }), (account?.address || phantomWalletAddress) && !showQRCode ? ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 mt-8 flex w-full flex-col items-center gap-4", children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative 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 items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: handlePayment, 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: "pl-4 text-lg md:text-sm", children: order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
480
486
|
? "Pay from Phantom Wallet"
|
|
481
487
|
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.jsxs)("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
482
488
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
483
|
-
: (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_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.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" })] })] })] })
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
if (navigator.share) {
|
|
487
|
-
navigator
|
|
488
|
-
.share({
|
|
489
|
-
title: "Complete Deposit",
|
|
490
|
-
text: "Complete your deposit on BSMNT.fun",
|
|
491
|
-
url: permalink,
|
|
492
|
-
})
|
|
493
|
-
.catch(error => console.log("Error sharing:", error));
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
sonner_1.toast.error("Web Share API is not supported on this browser");
|
|
497
|
-
}
|
|
498
|
-
}, children: ["Send Link ", (0, jsx_runtime_1.jsx)(lucide_react_1.SquareArrowOutUpRight, { className: "ml-2 h-3 w-3" })] })] })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), showOrderDetails ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "w-full", initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: order.type === "swap" || order.type === "mint_nft"
|
|
499
|
-
? "Expected to receive"
|
|
500
|
-
: order.type === "join_tournament"
|
|
501
|
-
? "Join tournament"
|
|
502
|
-
: order.type === "fund_tournament"
|
|
503
|
-
? "Fund tournament"
|
|
504
|
-
: order.type === "custom"
|
|
505
|
-
? order.metadata.action
|
|
506
|
-
? (0, anyspend_1.capitalizeFirstLetter)(order.metadata.action)
|
|
507
|
-
: "Contract execution"
|
|
508
|
-
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-end gap-2", children: [order.type === "swap" ? (`~${formattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { children: tournament?.name || "Tournament" })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { 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)("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: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: order.id })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-1", children: [recipientName && (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: recipientName }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: order.recipientAddress, onCopy: () => {
|
|
509
|
-
sonner_1.toast.success("Copied recipient address to clipboard");
|
|
510
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary flex items-center gap-2", children: [(0, centerTruncate_1.default)(order.recipientAddress, 10), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" })] })), (0, jsx_runtime_1.jsxs)("button", { className: "bg-as-on-surface-2 text-as-secondary flex w-full items-center justify-center gap-2 rounded-lg p-2", onClick: handleBack, children: ["Cancel and start over ", (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" })] })] }));
|
|
489
|
+
: (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_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.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" })] })] })] }) })) : (
|
|
490
|
+
// Default case - existing QR code flow
|
|
491
|
+
(0, jsx_runtime_1.jsx)(react_4.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: "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 ? "ETH" : order.srcTokenAddress), 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_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", 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: "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"] })] }));
|
|
511
492
|
});
|
|
512
493
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
513
494
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-b3-react-background relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 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_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg shadow-purple-500/30 backdrop-blur-sm", style: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
type Order = components["schemas"]["Order"];
|
|
3
|
+
type Token = components["schemas"]["Token"];
|
|
4
|
+
type Tournament = components["schemas"]["Tournament"];
|
|
5
|
+
type NFT = components["schemas"]["NFT"];
|
|
6
|
+
interface OrderDetailsCollapsibleProps {
|
|
7
|
+
order: Order;
|
|
8
|
+
dstToken: Token;
|
|
9
|
+
tournament?: Tournament;
|
|
10
|
+
nft?: NFT;
|
|
11
|
+
recipientName?: string;
|
|
12
|
+
formattedExpectedDstAmount?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
showTotal?: boolean;
|
|
15
|
+
totalAmount?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const OrderDetailsCollapsible: import("react").NamedExoticComponent<OrderDetailsCollapsibleProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.OrderDetailsCollapsible = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
10
|
+
const react_1 = require("../../../../global-account/react");
|
|
11
|
+
const utils_1 = require("../../../../shared/utils");
|
|
12
|
+
const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
|
|
13
|
+
const number_1 = require("../../../../shared/utils/number");
|
|
14
|
+
const lucide_react_1 = require("lucide-react");
|
|
15
|
+
const react_2 = require("motion/react");
|
|
16
|
+
const react_3 = require("react");
|
|
17
|
+
const sonner_1 = require("sonner");
|
|
18
|
+
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
|
+
const [showOrderDetails, setShowOrderDetails] = (0, react_3.useState)(true);
|
|
21
|
+
// Calculate expected amount if not provided
|
|
22
|
+
const expectedDstAmount = order.type === "mint_nft" ||
|
|
23
|
+
order.type === "join_tournament" ||
|
|
24
|
+
order.type === "fund_tournament" ||
|
|
25
|
+
order.type === "custom"
|
|
26
|
+
? "0"
|
|
27
|
+
: order.payload.expectedDstAmount.toString();
|
|
28
|
+
const finalFormattedExpectedDstAmount = formattedExpectedDstAmount || (0, number_1.formatTokenAmount)(BigInt(expectedDstAmount), dstToken.decimals);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2", className), children: showOrderDetails ? ((0, jsx_runtime_1.jsx)(react_2.motion.div, { className: "w-full", initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry", children: "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-1", children: [recipientName && (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: recipientName }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: order.recipientAddress, onCopy: () => {
|
|
30
|
+
sonner_1.toast.success("Copied recipient address to clipboard");
|
|
31
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary flex items-center gap-2", children: [(0, centerTruncate_1.default)(order.recipientAddress, 10), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" })] }) })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry", children: order.type === "swap" || order.type === "mint_nft"
|
|
32
|
+
? "Expected to receive"
|
|
33
|
+
: order.type === "join_tournament"
|
|
34
|
+
? "Join tournament"
|
|
35
|
+
: order.type === "fund_tournament"
|
|
36
|
+
? "Fund tournament"
|
|
37
|
+
: order.type === "custom"
|
|
38
|
+
? order.metadata.action
|
|
39
|
+
? (0, anyspend_1.capitalizeFirstLetter)(order.metadata.action)
|
|
40
|
+
: "Contract execution"
|
|
41
|
+
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { children: tournament?.name || "Tournament" })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { 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)("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: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" })] })) }));
|
|
42
|
+
});
|
|
@@ -3,11 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OrderStatus = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const anyspend_1 = require("../../../../anyspend");
|
|
6
|
-
const react_1 = require("../../../../global-account/react");
|
|
7
6
|
const lucide_react_1 = require("lucide-react");
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const StepProgress_1 = require("./StepProgress");
|
|
9
|
+
exports.OrderStatus = (0, react_1.memo)(function OrderStatus({ order }) {
|
|
10
10
|
const isComplete = order.status === "executed";
|
|
11
|
-
const { text, status: displayStatus } = (0, anyspend_1.getStatusDisplay)(order);
|
|
12
|
-
|
|
11
|
+
const { text, status: displayStatus, description } = (0, anyspend_1.getStatusDisplay)(order);
|
|
12
|
+
console.log("OrderStatus", displayStatus);
|
|
13
|
+
console.log("OrderStatus", order);
|
|
14
|
+
const paymentSteps = [
|
|
15
|
+
{
|
|
16
|
+
id: 1,
|
|
17
|
+
title: text,
|
|
18
|
+
description: description,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 2,
|
|
22
|
+
title: text,
|
|
23
|
+
description: description,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
if (order.status === "waiting_stripe_payment") {
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
|
|
28
|
+
}
|
|
29
|
+
if (order.status === "relay") {
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(StepProgress_1.StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
|
|
31
|
+
}
|
|
32
|
+
if (!isComplete && displayStatus !== "failure") {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center gap-2", children: isComplete ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: `bg-as-success-secondary relative flex h-10 w-10 items-center justify-center rounded-full`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "text-as-content-icon-success h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary mt-4 text-xl font-semibold", children: text }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry mt-1 text-center", children: description })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-error-secondary flex h-10 w-10 items-center justify-center rounded-full text-base", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "text-as-content-icon-error h-5 w-5" }) }), (0, jsx_runtime_1.jsx)("div", { className: "font-sf-rounded text-as-content-primary mt-4 text-lg font-semibold", children: text }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry text-center", style: { whiteSpace: "normal" }, children: description })] })) }));
|
|
13
36
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
export declare function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, className, }: {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
inputValue: string;
|
|
5
|
+
onChangeInput: (value: string) => void;
|
|
6
|
+
context: "from" | "to";
|
|
7
|
+
address: string | undefined;
|
|
8
|
+
token: components["schemas"]["Token"];
|
|
9
|
+
setToken: (token: components["schemas"]["Token"]) => void;
|
|
10
|
+
chainId: number;
|
|
11
|
+
setChainId: (chainId: number) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OrderTokenAmountFiat = OrderTokenAmountFiat;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const lucide_react_1 = require("lucide-react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_number_format_1 = require("react-number-format");
|
|
9
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
10
|
+
const utils_1 = require("../../../../shared/utils");
|
|
11
|
+
const relay_kit_ui_1 = require("@reservoir0x/relay-kit-ui");
|
|
12
|
+
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
13
|
+
function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, className, }) {
|
|
14
|
+
// Track previous token to detect changes
|
|
15
|
+
const prevTokenRef = (0, react_1.useRef)(token.address);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
// Only trigger when token actually changes
|
|
18
|
+
if (prevTokenRef.current !== token.address) {
|
|
19
|
+
console.log(`Token changed from ${prevTokenRef.current} to ${token.address}`);
|
|
20
|
+
// For "from" context, reset to default value when token changes
|
|
21
|
+
if (context === "from") {
|
|
22
|
+
// Reset input to default for new token
|
|
23
|
+
onChangeInput("0.01");
|
|
24
|
+
}
|
|
25
|
+
// Update ref to current token
|
|
26
|
+
prevTokenRef.current = token.address;
|
|
27
|
+
}
|
|
28
|
+
}, [token.address, chainId, context, onChangeInput]);
|
|
29
|
+
const handleTokenSelect = (newToken) => {
|
|
30
|
+
// Mark that we're about to change tokens
|
|
31
|
+
prevTokenRef.current = "changing"; // Temporary value to force effect
|
|
32
|
+
// Set the chain ID first
|
|
33
|
+
setChainId(newToken.chainId);
|
|
34
|
+
// Then set the new token
|
|
35
|
+
setToken({
|
|
36
|
+
address: newToken.address,
|
|
37
|
+
chainId: newToken.chainId, // Use the new chain ID
|
|
38
|
+
decimals: newToken.decimals,
|
|
39
|
+
metadata: { logoURI: newToken.logoURI },
|
|
40
|
+
name: newToken.name,
|
|
41
|
+
symbol: newToken.symbol,
|
|
42
|
+
});
|
|
43
|
+
// If this is the source token, reset the amount immediately
|
|
44
|
+
if (context === "from") {
|
|
45
|
+
onChangeInput("0.01");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// Original token amount input design for other contexts
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-as-border-secondary bg-as-surface-primary flex cursor-pointer items-center justify-between rounded-xl border px-3 py-2", className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 text-sm", children: anyspend_1.ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600", children: "\u2248" }), (0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 20, spellCheck: "false", className: "text-as-primary bg-as-surface-primary w-[100px]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, "aria-disabled": true, readOnly: true }, `input-${token.address}-${chainId}`), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" })] })] }) }, `selector-${context}-${token.address}-${chainId}`));
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
export declare function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, showAsReceiveAmount, }: {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
inputValue: string;
|
|
5
|
+
onChangeInput: (value: string) => void;
|
|
6
|
+
context: "from" | "to";
|
|
7
|
+
address: string | undefined;
|
|
8
|
+
token: components["schemas"]["Token"];
|
|
9
|
+
setToken: (token: components["schemas"]["Token"]) => void;
|
|
10
|
+
chainId: number;
|
|
11
|
+
setChainId: (chainId: number) => void;
|
|
12
|
+
hideTokenSelect?: boolean;
|
|
13
|
+
canEditAmount?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
showAsReceiveAmount?: boolean;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OrderTokenAmountFiat = OrderTokenAmountFiat;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const lucide_react_1 = require("lucide-react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_number_format_1 = require("react-number-format");
|
|
9
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
10
|
+
const react_2 = require("../../../../global-account/react");
|
|
11
|
+
const utils_1 = require("../../../../shared/utils");
|
|
12
|
+
const relay_kit_ui_1 = require("@reservoir0x/relay-kit-ui");
|
|
13
|
+
const ChainTokenIcon_1 = require("./ChainTokenIcon");
|
|
14
|
+
function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, showAsReceiveAmount = false, }) {
|
|
15
|
+
// Track previous token to detect changes
|
|
16
|
+
const prevTokenRef = (0, react_1.useRef)(token.address);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
// Only trigger when token actually changes
|
|
19
|
+
if (prevTokenRef.current !== token.address) {
|
|
20
|
+
console.log(`Token changed from ${prevTokenRef.current} to ${token.address}`);
|
|
21
|
+
// For "from" context, reset to default value when token changes
|
|
22
|
+
if (context === "from") {
|
|
23
|
+
// Reset input to default for new token
|
|
24
|
+
onChangeInput("0.01");
|
|
25
|
+
}
|
|
26
|
+
// Update ref to current token
|
|
27
|
+
prevTokenRef.current = token.address;
|
|
28
|
+
}
|
|
29
|
+
}, [token.address, chainId, context, onChangeInput]);
|
|
30
|
+
const handleTokenSelect = (newToken) => {
|
|
31
|
+
// Mark that we're about to change tokens
|
|
32
|
+
prevTokenRef.current = "changing"; // Temporary value to force effect
|
|
33
|
+
// Set the chain ID first
|
|
34
|
+
setChainId(newToken.chainId);
|
|
35
|
+
// Then set the new token
|
|
36
|
+
setToken({
|
|
37
|
+
address: newToken.address,
|
|
38
|
+
chainId: newToken.chainId, // Use the new chain ID
|
|
39
|
+
decimals: newToken.decimals,
|
|
40
|
+
metadata: { logoURI: newToken.logoURI },
|
|
41
|
+
name: newToken.name,
|
|
42
|
+
symbol: newToken.symbol,
|
|
43
|
+
});
|
|
44
|
+
// If this is the source token, reset the amount immediately
|
|
45
|
+
if (context === "from") {
|
|
46
|
+
onChangeInput("0.01");
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Calculate formatted amount for display
|
|
50
|
+
const formatAmount = (amount) => {
|
|
51
|
+
const numAmount = parseFloat(amount) || 0;
|
|
52
|
+
return numAmount.toLocaleString("en-US", {
|
|
53
|
+
minimumFractionDigits: 2,
|
|
54
|
+
maximumFractionDigits: 2,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
if (showAsReceiveAmount) {
|
|
58
|
+
// Design-matched token display for receive amounts (like in PanelOnramp)
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center justify-between rounded-xl bg-gray-50 p-4", className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-base font-semibold text-gray-900", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-600", children: anyspend_1.ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600", children: "\u2248" }), (0, jsx_runtime_1.jsx)("span", { className: "text-lg font-semibold text-gray-900", children: formatAmount(inputValue) }), !hideTokenSelect && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" }) }, `selector-${context}-${token.address}-${chainId}`))] })] }));
|
|
60
|
+
}
|
|
61
|
+
// Original token amount input design for other contexts
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [!canEditAmount ? ((0, jsx_runtime_1.jsx)("h2", { className: "text-3xl font-medium text-white", children: inputValue || "--" })) : ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: "placeholder:text-as-primary/70 disabled:text-as-primary/70 text-as-primary w-full bg-transparent text-4xl font-semibold leading-[42px] outline-none sm:text-[30px]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, onChange: e => onChangeInput(e.currentTarget.value) }, `input-${token.address}-${chainId}`)), !hideTokenSelect && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: Object.values(anyspend_1.ALL_CHAINS).map(chain => chain.id), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", role: "combobox", className: "bg-b3-react-background border-as-stroke flex h-auto w-fit shrink-0 items-center justify-center gap-2 rounded-xl border-2 px-2 py-1 pr-2 text-center", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[chainId]?.name })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) }, `selector-${context}-${token.address}-${chainId}`))] }) }, `${context}-${token.address}-${chainId}`));
|
|
63
|
+
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
import { FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
3
|
+
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, }: {
|
|
2
4
|
srcAmountOnRamp: string;
|
|
3
5
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
6
|
+
selectedPaymentMethod?: FiatPaymentMethod;
|
|
7
|
+
setActivePanel: (panel: number) => void;
|
|
8
|
+
_recipientAddress?: string;
|
|
9
|
+
destinationToken?: components["schemas"]["Token"];
|
|
10
|
+
destinationChainId?: number;
|
|
11
|
+
destinationAmount?: string;
|
|
12
|
+
onDestinationTokenChange?: (token: components["schemas"]["Token"]) => void;
|
|
13
|
+
onDestinationChainChange?: (chainId: number) => void;
|
|
4
14
|
}): import("react/jsx-runtime").JSX.Element;
|