Skip to content

Conversation

@RezaRahemtola
Copy link
Contributor

Sometimes the address given by explorers/wallets isn't in the right format, if copied from a URL for example.

This leads to the action giving the following response when called:

Error getting balance: ('web3.py only accepts checksum addresses. The software that gave you this non-checksum address should be considered unsafe, please file it as a bug on their platform. Try using an ENS name instead. Or, if you must accept lower safety, use Web3.to_checksum_address(lower_case_address).', '0xc0fbc4967259786c743361a5885ef49380473dcf')

In the case of a Base mainnet contract here.
This can easily be fixed by (as explained by the error message) wrapping the address with Web3.to_checksum_address()

What changed?

  • Documentation
  • Bug fix
  • New Action
  • New Action Provider
  • Other

Why was this change implemented?

Issue encountered during ETH Denver

Network support

  • All EVM
  • Base
  • Base Sepolia
  • Other

Wallet support

  • CDP Wallet
  • EVM Wallet
  • Other

Checklist

  • Changelog updated
  • Commits are signed. See instructions
  • Doc strings
  • Readme updates
  • Rebased against master
  • Relevant exports added

How has it been tested?

  • Agent tested
  • Unit tests

LLM: Nous Hermes 3 Pro
Prompt: What's your balance of the token 0xc0fbc4967259786c743361a5885ef49380473dcf ?
Agent output before:

The address you provided for the token is not in checksum format. I recommend using an ENS name or converting the address to checksum format using Web3.to_checksum_address() to ensure safety. Could you please provide the address again in the correct format?

Agent output after:

The balance of the token 0xc0fbc4967259786c743361a5885ef49380473dcf in your wallet is 0.

Notes to reviewers

…checksum to avoid errors

Sometimes the address given by explorers/wallets isn't in the right format
@cb-heimdall
Copy link

cb-heimdall commented Feb 24, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@John-peterson-coinbase John-peterson-coinbase merged commit 383ae0f into coinbase:main Feb 25, 2025
11 checks passed
kylexqian pushed a commit to OpenGradient/agentkit that referenced this pull request Feb 25, 2025
…checksum to avoid errors (coinbase#460)

Sometimes the address given by explorers/wallets isn't in the right format
@mikeghen mikeghen mentioned this pull request Mar 4, 2025
2 tasks

balance = wallet_provider.read_contract(
contract_address=validated_args.contract_address,
contract_address=Web3.to_checksum_address(validated_args.contract_address),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web3.to_checksum_ 0xB4FBF271143F4FBf7B91C5ded31805e1B2B0bC1D'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider python

Development

Successfully merging this pull request may close these issues.

4 participants