add process exit
ADD
examples/node/process-exit.js
+// const Matic = require('maticjs').default
+const Matic = require('../../lib/index').default
+const config = require('./config')
+
+const from = config.FROM_ADDRESS // from address
+const rootTokenAddress = config.ROPSTEN_TEST_TOKEN
+
+// Create object of Matic
+const matic = new Matic({
+ maticProvider: config.MATIC_PROVIDER,
+ parentProvider: config.PARENT_PROVIDER,
+ rootChainAddress: config.ROOTCHAIN_ADDRESS,
+ syncerUrl: config.SYNCER_URL,
+ watcherUrl: config.WATCHER_URL,
+ withdrawManagerAddress: config.WITHDRAWMANAGER_ADDRESS,
+})
+
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
+
+
+// NOTE: Wait for NFT Challenge period tobe complete
+matic.processExits(rootTokenAddress, {
+ from,
+ onTransactionHash: () => {
+ // action on Transaction success
+ // on sucessfull processExits withdrawManager.Withdraw event will receive
+ },
+})
\ No newline at end of file

MODIFY
src/index.js
src/index.js
@@ -437,6 +437,17 @@ export default class Matic {
return this._wrapWeb3Promise(withdrawTx.send(_options), options)
}
+ async processExits(rootTokenAddress, options = {}) {
+ const processExits = this._withdrawManagerContract.methods.processExits(rootTokenAddress)
+ const _options = await this._fillOptions(
+ options,
+ processExits,
+ this._parentWeb3
+ )
+ return this._wrapWeb3Promise(processExits.send(_options), options)
+
+ }
+
async withdrawLocally(txId, options = {}) {
const withdrawTx = await this._web3.eth.getTransaction(txId)
const withdrawReceipt = await this._web3.eth.getTransactionReceipt(txId)

add process exit