@b3dotfun/sdk 0.0.33-alpha.1 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +25 -26
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +4 -1
- package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +1 -0
- package/dist/cjs/global-account/react/components/Transak/TransakModal.js +110 -0
- package/dist/cjs/global-account/react/components/index.d.ts +9 -8
- package/dist/cjs/global-account/react/components/index.js +28 -25
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +19 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -4
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -1
- package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +1 -0
- package/dist/esm/global-account/react/components/Transak/TransakModal.js +104 -0
- package/dist/esm/global-account/react/components/index.d.ts +9 -8
- package/dist/esm/global-account/react/components/index.js +10 -8
- package/dist/esm/global-account/react/stores/index.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +19 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +1 -0
- package/dist/types/global-account/react/components/index.d.ts +9 -8
- package/dist/types/global-account/react/stores/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +19 -1
- package/package.json +3 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +3 -6
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -0
- package/src/global-account/react/components/Transak/TransakModal.tsx +131 -0
- package/src/global-account/react/components/index.ts +16 -13
- package/src/global-account/react/stores/index.ts +2 -1
- package/src/global-account/react/stores/useModalStore.ts +20 -0
|
@@ -12,13 +12,14 @@ const hooks_1 = require("../../../../shared/react/hooks");
|
|
|
12
12
|
const utils_1 = require("../../../../shared/utils");
|
|
13
13
|
const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
|
|
14
14
|
const number_1 = require("../../../../shared/utils/number");
|
|
15
|
+
const react_2 = require("@chakra-ui/react");
|
|
15
16
|
const spl_token_1 = require("@solana/spl-token");
|
|
16
17
|
const web3_js_1 = require("@solana/web3.js");
|
|
17
|
-
const
|
|
18
|
+
const react_3 = require("@web3icons/react");
|
|
18
19
|
const lucide_react_1 = require("lucide-react");
|
|
19
|
-
const
|
|
20
|
+
const react_4 = require("motion/react");
|
|
20
21
|
const qrcode_react_1 = require("qrcode.react");
|
|
21
|
-
const
|
|
22
|
+
const react_5 = require("react");
|
|
22
23
|
const react_timeago_1 = __importDefault(require("react-timeago"));
|
|
23
24
|
const sonner_1 = require("sonner");
|
|
24
25
|
const viem_1 = require("viem");
|
|
@@ -129,12 +130,9 @@ function roundTokenAmount(amount) {
|
|
|
129
130
|
const roundedDecimalPart = digits.join("");
|
|
130
131
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
131
132
|
}
|
|
132
|
-
exports.OrderDetails = (0,
|
|
133
|
+
exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, cryptoPaymentMethod, onBack, disableUrlParamManagement = false, }) {
|
|
133
134
|
const router = (0, hooks_1.useRouter)();
|
|
134
135
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
135
|
-
// Get theme from B3Provider context
|
|
136
|
-
const { theme } = (0, react_1.useB3)();
|
|
137
|
-
const colorMode = theme || "light";
|
|
138
136
|
// Read crypto payment method from URL parameters
|
|
139
137
|
const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
|
|
140
138
|
const effectiveCryptoPaymentMethod = cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE;
|
|
@@ -147,11 +145,12 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
147
145
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
148
146
|
const account = (0, react_1.useAccountWallet)();
|
|
149
147
|
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
150
|
-
const [txHash, setTxHash] = (0,
|
|
151
|
-
const [showQRCode, setShowQRCode] = (0,
|
|
148
|
+
const [txHash, setTxHash] = (0, react_5.useState)();
|
|
149
|
+
const [showQRCode, setShowQRCode] = (0, react_5.useState)(false);
|
|
152
150
|
const { isLoading: txLoading, isSuccess: txSuccess } = (0, wagmi_1.useWaitForTransactionReceipt)({ hash: txHash });
|
|
153
151
|
const { switchChainAndExecuteWithEOA, isSwitchingOrExecuting } = (0, react_1.useUnifiedChainSwitchAndExecute)();
|
|
154
|
-
const
|
|
152
|
+
const { colorMode } = (0, react_2.useColorMode)();
|
|
153
|
+
const roundedUpSrcAmount = (0, react_5.useMemo)(() => {
|
|
155
154
|
// Display the full transfer amount without rounding since users need to see the exact value they're transferring.
|
|
156
155
|
// Use 21 significant digits (max allowed by Intl.NumberFormat)
|
|
157
156
|
const formattedSrcAmount = srcToken
|
|
@@ -160,7 +159,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
160
159
|
return roundTokenAmount(formattedSrcAmount);
|
|
161
160
|
}, [order.srcAmount, srcToken]);
|
|
162
161
|
// Unified payment handler for both EOA and AA wallets
|
|
163
|
-
const handleUnifiedPaymentProcess = (0,
|
|
162
|
+
const handleUnifiedPaymentProcess = (0, react_5.useCallback)(async () => {
|
|
164
163
|
let txData;
|
|
165
164
|
let value;
|
|
166
165
|
let to;
|
|
@@ -196,7 +195,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
196
195
|
}
|
|
197
196
|
};
|
|
198
197
|
// When waitingForDeposit is true, we show a message to the user to wait for the deposit to be processed.
|
|
199
|
-
const setWaitingForDeposit = (0,
|
|
198
|
+
const setWaitingForDeposit = (0, react_5.useCallback)(() => {
|
|
200
199
|
if (disableUrlParamManagement)
|
|
201
200
|
return;
|
|
202
201
|
const params = new URLSearchParams(searchParams.toString());
|
|
@@ -204,7 +203,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
204
203
|
router.push(`?${params}`);
|
|
205
204
|
}, [router, searchParams, disableUrlParamManagement]);
|
|
206
205
|
// Clean up URL parameters before closing modal or navigating back
|
|
207
|
-
const cleanupUrlParams = (0,
|
|
206
|
+
const cleanupUrlParams = (0, react_5.useCallback)(() => {
|
|
208
207
|
if (disableUrlParamManagement)
|
|
209
208
|
return;
|
|
210
209
|
const params = new URLSearchParams(searchParams.toString());
|
|
@@ -217,25 +216,25 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
217
216
|
}
|
|
218
217
|
}, [router, searchParams, disableUrlParamManagement]);
|
|
219
218
|
// Helper functions that clean up URL params before executing actions
|
|
220
|
-
const handleCloseModal = (0,
|
|
219
|
+
const handleCloseModal = (0, react_5.useCallback)(() => {
|
|
221
220
|
cleanupUrlParams();
|
|
222
221
|
setB3ModalOpen(false);
|
|
223
222
|
}, [cleanupUrlParams, setB3ModalOpen]);
|
|
224
|
-
const handleBack = (0,
|
|
223
|
+
const handleBack = (0, react_5.useCallback)(() => {
|
|
225
224
|
cleanupUrlParams();
|
|
226
225
|
onBack?.();
|
|
227
226
|
}, [cleanupUrlParams, onBack]);
|
|
228
|
-
(0,
|
|
227
|
+
(0, react_5.useEffect)(() => {
|
|
229
228
|
if (txSuccess) {
|
|
230
229
|
sonner_1.toast.success("Transaction successful! We are processing your order.", { duration: 10000 });
|
|
231
230
|
setWaitingForDeposit();
|
|
232
231
|
setTxHash(undefined);
|
|
233
232
|
}
|
|
234
233
|
}, [setWaitingForDeposit, txSuccess]);
|
|
235
|
-
const isPhantomMobile = (0,
|
|
236
|
-
const isPhantomBrowser = (0,
|
|
234
|
+
const isPhantomMobile = (0, react_5.useMemo)(() => navigator.userAgent.includes("Phantom"), []);
|
|
235
|
+
const isPhantomBrowser = (0, react_5.useMemo)(() => window.phantom?.solana?.isPhantom, []);
|
|
237
236
|
// Get connected Phantom wallet address if available
|
|
238
|
-
const phantomWalletAddress = (0,
|
|
237
|
+
const phantomWalletAddress = (0, react_5.useMemo)(() => {
|
|
239
238
|
const phantom = window.phantom?.solana;
|
|
240
239
|
if (phantom?.isConnected && phantom?.publicKey) {
|
|
241
240
|
return phantom.publicKey.toString();
|
|
@@ -400,7 +399,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
400
399
|
}
|
|
401
400
|
};
|
|
402
401
|
if (refundTxs) {
|
|
403
|
-
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, { 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)(
|
|
402
|
+
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, { 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_4.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
403
|
? depositTxs.map(dTx => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
405
404
|
? `Received payment`
|
|
406
405
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTx, isProcessing: false }, dTx.txHash)))
|
|
@@ -409,7 +408,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
409
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: "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") })] }));
|
|
410
409
|
}
|
|
411
410
|
if (executeTx) {
|
|
412
|
-
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: "execute-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { 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)(
|
|
411
|
+
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: "execute-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { 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_4.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
|
|
413
412
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
414
413
|
? `Received payment`
|
|
415
414
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
@@ -431,7 +430,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
431
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: "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
431
|
}
|
|
433
432
|
if (relayTx && relayTx.status === "success") {
|
|
434
|
-
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, { 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)(
|
|
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.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, { 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_4.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
434
|
? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
436
435
|
? `Received payment`
|
|
437
436
|
: `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
|
|
@@ -463,7 +462,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
463
462
|
// This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
|
|
464
463
|
const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
|
|
465
464
|
if (depositTxs?.length || waitingForDeposit) {
|
|
466
|
-
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: "deposit-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(
|
|
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.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "deposit-details", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_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"
|
|
467
466
|
? `Received payment`
|
|
468
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"
|
|
469
468
|
? "Processing Swap"
|
|
@@ -487,11 +486,11 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
|
|
|
487
486
|
? "Pay from Phantom Wallet"
|
|
488
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
|
|
489
488
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
490
|
-
: (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)(
|
|
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" })] })] })] }) })) : (
|
|
491
490
|
// Default case - existing QR code flow
|
|
492
|
-
(0, jsx_runtime_1.jsx)(
|
|
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 ? 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_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"] })] }));
|
|
493
492
|
});
|
|
494
493
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
495
|
-
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)(
|
|
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-as-surface-secondary 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: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, children: title })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary", children: title })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-1", children: tx ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: (0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(chainId, tx.txHash), target: "_blank", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 font-mono text-xs", children: (0, centerTruncate_1.default)(tx?.txHash, 6) }) }) })) : null })] }));
|
|
496
495
|
}
|
|
497
496
|
exports.OrderDetailsLoadingView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsxs)(react_1.Badge, { variant: "default", className: "hover:bg-b3-react-background flex items-center gap-3 border-white/20 bg-white/10 px-4 py-1 text-base transition-colors", 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_1.TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-1 flex-col", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-24" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-8 w-48" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "ml-4 h-8 w-32" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mt-4 h-8 w-24" })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-4 h-12 w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)(react_1.Skeleton, { className: "rounded-lg p-6 pb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[200px] w-[200px]" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 flex items-center justify-center gap-2", children: (0, jsx_runtime_1.jsx)("div", { className: "h-5 w-5 rounded-full" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => ((0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" }, i))) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background mt-8 w-full rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "mb-3 h-4 w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 flex-1" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-10 w-full" })] }));
|
|
@@ -12,6 +12,7 @@ const LinkAccount_1 = require("./LinkAccount/LinkAccount");
|
|
|
12
12
|
const ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
13
13
|
const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
14
14
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
15
|
+
const TransakModal_1 = require("./Transak/TransakModal");
|
|
15
16
|
const dialog_1 = require("./ui/dialog");
|
|
16
17
|
const drawer_1 = require("./ui/drawer");
|
|
17
18
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
@@ -47,7 +48,7 @@ function B3DynamicModal() {
|
|
|
47
48
|
const hideCloseButton = isFreestyleType;
|
|
48
49
|
// Build content class using cn utility
|
|
49
50
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
50
|
-
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6");
|
|
51
|
+
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6", contentType?.type === "transak" && "transak-modal");
|
|
51
52
|
debug("contentType", contentType);
|
|
52
53
|
const renderContent = () => {
|
|
53
54
|
if (!contentType)
|
|
@@ -69,6 +70,8 @@ function B3DynamicModal() {
|
|
|
69
70
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendTournament, { ...contentType, mode: "modal", action: "join" });
|
|
70
71
|
case "anySpendFundTournament":
|
|
71
72
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendTournament, { ...contentType, mode: "modal", action: "fund" });
|
|
73
|
+
case "transak":
|
|
74
|
+
return (0, jsx_runtime_1.jsx)(TransakModal_1.TransakModal, {});
|
|
72
75
|
case "anySpendOrderHistory":
|
|
73
76
|
return (0, jsx_runtime_1.jsx)(react_1.OrderHistory, { onBack: () => { }, mode: "modal" });
|
|
74
77
|
case "anySpendStakeB3":
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TransakModal(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
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.TransakModal = TransakModal;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("../../../../global-account/react");
|
|
10
|
+
const debug_1 = __importDefault(require("../../../../shared/utils/debug"));
|
|
11
|
+
const transak_sdk_1 = require("@transak/transak-sdk");
|
|
12
|
+
const lucide_react_1 = require("lucide-react");
|
|
13
|
+
const react_2 = require("react");
|
|
14
|
+
const sonner_1 = require("sonner");
|
|
15
|
+
function TransakModal() {
|
|
16
|
+
const [isLoading, setIsLoading] = (0, react_2.useState)(true);
|
|
17
|
+
const [_error, setError] = (0, react_2.useState)(null);
|
|
18
|
+
const account = (0, react_1.useAccountWallet)();
|
|
19
|
+
const { environment } = (0, react_1.useB3)();
|
|
20
|
+
console.log(`process.env.NEXT_PUBLIC_TRANSAK_API_KEY`, process.env.NEXT_PUBLIC_TRANSAK_API_KEY); // d1f4e8be-cacb-4cfa-b2cd-c591084b5ef6
|
|
21
|
+
const transakConfig = (0, react_2.useMemo)(() => {
|
|
22
|
+
return {
|
|
23
|
+
apiKey: process.env.NEXT_PUBLIC_TRANSAK_API_KEY || "", // (Required)
|
|
24
|
+
// Yes, I know it looks weird to use isDevelopment for staging, but this is how this was done on Basement. Leaving till confirming difference
|
|
25
|
+
environment: environment === "development" ? transak_sdk_1.Transak.ENVIRONMENTS.STAGING : transak_sdk_1.Transak.ENVIRONMENTS.PRODUCTION, // (Required)
|
|
26
|
+
containerId: "transakMount", // Id of the element where you want to initialize the iframe
|
|
27
|
+
themeColor: "0c68e9",
|
|
28
|
+
widgetHeight: "650px",
|
|
29
|
+
productsAvailed: "BUY",
|
|
30
|
+
hideMenu: true,
|
|
31
|
+
colorMode: "DARK",
|
|
32
|
+
backgroundColors: "000000", // TODO: figure out why this doesn't work
|
|
33
|
+
exchangeScreenTitle: "Buy ETH on B3",
|
|
34
|
+
isFeeCalculationHidden: true,
|
|
35
|
+
cryptoCurrencyCode: "ETH",
|
|
36
|
+
network: "b3",
|
|
37
|
+
};
|
|
38
|
+
}, [environment]);
|
|
39
|
+
const { ready } = (0, react_1.useB3)();
|
|
40
|
+
const modalOptions = (0, react_1.useModalStore)(state => state.contentType);
|
|
41
|
+
const isOnRamp = modalOptions?.type === "transak";
|
|
42
|
+
const destinationWalletAddress = isOnRamp ? modalOptions?.destinationWalletAddress : undefined;
|
|
43
|
+
const defaultCryptoAmount = isOnRamp ? modalOptions?.defaultCryptoAmount : undefined;
|
|
44
|
+
const onSuccess = isOnRamp ? modalOptions?.onSuccess : undefined;
|
|
45
|
+
const fiatAmount = isOnRamp ? modalOptions?.fiatAmount : undefined;
|
|
46
|
+
const countryCode = isOnRamp ? modalOptions?.countryCode : undefined;
|
|
47
|
+
(0, react_2.useEffect)(() => {
|
|
48
|
+
if (!ready || !isOnRamp)
|
|
49
|
+
return;
|
|
50
|
+
const config = {
|
|
51
|
+
...transakConfig,
|
|
52
|
+
walletAddress: destinationWalletAddress || account?.address, // In the future, this should be set to the new global B3 SCW address
|
|
53
|
+
defaultCryptoAmount,
|
|
54
|
+
disableWalletAddressForm: !!destinationWalletAddress || !!account?.address, // Only disable the form if we have an address
|
|
55
|
+
fiatAmount: fiatAmount,
|
|
56
|
+
countryCode: countryCode,
|
|
57
|
+
};
|
|
58
|
+
const transak = new transak_sdk_1.Transak(config);
|
|
59
|
+
try {
|
|
60
|
+
transak.init();
|
|
61
|
+
// Add event listeners
|
|
62
|
+
transak_sdk_1.Transak.on("*", data => {
|
|
63
|
+
(0, debug_1.default)("@@transak", data);
|
|
64
|
+
});
|
|
65
|
+
transak_sdk_1.Transak.on(transak_sdk_1.Transak.EVENTS.TRANSAK_WIDGET_CLOSE, () => {
|
|
66
|
+
setIsLoading(false);
|
|
67
|
+
(0, debug_1.default)("@@transak", "Transak SDK closed!");
|
|
68
|
+
});
|
|
69
|
+
transak_sdk_1.Transak.on(transak_sdk_1.Transak.EVENTS.TRANSAK_WIDGET_INITIALISED, () => {
|
|
70
|
+
(0, debug_1.default)("@@transak", "Transak SDK initialized!");
|
|
71
|
+
setIsLoading(false);
|
|
72
|
+
});
|
|
73
|
+
transak_sdk_1.Transak.on(transak_sdk_1.Transak.EVENTS.TRANSAK_ORDER_FAILED, orderData => {
|
|
74
|
+
(0, debug_1.default)("@@transak", orderData);
|
|
75
|
+
sonner_1.toast.error("Oh no! Something went wrong. Please try again.");
|
|
76
|
+
});
|
|
77
|
+
transak_sdk_1.Transak.on(transak_sdk_1.Transak.EVENTS.TRANSAK_ORDER_SUCCESSFUL, orderData => {
|
|
78
|
+
(0, debug_1.default)("@@transak", orderData);
|
|
79
|
+
sonner_1.toast.success("Successfully purchased ETH with credit card!");
|
|
80
|
+
onSuccess?.();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
setError(err instanceof Error ? err : new Error("Failed to initialize Transak"));
|
|
85
|
+
sonner_1.toast.error("Oh no! Something went wrong. Please try again.");
|
|
86
|
+
setIsLoading(false);
|
|
87
|
+
}
|
|
88
|
+
// Cleanup code
|
|
89
|
+
return () => {
|
|
90
|
+
transak.close();
|
|
91
|
+
};
|
|
92
|
+
}, [
|
|
93
|
+
ready,
|
|
94
|
+
account?.address,
|
|
95
|
+
destinationWalletAddress,
|
|
96
|
+
defaultCryptoAmount,
|
|
97
|
+
isOnRamp,
|
|
98
|
+
onSuccess,
|
|
99
|
+
fiatAmount,
|
|
100
|
+
transakConfig,
|
|
101
|
+
countryCode,
|
|
102
|
+
]);
|
|
103
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isLoading && ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full min-h-[650px] flex-col items-center justify-center gap-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-24 w-24 animate-spin opacity-10" }), (0, jsx_runtime_1.jsx)(react_1.TextShimmer, { children: "Powering up our credit card processor..." })] })), (0, jsx_runtime_1.jsx)("div", { id: "transakMount", style: {
|
|
104
|
+
display: isLoading ? "none" : "block",
|
|
105
|
+
width: "100%",
|
|
106
|
+
height: "650px",
|
|
107
|
+
borderRadius: "25px",
|
|
108
|
+
overflow: "hidden",
|
|
109
|
+
} })] }));
|
|
110
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
1
2
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
3
|
-
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
4
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
6
|
export { StyleRoot } from "./StyleRoot";
|
|
7
|
-
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
|
|
8
|
-
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
9
|
-
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
10
7
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
11
8
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
12
9
|
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
10
|
+
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
|
|
11
|
+
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
12
|
+
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
13
13
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
14
14
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
15
15
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
@@ -19,15 +19,12 @@ export { AccountAssets } from "./AccountAssets/AccountAssets";
|
|
|
19
19
|
export { MintButton } from "./MintButton/MintButton";
|
|
20
20
|
export { SendETHButton } from "./SendETHButton/SendETHButton";
|
|
21
21
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
|
|
22
|
+
export { TransakModal } from "./Transak/TransakModal";
|
|
22
23
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
23
24
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
24
25
|
export { CopyToClipboard } from "./custom/CopyToClipboard";
|
|
25
26
|
export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
|
|
26
27
|
export { WalletConnectorIcon } from "./custom/WalletConnectorIcon";
|
|
27
|
-
export { Loading } from "./ui/Loading";
|
|
28
|
-
export { ShinyButton } from "./ui/ShinyButton";
|
|
29
|
-
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
|
|
30
|
-
export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
|
|
31
28
|
export { Badge, badgeVariants } from "./ui/badge";
|
|
32
29
|
export { Button, buttonVariants } from "./ui/button";
|
|
33
30
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command";
|
|
@@ -36,9 +33,13 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
|
|
|
36
33
|
export { GlareCard } from "./ui/glare-card";
|
|
37
34
|
export { GlareCardRounded } from "./ui/glare-card-rounded";
|
|
38
35
|
export { Input } from "./ui/input";
|
|
36
|
+
export { Loading } from "./ui/Loading";
|
|
39
37
|
export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
40
38
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
39
|
+
export { ShinyButton } from "./ui/ShinyButton";
|
|
41
40
|
export { Skeleton } from "./ui/skeleton";
|
|
41
|
+
export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, TabTrigger as TabTriggerPrimitive, } from "./ui/Tabs";
|
|
42
|
+
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
|
|
42
43
|
export { TextLoop } from "./ui/text-loop";
|
|
43
44
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
44
45
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.
|
|
3
|
+
exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.TransakModal = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3 = exports.B3Context = exports.InnerProvider = exports.B3Provider = exports.B3DynamicModal = exports.RelayKitProviderWrapper = void 0;
|
|
4
|
+
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = void 0;
|
|
5
5
|
// Core Components
|
|
6
|
+
var RelayKitProviderWrapper_1 = require("./B3Provider/RelayKitProviderWrapper");
|
|
7
|
+
Object.defineProperty(exports, "RelayKitProviderWrapper", { enumerable: true, get: function () { return RelayKitProviderWrapper_1.RelayKitProviderWrapper; } });
|
|
6
8
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
7
9
|
Object.defineProperty(exports, "B3DynamicModal", { enumerable: true, get: function () { return B3DynamicModal_1.B3DynamicModal; } });
|
|
8
10
|
var B3Provider_1 = require("./B3Provider/B3Provider");
|
|
9
11
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_1.B3Provider; } });
|
|
10
12
|
Object.defineProperty(exports, "InnerProvider", { enumerable: true, get: function () { return B3Provider_1.InnerProvider; } });
|
|
11
|
-
var RelayKitProviderWrapper_1 = require("./B3Provider/RelayKitProviderWrapper");
|
|
12
|
-
Object.defineProperty(exports, "RelayKitProviderWrapper", { enumerable: true, get: function () { return RelayKitProviderWrapper_1.RelayKitProviderWrapper; } });
|
|
13
13
|
var types_1 = require("./B3Provider/types");
|
|
14
14
|
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
15
15
|
var useB3_1 = require("./B3Provider/useB3");
|
|
@@ -17,18 +17,18 @@ Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { r
|
|
|
17
17
|
var StyleRoot_1 = require("./StyleRoot");
|
|
18
18
|
Object.defineProperty(exports, "StyleRoot", { enumerable: true, get: function () { return StyleRoot_1.StyleRoot; } });
|
|
19
19
|
// SignInWithB3 Components
|
|
20
|
-
var SignInWithB3_1 = require("./SignInWithB3/SignInWithB3");
|
|
21
|
-
Object.defineProperty(exports, "SignInWithB3", { enumerable: true, get: function () { return SignInWithB3_1.SignInWithB3; } });
|
|
22
|
-
var SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
23
|
-
Object.defineProperty(exports, "SignInWithB3Flow", { enumerable: true, get: function () { return SignInWithB3Flow_1.SignInWithB3Flow; } });
|
|
24
|
-
var SignInWithB3Privy_1 = require("./SignInWithB3/SignInWithB3Privy");
|
|
25
|
-
Object.defineProperty(exports, "SignInWithB3Privy", { enumerable: true, get: function () { return SignInWithB3Privy_1.SignInWithB3Privy; } });
|
|
26
20
|
var AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
27
21
|
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
28
22
|
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
29
23
|
Object.defineProperty(exports, "PermissionItem", { enumerable: true, get: function () { return PermissionItem_1.PermissionItem; } });
|
|
30
24
|
var WalletRow_1 = require("./SignInWithB3/components/WalletRow");
|
|
31
25
|
Object.defineProperty(exports, "WalletRow", { enumerable: true, get: function () { return WalletRow_1.WalletRow; } });
|
|
26
|
+
var SignInWithB3_1 = require("./SignInWithB3/SignInWithB3");
|
|
27
|
+
Object.defineProperty(exports, "SignInWithB3", { enumerable: true, get: function () { return SignInWithB3_1.SignInWithB3; } });
|
|
28
|
+
var SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
29
|
+
Object.defineProperty(exports, "SignInWithB3Flow", { enumerable: true, get: function () { return SignInWithB3Flow_1.SignInWithB3Flow; } });
|
|
30
|
+
var SignInWithB3Privy_1 = require("./SignInWithB3/SignInWithB3Privy");
|
|
31
|
+
Object.defineProperty(exports, "SignInWithB3Privy", { enumerable: true, get: function () { return SignInWithB3Privy_1.SignInWithB3Privy; } });
|
|
32
32
|
var LoginStep_1 = require("./SignInWithB3/steps/LoginStep");
|
|
33
33
|
Object.defineProperty(exports, "LoginStepContainer", { enumerable: true, get: function () { return LoginStep_1.LoginStepContainer; } });
|
|
34
34
|
var signInUtils_1 = require("./SignInWithB3/utils/signInUtils");
|
|
@@ -54,6 +54,9 @@ Object.defineProperty(exports, "SendETHButton", { enumerable: true, get: functio
|
|
|
54
54
|
// SendERC20Button Components
|
|
55
55
|
var SendERC20Button_1 = require("./SendERC20Button/SendERC20Button");
|
|
56
56
|
Object.defineProperty(exports, "SendERC20Button", { enumerable: true, get: function () { return SendERC20Button_1.SendERC20Button; } });
|
|
57
|
+
// Transak Components
|
|
58
|
+
var TransakModal_1 = require("./Transak/TransakModal");
|
|
59
|
+
Object.defineProperty(exports, "TransakModal", { enumerable: true, get: function () { return TransakModal_1.TransakModal; } });
|
|
57
60
|
// Custom Components
|
|
58
61
|
var Button_1 = require("./custom/Button");
|
|
59
62
|
Object.defineProperty(exports, "CustomButton", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
@@ -67,21 +70,6 @@ Object.defineProperty(exports, "StaggeredFadeLoader", { enumerable: true, get: f
|
|
|
67
70
|
var WalletConnectorIcon_1 = require("./custom/WalletConnectorIcon");
|
|
68
71
|
Object.defineProperty(exports, "WalletConnectorIcon", { enumerable: true, get: function () { return WalletConnectorIcon_1.WalletConnectorIcon; } });
|
|
69
72
|
// UI Components
|
|
70
|
-
var Loading_1 = require("./ui/Loading");
|
|
71
|
-
Object.defineProperty(exports, "Loading", { enumerable: true, get: function () { return Loading_1.Loading; } });
|
|
72
|
-
var ShinyButton_1 = require("./ui/ShinyButton");
|
|
73
|
-
Object.defineProperty(exports, "ShinyButton", { enumerable: true, get: function () { return ShinyButton_1.ShinyButton; } });
|
|
74
|
-
var TabSystem_1 = require("./ui/TabSystem");
|
|
75
|
-
Object.defineProperty(exports, "TabTrigger", { enumerable: true, get: function () { return TabSystem_1.TabTrigger; } });
|
|
76
|
-
Object.defineProperty(exports, "Tabs", { enumerable: true, get: function () { return TabSystem_1.Tabs; } });
|
|
77
|
-
Object.defineProperty(exports, "TabsContent", { enumerable: true, get: function () { return TabSystem_1.TabsContent; } });
|
|
78
|
-
Object.defineProperty(exports, "TabsList", { enumerable: true, get: function () { return TabSystem_1.TabsList; } });
|
|
79
|
-
Object.defineProperty(exports, "TabsTransitionWrapper", { enumerable: true, get: function () { return TabSystem_1.TabsTransitionWrapper; } });
|
|
80
|
-
var Tabs_1 = require("./ui/Tabs");
|
|
81
|
-
Object.defineProperty(exports, "TabTriggerPrimitive", { enumerable: true, get: function () { return Tabs_1.TabTrigger; } });
|
|
82
|
-
Object.defineProperty(exports, "TabsContentPrimitive", { enumerable: true, get: function () { return Tabs_1.TabsContent; } });
|
|
83
|
-
Object.defineProperty(exports, "TabsListPrimitive", { enumerable: true, get: function () { return Tabs_1.TabsList; } });
|
|
84
|
-
Object.defineProperty(exports, "TabsPrimitive", { enumerable: true, get: function () { return Tabs_1.Tabs; } });
|
|
85
73
|
var badge_1 = require("./ui/badge");
|
|
86
74
|
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return badge_1.Badge; } });
|
|
87
75
|
Object.defineProperty(exports, "badgeVariants", { enumerable: true, get: function () { return badge_1.badgeVariants; } });
|
|
@@ -126,6 +114,8 @@ var glare_card_rounded_1 = require("./ui/glare-card-rounded");
|
|
|
126
114
|
Object.defineProperty(exports, "GlareCardRounded", { enumerable: true, get: function () { return glare_card_rounded_1.GlareCardRounded; } });
|
|
127
115
|
var input_1 = require("./ui/input");
|
|
128
116
|
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return input_1.Input; } });
|
|
117
|
+
var Loading_1 = require("./ui/Loading");
|
|
118
|
+
Object.defineProperty(exports, "Loading", { enumerable: true, get: function () { return Loading_1.Loading; } });
|
|
129
119
|
var popover_1 = require("./ui/popover");
|
|
130
120
|
Object.defineProperty(exports, "Popover", { enumerable: true, get: function () { return popover_1.Popover; } });
|
|
131
121
|
Object.defineProperty(exports, "PopoverContent", { enumerable: true, get: function () { return popover_1.PopoverContent; } });
|
|
@@ -133,8 +123,21 @@ Object.defineProperty(exports, "PopoverTrigger", { enumerable: true, get: functi
|
|
|
133
123
|
var scroll_area_1 = require("./ui/scroll-area");
|
|
134
124
|
Object.defineProperty(exports, "ScrollArea", { enumerable: true, get: function () { return scroll_area_1.ScrollArea; } });
|
|
135
125
|
Object.defineProperty(exports, "ScrollBar", { enumerable: true, get: function () { return scroll_area_1.ScrollBar; } });
|
|
126
|
+
var ShinyButton_1 = require("./ui/ShinyButton");
|
|
127
|
+
Object.defineProperty(exports, "ShinyButton", { enumerable: true, get: function () { return ShinyButton_1.ShinyButton; } });
|
|
136
128
|
var skeleton_1 = require("./ui/skeleton");
|
|
137
129
|
Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return skeleton_1.Skeleton; } });
|
|
130
|
+
var Tabs_1 = require("./ui/Tabs");
|
|
131
|
+
Object.defineProperty(exports, "TabsContentPrimitive", { enumerable: true, get: function () { return Tabs_1.TabsContent; } });
|
|
132
|
+
Object.defineProperty(exports, "TabsListPrimitive", { enumerable: true, get: function () { return Tabs_1.TabsList; } });
|
|
133
|
+
Object.defineProperty(exports, "TabsPrimitive", { enumerable: true, get: function () { return Tabs_1.Tabs; } });
|
|
134
|
+
Object.defineProperty(exports, "TabTriggerPrimitive", { enumerable: true, get: function () { return Tabs_1.TabTrigger; } });
|
|
135
|
+
var TabSystem_1 = require("./ui/TabSystem");
|
|
136
|
+
Object.defineProperty(exports, "Tabs", { enumerable: true, get: function () { return TabSystem_1.Tabs; } });
|
|
137
|
+
Object.defineProperty(exports, "TabsContent", { enumerable: true, get: function () { return TabSystem_1.TabsContent; } });
|
|
138
|
+
Object.defineProperty(exports, "TabsList", { enumerable: true, get: function () { return TabSystem_1.TabsList; } });
|
|
139
|
+
Object.defineProperty(exports, "TabsTransitionWrapper", { enumerable: true, get: function () { return TabSystem_1.TabsTransitionWrapper; } });
|
|
140
|
+
Object.defineProperty(exports, "TabTrigger", { enumerable: true, get: function () { return TabSystem_1.TabTrigger; } });
|
|
138
141
|
var text_loop_1 = require("./ui/text-loop");
|
|
139
142
|
Object.defineProperty(exports, "TextLoop", { enumerable: true, get: function () { return text_loop_1.TextLoop; } });
|
|
140
143
|
var text_shimmer_1 = require("./ui/text-shimmer");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
2
|
export { useModalStore } from "./useModalStore";
|
|
3
|
-
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props,
|
|
3
|
+
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnyspendOrderDetailsProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, TransakProps, } from "./useModalStore";
|
|
@@ -183,6 +183,24 @@ export interface AnyspendOrderDetailsProps extends BaseModalProps {
|
|
|
183
183
|
/** Whether to show the back button */
|
|
184
184
|
showBackButton?: boolean;
|
|
185
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Props for the Transak modal
|
|
188
|
+
* Handles Transak-specific on-ramping
|
|
189
|
+
*/
|
|
190
|
+
export interface TransakProps extends BaseModalProps {
|
|
191
|
+
/** Modal type identifier */
|
|
192
|
+
type: "transak";
|
|
193
|
+
/** Wallet address to receive the purchased crypto */
|
|
194
|
+
destinationWalletAddress?: string;
|
|
195
|
+
/** Default amount of crypto to purchase */
|
|
196
|
+
defaultCryptoAmount?: number;
|
|
197
|
+
/** Amount of fiat currency to spend */
|
|
198
|
+
fiatAmount?: number;
|
|
199
|
+
/** ISO country code for KYC and available payment methods */
|
|
200
|
+
countryCode?: string;
|
|
201
|
+
/** Callback function called when the purchase is successful */
|
|
202
|
+
onSuccess?: () => void;
|
|
203
|
+
}
|
|
186
204
|
/**
|
|
187
205
|
* Props for the AnySpend order history modal
|
|
188
206
|
*/
|
|
@@ -290,7 +308,7 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
290
308
|
/**
|
|
291
309
|
* Union type of all possible modal content types
|
|
292
310
|
*/
|
|
293
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
|
|
311
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
|
|
294
312
|
/**
|
|
295
313
|
* State interface for the modal store
|
|
296
314
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ALL_CHAINS, DEPOSIT_HYPE_ACTION, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, RELAY_ETH_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, } from "../../../../anyspend/index.js";
|
|
4
|
-
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet,
|
|
4
|
+
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useModalStore, useProfile, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { useRouter, useSearchParams } from "../../../../shared/react/hooks/index.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/index.js";
|
|
7
7
|
import centerTruncate from "../../../../shared/utils/centerTruncate.js";
|
|
8
8
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
9
|
+
import { useColorMode } from "@chakra-ui/react";
|
|
9
10
|
import { createAssociatedTokenAccountInstruction, createTransferCheckedInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token";
|
|
10
11
|
import { ComputeBudgetProgram, Connection, PublicKey, SystemProgram, Transaction } from "@solana/web3.js";
|
|
11
12
|
import { WalletCoinbase, WalletMetamask, WalletPhantom, WalletTrust, WalletWalletConnect } from "@web3icons/react";
|
|
@@ -126,9 +127,6 @@ function roundTokenAmount(amount) {
|
|
|
126
127
|
export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, cryptoPaymentMethod, onBack, disableUrlParamManagement = false, }) {
|
|
127
128
|
const router = useRouter();
|
|
128
129
|
const searchParams = useSearchParams();
|
|
129
|
-
// Get theme from B3Provider context
|
|
130
|
-
const { theme } = useB3();
|
|
131
|
-
const colorMode = theme || "light";
|
|
132
130
|
// Read crypto payment method from URL parameters
|
|
133
131
|
const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
|
|
134
132
|
const effectiveCryptoPaymentMethod = cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethodType.NONE;
|
|
@@ -145,6 +143,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
145
143
|
const [showQRCode, setShowQRCode] = useState(false);
|
|
146
144
|
const { isLoading: txLoading, isSuccess: txSuccess } = useWaitForTransactionReceipt({ hash: txHash });
|
|
147
145
|
const { switchChainAndExecuteWithEOA, isSwitchingOrExecuting } = useUnifiedChainSwitchAndExecute();
|
|
146
|
+
const { colorMode } = useColorMode();
|
|
148
147
|
const roundedUpSrcAmount = useMemo(() => {
|
|
149
148
|
// Display the full transfer amount without rounding since users need to see the exact value they're transferring.
|
|
150
149
|
// Use 21 significant digits (max allowed by Intl.NumberFormat)
|