@leofcoin/endpoints 0.3.3 → 0.3.5

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
@@ -75,7 +75,8 @@ export default (chain, port, networkVersion, remote = false) => {
75
75
  });
76
76
  router.get('/getBlock', async (ctx) => (ctx.body = await chain.getBlock(ctx.query.index)));
77
77
  router.get('/blocks', async (ctx) => {
78
- ctx.body = chain.getBlocks(ctx.query.amount);
78
+ const limit = ctx.query.amount;
79
+ ctx.body = await globalThis.blockStore.values(limit);
79
80
  });
80
81
  router.get('/sendTransaction', async (ctx) => {
81
82
  try {
@@ -95,15 +96,18 @@ export default (chain, port, networkVersion, remote = false) => {
95
96
  ctx.body = await chain.lookup(ctx.query.name);
96
97
  });
97
98
  router.get('/staticCall', async (ctx) => (ctx.body = await chain.staticCall(ctx.query.contract, ctx.query.method, ctx.query.params)));
98
- router.get('/nativeBurns', async (ctx) => (ctx.body = await chain.nativeBurns));
99
99
  router.get('/contracts', async (ctx) => (ctx.body = await chain.contracts));
100
- router.get('/nativeMints', async (ctx) => (ctx.body = await chain.nativeMints));
101
100
  router.get('/nativeToken', async (ctx) => (ctx.body = await chain.nativeToken));
101
+ router.get('/nativeCalls', async (ctx) => (ctx.body = await chain.nativeCalls));
102
+ router.get('/nativeMints', async (ctx) => (ctx.body = await chain.nativeMints));
103
+ router.get('/nativeBurns', async (ctx) => (ctx.body = await chain.nativeBurns));
102
104
  router.get('/nativeTransfers', async (ctx) => (ctx.body = await chain.nativeTransfers));
103
- router.get('/totalSize', async (ctx) => (ctx.body = await chain.totalSize));
105
+ router.get('/totalBurnAmount', async (ctx) => (ctx.body = await chain.totalBurnAmount));
106
+ router.get('/totalMintAmount', async (ctx) => (ctx.body = await chain.totalMintAmount));
107
+ router.get('/totalTransferAmount', async (ctx) => (ctx.body = await chain.totalTransferAmount));
104
108
  router.get('/totalTransactions', async (ctx) => (ctx.body = await chain.totalTransactions));
109
+ router.get('/totalSize', async (ctx) => (ctx.body = await chain.totalSize));
105
110
  router.get('/totalBlocks', async (ctx) => (ctx.body = await chain.totalBlocks));
106
- router.get('/nativeCalls', async (ctx) => (ctx.body = await chain.nativeCalls));
107
111
  router.get('/lastBlock', async (ctx) => (ctx.body = await chain.lastBlock));
108
112
  router.get('/poolTransactions', async (ctx) => (ctx.body = await globalThis.transactionPoolStore.get()));
109
113
  router.get('/transactionsInPool', async (ctx) => (ctx.body = await globalThis.transactionPoolStore.length()));
package/exports/ws.js CHANGED
@@ -45,7 +45,7 @@ export default (chain, port, networkVersion, remote = false) => {
45
45
  hasTransactionToHandle: async ({ send }) => send(await chain.hasTransactionToHandle()),
46
46
  getBlock: async ({ index }, { send }) => send(await chain.getBlock(index)),
47
47
  blocks: async ({ amount }, { send }) => {
48
- send(await chain.getBlocks(amount));
48
+ send(await globalThis.blockStore.values(amount));
49
49
  },
50
50
  sendTransaction: async (transaction, { send }) => {
51
51
  try {
@@ -63,16 +63,19 @@ export default (chain, port, networkVersion, remote = false) => {
63
63
  validators: ({ send }) => send(chain.validators),
64
64
  lookup: async ({ name }, { send }) => send(await chain.lookup(name)),
65
65
  staticCall: async ({ contract, method, params }, { send }) => send(await chain.staticCall(contract, method, params)),
66
- nativeBurns: async ({ send }) => send(await chain.nativeBurns),
67
66
  contracts: async ({ send }) => send(await chain.contracts),
68
- nativeMints: async ({ send }) => send(await chain.nativeMints),
69
67
  nativeToken: async ({ send }) => send(await chain.nativeToken),
68
+ nativeCalls: async ({ send }) => send(await chain.nativeCalls),
69
+ nativeMints: async ({ send }) => send(await chain.nativeMints),
70
+ nativeBurns: async ({ send }) => send(await chain.nativeBurns),
70
71
  nativeTransfers: async ({ send }) => send(await chain.nativeTransfers),
71
- totalSize: async ({ send }) => send(await chain.totalSize),
72
+ totalBurnAmount: async ({ send }) => send(await chain.totalBurnAmount),
73
+ totalMintAmount: async ({ send }) => send(await chain.totalMintAmount),
74
+ totalTransferAmount: async ({ send }) => send(await chain.totalTransferAmount),
72
75
  totalTransactions: async ({ send }) => send(await chain.totalTransactions),
73
76
  totalBlocks: async ({ send }) => send(chain.totalBlocks),
77
+ totalSize: async ({ send }) => send((await transactionPoolStore.size()) + (await blockStore.size()) + (await accountsStore.size())),
74
78
  lastBlock: async (ctx) => (ctx.body = await chain.lastBlock),
75
- nativeCalls: async ({ send }) => send(await chain.nativeCalls),
76
79
  participating: async ({ send }) => send(await chain.participating),
77
80
  poolTransactions: async ({ send }) => send(await globalThis.transactionPoolStore.get()),
78
81
  transactionsInPool: async ({ send }) => send(await globalThis.transactionPoolStore.length()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/endpoints",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {