feat(abigen): descriptive deserialization errors (#1633)
* feat(abigen): descriptive deserialization errors * update changelog * map_err -> wrap_err
This commit is contained in:
parent
ff66008cbe
commit
b1124441ec
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
### Unreleased
|
### Unreleased
|
||||||
|
|
||||||
- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523)
|
- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523)
|
||||||
- Added `get_erc1155_token_transfer_events` function for etherscan client [#1503](https://github.com/gakonst/ethers-rs/pull/1503)
|
- Added `get_erc1155_token_transfer_events` function for etherscan client [#1503](https://github.com/gakonst/ethers-rs/pull/1503)
|
||||||
- Add support for Geth `debug_traceTransaction` [#1469](https://github.com/gakonst/ethers-rs/pull/1469)
|
- Add support for Geth `debug_traceTransaction` [#1469](https://github.com/gakonst/ethers-rs/pull/1469)
|
||||||
- Use correct, new transaction type for `typool_content` RPC endpoint [#1501](https://github.com/gakonst/ethers-rs/pull/1501)
|
- Use correct, new transaction type for `typool_content` RPC endpoint [#1501](https://github.com/gakonst/ethers-rs/pull/1501)
|
||||||
|
@ -104,6 +104,8 @@
|
||||||
`my_contract` rather than `mycontract_mod`.
|
`my_contract` rather than `mycontract_mod`.
|
||||||
- The `Cargo.toml` generated by bindings now includes the `abigen` feature on
|
- The `Cargo.toml` generated by bindings now includes the `abigen` feature on
|
||||||
ethers. [#1508](https://github.com/gakonst/ethers-rs/pull/1508)
|
ethers. [#1508](https://github.com/gakonst/ethers-rs/pull/1508)
|
||||||
|
- More descriptive contract deserialization errors.
|
||||||
|
[#1633](https://github.com/gakonst/ethers-rs/pull/1633)
|
||||||
|
|
||||||
### 0.6.0
|
### 0.6.0
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,9 @@ impl Context {
|
||||||
// holds the bytecode parsed from the abi_str, if present
|
// holds the bytecode parsed from the abi_str, if present
|
||||||
let mut contract_bytecode = None;
|
let mut contract_bytecode = None;
|
||||||
|
|
||||||
let (abi, human_readable, abi_parser) = parse_abi(&abi_str)?;
|
let (abi, human_readable, abi_parser) = parse_abi(&abi_str).wrap_err_with(|| {
|
||||||
|
eyre::eyre!("error parsing abi for contract: {}", args.contract_name)
|
||||||
|
})?;
|
||||||
|
|
||||||
// try to extract all the solidity structs from the normal JSON ABI
|
// try to extract all the solidity structs from the normal JSON ABI
|
||||||
// we need to parse the json abi again because we need the internalType fields which are
|
// we need to parse the json abi again because we need the internalType fields which are
|
||||||
|
@ -351,7 +353,8 @@ fn parse_abi(abi_str: &str) -> Result<(Abi, bool, AbiParser)> {
|
||||||
(abi, true, abi_parser)
|
(abi, true, abi_parser)
|
||||||
} else {
|
} else {
|
||||||
// a best-effort coercion of an ABI or an artifact JSON into an artifact JSON.
|
// a best-effort coercion of an ABI or an artifact JSON into an artifact JSON.
|
||||||
let contract: JsonContract = serde_json::from_str(abi_str)?;
|
let contract: JsonContract = serde_json::from_str(abi_str)
|
||||||
|
.wrap_err_with(|| eyre::eyre!("failed deserializing abi:\n{}", abi_str))?;
|
||||||
|
|
||||||
(contract.into_abi(), false, abi_parser)
|
(contract.into_abi(), false, abi_parser)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue