@b3dotfun/sdk 0.0.83 → 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 -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/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 +1 -0
- package/dist/cjs/anyspend/utils/token.js +19 -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/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/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 -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/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 +1 -0
- package/dist/esm/anyspend/utils/token.js +19 -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/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 +1 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -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 -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/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 +20 -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
|
@@ -2,20 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useConnectedUserProfile = useConnectedUserProfile;
|
|
4
4
|
const react_1 = require("../../../global-account/react");
|
|
5
|
-
const
|
|
5
|
+
const useConnectedWalletDisplay_1 = require("./useConnectedWalletDisplay");
|
|
6
6
|
/**
|
|
7
7
|
* Hook that provides connected user's address, profile, and cleaned display name
|
|
8
8
|
* Combines logic for getting connected address from either global account or thirdweb wallets
|
|
9
9
|
*/
|
|
10
|
-
function useConnectedUserProfile() {
|
|
11
|
-
const {
|
|
12
|
-
const connectedWallets = (0, react_2.useConnectedWallets)();
|
|
13
|
-
// Get connected address from global account or first connected wallet
|
|
14
|
-
const connectedAddress = globalAddress || connectedWallets?.[0]?.getAccount()?.address;
|
|
10
|
+
function useConnectedUserProfile(selectedCryptoPaymentMethod) {
|
|
11
|
+
const { walletAddress } = (0, useConnectedWalletDisplay_1.useConnectedWalletDisplay)(selectedCryptoPaymentMethod);
|
|
15
12
|
// Fetch profile data for the connected address with cleaned name
|
|
16
|
-
const connectedProfile = (0, react_1.useProfile)({ address:
|
|
13
|
+
const connectedProfile = (0, react_1.useProfile)({ address: walletAddress });
|
|
17
14
|
return {
|
|
18
|
-
address:
|
|
15
|
+
address: walletAddress,
|
|
19
16
|
profile: connectedProfile,
|
|
20
17
|
name: connectedProfile.data?.name,
|
|
21
18
|
isLoading: connectedProfile.isLoading,
|
|
@@ -2,8 +2,6 @@ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMetho
|
|
|
2
2
|
interface UseConnectedWalletDisplayResult {
|
|
3
3
|
walletAddress: string | undefined;
|
|
4
4
|
shouldShowConnectedEOA: boolean;
|
|
5
|
-
shouldShowWagmiWallet: boolean;
|
|
6
|
-
isWalletDuplicated: boolean;
|
|
7
5
|
suggestedPaymentMethod: CryptoPaymentMethodType;
|
|
8
6
|
}
|
|
9
7
|
/**
|
|
@@ -12,23 +12,15 @@ function useConnectedWalletDisplay(selectedCryptoPaymentMethod) {
|
|
|
12
12
|
const { connectedEOAWallet, connectedSmartWallet } = (0, react_1.useAccountWallet)();
|
|
13
13
|
const { address: wagmiAddress } = (0, wagmi_1.useAccount)();
|
|
14
14
|
const globalWalletAddress = connectedSmartWallet?.getAccount()?.address;
|
|
15
|
-
// Helper function to check if two addresses are the same
|
|
16
|
-
const isSameAddress = (addr1, addr2) => {
|
|
17
|
-
if (!addr1 || !addr2)
|
|
18
|
-
return false;
|
|
19
|
-
return addr1.toLowerCase() === addr2.toLowerCase();
|
|
20
|
-
};
|
|
21
15
|
// Check if connectedEOAWallet and wagmi wallet represent the same wallet
|
|
22
16
|
const connectedEOAAddress = connectedEOAWallet?.getAccount()?.address;
|
|
23
|
-
const isWalletDuplicated = isSameAddress(connectedEOAAddress, wagmiAddress) || isSameAddress(globalWalletAddress, wagmiAddress);
|
|
24
17
|
// Determine which wallet to show (prefer connectedEOAWallet if both exist and are the same)
|
|
25
18
|
const shouldShowConnectedEOA = !!connectedEOAWallet;
|
|
26
19
|
// this is disabled because we don't want to display In-App Wallet as a payment method
|
|
27
|
-
const shouldShowWagmiWallet = false; // wagmiWalletIsConnected && (!isWalletDuplicated || !connectedEOAWallet);
|
|
28
20
|
// Determine which address to use based on payment method
|
|
29
21
|
let walletAddress;
|
|
30
22
|
if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
31
|
-
walletAddress =
|
|
23
|
+
walletAddress = globalWalletAddress;
|
|
32
24
|
}
|
|
33
25
|
else if (selectedCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
34
26
|
// Prefer connectedEOAWallet, fallback to wagmi wallet
|
|
@@ -45,15 +37,13 @@ function useConnectedWalletDisplay(selectedCryptoPaymentMethod) {
|
|
|
45
37
|
// If there's a connected EOA or wagmi wallet, suggest CONNECT_WALLET
|
|
46
38
|
suggestedPaymentMethod = CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET;
|
|
47
39
|
}
|
|
48
|
-
else if (
|
|
40
|
+
else if (globalWalletAddress) {
|
|
49
41
|
// If only global wallet is available, suggest that
|
|
50
42
|
suggestedPaymentMethod = CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET;
|
|
51
43
|
}
|
|
52
44
|
return {
|
|
53
45
|
walletAddress,
|
|
54
46
|
shouldShowConnectedEOA,
|
|
55
|
-
shouldShowWagmiWallet,
|
|
56
|
-
isWalletDuplicated,
|
|
57
47
|
suggestedPaymentMethod,
|
|
58
48
|
};
|
|
59
49
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface HyperliquidTransferParams {
|
|
2
|
+
/** Amount in smallest unit (USDC has 6 decimals) */
|
|
3
|
+
amount: string;
|
|
4
|
+
/** Recipient address */
|
|
5
|
+
destination: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This hook is NOT USED in production.
|
|
9
|
+
*
|
|
10
|
+
* Hyperliquid is only supported as DESTINATION CHAIN (not source chain).
|
|
11
|
+
* Users cannot send FROM Hyperliquid in our flow, so EIP-712 signing is not needed.
|
|
12
|
+
*
|
|
13
|
+
* This hook was created during initial planning but is kept for:
|
|
14
|
+
* - Reference if we need to support source chain in the future
|
|
15
|
+
* - Understanding how Hyperliquid EIP-712 transfers work
|
|
16
|
+
*
|
|
17
|
+
* DO NOT USE THIS HOOK IN PRODUCTION CODE.
|
|
18
|
+
*
|
|
19
|
+
* Custom hook for handling Hyperliquid transfers via EIP-712 signature.
|
|
20
|
+
* Based on Relay SDK's Hyperliquid implementation.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const { initiateTransfer } = useHyperliquidTransfer();
|
|
25
|
+
*
|
|
26
|
+
* await initiateTransfer({
|
|
27
|
+
* amount: "1000000", // 1 USDC
|
|
28
|
+
* destination: "0x..."
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useHyperliquidTransfer(): {
|
|
33
|
+
initiateTransfer: ({ amount, destination }: HyperliquidTransferParams) => Promise<void>;
|
|
34
|
+
getConnectedAddress: () => `0x${string}` | null;
|
|
35
|
+
isWalletConnected: boolean;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useHyperliquidTransfer = useHyperliquidTransfer;
|
|
7
|
+
const anyspend_1 = require("../../../anyspend");
|
|
8
|
+
const react_1 = require("../../../global-account/react");
|
|
9
|
+
const number_1 = require("../../../shared/utils/number");
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
const react_2 = require("react");
|
|
12
|
+
const viem_1 = require("viem");
|
|
13
|
+
const wagmi_1 = require("wagmi");
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated This hook is NOT USED in production.
|
|
16
|
+
*
|
|
17
|
+
* Hyperliquid is only supported as DESTINATION CHAIN (not source chain).
|
|
18
|
+
* Users cannot send FROM Hyperliquid in our flow, so EIP-712 signing is not needed.
|
|
19
|
+
*
|
|
20
|
+
* This hook was created during initial planning but is kept for:
|
|
21
|
+
* - Reference if we need to support source chain in the future
|
|
22
|
+
* - Understanding how Hyperliquid EIP-712 transfers work
|
|
23
|
+
*
|
|
24
|
+
* DO NOT USE THIS HOOK IN PRODUCTION CODE.
|
|
25
|
+
*
|
|
26
|
+
* Custom hook for handling Hyperliquid transfers via EIP-712 signature.
|
|
27
|
+
* Based on Relay SDK's Hyperliquid implementation.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { initiateTransfer } = useHyperliquidTransfer();
|
|
32
|
+
*
|
|
33
|
+
* await initiateTransfer({
|
|
34
|
+
* amount: "1000000", // 1 USDC
|
|
35
|
+
* destination: "0x..."
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function useHyperliquidTransfer() {
|
|
40
|
+
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
41
|
+
/**
|
|
42
|
+
* Get the connected wallet address if available.
|
|
43
|
+
*/
|
|
44
|
+
const getConnectedAddress = (0, react_2.useCallback)(() => {
|
|
45
|
+
return walletClient?.account?.address || null;
|
|
46
|
+
}, [walletClient]);
|
|
47
|
+
/**
|
|
48
|
+
* Initiate Hyperliquid transfer by signing EIP-712 message and sending to Hyperliquid API.
|
|
49
|
+
*/
|
|
50
|
+
const initiateTransfer = (0, react_2.useCallback)(async ({ amount, destination }) => {
|
|
51
|
+
if (!walletClient?.account) {
|
|
52
|
+
react_1.toast.error("Please connect your wallet");
|
|
53
|
+
throw new Error("Wallet not connected");
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const currentTime = new Date().getTime();
|
|
57
|
+
// Convert amount from smallest unit (6 decimals) to display format.
|
|
58
|
+
// e.g., "11151533" -> "11.151533"
|
|
59
|
+
const displayAmount = (0, number_1.formatUnits)(amount, 6);
|
|
60
|
+
// Prepare EIP-712 typed data for Hyperliquid USD send.
|
|
61
|
+
const typedData = {
|
|
62
|
+
domain: {
|
|
63
|
+
name: "HyperliquidSignTransaction",
|
|
64
|
+
version: "1",
|
|
65
|
+
chainId: anyspend_1.HYPERLIQUID_CHAIN_ID,
|
|
66
|
+
verifyingContract: "0x0000000000000000000000000000000000000000",
|
|
67
|
+
},
|
|
68
|
+
types: {
|
|
69
|
+
"HyperliquidTransaction:UsdSend": [
|
|
70
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
71
|
+
{ name: "destination", type: "string" },
|
|
72
|
+
{ name: "amount", type: "string" },
|
|
73
|
+
{ name: "time", type: "uint64" },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
primaryType: "HyperliquidTransaction:UsdSend",
|
|
77
|
+
message: {
|
|
78
|
+
hyperliquidChain: "Mainnet",
|
|
79
|
+
destination: destination.toLowerCase(),
|
|
80
|
+
amount: displayAmount,
|
|
81
|
+
time: BigInt(currentTime),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
react_1.toast.info("Please sign the message in your wallet");
|
|
85
|
+
// Sign EIP-712 message.
|
|
86
|
+
const signature = await walletClient.signTypedData(typedData);
|
|
87
|
+
// Parse signature to get r, s, v components.
|
|
88
|
+
const { r, s, v } = (0, viem_1.parseSignature)(signature);
|
|
89
|
+
react_1.toast.info("Sending transaction to Hyperliquid...");
|
|
90
|
+
// Send signature to Hyperliquid API.
|
|
91
|
+
const response = await axios_1.default.post(anyspend_1.HYPERLIQUID_MAINNET.apiUrl + "/exchange", {
|
|
92
|
+
signature: {
|
|
93
|
+
r,
|
|
94
|
+
s,
|
|
95
|
+
v: Number(v ?? BigInt(0)),
|
|
96
|
+
},
|
|
97
|
+
nonce: currentTime,
|
|
98
|
+
action: {
|
|
99
|
+
type: "usdSend",
|
|
100
|
+
signatureChainId: `0x${anyspend_1.HYPERLIQUID_CHAIN_ID.toString(16)}`,
|
|
101
|
+
hyperliquidChain: "Mainnet",
|
|
102
|
+
destination: destination.toLowerCase(),
|
|
103
|
+
amount: displayAmount,
|
|
104
|
+
time: currentTime,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
// Check response status.
|
|
108
|
+
if (!response || response.status !== 200 || response.data?.status !== "ok") {
|
|
109
|
+
const errorMsg = response?.data?.error || "Failed to send transaction to Hyperliquid";
|
|
110
|
+
react_1.toast.error(errorMsg);
|
|
111
|
+
throw new Error(errorMsg);
|
|
112
|
+
}
|
|
113
|
+
react_1.toast.success("Transaction sent to Hyperliquid successfully!");
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error("Hyperliquid transfer error:", error);
|
|
117
|
+
// Handle user rejection.
|
|
118
|
+
if (error?.message?.includes("User rejected") || error?.code === 4001) {
|
|
119
|
+
react_1.toast.error("Transaction signature rejected");
|
|
120
|
+
throw new Error("User rejected signature");
|
|
121
|
+
}
|
|
122
|
+
// Handle other errors.
|
|
123
|
+
const errorMsg = error?.message || "Failed to complete Hyperliquid transfer";
|
|
124
|
+
react_1.toast.error(errorMsg);
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}, [walletClient]);
|
|
128
|
+
return {
|
|
129
|
+
initiateTransfer,
|
|
130
|
+
getConnectedAddress,
|
|
131
|
+
isWalletConnected: !!walletClient?.account,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -4,19 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.AnyspendProvider = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("../../../global-account/react");
|
|
7
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
8
|
-
const react_2 = require("react");
|
|
9
7
|
const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
|
|
10
8
|
const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
|
|
11
|
-
const defaultQueryClientConfig = {
|
|
12
|
-
defaultOptions: {
|
|
13
|
-
queries: {
|
|
14
|
-
refetchOnWindowFocus: false,
|
|
15
|
-
retry: false,
|
|
16
|
-
staleTime: 30000,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
9
|
/**
|
|
21
10
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
22
11
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -41,7 +30,6 @@ const defaultQueryClientConfig = {
|
|
|
41
30
|
* ```
|
|
42
31
|
*/
|
|
43
32
|
const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
44
|
-
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(FeatureFlagsContext_1.FeatureFlagsProvider, { featureFlags: featureFlags, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }) }));
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(FeatureFlagsContext_1.FeatureFlagsProvider, { featureFlags: featureFlags, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }));
|
|
46
34
|
};
|
|
47
35
|
exports.AnyspendProvider = AnyspendProvider;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Chain } from "viem";
|
|
2
1
|
import { components } from "../../anyspend/types/api";
|
|
2
|
+
import { Chain } from "viem";
|
|
3
3
|
export declare enum ChainType {
|
|
4
4
|
EVM = "evm",
|
|
5
|
-
SOLANA = "solana"
|
|
5
|
+
SOLANA = "solana",
|
|
6
|
+
HYPERLIQUID = "hyperliquid"
|
|
6
7
|
}
|
|
7
8
|
export interface IBaseChain {
|
|
8
9
|
id: number;
|
|
@@ -25,3 +26,10 @@ export interface IEVMChain extends IBaseChain {
|
|
|
25
26
|
export interface ISolanaChain extends IBaseChain {
|
|
26
27
|
type: ChainType.SOLANA;
|
|
27
28
|
}
|
|
29
|
+
export interface IHyperliquidChain extends IBaseChain {
|
|
30
|
+
type: ChainType.HYPERLIQUID;
|
|
31
|
+
apiUrl: string;
|
|
32
|
+
blockExplorer: {
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
export declare function isSolanaAddress(address: string): boolean;
|
|
2
2
|
export declare function isEvmOrSolanaAddress(address: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Check if an address is Hyperliquid's special USDC address.
|
|
5
|
+
* Hyperliquid USDC uses a special 34-character format (0x + 32 hex digits)
|
|
6
|
+
* instead of the standard 42-character Ethereum address format.
|
|
7
|
+
* This is required by Relay SDK for Hyperliquid integration.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain ID to check
|
|
10
|
+
* @param address - The token address to validate
|
|
11
|
+
* @returns true if the address is Hyperliquid USDC's special format
|
|
12
|
+
*/
|
|
13
|
+
export declare function isHyperliquidUSDC(chainId: number, address: string): boolean;
|
|
3
14
|
export declare function normalizeAddress(address: string): string;
|
|
4
15
|
export declare function eqci(a: string | null | undefined, b: string | null | undefined): boolean;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSolanaAddress = isSolanaAddress;
|
|
4
4
|
exports.isEvmOrSolanaAddress = isEvmOrSolanaAddress;
|
|
5
|
+
exports.isHyperliquidUSDC = isHyperliquidUSDC;
|
|
5
6
|
exports.normalizeAddress = normalizeAddress;
|
|
6
7
|
exports.eqci = eqci;
|
|
7
8
|
const viem_1 = require("viem");
|
|
9
|
+
const token_1 = require("./token");
|
|
8
10
|
function isSolanaAddress(address) {
|
|
9
11
|
// Solana addresses are 32-byte base58 strings (usually 32-44 characters)
|
|
10
12
|
const solanaAddressRegex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
@@ -13,6 +15,19 @@ function isSolanaAddress(address) {
|
|
|
13
15
|
function isEvmOrSolanaAddress(address) {
|
|
14
16
|
return (0, viem_1.isAddress)(address) || isSolanaAddress(address);
|
|
15
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if an address is Hyperliquid's special USDC address.
|
|
20
|
+
* Hyperliquid USDC uses a special 34-character format (0x + 32 hex digits)
|
|
21
|
+
* instead of the standard 42-character Ethereum address format.
|
|
22
|
+
* This is required by Relay SDK for Hyperliquid integration.
|
|
23
|
+
*
|
|
24
|
+
* @param chainId - The chain ID to check
|
|
25
|
+
* @param address - The token address to validate
|
|
26
|
+
* @returns true if the address is Hyperliquid USDC's special format
|
|
27
|
+
*/
|
|
28
|
+
function isHyperliquidUSDC(chainId, address) {
|
|
29
|
+
return chainId === token_1.HYPERLIQUID_CHAIN_ID && address.toLowerCase() === "0x00000000000000000000000000000000";
|
|
30
|
+
}
|
|
16
31
|
function normalizeAddress(address) {
|
|
17
32
|
if (isSolanaAddress(address)) {
|
|
18
33
|
return address;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../../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[];
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ALL_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.hyperEVM = void 0;
|
|
6
|
+
exports.ALL_CHAINS = exports.HYPERLIQUID_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.HYPERLIQUID_MAINNET = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.hyperEVM = void 0;
|
|
7
7
|
exports.getSolanaChains = getSolanaChains;
|
|
8
8
|
exports.getAllEvmChains = getAllEvmChains;
|
|
9
9
|
exports.getChainType = getChainType;
|
|
@@ -22,6 +22,9 @@ exports.getExplorerAddressUrl = getExplorerAddressUrl;
|
|
|
22
22
|
exports.getMulticall3Address = getMulticall3Address;
|
|
23
23
|
exports.getNativeToken = getNativeToken;
|
|
24
24
|
exports.isEvmChain = isEvmChain;
|
|
25
|
+
exports.isHyperliquidChain = isHyperliquidChain;
|
|
26
|
+
exports.getHyperliquidChain = getHyperliquidChain;
|
|
27
|
+
exports.getAvailableChainIds = getAvailableChainIds;
|
|
25
28
|
const constants_1 = require("../../anyspend/constants");
|
|
26
29
|
const invariant_1 = __importDefault(require("invariant"));
|
|
27
30
|
const viem_1 = require("viem");
|
|
@@ -256,9 +259,27 @@ exports.SOLANA_MAINNET = {
|
|
|
256
259
|
nativeToken: (0, token_1.getSolanaToken)(),
|
|
257
260
|
coingeckoName: "solana",
|
|
258
261
|
};
|
|
262
|
+
exports.HYPERLIQUID_MAINNET = {
|
|
263
|
+
id: token_1.HYPERLIQUID_CHAIN_ID,
|
|
264
|
+
name: "Hyperliquid",
|
|
265
|
+
type: chain_1.ChainType.HYPERLIQUID,
|
|
266
|
+
logoUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/32196.png",
|
|
267
|
+
nativeRequired: BigInt(0), // No native transfer needed - using Relay's useDepositAddress flow (USDC is native)
|
|
268
|
+
canDepositNative: true, // Can deposit USDC (native token)
|
|
269
|
+
defaultToken: (0, token_1.getHyperliquidUSDCToken)(),
|
|
270
|
+
nativeToken: (0, token_1.getHyperliquidUSDCToken)(),
|
|
271
|
+
coingeckoName: null,
|
|
272
|
+
apiUrl: "https://api.hyperliquid.xyz",
|
|
273
|
+
blockExplorer: {
|
|
274
|
+
url: "https://app.hyperliquid.xyz/explorer",
|
|
275
|
+
},
|
|
276
|
+
};
|
|
259
277
|
exports.EVM_CHAINS = { ...exports.EVM_MAINNET, ...exports.EVM_TESTNET };
|
|
260
278
|
exports.SOLANA_CHAINS = { [constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID]: exports.SOLANA_MAINNET };
|
|
261
|
-
exports.
|
|
279
|
+
exports.HYPERLIQUID_CHAINS = {
|
|
280
|
+
[token_1.HYPERLIQUID_CHAIN_ID]: exports.HYPERLIQUID_MAINNET,
|
|
281
|
+
};
|
|
282
|
+
exports.ALL_CHAINS = { ...exports.EVM_CHAINS, ...exports.SOLANA_CHAINS, ...exports.HYPERLIQUID_CHAINS };
|
|
262
283
|
function getSolanaChains(network) {
|
|
263
284
|
(0, invariant_1.default)(network === "mainnet", "Solana chain is only supported on mainnet");
|
|
264
285
|
return exports.SOLANA_MAINNET;
|
|
@@ -296,7 +317,7 @@ function canDepositNative(chainId) {
|
|
|
296
317
|
return exports.ALL_CHAINS[chainId].canDepositNative;
|
|
297
318
|
}
|
|
298
319
|
function isMainnet(chainId) {
|
|
299
|
-
return exports.EVM_MAINNET[chainId] !== undefined || constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID === chainId;
|
|
320
|
+
return (exports.EVM_MAINNET[chainId] !== undefined || constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID === chainId || token_1.HYPERLIQUID_CHAIN_ID === chainId);
|
|
300
321
|
}
|
|
301
322
|
function isTestnet(chainId) {
|
|
302
323
|
return exports.EVM_TESTNET[chainId] !== undefined;
|
|
@@ -307,7 +328,11 @@ function getDefaultToken(chainId) {
|
|
|
307
328
|
}
|
|
308
329
|
function getChainName(chainId) {
|
|
309
330
|
(0, invariant_1.default)(exports.ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
|
|
310
|
-
|
|
331
|
+
const chain = exports.ALL_CHAINS[chainId];
|
|
332
|
+
if (isEvmChain(chainId)) {
|
|
333
|
+
return chain.viem.name;
|
|
334
|
+
}
|
|
335
|
+
return chain.name;
|
|
311
336
|
}
|
|
312
337
|
function getCoingeckoName(chainId) {
|
|
313
338
|
(0, invariant_1.default)(exports.ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
|
|
@@ -456,6 +481,12 @@ function getPaymentUrl(address, amount, currency, chainId, decimals) {
|
|
|
456
481
|
console.log("Solana URL (isNativeSOL:", isNativeSOL, "):", url);
|
|
457
482
|
return url;
|
|
458
483
|
}
|
|
484
|
+
case chain_1.ChainType.HYPERLIQUID: {
|
|
485
|
+
// NOTE: Hyperliquid is only supported as destination chain (not source chain).
|
|
486
|
+
// Payment URLs are not needed since users cannot send FROM Hyperliquid in our flow.
|
|
487
|
+
// Return address as placeholder (this code path should not be reached).
|
|
488
|
+
return address;
|
|
489
|
+
}
|
|
459
490
|
default:
|
|
460
491
|
// Fallback to just the address if chain type is unknown
|
|
461
492
|
return address;
|
|
@@ -468,12 +499,20 @@ function getExplorerTxUrl(chainId, txHash) {
|
|
|
468
499
|
if (exports.EVM_CHAINS[chainId]) {
|
|
469
500
|
return exports.EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/tx/" + txHash;
|
|
470
501
|
}
|
|
502
|
+
if (exports.HYPERLIQUID_CHAINS[chainId]) {
|
|
503
|
+
return exports.HYPERLIQUID_CHAINS[chainId].blockExplorer.url + "/tx/" + txHash;
|
|
504
|
+
}
|
|
505
|
+
// Default to Solscan for Solana transactions
|
|
471
506
|
return "https://solscan.io/tx/" + txHash;
|
|
472
507
|
}
|
|
473
508
|
function getExplorerAddressUrl(chainId, address) {
|
|
474
509
|
if (exports.EVM_CHAINS[chainId]) {
|
|
475
510
|
return exports.EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/address/" + address;
|
|
476
511
|
}
|
|
512
|
+
if (exports.HYPERLIQUID_CHAINS[chainId]) {
|
|
513
|
+
return exports.HYPERLIQUID_CHAINS[chainId].blockExplorer.url + "/address/" + address;
|
|
514
|
+
}
|
|
515
|
+
// Default to Solscan for Solana addresses
|
|
477
516
|
return "https://solscan.io/account/" + address;
|
|
478
517
|
}
|
|
479
518
|
function getMulticall3Address(chainId) {
|
|
@@ -490,3 +529,33 @@ function getNativeToken(chainId) {
|
|
|
490
529
|
function isEvmChain(chainId) {
|
|
491
530
|
return Boolean(exports.EVM_CHAINS[chainId]);
|
|
492
531
|
}
|
|
532
|
+
function isHyperliquidChain(chainId) {
|
|
533
|
+
return exports.HYPERLIQUID_CHAINS[chainId] !== undefined;
|
|
534
|
+
}
|
|
535
|
+
function getHyperliquidChain(chainId) {
|
|
536
|
+
(0, invariant_1.default)(exports.HYPERLIQUID_CHAINS[chainId], `Chain ${chainId} is not a Hyperliquid chain`);
|
|
537
|
+
return exports.HYPERLIQUID_CHAINS[chainId];
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
541
|
+
* Filters out chains that shouldn't be available for the given context.
|
|
542
|
+
*
|
|
543
|
+
* @param context - "from" for source chains, "to" for destination chains
|
|
544
|
+
* @returns Array of available chain IDs
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* // Get source chains (excludes Hyperliquid)
|
|
548
|
+
* const sourceChains = getAvailableChainIds("from") // [1, 8453, 137, ...]
|
|
549
|
+
*
|
|
550
|
+
* // Get destination chains (includes Hyperliquid)
|
|
551
|
+
* const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
|
|
552
|
+
*/
|
|
553
|
+
function getAvailableChainIds(context) {
|
|
554
|
+
const allChainIds = Object.values(exports.ALL_CHAINS).map(chain => chain.id);
|
|
555
|
+
if (context === "from") {
|
|
556
|
+
// Hyperliquid is only supported as destination chain, not source chain
|
|
557
|
+
return allChainIds.filter(chainId => chainId !== token_1.HYPERLIQUID_CHAIN_ID);
|
|
558
|
+
}
|
|
559
|
+
// For destination ("to"), all chains are available including Hyperliquid
|
|
560
|
+
return allChainIds;
|
|
561
|
+
}
|
|
@@ -8,3 +8,4 @@ export declare function getPolToken(): components["schemas"]["Token"];
|
|
|
8
8
|
export declare function getBnbToken(): components["schemas"]["Token"];
|
|
9
9
|
export declare function getAvaxToken(): components["schemas"]["Token"];
|
|
10
10
|
export declare function getHyperEVMNativeToken(): components["schemas"]["Token"];
|
|
11
|
+
export declare function getHyperliquidUSDCToken(): components["schemas"]["Token"];
|
|
@@ -8,12 +8,13 @@ exports.getPolToken = getPolToken;
|
|
|
8
8
|
exports.getBnbToken = getBnbToken;
|
|
9
9
|
exports.getAvaxToken = getAvaxToken;
|
|
10
10
|
exports.getHyperEVMNativeToken = getHyperEVMNativeToken;
|
|
11
|
+
exports.getHyperliquidUSDCToken = getHyperliquidUSDCToken;
|
|
11
12
|
const constants_1 = require("../../anyspend/constants");
|
|
12
13
|
const chains_1 = require("viem/chains");
|
|
13
14
|
exports.HYPERLIQUID_CHAIN_ID = 1337;
|
|
14
15
|
exports.HYPEREVM_CHAIN_ID = 999;
|
|
15
16
|
function isNativeToken(address) {
|
|
16
|
-
return address.toLowerCase() === constants_1.
|
|
17
|
+
return address.toLowerCase() === constants_1.ZERO_ADDRESS || address.toLowerCase() === constants_1.RELAY_SOL_ADDRESS;
|
|
17
18
|
}
|
|
18
19
|
function getSolanaToken() {
|
|
19
20
|
return {
|
|
@@ -30,7 +31,7 @@ function getSolanaToken() {
|
|
|
30
31
|
function getEthToken(chainId) {
|
|
31
32
|
return {
|
|
32
33
|
chainId: chainId,
|
|
33
|
-
address: constants_1.
|
|
34
|
+
address: constants_1.ZERO_ADDRESS,
|
|
34
35
|
symbol: "ETH",
|
|
35
36
|
name: "Ethereum",
|
|
36
37
|
decimals: 18,
|
|
@@ -42,7 +43,7 @@ function getEthToken(chainId) {
|
|
|
42
43
|
function getPolToken() {
|
|
43
44
|
return {
|
|
44
45
|
chainId: chains_1.polygon.id,
|
|
45
|
-
address: constants_1.
|
|
46
|
+
address: constants_1.ZERO_ADDRESS,
|
|
46
47
|
symbol: "POL",
|
|
47
48
|
name: "Polygon",
|
|
48
49
|
decimals: 18,
|
|
@@ -54,7 +55,7 @@ function getPolToken() {
|
|
|
54
55
|
function getBnbToken() {
|
|
55
56
|
return {
|
|
56
57
|
chainId: chains_1.bsc.id,
|
|
57
|
-
address: constants_1.
|
|
58
|
+
address: constants_1.ZERO_ADDRESS,
|
|
58
59
|
symbol: "BNB",
|
|
59
60
|
name: "BNB",
|
|
60
61
|
decimals: 18,
|
|
@@ -66,7 +67,7 @@ function getBnbToken() {
|
|
|
66
67
|
function getAvaxToken() {
|
|
67
68
|
return {
|
|
68
69
|
chainId: chains_1.avalanche.id,
|
|
69
|
-
address: constants_1.
|
|
70
|
+
address: constants_1.ZERO_ADDRESS,
|
|
70
71
|
symbol: "AVAX",
|
|
71
72
|
name: "AVAX",
|
|
72
73
|
decimals: 18,
|
|
@@ -78,7 +79,7 @@ function getAvaxToken() {
|
|
|
78
79
|
function getHyperEVMNativeToken() {
|
|
79
80
|
return {
|
|
80
81
|
chainId: exports.HYPEREVM_CHAIN_ID,
|
|
81
|
-
address: constants_1.
|
|
82
|
+
address: constants_1.ZERO_ADDRESS,
|
|
82
83
|
symbol: "HYPE",
|
|
83
84
|
name: "HYPE",
|
|
84
85
|
decimals: 18,
|
|
@@ -87,3 +88,15 @@ function getHyperEVMNativeToken() {
|
|
|
87
88
|
},
|
|
88
89
|
};
|
|
89
90
|
}
|
|
91
|
+
function getHyperliquidUSDCToken() {
|
|
92
|
+
return {
|
|
93
|
+
chainId: exports.HYPERLIQUID_CHAIN_ID,
|
|
94
|
+
address: constants_1.ZERO_ADDRESS,
|
|
95
|
+
symbol: "USDC",
|
|
96
|
+
name: "USD Coin",
|
|
97
|
+
decimals: 6,
|
|
98
|
+
metadata: {
|
|
99
|
+
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -43,7 +43,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
|
|
|
43
43
|
(0, react_2.useEffect)(() => {
|
|
44
44
|
(0, client_manager_1.setClientType)(clientType);
|
|
45
45
|
}, [clientType]);
|
|
46
|
-
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
46
|
+
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
|
|
48
48
|
}
|
|
49
49
|
/**
|