evm-contracts-tools 0.0.3 → 0.0.5
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 +1 -0
- package/lib/bytecode-creation-get +61 -25
- package/lib/deployer-get +55 -23
- package/libevm-contracts-tools +29 -164
- package/package.json +3 -1
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)})();
|
|
@@ -28,65 +28,101 @@ const
|
|
|
28
28
|
_libcrash =
|
|
29
29
|
require(
|
|
30
30
|
"crash-js");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const
|
|
32
|
+
_cmdline_check =
|
|
33
|
+
_libcrash._cmdline_check;
|
|
34
|
+
const
|
|
35
|
+
_error_display =
|
|
36
|
+
_libcrash._error_display;
|
|
37
|
+
const
|
|
38
|
+
_msg_info =
|
|
39
|
+
_libcrash._msg_info;
|
|
40
|
+
const
|
|
41
|
+
_msg_error =
|
|
42
|
+
_libcrash._msg_error;
|
|
43
|
+
const
|
|
44
|
+
_printf =
|
|
45
|
+
_libcrash._printf;
|
|
41
46
|
const
|
|
42
47
|
{ ethers } =
|
|
43
48
|
require(
|
|
44
49
|
"ethers");
|
|
45
|
-
_ethers =
|
|
46
|
-
ethers;
|
|
47
|
-
_wei_to_ether =
|
|
48
|
-
_ethers.formatEther;
|
|
49
50
|
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
_ethers =
|
|
52
|
+
ethers;
|
|
53
|
+
const
|
|
54
|
+
_wei_to_ether =
|
|
55
|
+
_ethers.formatEther;
|
|
55
56
|
const
|
|
56
|
-
|
|
57
|
+
_evm_transaction_tools_module =
|
|
57
58
|
require(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
"evm-transactions-tools");
|
|
60
|
+
const
|
|
61
|
+
_transaction_get =
|
|
62
|
+
_evm_transactions_tools_module._transaction_get;
|
|
63
|
+
const
|
|
64
|
+
_transaction_receipt_get =
|
|
65
|
+
_evm_transactions_tools_module._transaction_receipt_get;
|
|
61
66
|
const
|
|
62
67
|
_deployer_get_module =
|
|
63
68
|
require(
|
|
64
69
|
'./deployer-get');
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
const
|
|
71
|
+
_deployer_get =
|
|
72
|
+
_deployer_get_module._deployer_get;
|
|
67
73
|
|
|
68
74
|
function
|
|
69
75
|
_global_variables() {
|
|
70
76
|
app_name =
|
|
71
77
|
"bytecode-creation-get";
|
|
78
|
+
/* global
|
|
79
|
+
wallet_seed:
|
|
80
|
+
writable */
|
|
72
81
|
wallet_seed =
|
|
73
82
|
"";
|
|
83
|
+
/* global
|
|
84
|
+
retries_max:
|
|
85
|
+
writable */
|
|
74
86
|
retries_max =
|
|
75
87
|
"";
|
|
88
|
+
/* global
|
|
89
|
+
api_key_path:
|
|
90
|
+
writable */
|
|
76
91
|
api_key_path =
|
|
77
92
|
"";
|
|
93
|
+
/* global
|
|
94
|
+
chain_id:
|
|
95
|
+
writable */
|
|
78
96
|
chain_id =
|
|
79
97
|
"";
|
|
98
|
+
/* global
|
|
99
|
+
chain_name:
|
|
100
|
+
writable */
|
|
80
101
|
chain_name =
|
|
81
102
|
"";
|
|
103
|
+
/* global
|
|
104
|
+
target_network:
|
|
105
|
+
writable */
|
|
82
106
|
target_network =
|
|
83
107
|
"";
|
|
108
|
+
/* global
|
|
109
|
+
contract_address:
|
|
110
|
+
writable */
|
|
84
111
|
contract_address =
|
|
85
112
|
"";
|
|
113
|
+
/* global
|
|
114
|
+
transaction_deployment:
|
|
115
|
+
writable */
|
|
86
116
|
transaction_deployment =
|
|
87
117
|
"";
|
|
118
|
+
/* global
|
|
119
|
+
contract_bytecode_path:
|
|
120
|
+
writable */
|
|
88
121
|
contract_bytecode_path =
|
|
89
122
|
"";
|
|
123
|
+
/* global
|
|
124
|
+
quiet:
|
|
125
|
+
writable */
|
|
90
126
|
quiet =
|
|
91
127
|
"";
|
|
92
128
|
}
|
package/lib/deployer-get
CHANGED
|
@@ -28,57 +28,89 @@ const
|
|
|
28
28
|
_libcrash =
|
|
29
29
|
require(
|
|
30
30
|
'../libcrash-js/crash-js');
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const
|
|
32
|
+
_cmdline_check =
|
|
33
|
+
_libcrash._cmdline_check;
|
|
34
|
+
const
|
|
35
|
+
_error_display =
|
|
36
|
+
_libcrash._error_display;
|
|
37
|
+
const
|
|
38
|
+
_msg_info =
|
|
39
|
+
_libcrash._msg_info;
|
|
40
|
+
const
|
|
41
|
+
_msg_error =
|
|
42
|
+
_libcrash._msg_error;
|
|
43
|
+
const
|
|
44
|
+
_printf =
|
|
45
|
+
_libcrash._printf;
|
|
41
46
|
const
|
|
42
47
|
{ ethers } =
|
|
43
48
|
require(
|
|
44
49
|
"ethers");
|
|
45
|
-
_ethers =
|
|
46
|
-
ethers;
|
|
47
|
-
_wei_to_ether =
|
|
48
|
-
_ethers.formatEther;
|
|
49
50
|
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
_ethers =
|
|
52
|
+
ethers;
|
|
53
|
+
const
|
|
54
|
+
_wei_to_ether =
|
|
55
|
+
_ethers.formatEther;
|
|
55
56
|
const
|
|
56
|
-
|
|
57
|
+
_evm_transactions_tools_module =
|
|
57
58
|
require(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
"evm-transactions-tools");
|
|
60
|
+
const
|
|
61
|
+
_transaction_get =
|
|
62
|
+
_evm_transactions_tools_module._transaction_get;
|
|
63
|
+
const
|
|
64
|
+
_transaction_receipt_get =
|
|
65
|
+
_evm_transactions_tools_module._transaction_receipt_get;
|
|
61
66
|
|
|
62
67
|
function
|
|
63
68
|
_global_variables() {
|
|
64
69
|
app_name =
|
|
65
70
|
"deployer-get";
|
|
71
|
+
/* global
|
|
72
|
+
wallet_seed:
|
|
73
|
+
writable */
|
|
66
74
|
wallet_seed =
|
|
67
75
|
"";
|
|
76
|
+
/* global
|
|
77
|
+
retries_max:
|
|
78
|
+
writable */
|
|
68
79
|
retries_max =
|
|
69
80
|
"";
|
|
81
|
+
/* global
|
|
82
|
+
api_key_path:
|
|
83
|
+
writable */
|
|
70
84
|
api_key_path =
|
|
71
85
|
"";
|
|
86
|
+
/* global
|
|
87
|
+
chain_id:
|
|
88
|
+
writable */
|
|
72
89
|
chain_id =
|
|
73
90
|
"";
|
|
91
|
+
/* global
|
|
92
|
+
chain_name:
|
|
93
|
+
writable */
|
|
74
94
|
chain_name =
|
|
75
95
|
"";
|
|
96
|
+
/* global
|
|
97
|
+
target_network:
|
|
98
|
+
writable */
|
|
76
99
|
target_network =
|
|
77
100
|
"";
|
|
101
|
+
/* global
|
|
102
|
+
contract_address:
|
|
103
|
+
writable */
|
|
78
104
|
contract_address =
|
|
79
105
|
"";
|
|
106
|
+
/* global
|
|
107
|
+
transaction_deployment:
|
|
108
|
+
writable */
|
|
80
109
|
transaction_deployment =
|
|
81
110
|
"";
|
|
111
|
+
/* global
|
|
112
|
+
quiet:
|
|
113
|
+
writable */
|
|
82
114
|
quiet =
|
|
83
115
|
"";
|
|
84
116
|
}
|
package/libevm-contracts-tools
CHANGED
|
@@ -29,27 +29,38 @@
|
|
|
29
29
|
* If not, see <https://www.gnu.org/licenses/>.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
+
/* eslint-disable
|
|
33
|
+
no-unused-vars */
|
|
34
|
+
|
|
32
35
|
const
|
|
33
36
|
_libcrash_module =
|
|
34
37
|
require(
|
|
35
38
|
"crash-js");
|
|
36
|
-
_file_exists =
|
|
37
|
-
_libcrash_module._file_exists;
|
|
38
|
-
_json_read =
|
|
39
|
-
_libcrash_module._json_read;
|
|
40
|
-
_path_join =
|
|
41
|
-
_libcrash_module._path_join;
|
|
42
39
|
const
|
|
43
40
|
_bytecode_creation_get_module =
|
|
44
41
|
require(
|
|
45
42
|
"./lib/bytecode_creation_get");
|
|
43
|
+
/* global
|
|
44
|
+
_bytecode_creation_get */
|
|
46
45
|
const
|
|
47
46
|
_bytecode_creation_get =
|
|
48
47
|
_bytecode_creation_get_module._bytecode_creation_get;
|
|
48
|
+
const
|
|
49
|
+
_bytecode_runtime_get_module =
|
|
50
|
+
require(
|
|
51
|
+
"./lib/bytecode_runtime_get");
|
|
52
|
+
/* global
|
|
53
|
+
_bytecode_runtime_get */
|
|
54
|
+
const
|
|
55
|
+
_bytecode_runtime_get =
|
|
56
|
+
_bytecode_runtime_get_module._bytecode_runtime_get;
|
|
57
|
+
|
|
49
58
|
const
|
|
50
59
|
_contract_get_module =
|
|
51
60
|
require(
|
|
52
61
|
"./lib/contract_get");
|
|
62
|
+
/* global
|
|
63
|
+
_contract_get */
|
|
53
64
|
const
|
|
54
65
|
_contract_get =
|
|
55
66
|
_contract_get_module._contract_get;
|
|
@@ -57,6 +68,8 @@ const
|
|
|
57
68
|
_deployer_get_module =
|
|
58
69
|
require(
|
|
59
70
|
"./lib/deployer_get");
|
|
71
|
+
/* global
|
|
72
|
+
_deployer_get */
|
|
60
73
|
const
|
|
61
74
|
_deployer_get =
|
|
62
75
|
_deployer_get_module._deployer_get;
|
|
@@ -64,6 +77,8 @@ const
|
|
|
64
77
|
_deployer_verify_module =
|
|
65
78
|
require(
|
|
66
79
|
"./lib/deployer_verify");
|
|
80
|
+
/* global
|
|
81
|
+
_deployer_verify */
|
|
67
82
|
const
|
|
68
83
|
_deployer_verify =
|
|
69
84
|
_deployer_verify_module._deployer_verify;
|
|
@@ -71,6 +86,8 @@ const
|
|
|
71
86
|
_evm_contract_call_dynamic_module =
|
|
72
87
|
require(
|
|
73
88
|
"./lib/evm-contract-call-dynamic");
|
|
89
|
+
/* global
|
|
90
|
+
_evm_contract_call_dynamic */
|
|
74
91
|
const
|
|
75
92
|
_evm_contract_call_dynamic =
|
|
76
93
|
_evm_contract_call_dynamic_module._evm_contract_call_dynamic;
|
|
@@ -78,160 +95,12 @@ const
|
|
|
78
95
|
_evm_contract_call_static_module =
|
|
79
96
|
require(
|
|
80
97
|
"./lib/evm-contract-call-static");
|
|
98
|
+
/* global
|
|
99
|
+
_evm_contract_call_static */
|
|
81
100
|
const
|
|
82
101
|
_evm_contract_call_static =
|
|
83
102
|
_evm_contract_call_static_module._evm_contract_call_static;
|
|
84
103
|
|
|
85
|
-
function
|
|
86
|
-
_evm_chains_db_path_get(
|
|
87
|
-
_user) {
|
|
88
|
-
let
|
|
89
|
-
_db_exists,
|
|
90
|
-
_path;
|
|
91
|
-
if ( _user == undefined ) {
|
|
92
|
-
_user =
|
|
93
|
-
false;
|
|
94
|
-
}
|
|
95
|
-
if ( _user == true ) {
|
|
96
|
-
_path =
|
|
97
|
-
_path_join(
|
|
98
|
-
[process.env.HOME,
|
|
99
|
-
".local",
|
|
100
|
-
"share",
|
|
101
|
-
"evm-chains",
|
|
102
|
-
"chains.json"])
|
|
103
|
-
_db_exists =
|
|
104
|
-
_file_exists(
|
|
105
|
-
_db_path);
|
|
106
|
-
if ( _db_exists == false ) {
|
|
107
|
-
_user =
|
|
108
|
-
false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if ( _user == false ) {
|
|
112
|
-
_path =
|
|
113
|
-
_path_join(
|
|
114
|
-
[process.env.NODE_PATH,
|
|
115
|
-
"..",
|
|
116
|
-
"evm-chains",
|
|
117
|
-
"chains.json"])
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
_msg_error(
|
|
121
|
-
"Input variable '_user' must be a boolean",
|
|
122
|
-
0);
|
|
123
|
-
}
|
|
124
|
-
return _path;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function
|
|
128
|
-
_evm_chain_info_get(
|
|
129
|
-
_chain_id,
|
|
130
|
-
_chain_info,
|
|
131
|
-
_db_path) {
|
|
132
|
-
let
|
|
133
|
-
_db,
|
|
134
|
-
_db_exists;
|
|
135
|
-
if ( _db_path == undefined ) {
|
|
136
|
-
_db_path =
|
|
137
|
-
_evm_chains_db_path_get(
|
|
138
|
-
false);
|
|
139
|
-
}
|
|
140
|
-
_db_exists =
|
|
141
|
-
_file_exists(
|
|
142
|
-
_db_path);
|
|
143
|
-
if ( _db_exists == false ) {
|
|
144
|
-
_msg_error(
|
|
145
|
-
"Database file does not exists.",
|
|
146
|
-
1);
|
|
147
|
-
}
|
|
148
|
-
_db =
|
|
149
|
-
_json_read(
|
|
150
|
-
_db_path);
|
|
151
|
-
for ( _chain_info of _db) {
|
|
152
|
-
if ( _chain_info["chainId"] == _chain_id ) {
|
|
153
|
-
return _chain_info;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
_msg_error(
|
|
157
|
-
`Network '${_chain_id}' not found.`,
|
|
158
|
-
1);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function
|
|
162
|
-
_rpc_backend_get(
|
|
163
|
-
_network_chain_id,
|
|
164
|
-
_selection_method,
|
|
165
|
-
_db_path) {
|
|
166
|
-
let
|
|
167
|
-
_chain_id,
|
|
168
|
-
_chain_info;
|
|
169
|
-
if ( _network_chain_id == undefined ) {
|
|
170
|
-
_msg_error(
|
|
171
|
-
"Network's ChainID not specified.",
|
|
172
|
-
1);
|
|
173
|
-
}
|
|
174
|
-
if ( _selection_method == undefined ) {
|
|
175
|
-
_selection_method =
|
|
176
|
-
"kirsh";
|
|
177
|
-
}
|
|
178
|
-
if ( _db_path == undefined ) {
|
|
179
|
-
_db_path =
|
|
180
|
-
_evm_chains_db_path_get(
|
|
181
|
-
false);
|
|
182
|
-
}
|
|
183
|
-
_chain_id =
|
|
184
|
-
Number(
|
|
185
|
-
_network_chain_id);
|
|
186
|
-
_chain_info =
|
|
187
|
-
_evm_chain_info_get(
|
|
188
|
-
_chain_id,
|
|
189
|
-
_db_path);
|
|
190
|
-
if ( _selection_method == "kirsh" ) {
|
|
191
|
-
return _chain_info["rpc"][0];
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
_msg_error(
|
|
195
|
-
"Unknown selection method.",
|
|
196
|
-
1);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function _rpc_backends_get(
|
|
201
|
-
_networks_chain_ids,
|
|
202
|
-
_selection_method,
|
|
203
|
-
_db_path) {
|
|
204
|
-
let
|
|
205
|
-
_chain_id,
|
|
206
|
-
_rpc_backend_get_opts,
|
|
207
|
-
_rpcs;
|
|
208
|
-
if ( _selection_method == undefined ) {
|
|
209
|
-
_selection_method =
|
|
210
|
-
"kirsh";
|
|
211
|
-
}
|
|
212
|
-
if ( _db_path == undefined ) {
|
|
213
|
-
_db_path =
|
|
214
|
-
_evm_chains_db_path_get(
|
|
215
|
-
false);
|
|
216
|
-
}
|
|
217
|
-
_rpcs =
|
|
218
|
-
[];
|
|
219
|
-
for ( _chain_id of _networks_chain_ids ) {
|
|
220
|
-
_rpc_backend_get_opts = [
|
|
221
|
-
_chain_id,
|
|
222
|
-
_selection_method,
|
|
223
|
-
_db_path
|
|
224
|
-
];
|
|
225
|
-
_rpc_backend =
|
|
226
|
-
_rpc_backend_get.apply(
|
|
227
|
-
null,
|
|
228
|
-
_rpc_backend_get_opts);
|
|
229
|
-
_rpcs.append(
|
|
230
|
-
_rpc_backend);
|
|
231
|
-
}
|
|
232
|
-
return _rpcs;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
104
|
module.exports = {
|
|
236
105
|
_bytecode_creation_get:
|
|
237
106
|
_bytecode_creation_get,
|
|
@@ -239,16 +108,12 @@ module.exports = {
|
|
|
239
108
|
_bytecode_runtime_get,
|
|
240
109
|
_contract_get:
|
|
241
110
|
_contract_get,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
111
|
+
_deployer_get:
|
|
112
|
+
_deployer_get,
|
|
113
|
+
_deployer_verify:
|
|
114
|
+
_deployer_verify,
|
|
246
115
|
_evm_contract_call_dynamic:
|
|
247
116
|
_evm_contract_call_dynamic,
|
|
248
117
|
_evm_contract_call_static:
|
|
249
118
|
_evm_contract_call_static,
|
|
250
|
-
_rpc_backend_get:
|
|
251
|
-
_rpc_backend_get,
|
|
252
|
-
_rpc_backends_get:
|
|
253
|
-
_rpc_backends_get
|
|
254
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{ "name": "evm-contracts-tools",
|
|
2
2
|
"version":
|
|
3
|
-
"0.0.
|
|
3
|
+
"0.0.5",
|
|
4
4
|
"description":
|
|
5
5
|
"JavaScript programs and libraries to enable seamless development of native computer applications designed to interact with Ethereum Virtual Machine-compatible networks.",
|
|
6
6
|
"funding": {
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
"^6.13.2",
|
|
84
84
|
"evm-chains-info":
|
|
85
85
|
"^0.0.16",
|
|
86
|
+
"evm-transactions-tools":
|
|
87
|
+
"^0.0.3",
|
|
86
88
|
"libevm":
|
|
87
89
|
"^0.0.6",
|
|
88
90
|
"yargs":
|