@b3dotfun/sdk 0.0.64 → 0.0.65-test.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 +73 -33
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -5
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +1 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -5
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +7 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/anyspend/utils/index.d.ts +0 -1
- package/dist/cjs/anyspend/utils/index.js +0 -1
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +139 -33
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +29 -13
- package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/cjs/global-account/react/components/Deposit/Deposit.js +65 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +113 -279
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +331 -0
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.js +34 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +23 -0
- package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +120 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +43 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +16 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +24 -193
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +15 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +44 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +50 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +8 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +38 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +22 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +10 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +12 -0
- package/dist/cjs/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/cjs/global-account/react/components/Send/Send.js +187 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.js +7 -0
- package/dist/cjs/global-account/react/components/index.d.ts +4 -2
- package/dist/cjs/global-account/react/components/index.js +11 -4
- package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +0 -11
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +3 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +34 -3
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +36 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +2 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +2 -2
- package/dist/cjs/shared/utils/ipfs.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +74 -34
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -6
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +2 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +6 -5
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/anyspend/utils/index.d.ts +0 -1
- package/dist/esm/anyspend/utils/index.js +0 -1
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +140 -34
- package/dist/esm/global-account/react/components/B3DynamicModal.js +30 -14
- package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/esm/global-account/react/components/Deposit/Deposit.js +59 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +113 -280
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +325 -0
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.js +32 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +21 -0
- package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +81 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +41 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +10 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +26 -195
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +13 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +42 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +45 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +36 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +20 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +10 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +10 -0
- package/dist/esm/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/esm/global-account/react/components/Send/Send.js +181 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.js +4 -0
- package/dist/esm/global-account/react/components/index.d.ts +4 -2
- package/dist/esm/global-account/react/components/index.js +7 -2
- package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +0 -11
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useGlobalAccount.js +3 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +34 -3
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +33 -0
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +2 -0
- package/dist/esm/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +2 -2
- package/dist/esm/shared/utils/ipfs.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/anyspend/utils/index.d.ts +0 -1
- package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/types/global-account/react/components/ManageAccount/AppsContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +10 -0
- package/dist/types/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/types/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/index.d.ts +4 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +1 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +34 -3
- package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +2 -0
- package/dist/types/shared/constants/chains/supported.d.ts +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +225 -167
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -6
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +2 -6
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +2 -7
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
- package/src/anyspend/react/components/common/OrderHistory.tsx +8 -13
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/anyspend/utils/index.ts +0 -1
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +115 -25
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +303 -126
- package/src/global-account/react/components/B3DynamicModal.tsx +33 -15
- package/src/global-account/react/components/Deposit/Deposit.tsx +211 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +332 -433
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +490 -0
- package/src/global-account/react/components/ManageAccount/AppsContent.tsx +79 -0
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +83 -0
- package/src/global-account/react/components/ManageAccount/Header.tsx +230 -0
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +118 -0
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +42 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +73 -589
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +24 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +74 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +87 -0
- package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +31 -0
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +74 -0
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +41 -0
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +50 -0
- package/src/global-account/react/components/Send/Send.tsx +585 -0
- package/src/global-account/react/components/icons/BellIcon.tsx +15 -0
- package/src/global-account/react/components/icons/ChevronDownIcon.tsx +17 -0
- package/src/global-account/react/components/icons/CopyIcon.tsx +22 -0
- package/src/global-account/react/components/icons/LinkIcon.tsx +15 -0
- package/src/global-account/react/components/icons/LockIcon.tsx +15 -0
- package/src/global-account/react/components/icons/WalletIcon.tsx +21 -0
- package/src/global-account/react/components/index.ts +9 -2
- package/src/global-account/react/components/ui/Tabs.tsx +5 -13
- package/src/global-account/react/components/ui/dialog.tsx +32 -14
- package/src/global-account/react/hooks/index.ts +3 -0
- package/src/global-account/react/hooks/useAuthentication.ts +0 -12
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +1 -0
- package/src/global-account/react/hooks/useGlobalAccount.tsx +3 -1
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +39 -2
- package/src/global-account/react/stores/useRecentAddressesStore.ts +55 -0
- package/src/global-account/react/utils/profileDisplay.ts +4 -2
- package/src/shared/utils/ipfs.ts +1 -1
- package/src/styles/index.css +6 -1
- package/dist/cjs/anyspend/utils/accountStore.d.ts +0 -7
- package/dist/cjs/anyspend/utils/accountStore.js +0 -8
- package/dist/esm/anyspend/utils/accountStore.d.ts +0 -7
- package/dist/esm/anyspend/utils/accountStore.js +0 -5
- package/dist/types/anyspend/utils/accountStore.d.ts +0 -7
- package/src/anyspend/utils/accountStore.ts +0 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRecentAddressesStore = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const middleware_1 = require("zustand/middleware");
|
|
6
|
+
/**
|
|
7
|
+
* Store for managing recently used addresses in the Send flow
|
|
8
|
+
* Persists to localStorage and keeps the last 6 unique addresses
|
|
9
|
+
*/
|
|
10
|
+
exports.useRecentAddressesStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
|
|
11
|
+
recentAddresses: [],
|
|
12
|
+
/**
|
|
13
|
+
* Add a new address to the recent addresses list
|
|
14
|
+
* Deduplicates and maintains a maximum of 6 addresses
|
|
15
|
+
*/
|
|
16
|
+
addRecentAddress: (address) => {
|
|
17
|
+
set(state => {
|
|
18
|
+
// Remove any existing entry with the same address
|
|
19
|
+
const filtered = state.recentAddresses.filter(item => item.address.toLowerCase() !== address.toLowerCase());
|
|
20
|
+
// Add the new address at the beginning
|
|
21
|
+
const updated = [{ address, timestamp: Date.now() }, ...filtered];
|
|
22
|
+
// Keep only the last 6 addresses
|
|
23
|
+
return {
|
|
24
|
+
recentAddresses: updated.slice(0, 6),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Clear all recent addresses
|
|
30
|
+
*/
|
|
31
|
+
clearRecentAddresses: () => {
|
|
32
|
+
set({ recentAddresses: [] });
|
|
33
|
+
},
|
|
34
|
+
}), {
|
|
35
|
+
name: "b3-recent-addresses-storage",
|
|
36
|
+
}));
|
|
@@ -13,6 +13,8 @@ export interface ExtendedProfileDetails {
|
|
|
13
13
|
name?: string;
|
|
14
14
|
username?: string;
|
|
15
15
|
profileImageUrl?: string;
|
|
16
|
+
picture?: string;
|
|
17
|
+
pfpUrl?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface ExtendedProfile extends Omit<Profile, "details"> {
|
|
18
20
|
details: ExtendedProfileDetails;
|
|
@@ -82,7 +82,7 @@ function getProfileDisplayInfo(profile) {
|
|
|
82
82
|
displayInfo = {
|
|
83
83
|
title: details.name || details.username || "Unknown",
|
|
84
84
|
subtitle: details.username ? `@${details.username}` : "Farcaster Account",
|
|
85
|
-
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
85
|
+
imageUrl: validateImageUrl(details.pfpUrl || details.profileImageUrl),
|
|
86
86
|
initial: "F",
|
|
87
87
|
type,
|
|
88
88
|
};
|
|
@@ -91,7 +91,7 @@ function getProfileDisplayInfo(profile) {
|
|
|
91
91
|
displayInfo = {
|
|
92
92
|
title: details.name || details.email || "Unknown",
|
|
93
93
|
subtitle: details.email || "Google Account",
|
|
94
|
-
imageUrl: validateImageUrl(details.profileImageUrl),
|
|
94
|
+
imageUrl: validateImageUrl(details.picture || details.profileImageUrl),
|
|
95
95
|
initial: "G",
|
|
96
96
|
type,
|
|
97
97
|
};
|
|
@@ -53,10 +53,10 @@ export declare function getCoingeckoChainInfo(chainId: number): {
|
|
|
53
53
|
name: string;
|
|
54
54
|
native_coin_id: string;
|
|
55
55
|
};
|
|
56
|
-
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/
|
|
56
|
+
export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
57
57
|
rpc: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/
|
|
59
|
+
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/chains").ChainOptions & {
|
|
60
60
|
rpc: string;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const b3Mainnet: import("viem").Chain;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
|
-
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
5
|
+
import { Button, ShinyButton, StyleRoot, TabsPrimitive, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
|
+
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
6
7
|
import { cn } from "../../../shared/utils/cn.js";
|
|
7
8
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
8
9
|
import invariant from "invariant";
|
|
@@ -10,6 +11,7 @@ import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
|
|
|
10
11
|
import { motion } from "motion/react";
|
|
11
12
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
13
|
import { toast } from "sonner";
|
|
14
|
+
import { defineChain } from "thirdweb";
|
|
13
15
|
import { parseUnits } from "viem";
|
|
14
16
|
import { base, mainnet } from "viem/chains";
|
|
15
17
|
import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod.js";
|
|
@@ -48,6 +50,25 @@ export function AnySpend(props) {
|
|
|
48
50
|
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
|
|
49
51
|
const searchParams = useSearchParamsSSR();
|
|
50
52
|
const router = useRouter();
|
|
53
|
+
const { partnerId } = useB3();
|
|
54
|
+
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
55
|
+
// Define base chain with RPC for modal props
|
|
56
|
+
const baseChain = useMemo(() => defineChain({
|
|
57
|
+
id: 8453,
|
|
58
|
+
name: "Base",
|
|
59
|
+
nativeCurrency: {
|
|
60
|
+
name: "Ether",
|
|
61
|
+
symbol: "ETH",
|
|
62
|
+
decimals: 18,
|
|
63
|
+
},
|
|
64
|
+
rpc: "https://mainnet.base.org",
|
|
65
|
+
blockExplorers: [
|
|
66
|
+
{
|
|
67
|
+
name: "Basescan",
|
|
68
|
+
url: "https://basescan.org",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
}), []);
|
|
51
72
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
52
73
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
53
74
|
// Add refs to track URL state
|
|
@@ -599,6 +620,10 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
599
620
|
const onClickHistory = () => {
|
|
600
621
|
setOrderId(undefined);
|
|
601
622
|
navigateToPanel(PanelView.HISTORY, "forward");
|
|
623
|
+
setB3ModalContentType({
|
|
624
|
+
type: "anySpendOrderHistory",
|
|
625
|
+
showBackButton: false,
|
|
626
|
+
});
|
|
602
627
|
// Remove orderId and paymentMethod from URL when going back to history
|
|
603
628
|
const params = new URLSearchParams(searchParams.toString());
|
|
604
629
|
params.delete("orderId");
|
|
@@ -760,43 +785,58 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
760
785
|
};
|
|
761
786
|
}, [activePanel, navigateBack]);
|
|
762
787
|
const historyView = (_jsx("div", { className: "mx-auto flex w-[560px] max-w-full flex-col items-center", children: _jsx(OrderHistory, { mode: mode, onBack: navigateBack, onSelectOrder: onSelectOrder }) }));
|
|
763
|
-
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
|
|
788
|
+
const orderDetailsView = (_jsx("div", { className: "mx-auto w-[460px] max-w-full px-5", children: _jsx("div", { className: "relative flex flex-col gap-4", children: oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, points: oat.data.points || undefined, onBack: () => {
|
|
764
789
|
setOrderId(undefined);
|
|
765
790
|
navigateBack();
|
|
766
791
|
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
767
792
|
} })) }) }));
|
|
768
|
-
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, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_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: (panelIndex) => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
793
|
+
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", 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, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : (_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: (panelIndex) => {
|
|
794
|
+
// Map panel index to navigation with direction
|
|
795
|
+
const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
|
|
796
|
+
if (panelsWithForwardNav.includes(panelIndex)) {
|
|
797
|
+
navigateToPanel(panelIndex, "forward");
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
setActivePanel(panelIndex);
|
|
801
|
+
}
|
|
802
|
+
}, _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: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _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: () => {
|
|
803
|
+
if (activeTab === "fiat" || isBuyMode) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
// Swap chain selections
|
|
807
|
+
const tempSrcChainId = selectedSrcChainId;
|
|
808
|
+
const tempDstChainId = selectedDstChainId;
|
|
809
|
+
setSelectedSrcChainId(tempDstChainId);
|
|
810
|
+
setSelectedDstChainId(tempSrcChainId);
|
|
811
|
+
// Swap token selections
|
|
812
|
+
const tempSrcToken = selectedSrcToken;
|
|
813
|
+
const tempDstToken = selectedDstToken;
|
|
814
|
+
setSelectedSrcToken(tempDstToken);
|
|
815
|
+
setSelectedDstToken(tempSrcToken);
|
|
816
|
+
// Swap amounts
|
|
817
|
+
const tempSrcAmount = srcAmount;
|
|
818
|
+
const tempDstAmount = dstAmount;
|
|
819
|
+
setSrcAmount(tempDstAmount);
|
|
820
|
+
setDstAmount(tempSrcAmount);
|
|
821
|
+
}, 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: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), setRecipientAddress: setRecipientAddress, recipientAddressFromProps: recipientAddressFromProps, globalAddress: globalAddress, dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
822
|
+
setIsSrcInputDirty(false);
|
|
823
|
+
setDstAmount(value);
|
|
824
|
+
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), selectedCryptoPaymentMethod: selectedCryptoPaymentMethod }))] }), _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"), 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: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), 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] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
825
|
+
if (value === "settings" || value === "home") {
|
|
826
|
+
setB3ModalContentType({
|
|
827
|
+
type: "manageAccount",
|
|
828
|
+
activeTab: value,
|
|
829
|
+
setActiveTab: () => { },
|
|
830
|
+
chain: baseChain,
|
|
831
|
+
partnerId,
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
else if (value === "swap") {
|
|
835
|
+
setB3ModalContentType({
|
|
836
|
+
type: "anySpend",
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
}, children: _jsx(BottomNavigation, {}) }) })] }));
|
|
800
840
|
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 => {
|
|
801
841
|
setOrderId(orderId);
|
|
802
842
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
@@ -437,7 +437,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
437
437
|
: orderType === "join_tournament"
|
|
438
438
|
? "Join for"
|
|
439
439
|
: "Recipient" }), _jsxs("div", { className: "flex items-center gap-2", children: [recipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx(_Fragment, { children: _jsx("div", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: _jsx("span", { children: recipientName ? formatUsername(recipientName) : shortenAddress(recipientAddress) }) }) }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) })), _jsx(ChevronRight, { className: "h-4 w-4" })] })] }, recipientAddress)) : null;
|
|
440
|
-
const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center
|
|
440
|
+
const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
|
|
441
441
|
setActivePanel(PanelView.HISTORY);
|
|
442
442
|
}, onSelectOrder: onSelectOrder }) }));
|
|
443
443
|
const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_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, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
@@ -7,8 +7,7 @@ import { ArrowDown, Loader2 } from "lucide-react";
|
|
|
7
7
|
import { motion } from "motion/react";
|
|
8
8
|
import { useEffect, useMemo, useRef } from "react";
|
|
9
9
|
import { toast } from "sonner";
|
|
10
|
-
import {
|
|
11
|
-
import { useGlobalWalletState } from "../../utils/index.js";
|
|
10
|
+
import { useSetActiveWallet } from "thirdweb/react";
|
|
12
11
|
import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow.js";
|
|
13
12
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
14
13
|
import { CryptoPaySection } from "./common/CryptoPaySection.js";
|
|
@@ -47,18 +46,15 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
47
46
|
});
|
|
48
47
|
const { connectedEOAWallet } = useAccountWallet();
|
|
49
48
|
const setActiveWallet = useSetActiveWallet();
|
|
50
|
-
const activeWallet = useActiveWallet();
|
|
51
|
-
const setGlobalAccountWallet = useGlobalWalletState(state => state.setGlobalAccountWallet);
|
|
52
49
|
const appliedPreferEoa = useRef(false);
|
|
53
50
|
useEffect(() => {
|
|
54
51
|
if (preferEoa && !appliedPreferEoa.current) {
|
|
55
52
|
if (connectedEOAWallet) {
|
|
56
53
|
appliedPreferEoa.current = true;
|
|
57
|
-
setGlobalAccountWallet(activeWallet);
|
|
58
54
|
setActiveWallet(connectedEOAWallet);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
|
-
}, [preferEoa, connectedEOAWallet, setActiveWallet
|
|
57
|
+
}, [preferEoa, connectedEOAWallet, setActiveWallet]);
|
|
62
58
|
const selectedRecipientOrDefault = selectedRecipientAddress ?? recipientAddress;
|
|
63
59
|
const expectedDstAmountRaw = anyspendQuote?.data?.currencyOut?.amount ?? "0";
|
|
64
60
|
const buildCustomPayload = (_recipient) => {
|
|
@@ -6,7 +6,7 @@ import invariant from "invariant";
|
|
|
6
6
|
import { motion } from "motion/react";
|
|
7
7
|
import { useEffect, useMemo, useRef } from "react";
|
|
8
8
|
import { toast } from "sonner";
|
|
9
|
-
import {
|
|
9
|
+
import { useSetActiveWallet } from "thirdweb/react";
|
|
10
10
|
import { base } from "viem/chains";
|
|
11
11
|
import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow.js";
|
|
12
12
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
@@ -19,7 +19,6 @@ import { OrderDetails } from "./common/OrderDetails.js";
|
|
|
19
19
|
import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
|
|
20
20
|
import { RecipientSelection } from "./common/RecipientSelection.js";
|
|
21
21
|
import { ArrowDown, Loader2 } from "lucide-react";
|
|
22
|
-
import { useGlobalWalletState } from "../../utils/index.js";
|
|
23
22
|
import { PanelOnramp } from "./common/PanelOnramp.js";
|
|
24
23
|
const SLIPPAGE_PERCENT = 3;
|
|
25
24
|
export const HYPE_TOKEN_DETAILS = {
|
|
@@ -45,18 +44,15 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
|
|
|
45
44
|
});
|
|
46
45
|
const { connectedEOAWallet: connectedEOAWallet } = useAccountWallet();
|
|
47
46
|
const setActiveWallet = useSetActiveWallet();
|
|
48
|
-
const activeWallet = useActiveWallet();
|
|
49
|
-
const setGlobalAccountWallet = useGlobalWalletState(state => state.setGlobalAccountWallet);
|
|
50
47
|
const appliedPreferEoa = useRef(false);
|
|
51
48
|
useEffect(() => {
|
|
52
49
|
if (preferEoa && !appliedPreferEoa.current) {
|
|
53
50
|
if (connectedEOAWallet) {
|
|
54
51
|
appliedPreferEoa.current = true;
|
|
55
|
-
setGlobalAccountWallet(activeWallet);
|
|
56
52
|
setActiveWallet(connectedEOAWallet);
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
}, [preferEoa, connectedEOAWallet, setActiveWallet
|
|
55
|
+
}, [preferEoa, connectedEOAWallet, setActiveWallet]);
|
|
60
56
|
// Button state logic
|
|
61
57
|
const btnInfo = useMemo(() => {
|
|
62
58
|
if (activeInputAmountInWei === "0")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useGlobalWalletState } from "../../../../anyspend/utils/index.js";
|
|
4
3
|
import { useAccountWallet } from "../../../../global-account/react/index.js";
|
|
5
4
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
6
5
|
import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
|
|
@@ -10,7 +9,7 @@ import { ChevronLeft, ChevronRightCircle, Wallet, X, ZapIcon } from "lucide-reac
|
|
|
10
9
|
import { useState } from "react";
|
|
11
10
|
import { createPortal } from "react-dom";
|
|
12
11
|
import { toast } from "sonner";
|
|
13
|
-
import {
|
|
12
|
+
import { useSetActiveWallet, useWalletInfo } from "thirdweb/react";
|
|
14
13
|
import { createWallet } from "thirdweb/wallets";
|
|
15
14
|
import { useAccount, useConnect, useDisconnect, useWalletClient } from "wagmi";
|
|
16
15
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay.js";
|
|
@@ -30,8 +29,6 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
30
29
|
const [showWalletModal, setShowWalletModal] = useState(false);
|
|
31
30
|
const setActiveWallet = useSetActiveWallet();
|
|
32
31
|
const { data: eoaWalletInfo } = useWalletInfo(connectedEOAWallet?.id);
|
|
33
|
-
const activeWallet = useActiveWallet();
|
|
34
|
-
const setGlobalAccountWallet = useGlobalWalletState(state => state.setGlobalAccountWallet);
|
|
35
32
|
const isConnected = !!connectedEOAWallet;
|
|
36
33
|
const globalAddress = connectedSmartWallet?.getAccount()?.address;
|
|
37
34
|
// Use custom hook to determine wallet display logic
|
|
@@ -159,10 +156,9 @@ export function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentM
|
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
};
|
|
162
|
-
return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
|
|
159
|
+
return (_jsxs("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5", children: [_jsxs("div", { className: cn("relative flex flex-col gap-10"), children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex items-center justify-around gap-4", children: _jsx("div", { className: "flex-1 text-center", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), _jsxs("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && (_jsxs("div", { className: "installed-wallets", children: [_jsx("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), _jsxs("div", { className: "space-y-2", children: [shouldShowConnectedEOA && (_jsx("button", { onClick: () => {
|
|
163
160
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
164
161
|
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
165
|
-
setGlobalAccountWallet(activeWallet);
|
|
166
162
|
if (connectedEOAWallet) {
|
|
167
163
|
setActiveWallet(connectedEOAWallet);
|
|
168
164
|
}
|
|
@@ -59,7 +59,7 @@ export function FeeDetailPanel({ fee, transactionAmountUsd, onBack }) {
|
|
|
59
59
|
// State for expanding tier lists
|
|
60
60
|
const [showAllFeeTiers, setShowAllFeeTiers] = useState(false);
|
|
61
61
|
const [showAllDiscountTiers, setShowAllDiscountTiers] = useState(false);
|
|
62
|
-
return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3", children: _jsxs("div", { className: "flex w-full flex-col gap-3", children: [_jsx("div", { className: "text-center", children: _jsx("h3", { className: "text-as-primary text-lg font-bold", children: "Fee Breakdown" }) }), _jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule" }), _jsx("div", { className: "space-y-1.5", children: isStripeFee
|
|
62
|
+
return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-3 px-5", children: _jsxs("div", { className: "flex w-full flex-col gap-3", children: [_jsx("div", { className: "text-center", children: _jsx("h3", { className: "text-as-primary text-lg font-bold", children: "Fee Breakdown" }) }), _jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-4", children: [_jsx("h4", { className: "text-as-primary mb-3 text-sm font-semibold", children: isStripeFee ? "Fiat Fee Schedule" : "Base Fee Schedule" }), _jsx("div", { className: "space-y-1.5", children: isStripeFee
|
|
63
63
|
? FIAT_FEE_TIERS.map((tier, idx) => {
|
|
64
64
|
const isCurrentTier = currentFiatTier?.label === tier.label;
|
|
65
65
|
const currentTierIndex = FIAT_FEE_TIERS.findIndex(t => t.label === currentFiatTier?.label);
|
|
@@ -56,9 +56,9 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
|
|
|
56
56
|
}
|
|
57
57
|
// Show loading state while checking geo availability
|
|
58
58
|
if (isLoadingGeoOnramp) {
|
|
59
|
-
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
|
|
59
|
+
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
|
|
60
60
|
}
|
|
61
|
-
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
|
|
61
|
+
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
|
|
62
62
|
setSelectedPaymentMethod(method.id);
|
|
63
63
|
onSelectPaymentMethod(method.id);
|
|
64
64
|
}, className: cn("fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200", selectedPaymentMethod === method.id
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface OrderHistoryProps {
|
|
2
2
|
mode: "modal" | "page";
|
|
3
|
-
onBack
|
|
3
|
+
onBack?: () => void;
|
|
4
4
|
onSelectOrder?: (orderId: string) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare function OrderHistory({ mode, onBack, onSelectOrder }: OrderHistoryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useAnyspendOrderHistory } from "../../../../anyspend/react/index.js";
|
|
4
4
|
import { Button, Skeleton, useAccountWallet } from "../../../../global-account/react/index.js";
|
|
5
|
-
import
|
|
5
|
+
import ModalHeader from "../../../../global-account/react/components/ModalHeader/ModalHeader.js";
|
|
6
|
+
import { RefreshCcw } from "lucide-react";
|
|
6
7
|
import { OrderHistoryItem } from "./OrderHistoryItem.js";
|
|
7
8
|
export function OrderHistory({ mode, onBack, onSelectOrder }) {
|
|
8
9
|
const { address } = useAccountWallet();
|
|
9
10
|
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(address);
|
|
10
|
-
return (_jsxs(_Fragment, { children: [
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(ModalHeader, { title: "Order History", showCloseButton: false, handleBack: onBack, className: "w-full", children: _jsx(Button, { variant: "ghost", size: "icon", className: "hover:bg-as-surface-secondary", onClick: () => {
|
|
12
|
+
refetchOrderHistory();
|
|
13
|
+
}, children: _jsx(RefreshCcw, { className: "text-as-secondary hover:text-as-primary h-5 w-5 cursor-pointer transition-all hover:rotate-180" }) }) }), isLoadingOrderHistory ? (_jsx("div", { className: "w-full space-y-3 px-5", children: [1, 2, 3].map(i => (_jsx(Skeleton, { className: "h-[180px] w-full rounded-2xl" }, i))) })) : !orderHistory?.length ? (_jsx("div", { className: "bg-as-surface-secondary w-full rounded-2xl p-12 px-5 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No order history found" }) })) : (_jsx("div", { className: "mb-12 w-full space-y-3 px-5 pt-5", children: [...orderHistory]
|
|
13
14
|
.sort((a, b) => b.createdAt - a.createdAt)
|
|
14
15
|
.map(order => (_jsx(OrderHistoryItem, { order: order, onSelectOrder: onSelectOrder, mode: mode }, order.id))) }))] }));
|
|
15
16
|
}
|
|
@@ -82,7 +82,7 @@ function PanelOnrampPaymentInner(props) {
|
|
|
82
82
|
toast.error("Failed to create order: " + err.message);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
|
|
85
|
+
return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6 px-5", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
|
|
86
86
|
opacity: 1,
|
|
87
87
|
y: 0,
|
|
88
88
|
filter: "blur(0px)",
|
|
@@ -3,5 +3,5 @@ import { ShinyButton } from "../../../../global-account/react/index.js";
|
|
|
3
3
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
4
|
import Link from "next/link";
|
|
5
5
|
export function PointsDetailPanel({ pointsAmount = 0, onBack }) {
|
|
6
|
-
return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: _jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [_jsx("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), _jsxs("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", _jsxs("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", _jsx(Link, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), _jsxs("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [_jsx("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), _jsxs("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [_jsx("li", { children: "\u2022 Points are earned based on transaction volume" }), _jsx("li", { children: "\u2022 Higher volume = more points" }), _jsx("li", { children: "\u2022 Points contribute to future airdrops" }), _jsx("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: "Back to Swap" })] }) }));
|
|
6
|
+
return (_jsx("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4 px-5", children: _jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [_jsx("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), _jsxs("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", _jsxs("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", _jsx(Link, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), _jsxs("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [_jsx("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), _jsxs("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [_jsx("li", { children: "\u2022 Points are earned based on transaction volume" }), _jsx("li", { children: "\u2022 Higher volume = more points" }), _jsx("li", { children: "\u2022 Points contribute to future airdrops" }), _jsx("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: "Back to Swap" })] }) }));
|
|
7
7
|
}
|
|
@@ -29,5 +29,5 @@ export function RecipientSelection({ initialValue = "", placeholder = "Enter rec
|
|
|
29
29
|
};
|
|
30
30
|
const isAddressValid = !validateAddress || !recipientAddress || validateAddress(recipientAddress);
|
|
31
31
|
const canConfirm = recipientAddress && isAddressValid;
|
|
32
|
-
return (_jsx("div", { className: "recipient-selection mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
|
|
32
|
+
return (_jsx("div", { className: "recipient-selection mx-auto w-[460px] max-w-full px-5", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
|
|
33
33
|
}
|
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
export function AccountAssets({ nfts, isLoading }) {
|
|
4
|
+
// Initialize with all collections expanded
|
|
5
|
+
const [expandedCollections, setExpandedCollections] = useState(() => new Set(collections.map(c => c.collection_id)));
|
|
3
6
|
if (isLoading) {
|
|
4
|
-
return (_jsx("div", { className: "
|
|
7
|
+
return (_jsx("div", { className: "flex flex-col gap-3", children: [...Array(2)].map((_, i) => (_jsxs("div", { className: "animate-pulse", children: [_jsx("div", { className: "bg-b3-react-muted mb-3 h-6 w-48 rounded" }), _jsxs("div", { className: "flex gap-3", children: [_jsx("div", { className: "bg-b3-react-muted h-[98px] w-[98px] shrink-0 rounded-lg" }), _jsx("div", { className: "bg-b3-react-muted h-[98px] w-[98px] shrink-0 rounded-lg" })] })] }, i))) }));
|
|
5
8
|
}
|
|
6
9
|
if (!nfts?.nfts?.length) {
|
|
7
10
|
return _jsx("div", { className: "text-b3-react-muted-foreground py-8 text-center", children: "No NFTs found" });
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
// Group NFTs by collection
|
|
13
|
+
const groupedNFTs = nfts.nfts.reduce((acc, nft) => {
|
|
14
|
+
const collectionId = nft.collection?.collection_id || "unknown";
|
|
15
|
+
if (!acc[collectionId]) {
|
|
16
|
+
acc[collectionId] = {
|
|
17
|
+
collection_id: collectionId,
|
|
18
|
+
collection_name: nft.collection?.name || "Unknown Collection",
|
|
19
|
+
collection_image: nft.collection?.image_url || nft.previews?.image_small_url || "",
|
|
20
|
+
nfts: [],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
acc[collectionId].nfts.push(nft);
|
|
24
|
+
return acc;
|
|
25
|
+
}, {});
|
|
26
|
+
const collections = Object.values(groupedNFTs);
|
|
27
|
+
const toggleCollection = (collectionId) => {
|
|
28
|
+
setExpandedCollections(prev => {
|
|
29
|
+
const next = new Set(prev);
|
|
30
|
+
if (next.has(collectionId)) {
|
|
31
|
+
next.delete(collectionId);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
next.add(collectionId);
|
|
35
|
+
}
|
|
36
|
+
return next;
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return (_jsx("div", { className: "flex flex-col gap-3 px-4", children: collections.map(collection => {
|
|
40
|
+
const isExpanded = expandedCollections.has(collection.collection_id);
|
|
41
|
+
return (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("button", { onClick: () => toggleCollection(collection.collection_id), className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1", children: [collection.collection_image && (_jsx("img", { src: collection.collection_image, alt: collection.collection_name, className: "h-5 w-5 shrink-0 rounded object-cover" })), _jsxs("p", { className: "font-neue-montreal-medium text-[14px] text-[#3f3f46]", children: [collection.collection_name, " (", collection.nfts.length, ")"] })] }), _jsx("svg", { className: `h-[18px] w-[18px] shrink-0 transition-transform ${isExpanded ? "rotate-180" : ""}`, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M4.5 6.75L9 11.25L13.5 6.75", stroke: "#51525C", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), isExpanded && (_jsx("div", { className: "flex gap-3 overflow-x-auto", children: collection.nfts.map(nft => (_jsx("div", { className: "relative h-[98px] w-[98px] shrink-0 overflow-hidden rounded-lg", children: _jsx("img", { src: nft.previews?.image_medium_url ||
|
|
42
|
+
nft.extra_metadata?.image_original_url ||
|
|
43
|
+
nft.collection?.image_url ||
|
|
44
|
+
"", alt: nft.name || "NFT", className: "h-full w-full object-cover" }) }, nft.nft_id))) }))] }, collection.collection_id));
|
|
45
|
+
}) }));
|
|
10
46
|
}
|