I’m trying to test my implementation, I’m just try to get the balance of PoS erc20, but I receive an error about gas.
parent: {
rpc: process.env.GOERLI_RPC_URL,
},
child: {
rpc: 'https://matic-mumbai.chainstacklabs.com',
},
const getMaticPOSClient = () => {
return new MaticPOSClient({
network: 'testnet',
version: 'mumbai',
parentProvider: new HDWalletProvider(PRIVATE_KEY, config.parent.rpc),
maticProvider: new HDWalletProvider(PRIVATE_KEY, config.child.rpc),
parentDefaultOptions: { from: USER_ADDRESS },
maticDefaultOptions: { from: USER_ADDRESS },
});
};
const SCALING_FACTOR = new bn(10).pow(new bn(18));
const execute = async () => {
const maticPOSInstance = getMaticPOSClient();
const balance = await maticPOSInstance.balanceOfERC20(
from,
pos.child.erc20,
{}
);
const balanceInToken = new bn(balance).div(SCALING_FACTOR);
console.log(`Balance of ${from} on PoS bridge is ${balanceInToken} TST`);
};
execute().then(() => process.exit(0));