@b3dotfun/sdk 0.0.83-alpha.1 → 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/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/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/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/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/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
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.ANYSPEND_TOKEN = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.
|
|
3
|
+
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.ANYSPEND_TOKEN = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.ZERO_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
4
|
const chains_1 = require("viem/chains");
|
|
5
5
|
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
6
|
-
exports.
|
|
6
|
+
exports.ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
7
7
|
exports.RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
8
8
|
exports.RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
9
9
|
exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -822,10 +822,14 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
822
822
|
else {
|
|
823
823
|
setActivePanel(panelIndex);
|
|
824
824
|
}
|
|
825
|
-
}, _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 }) })), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: (0, cn_1.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: () => {
|
|
825
|
+
}, _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 }) })), (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: (0, cn_1.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 === anyspend_1.HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
826
826
|
if (activeTab === "fiat" || isBuyMode) {
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
830
|
+
if (selectedDstChainId === anyspend_1.HYPERLIQUID_CHAIN_ID) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
829
833
|
// Swap chain selections
|
|
830
834
|
const tempSrcChainId = selectedSrcChainId;
|
|
831
835
|
const tempDstChainId = selectedDstChainId;
|
|
@@ -184,7 +184,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
184
184
|
// First check native tokens (ETH, etc.)
|
|
185
185
|
const nativeToken = nativeTokens?.find(t => t.chainId === srcChainId && Number(t.displayValue) > 0);
|
|
186
186
|
if (nativeToken) {
|
|
187
|
-
const matchingToken = tokenList.find(t => t.address === constants_1.
|
|
187
|
+
const matchingToken = tokenList.find(t => t.address === constants_1.ZERO_ADDRESS);
|
|
188
188
|
if (matchingToken)
|
|
189
189
|
return matchingToken;
|
|
190
190
|
}
|
|
@@ -21,5 +21,5 @@ function InsufficientDepositPayment({ order, srcToken, depositDeficit, phantomWa
|
|
|
21
21
|
react_2.toast.success("Copied to clipboard");
|
|
22
22
|
}, children: (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "payment-buttons mt-4 flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_1.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 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Transaction Pending", (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
23
23
|
? "Pay from Phantom Wallet"
|
|
24
|
-
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.jsx)("div", { children: "Or" }), (0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsxs)("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === anyspend_1.
|
|
24
|
+
: "Pay from Connected Wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] })) }), (0, jsx_runtime_1.jsx)("div", { children: "Or" }), (0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsxs)("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === anyspend_1.ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) })] })] }));
|
|
25
25
|
}
|
|
@@ -224,9 +224,9 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
224
224
|
// Main payment handler that triggers chain switch and payment
|
|
225
225
|
const handlePayment = (0, react_5.useCallback)(async () => {
|
|
226
226
|
console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
|
|
227
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
227
228
|
if (order.srcChain === anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
228
|
-
//
|
|
229
|
-
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
229
|
+
// Solana payment flow
|
|
230
230
|
await initiatePhantomTransfer({
|
|
231
231
|
amountLamports: amountToSend,
|
|
232
232
|
tokenAddress: order.srcTokenAddress,
|
|
@@ -234,7 +234,8 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
237
|
-
//
|
|
237
|
+
// EVM payment flow (EOA and AA wallets)
|
|
238
|
+
// Note: Hyperliquid is NOT supported as source chain, only as destination chain
|
|
238
239
|
await handleUnifiedPaymentProcess();
|
|
239
240
|
}
|
|
240
241
|
}, [order, walletClient?.chain?.id, depositDeficit, handleUnifiedPaymentProcess, initiatePhantomTransfer]);
|
|
@@ -416,7 +417,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
416
417
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
417
418
|
: (0, centerTruncate_1.default)(account?.address || "", 6)] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
418
419
|
// Default case - existing QR code flow
|
|
419
|
-
(0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.
|
|
420
|
+
(0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
420
421
|
});
|
|
421
422
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
422
423
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_1.TextShimmer, { duration: 1, children: title })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-as-primary", children: title })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-1", children: tx ? ((0, jsx_runtime_1.jsx)(react_4.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: (0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(chainId, tx.txHash), target: "_blank", children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30 font-mono text-xs", children: (0, centerTruncate_1.default)(tx?.txHash, 6) }) }) })) : null })] }));
|
|
@@ -24,7 +24,7 @@ function OrderToken({ context, address, chainId, setChainId, token, setToken, re
|
|
|
24
24
|
// Get balance for the selected token
|
|
25
25
|
let balance = null;
|
|
26
26
|
if (token && wallet?.address) {
|
|
27
|
-
if (token.address === anyspend_1.
|
|
27
|
+
if (token.address === anyspend_1.ZERO_ADDRESS) {
|
|
28
28
|
// Native token
|
|
29
29
|
const nativeToken = nativeTokens?.find(t => t.chainId === chainId);
|
|
30
30
|
balance = nativeToken?.value ?? null;
|
|
@@ -43,7 +43,7 @@ function OrderToken({ context, address, chainId, setChainId, token, setToken, re
|
|
|
43
43
|
hasEnoughBalance,
|
|
44
44
|
};
|
|
45
45
|
}, [chainId, fungibleTokens, nativeTokens, requiredAmount, token, wallet?.address]);
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter:
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: (0, anyspend_1.getAvailableChainIds)(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: token => {
|
|
47
47
|
setChainId(token.chainId);
|
|
48
48
|
setToken({
|
|
49
49
|
address: token.address,
|
|
@@ -76,5 +76,5 @@ function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, addres
|
|
|
76
76
|
// Then set the new token - the useEffect will handle setting the max balance
|
|
77
77
|
setToken(token);
|
|
78
78
|
};
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center justify-between gap-3", innerClassName), children: [!canEditAmount ? ((0, jsx_runtime_1.jsx)("h2", { className: (0, utils_1.cn)("text-3xl font-medium text-white", amountClassName), children: inputValue || "--" })) : ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: (0, utils_1.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 && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter:
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center justify-between gap-3", innerClassName), children: [!canEditAmount ? ((0, jsx_runtime_1.jsx)("h2", { className: (0, utils_1.cn)("text-3xl font-medium text-white", amountClassName), children: inputValue || "--" })) : ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: (0, utils_1.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 && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: (0, anyspend_1.getAvailableChainIds)(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", role: "combobox", className: (0, utils_1.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 ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId].logoUrl, tokenUrl: token.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[chainId].name })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) }, `selector-${context}-${token.address}-${chainId}`))] }) }, `${context}-${token.address}-${chainId}`));
|
|
80
80
|
}
|
|
@@ -46,5 +46,5 @@ function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, ad
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
// Original token amount input design for other contexts
|
|
49
|
-
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter:
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: (0, anyspend_1.getAvailableChainIds)(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.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: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 text-sm", children: anyspend_1.ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600", children: "\u2248" }), (0, jsx_runtime_1.jsx)(react_number_format_1.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}`), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" })] })] }) }, `selector-${context}-${token.address}-${chainId}`));
|
|
50
50
|
}
|
|
@@ -56,8 +56,8 @@ function OrderTokenAmountFiat({ disabled, inputValue, onChangeInput, context, ad
|
|
|
56
56
|
};
|
|
57
57
|
if (showAsReceiveAmount) {
|
|
58
58
|
// Design-matched token display for receive amounts (like in PanelOnramp)
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center justify-between rounded-xl bg-gray-50 p-4", className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-base font-semibold text-gray-900", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-600", children: anyspend_1.ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600", children: "\u2248" }), (0, jsx_runtime_1.jsx)("span", { className: "text-lg font-semibold text-gray-900", children: formatAmount(inputValue) }), !hideTokenSelect && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter:
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center justify-between rounded-xl bg-gray-50 p-4", className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [token.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-10 w-10" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-white", children: token.symbol?.substring(0, 2) || "??" }) })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-base font-semibold text-gray-900", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-600", children: anyspend_1.ALL_CHAINS[chainId]?.name || "Unknown" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600", children: "\u2248" }), (0, jsx_runtime_1.jsx)("span", { className: "text-lg font-semibold text-gray-900", children: formatAmount(inputValue) }), !hideTokenSelect && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: (0, anyspend_1.getAvailableChainIds)(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 cursor-pointer text-gray-400" }) }, `selector-${context}-${token.address}-${chainId}`))] })] }));
|
|
60
60
|
}
|
|
61
61
|
// Original token amount input design for other contexts
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [!canEditAmount ? ((0, jsx_runtime_1.jsx)("h2", { className: "text-3xl font-medium text-white", children: inputValue || "--" })) : ((0, jsx_runtime_1.jsx)(react_number_format_1.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 && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter:
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("border-as-stroke flex w-full flex-col gap-2 rounded-xl", className), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [!canEditAmount ? ((0, jsx_runtime_1.jsx)("h2", { className: "text-3xl font-medium text-white", children: inputValue || "--" })) : ((0, jsx_runtime_1.jsx)(react_number_format_1.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 && ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { address: address, chainIdsFilter: (0, anyspend_1.getAvailableChainIds)(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, anyspend_1.RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: handleTokenSelect, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_2.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 ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[chainId]?.logoUrl, tokenUrl: token.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[chainId]?.name })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) }, `selector-${context}-${token.address}-${chainId}`))] }) }, `${context}-${token.address}-${chainId}`));
|
|
63
63
|
}
|
|
@@ -70,5 +70,5 @@ exports.TransferCryptoDetails = (0, react_3.memo)(function TransferCryptoDetails
|
|
|
70
70
|
transition: "stroke-dashoffset 1s linear",
|
|
71
71
|
} })] }), (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-timer-text absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-content flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-cards flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-amount-card w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-amount-label text-as-content-secondary text-sm font-medium", children: "Amount" }), (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-amount-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
72
72
|
react_1.toast.success("Amount copied to clipboard");
|
|
73
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-chain-card w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.
|
|
73
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-chain-card w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.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" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-wallet-hint mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-wallet-text text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-address-section flex h-full w-full flex-col gap-2 p-6", children: [(0, jsx_runtime_1.jsx)("span", { className: "order-transfer-crypto-address-label text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-address-copy flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-address-text text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), (0, jsx_runtime_1.jsx)("div", { className: "order-transfer-crypto-address-copy-icon-wrapper place-self-end", children: (0, jsx_runtime_1.jsx)(lucide_react_1.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" }) })] })] })] }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), (0, jsx_runtime_1.jsxs)("div", { className: "order-transfer-crypto-actions flex flex-col gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.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" }), (0, jsx_runtime_1.jsx)(PaymentMethodSwitch_1.PaymentMethodSwitch, { currentMethod: CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO, onMethodChange: onPaymentMethodChange })] })] }));
|
|
74
74
|
});
|
|
@@ -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";
|
|
@@ -24,6 +24,7 @@ __exportStar(require("./useCoinbaseOnrampOptions"), exports);
|
|
|
24
24
|
__exportStar(require("./useConnectedUserProfile"), exports);
|
|
25
25
|
__exportStar(require("./useGeoOnrampOptions"), exports);
|
|
26
26
|
__exportStar(require("./useGetGeo"), exports);
|
|
27
|
+
__exportStar(require("./useHyperliquidTransfer"), exports);
|
|
27
28
|
__exportStar(require("./useRecipientAddressState"), exports);
|
|
28
29
|
__exportStar(require("./useSigMint"), exports);
|
|
29
30
|
__exportStar(require("./useStripeClientSecret"), exports);
|
|
@@ -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 ?? 0n),
|
|
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
|
+
}
|
|
@@ -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[];
|