@leofcoin/endpoints 0.4.4 → 0.4.6

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 vandeurenglenn
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022 vandeurenglenn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/exports/api.md CHANGED
@@ -1,376 +1,376 @@
1
- #### [selectAccount(address: `string`)](https://remote.leofcoin.org/select-account?address=)
2
-
3
- `address`: desired address
4
-
5
- > set default account to given address
6
-
7
- ```js
8
- await client.selectAccount(address)
9
- ```
10
-
11
- <br>
12
-
13
- #### [getBlock(index: `number`)](https://remote.leofcoin.org/getblock?index=0)
14
-
15
- `index`: index of the block to fetch<br>
16
-
17
- ```js
18
- await client.getBlock(10)
19
- ```
20
-
21
- <br>
22
-
23
- #### [blocks(amount)](https://remote.leofcoin.org/blocks)
24
-
25
- `amount`: the amount to slice
26
-
27
- ```js
28
- await client.blocks(-25)
29
- ```
30
-
31
- <br>
32
-
33
- #### createTransactionFrom(from: `string`, to: `string`, method: `string`, parameters: `array`, nonce: `number` | `undefined`)
34
-
35
- `from`:<br>
36
- `to`: <br>
37
- `method`: <br>
38
- `parameters`: <br>
39
- `nonce`: <br>
40
-
41
- ```js
42
- await client.createTransactionFrom(from, to, method, parameters, nonce)
43
- ```
44
-
45
- <br>
46
-
47
- #### [lookup(name: `string`)](https://remote.leofcoin.org/lookup?name=ArtOnlineContractFactory)
48
-
49
- `name`: name of the contract to lookup the address and owner of
50
-
51
- ```js
52
- await client.lookup('contractName')
53
- ```
54
-
55
- <br>
56
-
57
- #### participate(address: `string`)
58
-
59
- `address`: <br>
60
-
61
- ```js
62
- await client.participate(address)
63
- ```
64
-
65
- <br>
66
-
67
- #### staticCall(contract: `string`, method: `string`, params: `array`)
68
-
69
- `contract`: contract address todo the call on
70
- `method`: method/function to call
71
- `params`: array containing params needed to call the desired method
72
-
73
- ```js
74
- await client.staticCall(contract, method, params)
75
- ```
76
-
77
- <br>
78
-
79
- #### createContractAddress(owner: `string`, code: `string`, params: `array`)
80
-
81
- `owner`: address of the deployer<br>
82
- `code`: contract as a string<br>
83
- `params`: contract constructor params<br>
84
-
85
- ```js
86
- const address = await client.createContractAddress(owner, code, params)
87
- ```
88
-
89
- <br>
90
-
91
- #### deployContract(code: `string`, params: `array`)
92
-
93
- `code`: contract as a string<br>
94
- `params`: contract constructor params<br>
95
-
96
- ```js
97
- const tx = await client.deployContract(code, params)
98
- ```
99
-
100
- <br>
101
-
102
- #### [accounts()](https://remote.leofcoin.org/accounts)
103
-
104
- ```js
105
- await client.accounts()
106
- ```
107
-
108
- <br>
109
-
110
- #### [hasTransactionToHandle()](https://remote.leofcoin.org/hasTransactionToHandle)
111
-
112
- ```js
113
- await client.hasTransactionToHandle()
114
- ```
115
-
116
- <br>
117
-
118
- #### [balances()](https://remote.leofcoin.org/balances)
119
-
120
- > returns all balances
121
-
122
- ```js
123
- await client.balances()
124
- ```
125
-
126
- <br>
127
-
128
- #### [balancOf(address: `string`, format: `boolean`)](https://remote.leofcoin.org/balanceOf?address=YTqxKshWH4Qo7KprGYxQVCNYutedaE6YGoUdUPnUdFUVBPrTzgsrP&format=true)
129
-
130
- `address`: The address to check<br>
131
- `format`: Wether or not to format<br>
132
-
133
- > returns the balance of given address as BigNumber or string (when format is true)
134
-
135
- ```js
136
- await client.balanceOf(address, true)
137
- ```
138
-
139
- <br>
140
-
141
- #### [getNonce(address: `string`)](https://remote.leofcoin.org/getNonce?address=YTqxKshWH4Qo7KprGYxQVCNYutedaE6YGoUdUPnUdFUVBPrTzgsrP)
142
-
143
- `address`: The address to check<br>
144
- `format`: Wether or not to format<br>
145
-
146
- > returns the balance of given address as BigNumber or string (when format is true)
147
-
148
- ```js
149
- await client.getNonce(address)
150
- ```
151
-
152
- <br>
153
-
154
- #### [selectedAccount()](https://remote.leofcoin.org/selectedAccount)
155
-
156
- ```js
157
- await client.selectedAccount()
158
- ```
159
-
160
- <br>
161
-
162
- #### [peerId()](https://remote.leofcoin.org/peerId)
163
-
164
- ```js
165
- await client.peerId()
166
- ```
167
-
168
- <br>
169
-
170
- #### [peers()](https://remote.leofcoin.org/peers)
171
-
172
- ```js
173
- await client.peers()
174
- ```
175
-
176
- <br>
177
-
178
- #### [validators()](https://remote.leofcoin.org/validators)
179
-
180
- ```js
181
- await client.validators()
182
- ```
183
-
184
- <br>
185
-
186
- #### [contracts()](https://remote.leofcoin.org/contracts)
187
-
188
- ```js
189
- await client.contracts()
190
- ```
191
-
192
- <br>
193
-
194
- #### [totalContracts()](https://remote.leofcoin.org/totalContracts)
195
-
196
- ```js
197
- await client.totalContracts()
198
- ```
199
-
200
- <br>
201
-
202
- #### [nativeToken()](https://remote.leofcoin.org/nativeToken)
203
-
204
- ```js
205
- await client.nativeToken()
206
- ```
207
-
208
- <br>
209
-
210
- #### [nativeCalls()](https://remote.leofcoin.org/nativeCalls)
211
-
212
- ```js
213
- await client.nativeCalls()
214
- ```
215
-
216
- <br>
217
-
218
- #### [nativeMints()](https://remote.leofcoin.org/nativeMints)
219
-
220
- ```js
221
- await client.nativeMints()
222
- ```
223
-
224
- <br>
225
-
226
- #### [nativeBurns()](https://remote.leofcoin.org/nativeBurns)
227
-
228
- ```js
229
- await client.nativeBurns()
230
- ```
231
-
232
- <br>
233
-
234
- #### [nativeTransfers()](https://remote.leofcoin.org/nativeTransfers)
235
-
236
- ```js
237
- await client.nativeTransfers()
238
- ```
239
-
240
- <br>
241
-
242
- #### [totalBurnAmount()](https://remote.leofcoin.org/totalBurnAmount)
243
-
244
- ```js
245
- await client.totalBurnAmount()
246
- ```
247
-
248
- <br>
249
-
250
- #### [totalMintAmount()](https://remote.leofcoin.org/totalMintAmount)
251
-
252
- ```js
253
- await client.totalMintAmount()
254
- ```
255
-
256
- <br>
257
-
258
- #### [totalTransferAmount()](https://remote.leofcoin.org/totalTransferAmount)
259
-
260
- ```js
261
- await client.totalTransferAmount()
262
- ```
263
-
264
- <br>
265
-
266
- #### [totalTransactions()](https://remote.leofcoin.org/totalTransactions)
267
-
268
- ```js
269
- await client.totalTransactions()
270
- ```
271
-
272
- <br>
273
-
274
- #### [totalSize()](https://remote.leofcoin.org/totalSize)
275
-
276
- ```js
277
- await client.totalSize()
278
- ```
279
-
280
- <br>
281
-
282
- #### [poolTransactions()](https://remote.leofcoin.org/poolTransactions)
283
-
284
- ```js
285
- await client.poolTransactions()
286
- ```
287
-
288
- <br>
289
-
290
- #### [transactionsInPool()](https://remote.leofcoin.org/transactionsInPool)
291
-
292
- ```js
293
- await client.transactionsInPool()
294
- ```
295
-
296
- <br>
297
-
298
- #### [transactionPoolSize()](https://remote.leofcoin.org/transactionPoolSize)
299
-
300
- ```js
301
- await client.transactionPoolSize()
302
- ```
303
-
304
- <br>
305
-
306
- #### [totalBlocks()](https://remote.leofcoin.org/totalBlocks)
307
-
308
- ```js
309
- await client.totalBlocks()
310
- ```
311
-
312
- <br>
313
-
314
- #### [lastBlockHeight()](https://remote.leofcoin.org/lastBlockHeight)
315
-
316
- ```js
317
- await client.lastBlockHeight()
318
- ```
319
-
320
- <br>
321
-
322
- #### [participating()](https://remote.leofcoin.org/participating)
323
-
324
- ```js
325
- await client.participating()
326
- ```
327
-
328
- <br>
329
-
330
- #### [network()](https://remote.leofcoin.org/network)
331
-
332
- ```js
333
- await client.network()
334
- ```
335
-
336
- <br>
337
-
338
- #### [networkStats()](https://remote.leofcoin.org/networkStats)
339
-
340
- ```js
341
- await client.networkStats()
342
- ```
343
-
344
- <br>
345
-
346
- #### [networkStats()](https://remote.leofcoin.org/networkStats)
347
-
348
- ```js
349
- await client.networkStats()
350
- ```
351
-
352
- <br>
353
-
354
- #### [lastBlock()](https://remote.leofcoin.org/lastBlock)
355
-
356
- ```js
357
- await client.lastBlock()
358
- ```
359
-
360
- <br>
361
-
362
- #### [blockHashMap()](https://remote.leofcoin.org/blockHashMap)
363
-
364
- ```js
365
- await client.blockHashMap()
366
- ```
367
-
368
- <br>
369
-
370
- #### [bootstrap()](https://remote.leofcoin.org/bootstrap)
371
-
372
- ```js
373
- await client.bootstrap()
374
- ```
375
-
376
- <br>
1
+ #### [selectAccount(address: `string`)](https://remote.leofcoin.org/select-account?address=)
2
+
3
+ `address`: desired address
4
+
5
+ > set default account to given address
6
+
7
+ ```js
8
+ await client.selectAccount(address)
9
+ ```
10
+
11
+ <br>
12
+
13
+ #### [getBlock(index: `number`)](https://remote.leofcoin.org/getblock?index=0)
14
+
15
+ `index`: index of the block to fetch<br>
16
+
17
+ ```js
18
+ await client.getBlock(10)
19
+ ```
20
+
21
+ <br>
22
+
23
+ #### [blocks(amount)](https://remote.leofcoin.org/blocks)
24
+
25
+ `amount`: the amount to slice
26
+
27
+ ```js
28
+ await client.blocks(-25)
29
+ ```
30
+
31
+ <br>
32
+
33
+ #### createTransactionFrom(from: `string`, to: `string`, method: `string`, parameters: `array`, nonce: `number` | `undefined`)
34
+
35
+ `from`:<br>
36
+ `to`: <br>
37
+ `method`: <br>
38
+ `parameters`: <br>
39
+ `nonce`: <br>
40
+
41
+ ```js
42
+ await client.createTransactionFrom(from, to, method, parameters, nonce)
43
+ ```
44
+
45
+ <br>
46
+
47
+ #### [lookup(name: `string`)](https://remote.leofcoin.org/lookup?name=ArtOnlineContractFactory)
48
+
49
+ `name`: name of the contract to lookup the address and owner of
50
+
51
+ ```js
52
+ await client.lookup('contractName')
53
+ ```
54
+
55
+ <br>
56
+
57
+ #### participate(address: `string`)
58
+
59
+ `address`: <br>
60
+
61
+ ```js
62
+ await client.participate(address)
63
+ ```
64
+
65
+ <br>
66
+
67
+ #### staticCall(contract: `string`, method: `string`, params: `array`)
68
+
69
+ `contract`: contract address todo the call on
70
+ `method`: method/function to call
71
+ `params`: array containing params needed to call the desired method
72
+
73
+ ```js
74
+ await client.staticCall(contract, method, params)
75
+ ```
76
+
77
+ <br>
78
+
79
+ #### createContractAddress(owner: `string`, code: `string`, params: `array`)
80
+
81
+ `owner`: address of the deployer<br>
82
+ `code`: contract as a string<br>
83
+ `params`: contract constructor params<br>
84
+
85
+ ```js
86
+ const address = await client.createContractAddress(owner, code, params)
87
+ ```
88
+
89
+ <br>
90
+
91
+ #### deployContract(code: `string`, params: `array`)
92
+
93
+ `code`: contract as a string<br>
94
+ `params`: contract constructor params<br>
95
+
96
+ ```js
97
+ const tx = await client.deployContract(code, params)
98
+ ```
99
+
100
+ <br>
101
+
102
+ #### [accounts()](https://remote.leofcoin.org/accounts)
103
+
104
+ ```js
105
+ await client.accounts()
106
+ ```
107
+
108
+ <br>
109
+
110
+ #### [hasTransactionToHandle()](https://remote.leofcoin.org/hasTransactionToHandle)
111
+
112
+ ```js
113
+ await client.hasTransactionToHandle()
114
+ ```
115
+
116
+ <br>
117
+
118
+ #### [balances()](https://remote.leofcoin.org/balances)
119
+
120
+ > returns all balances
121
+
122
+ ```js
123
+ await client.balances()
124
+ ```
125
+
126
+ <br>
127
+
128
+ #### [balancOf(address: `string`, format: `boolean`)](https://remote.leofcoin.org/balanceOf?address=YTqxKshWH4Qo7KprGYxQVCNYutedaE6YGoUdUPnUdFUVBPrTzgsrP&format=true)
129
+
130
+ `address`: The address to check<br>
131
+ `format`: Wether or not to format<br>
132
+
133
+ > returns the balance of given address as BigNumber or string (when format is true)
134
+
135
+ ```js
136
+ await client.balanceOf(address, true)
137
+ ```
138
+
139
+ <br>
140
+
141
+ #### [getNonce(address: `string`)](https://remote.leofcoin.org/getNonce?address=YTqxKshWH4Qo7KprGYxQVCNYutedaE6YGoUdUPnUdFUVBPrTzgsrP)
142
+
143
+ `address`: The address to check<br>
144
+ `format`: Wether or not to format<br>
145
+
146
+ > returns the balance of given address as BigNumber or string (when format is true)
147
+
148
+ ```js
149
+ await client.getNonce(address)
150
+ ```
151
+
152
+ <br>
153
+
154
+ #### [selectedAccount()](https://remote.leofcoin.org/selectedAccount)
155
+
156
+ ```js
157
+ await client.selectedAccount()
158
+ ```
159
+
160
+ <br>
161
+
162
+ #### [peerId()](https://remote.leofcoin.org/peerId)
163
+
164
+ ```js
165
+ await client.peerId()
166
+ ```
167
+
168
+ <br>
169
+
170
+ #### [peers()](https://remote.leofcoin.org/peers)
171
+
172
+ ```js
173
+ await client.peers()
174
+ ```
175
+
176
+ <br>
177
+
178
+ #### [validators()](https://remote.leofcoin.org/validators)
179
+
180
+ ```js
181
+ await client.validators()
182
+ ```
183
+
184
+ <br>
185
+
186
+ #### [contracts()](https://remote.leofcoin.org/contracts)
187
+
188
+ ```js
189
+ await client.contracts()
190
+ ```
191
+
192
+ <br>
193
+
194
+ #### [totalContracts()](https://remote.leofcoin.org/totalContracts)
195
+
196
+ ```js
197
+ await client.totalContracts()
198
+ ```
199
+
200
+ <br>
201
+
202
+ #### [nativeToken()](https://remote.leofcoin.org/nativeToken)
203
+
204
+ ```js
205
+ await client.nativeToken()
206
+ ```
207
+
208
+ <br>
209
+
210
+ #### [nativeCalls()](https://remote.leofcoin.org/nativeCalls)
211
+
212
+ ```js
213
+ await client.nativeCalls()
214
+ ```
215
+
216
+ <br>
217
+
218
+ #### [nativeMints()](https://remote.leofcoin.org/nativeMints)
219
+
220
+ ```js
221
+ await client.nativeMints()
222
+ ```
223
+
224
+ <br>
225
+
226
+ #### [nativeBurns()](https://remote.leofcoin.org/nativeBurns)
227
+
228
+ ```js
229
+ await client.nativeBurns()
230
+ ```
231
+
232
+ <br>
233
+
234
+ #### [nativeTransfers()](https://remote.leofcoin.org/nativeTransfers)
235
+
236
+ ```js
237
+ await client.nativeTransfers()
238
+ ```
239
+
240
+ <br>
241
+
242
+ #### [totalBurnAmount()](https://remote.leofcoin.org/totalBurnAmount)
243
+
244
+ ```js
245
+ await client.totalBurnAmount()
246
+ ```
247
+
248
+ <br>
249
+
250
+ #### [totalMintAmount()](https://remote.leofcoin.org/totalMintAmount)
251
+
252
+ ```js
253
+ await client.totalMintAmount()
254
+ ```
255
+
256
+ <br>
257
+
258
+ #### [totalTransferAmount()](https://remote.leofcoin.org/totalTransferAmount)
259
+
260
+ ```js
261
+ await client.totalTransferAmount()
262
+ ```
263
+
264
+ <br>
265
+
266
+ #### [totalTransactions()](https://remote.leofcoin.org/totalTransactions)
267
+
268
+ ```js
269
+ await client.totalTransactions()
270
+ ```
271
+
272
+ <br>
273
+
274
+ #### [totalSize()](https://remote.leofcoin.org/totalSize)
275
+
276
+ ```js
277
+ await client.totalSize()
278
+ ```
279
+
280
+ <br>
281
+
282
+ #### [poolTransactions()](https://remote.leofcoin.org/poolTransactions)
283
+
284
+ ```js
285
+ await client.poolTransactions()
286
+ ```
287
+
288
+ <br>
289
+
290
+ #### [transactionsInPool()](https://remote.leofcoin.org/transactionsInPool)
291
+
292
+ ```js
293
+ await client.transactionsInPool()
294
+ ```
295
+
296
+ <br>
297
+
298
+ #### [transactionPoolSize()](https://remote.leofcoin.org/transactionPoolSize)
299
+
300
+ ```js
301
+ await client.transactionPoolSize()
302
+ ```
303
+
304
+ <br>
305
+
306
+ #### [totalBlocks()](https://remote.leofcoin.org/totalBlocks)
307
+
308
+ ```js
309
+ await client.totalBlocks()
310
+ ```
311
+
312
+ <br>
313
+
314
+ #### [lastBlockHeight()](https://remote.leofcoin.org/lastBlockHeight)
315
+
316
+ ```js
317
+ await client.lastBlockHeight()
318
+ ```
319
+
320
+ <br>
321
+
322
+ #### [participating()](https://remote.leofcoin.org/participating)
323
+
324
+ ```js
325
+ await client.participating()
326
+ ```
327
+
328
+ <br>
329
+
330
+ #### [network()](https://remote.leofcoin.org/network)
331
+
332
+ ```js
333
+ await client.network()
334
+ ```
335
+
336
+ <br>
337
+
338
+ #### [networkStats()](https://remote.leofcoin.org/networkStats)
339
+
340
+ ```js
341
+ await client.networkStats()
342
+ ```
343
+
344
+ <br>
345
+
346
+ #### [networkStats()](https://remote.leofcoin.org/networkStats)
347
+
348
+ ```js
349
+ await client.networkStats()
350
+ ```
351
+
352
+ <br>
353
+
354
+ #### [lastBlock()](https://remote.leofcoin.org/lastBlock)
355
+
356
+ ```js
357
+ await client.lastBlock()
358
+ ```
359
+
360
+ <br>
361
+
362
+ #### [blockHashMap()](https://remote.leofcoin.org/blockHashMap)
363
+
364
+ ```js
365
+ await client.blockHashMap()
366
+ ```
367
+
368
+ <br>
369
+
370
+ #### [bootstrap()](https://remote.leofcoin.org/bootstrap)
371
+
372
+ ```js
373
+ await client.bootstrap()
374
+ ```
375
+
376
+ <br>
package/exports/http.js CHANGED
@@ -37,9 +37,9 @@ export default (chain, port, networkVersion, remote = false) => {
37
37
  // @ts-ignore
38
38
  const balance = (await chain.balances)[ctx.query.address];
39
39
  if (balance)
40
- ctx.body = ctx.query.format ? formatUnits(balance) : balance;
40
+ ctx.body = ctx.query.format ? formatUnits(balance).toString() : balance.toString();
41
41
  else
42
- ctx.body = 0;
42
+ ctx.body = '0n';
43
43
  });
44
44
  router.get('/selectedAccount', (ctx) => {
45
45
  if (remote)
@@ -3,7 +3,7 @@ export declare const networkStats: (chain: any, networkVersion: any) => Promise<
3
3
  peers: any;
4
4
  accounts: any;
5
5
  accountsHolding: number;
6
- accountsHoldingAmount: string;
6
+ accountsHoldingAmount: any;
7
7
  topHolders: any[];
8
8
  }>;
9
9
  declare const _default: {
@@ -12,7 +12,7 @@ declare const _default: {
12
12
  peers: any;
13
13
  accounts: any;
14
14
  accountsHolding: number;
15
- accountsHoldingAmount: string;
15
+ accountsHoldingAmount: any;
16
16
  topHolders: any[];
17
17
  }>;
18
18
  bootstrap: () => Promise<any>;
package/exports/shared.js CHANGED
@@ -1,20 +1,20 @@
1
- import { formatUnits, BigNumber } from '@leofcoin/utils';
1
+ import { formatUnits } from '@leofcoin/utils';
2
2
  export const networkStats = async (chain, networkVersion) => {
3
3
  let accountsHolding = 0;
4
- let accountsHoldingAmount = BigNumber.from(0);
4
+ let accountsHoldingAmount = BigInt(0);
5
5
  let topHolders = [];
6
6
  const balances = Object.entries(await chain.balances)
7
7
  .map(([holder, amount]) => {
8
- amount = BigNumber.from(amount);
8
+ // amount = BigNumber.from(amount)
9
9
  return { holder, amount };
10
10
  })
11
11
  // @ts-ignore
12
12
  .sort((a, b) => formatUnits(b.amount.sub(a.amount)));
13
13
  for (let { holder, amount } of balances) {
14
14
  // @ts-ignore
15
- if (amount.gt(0)) {
15
+ if (amount > 0) {
16
16
  // @ts-ignore
17
- accountsHoldingAmount = accountsHoldingAmount.add(amount);
17
+ accountsHoldingAmount += amount;
18
18
  accountsHolding += 1;
19
19
  // @ts-ignore
20
20
  topHolders.length < 100 && topHolders.push({ holder, amount: formatUnits(amount) });
package/exports/ws.js CHANGED
@@ -13,9 +13,9 @@ export default (chain, port, networkVersion, remote = false) => {
13
13
  balanceOf: async ({ address, format = false }, { send }) => {
14
14
  const balance = (await chain.balances)[address];
15
15
  if (balance)
16
- send(format ? formatUnits(balance) : balance);
16
+ send(format ? formatUnits(balance).toString() : balance.toString());
17
17
  else
18
- send(0);
18
+ send('0n');
19
19
  },
20
20
  getNonce: async ({ address }, { send }) => send(await chain.getNonce(address)),
21
21
  selectedAccount: ({ send }) => {
package/package.json CHANGED
@@ -1,44 +1,45 @@
1
- {
2
- "name": "@leofcoin/endpoints",
3
- "version": "0.4.4",
4
- "description": "",
5
- "type": "module",
6
- "exports": {
7
- "./api": "./exports/api.md",
8
- "./http": "./exports/http.js",
9
- "./ws": "./exports/ws.js"
10
- },
11
- "files": [
12
- "./exports"
13
- ],
14
- "scripts": {
15
- "build": "npx tsc",
16
- "test": "echo \"Error: no test specified\" && exit 1"
17
- },
18
- "keywords": [],
19
- "author": "",
20
- "license": "MIT",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/leofcoin/endpoints.git"
24
- },
25
- "bugs": {
26
- "url": "https://github.com/leofcoin/endpoints/issues"
27
- },
28
- "homepage": "https://github.com/leofcoin/endpoints#readme",
29
- "dependencies": {
30
- "@koa/cors": "^5.0.0",
31
- "@koa/router": "^13.0.0",
32
- "@leofcoin/utils": "^1.1.18",
33
- "koa": "^2.15.3",
34
- "showdown": "^2.1.0",
35
- "socket-request-server": "^1.6.17"
36
- },
37
- "devDependencies": {
38
- "@types/koa__cors": "^5.0.0",
39
- "@types/koa__router": "^12.0.4",
40
- "@types/node": "^22.5.4",
41
- "@types/showdown": "^2.0.6",
42
- "typescript": "^5.6.2"
43
- }
44
- }
1
+ {
2
+ "name": "@leofcoin/endpoints",
3
+ "version": "0.4.6",
4
+ "description": "",
5
+ "type": "module",
6
+ "exports": {
7
+ "./api": "./exports/api.md",
8
+ "./http": "./exports/http.js",
9
+ "./ws": "./exports/ws.js"
10
+ },
11
+ "files": [
12
+ "./exports"
13
+ ],
14
+ "scripts": {
15
+ "build": "npx tsc",
16
+ "test": "echo \"Error: no test specified\" && exit 1"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/leofcoin/endpoints.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/leofcoin/endpoints/issues"
27
+ },
28
+ "homepage": "https://github.com/leofcoin/endpoints#readme",
29
+ "dependencies": {
30
+ "@koa/cors": "^5.0.0",
31
+ "@koa/router": "^13.1.1",
32
+ "@leofcoin/utils": "^1.1.40",
33
+ "koa": "^3.0.1",
34
+ "showdown": "^2.1.0",
35
+ "socket-request-server": "^1.6.17"
36
+ },
37
+ "devDependencies": {
38
+ "@leofcoin/types": "^1.0.22",
39
+ "@types/koa__cors": "^5.0.0",
40
+ "@types/koa__router": "^12.0.4",
41
+ "@types/node": "^24.1.0",
42
+ "@types/showdown": "^2.0.6",
43
+ "typescript": "^5.8.3"
44
+ }
45
+ }