Writing your own extensions
You can create your own extensions. They are just regular functions that pre-define the behavior of a prepareContractCall()
or readContract()
function.
The goal of extensions is to add a layer of convenience to direct contract calls, either to simplify the inputs or to give richer outputs.
Example: Creating the getBalance
extension for ERC20 tokens
The erc20/getBalance
extension is a very convenient and efficient way to fetch all the information needed to display an ERC20 token balance to a user, a very common usecase for applications. Here is how it is implemented in the SDK.
Example: Creating the mintTo
extension for ERC721 tokens
The erc721/mintTo
extension handles uploading the NFT metadata to IPFS before minting. Here is how it is implemented in the SDK.