@deriverse/kit 1.0.6 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ const TOKEN_PROGRAM_ID = (0, kit_1.address)('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss
41
41
  const TOKEN_2022_PROGRAM_ID = (0, kit_1.address)('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');
42
42
  const ASSOCIATED_TOKEN_PROGRAM_ID = (0, kit_1.address)('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
43
43
  let dec = 1000000000;
44
+ let lpDec = 10000;
44
45
  const nullOrder = 0xFFFF;
45
46
  /**
46
47
  * Get price step between orderbook lines depending on curent price
@@ -247,6 +248,7 @@ class Engine {
247
248
  }
248
249
  if (!this.uiNumbers) {
249
250
  dec = 1;
251
+ lpDec = 1;
250
252
  }
251
253
  }
252
254
  logsDecode(data) {
@@ -321,7 +323,7 @@ class Engine {
321
323
  const instrInfo = this.instruments.get(report.instrId);
322
324
  assetTokenDec = this.tokenDec(instrInfo.header.assetTokenId);
323
325
  crncyTokenDec = this.tokenDec(instrInfo.header.crncyTokenId);
324
- report.qty /= 10000;
326
+ report.qty /= lpDec;
325
327
  report.tokens /= assetTokenDec;
326
328
  report.crncy /= crncyTokenDec;
327
329
  logs.push(report);
@@ -1163,7 +1165,7 @@ class Engine {
1163
1165
  else if (tag == 2) {
1164
1166
  lp.set(id, {
1165
1167
  instrId: id,
1166
- amount: Number(primaryData.readBigInt64LE(offset + 8)) / 10000
1168
+ amount: Number(primaryData.readBigInt64LE(offset + 8)) / lpDec
1167
1169
  });
1168
1170
  }
1169
1171
  else if (tag == 3) {
@@ -1580,7 +1582,7 @@ class Engine {
1580
1582
  updateInstrDataFromBuffer(data) {
1581
1583
  return __awaiter(this, void 0, void 0, function* () {
1582
1584
  let header = structure_models_1.InstrAccountHeaderModel.fromBuffer(data);
1583
- header.ps /= 10000;
1585
+ header.ps /= lpDec;
1584
1586
  const assetTokenDec = this.tokenDec(header.assetTokenId);
1585
1587
  const crncyTokenDec = this.tokenDec(header.crncyTokenId);
1586
1588
  header.assetTokens /= assetTokenDec;
@@ -1862,7 +1864,7 @@ class Engine {
1862
1864
  return {
1863
1865
  accounts: keys,
1864
1866
  programAddress: this.programId,
1865
- data: (0, instruction_models_1.spotLpData)(14, args.side, args.instrId, Math.round(args.amount * 10000)),
1867
+ data: (0, instruction_models_1.spotLpData)(14, args.side, args.instrId, Math.round(args.amount * lpDec)),
1866
1868
  };
1867
1869
  });
1868
1870
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriverse/kit",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",