@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +11 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +22 -10
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -20
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -8
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +7 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -23
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +10 -6
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +18 -8
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/providers/index.js +3 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
- package/dist/cjs/anyspend/services/anyspend.js +2 -0
- package/dist/cjs/anyspend/types/api.d.ts +51 -1
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/orderPayload.js +3 -0
- package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
- package/dist/cjs/bondkit/bondkitToken.js +268 -2
- package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/cjs/bondkit/components/TradingView.js +3 -4
- package/dist/cjs/bondkit/config.d.ts +1 -1
- package/dist/cjs/bondkit/config.js +5 -2
- package/dist/cjs/bondkit/constants.d.ts +4 -0
- package/dist/cjs/bondkit/constants.js +6 -1
- package/dist/cjs/bondkit/index.d.ts +1 -0
- package/dist/cjs/bondkit/index.js +4 -1
- package/dist/cjs/bondkit/swapService.d.ts +43 -0
- package/dist/cjs/bondkit/swapService.js +376 -0
- package/dist/cjs/bondkit/types.d.ts +10 -4
- package/dist/cjs/bondkit/types.js +4 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +27 -28
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAccountAssets.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -3
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +32 -0
- package/dist/cjs/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/cjs/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +7 -1
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +28 -24
- package/dist/cjs/shared/utils/fetchBalances.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 +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +23 -11
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +41 -20
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -9
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +8 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +25 -24
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +10 -6
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +18 -8
- package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
- package/dist/esm/anyspend/react/providers/index.js +1 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
- package/dist/esm/anyspend/services/anyspend.js +2 -0
- package/dist/esm/anyspend/types/api.d.ts +51 -1
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/orderPayload.js +3 -0
- package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
- package/dist/esm/bondkit/bondkitToken.js +268 -2
- package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/esm/bondkit/components/TradingView.js +3 -4
- package/dist/esm/bondkit/config.d.ts +1 -1
- package/dist/esm/bondkit/config.js +5 -2
- package/dist/esm/bondkit/constants.d.ts +4 -0
- package/dist/esm/bondkit/constants.js +5 -0
- package/dist/esm/bondkit/index.d.ts +1 -0
- package/dist/esm/bondkit/index.js +2 -0
- package/dist/esm/bondkit/swapService.d.ts +43 -0
- package/dist/esm/bondkit/swapService.js +372 -0
- package/dist/esm/bondkit/types.d.ts +10 -4
- package/dist/esm/bondkit/types.js +4 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +27 -28
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAccountAssets.js +2 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -3
- package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/esm/global-account/react/hooks/useGlobalAccount.js +29 -0
- package/dist/esm/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -1
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +29 -25
- package/dist/esm/shared/utils/fetchBalances.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 +11 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/types/anyspend/react/providers/index.d.ts +1 -0
- package/dist/types/anyspend/services/anyspend.d.ts +1 -1
- package/dist/types/anyspend/types/api.d.ts +51 -1
- package/dist/types/bondkit/bondkitToken.d.ts +37 -2
- package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/types/bondkit/config.d.ts +1 -1
- package/dist/types/bondkit/constants.d.ts +4 -0
- package/dist/types/bondkit/index.d.ts +1 -0
- package/dist/types/bondkit/swapService.d.ts +43 -0
- package/dist/types/bondkit/types.d.ts +10 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/types/shared/utils/fetchBalances.d.ts +1 -1
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +52 -18
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +82 -34
- package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +12 -4
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +61 -45
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -47
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
- package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +18 -8
- package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +1 -1
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/services/anyspend.ts +3 -1
- package/src/anyspend/types/api.ts +51 -1
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/orderPayload.ts +3 -0
- package/src/bondkit/bondkitToken.ts +323 -3
- package/src/bondkit/bondkitTokenFactory.ts +2 -2
- package/src/bondkit/components/TradingView.tsx +3 -5
- package/src/bondkit/config.ts +5 -2
- package/src/bondkit/constants.ts +7 -0
- package/src/bondkit/index.ts +3 -0
- package/src/bondkit/swapService.ts +464 -0
- package/src/bondkit/types.ts +12 -5
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +31 -32
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAccountAssets.ts +4 -3
- package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
- package/src/global-account/react/hooks/useAuthentication.ts +2 -3
- package/src/global-account/react/hooks/useGlobalAccount.tsx +36 -0
- package/src/global-account/react/hooks/useOneBalance.tsx +1 -1
- package/src/global-account/react/hooks/useQueryB3.ts +22 -15
- package/src/global-account/react/hooks/useQueryBSMNT.ts +22 -15
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -1
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +30 -26
- package/src/shared/utils/fetchBalances.ts +1 -1
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -42,13 +42,15 @@ import { motion } from "motion/react";
|
|
|
42
42
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
43
43
|
import { toast } from "sonner";
|
|
44
44
|
import { base } from "viem/chains";
|
|
45
|
+
import { useFeatureFlags } from "../contexts/FeatureFlagsContext";
|
|
45
46
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
46
47
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
47
48
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
48
49
|
import { OrderDetails } from "./common/OrderDetails";
|
|
49
50
|
import { OrderHistory } from "./common/OrderHistory";
|
|
50
|
-
import { OrderStatus as OrderStatusDisplay } from "./common/OrderStatus";
|
|
51
51
|
import { OrderToken } from "./common/OrderToken";
|
|
52
|
+
import { PointsBadge } from "./common/PointsBadge";
|
|
53
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
52
54
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
53
55
|
|
|
54
56
|
enum PanelView {
|
|
@@ -59,6 +61,7 @@ enum PanelView {
|
|
|
59
61
|
RECIPIENT_SELECTION,
|
|
60
62
|
CRYPTO_PAYMENT_METHOD,
|
|
61
63
|
FIAT_PAYMENT_METHOD,
|
|
64
|
+
POINTS_DETAIL,
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
function generateGetRelayQuoteRequest({
|
|
@@ -67,6 +70,7 @@ function generateGetRelayQuoteRequest({
|
|
|
67
70
|
srcToken,
|
|
68
71
|
dstChainId,
|
|
69
72
|
dstToken,
|
|
73
|
+
recipientAddress,
|
|
70
74
|
dstAmount,
|
|
71
75
|
contractAddress,
|
|
72
76
|
tokenId,
|
|
@@ -79,6 +83,7 @@ function generateGetRelayQuoteRequest({
|
|
|
79
83
|
srcToken: components["schemas"]["Token"];
|
|
80
84
|
dstChainId: number;
|
|
81
85
|
dstToken: components["schemas"]["Token"];
|
|
86
|
+
recipientAddress: string | undefined;
|
|
82
87
|
dstAmount: string;
|
|
83
88
|
contractAddress: string;
|
|
84
89
|
tokenId?: number | null;
|
|
@@ -95,6 +100,7 @@ function generateGetRelayQuoteRequest({
|
|
|
95
100
|
srcTokenAddress: srcToken.address,
|
|
96
101
|
dstChain: dstChainId,
|
|
97
102
|
dstTokenAddress: dstToken.address,
|
|
103
|
+
recipientAddress,
|
|
98
104
|
price: dstAmount,
|
|
99
105
|
contractAddress: contractAddress,
|
|
100
106
|
tokenId: tokenId,
|
|
@@ -108,6 +114,7 @@ function generateGetRelayQuoteRequest({
|
|
|
108
114
|
srcTokenAddress: srcToken.address,
|
|
109
115
|
dstChain: dstChainId,
|
|
110
116
|
dstTokenAddress: dstToken.address,
|
|
117
|
+
recipientAddress,
|
|
111
118
|
price: dstAmount,
|
|
112
119
|
contractAddress: contractAddress,
|
|
113
120
|
};
|
|
@@ -119,6 +126,7 @@ function generateGetRelayQuoteRequest({
|
|
|
119
126
|
srcTokenAddress: srcToken.address,
|
|
120
127
|
dstChain: dstChainId,
|
|
121
128
|
dstTokenAddress: dstToken.address,
|
|
129
|
+
recipientAddress,
|
|
122
130
|
fundAmount: dstAmount,
|
|
123
131
|
contractAddress: contractAddress,
|
|
124
132
|
};
|
|
@@ -130,6 +138,7 @@ function generateGetRelayQuoteRequest({
|
|
|
130
138
|
srcTokenAddress: srcToken.address,
|
|
131
139
|
dstChain: dstChainId,
|
|
132
140
|
dstTokenAddress: dstToken.address,
|
|
141
|
+
recipientAddress,
|
|
133
142
|
payload: {
|
|
134
143
|
amount: dstAmount,
|
|
135
144
|
data: encodedData,
|
|
@@ -166,6 +175,7 @@ export function AnySpendCustom(props: {
|
|
|
166
175
|
}) => React.JSX.Element;
|
|
167
176
|
onSuccess?: (txHash?: string) => void;
|
|
168
177
|
showRecipient?: boolean;
|
|
178
|
+
onShowPointsDetail?: () => void;
|
|
169
179
|
}) {
|
|
170
180
|
const fingerprintConfig = getFingerprintConfig();
|
|
171
181
|
|
|
@@ -192,6 +202,7 @@ function AnySpendCustomInner({
|
|
|
192
202
|
header,
|
|
193
203
|
onSuccess,
|
|
194
204
|
showRecipient = true,
|
|
205
|
+
onShowPointsDetail,
|
|
195
206
|
}: {
|
|
196
207
|
loadOrder?: string;
|
|
197
208
|
mode?: "modal" | "page";
|
|
@@ -214,8 +225,10 @@ function AnySpendCustomInner({
|
|
|
214
225
|
}) => React.JSX.Element;
|
|
215
226
|
onSuccess?: (txHash?: string) => void;
|
|
216
227
|
showRecipient?: boolean;
|
|
228
|
+
onShowPointsDetail?: () => void;
|
|
217
229
|
}) {
|
|
218
230
|
const hasMounted = useHasMounted();
|
|
231
|
+
const featureFlags = useFeatureFlags();
|
|
219
232
|
|
|
220
233
|
const searchParams = useSearchParamsSSR();
|
|
221
234
|
const router = useRouter();
|
|
@@ -313,10 +326,11 @@ function AnySpendCustomInner({
|
|
|
313
326
|
srcToken: activeTab === "fiat" ? USDC_BASE : srcToken,
|
|
314
327
|
dstChainId: dstChainId,
|
|
315
328
|
dstToken: dstToken,
|
|
329
|
+
recipientAddress,
|
|
316
330
|
dstAmount: dstAmount,
|
|
317
331
|
contractAddress: contractAddress,
|
|
318
|
-
tokenId:
|
|
319
|
-
contractType:
|
|
332
|
+
tokenId: orderType === "mint_nft" ? metadata?.nftContract?.tokenId : undefined,
|
|
333
|
+
contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
|
|
320
334
|
encodedData: encodedData,
|
|
321
335
|
spenderAddress: spenderAddress,
|
|
322
336
|
});
|
|
@@ -329,8 +343,8 @@ function AnySpendCustomInner({
|
|
|
329
343
|
encodedData,
|
|
330
344
|
metadata?.nftContract?.tokenId,
|
|
331
345
|
metadata?.nftContract?.type,
|
|
332
|
-
metadata?.type,
|
|
333
346
|
orderType,
|
|
347
|
+
recipientAddress,
|
|
334
348
|
spenderAddress,
|
|
335
349
|
srcChainId,
|
|
336
350
|
srcToken,
|
|
@@ -427,7 +441,7 @@ function AnySpendCustomInner({
|
|
|
427
441
|
recipientAddress,
|
|
428
442
|
creatorAddress: currentWallet?.wallet?.address,
|
|
429
443
|
nft:
|
|
430
|
-
|
|
444
|
+
orderType === "mint_nft"
|
|
431
445
|
? metadata.nftContract.type === "erc1155"
|
|
432
446
|
? {
|
|
433
447
|
type: "erc1155",
|
|
@@ -449,7 +463,7 @@ function AnySpendCustomInner({
|
|
|
449
463
|
}
|
|
450
464
|
: undefined,
|
|
451
465
|
tournament:
|
|
452
|
-
|
|
466
|
+
orderType === "join_tournament" || orderType === "fund_tournament"
|
|
453
467
|
? {
|
|
454
468
|
...metadata.tournament,
|
|
455
469
|
contractAddress: contractAddress,
|
|
@@ -458,13 +472,12 @@ function AnySpendCustomInner({
|
|
|
458
472
|
: undefined,
|
|
459
473
|
// only populate payload for custom tx
|
|
460
474
|
payload:
|
|
461
|
-
|
|
475
|
+
orderType === "custom"
|
|
462
476
|
? {
|
|
463
477
|
amount: dstAmount,
|
|
464
478
|
data: encodedData,
|
|
465
479
|
spenderAddress: spenderAddress,
|
|
466
480
|
to: contractAddress,
|
|
467
|
-
action: metadata.action,
|
|
468
481
|
}
|
|
469
482
|
: undefined,
|
|
470
483
|
} as CreateOrderParams;
|
|
@@ -648,26 +661,25 @@ function AnySpendCustomInner({
|
|
|
648
661
|
)}
|
|
649
662
|
>
|
|
650
663
|
{oat && (
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
</>
|
|
664
|
+
<OrderDetails
|
|
665
|
+
mode={mode}
|
|
666
|
+
order={oat.data.order}
|
|
667
|
+
depositTxs={oat.data.depositTxs}
|
|
668
|
+
relayTxs={oat.data.relayTxs}
|
|
669
|
+
executeTx={oat.data.executeTx}
|
|
670
|
+
refundTxs={oat.data.refundTxs}
|
|
671
|
+
cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
672
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
673
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
674
|
+
onBack={() => {
|
|
675
|
+
setOrderId(undefined);
|
|
676
|
+
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
677
|
+
// Remove orderId from URL when canceling
|
|
678
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
679
|
+
params.delete("orderId");
|
|
680
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
681
|
+
}}
|
|
682
|
+
/>
|
|
671
683
|
)}
|
|
672
684
|
{mode === "page" && <div className="h-12" />}
|
|
673
685
|
</div>
|
|
@@ -751,6 +763,23 @@ function AnySpendCustomInner({
|
|
|
751
763
|
</div>
|
|
752
764
|
);
|
|
753
765
|
|
|
766
|
+
// Render points badge if conditions are met
|
|
767
|
+
const renderPointsBadge = () => {
|
|
768
|
+
if (featureFlags.showPoints && anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
|
|
769
|
+
return (
|
|
770
|
+
<PointsBadge
|
|
771
|
+
pointsAmount={anyspendQuote.data.pointsAmount}
|
|
772
|
+
pointsMultiplier={anyspendQuote.data.pointsMultiplier}
|
|
773
|
+
onClick={() => {
|
|
774
|
+
onShowPointsDetail?.();
|
|
775
|
+
setActivePanel(PanelView.POINTS_DETAIL);
|
|
776
|
+
}}
|
|
777
|
+
/>
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
return null;
|
|
781
|
+
};
|
|
782
|
+
|
|
754
783
|
// Confirm order view.
|
|
755
784
|
const confirmOrderView = (
|
|
756
785
|
<div className={"relative mx-auto flex w-full flex-col items-center"}>
|
|
@@ -919,9 +948,12 @@ function AnySpendCustomInner({
|
|
|
919
948
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
920
949
|
className="relative flex w-full items-center justify-between"
|
|
921
950
|
>
|
|
922
|
-
<
|
|
923
|
-
|
|
924
|
-
|
|
951
|
+
<div className="flex items-center gap-2">
|
|
952
|
+
<span className="text-as-tertiarry text-sm">
|
|
953
|
+
Total <span className="text-as-tertiarry">(with fee)</span>
|
|
954
|
+
</span>
|
|
955
|
+
{renderPointsBadge()}
|
|
956
|
+
</div>
|
|
925
957
|
<span className="text-as-primary font-semibold">
|
|
926
958
|
{formattedSrcAmount || "--"} {srcToken.symbol}
|
|
927
959
|
</span>
|
|
@@ -1042,9 +1074,12 @@ function AnySpendCustomInner({
|
|
|
1042
1074
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
1043
1075
|
className="relative flex w-full items-center justify-between"
|
|
1044
1076
|
>
|
|
1045
|
-
<
|
|
1046
|
-
|
|
1047
|
-
|
|
1077
|
+
<div className="flex items-center gap-2">
|
|
1078
|
+
<span className="text-as-tertiarry text-sm">
|
|
1079
|
+
Total <span className="text-as-tertiarry">(USD)</span>
|
|
1080
|
+
</span>
|
|
1081
|
+
{renderPointsBadge()}
|
|
1082
|
+
</div>
|
|
1048
1083
|
<span className="text-as-primary text-xl font-semibold">${srcFiatAmount || "0.00"}</span>
|
|
1049
1084
|
</motion.div>
|
|
1050
1085
|
</div>
|
|
@@ -1155,6 +1190,16 @@ function AnySpendCustomInner({
|
|
|
1155
1190
|
</div>
|
|
1156
1191
|
);
|
|
1157
1192
|
|
|
1193
|
+
// Points detail view
|
|
1194
|
+
const pointsDetailView = (
|
|
1195
|
+
<div className={cn("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4")}>
|
|
1196
|
+
<PointsDetailPanel
|
|
1197
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
1198
|
+
onBack={() => setActivePanel(PanelView.CONFIRM_ORDER)}
|
|
1199
|
+
/>
|
|
1200
|
+
</div>
|
|
1201
|
+
);
|
|
1202
|
+
|
|
1158
1203
|
// Return the TransitionPanel with all views
|
|
1159
1204
|
return (
|
|
1160
1205
|
<StyleRoot>
|
|
@@ -1198,6 +1243,9 @@ function AnySpendCustomInner({
|
|
|
1198
1243
|
<div key="fiat-payment-method-view" className="w-full">
|
|
1199
1244
|
{fiatPaymentMethodView}
|
|
1200
1245
|
</div>,
|
|
1246
|
+
<div key="points-detail-view" className="w-full">
|
|
1247
|
+
{pointsDetailView}
|
|
1248
|
+
</div>,
|
|
1201
1249
|
]}
|
|
1202
1250
|
</TransitionPanel>
|
|
1203
1251
|
</StyleRoot>
|
|
@@ -36,12 +36,14 @@ export function AnySpendNFT({
|
|
|
36
36
|
recipientAddress,
|
|
37
37
|
nftContract,
|
|
38
38
|
onSuccess,
|
|
39
|
+
onShowPointsDetail,
|
|
39
40
|
}: {
|
|
40
41
|
loadOrder?: string;
|
|
41
42
|
mode?: "modal" | "page";
|
|
42
43
|
recipientAddress?: string;
|
|
43
44
|
nftContract: components["schemas"]["NftContract"];
|
|
44
45
|
onSuccess?: (txHash?: string) => void;
|
|
46
|
+
onShowPointsDetail?: () => void;
|
|
45
47
|
}) {
|
|
46
48
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
|
|
47
49
|
const [isLoadingFallback, setIsLoadingFallback] = useState(false);
|
|
@@ -164,6 +166,7 @@ export function AnySpendNFT({
|
|
|
164
166
|
}}
|
|
165
167
|
header={header}
|
|
166
168
|
onSuccess={onSuccess}
|
|
169
|
+
onShowPointsDetail={onShowPointsDetail}
|
|
167
170
|
/>
|
|
168
171
|
);
|
|
169
172
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
|
|
2
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
3
|
import { Button, ShinyButton, StyleRoot, TransitionPanel } from "@b3dotfun/sdk/global-account/react";
|
|
3
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
5
|
import invariant from "invariant";
|
|
@@ -14,7 +15,7 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
|
14
15
|
import { ErrorSection } from "./common/ErrorSection";
|
|
15
16
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
16
17
|
import { OrderDetails } from "./common/OrderDetails";
|
|
17
|
-
import {
|
|
18
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
18
19
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
19
20
|
|
|
20
21
|
import { ArrowDown } from "lucide-react";
|
|
@@ -36,6 +37,11 @@ export interface AnySpendDepositHypeProps {
|
|
|
36
37
|
sourceTokenChainId?: number;
|
|
37
38
|
onSuccess?: () => void;
|
|
38
39
|
mainFooter?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
42
|
+
* Useful for handling special cases like B3 token selection.
|
|
43
|
+
*/
|
|
44
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
|
|
@@ -57,6 +63,7 @@ function AnySpendDepositHypeInner({
|
|
|
57
63
|
sourceTokenChainId,
|
|
58
64
|
onSuccess,
|
|
59
65
|
mainFooter,
|
|
66
|
+
onTokenSelect,
|
|
60
67
|
}: AnySpendDepositHypeProps) {
|
|
61
68
|
// Use shared flow hook
|
|
62
69
|
const {
|
|
@@ -202,6 +209,7 @@ function AnySpendDepositHypeInner({
|
|
|
202
209
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
203
210
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
204
211
|
anyspendQuote={anyspendQuote}
|
|
212
|
+
onTokenSelect={onTokenSelect}
|
|
205
213
|
/>
|
|
206
214
|
) : (
|
|
207
215
|
<motion.div
|
|
@@ -224,6 +232,8 @@ function AnySpendDepositHypeInner({
|
|
|
224
232
|
onDestinationChainChange={() => {}}
|
|
225
233
|
fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
|
|
226
234
|
recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
|
|
235
|
+
anyspendQuote={anyspendQuote}
|
|
236
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
227
237
|
/>
|
|
228
238
|
</motion.div>
|
|
229
239
|
)}
|
|
@@ -264,6 +274,7 @@ function AnySpendDepositHypeInner({
|
|
|
264
274
|
setSrcAmount(value);
|
|
265
275
|
}}
|
|
266
276
|
anyspendQuote={anyspendQuote}
|
|
277
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
267
278
|
/>
|
|
268
279
|
)}
|
|
269
280
|
</div>
|
|
@@ -381,23 +392,22 @@ function AnySpendDepositHypeInner({
|
|
|
381
392
|
<div className={"mx-auto w-[460px] max-w-full"}>
|
|
382
393
|
<div className="relative flex flex-col gap-4">
|
|
383
394
|
{oat && (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
</>
|
|
395
|
+
<OrderDetails
|
|
396
|
+
mode={mode}
|
|
397
|
+
order={oat.data.order}
|
|
398
|
+
depositTxs={oat.data.depositTxs}
|
|
399
|
+
relayTxs={oat.data.relayTxs}
|
|
400
|
+
executeTx={oat.data.executeTx}
|
|
401
|
+
refundTxs={oat.data.refundTxs}
|
|
402
|
+
cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
403
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
404
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
405
|
+
onBack={() => {
|
|
406
|
+
setOrderId(undefined);
|
|
407
|
+
setActivePanel(PanelView.MAIN);
|
|
408
|
+
}}
|
|
409
|
+
disableUrlParamManagement
|
|
410
|
+
/>
|
|
401
411
|
)}
|
|
402
412
|
</div>
|
|
403
413
|
</div>
|
|
@@ -450,6 +460,13 @@ function AnySpendDepositHypeInner({
|
|
|
450
460
|
/>
|
|
451
461
|
);
|
|
452
462
|
|
|
463
|
+
const pointsDetailView = (
|
|
464
|
+
<PointsDetailPanel
|
|
465
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
466
|
+
onBack={() => setActivePanel(PanelView.MAIN)}
|
|
467
|
+
/>
|
|
468
|
+
);
|
|
469
|
+
|
|
453
470
|
// If showing token selection, render with panel transitions
|
|
454
471
|
return (
|
|
455
472
|
<StyleRoot>
|
|
@@ -499,6 +516,9 @@ function AnySpendDepositHypeInner({
|
|
|
499
516
|
<div key="loading-view" className={cn(mode === "page" && "p-6")}>
|
|
500
517
|
{loadingView}
|
|
501
518
|
</div>,
|
|
519
|
+
<div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
|
|
520
|
+
{pointsDetailView}
|
|
521
|
+
</div>,
|
|
502
522
|
]}
|
|
503
523
|
</TransitionPanel>
|
|
504
524
|
</div>
|
|
@@ -141,10 +141,9 @@ export function AnyspendSignatureMint({
|
|
|
141
141
|
dstChainId={signatureData.collection.chainId}
|
|
142
142
|
dstToken={dstToken}
|
|
143
143
|
dstAmount={price.toString()}
|
|
144
|
-
contractAddress={signatureData.collection.address
|
|
144
|
+
contractAddress={signatureData.collection.address || ""}
|
|
145
145
|
encodedData={encodedData}
|
|
146
146
|
metadata={{
|
|
147
|
-
type: "custom",
|
|
148
147
|
action: "Signature Mint",
|
|
149
148
|
}}
|
|
150
149
|
header={header}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
4
4
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
5
|
-
import { ShinyButton, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
5
|
+
import { ShinyButton, useAccountWallet, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import centerTruncate from "@b3dotfun/sdk/shared/utils/centerTruncate";
|
|
7
7
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
8
8
|
import { motion } from "framer-motion";
|
|
9
9
|
import { ChevronRight, Loader2 } from "lucide-react";
|
|
10
|
-
import { useAccount } from "wagmi";
|
|
11
10
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
12
11
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
12
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
13
13
|
|
|
14
14
|
type Tournament = components["schemas"]["Tournament"];
|
|
15
15
|
type NFT = components["schemas"]["NFT"];
|
|
@@ -24,6 +24,7 @@ interface ConnectWalletPaymentProps {
|
|
|
24
24
|
tournament?: Tournament;
|
|
25
25
|
nft?: NFT;
|
|
26
26
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
27
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export default function ConnectWalletPayment({
|
|
@@ -35,10 +36,15 @@ export default function ConnectWalletPayment({
|
|
|
35
36
|
tournament,
|
|
36
37
|
nft,
|
|
37
38
|
cryptoPaymentMethod,
|
|
39
|
+
onPaymentMethodChange,
|
|
38
40
|
}: ConnectWalletPaymentProps) {
|
|
39
41
|
const profile = useProfile({ address: order.recipientAddress });
|
|
40
42
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
41
|
-
const {
|
|
43
|
+
const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
|
|
44
|
+
const connectedEvmAddress =
|
|
45
|
+
cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
46
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
47
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
42
48
|
|
|
43
49
|
const srcToken = order.metadata.srcToken;
|
|
44
50
|
const dstToken = order.metadata.dstToken;
|
|
@@ -94,9 +100,11 @@ export default function ConnectWalletPayment({
|
|
|
94
100
|
Connected to:{" "}
|
|
95
101
|
{order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
96
102
|
? centerTruncate(phantomWalletAddress, 6)
|
|
97
|
-
: centerTruncate(
|
|
103
|
+
: centerTruncate(connectedEvmAddress || "")}
|
|
98
104
|
</span>
|
|
99
105
|
|
|
106
|
+
<PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
|
|
107
|
+
|
|
100
108
|
<div className="mt-4">
|
|
101
109
|
<OrderDetailsCollapsible
|
|
102
110
|
order={order}
|
|
@@ -5,7 +5,6 @@ import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
|
5
5
|
import { ChevronRight } from "lucide-react";
|
|
6
6
|
import { motion } from "motion/react";
|
|
7
7
|
import { useEffect, useRef } from "react";
|
|
8
|
-
import { useAccount } from "wagmi";
|
|
9
8
|
import { components } from "../../../types/api";
|
|
10
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
11
10
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
@@ -25,6 +24,8 @@ interface CryptoPaySectionProps {
|
|
|
25
24
|
onSelectCryptoPaymentMethod: () => void;
|
|
26
25
|
// Quote data
|
|
27
26
|
anyspendQuote?: any;
|
|
27
|
+
// Token selection callback
|
|
28
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export function CryptoPaySection({
|
|
@@ -38,16 +39,19 @@ export function CryptoPaySection({
|
|
|
38
39
|
selectedCryptoPaymentMethod,
|
|
39
40
|
onSelectCryptoPaymentMethod,
|
|
40
41
|
anyspendQuote,
|
|
42
|
+
onTokenSelect,
|
|
41
43
|
}: CryptoPaySectionProps) {
|
|
42
|
-
const {
|
|
43
|
-
const { data: profileData } = useProfile({ address: connectedAddress });
|
|
44
|
-
const connectedName = profileData?.displayName;
|
|
45
|
-
const { address: globalAddress } = useAccountWallet();
|
|
44
|
+
const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
|
|
46
45
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
47
46
|
|
|
48
47
|
// Determine which address to use based on payment method
|
|
49
48
|
const walletAddress =
|
|
50
|
-
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
49
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
50
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
51
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
52
|
+
|
|
53
|
+
const { data: profileData } = useProfile({ address: walletAddress });
|
|
54
|
+
const connectedName = profileData?.displayName;
|
|
51
55
|
|
|
52
56
|
// Add ref to track if we've applied metadata
|
|
53
57
|
const appliedSrcMetadataRef = useRef(false);
|
|
@@ -92,9 +96,9 @@ export function CryptoPaySection({
|
|
|
92
96
|
>
|
|
93
97
|
{selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
|
|
94
98
|
<>
|
|
95
|
-
{
|
|
99
|
+
{walletAddress ? (
|
|
96
100
|
<div className="flex items-center gap-1">
|
|
97
|
-
{connectedName ? formatUsername(connectedName) : shortenAddress(
|
|
101
|
+
{connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "")}
|
|
98
102
|
</div>
|
|
99
103
|
) : (
|
|
100
104
|
"Connect wallet"
|
|
@@ -131,6 +135,7 @@ export function CryptoPaySection({
|
|
|
131
135
|
setChainId={setSelectedSrcChainId}
|
|
132
136
|
token={selectedSrcToken}
|
|
133
137
|
setToken={setSelectedSrcToken}
|
|
138
|
+
onTokenSelect={onTokenSelect}
|
|
134
139
|
/>
|
|
135
140
|
<div className="flex items-center justify-between">
|
|
136
141
|
<div className="text-as-primary/50 flex h-5 items-center text-sm">
|