@basedone/core 0.1.5 → 0.1.8
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 +49 -3
- package/dist/index.d.ts +49 -3
- package/dist/index.js +3048 -259
- package/dist/index.mjs +97 -16
- package/dist/{meta-CDVVRMMG.mjs → meta-57AY44US.mjs} +66 -29
- package/dist/{meta-HEOHBPHS.mjs → meta-RSZFFH63.mjs} +102 -72
- package/dist/perpDexs-PBKWKKQU.mjs +201 -0
- package/dist/perpDexs-XSB4Y2BP.mjs +2298 -0
- package/dist/{spotMeta-NK626IKQ.mjs → spotMeta-WQ4PXRNY.mjs} +290 -4
- package/dist/{spotMeta-4LMKHJUT.mjs → spotMeta-Y7G2GI7B.mjs} +551 -3
- package/lib/fee.ts +30 -3
- package/lib/hip3/market-info.ts +13 -21
- package/lib/hip3/utils.ts +75 -1
- package/lib/meta/data/mainnet/meta.json +102 -72
- package/lib/meta/data/mainnet/perpDexs.json +183 -4
- package/lib/meta/data/mainnet/spotMeta.json +290 -4
- package/lib/meta/data/testnet/meta.json +66 -29
- package/lib/meta/data/testnet/perpDexs.json +1755 -136
- package/lib/meta/data/testnet/spotMeta.json +551 -3
- package/lib/utils/formatter.ts +46 -0
- package/package.json +1 -1
- package/dist/perpDexs-G5YWV3II.mjs +0 -22
- package/dist/perpDexs-PGY6VMYS.mjs +0 -679
package/dist/index.d.mts
CHANGED
|
@@ -84,15 +84,17 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
|
|
|
84
84
|
* Get the amount of builder fee to approve for
|
|
85
85
|
* @param perpetualTradingFee - Perp fee in percentage
|
|
86
86
|
* @param spotTradingFee - Spot fee in percentage
|
|
87
|
+
* @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
|
|
87
88
|
* @returns {
|
|
88
89
|
* amount: number; - The amount of builder fee to approve in 1/10 of a basis point
|
|
89
90
|
* percent: string; - eg. String input to approve fee, "0.1%"
|
|
90
91
|
* }
|
|
91
92
|
*/
|
|
92
|
-
declare const getApprovalAmount: ({ customFeeEnabled, perpetualTradingFee, spotTradingFee, }: {
|
|
93
|
+
declare const getApprovalAmount: ({ customFeeEnabled, perpetualTradingFee, spotTradingFee, feeDiscount, }: {
|
|
93
94
|
customFeeEnabled: boolean;
|
|
94
95
|
perpetualTradingFee?: number;
|
|
95
96
|
spotTradingFee?: number;
|
|
97
|
+
feeDiscount?: number;
|
|
96
98
|
}) => {
|
|
97
99
|
approvalAmount: number;
|
|
98
100
|
approvalPercent: `${string}%`;
|
|
@@ -471,6 +473,18 @@ declare const formatPriceForOrder: ({ px, szDecimals, isSpot, }: {
|
|
|
471
473
|
szDecimals: number;
|
|
472
474
|
isSpot: boolean;
|
|
473
475
|
}) => number;
|
|
476
|
+
/**
|
|
477
|
+
* Formats price for order placement following Hyperliquid rules
|
|
478
|
+
* - Rounded to priceDecimals of the asset
|
|
479
|
+
* @param px - The price to format
|
|
480
|
+
* @param priceDecimals - Price decimals for the asset
|
|
481
|
+
* @returns Formatted price as number (rounded to priceDecimals if exceeds)
|
|
482
|
+
*/
|
|
483
|
+
declare const formatPriceForDisplay: ({ px, szDecimals, isSpot, }: {
|
|
484
|
+
px: number;
|
|
485
|
+
szDecimals: number;
|
|
486
|
+
isSpot: boolean;
|
|
487
|
+
}) => string;
|
|
474
488
|
/**
|
|
475
489
|
* Formats size for order placement following Hyperliquid rules
|
|
476
490
|
* - Rounded to szDecimals of the asset
|
|
@@ -482,6 +496,17 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
482
496
|
sz: number;
|
|
483
497
|
szDecimals: number;
|
|
484
498
|
}) => number;
|
|
499
|
+
/**
|
|
500
|
+
* Formats size for order placement following Hyperliquid rules
|
|
501
|
+
* - Rounded to szDecimals of the asset
|
|
502
|
+
* @param sz - The size to format
|
|
503
|
+
* @param szDecimals - Size decimals for the asset
|
|
504
|
+
* @returns Formatted size as number (rounded down to szDecimals if exceeds)
|
|
505
|
+
*/
|
|
506
|
+
declare const formatSizeForDisplay: ({ sz, szDecimals, }: {
|
|
507
|
+
sz: number;
|
|
508
|
+
szDecimals: number;
|
|
509
|
+
}) => string;
|
|
485
510
|
/**
|
|
486
511
|
* Get minimum price decimals for tick size calculations
|
|
487
512
|
* Uses the same logic as internal price formatting
|
|
@@ -498,7 +523,7 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
498
523
|
*/
|
|
499
524
|
declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
|
|
500
525
|
|
|
501
|
-
declare function isHip3Symbol(symbol: string): boolean;
|
|
526
|
+
declare function isHip3Symbol(symbol: string | undefined): boolean;
|
|
502
527
|
declare function getHip3Dex(symbol: string): string | null;
|
|
503
528
|
/**
|
|
504
529
|
* Enable HIP-3 DEX abstraction with the current agent wallet
|
|
@@ -521,5 +546,26 @@ declare const UserDexAbstractionTypes: {
|
|
|
521
546
|
*/
|
|
522
547
|
declare function setHip3DexAbstraction(client: ExchangeClient, enabled: boolean, user: string): Promise<SuccessResponse>;
|
|
523
548
|
declare function getHip3DexAbstraction(client: InfoClient, user: string): Promise<boolean | null>;
|
|
549
|
+
declare const isSpotSymbol: (coin: string | undefined) => boolean;
|
|
550
|
+
declare function getStaticCollateralTokenByDex(dex: string): string;
|
|
551
|
+
/**
|
|
552
|
+
* Get static collateral token symbol for a given coin
|
|
553
|
+
* @param coin - The coin symbol to get the collateral token symbol for eg. xyz:XYZ100
|
|
554
|
+
* @returns The collateral token symbol for the given coin
|
|
555
|
+
*/
|
|
556
|
+
declare function getStaticCollateralTokenSymbol(coin: string | undefined): string;
|
|
557
|
+
declare const stableQuoteTokens: string[];
|
|
558
|
+
declare function isStableQuoteToken(coin: string): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Get display market symbol for a given coin
|
|
561
|
+
* @param coin - The coin symbol to get the display market symbol for eg. xyz:XYZ100
|
|
562
|
+
* @param showCollateralTokenSymbol - Whether to show the collateral token symbol. Default is true.
|
|
563
|
+
* @returns
|
|
564
|
+
* HIP-3 symbol: The display market symbol for the given coin eg. XYZ100-USDC, BTC-USDE, etc.
|
|
565
|
+
* If showCollateralTokenSymbol is false, returns the symbol without the collateral token symbol. eg. rrrrr:BTC -> BTC, hyena:BTC -> BTC
|
|
566
|
+
* Spot symbol: returns the coin argument itself
|
|
567
|
+
*/
|
|
568
|
+
declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
|
|
569
|
+
declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
|
|
524
570
|
|
|
525
|
-
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, formatPriceForOrder, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,15 +84,17 @@ declare const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = "0.1%";
|
|
|
84
84
|
* Get the amount of builder fee to approve for
|
|
85
85
|
* @param perpetualTradingFee - Perp fee in percentage
|
|
86
86
|
* @param spotTradingFee - Spot fee in percentage
|
|
87
|
+
* @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
|
|
87
88
|
* @returns {
|
|
88
89
|
* amount: number; - The amount of builder fee to approve in 1/10 of a basis point
|
|
89
90
|
* percent: string; - eg. String input to approve fee, "0.1%"
|
|
90
91
|
* }
|
|
91
92
|
*/
|
|
92
|
-
declare const getApprovalAmount: ({ customFeeEnabled, perpetualTradingFee, spotTradingFee, }: {
|
|
93
|
+
declare const getApprovalAmount: ({ customFeeEnabled, perpetualTradingFee, spotTradingFee, feeDiscount, }: {
|
|
93
94
|
customFeeEnabled: boolean;
|
|
94
95
|
perpetualTradingFee?: number;
|
|
95
96
|
spotTradingFee?: number;
|
|
97
|
+
feeDiscount?: number;
|
|
96
98
|
}) => {
|
|
97
99
|
approvalAmount: number;
|
|
98
100
|
approvalPercent: `${string}%`;
|
|
@@ -471,6 +473,18 @@ declare const formatPriceForOrder: ({ px, szDecimals, isSpot, }: {
|
|
|
471
473
|
szDecimals: number;
|
|
472
474
|
isSpot: boolean;
|
|
473
475
|
}) => number;
|
|
476
|
+
/**
|
|
477
|
+
* Formats price for order placement following Hyperliquid rules
|
|
478
|
+
* - Rounded to priceDecimals of the asset
|
|
479
|
+
* @param px - The price to format
|
|
480
|
+
* @param priceDecimals - Price decimals for the asset
|
|
481
|
+
* @returns Formatted price as number (rounded to priceDecimals if exceeds)
|
|
482
|
+
*/
|
|
483
|
+
declare const formatPriceForDisplay: ({ px, szDecimals, isSpot, }: {
|
|
484
|
+
px: number;
|
|
485
|
+
szDecimals: number;
|
|
486
|
+
isSpot: boolean;
|
|
487
|
+
}) => string;
|
|
474
488
|
/**
|
|
475
489
|
* Formats size for order placement following Hyperliquid rules
|
|
476
490
|
* - Rounded to szDecimals of the asset
|
|
@@ -482,6 +496,17 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
482
496
|
sz: number;
|
|
483
497
|
szDecimals: number;
|
|
484
498
|
}) => number;
|
|
499
|
+
/**
|
|
500
|
+
* Formats size for order placement following Hyperliquid rules
|
|
501
|
+
* - Rounded to szDecimals of the asset
|
|
502
|
+
* @param sz - The size to format
|
|
503
|
+
* @param szDecimals - Size decimals for the asset
|
|
504
|
+
* @returns Formatted size as number (rounded down to szDecimals if exceeds)
|
|
505
|
+
*/
|
|
506
|
+
declare const formatSizeForDisplay: ({ sz, szDecimals, }: {
|
|
507
|
+
sz: number;
|
|
508
|
+
szDecimals: number;
|
|
509
|
+
}) => string;
|
|
485
510
|
/**
|
|
486
511
|
* Get minimum price decimals for tick size calculations
|
|
487
512
|
* Uses the same logic as internal price formatting
|
|
@@ -498,7 +523,7 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
498
523
|
*/
|
|
499
524
|
declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
|
|
500
525
|
|
|
501
|
-
declare function isHip3Symbol(symbol: string): boolean;
|
|
526
|
+
declare function isHip3Symbol(symbol: string | undefined): boolean;
|
|
502
527
|
declare function getHip3Dex(symbol: string): string | null;
|
|
503
528
|
/**
|
|
504
529
|
* Enable HIP-3 DEX abstraction with the current agent wallet
|
|
@@ -521,5 +546,26 @@ declare const UserDexAbstractionTypes: {
|
|
|
521
546
|
*/
|
|
522
547
|
declare function setHip3DexAbstraction(client: ExchangeClient, enabled: boolean, user: string): Promise<SuccessResponse>;
|
|
523
548
|
declare function getHip3DexAbstraction(client: InfoClient, user: string): Promise<boolean | null>;
|
|
549
|
+
declare const isSpotSymbol: (coin: string | undefined) => boolean;
|
|
550
|
+
declare function getStaticCollateralTokenByDex(dex: string): string;
|
|
551
|
+
/**
|
|
552
|
+
* Get static collateral token symbol for a given coin
|
|
553
|
+
* @param coin - The coin symbol to get the collateral token symbol for eg. xyz:XYZ100
|
|
554
|
+
* @returns The collateral token symbol for the given coin
|
|
555
|
+
*/
|
|
556
|
+
declare function getStaticCollateralTokenSymbol(coin: string | undefined): string;
|
|
557
|
+
declare const stableQuoteTokens: string[];
|
|
558
|
+
declare function isStableQuoteToken(coin: string): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Get display market symbol for a given coin
|
|
561
|
+
* @param coin - The coin symbol to get the display market symbol for eg. xyz:XYZ100
|
|
562
|
+
* @param showCollateralTokenSymbol - Whether to show the collateral token symbol. Default is true.
|
|
563
|
+
* @returns
|
|
564
|
+
* HIP-3 symbol: The display market symbol for the given coin eg. XYZ100-USDC, BTC-USDE, etc.
|
|
565
|
+
* If showCollateralTokenSymbol is false, returns the symbol without the collateral token symbol. eg. rrrrr:BTC -> BTC, hyena:BTC -> BTC
|
|
566
|
+
* Spot symbol: returns the coin argument itself
|
|
567
|
+
*/
|
|
568
|
+
declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
|
|
569
|
+
declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
|
|
524
570
|
|
|
525
|
-
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, formatPriceForOrder, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction };
|
|
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 };
|