@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface EditIconProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function EditIcon({ className, size = 16, color = "white", style }: EditIconProps) {
|
|
11
|
+
return (
|
|
12
|
+
<svg
|
|
13
|
+
width={size}
|
|
14
|
+
height={size}
|
|
15
|
+
viewBox="0 0 16 16"
|
|
16
|
+
fill="none"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
className={className}
|
|
19
|
+
style={style}
|
|
20
|
+
>
|
|
21
|
+
<path
|
|
22
|
+
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"
|
|
23
|
+
stroke={color}
|
|
24
|
+
strokeWidth="1.5"
|
|
25
|
+
strokeLinecap="round"
|
|
26
|
+
strokeLinejoin="round"
|
|
27
|
+
/>
|
|
28
|
+
<path d="M8.5 4L12 7.5" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default EditIcon;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface SignOutIconProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SignOutIcon({ className, size = 16, color = "#676767", style }: SignOutIconProps) {
|
|
11
|
+
return (
|
|
12
|
+
<svg
|
|
13
|
+
width={size}
|
|
14
|
+
height={size}
|
|
15
|
+
viewBox="0 0 16 16"
|
|
16
|
+
fill="none"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
className={className}
|
|
19
|
+
style={style}
|
|
20
|
+
>
|
|
21
|
+
<path d="M7 2.5H3V13.5H7" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
22
|
+
<path d="M7 8H14" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
23
|
+
<path d="M11.5 5.5L14 8L11.5 10.5" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default SignOutIcon;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface SwapIconProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function SwapIcon({ className, size = 24, color = "#3268EF", style }: SwapIconProps) {
|
|
11
|
+
return (
|
|
12
|
+
<svg
|
|
13
|
+
width={size}
|
|
14
|
+
height={size}
|
|
15
|
+
viewBox="0 0 25 24"
|
|
16
|
+
fill="none"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
className={className}
|
|
19
|
+
style={style}
|
|
20
|
+
>
|
|
21
|
+
<path d="M8.75 9H4.25V4.5" stroke={color} strokeWidth="2.25" strokeLinecap="round" strokeLinejoin="round" />
|
|
22
|
+
<path
|
|
23
|
+
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"
|
|
24
|
+
stroke={color}
|
|
25
|
+
strokeWidth="2.25"
|
|
26
|
+
strokeLinecap="round"
|
|
27
|
+
strokeLinejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
<path d="M16.25 15H20.75V19.5" stroke={color} strokeWidth="2.25" strokeLinecap="round" strokeLinejoin="round" />
|
|
30
|
+
<path
|
|
31
|
+
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"
|
|
32
|
+
stroke={color}
|
|
33
|
+
strokeWidth="2.25"
|
|
34
|
+
strokeLinecap="round"
|
|
35
|
+
strokeLinejoin="round"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default SwapIcon;
|
|
@@ -3,6 +3,7 @@ import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
|
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
import { createPublicClient, formatUnits, http } from "viem";
|
|
5
5
|
import { base } from "viem/chains";
|
|
6
|
+
import { fetchTokenPriceWithChange } from "./useTokenPrice";
|
|
6
7
|
|
|
7
8
|
// ABI for just balanceOf
|
|
8
9
|
const abi = [
|
|
@@ -28,9 +29,18 @@ async function fetchB3Balances(addresses: string[]): Promise<{
|
|
|
28
29
|
address: string;
|
|
29
30
|
balance: bigint;
|
|
30
31
|
formatted: string;
|
|
32
|
+
balanceUsd: number;
|
|
33
|
+
balanceUsdFormatted: string;
|
|
34
|
+
priceChange24h: number | null;
|
|
31
35
|
}[];
|
|
36
|
+
balanceUsd: number;
|
|
37
|
+
balanceUsdFormatted: string;
|
|
38
|
+
priceChange24h: number | null;
|
|
32
39
|
}> {
|
|
33
40
|
try {
|
|
41
|
+
// Fetch price with change data once (same for all addresses since it's the same token)
|
|
42
|
+
const priceData = await fetchTokenPriceWithChange(B3_TOKEN.address, B3_TOKEN.chainId, "usd");
|
|
43
|
+
|
|
34
44
|
// Fetch all balances in parallel
|
|
35
45
|
const balances = await Promise.all(
|
|
36
46
|
addresses.map(async address => {
|
|
@@ -40,22 +50,30 @@ async function fetchB3Balances(addresses: string[]): Promise<{
|
|
|
40
50
|
functionName: "balanceOf",
|
|
41
51
|
args: [address as `0x${string}`],
|
|
42
52
|
});
|
|
53
|
+
const balanceUsd = Number(formatUnits(balance, B3_TOKEN.decimals)) * priceData.price;
|
|
43
54
|
|
|
44
55
|
return {
|
|
45
56
|
address,
|
|
46
57
|
balance,
|
|
47
58
|
formatted: formatUnits(balance, B3_TOKEN.decimals),
|
|
59
|
+
balanceUsd,
|
|
60
|
+
balanceUsdFormatted: formatNumber(balanceUsd),
|
|
61
|
+
priceChange24h: priceData.priceChange24h,
|
|
48
62
|
};
|
|
49
63
|
}),
|
|
50
64
|
);
|
|
51
65
|
|
|
52
66
|
// Calculate total
|
|
53
67
|
const totalBalance = balances.reduce((sum, { balance }) => sum + balance, BigInt(0));
|
|
68
|
+
const totalBalanceUsd = balances.reduce((sum, { balanceUsd }) => sum + balanceUsd, 0);
|
|
54
69
|
|
|
55
70
|
return {
|
|
56
71
|
totalBalance,
|
|
57
72
|
formattedTotal: formatNumber(Number(formatUnits(totalBalance, B3_TOKEN.decimals))),
|
|
58
73
|
breakdown: balances,
|
|
74
|
+
balanceUsd: totalBalanceUsd,
|
|
75
|
+
balanceUsdFormatted: formatNumber(totalBalanceUsd),
|
|
76
|
+
priceChange24h: priceData.priceChange24h,
|
|
59
77
|
};
|
|
60
78
|
} catch (error) {
|
|
61
79
|
console.error("Error fetching B3 balances:", error);
|
|
@@ -3,6 +3,7 @@ import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
|
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
5
|
import { createPublicClient, formatEther, formatUnits, http } from "viem";
|
|
6
|
+
import { fetchNativeTokenPriceWithChange } from "./useTokenPrice";
|
|
6
7
|
interface NativeBalanceResponse {
|
|
7
8
|
data: Array<{
|
|
8
9
|
tokenDecimals: number;
|
|
@@ -30,21 +31,65 @@ async function fetchNativeBalance(address: string, chainIds: string) {
|
|
|
30
31
|
return acc + Number(balance);
|
|
31
32
|
}, 0);
|
|
32
33
|
|
|
34
|
+
// TODO: Revive me once CoinGecko supports B3
|
|
35
|
+
let usdBalances: Record<
|
|
36
|
+
number,
|
|
37
|
+
{
|
|
38
|
+
balance: number;
|
|
39
|
+
formatted: string;
|
|
40
|
+
priceChange24h: number | null;
|
|
41
|
+
}
|
|
42
|
+
> = {};
|
|
43
|
+
|
|
44
|
+
let globalPriceChange24h: number | null = null;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
for (const item of data.data) {
|
|
48
|
+
// Use chain ID once since native token ETH is the same across all chains
|
|
49
|
+
const priceData = await fetchNativeTokenPriceWithChange("eth");
|
|
50
|
+
|
|
51
|
+
// Store the price change globally (same for all chains since it's ETH)
|
|
52
|
+
if (globalPriceChange24h === null) {
|
|
53
|
+
globalPriceChange24h = priceData.priceChange24h;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
usdBalances[item.chainId] = {
|
|
57
|
+
balance: total * priceData.price,
|
|
58
|
+
formatted: formatNumber(total * priceData.price),
|
|
59
|
+
priceChange24h: priceData.priceChange24h,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("@@useNativeBalance:error in price calculation", error);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const totalUsd = Object.values(usdBalances).reduce((acc, curr) => acc + curr.balance, 0);
|
|
67
|
+
|
|
33
68
|
return {
|
|
34
69
|
total,
|
|
35
70
|
formattedTotal: formatNumber(total),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
71
|
+
totalUsd,
|
|
72
|
+
formattedTotalUsd: formatNumber(totalUsd),
|
|
73
|
+
priceChange24h: globalPriceChange24h,
|
|
74
|
+
breakdown: data.data.map(item => {
|
|
75
|
+
const usdBalance = usdBalances[item.chainId]?.balance || 0;
|
|
76
|
+
const priceChange = usdBalances[item.chainId]?.priceChange24h || null;
|
|
77
|
+
return {
|
|
78
|
+
chainId: item.chainId,
|
|
79
|
+
balance: BigInt(item.balance),
|
|
80
|
+
formatted: formatNumber(Number(formatUnits(BigInt(item.balance), item.tokenDecimals))),
|
|
81
|
+
balanceUsd: usdBalance,
|
|
82
|
+
balanceUsdFormatted: formatNumber(usdBalance),
|
|
83
|
+
priceChange24h: priceChange,
|
|
84
|
+
};
|
|
85
|
+
}),
|
|
41
86
|
};
|
|
42
87
|
}
|
|
43
88
|
|
|
44
89
|
export function useNativeBalance(address?: string, chainIds = "8333") {
|
|
45
90
|
return useQuery({
|
|
46
91
|
queryKey: ["nativeBalance", address, chainIds],
|
|
47
|
-
queryFn: () => fetchNativeBalance(address
|
|
92
|
+
queryFn: () => fetchNativeBalance(address || "", chainIds),
|
|
48
93
|
enabled: Boolean(address),
|
|
49
94
|
staleTime: 30 * 1000, // Consider data fresh for 30 seconds
|
|
50
95
|
gcTime: 5 * 60 * 1000, // Keep unused data in cache for 5 minutes
|
|
@@ -20,14 +20,110 @@ interface TokenPriceResponse {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
interface TokenPriceWithChangeResponse {
|
|
24
|
+
[contractAddress: string]: {
|
|
25
|
+
[key: string]: number; // For both currency prices and price change keys like "usd_24h_change"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface NativeTokenPriceResponse {
|
|
30
|
+
data: {
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
attributes: {
|
|
34
|
+
token_prices: {
|
|
35
|
+
[address: string]: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function fetchNativeTokenPriceUsd(contractAddress: string, network: string) {
|
|
42
|
+
const response = await fetch(
|
|
43
|
+
`https://coingecko-api.sean-430.workers.dev?localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}&url=https://pro-api.coingecko.com/api/v3/onchain/simple/networks/${network}/token_price/${contractAddress}`,
|
|
44
|
+
{
|
|
45
|
+
headers: {
|
|
46
|
+
accept: "application/json",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
throw new Error(`Failed to fetch native token price: ${response.status} ${response.statusText}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const data: NativeTokenPriceResponse = await response.json();
|
|
56
|
+
|
|
57
|
+
// Find the price using case-insensitive address comparison
|
|
58
|
+
const prices = data.data?.attributes?.token_prices || {};
|
|
59
|
+
const price = Object.entries(prices).find(
|
|
60
|
+
([address]) => address.toLowerCase() === contractAddress.toLowerCase(),
|
|
61
|
+
)?.[1];
|
|
62
|
+
|
|
63
|
+
if (!price) {
|
|
64
|
+
throw new Error(`No price data found for native token: ${contractAddress}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Convert string price to number
|
|
68
|
+
const numericPrice = Number(price);
|
|
69
|
+
if (isNaN(numericPrice)) {
|
|
70
|
+
throw new Error(`Invalid price data for native token: ${contractAddress}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return numericPrice;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function fetchNativeTokenPriceWithChange(network: string) {
|
|
77
|
+
// For ETH, use the regular simple price API instead of on-chain API to get price changes
|
|
78
|
+
const coinId = network === "eth" ? "ethereum" : network;
|
|
79
|
+
|
|
80
|
+
const response = await fetch(
|
|
81
|
+
`https://coingecko-api.sean-430.workers.dev?localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}&url=https://pro-api.coingecko.com/api/v3/simple/price?ids=${coinId}&vs_currencies=usd&include_24hr_change=true`,
|
|
82
|
+
{
|
|
83
|
+
headers: {
|
|
84
|
+
accept: "application/json",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (!response.ok) {
|
|
90
|
+
throw new Error(`Failed to fetch native token price with change: ${response.status} ${response.statusText}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface SimpleTokenPriceWithChangeResponse {
|
|
94
|
+
[coinId: string]: {
|
|
95
|
+
usd: number;
|
|
96
|
+
usd_24h_change: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const data: SimpleTokenPriceWithChangeResponse = await response.json();
|
|
101
|
+
|
|
102
|
+
if (!data[coinId]) {
|
|
103
|
+
throw new Error(`No price data found for coin: ${coinId}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const price = data[coinId].usd;
|
|
107
|
+
const priceChange = data[coinId].usd_24h_change;
|
|
108
|
+
|
|
109
|
+
if (typeof price !== "number") {
|
|
110
|
+
throw new Error(`Invalid price data for coin: ${coinId}`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
price,
|
|
115
|
+
priceChange24h: priceChange || null,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function fetchTokenPrice(contractAddress: string, chainId: number, vsCurrency = "usd") {
|
|
24
120
|
const platformId = getPlatformId(chainId as ChainId);
|
|
121
|
+
|
|
25
122
|
const response = await fetch(
|
|
26
|
-
`https://pro-api.coingecko.com/api/v3/simple/token_price/${platformId}?contract_addresses=${contractAddress}&vs_currencies=${vsCurrency}`,
|
|
123
|
+
`https://coingecko-api.sean-430.workers.dev?localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}&url=https://pro-api.coingecko.com/api/v3/simple/token_price/${platformId}?contract_addresses=${contractAddress}&vs_currencies=${vsCurrency}`,
|
|
27
124
|
{
|
|
28
125
|
headers: {
|
|
29
126
|
accept: "application/json",
|
|
30
|
-
"x-cg-pro-api-key": process.env.COINGECKO_API_KEY as string,
|
|
31
127
|
},
|
|
32
128
|
},
|
|
33
129
|
);
|
|
@@ -52,6 +148,45 @@ async function fetchTokenPrice(contractAddress: string, chainId: number, vsCurre
|
|
|
52
148
|
return data[contractAddress][vsCurrency] as number;
|
|
53
149
|
}
|
|
54
150
|
|
|
151
|
+
export async function fetchTokenPriceWithChange(contractAddress: string, chainId: number, vsCurrency = "usd") {
|
|
152
|
+
const platformId = getPlatformId(chainId as ChainId);
|
|
153
|
+
|
|
154
|
+
const response = await fetch(
|
|
155
|
+
`https://coingecko-api.sean-430.workers.dev?localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}&url=https://pro-api.coingecko.com/api/v3/simple/token_price/${platformId}?contract_addresses=${contractAddress}&vs_currencies=${vsCurrency}&include_24hr_change=true`,
|
|
156
|
+
{
|
|
157
|
+
headers: {
|
|
158
|
+
accept: "application/json",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (!response.ok) {
|
|
164
|
+
throw new Error(`Failed to fetch token price with change: ${response.status} ${response.statusText}`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const data: TokenPriceWithChangeResponse = await response.json();
|
|
168
|
+
|
|
169
|
+
// Check if the contract address exists in the response
|
|
170
|
+
if (!data[contractAddress]) {
|
|
171
|
+
throw new Error(`No price data found for contract address: ${contractAddress}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Check if the requested currency exists in the response
|
|
175
|
+
if (typeof data[contractAddress][vsCurrency] !== "number") {
|
|
176
|
+
throw new Error(`No price data found for currency: ${vsCurrency}`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Get the price change key (e.g., "usd_24h_change")
|
|
180
|
+
const priceChangeKey = `${vsCurrency}_24h_change` as keyof (typeof data)[typeof contractAddress];
|
|
181
|
+
const priceChange = data[contractAddress][priceChangeKey] as number | undefined;
|
|
182
|
+
|
|
183
|
+
// Return the price and price change with proper type checking
|
|
184
|
+
return {
|
|
185
|
+
price: data[contractAddress][vsCurrency] as number,
|
|
186
|
+
priceChange24h: priceChange || null,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
55
190
|
export function useTokenPrice({
|
|
56
191
|
contractAddress,
|
|
57
192
|
chainId = 8453, // Default to Base
|
|
@@ -16,6 +16,14 @@ export interface UnifiedTransactionParams {
|
|
|
16
16
|
value: bigint;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
const partnerId = String(
|
|
20
|
+
process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
21
|
+
process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
22
|
+
process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
|
|
23
|
+
process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID,
|
|
24
|
+
);
|
|
25
|
+
invariant(partnerId, "Partner ID is required");
|
|
26
|
+
|
|
19
27
|
export function useUnifiedChainSwitchAndExecute() {
|
|
20
28
|
const { data: walletClient } = useWalletClient();
|
|
21
29
|
const { switchChainAsync } = useSwitchChain();
|
|
@@ -130,9 +138,7 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
130
138
|
// Check if we can use global-accounts-intents, if yes, create an intent.
|
|
131
139
|
try {
|
|
132
140
|
await app.service("global-accounts-intents").create({
|
|
133
|
-
partnerId:
|
|
134
|
-
process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID || process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID,
|
|
135
|
-
),
|
|
141
|
+
partnerId: partnerId,
|
|
136
142
|
chainId: targetChainId,
|
|
137
143
|
to: params.to,
|
|
138
144
|
data: params.data || "0x",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
|
|
2
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
|
|
3
3
|
import { AllowedStrategy } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
5
5
|
import { Address, Chain } from "thirdweb";
|