@leofcoin/endpoints 0.4.6 → 0.4.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/exports/http.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import koa from 'koa';
2
2
  import cors from '@koa/cors';
3
3
  import Router from '@koa/router';
4
- import { formatUnits } from '@leofcoin/utils';
4
+ import { formatUnits, jsonStringifyBigInt } from '@leofcoin/utils';
5
5
  import { readFile } from 'fs/promises';
6
6
  import Showdown from 'showdown';
7
7
  import shared from './shared.js';
@@ -83,7 +83,7 @@ export default (chain, port, networkVersion, remote = false) => {
83
83
  const tx = await chain.sendTransaction(ctx.query.transaction);
84
84
  await tx.wait();
85
85
  delete tx.wait;
86
- ctx.body = tx;
86
+ ctx.body = JSON.stringify(tx, jsonStringifyBigInt);
87
87
  }
88
88
  catch (error) {
89
89
  // ctx(202)
@@ -126,7 +126,7 @@ export default (chain, port, networkVersion, remote = false) => {
126
126
  const tx = await chain.deployContract(ctx.query.contract, ctx.query.transaction);
127
127
  await tx.wait();
128
128
  delete tx.wait;
129
- ctx.body = JSON.stringify(tx);
129
+ ctx.body = JSON.stringify(tx, jsonStringifyBigInt);
130
130
  }
131
131
  catch (error) {
132
132
  ctx.body = error.mesage;
package/exports/shared.js CHANGED
@@ -8,15 +8,11 @@ export const networkStats = async (chain, networkVersion) => {
8
8
  // amount = BigNumber.from(amount)
9
9
  return { holder, amount };
10
10
  })
11
- // @ts-ignore
12
- .sort((a, b) => formatUnits(b.amount.sub(a.amount)));
11
+ .sort((a, b) => formatUnits(b.amount - a.amount));
13
12
  for (let { holder, amount } of balances) {
14
- // @ts-ignore
15
13
  if (amount > 0) {
16
- // @ts-ignore
17
14
  accountsHoldingAmount += amount;
18
15
  accountsHolding += 1;
19
- // @ts-ignore
20
16
  topHolders.length < 100 && topHolders.push({ holder, amount: formatUnits(amount) });
21
17
  }
22
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/endpoints",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {