@leofcoin/endpoints 0.2.3 → 0.2.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.
- package/README.md +7 -0
- package/exports/api.md +9 -0
- package/exports/http.js +7 -2
- package/exports/ws.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/exports/api.md
CHANGED
|
@@ -103,6 +103,15 @@ await client.balanceOf(address, true)
|
|
|
103
103
|
```
|
|
104
104
|
<br>
|
|
105
105
|
|
|
106
|
+
#### [getNonce(address: `string`)](https://remote.leofcoin.org/getNonce?address=YTqxKshWH4Qo7KprGYxQVCNYutedaE6YGoUdUPnUdFUVBPrTzgsrP)
|
|
107
|
+
`address`: The address to check<br>
|
|
108
|
+
`format`: Wether or not to format<br>
|
|
109
|
+
> returns the balance of given address as BigNumber or string (when format is true)
|
|
110
|
+
```js
|
|
111
|
+
await client.getNonce(address)
|
|
112
|
+
```
|
|
113
|
+
<br>
|
|
114
|
+
|
|
106
115
|
#### [selectedAccount()](https://remote.leofcoin.org/selectedAccount)
|
|
107
116
|
```js
|
|
108
117
|
await client.selectedAccount()
|
package/exports/http.js
CHANGED
|
@@ -25,7 +25,7 @@ export default (chain, port, networkVersion) => {
|
|
|
25
25
|
ctx.body = await chain.balances
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
router.get('balanceOf', async ctx => {
|
|
28
|
+
router.get('/balanceOf', async ctx => {
|
|
29
29
|
const balance = (await chain.balances)[ctx.query.address]
|
|
30
30
|
ctx.body = ctx.query.format ? formatUnits(balance) : balance
|
|
31
31
|
})
|
|
@@ -47,6 +47,11 @@ export default (chain, port, networkVersion) => {
|
|
|
47
47
|
router.get('/hasTransactionToHandle', async ctx => {
|
|
48
48
|
ctx.body = await chain.hasTransactionToHandle()
|
|
49
49
|
})
|
|
50
|
+
|
|
51
|
+
router.get('/getNonce', async ctx => {
|
|
52
|
+
ctx.body = await chain.getNonce(ctx.query.address)
|
|
53
|
+
})
|
|
54
|
+
|
|
50
55
|
router.get('/getBlock', ctx => ctx.body = chain.blocks[ctx.query.index])
|
|
51
56
|
|
|
52
57
|
router.get('/blocks', ctx => {
|
|
@@ -119,7 +124,7 @@ export default (chain, port, networkVersion) => {
|
|
|
119
124
|
ctx.body = chain.participating
|
|
120
125
|
)
|
|
121
126
|
|
|
122
|
-
router.get('participate', async ctx =>
|
|
127
|
+
router.get('/participate', async ctx =>
|
|
123
128
|
ctx.body = await chain.participate(ctx.query.address)
|
|
124
129
|
)
|
|
125
130
|
|
package/exports/ws.js
CHANGED
|
@@ -9,6 +9,7 @@ export default (chain, port, protocol) => {
|
|
|
9
9
|
const balance = (await chain.balances)[address]
|
|
10
10
|
send(format ? formatUnits(balance) : balance)
|
|
11
11
|
},
|
|
12
|
+
getNonce: async ({address}, {send}) => send((await chain.balances)[address]),
|
|
12
13
|
selectedAccount: ({send}) => send(peernet.selectedAccount),
|
|
13
14
|
selectAccount: async ({address}, {send}) => {
|
|
14
15
|
try {
|