@b3dotfun/sdk 0.0.83-test.0 → 0.0.84-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 +1 -1
- package/dist/cjs/anyspend/constants/index.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +21 -12
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +47 -177
- 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/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/useAnyspendFlow.js +0 -3
- 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 +58 -1
- package/dist/cjs/anyspend/utils/chain.js +94 -4
- package/dist/cjs/anyspend/utils/token.d.ts +4 -0
- package/dist/cjs/anyspend/utils/token.js +35 -6
- 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/SignInWithB3Flow.js +12 -57
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
- package/dist/cjs/global-account/react/hooks/index.js +1 -5
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +63 -72
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +24 -54
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- 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 +22 -13
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -7
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +45 -175
- 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/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/useAnyspendFlow.js +0 -3
- 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 +58 -1
- package/dist/esm/anyspend/utils/chain.js +91 -4
- package/dist/esm/anyspend/utils/token.d.ts +4 -0
- package/dist/esm/anyspend/utils/token.js +32 -6
- 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/SignInWithB3Flow.js +12 -57
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
- package/dist/esm/global-account/react/hooks/index.js +0 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +63 -72
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +24 -54
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/shared/utils/payment.utils.d.ts +1 -0
- package/dist/esm/shared/utils/payment.utils.js +9 -1
- package/dist/styles/index.css +1 -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 +58 -1
- package/dist/types/anyspend/utils/token.d.ts +4 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- 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 +31 -13
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +1 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +9 -29
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +22 -253
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
- 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/useAnyspendFlow.ts +0 -4
- 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 +115 -5
- package/src/anyspend/utils/token.ts +36 -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/SignInWithB3Flow.tsx +22 -77
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +0 -2
- package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
- package/src/global-account/react/hooks/useAuthentication.ts +85 -88
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +26 -59
- package/src/shared/utils/payment.utils.ts +10 -1
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -73
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/cjs/global-account/react/hooks/useAuth.js +0 -338
- 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/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -70
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/esm/global-account/react/hooks/useAuth.js +0 -332
- 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/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +0 -80
- package/src/global-account/react/hooks/useAuth.ts +0 -380
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
|
@@ -1,11 +1,51 @@
|
|
|
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
|
+
export declare const hyperEVM: {
|
|
5
|
+
blockExplorers: {
|
|
6
|
+
readonly default: {
|
|
7
|
+
readonly name: "HyperEVM Explorer";
|
|
8
|
+
readonly url: "https://hyperevmscan.io/";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
blockTime?: number | undefined | undefined;
|
|
12
|
+
contracts?: {
|
|
13
|
+
[x: string]: import("viem").ChainContract | {
|
|
14
|
+
[sourceId: number]: import("viem").ChainContract | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
ensRegistry?: import("viem").ChainContract | undefined;
|
|
17
|
+
ensUniversalResolver?: import("viem").ChainContract | undefined;
|
|
18
|
+
multicall3?: import("viem").ChainContract | undefined;
|
|
19
|
+
erc6492Verifier?: import("viem").ChainContract | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
ensTlds?: readonly string[] | undefined;
|
|
22
|
+
id: 999;
|
|
23
|
+
name: "HyperEVM";
|
|
24
|
+
nativeCurrency: {
|
|
25
|
+
readonly name: "HyperEVM";
|
|
26
|
+
readonly symbol: "HYPE";
|
|
27
|
+
readonly decimals: 18;
|
|
28
|
+
};
|
|
29
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
30
|
+
rpcUrls: {
|
|
31
|
+
readonly default: {
|
|
32
|
+
readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
sourceId?: number | undefined | undefined;
|
|
36
|
+
testnet?: boolean | undefined | undefined;
|
|
37
|
+
custom?: Record<string, unknown> | undefined;
|
|
38
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
39
|
+
formatters?: undefined;
|
|
40
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
41
|
+
};
|
|
4
42
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
5
43
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
6
44
|
export declare const SOLANA_MAINNET: ISolanaChain;
|
|
45
|
+
export declare const HYPERLIQUID_MAINNET: IHyperliquidChain;
|
|
7
46
|
export declare const EVM_CHAINS: Record<number, IEVMChain>;
|
|
8
47
|
export declare const SOLANA_CHAINS: Record<number, ISolanaChain>;
|
|
48
|
+
export declare const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain>;
|
|
9
49
|
export declare const ALL_CHAINS: Record<number, IBaseChain>;
|
|
10
50
|
export declare function getSolanaChains(network: "mainnet" | "testnet"): ISolanaChain;
|
|
11
51
|
export declare function getAllEvmChains(network: "mainnet" | "testnet"): Record<number, IEVMChain>;
|
|
@@ -25,3 +65,20 @@ export declare function getExplorerAddressUrl(chainId: number, address: string):
|
|
|
25
65
|
export declare function getMulticall3Address(chainId: number): string;
|
|
26
66
|
export declare function getNativeToken(chainId: number): components["schemas"]["Token"];
|
|
27
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,7 +1,11 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
|
+
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
2
4
|
export declare function isNativeToken(address: string): boolean;
|
|
3
5
|
export declare function getSolanaToken(): components["schemas"]["Token"];
|
|
4
6
|
export declare function getEthToken(chainId: number): components["schemas"]["Token"];
|
|
5
7
|
export declare function getPolToken(): components["schemas"]["Token"];
|
|
6
8
|
export declare function getBnbToken(): components["schemas"]["Token"];
|
|
7
9
|
export declare function getAvaxToken(): components["schemas"]["Token"];
|
|
10
|
+
export declare function getHyperEVMNativeToken(): components["schemas"]["Token"];
|
|
11
|
+
export declare function getHyperliquidUSDCToken(): components["schemas"]["Token"];
|
|
@@ -3,11 +3,9 @@ export { useAccountAssets } from "./useAccountAssets";
|
|
|
3
3
|
export { useAccountWallet } from "./useAccountWallet";
|
|
4
4
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
5
5
|
export { useAnalytics } from "./useAnalytics";
|
|
6
|
-
export { useAuth } from "./useAuth";
|
|
7
6
|
export { useAuthentication } from "./useAuthentication";
|
|
8
7
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
9
8
|
export { useB3EnsName } from "./useB3EnsName";
|
|
10
|
-
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
11
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
12
10
|
export * from "./useClaim";
|
|
13
11
|
export { useClient } from "./useClient";
|
|
@@ -41,8 +41,8 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
41
41
|
name?: string | undefined;
|
|
42
42
|
address?: string | undefined;
|
|
43
43
|
email?: string | undefined;
|
|
44
|
-
phone?: string | undefined;
|
|
45
44
|
username?: string | undefined;
|
|
45
|
+
phone?: string | undefined;
|
|
46
46
|
fid?: string | undefined;
|
|
47
47
|
};
|
|
48
48
|
}[] | undefined;
|
|
@@ -63,6 +63,6 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
63
63
|
turnkeyOtpId?: string | undefined;
|
|
64
64
|
};
|
|
65
65
|
} | undefined;
|
|
66
|
-
refetchUser: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
66
|
+
refetchUser: (wallet?: Wallet) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
67
67
|
setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
|
|
68
68
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use useAuth() with Turnkey authentication instead
|
|
4
|
-
*/
|
|
5
2
|
export declare function useTWAuth(): {
|
|
6
3
|
authenticate: (wallet: Wallet, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
7
4
|
};
|
|
@@ -36,8 +36,8 @@ export declare function useUserQuery(): {
|
|
|
36
36
|
name?: string | undefined;
|
|
37
37
|
address?: string | undefined;
|
|
38
38
|
email?: string | undefined;
|
|
39
|
-
phone?: string | undefined;
|
|
40
39
|
username?: string | undefined;
|
|
40
|
+
phone?: string | undefined;
|
|
41
41
|
fid?: string | undefined;
|
|
42
42
|
};
|
|
43
43
|
}[] | 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,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
eqci,
|
|
5
|
+
getDefaultToken,
|
|
6
|
+
getHyperliquidUSDCToken,
|
|
7
|
+
HYPERLIQUID_CHAIN_ID,
|
|
8
|
+
USDC_BASE,
|
|
9
|
+
ZERO_ADDRESS,
|
|
10
|
+
} from "@b3dotfun/sdk/anyspend";
|
|
4
11
|
import {
|
|
5
12
|
useAnyspendCreateOnrampOrder,
|
|
6
13
|
useAnyspendCreateOrder,
|
|
@@ -38,7 +45,6 @@ import { parseUnits } from "viem";
|
|
|
38
45
|
import { base, mainnet } from "viem/chains";
|
|
39
46
|
import { components } from "../../types/api";
|
|
40
47
|
import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod";
|
|
41
|
-
import { useAutoSetActiveWalletFromWagmi } from "../hooks/useAutoSetActiveWalletFromWagmi";
|
|
42
48
|
import { useConnectedWalletDisplay } from "../hooks/useConnectedWalletDisplay";
|
|
43
49
|
import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodState";
|
|
44
50
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState";
|
|
@@ -225,14 +231,17 @@ function AnySpendInner({
|
|
|
225
231
|
// State for destination chain/token selection
|
|
226
232
|
const [selectedDstChainId, setSelectedDstChainId] = useState<number>(initialDstChainId);
|
|
227
233
|
const defaultDstToken = isBuyMode
|
|
228
|
-
?
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
? // Special case: Hyperliquid uses zero address for USDC
|
|
235
|
+
destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
|
|
236
|
+
? getHyperliquidUSDCToken()
|
|
237
|
+
: {
|
|
238
|
+
symbol: "",
|
|
239
|
+
chainId: destinationTokenChainId,
|
|
240
|
+
address: destinationTokenAddress,
|
|
241
|
+
name: "",
|
|
242
|
+
decimals: 18,
|
|
243
|
+
metadata: {},
|
|
244
|
+
}
|
|
236
245
|
: getDefaultToken(selectedDstChainId);
|
|
237
246
|
const dstTokenFromUrl = useTokenFromUrl({
|
|
238
247
|
defaultToken: defaultDstToken,
|
|
@@ -278,6 +287,12 @@ function AnySpendInner({
|
|
|
278
287
|
// Update destination token with metadata
|
|
279
288
|
useEffect(() => {
|
|
280
289
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
290
|
+
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
291
|
+
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
|
|
292
|
+
appliedDstMetadataRef.current = true;
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
281
296
|
// Mark as applied
|
|
282
297
|
appliedDstMetadataRef.current = true;
|
|
283
298
|
|
|
@@ -461,9 +476,6 @@ function AnySpendInner({
|
|
|
461
476
|
|
|
462
477
|
const globalWalletImage = useAccountWalletImage();
|
|
463
478
|
|
|
464
|
-
// Auto-set active wallet from wagmi
|
|
465
|
-
useAutoSetActiveWalletFromWagmi();
|
|
466
|
-
|
|
467
479
|
// Get wallet address based on selected payment method
|
|
468
480
|
const { walletAddress } = useConnectedWalletDisplay(effectiveCryptoPaymentMethod);
|
|
469
481
|
|
|
@@ -1130,12 +1142,18 @@ function AnySpendInner({
|
|
|
1130
1142
|
"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",
|
|
1131
1143
|
isBuyMode && "top-[calc(50%+56px)] cursor-default",
|
|
1132
1144
|
activeTab === "fiat" && "hidden",
|
|
1145
|
+
selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
|
|
1133
1146
|
)}
|
|
1134
1147
|
onClick={() => {
|
|
1135
1148
|
if (activeTab === "fiat" || isBuyMode) {
|
|
1136
1149
|
return;
|
|
1137
1150
|
}
|
|
1138
1151
|
|
|
1152
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
1153
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1139
1157
|
// Swap chain selections
|
|
1140
1158
|
const tempSrcChainId = selectedSrcChainId;
|
|
1141
1159
|
const tempDstChainId = selectedDstChainId;
|
|
@@ -33,7 +33,7 @@ import { encodeFunctionData } from "viem";
|
|
|
33
33
|
import { AnySpendCustom } from "./AnySpendCustom";
|
|
34
34
|
|
|
35
35
|
// Collector Club Shop contract on Base
|
|
36
|
-
const CC_SHOP_ADDRESS = "
|
|
36
|
+
const CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
|
|
37
37
|
const BASE_CHAIN_ID = 8453;
|
|
38
38
|
|
|
39
39
|
// ABI for buyPacksFor function only
|
|
@@ -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,
|
|
@@ -44,11 +44,11 @@ import { motion } from "motion/react";
|
|
|
44
44
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
45
45
|
|
|
46
46
|
import { base } from "viem/chains";
|
|
47
|
-
import { useAutoSetActiveWalletFromWagmi } from "../hooks/useAutoSetActiveWalletFromWagmi";
|
|
48
47
|
import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodState";
|
|
49
48
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState";
|
|
50
49
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
51
50
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
51
|
+
import { CryptoPaymentMethodDisplay } from "./common/CryptoPaymentMethodDisplay";
|
|
52
52
|
import { FeeBreakDown } from "./common/FeeBreakDown";
|
|
53
53
|
import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
54
54
|
import { OrderDetails } from "./common/OrderDetails";
|
|
@@ -247,9 +247,6 @@ function AnySpendCustomInner({
|
|
|
247
247
|
const searchParams = useSearchParamsSSR();
|
|
248
248
|
const router = useRouter();
|
|
249
249
|
|
|
250
|
-
// Auto-set active wallet from wagmi
|
|
251
|
-
useAutoSetActiveWalletFromWagmi();
|
|
252
|
-
|
|
253
250
|
const [activePanel, setActivePanel] = useState<PanelView>(
|
|
254
251
|
loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER,
|
|
255
252
|
);
|
|
@@ -299,7 +296,7 @@ function AnySpendCustomInner({
|
|
|
299
296
|
// First check native tokens (ETH, etc.)
|
|
300
297
|
const nativeToken = nativeTokens?.find(t => t.chainId === srcChainId && Number(t.displayValue) > 0);
|
|
301
298
|
if (nativeToken) {
|
|
302
|
-
const matchingToken = tokenList.find(t => t.address ===
|
|
299
|
+
const matchingToken = tokenList.find(t => t.address === ZERO_ADDRESS);
|
|
303
300
|
if (matchingToken) return matchingToken;
|
|
304
301
|
}
|
|
305
302
|
|
|
@@ -473,7 +470,7 @@ function AnySpendCustomInner({
|
|
|
473
470
|
|
|
474
471
|
const isCreatingOrder = isCreatingRegularOrder || isCreatingOnrampOrder;
|
|
475
472
|
|
|
476
|
-
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile();
|
|
473
|
+
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile(effectiveCryptoPaymentMethod);
|
|
477
474
|
const recipientProfile = useProfile({ address: recipientAddress });
|
|
478
475
|
const recipientName = recipientProfile.data?.name;
|
|
479
476
|
|
|
@@ -955,28 +952,11 @@ function AnySpendCustomInner({
|
|
|
955
952
|
className="text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700"
|
|
956
953
|
onClick={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
957
954
|
>
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
</span>
|
|
964
|
-
) : (
|
|
965
|
-
<span className="whitespace-nowrap">Connect wallet</span>
|
|
966
|
-
)}
|
|
967
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
968
|
-
</>
|
|
969
|
-
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
970
|
-
<>
|
|
971
|
-
<span className="whitespace-nowrap">Transfer crypto</span>
|
|
972
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
973
|
-
</>
|
|
974
|
-
) : (
|
|
975
|
-
<>
|
|
976
|
-
<span className="whitespace-nowrap">Select payment method</span>
|
|
977
|
-
<ChevronRight className="h-4 w-4 shrink-0" />
|
|
978
|
-
</>
|
|
979
|
-
)}
|
|
955
|
+
<CryptoPaymentMethodDisplay
|
|
956
|
+
paymentMethod={effectiveCryptoPaymentMethod}
|
|
957
|
+
connectedAddress={connectedAddress}
|
|
958
|
+
connectedName={connectedName}
|
|
959
|
+
/>
|
|
980
960
|
</button>
|
|
981
961
|
</motion.div>
|
|
982
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
|