Web3 allows me to get the data of a contract function and then manually include it in a transaction. I need that functionality in ethers.js. Having problems finding it in the documentation.
I think what you are looking for is something like:
// function transfer(address to, uint256 amount)
let data = contract.interface.functions.transfer.encode([ toAddress, amount ]);
If you are only interested in the data, you can skip creating a Contract instance and just create an Interface object:
let abi = [
"function someFunc(address about, string what) returns (uint256)"
];
let iface = new ethers..utils.Interface(abi);
// This Description object has lots of useful things on it...
let someFunc = iface.functions.someFunc;
// Encode data (what you are looking for)
let encodedData = someFunc.encode([about, what]);
let resultData = await provider.call({ to: address, data: data });
// Parsing the result of calls
let result = someFunc.decode(resultData);
Hazzah! It works, thank you, you the man
Most helpful comment
I think what you are looking for is something like:
If you are only interested in the data, you can skip creating a Contract instance and just create an Interface object: