When I have a object of type ContractAbstraction<ContractProvider>
, I can get a key/value map of all the endpoints in the deployed contract like this:
const contract: ContractAbstraction<ContractProvider> = client.contract.at(this.state.contractAddress);
const methods = contract.methods;
where client
has type TezosToolkit
and handles the RPC interaction with a node.
And I can get a list of method (smart contract function) names like this
function getObjectMethodNames(obj: any): string[] {
if (!obj) {
return [];
}
return Object.getOwnPropertyNames(obj)
.filter((p) => typeof obj[p] === 'function')
.map((name) => name.toLowerCase());
}
const methodNames: string[] = getObjectMethodNames(contract.methods);
But how do I get information about how many arguments each function takes and what type the arguments have? Is that possible using Taquito?
I can see from the block explorer Better Call Dev that this should be possible since they show not only a list of functions for a smart contract but also each function's signature.