How to pass signature as string? #2387
-
I have function which initializes my contract which passes an array of string as the "setup parameters". I can convert most of the string supplied as params to the proper types (strings to bools, string to numbers etc.) But converting the signature passed as string to bytes so that I can use with ECDSA and confirm its validity has stumped me so far. Of course I can create a separate function just for passing the signature to the contract where the signature parameters is bytes and somehow the conversion is magically done for me by hardhat/ethers, but I would like there only to be a single initialization function for all of the setup params (in a string array) including the signature passed as a one of the strings. So how to convert a string to bytes array in a way that will be recognizable to ECDSA's recover function which expects 'signature` to be passed as bytes? If I try Like wise if I try The only way I could get the signature to verify properly was to build a separate parameter in my function Ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @grapevinegizmos, Is this a question about solidity? |
Beta Was this translation helpful? Give feedback.
-
I don't know to tell you the truth. All I know is that somehow if I provide a string argument in a call to a function with a bytes parameter it is magically transformed to a bytes value when it show up in the contract function. I assume that is hardhat which does that? Just trying to figure out if there is way to do that same
Magic after the param is passed.
…Sent from my iPhone
On Feb 15, 2022, at 1:20 PM, Patricio Palladino ***@***.***> wrote:
Hi @grapevinegizmos<https://github.com/grapevinegizmos>,
Is this a question about solidity?
—
Reply to this email directly, view it on GitHub<#2387 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACCIEBPA5FPCWZMO46CZTTTU3K7RNANCNFSM5OPPFXKQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
From your description what I get is that you need help with Solidity, not Hardhat. This isn't the right medium for that. You can try the |
Beta Was this translation helpful? Give feedback.
From your description what I get is that you need help with Solidity, not Hardhat. This isn't the right medium for that.
You can try the
#solidity
channel in our discord though.