From 9c85edf7286f16b4ec619e90372c36ee5c844db6 Mon Sep 17 00:00:00 2001 From: emizzle Date: Mon, 10 Jun 2019 22:11:29 +1000 Subject: [PATCH 1/4] Removing PK, adding metamask support WIP --- package.json | 1 + src/index.js | 110 +++++++++++++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/package.json b/package.json index f43ae01..a9c49b7 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "> 0.2%" ], "files": [ + "src", "dist" ], "scripts": { diff --git a/src/index.js b/src/index.js index 8b0983e..54efecf 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -/* global Web3 */ +/* global EmbarkJS */ import BigNumber from "bn.js"; import ChildChain from "@omisego/omg-js-childchain"; import RootChain from "@omisego/omg-js-rootchain"; @@ -19,46 +19,60 @@ export default class BaseEmbarkOmg { // plugin opts this.plasmaContractAddress = pluginConfig.PLASMA_CONTRACT_ADDRESS; - this.web3ProviderUrl = pluginConfig.WEB3_PROVIDER_URL; + //this.web3ProviderUrl = pluginConfig.WEB3_PROVIDER_URL; this.watcherUrl = pluginConfig.WATCHER_URL; this.childChainUrl = pluginConfig.CHILDCHAIN_URL; } - async init(accounts, web3Path) { + + async init(web3) { //}, web3Path) { + try { if (this.initing) { const message = "Already intializing the Plasma chain, please wait..."; - this.logger.error(message); + //this.logger.error(message); throw new Error(message); } this.initing = true; - if (!(accounts && accounts.length)) { - this.logger.error(ACCOUNT_CONFIG_ERROR); - throw new Error(ACCOUNT_CONFIG_ERROR); - } - const { address, privateKey } = accounts[0]; - this.address = address; - this.addressPrivateKey = privateKey; + // if (!(accounts && accounts.length)) { + // //this.logger.error(ACCOUNT_CONFIG_ERROR); + // throw new Error(ACCOUNT_CONFIG_ERROR); + // } + //const { address, privateKey } = accounts[0]; + //this.address = address; + //this.addressPrivateKey = privateKey; + + // this.address = accounts[0]; // init Web3 - const web3Lib = web3Path ? require(web3Path) : Web3; - this.web3 = new web3Lib(); - const web3Provider = new web3Lib.providers.HttpProvider(this.web3ProviderUrl); - this.web3.setProvider(web3Provider); + // const web3Lib = web3Path ? require(web3Path) : Web3; + // this.web3 = new web3Lib(); + // if (!web3) { + // web3 = EmbarkJS.Blockchain.providers["web3"]; + // } + this.web3 = web3; + let accounts = await this.web3.eth.getAccounts(); + this.address = accounts.length > 1 ? accounts[1] : accounts[0]; // ignore the first account because it is our deployer account, we want the manually added account + + // if(!this.web3) { + // throw new Error("web3 cannot be found. Please ensure you have the 'embarkjs-connector-web3' plugin installed in your DApp."); + // } + // const web3Provider = new web3Lib.providers.HttpProvider(this.web3ProviderUrl); + //this.web3.setProvider(web3Provider); // check account balance on the main chain - try { - this.maxDeposit = await this.web3.eth.getBalance(this.address); - if (!this.maxDeposit || new BigNumber(this.maxDeposit).lte(0)) { - this.logger.error(ACCOUNT_BALANCE_ERROR); - throw new Error(ACCOUNT_BALANCE_ERROR); - } - this.maxDeposit = new BigNumber(this.maxDeposit); - } - catch (e) { - this.logger.error(`Error getting balance for account ${this.address}: ${e}`); - } + // try { + // this.maxDeposit = await this.web3.eth.getBalance(this.address); + // if (!this.maxDeposit || new BigNumber(this.maxDeposit).lte(0)) { + // //this.logger.error(ACCOUNT_BALANCE_ERROR); + // throw new Error(ACCOUNT_BALANCE_ERROR); + // } + // this.maxDeposit = new BigNumber(this.maxDeposit); + // } + // catch (e) { + // this.logger.warn(`Error getting balance for account ${this.address}: ${e}`); + // } // set up the Plasma chain this.rootChain = new RootChain(this.web3, this.plasmaContractAddress); @@ -70,7 +84,7 @@ export default class BaseEmbarkOmg { } catch (e) { const message = `Error initializing Plasma chain: ${e}`; - this.logger.error(message); + //this.logger.error(message); throw new Error(message); } } @@ -78,37 +92,37 @@ export default class BaseEmbarkOmg { async deposit(amount) { if (!this.inited) { const message = "Please wait for the Plasma chain to initialize..."; - this.logger.error(message); + // this.logger.error(message); throw new Error(message); } amount = new BigNumber(amount); if (!amount || amount.lte(0)) { const message = "You must deposit more than 0 wei."; - this.logger.error(message); + // this.logger.error(message); throw new Error(message); } - if (amount.gt(this.maxDeposit)) { - // recheck balance in case it was updated in a recent tx - this.maxDeposit = await this.web3.eth.getBalance(this.address); - if (amount.gt(this.maxDeposit)) { - const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.address} and then try again.`; - this.logger.error(message); - throw new Error(message); - } - } + // if (amount.gt(this.maxDeposit) && this.maxDeposit.gt(0)) { + // // recheck balance in case it was updated in a recent tx + // this.maxDeposit = await this.web3.eth.getBalance(this.address); + // if (amount.gt(this.maxDeposit)) { + // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.address} and then try again.`; + // // this.logger.error(message); + // throw new Error(message); + // } + // } // const DEPOSIT_AMT = "100000"; this.logger.info(`Depositing ${amount} wei...`); const depositTx = transaction.encodeDeposit(this.address, amount, transaction.ETH_CURRENCY); try { - const receipt = await this.rootChain.depositEth(depositTx, amount, { from: this.address, privateKey: this.addressPrivateKey }); + const receipt = await this.rootChain.depositEth(depositTx, amount, { from: this.address });//, privateKey: this.addressPrivateKey }); this.logger.trace(receipt); const message = `Successfully deposited ${amount} wei in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${receipt.transactionHash}`; - this.logger.info(message); + // this.logger.info(message); return message; } catch (e) { const message = `Error depositing ${amount} wei: ${e}`; - this.logger.error(message); + // this.logger.error(message); throw new Error(message); } } @@ -119,11 +133,11 @@ export default class BaseEmbarkOmg { const utxos = await this.childChain.getUtxos(this.address); const utxosToSpend = this.selectUtxos(utxos, val, transaction.ETH_CURRENCY); if (!utxosToSpend) { - return this.logger.error(`No utxo big enough to cover the amount ${val}`); + throw new Error(`No utxo big enough to cover the amount ${val}`); } val = new BigNumber(val); if (!val || val.lte(0)) { - return this.logger.error("Transaction value must be more than 0 wei."); + throw new Error("Transaction value must be more than 0 wei."); } const txBody = { @@ -151,7 +165,7 @@ export default class BaseEmbarkOmg { try { const unsignedTx = await this.childChain.createTransaction(txBody); - const signatures = await this.childChain.signTransaction(unsignedTx, [this.addressPrivateKey]); + const signatures = await this.childChain.signTransaction(unsignedTx);//, [this.addressPrivateKey]); const signedTx = await this.childChain.buildSignedTransaction(unsignedTx, signatures); @@ -159,11 +173,11 @@ export default class BaseEmbarkOmg { const message = `Successfully submitted tx on the child chain: ${JSON.stringify(result)}\nView the transaction: http://quest.ari.omg.network/transaction/${result.txhash}`; - this.logger.info(message); + //this.logger.info(message); return message; } catch (e) { - this.logger.error(e); + // this.logger.error(e); throw e; } } @@ -191,12 +205,12 @@ export default class BaseEmbarkOmg { } ); const message = `Exited UTXO from address ${fromAddress} with value ${utxo.amount}. View the transaction: https://rinkeby.etherscan.io/tx/${receipt.transactionHash}`; - this.logger.info(message); + // this.logger.info(message); return message; } catch (e) { const message = `Error exiting the Plasma chain for UTXO ${JSON.stringify(utxo)}: ${e}`; - this.logger.error(message); + // this.logger.error(message); errors.push(message); } }); From 07c245dbbb4e2325478713d610dda77fa5cc51b6 Mon Sep 17 00:00:00 2001 From: emizzle Date: Wed, 12 Jun 2019 16:43:03 +1000 Subject: [PATCH 2/4] Migrate to v0.2 Samrong --- package.json | 11 +-- src/index.js | 265 +++++++++++++++++++++++++++++++-------------------- src/utils.js | 106 +++++++++++++++++++++ yarn.lock | 143 ++++----------------------- 4 files changed, 295 insertions(+), 230 deletions(-) create mode 100644 src/utils.js diff --git a/package.json b/package.json index a9c49b7..6d49a46 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,10 @@ "dependencies": { "@babel/plugin-proposal-optional-chaining": "7.2.0", "@babel/runtime-corejs2": "7.3.1", - "@omisego/omg-js": "1.2.2", - "@omisego/omg-js-childchain": "1.2.1", - "@omisego/omg-js-rootchain": "1.2.2", - "@omisego/omg-js-util": "1.2.1", - "async": "3.0.1", - "axios": "0.19.0", - "ethers": "4.0.28" + "@omisego/omg-js": "2.0.0-v0.2", + "@omisego/omg-js-childchain": "2.0.0-v0.2", + "@omisego/omg-js-rootchain": "2.0.0-v0.2", + "@omisego/omg-js-util": "2.0.0-v0.2" }, "devDependencies": { "@babel/cli": "7.2.3", diff --git a/src/index.js b/src/index.js index 54efecf..d4a3d33 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,16 @@ -/* global EmbarkJS */ +/* global web3, ethereum */ +import { + confirmTransaction, + normalizeUrl, + selectUtxos, + signTypedData +} from "./utils"; import BigNumber from "bn.js"; import ChildChain from "@omisego/omg-js-childchain"; import RootChain from "@omisego/omg-js-rootchain"; import { transaction } from "@omisego/omg-js-util"; -const ACCOUNT_CONFIG_ERROR = "Blockchain accounts configuration is missing. To use the Embark-OMG plugin, you must configure blockchain accounts to use either a private key file, a private key, or a mnemonic."; -const ACCOUNT_BALANCE_ERROR = "The configured account does not have enough funds. Please make sure this account has Rinkeby ETH."; +const web3Options = { transactionConfirmationBlocks: 1 }; export default class BaseEmbarkOmg { constructor({ pluginConfig, logger }) { @@ -16,57 +21,61 @@ export default class BaseEmbarkOmg { this.addressPrivateKey = ""; this.maxDeposit = 0; - // plugin opts - this.plasmaContractAddress = pluginConfig.PLASMA_CONTRACT_ADDRESS; - //this.web3ProviderUrl = pluginConfig.WEB3_PROVIDER_URL; - this.watcherUrl = pluginConfig.WATCHER_URL; - this.childChainUrl = pluginConfig.CHILDCHAIN_URL; + this.plasmaContractAddress = + pluginConfig.PLASMA_CONTRACT_ADDRESS || + "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7"; + this.watcherUrl = normalizeUrl( + pluginConfig.WATCHER_URL || "https://watchersamrong.omg.network/" + ); + this.childChainUrl = normalizeUrl( + pluginConfig.CHILDCHAIN_URL || "https://samrong.omg.network/" + ); + this.childChainExplorerUrl = normalizeUrl( + pluginConfig.CHILDCHAIN_EXPLORER_URL || + "https://quest.samrong.omg.network" + ); } - async init(web3) { //}, web3Path) { + async initWeb3() { + if (window.ethereum) { + this.web3 = new Web3(window.ethereum, null, web3Options); + try { + // Request account access + await ethereum.enable(); + return true; + } catch (err) { + // User denied account access :( + console.error(err); + } + } else if (window.web3) { + this.web3 = new Web3(window.web3.currentProvider, null, web3Options); + return true; + } + // No web3... + return false; + } + + async init(web3) { + //}, web3Path) { try { if (this.initing) { const message = "Already intializing the Plasma chain, please wait..."; - //this.logger.error(message); throw new Error(message); } this.initing = true; - // if (!(accounts && accounts.length)) { - // //this.logger.error(ACCOUNT_CONFIG_ERROR); - // throw new Error(ACCOUNT_CONFIG_ERROR); + // if (!(await this.initWeb3())) { + this.web3 = web3; // } - //const { address, privateKey } = accounts[0]; - //this.address = address; - //this.addressPrivateKey = privateKey; - - // this.address = accounts[0]; - - - // init Web3 - // const web3Lib = web3Path ? require(web3Path) : Web3; - // this.web3 = new web3Lib(); - // if (!web3) { - // web3 = EmbarkJS.Blockchain.providers["web3"]; - // } - this.web3 = web3; let accounts = await this.web3.eth.getAccounts(); this.address = accounts.length > 1 ? accounts[1] : accounts[0]; // ignore the first account because it is our deployer account, we want the manually added account - - // if(!this.web3) { - // throw new Error("web3 cannot be found. Please ensure you have the 'embarkjs-connector-web3' plugin installed in your DApp."); - // } - // const web3Provider = new web3Lib.providers.HttpProvider(this.web3ProviderUrl); - //this.web3.setProvider(web3Provider); - // check account balance on the main chain // try { // this.maxDeposit = await this.web3.eth.getBalance(this.address); // if (!this.maxDeposit || new BigNumber(this.maxDeposit).lte(0)) { - // //this.logger.error(ACCOUNT_BALANCE_ERROR); - // throw new Error(ACCOUNT_BALANCE_ERROR); + // throw new Error("The configured account does not have enough funds. Please make sure this account has Rinkeby ETH."); // } // this.maxDeposit = new BigNumber(this.maxDeposit); // } @@ -76,29 +85,30 @@ export default class BaseEmbarkOmg { // set up the Plasma chain this.rootChain = new RootChain(this.web3, this.plasmaContractAddress); - this.childChain = new ChildChain(this.watcherUrl, this.childChainUrl); + this.childChain = new ChildChain(this.watcherUrl); //, this.childChainUrl); // set lifecycle state vars this.initing = false; this.inited = true; - } - catch (e) { + } catch (e) { const message = `Error initializing Plasma chain: ${e}`; - //this.logger.error(message); throw new Error(message); } } async deposit(amount) { + // TODO: Update this to support ERC-20's + const currency = transaction.ETH_CURRENCY; + const approveDeposit = false; + const erc20abi = {}; + if (!this.inited) { const message = "Please wait for the Plasma chain to initialize..."; - // this.logger.error(message); throw new Error(message); } amount = new BigNumber(amount); if (!amount || amount.lte(0)) { const message = "You must deposit more than 0 wei."; - // this.logger.error(message); throw new Error(message); } // if (amount.gt(this.maxDeposit) && this.maxDeposit.gt(0)) { @@ -106,38 +116,64 @@ export default class BaseEmbarkOmg { // this.maxDeposit = await this.web3.eth.getBalance(this.address); // if (amount.gt(this.maxDeposit)) { // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.address} and then try again.`; - // // this.logger.error(message); // throw new Error(message); // } // } - // const DEPOSIT_AMT = "100000"; - this.logger.info(`Depositing ${amount} wei...`); - const depositTx = transaction.encodeDeposit(this.address, amount, transaction.ETH_CURRENCY); - try { - const receipt = await this.rootChain.depositEth(depositTx, amount, { from: this.address });//, privateKey: this.addressPrivateKey }); - this.logger.trace(receipt); - const message = `Successfully deposited ${amount} wei in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${receipt.transactionHash}`; - // this.logger.info(message); - return message; + // Create the deposit transaction + const depositTx = transaction.encodeDeposit(this.address, amount, currency); + + if (currency === transaction.ETH_CURRENCY) { + this.logger.info(`Depositing ${amount} wei...`); + // ETH deposit + try { + const receipt = await this.rootChain.depositEth(depositTx, amount, { + from: this.address + }); + this.logger.trace(receipt); + const message = `Successfully deposited ${amount} wei in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${ + receipt.transactionHash + }`; + return message; + } catch (e) { + const message = `Error depositing ${amount} wei: ${e}`; + throw new Error(message); + } } - catch (e) { - const message = `Error depositing ${amount} wei: ${e}`; - // this.logger.error(message); - throw new Error(message); + + // ERC20 token deposit + if (approveDeposit) { + // First approve the plasma contract on the erc20 contract + const erc20 = new this.web3.eth.Contract(erc20abi, currency); + // const approvePromise = Promise.promisify(erc20.approve.sendTransaction) + + // TODO + const gasPrice = 1000000; + const receipt = await erc20.methods + .approve(this.rootChain.plasmaContractAddress, amount) + .send({ from: this.address, gasPrice, gas: 2000000 }); + // Wait for the approve tx to be mined + this.logger.info( + `${amount} erc20 approved: ${ + receipt.transactionHash + }. Waiting for confirmation...` + ); + await confirmTransaction(this.web3, receipt.transactionHash); + this.logger.info(`... ${receipt.transactionHash} confirmed.`); } + + return this.rootChain.depositToken(depositTx, { from: this.address }); } - async send(toAddress, val) { - //const val = "555"; - // const toAddress = "0x38d5beb778b6e62d82e3ba4633e08987e6d0f990"; + async transfer(toAddress, amount) { + // TODO: Update this to support ERC20's + const currency = transaction.ETH_CURRENCY; + const verifyingContract = this.plasmaContractAddress; + + const transferZeroFee = currency !== transaction.ETH_CURRENCY; const utxos = await this.childChain.getUtxos(this.address); - const utxosToSpend = this.selectUtxos(utxos, val, transaction.ETH_CURRENCY); + const utxosToSpend = selectUtxos(utxos, amount, currency, transferZeroFee); if (!utxosToSpend) { - throw new Error(`No utxo big enough to cover the amount ${val}`); - } - val = new BigNumber(val); - if (!val || val.lte(0)) { - throw new Error("Transaction value must be more than 0 wei."); + throw new Error(`No utxo big enough to cover the amount ${amount}`); } const txBody = { @@ -145,72 +181,97 @@ export default class BaseEmbarkOmg { outputs: [ { owner: toAddress, - currency: transaction.ETH_CURRENCY, - amount: val + currency, + amount: amount.toString() } ] }; - const utxoAmnt = new BigNumber(utxosToSpend[0].amount); - if (utxoAmnt.gt(val)) { - // specify the change amount back to yourself - const changeAmnt = utxoAmnt.sub(val); + const bnAmount = new BigNumber(utxosToSpend[0].amount); + if (bnAmount.gt(new BigNumber(amount))) { + // Need to add a 'change' output + const CHANGE_AMOUNT = bnAmount.sub(new BigNumber(amount)); txBody.outputs.push({ owner: this.address, - currency: transaction.ETH_CURRENCY, - amount: changeAmnt + currency, + amount: CHANGE_AMOUNT }); } - try { - const unsignedTx = await this.childChain.createTransaction(txBody); - - const signatures = await this.childChain.signTransaction(unsignedTx);//, [this.addressPrivateKey]); - - const signedTx = await this.childChain.buildSignedTransaction(unsignedTx, signatures); - - const result = await this.childChain.submitTransaction(signedTx); - - const message = `Successfully submitted tx on the child chain: ${JSON.stringify(result)}\nView the transaction: http://quest.ari.omg.network/transaction/${result.txhash}`; - - //this.logger.info(message); - return message; - } - catch (e) { - // this.logger.error(e); - throw e; + if (transferZeroFee && utxosToSpend.length > 1) { + // The fee input can be returned + txBody.outputs.push({ + owner: this.address, + currency: utxosToSpend[utxosToSpend.length - 1].currency, + amount: utxosToSpend[utxosToSpend.length - 1].amount + }); } + + // Get the transaction data + const typedData = transaction.getTypedData(txBody, verifyingContract); + + // We should really sign each input separately but in this we know that they're all + // from the same address, so we can sign once and use that signature for each input. + // + // const sigs = await Promise.all(utxosToSpend.map(input => signTypedData(web3, web3.utils.toChecksumAddress(from), typedData))) + // + const signature = await signTypedData( + this.web3, + this.web3.utils.toChecksumAddress(this.address), + JSON.stringify(typedData) + ); + // const signer = this.web3.utils.toChecksumAddress(this.address); + // const data = JSON.stringify(typedData); + // const signature = this.web3.currentProvider.send("eth_signTypedData_v3", [ + // signer, + // data + // ]); + const sigs = new Array(utxosToSpend.length).fill(signature); + + // Build the signed transaction + const signedTx = this.childChain.buildSignedTransaction(typedData, sigs); + // Submit the signed transaction to the childchain + const result = await this.childChain.submitTransaction(signedTx); + + const message = `Successfully submitted tx on the child chain: ${JSON.stringify( + result + )}\nView the transaction: ${this.childChainExplorerUrl}transaction/${ + result.txhash + }`; + + return message; } async exit(fromAddress) { const utxos = await this.childChain.getUtxos(fromAddress); if (utxos.length <= 0) { const message = `No UTXOs found on the Plasma chain for ${fromAddress}.`; - this.logger.error(message); throw new Error(message); } // NB This only exits the first UTXO. // Selecting _which_ UTXO to exit is left as an exercise for the reader... const errors = []; - utxos.forEach(async (utxo) => { + utxos.forEach(async utxo => { const exitData = await this.childChain.getExitData(utxo); try { let receipt = await this.rootChain.startStandardExit( - exitData.utxo_pos.toString(), + Number(exitData.utxo_pos.toString()), exitData.txbytes, exitData.proof, { from: fromAddress } ); - const message = `Exited UTXO from address ${fromAddress} with value ${utxo.amount}. View the transaction: https://rinkeby.etherscan.io/tx/${receipt.transactionHash}`; - // this.logger.info(message); - return message; - } - catch (e) { - const message = `Error exiting the Plasma chain for UTXO ${JSON.stringify(utxo)}: ${e}`; - // this.logger.error(message); + return `Exited UTXO from address ${fromAddress} with value ${ + utxo.amount + }. View the transaction: https://rinkeby.etherscan.io/tx/${ + receipt.transactionHash + }`; + } catch (e) { + const message = `Error exiting the Plasma chain for UTXO ${JSON.stringify( + utxo + )}: ${e}`; errors.push(message); } }); @@ -222,7 +283,9 @@ export default class BaseEmbarkOmg { selectUtxos(utxos, amount, currency) { const correctCurrency = utxos.filter(utxo => utxo.currency === currency); // Just find the first utxo that can fulfill the amount - const selected = correctCurrency.find(utxo => new BigNumber(utxo.amount).gte(new BigNumber(amount))); + const selected = correctCurrency.find(utxo => + new BigNumber(utxo.amount).gte(new BigNumber(amount)) + ); if (selected) { return [selected]; } diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..76c14c3 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,106 @@ +import BigNumber from "bn.js"; +import { transaction } from "@omisego/omg-js-util"; + +const DEFAULT_INTERVAL = 1000; +const DEFAULT_BLOCKS_TO_WAIT = 1; + +export function confirmTransaction(web3, txnHash, options) { + const interval = options && options.interval ? options.interval : DEFAULT_INTERVAL; + const blocksToWait = options && options.blocksToWait ? options.blocksToWait : DEFAULT_BLOCKS_TO_WAIT; + const transactionReceiptAsync = async function (txnHash, resolve, reject) { + try { + const receipt = await web3.eth.getTransactionReceipt(txnHash); + if (!receipt) { + return setTimeout(function () { + transactionReceiptAsync(txnHash, resolve, reject); + }, interval); + } + if (blocksToWait > 0) { + const resolvedReceipt = await receipt; + if (!resolvedReceipt || !resolvedReceipt.blockNumber) { + return setTimeout(function () { + transactionReceiptAsync(txnHash, resolve, reject); + }, interval); + } + try { + const block = await web3.eth.getBlock(resolvedReceipt.blockNumber); + const current = await web3.eth.getBlock('latest'); + if (current.number - block.number >= blocksToWait) { + const txn = await web3.eth.getTransaction(txnHash); + // eslint-disable-next-line max-depth + if (txn.blockNumber !== null) { + return resolve(resolvedReceipt); + } + return reject(new Error('Transaction with hash: ' + txnHash + ' ended up in an uncle block.')); + } + return setTimeout(function () { + transactionReceiptAsync(txnHash, resolve, reject); + }, interval); + } catch (e) { + setTimeout(function () { + transactionReceiptAsync(txnHash, resolve, reject); + }, interval); + } + } else resolve(receipt); + + } catch (e) { + reject(e); + } + }; + if (Array.isArray(txnHash)) { + const promises = []; + txnHash.forEach(function (oneTxHash) { + promises.push(confirmTransaction(web3, oneTxHash, options)); + }); + return Promise.all(promises); + } + return new Promise(function (resolve, reject) { + transactionReceiptAsync(txnHash, resolve, reject); + }); +} + +export function selectUtxos(utxos, amount, currency, includeFee) { + // Filter by desired currency and sort in descending order + const sorted = utxos + .filter(utxo => utxo.currency === currency) + .sort((a, b) => new BigNumber(b.amount).sub(new BigNumber(a.amount))); + + if (sorted) { + const selected = []; + let currentBalance = new BigNumber(0); + for (let i = 0; i < Math.min(sorted.length, 4); i++) { + selected.push(sorted[i]); + currentBalance.iadd(new BigNumber(sorted[i].amount)); + if (currentBalance.gte(new BigNumber(amount))) { + break; + } + } + + if (currentBalance.gte(new BigNumber(amount))) { + if (includeFee) { + // Find the first ETH utxo (that's not selected) + const ethUtxos = utxos.filter( + utxo => utxo.currency === transaction.ETH_CURRENCY + ); + const feeUtxo = ethUtxos.find(utxo => utxo !== selected); + if (!feeUtxo) { + throw new Error(`Can't find a fee utxo for transaction`); + } else { + selected.push(feeUtxo); + } + } + return selected; + } + } +} + +export function signTypedData (web3, signer, data) { + return web3.currentProvider.send('eth_signTypedData_v3', [signer, data]); +} + +export function normalizeUrl (url) { + if(!url.endsWith("/")) { + url += "/"; + } + return url; +} diff --git a/yarn.lock b/yarn.lock index 2bc6a2a..6a66c73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -694,29 +694,29 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" -"@omisego/omg-js-childchain@1.2.1", "@omisego/omg-js-childchain@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@omisego/omg-js-childchain/-/omg-js-childchain-1.2.1.tgz#7fd83af2e47ae7936fd9743c5a98244c89f64222" - integrity sha512-UuYc0w8xTZPceDUnuWXV46MhPMUmu9+ecTbEh0sd5YSx9N9ie+t2FRikvvTH9g4+GBmQRoI0XCkFBU/pW3SJkA== +"@omisego/omg-js-childchain@2.0.0-v0.2", "@omisego/omg-js-childchain@^2.0.0-v0.2": + version "2.0.0-v0.2" + resolved "https://registry.yarnpkg.com/@omisego/omg-js-childchain/-/omg-js-childchain-2.0.0-v0.2.tgz#d2c2e1af48a8c00a68902db6107e1da824701b86" + integrity sha512-hz9U2xPg/xFbdBxUIqXfDjfA8JKIegMnG757d6b3h3Ot2kGvPL+0GK59JoMYwOG64J5uaco5HZ7NnnGfjQ5Aqw== dependencies: - "@omisego/omg-js-util" "^1.2.1" + "@omisego/omg-js-util" "^2.0.0-v0.2" debug "^4.0.1" json-bigint "^0.3.0" node-fetch "^2.2.0" rlp "^2.1.0" -"@omisego/omg-js-rootchain@1.2.2", "@omisego/omg-js-rootchain@^1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@omisego/omg-js-rootchain/-/omg-js-rootchain-1.2.2.tgz#630ad267f0ad6b2e44098790be9acb8816413032" - integrity sha512-vgyVfUDnyVeoe0XUv7hM13kHXqdJyEghqHEV07GyTr69QfzbFfTe9jzMceLAb5f+4Y/E5gLgU1Vqlt7lNGctUQ== +"@omisego/omg-js-rootchain@2.0.0-v0.2", "@omisego/omg-js-rootchain@^2.0.0-v0.2": + version "2.0.0-v0.2" + resolved "https://registry.yarnpkg.com/@omisego/omg-js-rootchain/-/omg-js-rootchain-2.0.0-v0.2.tgz#05ebbe6ee4e583a25f26c041a8d52b1084857b8c" + integrity sha512-QRsipPvozaImfO8ifPOh9w/GmOHT9hr9mdBWtRtZ3AqBOru10QG9gHF9vSQTsCDjr0jsAnoqHC/s/wuuDVfvbg== dependencies: - "@omisego/omg-js-util" "^1.2.1" + "@omisego/omg-js-util" "^2.0.0-v0.2" debug "^4.0.1" -"@omisego/omg-js-util@1.2.1", "@omisego/omg-js-util@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@omisego/omg-js-util/-/omg-js-util-1.2.1.tgz#7495f6835681a3096cc54dabb8c0495bc37d22ec" - integrity sha512-14YTB/hycMSgGnZ/SLKiu0KA9qqwc7mTvyGfO6VE2DonX6uDrYRqmbWX0wDnk3A1hWoVLPiqG7CLBNbkOnhsKg== +"@omisego/omg-js-util@2.0.0-v0.2", "@omisego/omg-js-util@^2.0.0-v0.2": + version "2.0.0-v0.2" + resolved "https://registry.yarnpkg.com/@omisego/omg-js-util/-/omg-js-util-2.0.0-v0.2.tgz#30b5882cc8a45446e7206576240caade614c8590" + integrity sha512-J5J5Q2XC7ZkpfQJiXJxii/66Tn3x4rhnhky3BmL++XEBoK6I34wgWMs/7dzsejWNHmmhGv/M/OZb+QBI+HlvlA== dependencies: eth-sig-util "^2.1.1" ethereumjs-util "^6.0.0" @@ -724,19 +724,14 @@ number-to-bn "^1.7.0" rlp "^2.2.2" -"@omisego/omg-js@1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@omisego/omg-js/-/omg-js-1.2.2.tgz#3d7b8a179953307f1d34a321730572760f21b4e0" - integrity sha512-nnaL80FEtv+4yAocXV9qyJr3yNOGKdVNFiB2ehIdHuEx3YTy5yPc7+E4RqQSYcCm3iev7GdxTtSd9bSXGZ2lNQ== +"@omisego/omg-js@2.0.0-v0.2": + version "2.0.0-v0.2" + resolved "https://registry.yarnpkg.com/@omisego/omg-js/-/omg-js-2.0.0-v0.2.tgz#cd50f0e2ccc4beca75b0e01b9b1ad2a126ec3103" + integrity sha512-eMAjn50+bX2uyzghlyXbSFV/2tcAA5wqD8Q3pZTXvUT9U6QZBcfsu6fUTV56vNJT8KqAdCl2Rma3PKeB80IB9Q== dependencies: - "@omisego/omg-js-childchain" "^1.2.1" - "@omisego/omg-js-rootchain" "^1.2.2" - "@omisego/omg-js-util" "^1.2.1" - -"@types/node@^10.3.2": - version "10.14.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.7.tgz#1854f0a9aa8d2cd6818d607b3d091346c6730362" - integrity sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A== + "@omisego/omg-js-childchain" "^2.0.0-v0.2" + "@omisego/omg-js-rootchain" "^2.0.0-v0.2" + "@omisego/omg-js-util" "^2.0.0-v0.2" abbrev@1: version "1.1.1" @@ -760,11 +755,6 @@ acorn@^5.5.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= - ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" @@ -880,24 +870,11 @@ async-each@^1.0.1: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/async/-/async-3.0.1.tgz#dfeb34657d1e63c94c0eee424297bf8a2c9a8182" - integrity sha512-ZswD8vwPtmBZzbn9xyi8XBQWXH3AvOQ43Za1KWYq7JeycrZuUYzx01KvHcVbXltjqH4y0MWrQ33008uLTqXuDw== - atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -axios@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8" - integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ== - dependencies: - follow-redirects "1.5.10" - is-buffer "^2.0.2" - babel-code-frame@^6.22.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -1348,13 +1325,6 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -debug@=3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== - dependencies: - ms "2.0.0" - debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -1451,16 +1421,6 @@ electron-to-chromium@^1.3.137: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.139.tgz#17a149701d934bbb91d2aa4ae09e5270c38dc0ff" integrity sha512-8cR7h6doIC/XLgPdsTM3BXpfWLzqrHS6jWrvWLsdZWZWFvVQQUJTbU/wUZsjRGK33OY5ZIiS1n6JbqowuWrmYg== -elliptic@6.3.3: - version "6.3.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f" - integrity sha1-VILZZG1UvLif19mU/J4ulWiHbj8= - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - inherits "^2.0.1" - elliptic@^6.4.0, elliptic@^6.4.1: version "6.4.1" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" @@ -1658,22 +1618,6 @@ ethereumjs-util@^6.0.0: safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethers@4.0.28: - version "4.0.28" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.28.tgz#74d9acb57f4ede3337c8d60476b38d0fe646af01" - integrity sha512-5JTHrPoFLqf+xCAI3pKwXSOgWBSJJoAUdPtPLr1ZlKbSKiIFMkPlRNovmZS3jhIw5sHW1YoVWOaJ6ZR2gKRbwg== - dependencies: - "@types/node" "^10.3.2" - aes-js "3.0.0" - bn.js "^4.4.0" - elliptic "6.3.3" - hash.js "1.1.3" - js-sha3 "0.5.7" - scrypt-js "2.0.4" - setimmediate "1.0.4" - uuid "2.0.1" - xmlhttprequest "1.8.0" - ethjs-util@0.1.6, ethjs-util@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -1796,13 +1740,6 @@ flat-cache@^1.2.1: rimraf "~2.6.2" write "^0.2.1" -follow-redirects@1.5.10: - version "1.5.10" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" - integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== - dependencies: - debug "=3.1.0" - for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1967,14 +1904,6 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" -hash.js@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" - integrity sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.0" - hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -2110,11 +2039,6 @@ is-buffer@^1.1.5: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-buffer@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" - integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== - is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" @@ -2285,11 +2209,6 @@ js-levenshtein@^1.1.3: resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== -js-sha3@0.5.7: - version "0.5.7" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" - integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= - js-sha3@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.6.1.tgz#5b89f77a7477679877f58c4a075240934b1f95c0" @@ -3158,11 +3077,6 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -scrypt-js@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" - integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== - secp256k1@^3.0.1: version "3.7.0" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.7.0.tgz#e85972f847b586cc4b2acd69497d3f80afaa7505" @@ -3212,11 +3126,6 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.4.tgz#20e81de622d4a02588ce0c8da8973cbcf1d3138f" - integrity sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48= - sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" @@ -3604,11 +3513,6 @@ util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -uuid@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" - integrity sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w= - validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -3648,11 +3552,6 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -xmlhttprequest@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" - integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= - yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" From 46fb2903b708f482b1c2b0c67fb28f1e5d4995b4 Mon Sep 17 00:00:00 2001 From: emizzle Date: Thu, 13 Jun 2019 18:28:44 +1000 Subject: [PATCH 3/4] Cleanup, start adding helper funcs (WIP) --- package.json | 3 +- src/index.js | 148 ++++++++++++++++++++++----------------------------- yarn.lock | 5 ++ 3 files changed, 71 insertions(+), 85 deletions(-) diff --git a/package.json b/package.json index 6d49a46..306a85c 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "@omisego/omg-js": "2.0.0-v0.2", "@omisego/omg-js-childchain": "2.0.0-v0.2", "@omisego/omg-js-rootchain": "2.0.0-v0.2", - "@omisego/omg-js-util": "2.0.0-v0.2" + "@omisego/omg-js-util": "2.0.0-v0.2", + "human-standard-token-abi": "2.0.0" }, "devDependencies": { "@babel/cli": "7.2.3", diff --git a/src/index.js b/src/index.js index d4a3d33..8d32ebf 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -/* global web3, ethereum */ import { confirmTransaction, normalizeUrl, @@ -9,6 +8,7 @@ import BigNumber from "bn.js"; import ChildChain from "@omisego/omg-js-childchain"; import RootChain from "@omisego/omg-js-rootchain"; import { transaction } from "@omisego/omg-js-util"; +const erc20abi = require("human-standard-token-abi"); const web3Options = { transactionConfirmationBlocks: 1 }; @@ -17,70 +17,43 @@ export default class BaseEmbarkOmg { this.logger = logger; this.initing = false; this.inited = false; - this.address = ""; - this.addressPrivateKey = ""; + this.account = { + address: "", + rootBalance: 0, + childBalance: 0 + }; + this.account.addressPrivateKey = ""; this.maxDeposit = 0; // plugin opts - this.plasmaContractAddress = - pluginConfig.PLASMA_CONTRACT_ADDRESS || - "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7"; - this.watcherUrl = normalizeUrl( - pluginConfig.WATCHER_URL || "https://watchersamrong.omg.network/" - ); - this.childChainUrl = normalizeUrl( - pluginConfig.CHILDCHAIN_URL || "https://samrong.omg.network/" - ); - this.childChainExplorerUrl = normalizeUrl( - pluginConfig.CHILDCHAIN_EXPLORER_URL || - "https://quest.samrong.omg.network" - ); - } - - async initWeb3() { - if (window.ethereum) { - this.web3 = new Web3(window.ethereum, null, web3Options); - try { - // Request account access - await ethereum.enable(); - return true; - } catch (err) { - // User denied account access :( - console.error(err); - } - } else if (window.web3) { - this.web3 = new Web3(window.web3.currentProvider, null, web3Options); - return true; - } - // No web3... - return false; + this.plasmaContractAddress = pluginConfig.PLASMA_CONTRACT_ADDRESS || "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7"; + this.watcherUrl = normalizeUrl(pluginConfig.WATCHER_URL || "https://watcher.samrong.omg.network/"); + this.childChainUrl = normalizeUrl(pluginConfig.CHILDCHAIN_URL || "https://samrong.omg.network/"); + this.childChainExplorerUrl = normalizeUrl(pluginConfig.CHILDCHAIN_EXPLORER_URL || "https://quest.samrong.omg.network"); } async init(web3) { - //}, web3Path) { - try { if (this.initing) { const message = "Already intializing the Plasma chain, please wait..."; throw new Error(message); } this.initing = true; + this.web3 = web3; - // if (!(await this.initWeb3())) { - this.web3 = web3; - // } let accounts = await this.web3.eth.getAccounts(); - this.address = accounts.length > 1 ? accounts[1] : accounts[0]; // ignore the first account because it is our deployer account, we want the manually added account + const address = accounts.length > 1 ? accounts[1] : accounts[0]; // ignore the first account because it is our deployer account, we want the manually added account + this.account.address = address; // check account balance on the main chain // try { - // this.maxDeposit = await this.web3.eth.getBalance(this.address); + // this.maxDeposit = await this.web3.eth.getBalance(this.account.address); // if (!this.maxDeposit || new BigNumber(this.maxDeposit).lte(0)) { // throw new Error("The configured account does not have enough funds. Please make sure this account has Rinkeby ETH."); // } // this.maxDeposit = new BigNumber(this.maxDeposit); // } // catch (e) { - // this.logger.warn(`Error getting balance for account ${this.address}: ${e}`); + // this.logger.warn(`Error getting balance for account ${this.account.address}: ${e}`); // } // set up the Plasma chain @@ -113,26 +86,24 @@ export default class BaseEmbarkOmg { } // if (amount.gt(this.maxDeposit) && this.maxDeposit.gt(0)) { // // recheck balance in case it was updated in a recent tx - // this.maxDeposit = await this.web3.eth.getBalance(this.address); + // this.maxDeposit = await this.web3.eth.getBalance(this.account.address); // if (amount.gt(this.maxDeposit)) { - // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.address} and then try again.`; + // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.account.address} and then try again.`; // throw new Error(message); // } // } // Create the deposit transaction - const depositTx = transaction.encodeDeposit(this.address, amount, currency); + const depositTx = transaction.encodeDeposit(this.account.address, amount, currency); if (currency === transaction.ETH_CURRENCY) { this.logger.info(`Depositing ${amount} wei...`); // ETH deposit try { - const receipt = await this.rootChain.depositEth(depositTx, amount, { - from: this.address - }); + const receipt = await this.rootChain.depositEth(depositTx, amount, { from: this.account.address }); this.logger.trace(receipt); const message = `Successfully deposited ${amount} wei in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${ receipt.transactionHash - }`; + }`; return message; } catch (e) { const message = `Error depositing ${amount} wei: ${e}`; @@ -150,18 +121,14 @@ export default class BaseEmbarkOmg { const gasPrice = 1000000; const receipt = await erc20.methods .approve(this.rootChain.plasmaContractAddress, amount) - .send({ from: this.address, gasPrice, gas: 2000000 }); + .send({ from: this.account.address, gasPrice, gas: 2000000 }); // Wait for the approve tx to be mined - this.logger.info( - `${amount} erc20 approved: ${ - receipt.transactionHash - }. Waiting for confirmation...` - ); + this.logger.info(`${amount} erc20 approved: ${receipt.transactionHash}. Waiting for confirmation...`); await confirmTransaction(this.web3, receipt.transactionHash); this.logger.info(`... ${receipt.transactionHash} confirmed.`); } - return this.rootChain.depositToken(depositTx, { from: this.address }); + return this.rootChain.depositToken(depositTx, { from: this.account.address }); } async transfer(toAddress, amount) { @@ -169,9 +136,7 @@ export default class BaseEmbarkOmg { const currency = transaction.ETH_CURRENCY; const verifyingContract = this.plasmaContractAddress; - const transferZeroFee = currency !== transaction.ETH_CURRENCY; - const utxos = await this.childChain.getUtxos(this.address); - const utxosToSpend = selectUtxos(utxos, amount, currency, transferZeroFee); + const utxosToSpend = await selectUtxos(amount, currency); if (!utxosToSpend) { throw new Error(`No utxo big enough to cover the amount ${amount}`); } @@ -192,16 +157,16 @@ export default class BaseEmbarkOmg { // Need to add a 'change' output const CHANGE_AMOUNT = bnAmount.sub(new BigNumber(amount)); txBody.outputs.push({ - owner: this.address, + owner: this.account.address, currency, amount: CHANGE_AMOUNT }); } - if (transferZeroFee && utxosToSpend.length > 1) { + if (currency !== transaction.ETH_CURRENCY && utxosToSpend.length > 1) { // The fee input can be returned txBody.outputs.push({ - owner: this.address, + owner: this.account.address, currency: utxosToSpend[utxosToSpend.length - 1].currency, amount: utxosToSpend[utxosToSpend.length - 1].amount }); @@ -217,15 +182,10 @@ export default class BaseEmbarkOmg { // const signature = await signTypedData( this.web3, - this.web3.utils.toChecksumAddress(this.address), + this.web3.utils.toChecksumAddress(this.account.address), JSON.stringify(typedData) ); - // const signer = this.web3.utils.toChecksumAddress(this.address); - // const data = JSON.stringify(typedData); - // const signature = this.web3.currentProvider.send("eth_signTypedData_v3", [ - // signer, - // data - // ]); + const sigs = new Array(utxosToSpend.length).fill(signature); // Build the signed transaction @@ -237,7 +197,7 @@ export default class BaseEmbarkOmg { result )}\nView the transaction: ${this.childChainExplorerUrl}transaction/${ result.txhash - }`; + }`; return message; } @@ -248,8 +208,6 @@ export default class BaseEmbarkOmg { const message = `No UTXOs found on the Plasma chain for ${fromAddress}.`; throw new Error(message); } - // NB This only exits the first UTXO. - // Selecting _which_ UTXO to exit is left as an exercise for the reader... const errors = []; utxos.forEach(async utxo => { const exitData = await this.childChain.getExitData(utxo); @@ -265,9 +223,9 @@ export default class BaseEmbarkOmg { ); return `Exited UTXO from address ${fromAddress} with value ${ utxo.amount - }. View the transaction: https://rinkeby.etherscan.io/tx/${ + }. View the transaction: https://rinkeby.etherscan.io/tx/${ receipt.transactionHash - }`; + }`; } catch (e) { const message = `Error exiting the Plasma chain for UTXO ${JSON.stringify( utxo @@ -280,14 +238,36 @@ export default class BaseEmbarkOmg { } } - selectUtxos(utxos, amount, currency) { - const correctCurrency = utxos.filter(utxo => utxo.currency === currency); - // Just find the first utxo that can fulfill the amount - const selected = correctCurrency.find(utxo => - new BigNumber(utxo.amount).gte(new BigNumber(amount)) - ); - if (selected) { - return [selected]; - } + async selectUtxos(amount, currency) { + const transferZeroFee = currency !== transaction.ETH_CURRENCY; + const utxos = await this.childChain.getUtxos(this.account.address); + return selectUtxos(utxos, amount, currency, transferZeroFee); + } + + async getTransactions() { + return this.childChain.getTransactions({ + address: this.account.address + }); + } + + async getBalances() { + this.account.rootBalance = await this.web3.eth.getBalance(this.account.address); + + const childchainBalance = await this.childChain.getBalance(this.account.address); + this.account.childBalance = await Promise.all(childchainBalance.map( + async (balance) => { + if (balance.currency === transaction.ETH_CURRENCY) { + balance.symbol = 'wei'; + } else { + const tokenContract = new this.web3.eth.Contract(erc20abi, balance.currency); + try { + balance.symbol = await tokenContract.methods.symbol().call(); + } catch (err) { + balance.symbol = 'Unknown ERC20'; + } + } + return balance; + } + )) } } diff --git a/yarn.lock b/yarn.lock index 6a66c73..369773a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1926,6 +1926,11 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== +human-standard-token-abi@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/human-standard-token-abi/-/human-standard-token-abi-2.0.0.tgz#e0c2057596d0a1d4a110f91f974a37f4b904f008" + integrity sha512-m1f5DiIvqaNmpgphNqx2OziyTCj4Lvmmk28uMSxGWrOc9/lMpAKH8UcMPhvb13DMNZPzxn07WYFhxOGKuPLryg== + iconv-lite@^0.4.17, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" From 7dfe7df6b44b00053dff5fb0dadea0cd2ab58129 Mon Sep 17 00:00:00 2001 From: emizzle Date: Mon, 17 Jun 2019 12:35:55 +1000 Subject: [PATCH 4/4] Refactor to include state and web3 web3 was added as a specific version is needed to support EIP-712. Refactor to include plugin state for consumption on the frontend. --- package.json | 9 +- src/index.js | 175 ++++++++----- src/utils.js | 8 +- yarn.lock | 685 ++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 797 insertions(+), 80 deletions(-) diff --git a/package.json b/package.json index 306a85c..7201d20 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "embarkjs-omg", + "name": "embarkjs-plasma", "version": "1.0.0", - "description": "EmbarkJS library for the OmiseGO plugin for Embark", + "description": "EmbarkJS library for the OmiseGO Plasma plugin for Embark", "main": "dist/index.js", "browser": { "./dist/index.js": "./dist/browser/index.js", @@ -54,7 +54,8 @@ "@omisego/omg-js-childchain": "2.0.0-v0.2", "@omisego/omg-js-rootchain": "2.0.0-v0.2", "@omisego/omg-js-util": "2.0.0-v0.2", - "human-standard-token-abi": "2.0.0" + "human-standard-token-abi": "2.0.0", + "web3": "1.0.0-beta.55" }, "devDependencies": { "@babel/cli": "7.2.3", @@ -77,4 +78,4 @@ "npm": ">=6.4.1", "yarn": ">=1.12.3" } -} +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 8d32ebf..5d729e2 100644 --- a/src/index.js +++ b/src/index.js @@ -7,73 +7,86 @@ import { import BigNumber from "bn.js"; import ChildChain from "@omisego/omg-js-childchain"; import RootChain from "@omisego/omg-js-rootchain"; -import { transaction } from "@omisego/omg-js-util"; -const erc20abi = require("human-standard-token-abi"); +import Web3 from "web3"; +import {transaction} from "@omisego/omg-js-util"; +const ERC20_ABI = require("human-standard-token-abi"); -const web3Options = { transactionConfirmationBlocks: 1 }; +const web3Options = {transactionConfirmationBlocks: 1}; -export default class BaseEmbarkOmg { - constructor({ pluginConfig, logger }) { +export default class EmbarkJSPlasma { + constructor({pluginConfig, logger}) { this.logger = logger; this.initing = false; this.inited = false; - this.account = { - address: "", - rootBalance: 0, - childBalance: 0 - }; - this.account.addressPrivateKey = ""; + this.currentAddress = ""; this.maxDeposit = 0; + this.state = { + account: { + address: "", + rootBalance: 0, + childBalance: 0 + }, + transactions: [], + utxos: [] + }; + this.rootChain = null; + this.childChain = null; // plugin opts - this.plasmaContractAddress = pluginConfig.PLASMA_CONTRACT_ADDRESS || "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7"; - this.watcherUrl = normalizeUrl(pluginConfig.WATCHER_URL || "https://watcher.samrong.omg.network/"); - this.childChainUrl = normalizeUrl(pluginConfig.CHILDCHAIN_URL || "https://samrong.omg.network/"); - this.childChainExplorerUrl = normalizeUrl(pluginConfig.CHILDCHAIN_EXPLORER_URL || "https://quest.samrong.omg.network"); + this.config = { + plasmaContractAddress: pluginConfig.PLASMA_CONTRACT_ADDRESS || "0x740ecec4c0ee99c285945de8b44e9f5bfb71eea7", + watcherUrl: normalizeUrl(pluginConfig.WATCHER_URL || "https://watcher.samrong.omg.network/"), + childChainUrl: normalizeUrl(pluginConfig.CHILDCHAIN_URL || "https://samrong.omg.network/"), + childChainExplorerUrl: normalizeUrl(pluginConfig.CHILDCHAIN_EXPLORER_URL || "https://quest.samrong.omg.network") + }; } - async init(web3) { + async init(web3, useGivenWeb3 = false) { try { if (this.initing) { const message = "Already intializing the Plasma chain, please wait..."; throw new Error(message); } this.initing = true; - this.web3 = web3; + if (useGivenWeb3) { + this.web3 = web3; + } + else { + this.web3 = new Web3(web3.currentProvider, null, web3Options); + } + + // set up the Plasma chain + this.rootChain = new RootChain(this.web3, this.config.plasmaContractAddress); + this.childChain = new ChildChain(this.config.watcherUrl); //, this.config.childChainUrl); let accounts = await this.web3.eth.getAccounts(); const address = accounts.length > 1 ? accounts[1] : accounts[0]; // ignore the first account because it is our deployer account, we want the manually added account - this.account.address = address; + this.currentAddress = address; + // check account balance on the main chain // try { - // this.maxDeposit = await this.web3.eth.getBalance(this.account.address); + // this.maxDeposit = await this.web3.eth.getBalance(this.currentAddress); // if (!this.maxDeposit || new BigNumber(this.maxDeposit).lte(0)) { // throw new Error("The configured account does not have enough funds. Please make sure this account has Rinkeby ETH."); // } // this.maxDeposit = new BigNumber(this.maxDeposit); // } // catch (e) { - // this.logger.warn(`Error getting balance for account ${this.account.address}: ${e}`); + // this.logger.warn(`Error getting balance for account ${this.currentAddress}: ${e}`); // } - // set up the Plasma chain - this.rootChain = new RootChain(this.web3, this.plasmaContractAddress); - this.childChain = new ChildChain(this.watcherUrl); //, this.childChainUrl); - // set lifecycle state vars this.initing = false; this.inited = true; + + await this.updateState(); } catch (e) { const message = `Error initializing Plasma chain: ${e}`; throw new Error(message); } } - async deposit(amount) { - // TODO: Update this to support ERC-20's - const currency = transaction.ETH_CURRENCY; - const approveDeposit = false; - const erc20abi = {}; + async deposit(amount, currency = transaction.ETH_CURRENCY, approveDeposit = false) { if (!this.inited) { const message = "Please wait for the Plasma chain to initialize..."; @@ -86,24 +99,22 @@ export default class BaseEmbarkOmg { } // if (amount.gt(this.maxDeposit) && this.maxDeposit.gt(0)) { // // recheck balance in case it was updated in a recent tx - // this.maxDeposit = await this.web3.eth.getBalance(this.account.address); + // this.maxDeposit = await this.web3.eth.getBalance(this.currentAddress); // if (amount.gt(this.maxDeposit)) { - // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.account.address} and then try again.`; + // const message = `You do not have enough funds for this deposit. Please deposit more funds in to ${this.currentAddress} and then try again.`; // throw new Error(message); // } // } // Create the deposit transaction - const depositTx = transaction.encodeDeposit(this.account.address, amount, currency); + const depositTx = transaction.encodeDeposit(this.currentAddress, amount, currency); if (currency === transaction.ETH_CURRENCY) { this.logger.info(`Depositing ${amount} wei...`); // ETH deposit try { - const receipt = await this.rootChain.depositEth(depositTx, amount, { from: this.account.address }); + const receipt = await this.rootChain.depositEth(depositTx, amount, {from: this.currentAddress}); this.logger.trace(receipt); - const message = `Successfully deposited ${amount} wei in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${ - receipt.transactionHash - }`; + const message = `Successfully deposited ${amount} ${currency === transaction.ETH_CURRENCY ? "wei" : currency} in to the Plasma chain.\nView the transaction: https://rinkeby.etherscan.io/tx/${receipt.transactionHash}`; return message; } catch (e) { const message = `Error depositing ${amount} wei: ${e}`; @@ -114,29 +125,31 @@ export default class BaseEmbarkOmg { // ERC20 token deposit if (approveDeposit) { // First approve the plasma contract on the erc20 contract - const erc20 = new this.web3.eth.Contract(erc20abi, currency); + const erc20 = new this.web3.eth.Contract(ERC20_ABI, currency); // const approvePromise = Promise.promisify(erc20.approve.sendTransaction) // TODO const gasPrice = 1000000; const receipt = await erc20.methods .approve(this.rootChain.plasmaContractAddress, amount) - .send({ from: this.account.address, gasPrice, gas: 2000000 }); + .send({from: this.currentAddress, gasPrice, gas: 2000000}); // Wait for the approve tx to be mined this.logger.info(`${amount} erc20 approved: ${receipt.transactionHash}. Waiting for confirmation...`); await confirmTransaction(this.web3, receipt.transactionHash); this.logger.info(`... ${receipt.transactionHash} confirmed.`); } - return this.rootChain.depositToken(depositTx, { from: this.account.address }); + return this.rootChain.depositToken(depositTx, {from: this.currentAddress}); } - async transfer(toAddress, amount) { - // TODO: Update this to support ERC20's - const currency = transaction.ETH_CURRENCY; - const verifyingContract = this.plasmaContractAddress; + async transfer(toAddress, amount, currency = transaction.ETH_CURRENCY) { + if (!this.inited) { + const message = "Please wait for the Plasma chain to initialize..."; + throw new Error(message); + } + const verifyingContract = this.config.plasmaContractAddress; - const utxosToSpend = await selectUtxos(amount, currency); + const utxosToSpend = await this.selectUtxos(amount, currency); if (!utxosToSpend) { throw new Error(`No utxo big enough to cover the amount ${amount}`); } @@ -157,7 +170,7 @@ export default class BaseEmbarkOmg { // Need to add a 'change' output const CHANGE_AMOUNT = bnAmount.sub(new BigNumber(amount)); txBody.outputs.push({ - owner: this.account.address, + owner: this.currentAddress, currency, amount: CHANGE_AMOUNT }); @@ -166,7 +179,7 @@ export default class BaseEmbarkOmg { if (currency !== transaction.ETH_CURRENCY && utxosToSpend.length > 1) { // The fee input can be returned txBody.outputs.push({ - owner: this.account.address, + owner: this.currentAddress, currency: utxosToSpend[utxosToSpend.length - 1].currency, amount: utxosToSpend[utxosToSpend.length - 1].amount }); @@ -182,7 +195,7 @@ export default class BaseEmbarkOmg { // const signature = await signTypedData( this.web3, - this.web3.utils.toChecksumAddress(this.account.address), + this.web3.utils.toChecksumAddress(this.currentAddress), JSON.stringify(typedData) ); @@ -195,14 +208,19 @@ export default class BaseEmbarkOmg { const message = `Successfully submitted tx on the child chain: ${JSON.stringify( result - )}\nView the transaction: ${this.childChainExplorerUrl}transaction/${ + )}\nView the transaction: ${this.config.childChainExplorerUrl}transaction/${ result.txhash }`; return message; } - async exit(fromAddress) { + async exitAllUtxos(fromAddress) { + if (!this.inited) { + const message = "Please wait for the Plasma chain to initialize..."; + throw new Error(message); + } + const utxos = await this.childChain.getUtxos(fromAddress); if (utxos.length <= 0) { const message = `No UTXOs found on the Plasma chain for ${fromAddress}.`; @@ -238,28 +256,43 @@ export default class BaseEmbarkOmg { } } + async exitUtxo(from, utxoToExit) { + if (!this.inited) { + const message = "Please wait for the Plasma chain to initialize..."; + throw new Error(message); + } + + const exitData = await this.childChain.getExitData(utxoToExit); + + return this.rootChain.startStandardExit( + Number(exitData.utxo_pos.toString()), + exitData.txbytes, + exitData.proof, + {from} + ); + } + async selectUtxos(amount, currency) { const transferZeroFee = currency !== transaction.ETH_CURRENCY; - const utxos = await this.childChain.getUtxos(this.account.address); + const utxos = await this.childChain.getUtxos(this.currentAddress); return selectUtxos(utxos, amount, currency, transferZeroFee); } - async getTransactions() { - return this.childChain.getTransactions({ - address: this.account.address - }); - } + async balances() { + if (!this.inited) { + const message = "Please wait for the Plasma chain to initialize..."; + throw new Error(message); + } - async getBalances() { - this.account.rootBalance = await this.web3.eth.getBalance(this.account.address); + const rootBalance = await this.web3.eth.getBalance(this.currentAddress); - const childchainBalance = await this.childChain.getBalance(this.account.address); - this.account.childBalance = await Promise.all(childchainBalance.map( + const childchainBalances = await this.childChain.getBalance(this.currentAddress); + const childBalances = await Promise.all(childchainBalances.map( async (balance) => { if (balance.currency === transaction.ETH_CURRENCY) { balance.symbol = 'wei'; } else { - const tokenContract = new this.web3.eth.Contract(erc20abi, balance.currency); + const tokenContract = new this.web3.eth.Contract(ERC20_ABI, balance.currency); try { balance.symbol = await tokenContract.methods.symbol().call(); } catch (err) { @@ -268,6 +301,26 @@ export default class BaseEmbarkOmg { } return balance; } - )) + )); + return { + rootBalance, + childBalances + }; + } + + async updateState() { + if (!this.inited) { + const message = "Please wait for the Plasma chain to initialize..."; + throw new Error(message); + } + + const {rootBalance, childBalances} = await this.balances(); + this.state.account.address = this.currentAddress; + this.state.account.rootBalance = rootBalance; + this.state.account.childBalances = childBalances; + + this.state.transactions = await this.childChain.getTransactions({address: this.currentAddress}); + + this.state.utxos = await this.childChain.getUtxos(this.currentAddress); } } diff --git a/src/utils.js b/src/utils.js index 76c14c3..67dc769 100644 --- a/src/utils.js +++ b/src/utils.js @@ -2,7 +2,7 @@ import BigNumber from "bn.js"; import { transaction } from "@omisego/omg-js-util"; const DEFAULT_INTERVAL = 1000; -const DEFAULT_BLOCKS_TO_WAIT = 1; +const DEFAULT_BLOCKS_TO_WAIT = 13; export function confirmTransaction(web3, txnHash, options) { const interval = options && options.interval ? options.interval : DEFAULT_INTERVAL; @@ -94,12 +94,12 @@ export function selectUtxos(utxos, amount, currency, includeFee) { } } -export function signTypedData (web3, signer, data) { +export function signTypedData(web3, signer, data) { return web3.currentProvider.send('eth_signTypedData_v3', [signer, data]); } -export function normalizeUrl (url) { - if(!url.endsWith("/")) { +export function normalizeUrl(url) { + if (!url.endsWith("/")) { url += "/"; } return url; diff --git a/yarn.lock b/yarn.lock index 369773a..55b4c81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -654,7 +654,7 @@ core-js "^2.5.7" regenerator-runtime "^0.12.0" -"@babel/runtime@^7.4.2": +"@babel/runtime@^7.3.1", "@babel/runtime@^7.4.2": version "7.4.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12" integrity sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ== @@ -733,6 +733,23 @@ "@omisego/omg-js-rootchain" "^2.0.0-v0.2" "@omisego/omg-js-util" "^2.0.0-v0.2" +"@types/bn.js@^4.11.4": + version "4.11.5" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.5.tgz#40e36197433f78f807524ec623afcf0169ac81dc" + integrity sha512-AEAZcIZga0JgVMHNtl1CprA/hXX7/wPt79AgR4XqaDt7jyj3QWYw6LPoOiznPtugDmlubUnAahMs2PFxGcQrng== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "12.0.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.8.tgz#551466be11b2adc3f3d47156758f610bd9f6b1d8" + integrity sha512-b8bbUOTwzIY3V5vDTY1fIJ+ePKDUBqt2hC2woVGotdQQhG/2Sh62HOKHrT7ab+VerXAcPyAiTEipPu/FsreUtg== + +"@types/node@^10.12.18", "@types/node@^10.3.2": + version "10.14.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.9.tgz#2e8d678039d27943ce53a1913386133227fd9066" + integrity sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg== + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -755,6 +772,11 @@ acorn@^5.5.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= + ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" @@ -952,7 +974,7 @@ bn.js@4.11.6: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= -bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0: +bn.js@4.11.8, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== @@ -986,7 +1008,7 @@ brorand@^1.0.1: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= -browserify-aes@^1.0.6: +browserify-aes@^1.0.4, browserify-aes@^1.0.6: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== @@ -998,6 +1020,25 @@ browserify-aes@^1.0.6: inherits "^2.0.1" safe-buffer "^5.0.1" +browserify-cipher@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + browserify-sha3@^0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/browserify-sha3/-/browserify-sha3-0.0.4.tgz#086c47b8c82316c9d47022c26185954576dd8e26" @@ -1020,6 +1061,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== +buffer-to-arraybuffer@^0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" + integrity sha1-YGSkD6dutDxyOrqe+PbhIW0QURo= + buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" @@ -1235,6 +1281,11 @@ convert-source-map@^1.1.0: dependencies: safe-buffer "~5.1.1" +cookiejar@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" + integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== + copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" @@ -1351,6 +1402,13 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +decompress-response@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= + dependencies: + mimic-response "^1.0.0" + deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -1395,6 +1453,14 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= +des.js@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + integrity sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" @@ -1407,6 +1473,11 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +dom-walk@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" + integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg= + drbg.js@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" @@ -1421,6 +1492,16 @@ electron-to-chromium@^1.3.137: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.139.tgz#17a149701d934bbb91d2aa4ae09e5270c38dc0ff" integrity sha512-8cR7h6doIC/XLgPdsTM3BXpfWLzqrHS6jWrvWLsdZWZWFvVQQUJTbU/wUZsjRGK33OY5ZIiS1n6JbqowuWrmYg== +elliptic@6.3.3: + version "6.3.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f" + integrity sha1-VILZZG1UvLif19mU/J4ulWiHbj8= + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + inherits "^2.0.1" + elliptic@^6.4.0, elliptic@^6.4.1: version "6.4.1" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" @@ -1441,7 +1522,7 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.4.3: +es-abstract@^1.4.3, es-abstract@^1.5.0: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== @@ -1561,6 +1642,23 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= +eth-ens-namehash@2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" + integrity sha1-IprEbsqG1S4MmR58sq74P/D2i88= + dependencies: + idna-uts46-hx "^2.3.1" + js-sha3 "^0.5.7" + +eth-lib@0.2.8: + version "0.2.8" + resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" + integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== + dependencies: + bn.js "^4.11.6" + elliptic "^6.4.0" + xhr-request-promise "^0.1.2" + eth-sig-util@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-2.2.0.tgz#769fa3d296b450f6618dedeefe076642c923a16f" @@ -1573,6 +1671,11 @@ eth-sig-util@^2.1.1: tweetnacl "^1.0.0" tweetnacl-util "^0.15.0" +ethereum-common@^0.0.18: + version "0.0.18" + resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" + integrity sha1-L9w1dvIykDNYl26znaeDIT/5Uj8= + ethereumjs-abi@0.6.5: version "0.6.5" resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.5.tgz#5a637ef16ab43473fa72a29ad90871405b3f5241" @@ -1581,6 +1684,14 @@ ethereumjs-abi@0.6.5: bn.js "^4.10.0" ethereumjs-util "^4.3.0" +ethereumjs-tx@^1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" + integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== + dependencies: + ethereum-common "^0.0.18" + ethereumjs-util "^5.0.0" + ethereumjs-util@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" @@ -1592,7 +1703,7 @@ ethereumjs-util@^4.3.0: rlp "^2.0.0" secp256k1 "^3.0.1" -ethereumjs-util@^5.1.1: +ethereumjs-util@^5.0.0, ethereumjs-util@^5.1.1: version "5.2.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz#3e0c0d1741471acf1036052d048623dee54ad642" integrity sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA== @@ -1618,6 +1729,30 @@ ethereumjs-util@^6.0.0: safe-buffer "^5.1.1" secp256k1 "^3.0.1" +ethers@^4.0.27: + version "4.0.30" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.30.tgz#140653fd08adf2834bb2f3aceefa10d04205b47d" + integrity sha512-1a39Y+q5zTfrXCLndV+CHsTHq+T5/TvAx5y0S/PKd700C0lfU70CJnU7q89bd+4pIuWp05TkrEsrTj2dXhkcSA== + dependencies: + "@types/node" "^10.3.2" + aes-js "3.0.0" + bn.js "^4.4.0" + elliptic "6.3.3" + hash.js "1.1.3" + js-sha3 "0.5.7" + scrypt-js "2.0.4" + setimmediate "1.0.4" + uuid "2.0.1" + xmlhttprequest "1.8.0" + +ethjs-unit@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= + dependencies: + bn.js "4.11.6" + number-to-bn "1.7.0" + ethjs-util@0.1.6, ethjs-util@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -1626,7 +1761,17 @@ ethjs-util@0.1.6, ethjs-util@^0.1.3: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" -evp_bytestokey@^1.0.3: +eventemitter3@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" + integrity sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA== + +eventemitter3@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + +evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== @@ -1740,6 +1885,13 @@ flat-cache@^1.2.1: rimraf "~2.6.2" write "^0.2.1" +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1826,6 +1978,14 @@ glob@^7.0.0, glob@^7.0.5, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +global@~4.3.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f" + integrity sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8= + dependencies: + min-document "^2.19.0" + process "~0.5.1" + globals@^11.0.1, globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -1904,6 +2064,14 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" +hash.js@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" + integrity sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.0" + hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -1938,6 +2106,13 @@ iconv-lite@^0.4.17, iconv-lite@^0.4.4: dependencies: safer-buffer ">= 2.1.2 < 3" +idna-uts46-hx@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" + integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== + dependencies: + punycode "2.1.0" + ieee754@^1.1.4: version "1.1.13" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" @@ -2044,7 +2219,7 @@ is-buffer@^1.1.5: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-callable@^1.1.4: +is-callable@^1.1.3, is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== @@ -2120,6 +2295,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-function@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5" + integrity sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU= + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -2182,6 +2362,11 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + is-windows@^1.0.0, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -2214,6 +2399,11 @@ js-levenshtein@^1.1.3: resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== +js-sha3@0.5.7, js-sha3@^0.5.7: + version "0.5.7" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" + integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= + js-sha3@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.6.1.tgz#5b89f77a7477679877f58c4a075240934b1f95c0" @@ -2421,6 +2611,18 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== +mimic-response@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + +min-document@^2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" + integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= + dependencies: + dom-walk "^0.1.0" + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -2498,7 +2700,7 @@ nan@2.13.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== -nan@^2.12.1, nan@^2.13.2, nan@^2.2.1: +nan@^2.0.8, nan@^2.11.0, nan@^2.12.1, nan@^2.13.2, nan@^2.2.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== @@ -2640,7 +2842,7 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -number-to-bn@^1.7.0: +number-to-bn@1.7.0, number-to-bn@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" integrity sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= @@ -2648,7 +2850,7 @@ number-to-bn@^1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -2691,7 +2893,7 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -once@^1.3.0: +once@^1.3.0, once@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= @@ -2744,6 +2946,14 @@ output-file-sync@^2.0.0: is-plain-obj "^1.1.0" mkdirp "^0.5.1" +parse-headers@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.2.tgz#9545e8a4c1ae5eaea7d24992bca890281ed26e34" + integrity sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg== + dependencies: + for-each "^0.3.3" + string.prototype.trim "^1.1.2" + parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" @@ -2789,6 +2999,17 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" +pbkdf2@^3.0.17, pbkdf2@^3.0.3: + version "3.0.17" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + pidtree@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.0.tgz#f6fada10fccc9f99bf50e90d0b23d72c9ebc2e6b" @@ -2824,6 +3045,11 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== +process@~0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" + integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8= + progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -2834,6 +3060,32 @@ pseudomap@^1.0.2: resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= +punycode@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" + integrity sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0= + +query-string@^5.0.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + dependencies: + decode-uri-component "^0.2.0" + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + +querystringify@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -2969,6 +3221,11 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" @@ -3060,6 +3317,13 @@ rx-lite@*, rx-lite@^4.0.8: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= +rxjs@^6.4.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" + integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== + dependencies: + tslib "^1.9.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -3082,6 +3346,34 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== +scrypt-js@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" + integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== + +scrypt.js@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/scrypt.js/-/scrypt.js-0.3.0.tgz#6c62d61728ad533c8c376a2e5e3e86d41a95c4c0" + integrity sha512-42LTc1nyFsyv/o0gcHtDztrn+aqpkaCNt5Qh7ATBZfhEZU7IC/0oT/qbBH+uRNoAPvs2fwiOId68FDEoSRA8/A== + dependencies: + scryptsy "^1.2.1" + optionalDependencies: + scrypt "^6.0.2" + +scrypt@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/scrypt/-/scrypt-6.0.3.tgz#04e014a5682b53fa50c2d5cce167d719c06d870d" + integrity sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0= + dependencies: + nan "^2.0.8" + +scryptsy@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/scryptsy/-/scryptsy-1.2.1.tgz#a3225fa4b2524f802700761e2855bdf3b2d92163" + integrity sha1-oyJfpLJST4AnAHYeKFW987LZIWM= + dependencies: + pbkdf2 "^3.0.3" + secp256k1@^3.0.1: version "3.7.0" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.7.0.tgz#e85972f847b586cc4b2acd69497d3f80afaa7505" @@ -3131,6 +3423,11 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" +setimmediate@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.4.tgz#20e81de622d4a02588ce0c8da8973cbcf1d3138f" + integrity sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48= + sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" @@ -3173,6 +3470,20 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +simple-concat@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +simple-get@^2.7.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" + integrity sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw== + dependencies: + decompress-response "^3.3.0" + once "^1.3.1" + simple-concat "^1.0.0" + slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" @@ -3282,6 +3593,11 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -3308,6 +3624,15 @@ string.prototype.padend@^3.0.0: es-abstract "^1.4.3" function-bind "^1.0.2" +string.prototype.trim@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" + integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.0" + function-bind "^1.0.2" + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -3393,6 +3718,11 @@ through@^2.3.6: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= +timed-out@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -3435,6 +3765,11 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= +tslib@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tweetnacl-util@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.0.tgz#4576c1cee5e2d63d207fee52f1ba02819480bc75" @@ -3452,6 +3787,13 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -3508,16 +3850,44 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= +url-parse@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8" + integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg== + dependencies: + querystringify "^2.0.0" + requires-port "^1.0.0" + +url-set-query@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" + integrity sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk= + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utf8@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.1.tgz#2e01db02f7d8d0944f77104f1609eb0c304cf768" + integrity sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g= + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= +uuid@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" + integrity sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w= + +uuid@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -3526,6 +3896,247 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +web3-core-helpers@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.55.tgz#832b8499889f9f514b1d174f00172fd3683d63de" + integrity sha512-suj9Xy/lIqajaYLJTEjr2rlFgu6hGYwChHmf8+qNrC2luZA6kirTamtB9VThWMxbywx7p0bqQFjW6zXogAgWhg== + dependencies: + "@babel/runtime" "^7.3.1" + lodash "^4.17.11" + web3-core "1.0.0-beta.55" + web3-eth-iban "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-core-method@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.0.0-beta.55.tgz#0af994295ac2dd64ccd53305b7df8da76e11da49" + integrity sha512-w1cW/s2ji9qGELHk2uMJCn1ooay0JJLVoPD1nvmsW6OTRWcVjxa62nJrFQhe6P5lEb83Xk9oHgmCxZoVUHibOw== + dependencies: + "@babel/runtime" "^7.3.1" + eventemitter3 "3.1.0" + lodash "^4.17.11" + rxjs "^6.4.0" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-subscriptions "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-core-subscriptions@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.55.tgz#105902c13db53466fc17d07a981ad3d41c700f76" + integrity sha512-pb3oQbUzK7IoyXwag8TYInQddg0rr7BHxKc+Pbs/92hVNQ5ps4iGMVJKezdrjlQ1IJEEUiDIglXl4LZ1hIuMkw== + dependencies: + "@babel/runtime" "^7.3.1" + eventemitter3 "^3.1.0" + lodash "^4.17.11" + +web3-core@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.0.0-beta.55.tgz#26b9abbf1bc1837c9cc90f06ecbc4ed714f89b53" + integrity sha512-AMMp7TLEtE7u8IJAu/THrRhBTZyZzeo7Y6GiWYNwb5+KStC9hIGLr9cI1KX9R6ZioTOLRHrqT7awDhnJ1ku2mg== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/bn.js" "^4.11.4" + "@types/node" "^10.12.18" + lodash "^4.17.11" + web3-core-method "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-eth-abi@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.55.tgz#69250420039346105a3d0f899c0a8a53be926f97" + integrity sha512-3h1xnm/vYmKUXTOYAOP0OsB5uijQV76pNNRGKOB6Dq6GR1pbcbD3WrB/4I643YA8l91t5FRzFzUiA3S77R2iqw== + dependencies: + "@babel/runtime" "^7.3.1" + ethers "^4.0.27" + lodash "^4.17.11" + web3-utils "1.0.0-beta.55" + +web3-eth-accounts@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.55.tgz#ba734ffdc1e3cc8ac0ea01de5241323a0c2f69f3" + integrity sha512-VfzvwpSDHXqRVelIxsBVhgbV9BkFvhJ/q+bKhnVUUXV0JAhMK/7uC92TsqKk4EBYuqpHyZ1jjqrL4n03fMU7zw== + dependencies: + "@babel/runtime" "^7.3.1" + browserify-cipher "^1.0.1" + eth-lib "0.2.8" + lodash "^4.17.11" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + scrypt.js "0.3.0" + uuid "3.3.2" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-eth-contract@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.55.tgz#cd9e6727ff73d648ebe7cae17516e8aec5873c65" + integrity sha512-v6oB1wfH039/A5sTb4ZTKX++fcBTHEkuQGpq50ATIDoxP/UTz2+6S+iL+3sCJTsByPw2/Bni/HM7NmLkXqzg/Q== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/bn.js" "^4.11.4" + lodash "^4.17.11" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-core-subscriptions "1.0.0-beta.55" + web3-eth-abi "1.0.0-beta.55" + web3-eth-accounts "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-eth-ens@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.0.0-beta.55.tgz#4341434a3406728212d411ae7f22d4cf5b8642fe" + integrity sha512-jEL17coO0FJXb7KYq4+7DhVXj0Rh+wHfZ86jOvFUvJsRaUHfqK2TlMatuhD2mbrmxpBYb6oMPnXVnNK9bnD5Rg== + dependencies: + "@babel/runtime" "^7.3.1" + eth-ens-namehash "2.0.8" + lodash "^4.17.11" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-eth-abi "1.0.0-beta.55" + web3-eth-accounts "1.0.0-beta.55" + web3-eth-contract "1.0.0-beta.55" + web3-net "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-eth-iban@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.55.tgz#15146a69de21addc99e7dbfb2920555b1e729637" + integrity sha512-a2Fxsb5Mssa+jiXgjUdIzJipE0175IcQXJbZLpKft2+zeSJWNTbaa3PQD2vPPpIM4W789q06N+f9Zc0Fyls+1g== + dependencies: + "@babel/runtime" "^7.3.1" + bn.js "4.11.8" + web3-utils "1.0.0-beta.55" + +web3-eth-personal@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.55.tgz#76e9d2da1501ee3c686751e7c7df63cc11793a1d" + integrity sha512-H0mahLQx6Oj7lpgTamKAswr3rHChRUZijeWAar2Hj7BABQlLRKwx8n09nYhxggvvLYQNQS90JjvQue7rAo2LQQ== + dependencies: + "@babel/runtime" "^7.3.1" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-eth-accounts "1.0.0-beta.55" + web3-net "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-eth@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.0.0-beta.55.tgz#bb52150df0a77bd13511449a53793d4eb23ade6e" + integrity sha512-F3zJ9I1gOgQdNGfi2Dy2lmj6OqCMJoRN01XHhQZagq0HY1JYMfObtfMi5E3L+qsegsSddHbqp4YY57tKx6uxpA== + dependencies: + "@babel/runtime" "^7.3.1" + ethereumjs-tx "^1.3.7" + rxjs "^6.4.0" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-core-subscriptions "1.0.0-beta.55" + web3-eth-abi "1.0.0-beta.55" + web3-eth-accounts "1.0.0-beta.55" + web3-eth-contract "1.0.0-beta.55" + web3-eth-ens "1.0.0-beta.55" + web3-eth-iban "1.0.0-beta.55" + web3-eth-personal "1.0.0-beta.55" + web3-net "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-net@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.0.0-beta.55.tgz#daf24323df16a890a0bac6c6eda48b6e8c7e96ef" + integrity sha512-do2WY8+/GArJSWX7k/zZ7nBnV9Y3n6LhPYkwT3LeFqDzD515bKwlomaNC8hOaTc6UQyXIoPprYTK2FevL7jrZw== + dependencies: + "@babel/runtime" "^7.3.1" + lodash "^4.17.11" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-providers@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-providers/-/web3-providers-1.0.0-beta.55.tgz#639503517741b69baaa82f1f940630df6a25992b" + integrity sha512-MNifc7W+iF6rykpbDR1MuX152jshWdZXHAU9Dk0Ja2/23elhIs4nCWs7wOX9FHrKgdrQbscPoq0uy+0aGzyWVQ== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/node" "^10.12.18" + eventemitter3 "3.1.0" + lodash "^4.17.11" + url-parse "1.4.4" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + websocket "^1.0.28" + xhr2-cookies "1.1.0" + +web3-shh@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.0.0-beta.55.tgz#56f152ebcefb791dab86d2e6f1c296f8c1553644" + integrity sha512-lGP2HQ/1ThNnfoU8677aL48KsTx4Ht+2KQIn39dGpxVZqysQmovQIltbymVnAr4h8wofwcEz46iNHGa+PAyNzA== + dependencies: + "@babel/runtime" "^7.3.1" + web3-core "1.0.0-beta.55" + web3-core-helpers "1.0.0-beta.55" + web3-core-method "1.0.0-beta.55" + web3-core-subscriptions "1.0.0-beta.55" + web3-net "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +web3-utils@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.0.0-beta.55.tgz#beb40926b7c04208b752d36a9bc959d27a04b308" + integrity sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/bn.js" "^4.11.4" + "@types/node" "^10.12.18" + bn.js "4.11.8" + eth-lib "0.2.8" + ethjs-unit "^0.1.6" + lodash "^4.17.11" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "2.1.1" + +web3@1.0.0-beta.55: + version "1.0.0-beta.55" + resolved "https://registry.yarnpkg.com/web3/-/web3-1.0.0-beta.55.tgz#8845075129299da172c2eb41a748c8a87c2a2b5a" + integrity sha512-yJpwy4IUA3T/F9hWzYQVn0GbJCrAaZ0KTIO3iuqkhaYH0Y09KV7k4GzFi4hN7hT4cFTj4yIKaeVCwQ5kzvi2Vg== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/node" "^10.12.18" + web3-core "1.0.0-beta.55" + web3-eth "1.0.0-beta.55" + web3-eth-personal "1.0.0-beta.55" + web3-net "1.0.0-beta.55" + web3-providers "1.0.0-beta.55" + web3-shh "1.0.0-beta.55" + web3-utils "1.0.0-beta.55" + +websocket@^1.0.28: + version "1.0.28" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.28.tgz#9e5f6fdc8a3fe01d4422647ef93abdd8d45a78d3" + integrity sha512-00y/20/80P7H4bCYkzuuvvfDvh+dgtXi5kzDf3UcZwN6boTYaKvsrtZ5lIYm1Gsg48siMErd9M4zjSYfYFHTrA== + dependencies: + debug "^2.2.0" + nan "^2.11.0" + typedarray-to-buffer "^3.1.5" + yaeti "^0.0.6" + which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -3557,6 +4168,58 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" +xhr-request-promise@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz#343c44d1ee7726b8648069682d0f840c83b4261d" + integrity sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0= + dependencies: + xhr-request "^1.0.1" + +xhr-request@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" + integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== + dependencies: + buffer-to-arraybuffer "^0.0.5" + object-assign "^4.1.1" + query-string "^5.0.1" + simple-get "^2.7.0" + timed-out "^4.0.1" + url-set-query "^1.0.0" + xhr "^2.0.4" + +xhr2-cookies@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg= + dependencies: + cookiejar "^2.1.1" + +xhr@^2.0.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.5.0.tgz#bed8d1676d5ca36108667692b74b316c496e49dd" + integrity sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ== + dependencies: + global "~4.3.0" + is-function "^1.0.1" + parse-headers "^2.0.0" + xtend "^4.0.0" + +xmlhttprequest@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" + integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= + +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"