multicall.py
multicall.py copied to clipboard
403 Client Error when using Multicall on Avalanche Mainnet.
Hello,
I am receiving the following error when attempting to use the avalanche public rpc on mainnet:
403 Client Error: Forbidden for url: https://api.avax.network/ext/bc/C/rpc [0]
I am using the example code as below:
from multicall import Call, Multicall
from web3 import Web3
TOKEN = '0x98e2060F672FD1656a07bc12D7253b5e41bF3876'
WHALE = '0x252332713864B50300d65580decD387cDD957C59'
def from_wei(value):
return value / 1e18
w3 = Web3(Web3.HTTPProvider('https://api.avax.network/ext/bc/C/rpc'))
multi = Multicall(calls=[
Call(TOKEN, ['balanceOf(address)(uint256)', WHALE], [('whale', from_wei)]),
], _w3=w3)
multi()