NFTServiceAttributes
@nevermined-io/sdk - v3.0.32 / NFTServiceAttributes
Class: NFTServiceAttributes
Table of contents
Constructors
Properties
- amount
- duration
- isSubscription
- maxCreditsToCharge
- minCreditsRequired
- minCreditsToCharge
- nftTransfer
- tokenId
- defaultValues
Methods
Constructors
constructor
• new NFTServiceAttributes(): NFTServiceAttributes
Returns
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