Constructor
new ProviderProfile()
This class is meant to be instantiated from within the SubscriptionPlans service, not directly.
- See:
Members
discounts
Map of DiscountId to Discount object.
- See:
plans
Map of planId to Plan object.
- See:
Methods
asProfileObject() → {Object}
Convert the profile into an Object suitable for serializing to IPFS.
Returns:
- Type
- Object
getDiscount(args) → {Plan}
Get a discount from the provider profile.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | Function arguments
Properties
|
- See:
-
- The SDK guide for more details on unit formatting at https://docs.cask.fi/developer-docs/javascript-sdk
Returns:
- Type
- Plan
getPlan(args) → {Plan}
Get a plan from the provider profile.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | Function arguments
Properties
|
- See:
-
- The SDK guide for more details on unit formatting at https://docs.cask.fi/developer-docs/javascript-sdk
Returns:
- Type
- Plan
incrementNonce()
Increment the internal nonce of the profile.
(async) loadFromIPFS(cid)
Load a profile from a given IPFS CID.
Parameters:
Name | Type | Description |
---|---|---|
cid |
IPFS CID. |
merkleCommitment() → {string}
Merkle commitment of profile.
Returns:
- Type
- string
needsPublish() → {boolean}
Check if the profile has unpublished changes.
Returns:
- Type
- boolean
removeDiscount(discountId)
Remove a discount from the profile.
Parameters:
Name | Type | Description |
---|---|---|
discountId |
Discount ID |
removePlan(planId)
Remove a plan from the provider profile.
Parameters:
Name | Type | Description |
---|---|---|
planId |
Plan ID |
(async) saveToIPFS()
Saves current profile data to IPFS.
setDiscount(args)
Add/update a discount in the profile. Specify either the discountId or raw discountCode for the new discount.
Must specify the discount identified as one of `discountId`, `discountCode`, 'discountNFTAddress'
or `discountERC20Address`.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | Function arguments
Properties
|
setMetadata(metadata)
Set metadata for provider profile
Parameters:
Name | Type | Description |
---|---|---|
metadata |
Metadata object |
setPaymentAddress(paymentAddress)
Set payment address of provider profile
Parameters:
Name | Type | Description |
---|---|---|
paymentAddress |
Address to receive subscription payments |
setPlan(args)
Add/update a plan to the provider profile.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | Function arguments
Properties
|
setSignedRoots(signedRoots)
Update the signed roots data of the provider profile.
Parameters:
Name | Type | Description |
---|---|---|
signedRoots |
Signed message data of the merkleroots representing the provider profile |
(async) signMerkleRoots(signer) → {Promise.<string>}
Sign the profile merkleroots using the provided signer.
Parameters:
Name | Type | Description |
---|---|---|
signer |
Signer to use |
Returns:
- Type
- Promise.<string>
updateMerkleRoots()
Update profile merkleroots using current profile plans/discounts.