jsir 1.1.6 → 1.2.0

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/cmd/ooa.js CHANGED
@@ -108,14 +108,30 @@ const _mainCmdMap = {
108
108
  }
109
109
  }
110
110
 
111
+ function getFileOpenExe(fileName) {
112
+ fileName = trim(fileName);
113
+ let strs = fileName.split('.')
114
+ let suffix = ''
115
+ if (strs.length > 1) {
116
+ suffix = strs[strs.length - 1]
117
+ }
118
+ if (!suffix) {
119
+ return 'idea'
120
+ }
121
+
122
+ let exe = getConfig(`${suffix}_exe`)
123
+ return exe || 'idea';
124
+ }
125
+
111
126
  run(async () => {
112
127
  try {
113
128
  _fs.mkdirSync(_home)
114
129
  } catch (e) {}
115
130
 
116
131
  if (_args[0] === 'config') {
117
- let configFile = getLibDataDir() + '/config.json';
118
- e(`idea "${configFile}"`)
132
+ let fileName = 'config.json';
133
+ let configFile = getLibDataDir() + '/' + fileName;
134
+ e(`"${getFileOpenExe(fileName)}" "${configFile}"`)
119
135
  return
120
136
  }
121
137
 
@@ -204,7 +220,8 @@ async function fileLine(name) {
204
220
  }
205
221
  let tempDir = getLibDataDir() + "/ooa"
206
222
  mkdir(tempDir)
207
- let workFile = `${tempDir}/f ${toJsirFileName(name)}`;
223
+ let fileName = `f ${toJsirFileName(name)}`
224
+ let workFile = `${tempDir}/${fileName}`;
208
225
  if (!_fs.existsSync(workFile)) {
209
226
  _fs.writeFileSync(workFile, '');
210
227
  }
@@ -212,26 +229,24 @@ async function fileLine(name) {
212
229
  _fs.unlinkSync(workFile)
213
230
  await sleep(1000)
214
231
  _fs.writeFileSync(workFile, text)
215
- e(`idea "${workFile}"`)
232
+ e(`"${getFileOpenExe(fileName)}" "${workFile}"`)
216
233
  let watcher = _Chokidar.watch([workFile]);
217
234
 
218
235
  text = trim(text)
219
- let lines = getLines(text)
220
- let line = trim(lines[lines.length - 1])
236
+ let lines = getExeLines(text)
237
+ let line = trim(lines[0])
221
238
  watcher
222
239
  .on('change', async () => {
223
240
  let newText = trim(String(_fs.readFileSync(workFile)))
224
- let newLines = getLines(newText)
225
- let newLine = trim(newLines[newLines.length - 1])
241
+ let newLines = getExeLines(newText)
242
+ let newLine = trim(newLines[0])
226
243
 
227
244
  if (newLine
228
245
  && newLines.length >= lines.length
229
246
  && newLine !== line) {
230
247
  let exeStrs
231
248
  if (newLine.startsWith('/*')) {
232
- exeStrs = newLine.replace(/^\/\*|\*\/$/g, '').split('\n')
233
- .map(i => trim(trim(i).replace(/^\*/, '')))
234
- .filter(i => i)
249
+ exeStrs = newLine.split('\n').slice(1, -1).map(trim).filter(i => i)
235
250
  } else {
236
251
  exeStrs = ["#" + newLine]
237
252
  }
@@ -253,7 +268,7 @@ async function fileLine(name) {
253
268
  info("fileLine open " + workFile)
254
269
  }
255
270
 
256
- function getLines(text) {
271
+ function getExeLines(text) {
257
272
  let lines = []
258
273
  let nLine = []
259
274
  let cLine = []
@@ -277,6 +292,8 @@ function getLines(text) {
277
292
 
278
293
  if (!line.endsWith('*/')) {
279
294
  nLine.push(line)
295
+ } else {
296
+ lines.push("")
280
297
  }
281
298
  continue
282
299
  }
@@ -286,8 +303,7 @@ function getLines(text) {
286
303
  if (cLine.length > 0) {
287
304
  lines.push(cLine.join('\n'))
288
305
  }
289
-
290
- return lines.slice(1).reverse()
306
+ return lines.slice(1)
291
307
  }
292
308
 
293
309
  async function dealInitData() {
@@ -410,7 +426,8 @@ function dealSourceCmds() {
410
426
  }
411
427
 
412
428
  async function save(args) {
413
- let path = `${_home}/${toJsirFileName(args.join(' '))}`
429
+ let name = toJsirFileName(args.join(' '))
430
+ let path = `${_home}/${name}`
414
431
  if (_fs.existsSync(path)) {
415
432
  warn('already exist')
416
433
  return
@@ -433,8 +450,12 @@ console.log($args)`;
433
450
  resp = await getCbText();
434
451
  }
435
452
  _fs.writeFileSync(path, resp)
436
- e(`idea "${path}"`)
453
+ e(`"${getFileOpenExe(name)}" "${path}"`)
437
454
  info(`${path} created`)
455
+
456
+ if (name.split(/\s+/)[0] === 'i') {
457
+ await dealInitData();
458
+ }
438
459
  }
439
460
 
440
461
  function rename(old, _new) {
@@ -466,10 +487,18 @@ function hisToCmdMap() {
466
487
  _cmdMap = cmdMap
467
488
  }
468
489
 
469
- function listCmd() {
490
+ function listCmd(onlyRepo = false) {
491
+ let jsLibDir;
492
+ if (onlyRepo) {
493
+ jsLibDir = trim(getConfig("jsLibSource"))
494
+ if (!(jsLibDir && _fs.existsSync(jsLibDir))) {
495
+ jsLibDir = null;
496
+ warn('require config.jsLibSource')
497
+ }
498
+ }
470
499
  let newCmdMap = {}
471
500
  let items = Object.values(_cmdMap)
472
- .filter(i => _fs.existsSync(_home + "/" + i))
501
+ .filter(i => _fs.existsSync(_home + "/" + i) && (!jsLibDir || _fs.existsSync(jsLibDir + "/" + i)))
473
502
  .sort((a,b) => {
474
503
  return String(_types[a.split(/\s+/)[0]]) >= String(_types[b.split(/\s+/)[0]]) ? 1:-1
475
504
  })
@@ -650,8 +679,8 @@ async function wrapperInput(str) {
650
679
  if (_cmdMap[strs[0]]) {
651
680
  putHis(_cmdMap[strs[0]])
652
681
  let path = _home + '/' + _cmdMap[strs[0]]
653
- let fileName = trimJsirFileName(_cmdMap[strs[0]]);
654
- let firstName = trim(fileName).split(/\s+/)[0]
682
+ let fileName = trim(_cmdMap[strs[0]]);
683
+ let firstName = fileName.split(/\s+/)[0]
655
684
  if (firstName === 'f') {
656
685
  await fileLine(fileName.replace(/^\s*f\s*/, ''))
657
686
  } else if (firstName !== 'e') {
@@ -731,6 +760,9 @@ async function dealKeyword(str, strs, fstr, ostr) {
731
760
  newName = toJsirFileName(newName)
732
761
  if (rename(_home + '/' + name, _home + '/' + newName)) {
733
762
  info(`${_home + '/' + newName} renamed`)
763
+ if (newName.split(/\s+/)[0] === 'i') {
764
+ await dealInitData()
765
+ }
734
766
  }
735
767
  let jsLibDir = trim(getConfig("jsLibSource"))
736
768
  if (jsLibDir && _fs.existsSync(jsLibDir)) {
@@ -775,6 +807,9 @@ async function dealKeyword(str, strs, fstr, ostr) {
775
807
  }
776
808
  }
777
809
  info(`${name} pulled`)
810
+ if (name.split(/\s+/)[0] === 'i') {
811
+ await dealInitData()
812
+ }
778
813
  } else {
779
814
  warn('require config.jsLibSource')
780
815
  }
@@ -790,6 +825,9 @@ async function dealKeyword(str, strs, fstr, ostr) {
790
825
  mkdir(cmdsDir)
791
826
  _fs.writeFileSync(cmdsDir + "/" + name, String(_fs.readFileSync(_home + '/' + name)))
792
827
  info(`${name} pushed`)
828
+ if (name.split(/\s+/)[0] === 'i') {
829
+ await dealInitData()
830
+ }
793
831
  } else {
794
832
  warn('require config.jsLibSource')
795
833
  }
@@ -800,7 +838,7 @@ async function dealKeyword(str, strs, fstr, ostr) {
800
838
  warn("no items")
801
839
  } else {
802
840
  let path = _home + '/' + name
803
- e(`idea "${path}"`)
841
+ e(`"${getFileOpenExe(name)}" "${path}"`)
804
842
  }
805
843
  } else if (/^c\d*$/.test(fstr)) {
806
844
  let name = _cmdMap[trim(fstr.replace(/^c/, ''))]
@@ -826,6 +864,8 @@ async function dealKeyword(str, strs, fstr, ostr) {
826
864
  listCmd()
827
865
  } else if (fstr === 'f') {
828
866
  await fileLine(trim(ostr.join(' ')))
867
+ } else if (fstr === '%') {
868
+ listCmd(true)
829
869
  } else {
830
870
  await save(strs)
831
871
  }
@@ -836,16 +876,16 @@ function getComments(text, cols = [], col) {
836
876
  text = trim(text)
837
877
  if (text.startsWith("/*")) {
838
878
  for (let line of text.split("\n")) {
839
- let aLine = line
840
- .replace(/^\s*\/\*/, '')
841
- .replace(/\*\/\s*/, '')
842
- .replace(/^\s*\*/, '')
843
- if (trim(aLine)) {
844
- docLines.push(aLine)
879
+ let trimLine = trim(line)
880
+ if (trimLine.startsWith("/*")) {
881
+ continue
845
882
  }
846
- if (trim(line).endsWith("*/")) {
883
+ if (trimLine.endsWith("*/")) {
847
884
  break
848
885
  }
886
+ if (trimLine) {
887
+ docLines.push(line)
888
+ }
849
889
  }
850
890
  }
851
891
  let argDef = getArgDef(text)
@@ -907,8 +947,7 @@ function filterCmd(args){
907
947
  if (!isJsirFileName(file)) {
908
948
  continue
909
949
  }
910
- let fileName = trimJsirFileName(file)
911
- isArgsMatch(fileName, args, () => {
950
+ isArgsMatch(file, args, () => {
912
951
  if (Object.values(cmdMap).indexOf(file) === -1) {
913
952
  cmdMap[i] = file
914
953
  i ++
package/ethWeb.js CHANGED
@@ -64,10 +64,10 @@ async function _ethBatchQuery(calls = [], web3) {
64
64
  return await Promise.all(pros);
65
65
  }
66
66
 
67
- async function ethBatchQuery(calls = [], web3, batchNum = 49, asyncNum = 33) {
67
+ async function ethBatchQuery(calls = [], web3, batchNum = 49, asyncNum = 33, useWebReq = false) {
68
68
  web3 = web3 || global.web3;
69
69
  let chainId = global.chainId || await web3.eth.getChainId()
70
- if (batchCallAddressMap[chainId]) {
70
+ if (batchCallAddressMap[chainId] && !useWebReq) {
71
71
  return await ethBatchQuery_(calls, web3, batchNum, asyncNum)
72
72
  } else {
73
73
  let transResult = result => {
@@ -113,7 +113,7 @@ async function ethBatchQuery(calls = [], web3, batchNum = 49, asyncNum = 33) {
113
113
  }
114
114
  }
115
115
 
116
- async function ethBatchQuery_(calls = [], web3, batchNum = 49, asyncNum = 33) {
116
+ async function ethBatchQuery_(calls = [], web3, batchNum, asyncNum) {
117
117
  if (calls.length <= 0) {
118
118
  return []
119
119
  }
@@ -187,9 +187,24 @@ async function initSender(web3, wallet, froms, resetNum) {
187
187
  senderNonce[aIndex] = Number(await web3.eth.getTransactionCount(walletGet(wallet, aIndex).address)) -1
188
188
  }
189
189
 
190
- let sender = (txObject) => {
190
+ let sender = async (txObject) => {
191
191
  let aIndex = froms[randomInt(froms.length) - 1]
192
192
  let adInfo = walletGet(wallet, aIndex)
193
+
194
+ if (!(txObject.gasLimit || txObject.gas)) {
195
+ try {
196
+ let gas = await web3.eth.estimateGas({
197
+ from: adInfo.address,
198
+ to: txObject.to,
199
+ value: txObject.value,
200
+ data: txObject.data
201
+ })
202
+ txObject.gasLimit = gas + 10000;
203
+ } catch (e) {
204
+ return [Promise.reject(e), {}, aIndex]
205
+ }
206
+ }
207
+
193
208
  if (senderBlock[aIndex]) {
194
209
  return []
195
210
  }
@@ -243,6 +258,21 @@ async function initSenderWithKeys(web3, privateKeys, resetNum) {
243
258
  let sender = async (txObject) => {
244
259
  let key = privateKeys[randomInt(privateKeys.length) - 1]
245
260
  let adds = keyMap[key]
261
+
262
+ if (!(txObject.gasLimit || txObject.gas)) {
263
+ try {
264
+ let gas = await web3.eth.estimateGas({
265
+ from: adds,
266
+ to: txObject.to,
267
+ value: txObject.value,
268
+ data: txObject.data
269
+ })
270
+ txObject.gasLimit = gas + 10000;
271
+ } catch (e) {
272
+ return [Promise.reject(e), {}, adds]
273
+ }
274
+ }
275
+
246
276
  if (senderBlock[adds]) {
247
277
  return []
248
278
  }
@@ -288,7 +318,7 @@ function txnSign(txObject, privateKey) {
288
318
  let params = {
289
319
  nonce: web3.utils.toHex(txObject.nonce),
290
320
  gasPrice: web3.utils.toHex(txObject.gasPrice),
291
- gasLimit: web3.utils.toHex(txObject.gasLimit),
321
+ gasLimit: web3.utils.toHex(txObject.gasLimit || txObject.gas),
292
322
  to: txObject.to,
293
323
  value: web3.utils.toHex(txObject.value),
294
324
  data: txObject.data
@@ -485,7 +515,7 @@ function getPairAmtNoFee(a, b, baseAmt) {
485
515
  }
486
516
 
487
517
  let tokenMapLoaded = {}
488
- async function getTokenMap(tokens, web3) {
518
+ async function getTokenMap(tokens, web3, batchNum, asyncNum) {
489
519
  web3 = web3 || global.web3;
490
520
  let chainId = global.chainId || await web3.getChainId()
491
521
  if (!tokenMapCache[chainId]) {
@@ -524,7 +554,7 @@ async function getTokenMap(tokens, web3) {
524
554
  name: 'decimals'
525
555
  })
526
556
  }
527
- let results = await ethBatchQuery(calls, web3, 99)
557
+ let results = await ethBatchQuery(calls, web3, batchNum, asyncNum)
528
558
  for(let i = 0; i<results.length; i+=3) {
529
559
  let token = calls[i].address
530
560
  try {
@@ -785,7 +815,7 @@ async function ethWrite(sender, address, {data, abi, method, args, gasPrice, gas
785
815
  let avgGasPrice = await cacheFn('getGasPrice', async () => await web3.eth.getGasPrice(), 1000 * 5)
786
816
  let txObject = {
787
817
  gasPrice: gasPrice ? gasPrice * 1000000000 : avgGasPrice,
788
- gasLimit: gasLimit || 1500000,
818
+ gasLimit: gasLimit,
789
819
  to: address,
790
820
  value
791
821
  }
@@ -804,16 +834,19 @@ async function ethWrite(sender, address, {data, abi, method, args, gasPrice, gas
804
834
  console.log("No address to used")
805
835
  return {}
806
836
  }
807
- console.log(`${msg} send ${signedTx.hash} ${txObject.gasPrice/1000000000}g`)
837
+ msg = trim(msg)
838
+ msg = msg ? msg + ' ':''
839
+ console.log(`${msg}send ${signedTx.hash} ${txObject.gasPrice/1000000000}g`)
808
840
  result = result.then(resp => {
809
- console.log('\x1B[32m%s\x1B[39m', `${msg} ${signedTx.hash} 交易成功`)
841
+ console.log('\x1B[32m%s\x1B[39m', `${msg}${signedTx.hash} 交易成功`)
810
842
  return true
811
843
  }).catch(async e => {
812
- console.log('\x1B[35m%s\x1B[39m', `${msg} ${signedTx.hash} 交易失败`)
844
+ console.log('\x1B[35m%s\x1B[39m', `${msg}${signedTx.hash} 交易失败`)
813
845
  if (onError) {
814
846
  return await onError(e)
815
847
  } else {
816
848
  console.error(e.toString().split("\n")[0])
849
+ $log(new Error(e.stack).stack);
817
850
  return false
818
851
  }
819
852
  })
@@ -991,7 +1024,7 @@ async function batchTranfer(ethTranserWrite, token, froms, tos, min, max) {
991
1024
  for(let from of froms) {
992
1025
  let sender = await newSender(from)
993
1026
  for(let to of tos) {
994
- let fromAddress = String(to).startsWith('0x') ? to:global.$wallet.getAddress(from);
1027
+ let fromAddress = String(from).startsWith('0x') ? from:global.$wallet.getAddress(from);
995
1028
  let toAddress = String(to).startsWith('0x') ? to:global.$wallet.getAddress(to);
996
1029
 
997
1030
  if (token) {
@@ -1001,10 +1034,10 @@ async function batchTranfer(ethTranserWrite, token, froms, tos, min, max) {
1001
1034
  if (Number(tb) >= min) {
1002
1035
  continue
1003
1036
  }
1004
- if (Number(fb) < max) {
1037
+ let transferAmt = bMin(max, tb)
1038
+ if (Number(fb) < Number(transferAmt)) {
1005
1039
  continue
1006
1040
  }
1007
- let transferAmt = bMin(max, tb)
1008
1041
  let fmtTransferAmt = exDcmNum(transferAmt, -decimals).toString()
1009
1042
  pros.push(ethTranserWrite(sender, token, {
1010
1043
  abi: erc20Abi,
@@ -1019,10 +1052,10 @@ async function batchTranfer(ethTranserWrite, token, froms, tos, min, max) {
1019
1052
  if (Number(tb) >= min) {
1020
1053
  continue
1021
1054
  }
1022
- if (Number(fb) < max) {
1055
+ let transferAmt = bMin(max, tb)
1056
+ if (Number(fb) < Number(transferAmt)) {
1023
1057
  continue
1024
1058
  }
1025
- let transferAmt = bMin(max, tb)
1026
1059
  let fmtTransferAmt = exDcmNum(transferAmt, -decimals).toString()
1027
1060
  pros.push(ethTranserWrite(sender, toAddress, {
1028
1061
  value: transferAmt,
@@ -1048,7 +1081,7 @@ async function batchCollect(ethTranserWrite, token, froms, to, remain) {
1048
1081
  for(let from of froms) {
1049
1082
  let sender = await newSender(from)
1050
1083
 
1051
- let fromAddress = String(from).startsWith('0x') ? to:global.$wallet.getAddress(from);
1084
+ let fromAddress = String(from).startsWith('0x') ? from:global.$wallet.getAddress(from);
1052
1085
  let toAddress = String(to).startsWith('0x') ? to:global.$wallet.getAddress(to);
1053
1086
 
1054
1087
  if (token) {
@@ -1104,26 +1137,6 @@ async function getContractJson(address) {
1104
1137
  return JSON.parse(String(fs.readFileSync(obj[address]['abiPath'])))
1105
1138
  }
1106
1139
  }
1107
-
1108
- const agent = new https.Agent({
1109
- rejectUnauthorized: false
1110
- });
1111
- let home = getLibDataDir() + '/abi'
1112
- mkdir(home)
1113
- let file = `${home}/${address}`
1114
- if (fs.existsSync(file)) {
1115
- let str = String(fs.readFileSync(file))
1116
- let strs = str.split('\n').map(item => trim(item)).filter(item => item)
1117
- return {abi: JSON.parse(strs[1])}
1118
- }
1119
- return got(`https://api-cn.etherscan.com/api?module=contract&action=getabi&address=${address}`,
1120
- { httpsAgent: agent }).then(resp => {
1121
- if (resp.data.status !== '1') {
1122
- return ''
1123
- }
1124
- fs.writeFileSync(file, `${Date.now()}\n${resp.data.result}`)
1125
- return {abi: JSON.parse(resp.data.result)}
1126
- })
1127
1140
  }
1128
1141
 
1129
1142
  async function transferToken(ethTranserWrite, sender, address, token, amt, msg) {
@@ -1229,5 +1242,6 @@ module.exports = {
1229
1242
  getTokenBal,
1230
1243
  transferToken,
1231
1244
  tokenApprove,
1232
- txnInputReplacer
1245
+ txnInputReplacer,
1246
+ abiDecoder
1233
1247
  }
package/index.js CHANGED
@@ -129,7 +129,8 @@ const {
129
129
  getTokenBal,
130
130
  transferToken,
131
131
  tokenApprove,
132
- txnInputReplacer
132
+ txnInputReplacer,
133
+ abiDecoder
133
134
  } = require('./ethWeb')
134
135
 
135
136
  module.exports = {
@@ -259,5 +260,6 @@ module.exports = {
259
260
  warn,
260
261
  error,
261
262
  txnInputReplacer,
262
- parseSteps
263
+ parseSteps,
264
+ abiDecoder
263
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsir",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,8 +27,8 @@
27
27
  "author": "",
28
28
  "license": "ISC",
29
29
  "dependencies": {
30
- "@ethersproject/abi": "latest",
31
- "abi-decoder": "^2.3.0",
30
+ "@ethersproject/abi": "^5.5.0",
31
+ "abi-decoder": "^2.4.0",
32
32
  "address": "^1.1.2",
33
33
  "axios": "^0.20.0",
34
34
  "bignumber.js": "^9.0.0",
@@ -36,16 +36,16 @@
36
36
  "console.table": "^0.10.0",
37
37
  "dayjs": "^1.10.4",
38
38
  "ethereumjs-tx": "^1.3.7",
39
- "ethereumjs-util": "latest",
39
+ "ethereumjs-util": "^7.1.3",
40
40
  "ethers": "^5.1.0",
41
41
  "global-dirs": "^3.0.0",
42
- "keccak": "latest",
42
+ "keccak": "^3.0.2",
43
43
  "md5": "^2.3.0",
44
44
  "pad": "^3.2.0",
45
45
  "randomhex": "^0.1.5",
46
46
  "server": "^1.0.30",
47
47
  "urlencode": "^1.1.0",
48
- "web3": "^1.3.0",
49
- "web3-eth-contract": "latest"
48
+ "web3": "^1.6.1",
49
+ "web3-eth-contract": "^1.6.1"
50
50
  }
51
51
  }
package/sol.js CHANGED
@@ -107,13 +107,13 @@ async function exeMethods(web3, deployInfo, sol, method, text) {
107
107
  deployInfo.address);
108
108
  text = text + '\n' + fs.readFileSync(deployInfo.abiPath.replace('.json', '.sol').replace('/bin', ''))
109
109
 
110
- let args = reget(text, new RegExp(`@${method}.args[ :=]+(.*)`))
111
- let sendArgs = reget(text, new RegExp(`@${method}.send.args[ :=]+(.*)`))
112
- let callArgs = reget(text, new RegExp(`@${method}.call.args[ :=]+(.*)`))
113
- let value = reget(text, new RegExp(`@${method}.value[ :=]+(.*)`));
114
- let gas = reget(text, new RegExp(`@${method}.gas[ :=]+(.*)`));
115
- let from = reget(text, new RegExp(`@${method}.from[ :=]+(.*)`));
116
- let expect = reget(text, new RegExp(`@${method}.expect[ :=]+(.*)`));
110
+ let args = reget(text, new RegExp(`@${method}\.args[ :=]+(.*)`))
111
+ let sendArgs = reget(text, new RegExp(`@${method}(\.send)`))
112
+ let callArgs = reget(text, new RegExp(`@${method}(\.call)`))
113
+ let value = reget(text, new RegExp(`@${method}\.value[ :=]+(.*)`));
114
+ let gas = reget(text, new RegExp(`@${method}\.gas[ :=]+(.*)`));
115
+ let from = reget(text, new RegExp(`@${method}\.from[ :=]+(.*)`));
116
+ let expect = reget(text, new RegExp(`@${method}\.expect[ :=]+(.*)`));
117
117
  let action = 'call';
118
118
 
119
119
  let fnStr = reget(text, new RegExp(`\\s+(function\\s+${method}\\s*\\([\\s\\S]*?)\\{`));
@@ -121,11 +121,9 @@ async function exeMethods(web3, deployInfo, sol, method, text) {
121
121
  action = 'send'
122
122
  }
123
123
  if (callArgs) {
124
- args = callArgs;
125
124
  action = 'call'
126
125
  }
127
126
  if (sendArgs) {
128
- args = sendArgs;
129
127
  action = 'send'
130
128
  }
131
129
 
package/util.js CHANGED
@@ -811,8 +811,27 @@ function parseSteps(str) {
811
811
  let result = []
812
812
  for (let item of items) {
813
813
  let ss = item.split('-').map(trim).filter(i => i)
814
+ let _len = result.length
815
+ let numReg = /^\d+$/
816
+ if (ss[0] && !numReg.test(ss[0])) {
817
+ result.push(ss[0]);
818
+ }
819
+ if (ss[1] && !numReg.test(ss[1])) {
820
+ result.push(ss[1]);
821
+ }
822
+ if (ss[2] && !numReg.test(ss[2])) {
823
+ result.push(ss[2]);
824
+ }
825
+ if (result.length > _len) {
826
+ continue
827
+ }
828
+
814
829
  if (ss.length > 1) {
815
- result.push(...range(Number(ss[0]), Number(ss[1])))
830
+ if (Number(ss[0]) > Number(ss[1])) {
831
+ result.push(...range(Number(ss[1]), Number(ss[0]), ss[2] ? Number(ss[2]):null))
832
+ } else {
833
+ result.push(...range(Number(ss[0]), Number(ss[1]), ss[2] ? Number(ss[2]):null))
834
+ }
816
835
  } else {
817
836
  result.push(Number(ss[0]))
818
837
  }