Simpler support for proxies and meta-transactions. #2580
Replies: 3 comments 1 reply
-
there is a way to do it, but it is not that easy to use: token.interface.encodeFunctionData('approve', [target, amount]) The problem comes with type-safety (when used in conjunction with typechain): try to make a mistake (in method name, or even parameter type), and the error becomes incomprehensible - the compiler can't match valid string param to array param, so the error references the LAST method (which is probably not "approve"), which makes the error almost useless. this is NOT a problem in typechain itself: it merely add types to ethers API. |
Beta Was this translation helpful? Give feedback.
-
A top-level For your purposes, what you would probably want to do is sub-class Signer, and use that with the contract. Then your Signer can automatically perform the required steps of populating the transaction and executing it. That is the design pattern the Signer was designed for, to abstract what calling/sending means so that meta-transaction and L2 access just has code that looks like any other. Once you have said Signer, it can just be used interchangeably with existing code, contracts, functions, etc. Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
I guess |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When using proxies (or meta-transactions), it is often needed to have the encoded function without calling it.
With ethers 5.x, the syntax is a bit cumbersome:
e.g.
it would be nice to have a top-level "encodeAbi" entry (which will also work without requiring "await"
e.g.
Beta Was this translation helpful? Give feedback.
All reactions