Skip to content

Latest commit

 

History

History
260 lines (147 loc) · 4.77 KB

File metadata and controls

260 lines (147 loc) · 4.77 KB

iexec


iexec / IExecAccountModule

Class: IExecAccountModule

module exposing account methods

Extends

Constructors

Constructor

new IExecAccountModule(configOrArgs, options?): IExecAccountModule

Create an IExecModule instance

Parameters

configOrArgs

IExecConfigArgs | IExecConfig

options?

IExecConfigOptions

Returns

IExecAccountModule

Inherited from

IExecModule.constructor

Properties

config

config: IExecConfig

current IExecConfig

Inherited from

IExecModule.config

Methods

approve()

approve(amount, spenderAddress): Promise<string>

SIGNER REQUIRED

approves the spender to use the account up to a specified amount, denoted in nRLC (1 nRLC = 1*10^-9 RLC).

example:

const txHash = await approve(amount, spenderAddress);
console.log('tx:', txHash);

Parameters

amount

NRLCAmount

spenderAddress

string

Returns

Promise<string>


checkAllowance()

checkAllowance(ownerAddress, spenderAddress): Promise<NRLCAmount>

checks the amount of allowance approved for the specified spender to use the account of the owner.

example:

const allowanceAmount = await checkAllowance(ownerAddress, spenderAddress);
console.log('allowance amount:', allowanceAmount);

Parameters

ownerAddress

string

spenderAddress

string

Returns

Promise<NRLCAmount>


checkBalance()

checkBalance(address): Promise<{ locked: BN; stake: BN; }>

check the account balance of specified address (stake is available nRLC, locked is escrowed nRLC)

example:

const balance = await checkBalance(ethAddress);
console.log('Nano RLC staked:', balance.stake.toString());
console.log('Nano RLC locked:', balance.locked.toString());

Parameters

address

string

Returns

Promise<{ locked: BN; stake: BN; }>


checkBridgedBalance()

checkBridgedBalance(address): Promise<{ locked: BN; stake: BN; }>

check the account balance on bridged chain of specified address ie: when connected to mainnet, check the account ballance on bellecour example:

const balance = await checkBridgedBalance(ethAddress);
console.log('Nano RLC staked:', balance.stake.toString());
console.log('Nano RLC locked:', balance.locked.toString());

Parameters

address

string

Returns

Promise<{ locked: BN; stake: BN; }>


deposit()

deposit(amount): Promise<{ amount: BN; txHash: string; }>

SIGNER REQUIRED

deposit some nRLC (1 nRLC = 1*10^-9 RLC) from user wallet to user account

example:

const { amount, txHash } = await deposit('1000000000');
console.log('Deposited:', amount);
console.log('tx:', txHash);

Parameters

amount

NRLCAmount

Returns

Promise<{ amount: BN; txHash: string; }>


revokeApproval()

revokeApproval(spenderAddress): Promise<string>

SIGNER REQUIRED

revokes the approval for the spender to use the account.

example:

const txHash = await revokeApproval(spenderAddress);
console.log('tx:', txHash);

Parameters

spenderAddress

string

Returns

Promise<string>


withdraw()

withdraw(amount): Promise<{ amount: BN; txHash: string; }>

SIGNER REQUIRED

withdraw some nRLC (1 nRLC = 1*10^-9 RLC) from user account to user wallet

example:

const { amount, txHash } = await iexec.account.withdraw('1000000000');
console.log('Withdrawn:', amount);
console.log('tx:', txHash);

Parameters

amount

NRLCAmount

Returns

Promise<{ amount: BN; txHash: string; }>


fromConfig()

static fromConfig(config): IExecAccountModule

Create an IExecAccountModule instance using an IExecConfig instance

Parameters

config

IExecConfig

Returns

IExecAccountModule

Overrides

IExecModule.fromConfig