Closed adamxyzxyz closed 4 months ago
Not entirely sure here, are you able to make calls to the same rpc using a different method?
Yes, if I make calls normally, such as contract.functions.function().call(), there are no issues.
Similarly, this also works:
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'))
calls=Call(TOKEN, ['balanceOf(address)(uint256)', WHALE], [('whale', from_wei)], _w3=w3)
print(calls())
@BobTheBuidler are you able to reproduce this error on your end? I do not receive the 403 error if I use other avalanche endpoints, but I would prefer to use their public one if possible.
Hey @BobTheBuidler @banteg circling back on this
The issue is that your TOKEN
address is not a token on AVAX, and thus does not have a balanceOf
method.
Changing your above code simply to reference a compatible token contract results in no error --
TOKEN = '0xd6070ae98b8069de6B494332d1A1a81B6179D960'
@DefiDebauchery its a bit odd that the examples provided do work with a non-token address.
@adamxyzxyz j/w, was it just outputting a 0 or was it giving you a positive result?
going to close this due to no activity. Feel free to reopen if this is still an issue.
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: