Get all contract functions
This will return a paginated list of all the functions that are available on the contract.
Get a specific contract function
Just get one function from the contract by collectionId and functionId.
Read a value from a contract function
Use this api to read a value from a contract function. Make sure to pass the correct arguments for the function.
Execute a contract function
By default, contract functions aren't configured to be manually executed. A function must be configured for manual execution before it can be the target of this endpoint. Issue a PATCH to the /functions/{function_id} endpoint and pass in "enabled": true
async function getContractFunctions(collectionId) {
try {
const headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Phosphor-Api-Key", phosphorApiKey);
return fetch(`${phosphorApiUrl}/v1/collections/${collectionId}/functions`, {
method: "GET",
headers,
});
} catch (error) {
console.log(error);
}
}