import { ExitUtil, RootChain, use, Web3SideChainClient } from "@maticnetwork/maticjs";
import { Web3ClientPlugin } from "@maticnetwork/maticjs-web3";
import HDWalletProvider from "@truffle/hdwallet-provider";
import { from, privateKey, RPC } from "./config";
use(Web3ClientPlugin);
const client = new Web3SideChainClient<any>();
// initiate client
await client.init({
// log: true,
network: 'testnet',
version: 'amoy',
parent: {
provider: new HDWalletProvider(privateKey, RPC.parent),
defaultConfig: {
from
}
},
child: {
provider: new HDWalletProvider(privateKey, RPC.child),
defaultConfig: {
from
}
}
});
// create root chain instance
const rootChain = new RootChain(client, <root chain address>);
// create exitUtil Instance
const exitUtil = new ExitUtil(client, rootChain);
// generate proof
const proof = await exitUtil.buildPayloadForExit(
<burn tx hash>,
<log event signature>,
<isFast>
)