Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const msgParams = [{
- type: 'string', name: 'Message', value: 'Hi, Alice!'
- },{ type: 'uint32', name: 'A number', value: '1337'
- }];
- let from = Merchant.accounts[0];
- console.log(window.provider);
- let p = window.provider;
- console.log(Object.keys(window.web3));
- window.web3.eth.sign(from, msgParams, function(err, res) {
- console.log(err);
- console.log(res);
- });
- web3.eth.getAccounts(function(a,b) {
- Merchant.accounts = b;
- // alert("Saving accounts" + Merchant.accounts);
- console.log("Merchant accounts: " + Merchant.accounts);
- let x = web3.eth.getBalance;
- console.log(x);
- });
- toChecksumAddress (address) {
- address = address.toLowerCase().replace('0x', '')
- var hash = createKeccakHash('keccak256').update(address).digest('hex')
- var ret = '0x'
- for (var i = 0; i < address.length; i++) {
- if (parseInt(hash[i], 16) >= 8) {
- ret += address[i].toUpperCase()
- } else {
- ret += address[i]
- }
- }
- return ret
- }
- reloadKeys() {
- const msgParams = [{
- type: 'string', name: 'Message', value: 'Hi, Alice!'
- },{ type: 'uint32', name: 'A number', value: '1337'
- }];
- // Merchant.accounts[0]
- // let addr = 0x2E290A50d3193753F156e5b0b12e4231Bd568526;
- let from = this.toChecksumAddress(Merchant.accounts[0]);
- // window.web3.utils.toChecksumAddress();
- console.log(typeof(from));
- console.log(from);
- console.log(Object.keys(window.web3));
- window.web3.eth.sign(from, msgParams, function(err, res) {
- console.log(err);
- console.log(res);
- });
- let from = web3.toChecksumAddress(Merchant.accounts[0]);
Add Comment
Please, Sign In to add comment