From 12548b5abfffaf3971efcdbcab56823882470713 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Oct 2022 17:10:31 +0200 Subject: [PATCH] fix: skip json abi formatting (#1777) --- .../ethers-contract-abigen/src/contract/common.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ethers-contract/ethers-contract-abigen/src/contract/common.rs b/ethers-contract/ethers-contract-abigen/src/contract/common.rs index 41b7b668..bd9e1bfe 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/common.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/common.rs @@ -99,11 +99,16 @@ pub(crate) fn struct_declaration(cx: &Context) -> TokenStream { let abi_parse = if !cx.human_readable { 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")); } } else { 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) .expect("invalid abi")); }