@basedone/core 0.1.8 → 0.2.0

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.
Files changed (59) hide show
  1. package/dist/chunk-4GAKANLT.mjs +1987 -0
  2. package/dist/chunk-4UEJOM6W.mjs +1 -3
  3. package/dist/chunk-VBC6EQ7Q.mjs +235 -0
  4. package/dist/client-CgmiTuEX.d.mts +179 -0
  5. package/dist/client-CgmiTuEX.d.ts +179 -0
  6. package/dist/ecommerce.d.mts +3732 -0
  7. package/dist/ecommerce.d.ts +3732 -0
  8. package/dist/ecommerce.js +2031 -0
  9. package/dist/ecommerce.mjs +2 -0
  10. package/dist/index.d.mts +79 -4
  11. package/dist/index.d.ts +79 -4
  12. package/dist/index.js +3674 -331
  13. package/dist/index.mjs +107 -104
  14. package/dist/{meta-57AY44US.mjs → meta-JB5ITE27.mjs} +6 -14
  15. package/dist/{meta-RSZFFH63.mjs → meta-UOGUG3OW.mjs} +5 -11
  16. package/dist/{perpDexs-PBKWKKQU.mjs → perpDexs-3LRJ5ZHM.mjs} +100 -13
  17. package/dist/{perpDexs-XSB4Y2BP.mjs → perpDexs-4ISLD7NX.mjs} +798 -121
  18. package/dist/react.d.mts +39 -0
  19. package/dist/react.d.ts +39 -0
  20. package/dist/react.js +268 -0
  21. package/dist/react.mjs +31 -0
  22. package/dist/{spotMeta-WQ4PXRNY.mjs → spotMeta-GHXX7C5M.mjs} +85 -14
  23. package/dist/{spotMeta-Y7G2GI7B.mjs → spotMeta-IBBUP2SG.mjs} +249 -12
  24. package/dist/staticMeta-GM7T3OYL.mjs +3 -6
  25. package/dist/staticMeta-QV2KMX57.mjs +3 -6
  26. package/ecommerce.ts +15 -0
  27. package/index.ts +7 -0
  28. package/lib/cloid/cloid.ts +2 -0
  29. package/lib/ecommerce/QUICK_REFERENCE.md +211 -0
  30. package/lib/ecommerce/README.md +385 -0
  31. package/lib/ecommerce/USAGE_EXAMPLES.md +704 -0
  32. package/lib/ecommerce/client/base.ts +272 -0
  33. package/lib/ecommerce/client/customer.ts +522 -0
  34. package/lib/ecommerce/client/merchant.ts +1341 -0
  35. package/lib/ecommerce/index.ts +51 -0
  36. package/lib/ecommerce/types/entities.ts +722 -0
  37. package/lib/ecommerce/types/enums.ts +270 -0
  38. package/lib/ecommerce/types/index.ts +18 -0
  39. package/lib/ecommerce/types/requests.ts +525 -0
  40. package/lib/ecommerce/types/responses.ts +805 -0
  41. package/lib/ecommerce/utils/errors.ts +113 -0
  42. package/lib/ecommerce/utils/helpers.ts +131 -0
  43. package/lib/fee.ts +10 -10
  44. package/lib/hip3/market-info.ts +36 -8
  45. package/lib/hip3/utils.ts +15 -2
  46. package/lib/instrument/client.ts +351 -0
  47. package/lib/meta/data/mainnet/meta.json +2 -4
  48. package/lib/meta/data/mainnet/perpDexs.json +97 -9
  49. package/lib/meta/data/mainnet/spotMeta.json +82 -8
  50. package/lib/meta/data/testnet/meta.json +3 -7
  51. package/lib/meta/data/testnet/perpDexs.json +795 -117
  52. package/lib/meta/data/testnet/spotMeta.json +246 -6
  53. package/lib/meta/metadata.ts +8 -1
  54. package/lib/meta/types.ts +36 -0
  55. package/lib/react/InstrumentProvider.tsx +69 -0
  56. package/lib/utils/flooredDateTime.ts +55 -0
  57. package/lib/utils/time.ts +51 -0
  58. package/package.json +37 -11
  59. package/react.ts +1 -0
@@ -0,0 +1,2 @@
1
+ export { BannerType, BaseEcommerceClient, CustomerEcommerceClient, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, InventoryAuditAction, MerchantEcommerceClient, MerchantStatus, OrderStatus, PaymentMethod, PaymentStatus, ProductSortBy, ReturnStatus, ReviewSortBy, ReviewStatus, ShipmentStatus, SortOrder, TaxBehavior, TaxReportPeriodType, TaxReportStatus, TaxType, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './chunk-4GAKANLT.mjs';
2
+ import './chunk-4UEJOM6W.mjs';
package/dist/index.d.mts CHANGED
@@ -1,5 +1,8 @@
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
+ export { A as AllPerpsMeta, d as AssetIdUtils, B as BaseInstrument, I as InstrumentClient, M as MarketInstrument, c as PerpsInstrument, P as PerpsMeta, a as PerpsMetaAndAssetCtxs, b as PerpsUniverse, S as SpotInstrument, g as getAllPerpsMeta } from './client-CgmiTuEX.mjs';
4
+ export { AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, ListBannersResponse, ListCouponsResponse, ListCustomersParams, ListCustomersResponse, ListInventoryAuditResponse, ListMediaAssetsResponse, ListMessagesResponse, ListOrdersParams, ListOrdersResponse, ListProductVariantsResponse, ListProductsParams, ListProductsResponse, ListReturnsResponse, ListReviewsParams, ListReviewsResponse, ListShipmentsResponse, ListShippingAddressesResponse, ListShippingMethodsResponse, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProfileRequest, MerchantProfileResponse, MerchantStatus, Message, MessageResponse, Order, OrderEvent, OrderItem, OrderReceiptResponse, OrderStatus, OrdersByStatus, PaginatedResponse, PaginationParams, Payment, PaymentMethod, PaymentStatus, Product, ProductDimensions, ProductDiscountsResponse, ProductMetrics, ProductResponse, ProductReview, ProductSortBy, ProductVariant, ProductVariantResponse, RecentOrderSummary, RespondToReviewRequest, Return, ReturnItem, ReturnResponse, ReturnStatus, RevenueByDay, ReviewResponse, ReviewSortBy, ReviewStatus, SendMessageRequest, Settlement, Shipment, ShipmentResponse, ShipmentStatus, ShippingAddress, ShippingAddressRequest, ShippingAddressResponse, ShippingMethod, ShippingMethodResponse, SortOrder, SuccessResponse, TaxBehavior, TaxBreakdownItem, TaxNexus, TaxNexusResponse, TaxReport, TaxReportDetails, TaxReportPeriodType, TaxReportResponse, TaxReportStatus, TaxRule, TaxRuleResponse, TaxSettings, TaxSettingsResponse, TaxType, TopProduct, TrackBannerRequest, UpdateBannerRequest, UpdateCouponRequest, UpdateOrderResponse, UpdateOrderStatusRequest, UpdateProductRequest, UpdateProductVariantRequest, UpdateShipmentRequest, UpdateShippingMethodRequest, UpdateTaxNexusRequest, UpdateTaxReportStatusRequest, UpdateTaxRuleRequest, UpdateTaxSettingsRequest, UserShippingAddress, ValidateDiscountRequest, ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './ecommerce.mjs';
5
+ import 'axios';
3
6
 
4
7
  declare function encodeSlug(slug: string): bigint;
5
8
  declare function decodeSlug(value: bigint): string;
@@ -45,6 +48,7 @@ declare const CloidClientCode: {
45
48
  readonly Desktop: 7;
46
49
  readonly API: 8;
47
50
  readonly Stream: 9;
51
+ readonly Pal: 10;
48
52
  };
49
53
  type ClientCodeType = keyof typeof CloidClientCode;
50
54
  type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
@@ -82,8 +86,8 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE: number;
82
86
  declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
83
87
  /**
84
88
  * Get the amount of builder fee to approve for
85
- * @param perpetualTradingFee - Perp fee in percentage
86
- * @param spotTradingFee - Spot fee in percentage
89
+ * @param perpetualTradingFee - Perp fee in percentage (0.025 means 0.025% perp fee)
90
+ * @param spotTradingFee - Spot fee in percentage (0.01 means 0.01% spot fee)
87
91
  * @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
88
92
  * @returns {
89
93
  * amount: number; - The amount of builder fee to approve in 1/10 of a basis point
@@ -238,6 +242,34 @@ declare function getNextTierInfo(pupTokenAmount: number, normalizedAirDropAmount
238
242
  declare const USDC_SPOT_TOKEN: SpotToken;
239
243
  declare const TESTNET_USDC_SPOT_TOKEN: SpotToken;
240
244
 
245
+ interface PerpsMeta {
246
+ /** Trading universes available for perpetual trading. */
247
+ universe: PerpsUniverse[];
248
+ /** Margin requirement tables for different leverage tiers. */
249
+ marginTables: MarginTables;
250
+ /** Collateral token index. */
251
+ collateralToken?: number;
252
+ }
253
+ /** Trading universe parameters for perpetual assets. */
254
+ interface PerpsUniverse {
255
+ /** Minimum decimal places for order sizes. */
256
+ szDecimals: number;
257
+ /** Name of the universe. */
258
+ name: string;
259
+ /** Maximum allowed leverage. */
260
+ maxLeverage: number;
261
+ /** Unique identifier for the margin requirements table. */
262
+ marginTableId: number;
263
+ /** Indicates if only isolated margin trading is allowed. */
264
+ onlyIsolated?: true;
265
+ /** Indicates if the universe is delisted. */
266
+ isDelisted?: true;
267
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
268
+ growthMode?: "enabled";
269
+ /** Margin mode for the universe. */
270
+ marginMode?: "strictIsolated" | "noCross";
271
+ }
272
+
241
273
  interface PerpDex {
242
274
  /** Short name of the perpetual dex. */
243
275
  name: string;
@@ -269,6 +301,7 @@ interface MarketInfo {
269
301
  dexDisplayName?: string;
270
302
  dexImageUrl?: string;
271
303
  dexCollateralTokenSymbol?: string;
304
+ growthMode: boolean;
272
305
  }
273
306
  interface DexInfo {
274
307
  meta: PerpsMeta;
@@ -326,6 +359,7 @@ interface MetadataClientConfig {
326
359
  * - HIP-3: 100000 + perp_dex_index * 10000 + index_in_meta
327
360
  */
328
361
  declare const ROOT_DEX = "hyperliquid";
362
+ /**@deprecated use react sdk instead */
329
363
  declare class MetadataClient {
330
364
  private infoClient;
331
365
  private config;
@@ -523,6 +557,47 @@ declare const formatSizeForDisplay: ({ sz, szDecimals, }: {
523
557
  */
524
558
  declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
525
559
 
560
+ type RoundMode = 'floor' | 'round' | 'ceil';
561
+ interface UtcRoundOptions {
562
+ mode?: RoundMode;
563
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
564
+ anchorUtc?: number;
565
+ }
566
+ /**
567
+ * Higher-order UTC rounder.
568
+ * Snaps an instant t to the UTC grid defined by (anchorUtc + k*stepMs).
569
+ * Formula: anchor + step * op((t - anchor)/step)
570
+ */
571
+ declare function makeUtcRounder(stepMs: number, opts?: UtcRoundOptions): (t: Date) => Date;
572
+ declare const floorUtcMinutes: (stepMinutes: number) => (t: Date) => Date;
573
+ declare const floorUtcHour: () => (t: Date) => Date;
574
+ declare const floorUtcDay: () => (t: Date) => Date;
575
+ declare const floorUtcWeek: (weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6) => (t: Date) => Date;
576
+
577
+ declare enum DayOfWeek {
578
+ Sunday = 0,
579
+ Monday = 1,
580
+ Tuesday = 2,
581
+ Wednesday = 3,
582
+ Thursday = 4,
583
+ Friday = 5,
584
+ Saturday = 6
585
+ }
586
+ interface WeekInfo {
587
+ weekNumber: number;
588
+ startDate: Date;
589
+ endDate: Date;
590
+ }
591
+ /**
592
+ * Gets the latest completed week information.
593
+ *
594
+ * @param currentTimestamp - Optional timestamp in milliseconds. If not provided, uses current time.
595
+ * @param offset - Optional number of weeks to offset (0 = latest completed week, 1 = previous week, etc.)
596
+ * @param weekStartsOn - Day of week the week should start on. Defaults to Thursday.
597
+ * @returns WeekInfo with weekNumber, startDate, and endDate
598
+ */
599
+ declare function getLatestCompletedWeek(currentTimestamp?: number, offset?: number, weekStartsOn?: DayOfWeek): WeekInfo;
600
+
526
601
  declare function isHip3Symbol(symbol: string | undefined): boolean;
527
602
  declare function getHip3Dex(symbol: string): string | null;
528
603
  /**
@@ -568,4 +643,4 @@ declare function isStableQuoteToken(coin: string): boolean;
568
643
  declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
569
644
  declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
570
645
 
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 };
646
+ export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, DayOfWeek, 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, type WeekInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
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
+ export { A as AllPerpsMeta, d as AssetIdUtils, B as BaseInstrument, I as InstrumentClient, M as MarketInstrument, c as PerpsInstrument, P as PerpsMeta, a as PerpsMetaAndAssetCtxs, b as PerpsUniverse, S as SpotInstrument, g as getAllPerpsMeta } from './client-CgmiTuEX.js';
4
+ export { AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, ListBannersResponse, ListCouponsResponse, ListCustomersParams, ListCustomersResponse, ListInventoryAuditResponse, ListMediaAssetsResponse, ListMessagesResponse, ListOrdersParams, ListOrdersResponse, ListProductVariantsResponse, ListProductsParams, ListProductsResponse, ListReturnsResponse, ListReviewsParams, ListReviewsResponse, ListShipmentsResponse, ListShippingAddressesResponse, ListShippingMethodsResponse, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProfileRequest, MerchantProfileResponse, MerchantStatus, Message, MessageResponse, Order, OrderEvent, OrderItem, OrderReceiptResponse, OrderStatus, OrdersByStatus, PaginatedResponse, PaginationParams, Payment, PaymentMethod, PaymentStatus, Product, ProductDimensions, ProductDiscountsResponse, ProductMetrics, ProductResponse, ProductReview, ProductSortBy, ProductVariant, ProductVariantResponse, RecentOrderSummary, RespondToReviewRequest, Return, ReturnItem, ReturnResponse, ReturnStatus, RevenueByDay, ReviewResponse, ReviewSortBy, ReviewStatus, SendMessageRequest, Settlement, Shipment, ShipmentResponse, ShipmentStatus, ShippingAddress, ShippingAddressRequest, ShippingAddressResponse, ShippingMethod, ShippingMethodResponse, SortOrder, SuccessResponse, TaxBehavior, TaxBreakdownItem, TaxNexus, TaxNexusResponse, TaxReport, TaxReportDetails, TaxReportPeriodType, TaxReportResponse, TaxReportStatus, TaxRule, TaxRuleResponse, TaxSettings, TaxSettingsResponse, TaxType, TopProduct, TrackBannerRequest, UpdateBannerRequest, UpdateCouponRequest, UpdateOrderResponse, UpdateOrderStatusRequest, UpdateProductRequest, UpdateProductVariantRequest, UpdateShipmentRequest, UpdateShippingMethodRequest, UpdateTaxNexusRequest, UpdateTaxReportStatusRequest, UpdateTaxRuleRequest, UpdateTaxSettingsRequest, UserShippingAddress, ValidateDiscountRequest, ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './ecommerce.js';
5
+ import 'axios';
3
6
 
4
7
  declare function encodeSlug(slug: string): bigint;
5
8
  declare function decodeSlug(value: bigint): string;
@@ -45,6 +48,7 @@ declare const CloidClientCode: {
45
48
  readonly Desktop: 7;
46
49
  readonly API: 8;
47
50
  readonly Stream: 9;
51
+ readonly Pal: 10;
48
52
  };
49
53
  type ClientCodeType = keyof typeof CloidClientCode;
50
54
  type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
@@ -82,8 +86,8 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE: number;
82
86
  declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
83
87
  /**
84
88
  * Get the amount of builder fee to approve for
85
- * @param perpetualTradingFee - Perp fee in percentage
86
- * @param spotTradingFee - Spot fee in percentage
89
+ * @param perpetualTradingFee - Perp fee in percentage (0.025 means 0.025% perp fee)
90
+ * @param spotTradingFee - Spot fee in percentage (0.01 means 0.01% spot fee)
87
91
  * @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
88
92
  * @returns {
89
93
  * amount: number; - The amount of builder fee to approve in 1/10 of a basis point
@@ -238,6 +242,34 @@ declare function getNextTierInfo(pupTokenAmount: number, normalizedAirDropAmount
238
242
  declare const USDC_SPOT_TOKEN: SpotToken;
239
243
  declare const TESTNET_USDC_SPOT_TOKEN: SpotToken;
240
244
 
245
+ interface PerpsMeta {
246
+ /** Trading universes available for perpetual trading. */
247
+ universe: PerpsUniverse[];
248
+ /** Margin requirement tables for different leverage tiers. */
249
+ marginTables: MarginTables;
250
+ /** Collateral token index. */
251
+ collateralToken?: number;
252
+ }
253
+ /** Trading universe parameters for perpetual assets. */
254
+ interface PerpsUniverse {
255
+ /** Minimum decimal places for order sizes. */
256
+ szDecimals: number;
257
+ /** Name of the universe. */
258
+ name: string;
259
+ /** Maximum allowed leverage. */
260
+ maxLeverage: number;
261
+ /** Unique identifier for the margin requirements table. */
262
+ marginTableId: number;
263
+ /** Indicates if only isolated margin trading is allowed. */
264
+ onlyIsolated?: true;
265
+ /** Indicates if the universe is delisted. */
266
+ isDelisted?: true;
267
+ /** Indicates if the universe is in growth mode, eligible for discounted fees */
268
+ growthMode?: "enabled";
269
+ /** Margin mode for the universe. */
270
+ marginMode?: "strictIsolated" | "noCross";
271
+ }
272
+
241
273
  interface PerpDex {
242
274
  /** Short name of the perpetual dex. */
243
275
  name: string;
@@ -269,6 +301,7 @@ interface MarketInfo {
269
301
  dexDisplayName?: string;
270
302
  dexImageUrl?: string;
271
303
  dexCollateralTokenSymbol?: string;
304
+ growthMode: boolean;
272
305
  }
273
306
  interface DexInfo {
274
307
  meta: PerpsMeta;
@@ -326,6 +359,7 @@ interface MetadataClientConfig {
326
359
  * - HIP-3: 100000 + perp_dex_index * 10000 + index_in_meta
327
360
  */
328
361
  declare const ROOT_DEX = "hyperliquid";
362
+ /**@deprecated use react sdk instead */
329
363
  declare class MetadataClient {
330
364
  private infoClient;
331
365
  private config;
@@ -523,6 +557,47 @@ declare const formatSizeForDisplay: ({ sz, szDecimals, }: {
523
557
  */
524
558
  declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
525
559
 
560
+ type RoundMode = 'floor' | 'round' | 'ceil';
561
+ interface UtcRoundOptions {
562
+ mode?: RoundMode;
563
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
564
+ anchorUtc?: number;
565
+ }
566
+ /**
567
+ * Higher-order UTC rounder.
568
+ * Snaps an instant t to the UTC grid defined by (anchorUtc + k*stepMs).
569
+ * Formula: anchor + step * op((t - anchor)/step)
570
+ */
571
+ declare function makeUtcRounder(stepMs: number, opts?: UtcRoundOptions): (t: Date) => Date;
572
+ declare const floorUtcMinutes: (stepMinutes: number) => (t: Date) => Date;
573
+ declare const floorUtcHour: () => (t: Date) => Date;
574
+ declare const floorUtcDay: () => (t: Date) => Date;
575
+ declare const floorUtcWeek: (weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6) => (t: Date) => Date;
576
+
577
+ declare enum DayOfWeek {
578
+ Sunday = 0,
579
+ Monday = 1,
580
+ Tuesday = 2,
581
+ Wednesday = 3,
582
+ Thursday = 4,
583
+ Friday = 5,
584
+ Saturday = 6
585
+ }
586
+ interface WeekInfo {
587
+ weekNumber: number;
588
+ startDate: Date;
589
+ endDate: Date;
590
+ }
591
+ /**
592
+ * Gets the latest completed week information.
593
+ *
594
+ * @param currentTimestamp - Optional timestamp in milliseconds. If not provided, uses current time.
595
+ * @param offset - Optional number of weeks to offset (0 = latest completed week, 1 = previous week, etc.)
596
+ * @param weekStartsOn - Day of week the week should start on. Defaults to Thursday.
597
+ * @returns WeekInfo with weekNumber, startDate, and endDate
598
+ */
599
+ declare function getLatestCompletedWeek(currentTimestamp?: number, offset?: number, weekStartsOn?: DayOfWeek): WeekInfo;
600
+
526
601
  declare function isHip3Symbol(symbol: string | undefined): boolean;
527
602
  declare function getHip3Dex(symbol: string): string | null;
528
603
  /**
@@ -568,4 +643,4 @@ declare function isStableQuoteToken(coin: string): boolean;
568
643
  declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
569
644
  declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
570
645
 
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 };
646
+ export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, DayOfWeek, 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, type WeekInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };