evm-contracts-tools 0.0.43 → 0.0.45

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.
Files changed (31) hide show
  1. package/dist/evm-contract-call/evm-contract-call.js +1 -1
  2. package/dist/evm-contract-call/fs-worker.js +1 -1
  3. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -1
  4. package/dist/evm-contract-deployment-address/fs-worker.js +1 -1
  5. package/dist/evm-contract-deployment-deployment-networks +1 -1
  6. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -1
  7. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -1
  8. package/dist/evm-contract-deployment-versions/fs-worker.js +1 -1
  9. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -1
  10. package/dist/evm-contract-deployments-dir/fs-worker.js +1 -1
  11. package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -1
  12. package/dist/evm-contracts-tools/fs-worker.js +1 -1
  13. package/dist/libevm-contract-call/fs-worker.js +1 -1
  14. package/dist/libevm-contract-call/libevm-contract-call.js +1 -1
  15. package/dist/libevm-contract-deployment-address/fs-worker.js +1 -1
  16. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
  17. package/dist/libevm-contract-deployment-deployment-networks +1 -1
  18. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -1
  19. package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -1
  20. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -1
  21. package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -1
  22. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -1
  23. package/dist/libevm-contracts-tools +1 -1
  24. package/evm-contract-deployment-address +115 -33
  25. package/evm-contract-deployment-versions +38 -12
  26. package/libevm-contract-call +2 -2
  27. package/libevm-contract-deployment-address +445 -67
  28. package/libevm-contract-deployment-networks +24 -22
  29. package/libevm-contract-deployment-versions +95 -6
  30. package/libevm-contract-deployments-dir +4 -5
  31. package/package.json +9 -9
@@ -38,12 +38,12 @@ const
38
38
  require(
39
39
  "crash-js");
40
40
  /* global
41
- _dirname */
41
+ _dir_exists */
42
42
  /* eslint-disable-next-line
43
43
  no-global-assign */
44
44
  const
45
- _dirname =
46
- _libcrash_module._dirname;
45
+ _dir_exists =
46
+ _libcrash_module._dir_exists;
47
47
  /* global
48
48
  _file_exists */
49
49
  /* eslint-disable-next-line
@@ -100,13 +100,6 @@ const
100
100
  const
101
101
  _path_join =
102
102
  _libcrash_module._path_join;
103
- /* global
104
- _range */
105
- /* eslint-disable-next-line
106
- no-global-assign */
107
- const
108
- _range =
109
- _libcrash_module._range;
110
103
  /* global
111
104
  _stat */
112
105
  /* eslint-disable-next-line
@@ -195,7 +188,7 @@ function
195
188
  }
196
189
  }
197
190
 
198
- function
191
+ async function
199
192
  _network_check(
200
193
  _deployments,
201
194
  _contract,
@@ -221,7 +214,7 @@ function
221
214
  _conf_dir;
222
215
  if ( _type == "system" ) {
223
216
  _conf_dir =
224
- _lib_get();
217
+ await _lib_get();
225
218
  }
226
219
  else if ( _type == "user" ) {
227
220
  const
@@ -233,7 +226,7 @@ function
233
226
  return `${_conf_dir}/${_app}/deployments`;
234
227
  }
235
228
 
236
- function
229
+ async function
237
230
  _networks_find(
238
231
  _deployment_dir) {
239
232
  let
@@ -245,18 +238,18 @@ function
245
238
  [];
246
239
  const
247
240
  _files =
248
- _ls(
241
+ await _ls(
249
242
  _deployment_dir);
250
243
  for ( _file of _files ) {
251
244
  _path =
252
245
  `${_deployment_dir}/${_file}`;
253
246
  _file_is_dir =
254
- _is_dir(
247
+ _dir_exists(
255
248
  _path);
256
249
  if ( ! _file_is_dir ) {
257
250
  const
258
251
  _msg =
259
- `there shouldn't be a file into ` +
252
+ `There shouldn't be a file into ` +
260
253
  `this directory.`;
261
254
  _msg_warning(
262
255
  _msg)
@@ -271,7 +264,7 @@ function
271
264
  return _networks;
272
265
  }
273
266
 
274
- function
267
+ async function
275
268
  _evm_contract_deployment_networks(
276
269
  _deployment_dir,
277
270
  _display_all,
@@ -279,13 +272,22 @@ function
279
272
  _display_cheapest) {
280
273
  let
281
274
  _networks;
282
- console.log(
283
- _deployment_dir);
275
+ const
276
+ _deployment_dir_type =
277
+ typeof(
278
+ _deployment_dir);
279
+ if ( _deployment_dir_type == "object" ) {
280
+ const
281
+ _msg =
282
+ "Deployment directory argument " +
283
+ "must be of type 'string'.";
284
+ _msg_error(
285
+ _msg,
286
+ 1);
287
+ }
284
288
  _networks =
285
- _networks_find(
289
+ await _networks_find(
286
290
  _deployment_dir);
287
- console.log(
288
- _networks);
289
291
  return _networks;
290
292
  }
291
293
 
@@ -65,6 +65,20 @@ const
65
65
  _libcrash_module =
66
66
  require(
67
67
  "crash-js");
68
+ /* global
69
+ _file_read */
70
+ /* eslint-disable-next-line
71
+ no-global-assign */
72
+ const
73
+ _file_read =
74
+ _libcrash_module._file_read;
75
+ /* global
76
+ _from_bash_ass_array */
77
+ /* eslint-disable-next-line
78
+ no-global-assign */
79
+ const
80
+ _from_bash_ass_array =
81
+ _libcrash_module._from_bash_ass_array;
68
82
  /* global
69
83
  _json_read */
70
84
  /* eslint-disable-next-line
@@ -87,27 +101,102 @@ const
87
101
  _msg_error =
88
102
  _libcrash_module._msg_error;
89
103
 
104
+ function
105
+ _configuration_format_auto_detect() {
106
+ let
107
+ _configuration_format;
108
+ if ( typeof(
109
+ configuration_format) === "undefined" ||
110
+ configuration_format == "" ) {
111
+ _configuration_format =
112
+ "json";
113
+ if ( config_file.endsWith(
114
+ ".sh") ) {
115
+ _configuration_format =
116
+ "bash";
117
+ }
118
+ else if ( config_file.endsWith(
119
+ ".json") ) {
120
+ _configuration_format =
121
+ "json";
122
+ }
123
+ else {
124
+ const
125
+ _msg =
126
+ "Impossible determining " +
127
+ "configuration format from file " +
128
+ "extension, defaulting to 'json'.";
129
+ _msg_info(
130
+ _msg,
131
+ 1);
132
+ }
133
+ configuration_format =
134
+ _configuration_format;
135
+ }
136
+ }
137
+
90
138
  function
91
139
  _evm_contract_deployment_versions(
92
140
  _config_file,
93
141
  _display_highest,
94
- _display_lowest) {
95
- const
142
+ _display_lowest,
143
+ _configuration_format) {
144
+ let
145
+ _config,
146
+ _key_name,
147
+ _versions;
148
+ if ( typeof(
149
+ _configuration_format) == "undefined" ||
150
+ _configuration_format == "" ) {
151
+ _configuration_format =
152
+ "json";
153
+ }
154
+ if ( _configuration_format == "json" ) {
96
155
  _config =
97
156
  _json_read(
98
157
  _config_file);
158
+ _key_name =
159
+ "contract-address";
160
+ }
161
+ else if ( _configuration_format == "bash" ) {
162
+ _config =
163
+ _from_bash_ass_array(
164
+ _file_read(
165
+ _config_file));
166
+ _key_name =
167
+ "contract_address";
168
+ }
169
+ else {
170
+ _msg =
171
+ "Unknown configuration format " +
172
+ `'${_configuration_format}'.`;
173
+ _msg_error(
174
+ _msg,
175
+ 1);
176
+ }
99
177
  const
100
178
  _contract_addresses =
101
179
  _config[
102
- "contract-address"];
103
- const
180
+ _key_name];
181
+ _versions =
182
+ Object.keys(
183
+ _contract_addresses);
184
+ if ( _display_highest == "y" ) {
185
+ _versions =
186
+ _versions.reverse()[
187
+ 0];
188
+ }
189
+ if ( _display_lowest == "y" ) {
104
190
  _versions =
105
- Object.keys(
106
- _contract_addresses);
191
+ _versions.sort()[
192
+ 0];
193
+ }
107
194
  return _versions;
108
195
  }
109
196
 
110
197
  module.exports = {
198
+ _configuration_format_auto_detect:
199
+ _configuration_format_auto_detect,
111
200
  _evm_contract_deployment_versions:
112
201
  _evm_contract_deployment_versions,
113
202
  };
@@ -83,7 +83,6 @@ function
83
83
  _error_flag =
84
84
  true;
85
85
  }
86
- console.log(_app);
87
86
  if ( _app_type != "string" ) {
88
87
  _msg =
89
88
  "Application argument must be of " +
@@ -98,7 +97,7 @@ function
98
97
  }
99
98
  }
100
99
 
101
- function
100
+ async function
102
101
  _default_deployments_dir_get(
103
102
  _app,
104
103
  _type) {
@@ -114,7 +113,7 @@ function
114
113
  _conf_dir;
115
114
  if ( _type == "system" ) {
116
115
  _conf_dir =
117
- _lib_get();
116
+ await _lib_get();
118
117
  }
119
118
  else if ( _type == "user" ) {
120
119
  const
@@ -126,7 +125,7 @@ function
126
125
  return `${_conf_dir}/${_app}/deployments`;
127
126
  }
128
127
 
129
- function
128
+ async function
130
129
  _evm_contract_deployments_dir(
131
130
  _app,
132
131
  _user_level) {
@@ -152,7 +151,7 @@ function
152
151
  1);
153
152
  }
154
153
  _deployments =
155
- _default_deployments_dir_get(
154
+ await _default_deployments_dir_get(
156
155
  _app,
157
156
  _deployment_type);
158
157
  return _deployments;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  { "name": "evm-contracts-tools",
2
2
  "version":
3
- "0.0.43",
3
+ "0.0.45",
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": {
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "devDependencies": {
90
90
  "crash-js-webpack":
91
- "^0.0.31",
91
+ "^0.0.40",
92
92
  "flatted":
93
93
  "^3.2.9",
94
94
  "eslint":
@@ -98,7 +98,7 @@
98
98
  "@eslint/js":
99
99
  "^10.0.1",
100
100
  "safely-serve":
101
- "^0.0.9",
101
+ "^0.0.10",
102
102
  "webpack":
103
103
  "^5.102.1",
104
104
  "webpack-cli":
@@ -106,17 +106,17 @@
106
106
  },
107
107
  "dependencies": {
108
108
  "crash-js":
109
- "^0.11.1",
109
+ "^0.11.111111111",
110
110
  "ethers":
111
111
  "^6.13.2",
112
112
  "evm-chains-info":
113
- "^0.0.22",
113
+ "^0.0.27",
114
114
  "evm-transactions-tools":
115
- "^0.0.10",
115
+ "^0.0.111",
116
116
  "evm-wallet.js":
117
- "^0.0.63",
117
+ "^0.0.69",
118
118
  "libevm":
119
- "^0.0.29",
119
+ "^0.0.30",
120
120
  "ws":
121
121
  "^8.21.0",
122
122
  "yargs":
@@ -126,7 +126,7 @@
126
126
  "evm-contracts-tools":
127
127
  "./evm-contracts-tools",
128
128
  "evm-wallet.js":
129
- "^0.0.63"
129
+ "^0.0.69"
130
130
  },
131
131
  "type":
132
132
  "commonjs",