@b3dotfun/sdk 0.0.40 → 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/react/components/AnySpend.d.ts +11 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +17 -4
- 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 +33 -11
- 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 +6 -3
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
- 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.js +8 -11
- 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/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/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 +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +41 -9
- 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/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/react/components/AnySpend.d.ts +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +17 -4
- 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 +33 -11
- 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 +6 -3
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
- 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.js +8 -11
- 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/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/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 +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +42 -9
- 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/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/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/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- 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/PointsBadge.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -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 +4 -3
- 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 +6 -5
- package/src/anyspend/react/components/AnySpend.tsx +37 -1
- 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 +63 -13
- 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 +22 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -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 +10 -14
- 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/PointsBadge.tsx +20 -0
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
- 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 +55 -15
- 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/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
|
@@ -42,12 +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
51
|
import { OrderToken } from "./common/OrderToken";
|
|
52
|
+
import { PointsBadge } from "./common/PointsBadge";
|
|
53
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
51
54
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
52
55
|
|
|
53
56
|
enum PanelView {
|
|
@@ -58,6 +61,7 @@ enum PanelView {
|
|
|
58
61
|
RECIPIENT_SELECTION,
|
|
59
62
|
CRYPTO_PAYMENT_METHOD,
|
|
60
63
|
FIAT_PAYMENT_METHOD,
|
|
64
|
+
POINTS_DETAIL,
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
function generateGetRelayQuoteRequest({
|
|
@@ -66,6 +70,7 @@ function generateGetRelayQuoteRequest({
|
|
|
66
70
|
srcToken,
|
|
67
71
|
dstChainId,
|
|
68
72
|
dstToken,
|
|
73
|
+
recipientAddress,
|
|
69
74
|
dstAmount,
|
|
70
75
|
contractAddress,
|
|
71
76
|
tokenId,
|
|
@@ -78,6 +83,7 @@ function generateGetRelayQuoteRequest({
|
|
|
78
83
|
srcToken: components["schemas"]["Token"];
|
|
79
84
|
dstChainId: number;
|
|
80
85
|
dstToken: components["schemas"]["Token"];
|
|
86
|
+
recipientAddress: string | undefined;
|
|
81
87
|
dstAmount: string;
|
|
82
88
|
contractAddress: string;
|
|
83
89
|
tokenId?: number | null;
|
|
@@ -94,6 +100,7 @@ function generateGetRelayQuoteRequest({
|
|
|
94
100
|
srcTokenAddress: srcToken.address,
|
|
95
101
|
dstChain: dstChainId,
|
|
96
102
|
dstTokenAddress: dstToken.address,
|
|
103
|
+
recipientAddress,
|
|
97
104
|
price: dstAmount,
|
|
98
105
|
contractAddress: contractAddress,
|
|
99
106
|
tokenId: tokenId,
|
|
@@ -107,6 +114,7 @@ function generateGetRelayQuoteRequest({
|
|
|
107
114
|
srcTokenAddress: srcToken.address,
|
|
108
115
|
dstChain: dstChainId,
|
|
109
116
|
dstTokenAddress: dstToken.address,
|
|
117
|
+
recipientAddress,
|
|
110
118
|
price: dstAmount,
|
|
111
119
|
contractAddress: contractAddress,
|
|
112
120
|
};
|
|
@@ -118,6 +126,7 @@ function generateGetRelayQuoteRequest({
|
|
|
118
126
|
srcTokenAddress: srcToken.address,
|
|
119
127
|
dstChain: dstChainId,
|
|
120
128
|
dstTokenAddress: dstToken.address,
|
|
129
|
+
recipientAddress,
|
|
121
130
|
fundAmount: dstAmount,
|
|
122
131
|
contractAddress: contractAddress,
|
|
123
132
|
};
|
|
@@ -129,6 +138,7 @@ function generateGetRelayQuoteRequest({
|
|
|
129
138
|
srcTokenAddress: srcToken.address,
|
|
130
139
|
dstChain: dstChainId,
|
|
131
140
|
dstTokenAddress: dstToken.address,
|
|
141
|
+
recipientAddress,
|
|
132
142
|
payload: {
|
|
133
143
|
amount: dstAmount,
|
|
134
144
|
data: encodedData,
|
|
@@ -165,6 +175,7 @@ export function AnySpendCustom(props: {
|
|
|
165
175
|
}) => React.JSX.Element;
|
|
166
176
|
onSuccess?: (txHash?: string) => void;
|
|
167
177
|
showRecipient?: boolean;
|
|
178
|
+
onShowPointsDetail?: () => void;
|
|
168
179
|
}) {
|
|
169
180
|
const fingerprintConfig = getFingerprintConfig();
|
|
170
181
|
|
|
@@ -191,6 +202,7 @@ function AnySpendCustomInner({
|
|
|
191
202
|
header,
|
|
192
203
|
onSuccess,
|
|
193
204
|
showRecipient = true,
|
|
205
|
+
onShowPointsDetail,
|
|
194
206
|
}: {
|
|
195
207
|
loadOrder?: string;
|
|
196
208
|
mode?: "modal" | "page";
|
|
@@ -213,8 +225,10 @@ function AnySpendCustomInner({
|
|
|
213
225
|
}) => React.JSX.Element;
|
|
214
226
|
onSuccess?: (txHash?: string) => void;
|
|
215
227
|
showRecipient?: boolean;
|
|
228
|
+
onShowPointsDetail?: () => void;
|
|
216
229
|
}) {
|
|
217
230
|
const hasMounted = useHasMounted();
|
|
231
|
+
const featureFlags = useFeatureFlags();
|
|
218
232
|
|
|
219
233
|
const searchParams = useSearchParamsSSR();
|
|
220
234
|
const router = useRouter();
|
|
@@ -312,10 +326,11 @@ function AnySpendCustomInner({
|
|
|
312
326
|
srcToken: activeTab === "fiat" ? USDC_BASE : srcToken,
|
|
313
327
|
dstChainId: dstChainId,
|
|
314
328
|
dstToken: dstToken,
|
|
329
|
+
recipientAddress,
|
|
315
330
|
dstAmount: dstAmount,
|
|
316
331
|
contractAddress: contractAddress,
|
|
317
|
-
tokenId:
|
|
318
|
-
contractType:
|
|
332
|
+
tokenId: orderType === "mint_nft" ? metadata?.nftContract?.tokenId : undefined,
|
|
333
|
+
contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
|
|
319
334
|
encodedData: encodedData,
|
|
320
335
|
spenderAddress: spenderAddress,
|
|
321
336
|
});
|
|
@@ -328,8 +343,8 @@ function AnySpendCustomInner({
|
|
|
328
343
|
encodedData,
|
|
329
344
|
metadata?.nftContract?.tokenId,
|
|
330
345
|
metadata?.nftContract?.type,
|
|
331
|
-
metadata?.type,
|
|
332
346
|
orderType,
|
|
347
|
+
recipientAddress,
|
|
333
348
|
spenderAddress,
|
|
334
349
|
srcChainId,
|
|
335
350
|
srcToken,
|
|
@@ -426,7 +441,7 @@ function AnySpendCustomInner({
|
|
|
426
441
|
recipientAddress,
|
|
427
442
|
creatorAddress: currentWallet?.wallet?.address,
|
|
428
443
|
nft:
|
|
429
|
-
|
|
444
|
+
orderType === "mint_nft"
|
|
430
445
|
? metadata.nftContract.type === "erc1155"
|
|
431
446
|
? {
|
|
432
447
|
type: "erc1155",
|
|
@@ -448,7 +463,7 @@ function AnySpendCustomInner({
|
|
|
448
463
|
}
|
|
449
464
|
: undefined,
|
|
450
465
|
tournament:
|
|
451
|
-
|
|
466
|
+
orderType === "join_tournament" || orderType === "fund_tournament"
|
|
452
467
|
? {
|
|
453
468
|
...metadata.tournament,
|
|
454
469
|
contractAddress: contractAddress,
|
|
@@ -457,13 +472,12 @@ function AnySpendCustomInner({
|
|
|
457
472
|
: undefined,
|
|
458
473
|
// only populate payload for custom tx
|
|
459
474
|
payload:
|
|
460
|
-
|
|
475
|
+
orderType === "custom"
|
|
461
476
|
? {
|
|
462
477
|
amount: dstAmount,
|
|
463
478
|
data: encodedData,
|
|
464
479
|
spenderAddress: spenderAddress,
|
|
465
480
|
to: contractAddress,
|
|
466
|
-
action: metadata.action,
|
|
467
481
|
}
|
|
468
482
|
: undefined,
|
|
469
483
|
} as CreateOrderParams;
|
|
@@ -749,6 +763,23 @@ function AnySpendCustomInner({
|
|
|
749
763
|
</div>
|
|
750
764
|
);
|
|
751
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
|
+
|
|
752
783
|
// Confirm order view.
|
|
753
784
|
const confirmOrderView = (
|
|
754
785
|
<div className={"relative mx-auto flex w-full flex-col items-center"}>
|
|
@@ -917,9 +948,12 @@ function AnySpendCustomInner({
|
|
|
917
948
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
918
949
|
className="relative flex w-full items-center justify-between"
|
|
919
950
|
>
|
|
920
|
-
<
|
|
921
|
-
|
|
922
|
-
|
|
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>
|
|
923
957
|
<span className="text-as-primary font-semibold">
|
|
924
958
|
{formattedSrcAmount || "--"} {srcToken.symbol}
|
|
925
959
|
</span>
|
|
@@ -1040,9 +1074,12 @@ function AnySpendCustomInner({
|
|
|
1040
1074
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
1041
1075
|
className="relative flex w-full items-center justify-between"
|
|
1042
1076
|
>
|
|
1043
|
-
<
|
|
1044
|
-
|
|
1045
|
-
|
|
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>
|
|
1046
1083
|
<span className="text-as-primary text-xl font-semibold">${srcFiatAmount || "0.00"}</span>
|
|
1047
1084
|
</motion.div>
|
|
1048
1085
|
</div>
|
|
@@ -1153,6 +1190,16 @@ function AnySpendCustomInner({
|
|
|
1153
1190
|
</div>
|
|
1154
1191
|
);
|
|
1155
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
|
+
|
|
1156
1203
|
// Return the TransitionPanel with all views
|
|
1157
1204
|
return (
|
|
1158
1205
|
<StyleRoot>
|
|
@@ -1196,6 +1243,9 @@ function AnySpendCustomInner({
|
|
|
1196
1243
|
<div key="fiat-payment-method-view" className="w-full">
|
|
1197
1244
|
{fiatPaymentMethodView}
|
|
1198
1245
|
</div>,
|
|
1246
|
+
<div key="points-detail-view" className="w-full">
|
|
1247
|
+
{pointsDetailView}
|
|
1248
|
+
</div>,
|
|
1199
1249
|
]}
|
|
1200
1250
|
</TransitionPanel>
|
|
1201
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,6 +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";
|
|
18
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
17
19
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
18
20
|
|
|
19
21
|
import { ArrowDown } from "lucide-react";
|
|
@@ -35,6 +37,11 @@ export interface AnySpendDepositHypeProps {
|
|
|
35
37
|
sourceTokenChainId?: number;
|
|
36
38
|
onSuccess?: () => void;
|
|
37
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;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
|
|
@@ -56,6 +63,7 @@ function AnySpendDepositHypeInner({
|
|
|
56
63
|
sourceTokenChainId,
|
|
57
64
|
onSuccess,
|
|
58
65
|
mainFooter,
|
|
66
|
+
onTokenSelect,
|
|
59
67
|
}: AnySpendDepositHypeProps) {
|
|
60
68
|
// Use shared flow hook
|
|
61
69
|
const {
|
|
@@ -201,6 +209,7 @@ function AnySpendDepositHypeInner({
|
|
|
201
209
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
202
210
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
203
211
|
anyspendQuote={anyspendQuote}
|
|
212
|
+
onTokenSelect={onTokenSelect}
|
|
204
213
|
/>
|
|
205
214
|
) : (
|
|
206
215
|
<motion.div
|
|
@@ -223,6 +232,8 @@ function AnySpendDepositHypeInner({
|
|
|
223
232
|
onDestinationChainChange={() => {}}
|
|
224
233
|
fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
|
|
225
234
|
recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
|
|
235
|
+
anyspendQuote={anyspendQuote}
|
|
236
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
226
237
|
/>
|
|
227
238
|
</motion.div>
|
|
228
239
|
)}
|
|
@@ -263,6 +274,7 @@ function AnySpendDepositHypeInner({
|
|
|
263
274
|
setSrcAmount(value);
|
|
264
275
|
}}
|
|
265
276
|
anyspendQuote={anyspendQuote}
|
|
277
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
266
278
|
/>
|
|
267
279
|
)}
|
|
268
280
|
</div>
|
|
@@ -448,6 +460,13 @@ function AnySpendDepositHypeInner({
|
|
|
448
460
|
/>
|
|
449
461
|
);
|
|
450
462
|
|
|
463
|
+
const pointsDetailView = (
|
|
464
|
+
<PointsDetailPanel
|
|
465
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
466
|
+
onBack={() => setActivePanel(PanelView.MAIN)}
|
|
467
|
+
/>
|
|
468
|
+
);
|
|
469
|
+
|
|
451
470
|
// If showing token selection, render with panel transitions
|
|
452
471
|
return (
|
|
453
472
|
<StyleRoot>
|
|
@@ -497,6 +516,9 @@ function AnySpendDepositHypeInner({
|
|
|
497
516
|
<div key="loading-view" className={cn(mode === "page" && "p-6")}>
|
|
498
517
|
{loadingView}
|
|
499
518
|
</div>,
|
|
519
|
+
<div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
|
|
520
|
+
{pointsDetailView}
|
|
521
|
+
</div>,
|
|
500
522
|
]}
|
|
501
523
|
</TransitionPanel>
|
|
502
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,12 +2,11 @@
|
|
|
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";
|
|
13
12
|
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
@@ -41,7 +40,11 @@ export default function ConnectWalletPayment({
|
|
|
41
40
|
}: ConnectWalletPaymentProps) {
|
|
42
41
|
const profile = useProfile({ address: order.recipientAddress });
|
|
43
42
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
44
|
-
const {
|
|
43
|
+
const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
|
|
44
|
+
const connectedEvmAddress =
|
|
45
|
+
cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
46
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
47
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
45
48
|
|
|
46
49
|
const srcToken = order.metadata.srcToken;
|
|
47
50
|
const dstToken = order.metadata.dstToken;
|
|
@@ -97,7 +100,7 @@ export default function ConnectWalletPayment({
|
|
|
97
100
|
Connected to:{" "}
|
|
98
101
|
{order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
99
102
|
? centerTruncate(phantomWalletAddress, 6)
|
|
100
|
-
: centerTruncate(
|
|
103
|
+
: centerTruncate(connectedEvmAddress || "")}
|
|
101
104
|
</span>
|
|
102
105
|
|
|
103
106
|
<PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
|
|
@@ -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">
|