@b3dotfun/sdk 0.0.33 → 0.0.34-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +65 -60
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/types/api.d.ts +130 -14
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +1 -0
- package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/cjs/global-account/react/components/index.d.ts +8 -9
- package/dist/cjs/global-account/react/components/index.js +25 -28
- package/dist/cjs/global-account/react/index.native.d.ts +2 -1
- package/dist/cjs/global-account/react/index.native.js +5 -3
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +48 -43
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/types/api.d.ts +130 -14
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.js +1 -0
- package/dist/esm/anyspend/utils/orderPayload.js +7 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/esm/global-account/react/components/index.d.ts +8 -9
- package/dist/esm/global-account/react/components/index.js +8 -10
- package/dist/esm/global-account/react/index.native.d.ts +2 -1
- package/dist/esm/global-account/react/index.native.js +2 -1
- package/dist/esm/global-account/react/stores/index.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/types/anyspend/types/api.d.ts +130 -14
- package/dist/types/global-account/react/components/index.d.ts +8 -9
- package/dist/types/global-account/react/index.native.d.ts +2 -1
- package/dist/types/global-account/react/stores/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -22
- package/package.json +2 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +95 -71
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/types/api.ts +131 -11
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/format.ts +1 -0
- package/src/anyspend/utils/orderPayload.ts +7 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -4
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +10 -0
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +6 -6
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +109 -83
- package/src/global-account/react/components/index.ts +13 -16
- package/src/global-account/react/index.native.ts +2 -1
- package/src/global-account/react/stores/index.ts +1 -2
- package/src/global-account/react/stores/useModalStore.ts +3 -23
- package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/cjs/global-account/react/components/Transak/TransakModal.js +0 -110
- package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/esm/global-account/react/components/Transak/TransakModal.js +0 -104
- package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/src/global-account/react/components/Transak/TransakModal.tsx +0 -131
|
@@ -59,13 +59,30 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
59
59
|
const [unlinkingAccountId, setUnlinkingAccountId] = (0, react_2.useState)(null);
|
|
60
60
|
const { data: profilesRaw = [], isLoading: isLoadingProfiles } = (0, react_3.useProfiles)({ client: thirdweb_1.client });
|
|
61
61
|
const { mutate: unlinkProfile, isPending: isUnlinking } = (0, react_3.useUnlinkProfile)();
|
|
62
|
-
const { setB3ModalOpen, setB3ModalContentType, isLinking } = (0, react_1.useModalStore)();
|
|
62
|
+
const { setB3ModalOpen, setB3ModalContentType, isLinking, contentType } = (0, react_1.useModalStore)();
|
|
63
63
|
const { user, setUser } = (0, react_1.useB3)();
|
|
64
64
|
const [isUpdatingCode, setIsUpdatingCode] = (0, react_2.useState)(false);
|
|
65
65
|
const [newReferralCode, setNewReferralCode] = (0, react_2.useState)("");
|
|
66
66
|
const [isEditingCode, setIsEditingCode] = (0, react_2.useState)(false);
|
|
67
67
|
const referallCodeRef = (0, react_2.useRef)(null);
|
|
68
68
|
const { data: referrals, isLoading: isLoadingReferrals } = (0, react_1.useQueryB3)("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
|
|
69
|
+
const showReferralInfo = contentType?.showReferralInfo ?? false;
|
|
70
|
+
const mutationOptions = {
|
|
71
|
+
onError: (error) => {
|
|
72
|
+
console.error("Error Unlinking account:", error);
|
|
73
|
+
sonner_1.toast.error(error.message);
|
|
74
|
+
},
|
|
75
|
+
onSuccess: async (data) => {
|
|
76
|
+
console.log("Raw Link Account Data:", data);
|
|
77
|
+
try {
|
|
78
|
+
console.log("Sync user data...");
|
|
79
|
+
await app_1.default.service("users").syncTwProfiles({});
|
|
80
|
+
}
|
|
81
|
+
catch (refreshError) {
|
|
82
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
};
|
|
69
86
|
// Fetch referred users
|
|
70
87
|
const currentReferralCode = user?.referralCode || user?.userId || "";
|
|
71
88
|
const handleCopyCode = async () => {
|
|
@@ -108,7 +125,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
108
125
|
const handleUnlink = async (profile) => {
|
|
109
126
|
setUnlinkingAccountId(profile.title);
|
|
110
127
|
try {
|
|
111
|
-
unlinkProfile({ client: thirdweb_1.client, profileToUnlink: profile.originalProfile });
|
|
128
|
+
unlinkProfile({ client: thirdweb_1.client, profileToUnlink: profile.originalProfile }, mutationOptions);
|
|
112
129
|
}
|
|
113
130
|
catch (error) {
|
|
114
131
|
console.error("Error unlinking account:", error);
|
|
@@ -135,7 +152,9 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
135
152
|
},
|
|
136
153
|
});
|
|
137
154
|
};
|
|
138
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }),
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
|
|
156
|
+
/* Referral Section */
|
|
157
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }) : "Save" }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
139
158
|
setIsEditingCode(false);
|
|
140
159
|
setNewReferralCode("");
|
|
141
160
|
}, children: "Cancel" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "icon", variant: "ghost", onClick: handleCopyCode, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "icon", variant: "ghost", onClick: () => {
|
|
@@ -143,7 +162,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
143
162
|
setTimeout(() => {
|
|
144
163
|
referallCodeRef.current?.focus();
|
|
145
164
|
}, 100);
|
|
146
|
-
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { className: "h-4 w-4" }) })] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: referrals.data.map((referral) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: referral.referreeId }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line rounded-xl p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), (0, jsx_runtime_1.jsx)("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
|
|
165
|
+
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { className: "h-4 w-4" }) })] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-line rounded-xl p-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center py-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: referrals.data.map((referral) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: referral.referreeId }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-line rounded-xl p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), (0, jsx_runtime_1.jsx)("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
|
|
147
166
|
};
|
|
148
167
|
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1", children: (0, jsx_runtime_1.jsxs)(react_1.TabsPrimitive, { defaultValue: activeTab, onValueChange: value => {
|
|
149
168
|
const tab = value;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
2
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
3
2
|
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 { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
|
-
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
9
|
-
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
10
7
|
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
|
|
11
8
|
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
12
9
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
10
|
+
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
11
|
+
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
12
|
+
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
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,12 +19,15 @@ 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";
|
|
23
22
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
24
23
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
25
24
|
export { CopyToClipboard } from "./custom/CopyToClipboard";
|
|
26
25
|
export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
|
|
27
26
|
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";
|
|
28
31
|
export { Badge, badgeVariants } from "./ui/badge";
|
|
29
32
|
export { Button, buttonVariants } from "./ui/button";
|
|
30
33
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command";
|
|
@@ -33,13 +36,9 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
|
|
|
33
36
|
export { GlareCard } from "./ui/glare-card";
|
|
34
37
|
export { GlareCardRounded } from "./ui/glare-card-rounded";
|
|
35
38
|
export { Input } from "./ui/input";
|
|
36
|
-
export { Loading } from "./ui/Loading";
|
|
37
39
|
export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
38
40
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
39
|
-
export { ShinyButton } from "./ui/ShinyButton";
|
|
40
41
|
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";
|
|
43
42
|
export { TextLoop } from "./ui/text-loop";
|
|
44
43
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
45
44
|
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.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.TabTriggerPrimitive = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTrigger = exports.ShinyButton = exports.Loading = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.StyleRoot = exports.useB3 = exports.B3Context = exports.RelayKitProviderWrapper = exports.InnerProvider = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
4
|
+
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.Skeleton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = 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 = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = 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; } });
|
|
8
6
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
9
7
|
Object.defineProperty(exports, "B3DynamicModal", { enumerable: true, get: function () { return B3DynamicModal_1.B3DynamicModal; } });
|
|
10
8
|
var B3Provider_1 = require("./B3Provider/B3Provider");
|
|
11
9
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_1.B3Provider; } });
|
|
12
10
|
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 AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
21
|
-
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
22
|
-
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
23
|
-
Object.defineProperty(exports, "PermissionItem", { enumerable: true, get: function () { return PermissionItem_1.PermissionItem; } });
|
|
24
|
-
var WalletRow_1 = require("./SignInWithB3/components/WalletRow");
|
|
25
|
-
Object.defineProperty(exports, "WalletRow", { enumerable: true, get: function () { return WalletRow_1.WalletRow; } });
|
|
26
20
|
var SignInWithB3_1 = require("./SignInWithB3/SignInWithB3");
|
|
27
21
|
Object.defineProperty(exports, "SignInWithB3", { enumerable: true, get: function () { return SignInWithB3_1.SignInWithB3; } });
|
|
28
22
|
var SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
29
23
|
Object.defineProperty(exports, "SignInWithB3Flow", { enumerable: true, get: function () { return SignInWithB3Flow_1.SignInWithB3Flow; } });
|
|
30
24
|
var SignInWithB3Privy_1 = require("./SignInWithB3/SignInWithB3Privy");
|
|
31
25
|
Object.defineProperty(exports, "SignInWithB3Privy", { enumerable: true, get: function () { return SignInWithB3Privy_1.SignInWithB3Privy; } });
|
|
26
|
+
var AuthButton_1 = require("./SignInWithB3/components/AuthButton");
|
|
27
|
+
Object.defineProperty(exports, "AuthButton", { enumerable: true, get: function () { return AuthButton_1.AuthButton; } });
|
|
28
|
+
var PermissionItem_1 = require("./SignInWithB3/components/PermissionItem");
|
|
29
|
+
Object.defineProperty(exports, "PermissionItem", { enumerable: true, get: function () { return PermissionItem_1.PermissionItem; } });
|
|
30
|
+
var WalletRow_1 = require("./SignInWithB3/components/WalletRow");
|
|
31
|
+
Object.defineProperty(exports, "WalletRow", { enumerable: true, get: function () { return WalletRow_1.WalletRow; } });
|
|
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,9 +54,6 @@ 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; } });
|
|
60
57
|
// Custom Components
|
|
61
58
|
var Button_1 = require("./custom/Button");
|
|
62
59
|
Object.defineProperty(exports, "CustomButton", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
@@ -70,6 +67,21 @@ Object.defineProperty(exports, "StaggeredFadeLoader", { enumerable: true, get: f
|
|
|
70
67
|
var WalletConnectorIcon_1 = require("./custom/WalletConnectorIcon");
|
|
71
68
|
Object.defineProperty(exports, "WalletConnectorIcon", { enumerable: true, get: function () { return WalletConnectorIcon_1.WalletConnectorIcon; } });
|
|
72
69
|
// 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; } });
|
|
73
85
|
var badge_1 = require("./ui/badge");
|
|
74
86
|
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return badge_1.Badge; } });
|
|
75
87
|
Object.defineProperty(exports, "badgeVariants", { enumerable: true, get: function () { return badge_1.badgeVariants; } });
|
|
@@ -114,8 +126,6 @@ var glare_card_rounded_1 = require("./ui/glare-card-rounded");
|
|
|
114
126
|
Object.defineProperty(exports, "GlareCardRounded", { enumerable: true, get: function () { return glare_card_rounded_1.GlareCardRounded; } });
|
|
115
127
|
var input_1 = require("./ui/input");
|
|
116
128
|
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; } });
|
|
119
129
|
var popover_1 = require("./ui/popover");
|
|
120
130
|
Object.defineProperty(exports, "Popover", { enumerable: true, get: function () { return popover_1.Popover; } });
|
|
121
131
|
Object.defineProperty(exports, "PopoverContent", { enumerable: true, get: function () { return popover_1.PopoverContent; } });
|
|
@@ -123,21 +133,8 @@ Object.defineProperty(exports, "PopoverTrigger", { enumerable: true, get: functi
|
|
|
123
133
|
var scroll_area_1 = require("./ui/scroll-area");
|
|
124
134
|
Object.defineProperty(exports, "ScrollArea", { enumerable: true, get: function () { return scroll_area_1.ScrollArea; } });
|
|
125
135
|
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; } });
|
|
128
136
|
var skeleton_1 = require("./ui/skeleton");
|
|
129
137
|
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; } });
|
|
141
138
|
var text_loop_1 = require("./ui/text-loop");
|
|
142
139
|
Object.defineProperty(exports, "TextLoop", { enumerable: true, get: function () { return text_loop_1.TextLoop; } });
|
|
143
140
|
var text_shimmer_1 = require("./ui/text-shimmer");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
3
2
|
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
+
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
4
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
5
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
|
+
export { useProfile } from "./hooks/useProfile";
|
|
6
7
|
export { useSiwe } from "./hooks/useSiwe";
|
|
7
8
|
export { useAuthStore } from "./stores/useAuthStore";
|
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
// export * from "./hooks";
|
|
4
4
|
// export * from "./stores";
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useAuthStore = exports.useSiwe = exports.useAuthentication = exports.useAccountWallet = exports.
|
|
6
|
+
exports.useAuthStore = exports.useSiwe = exports.useProfile = exports.useAuthentication = exports.useAccountWallet = exports.useB3 = exports.B3Context = exports.B3Provider = void 0;
|
|
7
7
|
// We only export the components and hooks that are needed for the native app
|
|
8
8
|
var B3Provider_native_1 = require("./components/B3Provider/B3Provider.native");
|
|
9
9
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_native_1.B3Provider; } });
|
|
10
|
-
var useB3_1 = require("./components/B3Provider/useB3");
|
|
11
|
-
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
12
10
|
var types_1 = require("./components/B3Provider/types");
|
|
13
11
|
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
12
|
+
var useB3_1 = require("./components/B3Provider/useB3");
|
|
13
|
+
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
14
14
|
var useAccountWallet_1 = require("./hooks/useAccountWallet");
|
|
15
15
|
Object.defineProperty(exports, "useAccountWallet", { enumerable: true, get: function () { return useAccountWallet_1.useAccountWallet; } });
|
|
16
16
|
var useAuthentication_1 = require("./hooks/useAuthentication");
|
|
17
17
|
Object.defineProperty(exports, "useAuthentication", { enumerable: true, get: function () { return useAuthentication_1.useAuthentication; } });
|
|
18
|
+
var useProfile_1 = require("./hooks/useProfile");
|
|
19
|
+
Object.defineProperty(exports, "useProfile", { enumerable: true, get: function () { return useProfile_1.useProfile; } });
|
|
18
20
|
var useSiwe_1 = require("./hooks/useSiwe");
|
|
19
21
|
Object.defineProperty(exports, "useSiwe", { enumerable: true, get: function () { return useSiwe_1.useSiwe; } });
|
|
20
22
|
var useAuthStore_1 = require("./stores/useAuthStore");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
2
|
export { useModalStore } from "./useModalStore";
|
|
3
|
-
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps,
|
|
3
|
+
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -82,6 +82,8 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
82
82
|
activeTab?: "overview" | "tokens" | "nfts" | "apps" | "settings";
|
|
83
83
|
/** Function to set the active tab */
|
|
84
84
|
setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
|
|
85
|
+
/** Whether to show the referral information */
|
|
86
|
+
showReferralInfo?: boolean;
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
89
|
* Props for the AnySpend modal
|
|
@@ -183,24 +185,6 @@ export interface AnyspendOrderDetailsProps extends BaseModalProps {
|
|
|
183
185
|
/** Whether to show the back button */
|
|
184
186
|
showBackButton?: boolean;
|
|
185
187
|
}
|
|
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
|
-
}
|
|
204
188
|
/**
|
|
205
189
|
* Props for the AnySpend order history modal
|
|
206
190
|
*/
|
|
@@ -298,17 +282,15 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
298
282
|
sourceTokenChainId?: number;
|
|
299
283
|
/** Payment type - crypto or fiat */
|
|
300
284
|
paymentType?: "crypto" | "fiat";
|
|
301
|
-
/** Deposit contract address */
|
|
302
|
-
depositContractAddress: string;
|
|
303
285
|
/** Main footer */
|
|
304
286
|
mainFooter?: React.ReactNode;
|
|
305
287
|
/** Callback function called when the deposit is successful */
|
|
306
|
-
onSuccess?: () => void;
|
|
288
|
+
onSuccess?: (amount?: string) => void;
|
|
307
289
|
}
|
|
308
290
|
/**
|
|
309
291
|
* Union type of all possible modal content types
|
|
310
292
|
*/
|
|
311
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps |
|
|
293
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
|
|
312
294
|
/**
|
|
313
295
|
* State interface for the modal store
|
|
314
296
|
*/
|
|
@@ -650,12 +650,12 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
650
650
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
651
651
|
}, [activePanel]);
|
|
652
652
|
const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: () => setActivePanel(PanelView.MAIN), onSelectOrder: onSelectOrder }) }));
|
|
653
|
-
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
653
|
+
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: () => {
|
|
654
654
|
setOrderId(undefined);
|
|
655
655
|
setActivePanel(PanelView.MAIN);
|
|
656
656
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
657
657
|
} })] })) }) }));
|
|
658
|
-
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { 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: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
|
|
658
|
+
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(PaySection, { paymentType: "crypto", selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, selectedFiatPaymentMethod: selectedFiatPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), onSelectFiatPaymentMethod: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { 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: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
|
|
659
659
|
if (activeTab === "fiat" || isBuyMode) {
|
|
660
660
|
return;
|
|
661
661
|
}
|
|
@@ -413,7 +413,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
413
413
|
const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
|
|
414
414
|
setActivePanel(PanelView.HISTORY);
|
|
415
415
|
}, onSelectOrder: onSelectOrder }) }));
|
|
416
|
-
const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatusDisplay, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
416
|
+
const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatusDisplay, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
417
417
|
setOrderId(undefined);
|
|
418
418
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
419
419
|
// Remove orderId from URL when canceling
|
|
@@ -10,7 +10,6 @@ export interface AnySpendDepositHypeProps {
|
|
|
10
10
|
sourceTokenAddress?: string;
|
|
11
11
|
sourceTokenChainId?: number;
|
|
12
12
|
onSuccess?: () => void;
|
|
13
|
-
depositContractAddress?: string;
|
|
14
13
|
mainFooter?: React.ReactNode;
|
|
15
14
|
}
|
|
16
15
|
export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { B3_TOKEN
|
|
2
|
+
import { B3_TOKEN } from "../../../anyspend/index.js";
|
|
3
3
|
import { Button, ShinyButton, StyleRoot, TransitionPanel } from "../../../global-account/react/index.js";
|
|
4
4
|
import { cn } from "../../../shared/utils/cn.js";
|
|
5
5
|
import invariant from "invariant";
|
|
6
6
|
import { motion } from "motion/react";
|
|
7
7
|
import { useMemo } from "react";
|
|
8
8
|
import { toast } from "sonner";
|
|
9
|
-
import { encodeFunctionData } from "viem";
|
|
10
9
|
import { base } from "viem/chains";
|
|
11
10
|
import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow.js";
|
|
12
11
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
@@ -18,7 +17,6 @@ import { OrderDetails } from "./common/OrderDetails.js";
|
|
|
18
17
|
import { OrderStatus } from "./common/OrderStatus.js";
|
|
19
18
|
import { PaySection } from "./common/PaySection.js";
|
|
20
19
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
21
|
-
import { ESCROW_ABI } from "../../../anyspend/abis/escrow.js";
|
|
22
20
|
import { ArrowDown } from "lucide-react";
|
|
23
21
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
24
22
|
const SLIPPAGE_PERCENT = 3;
|
|
@@ -26,20 +24,11 @@ export const HYPE_TOKEN_DETAILS = {
|
|
|
26
24
|
SYMBOL: "HYPE",
|
|
27
25
|
LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
|
|
28
26
|
};
|
|
29
|
-
function generateEncodedDataForDepositHype(amount, beneficiary) {
|
|
30
|
-
invariant(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
31
|
-
const encodedData = encodeFunctionData({
|
|
32
|
-
abi: ESCROW_ABI,
|
|
33
|
-
functionName: "depositFor",
|
|
34
|
-
args: [beneficiary, B3_TOKEN.address, BigInt(amount)],
|
|
35
|
-
});
|
|
36
|
-
return encodedData;
|
|
37
|
-
}
|
|
38
27
|
export function AnySpendDepositHype(props) {
|
|
39
28
|
const fingerprintConfig = getFingerprintConfig();
|
|
40
29
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendDepositHypeInner, { ...props }) }));
|
|
41
30
|
}
|
|
42
|
-
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess,
|
|
31
|
+
function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, }) {
|
|
43
32
|
// Use shared flow hook
|
|
44
33
|
const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = useAnyspendFlow({
|
|
45
34
|
paymentType,
|
|
@@ -132,28 +121,17 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
132
121
|
try {
|
|
133
122
|
invariant(anyspendQuote, "Relay price is not found");
|
|
134
123
|
invariant(selectedRecipientAddress, "Recipient address is not found");
|
|
135
|
-
invariant(depositContractAddress, "Deposit contract address is not found");
|
|
136
124
|
const srcAmountBigInt = BigInt(activeInputAmountInWei);
|
|
137
|
-
// TODO: temp subtract 3% for slippage
|
|
138
|
-
const originalDepositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
139
|
-
const depositAmountWei = ((BigInt(originalDepositAmountWei) * BigInt(100 - SLIPPAGE_PERCENT)) /
|
|
140
|
-
BigInt(100)).toString();
|
|
141
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
142
125
|
createOrder({
|
|
143
126
|
recipientAddress: selectedRecipientAddress,
|
|
144
|
-
orderType: "
|
|
127
|
+
orderType: "hype_duel",
|
|
145
128
|
srcChain: selectedSrcChainId,
|
|
146
129
|
dstChain: base.id,
|
|
147
130
|
srcToken: selectedSrcToken,
|
|
148
131
|
dstToken: B3_TOKEN,
|
|
149
132
|
srcAmount: srcAmountBigInt.toString(),
|
|
133
|
+
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
150
134
|
creatorAddress: globalAddress,
|
|
151
|
-
payload: {
|
|
152
|
-
amount: depositAmountWei,
|
|
153
|
-
data: encodedData,
|
|
154
|
-
to: depositContractAddress,
|
|
155
|
-
action: DEPOSIT_HYPE_ACTION,
|
|
156
|
-
},
|
|
157
135
|
});
|
|
158
136
|
}
|
|
159
137
|
catch (err) {
|
|
@@ -166,7 +144,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
166
144
|
try {
|
|
167
145
|
invariant(anyspendQuote, "Relay price is not found");
|
|
168
146
|
invariant(selectedRecipientAddress, "Recipient address is not found");
|
|
169
|
-
invariant(depositContractAddress, "Deposit contract address is not found");
|
|
170
147
|
if (!srcAmount || parseFloat(srcAmount) <= 0) {
|
|
171
148
|
toast.error("Please enter a valid amount");
|
|
172
149
|
return;
|
|
@@ -194,11 +171,9 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
194
171
|
toast.error("Please select a payment method");
|
|
195
172
|
return;
|
|
196
173
|
}
|
|
197
|
-
const depositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
198
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
199
174
|
createOnrampOrder({
|
|
200
175
|
recipientAddress: selectedRecipientAddress,
|
|
201
|
-
orderType: "
|
|
176
|
+
orderType: "hype_duel",
|
|
202
177
|
dstChain: base.id,
|
|
203
178
|
dstToken: B3_TOKEN,
|
|
204
179
|
srcFiatAmount: srcAmount,
|
|
@@ -210,12 +185,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
210
185
|
},
|
|
211
186
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
212
187
|
creatorAddress: globalAddress,
|
|
213
|
-
payload: {
|
|
214
|
-
amount: depositAmountWei,
|
|
215
|
-
data: encodedData,
|
|
216
|
-
to: depositContractAddress,
|
|
217
|
-
action: DEPOSIT_HYPE_ACTION,
|
|
218
|
-
},
|
|
219
188
|
});
|
|
220
189
|
}
|
|
221
190
|
catch (err) {
|
|
@@ -224,7 +193,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
224
193
|
}
|
|
225
194
|
};
|
|
226
195
|
// Order details view
|
|
227
|
-
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs,
|
|
196
|
+
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: oat.data.order, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }), _jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, onBack: () => {
|
|
228
197
|
setOrderId(undefined);
|
|
229
198
|
setActivePanel(PanelView.MAIN);
|
|
230
199
|
}, disableUrlParamManagement: true })] })) }) }));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
interface InsufficientDepositPaymentProps {
|
|
3
|
+
order: components["schemas"]["Order"];
|
|
4
|
+
srcToken: components["schemas"]["Token"];
|
|
5
|
+
depositDeficit: bigint;
|
|
6
|
+
phantomWalletAddress: string | null;
|
|
7
|
+
txLoading: boolean;
|
|
8
|
+
isSwitchingOrExecuting: boolean;
|
|
9
|
+
onPayment: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function InsufficientDepositPayment({ order, srcToken, depositDeficit, phantomWalletAddress, txLoading, isSwitchingOrExecuting, onPayment, }: InsufficientDepositPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { ALL_CHAINS, getChainName, getPaymentUrl, RELAY_ETH_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, } from "../../../../anyspend/index.js";
|
|
4
|
+
import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "../../../../global-account/react/index.js";
|
|
5
|
+
import { cn } from "../../../../shared/utils/index.js";
|
|
6
|
+
import { b3 } from "viem/chains";
|
|
7
|
+
import { formatUnits } from "../../../../shared/utils/number.js";
|
|
8
|
+
import { WalletCoinbase, WalletMetamask, WalletPhantom, WalletTrust } from "@web3icons/react";
|
|
9
|
+
import { ChevronRight, Copy, Loader2 } from "lucide-react";
|
|
10
|
+
import { motion } from "motion/react";
|
|
11
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
12
|
+
import { toast } from "sonner";
|
|
13
|
+
export function InsufficientDepositPayment({ order, srcToken, depositDeficit, phantomWalletAddress, txLoading, isSwitchingOrExecuting, onPayment, }) {
|
|
14
|
+
const depositDeficitAmount = formatUnits(depositDeficit.toString(), srcToken.decimals);
|
|
15
|
+
return (_jsxs("div", { className: "insufficient-deposit-payment relative flex w-full flex-1 flex-col", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "insufficient-deposit-payment-text text-as-primary/50", children: "Please send remaining" }), _jsxs("div", { className: "flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0", children: [_jsx(CopyToClipboard, { text: depositDeficitAmount, onCopy: () => {
|
|
16
|
+
toast.success("Copied to clipboard");
|
|
17
|
+
}, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("strong", { className: "border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl", children: [depositDeficitAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs(Badge, { variant: "outline", className: "flex h-10 items-center gap-2 px-3 py-1 pr-2 text-sm", children: ["on ", getChainName(order.srcChain), _jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") })] })] }), _jsx("span", { className: "text-as-primary/50 mb-1 mt-2", children: " to the address:" })] }), _jsx(CopyToClipboard, { text: order.globalAddress, onCopy: () => {
|
|
18
|
+
toast.success("Copied to clipboard");
|
|
19
|
+
}, children: _jsxs("div", { className: "payment-address bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs("div", { className: "payment-buttons mt-4 flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
20
|
+
? "Pay from Phantom Wallet"
|
|
21
|
+
: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsx("div", { children: "Or" }), _jsx(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: _jsxs("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) })] })] }));
|
|
22
|
+
}
|
|
@@ -3,10 +3,10 @@ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
|
3
3
|
interface OrderDetailsProps {
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
order: components["schemas"]["Order"];
|
|
6
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
7
|
-
|
|
6
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
7
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
8
8
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
9
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
9
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
10
10
|
cryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
11
11
|
onBack?: () => void;
|
|
12
12
|
disableUrlParamManagement?: boolean;
|