import { ethers } from 'ethers' ; import { ContractCallContext , ContractCallResults , Multicall } from '../' ; const execute = async ( ) => { const provider = new ethers . providers . InfuraProvider ( 42 , '9aa3d95b3bc440fa88ea12eaa4456161' ) ; const multicall = new Multicall ( { ethersProvider : provider , tryAggregate : true , } ) ; const contractCallContext = { reference : 'testContract' , contractAddress : '0xD21d3A321eDc8ca5FEA387A4D082a349c86CCfE5' , abi : [ { inputs : [ ] , name : 'globalPositionData' , outputs : [ { components : [ { internalType : 'uint256' , name : 'rawValue' , type : 'uint256' } , ] , internalType : 'struct FixedPoint.Unsigned' , name : 'totalTokensOutstanding' , type : 'tuple' , } , { components : [ { internalType : 'uint256' , name : 'rawValue' , type : 'uint256' } , ] , internalType : 'struct FixedPoint.Unsigned' , name : 'rawTotalPositionCollateral' , type : 'tuple' , } , ] , stateMutability : 'view' , type : 'function' , } , ] , calls : [ { reference : 'globalPositionDataCall' , methodName : 'globalPositionData' , methodParameters : [ ] , } , ] , } ; const context = await multicall . call ( contractCallContext ) ; console . log ( context . results [ contractCallContext . reference ] . callsReturnContext [ 0 ] . returnValues ) ; } ; execute ( ) ;