@b3dotfun/sdk 0.0.40-alpha.2 → 0.0.40-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +8 -4
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +26 -10
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -3
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +0 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +8 -8
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +10 -6
- package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/providers/index.js +3 -0
- package/dist/cjs/anyspend/types/api.d.ts +11 -1
- package/dist/cjs/anyspend/utils/orderPayload.js +1 -0
- package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
- package/dist/cjs/bondkit/bondkitToken.js +268 -2
- package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/cjs/bondkit/config.d.ts +1 -1
- package/dist/cjs/bondkit/config.js +5 -2
- package/dist/cjs/bondkit/constants.d.ts +4 -0
- package/dist/cjs/bondkit/constants.js +6 -1
- package/dist/cjs/bondkit/index.d.ts +1 -0
- package/dist/cjs/bondkit/index.js +4 -1
- package/dist/cjs/bondkit/swapService.d.ts +43 -0
- package/dist/cjs/bondkit/swapService.js +373 -0
- package/dist/cjs/bondkit/types.d.ts +10 -4
- package/dist/cjs/bondkit/types.js +4 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +35 -9
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -4
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +26 -10
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -3
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +0 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -8
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +10 -6
- package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -0
- package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
- package/dist/esm/anyspend/react/providers/index.js +1 -0
- package/dist/esm/anyspend/types/api.d.ts +11 -1
- package/dist/esm/anyspend/utils/orderPayload.js +1 -0
- package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
- package/dist/esm/bondkit/bondkitToken.js +268 -2
- package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/esm/bondkit/config.d.ts +1 -1
- package/dist/esm/bondkit/config.js +5 -2
- package/dist/esm/bondkit/constants.d.ts +4 -0
- package/dist/esm/bondkit/constants.js +5 -0
- package/dist/esm/bondkit/index.d.ts +1 -0
- package/dist/esm/bondkit/index.js +2 -0
- package/dist/esm/bondkit/swapService.d.ts +43 -0
- package/dist/esm/bondkit/swapService.js +369 -0
- package/dist/esm/bondkit/types.d.ts +10 -4
- package/dist/esm/bondkit/types.js +4 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +36 -9
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/types/anyspend/react/providers/index.d.ts +1 -0
- package/dist/types/anyspend/types/api.d.ts +11 -1
- package/dist/types/bondkit/bondkitToken.d.ts +37 -2
- package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/types/bondkit/config.d.ts +1 -1
- package/dist/types/bondkit/constants.d.ts +4 -0
- package/dist/types/bondkit/index.d.ts +1 -0
- package/dist/types/bondkit/swapService.d.ts +43 -0
- package/dist/types/bondkit/types.d.ts +10 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
- package/package.json +6 -5
- package/src/anyspend/react/components/AnySpend.tsx +24 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +55 -13
- package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +22 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -1
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -4
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +61 -45
- package/src/anyspend/react/components/common/OrderDetails.tsx +8 -9
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
- package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
- package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/types/api.ts +11 -1
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/orderPayload.ts +1 -0
- package/src/bondkit/bondkitToken.ts +323 -3
- package/src/bondkit/bondkitTokenFactory.ts +2 -2
- package/src/bondkit/config.ts +5 -2
- package/src/bondkit/constants.ts +7 -0
- package/src/bondkit/index.ts +3 -0
- package/src/bondkit/swapService.ts +461 -0
- package/src/bondkit/types.ts +12 -5
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +51 -15
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
- package/src/global-account/react/hooks/useAuthentication.ts +1 -2
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +23 -21
|
@@ -10,6 +10,7 @@ const react_1 = require("../../../../global-account/react");
|
|
|
10
10
|
const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
|
|
11
11
|
const formatNumber_1 = require("../../../../shared/utils/formatNumber");
|
|
12
12
|
const thirdweb_1 = require("../../../../shared/utils/thirdweb");
|
|
13
|
+
const truncateAddress_1 = require("../../../../shared/utils/truncateAddress");
|
|
13
14
|
const lucide_react_1 = require("lucide-react");
|
|
14
15
|
const react_2 = require("react");
|
|
15
16
|
const sonner_1 = require("sonner");
|
|
@@ -18,6 +19,21 @@ const viem_1 = require("viem");
|
|
|
18
19
|
const profileDisplay_1 = require("../../utils/profileDisplay");
|
|
19
20
|
const AccountAssets_1 = require("../AccountAssets/AccountAssets");
|
|
20
21
|
const ContentTokens_1 = require("./ContentTokens");
|
|
22
|
+
// Helper function to check if a string is a wallet address and format it
|
|
23
|
+
const formatProfileTitle = (title) => {
|
|
24
|
+
// Check if title looks like an Ethereum address (0x followed by 40 hex characters)
|
|
25
|
+
const isEthereumAddress = /^0x[a-fA-F0-9]{40}$/.test(title);
|
|
26
|
+
if (isEthereumAddress) {
|
|
27
|
+
return {
|
|
28
|
+
displayTitle: (0, truncateAddress_1.truncateAddress)(title),
|
|
29
|
+
isAddress: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
displayTitle: title,
|
|
34
|
+
isAddress: false,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
21
37
|
const BalanceContent_1 = require("./BalanceContent");
|
|
22
38
|
function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }) {
|
|
23
39
|
const [revokingSignerId, setRevokingSignerId] = (0, react_2.useState)(null);
|
|
@@ -117,7 +133,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
117
133
|
}
|
|
118
134
|
};
|
|
119
135
|
const profiles = profilesRaw
|
|
120
|
-
.filter((profile) => !["custom_auth_endpoint"
|
|
136
|
+
.filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
|
|
121
137
|
.map((profile) => ({
|
|
122
138
|
...(0, profileDisplay_1.getProfileDisplayInfo)(profile),
|
|
123
139
|
originalProfile: profile,
|
|
@@ -152,7 +168,24 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
152
168
|
},
|
|
153
169
|
});
|
|
154
170
|
};
|
|
155
|
-
|
|
171
|
+
console.log("@@profiles", profiles);
|
|
172
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-settings space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-section space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "linked-accounts-settings-button linked-accounts-link-button 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: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-loading 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: "linked-accounts-list space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "linked-account-item bg-b3-line group flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(() => {
|
|
173
|
+
const { displayTitle, isAddress } = formatProfileTitle(profile.title);
|
|
174
|
+
const handleCopyAddress = async (e) => {
|
|
175
|
+
e.stopPropagation();
|
|
176
|
+
try {
|
|
177
|
+
await navigator.clipboard.writeText(profile.title);
|
|
178
|
+
sonner_1.toast.success("Address copied to clipboard!");
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
sonner_1.toast.error("Failed to copy address");
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
|
|
185
|
+
? "font-mono text-sm" // Use monospace font for addresses
|
|
186
|
+
: "break-words" // Use break-words for emails/names (better than break-all)
|
|
187
|
+
}`, title: isAddress ? profile.title : undefined, children: displayTitle }), isAddress && ((0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "linked-account-copy-button ml-1 rounded p-1 opacity-0 transition-opacity hover:bg-gray-100 group-hover:opacity-100", title: "Copy full address", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { size: 12, className: "text-gray-500 hover:text-gray-700" }) }))] }));
|
|
188
|
+
})(), (0, jsx_runtime_1.jsx)("span", { className: "linked-account-type 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: "linked-account-subtitle 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: "linked-account-unlink-button 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: "linked-account-unlink-loading animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
|
|
156
189
|
/* Referral Section */
|
|
157
190
|
(0, jsx_runtime_1.jsxs)("div", { className: "referrals-section space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "referrals-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "referral-code-container bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header-editing", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description 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: "referral-code-content flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description 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: "referral-code-actions flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-edit-form flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "referral-code-input 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", className: "referral-code-save-button", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "referral-code-save-loading h-4 w-4 animate-spin" })) : ("Save") }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", className: "referral-code-cancel-button", onClick: () => {
|
|
158
191
|
setIsEditingCode(false);
|
|
@@ -8,6 +8,7 @@ const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
|
|
|
8
8
|
const react_2 = require("react");
|
|
9
9
|
const react_3 = require("thirdweb/react");
|
|
10
10
|
const wallets_1 = require("thirdweb/wallets");
|
|
11
|
+
const debug = (0, debug_1.debugB3React)("LoginStepCustom");
|
|
11
12
|
function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
12
13
|
const [isLoading, setIsLoading] = (0, react_2.useState)(false);
|
|
13
14
|
const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
|
|
@@ -24,7 +25,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
|
|
|
24
25
|
const handleConnect = async (strategy) => {
|
|
25
26
|
try {
|
|
26
27
|
setIsLoading(true);
|
|
27
|
-
|
|
28
|
+
debug("setIsAuthenticating:true:3");
|
|
28
29
|
setIsAuthenticating(true);
|
|
29
30
|
const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
|
|
30
31
|
let connectResult;
|
|
@@ -45,7 +46,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
|
|
|
45
46
|
connectResult = await connect(options);
|
|
46
47
|
}
|
|
47
48
|
const account = connectResult?.getAccount();
|
|
48
|
-
|
|
49
|
+
debug("@@connectResult", { connectResult, account, options });
|
|
49
50
|
if (!account)
|
|
50
51
|
throw new Error("Failed to connect");
|
|
51
52
|
await onSuccess(account);
|
|
@@ -58,7 +59,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
|
|
|
58
59
|
}
|
|
59
60
|
finally {
|
|
60
61
|
setIsLoading(false);
|
|
61
|
-
|
|
62
|
+
debug("setIsAuthenticating:false:3");
|
|
62
63
|
setIsAuthenticating(false);
|
|
63
64
|
}
|
|
64
65
|
};
|
|
@@ -122,8 +122,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
122
122
|
if (activeWallet) {
|
|
123
123
|
debug("@@logout:activeWallet", activeWallet);
|
|
124
124
|
disconnect(activeWallet);
|
|
125
|
-
debug("@@logout:
|
|
126
|
-
console.log("@@gio:logout:activeWallet", activeWallet);
|
|
125
|
+
debug("@@logout:activeWallet", activeWallet);
|
|
127
126
|
}
|
|
128
127
|
// Log out of each wallet
|
|
129
128
|
wallets.forEach(wallet => {
|
|
@@ -6,8 +6,8 @@ async function fetchSimBalance(address) {
|
|
|
6
6
|
if (!address)
|
|
7
7
|
throw new Error("Address is required");
|
|
8
8
|
let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
|
|
9
|
-
if (process.env.
|
|
10
|
-
url += `&localkey=${process.env.
|
|
9
|
+
if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
|
|
10
|
+
url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
|
|
11
11
|
}
|
|
12
12
|
const response = await fetch(url);
|
|
13
13
|
if (!response.ok) {
|
|
@@ -12,10 +12,11 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
12
12
|
const react_1 = require("react");
|
|
13
13
|
const sonner_1 = require("sonner");
|
|
14
14
|
const thirdweb_2 = require("thirdweb");
|
|
15
|
+
const react_2 = require("thirdweb/react");
|
|
16
|
+
const viem_1 = require("viem");
|
|
15
17
|
const wagmi_1 = require("wagmi");
|
|
16
18
|
const components_1 = require("../components");
|
|
17
19
|
const useAccountWallet_1 = require("./useAccountWallet");
|
|
18
|
-
const viem_1 = require("viem");
|
|
19
20
|
const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
20
21
|
process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
21
22
|
process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
|
|
@@ -25,37 +26,43 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
25
26
|
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
26
27
|
const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
|
|
27
28
|
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_1.useState)(false);
|
|
28
|
-
const
|
|
29
|
+
const activeWallet = (0, react_2.useActiveWallet)();
|
|
30
|
+
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
|
|
29
31
|
const { account: aaAccount } = (0, components_1.useB3)();
|
|
30
32
|
// Handle EOA wallet chain switch and execute transaction
|
|
31
33
|
const handleEOASwitchChainAndSendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
|
|
32
|
-
if (!
|
|
34
|
+
if (!connectedEOAWallet) {
|
|
33
35
|
sonner_1.toast.error("Please connect your wallet");
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
+
// Get target chain configuration once
|
|
39
|
+
const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
|
|
40
|
+
if (!targetChain) {
|
|
41
|
+
sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const currentChainId = activeWallet?.getChain()?.id;
|
|
45
|
+
const onCorrectChain = currentChainId === targetChainId;
|
|
38
46
|
// Helper function to execute the transaction
|
|
39
47
|
const executeTransaction = async () => {
|
|
40
|
-
const signer =
|
|
48
|
+
const signer = activeWallet?.getAccount();
|
|
41
49
|
if (!signer) {
|
|
42
50
|
throw new Error("No account connected");
|
|
43
51
|
}
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
52
|
+
// Coinbase Smart Wallet specific chain switching (different behavior from other wallets)
|
|
53
|
+
const walletChain = connectedEOAWallet.getChain();
|
|
54
|
+
if (walletChain?.id !== targetChainId) {
|
|
55
|
+
activeWallet?.switchChain((0, supported_1.getThirdwebChain)(targetChainId));
|
|
48
56
|
}
|
|
49
57
|
(0, invariant_1.default)((0, viem_1.isAddress)(params.to), "params.to is not a valid address");
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
chain: targetChain,
|
|
58
|
+
const result = await signer.sendTransaction({
|
|
59
|
+
chainId: targetChainId,
|
|
53
60
|
to: params.to,
|
|
54
61
|
data: params.data,
|
|
55
62
|
value: params.value,
|
|
56
63
|
});
|
|
57
|
-
sonner_1.toast.success(`Transaction sent: ${
|
|
58
|
-
return
|
|
64
|
+
sonner_1.toast.success(`Transaction sent: ${result.transactionHash.slice(0, 10)}...`);
|
|
65
|
+
return result.transactionHash;
|
|
59
66
|
};
|
|
60
67
|
try {
|
|
61
68
|
setIsSwitchingOrExecuting(true);
|
|
@@ -63,11 +70,6 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
63
70
|
return await executeTransaction();
|
|
64
71
|
}
|
|
65
72
|
const switchingToastId = sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
|
|
66
|
-
const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
|
|
67
|
-
if (!targetChain) {
|
|
68
|
-
sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
73
|
const blockExplorerUrl = targetChain.blockExplorers?.default.url;
|
|
72
74
|
(0, invariant_1.default)(blockExplorerUrl, "Block explorer URL is required");
|
|
73
75
|
const nativeCurrency = (0, anyspend_1.getNativeToken)(targetChainId);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { components } from "../../types/api";
|
|
1
2
|
export interface RecipientOption {
|
|
2
3
|
address: string;
|
|
3
4
|
icon?: string;
|
|
@@ -12,7 +13,8 @@ export declare enum PanelView {
|
|
|
12
13
|
FIAT_PAYMENT = 4,
|
|
13
14
|
RECIPIENT_SELECTION = 5,
|
|
14
15
|
CRYPTO_PAYMENT_METHOD = 6,
|
|
15
|
-
FIAT_PAYMENT_METHOD = 7
|
|
16
|
+
FIAT_PAYMENT_METHOD = 7,
|
|
17
|
+
POINTS_DETAIL = 8
|
|
16
18
|
}
|
|
17
19
|
export declare function AnySpend(props: {
|
|
18
20
|
mode?: "page" | "modal";
|
|
@@ -22,4 +24,11 @@ export declare function AnySpend(props: {
|
|
|
22
24
|
recipientAddress?: string;
|
|
23
25
|
loadOrder?: string;
|
|
24
26
|
hideTransactionHistoryButton?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
29
|
+
* Useful for handling special cases like B3 token selection.
|
|
30
|
+
*/
|
|
31
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
32
|
+
preventDefault: () => void;
|
|
33
|
+
}) => void;
|
|
25
34
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,6 +22,7 @@ import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails.js"
|
|
|
22
22
|
import { OrderHistory } from "./common/OrderHistory.js";
|
|
23
23
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
24
24
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
|
|
25
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
25
26
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
26
27
|
import { TabSection } from "./common/TabSection.js";
|
|
27
28
|
export var PanelView;
|
|
@@ -34,13 +35,14 @@ export var PanelView;
|
|
|
34
35
|
PanelView[PanelView["RECIPIENT_SELECTION"] = 5] = "RECIPIENT_SELECTION";
|
|
35
36
|
PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 6] = "CRYPTO_PAYMENT_METHOD";
|
|
36
37
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 7] = "FIAT_PAYMENT_METHOD";
|
|
38
|
+
PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
|
|
37
39
|
})(PanelView || (PanelView = {}));
|
|
38
40
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
39
41
|
export function AnySpend(props) {
|
|
40
42
|
const fingerprintConfig = getFingerprintConfig();
|
|
41
43
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
|
|
42
44
|
}
|
|
43
|
-
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, }) {
|
|
45
|
+
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, }) {
|
|
44
46
|
const searchParams = useSearchParamsSSR();
|
|
45
47
|
const router = useRouter();
|
|
46
48
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
@@ -319,7 +321,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
319
321
|
srcTokenAddress: selectedSrcToken.address,
|
|
320
322
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
321
323
|
type: "swap",
|
|
322
|
-
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "
|
|
324
|
+
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXACT_OUTPUT",
|
|
323
325
|
amount: activeInputAmountInWei,
|
|
324
326
|
}
|
|
325
327
|
: {
|
|
@@ -656,7 +658,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
656
658
|
setActivePanel(PanelView.MAIN);
|
|
657
659
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
658
660
|
} })) }) }));
|
|
659
|
-
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(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_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: () => {
|
|
661
|
+
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(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_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, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }) })), _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: () => {
|
|
660
662
|
if (activeTab === "fiat" || isBuyMode) {
|
|
661
663
|
return;
|
|
662
664
|
}
|
|
@@ -678,7 +680,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
678
680
|
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, onChangeDstAmount: value => {
|
|
679
681
|
setIsSrcInputDirty(false);
|
|
680
682
|
setDstAmount(value);
|
|
681
|
-
}, anyspendQuote: anyspendQuote }))] }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
|
|
683
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }))] }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
|
|
682
684
|
const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: recipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
|
|
683
685
|
setOrderId(orderId);
|
|
684
686
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
@@ -706,6 +708,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
706
708
|
setSelectedFiatPaymentMethod(method);
|
|
707
709
|
setActivePanel(PanelView.MAIN); // Go back to main panel to show updated pricing
|
|
708
710
|
}, srcAmountOnRamp: srcAmountOnRamp }));
|
|
711
|
+
const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.MAIN) }));
|
|
709
712
|
// Add tabs to the main component when no order is loaded
|
|
710
713
|
return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
|
|
711
714
|
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
@@ -729,5 +732,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
729
732
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: recipientSelectionView }, "recipient-selection-view"),
|
|
730
733
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
|
|
731
734
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
735
|
+
_jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
|
|
732
736
|
] }) }) }));
|
|
733
737
|
}
|
|
@@ -199,7 +199,6 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
199
199
|
args: [recipientAddress, parseEther(b3Amount), BigInt(minTokensOut)],
|
|
200
200
|
});
|
|
201
201
|
return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
202
|
-
type: "custom",
|
|
203
202
|
action: "BondKit Buy",
|
|
204
203
|
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
205
204
|
}
|
|
@@ -390,7 +390,6 @@ export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAd
|
|
|
390
390
|
// AnySpend flow for when user needs to swap to B3
|
|
391
391
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
392
392
|
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
393
|
-
type: "custom",
|
|
394
393
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
395
394
|
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
396
395
|
}
|
|
@@ -13,12 +13,15 @@ import { motion } from "motion/react";
|
|
|
13
13
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
14
14
|
import { toast } from "sonner";
|
|
15
15
|
import { base } from "viem/chains";
|
|
16
|
+
import { useFeatureFlags } from "../contexts/FeatureFlagsContext.js";
|
|
16
17
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
17
18
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
|
|
18
19
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
|
|
19
20
|
import { OrderDetails } from "./common/OrderDetails.js";
|
|
20
21
|
import { OrderHistory } from "./common/OrderHistory.js";
|
|
21
22
|
import { OrderToken } from "./common/OrderToken.js";
|
|
23
|
+
import { PointsBadge } from "./common/PointsBadge.js";
|
|
24
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
22
25
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
23
26
|
var PanelView;
|
|
24
27
|
(function (PanelView) {
|
|
@@ -29,6 +32,7 @@ var PanelView;
|
|
|
29
32
|
PanelView[PanelView["RECIPIENT_SELECTION"] = 4] = "RECIPIENT_SELECTION";
|
|
30
33
|
PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 5] = "CRYPTO_PAYMENT_METHOD";
|
|
31
34
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 6] = "FIAT_PAYMENT_METHOD";
|
|
35
|
+
PanelView[PanelView["POINTS_DETAIL"] = 7] = "POINTS_DETAIL";
|
|
32
36
|
})(PanelView || (PanelView = {}));
|
|
33
37
|
function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress, }) {
|
|
34
38
|
switch (orderType) {
|
|
@@ -92,8 +96,9 @@ export function AnySpendCustom(props) {
|
|
|
92
96
|
const fingerprintConfig = getFingerprintConfig();
|
|
93
97
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomInner, { ...props }) }));
|
|
94
98
|
}
|
|
95
|
-
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, }) {
|
|
99
|
+
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, }) {
|
|
96
100
|
const hasMounted = useHasMounted();
|
|
101
|
+
const featureFlags = useFeatureFlags();
|
|
97
102
|
const searchParams = useSearchParamsSSR();
|
|
98
103
|
const router = useRouter();
|
|
99
104
|
const [activePanel, setActivePanel] = useState(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
@@ -170,8 +175,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
170
175
|
dstToken: dstToken,
|
|
171
176
|
dstAmount: dstAmount,
|
|
172
177
|
contractAddress: contractAddress,
|
|
173
|
-
tokenId:
|
|
174
|
-
contractType:
|
|
178
|
+
tokenId: orderType === "mint_nft" ? metadata.nftContract.tokenId : undefined,
|
|
179
|
+
contractType: orderType === "mint_nft" ? metadata.nftContract.type : undefined,
|
|
175
180
|
encodedData: encodedData,
|
|
176
181
|
spenderAddress: spenderAddress,
|
|
177
182
|
});
|
|
@@ -184,7 +189,6 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
184
189
|
encodedData,
|
|
185
190
|
metadata?.nftContract?.tokenId,
|
|
186
191
|
metadata?.nftContract?.type,
|
|
187
|
-
metadata?.type,
|
|
188
192
|
orderType,
|
|
189
193
|
spenderAddress,
|
|
190
194
|
srcChainId,
|
|
@@ -261,7 +265,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
261
265
|
srcAmount: srcAmount.toString(),
|
|
262
266
|
recipientAddress,
|
|
263
267
|
creatorAddress: currentWallet?.wallet?.address,
|
|
264
|
-
nft:
|
|
268
|
+
nft: orderType === "mint_nft"
|
|
265
269
|
? metadata.nftContract.type === "erc1155"
|
|
266
270
|
? {
|
|
267
271
|
type: "erc1155",
|
|
@@ -282,7 +286,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
282
286
|
imageUrl: metadata.nftContract.imageUrl,
|
|
283
287
|
}
|
|
284
288
|
: undefined,
|
|
285
|
-
tournament:
|
|
289
|
+
tournament: orderType === "join_tournament" || orderType === "fund_tournament"
|
|
286
290
|
? {
|
|
287
291
|
...metadata.tournament,
|
|
288
292
|
contractAddress: contractAddress,
|
|
@@ -290,13 +294,12 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
290
294
|
}
|
|
291
295
|
: undefined,
|
|
292
296
|
// only populate payload for custom tx
|
|
293
|
-
payload:
|
|
297
|
+
payload: orderType === "custom"
|
|
294
298
|
? {
|
|
295
299
|
amount: dstAmount,
|
|
296
300
|
data: encodedData,
|
|
297
301
|
spenderAddress: spenderAddress,
|
|
298
302
|
to: contractAddress,
|
|
299
|
-
action: metadata.action,
|
|
300
303
|
}
|
|
301
304
|
: undefined,
|
|
302
305
|
};
|
|
@@ -421,6 +424,16 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
421
424
|
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
422
425
|
} })), mode === "page" && _jsx("div", { className: "h-12" })] }));
|
|
423
426
|
const loadingView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background"), children: [_jsxs(Badge, { variant: "default", className: "bg-b3-react-muted/30 border-b3-react-border hover:bg-b3-react-muted/50 flex items-center gap-3 px-4 py-1 text-base transition-all", children: [_jsx(Loader2, { className: "text-b3-react-foreground size-4 animate-spin" }), _jsx(TextShimmer, { duration: 1, className: "font-sf-rounded text-base font-semibold", children: "Loading..." })] }), _jsxs("div", { className: "flex w-full flex-1 flex-col", children: [_jsxs("div", { className: "mb-4 flex flex-col gap-1", children: [_jsx(Skeleton, { className: "h-4 w-24" }), _jsxs("div", { className: "mt-2 flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-8 w-48" }), _jsx(Skeleton, { className: "ml-4 h-8 w-32" })] }), _jsx(Skeleton, { className: "mt-4 h-8 w-24" })] }), _jsx(Skeleton, { className: "mb-4 h-12 w-full" }), _jsxs("div", { className: "flex w-full items-center justify-between gap-4", children: [_jsxs(Skeleton, { className: "rounded-lg bg-white/5 p-6 pb-3", children: [_jsx("div", { className: "size-[200px]" }), _jsx("div", { className: "mt-3 flex items-center justify-center gap-2", children: _jsx("div", { className: "size-5 rounded-full" }) })] }), _jsx("div", { className: "flex flex-1 flex-col gap-2", children: [1, 2, 3].map(i => (_jsx(Skeleton, { className: "h-10 w-full" }, i))) })] })] }), _jsxs("div", { className: "bg-b3-react-muted/30 mt-8 w-full rounded-lg p-4", children: [_jsx(Skeleton, { className: "mb-3 h-4 w-48" }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Skeleton, { className: "h-10 flex-1" }), _jsx(Skeleton, { className: "h-10 flex-1" })] })] }), _jsx("div", { className: "flex w-full flex-col gap-3", children: [1, 2, 3, 4, 5].map(i => (_jsxs("div", { className: "flex w-full justify-between", children: [_jsx(Skeleton, { className: "h-4 w-24" }), _jsx(Skeleton, { className: "h-4 w-32" })] }, i))) }), _jsx(Skeleton, { className: "h-10 w-full" }), mode === "page" && _jsx("div", { className: "h-12" })] }));
|
|
427
|
+
// Render points badge if conditions are met
|
|
428
|
+
const renderPointsBadge = () => {
|
|
429
|
+
if (featureFlags.showPoints && anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
|
|
430
|
+
return (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => {
|
|
431
|
+
onShowPointsDetail?.();
|
|
432
|
+
setActivePanel(PanelView.POINTS_DETAIL);
|
|
433
|
+
} }));
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
};
|
|
424
437
|
// Confirm order view.
|
|
425
438
|
const confirmOrderView = (_jsxs("div", { className: "relative mx-auto flex w-full flex-col items-center", children: [header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote }), _jsxs(Tabs, { value: activeTab, onValueChange: value => setActiveTab(value), className: "bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5", children: [_jsx("div", { className: "w-full", children: _jsxs("div", { className: "bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl", children: [_jsx("div", { className: cn("bg-as-brand absolute bottom-0 left-0 top-0 z-0 rounded-xl transition-transform duration-100", "h-full w-1/2", activeTab === "fiat" ? "translate-x-full" : "translate-x-0"), style: { willChange: "transform" } }), _jsx("button", { className: cn("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", activeTab === "crypto" ? "text-white" : "text-as-primary/70 hover:bg-as-on-surface-2 bg-transparent"), onClick: () => {
|
|
426
439
|
setActiveTab("crypto");
|
|
@@ -445,7 +458,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
445
458
|
opacity: hasMounted ? 1 : 0,
|
|
446
459
|
y: hasMounted ? 0 : 20,
|
|
447
460
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
448
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" })] }), _jsxs("span", { className: "text-as-primary font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] })] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
461
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(with fee)" })] }), renderPointsBadge()] }), _jsxs("span", { className: "text-as-primary font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] })] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
449
462
|
opacity: hasMounted ? 1 : 0,
|
|
450
463
|
y: hasMounted ? 0 : 20,
|
|
451
464
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -457,7 +470,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
457
470
|
opacity: hasMounted ? 1 : 0,
|
|
458
471
|
y: hasMounted ? 0 : 20,
|
|
459
472
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
460
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" })] }), _jsxs("span", { className: "text-as-primary text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
473
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["Total ", _jsx("span", { className: "text-as-tertiarry", children: "(USD)" })] }), renderPointsBadge()] }), _jsxs("span", { className: "text-as-primary text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] })] })] }), _jsx("div", { className: cn("flex w-full flex-col items-center justify-between gap-2"), children: _jsx(motion.div, { initial: false, animate: {
|
|
461
474
|
opacity: hasMounted ? 1 : 0,
|
|
462
475
|
y: hasMounted ? 0 : 20,
|
|
463
476
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -484,6 +497,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
484
497
|
setSelectedFiatPaymentMethod(method);
|
|
485
498
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
486
499
|
}, srcAmountOnRamp: srcFiatAmount }) }));
|
|
500
|
+
// Points detail view
|
|
501
|
+
const pointsDetailView = (_jsx("div", { className: cn("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: _jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER) }) }));
|
|
487
502
|
// Return the TransitionPanel with all views
|
|
488
503
|
return (_jsx(StyleRoot, { children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
489
504
|
? oat
|
|
@@ -503,5 +518,6 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
503
518
|
_jsx("div", { className: "w-full", children: recipientSelectionView }, "recipient-selection-view"),
|
|
504
519
|
_jsx("div", { className: "w-full", children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
|
|
505
520
|
_jsx("div", { className: "w-full", children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
521
|
+
_jsx("div", { className: "w-full", children: pointsDetailView }, "points-detail-view"),
|
|
506
522
|
] }) }));
|
|
507
523
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress?: string;
|
|
6
6
|
nftContract: components["schemas"]["NftContract"];
|
|
7
7
|
onSuccess?: (txHash?: string) => void;
|
|
8
|
+
onShowPointsDetail?: () => void;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,7 +26,7 @@ const CONTRACT_URI_ABI = [
|
|
|
26
26
|
type: "function",
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
|
-
export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, }) {
|
|
29
|
+
export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, }) {
|
|
30
30
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState(nftContract.imageUrl);
|
|
31
31
|
const [isLoadingFallback, setIsLoadingFallback] = useState(false);
|
|
32
32
|
// Fetch contract metadata when imageUrl is empty
|
|
@@ -86,7 +86,7 @@ export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftCo
|
|
|
86
86
|
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
87
87
|
type: "mint_nft",
|
|
88
88
|
nftContract: nftContract,
|
|
89
|
-
}, header: header, onSuccess: onSuccess }));
|
|
89
|
+
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail }));
|
|
90
90
|
}
|
|
91
91
|
function DropdownMenu({ nftContract }) {
|
|
92
92
|
const [open, setOpen] = useState(false);
|
|
@@ -258,7 +258,6 @@ export function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, s
|
|
|
258
258
|
}
|
|
259
259
|
const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
|
|
260
260
|
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: base.id, dstToken: B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
|
|
261
|
-
type: "custom",
|
|
262
261
|
action: "stake B3",
|
|
263
262
|
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
264
263
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
1
2
|
export declare const HYPE_TOKEN_DETAILS: {
|
|
2
3
|
SYMBOL: string;
|
|
3
4
|
LOGO_URI: string;
|
|
@@ -11,5 +12,12 @@ export interface AnySpendDepositHypeProps {
|
|
|
11
12
|
sourceTokenChainId?: number;
|
|
12
13
|
onSuccess?: () => void;
|
|
13
14
|
mainFooter?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
17
|
+
* Useful for handling special cases like B3 token selection.
|
|
18
|
+
*/
|
|
19
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
20
|
+
preventDefault: () => void;
|
|
21
|
+
}) => void;
|
|
14
22
|
}
|
|
15
23
|
export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
|