@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
|
@@ -49,10 +49,7 @@ export default App;
|
|
|
49
49
|
|
|
50
50
|
### 2. Environment Configuration
|
|
51
51
|
|
|
52
|
-
AnySpend automatically configures API endpoints based on the `isMainnet` parameter:
|
|
53
|
-
|
|
54
52
|
- **Mainnet**: `https://mainnet.anyspend.com`
|
|
55
|
-
- **Testnet**: `http://testnet.anyspend.com`
|
|
56
53
|
|
|
57
54
|
### 3. TypeScript Configuration (Optional but Recommended)
|
|
58
55
|
|
|
@@ -97,7 +94,6 @@ function TestComponent() {
|
|
|
97
94
|
<AnySpendNFTButton
|
|
98
95
|
nftContract={testNFT}
|
|
99
96
|
recipientAddress="0x742d35Cc6634C0532925a3b8D07d77d9F05C4d57"
|
|
100
|
-
isMainnet={false} // Use testnet for testing
|
|
101
97
|
onSuccess={(txHash) => {
|
|
102
98
|
console.log("Test successful!", txHash);
|
|
103
99
|
}}
|
|
@@ -110,4 +106,4 @@ function TestComponent() {
|
|
|
110
106
|
|
|
111
107
|
- [Explore Components →](./components.md)
|
|
112
108
|
- [Learn about Hooks →](./hooks.md)
|
|
113
|
-
- [See Examples →](./examples.md)
|
|
109
|
+
- [See Examples →](./examples.md)
|
|
@@ -25,12 +25,12 @@ import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
|
25
25
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
26
26
|
import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
27
27
|
import invariant from "invariant";
|
|
28
|
-
import { ArrowDown, ChevronRight,
|
|
28
|
+
import { ArrowDown, ChevronRight, CircleAlert, HistoryIcon } from "lucide-react";
|
|
29
29
|
import { motion } from "motion/react";
|
|
30
30
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
31
31
|
import { toast } from "sonner";
|
|
32
32
|
import { parseUnits } from "viem";
|
|
33
|
-
import {
|
|
33
|
+
import { base, mainnet } from "viem/chains";
|
|
34
34
|
import { components } from "../../types/api";
|
|
35
35
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
36
36
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
@@ -65,7 +65,6 @@ export enum PanelView {
|
|
|
65
65
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
66
66
|
|
|
67
67
|
export function AnySpend(props: {
|
|
68
|
-
isMainnet?: boolean;
|
|
69
68
|
mode?: "page" | "modal";
|
|
70
69
|
defaultActiveTab?: "crypto" | "fiat";
|
|
71
70
|
destinationTokenAddress?: string;
|
|
@@ -86,7 +85,6 @@ export function AnySpend(props: {
|
|
|
86
85
|
function AnySpendInner({
|
|
87
86
|
destinationTokenAddress,
|
|
88
87
|
destinationTokenChainId,
|
|
89
|
-
isMainnet = true,
|
|
90
88
|
mode = "modal",
|
|
91
89
|
defaultActiveTab = "crypto",
|
|
92
90
|
loadOrder,
|
|
@@ -95,7 +93,6 @@ function AnySpendInner({
|
|
|
95
93
|
}: {
|
|
96
94
|
destinationTokenAddress?: string;
|
|
97
95
|
destinationTokenChainId?: number;
|
|
98
|
-
isMainnet?: boolean;
|
|
99
96
|
mode?: "page" | "modal";
|
|
100
97
|
defaultActiveTab?: "crypto" | "fiat";
|
|
101
98
|
loadOrder?: string;
|
|
@@ -129,10 +126,7 @@ function AnySpendInner({
|
|
|
129
126
|
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(defaultActiveTab);
|
|
130
127
|
|
|
131
128
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
132
|
-
const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(
|
|
133
|
-
isMainnet,
|
|
134
|
-
orderId,
|
|
135
|
-
);
|
|
129
|
+
const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(orderId);
|
|
136
130
|
!!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
|
|
137
131
|
|
|
138
132
|
const [activePanel, setActivePanel] = useState<PanelView>(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
|
|
@@ -147,10 +141,9 @@ function AnySpendInner({
|
|
|
147
141
|
// const recipientInputRef = useRef<HTMLInputElement>(null);
|
|
148
142
|
|
|
149
143
|
// Get initial chain IDs from URL or defaults
|
|
150
|
-
const initialSrcChainId = parseInt(searchParams.get("fromChainId") || "0") ||
|
|
144
|
+
const initialSrcChainId = parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
|
|
151
145
|
const initialDstChainId =
|
|
152
|
-
parseInt(searchParams.get("toChainId") || "0") ||
|
|
153
|
-
(isBuyMode ? destinationTokenChainId : isMainnet ? base.id : b3Sepolia.id);
|
|
146
|
+
parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : base.id);
|
|
154
147
|
|
|
155
148
|
// State for source chain/token selection
|
|
156
149
|
const [selectedSrcChainId, setSelectedSrcChainId] = useState<number>(initialSrcChainId);
|
|
@@ -415,10 +408,7 @@ function AnySpendInner({
|
|
|
415
408
|
}, [recipientAddressFromProps, globalAddress]);
|
|
416
409
|
|
|
417
410
|
// Get geo-based onramp options for fiat payments
|
|
418
|
-
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(
|
|
419
|
-
isMainnet,
|
|
420
|
-
srcAmountOnRamp,
|
|
421
|
-
);
|
|
411
|
+
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
422
412
|
|
|
423
413
|
// Helper function to map payment method to onramp vendor
|
|
424
414
|
const getOnrampVendor = (paymentMethod: FiatPaymentMethod): "coinbase" | "stripe" | "stripe-web2" | undefined => {
|
|
@@ -442,7 +432,6 @@ function AnySpendInner({
|
|
|
442
432
|
: parseUnits(dstAmount.replace(/,/g, ""), selectedDstToken.decimals).toString();
|
|
443
433
|
const srcAmountOnrampInWei = parseUnits(srcAmountOnRamp.replace(/,/g, ""), USDC_BASE.decimals).toString();
|
|
444
434
|
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote(
|
|
445
|
-
isMainnet,
|
|
446
435
|
activeTab === "crypto"
|
|
447
436
|
? {
|
|
448
437
|
srcChain: selectedSrcChainId,
|
|
@@ -534,7 +523,6 @@ function AnySpendInner({
|
|
|
534
523
|
// const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
535
524
|
|
|
536
525
|
// createOrder({
|
|
537
|
-
// isMainnet,
|
|
538
526
|
// recipientAddress,
|
|
539
527
|
// orderType: "swap",
|
|
540
528
|
// srcChain: selectedSrcChainId,
|
|
@@ -800,7 +788,6 @@ function AnySpendInner({
|
|
|
800
788
|
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
801
789
|
|
|
802
790
|
createOrder({
|
|
803
|
-
isMainnet,
|
|
804
791
|
recipientAddress,
|
|
805
792
|
orderType: "swap",
|
|
806
793
|
srcChain: selectedSrcChainId,
|
|
@@ -866,7 +853,6 @@ function AnySpendInner({
|
|
|
866
853
|
};
|
|
867
854
|
|
|
868
855
|
createOnrampOrder({
|
|
869
|
-
isMainnet,
|
|
870
856
|
recipientAddress,
|
|
871
857
|
orderType: "swap",
|
|
872
858
|
dstChain: getDstToken().chainId,
|
|
@@ -969,7 +955,6 @@ function AnySpendInner({
|
|
|
969
955
|
<>
|
|
970
956
|
<OrderStatus order={oat.data.order} />
|
|
971
957
|
<OrderDetails
|
|
972
|
-
isMainnet={isMainnet}
|
|
973
958
|
mode={mode}
|
|
974
959
|
order={oat.data.order}
|
|
975
960
|
depositTxs={oat.data.depositTxs}
|
|
@@ -1322,15 +1307,12 @@ function AnySpendInner({
|
|
|
1322
1307
|
disabled={btnInfo.disable}
|
|
1323
1308
|
onClick={onMainButtonClick}
|
|
1324
1309
|
className={cn(
|
|
1325
|
-
"relative w-full",
|
|
1310
|
+
"as-main-button relative w-full",
|
|
1326
1311
|
btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand",
|
|
1327
1312
|
)}
|
|
1328
1313
|
textClassName={cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white")}
|
|
1329
1314
|
>
|
|
1330
1315
|
{btnInfo.text}
|
|
1331
|
-
{!btnInfo.disable && !btnInfo.error && (
|
|
1332
|
-
<ChevronRightCircle className="absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" />
|
|
1333
|
-
)}
|
|
1334
1316
|
</ShinyButton>
|
|
1335
1317
|
|
|
1336
1318
|
{!hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (
|
|
@@ -1351,7 +1333,6 @@ function AnySpendInner({
|
|
|
1351
1333
|
srcAmountOnRamp={srcAmountOnRamp}
|
|
1352
1334
|
recipientName={recipientName || undefined}
|
|
1353
1335
|
recipientAddress={recipientAddress}
|
|
1354
|
-
isMainnet={isMainnet}
|
|
1355
1336
|
isBuyMode={isBuyMode}
|
|
1356
1337
|
destinationTokenChainId={destinationTokenChainId}
|
|
1357
1338
|
destinationTokenAddress={destinationTokenAddress}
|
|
@@ -1416,7 +1397,6 @@ function AnySpendInner({
|
|
|
1416
1397
|
setActivePanel(PanelView.MAIN); // Go back to main panel to show updated pricing
|
|
1417
1398
|
}}
|
|
1418
1399
|
srcAmountOnRamp={srcAmountOnRamp}
|
|
1419
|
-
isMainnet={isMainnet}
|
|
1420
1400
|
/>
|
|
1421
1401
|
);
|
|
1422
1402
|
|
|
@@ -1425,7 +1405,7 @@ function AnySpendInner({
|
|
|
1425
1405
|
<StyleRoot>
|
|
1426
1406
|
<div
|
|
1427
1407
|
className={cn(
|
|
1428
|
-
"mx-auto w-full max-w-[460px]",
|
|
1408
|
+
"anyspend-container font-inter mx-auto w-full max-w-[460px]",
|
|
1429
1409
|
mode === "page" &&
|
|
1430
1410
|
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
1431
1411
|
)}
|
|
@@ -121,7 +121,6 @@ const basePublicClient = createPublicClient({
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
export function AnySpendBuySpin({
|
|
124
|
-
isMainnet = true,
|
|
125
124
|
loadOrder,
|
|
126
125
|
mode = "modal",
|
|
127
126
|
spinwheelContractAddress,
|
|
@@ -130,7 +129,6 @@ export function AnySpendBuySpin({
|
|
|
130
129
|
prefillQuantity,
|
|
131
130
|
onSuccess,
|
|
132
131
|
}: {
|
|
133
|
-
isMainnet?: boolean;
|
|
134
132
|
loadOrder?: string;
|
|
135
133
|
mode?: "modal" | "page";
|
|
136
134
|
spinwheelContractAddress: string;
|
|
@@ -665,7 +663,6 @@ export function AnySpendBuySpin({
|
|
|
665
663
|
|
|
666
664
|
return (
|
|
667
665
|
<AnySpendCustom
|
|
668
|
-
isMainnet={isMainnet}
|
|
669
666
|
loadOrder={loadOrder}
|
|
670
667
|
mode={mode}
|
|
671
668
|
recipientAddress={recipientAddress}
|
|
@@ -41,7 +41,7 @@ import { ChevronRight, ChevronRightCircle, Loader2 } from "lucide-react";
|
|
|
41
41
|
import { motion } from "motion/react";
|
|
42
42
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
43
43
|
import { toast } from "sonner";
|
|
44
|
-
import { base
|
|
44
|
+
import { base } from "viem/chains";
|
|
45
45
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
46
46
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
47
47
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
@@ -144,7 +144,6 @@ function generateGetRelayQuoteRequest({
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export function AnySpendCustom(props: {
|
|
147
|
-
isMainnet?: boolean;
|
|
148
147
|
loadOrder?: string;
|
|
149
148
|
mode?: "modal" | "page";
|
|
150
149
|
recipientAddress?: string;
|
|
@@ -176,7 +175,6 @@ export function AnySpendCustom(props: {
|
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
function AnySpendCustomInner({
|
|
179
|
-
isMainnet = true,
|
|
180
178
|
loadOrder,
|
|
181
179
|
mode = "modal",
|
|
182
180
|
recipientAddress: recipientAddressProps,
|
|
@@ -192,7 +190,6 @@ function AnySpendCustomInner({
|
|
|
192
190
|
onSuccess,
|
|
193
191
|
showRecipient = true,
|
|
194
192
|
}: {
|
|
195
|
-
isMainnet?: boolean;
|
|
196
193
|
loadOrder?: string;
|
|
197
194
|
mode?: "modal" | "page";
|
|
198
195
|
recipientAddress?: string;
|
|
@@ -241,11 +238,11 @@ function AnySpendCustomInner({
|
|
|
241
238
|
|
|
242
239
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
243
240
|
|
|
244
|
-
const [srcChainId, setSrcChainId] = useState<number>(
|
|
241
|
+
const [srcChainId, setSrcChainId] = useState<number>(base.id);
|
|
245
242
|
|
|
246
243
|
// Get token list for token balance check
|
|
247
244
|
const chainName = useMemo(() => simpleHashChainToChainName(srcChainId), [srcChainId]);
|
|
248
|
-
const { data: tokenList } = useAnyspendTokenList(
|
|
245
|
+
const { data: tokenList } = useAnyspendTokenList(srcChainId, "");
|
|
249
246
|
|
|
250
247
|
// Get token balances for the selected chain
|
|
251
248
|
const { nativeTokens, fungibleTokens } = useTokenBalancesByChain({
|
|
@@ -334,9 +331,9 @@ function AnySpendCustomInner({
|
|
|
334
331
|
srcChainId,
|
|
335
332
|
srcToken,
|
|
336
333
|
]);
|
|
337
|
-
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote(
|
|
334
|
+
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote(getRelayQuoteRequest);
|
|
338
335
|
|
|
339
|
-
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(
|
|
336
|
+
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
340
337
|
|
|
341
338
|
const onSelectOrder = (selectedOrderId: string) => {
|
|
342
339
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
@@ -371,10 +368,8 @@ function AnySpendCustomInner({
|
|
|
371
368
|
);
|
|
372
369
|
|
|
373
370
|
// Get geo data and onramp options (after quote is available)
|
|
374
|
-
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } =
|
|
375
|
-
|
|
376
|
-
srcFiatAmount,
|
|
377
|
-
);
|
|
371
|
+
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } =
|
|
372
|
+
useGeoOnrampOptions(srcFiatAmount);
|
|
378
373
|
|
|
379
374
|
useEffect(() => {
|
|
380
375
|
if (oat?.data?.order.status === "executed") {
|
|
@@ -419,7 +414,6 @@ function AnySpendCustomInner({
|
|
|
419
414
|
invariant(srcAmount, "Src amount is null");
|
|
420
415
|
|
|
421
416
|
const createOrderParams = {
|
|
422
|
-
isMainnet: isMainnet,
|
|
423
417
|
orderType: orderType,
|
|
424
418
|
srcChain: activeTab === "fiat" ? base.id : srcChainId,
|
|
425
419
|
dstChain: dstChainId,
|
|
@@ -661,7 +655,6 @@ function AnySpendCustomInner({
|
|
|
661
655
|
<>
|
|
662
656
|
<OrderStatusDisplay order={oat.data.order} />
|
|
663
657
|
<OrderDetails
|
|
664
|
-
isMainnet={isMainnet}
|
|
665
658
|
mode={mode}
|
|
666
659
|
order={oat.data.order}
|
|
667
660
|
depositTxs={oat.data.depositTxs}
|
|
@@ -1162,7 +1155,6 @@ function AnySpendCustomInner({
|
|
|
1162
1155
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
1163
1156
|
}}
|
|
1164
1157
|
srcAmountOnRamp={srcFiatAmount}
|
|
1165
|
-
isMainnet={isMainnet}
|
|
1166
1158
|
/>
|
|
1167
1159
|
</div>
|
|
1168
1160
|
);
|
|
@@ -1180,7 +1172,7 @@ function AnySpendCustomInner({
|
|
|
1180
1172
|
? PanelView.CONFIRM_ORDER
|
|
1181
1173
|
: activePanel
|
|
1182
1174
|
}
|
|
1183
|
-
className={cn("w-full")}
|
|
1175
|
+
className={cn("anyspend-container font-inter w-full")}
|
|
1184
1176
|
variants={{
|
|
1185
1177
|
enter: { x: 300, opacity: 0 },
|
|
1186
1178
|
center: { x: 0, opacity: 1 },
|
|
@@ -31,14 +31,12 @@ const CONTRACT_URI_ABI = [
|
|
|
31
31
|
] as const;
|
|
32
32
|
|
|
33
33
|
export function AnySpendNFT({
|
|
34
|
-
isMainnet = true,
|
|
35
34
|
loadOrder,
|
|
36
35
|
mode = "modal",
|
|
37
36
|
recipientAddress,
|
|
38
37
|
nftContract,
|
|
39
38
|
onSuccess,
|
|
40
39
|
}: {
|
|
41
|
-
isMainnet?: boolean;
|
|
42
40
|
loadOrder?: string;
|
|
43
41
|
mode?: "modal" | "page";
|
|
44
42
|
recipientAddress?: string;
|
|
@@ -150,7 +148,6 @@ export function AnySpendNFT({
|
|
|
150
148
|
|
|
151
149
|
return (
|
|
152
150
|
<AnySpendCustom
|
|
153
|
-
isMainnet={isMainnet}
|
|
154
151
|
loadOrder={loadOrder}
|
|
155
152
|
mode={mode}
|
|
156
153
|
recipientAddress={recipientAddress}
|
|
@@ -42,14 +42,12 @@ function generateEncodedDataForStakingB3(amount: string, beneficiary: string): s
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function AnySpendStakeB3({
|
|
45
|
-
isMainnet = true,
|
|
46
45
|
loadOrder,
|
|
47
46
|
mode = "modal",
|
|
48
47
|
recipientAddress,
|
|
49
48
|
stakeAmount,
|
|
50
49
|
onSuccess,
|
|
51
50
|
}: {
|
|
52
|
-
isMainnet?: boolean;
|
|
53
51
|
loadOrder?: string;
|
|
54
52
|
mode?: "modal" | "page";
|
|
55
53
|
recipientAddress: string;
|
|
@@ -482,7 +480,6 @@ export function AnySpendStakeB3({
|
|
|
482
480
|
|
|
483
481
|
return (
|
|
484
482
|
<AnySpendCustom
|
|
485
|
-
isMainnet={isMainnet}
|
|
486
483
|
loadOrder={loadOrder}
|
|
487
484
|
mode={mode}
|
|
488
485
|
recipientAddress={recipientAddress}
|
|
@@ -7,7 +7,6 @@ import { AnySpendCustom } from "./AnySpendCustom";
|
|
|
7
7
|
|
|
8
8
|
type AnySpendTournamentProps =
|
|
9
9
|
| {
|
|
10
|
-
isMainnet?: boolean;
|
|
11
10
|
mode?: "modal" | "page";
|
|
12
11
|
action: "join";
|
|
13
12
|
joinFor: string;
|
|
@@ -20,7 +19,6 @@ type AnySpendTournamentProps =
|
|
|
20
19
|
onSuccess?: () => void;
|
|
21
20
|
}
|
|
22
21
|
| {
|
|
23
|
-
isMainnet?: boolean;
|
|
24
22
|
mode?: "modal" | "page";
|
|
25
23
|
action: "fund";
|
|
26
24
|
loadOrder?: string;
|
|
@@ -34,7 +32,6 @@ type AnySpendTournamentProps =
|
|
|
34
32
|
|
|
35
33
|
export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
36
34
|
const {
|
|
37
|
-
isMainnet = true,
|
|
38
35
|
mode = "modal",
|
|
39
36
|
action,
|
|
40
37
|
loadOrder,
|
|
@@ -91,7 +88,6 @@ export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
|
91
88
|
|
|
92
89
|
return (
|
|
93
90
|
<AnySpendCustom
|
|
94
|
-
isMainnet={isMainnet}
|
|
95
91
|
loadOrder={loadOrder}
|
|
96
92
|
mode={mode}
|
|
97
93
|
recipientAddress={action === "join" ? props.joinFor : undefined}
|
|
@@ -57,7 +57,7 @@ export function CryptoPaymentMethod({
|
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
|
-
<div className="mx-auto h-fit w-[460px] max-w-full">
|
|
60
|
+
<div className="crypto-payment-method mx-auto h-fit w-[460px] max-w-full">
|
|
61
61
|
<div className={cn("relative flex flex-col gap-10")}>
|
|
62
62
|
{/* Header */}
|
|
63
63
|
<button
|
|
@@ -73,16 +73,16 @@ export function CryptoPaymentMethod({
|
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
75
|
{/* Payment Methods */}
|
|
76
|
-
<div className="flex flex-col gap-3">
|
|
76
|
+
<div className="crypto-payment-methods flex flex-col gap-3">
|
|
77
77
|
{/* Connect Wallet Option */}
|
|
78
78
|
{!activeWallet ? (
|
|
79
79
|
// Not connected - show single connect button
|
|
80
80
|
<button
|
|
81
81
|
onClick={() => setShowWalletModal(true)}
|
|
82
|
-
className="bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md"
|
|
82
|
+
className="crypto-payment-method-connect-wallet bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md"
|
|
83
83
|
>
|
|
84
84
|
<div className="flex items-center gap-3">
|
|
85
|
-
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-100">
|
|
85
|
+
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-blue-100">
|
|
86
86
|
<Wallet className="h-4 w-4 text-blue-600" />
|
|
87
87
|
</div>
|
|
88
88
|
<div className="flex flex-col items-start text-left">
|
|
@@ -94,13 +94,13 @@ export function CryptoPaymentMethod({
|
|
|
94
94
|
</button>
|
|
95
95
|
) : (
|
|
96
96
|
// Connected - show wallet info
|
|
97
|
-
<div className="bg-as-surface-primary border-as-border-secondary rounded-xl border">
|
|
97
|
+
<div className="crypto-payment-method-connect-wallet wallet-connected bg-as-surface-primary border-as-border-secondary rounded-xl border">
|
|
98
98
|
<div className="flex items-center justify-between p-4">
|
|
99
99
|
<div className="flex items-center gap-3">
|
|
100
100
|
{globalWallet?.meta?.icon ? (
|
|
101
101
|
<img src={globalWallet.meta.icon} alt="Connected Wallet" className="h-8 w-8 rounded-full" />
|
|
102
102
|
) : (
|
|
103
|
-
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-green-100">
|
|
103
|
+
<div className="wallet-icon flex h-8 w-8 items-center justify-center rounded-full bg-green-100">
|
|
104
104
|
<Wallet className="h-4 w-4 text-green-600" />
|
|
105
105
|
</div>
|
|
106
106
|
)}
|
|
@@ -146,7 +146,7 @@ export function CryptoPaymentMethod({
|
|
|
146
146
|
onSelectPaymentMethod(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
147
147
|
}}
|
|
148
148
|
disabled={isCreatingOrder}
|
|
149
|
-
className="bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md"
|
|
149
|
+
className="crypto-payment-method-transfer bg-as-surface-primary border-as-border-secondary hover:border-as-secondary/80 group flex w-full items-center justify-between gap-4 rounded-xl border px-4 py-3.5 transition-all duration-200 hover:shadow-md"
|
|
150
150
|
>
|
|
151
151
|
<div className="flex flex-col items-start text-left">
|
|
152
152
|
<h4 className="text-as-primary font-semibold">Transfer crypto</h4>
|
|
@@ -16,7 +16,6 @@ interface FiatPaymentMethodProps {
|
|
|
16
16
|
onBack: () => void;
|
|
17
17
|
onSelectPaymentMethod: (method: FiatPaymentMethod) => void;
|
|
18
18
|
srcAmountOnRamp: string;
|
|
19
|
-
isMainnet: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export function FiatPaymentMethodComponent({
|
|
@@ -25,7 +24,6 @@ export function FiatPaymentMethodComponent({
|
|
|
25
24
|
onBack,
|
|
26
25
|
onSelectPaymentMethod,
|
|
27
26
|
srcAmountOnRamp,
|
|
28
|
-
isMainnet,
|
|
29
27
|
}: FiatPaymentMethodProps) {
|
|
30
28
|
// Helper function to get fees from API data
|
|
31
29
|
const getFeeFromApi = (paymentMethod: FiatPaymentMethod): string | null => {
|
|
@@ -49,7 +47,7 @@ export function FiatPaymentMethodComponent({
|
|
|
49
47
|
coinbaseAvailablePaymentMethods,
|
|
50
48
|
stripeWeb2Support,
|
|
51
49
|
isLoading: isLoadingGeoOnramp,
|
|
52
|
-
} = useGeoOnrampOptions(
|
|
50
|
+
} = useGeoOnrampOptions(srcAmountOnRamp);
|
|
53
51
|
|
|
54
52
|
// Generate payment methods based on geo availability (like in PanelOnrampPayment)
|
|
55
53
|
const availablePaymentMethods = [];
|
|
@@ -83,7 +81,7 @@ export function FiatPaymentMethodComponent({
|
|
|
83
81
|
// Show loading state while checking geo availability
|
|
84
82
|
if (isLoadingGeoOnramp) {
|
|
85
83
|
return (
|
|
86
|
-
<div className="mx-auto w-[460px] max-w-full">
|
|
84
|
+
<div className="fiat-payment-method mx-auto w-[460px] max-w-full">
|
|
87
85
|
<div className="flex flex-col gap-6">
|
|
88
86
|
<div className="flex items-center gap-4">
|
|
89
87
|
<button
|
|
@@ -106,7 +104,7 @@ export function FiatPaymentMethodComponent({
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
return (
|
|
109
|
-
<div className="mx-auto w-[460px] max-w-full">
|
|
107
|
+
<div className="fiat-payment-method mx-auto w-[460px] max-w-full">
|
|
110
108
|
<div className="flex flex-col gap-6">
|
|
111
109
|
{/* Header */}
|
|
112
110
|
<div className="flex items-center gap-4">
|
|
@@ -124,7 +122,7 @@ export function FiatPaymentMethodComponent({
|
|
|
124
122
|
{/* Payment Methods */}
|
|
125
123
|
<div className="flex flex-col gap-3">
|
|
126
124
|
{availablePaymentMethods.length === 0 ? (
|
|
127
|
-
<div className="bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center">
|
|
125
|
+
<div className="fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center">
|
|
128
126
|
<p className="text-as-secondary text-sm">
|
|
129
127
|
No payment methods available in your region for the selected amount.
|
|
130
128
|
</p>
|
|
@@ -138,7 +136,7 @@ export function FiatPaymentMethodComponent({
|
|
|
138
136
|
onSelectPaymentMethod(method.id);
|
|
139
137
|
}}
|
|
140
138
|
className={cn(
|
|
141
|
-
"bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200",
|
|
139
|
+
"fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200",
|
|
142
140
|
selectedPaymentMethod === method.id
|
|
143
141
|
? "border-as-brand bg-as-brand/10"
|
|
144
142
|
: "hover:border-as-brand/50 hover:bg-as-brand/5",
|
|
@@ -54,7 +54,6 @@ import PaymentVendorUI from "./PaymentVendorUI";
|
|
|
54
54
|
import { TransferCryptoDetails } from "./TransferCryptoDetails";
|
|
55
55
|
|
|
56
56
|
interface OrderDetailsProps {
|
|
57
|
-
isMainnet: boolean;
|
|
58
57
|
mode?: "modal" | "page";
|
|
59
58
|
order: components["schemas"]["Order"];
|
|
60
59
|
depositTxs: components["schemas"]["DepositTx"][] | null;
|
|
@@ -191,7 +190,6 @@ function roundTokenAmount(amount: string | undefined): string | undefined {
|
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
export const OrderDetails = memo(function OrderDetails({
|
|
194
|
-
isMainnet,
|
|
195
193
|
mode = "modal",
|
|
196
194
|
order,
|
|
197
195
|
depositTxs,
|
|
@@ -963,7 +961,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
963
961
|
{statusDisplay === "processing" && (
|
|
964
962
|
<>
|
|
965
963
|
{order.onrampMetadata ? (
|
|
966
|
-
<PaymentVendorUI
|
|
964
|
+
<PaymentVendorUI order={order} dstTokenSymbol={dstToken.symbol} />
|
|
967
965
|
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
|
|
968
966
|
<ConnectWalletPayment
|
|
969
967
|
order={order}
|
|
@@ -5,8 +5,6 @@ import { Button, Skeleton, useAccountWallet } from "@b3dotfun/sdk/global-account
|
|
|
5
5
|
import { ArrowLeft, RefreshCcw } from "lucide-react";
|
|
6
6
|
import { OrderHistoryItem } from "./OrderHistoryItem";
|
|
7
7
|
|
|
8
|
-
const isMainnet = true;
|
|
9
|
-
|
|
10
8
|
interface OrderHistoryProps {
|
|
11
9
|
mode: "modal" | "page";
|
|
12
10
|
onBack: () => void;
|
|
@@ -15,7 +13,7 @@ interface OrderHistoryProps {
|
|
|
15
13
|
|
|
16
14
|
export function OrderHistory({ mode, onBack, onSelectOrder }: OrderHistoryProps) {
|
|
17
15
|
const { address } = useAccountWallet();
|
|
18
|
-
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(
|
|
16
|
+
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(address);
|
|
19
17
|
|
|
20
18
|
return (
|
|
21
19
|
<>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getStatusDisplay } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
+
import { useSearchParams } from "@b3dotfun/sdk/shared/react";
|
|
3
4
|
import { Check, X } from "lucide-react";
|
|
4
5
|
import { memo } from "react";
|
|
5
6
|
import { Step, StepProgress } from "./StepProgress";
|
|
@@ -7,6 +8,8 @@ import { Step, StepProgress } from "./StepProgress";
|
|
|
7
8
|
export const OrderStatus = memo(function OrderStatus({ order }: { order: components["schemas"]["Order"] }) {
|
|
8
9
|
const isComplete = order.status === "executed";
|
|
9
10
|
const { text, status: displayStatus, description } = getStatusDisplay(order);
|
|
11
|
+
const searchParams = useSearchParams();
|
|
12
|
+
const cryptoPaymentMethod = searchParams.get("cryptoPaymentMethod");
|
|
10
13
|
|
|
11
14
|
console.log("OrderStatus", displayStatus);
|
|
12
15
|
console.log("OrderStatus", order);
|
|
@@ -25,7 +28,10 @@ export const OrderStatus = memo(function OrderStatus({ order }: { order: compone
|
|
|
25
28
|
];
|
|
26
29
|
|
|
27
30
|
if (["waiting_stripe_payment", "scanning_deposit_transaction"].includes(order.status)) {
|
|
28
|
-
|
|
31
|
+
// hide step if order is scanning_deposit_transaction and crypto payment method is transfer_crypto
|
|
32
|
+
if (!(order.status === "scanning_deposit_transaction" && cryptoPaymentMethod === "transfer_crypto")) {
|
|
33
|
+
return <StepProgress steps={paymentSteps} currentStepIndex={0} />;
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
if (["relay", "sending_token_from_vault"].includes(order.status)) {
|
|
@@ -34,7 +34,7 @@ export function PanelOnramp({
|
|
|
34
34
|
onDestinationChainChange?: (chainId: number) => void;
|
|
35
35
|
}) {
|
|
36
36
|
// Get geo-based onramp options to access fee information
|
|
37
|
-
const { stripeWeb2Support } = useGeoOnrampOptions(
|
|
37
|
+
const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
38
38
|
|
|
39
39
|
// Helper function to get fees from API data
|
|
40
40
|
const getFeeFromApi = (paymentMethod: FiatPaymentMethod): number | null => {
|
|
@@ -74,7 +74,7 @@ export function PanelOnramp({
|
|
|
74
74
|
|
|
75
75
|
// Get geo data for onramp availability
|
|
76
76
|
const { geoData } = useGetGeo();
|
|
77
|
-
const { coinbaseOnrampOptions } = useCoinbaseOnrampOptions(
|
|
77
|
+
const { coinbaseOnrampOptions } = useCoinbaseOnrampOptions(geoData?.country || "US");
|
|
78
78
|
|
|
79
79
|
// Get recipient profile for displaying name
|
|
80
80
|
const recipientProfile = useProfile({ address: _recipientAddress });
|
|
@@ -13,7 +13,6 @@ interface PanelOnrampPaymentProps {
|
|
|
13
13
|
srcAmountOnRamp: string;
|
|
14
14
|
recipientName?: string;
|
|
15
15
|
recipientAddress?: string;
|
|
16
|
-
isMainnet: boolean;
|
|
17
16
|
isBuyMode: boolean;
|
|
18
17
|
destinationTokenChainId?: number;
|
|
19
18
|
destinationTokenAddress?: string;
|
|
@@ -45,7 +44,6 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
45
44
|
const {
|
|
46
45
|
srcAmountOnRamp,
|
|
47
46
|
recipientAddress,
|
|
48
|
-
isMainnet,
|
|
49
47
|
isBuyMode,
|
|
50
48
|
destinationTokenChainId,
|
|
51
49
|
destinationTokenAddress,
|
|
@@ -69,7 +67,7 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
69
67
|
coinbaseAvailablePaymentMethods,
|
|
70
68
|
stripeWeb2Support,
|
|
71
69
|
isLoading: isLoadingGeoOnramp,
|
|
72
|
-
} = useGeoOnrampOptions(
|
|
70
|
+
} = useGeoOnrampOptions(srcAmountOnRamp);
|
|
73
71
|
|
|
74
72
|
const isLoading = isLoadingGeoOnramp;
|
|
75
73
|
|
|
@@ -127,7 +125,6 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
|
|
|
127
125
|
};
|
|
128
126
|
|
|
129
127
|
createOrder({
|
|
130
|
-
isMainnet,
|
|
131
128
|
recipientAddress,
|
|
132
129
|
orderType,
|
|
133
130
|
dstChain: getDstToken().chainId,
|
|
@@ -15,17 +15,15 @@ import PaymentMethodIcons from "./PaymentMethodIcons";
|
|
|
15
15
|
const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
|
|
16
16
|
|
|
17
17
|
interface PaymentStripeWeb2Props {
|
|
18
|
-
isMainnet: boolean;
|
|
19
18
|
order: components["schemas"]["Order"];
|
|
20
19
|
onPaymentSuccess?: (paymentIntent: any) => void;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
export default function PaymentStripeWeb2({
|
|
22
|
+
export default function PaymentStripeWeb2({ order, onPaymentSuccess }: PaymentStripeWeb2Props) {
|
|
24
23
|
const { theme } = useB3();
|
|
25
24
|
const fingerprintConfig = getFingerprintConfig();
|
|
26
25
|
|
|
27
26
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(
|
|
28
|
-
isMainnet,
|
|
29
27
|
order.stripePaymentIntentId!,
|
|
30
28
|
);
|
|
31
29
|
|