Skip to content

setProtectedDataToRenting

Method to allow a protected data to be rented.

If you call this method on a protected data that is already set for renting, it will update the price and duration parameters, and will apply to future rentals.

Usage

ts
const 
setForRentingResult
=
await
dataProtectorSharing
.
setProtectedDataToRenting
({
protectedData
: '0x123abc...',
price
: 1, // 1 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

Parameters

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

protectedData Required *

Type: AddressOrENS

Address of the protected data you'd like to set renting parameters for.

ts
const 
setForRentingResult
=
await
dataProtectorSharing
.
setProtectedDataToRenting
({
protectedData
: '0x123abc...',
price
: 1, // 1 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

price Required *

Type: number

The price in nano RLC (nRLC) you ask from someone who wants to rent the protected data.

ts
const 
setForRentingResult
=
await
dataProtectorSharing
.
setProtectedDataToRenting
({
protectedData
: '0x123abc...',
price
: 1, // 1 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

duration Required *

Type: number

The duration of the rental in seconds.

ts
const 
setForRentingResult
=
await
dataProtectorSharing
.
setProtectedDataToRenting
({
protectedData
: '0x123abc...',
price
: 1, // 1 nRLC
duration
: 60 * 60 * 24 * 30, // 30 days
});

Return value

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

See SuccessWithTransactionHash