@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.mjs CHANGED
@@ -209,7 +209,8 @@ var CloidClientCode = {
209
209
  Chase: 6,
210
210
  Desktop: 7,
211
211
  API: 8,
212
- Stream: 9
212
+ Stream: 9,
213
+ Pal: 10
213
214
  };
214
215
  var CloidClientCodeNameById = {
215
216
  [CloidClientCode.Unset]: "Unset",
@@ -221,7 +222,8 @@ var CloidClientCodeNameById = {
221
222
  [CloidClientCode.Chase]: "Chase",
222
223
  [CloidClientCode.Desktop]: "Desktop",
223
224
  [CloidClientCode.API]: "API",
224
- [CloidClientCode.Stream]: "Stream"
225
+ [CloidClientCode.Stream]: "Stream",
226
+ [CloidClientCode.Pal]: "Pal"
225
227
  };
226
228
  function getClientCodeNameById(id) {
227
229
  return CloidClientCodeNameById[id] ?? `client_${id}`;
@@ -325,18 +327,18 @@ var getApprovalAmount = ({
325
327
  validatedPerpFeePct = TARGET_FUTURES_BUILDER_FEE / 1e3;
326
328
  }
327
329
  validatedPerpFeePct = new Decimal(validatedPerpFeePct).mul(discountMultiplier).toNumber();
328
- if (validatedPerpFeePct > 0 && validatedPerpFeePct < 0.01) {
329
- console.warn("Perp fee is less than 0.01%, setting to 0.01%");
330
- validatedPerpFeePct = 0.01;
331
- }
332
- if (validatedPerpFeePct < 0) {
333
- console.warn("Perp fee is less than 0, setting to 0");
334
- validatedPerpFeePct = 0;
330
+ if (validatedPerpFeePct > 0 && validatedPerpFeePct < 1e-3) {
331
+ console.warn("Perp fee is less than 0.001%, setting to 0.001%");
332
+ validatedPerpFeePct = 1e-3;
335
333
  }
336
334
  if (validatedPerpFeePct > 0.1) {
337
335
  console.warn("Perp fee is greater than 0.1%, setting to 0.1%");
338
336
  validatedPerpFeePct = 0.1;
339
337
  }
338
+ if (validatedPerpFeePct < 0) {
339
+ console.warn("Perp fee is less than 0, setting to 0");
340
+ validatedPerpFeePct = 0;
341
+ }
340
342
  let validatedSpotFeePct = spotTradingFee;
341
343
  if (validatedSpotFeePct === void 0) {
342
344
  validatedSpotFeePct = TARGET_SPOT_BUILDER_FEE / 1e3;
@@ -619,7 +621,7 @@ async function getHip3DexAbstraction(client, user) {
619
621
  }
620
622
  var dexToCollateralTokenSymbol = {
621
623
  rrrrr: "USDEEE",
622
- hyena: "USDE",
624
+ hyna: "USDE",
623
625
  flx: "USDH",
624
626
  vntl: "USDH"
625
627
  };
@@ -642,7 +644,18 @@ function isStableQuoteToken(coin) {
642
644
  return stableQuoteTokens.includes(coin);
643
645
  }
644
646
  function getDisplayMarketSymbol(coin, showCollateralTokenSymbol = true, collateralTokenSymbol) {
645
- if (!coin || isSpotSymbol(coin)) return coin;
647
+ if (!coin) return coin;
648
+ if (isSpotSymbol(coin)) {
649
+ if (coin.includes("/")) {
650
+ const [baseToken, quoteToken] = coin.split("/");
651
+ if (showCollateralTokenSymbol) {
652
+ return `${baseToken}/${collateralTokenSymbol ?? quoteToken}`;
653
+ } else {
654
+ return baseToken;
655
+ }
656
+ }
657
+ return coin;
658
+ }
646
659
  if (isHip3Symbol(coin)) {
647
660
  const [_, symbol] = coin.split(":");
648
661
  if (!showCollateralTokenSymbol) return symbol;
@@ -665,20 +678,20 @@ var globImport_data_staticMeta_json = __glob({
665
678
 
666
679
  // import("./data/**/*/spotMeta.json") in lib/meta/metadata.ts
667
680
  var globImport_data_spotMeta_json = __glob({
668
- "./data/mainnet/spotMeta.json": () => import("./spotMeta-WQ4PXRNY.mjs"),
669
- "./data/testnet/spotMeta.json": () => import("./spotMeta-Y7G2GI7B.mjs")
681
+ "./data/mainnet/spotMeta.json": () => import("./spotMeta-OD7S6HGW.mjs"),
682
+ "./data/testnet/spotMeta.json": () => import("./spotMeta-PCN4Z4R3.mjs")
670
683
  });
671
684
 
672
685
  // import("./data/**/*/meta.json") in lib/meta/metadata.ts
673
686
  var globImport_data_meta_json = __glob({
674
- "./data/mainnet/meta.json": () => import("./meta-RSZFFH63.mjs"),
675
- "./data/testnet/meta.json": () => import("./meta-57AY44US.mjs")
687
+ "./data/mainnet/meta.json": () => import("./meta-UOGUG3OW.mjs"),
688
+ "./data/testnet/meta.json": () => import("./meta-FVJIMALT.mjs")
676
689
  });
677
690
 
678
691
  // import("./data/**/*/perpDexs.json") in lib/meta/metadata.ts
679
692
  var globImport_data_perpDexs_json = __glob({
680
- "./data/mainnet/perpDexs.json": () => import("./perpDexs-PBKWKKQU.mjs"),
681
- "./data/testnet/perpDexs.json": () => import("./perpDexs-XSB4Y2BP.mjs")
693
+ "./data/mainnet/perpDexs.json": () => import("./perpDexs-GGL32HT4.mjs"),
694
+ "./data/testnet/perpDexs.json": () => import("./perpDexs-G7V2QIM6.mjs")
682
695
  });
683
696
 
684
697
  // lib/meta/metadata.ts
@@ -871,7 +884,8 @@ var MetadataClient = class {
871
884
  assetId: index,
872
885
  szDecimals: market.szDecimals,
873
886
  type: "perps",
874
- maxLeverage: market.maxLeverage
887
+ maxLeverage: market.maxLeverage,
888
+ growthMode: market.growthMode === "enabled"
875
889
  };
876
890
  const staticOverrides = this.staticMeta?.coins?.[market.name];
877
891
  if (staticOverrides) {
@@ -904,7 +918,8 @@ var MetadataClient = class {
904
918
  szDecimals: baseToken.szDecimals,
905
919
  type: "spot",
906
920
  baseToken,
907
- quoteToken
921
+ quoteToken,
922
+ growthMode: false
908
923
  };
909
924
  const staticOverrides = this.staticMeta?.coins?.[coin];
910
925
  if (staticOverrides) {
@@ -1003,7 +1018,8 @@ var MetadataClient = class {
1003
1018
  dexIndex: dexInfo.dexIndex,
1004
1019
  dexDisplayName: dexInfo.displayName,
1005
1020
  dexImageUrl: dexInfo.imageUrl,
1006
- dexCollateralTokenSymbol: dexInfo.collateralTokenSymbol
1021
+ dexCollateralTokenSymbol: dexInfo.collateralTokenSymbol,
1022
+ growthMode: market.growthMode === "enabled"
1007
1023
  };
1008
1024
  const staticOverrides = this.staticMeta?.coins?.[symbol];
1009
1025
  if (staticOverrides) {
@@ -1078,7 +1094,8 @@ var MetadataClient = class {
1078
1094
  // Perps asset ID is just the index
1079
1095
  szDecimals: market.szDecimals,
1080
1096
  type: "perps",
1081
- maxLeverage: market.maxLeverage
1097
+ maxLeverage: market.maxLeverage,
1098
+ growthMode: market.growthMode === "enabled"
1082
1099
  };
1083
1100
  }
1084
1101
  /**
@@ -1248,6 +1265,13 @@ function getPriceDecimals(price, szDecimals, isSpot) {
1248
1265
  }
1249
1266
  return minDecimals;
1250
1267
  }
1268
+
1269
+ // lib/hip3/market-info.ts
1270
+ async function getAllPerpsMeta(infoClient) {
1271
+ return infoClient.transport.request("info", {
1272
+ type: "allPerpMetas"
1273
+ });
1274
+ }
1251
1275
  export {
1252
1276
  CloidClientCode,
1253
1277
  CloidClientCodeNameById,
@@ -1274,6 +1298,7 @@ export {
1274
1298
  formatPriceForOrder,
1275
1299
  formatSizeForDisplay,
1276
1300
  formatSizeForOrder,
1301
+ getAllPerpsMeta,
1277
1302
  getApprovalAmount,
1278
1303
  getClientCodeNameById,
1279
1304
  getCloid,
@@ -1242,10 +1242,8 @@ var universe = [
1242
1242
  {
1243
1243
  szDecimals: 0,
1244
1244
  name: "MON",
1245
- maxLeverage: 3,
1246
- marginTableId: 3,
1247
- onlyIsolated: true,
1248
- marginMode: "strictIsolated"
1245
+ maxLeverage: 5,
1246
+ marginTableId: 5
1249
1247
  },
1250
1248
  {
1251
1249
  szDecimals: 0,
@@ -1348,10 +1348,8 @@ var universe = [
1348
1348
  {
1349
1349
  szDecimals: 0,
1350
1350
  name: "MON",
1351
- maxLeverage: 3,
1352
- marginTableId: 3,
1353
- onlyIsolated: true,
1354
- marginMode: "strictIsolated"
1351
+ maxLeverage: 5,
1352
+ marginTableId: 5
1355
1353
  },
1356
1354
  {
1357
1355
  szDecimals: 0,