Options
All
  • Public
  • Public/Protected
  • All
Menu

This module provides the highest-level abstractions of the SDK with all the utilities for minting an NFT from a video file.

remarks

On a production app, each part of the flow will likely be in a different part of your stack. In the most common case:

  • The Uploader will be used the closest to your users, where they provide the files and upload them to a URL provided by the Livepeer API.
  • The Api will be used to call the Livepeer VOD API. Since using the API requires having an API key, this should probably stay in a private part of your stack like your backend. It can be used and will work from the frontend for development purposes anyway, or if you configure your backend as a proxy to the API that injects the API key into the request. See Livepeer Web API Proxy for a sample project of that.
  • The Web3 will be used to interact with the Ethereum-compatible blockchain. It is most commonly used from the browser, connecting to your users' web3 wallet like MetaMask. It can also be used from the backend if you'd prefer to mint all the NFTs yourself, maybe with a custom contract from which you can mint directly to your users' addresses.
remarks

The FullMinter class encapsulates all of the parts above, but it serves mostly as an example of what the full minting flow would look like if performed in a single place. Check its specific documentation for more details.

Index

Type aliases

EthereumOrProvider: ethers.providers.ExternalProvider | ethers.providers.JsonRpcFetchFunc | ethers.providers.JsonRpcProvider

Representation of either an ethers JSON RPC provider or the arguments required for creating one. The window.ethereum object injected by MetaMask is an acceptable value for this.

MintedNftInfo: { contractAddress: string; opensea?: { contractUrl: string; tokenUrl?: string }; tokenId?: number }

Some helpful information about a newly minted NFT.

Type declaration

  • contractAddress: string

    The address of the smart contract on which the NFT was minted.

  • Optional opensea?: { contractUrl: string; tokenUrl?: string }

    Helpful links about the NFT in OpenSea. Will only be available when using a built-in chain for which we have the OpenSea parameters.

    • contractUrl: string

      Search URL for the smart contract, which is aggregated in OpenSea as a collection. Can be sent as a best-effort if the token URL is not known.

    • Optional tokenUrl?: string

      URL directly to the token page in OpenSea. Might not be available in case the token ID is not known.

  • Optional tokenId?: number

    The ID of the minted NFT which can be used to fetch information about it in the ERC-721 contract. Will only be available if the NFT contract emits a Mint event compatible with the videoNftAbi

Web3Options: { chainId: string | number; ethereum: EthereumOrProvider }

Options for creating a Web3 instance.

Type declaration

  • chainId: string | number

    The ID of the blockchain that is currently connected.

    remarks

    This would not be really necessary since we can get it from the ethereum provider but ethers library explodes if the chain changes. So we only force the chainId to be sent here so it's clear that you need to recreate the Web3 instance anytime the chain changes. You also need to recreate your custom ethers provider if you are creating one manually.

  • ethereum: EthereumOrProvider

    The blockchain-access provider, either from ethers or the wallet.

    remarks

    This can be either an external provider, as exposed as a window.ethereum object by some web3 wallets like MetaMask or a custom provider created with the ethers library. You will likely need to instantiate a custom provider if you are using this from node.js.

Variables

videoNftAbi: readonly ["event Mint(address indexed sender, address indexed owner, string tokenURI, uint256 tokenId)", "function mint(address owner, string tokenURI) returns (uint256)"] = ...

The ABI for the required interface that the NFT smart contract should implement to be compatible with this SDK. Represented in ethers' human-readable ABI format.

example

This can also be represented by the following Solidity interface:

interface IVideoNFT {
function mint(address owner, string memory tokenURI)
public
returns (uint256);

event Mint(
address indexed sender,
address indexed owner,
string tokenURI,
uint256 tokenId
);
}

Generated using TypeDoc