From 556821f0778a8bd9596cc35e2f9a2dabb80e4f77 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 6 Dec 2022 07:05:24 +0100 Subject: [PATCH] chore: generate selector as hex in docs (#1924) --- .../ethers-contract-abigen/src/contract/errors.rs | 4 ++-- .../ethers-contract-abigen/src/contract/methods.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ethers-contract/ethers-contract-abigen/src/contract/errors.rs b/ethers-contract/ethers-contract-abigen/src/contract/errors.rs index fa3384d2..e8c3d3fb 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/errors.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/errors.rs @@ -60,10 +60,10 @@ impl Context { }; let doc = format!( - "Custom Error type `{}` with signature `{}` and selector `{:?}`", + "Custom Error type `{}` with signature `{}` and selector `0x{}`", error.name, abi_signature, - error.selector() + hex::encode(&error.selector()[..]) ); let abi_signature_doc = util::expand_doc(&doc); let ethers_contract = ethers_contract_crate(); diff --git a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs index 57e16d19..6fc6bb56 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs @@ -125,10 +125,10 @@ impl Context { let function_name = &function.name; let abi_signature = function.abi_signature(); let doc = format!( - "Container type for all input parameters for the `{}` function with signature `{}` and selector `{:?}`", + "Container type for all input parameters for the `{}` function with signature `{}` and selector `0x{}`", function.name, abi_signature, - function.selector() + hex::encode(&function.selector()[..]) ); let abi_signature_doc = util::expand_doc(&doc); let ethers_contract = ethers_contract_crate(); @@ -177,10 +177,10 @@ impl Context { }; let abi_signature = function.abi_signature(); let doc = format!( - "Container type for all return fields from the `{}` function with signature `{}` and selector `{:?}`", + "Container type for all return fields from the `{}` function with signature `{}` and selector `0x{}`", function.name, abi_signature, - function.selector() + hex::encode(&function.selector()[..]) ); let abi_signature_doc = util::expand_doc(&doc); let ethers_contract = ethers_contract_crate();