Skip to main content

NFTServiceAttributes

@nevermined-io/sdk - v3.0.44 / NFTServiceAttributes

Class: NFTServiceAttributes

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new NFTServiceAttributes(): NFTServiceAttributes

Returns

NFTServiceAttributes

Properties

amount

Optional amount: bigint

Number of editions

Defined in

src/models/NFTAttributes.ts:17


duration

Optional duration: number

If is a subscription this means the number of blocks the subscription last. If 0 means unlimited

Defined in

src/models/NFTAttributes.ts:32


isSubscription

Optional isSubscription: boolean

If true means the NFT works as a subscription

Defined in

src/models/NFTAttributes.ts:27


maxCreditsToCharge

Optional maxCreditsToCharge: bigint

The maximum number of credits that can be charged to the subscriber. If not specified, the subscription cost is not capped

Defined in

src/models/NFTAttributes.ts:44


minCreditsRequired

Optional minCreditsRequired: bigint

The minimum number of credits that the subscribers needs to hold to access the asset. If not specified, the amount defined in the service agreement or 1 credit will be required

Defined in

src/models/NFTAttributes.ts:56


minCreditsToCharge

Optional minCreditsToCharge: bigint

The minimum number of credits that will be charged to the subscriber. If not specified, the amount defined in the service agreement or 1 credit will be charged

Defined in

src/models/NFTAttributes.ts:50


nftTransfer

Optional nftTransfer: boolean

The asset is transferred (true) or minted (false) with Nevermined contracts

Defined in

src/models/NFTAttributes.ts:22


tokenId

Optional tokenId: string

The tokenId of the NFT related with the Service. For example if is a NFT Access service requiring holding a NFT, this is the tokenId of the NFT

Defined in

src/models/NFTAttributes.ts:38


defaultValues

Static defaultValues: Object

Type declaration

NameType
amountbigint
durationnumber
isSubscriptionboolean
maxCreditsToChargebigint
minCreditsRequiredbigint
minCreditsToChargebigint
nftTransferboolean
serviceTypeServiceType
tokenIdstring

Defined in

src/models/NFTAttributes.ts:58

Methods

configureServicesAttributes

configureServicesAttributes(nftAttributes): Partial\<NFTAttributes>

Given some partial nft attributes it applies some default validations and pre-configure default values

Parameters

NameTypeDescription
nftAttributesPartial\<NFTAttributes>partial nft attributes

Returns

Partial\<NFTAttributes>

nft attributes validated and configured

Defined in

src/models/NFTAttributes.ts:136


getCreditsToCharge

getCreditsToCharge(nftAttributes, chargeType?, dynamicAmount?): undefined | bigint

Taking into account the nft attributes confifured tt returns the number of credits to be consumed

Parameters

NameTypeDefault valueDescription
nftAttributesNFTServiceAttributesundefined-
chargeTypeChargeTypeChargeType.Fixed-
dynamicAmount?bigintundefinedthe dynamic amount of credits asked to be consumed

Returns

undefined | bigint

amount to consume

Defined in

src/models/NFTAttributes.ts:81


getDefaultNFTServiceAttributes

getDefaultNFTServiceAttributes(): Required\<NFTServiceAttributes>

Returns

Required\<NFTServiceAttributes>

Defined in

src/models/NFTAttributes.ts:70


isCreditsBalanceEnough

isCreditsBalanceEnough(nftAttributes, creditsBalance, dynamicAmount?): boolean

Given some credits balance if checks if that's enough to access to a NFT asset

Parameters

NameTypeDescription
nftAttributesNFTServiceAttributesNFT Attributes metadata
creditsBalancebigintbalance of credits
dynamicAmount?bigintthe dynamic amount of credits asked to be burned

Returns

boolean

boolean

Defined in

src/models/NFTAttributes.ts:115