@basedone/core 0.1.8 → 0.1.10

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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
1
+ import { SpotToken, MarginTables, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
2
2
  import { Hex } from '@nktkas/hyperliquid/types';
3
3
 
4
4
  declare function encodeSlug(slug: string): bigint;
@@ -45,6 +45,7 @@ declare const CloidClientCode: {
45
45
  readonly Desktop: 7;
46
46
  readonly API: 8;
47
47
  readonly Stream: 9;
48
+ readonly Pal: 10;
48
49
  };
49
50
  type ClientCodeType = keyof typeof CloidClientCode;
50
51
  type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
@@ -82,8 +83,8 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE: number;
82
83
  declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
83
84
  /**
84
85
  * Get the amount of builder fee to approve for
85
- * @param perpetualTradingFee - Perp fee in percentage
86
- * @param spotTradingFee - Spot fee in percentage
86
+ * @param perpetualTradingFee - Perp fee in percentage (0.025 means 0.025% perp fee)
87
+ * @param spotTradingFee - Spot fee in percentage (0.01 means 0.01% spot fee)
87
88
  * @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
88
89
  * @returns {
89
90
  * amount: number; - The amount of builder fee to approve in 1/10 of a basis point
@@ -238,6 +239,34 @@ declare function getNextTierInfo(pupTokenAmount: number, normalizedAirDropAmount
238
239
  declare const USDC_SPOT_TOKEN: SpotToken;
239
240
  declare const TESTNET_USDC_SPOT_TOKEN: SpotToken;
240
241
 
242
+ interface PerpsMeta$1 {
243
+ /** Trading universes available for perpetual trading. */
244
+ universe: PerpsUniverse$1[];
245
+ /** Margin requirement tables for different leverage tiers. */
246
+ marginTables: MarginTables;
247
+ /** Collateral token index. */
248
+ collateralToken?: number;
249
+ }
250
+ /** Trading universe parameters for perpetual assets. */
251
+ interface PerpsUniverse$1 {
252
+ /** Minimum decimal places for order sizes. */
253
+ szDecimals: number;
254
+ /** Name of the universe. */
255
+ name: string;
256
+ /** Maximum allowed leverage. */
257
+ maxLeverage: number;
258
+ /** Unique identifier for the margin requirements table. */
259
+ marginTableId: number;
260
+ /** Indicates if only isolated margin trading is allowed. */
261
+ onlyIsolated?: true;
262
+ /** Indicates if the universe is delisted. */
263
+ isDelisted?: true;
264
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
265
+ growthMode?: "enabled";
266
+ /** Margin mode for the universe. */
267
+ marginMode?: "strictIsolated" | "noCross";
268
+ }
269
+
241
270
  interface PerpDex {
242
271
  /** Short name of the perpetual dex. */
243
272
  name: string;
@@ -269,9 +298,10 @@ interface MarketInfo {
269
298
  dexDisplayName?: string;
270
299
  dexImageUrl?: string;
271
300
  dexCollateralTokenSymbol?: string;
301
+ growthMode: boolean;
272
302
  }
273
303
  interface DexInfo {
274
- meta: PerpsMeta;
304
+ meta: PerpsMeta$1;
275
305
  assetContext: PerpsAssetCtx[];
276
306
  dexFullName: string;
277
307
  dexName: string;
@@ -281,7 +311,7 @@ interface DexInfo {
281
311
  imageUrl?: string;
282
312
  accountName?: string;
283
313
  }
284
- type ExtendedPerpsMeta = PerpsMeta & {
314
+ type ExtendedPerpsMeta = PerpsMeta$1 & {
285
315
  collateralToken?: number;
286
316
  };
287
317
  /**
@@ -326,6 +356,7 @@ interface MetadataClientConfig {
326
356
  * - HIP-3: 100000 + perp_dex_index * 10000 + index_in_meta
327
357
  */
328
358
  declare const ROOT_DEX = "hyperliquid";
359
+ /**@deprecated use react sdk instead */
329
360
  declare class MetadataClient {
330
361
  private infoClient;
331
362
  private config;
@@ -430,7 +461,7 @@ declare class MetadataClient {
430
461
  */
431
462
  getRawMetadata(): {
432
463
  spotMeta: SpotMeta | null;
433
- perpsMeta: PerpsMeta | null;
464
+ perpsMeta: PerpsMeta$1 | null;
434
465
  perpDexs: (PerpDex | null)[];
435
466
  hip3DexsMeta: {
436
467
  [k: string]: DexInfo;
@@ -568,4 +599,40 @@ declare function isStableQuoteToken(coin: string): boolean;
568
599
  declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
569
600
  declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
570
601
 
571
- export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
602
+ interface PerpsMeta {
603
+ collateralToken: number;
604
+ /** Trading universes available for perpetual trading. */
605
+ universe: PerpsUniverse[];
606
+ /** Margin requirement tables for different leverage tiers. */
607
+ marginTables: MarginTables;
608
+ }
609
+ /** Metadata and context for perpetual assets. */
610
+ type PerpsMetaAndAssetCtxs = [
611
+ /** Metadata for assets. */
612
+ PerpsMeta,
613
+ /** Context for each perpetual asset. */
614
+ PerpsAssetCtx[]
615
+ ];
616
+ /** Trading universe parameters for perpetual assets. */
617
+ interface PerpsUniverse {
618
+ /** Minimum decimal places for order sizes. */
619
+ szDecimals: number;
620
+ /** Name of the universe. */
621
+ name: string;
622
+ /** Maximum allowed leverage. */
623
+ maxLeverage: number;
624
+ /** Unique identifier for the margin requirements table. */
625
+ marginTableId: number;
626
+ /** Indicates if only isolated margin trading is allowed. */
627
+ onlyIsolated?: true;
628
+ /** Indicates if the universe is delisted. */
629
+ isDelisted?: true;
630
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
631
+ growthMode?: true;
632
+ /** Margin mode for the universe. */
633
+ marginMode?: "strictIsolated" | "noCross";
634
+ }
635
+ type AllPerpsMeta = PerpsMeta[];
636
+ declare function getAllPerpsMeta(infoClient: InfoClient): Promise<AllPerpsMeta>;
637
+
638
+ export { type AirdropAllocationData, type AllPerpsMeta, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PerpsMeta, type PerpsMetaAndAssetCtxs, type PerpsUniverse, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
1
+ import { SpotToken, MarginTables, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
2
2
  import { Hex } from '@nktkas/hyperliquid/types';
3
3
 
4
4
  declare function encodeSlug(slug: string): bigint;
@@ -45,6 +45,7 @@ declare const CloidClientCode: {
45
45
  readonly Desktop: 7;
46
46
  readonly API: 8;
47
47
  readonly Stream: 9;
48
+ readonly Pal: 10;
48
49
  };
49
50
  type ClientCodeType = keyof typeof CloidClientCode;
50
51
  type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
@@ -82,8 +83,8 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE: number;
82
83
  declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
83
84
  /**
84
85
  * Get the amount of builder fee to approve for
85
- * @param perpetualTradingFee - Perp fee in percentage
86
- * @param spotTradingFee - Spot fee in percentage
86
+ * @param perpetualTradingFee - Perp fee in percentage (0.025 means 0.025% perp fee)
87
+ * @param spotTradingFee - Spot fee in percentage (0.01 means 0.01% spot fee)
87
88
  * @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
88
89
  * @returns {
89
90
  * amount: number; - The amount of builder fee to approve in 1/10 of a basis point
@@ -238,6 +239,34 @@ declare function getNextTierInfo(pupTokenAmount: number, normalizedAirDropAmount
238
239
  declare const USDC_SPOT_TOKEN: SpotToken;
239
240
  declare const TESTNET_USDC_SPOT_TOKEN: SpotToken;
240
241
 
242
+ interface PerpsMeta$1 {
243
+ /** Trading universes available for perpetual trading. */
244
+ universe: PerpsUniverse$1[];
245
+ /** Margin requirement tables for different leverage tiers. */
246
+ marginTables: MarginTables;
247
+ /** Collateral token index. */
248
+ collateralToken?: number;
249
+ }
250
+ /** Trading universe parameters for perpetual assets. */
251
+ interface PerpsUniverse$1 {
252
+ /** Minimum decimal places for order sizes. */
253
+ szDecimals: number;
254
+ /** Name of the universe. */
255
+ name: string;
256
+ /** Maximum allowed leverage. */
257
+ maxLeverage: number;
258
+ /** Unique identifier for the margin requirements table. */
259
+ marginTableId: number;
260
+ /** Indicates if only isolated margin trading is allowed. */
261
+ onlyIsolated?: true;
262
+ /** Indicates if the universe is delisted. */
263
+ isDelisted?: true;
264
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
265
+ growthMode?: "enabled";
266
+ /** Margin mode for the universe. */
267
+ marginMode?: "strictIsolated" | "noCross";
268
+ }
269
+
241
270
  interface PerpDex {
242
271
  /** Short name of the perpetual dex. */
243
272
  name: string;
@@ -269,9 +298,10 @@ interface MarketInfo {
269
298
  dexDisplayName?: string;
270
299
  dexImageUrl?: string;
271
300
  dexCollateralTokenSymbol?: string;
301
+ growthMode: boolean;
272
302
  }
273
303
  interface DexInfo {
274
- meta: PerpsMeta;
304
+ meta: PerpsMeta$1;
275
305
  assetContext: PerpsAssetCtx[];
276
306
  dexFullName: string;
277
307
  dexName: string;
@@ -281,7 +311,7 @@ interface DexInfo {
281
311
  imageUrl?: string;
282
312
  accountName?: string;
283
313
  }
284
- type ExtendedPerpsMeta = PerpsMeta & {
314
+ type ExtendedPerpsMeta = PerpsMeta$1 & {
285
315
  collateralToken?: number;
286
316
  };
287
317
  /**
@@ -326,6 +356,7 @@ interface MetadataClientConfig {
326
356
  * - HIP-3: 100000 + perp_dex_index * 10000 + index_in_meta
327
357
  */
328
358
  declare const ROOT_DEX = "hyperliquid";
359
+ /**@deprecated use react sdk instead */
329
360
  declare class MetadataClient {
330
361
  private infoClient;
331
362
  private config;
@@ -430,7 +461,7 @@ declare class MetadataClient {
430
461
  */
431
462
  getRawMetadata(): {
432
463
  spotMeta: SpotMeta | null;
433
- perpsMeta: PerpsMeta | null;
464
+ perpsMeta: PerpsMeta$1 | null;
434
465
  perpDexs: (PerpDex | null)[];
435
466
  hip3DexsMeta: {
436
467
  [k: string]: DexInfo;
@@ -568,4 +599,40 @@ declare function isStableQuoteToken(coin: string): boolean;
568
599
  declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
569
600
  declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
570
601
 
571
- export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
602
+ interface PerpsMeta {
603
+ collateralToken: number;
604
+ /** Trading universes available for perpetual trading. */
605
+ universe: PerpsUniverse[];
606
+ /** Margin requirement tables for different leverage tiers. */
607
+ marginTables: MarginTables;
608
+ }
609
+ /** Metadata and context for perpetual assets. */
610
+ type PerpsMetaAndAssetCtxs = [
611
+ /** Metadata for assets. */
612
+ PerpsMeta,
613
+ /** Context for each perpetual asset. */
614
+ PerpsAssetCtx[]
615
+ ];
616
+ /** Trading universe parameters for perpetual assets. */
617
+ interface PerpsUniverse {
618
+ /** Minimum decimal places for order sizes. */
619
+ szDecimals: number;
620
+ /** Name of the universe. */
621
+ name: string;
622
+ /** Maximum allowed leverage. */
623
+ maxLeverage: number;
624
+ /** Unique identifier for the margin requirements table. */
625
+ marginTableId: number;
626
+ /** Indicates if only isolated margin trading is allowed. */
627
+ onlyIsolated?: true;
628
+ /** Indicates if the universe is delisted. */
629
+ isDelisted?: true;
630
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
631
+ growthMode?: true;
632
+ /** Margin mode for the universe. */
633
+ marginMode?: "strictIsolated" | "noCross";
634
+ }
635
+ type AllPerpsMeta = PerpsMeta[];
636
+ declare function getAllPerpsMeta(infoClient: InfoClient): Promise<AllPerpsMeta>;
637
+
638
+ export { type AirdropAllocationData, type AllPerpsMeta, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PerpsMeta, type PerpsMetaAndAssetCtxs, type PerpsUniverse, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };