koilib 6.0.0 → 7.1.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/README.md +39 -40
- package/dist/koinos.js +1675 -84
- package/dist/koinos.min.js +1 -1
- package/lib/Contract.d.ts +12 -24
- package/lib/Contract.js +11 -23
- package/lib/Contract.js.map +1 -1
- package/lib/Provider.d.ts +257 -12
- package/lib/Provider.js +288 -10
- package/lib/Provider.js.map +1 -1
- package/lib/Signer.d.ts +75 -6
- package/lib/Signer.js +87 -6
- package/lib/Signer.js.map +1 -1
- package/lib/Transaction.d.ts +4 -3
- package/lib/Transaction.js +13 -10
- package/lib/Transaction.js.map +1 -1
- package/lib/browser/Contract.d.ts +12 -24
- package/lib/browser/Contract.js +11 -23
- package/lib/browser/Contract.js.map +1 -1
- package/lib/browser/Provider.d.ts +257 -12
- package/lib/browser/Provider.js +288 -10
- package/lib/browser/Provider.js.map +1 -1
- package/lib/browser/Signer.d.ts +75 -6
- package/lib/browser/Signer.js +87 -6
- package/lib/browser/Signer.js.map +1 -1
- package/lib/browser/Transaction.d.ts +4 -3
- package/lib/browser/Transaction.js +13 -10
- package/lib/browser/Transaction.js.map +1 -1
- package/lib/browser/interface.d.ts +34 -0
- package/lib/browser/utils.d.ts +39 -0
- package/lib/browser/utils.js +1276 -27
- package/lib/browser/utils.js.map +1 -1
- package/lib/interface.d.ts +34 -0
- package/lib/utils.d.ts +39 -0
- package/lib/utils.js +1276 -27
- package/lib/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/Contract.ts +12 -24
- package/src/Provider.ts +303 -24
- package/src/Signer.ts +126 -7
- package/src/Transaction.ts +17 -16
- package/src/interface.ts +39 -0
- package/src/utils.ts +1283 -23
- package/lib/browser/jsonDescriptors/token-proto.json +0 -234
- package/lib/jsonDescriptors/token-proto.json +0 -234
- package/src/jsonDescriptors/token-proto.json +0 -234
package/lib/Provider.js
CHANGED
|
@@ -25,8 +25,8 @@ class Provider {
|
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
27
|
* const provider = new Provider([
|
|
28
|
-
* "
|
|
29
|
-
* "
|
|
28
|
+
* "https://api.koinos.io",
|
|
29
|
+
* "https://api.koinosblocks.com"
|
|
30
30
|
* ]);
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
@@ -43,6 +43,151 @@ class Provider {
|
|
|
43
43
|
* @param method - jsonrpc method
|
|
44
44
|
* @param params - jsonrpc params
|
|
45
45
|
* @returns Result of jsonrpc response
|
|
46
|
+
*
|
|
47
|
+
* To know the full list of possible calls check the services
|
|
48
|
+
* listed in the [rpc folder of koinos-proto](https://github.com/koinos/koinos-proto/tree/master/koinos/rpc)
|
|
49
|
+
* and the corresponding proto files.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* Let's take "account_history" as an example. Go to [account_history_rpc.proto](https://github.com/koinos/koinos-proto/blob/master/koinos/rpc/account_history/account_history_rpc.proto).
|
|
53
|
+
* The `account_history_request` message has 1 single method: `get_account_history`.
|
|
54
|
+
*
|
|
55
|
+
* Now search the message `get_account_history_request`. This message is telling us
|
|
56
|
+
* the expected fields in the body of the call:
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* message get_account_history_request {
|
|
60
|
+
* bytes address = 1 [(btype) = ADDRESS];
|
|
61
|
+
* optional uint64 seq_num = 2 [jstype = JS_STRING];
|
|
62
|
+
* uint64 limit = 3 [jstype = JS_STRING];
|
|
63
|
+
* bool ascending = 4;
|
|
64
|
+
* bool irreversible = 5;
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* And search the message `get_account_history_response` to see the format of the response:
|
|
69
|
+
* ```ts
|
|
70
|
+
* message get_account_history_response {
|
|
71
|
+
* repeated account_history_entry values = 1;
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* With this information we can now call the RPC node. It should be done in this way:
|
|
76
|
+
* ```ts
|
|
77
|
+
* const provider = new Provider(["https://api.koinos.io"]);
|
|
78
|
+
* const result = await provider.call(
|
|
79
|
+
* "account_history.get_account_history",
|
|
80
|
+
* {
|
|
81
|
+
* address: "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
|
|
82
|
+
* limit: 2,
|
|
83
|
+
* ascending: true,
|
|
84
|
+
* irreversible: true,
|
|
85
|
+
* }
|
|
86
|
+
* );
|
|
87
|
+
* console.log(result);
|
|
88
|
+
*
|
|
89
|
+
* // {
|
|
90
|
+
* // "values": [
|
|
91
|
+
* // {
|
|
92
|
+
* // "trx": {
|
|
93
|
+
* // "transaction": {
|
|
94
|
+
* // "id": "0x12205b566701d6afcf1f5e45b5e9f5443def75728c219f7c1e897ed0ce1ef491223c",
|
|
95
|
+
* // "header": {
|
|
96
|
+
* // "chain_id": "EiBZK_GGVP0H_fXVAM3j6EAuz3-B-l3ejxRSewi7qIBfSA==",
|
|
97
|
+
* // "rc_limit": "961224079493",
|
|
98
|
+
* // "nonce": "KAE=",
|
|
99
|
+
* // "operation_merkle_root": "EiA32K_GrZ2VsvWSrM4QZhyEmvm8ID1P6aE4vP00RnY9hg==",
|
|
100
|
+
* // "payer": "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18"
|
|
101
|
+
* // },
|
|
102
|
+
* // "operations": [
|
|
103
|
+
* // {
|
|
104
|
+
* // "call_contract": {
|
|
105
|
+
* // "contract_id": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
|
|
106
|
+
* // "entry_point": 670398154,
|
|
107
|
+
* // "args": "ChkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHEhkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrGIDC1y8="
|
|
108
|
+
* // }
|
|
109
|
+
* // }
|
|
110
|
+
* // ],
|
|
111
|
+
* // "signatures": [
|
|
112
|
+
* // "ICBdTcH6jzhDpl9ZB0ZqNcvSy8wiOokHFtkQ66Lc04K1LhXd77tqaQdMhJOAfYotg5npVmfSgyO9CwgLJmtMIjg="
|
|
113
|
+
* // ]
|
|
114
|
+
* // },
|
|
115
|
+
* // "receipt": {
|
|
116
|
+
* // "id": "0x12205b566701d6afcf1f5e45b5e9f5443def75728c219f7c1e897ed0ce1ef491223c",
|
|
117
|
+
* // "payer": "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18",
|
|
118
|
+
* // "max_payer_rc": "961224079493",
|
|
119
|
+
* // "rc_limit": "961224079493",
|
|
120
|
+
* // "rc_used": "3009833",
|
|
121
|
+
* // "disk_storage_used": "112",
|
|
122
|
+
* // "network_bandwidth_used": "313",
|
|
123
|
+
* // "compute_bandwidth_used": "561439",
|
|
124
|
+
* // "events": [
|
|
125
|
+
* // {
|
|
126
|
+
* // "sequence": 2,
|
|
127
|
+
* // "source": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
|
|
128
|
+
* // "name": "koinos.contracts.token.transfer_event",
|
|
129
|
+
* // "data": "ChkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHEhkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrGIDC1y8=",
|
|
130
|
+
* // "impacted": [
|
|
131
|
+
* // "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
|
|
132
|
+
* // "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18"
|
|
133
|
+
* // ]
|
|
134
|
+
* // }
|
|
135
|
+
* // ]
|
|
136
|
+
* // }
|
|
137
|
+
* // }
|
|
138
|
+
* // },
|
|
139
|
+
* // {
|
|
140
|
+
* // "seq_num": "1",
|
|
141
|
+
* // "trx": {
|
|
142
|
+
* // "transaction": {
|
|
143
|
+
* // "id": "0x1220a08183a5237e57a08e1ae539017c4253ddfbc23f9b7b6f5e263669aacd3fed47",
|
|
144
|
+
* // "header": {
|
|
145
|
+
* // "chain_id": "EiBZK_GGVP0H_fXVAM3j6EAuz3-B-l3ejxRSewi7qIBfSA==",
|
|
146
|
+
* // "rc_limit": "100000000",
|
|
147
|
+
* // "nonce": "KAE=",
|
|
148
|
+
* // "operation_merkle_root": "EiBAmutXQlPyAGctNBNhKEUUEUtwj2KQeNrdFBqpN9RWDg==",
|
|
149
|
+
* // "payer": "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe"
|
|
150
|
+
* // },
|
|
151
|
+
* // "operations": [
|
|
152
|
+
* // {
|
|
153
|
+
* // "call_contract": {
|
|
154
|
+
* // "contract_id": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
|
|
155
|
+
* // "entry_point": 670398154,
|
|
156
|
+
* // "args": "ChkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrEhkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHGJBO"
|
|
157
|
+
* // }
|
|
158
|
+
* // }
|
|
159
|
+
* // ],
|
|
160
|
+
* // "signatures": [
|
|
161
|
+
* // "IF5FBloKjEfnqlGJRL_aPy4L36On-Q8XXzpAQagK_X-xZ6DgioBhZOhKEnhKyhaoROAgGwRuy6BsdRqya8fCHU8="
|
|
162
|
+
* // ]
|
|
163
|
+
* // },
|
|
164
|
+
* // "receipt": {
|
|
165
|
+
* // "id": "0x1220a08183a5237e57a08e1ae539017c4253ddfbc23f9b7b6f5e263669aacd3fed47",
|
|
166
|
+
* // "payer": "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe",
|
|
167
|
+
* // "max_payer_rc": "100000000",
|
|
168
|
+
* // "rc_limit": "100000000",
|
|
169
|
+
* // "rc_used": "2657385",
|
|
170
|
+
* // "disk_storage_used": "35",
|
|
171
|
+
* // "network_bandwidth_used": "309",
|
|
172
|
+
* // "compute_bandwidth_used": "566375",
|
|
173
|
+
* // "events": [
|
|
174
|
+
* // {
|
|
175
|
+
* // "sequence": 2,
|
|
176
|
+
* // "source": "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
|
|
177
|
+
* // "name": "koinos.contracts.token.transfer_event",
|
|
178
|
+
* // "data": "ChkACsvmdCIUj89udQ1R5iLPLXzqJoHdliWrEhkAukkLSXtxbRNRTBtDrdAwDI7I6Ot9GxFHGJBO",
|
|
179
|
+
* // "impacted": [
|
|
180
|
+
* // "1HyzBsd7nmyUp8dyCJqJZoQRUnzifVzP18",
|
|
181
|
+
* // "1z629tURV9KAK6Q5yqFDozwSHeWshxXQe"
|
|
182
|
+
* // ]
|
|
183
|
+
* // }
|
|
184
|
+
* // ]
|
|
185
|
+
* // }
|
|
186
|
+
* // }
|
|
187
|
+
* // }
|
|
188
|
+
* // ]
|
|
189
|
+
* // }
|
|
190
|
+
* ```
|
|
46
191
|
*/
|
|
47
192
|
async call(method, params) {
|
|
48
193
|
/* eslint-disable no-await-in-loop */
|
|
@@ -153,11 +298,29 @@ class Provider {
|
|
|
153
298
|
return this.call("block_store.get_blocks_by_id", {
|
|
154
299
|
block_ids: blockIds,
|
|
155
300
|
return_block: opts && opts.returnBlock !== undefined ? opts.returnBlock : true,
|
|
156
|
-
return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt :
|
|
301
|
+
return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : true,
|
|
157
302
|
});
|
|
158
303
|
}
|
|
159
304
|
/**
|
|
160
305
|
* Function to get info from the head block in the blockchain
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* const provider = new Provider("https://api.koinos.io");
|
|
310
|
+
* const headInfo = await provider.getHeadInfo();
|
|
311
|
+
* console.log(headInfo);
|
|
312
|
+
*
|
|
313
|
+
* // {
|
|
314
|
+
* // head_topology: {
|
|
315
|
+
* // id: '0x12209f7c9b4d695eefd6f87465d490654e495fe25a3d7d2e1eb80658acdc49bad962',
|
|
316
|
+
* // height: '14957951',
|
|
317
|
+
* // previous: '0x1220bc3b94e3a2adc3ca09d61a4418df1f4acfa78a69686f592877c194ea50642cd2'
|
|
318
|
+
* // },
|
|
319
|
+
* // last_irreversible_block: '14957891',
|
|
320
|
+
* // head_state_merkle_root: 'EiCriqXooNUXBG23EUKLz2qq3h9ZAC8w1W7w185YQ9MzIA==',
|
|
321
|
+
* // head_block_time: '1713874497290'
|
|
322
|
+
* // }
|
|
323
|
+
* ```
|
|
161
324
|
*/
|
|
162
325
|
async getHeadInfo() {
|
|
163
326
|
return this.call("chain.get_head_info", {});
|
|
@@ -188,14 +351,80 @@ class Provider {
|
|
|
188
351
|
ancestor_start_height: height,
|
|
189
352
|
num_blocks: numBlocks,
|
|
190
353
|
return_block: opts && opts.returnBlock !== undefined ? opts.returnBlock : true,
|
|
191
|
-
return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt :
|
|
354
|
+
return_receipt: opts && opts.returnReceipt !== undefined ? opts.returnReceipt : true,
|
|
192
355
|
})).block_items;
|
|
193
356
|
}
|
|
194
357
|
/**
|
|
195
358
|
* Function to get a block by its height
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* const provider = new Provider("https://api.koinos.io");
|
|
363
|
+
* const block = await provider.getBlock(14951433);
|
|
364
|
+
* console.log(block);
|
|
365
|
+
*
|
|
366
|
+
* // {
|
|
367
|
+
* // block_id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
|
|
368
|
+
* // block_height: '14951433',
|
|
369
|
+
* // block: {
|
|
370
|
+
* // id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
|
|
371
|
+
* // header: {
|
|
372
|
+
* // previous: '0x1220a3c4cbc57ccee4d02b4a1849a9e504122ee93b904deff711d926def2ea2cc878',
|
|
373
|
+
* // height: '14951433',
|
|
374
|
+
* // timestamp: '1713854518430',
|
|
375
|
+
* // previous_state_merkle_root: 'EiCPcnYosMvEBYeCcJrdIJJG0mp4TJ796UGxa0NY6EvzbQ==',
|
|
376
|
+
* // transaction_merkle_root: 'EiBGPKwttckB7c_BafwnHHmHTBa9S1vKBKauj_yLVNb0tg==',
|
|
377
|
+
* // signer: '1EPZaqve43k9Jq5mNeT2ydCjUiytTTU4U',
|
|
378
|
+
* // approved_proposals: [Array]
|
|
379
|
+
* // },
|
|
380
|
+
* // transactions: [ [Object] ],
|
|
381
|
+
* // signature: 'ClEDnHKX1F-pQVbFhmz2qnrwGfP-RbEfTdRFUrvmhmqMeoejtmm2Q0yIPbD5kN5xpIEb
|
|
382
|
+
* // 8vVwsIJ3lTrgFz2E8w0Paxkgv1E_gMaYNq5UUqtHnl0SIhIgAAbuPHmfMKh9R0Yi5y1D
|
|
383
|
+
* // TpjjdN0DYKaIUseXzLiLg_QaQR9jRinZf0g_qo2_4wOx9gDBunIij0r5CycHrNMsuT_V
|
|
384
|
+
* // _UvrJOYuwj7aUCA-qnF2tCBQoNQZ3ww7WvKHrMdChxxy'
|
|
385
|
+
* // },
|
|
386
|
+
* // receipt: {
|
|
387
|
+
* // id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
|
|
388
|
+
* // height: '14951433',
|
|
389
|
+
* // disk_storage_used: '35',
|
|
390
|
+
* // network_bandwidth_used: '760',
|
|
391
|
+
* // compute_bandwidth_used: '5253506',
|
|
392
|
+
* // events: [ [Object], [Object] ],
|
|
393
|
+
* // transaction_receipts: [ [Object] ],
|
|
394
|
+
* // disk_storage_charged: '35',
|
|
395
|
+
* // network_bandwidth_charged: '760',
|
|
396
|
+
* // compute_bandwidth_charged: '5180427',
|
|
397
|
+
* // state_delta_entries: [
|
|
398
|
+
* // [Object], [Object],
|
|
399
|
+
* // [Object], [Object],
|
|
400
|
+
* // [Object], [Object],
|
|
401
|
+
* // [Object], [Object],
|
|
402
|
+
* // [Object], [Object]
|
|
403
|
+
* // ]
|
|
404
|
+
* // }
|
|
405
|
+
* // }
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* Use the options to get less information. This helps to reduce
|
|
409
|
+
* the bandwidth of the call.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* const provider = new Provider("https://api.koinos.io");
|
|
414
|
+
* const block = await provider.getBlock(14951433, {
|
|
415
|
+
* returnReceipt: false,
|
|
416
|
+
* returnBlock: false
|
|
417
|
+
* });
|
|
418
|
+
* console.log(block);
|
|
419
|
+
*
|
|
420
|
+
* // {
|
|
421
|
+
* // block_id: '0x1220d5e848eb0f69c590c24cbea4391f89a1055f540bc265c60f6b13c4cc0055ec36',
|
|
422
|
+
* // block_height: '14951433'
|
|
423
|
+
* // }
|
|
424
|
+
* ```
|
|
196
425
|
*/
|
|
197
|
-
async getBlock(height) {
|
|
198
|
-
return (await this.getBlocks(height, 1))[0];
|
|
426
|
+
async getBlock(height, opts) {
|
|
427
|
+
return (await this.getBlocks(height, 1, undefined, opts))[0];
|
|
199
428
|
}
|
|
200
429
|
/**
|
|
201
430
|
* Function to wait for a transaction to be mined.
|
|
@@ -307,10 +536,37 @@ class Provider {
|
|
|
307
536
|
* and the transaction with the arrow function "wait" (see [[wait]])
|
|
308
537
|
*/
|
|
309
538
|
async sendTransaction(transaction, broadcast = true) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
539
|
+
let response;
|
|
540
|
+
try {
|
|
541
|
+
response = await this.call("chain.submit_transaction", { transaction, broadcast });
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
if (!error.message.includes("rpc failed, context deadline exceeded")) {
|
|
545
|
+
throw error;
|
|
546
|
+
}
|
|
547
|
+
response = {
|
|
548
|
+
receipt: {
|
|
549
|
+
id: transaction.id,
|
|
550
|
+
payer: transaction.header.payer,
|
|
551
|
+
max_payer_rc: "",
|
|
552
|
+
rc_limit: transaction.header.rc_limit.toString(),
|
|
553
|
+
rc_used: "",
|
|
554
|
+
disk_storage_used: "",
|
|
555
|
+
network_bandwidth_used: "",
|
|
556
|
+
compute_bandwidth_used: "",
|
|
557
|
+
reverted: false,
|
|
558
|
+
events: [],
|
|
559
|
+
state_delta_entries: [],
|
|
560
|
+
logs: [],
|
|
561
|
+
rpc_error: JSON.parse(error.message),
|
|
562
|
+
},
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
if (broadcast) {
|
|
566
|
+
transaction.wait = async (type = "byBlock", timeout = 15000) => {
|
|
567
|
+
return this.wait(transaction.id, type, timeout);
|
|
568
|
+
};
|
|
569
|
+
}
|
|
314
570
|
return { ...response, transaction: transaction };
|
|
315
571
|
}
|
|
316
572
|
/**
|
|
@@ -362,6 +618,28 @@ class Provider {
|
|
|
362
618
|
const result = await serializer.deserialize(response.value, serializer.returnTypeName);
|
|
363
619
|
return result;
|
|
364
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Function to get the contract metadata of a specific contract.
|
|
623
|
+
* @param contractId contract ID
|
|
624
|
+
*
|
|
625
|
+
* @example
|
|
626
|
+
* ```ts
|
|
627
|
+
* const provider = new Provider("https://api.koinos.io");
|
|
628
|
+
* const result = await provider.invokeGetContractMetadata("15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL");
|
|
629
|
+
* console.log(result);
|
|
630
|
+
*
|
|
631
|
+
* // {
|
|
632
|
+
* // value: {
|
|
633
|
+
* // hash: '0x1220c57e3573189868970a3a1662a667c366b15015d9b7900ffed415c5e944036e88',
|
|
634
|
+
* // system: true,
|
|
635
|
+
* // authorizes_call_contract: true,
|
|
636
|
+
* // authorizes_transaction_application: true,
|
|
637
|
+
* // authorizes_upload_contract: true
|
|
638
|
+
* // }
|
|
639
|
+
* // }
|
|
640
|
+
*
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
365
643
|
async invokeGetContractMetadata(contractId) {
|
|
366
644
|
const serializer = new Serializer_1.Serializer({
|
|
367
645
|
nested: {
|
package/lib/Provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../src/Provider.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAShC,6DAA6D;AAC7D,aAAa;AACb,wEAA0D;AAC1D,mC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F;iBACF;gBACD,4BAA4B,EAAE;oBAC5B,MAAM,EAAE;wBACN,KAAK,EAAE;4BACL,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,CAAC;yBACN;qBACF;iBACF;gBACD,wBAAwB,EAAE;oBACxB,MAAM,EAAE;wBACN,IAAI,EAAE;4BACJ,IAAI,EAAE,OAAO;4BACb,EAAE,EAAE,CAAC;4BACL,OAAO,EAAE;gCACP,gBAAgB,EAAE,KAAK;6BACxB;yBACF;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,MAAM;4BACZ,EAAE,EAAE,CAAC;yBACN;wBACD,wBAAwB,EAAE;4BACxB,IAAI,EAAE,MAAM;4BACZ,EAAE,EAAE,CAAC;yBACN;wBACD,kCAAkC,EAAE;4BAClC,IAAI,EAAE,MAAM;4BACZ,EAAE,EAAE,CAAC;yBACN;wBACD,0BAA0B,EAAE;4BAC1B,IAAI,EAAE,MAAM;4BACZ,EAAE,EAAE,CAAC;yBACN;qBACF;iBACF;aACF;SACF,EACD;YACE,iBAAiB,EAAE,iCAAiC;YACpD,cAAc,EAAE,8BAA8B;SAC/C,CACF,CAAC;QACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,uBAAuB,EAAE;YAChE,WAAW,EAAE,UAAU;SACxB,CAAC,CAAC;IACL,CAAC;CACF;AA73BD,4BA63BC;AAED,kBAAe,QAAQ,CAAC"}
|
package/lib/Signer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Provider } from "./Provider";
|
|
2
|
-
import { TransactionJson, TransactionJsonWait, BlockJson, RecoverPublicKeyOptions, Abi, TransactionReceipt, SendTransactionOptions } from "./interface";
|
|
2
|
+
import { TransactionJson, TransactionJsonWait, BlockJson, RecoverPublicKeyOptions, Abi, TransactionReceipt, SendTransactionOptions, ResourceCreditsOptions } from "./interface";
|
|
3
3
|
export interface SignerInterface {
|
|
4
4
|
provider?: Provider;
|
|
5
5
|
getAddress: (compressed?: boolean) => string;
|
|
@@ -79,10 +79,6 @@ export declare class Signer implements SignerInterface {
|
|
|
79
79
|
* Account address
|
|
80
80
|
*/
|
|
81
81
|
address: string;
|
|
82
|
-
/**
|
|
83
|
-
* Chain id
|
|
84
|
-
*/
|
|
85
|
-
chainId: string;
|
|
86
82
|
/**
|
|
87
83
|
* Provider to connect with the blockchain
|
|
88
84
|
*/
|
|
@@ -93,6 +89,32 @@ export declare class Signer implements SignerInterface {
|
|
|
93
89
|
* are undefined
|
|
94
90
|
*/
|
|
95
91
|
sendOptions?: SendTransactionOptions;
|
|
92
|
+
/**
|
|
93
|
+
* Options related to the estimation of the rcLimit.
|
|
94
|
+
* By default the estimation is enabled and increased
|
|
95
|
+
* by 10%.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* This code estimates the mana by multiplying the rc_used
|
|
99
|
+
* by 2.
|
|
100
|
+
* ```ts
|
|
101
|
+
* const signer = new Signer({
|
|
102
|
+
* privateKey,
|
|
103
|
+
* provider,
|
|
104
|
+
* rcOptions: {
|
|
105
|
+
* estimateRc: true,
|
|
106
|
+
* adjustRcLimit: (receipt) => 2 * Number(receipt.rc_used),
|
|
107
|
+
* },
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // you can also update rcOptions
|
|
111
|
+
* signer.rcOptions = {
|
|
112
|
+
* estimateRc: true,
|
|
113
|
+
* adjustRcLimit: (receipt) => 2 * Number(receipt.rc_used),
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
rcOptions: ResourceCreditsOptions;
|
|
96
118
|
/**
|
|
97
119
|
* The constructor receives de private key as hexstring, bigint or Uint8Array.
|
|
98
120
|
* See also the functions [[Signer.fromWif]] and [[Signer.fromSeed]]
|
|
@@ -101,6 +123,8 @@ export declare class Signer implements SignerInterface {
|
|
|
101
123
|
* @param privateKey - Private key as hexstring, bigint or Uint8Array
|
|
102
124
|
* @param compressed - compressed format is true by default
|
|
103
125
|
* @param provider - provider to connect with the blockchain
|
|
126
|
+
* @param sendOptions - Send options
|
|
127
|
+
* @param rcOptions - options for mana estimation
|
|
104
128
|
* @example
|
|
105
129
|
* ```ts
|
|
106
130
|
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
@@ -108,13 +132,46 @@ export declare class Signer implements SignerInterface {
|
|
|
108
132
|
* console.log(signer.getAddress());
|
|
109
133
|
* // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
|
|
110
134
|
* ```
|
|
135
|
+
*
|
|
136
|
+
* By default the mana is estimated as 110% the mana used. This
|
|
137
|
+
* estimation is computed using the "broadcast:false" option.
|
|
138
|
+
* For instance, if the transaction consumes 1 mana, the rc_limit
|
|
139
|
+
* will be set to 1.1 mana.
|
|
140
|
+
*
|
|
141
|
+
* You can also adjust the rc limit.
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
145
|
+
* cons signer = new Signer({
|
|
146
|
+
* privateKey,
|
|
147
|
+
* provider,
|
|
148
|
+
* rcOptions: {
|
|
149
|
+
* estimateRc: true,
|
|
150
|
+
* // use 2 times rc_used as rc_limit
|
|
151
|
+
* adjustRcLimit: (r) => 2 * Number(r.rc_used),
|
|
152
|
+
* },
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* The rpc node must be highly trusted because the transaction
|
|
157
|
+
* is signed during the estimation of the mana. You can also
|
|
158
|
+
* disable the mana estimation:
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
162
|
+
* cons signer = new Signer({
|
|
163
|
+
* privateKey,
|
|
164
|
+
* provider,
|
|
165
|
+
* rcOptions: { estimateRc: false },
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
111
168
|
*/
|
|
112
169
|
constructor(c: {
|
|
113
170
|
privateKey: string | number | bigint | Uint8Array;
|
|
114
171
|
compressed?: boolean;
|
|
115
|
-
chainId?: string;
|
|
116
172
|
provider?: Provider;
|
|
117
173
|
sendOptions?: SendTransactionOptions;
|
|
174
|
+
rcOptions?: ResourceCreditsOptions;
|
|
118
175
|
});
|
|
119
176
|
/**
|
|
120
177
|
* Function to import a private key from the WIF
|
|
@@ -201,6 +258,18 @@ export declare class Signer implements SignerInterface {
|
|
|
201
258
|
receipt: TransactionReceipt;
|
|
202
259
|
transaction: TransactionJsonWait;
|
|
203
260
|
}>;
|
|
261
|
+
/**
|
|
262
|
+
* Estimate the receipt associated to the transaction if
|
|
263
|
+
* it sent to the blockchain. It is useful to estimate the
|
|
264
|
+
* consumption of mana.
|
|
265
|
+
* The transaction is signed during this process and sent
|
|
266
|
+
* to the rpc node with the "broadcast:false" option to
|
|
267
|
+
* just compute the transaction without broadcasting it to
|
|
268
|
+
* the network.
|
|
269
|
+
* After that, the initial signatures are restored (if any)
|
|
270
|
+
* and the ones used for the estimation will be removed.
|
|
271
|
+
*/
|
|
272
|
+
estimateReceipt(tx: TransactionJson | TransactionJsonWait): Promise<TransactionReceipt>;
|
|
204
273
|
/**
|
|
205
274
|
* Function to recover the public key from hash and signature
|
|
206
275
|
* @param hash - hash sha256
|
package/lib/Signer.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.Signer = void 0;
|
|
|
27
27
|
/* eslint-disable no-param-reassign, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
|
|
28
28
|
const sha256_1 = require("@noble/hashes/sha256");
|
|
29
29
|
const secp = __importStar(require("@noble/secp256k1"));
|
|
30
|
+
const Transaction_1 = require("./Transaction");
|
|
30
31
|
const utils_1 = require("./utils");
|
|
31
32
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
32
33
|
// @ts-ignore
|
|
@@ -110,6 +111,8 @@ class Signer {
|
|
|
110
111
|
* @param privateKey - Private key as hexstring, bigint or Uint8Array
|
|
111
112
|
* @param compressed - compressed format is true by default
|
|
112
113
|
* @param provider - provider to connect with the blockchain
|
|
114
|
+
* @param sendOptions - Send options
|
|
115
|
+
* @param rcOptions - options for mana estimation
|
|
113
116
|
* @example
|
|
114
117
|
* ```ts
|
|
115
118
|
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
@@ -117,12 +120,42 @@ class Signer {
|
|
|
117
120
|
* console.log(signer.getAddress());
|
|
118
121
|
* // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
|
|
119
122
|
* ```
|
|
123
|
+
*
|
|
124
|
+
* By default the mana is estimated as 110% the mana used. This
|
|
125
|
+
* estimation is computed using the "broadcast:false" option.
|
|
126
|
+
* For instance, if the transaction consumes 1 mana, the rc_limit
|
|
127
|
+
* will be set to 1.1 mana.
|
|
128
|
+
*
|
|
129
|
+
* You can also adjust the rc limit.
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
133
|
+
* cons signer = new Signer({
|
|
134
|
+
* privateKey,
|
|
135
|
+
* provider,
|
|
136
|
+
* rcOptions: {
|
|
137
|
+
* estimateRc: true,
|
|
138
|
+
* // use 2 times rc_used as rc_limit
|
|
139
|
+
* adjustRcLimit: (r) => 2 * Number(r.rc_used),
|
|
140
|
+
* },
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* The rpc node must be highly trusted because the transaction
|
|
145
|
+
* is signed during the estimation of the mana. You can also
|
|
146
|
+
* disable the mana estimation:
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
|
|
150
|
+
* cons signer = new Signer({
|
|
151
|
+
* privateKey,
|
|
152
|
+
* provider,
|
|
153
|
+
* rcOptions: { estimateRc: false },
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
120
156
|
*/
|
|
121
157
|
constructor(c) {
|
|
122
|
-
|
|
123
|
-
* Chain id
|
|
124
|
-
*/
|
|
125
|
-
this.chainId = "";
|
|
158
|
+
var _a;
|
|
126
159
|
this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
|
|
127
160
|
this.privateKey = c.privateKey;
|
|
128
161
|
this.provider = c.provider;
|
|
@@ -134,12 +167,14 @@ class Signer {
|
|
|
134
167
|
this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
|
|
135
168
|
this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
|
|
136
169
|
}
|
|
137
|
-
if (c.chainId)
|
|
138
|
-
this.chainId = c.chainId;
|
|
139
170
|
this.sendOptions = {
|
|
140
171
|
broadcast: true,
|
|
141
172
|
...c.sendOptions,
|
|
142
173
|
};
|
|
174
|
+
this.rcOptions = (_a = c.rcOptions) !== null && _a !== void 0 ? _a : {
|
|
175
|
+
estimateRc: true,
|
|
176
|
+
adjustRcLimit: (receipt) => Promise.resolve(Math.min(Number(receipt.max_payer_rc), Math.floor(1.1 * Number(receipt.rc_used)))),
|
|
177
|
+
};
|
|
143
178
|
}
|
|
144
179
|
/**
|
|
145
180
|
* Function to import a private key from the WIF
|
|
@@ -259,6 +294,15 @@ class Signer {
|
|
|
259
294
|
async signTransaction(tx, _abis) {
|
|
260
295
|
if (!tx.id)
|
|
261
296
|
throw new Error("Missing transaction id");
|
|
297
|
+
// estimation of rcLimit
|
|
298
|
+
if (this.rcOptions.estimateRc &&
|
|
299
|
+
(!tx.signatures || tx.signatures.length === 0)) {
|
|
300
|
+
const receipt = await this.estimateReceipt(tx);
|
|
301
|
+
tx.header.rc_limit = this.rcOptions.adjustRcLimit
|
|
302
|
+
? await this.rcOptions.adjustRcLimit(receipt)
|
|
303
|
+
: receipt.rc_used;
|
|
304
|
+
tx.id = Transaction_1.Transaction.computeTransactionId(tx.header);
|
|
305
|
+
}
|
|
262
306
|
// multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
|
|
263
307
|
// tx id is a stringified multihash, need to extract the hash digest only
|
|
264
308
|
const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
|
|
@@ -307,6 +351,43 @@ class Signer {
|
|
|
307
351
|
}
|
|
308
352
|
return this.provider.sendTransaction(transaction, opts.broadcast);
|
|
309
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Estimate the receipt associated to the transaction if
|
|
356
|
+
* it sent to the blockchain. It is useful to estimate the
|
|
357
|
+
* consumption of mana.
|
|
358
|
+
* The transaction is signed during this process and sent
|
|
359
|
+
* to the rpc node with the "broadcast:false" option to
|
|
360
|
+
* just compute the transaction without broadcasting it to
|
|
361
|
+
* the network.
|
|
362
|
+
* After that, the initial signatures are restored (if any)
|
|
363
|
+
* and the ones used for the estimation will be removed.
|
|
364
|
+
*/
|
|
365
|
+
async estimateReceipt(tx) {
|
|
366
|
+
if (!tx.id)
|
|
367
|
+
throw new Error("Missing transaction id");
|
|
368
|
+
if (!tx.signatures)
|
|
369
|
+
tx.signatures = [];
|
|
370
|
+
const signaturesCopy = [...tx.signatures];
|
|
371
|
+
// sign if there are no signatures
|
|
372
|
+
if (tx.signatures.length === 0) {
|
|
373
|
+
const hash = (0, utils_1.toUint8Array)(tx.id.slice(6));
|
|
374
|
+
const signature = await this.signHash(hash);
|
|
375
|
+
tx.signatures.push((0, utils_1.encodeBase64url)(signature));
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const { receipt } = await this.sendTransaction(tx, {
|
|
379
|
+
broadcast: false,
|
|
380
|
+
});
|
|
381
|
+
// restore signatures
|
|
382
|
+
tx.signatures = signaturesCopy;
|
|
383
|
+
return receipt;
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
// restore signatures
|
|
387
|
+
tx.signatures = signaturesCopy;
|
|
388
|
+
throw error;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
310
391
|
/**
|
|
311
392
|
* Function to recover the public key from hash and signature
|
|
312
393
|
* @param hash - hash sha256
|