fix error messgae
MODIFY
src/index.js
src/index.js
@@ -152,7 +152,7 @@ export default class Matic {
async depositEthers(options = {}) {
if (options && (!options.from || !options.value)) {
- throw new Error(`${options.from} or ${options.value} is missing`)
+ throw new Error('options.from or options.value is missing')
}
const depositTx = this._rootChainContract.methods.depositEthers()
options.data = depositTx.encodeABI()
@@ -172,7 +172,7 @@ export default class Matic {
async approveERC20TokensForDeposit(token, amount, options = {}) {
if (options && (!options.from || !amount || !token)) {
- throw new Error(`${options.from}, ${token} or ${amount} is missing`)
+ throw new Error('options.from, token or amount is missing')
}
const _tokenContract = this._getERC20TokenContract(token, this._parentWeb3)
@@ -197,7 +197,7 @@ export default class Matic {
async allowanceERC20TokensForDeposit(address, token) {
if (!address || !token) {
- throw new Error(`${address} or ${token} is missing`)
+ throw new Error('address or token is missing')
}
const _tokenContract = this._getERC20TokenContract(token, this._parentWeb3)
@@ -208,7 +208,7 @@ export default class Matic {
async depositERC20Tokens(token, user, amount, options = {}) {
if (options && (!options.from || !token || !user || !amount)) {
- throw new Error(`${options.from}, ${token}, ${amount} or ${user} is missing`)
+ throw new Error('options.from, token, amount or user is missing')
}
const depositTx = this._rootChainContract.methods.deposit(
token,
@@ -232,7 +232,7 @@ export default class Matic {
async safeDepositERC721Tokens(token, tokenId, options = {}) {
if (options && (!options.from || !tokenId || !token)) {
- throw new Error(`${options.from}, ${tokenId} or ${token} is missing`)
+ throw new Error(`options.from, tokenId or token is missing`)
}
const _tokenContract = this._getERC721TokenContract(token, this._parentWeb3)
@@ -262,7 +262,7 @@ export default class Matic {
async approveERC721TokenForDeposit(token, tokenId, options = {}) {
if (options && (!options.from || !tokenId || !token)) {
- throw new Error(`${options.from}, ${tokenId} or ${token} is missing`)
+ throw new Error(`options.from, tokenId or token is missing`)
}
const _tokenContract = this._getERC721TokenContract(token, this._parentWeb3)
@@ -287,7 +287,7 @@ export default class Matic {
async depositERC721Tokens(token, user, tokenId, options = {}) {
if (options && (!options.from || !token || !user || !tokenId)) {
- throw new Error(`${options.from}, ${tokenId}, ${user} or ${token} is missing`)
+ throw new Error(`options.from, tokenId, user or token is missing`)
}
const depositTx = this._rootChainContract.methods.depositERC721(
@@ -312,7 +312,7 @@ export default class Matic {
async transferTokens(token, user, amount, options = {}) {
if (options && (!options.from || !amount || !user || !token)) {
- throw new Error(`${options.from}, ${amount}, ${user} or ${token} is missing`)
+ throw new Error(`options.from, amount, user or token is missing`)
}
let web3Object = this._web3
if (options.parent) {
@@ -333,7 +333,7 @@ export default class Matic {
async transferERC721Tokens(token, user, tokenId, options = {}) {
if (options && (!options.from || !token || !user || !tokenId)) {
- throw new Error(`${options.from}, ${token}, ${user} or ${tokenId} is missing`)
+ throw new Error(`options.from, token, user or tokenId is missing`)
}
let web3Object = this._web3
if (options.parent) {
@@ -359,7 +359,7 @@ export default class Matic {
let web3Object = this._parentWeb3
if (options && (!options.from || !amount || !to)) {
- throw new Error(`${options.from}, ${amount} or ${to} is missing`)
+ throw new Error(`options.from, amount or to is missing`)
}
const from = options.from
@@ -392,7 +392,7 @@ export default class Matic {
async startWithdraw(token, amount, options = {}) {
if (options && (!options.from || !amount || !token)) {
- throw new Error(`${options.from}, ${amount} or ${token} is missing`)
+ throw new Error(`options.from, amount or token is missing`)
}
const _tokenContract = this._getERC20TokenContract(token, this._web3)
const withdrawTx = _tokenContract.methods.withdraw(amount)
@@ -408,7 +408,7 @@ export default class Matic {
async startERC721Withdraw(token, tokenId, options = {}) {
if (options && (!options.from || !tokenId || !token)) {
- throw new Error(`${options.from}, ${tokenId} or ${token} is missing`)
+ throw new Error(`options.from, tokenId or token is missing`)
}
const _tokenContract = this._getERC721TokenContract(token, this._web3)
const withdrawTx = _tokenContract.methods.withdraw(tokenId)

fix error messgae