Replies: 2 comments 2 replies
-
I am moving this to the “Ideas” discussion. This is definitely not something that would go into v5. It might take a lot of refactoring and thinking through the edge cases in order to incorporate it directly into the Unterface object (I would probably change the human-readable signature to "selector 0x12345678(address) returns (uint)", for example to delineate it and does not require hashing). I think it would likely be a fairly easy third-party class to write though; the Fragment parser is fully exposed, you could use a regex to swap out the selector with the word “test” for example, process it as a normal Fragment (using Fragment.from) and then incorporate it using the _encodeParams and _decodeParams. The v6 fragment might already make this much easier since it internalizes the selector. And if the name property was accessed you could throw. I will mull over it more, but for now I would try out making a simple class that extends the Interface to see what gotchas there may be. |
Beta Was this translation helpful? Give feedback.
-
It'd be nice to be able to call such selector as well (if I only know the function's argument types). I assume there's no web3js equivalent to this either? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the Feature
Let's say I have an unverified contract with a bunch of sighash selector functions. I'd like to use
ethers.abi.Interface
instance or equivalent to build an interface for interacting with it in a generalized way (whether it's sighsahes or human-readable functions).I'd like to build a frontend generator that takes
Interface
-like objects, so it shouldn't care whether functions are the original human-readable versions or sighash selectors.Right now,
Interface
does not like this. Ideally,Interface
shouldn't care whether I give it a human-readable function or a selector. Bonus points ifInterface
knows not to re-sighash a selector.Perhaps there's a reason why
Interface
is incompatible with this, but I couldn't think of it. :)Code Example
Beta Was this translation helpful? Give feedback.
All reactions