Open ababyprogrammer opened 5 months ago
ethers.js has a function called encodeFunctionDataand it encodes a function and it's arguments into bytes. This is helpful especially when working with proxies and low level delegate calls.
encodeFunctionData
Here is an example.
I'd think the API would look something like:
from web3 import Web3 Web3.encode_function_data("functionName(uint256 parameter1, uint256 parameter2...)", parameter1, parameter2...)
The function could look something like:
def encode_function_data(function_string: string, *parameters): return Web3.toHex(Web3.toHex(functionFragment)[0:4] + Web3.toHex([*parameters])
(I think).
Does contract.encodeABI work for your use case or would you rather have it on the Web3 class?
contract.encodeABI
ethers.js has a function called
encodeFunctionData
and it encodes a function and it's arguments into bytes. This is helpful especially when working with proxies and low level delegate calls.Here is an example.
I'd think the API would look something like:
The function could look something like:
(I think).