iexec / IExecAccountModule
module exposing account methods
new IExecAccountModule(
configOrArgs,options?):IExecAccountModule
Create an IExecModule instance
IExecAccountModule
config:
IExecConfig
current IExecConfig
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);string
Promise<string>
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);string
string
Promise<NRLCAmount>
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());string
Promise<{ locked: BN; stake: BN; }>
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());string
Promise<{ locked: BN; stake: BN; }>
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);Promise<{ amount: BN; txHash: string; }>
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);string
Promise<string>
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);Promise<{ amount: BN; txHash: string; }>
staticfromConfig(config):IExecAccountModule
Create an IExecAccountModule instance using an IExecConfig instance
IExecAccountModule