evm-contracts-tools 0.0.85 → 0.0.87
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 +432 -94
- package/package.json +6 -6
|
@@ -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(
|
|
@@ -613,6 +614,9 @@ async function
|
|
|
613
614
|
_price_gas,
|
|
614
615
|
_gas_fee,
|
|
615
616
|
_fee_priority,
|
|
617
|
+
_target_network,
|
|
618
|
+
_api_key_path,
|
|
619
|
+
_measure_unit,
|
|
616
620
|
_retries_max) {
|
|
617
621
|
let
|
|
618
622
|
_msg;
|
|
@@ -720,7 +724,13 @@ async function
|
|
|
720
724
|
_fee_priority =
|
|
721
725
|
Number(
|
|
722
726
|
_fee_priority);
|
|
723
|
-
|
|
727
|
+
const
|
|
728
|
+
_output = [
|
|
729
|
+
_price_gas,
|
|
730
|
+
_gas_fee,
|
|
731
|
+
_fee_priority
|
|
732
|
+
];
|
|
733
|
+
return _output;
|
|
724
734
|
}
|
|
725
735
|
|
|
726
736
|
function
|
|
@@ -842,9 +852,11 @@ function
|
|
|
842
852
|
async function
|
|
843
853
|
_method_check(
|
|
844
854
|
_contract_method,
|
|
845
|
-
_method
|
|
855
|
+
_method,
|
|
856
|
+
_contract) {
|
|
846
857
|
let
|
|
847
|
-
_method_object_get
|
|
858
|
+
_method_object_get,
|
|
859
|
+
_msg;
|
|
848
860
|
const
|
|
849
861
|
_method_type =
|
|
850
862
|
typeof(
|
|
@@ -900,6 +912,209 @@ async function
|
|
|
900
912
|
return _method;
|
|
901
913
|
}
|
|
902
914
|
|
|
915
|
+
function
|
|
916
|
+
_price_gas_max_check(
|
|
917
|
+
_price_gas_max) {
|
|
918
|
+
let
|
|
919
|
+
_price_gas_max_get,
|
|
920
|
+
_msg;
|
|
921
|
+
const
|
|
922
|
+
_default =
|
|
923
|
+
100000000;
|
|
924
|
+
_price_gas_max_get =
|
|
925
|
+
false;
|
|
926
|
+
const
|
|
927
|
+
_price_gas_max_type =
|
|
928
|
+
typeof(
|
|
929
|
+
_price_gas_max);
|
|
930
|
+
if ( _price_gas_max_type === "undefined" ) {
|
|
931
|
+
_msg =
|
|
932
|
+
"Maximum gas price variable undefined, " +
|
|
933
|
+
`setting default. (${_default}).`;
|
|
934
|
+
_msg_info(
|
|
935
|
+
_msg);
|
|
936
|
+
_price_gas_max_get =
|
|
937
|
+
true;
|
|
938
|
+
}
|
|
939
|
+
else if ( _price_gas_max_type === "string" ) {
|
|
940
|
+
if ( _price_gas_max.length < 1 ) {
|
|
941
|
+
_msg =
|
|
942
|
+
"Maximum gas price variable is an empty string, " +
|
|
943
|
+
`setting default. (${_default}).`;
|
|
944
|
+
_msg_info(
|
|
945
|
+
_msg);
|
|
946
|
+
_price_gas_max_get =
|
|
947
|
+
true;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
else if ( _price_gas_max_type === "object" ) {
|
|
951
|
+
_price_gas_max_keys =
|
|
952
|
+
Object.keys(
|
|
953
|
+
_price_gas_max);
|
|
954
|
+
if ( _price_gas_max_keys.length < 1 ) {
|
|
955
|
+
_msg =
|
|
956
|
+
"Maximum gas price variable is an empty object, " +
|
|
957
|
+
`setting default. (${_default}).`;
|
|
958
|
+
_msg_info(
|
|
959
|
+
_msg);
|
|
960
|
+
_price_gas_max_get =
|
|
961
|
+
true;
|
|
962
|
+
}
|
|
963
|
+
else {
|
|
964
|
+
_msg =
|
|
965
|
+
"Maximum gas price variable is an " +
|
|
966
|
+
"object but it should be a positive integer.";
|
|
967
|
+
_msg_error(
|
|
968
|
+
_msg,
|
|
969
|
+
0);
|
|
970
|
+
throw _msg;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
else if ( _price_gas_max_type === "number" ) {
|
|
974
|
+
true;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
_msg =
|
|
978
|
+
"Maximum gas price variable has type " +
|
|
979
|
+
`'${_price_gas_max_type}' but it should be` +
|
|
980
|
+
"a positive integer.";
|
|
981
|
+
_msg_error(
|
|
982
|
+
_msg,
|
|
983
|
+
0);
|
|
984
|
+
throw _msg;
|
|
985
|
+
}
|
|
986
|
+
if ( _price_gas_max_get ) {
|
|
987
|
+
_price_gas_max =
|
|
988
|
+
_default;
|
|
989
|
+
}
|
|
990
|
+
if ( _price_gas_max_get < 1 ) {
|
|
991
|
+
_msg =
|
|
992
|
+
"Maximum gas price variable should be " +
|
|
993
|
+
"a positive integer, but has value " +
|
|
994
|
+
`'${_price_gas_max}'`;
|
|
995
|
+
_msg_error(
|
|
996
|
+
_msg,
|
|
997
|
+
0);
|
|
998
|
+
}
|
|
999
|
+
return _price_gas_max;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
function
|
|
1003
|
+
_eip_1559_check(
|
|
1004
|
+
_eip_1559) {
|
|
1005
|
+
let
|
|
1006
|
+
_eip_1559_get,
|
|
1007
|
+
_msg;
|
|
1008
|
+
const
|
|
1009
|
+
_default =
|
|
1010
|
+
true;
|
|
1011
|
+
_eip_1559_get =
|
|
1012
|
+
false;
|
|
1013
|
+
const
|
|
1014
|
+
_eip_1559_type =
|
|
1015
|
+
typeof(
|
|
1016
|
+
_eip_1559);
|
|
1017
|
+
if ( _eip_1559_type === "undefined" ) {
|
|
1018
|
+
_msg =
|
|
1019
|
+
"EIP-1559 switch setting undefined, " +
|
|
1020
|
+
`setting default. (${_default})`;
|
|
1021
|
+
_msg_info(
|
|
1022
|
+
_msg);
|
|
1023
|
+
_eip_1559_get =
|
|
1024
|
+
true;
|
|
1025
|
+
}
|
|
1026
|
+
else if ( _eip_1559_type === "string" ) {
|
|
1027
|
+
if ( _eip_1559_max.length < 1 ) {
|
|
1028
|
+
_msg =
|
|
1029
|
+
"EIP-1559 switch setting is an empty string, " +
|
|
1030
|
+
`setting default. (${_default}).`;
|
|
1031
|
+
_msg_info(
|
|
1032
|
+
_msg);
|
|
1033
|
+
_eip_1559_get =
|
|
1034
|
+
true;
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
if ( _eip_1559 === "true" ) {
|
|
1038
|
+
_eip_1559 =
|
|
1039
|
+
true;
|
|
1040
|
+
}
|
|
1041
|
+
if ( _eip_1559 === "false" ) {
|
|
1042
|
+
_eip_1559 =
|
|
1043
|
+
false;
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
_msg =
|
|
1047
|
+
"EIP-1559 switch setting is a non-boolean string, " +
|
|
1048
|
+
"but it should be a boolean " +
|
|
1049
|
+
`(current value: ${_eip_1559}).`;
|
|
1050
|
+
_msg_error(
|
|
1051
|
+
_msg,
|
|
1052
|
+
0);
|
|
1053
|
+
throw _msg;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
else if ( _eip_1559_type === "object" ) {
|
|
1058
|
+
_eip_1559_keys =
|
|
1059
|
+
Object.keys(
|
|
1060
|
+
_eip_1559);
|
|
1061
|
+
if ( _eip_1559_keys.length < 1 ) {
|
|
1062
|
+
_msg =
|
|
1063
|
+
"EIP-1559 switch setting is an empty object, " +
|
|
1064
|
+
`setting default. (${_default}).`;
|
|
1065
|
+
_msg_info(
|
|
1066
|
+
_msg);
|
|
1067
|
+
_eip_1559_get =
|
|
1068
|
+
true;
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
_msg =
|
|
1072
|
+
"EIP-1559 switch setting is an " +
|
|
1073
|
+
"object but it should be a boolean. " +
|
|
1074
|
+
`(current value: ${_eip_1559}).`;
|
|
1075
|
+
_msg_error(
|
|
1076
|
+
_msg,
|
|
1077
|
+
0);
|
|
1078
|
+
throw _msg;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
else if ( _eip_1559_type === "number" ) {
|
|
1082
|
+
if ( _eip_1559 === 0 ) {
|
|
1083
|
+
_eip_1559 =
|
|
1084
|
+
false;
|
|
1085
|
+
}
|
|
1086
|
+
if ( _eip_1559 === 1 ) {
|
|
1087
|
+
_eip_1559 =
|
|
1088
|
+
true;
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
_msg =
|
|
1092
|
+
"EIP-1559 switch setting is an " +
|
|
1093
|
+
"object but it should be a boolean " +
|
|
1094
|
+
`(current value: ${_eip_1559}).`;
|
|
1095
|
+
_msg_error(
|
|
1096
|
+
_msg,
|
|
1097
|
+
0);
|
|
1098
|
+
throw _msg;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
_msg =
|
|
1103
|
+
"EIP-1559 switch setting has type " +
|
|
1104
|
+
`'${_eip_1559_type}' but it should be` +
|
|
1105
|
+
"a boolean.";
|
|
1106
|
+
_msg_error(
|
|
1107
|
+
_msg,
|
|
1108
|
+
0);
|
|
1109
|
+
throw _msg;
|
|
1110
|
+
}
|
|
1111
|
+
if ( _eip_1559_get ) {
|
|
1112
|
+
_eip_1559 =
|
|
1113
|
+
_default;
|
|
1114
|
+
}
|
|
1115
|
+
return _eip_1559;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
903
1118
|
async function
|
|
904
1119
|
_call_price_gas_manual(
|
|
905
1120
|
_price_feasible_retries_max,
|
|
@@ -909,6 +1124,10 @@ async function
|
|
|
909
1124
|
_price_gas,
|
|
910
1125
|
_gas_fee,
|
|
911
1126
|
_fee_priority,
|
|
1127
|
+
_price_gas_max,
|
|
1128
|
+
_eip_1559,
|
|
1129
|
+
_msg_value,
|
|
1130
|
+
_contract,
|
|
912
1131
|
_method,
|
|
913
1132
|
_method_args,
|
|
914
1133
|
_tx) {
|
|
@@ -916,8 +1135,24 @@ async function
|
|
|
916
1135
|
_gas_limit,
|
|
917
1136
|
_msg,
|
|
918
1137
|
_price_feasible_retries,
|
|
919
|
-
_price_gas_max,
|
|
920
1138
|
_price_gas_transaction_get_args;
|
|
1139
|
+
try {
|
|
1140
|
+
_price_gas_max =
|
|
1141
|
+
_price_gas_max_check(
|
|
1142
|
+
_price_gas_max);
|
|
1143
|
+
}
|
|
1144
|
+
catch(
|
|
1145
|
+
_error) {
|
|
1146
|
+
_msg =
|
|
1147
|
+
"Error running '_price_gas_max_check' " +
|
|
1148
|
+
`with argument '${_price_gas_max}'.`;
|
|
1149
|
+
_msg_error(
|
|
1150
|
+
_msg,
|
|
1151
|
+
0);
|
|
1152
|
+
_echo2(
|
|
1153
|
+
_error);
|
|
1154
|
+
throw _error;
|
|
1155
|
+
}
|
|
921
1156
|
const
|
|
922
1157
|
_price_gas_type =
|
|
923
1158
|
typeof(
|
|
@@ -964,10 +1199,9 @@ async function
|
|
|
964
1199
|
0);
|
|
965
1200
|
throw _msg;
|
|
966
1201
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
100000000;
|
|
1202
|
+
const
|
|
1203
|
+
_price_gas_transaction_get_selection_mode =
|
|
1204
|
+
_price_gas;
|
|
971
1205
|
try {
|
|
972
1206
|
_tx = await
|
|
973
1207
|
_method.populateTransaction.apply(
|
|
@@ -1143,7 +1377,23 @@ async function
|
|
|
1143
1377
|
_msg_error(
|
|
1144
1378
|
_msg,
|
|
1145
1379
|
0);
|
|
1146
|
-
|
|
1380
|
+
const
|
|
1381
|
+
_code =
|
|
1382
|
+
_error[
|
|
1383
|
+
"info"][
|
|
1384
|
+
"error"][
|
|
1385
|
+
"code"];
|
|
1386
|
+
if ( _code === -32000 ) {
|
|
1387
|
+
_msg =
|
|
1388
|
+
_error[
|
|
1389
|
+
"info"][
|
|
1390
|
+
"error"][
|
|
1391
|
+
"message"];
|
|
1392
|
+
throw _msg;
|
|
1393
|
+
}
|
|
1394
|
+
else {
|
|
1395
|
+
throw _error;
|
|
1396
|
+
}
|
|
1147
1397
|
}
|
|
1148
1398
|
return _tx;
|
|
1149
1399
|
}
|
|
@@ -1238,7 +1488,9 @@ async function
|
|
|
1238
1488
|
_verbose,
|
|
1239
1489
|
_retries_max,
|
|
1240
1490
|
_contract,
|
|
1241
|
-
_method
|
|
1491
|
+
_method,
|
|
1492
|
+
_price_gas_max,
|
|
1493
|
+
_eip_1559) {
|
|
1242
1494
|
let
|
|
1243
1495
|
_amount,
|
|
1244
1496
|
_call_price_gas_manual_args,
|
|
@@ -1247,46 +1499,67 @@ async function
|
|
|
1247
1499
|
_fee_priority,
|
|
1248
1500
|
_gas_fee,
|
|
1249
1501
|
_msg,
|
|
1250
|
-
_eip_1559,
|
|
1251
1502
|
_price_feasible_retries_max,
|
|
1252
|
-
_price_gas_max,
|
|
1253
1503
|
_price_gas_transaction_get_args,
|
|
1254
1504
|
_price_gas_transaction_get_retries_max,
|
|
1255
1505
|
_price_gas_transaction_get_selection_mode,
|
|
1256
1506
|
_send_opts,
|
|
1257
1507
|
_receipt,
|
|
1258
1508
|
_tx;
|
|
1259
|
-
|
|
1260
|
-
|
|
1509
|
+
try {
|
|
1510
|
+
_eip_1559 =
|
|
1511
|
+
_eip_1559_check(
|
|
1512
|
+
_eip_1559);
|
|
1513
|
+
}
|
|
1514
|
+
catch(
|
|
1515
|
+
_error) {
|
|
1516
|
+
_msg =
|
|
1517
|
+
"Error running '_eip_1559_check'.";
|
|
1518
|
+
_msg_error(
|
|
1519
|
+
_msg,
|
|
1520
|
+
0);
|
|
1521
|
+
throw _msg;
|
|
1522
|
+
}
|
|
1261
1523
|
_send_opts =
|
|
1262
1524
|
{};
|
|
1263
1525
|
_measure_unit =
|
|
1264
1526
|
_measure_unit_check(
|
|
1265
1527
|
_measure_unit);
|
|
1528
|
+
const
|
|
1529
|
+
_price_gas_check_args = [
|
|
1530
|
+
_price_gas,
|
|
1531
|
+
_gas_fee,
|
|
1532
|
+
_fee_priority,
|
|
1533
|
+
_target_network,
|
|
1534
|
+
_api_key_path,
|
|
1535
|
+
_measure_unit,
|
|
1536
|
+
_retries_max
|
|
1537
|
+
];
|
|
1266
1538
|
try {
|
|
1267
1539
|
[ _price_gas,
|
|
1268
1540
|
_gas_fee,
|
|
1269
1541
|
_fee_priority ] =
|
|
1270
|
-
await _price_gas_check(
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
_fee_priority,
|
|
1274
|
-
_retries_max);
|
|
1542
|
+
await _price_gas_check.apply(
|
|
1543
|
+
null,
|
|
1544
|
+
_price_gas_check_args);
|
|
1275
1545
|
}
|
|
1276
1546
|
catch(
|
|
1277
1547
|
_error) {
|
|
1278
1548
|
_msg =
|
|
1279
|
-
"Error
|
|
1549
|
+
"Error running '_price_gas_check' " +
|
|
1550
|
+
"with arguments:";
|
|
1280
1551
|
_msg_error(
|
|
1281
1552
|
_msg,
|
|
1282
1553
|
0);
|
|
1554
|
+
_echo2(
|
|
1555
|
+
_price_gas_check_args);
|
|
1283
1556
|
_echo2(
|
|
1284
1557
|
_error);
|
|
1285
1558
|
throw _error;
|
|
1286
1559
|
}
|
|
1287
1560
|
_msg_value =
|
|
1288
1561
|
_msg_value_check(
|
|
1289
|
-
|
|
1562
|
+
_msg_value);
|
|
1290
1563
|
_call_timeout =
|
|
1291
1564
|
_call_timeout_check(
|
|
1292
1565
|
_call_timeout);
|
|
@@ -1327,7 +1600,8 @@ async function
|
|
|
1327
1600
|
const
|
|
1328
1601
|
_method_check_args = [
|
|
1329
1602
|
_contract_method,
|
|
1330
|
-
_method
|
|
1603
|
+
_method,
|
|
1604
|
+
_contract
|
|
1331
1605
|
];
|
|
1332
1606
|
try {
|
|
1333
1607
|
_method =
|
|
@@ -1355,6 +1629,10 @@ async function
|
|
|
1355
1629
|
_price_gas,
|
|
1356
1630
|
_gas_fee,
|
|
1357
1631
|
_fee_priority,
|
|
1632
|
+
_price_gas_max,
|
|
1633
|
+
_eip_1559,
|
|
1634
|
+
_msg_value,
|
|
1635
|
+
_contract,
|
|
1358
1636
|
_method,
|
|
1359
1637
|
_method_args,
|
|
1360
1638
|
_tx
|
|
@@ -1526,6 +1804,9 @@ function
|
|
|
1526
1804
|
100;
|
|
1527
1805
|
}
|
|
1528
1806
|
}
|
|
1807
|
+
else if ( _retries_max_type === "number" ) {
|
|
1808
|
+
true;
|
|
1809
|
+
}
|
|
1529
1810
|
else {
|
|
1530
1811
|
_msg =
|
|
1531
1812
|
"Variable '_retries_max' must be " +
|
|
@@ -1541,6 +1822,43 @@ function
|
|
|
1541
1822
|
return _retries_max;
|
|
1542
1823
|
}
|
|
1543
1824
|
|
|
1825
|
+
function
|
|
1826
|
+
_receipt_tx_cost_get(
|
|
1827
|
+
_receipt,
|
|
1828
|
+
_measure_unit) {
|
|
1829
|
+
const
|
|
1830
|
+
_tx_cost =
|
|
1831
|
+
_receipt[
|
|
1832
|
+
"gasUsed"] *
|
|
1833
|
+
_receipt[
|
|
1834
|
+
"gasPrice"];
|
|
1835
|
+
return _tx_cost;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
function
|
|
1839
|
+
_receipt_display(
|
|
1840
|
+
_receipt,
|
|
1841
|
+
_measure_unit) {
|
|
1842
|
+
_msg =
|
|
1843
|
+
`Transaction hash: '${_receipt.hash}'.`;
|
|
1844
|
+
_msg_info(
|
|
1845
|
+
_msg);
|
|
1846
|
+
const
|
|
1847
|
+
_tx_cost =
|
|
1848
|
+
_receipt_tx_cost_get(
|
|
1849
|
+
_receipt,
|
|
1850
|
+
_measure_unit);
|
|
1851
|
+
if ( _measure_unit == "ether" ) {
|
|
1852
|
+
_tx_cost =
|
|
1853
|
+
_wei_to_ether(
|
|
1854
|
+
_tx_cost);
|
|
1855
|
+
}
|
|
1856
|
+
_msg =
|
|
1857
|
+
`Transaction cost: '${_tx_cost}'.`;
|
|
1858
|
+
_msg_info(
|
|
1859
|
+
_msg);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1544
1862
|
async function
|
|
1545
1863
|
_contract_run(
|
|
1546
1864
|
_retries_max,
|
|
@@ -1564,6 +1882,7 @@ async function
|
|
|
1564
1882
|
_method) {
|
|
1565
1883
|
let
|
|
1566
1884
|
_attempt,
|
|
1885
|
+
_hash_type,
|
|
1567
1886
|
_msg,
|
|
1568
1887
|
_receipt,
|
|
1569
1888
|
_receipt_type,
|
|
@@ -1660,7 +1979,8 @@ async function
|
|
|
1660
1979
|
const
|
|
1661
1980
|
_method_check_args = [
|
|
1662
1981
|
_contract_method,
|
|
1663
|
-
_method
|
|
1982
|
+
_method,
|
|
1983
|
+
_contract
|
|
1664
1984
|
];
|
|
1665
1985
|
try {
|
|
1666
1986
|
_method =
|
|
@@ -1703,86 +2023,104 @@ async function
|
|
|
1703
2023
|
1;
|
|
1704
2024
|
while ( _attempt <= _retries_max ) {
|
|
1705
2025
|
try {
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
typeof(
|
|
1715
|
-
_receipt);
|
|
1716
|
-
if ( _receipt_type == "undefined" ) {
|
|
1717
|
-
_msg_error_transaction_undefined(
|
|
1718
|
-
_attempt);
|
|
1719
|
-
_msg =
|
|
1720
|
-
"No receipt, transaction may have failed.";
|
|
1721
|
-
throw _msg;
|
|
2026
|
+
try {
|
|
2027
|
+
[ _tx,
|
|
2028
|
+
_receipt,
|
|
2029
|
+
_method,
|
|
2030
|
+
_contract ] =
|
|
2031
|
+
await _contract_call_dynamic.apply(
|
|
2032
|
+
null,
|
|
2033
|
+
_contract_call_dynamic_args);
|
|
1722
2034
|
}
|
|
1723
|
-
|
|
2035
|
+
catch (
|
|
2036
|
+
_error) {
|
|
1724
2037
|
_msg =
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
_msg_info(
|
|
1738
|
-
_msg);
|
|
1739
|
-
_echo(
|
|
2038
|
+
"Error running '_evm_contract_call_dynamic'. " +
|
|
2039
|
+
"Arguments unsatized, not showing.";
|
|
2040
|
+
_msg_error(
|
|
2041
|
+
_msg,
|
|
2042
|
+
0);
|
|
2043
|
+
_echo2(
|
|
2044
|
+
_error);
|
|
2045
|
+
throw _error;
|
|
2046
|
+
}
|
|
2047
|
+
try {
|
|
2048
|
+
_receipt_type =
|
|
2049
|
+
typeof(
|
|
1740
2050
|
_receipt);
|
|
2051
|
+
if ( _receipt_type === "undefined" ) {
|
|
2052
|
+
_msg_error_transaction_undefined(
|
|
2053
|
+
_attempt);
|
|
2054
|
+
_msg =
|
|
2055
|
+
"No receipt, transaction may have failed.";
|
|
2056
|
+
throw _msg;
|
|
1741
2057
|
}
|
|
1742
|
-
if (
|
|
1743
|
-
_receipt_tx_cost_get(
|
|
1744
|
-
_receipt,
|
|
1745
|
-
_measure_unit);
|
|
1746
|
-
_receipt_display(
|
|
1747
|
-
_receipt,
|
|
1748
|
-
_measure_unit);
|
|
2058
|
+
else if ( _receipt_type !== "undefined" ) {
|
|
1749
2059
|
_msg =
|
|
1750
|
-
`Transaction
|
|
2060
|
+
`Transaction no. '${_tx.nonce}'.`;
|
|
1751
2061
|
_msg_info(
|
|
1752
2062
|
_msg);
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
"
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
2063
|
+
if ( _verbose == "y" ) {
|
|
2064
|
+
_msg =
|
|
2065
|
+
"Transaction response:";
|
|
2066
|
+
_msg_info(
|
|
2067
|
+
_msg);
|
|
2068
|
+
_echo(
|
|
2069
|
+
_tx);
|
|
2070
|
+
_msg =
|
|
2071
|
+
"Transaction receipt:";
|
|
2072
|
+
_msg_info(
|
|
2073
|
+
_msg);
|
|
2074
|
+
_echo(
|
|
2075
|
+
_receipt);
|
|
2076
|
+
}
|
|
2077
|
+
_hash_type =
|
|
2078
|
+
typeof(
|
|
2079
|
+
_receipt.hash);
|
|
2080
|
+
if ( _hash_type !== "undefined" ) {
|
|
2081
|
+
_receipt_display(
|
|
2082
|
+
_receipt,
|
|
2083
|
+
_measure_unit);
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
else if ( _hash_type === "undefined" ) {
|
|
2087
|
+
_msg_error_transaction_failed(
|
|
2088
|
+
_attempt);
|
|
2089
|
+
_msg =
|
|
2090
|
+
"Transaction hash undefined.";
|
|
2091
|
+
_msg_error(
|
|
2092
|
+
_msg,
|
|
2093
|
+
0);
|
|
2094
|
+
throw _msg;
|
|
2095
|
+
}
|
|
2096
|
+
else {
|
|
2097
|
+
_msg_error_transaction_failed(
|
|
2098
|
+
_attempt);
|
|
2099
|
+
_msg =
|
|
2100
|
+
"Unknown transaction error.";
|
|
2101
|
+
_msg_error(
|
|
2102
|
+
_msg,
|
|
2103
|
+
0);
|
|
2104
|
+
throw _msg;
|
|
1762
2105
|
}
|
|
1763
|
-
_msg =
|
|
1764
|
-
`Transaction cost: '${_tx_cost}'.`;
|
|
1765
|
-
_msg_info(
|
|
1766
|
-
_msg);
|
|
1767
|
-
break;
|
|
1768
|
-
}
|
|
1769
|
-
else if ( _receipt.hash == undefined ) {
|
|
1770
|
-
_msg_error_transaction_failed(
|
|
1771
|
-
_attempt);
|
|
1772
|
-
_msg =
|
|
1773
|
-
"Transaction hash undefined.";
|
|
1774
|
-
throw _msg;
|
|
1775
|
-
}
|
|
1776
|
-
else {
|
|
1777
|
-
_msg_error_transaction_failed(
|
|
1778
|
-
_attempt);
|
|
1779
|
-
_msg =
|
|
1780
|
-
"Unknown transaction error.";
|
|
1781
|
-
throw _msg;
|
|
1782
2106
|
}
|
|
1783
2107
|
}
|
|
1784
|
-
|
|
2108
|
+
catch (
|
|
1785
2109
|
_error) {
|
|
2110
|
+
_msg =
|
|
2111
|
+
"Error processing receipt with value:";
|
|
2112
|
+
_msg_error(
|
|
2113
|
+
_msg,
|
|
2114
|
+
0);
|
|
2115
|
+
_echo2(
|
|
2116
|
+
_receipt);
|
|
2117
|
+
_echo2(
|
|
2118
|
+
_error);
|
|
2119
|
+
throw _error;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
catch (
|
|
2123
|
+
_error) {
|
|
1786
2124
|
_error_display(
|
|
1787
2125
|
_error);
|
|
1788
2126
|
_msg =
|
|
@@ -1795,7 +2133,7 @@ async function
|
|
|
1795
2133
|
_attempt + 1;
|
|
1796
2134
|
}
|
|
1797
2135
|
}
|
|
1798
|
-
if (
|
|
2136
|
+
if ( _retries_max < _attempt ) {
|
|
1799
2137
|
_msg =
|
|
1800
2138
|
"Maximum number of retries reached.";
|
|
1801
2139
|
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.87",
|
|
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": {
|
|
@@ -128,9 +128,9 @@
|
|
|
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.105",
|
|
132
132
|
"libevm":
|
|
133
|
-
"^0.0.
|
|
133
|
+
"^0.0.57",
|
|
134
134
|
"ws":
|
|
135
135
|
"^8.21.0",
|
|
136
136
|
"yargs":
|
|
@@ -142,11 +142,11 @@
|
|
|
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.105",
|
|
146
146
|
"evm-wallet.js":
|
|
147
|
-
"npm:evm-wallet.js@^0.0.
|
|
147
|
+
"npm:evm-wallet.js@^0.0.105",
|
|
148
148
|
"libevm":
|
|
149
|
-
"^0.0.
|
|
149
|
+
"^0.0.57"
|
|
150
150
|
},
|
|
151
151
|
"type":
|
|
152
152
|
"module",
|