MintTransfer method
The mintTransfer()
is a payable
method that allows users to buy newly minted TPAs. To use this method, you need to send plaquePrice * _names.length
amount of value
in Wei to this transaction as TPAs price.
function mintTransfer(bytes32[] _names, uint32[] _amounts, string _outputData) external payable
Input & Output
_names
: an array ofbytes32
representing the TPA names to be minted._amounts
: an array ofuint32
representing the amount of TPAs to be minted. The length of this array should be the same as the length of the_names
array, and all elements should be set to 1._outputData
: a string representing the output data to be sent to us. It should be a JSON-encoded object with either a "username" or a "name" property. Recording the username or TPA name in the output data and pinging someone is optional. However, it's worth noting that to ping a TPA, the TPA owner must have registered their username on the platform. Additionally, you cannot use both the "username" and "name" properties simultaneously.This function doesn't return anything, only a transaction hash to follow your transaction with.
Usage
To use this method, you can create a new instance of the StageMeta smart-contract and call the mintTransfer()
method, like this:
const options = {
value: ethers.utils.parseEther("0.06498719370006499"), // TPAs price
gasLimit: 500000,
};
const mintTransferResult = await stageMetaContract.mintTransfer(
[
ethers.utils.formatBytes32String("aaa-888"),
ethers.utils.formatBytes32String("aaa-999")
],
[1, 1],
JSON.stringify({
name: 'aaa-000', //or username: 'stagemeta'
}),
options
);
console.log("mintTransferResult:", mintTransferResult);
Last updated