multicall.py icon indicating copy to clipboard operation
multicall.py copied to clipboard

403 Client Error when using Multicall on Avalanche Mainnet.

Open adamxyzxyz opened this issue 1 year ago • 5 comments

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()

adamxyzxyz avatar Mar 29 '23 12:03 adamxyzxyz