evm-contracts-tools 0.0.86 → 0.0.88
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/lib/evm-contract-call-dynamic +433 -98
- package/package.json +11 -11
|
@@ -489,7 +489,8 @@ async function
|
|
|
489
489
|
_contract) {
|
|
490
490
|
let
|
|
491
491
|
_contract_object_get,
|
|
492
|
-
_contract_get_args
|
|
492
|
+
_contract_get_args,
|
|
493
|
+
_msg;
|
|
493
494
|
const
|
|
494
495
|
_contract_type =
|
|
495
496
|
typeof(
|
|
@@ -632,6 +633,9 @@ async function
|
|
|
632
633
|
_price_gas =
|
|
633
634
|
0;
|
|
634
635
|
}
|
|
636
|
+
else if ( _price_gas_type === "number" ) {
|
|
637
|
+
true;
|
|
638
|
+
}
|
|
635
639
|
else if ( _price_gas_type === "string" ) {
|
|
636
640
|
if ( 0 < _price_gas.length ) {
|
|
637
641
|
const
|
|
@@ -723,7 +727,13 @@ async function
|
|
|
723
727
|
_fee_priority =
|
|
724
728
|
Number(
|
|
725
729
|
_fee_priority);
|
|
726
|
-
|
|
730
|
+
const
|
|
731
|
+
_output = [
|
|
732
|
+
_price_gas,
|
|
733
|
+
_gas_fee,
|
|
734
|
+
_fee_priority
|
|
735
|
+
];
|
|
736
|
+
return _output;
|
|
727
737
|
}
|
|
728
738
|
|
|
729
739
|
function
|
|
@@ -905,6 +915,209 @@ async function
|
|
|
905
915
|
return _method;
|
|
906
916
|
}
|
|
907
917
|
|
|
918
|
+
function
|
|
919
|
+
_price_gas_max_check(
|
|
920
|
+
_price_gas_max) {
|
|
921
|
+
let
|
|
922
|
+
_price_gas_max_get,
|
|
923
|
+
_msg;
|
|
924
|
+
const
|
|
925
|
+
_default =
|
|
926
|
+
100000000;
|
|
927
|
+
_price_gas_max_get =
|
|
928
|
+
false;
|
|
929
|
+
const
|
|
930
|
+
_price_gas_max_type =
|
|
931
|
+
typeof(
|
|
932
|
+
_price_gas_max);
|
|
933
|
+
if ( _price_gas_max_type === "undefined" ) {
|
|
934
|
+
_msg =
|
|
935
|
+
"Maximum gas price variable undefined, " +
|
|
936
|
+
`setting default. (${_default}).`;
|
|
937
|
+
_msg_info(
|
|
938
|
+
_msg);
|
|
939
|
+
_price_gas_max_get =
|
|
940
|
+
true;
|
|
941
|
+
}
|
|
942
|
+
else if ( _price_gas_max_type === "string" ) {
|
|
943
|
+
if ( _price_gas_max.length < 1 ) {
|
|
944
|
+
_msg =
|
|
945
|
+
"Maximum gas price variable is an empty string, " +
|
|
946
|
+
`setting default. (${_default}).`;
|
|
947
|
+
_msg_info(
|
|
948
|
+
_msg);
|
|
949
|
+
_price_gas_max_get =
|
|
950
|
+
true;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
else if ( _price_gas_max_type === "object" ) {
|
|
954
|
+
_price_gas_max_keys =
|
|
955
|
+
Object.keys(
|
|
956
|
+
_price_gas_max);
|
|
957
|
+
if ( _price_gas_max_keys.length < 1 ) {
|
|
958
|
+
_msg =
|
|
959
|
+
"Maximum gas price variable is an empty object, " +
|
|
960
|
+
`setting default. (${_default}).`;
|
|
961
|
+
_msg_info(
|
|
962
|
+
_msg);
|
|
963
|
+
_price_gas_max_get =
|
|
964
|
+
true;
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
_msg =
|
|
968
|
+
"Maximum gas price variable is an " +
|
|
969
|
+
"object but it should be a positive integer.";
|
|
970
|
+
_msg_error(
|
|
971
|
+
_msg,
|
|
972
|
+
0);
|
|
973
|
+
throw _msg;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
else if ( _price_gas_max_type === "number" ) {
|
|
977
|
+
true;
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
_msg =
|
|
981
|
+
"Maximum gas price variable has type " +
|
|
982
|
+
`'${_price_gas_max_type}' but it should be` +
|
|
983
|
+
"a positive integer.";
|
|
984
|
+
_msg_error(
|
|
985
|
+
_msg,
|
|
986
|
+
0);
|
|
987
|
+
throw _msg;
|
|
988
|
+
}
|
|
989
|
+
if ( _price_gas_max_get ) {
|
|
990
|
+
_price_gas_max =
|
|
991
|
+
_default;
|
|
992
|
+
}
|
|
993
|
+
if ( _price_gas_max_get < 1 ) {
|
|
994
|
+
_msg =
|
|
995
|
+
"Maximum gas price variable should be " +
|
|
996
|
+
"a positive integer, but has value " +
|
|
997
|
+
`'${_price_gas_max}'`;
|
|
998
|
+
_msg_error(
|
|
999
|
+
_msg,
|
|
1000
|
+
0);
|
|
1001
|
+
}
|
|
1002
|
+
return _price_gas_max;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
function
|
|
1006
|
+
_eip_1559_check(
|
|
1007
|
+
_eip_1559) {
|
|
1008
|
+
let
|
|
1009
|
+
_eip_1559_get,
|
|
1010
|
+
_msg;
|
|
1011
|
+
const
|
|
1012
|
+
_default =
|
|
1013
|
+
true;
|
|
1014
|
+
_eip_1559_get =
|
|
1015
|
+
false;
|
|
1016
|
+
const
|
|
1017
|
+
_eip_1559_type =
|
|
1018
|
+
typeof(
|
|
1019
|
+
_eip_1559);
|
|
1020
|
+
if ( _eip_1559_type === "undefined" ) {
|
|
1021
|
+
_msg =
|
|
1022
|
+
"EIP-1559 switch setting undefined, " +
|
|
1023
|
+
`setting default. (${_default})`;
|
|
1024
|
+
_msg_info(
|
|
1025
|
+
_msg);
|
|
1026
|
+
_eip_1559_get =
|
|
1027
|
+
true;
|
|
1028
|
+
}
|
|
1029
|
+
else if ( _eip_1559_type === "string" ) {
|
|
1030
|
+
if ( _eip_1559_max.length < 1 ) {
|
|
1031
|
+
_msg =
|
|
1032
|
+
"EIP-1559 switch setting is an empty string, " +
|
|
1033
|
+
`setting default. (${_default}).`;
|
|
1034
|
+
_msg_info(
|
|
1035
|
+
_msg);
|
|
1036
|
+
_eip_1559_get =
|
|
1037
|
+
true;
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
if ( _eip_1559 === "true" ) {
|
|
1041
|
+
_eip_1559 =
|
|
1042
|
+
true;
|
|
1043
|
+
}
|
|
1044
|
+
if ( _eip_1559 === "false" ) {
|
|
1045
|
+
_eip_1559 =
|
|
1046
|
+
false;
|
|
1047
|
+
}
|
|
1048
|
+
else {
|
|
1049
|
+
_msg =
|
|
1050
|
+
"EIP-1559 switch setting is a non-boolean string, " +
|
|
1051
|
+
"but it should be a boolean " +
|
|
1052
|
+
`(current value: ${_eip_1559}).`;
|
|
1053
|
+
_msg_error(
|
|
1054
|
+
_msg,
|
|
1055
|
+
0);
|
|
1056
|
+
throw _msg;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
else if ( _eip_1559_type === "object" ) {
|
|
1061
|
+
_eip_1559_keys =
|
|
1062
|
+
Object.keys(
|
|
1063
|
+
_eip_1559);
|
|
1064
|
+
if ( _eip_1559_keys.length < 1 ) {
|
|
1065
|
+
_msg =
|
|
1066
|
+
"EIP-1559 switch setting is an empty object, " +
|
|
1067
|
+
`setting default. (${_default}).`;
|
|
1068
|
+
_msg_info(
|
|
1069
|
+
_msg);
|
|
1070
|
+
_eip_1559_get =
|
|
1071
|
+
true;
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
_msg =
|
|
1075
|
+
"EIP-1559 switch setting is an " +
|
|
1076
|
+
"object but it should be a boolean. " +
|
|
1077
|
+
`(current value: ${_eip_1559}).`;
|
|
1078
|
+
_msg_error(
|
|
1079
|
+
_msg,
|
|
1080
|
+
0);
|
|
1081
|
+
throw _msg;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
else if ( _eip_1559_type === "number" ) {
|
|
1085
|
+
if ( _eip_1559 === 0 ) {
|
|
1086
|
+
_eip_1559 =
|
|
1087
|
+
false;
|
|
1088
|
+
}
|
|
1089
|
+
if ( _eip_1559 === 1 ) {
|
|
1090
|
+
_eip_1559 =
|
|
1091
|
+
true;
|
|
1092
|
+
}
|
|
1093
|
+
else {
|
|
1094
|
+
_msg =
|
|
1095
|
+
"EIP-1559 switch setting is an " +
|
|
1096
|
+
"object but it should be a boolean " +
|
|
1097
|
+
`(current value: ${_eip_1559}).`;
|
|
1098
|
+
_msg_error(
|
|
1099
|
+
_msg,
|
|
1100
|
+
0);
|
|
1101
|
+
throw _msg;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
_msg =
|
|
1106
|
+
"EIP-1559 switch setting has type " +
|
|
1107
|
+
`'${_eip_1559_type}' but it should be` +
|
|
1108
|
+
"a boolean.";
|
|
1109
|
+
_msg_error(
|
|
1110
|
+
_msg,
|
|
1111
|
+
0);
|
|
1112
|
+
throw _msg;
|
|
1113
|
+
}
|
|
1114
|
+
if ( _eip_1559_get ) {
|
|
1115
|
+
_eip_1559 =
|
|
1116
|
+
_default;
|
|
1117
|
+
}
|
|
1118
|
+
return _eip_1559;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
908
1121
|
async function
|
|
909
1122
|
_call_price_gas_manual(
|
|
910
1123
|
_price_feasible_retries_max,
|
|
@@ -914,6 +1127,10 @@ async function
|
|
|
914
1127
|
_price_gas,
|
|
915
1128
|
_gas_fee,
|
|
916
1129
|
_fee_priority,
|
|
1130
|
+
_price_gas_max,
|
|
1131
|
+
_eip_1559,
|
|
1132
|
+
_msg_value,
|
|
1133
|
+
_contract,
|
|
917
1134
|
_method,
|
|
918
1135
|
_method_args,
|
|
919
1136
|
_tx) {
|
|
@@ -921,8 +1138,24 @@ async function
|
|
|
921
1138
|
_gas_limit,
|
|
922
1139
|
_msg,
|
|
923
1140
|
_price_feasible_retries,
|
|
924
|
-
_price_gas_max,
|
|
925
1141
|
_price_gas_transaction_get_args;
|
|
1142
|
+
try {
|
|
1143
|
+
_price_gas_max =
|
|
1144
|
+
_price_gas_max_check(
|
|
1145
|
+
_price_gas_max);
|
|
1146
|
+
}
|
|
1147
|
+
catch(
|
|
1148
|
+
_error) {
|
|
1149
|
+
_msg =
|
|
1150
|
+
"Error running '_price_gas_max_check' " +
|
|
1151
|
+
`with argument '${_price_gas_max}'.`;
|
|
1152
|
+
_msg_error(
|
|
1153
|
+
_msg,
|
|
1154
|
+
0);
|
|
1155
|
+
_echo2(
|
|
1156
|
+
_error);
|
|
1157
|
+
throw _error;
|
|
1158
|
+
}
|
|
926
1159
|
const
|
|
927
1160
|
_price_gas_type =
|
|
928
1161
|
typeof(
|
|
@@ -969,10 +1202,9 @@ async function
|
|
|
969
1202
|
0);
|
|
970
1203
|
throw _msg;
|
|
971
1204
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
100000000;
|
|
1205
|
+
const
|
|
1206
|
+
_price_gas_transaction_get_selection_mode =
|
|
1207
|
+
_price_gas;
|
|
976
1208
|
try {
|
|
977
1209
|
_tx = await
|
|
978
1210
|
_method.populateTransaction.apply(
|
|
@@ -992,8 +1224,9 @@ async function
|
|
|
992
1224
|
}
|
|
993
1225
|
// An hardcoded gas limit parameter.
|
|
994
1226
|
_gas_limit =
|
|
995
|
-
|
|
996
|
-
|
|
1227
|
+
10000000
|
|
1228
|
+
// Math.floor(
|
|
1229
|
+
// 15803479 * 12 / 10);
|
|
997
1230
|
// 17000000;
|
|
998
1231
|
// Setting as gas limit double
|
|
999
1232
|
// of how much you wanna spend.
|
|
@@ -1148,21 +1381,40 @@ async function
|
|
|
1148
1381
|
_msg_error(
|
|
1149
1382
|
_msg,
|
|
1150
1383
|
0);
|
|
1151
|
-
|
|
1384
|
+
const
|
|
1385
|
+
_code =
|
|
1386
|
+
_error[
|
|
1387
|
+
"info"][
|
|
1388
|
+
"error"][
|
|
1389
|
+
"code"];
|
|
1390
|
+
if ( _code === -32000 ) {
|
|
1391
|
+
_msg =
|
|
1392
|
+
_error[
|
|
1393
|
+
"info"][
|
|
1394
|
+
"error"][
|
|
1395
|
+
"message"];
|
|
1396
|
+
throw _msg;
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
_echo2(
|
|
1400
|
+
_error);
|
|
1401
|
+
throw _error;
|
|
1402
|
+
}
|
|
1152
1403
|
}
|
|
1153
1404
|
return _tx;
|
|
1154
1405
|
}
|
|
1155
1406
|
|
|
1156
1407
|
async function
|
|
1157
1408
|
_call_price_gas_auto(
|
|
1409
|
+
_retries_max,
|
|
1158
1410
|
_measure_unit,
|
|
1159
1411
|
_msg_value,
|
|
1160
1412
|
_method,
|
|
1161
|
-
_method_args
|
|
1413
|
+
_method_args,
|
|
1414
|
+
_tx) {
|
|
1162
1415
|
let
|
|
1163
1416
|
_amount,
|
|
1164
|
-
_msg
|
|
1165
|
-
_tx;
|
|
1417
|
+
_msg;
|
|
1166
1418
|
const
|
|
1167
1419
|
_send_opts =
|
|
1168
1420
|
{};
|
|
@@ -1212,13 +1464,30 @@ async function
|
|
|
1212
1464
|
_error) {
|
|
1213
1465
|
_msg =
|
|
1214
1466
|
"Error sending transaction to the " +
|
|
1215
|
-
"network using the 'send' method" +
|
|
1467
|
+
"network using the 'send' method " +
|
|
1216
1468
|
"of the Ethers method object.";
|
|
1217
1469
|
_msg_error(
|
|
1218
1470
|
_msg,
|
|
1219
1471
|
0);
|
|
1220
|
-
|
|
1221
|
-
|
|
1472
|
+
const
|
|
1473
|
+
_code =
|
|
1474
|
+
_error[
|
|
1475
|
+
"info"][
|
|
1476
|
+
"error"][
|
|
1477
|
+
"code"];
|
|
1478
|
+
if ( _code === -32000 ) {
|
|
1479
|
+
_msg =
|
|
1480
|
+
_error[
|
|
1481
|
+
"info"][
|
|
1482
|
+
"error"][
|
|
1483
|
+
"message"];
|
|
1484
|
+
throw _msg;
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
_echo2(
|
|
1488
|
+
_error);
|
|
1489
|
+
throw _error;
|
|
1490
|
+
}
|
|
1222
1491
|
throw _error;
|
|
1223
1492
|
}
|
|
1224
1493
|
return _tx;
|
|
@@ -1243,7 +1512,9 @@ async function
|
|
|
1243
1512
|
_verbose,
|
|
1244
1513
|
_retries_max,
|
|
1245
1514
|
_contract,
|
|
1246
|
-
_method
|
|
1515
|
+
_method,
|
|
1516
|
+
_price_gas_max,
|
|
1517
|
+
_eip_1559) {
|
|
1247
1518
|
let
|
|
1248
1519
|
_amount,
|
|
1249
1520
|
_call_price_gas_manual_args,
|
|
@@ -1252,17 +1523,27 @@ async function
|
|
|
1252
1523
|
_fee_priority,
|
|
1253
1524
|
_gas_fee,
|
|
1254
1525
|
_msg,
|
|
1255
|
-
_eip_1559,
|
|
1256
1526
|
_price_feasible_retries_max,
|
|
1257
|
-
_price_gas_max,
|
|
1258
1527
|
_price_gas_transaction_get_args,
|
|
1259
1528
|
_price_gas_transaction_get_retries_max,
|
|
1260
1529
|
_price_gas_transaction_get_selection_mode,
|
|
1261
1530
|
_send_opts,
|
|
1262
1531
|
_receipt,
|
|
1263
1532
|
_tx;
|
|
1264
|
-
|
|
1265
|
-
|
|
1533
|
+
try {
|
|
1534
|
+
_eip_1559 =
|
|
1535
|
+
_eip_1559_check(
|
|
1536
|
+
_eip_1559);
|
|
1537
|
+
}
|
|
1538
|
+
catch(
|
|
1539
|
+
_error) {
|
|
1540
|
+
_msg =
|
|
1541
|
+
"Error running '_eip_1559_check'.";
|
|
1542
|
+
_msg_error(
|
|
1543
|
+
_msg,
|
|
1544
|
+
0);
|
|
1545
|
+
throw _msg;
|
|
1546
|
+
}
|
|
1266
1547
|
_send_opts =
|
|
1267
1548
|
{};
|
|
1268
1549
|
_measure_unit =
|
|
@@ -1302,7 +1583,7 @@ async function
|
|
|
1302
1583
|
}
|
|
1303
1584
|
_msg_value =
|
|
1304
1585
|
_msg_value_check(
|
|
1305
|
-
|
|
1586
|
+
_msg_value);
|
|
1306
1587
|
_call_timeout =
|
|
1307
1588
|
_call_timeout_check(
|
|
1308
1589
|
_call_timeout);
|
|
@@ -1372,6 +1653,10 @@ async function
|
|
|
1372
1653
|
_price_gas,
|
|
1373
1654
|
_gas_fee,
|
|
1374
1655
|
_fee_priority,
|
|
1656
|
+
_price_gas_max,
|
|
1657
|
+
_eip_1559,
|
|
1658
|
+
_msg_value,
|
|
1659
|
+
_contract,
|
|
1375
1660
|
_method,
|
|
1376
1661
|
_method_args,
|
|
1377
1662
|
_tx
|
|
@@ -1510,12 +1795,6 @@ async function
|
|
|
1510
1795
|
];
|
|
1511
1796
|
}
|
|
1512
1797
|
|
|
1513
|
-
function
|
|
1514
|
-
_receipt_cost_get(
|
|
1515
|
-
_receipt) {
|
|
1516
|
-
true;
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
1798
|
function
|
|
1520
1799
|
_retries_max_check(
|
|
1521
1800
|
_retries_max) {
|
|
@@ -1561,6 +1840,43 @@ function
|
|
|
1561
1840
|
return _retries_max;
|
|
1562
1841
|
}
|
|
1563
1842
|
|
|
1843
|
+
function
|
|
1844
|
+
_receipt_tx_cost_get(
|
|
1845
|
+
_receipt,
|
|
1846
|
+
_measure_unit) {
|
|
1847
|
+
const
|
|
1848
|
+
_tx_cost =
|
|
1849
|
+
_receipt[
|
|
1850
|
+
"gasUsed"] *
|
|
1851
|
+
_receipt[
|
|
1852
|
+
"gasPrice"];
|
|
1853
|
+
return _tx_cost;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
function
|
|
1857
|
+
_receipt_display(
|
|
1858
|
+
_receipt,
|
|
1859
|
+
_measure_unit) {
|
|
1860
|
+
_msg =
|
|
1861
|
+
`Transaction hash: '${_receipt.hash}'.`;
|
|
1862
|
+
_msg_info(
|
|
1863
|
+
_msg);
|
|
1864
|
+
const
|
|
1865
|
+
_tx_cost =
|
|
1866
|
+
_receipt_tx_cost_get(
|
|
1867
|
+
_receipt,
|
|
1868
|
+
_measure_unit);
|
|
1869
|
+
if ( _measure_unit == "ether" ) {
|
|
1870
|
+
_tx_cost =
|
|
1871
|
+
_wei_to_ether(
|
|
1872
|
+
_tx_cost);
|
|
1873
|
+
}
|
|
1874
|
+
_msg =
|
|
1875
|
+
`Transaction cost: '${_tx_cost}'.`;
|
|
1876
|
+
_msg_info(
|
|
1877
|
+
_msg);
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1564
1880
|
async function
|
|
1565
1881
|
_contract_run(
|
|
1566
1882
|
_retries_max,
|
|
@@ -1584,6 +1900,7 @@ async function
|
|
|
1584
1900
|
_method) {
|
|
1585
1901
|
let
|
|
1586
1902
|
_attempt,
|
|
1903
|
+
_hash_type,
|
|
1587
1904
|
_msg,
|
|
1588
1905
|
_receipt,
|
|
1589
1906
|
_receipt_type,
|
|
@@ -1724,86 +2041,104 @@ async function
|
|
|
1724
2041
|
1;
|
|
1725
2042
|
while ( _attempt <= _retries_max ) {
|
|
1726
2043
|
try {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
typeof(
|
|
1736
|
-
_receipt);
|
|
1737
|
-
if ( _receipt_type == "undefined" ) {
|
|
1738
|
-
_msg_error_transaction_undefined(
|
|
1739
|
-
_attempt);
|
|
1740
|
-
_msg =
|
|
1741
|
-
"No receipt, transaction may have failed.";
|
|
1742
|
-
throw _msg;
|
|
2044
|
+
try {
|
|
2045
|
+
[ _tx,
|
|
2046
|
+
_receipt,
|
|
2047
|
+
_method,
|
|
2048
|
+
_contract ] =
|
|
2049
|
+
await _contract_call_dynamic.apply(
|
|
2050
|
+
null,
|
|
2051
|
+
_contract_call_dynamic_args);
|
|
1743
2052
|
}
|
|
1744
|
-
|
|
2053
|
+
catch (
|
|
2054
|
+
_error) {
|
|
1745
2055
|
_msg =
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
_msg_info(
|
|
1759
|
-
_msg);
|
|
1760
|
-
_echo(
|
|
2056
|
+
"Error running '_evm_contract_call_dynamic'. " +
|
|
2057
|
+
"Arguments unsatized, not showing.";
|
|
2058
|
+
_msg_error(
|
|
2059
|
+
_msg,
|
|
2060
|
+
0);
|
|
2061
|
+
_echo2(
|
|
2062
|
+
_error);
|
|
2063
|
+
throw _error;
|
|
2064
|
+
}
|
|
2065
|
+
try {
|
|
2066
|
+
_receipt_type =
|
|
2067
|
+
typeof(
|
|
1761
2068
|
_receipt);
|
|
2069
|
+
if ( _receipt_type === "undefined" ) {
|
|
2070
|
+
_msg_error_transaction_undefined(
|
|
2071
|
+
_attempt);
|
|
2072
|
+
_msg =
|
|
2073
|
+
"No receipt, transaction may have failed.";
|
|
2074
|
+
throw _msg;
|
|
1762
2075
|
}
|
|
1763
|
-
if (
|
|
1764
|
-
_receipt_tx_cost_get(
|
|
1765
|
-
_receipt,
|
|
1766
|
-
_measure_unit);
|
|
1767
|
-
_receipt_display(
|
|
1768
|
-
_receipt,
|
|
1769
|
-
_measure_unit);
|
|
2076
|
+
else if ( _receipt_type !== "undefined" ) {
|
|
1770
2077
|
_msg =
|
|
1771
|
-
`Transaction
|
|
2078
|
+
`Transaction no. '${_tx.nonce}'.`;
|
|
1772
2079
|
_msg_info(
|
|
1773
2080
|
_msg);
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
"
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
2081
|
+
if ( _verbose == "y" ) {
|
|
2082
|
+
_msg =
|
|
2083
|
+
"Transaction response:";
|
|
2084
|
+
_msg_info(
|
|
2085
|
+
_msg);
|
|
2086
|
+
_echo(
|
|
2087
|
+
_tx);
|
|
2088
|
+
_msg =
|
|
2089
|
+
"Transaction receipt:";
|
|
2090
|
+
_msg_info(
|
|
2091
|
+
_msg);
|
|
2092
|
+
_echo(
|
|
2093
|
+
_receipt);
|
|
2094
|
+
}
|
|
2095
|
+
_hash_type =
|
|
2096
|
+
typeof(
|
|
2097
|
+
_receipt.hash);
|
|
2098
|
+
if ( _hash_type !== "undefined" ) {
|
|
2099
|
+
_receipt_display(
|
|
2100
|
+
_receipt,
|
|
2101
|
+
_measure_unit);
|
|
2102
|
+
break;
|
|
2103
|
+
}
|
|
2104
|
+
else if ( _hash_type === "undefined" ) {
|
|
2105
|
+
_msg_error_transaction_failed(
|
|
2106
|
+
_attempt);
|
|
2107
|
+
_msg =
|
|
2108
|
+
"Transaction hash undefined.";
|
|
2109
|
+
_msg_error(
|
|
2110
|
+
_msg,
|
|
2111
|
+
0);
|
|
2112
|
+
throw _msg;
|
|
2113
|
+
}
|
|
2114
|
+
else {
|
|
2115
|
+
_msg_error_transaction_failed(
|
|
2116
|
+
_attempt);
|
|
2117
|
+
_msg =
|
|
2118
|
+
"Unknown transaction error.";
|
|
2119
|
+
_msg_error(
|
|
2120
|
+
_msg,
|
|
2121
|
+
0);
|
|
2122
|
+
throw _msg;
|
|
1783
2123
|
}
|
|
1784
|
-
_msg =
|
|
1785
|
-
`Transaction cost: '${_tx_cost}'.`;
|
|
1786
|
-
_msg_info(
|
|
1787
|
-
_msg);
|
|
1788
|
-
break;
|
|
1789
|
-
}
|
|
1790
|
-
else if ( _receipt.hash == undefined ) {
|
|
1791
|
-
_msg_error_transaction_failed(
|
|
1792
|
-
_attempt);
|
|
1793
|
-
_msg =
|
|
1794
|
-
"Transaction hash undefined.";
|
|
1795
|
-
throw _msg;
|
|
1796
|
-
}
|
|
1797
|
-
else {
|
|
1798
|
-
_msg_error_transaction_failed(
|
|
1799
|
-
_attempt);
|
|
1800
|
-
_msg =
|
|
1801
|
-
"Unknown transaction error.";
|
|
1802
|
-
throw _msg;
|
|
1803
2124
|
}
|
|
1804
2125
|
}
|
|
1805
|
-
|
|
2126
|
+
catch (
|
|
1806
2127
|
_error) {
|
|
2128
|
+
_msg =
|
|
2129
|
+
"Error processing receipt with value:";
|
|
2130
|
+
_msg_error(
|
|
2131
|
+
_msg,
|
|
2132
|
+
0);
|
|
2133
|
+
_echo2(
|
|
2134
|
+
_receipt);
|
|
2135
|
+
_echo2(
|
|
2136
|
+
_error);
|
|
2137
|
+
throw _error;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
catch (
|
|
2141
|
+
_error) {
|
|
1807
2142
|
_error_display(
|
|
1808
2143
|
_error);
|
|
1809
2144
|
_msg =
|
|
@@ -1816,7 +2151,7 @@ async function
|
|
|
1816
2151
|
_attempt + 1;
|
|
1817
2152
|
}
|
|
1818
2153
|
}
|
|
1819
|
-
if (
|
|
2154
|
+
if ( _retries_max < _attempt ) {
|
|
1820
2155
|
_msg =
|
|
1821
2156
|
"Maximum number of retries reached.";
|
|
1822
2157
|
throw _msg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{ "name": "evm-contracts-tools",
|
|
2
2
|
"version":
|
|
3
|
-
"0.0.
|
|
3
|
+
"0.0.88",
|
|
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": {
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"crash-js-webpack":
|
|
103
|
-
"^0.0.
|
|
103
|
+
"^0.0.93",
|
|
104
104
|
"brace-expansion":
|
|
105
105
|
"^5.0.9",
|
|
106
106
|
"eslint":
|
|
107
|
-
"^10.
|
|
107
|
+
"^10.15.0",
|
|
108
108
|
"@eslint/js":
|
|
109
109
|
"^10.0.1",
|
|
110
110
|
"fast-uri":
|
|
@@ -120,17 +120,17 @@
|
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
122
|
"libcrash-js":
|
|
123
|
-
"npm:crash-js@^
|
|
123
|
+
"npm:crash-js@^1000000000000031.1000000000000001.1000000000000001",
|
|
124
124
|
"ethers":
|
|
125
125
|
"^6.13.2",
|
|
126
126
|
"evm-chains-info":
|
|
127
|
-
"^0.0.
|
|
127
|
+
"^0.0.43",
|
|
128
128
|
"evm-transactions-tools":
|
|
129
129
|
"^0.1.10000000000001",
|
|
130
130
|
"evm-wallet":
|
|
131
|
-
"npm:evm-wallet.js@^0.0.
|
|
131
|
+
"npm:evm-wallet.js@^0.0.108",
|
|
132
132
|
"libevm":
|
|
133
|
-
"^0.0.
|
|
133
|
+
"^0.0.58",
|
|
134
134
|
"ws":
|
|
135
135
|
"^8.21.0",
|
|
136
136
|
"yargs":
|
|
@@ -138,15 +138,15 @@
|
|
|
138
138
|
},
|
|
139
139
|
"overrides": {
|
|
140
140
|
"libcrash-js":
|
|
141
|
-
"npm:crash-js@^
|
|
141
|
+
"npm:crash-js@^1000000000000031.1000000000000001.1000000000000001",
|
|
142
142
|
"evm-contracts-tools":
|
|
143
143
|
"./evm-contracts-tools",
|
|
144
144
|
"evm-wallet":
|
|
145
|
-
"npm:evm-wallet.js@^0.0.
|
|
145
|
+
"npm:evm-wallet.js@^0.0.108",
|
|
146
146
|
"evm-wallet.js":
|
|
147
|
-
"npm:evm-wallet.js@^0.0.
|
|
147
|
+
"npm:evm-wallet.js@^0.0.108",
|
|
148
148
|
"libevm":
|
|
149
|
-
"^0.0.
|
|
149
|
+
"^0.0.58"
|
|
150
150
|
},
|
|
151
151
|
"type":
|
|
152
152
|
"module",
|