Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Nft

Index

Type aliases

INftData: { collectionId: number | undefined; creator: string; offchainData: string; owner: string; royalty: number; state: Nft.INftState }

Type declaration

  • collectionId: number | undefined
  • creator: string
  • offchainData: string
  • owner: string
  • royalty: number
  • state: Nft.INftState
INftState: { isCapsule: boolean; isDelegated: boolean; isSecret: boolean; isSoulbound: boolean; listedForSale: boolean }

Type declaration

  • isCapsule: boolean
  • isDelegated: boolean
  • isSecret: boolean
  • isSoulbound: boolean
  • listedForSale: boolean

Functions

  • name

    addNftToCollection

    summary

    Adds an NFT to an existing collection.

    Parameters

    • nft_id: number

      The ID of the NFT.

    • collection_id: number

      The ID of the Collection.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTAddedToCollectionEvent>

    NFTAddedToCollectionEvent Blockchain event.

  • addNftToCollectionTx(nft_id: number, collection_id: number): Promise<`0x${string}`>
  • name

    addNftToCollectionTx

    summary

    Creates an unsigned unsubmitted Add-NFT-To-Collection Transaction Hash.

    Parameters

    • nft_id: number

      The ID of the NFT.

    • collection_id: number

      The ID of the Collection.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Add-NFT-To-Collection Transaction Hash. The Hash is only valid for 5 minutes.

  • name

    burnCollection

    summary

    Burns an existing collection. The collections needs to be empty before it can be burned.

    Parameters

    • id: number

      The ID of the Collection.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.CollectionBurnedEvent>

    CollectionBurnedEvent Blockchain event.

  • burnCollectionTx(id: number): Promise<`0x${string}`>
  • name

    burnCollectionTx

    summary

    Creates an unsigned unsubmitted Burn-Collection Transaction Hash.

    Parameters

    • id: number

      The ID of the Collection.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Burn-Collection Transaction Hash. The Hash is only valid for 5 minutes.

  • name

    burnNft

    summary

    Burns an NFT from the chain.

    Parameters

    • id: number

      The ID of the NFT.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTBurnedEvent>

    NFTBurnedEvent Blockchain event.

  • burnNftTx(id: number): Promise<`0x${string}`>
  • name

    burnNftTx

    summary

    Creates an unsigned unsubmitted Burn-NFT Transaction Hash.

    Parameters

    • id: number

      The ID of the NFT.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Burn-NFT Transaction Hash. The Hash is only valid for 5 minutes.

  • name

    closeCollection

    summary

    Closes the collection so that no new NFTs can be added.

    Parameters

    • id: number

      The ID of the Collection.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.CollectionClosedEvent>

    CollectionClosedEvent Blockchain event.

  • closeCollectionTx(id: number): Promise<`0x${string}`>
  • name

    closeCollectionTx

    summary

    Creates an unsigned unsubmitted Close-Collection Transaction Hash.

    Parameters

    • id: number

      The ID of the Collection.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Close-Collection Transaction Hash. The Hash is only valid for 5 minutes.

  • collectionIpfsUpload(data: Nft.ICollectionMetadata, ipfsGateway?: string, apiKey?: string): Promise<{ hash: any; name: any; size: any; type: string }>
  • name

    collectionIpfsUpload

    summary

    Uploads your Collection offchain metadata on IPFS.

    Parameters

    • data: Nft.ICollectionMetadata

      Offchain metadata to be uploaded. It must fit the ICollectionMetadata interface format with a name, description, profileFile and a bannerFile.

    • Optional ipfsGateway: string

      IPFS gateway to upload your file on. If not provided, default is https://ipfs.ternoa.dev/api/v0/add

    • Optional apiKey: string

      API Key to validate the upload on the IPFS gateway.

    Returns Promise<{ hash: any; name: any; size: any; type: string }>

    The data object with the hash to add as offchain metadata in the extrinsic.

  • createCollection(offchainData: string, limit?: undefined | number, keyring: IKeyringPair, waitUntil: WaitUntil): Promise<Events.CollectionCreatedEvent>
  • name

    createCollection

    summary

    Creates a collection.

    Parameters

    • offchainData: string

      Off-chain related Collection metadata. Can be an IPFS Hash, an URL or plain text.

    • limit: undefined | number = undefined

      Amount of NFTs that can be associated with this collection. This is optional

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.CollectionCreatedEvent>

    CollectionCreatedEvent Blockchain event.

  • createCollectionTx(offchainData: string, limit?: undefined | number): Promise<`0x${string}`>
  • name

    createCollectionTx

    summary

    Creates an unsigned unsubmitted Create-Collection Transaction Hash.

    Parameters

    • offchainData: string

      Off-chain related Collection metadata. Can be an IPFS Hash, an URL or plain text.

    • limit: undefined | number = undefined

      The maximum amount that NFTs that the collection can hold. This is optional

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Create-Collection Transaction Hash. The Hash is only valid for 5 minutes.

  • createNft(offchainData: string, royalty?: number, collectionId?: undefined | number, isSoulbound?: boolean, keyring: IKeyringPair, waitUntil: WaitUntil): Promise<Events.NFTCreatedEvent>
  • name

    createNft

    summary

    Creates an NFT on the chain.

    Parameters

    • offchainData: string

      Off-chain related NFT metadata. Can be an IPFS Hash, an URL or plain text.

    • royalty: number = 0

      Percentage of all second sales that the creator will receive. It's a decimal number in range [0, 100]. Default is 0.

    • collectionId: undefined | number = undefined

      The collection that this NFT will belong. Optional Parameter.

    • isSoulbound: boolean = false

      If true makes the NFT untransferable. Default is false.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTCreatedEvent>

    NFTCreatedEvent Blockchain event.

  • createNftTx(offchainData: string, royalty?: number, collectionId?: undefined | number, isSoulbound?: boolean): Promise<`0x${string}`>
  • name

    createNftTx

    summary

    Creates an unsigned unsubmitted Create-NFT Transaction Hash.

    Parameters

    • offchainData: string

      Off-chain related NFT metadata. Can be an IPFS Hash, an URL or plain text.

    • royalty: number = 0

      Percentage of all second sales that the creator will receive. It's a decimal number in range [0, 100]. Default is 0.

    • collectionId: undefined | number = undefined

      The collection that this NFT will belong. Optional Parameter.

    • isSoulbound: boolean = false

      If true makes the NFT untransferable. Default is false.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Create-NFT Transaction Hash. The Hash is only valid for 5 minutes.

  • delegateNft(id: number, recipient?: undefined | string, keyring: IKeyringPair, waitUntil: WaitUntil): Promise<Events.NFTDelegatedEvent>
  • name

    delegateNft

    summary

    Delegates an NFT to someone.

    Parameters

    • id: number

      The ID of the NFT.

    • recipient: undefined | string = undefined

      Destination account. If set to undefined this functions acts as a way to undelegate a delegated NFT.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTDelegatedEvent>

    NFTDelegatedEvent Blockchain event.

  • delegateNftTx(id: number, recipient?: undefined | string): Promise<`0x${string}`>
  • name

    delegateNftTx

    summary

    Creates an unsigned unsubmitted Delegate-NFT Transaction Hash.

    Parameters

    • id: number

      The ID of the NFT.

    • recipient: undefined | string = undefined

      Destination account. If set to undefined this functions acts as a way to undelegate a delegated NFT.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Delegate-NFT Transaction Hash. The Hash is only valid for 5 minutes.

  • name

    getCollectionData

    summary

    Provides the data related to one NFT collection. ex:{owner, creator, offchainData, limit, isClosed(...)}

    Parameters

    • collectionId: number

      The collection id.

    Returns Promise<null | Nft.ICollectionData>

    A JSON object with data of a single NFT collection.

  • getCollectionOffchainDataLimit(): Promise<number>
  • name

    getCollectionOffchainDataLimit

    summary

    Provides the maximum offchain data length.

    Returns Promise<number>

    Number.

  • getCollectionSizeLimit(): Promise<number>
  • name

    getCollectionSizeLimit

    summary

    Maximum collection length.

    Returns Promise<number>

    Number.

  • getInitialMintFee(): Promise<BN>
  • name

    getInitialMintFee

    summary

    Original mint fee.

    Returns Promise<BN>

    Original NFT mint fee.

  • getNextCollectionId(): Promise<number>
  • name

    getNextCollectionId

    summary

    Get the next collection Id available.

    Returns Promise<number>

    Number.

  • getNextNftId(): Promise<number>
  • name

    getNextNftId

    summary

    Get the next NFT Id available.

    Returns Promise<number>

    Number.

  • getNftData(nftId: number): Promise<null | Nft.INftData>
  • name

    getNftData

    summary

    Provides the data related to one NFT.

    Parameters

    • nftId: number

      The NFT id.

    Returns Promise<null | Nft.INftData>

    A JSON object with the NFT data. ex:{owner, creator, offchainData, (...)}

  • getNftMintFee(): Promise<BN>
  • name

    nftMintFee

    summary

    Fee to mint an NFT (extra fee on top of the tx fees).

    Returns Promise<BN>

    NFT mint fee.

  • getNftOffchainDataLimit(): Promise<number>
  • name

    getNftOffchainDataLimit

    summary

    Provides the maximum offchain data length.

    Returns Promise<number>

    Number.

  • name

    limitCollection

    summary

    Limits how many NFTs can be associated with this collection.

    Parameters

    • id: number

      The ID of the Collection.

    • limit: number

      Amount of NFTs that can be associated with this collection.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.CollectionLimitedEvent>

    CollectionLimitedEvent Blockchain event.

  • limitCollectionTx(id: number, limit: number): Promise<`0x${string}`>
  • name

    limitCollectionTx

    summary

    Creates an unsigned unsubmitted Limit-Collection Transaction Hash.

    Parameters

    • id: number

      The ID of the Collection.

    • limit: number

      Amount of NFTs that can be associated with this collection.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Limit-Collection Transaction Hash. The Hash is only valid for 5 minutes.

  • nftIpfsUpload(data: Nft.INFTMetadata, ipfsGateway?: string, apiKey?: string): Promise<{ hash: any; name: any; size: any; type: string }>
  • name

    nftIpfsUpload

    summary

    Uploads your NFT offchain metadata on IPFS.

    Parameters

    • data: Nft.INFTMetadata

      Offchain metadata to be uploaded. It must fit the INFTMetadata interface format with a description, file and title.

    • Optional ipfsGateway: string

      IPFS gateway to upload your file on. If not provided, default is https://ipfs.ternoa.dev/api/v0/add

    • Optional apiKey: string

      API Key to validate the upload on the IPFS gateway.

    Returns Promise<{ hash: any; name: any; size: any; type: string }>

    The data object with the hash to add as offchain metadata in the extrinsic.

  • name

    setRoyalty

    summary

    Sets the royalty of an NFT.

    Parameters

    • id: number

      The ID of the NFT.

    • amount: number

      The new royalty value.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTRoyaltySetEvent>

    NFTRoyaltySetEvent Blockchain event.

  • setRoyaltyTx(id: number, amount: number): Promise<`0x${string}`>
  • name

    setRoyaltyTx

    summary

    Creates an unsigned unsubmitted Set-Royalty Transaction Hash.

    Parameters

    • id: number

      The ID of the NFT.

    • amount: number

      The new royalty value.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Set-Royalty-NFT Transaction Hash. The Hash is only valid for 5 minutes.

  • name

    transferNft

    summary

    Sends an NFT to someone.

    Parameters

    • id: number

      The ID of the NFT.

    • recipient: string

      Destination account.

    • keyring: IKeyringPair

      Account that will sign the transaction.

    • waitUntil: WaitUntil

      Execution trigger that can be set either to BlockInclusion or BlockFinalization.

    Returns Promise<Events.NFTTransferredEvent>

    NFTTransferredEvent Blockchain event.

  • transferNftTx(id: number, recipient: string): Promise<`0x${string}`>
  • name

    transferNftTx

    summary

    Creates an unsigned unsubmitted Transfer-NFT Transaction Hash.

    Parameters

    • id: number

      The ID of the NFT.

    • recipient: string

      Destination account.

    Returns Promise<`0x${string}`>

    Unsigned unsubmitted Transfer-NFT Transaction Hash. The Hash is only valid for 5 minutes

Generated using TypeDoc