@b3dotfun/sdk 0.0.84-alpha.1 → 0.0.84
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/react/components/AnySpend.js +2 -4
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +1 -2
- package/dist/cjs/anyspend/utils/token.d.ts +0 -6
- package/dist/cjs/anyspend/utils/token.js +3 -9
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/esm/anyspend/react/components/AnySpend.js +3 -5
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +1 -2
- package/dist/esm/anyspend/utils/token.d.ts +0 -6
- package/dist/esm/anyspend/utils/token.js +2 -8
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/types/anyspend/utils/token.d.ts +0 -6
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +2 -7
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +5 -16
- package/src/anyspend/utils/token.ts +2 -9
|
@@ -113,11 +113,9 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
113
113
|
const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(searchParams.get("fromAmount") || "5");
|
|
114
114
|
// State for destination chain/token selection
|
|
115
115
|
const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(initialDstChainId);
|
|
116
|
-
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
117
|
-
const isHyperliquidUSDCAddress = (address) => (0, anyspend_1.eqci)(address, anyspend_1.HYPERLIQUID_USDC_ADDRESS) || (0, anyspend_1.eqci)(address, anyspend_1.ZERO_ADDRESS);
|
|
118
116
|
const defaultDstToken = isBuyMode
|
|
119
117
|
? // Special case: Hyperliquid uses zero address for USDC
|
|
120
|
-
destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID &&
|
|
118
|
+
destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(destinationTokenAddress, anyspend_1.ZERO_ADDRESS)
|
|
121
119
|
? (0, anyspend_1.getHyperliquidUSDCToken)()
|
|
122
120
|
: {
|
|
123
121
|
symbol: "",
|
|
@@ -165,7 +163,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
165
163
|
(0, react_4.useEffect)(() => {
|
|
166
164
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
167
165
|
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
168
|
-
if (selectedDstToken.chainId === anyspend_1.HYPERLIQUID_CHAIN_ID &&
|
|
166
|
+
if (selectedDstToken.chainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(selectedDstToken.address, anyspend_1.ZERO_ADDRESS)) {
|
|
169
167
|
appliedDstMetadataRef.current = true;
|
|
170
168
|
return;
|
|
171
169
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CryptoReceiveSection = CryptoReceiveSection;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const anyspend_1 = require("../../../../anyspend");
|
|
6
5
|
const utils_1 = require("../../../../shared/utils");
|
|
7
6
|
const cn_1 = require("../../../../shared/utils/cn");
|
|
8
7
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
@@ -14,7 +13,7 @@ const PointsBadge_1 = require("./PointsBadge");
|
|
|
14
13
|
function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
|
|
15
14
|
return ((0, jsx_runtime_1.jsxs)(react_1.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.shortenAddress)(effectiveRecipientAddress || "") }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }) })) : ((0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
|
|
16
15
|
// Fixed destination token display for buy mode and deposit mode
|
|
17
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.
|
|
16
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.jsx)("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
|
|
18
17
|
// Token selection for regular swap mode
|
|
19
18
|
(0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: effectiveRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyOut?.amountUsd, {
|
|
20
19
|
style: "currency",
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { components } from "../../anyspend/types/api";
|
|
2
2
|
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
3
|
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
4
|
-
/**
|
|
5
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
6
|
-
* instead of the standard 42-character EVM address format.
|
|
7
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
8
|
-
*/
|
|
9
|
-
export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
10
4
|
export declare function isNativeToken(address: string): boolean;
|
|
11
5
|
export declare function getSolanaToken(): components["schemas"]["Token"];
|
|
12
6
|
export declare function getEthToken(chainId: number): components["schemas"]["Token"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
|
|
4
4
|
exports.isNativeToken = isNativeToken;
|
|
5
5
|
exports.getSolanaToken = getSolanaToken;
|
|
6
6
|
exports.getEthToken = getEthToken;
|
|
@@ -13,12 +13,6 @@ const constants_1 = require("../../anyspend/constants");
|
|
|
13
13
|
const chains_1 = require("viem/chains");
|
|
14
14
|
exports.HYPERLIQUID_CHAIN_ID = 1337;
|
|
15
15
|
exports.HYPEREVM_CHAIN_ID = 999;
|
|
16
|
-
/**
|
|
17
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
18
|
-
* instead of the standard 42-character EVM address format.
|
|
19
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
20
|
-
*/
|
|
21
|
-
exports.HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
22
16
|
function isNativeToken(address) {
|
|
23
17
|
return address.toLowerCase() === constants_1.ZERO_ADDRESS || address.toLowerCase() === constants_1.RELAY_SOL_ADDRESS;
|
|
24
18
|
}
|
|
@@ -97,10 +91,10 @@ function getHyperEVMNativeToken() {
|
|
|
97
91
|
function getHyperliquidUSDCToken() {
|
|
98
92
|
return {
|
|
99
93
|
chainId: exports.HYPERLIQUID_CHAIN_ID,
|
|
100
|
-
address:
|
|
94
|
+
address: constants_1.ZERO_ADDRESS,
|
|
101
95
|
symbol: "USDC",
|
|
102
96
|
name: "USD Coin",
|
|
103
|
-
decimals:
|
|
97
|
+
decimals: 6,
|
|
104
98
|
metadata: {
|
|
105
99
|
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
|
|
106
100
|
},
|
|
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7454
7454
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
|
-
[x: `bytes8[${string}]`]: undefined;
|
|
7458
7457
|
[x: `bytes2[${string}]`]: undefined;
|
|
7459
7458
|
[x: `bytes3[${string}]`]: undefined;
|
|
7460
7459
|
[x: `bytes4[${string}]`]: undefined;
|
|
7461
7460
|
[x: `bytes5[${string}]`]: undefined;
|
|
7462
7461
|
[x: `bytes7[${string}]`]: undefined;
|
|
7462
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
7463
7463
|
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7556
7556
|
bytes18?: undefined;
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
|
-
bytes8?: undefined;
|
|
7560
7559
|
bytes2?: undefined;
|
|
7561
7560
|
bytes3?: undefined;
|
|
7562
7561
|
bytes4?: undefined;
|
|
7563
7562
|
bytes5?: undefined;
|
|
7564
7563
|
bytes7?: undefined;
|
|
7564
|
+
bytes8?: undefined;
|
|
7565
7565
|
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID,
|
|
3
|
+
import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, USDC_BASE, ZERO_ADDRESS, } 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";
|
|
@@ -106,11 +106,9 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
106
106
|
const [srcAmountOnRamp, setSrcAmountOnRamp] = useState(searchParams.get("fromAmount") || "5");
|
|
107
107
|
// State for destination chain/token selection
|
|
108
108
|
const [selectedDstChainId, setSelectedDstChainId] = useState(initialDstChainId);
|
|
109
|
-
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
110
|
-
const isHyperliquidUSDCAddress = (address) => eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
|
|
111
109
|
const defaultDstToken = isBuyMode
|
|
112
110
|
? // Special case: Hyperliquid uses zero address for USDC
|
|
113
|
-
destinationTokenChainId === HYPERLIQUID_CHAIN_ID &&
|
|
111
|
+
destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
|
|
114
112
|
? getHyperliquidUSDCToken()
|
|
115
113
|
: {
|
|
116
114
|
symbol: "",
|
|
@@ -158,7 +156,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
158
156
|
useEffect(() => {
|
|
159
157
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
160
158
|
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
161
|
-
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID &&
|
|
159
|
+
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
|
|
162
160
|
appliedDstMetadataRef.current = true;
|
|
163
161
|
return;
|
|
164
162
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ALL_CHAINS } from "../../../../anyspend/index.js";
|
|
3
2
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
3
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
5
4
|
import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
|
|
@@ -11,7 +10,7 @@ import { PointsBadge } from "./PointsBadge.js";
|
|
|
11
10
|
export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
|
|
12
11
|
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "") }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
|
|
13
12
|
// Fixed destination token display for buy mode and deposit mode
|
|
14
|
-
_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
|
|
13
|
+
_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
|
|
15
14
|
// Token selection for regular swap mode
|
|
16
15
|
_jsx(OrderTokenAmount, { address: effectiveRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), _jsxs("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, {
|
|
17
16
|
style: "currency",
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { components } from "../../anyspend/types/api";
|
|
2
2
|
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
3
|
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
4
|
-
/**
|
|
5
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
6
|
-
* instead of the standard 42-character EVM address format.
|
|
7
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
8
|
-
*/
|
|
9
|
-
export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
10
4
|
export declare function isNativeToken(address: string): boolean;
|
|
11
5
|
export declare function getSolanaToken(): components["schemas"]["Token"];
|
|
12
6
|
export declare function getEthToken(chainId: number): components["schemas"]["Token"];
|
|
@@ -2,12 +2,6 @@ import { RELAY_SOL_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS } from "
|
|
|
2
2
|
import { avalanche, bsc, polygon } from "viem/chains";
|
|
3
3
|
export const HYPERLIQUID_CHAIN_ID = 1337;
|
|
4
4
|
export const HYPEREVM_CHAIN_ID = 999;
|
|
5
|
-
/**
|
|
6
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
7
|
-
* instead of the standard 42-character EVM address format.
|
|
8
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
9
|
-
*/
|
|
10
|
-
export const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
11
5
|
export function isNativeToken(address) {
|
|
12
6
|
return address.toLowerCase() === ZERO_ADDRESS || address.toLowerCase() === RELAY_SOL_ADDRESS;
|
|
13
7
|
}
|
|
@@ -86,10 +80,10 @@ export function getHyperEVMNativeToken() {
|
|
|
86
80
|
export function getHyperliquidUSDCToken() {
|
|
87
81
|
return {
|
|
88
82
|
chainId: HYPERLIQUID_CHAIN_ID,
|
|
89
|
-
address:
|
|
83
|
+
address: ZERO_ADDRESS,
|
|
90
84
|
symbol: "USDC",
|
|
91
85
|
name: "USD Coin",
|
|
92
|
-
decimals:
|
|
86
|
+
decimals: 6,
|
|
93
87
|
metadata: {
|
|
94
88
|
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
|
|
95
89
|
},
|
|
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7454
7454
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
|
-
[x: `bytes8[${string}]`]: undefined;
|
|
7458
7457
|
[x: `bytes2[${string}]`]: undefined;
|
|
7459
7458
|
[x: `bytes3[${string}]`]: undefined;
|
|
7460
7459
|
[x: `bytes4[${string}]`]: undefined;
|
|
7461
7460
|
[x: `bytes5[${string}]`]: undefined;
|
|
7462
7461
|
[x: `bytes7[${string}]`]: undefined;
|
|
7462
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
7463
7463
|
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7556
7556
|
bytes18?: undefined;
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
|
-
bytes8?: undefined;
|
|
7560
7559
|
bytes2?: undefined;
|
|
7561
7560
|
bytes3?: undefined;
|
|
7562
7561
|
bytes4?: undefined;
|
|
7563
7562
|
bytes5?: undefined;
|
|
7564
7563
|
bytes7?: undefined;
|
|
7564
|
+
bytes8?: undefined;
|
|
7565
7565
|
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
2
|
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
3
|
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
4
|
-
/**
|
|
5
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
6
|
-
* instead of the standard 42-character EVM address format.
|
|
7
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
8
|
-
*/
|
|
9
|
-
export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
10
4
|
export declare function isNativeToken(address: string): boolean;
|
|
11
5
|
export declare function getSolanaToken(): components["schemas"]["Token"];
|
|
12
6
|
export declare function getEthToken(chainId: number): components["schemas"]["Token"];
|
|
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7454
7454
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
|
-
[x: `bytes8[${string}]`]: undefined;
|
|
7458
7457
|
[x: `bytes2[${string}]`]: undefined;
|
|
7459
7458
|
[x: `bytes3[${string}]`]: undefined;
|
|
7460
7459
|
[x: `bytes4[${string}]`]: undefined;
|
|
7461
7460
|
[x: `bytes5[${string}]`]: undefined;
|
|
7462
7461
|
[x: `bytes7[${string}]`]: undefined;
|
|
7462
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
7463
7463
|
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7556
7556
|
bytes18?: undefined;
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
|
-
bytes8?: undefined;
|
|
7560
7559
|
bytes2?: undefined;
|
|
7561
7560
|
bytes3?: undefined;
|
|
7562
7561
|
bytes4?: undefined;
|
|
7563
7562
|
bytes5?: undefined;
|
|
7564
7563
|
bytes7?: undefined;
|
|
7564
|
+
bytes8?: undefined;
|
|
7565
7565
|
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
getDefaultToken,
|
|
6
6
|
getHyperliquidUSDCToken,
|
|
7
7
|
HYPERLIQUID_CHAIN_ID,
|
|
8
|
-
HYPERLIQUID_USDC_ADDRESS,
|
|
9
8
|
USDC_BASE,
|
|
10
9
|
ZERO_ADDRESS,
|
|
11
10
|
} from "@b3dotfun/sdk/anyspend";
|
|
@@ -231,13 +230,9 @@ function AnySpendInner({
|
|
|
231
230
|
|
|
232
231
|
// State for destination chain/token selection
|
|
233
232
|
const [selectedDstChainId, setSelectedDstChainId] = useState<number>(initialDstChainId);
|
|
234
|
-
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
235
|
-
const isHyperliquidUSDCAddress = (address?: string) =>
|
|
236
|
-
eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
|
|
237
|
-
|
|
238
233
|
const defaultDstToken = isBuyMode
|
|
239
234
|
? // Special case: Hyperliquid uses zero address for USDC
|
|
240
|
-
destinationTokenChainId === HYPERLIQUID_CHAIN_ID &&
|
|
235
|
+
destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
|
|
241
236
|
? getHyperliquidUSDCToken()
|
|
242
237
|
: {
|
|
243
238
|
symbol: "",
|
|
@@ -293,7 +288,7 @@ function AnySpendInner({
|
|
|
293
288
|
useEffect(() => {
|
|
294
289
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
295
290
|
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
296
|
-
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID &&
|
|
291
|
+
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
|
|
297
292
|
appliedDstMetadataRef.current = true;
|
|
298
293
|
return;
|
|
299
294
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
|
|
2
1
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
3
2
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
3
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
@@ -95,21 +94,11 @@ export function CryptoReceiveSection({
|
|
|
95
94
|
<div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
|
|
96
95
|
<div className="bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3">
|
|
97
96
|
{(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/>
|
|
104
|
-
{/* Chain logo overlay */}
|
|
105
|
-
{ALL_CHAINS[dstToken.chainId]?.logoUrl && (
|
|
106
|
-
<img
|
|
107
|
-
src={ALL_CHAINS[dstToken.chainId].logoUrl}
|
|
108
|
-
alt="Chain"
|
|
109
|
-
className="absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white"
|
|
110
|
-
/>
|
|
111
|
-
)}
|
|
112
|
-
</div>
|
|
97
|
+
<img
|
|
98
|
+
src={dstTokenLogoURI || dstToken.metadata?.logoURI}
|
|
99
|
+
alt={dstTokenSymbol || dstToken.symbol}
|
|
100
|
+
className="h-8 w-8 rounded-full"
|
|
101
|
+
/>
|
|
113
102
|
)}
|
|
114
103
|
<span className="text-as-brand text-lg font-bold">{dstTokenSymbol || dstToken.symbol}</span>
|
|
115
104
|
</div>
|
|
@@ -5,13 +5,6 @@ import { avalanche, bsc, polygon } from "viem/chains";
|
|
|
5
5
|
export const HYPERLIQUID_CHAIN_ID = 1337;
|
|
6
6
|
export const HYPEREVM_CHAIN_ID = 999;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
10
|
-
* instead of the standard 42-character EVM address format.
|
|
11
|
-
* This is required by Relay SDK for Hyperliquid integration.
|
|
12
|
-
*/
|
|
13
|
-
export const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
|
|
14
|
-
|
|
15
8
|
export function isNativeToken(address: string): boolean {
|
|
16
9
|
return address.toLowerCase() === ZERO_ADDRESS || address.toLowerCase() === RELAY_SOL_ADDRESS;
|
|
17
10
|
}
|
|
@@ -97,10 +90,10 @@ export function getHyperEVMNativeToken(): components["schemas"]["Token"] {
|
|
|
97
90
|
export function getHyperliquidUSDCToken(): components["schemas"]["Token"] {
|
|
98
91
|
return {
|
|
99
92
|
chainId: HYPERLIQUID_CHAIN_ID,
|
|
100
|
-
address:
|
|
93
|
+
address: ZERO_ADDRESS,
|
|
101
94
|
symbol: "USDC",
|
|
102
95
|
name: "USD Coin",
|
|
103
|
-
decimals:
|
|
96
|
+
decimals: 6,
|
|
104
97
|
metadata: {
|
|
105
98
|
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
|
|
106
99
|
},
|