-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for loose JSON-RPC providers (e.g. TestRPC) #45
Comments
Hey @padelagani! Which Provider are you using and would you mind providing the transaction hash? Looks like the provider is returning a weird value for the data. |
@ricmoo And calling following api for doing transaction provider.sendTransaction |
So, you are connecting to a local Ethereum node then? Are you using Parity or Geth? Can you provider a quick code snippet? Make sure you redact any private keys. You can also send the details to [email protected] if you'd prefer not publish it on a GitHub issue. |
/Users/ethers> ethers --testnet
testnet> p = new providers.InfuraProvider(true);
InfuraProvider {
ensAddress: '0x112234455c3a32fd11230c42e7bccd4a84e02010',
testnet: true,
chainId: 3,
_events: {},
resetEventsBlock: [Function],
url: 'https://ropsten.infura.io/',
apiAccessToken: null }
testnet> privateKey = [ redacted ];
testnet> wallet = new Wallet(privateKey, provider)
Wallet {
privateKey: [ redacted ],
provider: [Getter/Setter],
defaultGasLimit: [Getter/Setter],
address: '0x14791697260E4c9A71f18484C9f997B308e59325',
sign: [Function] }
testnet> tx = wallet.sign({ to: wallet.address, nonce: 5, value: 1, gasPrice: 100000000000, gasLimit: 21000 })
'0xf8640585174876e8008252089414791697260e4c9a71f18484c9f997b308e59325018029a0a5d15299f6b83c46b6dc3be4183e50aa22e71640fa0ca9b5adba9182df19496da03317e2d274dfa90947f3a57a0e5b8fbb3e56df427d2bdec39edfe0eb718d096b'
testnet> p.sendTransaction(tx)
Resolved:
'0x4572f3ec2d27b079d0108c6d2bc03fcf01625624f50e067e8f7c7267c032dfba'
testnet> txid = _
'0x4572f3ec2d27b079d0108c6d2bc03fcf01625624f50e067e8f7c7267c032dfba'
testnet> p.getTransaction(txid)
Resolved:
{ hash: '0x4572f3ec2d27b079d0108c6d2bc03fcf01625624f50e067e8f7c7267c032dfba',
blockHash: '0x8147b11bb51bdb2d22593bb16c4de6e0a4ce424e444fa3b0cd379bb5316c4d3f',
blockNumber: 1949760,
transactionIndex: 0,
from: '0x14791697260E4c9A71f18484C9f997B308e59325',
gasPrice: BigNumber { _bn: <BN: 174876e800> },
gasLimit: BigNumber { _bn: <BN: 5208> },
to: '0x14791697260E4c9A71f18484C9f997B308e59325',
value: BigNumber { _bn: <BN: 1> },
nonce: 5,
data: '0x',
r: '0xa5d15299f6b83c46b6dc3be4183e50aa22e71640fa0ca9b5adba9182df19496d',
s: '0x3317e2d274dfa90947f3a57a0e5b8fbb3e56df427d2bdec39edfe0eb718d096b',
v: 41,
creates: null,
raw: '0xf8640585174876e8008252089414791697260e4c9a71f18484c9f997b308e59325018029a0a5d15299f6b83c46b6dc3be4183e50aa22e71640fa0ca9b5adba9182df19496da03317e2d274dfa90947f3a57a0e5b8fbb3e56df427d2bdec39edfe0eb718d096b',
networkId: 3 } |
@ricmoo Following is the code snippet
|
Ah! I have a custom version of TestRPC in a package called The problem is that TestRPC isn't fully standards compliant. I will update the provider though to be more lenient with loose providers. I probably won't get to that until tomorrow afternoon though. |
I've reproduced the issue. TestRPC doesn't return the signature ( I will have ethers skip computing There is another issue with TestRPC I also just found; I will open an issue with them. The input is returned |
@ricmoo Thank you! So should I wait or try an alternative for this. If you can suggest an alternative to use. |
@ricmoo Can you suggest an alternative ? |
An alternative to TestRPC? I usually just use Ropsten or Rinkeby. If you are feeling experimental, try npm install -g ethers-cli. There are no docs yet, but you can try out: var build = require(“ethers-cli”);
var builder = new build.TestBuilder();
var accounts = builder.accounts;
var provider = builder.provider; The providers state is reset every time though, it doesn’t run persistent like the CLI of TestRPC. Otherwise, tomorrow afternoon (GMT-5) there should be a fixed version of the ethers Provider up. :) |
The test cases are running locally right now, then I will push and once the Travis CI tests have passed, I will publish to NPM. |
Added in e4c455b. |
Published to npm as ethers-providers 2.1.5. Updating ethers (the umbrella package) will get this latest version. Thanks! Let me know if there are any further issues. |
@ricmoo Thank you!!
|
Thanks. I’ll look into that tomorrow. Probably a similar issue for receipts... Re-opening to track. |
@ricmoo Any updates ?? |
I have completed the test cases and reproduced the issue and have a fix in place locally. There are a few differences since the hard-fork I’m adding some extra testing and updating the receipt parsing for. I should finish this tomorrow on the plane along with ABI v2. |
Ok, thanks |
This should be fixed now. In 8835225. Thanks! Please re-open this issue if you still have problems with 2.1.7. |
Edit: this was fixed updating to Ethers 3.0.15 @ricmoo Similarly, I'm getting the invalid hexlify value error when calling getTransactionReceipt() connected to a local node using Ganache (previously called TestRPC) Here's the full error log: |
While calling a function provider.getTransaction it throws an error invalid hexlify value.
Following transaction hash I got while creating transaction
Hash: 0x38796338be290d9733a362ae609bd507b9625a86b4262898c12715dcbaaf38c3
But while fetching transaction details gets the following error
The text was updated successfully, but these errors were encountered: