@b3dotfun/sdk 0.0.87 → 0.0.88
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/README.md +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +77 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/format.js +28 -5
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +17 -47
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +10 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +23 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +42 -0
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +77 -73
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
- package/dist/esm/anyspend/react/components/index.d.ts +2 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/format.js +28 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +21 -51
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +6 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +19 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +2 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +4 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +39 -0
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/index.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +105 -85
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
- package/src/anyspend/react/components/AnySpendDeposit.tsx +578 -0
- package/src/anyspend/react/components/QRDeposit.tsx +348 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/WarningText.tsx +52 -0
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/credit-card.svg +5 -0
- package/src/anyspend/react/components/icons/qr-code.svg +5 -0
- package/src/anyspend/react/components/index.ts +2 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
- package/src/anyspend/utils/format.ts +33 -5
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +10 -2
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +6 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +20 -71
- package/src/global-account/react/components/B3Provider/types.ts +8 -9
- package/src/global-account/react/components/B3Provider/useB3.ts +1 -0
- package/src/global-account/react/components/B3Provider/useB3Account.ts +7 -0
- package/src/global-account/react/components/B3Provider/useB3Config.ts +34 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -2
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +2 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -2
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +5 -2
- package/src/global-account/react/components/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountWallet.tsx +4 -3
- package/src/global-account/react/hooks/useAutoSelectWallet.ts +51 -0
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +7 -5
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +2 -2
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/styles/index.css +2 -0
|
@@ -16,19 +16,26 @@ const lucide_react_1 = require("lucide-react");
|
|
|
16
16
|
const react_2 = require("motion/react");
|
|
17
17
|
const react_3 = require("react");
|
|
18
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, points, }) {
|
|
20
|
-
const [
|
|
19
|
+
exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollapsible({ order, dstToken, tournament, nft, recipientName, formattedExpectedDstAmount, className, showTotal = false, totalAmount, points, isOpen, onOpenChange, }) {
|
|
20
|
+
const [internalOpen, setInternalOpen] = (0, react_3.useState)(true);
|
|
21
|
+
// Use controlled mode if isOpen is provided, otherwise use internal state
|
|
22
|
+
const showOrderDetails = isOpen !== undefined ? isOpen : internalOpen;
|
|
23
|
+
const setShowOrderDetails = onOpenChange || setInternalOpen;
|
|
21
24
|
// Calculate expected amount if not provided
|
|
22
25
|
const expectedDstAmount = order.type === "mint_nft" ||
|
|
23
26
|
order.type === "join_tournament" ||
|
|
24
27
|
order.type === "fund_tournament" ||
|
|
25
|
-
order.type === "custom"
|
|
28
|
+
order.type === "custom" ||
|
|
29
|
+
order.type === "deposit_first"
|
|
26
30
|
? "0"
|
|
27
31
|
: order.payload.expectedDstAmount.toString();
|
|
28
32
|
const finalFormattedExpectedDstAmount = formattedExpectedDstAmount || (0, number_1.formatTokenAmount)(BigInt(expectedDstAmount), dstToken.decimals);
|
|
29
33
|
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("order-details-collapsible 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: "order-details-expanded 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: "order-details-content flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-details-recipient-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-recipient-label text-as-tertiarry", children: "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-recipient-info flex flex-col items-end gap-1", children: [recipientName && ((0, jsx_runtime_1.jsx)("div", { className: "order-details-recipient-name text-as-primary font-semibold", children: recipientName })), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: order.recipientAddress, onCopy: () => {
|
|
30
34
|
react_1.toast.success("Copied recipient address to clipboard");
|
|
31
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-recipient-address 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: "order-details-recipient-copy-icon 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: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-section flex w-full items-
|
|
35
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-recipient-address 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: "order-details-recipient-copy-icon 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: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-section flex w-full items-start justify-between gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-expected-label text-as-tertiarry shrink-0", children: order.type === "swap" ||
|
|
36
|
+
order.type === "deposit_first" ||
|
|
37
|
+
order.type === "mint_nft" ||
|
|
38
|
+
order.type === "hype_duel"
|
|
32
39
|
? "Expected to receive"
|
|
33
40
|
: order.type === "join_tournament"
|
|
34
41
|
? "Join tournament"
|
|
@@ -38,5 +45,5 @@ exports.OrderDetailsCollapsible = (0, react_3.memo)(function OrderDetailsCollaps
|
|
|
38
45
|
? order.metadata.action
|
|
39
46
|
? (0, anyspend_1.capitalizeFirstLetter)(order.metadata.action)
|
|
40
47
|
: "Contract execution"
|
|
41
|
-
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex items-end gap-2", children: [order.type === "swap" ? (`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", (0, formatNumber_1.formatNumber)(points), " pts"] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
48
|
+
: "" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-expected-value flex flex-wrap items-center justify-end gap-2", children: [order.type === "swap" || order.type === "deposit_first" ? ((0, jsx_runtime_1.jsx)("span", { className: "order-details-amount-text", children: `~${finalFormattedExpectedDstAmount} ${dstToken.symbol}` })) : order.type === "mint_nft" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-nft-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: nft?.imageUrl, alt: nft?.name || "NFT", className: "order-details-nft-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-nft-name", children: nft?.name || "NFT" })] })) : order.type === "join_tournament" || order.type === "fund_tournament" ? ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-tournament-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: tournament?.imageUrl, alt: tournament?.name || "Tournament", className: "order-details-tournament-image h-5 w-5" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-tournament-name", children: tournament?.name || "Tournament" })] })) : order.type === "hype_duel" ? ((0, jsx_runtime_1.jsx)("div", { className: "order-details-hype-info flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-hype-amount", children: [(0, number_1.formatTokenAmount)(BigInt(order.payload.expectedDstAmount), dstToken.decimals), " HYPE"] }) })) : null, (0, jsx_runtime_1.jsxs)("div", { className: "order-details-chain-info text-as-primary/50 flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "order-details-chain-text", children: ["on ", order.dstChain !== chains_1.b3.id && (0, anyspend_1.getChainName)(order.dstChain)] }), (0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.dstChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.dstChain), className: (0, utils_1.cn)("order-details-chain-logo h-3", order.dstChain !== chains_1.b3.id && "w-3 rounded-full", order.dstChain === chains_1.b3.id && "h-4") })] })] })] }), points !== undefined && points !== null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-points-label text-as-tertiarry", children: "Points" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-points-value text-as-brand font-semibold", children: ["+", (0, formatNumber_1.formatNumber)(points), " pts"] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "order-details-divider divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-id-total-section flex w-full justify-between gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-label text-as-tertiarry", children: showTotal ? "Total (included fee)" : "Order ID" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap", children: showTotal && totalAmount ? totalAmount : order.id })] })] }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-collapsed flex w-full items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" }), (0, jsx_runtime_1.jsx)("button", { className: "order-details-collapsed-button whitespace-nowrap text-sm", onClick: () => setShowOrderDetails(true), children: "Order Details" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" }), (0, jsx_runtime_1.jsx)("div", { className: "order-details-collapsed-divider divider w-full" })] })) }));
|
|
42
49
|
});
|
|
@@ -8,7 +8,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
8
8
|
const react_2 = require("react");
|
|
9
9
|
const StepProgress_1 = require("./StepProgress");
|
|
10
10
|
exports.OrderStatus = (0, react_2.memo)(function OrderStatus({ order, selectedCryptoPaymentMethod, }) {
|
|
11
|
-
const
|
|
11
|
+
const showCheck = order.status === "executed" || order.status === "quoting_after_deposit";
|
|
12
12
|
const { text, status: displayStatus, description } = (0, anyspend_1.getStatusDisplay)(order);
|
|
13
13
|
const searchParams = (0, react_1.useSearchParams)();
|
|
14
14
|
const cryptoPaymentMethod = selectedCryptoPaymentMethod || searchParams.get("cryptoPaymentMethod");
|
|
@@ -38,5 +38,5 @@ exports.OrderStatus = (0, react_2.memo)(function OrderStatus({ order, selectedCr
|
|
|
38
38
|
if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center gap-2", children:
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center gap-2", children: showCheck ? ((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 })] })) }));
|
|
42
42
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface WarningTextProps {
|
|
2
|
+
/** The warning message content */
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Additional CSS classes */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A generic warning text component with consistent styling.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <WarningText>
|
|
12
|
+
* Custom warning message
|
|
13
|
+
* </WarningText>
|
|
14
|
+
*/
|
|
15
|
+
export declare function WarningText({ children, className }: WarningTextProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ChainWarningTextProps {
|
|
17
|
+
/** The chain ID to display warning for */
|
|
18
|
+
chainId: number;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
24
|
+
* Returns null if there's no warning for the given chain.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
31
|
+
*/
|
|
32
|
+
export declare function ChainWarningText({ chainId, className }: ChainWarningTextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarningText = WarningText;
|
|
4
|
+
exports.ChainWarningText = ChainWarningText;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
7
|
+
const cn_1 = require("../../../../shared/utils/cn");
|
|
8
|
+
/**
|
|
9
|
+
* A generic warning text component with consistent styling.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <WarningText>
|
|
13
|
+
* Custom warning message
|
|
14
|
+
* </WarningText>
|
|
15
|
+
*/
|
|
16
|
+
function WarningText({ children, className }) {
|
|
17
|
+
return (0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)("anyspend-warning text-center text-xs italic text-red-500", className), children: children });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
21
|
+
* Returns null if there's no warning for the given chain.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
28
|
+
*/
|
|
29
|
+
function ChainWarningText({ chainId, className }) {
|
|
30
|
+
// Chain-specific warning messages
|
|
31
|
+
if (chainId === anyspend_1.HYPERLIQUID_CHAIN_ID) {
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(WarningText, { className: className, children: ["Minimum deposit amount: ", (0, jsx_runtime_1.jsx)("b", { children: "$1" })] }));
|
|
33
|
+
}
|
|
34
|
+
// No warning for this chain
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreditCardIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const CreditCardIcon = ({ className }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), (0, jsx_runtime_1.jsx)("path", { d: "M30 18H10M19 22H14M10 16.2L10 23.8C10 24.9201 10 25.4802 10.218 25.908C10.4097 26.2843 10.7157 26.5903 11.092 26.782C11.5198 27 12.0799 27 13.2 27L26.8 27C27.9201 27 28.4802 27 28.908 26.782C29.2843 26.5903 29.5903 26.2843 29.782 25.908C30 25.4802 30 24.9201 30 23.8V16.2C30 15.0799 30 14.5198 29.782 14.092C29.5903 13.7157 29.2843 13.4097 28.908 13.218C28.4802 13 27.9201 13 26.8 13L13.2 13C12.0799 13 11.5198 13 11.092 13.218C10.7157 13.4097 10.4097 13.7157 10.218 14.092C10 14.5198 10 15.0799 10 16.2Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
6
|
+
exports.CreditCardIcon = CreditCardIcon;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QrCodeIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const QrCodeIcon = ({ className }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), (0, jsx_runtime_1.jsx)("path", { d: "M15 20H20V25M11.01 20H11M16.01 25H16M20.01 29H20M29.01 20H29M11 25H12.5M23.5 20H25.5M11 29H16M20 10V16M25.6 29H27.4C27.9601 29 28.2401 29 28.454 28.891C28.6422 28.7951 28.7951 28.6422 28.891 28.454C29 28.2401 29 27.9601 29 27.4V25.6C29 25.0399 29 24.7599 28.891 24.546C28.7951 24.3578 28.6422 24.2049 28.454 24.109C28.2401 24 27.9601 24 27.4 24H25.6C25.0399 24 24.7599 24 24.546 24.109C24.3578 24.2049 24.2049 24.3578 24.109 24.546C24 24.7599 24 25.0399 24 25.6V27.4C24 27.9601 24 28.2401 24.109 28.454C24.2049 28.6422 24.3578 28.7951 24.546 28.891C24.7599 29 25.0399 29 25.6 29ZM25.6 16H27.4C27.9601 16 28.2401 16 28.454 15.891C28.6422 15.7951 28.7951 15.6422 28.891 15.454C29 15.2401 29 14.9601 29 14.4V12.6C29 12.0399 29 11.7599 28.891 11.546C28.7951 11.3578 28.6422 11.2049 28.454 11.109C28.2401 11 27.9601 11 27.4 11H25.6C25.0399 11 24.7599 11 24.546 11.109C24.3578 11.2049 24.2049 11.3578 24.109 11.546C24 11.7599 24 12.0399 24 12.6V14.4C24 14.9601 24 15.2401 24.109 15.454C24.2049 15.6422 24.3578 15.7951 24.546 15.891C24.7599 16 25.0399 16 25.6 16ZM12.6 16H14.4C14.9601 16 15.2401 16 15.454 15.891C15.6422 15.7951 15.7951 15.6422 15.891 15.454C16 15.2401 16 14.9601 16 14.4V12.6C16 12.0399 16 11.7599 15.891 11.546C15.7951 11.3578 15.6422 11.2049 15.454 11.109C15.2401 11 14.9601 11 14.4 11H12.6C12.0399 11 11.7599 11 11.546 11.109C11.3578 11.2049 11.2049 11.3578 11.109 11.546C11 11.7599 11 12.0399 11 12.6V14.4C11 14.9601 11 15.2401 11.109 15.454C11.2049 15.6422 11.3578 15.7951 11.546 15.891C11.7599 16 12.0399 16 12.6 16Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
6
|
+
exports.QrCodeIcon = QrCodeIcon;
|
|
@@ -4,6 +4,8 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
|
4
4
|
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
|
|
5
5
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
6
6
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
7
|
+
export { AnySpendDeposit } from "./AnySpendDeposit";
|
|
8
|
+
export type { AnySpendDepositProps, ChainConfig, DepositContractConfig } from "./AnySpendDeposit";
|
|
7
9
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
8
10
|
export * from "./AnySpendFingerprintWrapper";
|
|
9
11
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.HYPE_TOKEN_DETAILS = exports.AnySpendDepositHype = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendCollectorClubPurchase = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
17
|
+
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.HYPE_TOKEN_DETAILS = exports.AnySpendDepositHype = exports.AnySpendDeposit = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendCollectorClubPurchase = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
18
18
|
// Components
|
|
19
19
|
var AnySpend_1 = require("./AnySpend");
|
|
20
20
|
Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
|
|
@@ -28,6 +28,8 @@ var AnySpendCustom_1 = require("./AnySpendCustom");
|
|
|
28
28
|
Object.defineProperty(exports, "AnySpendCustom", { enumerable: true, get: function () { return AnySpendCustom_1.AnySpendCustom; } });
|
|
29
29
|
var AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
|
|
30
30
|
Object.defineProperty(exports, "AnySpendCustomExactIn", { enumerable: true, get: function () { return AnySpendCustomExactIn_1.AnySpendCustomExactIn; } });
|
|
31
|
+
var AnySpendDeposit_1 = require("./AnySpendDeposit");
|
|
32
|
+
Object.defineProperty(exports, "AnySpendDeposit", { enumerable: true, get: function () { return AnySpendDeposit_1.AnySpendDeposit; } });
|
|
31
33
|
var AnyspendDepositHype_1 = require("./AnyspendDepositHype");
|
|
32
34
|
Object.defineProperty(exports, "AnySpendDepositHype", { enumerable: true, get: function () { return AnyspendDepositHype_1.AnySpendDepositHype; } });
|
|
33
35
|
Object.defineProperty(exports, "HYPE_TOKEN_DETAILS", { enumerable: true, get: function () { return AnyspendDepositHype_1.HYPE_TOKEN_DETAILS; } });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./useAnyspendCreateOnrampOrder";
|
|
2
2
|
export * from "./useAnyspendCreateOrder";
|
|
3
|
+
export * from "./useCreateDepositFirstOrder";
|
|
3
4
|
export * from "./useAnyspendOrderAndTransactions";
|
|
4
5
|
export * from "./useAnyspendOrderHistory";
|
|
5
6
|
export * from "./useAnyspendQuote";
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./useAnyspendCreateOnrampOrder"), exports);
|
|
18
18
|
__exportStar(require("./useAnyspendCreateOrder"), exports);
|
|
19
|
+
__exportStar(require("./useCreateDepositFirstOrder"), exports);
|
|
19
20
|
__exportStar(require("./useAnyspendOrderAndTransactions"), exports);
|
|
20
21
|
__exportStar(require("./useAnyspendOrderHistory"), exports);
|
|
21
22
|
__exportStar(require("./useAnyspendQuote"), exports);
|
|
@@ -24,9 +24,9 @@ interface UseAnyspendFlowProps {
|
|
|
24
24
|
destinationTokenChainId?: number;
|
|
25
25
|
slippage?: number;
|
|
26
26
|
disableUrlParamManagement?: boolean;
|
|
27
|
-
orderType?: "hype_duel" | "custom_exact_in";
|
|
27
|
+
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
28
28
|
}
|
|
29
|
-
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder,
|
|
29
|
+
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
|
|
30
30
|
activePanel: PanelView;
|
|
31
31
|
setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
|
|
32
32
|
orderId: string | undefined;
|
|
@@ -28,7 +28,7 @@ var PanelView;
|
|
|
28
28
|
PanelView[PanelView["FEE_DETAIL"] = 7] = "FEE_DETAIL";
|
|
29
29
|
})(PanelView || (exports.PanelView = PanelView = {}));
|
|
30
30
|
// This hook serves for order hype_duel and custom_exact_in
|
|
31
|
-
function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
|
|
31
|
+
function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage = 0, disableUrlParamManagement = false, orderType = "hype_duel", }) {
|
|
32
32
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
33
33
|
const router = (0, react_2.useRouter)();
|
|
34
34
|
// Panel and order state
|
|
@@ -135,16 +135,40 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
|
|
|
135
135
|
// For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
|
|
136
136
|
const effectiveDecimals = paymentType === "fiat" ? anyspend_1.USDC_BASE.decimals : selectedSrcToken.decimals;
|
|
137
137
|
const activeInputAmountInWei = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
// Build quote request based on order type
|
|
139
|
+
const quoteRequest = (() => {
|
|
140
|
+
const baseParams = {
|
|
141
|
+
srcChain: paymentType === "fiat" ? chains_1.base.id : selectedSrcChainId,
|
|
142
|
+
dstChain: selectedDstChainId ?? chains_1.base.id,
|
|
143
|
+
srcTokenAddress: paymentType === "fiat" ? anyspend_1.USDC_BASE.address : selectedSrcToken.address,
|
|
144
|
+
dstTokenAddress: selectedDstToken.address,
|
|
145
|
+
recipientAddress: effectiveRecipientAddress,
|
|
146
|
+
onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
|
|
147
|
+
};
|
|
148
|
+
if (orderType === "swap") {
|
|
149
|
+
return {
|
|
150
|
+
...baseParams,
|
|
151
|
+
type: "swap",
|
|
152
|
+
tradeType: "EXACT_INPUT",
|
|
153
|
+
amount: activeInputAmountInWei,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else if (orderType === "hype_duel") {
|
|
157
|
+
return {
|
|
158
|
+
...baseParams,
|
|
159
|
+
type: "hype_duel",
|
|
160
|
+
amount: activeInputAmountInWei,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return {
|
|
165
|
+
...baseParams,
|
|
166
|
+
type: "custom_exact_in",
|
|
167
|
+
amount: activeInputAmountInWei,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
})();
|
|
171
|
+
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)(quoteRequest);
|
|
148
172
|
// Get geo options for fiat
|
|
149
173
|
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(paymentType === "fiat" ? (0, number_1.formatUnits)(activeInputAmountInWei, anyspend_1.USDC_BASE.decimals) : "0");
|
|
150
174
|
// Update destination amount when quote changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
3
|
+
export type CreateDepositFirstOrderParams = {
|
|
4
|
+
recipientAddress: string;
|
|
5
|
+
srcChain: number;
|
|
6
|
+
dstChain: number;
|
|
7
|
+
srcToken: components["schemas"]["Token"];
|
|
8
|
+
dstToken: components["schemas"]["Token"];
|
|
9
|
+
creatorAddress?: string;
|
|
10
|
+
/** Optional contract config for custom execution after deposit */
|
|
11
|
+
contractConfig?: DepositContractConfig;
|
|
12
|
+
};
|
|
13
|
+
export type UseCreateDepositFirstOrderProps = {
|
|
14
|
+
onSuccess?: (data: any) => void;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
19
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
|
|
22
|
+
createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
|
|
23
|
+
isCreatingOrder: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCreateDepositFirstOrder = useCreateDepositFirstOrder;
|
|
4
|
+
const anyspend_1 = require("../../../anyspend/services/anyspend");
|
|
5
|
+
const utils_1 = require("../../../anyspend/utils");
|
|
6
|
+
const react_1 = require("../../../global-account/react");
|
|
7
|
+
const fingerprintjs_pro_react_1 = require("@fingerprintjs/fingerprintjs-pro-react");
|
|
8
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
/**
|
|
11
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
12
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
13
|
+
*/
|
|
14
|
+
function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
15
|
+
const { partnerId } = (0, react_1.useB3)();
|
|
16
|
+
const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
|
|
17
|
+
const visitorData = fpData && {
|
|
18
|
+
requestId: fpData.requestId,
|
|
19
|
+
visitorId: fpData.visitorId,
|
|
20
|
+
};
|
|
21
|
+
const { mutate: createOrder, isPending } = (0, react_query_1.useMutation)({
|
|
22
|
+
mutationFn: async (params) => {
|
|
23
|
+
const { recipientAddress, srcChain, dstChain, srcToken, dstToken, creatorAddress, contractConfig } = params;
|
|
24
|
+
// Build payload based on whether we have a contract config
|
|
25
|
+
const payload = contractConfig
|
|
26
|
+
? {
|
|
27
|
+
functionAbi: contractConfig.functionAbi,
|
|
28
|
+
functionName: contractConfig.functionName,
|
|
29
|
+
functionArgs: contractConfig.functionArgs,
|
|
30
|
+
to: (0, utils_1.normalizeAddress)(contractConfig.to),
|
|
31
|
+
spenderAddress: contractConfig.spenderAddress ? (0, utils_1.normalizeAddress)(contractConfig.spenderAddress) : undefined,
|
|
32
|
+
action: contractConfig.action,
|
|
33
|
+
}
|
|
34
|
+
: {};
|
|
35
|
+
try {
|
|
36
|
+
return await anyspend_1.anyspendService.createOrder({
|
|
37
|
+
recipientAddress: (0, utils_1.normalizeAddress)(recipientAddress),
|
|
38
|
+
type: "deposit_first",
|
|
39
|
+
srcChain,
|
|
40
|
+
dstChain,
|
|
41
|
+
srcTokenAddress: (0, utils_1.normalizeAddress)(srcToken.address),
|
|
42
|
+
dstTokenAddress: (0, utils_1.normalizeAddress)(dstToken.address),
|
|
43
|
+
srcAmount: "", // Not required for deposit_first
|
|
44
|
+
payload,
|
|
45
|
+
metadata: {
|
|
46
|
+
srcToken: {
|
|
47
|
+
chainId: srcToken.chainId,
|
|
48
|
+
address: srcToken.address,
|
|
49
|
+
symbol: srcToken.symbol,
|
|
50
|
+
name: srcToken.name,
|
|
51
|
+
decimals: srcToken.decimals,
|
|
52
|
+
metadata: srcToken.metadata || {},
|
|
53
|
+
},
|
|
54
|
+
dstToken: {
|
|
55
|
+
chainId: dstToken.chainId,
|
|
56
|
+
address: dstToken.address,
|
|
57
|
+
symbol: dstToken.symbol,
|
|
58
|
+
name: dstToken.name,
|
|
59
|
+
decimals: dstToken.decimals,
|
|
60
|
+
metadata: dstToken.metadata || {},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined,
|
|
64
|
+
partnerId,
|
|
65
|
+
visitorData,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error?.data) {
|
|
70
|
+
throw error.data;
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
onSuccess: (data) => {
|
|
76
|
+
onSuccess?.(data);
|
|
77
|
+
},
|
|
78
|
+
onError: (error) => {
|
|
79
|
+
onError?.(error);
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
return (0, react_2.useMemo)(() => ({
|
|
83
|
+
createOrder,
|
|
84
|
+
isCreatingOrder: isPending,
|
|
85
|
+
}), [createOrder, isPending]);
|
|
86
|
+
}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getErrorDisplay = exports.getStatusDisplay = void 0;
|
|
4
|
+
const number_1 = require("../../shared/utils/number");
|
|
4
5
|
const getStatusDisplay = (order) => {
|
|
6
|
+
const srcToken = order.metadata?.srcToken;
|
|
7
|
+
const dstToken = order.metadata?.dstToken;
|
|
8
|
+
const formattedSrcAmount = srcToken ? (0, number_1.formatTokenAmount)(BigInt(order.srcAmount), srcToken.decimals) : undefined;
|
|
9
|
+
const actualDstAmount = order.settlement?.actualDstAmount;
|
|
10
|
+
const formattedActualDstAmount = actualDstAmount && dstToken ? (0, number_1.formatTokenAmount)(BigInt(actualDstAmount), dstToken.decimals) : undefined;
|
|
5
11
|
switch (order.status) {
|
|
6
|
-
case "scanning_deposit_transaction":
|
|
12
|
+
case "scanning_deposit_transaction": {
|
|
13
|
+
const depositText = formattedSrcAmount && srcToken
|
|
14
|
+
? `Awaiting ${formattedSrcAmount} ${srcToken.symbol}`
|
|
15
|
+
: order.onrampMetadata
|
|
16
|
+
? "Awaiting Payment"
|
|
17
|
+
: "Awaiting Deposit";
|
|
7
18
|
return {
|
|
8
|
-
text:
|
|
19
|
+
text: depositText,
|
|
9
20
|
status: "processing",
|
|
10
21
|
};
|
|
22
|
+
}
|
|
11
23
|
case "waiting_stripe_payment":
|
|
12
24
|
return {
|
|
13
25
|
text: "Awaiting Payment",
|
|
@@ -30,15 +42,16 @@ const getStatusDisplay = (order) => {
|
|
|
30
42
|
description: "It will take approximately one minute to complete.",
|
|
31
43
|
};
|
|
32
44
|
case "executed": {
|
|
45
|
+
const receivedText = formattedActualDstAmount && dstToken ? `Received ${formattedActualDstAmount} ${dstToken.symbol}` : undefined;
|
|
33
46
|
const { text, description } = order.type === "swap"
|
|
34
|
-
? { text: "Swap Complete", description: "Your swap has been completed successfully." }
|
|
47
|
+
? { text: receivedText || "Swap Complete", description: "Your swap has been completed successfully." }
|
|
35
48
|
: order.type === "mint_nft"
|
|
36
49
|
? { text: "NFT Minted", description: "Your NFT has been minted" }
|
|
37
50
|
: order.type === "join_tournament"
|
|
38
51
|
? { text: "Tournament Joined", description: "You have joined the tournament" }
|
|
39
52
|
: order.type === "fund_tournament"
|
|
40
53
|
? { text: "Tournament Funded", description: "You have funded the tournament" }
|
|
41
|
-
: { text: "Order Complete", description: "Your order has been completed" };
|
|
54
|
+
: { text: receivedText || "Order Complete", description: "Your order has been completed" };
|
|
42
55
|
return { text, status: "success", description };
|
|
43
56
|
}
|
|
44
57
|
case "refunding":
|
|
@@ -51,8 +64,18 @@ const getStatusDisplay = (order) => {
|
|
|
51
64
|
status: "failure",
|
|
52
65
|
description: "This order has failed. Please try again or contact support.",
|
|
53
66
|
};
|
|
67
|
+
case "quoting_after_deposit": {
|
|
68
|
+
return {
|
|
69
|
+
text: "Quoting After Deposit",
|
|
70
|
+
status: "processing",
|
|
71
|
+
description: "Getting quote for the order",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
54
74
|
default:
|
|
55
|
-
|
|
75
|
+
return {
|
|
76
|
+
text: order.status,
|
|
77
|
+
status: "processing",
|
|
78
|
+
};
|
|
56
79
|
}
|
|
57
80
|
};
|
|
58
81
|
exports.getStatusDisplay = getStatusDisplay;
|
|
@@ -43,7 +43,8 @@ function AvatarEditor({ onSetAvatar, className }) {
|
|
|
43
43
|
const [zoom, setZoom] = (0, react_2.useState)(1);
|
|
44
44
|
const [croppedAreaPixels, setCroppedAreaPixels] = (0, react_2.useState)(null);
|
|
45
45
|
const fileInputRef = (0, react_2.useRef)(null);
|
|
46
|
-
const {
|
|
46
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
47
|
+
const { user, setUser } = (0, react_1.useAuthentication)(partnerId);
|
|
47
48
|
const setB3ModalContentType = (0, stores_1.useModalStore)(state => state.setB3ModalContentType);
|
|
48
49
|
const contentType = (0, stores_1.useModalStore)(state => state.contentType);
|
|
49
50
|
const account = (0, react_3.useActiveAccount)();
|
|
@@ -4,9 +4,9 @@ exports.B3Provider = B3Provider;
|
|
|
4
4
|
exports.InnerProvider = InnerProvider;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("../../../../global-account/react");
|
|
7
|
+
const useAutoSelectWallet_1 = require("../../../../global-account/react/hooks/useAutoSelectWallet");
|
|
7
8
|
const createWagmiConfig_1 = require("../../../../global-account/react/utils/createWagmiConfig");
|
|
8
9
|
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
9
|
-
const debug_1 = require("../../../../shared/utils/debug");
|
|
10
10
|
require("@relayprotocol/relay-kit-ui/styles.css");
|
|
11
11
|
const react_query_1 = require("@tanstack/react-query");
|
|
12
12
|
const react_2 = require("react");
|
|
@@ -17,7 +17,6 @@ const StyleRoot_1 = require("../StyleRoot");
|
|
|
17
17
|
const index_1 = require("../Toast/index");
|
|
18
18
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
19
19
|
const types_1 = require("./types");
|
|
20
|
-
const debug = (0, debug_1.debugB3React)("B3Provider");
|
|
21
20
|
/**
|
|
22
21
|
* Default permissions configuration for B3 provider
|
|
23
22
|
*/
|
|
@@ -51,52 +50,26 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
51
50
|
*/
|
|
52
51
|
function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
53
52
|
const activeAccount = (0, react_3.useActiveAccount)();
|
|
54
|
-
const [manuallySelectedWallet, setManuallySelectedWallet] = (0, react_2.useState)(undefined);
|
|
55
|
-
const wallets = (0, react_3.useConnectedWallets)();
|
|
56
53
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
57
|
-
const isConnected =
|
|
58
|
-
const justCompletedLogin =
|
|
59
|
-
const setActiveWallet = (0, react_3.useSetActiveWallet)();
|
|
60
|
-
const { user, setUser, refetchUser } = (0, react_1.useAuthentication)(partnerId);
|
|
61
|
-
debug("@@B3Provider:isConnected", isConnected);
|
|
62
|
-
debug("@@wallets", wallets);
|
|
63
|
-
debug("@@B3Provider:user", user);
|
|
64
|
-
debug("@@B3Provider:justCompletedLogin", justCompletedLogin);
|
|
54
|
+
//const isConnected = useAuthStore(state => state.isConnected);
|
|
55
|
+
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
65
56
|
// Use given accountOverride or activeAccount from thirdweb
|
|
57
|
+
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
58
|
+
// skip isAuthenticated check ?
|
|
66
59
|
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
(0, react_2.useEffect)(() => {
|
|
74
|
-
const autoSelectFirstEOAWallet = async () => {
|
|
75
|
-
// Only proceed if auto-selection is enabled and user is authenticated
|
|
76
|
-
if (!automaticallySetFirstEoa || !isAuthenticated) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// Find the first EOA wallet (excluding ecosystem wallets)
|
|
80
|
-
const isEOAWallet = (wallet) => !wallet.id.startsWith("ecosystem.");
|
|
81
|
-
const firstEOAWallet = wallets.find(isEOAWallet);
|
|
82
|
-
if (firstEOAWallet) {
|
|
83
|
-
// Only auto-select if the last auth was via wallet or no previous auth provider
|
|
84
|
-
const lastAuthProvider = await (0, react_3.getLastAuthProvider)();
|
|
85
|
-
const shouldAutoSelect = lastAuthProvider === null || lastAuthProvider === "wallet";
|
|
86
|
-
if (shouldAutoSelect) {
|
|
87
|
-
setWallet(firstEOAWallet);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
autoSelectFirstEOAWallet();
|
|
92
|
-
}, [automaticallySetFirstEoa, isAuthenticated, setWallet, wallets]);
|
|
60
|
+
// Wrapper to set active wallet via thirdweb
|
|
61
|
+
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
62
|
+
// Auto-select first EOA wallet when enabled
|
|
63
|
+
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
64
|
+
enabled: automaticallySetFirstEoa,
|
|
65
|
+
});
|
|
93
66
|
return ((0, jsx_runtime_1.jsx)(types_1.B3Context.Provider, { value: {
|
|
94
67
|
account: effectiveAccount,
|
|
95
|
-
setWallet,
|
|
96
|
-
wallet:
|
|
97
|
-
user,
|
|
98
|
-
setUser,
|
|
99
|
-
refetchUser,
|
|
68
|
+
// setWallet,
|
|
69
|
+
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
70
|
+
//user,
|
|
71
|
+
//setUser,
|
|
72
|
+
//refetchUser,
|
|
100
73
|
initialized: true,
|
|
101
74
|
ready: !!effectiveAccount,
|
|
102
75
|
automaticallySetFirstEoa,
|
|
@@ -108,11 +81,8 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
|
|
|
108
81
|
stripePublishableKey,
|
|
109
82
|
createClientReferenceId,
|
|
110
83
|
enableTurnkey,
|
|
111
|
-
}, children:
|
|
84
|
+
}, children: children }));
|
|
112
85
|
}
|
|
113
|
-
const InnerProvider2 = ({ children }) => {
|
|
114
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
115
|
-
};
|
|
116
86
|
/**
|
|
117
87
|
* Component to connect the toast context to the global toast API
|
|
118
88
|
*/
|