pass root contract address to approval function
MODIFY
src/index.js
src/index.js
@@ -32,11 +32,12 @@ export default class Matic {
this._syncerUrl = options.syncerUrl
this._watcherUrl = options.watcherUrl
+ this._rootChainAddress = options.rootChainAddress
// create rootchain contract
this._rootChainContract = new this._parentWeb3.eth.Contract(
RootChainArtifacts.abi,
- options.rootChainAddress
+ this._rootChainAddress
)
// internal cache
@@ -87,7 +88,10 @@ export default class Matic {
StandardTokenArtifacts.abi,
token
)
- const approveTx = await _tokenContract.methods.approve(this._rootChainContract, amount)
+ const approveTx = await _tokenContract.methods.approve(
+ this._rootChainAddress,
+ amount
+ )
const _options = await this._fillOptions(
options,
approveTx,

pass root contract address to approval function