@leofcoin/endpoints 0.2.13 → 0.2.15

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
@@ -178,6 +178,24 @@ await client.totalTransactions()
178
178
  ```
179
179
  <br>
180
180
 
181
+ #### [poolTransactions()](https://remote.leofcoin.org/poolTransactions)
182
+ ```js
183
+ await client.poolTransactions()
184
+ ```
185
+ <br>
186
+
187
+ #### [transactionsInPool()](https://remote.leofcoin.org/transactionsInPool)
188
+ ```js
189
+ await client.transactionsInPool()
190
+ ```
191
+ <br>
192
+
193
+ #### [transactionPoolSize()](https://remote.leofcoin.org/transactionPoolSize)
194
+ ```js
195
+ await client.transactionPoolSize()
196
+ ```
197
+ <br>
198
+
181
199
  #### [totalBlocks()](https://remote.leofcoin.org/totalBlocks)
182
200
  ```js
183
201
  await client.totalBlocks()
package/exports/http.js CHANGED
@@ -130,6 +130,16 @@ export default (chain, port, networkVersion) => {
130
130
  ctx.body = chain.totalTransactions
131
131
  )
132
132
 
133
+ router.get('/poolTransactions', async ctx =>
134
+ ctx.body = await transactionPoolStore.get()
135
+ )
136
+ router.get('/transactionsInPool', async ctx =>
137
+ ctx.body = await transactionPoolStore.length()
138
+ )
139
+ router.get('/transactionPoolSize', async ctx =>
140
+ ctx.body = await transactionPoolStore.size()
141
+ )
142
+
133
143
  router.get('/totalBlocks', ctx =>
134
144
  ctx.body = chain.blocks.length
135
145
  )
@@ -166,6 +176,10 @@ export default (chain, port, networkVersion) => {
166
176
  }
167
177
  })
168
178
 
179
+ router.get('/bootstrap', async ctx => {
180
+ ctx.body = await shared.bootstrap()
181
+ })
182
+
169
183
  // todo finish ...
170
184
  api.use(cors('*'))
171
185
  api.use(router.routes())
package/exports/shared.js CHANGED
@@ -29,6 +29,11 @@ export const networkStats = async (chain, networkVersion) => {
29
29
  }
30
30
  }
31
31
 
32
+ const bootstrap = async () => {
33
+ return blockStore.values()
34
+ }
35
+
32
36
  export default {
33
- networkStats
37
+ networkStats,
38
+ bootstrap
34
39
  }
package/exports/ws.js CHANGED
@@ -69,6 +69,12 @@ export default (chain, port, networkVersion) => {
69
69
  send(chain.totalSize),
70
70
  totalTransactions: ({send}) =>
71
71
  send(chain.totalTransactions),
72
+ poolTransactions: async ({send}) =>
73
+ send(await transactionPoolStore.get()),
74
+ transactionsInPool: async ({send}) =>
75
+ send(await transactionPoolStore.length()),
76
+ transactionPoolSize: async ({send}) =>
77
+ send(await transactionPoolStore.size()),
72
78
  totalBlocks: ({send}) =>
73
79
  send(chain.blocks.length),
74
80
  nativeCalls: ({send}) =>
@@ -94,7 +100,10 @@ export default (chain, port, networkVersion) => {
94
100
  } catch (error) {
95
101
  send(error)
96
102
  }
97
- }
103
+ },
104
+ bootstrap: async ({send}) => {
105
+ send(await shared.bootstrap())
106
+ }
98
107
  })
99
108
  }
100
109
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@leofcoin/endpoints",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
7
- "./api": "./exportys/api.md",
7
+ "./api": "./exports/api.md",
8
8
  "./http": "./exports/http.js",
9
9
  "./ws": "./exports/ws.js"
10
10
  },