iexec / IExecWalletModule
module exposing wallet methods
new IExecWalletModule(
configOrArgs,options?):IExecWalletModule
Create an IExecModule instance
IExecWalletModule
config:
IExecConfig
current IExecConfig
bridgeToMainchain(
nRLCAmount):Promise<{receiveTxHash?:string;sendTxHash:string; }>
SIGNER REQUIRED
send some nRLC to the mainchain
NB:
- RLC is send to the sidechain bridge smart contract on sidechain then credited on mainchain by the mainchain bridge smart contract
- the reception of the value on the mainchain (
receiveTxHash) will not be monitored if the bridged network configuration is missing
example:
const { sendTxHash, receiveTxHash } = await bridgeToSidechain('1000000000');
console.log(`sent RLC on sidechain (tx: ${sendTxHash}), wallet credited on mainchain (tx: ${receiveTxHash})`);Promise<{ receiveTxHash?: string; sendTxHash: string; }>
bridgeToSidechain(
nRLCAmount):Promise<{receiveTxHash?:string;sendTxHash:string; }>
SIGNER REQUIRED
send some nRLC to the sidechain
NB:
- RLC is send to the mainchain bridge smart contract on mainchain then credited on sidechain by the sidechain bridge smart contract
- the reception of the value on the sidechain (
receiveTxHash) will not be monitored if the bridged network configuration is missing
example:
const { sendTxHash, receiveTxHash } = await bridgeToSidechain('1000000000');
console.log(`sent RLC on mainchain (tx: ${sendTxHash}), wallet credited on sidechain (tx: ${receiveTxHash})`);Promise<{ receiveTxHash?: string; sendTxHash: string; }>
check the wallet balances (native and iExec token) of specified address
example:
const { wei, nRLC } = await checkBalances(address);
console.log('iExec nano RLC:', nRLC.toString());
console.log('ethereum wei:', wei.toString());string
Promise<{ nRLC: BN; wei: BN; }>
checkBridgedBalances(
address):Promise<{nRLC:BN;wei:BN; }>
check the wallet balances (native and iExec token) of specified address on bridged chain
example:
const { wei, nRLC } = await checkBalances(address);
console.log('iExec nano RLC:', nRLC.toString());
console.log('ethereum wei:', wei.toString());string
Promise<{ nRLC: BN; wei: BN; }>
getAddress():
Promise<string>
SIGNER REQUIRED
get the connected wallet address
example:
const userAddress = await getAddress();
console.log('user address:', userAddress);Promise<string>
obsBridgeToMainchain(
nRLCAmount):Promise<BridgeObservable>
SIGNER REQUIRED
return an Observable with a subscribe method to start and monitor the bridge to mainchain process
example:
const bridgeObservable = await obsBridgeToMainchain('1000000000');
const cancel = bridgeObservable.subscribe({
next: ({message, ...rest}) => console.log(message, ...rest),
error: (err) => console.error(err),
complete: () => console.log('completed'),
});Promise<BridgeObservable>
obsBridgeToSidechain(
nRLCAmount):Promise<BridgeObservable>
SIGNER REQUIRED
return an Observable with a subscribe method to start and monitor the bridge to sidechain process
example:
const bridgeObservable = await obsBridgeToSidechain('1000000000');
const cancel = bridgeObservable.subscribe({
next: ({message, ...rest}) => console.log(message, ...rest),
error: (err) => console.error(err),
complete: () => console.log('completed'),
});Promise<BridgeObservable>
sendETH(
WeiAmount,to):Promise<string>
SIGNER REQUIRED
send some wei to the specified address
example:
const txHash = await sendETH(amount, receiverAddress);
console.log('transaction hash:', txHash);string
Promise<string>
sendRLC(
nRLCAmount,to):Promise<string>
SIGNER REQUIRED
send some nRLC to the specified address
example:
const txHash = await sendRLC(amount, receiverAddress);
console.log('transaction hash:', txHash);string
Promise<string>
sweep(
to):Promise<{sendERC20TxHash:string;sendNativeTxHash:string; }>
SIGNER REQUIRED
send all the iExec token and the native token owned by the wallet to the specified address
example:
const { sendERC20TxHash, sendNativeTxHash } = await sweep(receiverAddress);
console.log('sweep RLC transaction hash:', sendERC20TxHash);
console.log('sweep ether transaction hash:', sendNativeTxHash);string
Promise<{ sendERC20TxHash: string; sendNativeTxHash: string; }>
staticfromConfig(config):IExecWalletModule
Create an IExecWalletModule instance using an IExecConfig instance
IExecWalletModule