Skip to content

Latest commit

 

History

History
170 lines (95 loc) · 2.96 KB

File metadata and controls

170 lines (95 loc) · 2.96 KB

iexec


iexec / IExecVoucherModule

Class: IExecVoucherModule

module exposing voucher methods

Extends

Constructors

Constructor

new IExecVoucherModule(configOrArgs, options?): IExecVoucherModule

Create an IExecModule instance

Parameters

configOrArgs

IExecConfigArgs | IExecConfig

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

requester

string

Returns

Promise<string>


getVoucherAddress()

getVoucherAddress(owner): Promise<string | null>

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

owner

string

Returns

Promise<string | null>


revokeRequesterAuthorization()

revokeRequesterAuthorization(requester): Promise<string>

Parameters

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

owner

string

Returns

Promise<VoucherInfo>


fromConfig()

static fromConfig(config): IExecVoucherModule

Create an IExecVoucherModule instance using an IExecConfig instance

Parameters

config

IExecConfig

Returns

IExecVoucherModule

Overrides

IExecModule.fromConfig