@leofcoin/endpoints 0.2.17 → 0.3.1

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/api.md CHANGED
@@ -212,4 +212,40 @@ await client.nativeCalls()
212
212
  ```js
213
213
  await client.participating()
214
214
  ```
215
+ <br>
216
+
217
+ #### [network()](https://remote.leofcoin.org/network)
218
+ ```js
219
+ await client.network()
220
+ ```
221
+ <br>
222
+
223
+ #### [networkStats()](https://remote.leofcoin.org/networkStats)
224
+ ```js
225
+ await client.networkStats()
226
+ ```
227
+ <br>
228
+
229
+ #### [networkStats()](https://remote.leofcoin.org/networkStats)
230
+ ```js
231
+ await client.networkStats()
232
+ ```
233
+ <br>
234
+
235
+ #### [lastBlock()](https://remote.leofcoin.org/lastBlock)
236
+ ```js
237
+ await client.lastBlock()
238
+ ```
239
+ <br>
240
+
241
+ #### [blockHashMap()](https://remote.leofcoin.org/blockHashMap)
242
+ ```js
243
+ await client.blockHashMap()
244
+ ```
245
+ <br>
246
+
247
+ #### [bootstrap()](https://remote.leofcoin.org/bootstrap)
248
+ ```js
249
+ await client.bootstrap()
250
+ ```
215
251
  <br>
package/exports/http.js CHANGED
@@ -65,7 +65,7 @@ export default (chain, port, networkVersion) => {
65
65
  ctx.body = await chain.getNonce(ctx.query.address)
66
66
  })
67
67
 
68
- router.get('/getBlock', ctx => ctx.body = chain.blocks[ctx.query.index])
68
+ router.get('/getBlock', ctx => ctx.body = chain.blocks[ctx.query.index - 1])
69
69
 
70
70
  router.get('/blocks', ctx => {
71
71
  ctx.body = chain.blocks.slice(ctx.query.amount)
@@ -176,6 +176,10 @@ export default (chain, port, networkVersion) => {
176
176
  }
177
177
  })
178
178
 
179
+ router.get('/lastBlock', async ctx => ctx.body = chain.lastBlock)
180
+
181
+ router.get('/blockHashMap', async ctx => ctx.body = chain.blockHashMap)
182
+
179
183
  router.get('/bootstrap', async ctx => {
180
184
  ctx.body = (await shared.bootstrap()).map(value => Array.from(value.toString()))
181
185
  })
package/exports/ws.js CHANGED
@@ -32,7 +32,7 @@ export default (chain, port, networkVersion) => {
32
32
  hasTransactionToHandle: async ({send}) =>
33
33
  send(await chain.hasTransactionToHandle()),
34
34
  getBlock: ({index}, {send}) =>
35
- send(chain.blocks[index]),
35
+ send(chain.blocks[index - 1]),
36
36
  blocks:({amount}, {send}) => {
37
37
  send(chain.blocks.slice(amount))},
38
38
  sendTransaction: async (transaction, {send}) => {
@@ -101,6 +101,11 @@ export default (chain, port, networkVersion) => {
101
101
  send(error)
102
102
  }
103
103
  },
104
+
105
+ lastBlock: async ctx => ctx.body = chain.lastBlock,
106
+
107
+ blockHashMap: async ctx => ctx.body = chain.blockHashMap,
108
+
104
109
  bootstrap: async ({send}) => {
105
110
  send(await shared.bootstrap())
106
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/endpoints",
3
- "version": "0.2.17",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {