Closed relaxbao closed 4 years ago
Hi,i had searched and tried for a long time , i really really want get help.
i want to call my contract with my local account or privatekey, is there some fuction i can use to do this ?
for example :
pragma solidity ^0.4.4; contract SimpleStorage { uint storedData; function set(uint x) public returns (address){ storedData = x; return msg.sender; } function get() public view returns (uint) { return storedData; } }
i can get call the methods this way
DidReg = new EthContract(provider)(abi) registry = DidReg.at(registryAddress) const hash = registry.set(10)
but in this way , the msg.sender is the eth.account[0], i want to use my local account.
msg.sender
eth.account[0]
i tried the addWallet ,but it doesn't work
web3.eth.accounts.wallet.add(account)
so Can i use the privatekey to call the methods of the contract with ethjs-contract?
ethjs-contract
Issue Type
Description
Hi,i had searched and tried for a long time , i really really want get help.
i want to call my contract with my local account or privatekey, is there some fuction i can use to do this ?
for example :
i can get call the methods this way
but in this way , the
msg.sender
is theeth.account[0]
, i want to use my local account.i tried the addWallet ,but it doesn't work
so Can i use the privatekey to call the methods of the contract with ethjs-contract?