@b3dotfun/sdk 0.0.83-alpha.6 → 0.0.83-alpha.7

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.
@@ -114,14 +114,17 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
114
114
  // State for destination chain/token selection
115
115
  const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(initialDstChainId);
116
116
  const defaultDstToken = isBuyMode
117
- ? {
118
- symbol: "",
119
- chainId: destinationTokenChainId,
120
- address: destinationTokenAddress,
121
- name: "",
122
- decimals: 18,
123
- metadata: {},
124
- }
117
+ ? // Special case: Hyperliquid uses zero address for USDC
118
+ destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(destinationTokenAddress, anyspend_1.ZERO_ADDRESS)
119
+ ? (0, anyspend_1.getHyperliquidUSDCToken)()
120
+ : {
121
+ symbol: "",
122
+ chainId: destinationTokenChainId,
123
+ address: destinationTokenAddress,
124
+ name: "",
125
+ decimals: 18,
126
+ metadata: {},
127
+ }
125
128
  : (0, anyspend_1.getDefaultToken)(selectedDstChainId);
126
129
  const dstTokenFromUrl = (0, react_2.useTokenFromUrl)({
127
130
  defaultToken: defaultDstToken,
@@ -159,6 +162,11 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
159
162
  // Update destination token with metadata
160
163
  (0, react_4.useEffect)(() => {
161
164
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
165
+ // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
166
+ if (selectedDstToken.chainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(selectedDstToken.address, anyspend_1.ZERO_ADDRESS)) {
167
+ appliedDstMetadataRef.current = true;
168
+ return;
169
+ }
162
170
  // Mark as applied
163
171
  appliedDstMetadataRef.current = true;
164
172
  const enhancedToken = {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { getDefaultToken, HYPERLIQUID_CHAIN_ID, USDC_BASE } from "../../../anyspend/index.js";
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";
@@ -107,14 +107,17 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
107
107
  // State for destination chain/token selection
108
108
  const [selectedDstChainId, setSelectedDstChainId] = useState(initialDstChainId);
109
109
  const defaultDstToken = isBuyMode
110
- ? {
111
- symbol: "",
112
- chainId: destinationTokenChainId,
113
- address: destinationTokenAddress,
114
- name: "",
115
- decimals: 18,
116
- metadata: {},
117
- }
110
+ ? // Special case: Hyperliquid uses zero address for USDC
111
+ destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
112
+ ? getHyperliquidUSDCToken()
113
+ : {
114
+ symbol: "",
115
+ chainId: destinationTokenChainId,
116
+ address: destinationTokenAddress,
117
+ name: "",
118
+ decimals: 18,
119
+ metadata: {},
120
+ }
118
121
  : getDefaultToken(selectedDstChainId);
119
122
  const dstTokenFromUrl = useTokenFromUrl({
120
123
  defaultToken: defaultDstToken,
@@ -152,6 +155,11 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
152
155
  // Update destination token with metadata
153
156
  useEffect(() => {
154
157
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
158
+ // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
159
+ if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
160
+ appliedDstMetadataRef.current = true;
161
+ return;
162
+ }
155
163
  // Mark as applied
156
164
  appliedDstMetadataRef.current = true;
157
165
  const enhancedToken = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.83-alpha.6",
3
+ "version": "0.0.83-alpha.7",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -1,6 +1,13 @@
1
1
  "use client";
2
2
 
3
- import { getDefaultToken, HYPERLIQUID_CHAIN_ID, USDC_BASE } from "@b3dotfun/sdk/anyspend";
3
+ import {
4
+ eqci,
5
+ getDefaultToken,
6
+ getHyperliquidUSDCToken,
7
+ HYPERLIQUID_CHAIN_ID,
8
+ USDC_BASE,
9
+ ZERO_ADDRESS,
10
+ } from "@b3dotfun/sdk/anyspend";
4
11
  import {
5
12
  useAnyspendCreateOnrampOrder,
6
13
  useAnyspendCreateOrder,
@@ -224,14 +231,17 @@ function AnySpendInner({
224
231
  // State for destination chain/token selection
225
232
  const [selectedDstChainId, setSelectedDstChainId] = useState<number>(initialDstChainId);
226
233
  const defaultDstToken = isBuyMode
227
- ? {
228
- symbol: "",
229
- chainId: destinationTokenChainId,
230
- address: destinationTokenAddress,
231
- name: "",
232
- decimals: 18,
233
- metadata: {},
234
- }
234
+ ? // Special case: Hyperliquid uses zero address for USDC
235
+ destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
236
+ ? getHyperliquidUSDCToken()
237
+ : {
238
+ symbol: "",
239
+ chainId: destinationTokenChainId,
240
+ address: destinationTokenAddress,
241
+ name: "",
242
+ decimals: 18,
243
+ metadata: {},
244
+ }
235
245
  : getDefaultToken(selectedDstChainId);
236
246
  const dstTokenFromUrl = useTokenFromUrl({
237
247
  defaultToken: defaultDstToken,
@@ -277,6 +287,12 @@ function AnySpendInner({
277
287
  // Update destination token with metadata
278
288
  useEffect(() => {
279
289
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
290
+ // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
291
+ if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
292
+ appliedDstMetadataRef.current = true;
293
+ return;
294
+ }
295
+
280
296
  // Mark as applied
281
297
  appliedDstMetadataRef.current = true;
282
298