@b3dotfun/sdk 0.0.83-alpha.0 → 0.0.83-alpha.2
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 +5 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -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/TransferCryptoDetails.js +1 -1
- 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/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/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 +6 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +2 -2
- 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/TransferCryptoDetails.js +2 -2
- 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/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/types/anyspend/constants/index.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- 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/package.json +1 -1
- package/src/anyspend/constants/index.ts +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +7 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +2 -2
- 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/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/hooks/index.ts +1 -0
- 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
|
@@ -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
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../types/api";
|
|
2
2
|
export declare const ANYSPEND_MAINNET_BASE_URL: string;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
4
|
export declare const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
5
5
|
export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
6
6
|
export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { base } from "viem/chains";
|
|
2
2
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
3
|
-
export const
|
|
3
|
+
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
4
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
5
5
|
export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
6
6
|
export const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
3
|
+
import { getDefaultToken, HYPERLIQUID_CHAIN_ID, USDC_BASE } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
@@ -815,10 +815,14 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
815
815
|
else {
|
|
816
816
|
setActivePanel(panelIndex);
|
|
817
817
|
}
|
|
818
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("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", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
|
|
818
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("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", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden", selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
819
819
|
if (activeTab === "fiat" || isBuyMode) {
|
|
820
820
|
return;
|
|
821
821
|
}
|
|
822
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
823
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
822
826
|
// Swap chain selections
|
|
823
827
|
const tempSrcChainId = selectedSrcChainId;
|
|
824
828
|
const tempDstChainId = selectedDstChainId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { eqci, getDefaultToken, roundUpUSDCBaseAmountToNearest } from "../../../anyspend/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { USDC_BASE, ZERO_ADDRESS } from "../../../anyspend/constants/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useConnectedUserProfile, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn, formatUsername } from "../../../shared/utils/index.js";
|
|
@@ -145,7 +145,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
145
145
|
// First check native tokens (ETH, etc.)
|
|
146
146
|
const nativeToken = nativeTokens?.find(t => t.chainId === srcChainId && Number(t.displayValue) > 0);
|
|
147
147
|
if (nativeToken) {
|
|
148
|
-
const matchingToken = tokenList.find(t => t.address ===
|
|
148
|
+
const matchingToken = tokenList.find(t => t.address === ZERO_ADDRESS);
|
|
149
149
|
if (matchingToken)
|
|
150
150
|
return matchingToken;
|
|
151
151
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS, getChainName, getPaymentUrl,
|
|
3
|
+
import { ALL_CHAINS, getChainName, getPaymentUrl, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { b3 } from "viem/chains";
|
|
@@ -18,5 +18,5 @@ export function InsufficientDepositPayment({ order, srcToken, depositDeficit, ph
|
|
|
18
18
|
toast.success("Copied to clipboard");
|
|
19
19
|
}, children: _jsxs("div", { className: "payment-address bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs("div", { className: "payment-buttons mt-4 flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
20
20
|
? "Pay from Phantom Wallet"
|
|
21
|
-
: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsx("div", { children: "Or" }), _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress ===
|
|
21
|
+
: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsx("div", { children: "Or" }), _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) })] })] }));
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken,
|
|
3
|
+
import { ALL_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useB3, useModalStore, useProfile, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { useRouter, useSearchParams } from "../../../../shared/react/hooks/index.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/index.js";
|
|
@@ -218,9 +218,9 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
218
218
|
// Main payment handler that triggers chain switch and payment
|
|
219
219
|
const handlePayment = useCallback(async () => {
|
|
220
220
|
console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
|
|
221
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
221
222
|
if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
222
|
-
//
|
|
223
|
-
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
223
|
+
// Solana payment flow
|
|
224
224
|
await initiatePhantomTransfer({
|
|
225
225
|
amountLamports: amountToSend,
|
|
226
226
|
tokenAddress: order.srcTokenAddress,
|
|
@@ -228,7 +228,8 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
else {
|
|
231
|
-
//
|
|
231
|
+
// EVM payment flow (EOA and AA wallets)
|
|
232
|
+
// Note: Hyperliquid is NOT supported as source chain, only as destination chain
|
|
232
233
|
await handleUnifiedPaymentProcess();
|
|
233
234
|
}
|
|
234
235
|
}, [order, walletClient?.chain?.id, depositDeficit, handleUnifiedPaymentProcess, initiatePhantomTransfer]);
|
|
@@ -410,7 +411,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
410
411
|
? centerTruncate(phantomWalletAddress, 6)
|
|
411
412
|
: centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
412
413
|
// Default case - existing QR code flow
|
|
413
|
-
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress ===
|
|
414
|
+
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
414
415
|
});
|
|
415
416
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
416
417
|
return (_jsxs("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: _jsx(CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), _jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? (_jsx(TextShimmer, { duration: 1, children: title })) : (_jsx("span", { className: "text-as-primary", children: title })) })] }), _jsx("div", { className: "flex flex-col gap-1", children: tx ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: _jsx("a", { href: getExplorerTxUrl(chainId, tx.txHash), target: "_blank", children: _jsx("div", { className: "text-as-primary/30 font-mono text-xs", children: centerTruncate(tx?.txHash, 6) }) }) })) : null })] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS,
|
|
3
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Button, useAccountWallet, useTokenBalancesByChain } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
@@ -21,7 +21,7 @@ export function OrderToken({ context, address, chainId, setChainId, token, setTo
|
|
|
21
21
|
// Get balance for the selected token
|
|
22
22
|
let balance = null;
|
|
23
23
|
if (token && wallet?.address) {
|
|
24
|
-
if (token.address ===
|
|
24
|
+
if (token.address === ZERO_ADDRESS) {
|
|
25
25
|
// Native token
|
|
26
26
|
const nativeToken = nativeTokens?.find(t => t.chainId === chainId);
|
|
27
27
|
balance = nativeToken?.value ?? null;
|
|
@@ -40,7 +40,7 @@ export function OrderToken({ context, address, chainId, setChainId, token, setTo
|
|
|
40
40
|
hasEnoughBalance,
|
|
41
41
|
};
|
|
42
42
|
}, [chainId, fungibleTokens, nativeTokens, requiredAmount, token, wallet?.address]);
|
|
43
|
-
return (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
43
|
+
return (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: token => {
|
|
44
44
|
setChainId(token.chainId);
|
|
45
45
|
setToken({
|
|
46
46
|
address: token.address,
|
|
@@ -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
|
import { formatUnits } from "viem";
|
|
7
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../../../anyspend/index.js";
|
|
7
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
8
8
|
import { getNativeRequired } from "../../../../anyspend/utils/chain.js";
|
|
9
9
|
import { isNativeToken } from "../../../../anyspend/utils/token.js";
|
|
10
10
|
import { Button, useTokenBalance } from "../../../../global-account/react/index.js";
|
|
@@ -73,5 +73,5 @@ export function OrderTokenAmount({ disabled, inputValue, onChangeInput, context,
|
|
|
73
73
|
// Then set the new token - the useEffect will handle setting the max balance
|
|
74
74
|
setToken(token);
|
|
75
75
|
};
|
|
76
|
-
return (_jsx("div", { className: cn("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: _jsxs("div", { className: cn("flex items-center justify-between gap-3", innerClassName), children: [!canEditAmount ? (_jsx("h2", { className: cn("text-3xl font-medium text-white", amountClassName), children: inputValue || "--" })) : (_jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: cn("placeholder:text-as-primary/70 disabled:text-as-primary/70 text-as-primary w-full bg-transparent text-4xl font-semibold leading-[42px] outline-none sm:text-[30px]", amountClassName), pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, onChange: e => onChangeInput(e.currentTarget.value) }, `input-${token.address}-${chainId}`)), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
76
|
+
return (_jsx("div", { className: cn("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: _jsxs("div", { className: cn("flex items-center justify-between gap-3", innerClassName), children: [!canEditAmount ? (_jsx("h2", { className: cn("text-3xl font-medium text-white", amountClassName), children: inputValue || "--" })) : (_jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: cn("placeholder:text-as-primary/70 disabled:text-as-primary/70 text-as-primary w-full bg-transparent text-4xl font-semibold leading-[42px] outline-none sm:text-[30px]", amountClassName), pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, onChange: e => onChangeInput(e.currentTarget.value) }, `input-${token.address}-${chainId}`)), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsxs(Button, { variant: "outline", role: "combobox", className: cn("token-selector-button bg-b3-react-background border-as-stroke flex h-auto w-fit shrink-0 items-center justify-center gap-2 rounded-xl border-2 px-2 py-1 pr-2 text-center", tokenSelectClassName), children: [token.metadata.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[chainId].logoUrl, tokenUrl: token.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : (_jsx("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), _jsxs("div", { className: "flex flex-col items-start gap-0", children: [_jsx("div", { className: "text-as-primary font-semibold", children: token.symbol }), _jsx("div", { className: "text-as-primary/70 text-xs", children: ALL_CHAINS[chainId].name })] }), _jsx(ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) }, `selector-${context}-${token.address}-${chainId}`))] }) }, `${context}-${token.address}-${chainId}`));
|
|
77
77
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { ChevronsUpDown } from "lucide-react";
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { NumericFormat } from "react-number-format";
|
|
6
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../../../anyspend/index.js";
|
|
6
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
7
7
|
import { cn } from "../../../../shared/utils/index.js";
|
|
8
8
|
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
9
9
|
import { ChainTokenIcon } from "./ChainTokenIcon.js";
|
|
@@ -43,5 +43,5 @@ export function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, cont
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
// Original token amount input design for other contexts
|
|
46
|
-
return (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
46
|
+
return (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsxs("div", { className: cn("border-as-border-secondary bg-as-surface-primary flex cursor-pointer items-center justify-between rounded-xl border px-3 py-2", className), children: [_jsxs("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : (_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), _jsxs("div", { children: [_jsx("div", { className: "text-as-primary font-semibold", children: token.symbol }), _jsx("div", { className: "text-as-primary/50 text-sm", children: ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm text-gray-600", children: "\u2248" }), _jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 20, spellCheck: "false", className: "text-as-primary bg-as-surface-primary w-[100px]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, "aria-disabled": true, readOnly: true }, `input-${token.address}-${chainId}`), _jsx(ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" })] })] }) }, `selector-${context}-${token.address}-${chainId}`));
|
|
47
47
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { ChevronsUpDown } from "lucide-react";
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { NumericFormat } from "react-number-format";
|
|
6
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../../../anyspend/index.js";
|
|
6
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
7
7
|
import { Button } from "../../../../global-account/react/index.js";
|
|
8
8
|
import { cn } from "../../../../shared/utils/index.js";
|
|
9
9
|
import { TokenSelector } from "@relayprotocol/relay-kit-ui";
|
|
@@ -53,8 +53,8 @@ export function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, cont
|
|
|
53
53
|
};
|
|
54
54
|
if (showAsReceiveAmount) {
|
|
55
55
|
// Design-matched token display for receive amounts (like in PanelOnramp)
|
|
56
|
-
return (_jsxs("div", { className: cn("flex items-center justify-between rounded-xl bg-gray-50 p-4", className), children: [_jsxs("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : (_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), _jsxs("div", { children: [_jsx("div", { className: "text-base font-semibold text-gray-900", children: token.symbol }), _jsx("div", { className: "text-sm text-gray-600", children: ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm text-gray-600", children: "\u2248" }), _jsx("span", { className: "text-lg font-semibold text-gray-900", children: formatAmount(inputValue) }), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
56
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between rounded-xl bg-gray-50 p-4", className), children: [_jsxs("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : (_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: _jsx("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), _jsxs("div", { children: [_jsx("div", { className: "text-base font-semibold text-gray-900", children: token.symbol }), _jsx("div", { className: "text-sm text-gray-600", children: ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm text-gray-600", children: "\u2248" }), _jsx("span", { className: "text-lg font-semibold text-gray-900", children: formatAmount(inputValue) }), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsx(ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" }) }, `selector-${context}-${token.address}-${chainId}`))] })] }));
|
|
57
57
|
}
|
|
58
58
|
// Original token amount input design for other contexts
|
|
59
|
-
return (_jsx("div", { className: cn("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [!canEditAmount ? (_jsx("h2", { className: "text-3xl font-medium text-white", children: inputValue || "--" })) : (_jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: "placeholder:text-as-primary/70 disabled:text-as-primary/70 text-as-primary w-full bg-transparent text-4xl font-semibold leading-[42px] outline-none sm:text-[30px]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, onChange: e => onChangeInput(e.currentTarget.value) }, `input-${token.address}-${chainId}`)), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
59
|
+
return (_jsx("div", { className: cn("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [!canEditAmount ? (_jsx("h2", { className: "text-3xl font-medium text-white", children: inputValue || "--" })) : (_jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: "placeholder:text-as-primary/70 disabled:text-as-primary/70 text-as-primary w-full bg-transparent text-4xl font-semibold leading-[42px] outline-none sm:text-[30px]", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: disabled, value: inputValue, allowNegative: false, onChange: e => onChangeInput(e.currentTarget.value) }, `input-${token.address}-${chainId}`)), !hideTokenSelect && (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsxs(Button, { variant: "outline", role: "combobox", className: "bg-b3-react-background border-as-stroke flex h-auto w-fit shrink-0 items-center justify-center gap-2 rounded-xl border-2 px-2 py-1 pr-2 text-center", children: [token.metadata?.logoURI ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : (_jsx("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), _jsxs("div", { className: "flex flex-col items-start gap-0", children: [_jsx("div", { className: "text-as-primary font-semibold", children: token.symbol }), _jsx("div", { className: "text-as-primary/70 text-xs", children: ALL_CHAINS[chainId]?.name })] }), _jsx(ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) }, `selector-${context}-${token.address}-${chainId}`))] }) }, `${context}-${token.address}-${chainId}`));
|
|
60
60
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS, getChainName, getPaymentUrl,
|
|
3
|
+
import { ALL_CHAINS, getChainName, getPaymentUrl, ZERO_ADDRESS } from "../../../../anyspend/index.js";
|
|
4
4
|
import { CopyToClipboard, ShinyButton, TextLoop, toast } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
@@ -67,5 +67,5 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order
|
|
|
67
67
|
transition: "stroke-dashoffset 1s linear",
|
|
68
68
|
} })] }), _jsx("div", { className: "order-transfer-crypto-timer-text absolute inset-0 flex items-center justify-center", children: _jsx("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-content flex w-full flex-col gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-cards flex items-center gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-amount-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-amount-label text-as-content-secondary text-sm font-medium", children: "Amount" }), _jsx("div", { className: "order-transfer-crypto-amount-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsx(CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
69
69
|
toast.success("Amount copied to clipboard");
|
|
70
|
-
}, children: _jsxs("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "order-transfer-crypto-chain-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-qr-deposit-card border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [_jsx("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: _jsxs("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress ===
|
|
70
|
+
}, children: _jsxs("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "order-transfer-crypto-chain-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-qr-deposit-card border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [_jsx("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: _jsxs("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-transfer-crypto-qr-code bg-as-surface-secondary max-h-48 max-w-48" }), _jsxs("div", { className: "order-transfer-crypto-wallet-hint mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "order-transfer-crypto-wallet-text text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" })] })] })] }) }) }), _jsxs("div", { className: "order-transfer-crypto-address-section flex h-full w-full flex-col gap-2 p-6", children: [_jsx("span", { className: "order-transfer-crypto-address-label text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), _jsxs("div", { className: "order-transfer-crypto-address-copy flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [_jsx("div", { className: "order-transfer-crypto-address-text text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), _jsx("div", { className: "order-transfer-crypto-address-copy-icon-wrapper place-self-end", children: _jsx(Copy, { className: "order-transfer-crypto-address-copy-icon group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), _jsxs("div", { className: "order-transfer-crypto-actions flex flex-col gap-3", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "order-transfer-crypto-copy-btn w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }), _jsx(PaymentMethodSwitch, { currentMethod: CryptoPaymentMethodType.TRANSFER_CRYPTO, onMethodChange: onPaymentMethodChange })] })] }));
|
|
71
71
|
});
|
|
@@ -8,6 +8,7 @@ export * from "./useCoinbaseOnrampOptions";
|
|
|
8
8
|
export * from "./useConnectedUserProfile";
|
|
9
9
|
export * from "./useGeoOnrampOptions";
|
|
10
10
|
export * from "./useGetGeo";
|
|
11
|
+
export * from "./useHyperliquidTransfer";
|
|
11
12
|
export * from "./useRecipientAddressState";
|
|
12
13
|
export * from "./useSigMint";
|
|
13
14
|
export * from "./useStripeClientSecret";
|
|
@@ -8,6 +8,7 @@ export * from "./useCoinbaseOnrampOptions.js";
|
|
|
8
8
|
export * from "./useConnectedUserProfile.js";
|
|
9
9
|
export * from "./useGeoOnrampOptions.js";
|
|
10
10
|
export * from "./useGetGeo.js";
|
|
11
|
+
export * from "./useHyperliquidTransfer.js";
|
|
11
12
|
export * from "./useRecipientAddressState.js";
|
|
12
13
|
export * from "./useSigMint.js";
|
|
13
14
|
export * from "./useStripeClientSecret.js";
|
|
@@ -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 {};
|