This function will revert under the following conditions:

  • The channel does not allow ERC20 minting.
  • The caller does not fulfill any of the channel creatorLogic[] rules.
  • 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

{ 
  tokenId: bigint, // the token ID of the newly created token
  event: Log 
}

Parameters

channelAddress

  • type: string

The target channel address

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

to

  • type: string

The recipient of the minted tokens

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

tokenId

  • type: bigint

The token ID to mint

const { event } = await uplinkClient.sponsorTokenWithERC20({
  tokenId: 1n,
  ...
})

amount

  • type: bigint

The amount to mint

const { event } = await uplinkClient.sponsorTokenWithERC20({
  amount: 1n,
  ...
})

mintReferral (optional)

  • type: string

The referral address for the mint

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

data (optional)

  • type: string

Additional data for the mint

const { event } = await uplinkClient.sponsorTokenWithERC20
({
  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.sponsorTokenWithERC20({
    ...
    transactionOverrides: {
        gas: 1000000nn
    }
})

Calldata

generate calldata for the transaction

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

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

Returns

bigint // gas estimate in wei