@b3dotfun/sdk 0.0.83 → 0.0.84-alpha.1
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 +1 -1
- package/dist/cjs/anyspend/constants/index.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +23 -9
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +28 -0
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -4
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -6
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +41 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +5 -8
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.js +133 -0
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/cjs/anyspend/types/chain.d.ts +10 -2
- package/dist/cjs/anyspend/types/chain.js +1 -0
- package/dist/cjs/anyspend/utils/address.d.ts +11 -0
- package/dist/cjs/anyspend/utils/address.js +15 -0
- package/dist/cjs/anyspend/utils/chain.d.ts +20 -1
- package/dist/cjs/anyspend/utils/chain.js +73 -4
- package/dist/cjs/anyspend/utils/token.d.ts +7 -0
- package/dist/cjs/anyspend/utils/token.js +26 -7
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/cjs/shared/utils/payment.utils.d.ts +1 -0
- package/dist/cjs/shared/utils/payment.utils.js +9 -0
- package/dist/esm/anyspend/constants/index.d.ts +1 -1
- package/dist/esm/anyspend/constants/index.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +24 -10
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +25 -0
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -5
- package/dist/esm/anyspend/react/components/common/OrderToken.js +3 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -4
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +9 -3
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +3 -4
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +6 -9
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.js +127 -0
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/esm/anyspend/types/chain.d.ts +10 -2
- package/dist/esm/anyspend/types/chain.js +1 -0
- package/dist/esm/anyspend/utils/address.d.ts +11 -0
- package/dist/esm/anyspend/utils/address.js +14 -0
- package/dist/esm/anyspend/utils/chain.d.ts +20 -1
- package/dist/esm/anyspend/utils/chain.js +70 -4
- package/dist/esm/anyspend/utils/token.d.ts +7 -0
- package/dist/esm/anyspend/utils/token.js +25 -7
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -5
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/esm/shared/utils/payment.utils.d.ts +1 -0
- package/dist/esm/shared/utils/payment.utils.js +9 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/types/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/types/anyspend/types/chain.d.ts +10 -2
- package/dist/types/anyspend/utils/address.d.ts +11 -0
- package/dist/types/anyspend/utils/chain.d.ts +20 -1
- package/dist/types/anyspend/utils/token.d.ts +7 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/types/shared/utils/payment.utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +36 -9
- package/src/anyspend/react/components/AnySpendCustom.tsx +9 -25
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +16 -5
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -5
- package/src/anyspend/react/components/common/OrderToken.tsx +5 -5
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +6 -6
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -5
- package/src/anyspend/react/components/common/PaymentVendorUI.tsx +26 -2
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +3 -5
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useConnectedUserProfile.ts +7 -10
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +2 -15
- package/src/anyspend/react/hooks/useHyperliquidTransfer.ts +152 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +7 -22
- package/src/anyspend/types/chain.ts +10 -1
- package/src/anyspend/utils/address.ts +15 -0
- package/src/anyspend/utils/chain.ts +84 -4
- package/src/anyspend/utils/token.ts +27 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -2
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +4 -6
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
- package/src/shared/utils/payment.utils.ts +10 -1
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +0 -148
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +0 -145
- package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
|
|
3
|
-
import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
|
|
3
|
+
import { ChainType, IBaseChain, IEVMChain, IHyperliquidChain, ISolanaChain } from "../types/chain";
|
|
4
4
|
export declare const hyperEVM: {
|
|
5
5
|
blockExplorers: {
|
|
6
6
|
readonly default: {
|
|
@@ -42,8 +42,10 @@ export declare const hyperEVM: {
|
|
|
42
42
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
43
43
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
44
44
|
export declare const SOLANA_MAINNET: ISolanaChain;
|
|
45
|
+
export declare const HYPERLIQUID_MAINNET: IHyperliquidChain;
|
|
45
46
|
export declare const EVM_CHAINS: Record<number, IEVMChain>;
|
|
46
47
|
export declare const SOLANA_CHAINS: Record<number, ISolanaChain>;
|
|
48
|
+
export declare const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain>;
|
|
47
49
|
export declare const ALL_CHAINS: Record<number, IBaseChain>;
|
|
48
50
|
export declare function getSolanaChains(network: "mainnet" | "testnet"): ISolanaChain;
|
|
49
51
|
export declare function getAllEvmChains(network: "mainnet" | "testnet"): Record<number, IEVMChain>;
|
|
@@ -63,3 +65,20 @@ export declare function getExplorerAddressUrl(chainId: number, address: string):
|
|
|
63
65
|
export declare function getMulticall3Address(chainId: number): string;
|
|
64
66
|
export declare function getNativeToken(chainId: number): components["schemas"]["Token"];
|
|
65
67
|
export declare function isEvmChain(chainId: number): boolean;
|
|
68
|
+
export declare function isHyperliquidChain(chainId: number): boolean;
|
|
69
|
+
export declare function getHyperliquidChain(chainId: number): IHyperliquidChain;
|
|
70
|
+
/**
|
|
71
|
+
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
72
|
+
* Filters out chains that shouldn't be available for the given context.
|
|
73
|
+
*
|
|
74
|
+
* @param context - "from" for source chains, "to" for destination chains
|
|
75
|
+
* @returns Array of available chain IDs
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Get source chains (excludes Hyperliquid)
|
|
79
|
+
* const sourceChains = getAvailableChainIds("from") // [1, 8453, 137, ...]
|
|
80
|
+
*
|
|
81
|
+
* // Get destination chains (includes Hyperliquid)
|
|
82
|
+
* const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
|
|
83
|
+
*/
|
|
84
|
+
export declare function getAvailableChainIds(context: "from" | "to"): number[];
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
3
|
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
4
|
+
/**
|
|
5
|
+
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
6
|
+
* instead of the standard 42-character EVM address format.
|
|
7
|
+
* This is required by Relay SDK for Hyperliquid integration.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
4
10
|
export declare function isNativeToken(address: string): boolean;
|
|
5
11
|
export declare function getSolanaToken(): components["schemas"]["Token"];
|
|
6
12
|
export declare function getEthToken(chainId: number): components["schemas"]["Token"];
|
|
@@ -8,3 +14,4 @@ export declare function getPolToken(): components["schemas"]["Token"];
|
|
|
8
14
|
export declare function getBnbToken(): components["schemas"]["Token"];
|
|
9
15
|
export declare function getAvaxToken(): components["schemas"]["Token"];
|
|
10
16
|
export declare function getHyperEVMNativeToken(): components["schemas"]["Token"];
|
|
17
|
+
export declare function getHyperliquidUSDCToken(): components["schemas"]["Token"];
|
|
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics";
|
|
|
6
6
|
export { useAuthentication } from "./useAuthentication";
|
|
7
7
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
8
8
|
export { useB3EnsName } from "./useB3EnsName";
|
|
9
|
-
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
10
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
11
10
|
export * from "./useClaim";
|
|
12
11
|
export { useClient } from "./useClient";
|
|
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7454
7454
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
7457
7458
|
[x: `bytes2[${string}]`]: undefined;
|
|
7458
7459
|
[x: `bytes3[${string}]`]: undefined;
|
|
7459
7460
|
[x: `bytes4[${string}]`]: undefined;
|
|
7460
7461
|
[x: `bytes5[${string}]`]: undefined;
|
|
7461
7462
|
[x: `bytes7[${string}]`]: undefined;
|
|
7462
|
-
[x: `bytes8[${string}]`]: undefined;
|
|
7463
7463
|
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7556
7556
|
bytes18?: undefined;
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
|
+
bytes8?: undefined;
|
|
7559
7560
|
bytes2?: undefined;
|
|
7560
7561
|
bytes3?: undefined;
|
|
7561
7562
|
bytes4?: undefined;
|
|
7562
7563
|
bytes5?: undefined;
|
|
7563
7564
|
bytes7?: undefined;
|
|
7564
|
-
bytes8?: undefined;
|
|
7565
7565
|
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
export declare function getStripePromise(): Promise<import("@stripe/stripe-js").Stripe | null>;
|
|
2
3
|
export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
3
4
|
export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
4
5
|
export declare function formatStripeAmount(amount: number): string;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { components } from "../types/api";
|
|
|
3
3
|
|
|
4
4
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
7
7
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
8
8
|
|
|
9
9
|
export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
eqci,
|
|
5
|
+
getDefaultToken,
|
|
6
|
+
getHyperliquidUSDCToken,
|
|
7
|
+
HYPERLIQUID_CHAIN_ID,
|
|
8
|
+
HYPERLIQUID_USDC_ADDRESS,
|
|
9
|
+
USDC_BASE,
|
|
10
|
+
ZERO_ADDRESS,
|
|
11
|
+
} from "@b3dotfun/sdk/anyspend";
|
|
4
12
|
import {
|
|
5
13
|
useAnyspendCreateOnrampOrder,
|
|
6
14
|
useAnyspendCreateOrder,
|
|
@@ -223,15 +231,22 @@ function AnySpendInner({
|
|
|
223
231
|
|
|
224
232
|
// State for destination chain/token selection
|
|
225
233
|
const [selectedDstChainId, setSelectedDstChainId] = useState<number>(initialDstChainId);
|
|
234
|
+
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
235
|
+
const isHyperliquidUSDCAddress = (address?: string) =>
|
|
236
|
+
eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
|
|
237
|
+
|
|
226
238
|
const defaultDstToken = isBuyMode
|
|
227
|
-
?
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
239
|
+
? // Special case: Hyperliquid uses zero address for USDC
|
|
240
|
+
destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
|
|
241
|
+
? getHyperliquidUSDCToken()
|
|
242
|
+
: {
|
|
243
|
+
symbol: "",
|
|
244
|
+
chainId: destinationTokenChainId,
|
|
245
|
+
address: destinationTokenAddress,
|
|
246
|
+
name: "",
|
|
247
|
+
decimals: 18,
|
|
248
|
+
metadata: {},
|
|
249
|
+
}
|
|
235
250
|
: getDefaultToken(selectedDstChainId);
|
|
236
251
|
const dstTokenFromUrl = useTokenFromUrl({
|
|
237
252
|
defaultToken: defaultDstToken,
|
|
@@ -277,6 +292,12 @@ function AnySpendInner({
|
|
|
277
292
|
// Update destination token with metadata
|
|
278
293
|
useEffect(() => {
|
|
279
294
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
295
|
+
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
296
|
+
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(selectedDstToken.address)) {
|
|
297
|
+
appliedDstMetadataRef.current = true;
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
280
301
|
// Mark as applied
|
|
281
302
|
appliedDstMetadataRef.current = true;
|
|
282
303
|
|
|
@@ -1126,12 +1147,18 @@ function AnySpendInner({
|
|
|
1126
1147
|
"border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
|
|
1127
1148
|
isBuyMode && "top-[calc(50%+56px)] cursor-default",
|
|
1128
1149
|
activeTab === "fiat" && "hidden",
|
|
1150
|
+
selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
|
|
1129
1151
|
)}
|
|
1130
1152
|
onClick={() => {
|
|
1131
1153
|
if (activeTab === "fiat" || isBuyMode) {
|
|
1132
1154
|
return;
|
|
1133
1155
|
}
|
|
1134
1156
|
|
|
1157
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
1158
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1135
1162
|
// Swap chain selections
|
|
1136
1163
|
const tempSrcChainId = selectedSrcChainId;
|
|
1137
1164
|
const tempDstChainId = selectedDstChainId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { eqci, getDefaultToken, roundUpUSDCBaseAmountToNearest } from "@b3dotfun/sdk/anyspend";
|
|
2
|
-
import {
|
|
2
|
+
import { USDC_BASE, ZERO_ADDRESS } from "@b3dotfun/sdk/anyspend/constants";
|
|
3
3
|
import {
|
|
4
4
|
CreateOrderParams,
|
|
5
5
|
useAnyspendCreateOnrampOrder,
|
|
@@ -48,6 +48,7 @@ import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodStat
|
|
|
48
48
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState";
|
|
49
49
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
50
50
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
51
|
+
import { CryptoPaymentMethodDisplay } from "./common/CryptoPaymentMethodDisplay";
|
|
51
52
|
import { FeeBreakDown } from "./common/FeeBreakDown";
|
|
52
53
|
import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
53
54
|
import { OrderDetails } from "./common/OrderDetails";
|
|
@@ -295,7 +296,7 @@ function AnySpendCustomInner({
|
|
|
295
296
|
// First check native tokens (ETH, etc.)
|
|
296
297
|
const nativeToken = nativeTokens?.find(t => t.chainId === srcChainId && Number(t.displayValue) > 0);
|
|
297
298
|
if (nativeToken) {
|
|
298
|
-
const matchingToken = tokenList.find(t => t.address ===
|
|
299
|
+
const matchingToken = tokenList.find(t => t.address === ZERO_ADDRESS);
|
|
299
300
|
if (matchingToken) return matchingToken;
|
|
300
301
|
}
|
|
301
302
|
|
|
@@ -469,7 +470,7 @@ function AnySpendCustomInner({
|
|
|
469
470
|
|
|
470
471
|
const isCreatingOrder = isCreatingRegularOrder || isCreatingOnrampOrder;
|
|
471
472
|
|
|
472
|
-
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile();
|
|
473
|
+
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile(effectiveCryptoPaymentMethod);
|
|
473
474
|
const recipientProfile = useProfile({ address: recipientAddress });
|
|
474
475
|
const recipientName = recipientProfile.data?.name;
|
|
475
476
|
|
|
@@ -951,28 +952,11 @@ function AnySpendCustomInner({
|
|
|
951
952
|
className="text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700"
|
|
952
953
|
onClick={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
953
954
|
>
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
</span>
|
|
960
|
-
) : (
|
|
961
|
-
<span className="whitespace-nowrap">Connect wallet</span>
|
|
962
|
-
)}
|
|
963
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
964
|
-
</>
|
|
965
|
-
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
966
|
-
<>
|
|
967
|
-
<span className="whitespace-nowrap">Transfer crypto</span>
|
|
968
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
969
|
-
</>
|
|
970
|
-
) : (
|
|
971
|
-
<>
|
|
972
|
-
<span className="whitespace-nowrap">Select payment method</span>
|
|
973
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
974
|
-
</>
|
|
975
|
-
)}
|
|
955
|
+
<CryptoPaymentMethodDisplay
|
|
956
|
+
paymentMethod={effectiveCryptoPaymentMethod}
|
|
957
|
+
connectedAddress={connectedAddress}
|
|
958
|
+
connectedName={connectedName}
|
|
959
|
+
/>
|
|
976
960
|
</button>
|
|
977
961
|
</motion.div>
|
|
978
962
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useProfile, useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
-
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
3
|
-
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
4
2
|
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
-
import {
|
|
3
|
+
import { Info } from "lucide-react";
|
|
6
4
|
import { motion } from "motion/react";
|
|
7
5
|
import { useEffect, useRef } from "react";
|
|
8
6
|
import { components } from "../../../types/api";
|
|
9
7
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
10
8
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
9
|
+
import { CryptoPaymentMethodDisplay } from "./CryptoPaymentMethodDisplay";
|
|
11
10
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
12
11
|
import { TokenBalance } from "./TokenBalance";
|
|
13
12
|
|
|
@@ -103,33 +102,11 @@ export function CryptoPaySection({
|
|
|
103
102
|
className="text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none"
|
|
104
103
|
onClick={onSelectCryptoPaymentMethod}
|
|
105
104
|
>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</div>
|
|
112
|
-
) : (
|
|
113
|
-
"Connect wallet"
|
|
114
|
-
)}
|
|
115
|
-
<ChevronRight className="h-4 w-4" />
|
|
116
|
-
</>
|
|
117
|
-
) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (
|
|
118
|
-
<>
|
|
119
|
-
Global Account
|
|
120
|
-
<ChevronRight className="h-4 w-4" />
|
|
121
|
-
</>
|
|
122
|
-
) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
123
|
-
<>
|
|
124
|
-
Transfer crypto
|
|
125
|
-
<ChevronRight className="h-4 w-4" />
|
|
126
|
-
</>
|
|
127
|
-
) : (
|
|
128
|
-
<>
|
|
129
|
-
Select payment method
|
|
130
|
-
<ChevronRight className="h-4 w-4" />
|
|
131
|
-
</>
|
|
132
|
-
)}
|
|
105
|
+
<CryptoPaymentMethodDisplay
|
|
106
|
+
paymentMethod={selectedCryptoPaymentMethod}
|
|
107
|
+
connectedAddress={walletAddress}
|
|
108
|
+
connectedName={connectedName}
|
|
109
|
+
/>
|
|
133
110
|
</button>
|
|
134
111
|
</div>
|
|
135
112
|
<OrderTokenAmount
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
2
|
+
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
5
|
+
|
|
6
|
+
interface CryptoPaymentMethodDisplayProps {
|
|
7
|
+
paymentMethod: CryptoPaymentMethodType;
|
|
8
|
+
connectedAddress?: string | null;
|
|
9
|
+
connectedName?: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Displays the selected crypto payment method with appropriate label
|
|
14
|
+
* - CONNECT_WALLET: Shows wallet address/name or "Connect wallet"
|
|
15
|
+
* - GLOBAL_WALLET: Shows "Global Account"
|
|
16
|
+
* - TRANSFER_CRYPTO: Shows "Transfer crypto"
|
|
17
|
+
* - NONE: Shows "Select payment method"
|
|
18
|
+
*/
|
|
19
|
+
export function CryptoPaymentMethodDisplay({
|
|
20
|
+
paymentMethod,
|
|
21
|
+
connectedAddress,
|
|
22
|
+
connectedName,
|
|
23
|
+
}: CryptoPaymentMethodDisplayProps) {
|
|
24
|
+
if (paymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
{connectedAddress ? (
|
|
28
|
+
<span className="text-as-tertiarry whitespace-nowrap">
|
|
29
|
+
{connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress)}
|
|
30
|
+
</span>
|
|
31
|
+
) : (
|
|
32
|
+
<span className="whitespace-nowrap">Connect wallet</span>
|
|
33
|
+
)}
|
|
34
|
+
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (paymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<span className="whitespace-nowrap">Global Account</span>
|
|
43
|
+
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (paymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<span className="whitespace-nowrap">Transfer crypto</span>
|
|
52
|
+
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// NONE or any other case
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<span className="whitespace-nowrap">Select payment method</span>
|
|
61
|
+
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
|
|
1
2
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
2
3
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
3
4
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
@@ -94,11 +95,21 @@ export function CryptoReceiveSection({
|
|
|
94
95
|
<div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
|
|
95
96
|
<div className="bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3">
|
|
96
97
|
{(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
<div className="relative">
|
|
99
|
+
<img
|
|
100
|
+
src={dstTokenLogoURI || dstToken.metadata?.logoURI}
|
|
101
|
+
alt={dstTokenSymbol || dstToken.symbol}
|
|
102
|
+
className="h-8 w-8 rounded-full"
|
|
103
|
+
/>
|
|
104
|
+
{/* Chain logo overlay */}
|
|
105
|
+
{ALL_CHAINS[dstToken.chainId]?.logoUrl && (
|
|
106
|
+
<img
|
|
107
|
+
src={ALL_CHAINS[dstToken.chainId].logoUrl}
|
|
108
|
+
alt="Chain"
|
|
109
|
+
className="absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white"
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
102
113
|
)}
|
|
103
114
|
<span className="text-as-brand text-lg font-bold">{dstTokenSymbol || dstToken.symbol}</span>
|
|
104
115
|
</div>
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
ALL_CHAINS,
|
|
5
5
|
getChainName,
|
|
6
6
|
getPaymentUrl,
|
|
7
|
-
RELAY_ETH_ADDRESS,
|
|
8
7
|
RELAY_SOLANA_MAINNET_CHAIN_ID,
|
|
8
|
+
ZERO_ADDRESS,
|
|
9
9
|
} from "@b3dotfun/sdk/anyspend";
|
|
10
10
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
11
11
|
import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -121,7 +121,7 @@ export function InsufficientDepositPayment({
|
|
|
121
121
|
value={getPaymentUrl(
|
|
122
122
|
order.globalAddress,
|
|
123
123
|
BigInt(depositDeficit),
|
|
124
|
-
order.srcTokenAddress ===
|
|
124
|
+
order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress,
|
|
125
125
|
order.srcChain,
|
|
126
126
|
srcToken?.decimals,
|
|
127
127
|
)}
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
getPaymentUrl,
|
|
9
9
|
getStatusDisplay,
|
|
10
10
|
isNativeToken,
|
|
11
|
-
RELAY_ETH_ADDRESS,
|
|
12
11
|
RELAY_SOLANA_MAINNET_CHAIN_ID,
|
|
12
|
+
ZERO_ADDRESS,
|
|
13
13
|
} from "@b3dotfun/sdk/anyspend";
|
|
14
14
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
15
15
|
import {
|
|
@@ -327,16 +327,17 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
327
327
|
// Main payment handler that triggers chain switch and payment
|
|
328
328
|
const handlePayment = useCallback(async () => {
|
|
329
329
|
console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
|
|
330
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
330
331
|
if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
331
|
-
//
|
|
332
|
-
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
332
|
+
// Solana payment flow
|
|
333
333
|
await initiatePhantomTransfer({
|
|
334
334
|
amountLamports: amountToSend,
|
|
335
335
|
tokenAddress: order.srcTokenAddress,
|
|
336
336
|
recipientAddress: order.globalAddress,
|
|
337
337
|
});
|
|
338
338
|
} else {
|
|
339
|
-
//
|
|
339
|
+
// EVM payment flow (EOA and AA wallets)
|
|
340
|
+
// Note: Hyperliquid is NOT supported as source chain, only as destination chain
|
|
340
341
|
await handleUnifiedPaymentProcess();
|
|
341
342
|
}
|
|
342
343
|
}, [order, walletClient?.chain?.id, depositDeficit, handleUnifiedPaymentProcess, initiatePhantomTransfer]);
|
|
@@ -1039,7 +1040,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1039
1040
|
value={getPaymentUrl(
|
|
1040
1041
|
order.globalAddress,
|
|
1041
1042
|
BigInt(order.srcAmount),
|
|
1042
|
-
order.srcTokenAddress ===
|
|
1043
|
+
order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress,
|
|
1043
1044
|
order.srcChain,
|
|
1044
1045
|
srcToken?.decimals,
|
|
1045
1046
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ALL_CHAINS,
|
|
3
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
4
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
5
|
import { Button, useAccountWallet, useTokenBalancesByChain } from "@b3dotfun/sdk/global-account/react";
|
|
5
6
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
6
7
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
@@ -9,7 +10,6 @@ import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
|
9
10
|
import { CheckCircle2, ChevronsUpDown } from "lucide-react";
|
|
10
11
|
import { useMemo } from "react";
|
|
11
12
|
import { ChainTokenIcon } from "./ChainTokenIcon";
|
|
12
|
-
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
13
13
|
|
|
14
14
|
export function OrderToken({
|
|
15
15
|
context,
|
|
@@ -44,7 +44,7 @@ export function OrderToken({
|
|
|
44
44
|
// Get balance for the selected token
|
|
45
45
|
let balance: bigint | null = null;
|
|
46
46
|
if (token && wallet?.address) {
|
|
47
|
-
if (token.address ===
|
|
47
|
+
if (token.address === ZERO_ADDRESS) {
|
|
48
48
|
// Native token
|
|
49
49
|
const nativeToken = nativeTokens?.find(t => t.chainId === chainId);
|
|
50
50
|
balance = nativeToken?.value ?? null;
|
|
@@ -69,12 +69,12 @@ export function OrderToken({
|
|
|
69
69
|
return (
|
|
70
70
|
<TokenSelector
|
|
71
71
|
address={address}
|
|
72
|
-
chainIdsFilter={
|
|
72
|
+
chainIdsFilter={getAvailableChainIds(context)}
|
|
73
73
|
context={context}
|
|
74
74
|
fromChainWalletVMSupported={true}
|
|
75
75
|
isValidAddress={true}
|
|
76
76
|
key={undefined}
|
|
77
|
-
lockedChainIds={
|
|
77
|
+
lockedChainIds={getAvailableChainIds(context)}
|
|
78
78
|
multiWalletSupportEnabled={true}
|
|
79
79
|
onAnalyticEvent={undefined}
|
|
80
80
|
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
@@ -5,7 +5,7 @@ import { useEffect, useRef } from "react";
|
|
|
5
5
|
import { NumericFormat } from "react-number-format";
|
|
6
6
|
import { formatUnits } from "viem";
|
|
7
7
|
|
|
8
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
8
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
9
9
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
10
10
|
import { getNativeRequired } from "@b3dotfun/sdk/anyspend/utils/chain";
|
|
11
11
|
import { isNativeToken } from "@b3dotfun/sdk/anyspend/utils/token";
|
|
@@ -163,12 +163,12 @@ export function OrderTokenAmount({
|
|
|
163
163
|
{!hideTokenSelect && (
|
|
164
164
|
<TokenSelector
|
|
165
165
|
address={address}
|
|
166
|
-
chainIdsFilter={
|
|
166
|
+
chainIdsFilter={getAvailableChainIds(context)}
|
|
167
167
|
context={context}
|
|
168
168
|
fromChainWalletVMSupported={true}
|
|
169
169
|
isValidAddress={true}
|
|
170
170
|
key={`selector-${context}-${token.address}-${chainId}`}
|
|
171
|
-
lockedChainIds={
|
|
171
|
+
lockedChainIds={getAvailableChainIds(context)}
|
|
172
172
|
multiWalletSupportEnabled={true}
|
|
173
173
|
onAnalyticEvent={undefined}
|
|
174
174
|
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
@@ -4,7 +4,7 @@ import { ChevronsUpDown } from "lucide-react";
|
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { NumericFormat } from "react-number-format";
|
|
6
6
|
|
|
7
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
7
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
8
8
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
9
9
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
10
10
|
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
@@ -79,12 +79,12 @@ export function OrderTokenAmountFiat({
|
|
|
79
79
|
return (
|
|
80
80
|
<TokenSelector
|
|
81
81
|
address={address}
|
|
82
|
-
chainIdsFilter={
|
|
82
|
+
chainIdsFilter={getAvailableChainIds(context)}
|
|
83
83
|
context={context}
|
|
84
84
|
fromChainWalletVMSupported={true}
|
|
85
85
|
isValidAddress={true}
|
|
86
86
|
key={`selector-${context}-${token.address}-${chainId}`}
|
|
87
|
-
lockedChainIds={
|
|
87
|
+
lockedChainIds={getAvailableChainIds(context)}
|
|
88
88
|
multiWalletSupportEnabled={true}
|
|
89
89
|
onAnalyticEvent={undefined}
|
|
90
90
|
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
@@ -4,12 +4,12 @@ import { ChevronsUpDown } from "lucide-react";
|
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { NumericFormat } from "react-number-format";
|
|
6
6
|
|
|
7
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
7
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
8
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
8
9
|
import { Button } from "@b3dotfun/sdk/global-account/react";
|
|
9
10
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
10
11
|
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
11
12
|
import { ChainTokenIcon } from "./ChainTokenIcon";
|
|
12
|
-
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
13
13
|
|
|
14
14
|
export function OrderTokenAmountFiat({
|
|
15
15
|
disabled,
|
|
@@ -118,12 +118,12 @@ export function OrderTokenAmountFiat({
|
|
|
118
118
|
{!hideTokenSelect && (
|
|
119
119
|
<TokenSelector
|
|
120
120
|
address={address}
|
|
121
|
-
chainIdsFilter={
|
|
121
|
+
chainIdsFilter={getAvailableChainIds(context)}
|
|
122
122
|
context={context}
|
|
123
123
|
fromChainWalletVMSupported={true}
|
|
124
124
|
isValidAddress={true}
|
|
125
125
|
key={`selector-${context}-${token.address}-${chainId}`}
|
|
126
|
-
lockedChainIds={
|
|
126
|
+
lockedChainIds={getAvailableChainIds(context)}
|
|
127
127
|
multiWalletSupportEnabled={true}
|
|
128
128
|
onAnalyticEvent={undefined}
|
|
129
129
|
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
@@ -173,12 +173,12 @@ export function OrderTokenAmountFiat({
|
|
|
173
173
|
{!hideTokenSelect && (
|
|
174
174
|
<TokenSelector
|
|
175
175
|
address={address}
|
|
176
|
-
chainIdsFilter={
|
|
176
|
+
chainIdsFilter={getAvailableChainIds(context)}
|
|
177
177
|
context={context}
|
|
178
178
|
fromChainWalletVMSupported={true}
|
|
179
179
|
isValidAddress={true}
|
|
180
180
|
key={`selector-${context}-${token.address}-${chainId}`}
|
|
181
|
-
lockedChainIds={
|
|
181
|
+
lockedChainIds={getAvailableChainIds(context)}
|
|
182
182
|
multiWalletSupportEnabled={true}
|
|
183
183
|
onAnalyticEvent={undefined}
|
|
184
184
|
popularChainIds={[1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID]}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
2
2
|
import { OrderDetailsCollapsible, useStripeClientSecret } from "@b3dotfun/sdk/anyspend/react";
|
|
3
3
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
4
|
import { ShinyButton, useB3, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
5
5
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
6
6
|
import { formatStripeAmount } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
7
7
|
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
8
|
-
import {
|
|
8
|
+
import { PaymentIntentResult, StripePaymentElementOptions } from "@stripe/stripe-js";
|
|
9
9
|
import { X } from "lucide-react";
|
|
10
10
|
import { useEffect, useState } from "react";
|
|
11
11
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFingerprintWrapper";
|
|
12
12
|
import HowItWorks from "./HowItWorks";
|
|
13
13
|
import PaymentMethodIcons from "./PaymentMethodIcons";
|
|
14
14
|
|
|
15
|
-
const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
|
|
16
|
-
|
|
17
15
|
interface PaymentStripeWeb2Props {
|
|
18
16
|
order: components["schemas"]["Order"];
|
|
19
17
|
stripePaymentIntentId: string;
|
|
@@ -38,7 +36,7 @@ export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaym
|
|
|
38
36
|
return (
|
|
39
37
|
<AnySpendFingerprintWrapper fingerprint={fingerprintConfig}>
|
|
40
38
|
<Elements
|
|
41
|
-
stripe={
|
|
39
|
+
stripe={getStripePromise()}
|
|
42
40
|
options={{
|
|
43
41
|
clientSecret: clientSecret || undefined,
|
|
44
42
|
appearance: { theme: theme === "light" ? "stripe" : "night" },
|