The properties of the contract.
The address of the contract.
The ABI of the contract.
The provider for the contract.
Optional
sender: stringWho is sending the transaction.
The contract instance.
const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org');
const contract: IOP_20Contract = getContract<IOP_20Contract>(
'bcrt1qxeyh0pacdtkqmlna9n254fztp3ptadkkfu6efl',
OP_20_ABI,
provider,
);
const balanceExample = await contract.balanceOf(
'bcrt1pyrs3eqwnrmd4ql3nwvx66yzp0wc24xd2t9pf8699ln340pjs7f3sar3tum',
);
if ('error' in balanceExample) throw new Error('Error in fetching balance');
console.log('Balance:', balanceExample.decoded);
Creates a new contract instance.