@b3dotfun/sdk 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -8
- package/dist/cjs/anyspend/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +11 -15
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +9 -10
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -4
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +5 -5
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +1 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +9 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +2 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.d.ts +1 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +3 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendTokens.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendTokens.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.js +3 -3
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +3 -3
- package/dist/cjs/anyspend/react/hooks/useStripeClientSecret.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useStripeClientSecret.js +3 -3
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +3 -3
- package/dist/cjs/anyspend/services/anyspend.d.ts +9 -10
- package/dist/cjs/anyspend/services/anyspend.js +18 -18
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +13 -15
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +4 -4
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.d.ts +1 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +31 -20
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/cjs/global-account/react/components/custom/CopyToClipboard.d.ts +2 -1
- package/dist/cjs/global-account/react/components/custom/CopyToClipboard.js +3 -2
- package/dist/cjs/global-account/react/components/icons/BankIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/BankIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/EditIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/EditIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/SignOutIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/SignOutIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/SwapIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/SwapIcon.js +8 -0
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.d.ts +6 -0
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +11 -0
- package/dist/cjs/global-account/react/hooks/useNativeBalance.d.ts +6 -0
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +39 -6
- package/dist/cjs/global-account/react/hooks/useTokenPrice.d.ts +10 -0
- package/dist/cjs/global-account/react/hooks/useTokenPrice.js +81 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +1 -1
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +13 -17
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +10 -11
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -4
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +1 -2
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +5 -5
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +1 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +7 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +0 -1
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.d.ts +1 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.d.ts +1 -2
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +2 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.d.ts +1 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +3 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendTokens.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendTokens.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +3 -3
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +3 -3
- package/dist/esm/anyspend/react/hooks/useStripeClientSecret.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useStripeClientSecret.js +3 -3
- package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useStripeSupport.js +3 -3
- package/dist/esm/anyspend/services/anyspend.d.ts +9 -10
- package/dist/esm/anyspend/services/anyspend.js +19 -19
- package/dist/esm/global-account/react/components/B3DynamicModal.js +13 -15
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +5 -5
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.d.ts +1 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +33 -22
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/custom/CopyToClipboard.d.ts +2 -1
- package/dist/esm/global-account/react/components/custom/CopyToClipboard.js +4 -3
- package/dist/esm/global-account/react/components/icons/BankIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/BankIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/EditIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/EditIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/SignOutIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/SignOutIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/SwapIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/SwapIcon.js +5 -0
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.d.ts +6 -0
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +11 -0
- package/dist/esm/global-account/react/hooks/useNativeBalance.d.ts +6 -0
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +39 -6
- package/dist/esm/global-account/react/hooks/useTokenPrice.d.ts +10 -0
- package/dist/esm/global-account/react/hooks/useTokenPrice.js +78 -3
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +6 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +1 -2
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/PaymentStripeWeb2.d.ts +1 -2
- package/dist/types/anyspend/react/components/common/PaymentVendorUI.d.ts +1 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useAnyspendQuote.d.ts +1 -2
- package/dist/types/anyspend/react/hooks/useAnyspendTokens.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useStripeClientSecret.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
- package/dist/types/anyspend/services/anyspend.d.ts +9 -10
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -2
- package/dist/types/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/types/global-account/react/components/ManageAccount/ManageAccount.d.ts +1 -0
- package/dist/types/global-account/react/components/custom/CopyToClipboard.d.ts +2 -1
- package/dist/types/global-account/react/components/icons/BankIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/EditIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/SignOutIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/SwapIcon.d.ts +9 -0
- package/dist/types/global-account/react/hooks/useB3BalanceFromAddresses.d.ts +6 -0
- package/dist/types/global-account/react/hooks/useNativeBalance.d.ts +6 -0
- package/dist/types/global-account/react/hooks/useTokenPrice.d.ts +10 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +1 -1
- package/package.json +2 -1
- package/src/anyspend/constants/index.ts +0 -1
- package/src/anyspend/docs/components.md +1 -5
- package/src/anyspend/docs/error-handling.md +47 -47
- package/src/anyspend/docs/examples.md +29 -29
- package/src/anyspend/docs/hooks.md +22 -27
- package/src/anyspend/docs/installation.md +1 -5
- package/src/anyspend/react/components/AnySpend.tsx +8 -28
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -3
- package/src/anyspend/react/components/AnySpendCustom.tsx +8 -16
- package/src/anyspend/react/components/AnySpendNFT.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -3
- package/src/anyspend/react/components/AnySpendTournament.tsx +0 -4
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +7 -7
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +5 -7
- package/src/anyspend/react/components/common/OrderDetails.tsx +1 -3
- package/src/anyspend/react/components/common/OrderHistory.tsx +1 -3
- package/src/anyspend/react/components/common/OrderStatus.tsx +7 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +2 -2
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -4
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +1 -3
- package/src/anyspend/react/components/common/PaymentVendorUI.tsx +2 -3
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +1 -3
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +0 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +1 -13
- package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendOrderHistory.ts +2 -7
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +3 -4
- package/src/anyspend/react/hooks/useAnyspendTokens.ts +2 -2
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +3 -8
- package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +2 -3
- package/src/anyspend/react/hooks/useStripeClientSecret.ts +3 -3
- package/src/anyspend/react/hooks/useStripeSupport.ts +3 -8
- package/src/anyspend/services/anyspend.ts +19 -45
- package/src/global-account/react/components/B3DynamicModal.tsx +66 -39
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -4
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -3
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +4 -6
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +309 -137
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +4 -3
- package/src/global-account/react/components/custom/CopyToClipboard.tsx +7 -4
- package/src/global-account/react/components/icons/BankIcon.tsx +38 -0
- package/src/global-account/react/components/icons/EditIcon.tsx +33 -0
- package/src/global-account/react/components/icons/SignOutIcon.tsx +28 -0
- package/src/global-account/react/components/icons/SwapIcon.tsx +41 -0
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +18 -0
- package/src/global-account/react/hooks/useNativeBalance.tsx +51 -6
- package/src/global-account/react/hooks/useTokenPrice.tsx +138 -3
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +9 -3
- package/src/global-account/react/stores/useModalStore.ts +1 -1
- package/src/styles/index.css +328 -0
|
@@ -4,6 +4,7 @@ exports.B3DynamicModal = B3DynamicModal;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("../../../anyspend/react");
|
|
6
6
|
const react_2 = require("../../../global-account/react");
|
|
7
|
+
const cn_1 = require("../../../shared/utils/cn");
|
|
7
8
|
const debug_1 = require("../../../shared/utils/debug");
|
|
8
9
|
const useB3_1 = require("./B3Provider/useB3");
|
|
9
10
|
const ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
@@ -17,9 +18,9 @@ function B3DynamicModal() {
|
|
|
17
18
|
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = (0, react_2.useModalStore)();
|
|
18
19
|
const { theme } = (0, useB3_1.useB3)();
|
|
19
20
|
const isMobile = (0, react_2.useIsMobile)();
|
|
20
|
-
let contentClass = `b3-modal ${theme === "dark" ? "dark" : ""}`;
|
|
21
21
|
let hideCloseButton = false;
|
|
22
|
-
|
|
22
|
+
// Define arrays for different modal type groups
|
|
23
|
+
const fullWidthTypes = [
|
|
23
24
|
"anySpend",
|
|
24
25
|
"anySpendNft",
|
|
25
26
|
"anySpendJoinTournament",
|
|
@@ -30,10 +31,8 @@ function B3DynamicModal() {
|
|
|
30
31
|
"signInWithB3",
|
|
31
32
|
"anySpendSignatureMint",
|
|
32
33
|
"anySpendBondKit",
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if ([
|
|
34
|
+
];
|
|
35
|
+
const freestyleTypes = [
|
|
37
36
|
"anySpendNft",
|
|
38
37
|
"anySpendJoinTournament",
|
|
39
38
|
"anySpendFundTournament",
|
|
@@ -41,16 +40,15 @@ function B3DynamicModal() {
|
|
|
41
40
|
"anySpendBuySpin",
|
|
42
41
|
"anySpendSignatureMint",
|
|
43
42
|
"anySpendBondKit",
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
contentClass += " b3-modal-freestyle";
|
|
43
|
+
];
|
|
44
|
+
// Check if current content type is in freestyle types
|
|
45
|
+
const isFreestyleType = freestyleTypes.includes(contentType?.type);
|
|
46
|
+
if (isFreestyleType) {
|
|
49
47
|
hideCloseButton = true;
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
// Build content class using cn utility
|
|
50
|
+
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
51
|
+
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6", contentType?.type === "transak" && "transak-modal");
|
|
54
52
|
debug("contentType", contentType);
|
|
55
53
|
const renderContent = () => {
|
|
56
54
|
if (!contentType)
|
|
@@ -93,5 +91,5 @@ function B3DynamicModal() {
|
|
|
93
91
|
const ModalContent = isMobile ? drawer_1.DrawerContent : dialog_1.DialogContent;
|
|
94
92
|
const ModalTitle = isMobile ? drawer_1.DrawerTitle : dialog_1.DialogTitle;
|
|
95
93
|
const ModalDescription = isMobile ? drawer_1.DrawerDescription : dialog_1.DialogDescription;
|
|
96
|
-
return ((0, jsx_runtime_1.jsx)(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: (0, jsx_runtime_1.jsxs)(ModalContent, { className: contentClass, hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: "no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]", children: [history.length > 0 && contentType?.showBackButton && ((0, jsx_runtime_1.jsxs)("button", { onClick: navigateBack, className: "
|
|
94
|
+
return ((0, jsx_runtime_1.jsx)(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: (0, jsx_runtime_1.jsxs)(ModalContent, { className: (0, cn_1.cn)(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800", "mx-auto w-full max-w-md", "sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [(0, jsx_runtime_1.jsx)(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), (0, jsx_runtime_1.jsx)(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), (0, jsx_runtime_1.jsxs)("div", { className: "no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]", children: [history.length > 0 && contentType?.showBackButton && ((0, jsx_runtime_1.jsxs)("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }) }));
|
|
97
95
|
}
|
|
@@ -6,8 +6,7 @@ export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem"
|
|
|
6
6
|
/**
|
|
7
7
|
* Main B3Provider component
|
|
8
8
|
*/
|
|
9
|
-
export declare function B3Provider({
|
|
10
|
-
isMainnetAnySpend?: boolean;
|
|
9
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, }: {
|
|
11
10
|
theme: "light" | "dark";
|
|
12
11
|
children: React.ReactNode;
|
|
13
12
|
accountOverride?: Account;
|
|
@@ -32,8 +32,8 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
32
32
|
/**
|
|
33
33
|
* Main B3Provider component
|
|
34
34
|
*/
|
|
35
|
-
function B3Provider({
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, children: (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, {
|
|
35
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, }) {
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, children: (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" }), (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Inner provider component that provides the actual B3Context
|
|
@@ -4,8 +4,7 @@ import { B3ContextType } from "./types";
|
|
|
4
4
|
/**
|
|
5
5
|
* Main B3Provider component
|
|
6
6
|
*/
|
|
7
|
-
export declare function B3Provider({
|
|
8
|
-
isMainnetAnySpend?: boolean;
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, }: {
|
|
9
8
|
theme: "light" | "dark";
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
accountOverride?: Account;
|
|
@@ -21,9 +21,7 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
21
21
|
/**
|
|
22
22
|
* Main B3Provider component
|
|
23
23
|
*/
|
|
24
|
-
function B3Provider({
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
-
isMainnetAnySpend = true, theme = "light", children, accountOverride, environment, }) {
|
|
24
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, }) {
|
|
27
25
|
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, children: children }) }) }));
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export declare function RelayKitProviderWrapper({
|
|
2
|
-
isMainnet: boolean;
|
|
1
|
+
export declare function RelayKitProviderWrapper({ children, simDuneApiKey, }: {
|
|
3
2
|
children: React.ReactNode;
|
|
4
3
|
simDuneApiKey?: string;
|
|
5
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,17 +5,17 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const relay_kit_ui_1 = require("@reservoir0x/relay-kit-ui");
|
|
6
6
|
const relay_sdk_1 = require("@reservoir0x/relay-sdk");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
function RelayKitProviderWrapper({
|
|
8
|
+
function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
|
|
9
9
|
const [relayChains, setRelayChains] = (0, react_1.useState)([]);
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
11
11
|
const fetchChains = async () => {
|
|
12
|
-
const chains = await (0, relay_sdk_1.fetchChainConfigs)(
|
|
12
|
+
const chains = await (0, relay_sdk_1.fetchChainConfigs)(relay_sdk_1.MAINNET_RELAY_API);
|
|
13
13
|
setRelayChains(chains);
|
|
14
14
|
};
|
|
15
15
|
fetchChains();
|
|
16
|
-
}, [
|
|
16
|
+
}, []);
|
|
17
17
|
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.RelayKitProvider, { options: {
|
|
18
|
-
baseApiUrl:
|
|
18
|
+
baseApiUrl: relay_sdk_1.MAINNET_RELAY_API,
|
|
19
19
|
source: "anyspend",
|
|
20
20
|
duneConfig: {
|
|
21
21
|
apiKey: simDuneApiKey,
|
|
@@ -6,6 +6,7 @@ interface ManageAccountProps {
|
|
|
6
6
|
onViewProfile?: () => void;
|
|
7
7
|
chain: Chain;
|
|
8
8
|
partnerId: string;
|
|
9
|
+
containerClassName?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, }: ManageAccountProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ManageAccount = ManageAccount;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("../../../../global-account/react");
|
|
9
|
-
const
|
|
9
|
+
const BankIcon_1 = require("../../../../global-account/react/components/icons/BankIcon");
|
|
10
|
+
const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
|
|
11
|
+
const SwapIcon_1 = require("../../../../global-account/react/components/icons/SwapIcon");
|
|
12
|
+
const utils_1 = require("../../../../shared/utils");
|
|
10
13
|
const formatNumber_1 = require("../../../../shared/utils/formatNumber");
|
|
11
14
|
const lucide_react_1 = require("lucide-react");
|
|
12
15
|
const react_2 = require("react");
|
|
@@ -20,14 +23,17 @@ function centerTruncate(str, length = 4) {
|
|
|
20
23
|
return `${str.slice(0, length)}...${str.slice(-length)}`;
|
|
21
24
|
}
|
|
22
25
|
function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, }) {
|
|
23
|
-
const { automaticallySetFirstEoa } = (0, react_1.useB3)();
|
|
24
26
|
const [activeTab, setActiveTab] = (0, react_2.useState)("balance");
|
|
25
27
|
const [revokingSignerId, setRevokingSignerId] = (0, react_2.useState)(null);
|
|
26
28
|
const account = (0, react_3.useActiveAccount)();
|
|
27
|
-
const { address: eoaAddress, info: { data: eoaInfo }, } = (0, useFirstEOA_1.default)();
|
|
28
29
|
const { data: assets, isLoading } = (0, react_1.useAccountAssets)(account?.address);
|
|
29
30
|
const { data: b3Balance } = (0, react_1.useB3BalanceFromAddresses)(account?.address);
|
|
30
31
|
const { data: nativeBalance } = (0, react_1.useNativeBalance)(account?.address);
|
|
32
|
+
const { address: eoaAddress } = (0, useFirstEOA_1.default)();
|
|
33
|
+
const { data: profile } = (0, react_1.useProfile)({
|
|
34
|
+
address: eoaAddress || account?.address,
|
|
35
|
+
fresh: true,
|
|
36
|
+
});
|
|
31
37
|
const { data: eoaNativeBalance } = (0, react_1.useNativeBalance)(eoaAddress);
|
|
32
38
|
const { data: eoaB3Balance } = (0, react_1.useB3BalanceFromAddresses)(eoaAddress);
|
|
33
39
|
const { data: signers, refetch: refetchSigners } = (0, react_1.useGetAllTWSigners)({
|
|
@@ -37,6 +43,8 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
37
43
|
const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
|
|
38
44
|
const { logout } = (0, react_1.useAuthentication)(partnerId);
|
|
39
45
|
const [logoutLoading, setLogoutLoading] = (0, react_2.useState)(false);
|
|
46
|
+
console.log("account", account);
|
|
47
|
+
console.log("eoaAddress", eoaAddress);
|
|
40
48
|
const { removeSessionKey } = (0, react_1.useRemoveSessionKey)({
|
|
41
49
|
chain,
|
|
42
50
|
onSuccess: tx => {
|
|
@@ -60,21 +68,24 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
60
68
|
setB3ModalOpen(false);
|
|
61
69
|
setLogoutLoading(false);
|
|
62
70
|
};
|
|
63
|
-
const BalanceContent = () =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
const BalanceContent = () => {
|
|
72
|
+
const { info: eoaInfo } = (0, useFirstEOA_1.default)();
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [profile?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted", children: (0, utils_1.formatUsername)(profile?.name || "") })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "manage-account-address bg-b3-line flex h-11 items-center gap-2 rounded-full px-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: centerTruncate(account?.address || "") }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [(0, jsx_runtime_1.jsxs)(react_1.Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
74
|
+
setB3ModalOpen(true);
|
|
75
|
+
setB3ModalContentType({
|
|
76
|
+
type: "anySpend",
|
|
77
|
+
defaultActiveTab: "fiat",
|
|
78
|
+
showBackButton: true,
|
|
79
|
+
});
|
|
80
|
+
}, children: [(0, jsx_runtime_1.jsx)(BankIcon_1.BankIcon, { size: 24, className: "text-b3-primary-blue shrink-0" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Deposit" })] }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "manage-account-swap bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
|
|
81
|
+
setB3ModalOpen(true);
|
|
82
|
+
setB3ModalContentType({
|
|
83
|
+
type: "anySpend",
|
|
84
|
+
showBackButton: true,
|
|
85
|
+
});
|
|
86
|
+
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold", children: "Balance" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3-coin-3d.png", alt: "B3", className: "size-10" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: "B3" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: [b3Balance?.formattedTotal || "0.00", " B3"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: ["$", b3Balance?.balanceUsdFormatted || "0.00"] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: b3Balance?.priceChange24h !== null && b3Balance?.priceChange24h !== undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Triangle, { className: `size-3 ${b3Balance.priceChange24h >= 0 ? "text-b3-positive fill-b3-positive" : "text-b3-negative fill-b3-negative rotate-180"}` }), (0, jsx_runtime_1.jsxs)("span", { className: `font-neue-montreal-medium text-sm ${b3Balance.priceChange24h >= 0 ? "text-b3-positive" : "text-b3-negative"}`, children: [b3Balance.priceChange24h >= 0 ? "+" : "", b3Balance.priceChange24h.toFixed(2), "%"] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "--" })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/ethereum.svg", alt: "ETH", className: "size-10" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: "Ethereum" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: [nativeBalance?.formattedTotal || "0.00", " ETH"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: ["$", nativeBalance?.formattedTotalUsd || "0.00"] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: nativeBalance?.priceChange24h !== null && nativeBalance?.priceChange24h !== undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Triangle, { className: `size-3 ${nativeBalance.priceChange24h >= 0 ? "text-b3-positive fill-b3-positive" : "text-b3-negative fill-b3-negative rotate-180"}` }), (0, jsx_runtime_1.jsxs)("span", { className: `font-neue-montreal-medium text-sm ${nativeBalance.priceChange24h >= 0 ? "text-b3-positive" : "text-b3-negative"}`, children: [nativeBalance.priceChange24h >= 0 ? "+" : "", nativeBalance.priceChange24h.toFixed(2), "%"] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "--" })) })] })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-b3-grey font-neue-montreal-semibold", children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), (0, jsx_runtime_1.jsxs)("div", { className: "manage-account-address bg-b3-line flex h-11 items-center gap-2 rounded-full px-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: centerTruncate(eoaAddress) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: eoaAddress })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3-coin-3d.png", alt: "B3", className: "size-10" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: "B3" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: [eoaB3Balance?.formattedTotal || "0.00", " B3"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: ["$", eoaB3Balance?.balanceUsdFormatted || "0.00"] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1", children: eoaB3Balance?.priceChange24h !== null && eoaB3Balance?.priceChange24h !== undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Triangle, { className: `size-3 ${eoaB3Balance.priceChange24h >= 0 ? "text-b3-positive fill-b3-positive" : "text-b3-negative fill-b3-negative rotate-180"}` }), (0, jsx_runtime_1.jsxs)("span", { className: `font-neue-montreal-medium text-sm ${eoaB3Balance.priceChange24h >= 0 ? "text-b3-positive" : "text-b3-negative"}`, children: [eoaB3Balance.priceChange24h >= 0 ? "+" : "", eoaB3Balance.priceChange24h.toFixed(2), "%"] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "--" })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/ethereum.svg", alt: "ETH", className: "size-10" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-b3-grey font-neue-montreal-semibold", children: "Ethereum" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: [eoaNativeBalance?.formattedTotal || "0.00", " ETH"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: ["$", eoaNativeBalance?.formattedTotalUsd || "0.00"] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: eoaNativeBalance?.priceChange24h !== null && eoaNativeBalance?.priceChange24h !== undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Triangle, { className: `size-3 ${eoaNativeBalance.priceChange24h >= 0 ? "text-b3-positive fill-b3-positive" : "text-b3-negative fill-b3-negative rotate-180"}` }), (0, jsx_runtime_1.jsxs)("span", { className: `font-neue-montreal-medium text-sm ${eoaNativeBalance.priceChange24h >= 0 ? "text-b3-positive" : "text-b3-negative"}`, children: [eoaNativeBalance.priceChange24h >= 0 ? "+" : "", eoaNativeBalance.priceChange24h.toFixed(2), "%"] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "--" })) })] })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3-powered apps" })] }), (0, jsx_runtime_1.jsx)("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin" }) : (0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
|
|
87
|
+
};
|
|
88
|
+
const AssetsContent = () => ((0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-3 gap-4", children: assets?.nftResponse ? ((0, jsx_runtime_1.jsx)(AccountAssets_1.AccountAssets, { nfts: assets.nftResponse, isLoading: isLoading })) : ((0, jsx_runtime_1.jsx)("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }));
|
|
89
|
+
const AppsContent = () => ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [signers?.map((signer) => ((0, jsx_runtime_1.jsx)("div", { className: "rounded-xl border border-gray-200 p-4 dark:border-gray-800", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-medium text-gray-600 dark:text-gray-400", children: "App" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-medium text-gray-900 dark:text-white", children: signer.partner.name }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 space-y-1", children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-gray-500", children: ["Added ", new Date(signer.createdAt).toLocaleDateString()] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-gray-500", children: ["Expires ", new Date(Number(signer.endTimestamp) * 1000).toLocaleDateString()] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-gray-500", children: ["Max spend: ", (0, formatNumber_1.formatNumber)(Number((0, viem_1.formatUnits)(signer.nativeTokenLimitPerTransaction, 18))), " ETH"] })] })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "outline", size: "sm", className: "border-red-200 text-red-500 hover:border-red-300 hover:text-red-600", onClick: () => handleRevoke(signer), disabled: revokingSignerId === signer.id, children: revokingSignerId === signer.id ? "Revoking..." : "Revoke" })] }) }, signer.id))), !signers?.length && (0, jsx_runtime_1.jsx)("div", { className: "py-12 text-center text-gray-500", children: "No connected apps" })] }));
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1", children: (0, jsx_runtime_1.jsxs)(react_1.TabsPrimitive, { defaultValue: activeTab, onValueChange: setActiveTab, children: [(0, jsx_runtime_1.jsxs)(react_1.TabsListPrimitive, { className: "font-neue-montreal-semibold text-b3-grey flex h-8 w-full items-start justify-start gap-8 border-0 text-xl md:p-4", children: [(0, jsx_runtime_1.jsx)(react_1.TabTriggerPrimitive, { value: "balance", className: "data-[state=active]:text-b3-primary-blue data-[state=active]:border-b-b3-primary-blue flex-none rounded-none border-0 p-0 pb-1 text-xl leading-none tracking-wide transition-colors data-[state=active]:border-b data-[state=active]:bg-white md:pb-4", children: "Overview" }), (0, jsx_runtime_1.jsx)(react_1.TabTriggerPrimitive, { value: "assets", className: "data-[state=active]:text-b3-primary-blue data-[state=active]:border-b-b3-primary-blue flex-none rounded-none border-0 p-0 pb-1 text-xl leading-none tracking-wide transition-colors data-[state=active]:border-b data-[state=active]:bg-white md:pb-4", children: "Mints" }), (0, jsx_runtime_1.jsx)(react_1.TabTriggerPrimitive, { value: "apps", className: "data-[state=active]:text-b3-primary-blue data-[state=active]:border-b-b3-primary-blue flex-none rounded-none border-0 p-0 pb-1 text-xl leading-none tracking-wide transition-colors data-[state=active]:border-b data-[state=active]:bg-white md:pb-4", children: "Apps" })] }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "balance", className: "pt-4 md:p-4", children: (0, jsx_runtime_1.jsx)(BalanceContent, {}) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "assets", className: "pt-4 md:p-4", children: (0, jsx_runtime_1.jsx)(AssetsContent, {}) }), (0, jsx_runtime_1.jsx)(react_1.TabsContentPrimitive, { value: "apps", className: "pt-4 md:p-4", children: (0, jsx_runtime_1.jsx)(AppsContent, {}) })] }) }) }));
|
|
80
91
|
}
|
|
@@ -17,7 +17,7 @@ function LoginStepContainer({ children, partnerId }) {
|
|
|
17
17
|
},
|
|
18
18
|
}, !!partnerId);
|
|
19
19
|
const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [partnerLogo && (0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "mb-6 mt-6 h-12 w-auto object-contain" }), children, (0, jsx_runtime_1.jsxs)("h2", { className: "mt-6 flex items-center gap-2 text-lg font-bold", children: ["Powered by", (0, jsx_runtime_1.jsx)("img", { alt: "B3 Logo", className: "h-5", src: "https://cdn.b3.fun/b3_logo.svg" }), "Connect"] })] }));
|
|
21
21
|
}
|
|
22
22
|
function LoginStep({ onSuccess, onError, partnerId, chain }) {
|
|
23
23
|
const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
|
|
@@ -62,7 +62,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
|
|
|
62
62
|
header: {
|
|
63
63
|
title: "Sign in with B3",
|
|
64
64
|
titleIcon: "https://cdn.b3.fun/b3_logo.svg",
|
|
65
|
-
}, onConnect: async (wallet) => {
|
|
65
|
+
}, className: "b3-login-step", onConnect: async (wallet) => {
|
|
66
66
|
try {
|
|
67
67
|
setIsAuthenticating(true);
|
|
68
68
|
(0, debug_1.debug)("setIsAuthenticating:true:6");
|
|
@@ -2,6 +2,7 @@ interface CopyToClipboardProps {
|
|
|
2
2
|
text?: string;
|
|
3
3
|
onCopy?: () => void;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function CopyToClipboard({ text, onCopy, children }: CopyToClipboardProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function CopyToClipboard({ text, onCopy, children, className }: CopyToClipboardProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CopyToClipboard = CopyToClipboard;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("../../../../shared/utils");
|
|
5
6
|
const lucide_react_1 = require("lucide-react");
|
|
6
7
|
const react_1 = require("react");
|
|
7
|
-
function CopyToClipboard({ text, onCopy, children }) {
|
|
8
|
+
function CopyToClipboard({ text, onCopy, children, className }) {
|
|
8
9
|
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
9
10
|
const handleCopy = async () => {
|
|
10
11
|
if (!text)
|
|
@@ -17,5 +18,5 @@ function CopyToClipboard({ text, onCopy, children }) {
|
|
|
17
18
|
if (children) {
|
|
18
19
|
return ((0, jsx_runtime_1.jsx)("div", { onClick: handleCopy, className: "cursor-pointer", children: children }));
|
|
19
20
|
}
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)("div", { onClick: handleCopy, className: "text-b3-
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: handleCopy, className: (0, utils_1.cn)("text-b3-foreground-muted hover:text-b3-foreground-muted/80 flex cursor-pointer items-center gap-1 text-xs transition-all duration-200", className), children: copied ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" }) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) })) }));
|
|
21
22
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface BankIconProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare function BankIcon({ className, size, color, style }: BankIconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default BankIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BankIcon = BankIcon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function BankIcon({ className, size = 24, color = "#3268EF", style }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style, children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 9H21.75L12 3L2.25 9Z", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.25 9V15.75", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M9.75 9V15.75", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M14.25 9V15.75", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M18.75 9V15.75", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 15.75H21", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M1.5 19.5H22.5", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
|
+
}
|
|
8
|
+
exports.default = BankIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface EditIconProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare function EditIcon({ className, size, color, style }: EditIconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default EditIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditIcon = EditIcon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function EditIcon({ className, size = 16, color = "white", style }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style, children: [(0, jsx_runtime_1.jsx)("path", { d: "M5.79313 13.5001H3C2.86739 13.5001 2.74021 13.4474 2.64645 13.3536C2.55268 13.2599 2.5 13.1327 2.5 13.0001V10.207C2.50006 10.0745 2.55266 9.94753 2.64625 9.85383L10.3538 2.14633C10.4475 2.05263 10.5746 2 10.7072 2C10.8397 2 10.9669 2.05263 11.0606 2.14633L13.8538 4.93758C13.9474 5.03134 14.0001 5.15847 14.0001 5.29102C14.0001 5.42357 13.9474 5.5507 13.8538 5.64446L6.14625 13.3538C6.05255 13.4474 5.92556 13.5 5.79313 13.5001Z", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M8.5 4L12 7.5", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
|
+
}
|
|
8
|
+
exports.default = EditIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SignOutIconProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare function SignOutIcon({ className, size, color, style }: SignOutIconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default SignOutIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignOutIcon = SignOutIcon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function SignOutIcon({ className, size = 16, color = "#676767", style }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style, children: [(0, jsx_runtime_1.jsx)("path", { d: "M7 2.5H3V13.5H7", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 8H14", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M11.5 5.5L14 8L11.5 10.5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
|
+
}
|
|
8
|
+
exports.default = SignOutIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SwapIconProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare function SwapIcon({ className, size, color, style }: SwapIconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default SwapIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapIcon = SwapIcon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function SwapIcon({ className, size = 24, color = "#3268EF", style }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style, children: [(0, jsx_runtime_1.jsx)("path", { d: "M8.75 9H4.25V4.5", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.25 9.00013L6.90125 6.34888C8.43666 4.81353 10.5154 3.94539 12.6868 3.93276C14.8581 3.92012 16.9468 4.764 18.5 6.28138", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M16.25 15H20.75V19.5", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M20.75 15L18.0988 17.6512C16.5633 19.1866 14.4846 20.0547 12.3132 20.0674C10.1419 20.08 8.05317 19.2361 6.5 17.7188", stroke: color, strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
|
+
}
|
|
8
|
+
exports.default = SwapIcon;
|
|
@@ -10,6 +10,12 @@ export declare function useB3BalanceFromAddresses(addresses?: string[] | string
|
|
|
10
10
|
address: string;
|
|
11
11
|
balance: bigint;
|
|
12
12
|
formatted: string;
|
|
13
|
+
balanceUsd: number;
|
|
14
|
+
balanceUsdFormatted: string;
|
|
15
|
+
priceChange24h: number | null;
|
|
13
16
|
}[];
|
|
17
|
+
balanceUsd: number;
|
|
18
|
+
balanceUsdFormatted: string;
|
|
19
|
+
priceChange24h: number | null;
|
|
14
20
|
}, Error>;
|
|
15
21
|
export default useB3BalanceFromAddresses;
|
|
@@ -6,6 +6,7 @@ const formatNumber_1 = require("../../../shared/utils/formatNumber");
|
|
|
6
6
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
7
|
const viem_1 = require("viem");
|
|
8
8
|
const chains_1 = require("viem/chains");
|
|
9
|
+
const useTokenPrice_1 = require("./useTokenPrice");
|
|
9
10
|
// ABI for just balanceOf
|
|
10
11
|
const abi = [
|
|
11
12
|
{
|
|
@@ -23,6 +24,8 @@ const client = (0, viem_1.createPublicClient)({
|
|
|
23
24
|
});
|
|
24
25
|
async function fetchB3Balances(addresses) {
|
|
25
26
|
try {
|
|
27
|
+
// Fetch price with change data once (same for all addresses since it's the same token)
|
|
28
|
+
const priceData = await (0, useTokenPrice_1.fetchTokenPriceWithChange)(anyspend_1.B3_TOKEN.address, anyspend_1.B3_TOKEN.chainId, "usd");
|
|
26
29
|
// Fetch all balances in parallel
|
|
27
30
|
const balances = await Promise.all(addresses.map(async (address) => {
|
|
28
31
|
const balance = await client.readContract({
|
|
@@ -31,18 +34,26 @@ async function fetchB3Balances(addresses) {
|
|
|
31
34
|
functionName: "balanceOf",
|
|
32
35
|
args: [address],
|
|
33
36
|
});
|
|
37
|
+
const balanceUsd = Number((0, viem_1.formatUnits)(balance, anyspend_1.B3_TOKEN.decimals)) * priceData.price;
|
|
34
38
|
return {
|
|
35
39
|
address,
|
|
36
40
|
balance,
|
|
37
41
|
formatted: (0, viem_1.formatUnits)(balance, anyspend_1.B3_TOKEN.decimals),
|
|
42
|
+
balanceUsd,
|
|
43
|
+
balanceUsdFormatted: (0, formatNumber_1.formatNumber)(balanceUsd),
|
|
44
|
+
priceChange24h: priceData.priceChange24h,
|
|
38
45
|
};
|
|
39
46
|
}));
|
|
40
47
|
// Calculate total
|
|
41
48
|
const totalBalance = balances.reduce((sum, { balance }) => sum + balance, BigInt(0));
|
|
49
|
+
const totalBalanceUsd = balances.reduce((sum, { balanceUsd }) => sum + balanceUsd, 0);
|
|
42
50
|
return {
|
|
43
51
|
totalBalance,
|
|
44
52
|
formattedTotal: (0, formatNumber_1.formatNumber)(Number((0, viem_1.formatUnits)(totalBalance, anyspend_1.B3_TOKEN.decimals))),
|
|
45
53
|
breakdown: balances,
|
|
54
|
+
balanceUsd: totalBalanceUsd,
|
|
55
|
+
balanceUsdFormatted: (0, formatNumber_1.formatNumber)(totalBalanceUsd),
|
|
56
|
+
priceChange24h: priceData.priceChange24h,
|
|
46
57
|
};
|
|
47
58
|
}
|
|
48
59
|
catch (error) {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
export declare function useNativeBalance(address?: string, chainIds?: string): import("@tanstack/react-query").UseQueryResult<{
|
|
2
2
|
total: number;
|
|
3
3
|
formattedTotal: string;
|
|
4
|
+
totalUsd: number;
|
|
5
|
+
formattedTotalUsd: string;
|
|
6
|
+
priceChange24h: number | null;
|
|
4
7
|
breakdown: {
|
|
5
8
|
chainId: number;
|
|
6
9
|
balance: bigint;
|
|
7
10
|
formatted: string;
|
|
11
|
+
balanceUsd: number;
|
|
12
|
+
balanceUsdFormatted: string;
|
|
13
|
+
priceChange24h: number | null;
|
|
8
14
|
}[];
|
|
9
15
|
}, Error>;
|
|
10
16
|
/**
|
|
@@ -7,6 +7,7 @@ const formatNumber_1 = require("../../../shared/utils/formatNumber");
|
|
|
7
7
|
const react_query_1 = require("@tanstack/react-query");
|
|
8
8
|
const sonner_1 = require("sonner");
|
|
9
9
|
const viem_1 = require("viem");
|
|
10
|
+
const useTokenPrice_1 = require("./useTokenPrice");
|
|
10
11
|
async function fetchNativeBalance(address, chainIds) {
|
|
11
12
|
if (!address)
|
|
12
13
|
throw new Error("Address is required");
|
|
@@ -20,20 +21,52 @@ async function fetchNativeBalance(address, chainIds) {
|
|
|
20
21
|
const balance = (0, viem_1.formatUnits)(BigInt(curr.balance), curr.tokenDecimals);
|
|
21
22
|
return acc + Number(balance);
|
|
22
23
|
}, 0);
|
|
24
|
+
// TODO: Revive me once CoinGecko supports B3
|
|
25
|
+
let usdBalances = {};
|
|
26
|
+
let globalPriceChange24h = null;
|
|
27
|
+
try {
|
|
28
|
+
for (const item of data.data) {
|
|
29
|
+
// Use chain ID once since native token ETH is the same across all chains
|
|
30
|
+
const priceData = await (0, useTokenPrice_1.fetchNativeTokenPriceWithChange)("eth");
|
|
31
|
+
// Store the price change globally (same for all chains since it's ETH)
|
|
32
|
+
if (globalPriceChange24h === null) {
|
|
33
|
+
globalPriceChange24h = priceData.priceChange24h;
|
|
34
|
+
}
|
|
35
|
+
usdBalances[item.chainId] = {
|
|
36
|
+
balance: total * priceData.price,
|
|
37
|
+
formatted: (0, formatNumber_1.formatNumber)(total * priceData.price),
|
|
38
|
+
priceChange24h: priceData.priceChange24h,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error("@@useNativeBalance:error in price calculation", error);
|
|
44
|
+
}
|
|
45
|
+
const totalUsd = Object.values(usdBalances).reduce((acc, curr) => acc + curr.balance, 0);
|
|
23
46
|
return {
|
|
24
47
|
total,
|
|
25
48
|
formattedTotal: (0, formatNumber_1.formatNumber)(total),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
totalUsd,
|
|
50
|
+
formattedTotalUsd: (0, formatNumber_1.formatNumber)(totalUsd),
|
|
51
|
+
priceChange24h: globalPriceChange24h,
|
|
52
|
+
breakdown: data.data.map(item => {
|
|
53
|
+
const usdBalance = usdBalances[item.chainId]?.balance || 0;
|
|
54
|
+
const priceChange = usdBalances[item.chainId]?.priceChange24h || null;
|
|
55
|
+
return {
|
|
56
|
+
chainId: item.chainId,
|
|
57
|
+
balance: BigInt(item.balance),
|
|
58
|
+
formatted: (0, formatNumber_1.formatNumber)(Number((0, viem_1.formatUnits)(BigInt(item.balance), item.tokenDecimals))),
|
|
59
|
+
balanceUsd: usdBalance,
|
|
60
|
+
balanceUsdFormatted: (0, formatNumber_1.formatNumber)(usdBalance),
|
|
61
|
+
priceChange24h: priceChange,
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
31
64
|
};
|
|
32
65
|
}
|
|
33
66
|
function useNativeBalance(address, chainIds = "8333") {
|
|
34
67
|
return (0, react_query_1.useQuery)({
|
|
35
68
|
queryKey: ["nativeBalance", address, chainIds],
|
|
36
|
-
queryFn: () => fetchNativeBalance(address, chainIds),
|
|
69
|
+
queryFn: () => fetchNativeBalance(address || "", chainIds),
|
|
37
70
|
enabled: Boolean(address),
|
|
38
71
|
staleTime: 30 * 1000, // Consider data fresh for 30 seconds
|
|
39
72
|
gcTime: 5 * 60 * 1000, // Keep unused data in cache for 5 minutes
|
|
@@ -7,6 +7,16 @@ interface UseTokenPriceProps {
|
|
|
7
7
|
refreshInterval?: number;
|
|
8
8
|
queryOptions?: Omit<UseQueryOptions<number, Error>, "queryKey" | "queryFn" | "refetchInterval" | "staleTime" | "retry" | "retryDelay">;
|
|
9
9
|
}
|
|
10
|
+
export declare function fetchNativeTokenPriceUsd(contractAddress: string, network: string): Promise<number>;
|
|
11
|
+
export declare function fetchNativeTokenPriceWithChange(network: string): Promise<{
|
|
12
|
+
price: number;
|
|
13
|
+
priceChange24h: number | null;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function fetchTokenPrice(contractAddress: string, chainId: number, vsCurrency?: string): Promise<number>;
|
|
16
|
+
export declare function fetchTokenPriceWithChange(contractAddress: string, chainId: number, vsCurrency?: string): Promise<{
|
|
17
|
+
price: number;
|
|
18
|
+
priceChange24h: number | null;
|
|
19
|
+
}>;
|
|
10
20
|
export declare function useTokenPrice({ contractAddress, chainId, // Default to Base
|
|
11
21
|
vsCurrency, refreshInterval, queryOptions, }: UseTokenPriceProps): {
|
|
12
22
|
price: number;
|