Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides abstractions for interacting with an Ethereum-compatible blockchain and minting an NFT.

remarks

This currently only works with smart contracts compatible with the videoNftAbi interface. If you deploy your own contract, you can pass its address to the minting functions here but it has to implement the specified interface or not all of the functionality here will work.

Hierarchy

  • Web3

Index

Constructors

  • Creates a new Web3 instance with the provided options.

    Parameters

    Returns Web3

Properties

chainId: string
ethProvider?: JsonRpcProvider

Methods

  • getMintedNftInfo(tx: ContractTransaction): Promise<MintedNftInfo>
  • Waits for a mint transaction to be confirmed and returns info about the minted NFT.

    remarks

    This is the part of the minting process that relies on the Mint event from the videoNftAbi. You can use a contract that does not emit such event but you'll not be able to call this function to get the minted token ID.

    Parameters

    • tx: ContractTransaction

      The transaction receipt as returned by mintNft.

    Returns Promise<MintedNftInfo>

    Information about the just minted NFT.

  • mintNft(tokenUri: string, contractAddress?: string, to?: string): Promise<ContractTransaction>
  • Sends a transaction to the blockchain calling the mint function of the specified contract.

    remarks

    The tokenUri should likely be obtained from a function like Api.exportToIPFS but you can pass any URL here for the NFT. For example you can export the asset to IPFS but then create a custom metadata file in IPFS in case our current API doesn't work for your use case. We only suggest that you use a decentralized and immutable storage like IPFS for further reliability of the NFT over time.

    remarks

    The default smart contracts do not allow minting to other addresses. So the recipient of the NFT must always be the one that calls the mint transaction. Here it means that you should not provide the to argument and it will be obtained automatically from the provider.

    Parameters

    • tokenUri: string

      The URI of the NFT. This is normally the nftMetadataUrl field returned by Api.exportToIPFS.

    • Optional contractAddress: string

      The address of the smart contract to use. If you're using one of the built-in chains this will default to the Livepeer-deployed smart contract so you don't need to provide one.

    • Optional to: string

      An optional address for the recipient of the NFT. If using the default smart contracts, this must be omited or equal to the address sending the transaction.

    Returns Promise<ContractTransaction>

    The receipt of the transaction. Notice that this does not mean that the transaction is confirmed. To wait for that and also get the result of the minting process, check getMintedNftInfo.

Generated using TypeDoc