fix: skip json abi formatting (#1777)

This commit is contained in:
Matthias Seitz 2022-10-11 17:10:31 +02:00 committed by GitHub
parent 123e2def9d
commit 12548b5abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -99,11 +99,16 @@ pub(crate) fn struct_declaration(cx: &Context) -> TokenStream {
let abi_parse = if !cx.human_readable { let abi_parse = if !cx.human_readable {
quote! { quote! {
pub static #abi_name: #ethers_contract::Lazy<#ethers_core::abi::Abi> = #ethers_contract::Lazy::new(|| #ethers_core::utils::__serde_json::from_str(#abi) #[rustfmt::skip]
const __ABI: &str = #abi;
/// The parsed JSON-ABI of the contract.
pub static #abi_name: #ethers_contract::Lazy<#ethers_core::abi::Abi> = #ethers_contract::Lazy::new(|| #ethers_core::utils::__serde_json::from_str(__ABI)
.expect("invalid abi")); .expect("invalid abi"));
} }
} else { } else {
quote! { quote! {
/// The parsed human readable ABI of the contract.
pub static #abi_name: #ethers_contract::Lazy<#ethers_core::abi::Abi> = #ethers_contract::Lazy::new(|| #ethers_core::abi::parse_abi_str(#abi) pub static #abi_name: #ethers_contract::Lazy<#ethers_core::abi::Abi> = #ethers_contract::Lazy::new(|| #ethers_core::abi::parse_abi_str(#abi)
.expect("invalid abi")); .expect("invalid abi"));
} }