@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
|
@@ -9,7 +9,7 @@ export var FiatPaymentMethod;
|
|
|
9
9
|
FiatPaymentMethod["COINBASE_PAY"] = "coinbase_pay";
|
|
10
10
|
FiatPaymentMethod["STRIPE"] = "stripe";
|
|
11
11
|
})(FiatPaymentMethod || (FiatPaymentMethod = {}));
|
|
12
|
-
export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentMethod, onBack, onSelectPaymentMethod, srcAmountOnRamp,
|
|
12
|
+
export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedPaymentMethod, onBack, onSelectPaymentMethod, srcAmountOnRamp, }) {
|
|
13
13
|
// Helper function to get fees from API data
|
|
14
14
|
const getFeeFromApi = (paymentMethod) => {
|
|
15
15
|
switch (paymentMethod) {
|
|
@@ -27,7 +27,7 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
// Load geo-based onramp options like in PanelOnramp
|
|
30
|
-
const { coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(
|
|
30
|
+
const { coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
31
31
|
// Generate payment methods based on geo availability (like in PanelOnrampPayment)
|
|
32
32
|
const availablePaymentMethods = [];
|
|
33
33
|
// Add Coinbase Pay if available
|
|
@@ -56,12 +56,12 @@ export function FiatPaymentMethodComponent({ selectedPaymentMethod, setSelectedP
|
|
|
56
56
|
}
|
|
57
57
|
// Show loading state while checking geo availability
|
|
58
58
|
if (isLoadingGeoOnramp) {
|
|
59
|
-
return (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
|
|
59
|
+
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsxs("div", { className: "flex items-center justify-center py-8", children: [_jsx(Loader2, { className: "h-6 w-6 animate-spin" }), _jsx("span", { className: "text-as-secondary ml-2 text-sm", children: "Loading payment methods..." })] })] }) }));
|
|
60
60
|
}
|
|
61
|
-
return (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
|
|
61
|
+
return (_jsx("div", { className: "fiat-payment-method mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("div", { className: "flex-1", children: _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Choose payment method" }) })] }), _jsx("div", { className: "flex flex-col gap-3", children: availablePaymentMethods.length === 0 ? (_jsx("div", { className: "fiat-payment-method-no-methods bg-as-surface-secondary border-as-border-secondary rounded-2xl border p-6 text-center", children: _jsx("p", { className: "text-as-secondary text-sm", children: "No payment methods available in your region for the selected amount." }) })) : (availablePaymentMethods.map(method => (_jsxs("button", { onClick: () => {
|
|
62
62
|
setSelectedPaymentMethod(method.id);
|
|
63
63
|
onSelectPaymentMethod(method.id);
|
|
64
|
-
}, className: cn("bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200", selectedPaymentMethod === method.id
|
|
64
|
+
}, className: cn("fiat-payment-method-item bg-as-surface-secondary border-as-border-secondary flex w-full items-center gap-4 rounded-2xl border p-4 transition-all duration-200", selectedPaymentMethod === method.id
|
|
65
65
|
? "border-as-brand bg-as-brand/10"
|
|
66
66
|
: "hover:border-as-brand/50 hover:bg-as-brand/5"), children: [_jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-blue-600 text-2xl text-white", children: method.id === FiatPaymentMethod.COINBASE_PAY ? "C" : "S" }), _jsxs("div", { className: "flex flex-1 flex-col items-start text-left", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-as-primary text-base font-semibold", children: method.name }), _jsx("span", { className: cn("rounded-full px-2 py-1 text-xs font-medium", method.badgeColor), children: method.badge })] }), _jsx("span", { className: "text-as-primary/60 text-sm", children: method.description })] }), selectedPaymentMethod === method.id && _jsx(ChevronRight, { className: "text-as-brand h-5 w-5" })] }, method.id)))) })] }) }));
|
|
67
67
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
2
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
3
3
|
interface OrderDetailsProps {
|
|
4
|
-
isMainnet: boolean;
|
|
5
4
|
mode?: "modal" | "page";
|
|
6
5
|
order: components["schemas"]["Order"];
|
|
7
6
|
depositTxs: components["schemas"]["DepositTx"][] | null;
|
|
@@ -121,7 +121,7 @@ function roundTokenAmount(amount) {
|
|
|
121
121
|
const roundedDecimalPart = digits.join("");
|
|
122
122
|
return `${wholePart}.${roundedDecimalPart}`;
|
|
123
123
|
}
|
|
124
|
-
export const OrderDetails = memo(function OrderDetails({
|
|
124
|
+
export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, cryptoPaymentMethod, onBack, }) {
|
|
125
125
|
const router = useRouter();
|
|
126
126
|
const searchParams = useSearchParams();
|
|
127
127
|
// Read crypto payment method from URL parameters
|
|
@@ -463,7 +463,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
|
|
|
463
463
|
? `Waiting for payment`
|
|
464
464
|
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) })] }));
|
|
465
465
|
}
|
|
466
|
-
return (_jsxs(_Fragment, { children: [statusDisplay === "processing" && (_jsx(_Fragment, { children: order.onrampMetadata ? (_jsx(PaymentVendorUI, {
|
|
466
|
+
return (_jsxs(_Fragment, { children: [statusDisplay === "processing" && (_jsx(_Fragment, { children: order.onrampMetadata ? (_jsx(PaymentVendorUI, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsx(ConnectWalletPayment, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft })) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
467
467
|
// Transfer Crypto Payment Method - Show new card-based UI
|
|
468
468
|
_jsx(TransferCryptoDetails, { order: order, recipientName: recipientName, srcToken: srcToken, dstToken: dstToken, tournament: tournament, nft: nft, onBack: handleBack })) : (_jsxs("div", { className: "relative flex w-full flex-1 flex-col", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-as-primary/50", children: "Please send" }), _jsxs("div", { className: "flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0", children: [_jsx(CopyToClipboard, { text: roundedUpSrcAmount, onCopy: () => {
|
|
469
469
|
toast.success("Copied to clipboard");
|
|
@@ -4,10 +4,9 @@ import { useAnyspendOrderHistory } from "../../../../anyspend/react/index.js";
|
|
|
4
4
|
import { Button, Skeleton, useAccountWallet } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { ArrowLeft, RefreshCcw } from "lucide-react";
|
|
6
6
|
import { OrderHistoryItem } from "./OrderHistoryItem.js";
|
|
7
|
-
const isMainnet = true;
|
|
8
7
|
export function OrderHistory({ mode, onBack, onSelectOrder }) {
|
|
9
8
|
const { address } = useAccountWallet();
|
|
10
|
-
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(
|
|
9
|
+
const { orderHistory, isLoadingOrderHistory, refetchOrderHistory } = useAnyspendOrderHistory(address);
|
|
11
10
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-6 flex w-full items-center gap-4", children: [_jsx(Button, { onClick: onBack, variant: "ghost", size: "icon", children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "text-xl font-semibold", children: "Order History" }), _jsx("p", { className: "text-as-primary/30 text-sm", children: "View your past transactions" })] }), _jsx(Button, { variant: "ghost", size: "icon", onClick: () => {
|
|
12
11
|
refetchOrderHistory();
|
|
13
12
|
}, children: _jsx(RefreshCcw, { className: "text-as-primary/30 hover:text-as-primary h-4 w-4 cursor-pointer transition-all hover:rotate-180" }) })] }), isLoadingOrderHistory ? (_jsx("div", { className: "w-full space-y-4", children: [1, 2, 3].map(i => (_jsx(Skeleton, { className: "h-[160px] w-full rounded-lg" }, i))) })) : !orderHistory?.length ? (_jsx("div", { className: "bg-as-light-brand w-full rounded-lg border p-8 text-center", children: _jsx("p", { className: "text-b3-react-muted-foreground", children: "No order history found" }) })) : (_jsx("div", { className: "mb-12 w-full space-y-4", children: [...orderHistory]
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getStatusDisplay } from "../../../../anyspend/index.js";
|
|
3
|
+
import { useSearchParams } from "../../../../shared/react/index.js";
|
|
3
4
|
import { Check, X } from "lucide-react";
|
|
4
5
|
import { memo } from "react";
|
|
5
6
|
import { StepProgress } from "./StepProgress.js";
|
|
6
7
|
export const OrderStatus = memo(function OrderStatus({ order }) {
|
|
7
8
|
const isComplete = order.status === "executed";
|
|
8
9
|
const { text, status: displayStatus, description } = getStatusDisplay(order);
|
|
10
|
+
const searchParams = useSearchParams();
|
|
11
|
+
const cryptoPaymentMethod = searchParams.get("cryptoPaymentMethod");
|
|
9
12
|
console.log("OrderStatus", displayStatus);
|
|
10
13
|
console.log("OrderStatus", order);
|
|
11
14
|
const paymentSteps = [
|
|
@@ -21,7 +24,10 @@ export const OrderStatus = memo(function OrderStatus({ order }) {
|
|
|
21
24
|
},
|
|
22
25
|
];
|
|
23
26
|
if (["waiting_stripe_payment", "scanning_deposit_transaction"].includes(order.status)) {
|
|
24
|
-
|
|
27
|
+
// hide step if order is scanning_deposit_transaction and crypto payment method is transfer_crypto
|
|
28
|
+
if (!(order.status === "scanning_deposit_transaction" && cryptoPaymentMethod === "transfer_crypto")) {
|
|
29
|
+
return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
if (["relay", "sending_token_from_vault"].includes(order.status)) {
|
|
27
33
|
return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
|
|
@@ -11,7 +11,7 @@ import { FiatPaymentMethod } from "./FiatPaymentMethod.js";
|
|
|
11
11
|
import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
|
|
12
12
|
export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, }) {
|
|
13
13
|
// Get geo-based onramp options to access fee information
|
|
14
|
-
const { stripeWeb2Support } = useGeoOnrampOptions(
|
|
14
|
+
const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
15
15
|
// Helper function to get fees from API data
|
|
16
16
|
const getFeeFromApi = (paymentMethod) => {
|
|
17
17
|
switch (paymentMethod) {
|
|
@@ -45,7 +45,7 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
|
|
|
45
45
|
};
|
|
46
46
|
// Get geo data for onramp availability
|
|
47
47
|
const { geoData } = useGetGeo();
|
|
48
|
-
const { coinbaseOnrampOptions } = useCoinbaseOnrampOptions(
|
|
48
|
+
const { coinbaseOnrampOptions } = useCoinbaseOnrampOptions(geoData?.country || "US");
|
|
49
49
|
// Get recipient profile for displaying name
|
|
50
50
|
const recipientProfile = useProfile({ address: _recipientAddress });
|
|
51
51
|
const recipientName = recipientProfile.data?.name;
|
|
@@ -12,8 +12,8 @@ export function PanelOnrampPayment(props) {
|
|
|
12
12
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(PanelOnrampPaymentInner, { ...props }) }));
|
|
13
13
|
}
|
|
14
14
|
function PanelOnrampPaymentInner(props) {
|
|
15
|
-
const { srcAmountOnRamp, recipientAddress,
|
|
16
|
-
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(
|
|
15
|
+
const { srcAmountOnRamp, recipientAddress, isBuyMode, destinationTokenChainId, destinationTokenAddress, selectedDstChainId, selectedDstToken, anyspendQuote, globalAddress, onOrderCreated, onBack, orderType, nft, tournament, payload, recipientEnsName, recipientImageUrl, } = props;
|
|
16
|
+
const { geoData, coinbaseOnrampOptions, coinbaseAvailablePaymentMethods, stripeWeb2Support, isLoading: isLoadingGeoOnramp, } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
17
17
|
const isLoading = isLoadingGeoOnramp;
|
|
18
18
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
19
19
|
onSuccess: data => {
|
|
@@ -59,7 +59,6 @@ function PanelOnrampPaymentInner(props) {
|
|
|
59
59
|
return selectedDstToken;
|
|
60
60
|
};
|
|
61
61
|
createOrder({
|
|
62
|
-
isMainnet,
|
|
63
62
|
recipientAddress,
|
|
64
63
|
orderType,
|
|
65
64
|
dstChain: getDstToken().chainId,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
2
|
interface PaymentStripeWeb2Props {
|
|
3
|
-
isMainnet: boolean;
|
|
4
3
|
order: components["schemas"]["Order"];
|
|
5
4
|
onPaymentSuccess?: (paymentIntent: any) => void;
|
|
6
5
|
}
|
|
7
|
-
export default function PaymentStripeWeb2({
|
|
6
|
+
export default function PaymentStripeWeb2({ order, onPaymentSuccess }: PaymentStripeWeb2Props): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export {};
|
|
@@ -12,10 +12,10 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFin
|
|
|
12
12
|
import HowItWorks from "./HowItWorks.js";
|
|
13
13
|
import PaymentMethodIcons from "./PaymentMethodIcons.js";
|
|
14
14
|
const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
|
|
15
|
-
export default function PaymentStripeWeb2({
|
|
15
|
+
export default function PaymentStripeWeb2({ order, onPaymentSuccess }) {
|
|
16
16
|
const { theme } = useB3();
|
|
17
17
|
const fingerprintConfig = getFingerprintConfig();
|
|
18
|
-
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(
|
|
18
|
+
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(order.stripePaymentIntentId);
|
|
19
19
|
if (isLoadingStripeClientSecret) {
|
|
20
20
|
return _jsx(StripeLoadingState, {});
|
|
21
21
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
2
|
interface PaymentVendorUIProps {
|
|
3
|
-
isMainnet: boolean;
|
|
4
3
|
order: components["schemas"]["Order"];
|
|
5
4
|
dstTokenSymbol: string;
|
|
6
5
|
}
|
|
7
|
-
export default function PaymentVendorUI({
|
|
6
|
+
export default function PaymentVendorUI({ order, dstTokenSymbol }: PaymentVendorUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import PaymentOneClick from "./PaymentOneClick.js";
|
|
3
3
|
import PaymentStripeWeb2 from "./PaymentStripeWeb2.js";
|
|
4
|
-
export default function PaymentVendorUI({
|
|
4
|
+
export default function PaymentVendorUI({ order, dstTokenSymbol }) {
|
|
5
5
|
const vendor = order.onrampMetadata?.vendor;
|
|
6
6
|
// Handle one-click payment flows (Coinbase, Stripe redirect)
|
|
7
7
|
if (order.oneClickBuyUrl) {
|
|
@@ -9,7 +9,7 @@ export default function PaymentVendorUI({ isMainnet, order, dstTokenSymbol }) {
|
|
|
9
9
|
}
|
|
10
10
|
// Handle Stripe Web2 payment flow
|
|
11
11
|
if (vendor === "stripe-web2") {
|
|
12
|
-
return _jsx(PaymentStripeWeb2, {
|
|
12
|
+
return _jsx(PaymentStripeWeb2, { order: order });
|
|
13
13
|
}
|
|
14
14
|
// Return null for unsupported vendors
|
|
15
15
|
return null;
|
|
@@ -29,5 +29,5 @@ export function RecipientSelection({ initialValue = "", placeholder = "Enter rec
|
|
|
29
29
|
};
|
|
30
30
|
const isAddressValid = !validateAddress || !recipientAddress || validateAddress(recipientAddress);
|
|
31
31
|
const canConfirm = recipientAddress && isAddressValid;
|
|
32
|
-
return (_jsx("div", { className: "mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
|
|
32
|
+
return (_jsx("div", { className: "recipient-selection mx-auto w-[460px] max-w-full", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex justify-around", children: [_jsx("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsxs("div", { className: "flex-1 text-center", children: [_jsx("h2", { className: "text-as-primary text-lg font-semibold", children: title }), _jsx("p", { className: "text-as-primary/60 text-sm", children: description })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "bg-as-surface-secondary border-as-border-secondary flex h-12 w-full overflow-hidden rounded-xl border", children: [_jsx("input", { type: "text", placeholder: placeholder, value: recipientAddress, onChange: e => setRecipientAddress(e.target.value), onKeyDown: handleKeyDown, className: "text-as-primary placeholder:text-as-primary/50 flex-1 bg-transparent px-4 text-base focus:outline-none", autoFocus: autoFocus }), _jsx("div", { className: "border-as-border-secondary border-l", children: _jsx("button", { onClick: handlePaste, className: "text-as-primary/70 hover:text-as-primary hover:bg-as-surface-primary h-full px-4 font-semibold transition-colors", children: "Paste" }) })] }), recipientAddress && !isAddressValid && (_jsx("div", { className: "text-as-red text-sm", children: "Please enter a valid address" })), _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "bg-as-brand hover:bg-as-brand/90 disabled:bg-as-on-surface-2 disabled:text-as-secondary h-12 w-full rounded-xl font-medium text-white transition-colors disabled:cursor-not-allowed", children: confirmText })] })] }) }));
|
|
33
33
|
}
|
|
@@ -87,7 +87,7 @@ function StripePaymentForm({ order, onPaymentSuccess, }) {
|
|
|
87
87
|
function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId, }) {
|
|
88
88
|
const [createdOrder, setCreatedOrder] = useState(null);
|
|
89
89
|
const orderCreationAttempted = useRef(false);
|
|
90
|
-
const { geoData, stripeWeb2Support, isLoading: isLoadingGeoOnramp } = useGeoOnrampOptions(
|
|
90
|
+
const { geoData, stripeWeb2Support, isLoading: isLoadingGeoOnramp } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
91
91
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
|
|
92
92
|
onSuccess: data => {
|
|
93
93
|
setCreatedOrder(data.data);
|
|
@@ -97,7 +97,7 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
|
|
|
97
97
|
toast.error("Failed to create order: " + error.message);
|
|
98
98
|
},
|
|
99
99
|
});
|
|
100
|
-
const { clientSecret, isLoadingStripeClientSecret } = useStripeClientSecret(
|
|
100
|
+
const { clientSecret, isLoadingStripeClientSecret } = useStripeClientSecret(createdOrder?.stripePaymentIntentId || "");
|
|
101
101
|
// Create order when component mounts and all required data is available
|
|
102
102
|
useEffect(() => {
|
|
103
103
|
const createOrderIfPossible = async () => {
|
|
@@ -118,7 +118,6 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
|
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
createOrder({
|
|
121
|
-
isMainnet: true,
|
|
122
121
|
recipientAddress,
|
|
123
122
|
orderType: "swap",
|
|
124
123
|
dstChain: getDstToken().chainId,
|
|
@@ -19,7 +19,7 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
|
19
19
|
};
|
|
20
20
|
const { mutate: createOrder, isPending } = useMutation({
|
|
21
21
|
mutationFn: async (params) => {
|
|
22
|
-
const {
|
|
22
|
+
const { recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId, } = params;
|
|
23
23
|
try {
|
|
24
24
|
// Validate required onramp fields
|
|
25
25
|
if (!onramp.vendor || !onramp.country) {
|
|
@@ -30,7 +30,6 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
|
30
30
|
// Create order with USDC on Base as source
|
|
31
31
|
const srcAmountOnRampInWei = parseUnits(srcFiatAmount, USDC_BASE.decimals);
|
|
32
32
|
return await anyspendService.createOrder({
|
|
33
|
-
isMainnet,
|
|
34
33
|
recipientAddress: normalizeAddress(recipientAddress),
|
|
35
34
|
type: orderType,
|
|
36
35
|
srcChain,
|
|
@@ -17,10 +17,9 @@ export function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
|
17
17
|
};
|
|
18
18
|
const { mutate: createOrder, isPending } = useMutation({
|
|
19
19
|
mutationFn: async (params) => {
|
|
20
|
-
const {
|
|
20
|
+
const { recipientAddress, orderType, srcChain, dstChain, srcToken, dstToken, srcAmount, creatorAddress } = params;
|
|
21
21
|
try {
|
|
22
22
|
return await anyspendService.createOrder({
|
|
23
|
-
isMainnet,
|
|
24
23
|
recipientAddress: normalizeAddress(recipientAddress),
|
|
25
24
|
type: orderType,
|
|
26
25
|
srcChain,
|
|
@@ -21,7 +21,7 @@ function customDeepEqual(oldData, newData) {
|
|
|
21
21
|
return oldData === newData;
|
|
22
22
|
}
|
|
23
23
|
// Hook to fetch and auto-refresh order status and transaction details
|
|
24
|
-
export function useAnyspendOrderAndTransactions(
|
|
24
|
+
export function useAnyspendOrderAndTransactions(orderId) {
|
|
25
25
|
const selectFn = useCallback((data) => {
|
|
26
26
|
if (!data)
|
|
27
27
|
return undefined;
|
|
@@ -29,7 +29,7 @@ export function useAnyspendOrderAndTransactions(isMainnet, orderId) {
|
|
|
29
29
|
}, []);
|
|
30
30
|
const { data, isLoading, refetch, error } = useQuery({
|
|
31
31
|
queryKey: ["getAnyspendOrderAndTransactions", orderId],
|
|
32
|
-
queryFn: () => anyspendService.getOrderAndTransactions(
|
|
32
|
+
queryFn: () => anyspendService.getOrderAndTransactions(orderId),
|
|
33
33
|
enabled: !!orderId,
|
|
34
34
|
refetchInterval: 3000,
|
|
35
35
|
staleTime: 1000,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useAnyspendOrderHistory(
|
|
1
|
+
export declare function useAnyspendOrderHistory(creatorAddress: string | undefined, limit?: number, offset?: number): {
|
|
2
2
|
orderHistory: (({
|
|
3
3
|
id: string;
|
|
4
4
|
recipientAddress: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useAnyspendOrderHistory(
|
|
4
|
+
export function useAnyspendOrderHistory(creatorAddress, limit = 100, offset = 0) {
|
|
5
5
|
const { data: rawData = [], isLoading, refetch, error, } = useQuery({
|
|
6
6
|
queryKey: ["getOrderHistory", creatorAddress, limit, offset],
|
|
7
7
|
queryFn: async () => {
|
|
8
|
-
const response = await anyspendService.getOrderHistory(
|
|
8
|
+
const response = await anyspendService.getOrderHistory(creatorAddress, limit, offset);
|
|
9
9
|
return response.data;
|
|
10
10
|
},
|
|
11
11
|
});
|
|
@@ -2,7 +2,6 @@ import { GetQuoteRequest, GetQuoteResponse } from "../../types/api_req_res";
|
|
|
2
2
|
/**
|
|
3
3
|
* React hook to fetch the price or rate for a relay swap using Anyspend.
|
|
4
4
|
*
|
|
5
|
-
* @param isMainnet - Whether to use mainnet or testnet endpoints.
|
|
6
5
|
* @param req - The request object containing source/destination chain, token addresses, and amount/price.
|
|
7
6
|
* @remarks The query is enabled only if all required fields in `req` are present and the amount/price is non-zero.
|
|
8
7
|
*/
|
|
@@ -12,4 +11,4 @@ export type UseAnyspendQuoteResult = {
|
|
|
12
11
|
getAnyspendQuoteError: Error | null;
|
|
13
12
|
refetchAnyspendQuote: () => void;
|
|
14
13
|
};
|
|
15
|
-
export declare function useAnyspendQuote(
|
|
14
|
+
export declare function useAnyspendQuote(req: GetQuoteRequest): UseAnyspendQuoteResult;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useAnyspendQuote(
|
|
4
|
+
export function useAnyspendQuote(req) {
|
|
5
5
|
const { data, isLoading, refetch, error } = useQuery({
|
|
6
|
-
queryKey: ["useAnyspendQuote",
|
|
6
|
+
queryKey: ["useAnyspendQuote", JSON.stringify(req)],
|
|
7
7
|
queryFn: () => {
|
|
8
|
-
return anyspendService.getQuote(
|
|
8
|
+
return anyspendService.getQuote(req);
|
|
9
9
|
},
|
|
10
10
|
enabled: Boolean(req.srcChain &&
|
|
11
11
|
req.dstChain &&
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useAnyspendTokenList(
|
|
4
|
+
export function useAnyspendTokenList(chainId, query) {
|
|
5
5
|
const { data = [], isLoading, refetch, } = useQuery({
|
|
6
6
|
queryKey: ["getAnyspendTokenList", chainId, query],
|
|
7
|
-
queryFn: () => anyspendService.getTokenList(
|
|
7
|
+
queryFn: () => anyspendService.getTokenList(chainId, query),
|
|
8
8
|
enabled: true,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
|
-
export declare function useCoinbaseOnrampOptions(
|
|
2
|
+
export declare function useCoinbaseOnrampOptions(country?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
3
3
|
coinbaseOnrampOptions: {
|
|
4
4
|
paymentCurrencies: {
|
|
5
5
|
id?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useCoinbaseOnrampOptions(
|
|
4
|
+
export function useCoinbaseOnrampOptions(country, visitorData, isLoadingVisitorData) {
|
|
5
5
|
const { data, isLoading, error, refetch } = useQuery({
|
|
6
|
-
queryKey: ["getCoinbaseOnrampOptions",
|
|
7
|
-
queryFn: () => anyspendService.getCoinbaseOnrampOptions(
|
|
6
|
+
queryKey: ["getCoinbaseOnrampOptions", country, visitorData],
|
|
7
|
+
queryFn: () => anyspendService.getCoinbaseOnrampOptions(country, visitorData),
|
|
8
8
|
enabled: Boolean(country) && !isLoadingVisitorData,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { useCoinbaseOnrampOptions } from "./useCoinbaseOnrampOptions.js";
|
|
4
4
|
import { useGetGeo } from "./useGetGeo.js";
|
|
5
5
|
import { useStripeSupport } from "./useStripeSupport.js";
|
|
6
|
-
export function useGeoOnrampOptions(
|
|
6
|
+
export function useGeoOnrampOptions(srcFiatAmount) {
|
|
7
7
|
// Get fingerprint data
|
|
8
8
|
const { data: fpData, isLoading: isLoadingVisitorData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
9
9
|
const visitorData = fpData && {
|
|
@@ -12,8 +12,8 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
|
|
|
12
12
|
};
|
|
13
13
|
// Use existing hooks
|
|
14
14
|
const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
|
|
15
|
-
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(
|
|
16
|
-
const { stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(
|
|
15
|
+
const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(geoData?.country, visitorData);
|
|
16
|
+
const { stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(srcFiatAmount, visitorData);
|
|
17
17
|
// Calculate available payment methods based on the amount
|
|
18
18
|
const coinbaseAvailablePaymentMethods = useMemo(() => {
|
|
19
19
|
if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useStripeClientSecret(
|
|
1
|
+
export declare function useStripeClientSecret(paymentIntentId: string): {
|
|
2
2
|
clientSecret: string | null;
|
|
3
3
|
isLoadingStripeClientSecret: boolean;
|
|
4
4
|
stripeClientSecretError: Error | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
4
|
-
export function useStripeClientSecret(
|
|
4
|
+
export function useStripeClientSecret(paymentIntentId) {
|
|
5
5
|
const { data, isLoading, error, refetch } = useQuery({
|
|
6
|
-
queryKey: ["stripeClientSecret",
|
|
7
|
-
queryFn: () => anyspendService.getStripeClientSecret(
|
|
6
|
+
queryKey: ["stripeClientSecret", paymentIntentId],
|
|
7
|
+
queryFn: () => anyspendService.getStripeClientSecret(paymentIntentId),
|
|
8
8
|
});
|
|
9
9
|
return useMemo(() => ({
|
|
10
10
|
clientSecret: data || null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VisitorData } from "../../../anyspend/types/fingerprint";
|
|
2
|
-
export declare function useStripeSupport(
|
|
2
|
+
export declare function useStripeSupport(usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
|
|
3
3
|
stripeWeb2Support: {
|
|
4
4
|
isSupport: false;
|
|
5
5
|
} | {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
export function useStripeSupport(
|
|
4
|
+
export function useStripeSupport(usdAmount, visitorData, isLoadingVisitorData) {
|
|
5
5
|
const { data, isLoading, error, refetch } = useQuery({
|
|
6
|
-
queryKey: ["useStripeSupport",
|
|
7
|
-
queryFn: () => anyspendService.checkStripeSupport(
|
|
6
|
+
queryKey: ["useStripeSupport", usdAmount, visitorData?.requestId, visitorData?.visitorId],
|
|
7
|
+
queryFn: () => anyspendService.checkStripeSupport(usdAmount, visitorData),
|
|
8
8
|
enabled: !isLoadingVisitorData,
|
|
9
9
|
});
|
|
10
10
|
return useMemo(() => ({
|
|
@@ -3,11 +3,10 @@ import { components } from "../types/api";
|
|
|
3
3
|
import { GetCoinbaseOnrampOptionsResponse, GetOrderAndTxsResponse, GetOrderHistoryResponse, GetQuoteRequest, GetQuoteResponse } from "../types/api_req_res";
|
|
4
4
|
import { VisitorData } from "../types/fingerprint";
|
|
5
5
|
export declare const anyspendService: {
|
|
6
|
-
getTokenList: (
|
|
7
|
-
getToken: (
|
|
8
|
-
getQuote: (
|
|
9
|
-
createOrder: ({
|
|
10
|
-
isMainnet: boolean;
|
|
6
|
+
getTokenList: (chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
|
|
7
|
+
getToken: (chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
|
|
8
|
+
getQuote: (req: GetQuoteRequest) => Promise<GetQuoteResponse>;
|
|
9
|
+
createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }: {
|
|
11
10
|
recipientAddress: string;
|
|
12
11
|
type: string;
|
|
13
12
|
srcChain: number;
|
|
@@ -27,12 +26,12 @@ export declare const anyspendService: {
|
|
|
27
26
|
data: components["schemas"]["Order"];
|
|
28
27
|
statusCode: number;
|
|
29
28
|
}>;
|
|
30
|
-
getOrderAndTransactions: (
|
|
31
|
-
getOrderHistory: (
|
|
32
|
-
getCoinbaseOnrampOptions: (
|
|
33
|
-
checkStripeSupport: (
|
|
29
|
+
getOrderAndTransactions: (orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
|
|
30
|
+
getOrderHistory: (creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
|
|
31
|
+
getCoinbaseOnrampOptions: (country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
32
|
+
checkStripeSupport: (usdAmount?: string, visitorData?: VisitorData) => Promise<{
|
|
34
33
|
stripeOnramp: boolean;
|
|
35
34
|
stripeWeb2: components["schemas"]["StripeWeb2Support"];
|
|
36
35
|
}>;
|
|
37
|
-
getStripeClientSecret: (
|
|
36
|
+
getStripeClientSecret: (paymentIntentId: string) => Promise<string | null>;
|
|
38
37
|
};
|