sdk-js

@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

Name Type
amount bigint
duration number
isSubscription boolean
maxCreditsToCharge bigint
minCreditsRequired bigint
minCreditsToCharge bigint
nftTransfer boolean
serviceType ServiceType
tokenId string

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

Name Type Description
nftAttributes Partial<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

Name Type Default value Description
nftAttributes NFTServiceAttributes undefined -
chargeType ChargeType ChargeType.Fixed -
dynamicAmount? bigint undefined the 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

Name Type Description
nftAttributes NFTServiceAttributes NFT Attributes metadata
creditsBalance bigint balance of credits
dynamicAmount? bigint the dynamic amount of credits asked to be burned

Returns

boolean

boolean

Defined in

src/models/NFTAttributes.ts:115