Skip to content

Latest commit

 

History

History
183 lines (110 loc) · 3.76 KB

IExecVoucherModule.md

File metadata and controls

183 lines (110 loc) · 3.76 KB

iexec / Exports / IExecVoucherModule

Class: IExecVoucherModule

module exposing voucher methods

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new IExecVoucherModule(configOrArgs, options?): IExecVoucherModule

Create an IExecModule instance

Parameters

Name Type
configOrArgs IExecConfig | IExecConfigArgs
options? IExecConfigOptions

Returns

IExecVoucherModule

Inherited from

IExecModule.constructor

Properties

config

config: IExecConfig

current IExecConfig

Inherited from

IExecModule.config

Methods

authorizeRequester

authorizeRequester(requester): Promise<string>

SIGNER REQUIRED

authorize a requester to use the voucher

example:

const txHash = await authorizeRequester(requesterAddress);
console.log('tx:', txHash);

Parameters

Name Type
requester string

Returns

Promise<string>


getVoucherAddress

getVoucherAddress(owner): Promise<null | string>

returns the address of the voucher contract for the specified address if the address owns a voucher

example:

const voucherAddress = await getVoucherAddress(ownerAddress);
console.log('voucher contract address:', voucherAddress);

Parameters

Name Type
owner string

Returns

Promise<null | string>


revokeRequesterAuthorization

revokeRequesterAuthorization(requester): Promise<string>

Parameters

Name Type
requester string

Returns

Promise<string>


showUserVoucher

showUserVoucher(owner): Promise<VoucherInfo>

returns the user voucher information

example:

const userVoucher = await showUserVoucher(userAddress);
console.log('address:', userVoucher.address);
console.log('balance:', userVoucher.balance);
console.log('expiration:', userVoucher.expirationTimestamp);
console.log('sponsored apps:', userVoucher.sponsoredApps);
console.log('sponsored datasets:', userVoucher.sponsoredDatasets);
console.log('sponsored workerpools:', userVoucher.sponsoredWorkerpools);
console.log('allowance on user account:', userVoucher.allowanceAmount);
console.log('authorized accounts:', userVoucher.authorizedAccounts);

Parameters

Name Type
owner string

Returns

Promise<VoucherInfo>


fromConfig

fromConfig(config): IExecVoucherModule

Create an IExecVoucherModule instance using an IExecConfig instance

Parameters

Name Type
config IExecConfig

Returns

IExecVoucherModule

Overrides

IExecModule.fromConfig