evm-transactions-tools 0.0.1 → 0.0.3

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/fs-worker.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
@@ -31,17 +31,10 @@
31
31
  * If not, see <https://www.gnu.org/licenses/>.
32
32
  */
33
33
 
34
-
35
- // const
36
- // { ethers } =
37
- // require(
38
- // "ethers");
39
- // _ethers =
40
- // ethers;
41
34
  const
42
35
  _libcrash =
43
36
  require(
44
- '../libcrash-js/crash-js');
37
+ "crash-js");
45
38
  _cmdline_check =
46
39
  _libcrash._cmdline_check;
47
40
  _dirname =
@@ -61,17 +54,13 @@ _msg_error =
61
54
  _printf =
62
55
  _libcrash._printf;
63
56
  const
64
- _evm_wallet_get =
57
+ _evm_wallet_module =
65
58
  require(
66
- '../evm-wallet/wallet-get');
59
+ "evm-wallet.js");
67
60
  _wallet_get =
68
- _evm_wallet_get._wallet_get;
69
- const
70
- _network_provider_module =
71
- require(
72
- '../evm-wallet/network-provider');
61
+ _evm_wallet_module._wallet_get;
73
62
  _provider_get =
74
- _network_provider_module._provider_get;
63
+ _evm_wallet_module._provider_get;
75
64
 
76
65
  function
77
66
  _global_variables() {
@@ -32,16 +32,10 @@
32
32
  */
33
33
 
34
34
 
35
- // const
36
- // { ethers } =
37
- // require(
38
- // "ethers");
39
- // _ethers =
40
- // ethers;
41
35
  const
42
36
  _libcrash =
43
37
  require(
44
- '../libcrash-js/crash-js');
38
+ "crash-js");
45
39
  _cmdline_check =
46
40
  _libcrash._cmdline_check;
47
41
  _dirname =
@@ -61,17 +55,13 @@ _msg_error =
61
55
  _printf =
62
56
  _libcrash._printf;
63
57
  const
64
- _evm_wallet_get =
58
+ _evm_wallet_module =
65
59
  require(
66
- '../evm-wallet/wallet-get');
60
+ "evm-wallet.js");
67
61
  _wallet_get =
68
- _evm_wallet_get._wallet_get;
69
- const
70
- _network_provider_module =
71
- require(
72
- '../evm-wallet/network-provider');
62
+ _evm_wallet_module._wallet_get;
73
63
  _provider_get =
74
- _network_provider_module._provider_get;
64
+ _evm_wallet_module._provider_get;
75
65
 
76
66
  function
77
67
  _global_variables() {
@@ -238,39 +228,16 @@ function
238
228
  let
239
229
  _line,
240
230
  _text;
241
- _text = [];
242
- _text.push(
243
- " Maximum retries: {retries_max}".replace(
244
- "{retries_max}",
245
- retries_max));
246
- _text.push(
247
- " Wallet seed: {wallet_seed}".replace(
248
- "{wallet_seed}",
249
- wallet_seed));
250
- _text.push(
251
- " Chain ID: {chain_id}".replace(
252
- "{chain_id}",
253
- chain_id));
254
- _text.push(
255
- " Chain Name: {chain_name}".replace(
256
- "{chain_name}",
257
- chain_name));
258
- _text.push(
259
- " Target network: {target_network}".replace(
260
- "{target_network}",
261
- target_network));
262
- _text.push(
263
- " API Key: {api_key_path}".replace(
264
- "{api_key_path}",
265
- api_key_path));
266
- _text.push(
267
- " Output path: {output_path}".replace(
268
- "{output_path}",
269
- output_path));
270
- _text.push(
271
- " Transaction address: {transaction_address}".replace(
272
- "{transaction_address}",
273
- transaction_address));
231
+ _text = [
232
+ ` Maximum retries: ${retries_max}`,
233
+ ` Wallet seed: ${wallet_seed}`,
234
+ ` Chain ID: ${chain_id}`,
235
+ ` Chain Name: ${chain_name}`,
236
+ ` Target network: ${target_network}`,
237
+ ` API Key: ${api_key_path}`,
238
+ ` Output path: ${output_path}`,
239
+ ` Transaction address: ${transaction_address}`,
240
+ ];
274
241
  for ( _line of _text ) {
275
242
  _msg_info(
276
243
  _line);
@@ -285,34 +252,34 @@ function
285
252
  _text;
286
253
  _text = [
287
254
  "Usage:",
288
- " contract-get",
255
+ " transaction-receipt-get",
289
256
  " <quiet>",
290
- " <retries_max>",
291
- " <wallet_seed>",
292
- " <wallet_password_path>",
293
- " <chain_id>",
294
- " <chain_name>",
295
- " <target_network>",
296
- " <api_key_path>",
297
- " <output_path>",
298
- " <transaction_address>",
257
+ " <retries-max>",
258
+ " <wallet-seed>",
259
+ " <wallet-password-path>",
260
+ " <chain-id>",
261
+ " <chain_-ame>",
262
+ " <target-network>",
263
+ " <api-key-path>",
264
+ " <output-path>",
265
+ " <transaction-address>",
299
266
  "",
300
267
  "Args:",
301
268
  " <quiet> Can be 'y' or 'n'",
302
269
  " Default: y",
303
- " <retries_max> Maximum number of retries before",
270
+ " <retries-max> Maximum number of retries before",
304
271
  " failing.",
305
- " <wallet_seed> Path of the seed phrase.",
306
- " <wallet_password_path> Wallet password path.",
307
- " <chain_id> Chain ID for the network.",
308
- " <chain_name> Name for the network.",
309
- " <target_network> Network on which the transaction",
272
+ " <wallet-seed> Path of the seed phrase.",
273
+ " <wallet-password_path> Wallet password path.",
274
+ " <chain-id> Chain ID for the network.",
275
+ " <chain-name> Name for the network.",
276
+ " <target-network> Network on which the transaction",
310
277
  " resides.",
311
- " <api_key_path> Path of the API key for the",
278
+ " <api-key-path> Path of the API key for the",
312
279
  " contract ABI provider service.",
313
- " <output_path> File on which to optionally save",
280
+ " <output-path> File on which to optionally save",
314
281
  " the output.",
315
- " <transaction_address> Transaction one wants to retrieve.",
282
+ " <transaction-address> Transaction one wants to retrieve.",
316
283
  "",
317
284
  " Options:",
318
285
  " -h This help."
@@ -425,9 +392,14 @@ async function
425
392
  _json);
426
393
  }
427
394
  else {
428
- throw "'Transaction Receipt Get' returned undefined value."
395
+ const
396
+ _msg =
397
+ "'Transaction Receipt Get' returned undefined value.";
398
+ throw _msg;
429
399
  }
430
- } catch (error) {
400
+ }
401
+ catch (
402
+ error) {
431
403
  _msg_error(
432
404
  error,
433
405
  1);
@@ -29,178 +29,24 @@
29
29
  * If not, see <https://www.gnu.org/licenses/>.
30
30
  */
31
31
 
32
- // const
33
- // _libcrash =
34
- // require(
35
- // '../libcrash-js/crash-js');
36
32
  const
37
- _libcrash_module =
33
+ _transaction_get_module =
38
34
  require(
39
- "crash-js");
40
- _file_exists =
41
- _libcrash_module._file_exists;
42
- _json_read =
43
- _libcrash_module._json_read;
44
- _path_join =
45
- _libcrash_module._path_join;
46
-
47
- function
48
- _evm_chains_db_path_get(
49
- _user) {
50
- let
51
- _db_exists,
52
- _path;
53
- if ( _user == undefined ) {
54
- _user =
55
- false;
56
- }
57
- if ( _user == true ) {
58
- _path =
59
- _path_join(
60
- [process.env.HOME,
61
- ".local",
62
- "share",
63
- "evm-chains",
64
- "chains.json"])
65
- _db_exists =
66
- _file_exists(
67
- _db_path);
68
- if ( _db_exists == false ) {
69
- _user =
70
- false;
71
- }
72
- }
73
- if ( _user == false ) {
74
- _path =
75
- _path_join(
76
- [process.env.NODE_PATH,
77
- "..",
78
- "evm-chains",
79
- "chains.json"])
80
- }
81
- else {
82
- _msg_error(
83
- "Input variable '_user' must be a boolean",
84
- 0);
85
- }
86
- return _path;
87
- }
88
-
89
- function
90
- _evm_chain_info_get(
91
- _chain_id,
92
- _chain_info,
93
- _db_path) {
94
- let
95
- _db,
96
- _db_exists;
97
- if ( _db_path == undefined ) {
98
- _db_path =
99
- _evm_chains_db_path_get(
100
- false);
101
- }
102
- _db_exists =
103
- _file_exists(
104
- _db_path);
105
- if ( _db_exists == false ) {
106
- _msg_error(
107
- "Database file does not exists.",
108
- 1);
109
- }
110
- _db =
111
- _json_read(
112
- _db_path);
113
- for ( _chain_info of _db) {
114
- if ( _chain_info["chainId"] == _chain_id ) {
115
- return _chain_info;
116
- }
117
- }
118
- _msg_error(
119
- `Network '${_chain_id}' not found.`,
120
- 1);
121
- }
122
-
123
- function
124
- _rpc_backend_get(
125
- _network_chain_id,
126
- _selection_method,
127
- _db_path) {
128
- let
129
- _chain_id,
130
- _chain_info;
131
- if ( _network_chain_id == undefined ) {
132
- _msg_error(
133
- "Network's ChainID not specified.",
134
- 1);
135
- }
136
- if ( _selection_method == undefined ) {
137
- _selection_method =
138
- "kirsh";
139
- }
140
- if ( _db_path == undefined ) {
141
- _db_path =
142
- _evm_chains_db_path_get(
143
- false);
144
- }
145
- _chain_id =
146
- Number(
147
- _network_chain_id);
148
- _chain_info =
149
- _evm_chain_info_get(
150
- _chain_id,
151
- _db_path);
152
- if ( _selection_method == "kirsh" ) {
153
- return _chain_info["rpc"][0];
154
- }
155
- else {
156
- _msg_error(
157
- "Unknown selection method.",
158
- 1);
159
- }
160
- }
161
-
162
- function _rpc_backends_get(
163
- _networks_chain_ids,
164
- _selection_method,
165
- _db_path) {
166
- let
167
- _chain_id,
168
- _rpc_backend_get_opts,
169
- _rpcs;
170
- if ( _selection_method == undefined ) {
171
- _selection_method =
172
- "kirsh";
173
- }
174
- if ( _db_path == undefined ) {
175
- _db_path =
176
- _evm_chains_db_path_get(
177
- false);
178
- }
179
- _rpcs =
180
- [];
181
- for ( _chain_id of _networks_chain_ids ) {
182
- _rpc_backend_get_opts = [
183
- _chain_id,
184
- _selection_method,
185
- _db_path
186
- ];
187
- _rpc_backend =
188
- _rpc_backend_get.apply(
189
- null,
190
- _rpc_backend_get_opts);
191
- _rpcs.append(
192
- _rpc_backend);
193
- }
194
- return _rpcs;
195
- }
35
+ "./lib/transaction-get");
36
+ const
37
+ _transaction_get =
38
+ _transaction_get_module._transaction_get;
39
+ const
40
+ _transaction_receipt_get_module =
41
+ require(
42
+ "./lib/transaction-receipt-get");
43
+ const
44
+ _transaction_receipt_get =
45
+ _transaction_receipt_get_module._transaction_receipt_get;
196
46
 
197
47
  module.exports = {
198
- _evm_chains_db_path_get:
199
- _evm_chains_db_path_get,
200
- _evm_chain_info_get:
201
- _evm_chain_info_get,
202
- _rpc_backend_get:
203
- _rpc_backend_get,
204
- _rpc_backends_get:
205
- _rpc_backends_get
48
+ _transaction_get:
49
+ _transaction_get,
50
+ _transaction_receipt_get:
51
+ _transaction_receipt_get
206
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  { "name": "evm-transactions-tools",
2
2
  "version":
3
- "0.0.1",
3
+ "0.0.3",
4
4
  "description":
5
5
  "Programs and libraries to interact with Ethereum Virtual Machine (EVM) networks transactions in native computer applications, in particular those written using the LibEVM library and using the EVM Contracts Tools.",
6
6
  "funding": {
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "crash-js-webpack":
58
- "^0.0.3",
58
+ "^0.0.6",
59
59
  "flatted":
60
- "3.4.1",
60
+ "^3.2.9",
61
61
  "eslint":
62
62
  "^10.0.3",
63
63
  "globals":
@@ -73,15 +73,11 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "crash-js":
76
- "^0.1.88",
77
- "ethereum-data":
78
- "^0.0.1",
79
- "ethers":
80
- "^6.13.2",
81
- "evm-chains-info":
82
- "^0.0.1",
76
+ "^0.1.101",
77
+ "evm-wallet.js":
78
+ "^0.0.17",
83
79
  "libevm":
84
- "^0.0.1",
80
+ "^0.0.6",
85
81
  "yargs":
86
82
  "18.0.0"
87
83
  },