Skip to content

setSubscriptionParams

Method to set subscription parameters for a given collection of yours.

Usage

ts

const 
setSubscriptionParamsResult
=
await
dataProtectorSharing
.
setSubscriptionParams
({
collectionId
: 12,
price
: 2, // 2 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

Parameters

ts
import { type 
SetSubscriptionParams
} from '@iexec/dataprotector';

collectionId

Collection ID to which you'd like to set the subscription params.

ts

const 
setSubscriptionParamsResult
=
await
dataProtectorSharing
.
setSubscriptionParams
({
collectionId
: 12,
price
: 2, // 2 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

price

The price in nano RLC (nRLC) it's going to cost a subscriber to access your collection.

ts

const 
setSubscriptionParamsResult
=
await
dataProtectorSharing
.
setSubscriptionParams
({
collectionId
: 12,
price
: 2, // 2 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

duration

The duration (in seconds) for a period of subscription.

ts

const 
setSubscriptionParamsResult
=
await
dataProtectorSharing
.
setSubscriptionParams
({
collectionId
: 12,
price
: 2, // 2 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

Return value

ts
import { type 
SuccessWithTransactionHash
} from '@iexec/dataprotector';

See SuccessWithTransactionHash