This function will revert under the following conditions:

  • The channel does not allow ERC20 minting.
  • The caller does not fulfill any of the channel minterLogic[] rules.
  • The caller does not have the required ERC20 balance to mint the tokens.
  • The caller has not approved the channel to spend the required ERC20 balance.

Usage

Returns

{ 
  event: Log 
}

Parameters

channelAddress

  • type: string

The target channel address

const { event } = await uplinkClient.mintTokenBatchWithERC20({
  channelAddress: '0x1234567890123456789012345678901234567890',
  ...
})

to

  • type: string

The recipient of the minted tokens

const { event } = await uplinkClient.mintTokenBatchWithERC20
({
  to: '0x1234567890123456789012345678901234567890',
  ...
})

tokenIds

  • type: bigint[]

The token IDs to mint

const { event } = await uplinkClient.mintTokenBatchWithERC20({
  tokenIds: [1n, 2n, 3n],
  ...
})

amounts

  • type: bigint[]

The amounts of each token to mint

const { event } = await uplinkClient.mintTokenBatchWithERC20({
  amounts: [1n, 1n, 1n],
  ...
})

mintReferral (optional)

  • type: string

The referral address for the mint

const { event } = await uplinkClient.mintTokenBatchWithERC20({
  mintReferral: '0x1234567890123456789012345678901234567890',
  ...
})

data (optional)

  • type: string

Additional data for the mint

const { event } = await uplinkClient.mintTokenBatchWithERC20
({
  data: '0x00...',
  ...
})

transactionOverrides (optional)

  • type: TransactionOverrides
type TransactionOverrides = {
  accessList?: AccessList
  gas?: bigint
  maxFeePerGas?: bigint
  maxPriorityFeePerGas?: bigint
  nonce?: number
  value?: bigint
}

Overrides for the transaction

const { event } = await uplinkClient.mintTokenBatchWithERC20({
    ...
    transactionOverrides: {
        gas: 1000000nn
    }
})

Calldata

generate calldata for the transaction

const { address, data } = await uplinkClient.calldata.mintTokenBatchWithERC20({...})

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.mintTokenBatchWithERC20({...})

Returns

bigint // gas estimate in wei