@cityofzion/bs-neox 3.0.2 → 3.0.4

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.
@@ -62,7 +62,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
62
62
  const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
63
63
  const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', nativeToken.hash);
64
64
  events.push({
65
- amount: ethers_1.ethers.utils.formatUnits(response.value, nativeToken.decimals),
65
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(response.value, nativeToken.decimals), {
66
+ decimals: nativeToken.decimals,
67
+ }),
66
68
  from,
67
69
  fromUrl,
68
70
  to,
@@ -87,7 +89,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
87
89
  const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
88
90
  if (tokenTransfer.token.type === 'ERC-20') {
89
91
  events.push({
90
- amount: ethers_1.ethers.utils.formatUnits(tokenTransfer.total.value, tokenTransfer.total.decimals),
92
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(tokenTransfer.total.value, tokenTransfer.total.decimals), {
93
+ decimals: tokenTransfer.total.decimals,
94
+ }),
91
95
  from,
92
96
  fromUrl,
93
97
  to,
@@ -138,8 +142,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
138
142
  txId,
139
143
  txIdUrl,
140
144
  events,
141
- networkFeeAmount: ethers_1.ethers.utils.formatEther(response.fee.value),
142
- systemFeeAmount: ethers_1.ethers.utils.formatEther(0),
145
+ networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(response.fee.value, this._service.feeToken.decimals), {
146
+ decimals: this._service.feeToken.decimals,
147
+ }),
143
148
  date: new Date(response.timestamp).toISOString(),
144
149
  invocationCount: 0,
145
150
  notificationCount: 0,
@@ -181,7 +186,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
181
186
  const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
182
187
  const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
183
188
  events.push({
184
- amount: ethers_1.ethers.utils.formatUnits(item.value, nativeToken.decimals),
189
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(item.value, nativeToken.decimals), {
190
+ decimals: nativeToken.decimals,
191
+ }),
185
192
  from: item.from.hash,
186
193
  fromUrl,
187
194
  to,
@@ -209,7 +216,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
209
216
  const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
210
217
  const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
211
218
  events.push({
212
- amount: ethers_1.ethers.utils.formatUnits(value, token.decimals),
219
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(value, token.decimals), {
220
+ decimals: token.decimals,
221
+ }),
213
222
  from: item.from.hash,
214
223
  fromUrl,
215
224
  to,
@@ -238,8 +247,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
238
247
  date: new Date(item.timestamp).toISOString(),
239
248
  invocationCount: 0,
240
249
  notificationCount: 0,
241
- networkFeeAmount: ethers_1.ethers.utils.formatEther(item.fee.value),
242
- systemFeeAmount: ethers_1.ethers.utils.formatEther(0),
250
+ networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(item.fee.value, this._service.feeToken.decimals), {
251
+ decimals: this._service.feeToken.decimals,
252
+ }),
243
253
  events,
244
254
  type: 'default',
245
255
  };
@@ -328,7 +338,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
328
338
  const nativeToken = BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET;
329
339
  const balances = [
330
340
  {
331
- amount: ethers_1.ethers.utils.formatUnits(nativeBalance.coin_balance, nativeToken.decimals),
341
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(nativeBalance.coin_balance, nativeToken.decimals), {
342
+ decimals: nativeToken.decimals,
343
+ }),
332
344
  token: nativeToken,
333
345
  },
334
346
  ];
@@ -348,7 +360,9 @@ class BlockscoutBDSNeoX extends bs_ethereum_1.RpcBDSEthereum {
348
360
  symbol: balance.token.symbol,
349
361
  });
350
362
  balances.push({
351
- amount: ethers_1.ethers.utils.formatUnits(balance.value, token.decimals),
363
+ amount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(balance.value, token.decimals), {
364
+ decimals: token.decimals,
365
+ }),
352
366
  token,
353
367
  });
354
368
  }
@@ -396,7 +410,7 @@ _a = BlockscoutBDSNeoX, _BlockscoutBDSNeoX_apiInstance = new WeakMap(), _Blocksc
396
410
  return {
397
411
  tokenToUse,
398
412
  receiverAddress,
399
- amount: blockchain_service_1.BSBigNumberHelper.toNumber(amountBn),
413
+ amount: blockchain_service_1.BSBigNumberHelper.format(amountBn, { decimals: tokenToUse.decimals }),
400
414
  };
401
415
  };
402
416
  BlockscoutBDSNeoX.BASE_URL_BY_CHAIN_ID = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neox",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -15,9 +15,9 @@
15
15
  "ethers": "~5.7.2",
16
16
  "neox-tpke": "~1.0.5",
17
17
  "viem": "~2.38.5",
18
- "@cityofzion/blockchain-service": "3.0.2",
19
- "@cityofzion/bs-ethereum": "3.0.2",
20
- "@cityofzion/bs-neo3": "3.0.2"
18
+ "@cityofzion/blockchain-service": "3.0.4",
19
+ "@cityofzion/bs-ethereum": "3.0.4",
20
+ "@cityofzion/bs-neo3": "3.0.4"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@ledgerhq/hw-transport": "~6.32.0",