提交 d2061c16 authored 作者: 崔大师's avatar 崔大师

bug fix

上级 3e95e8dd
...@@ -5,7 +5,7 @@ const Web3 = require('thinkium-web3js'); ...@@ -5,7 +5,7 @@ const Web3 = require('thinkium-web3js');
const fs = require('fs'); const fs = require('fs');
const web3 = new Web3(); const web3 = new Web3();
// const rpxUrl = "http://rpctest.chainopen.cn" // const rpxUrl = "http://rpctest.thinkium.org"
const rpxUrl = "http://rpcproxy.thinkium.org" const rpxUrl = "http://rpcproxy.thinkium.org"
const init = (mnemonic) => { const init = (mnemonic) => {
...@@ -62,7 +62,7 @@ const isIban = (THAddress) => { ...@@ -62,7 +62,7 @@ const isIban = (THAddress) => {
return web3.Iban.isValid(THAddress) return web3.Iban.isValid(THAddress)
} }
const toAddress = (THAddress) => { const toAddress = (THAddress) => {
return web3.Iban.toAddress(THAddress).toString() return web3.Iban.toAddress(THAddress).toString().toLowerCase()
} }
const isAddress = (address) => { const isAddress = (address) => {
return web3.isAddress(address).toString() return web3.isAddress(address).toString()
......
...@@ -17,7 +17,7 @@ const getPrivateKey = async (mnemonic,n) => { ...@@ -17,7 +17,7 @@ const getPrivateKey = async (mnemonic,n) => {
const address = utils.privateToAddress((privateKey)) const address = utils.privateToAddress((privateKey))
var account = web3.thk.GetAccount('1', '0x'+address.toString('hex')); var account = web3.thk.GetAccount('1', '0x'+address.toString('hex'));
var balance = account.balance; var balance = account.balance;
console.log("("+n+")"+"0x"+privateKey.toString('hex'),":","0x"+address.toString('hex'),"("+web3.fromWei(balance,'ether')+" ether)") console.log("("+n+")"+"0x"+privateKey.toString('hex'),":",web3.Iban.toIban(("0x"+address.toString('hex'))).toString(),"("+web3.fromWei(balance,'ether')+" ether)")
} }
for(var i=0;i<10;i++){ for(var i=0;i<10;i++){
getPrivateKey(mnemonic,i); getPrivateKey(mnemonic,i);
......
{ {
"mnemonic": "alley absorb wait alpha teach path pizza people home cloud announce kiwi", "mnemonic": "",
"contractAddress": "TH83SS304IEHHYPXZEQQAZS711AP2KS1CIM" "contractAddress": ""
} }
\ No newline at end of file
...@@ -125,14 +125,8 @@ const call = async(functionName, inputs, outputs) => { ...@@ -125,14 +125,8 @@ const call = async(functionName, inputs, outputs) => {
type: 'input', type: 'input',
name: inputs[i].name == "" ? inputs[i].desc : inputs[i].name, name: inputs[i].name == "" ? inputs[i].desc : inputs[i].name,
message: inputs[i].type + " " + inputs[i].desc + ':', message: inputs[i].type + " " + inputs[i].desc + ':',
validate: function (value) {
if (isAddress(value)) {
return true;
}
return '地址输入不正确';
},
filter: function (value) { filter: function (value) {
return isAddress(value) ? value : toAddress(value); return toAddress(value);
} }
} }
) )
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,12 +10,9 @@ ...@@ -10,12 +10,9 @@
"ethereum-hdwallet": "0.0.26", "ethereum-hdwallet": "0.0.26",
"ethereumjs-util": "^7.0.2", "ethereumjs-util": "^7.0.2",
"inquirer": "^7.2.0", "inquirer": "^7.2.0",
"thinkium-web3js": "^1.0.8", "thinkium-web3js": "^1.0.8"
"web3": "^1.2.9"
},
"devDependencies": {
"pkg": "^4.4.9"
}, },
"devDependencies": {},
"scripts": { "scripts": {
"pkg": "node --max_old_space_size=4096 ./node_modules/.bin/pkg -t package.json" "pkg": "node --max_old_space_size=4096 ./node_modules/.bin/pkg -t package.json"
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论