Uplink client
createToken
Create a new token in the channel. This function will revert if the caller does not fulfill any of the channel creatorLogic[]
rules.
Usage
Returns
{
tokenId: bigint,
event: Log
}
Parameters
channelAddress
- type:
string
The target channel address
const { tokenId, event } = await uplinkClient.createToken({
channelAddress: '0x1234567890123456789012345678901234567890',
...
})
uri
- type:
string
The metadata URI of the token
const { tokenId, event } = await uplinkClient.createToken({
uri: 'new token uri',
...
})
maxSupply
- type:
bigint
The maximum supply of the token
const { tokenId, event } = await uplinkClient.createToken({
maxSupply: 100n,
...
})
transactionOverrides (optional)
- type:
TransactionOverrides
type TransactionOverrides = {
accessList?: AccessList
gas?: bigint
maxFeePerGas?: bigint
maxPriorityFeePerGas?: bigint
nonce?: number
value?: bigint
}
Overrides for the transaction
const { tokenId, event } = await uplinkClient.createToken({
...
transactionOverrides: {
gas: 1000000n
}
})
Calldata
generate calldata for the transaction
const { address, data } = await uplinkClient.calldata.createToken({...})
Returns
{
address: string, // address of the target contract
data: string // calldata for the transaction
}
Gas Estimation
Estimate gas for the transaction
const gas = await uplinkClient.estimateGas.createToken({...})
Returns
bigint // gas estimate in wei