Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: handle eth case in native erc20 token address endpoint #51

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

juanbono
Copy link

@juanbono juanbono commented Jan 17, 2024

What ❔

Changes the native ERC20 address endpoint (get_native_token_address) to return a 0 if there is no native ERC20 deployed. This means that the native token in the network is ETH.

Since we are relying on the native_erc20.json file for now to detect a native ERC20 token, it just returns 0 if the files does not exist. In the future, If we move to config file we can check the existence/contents of the env var.

Why ❔

This is mostly added for compatibility purposes.

How to test

Just remove the etc/tokens/native_erc20.json file and query the endpoint:

❯ curl -X  POST http://localhost:3050 -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"zks_getNativeTokenAddress","params":[""],"id":1}'
# expected
{"jsonrpc":"2.0","result":"0x0000000000000000000000000000000000000000","id":1}

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.
  • Spellcheck has been run via zk spellcheck.

@juanbono juanbono changed the title handle eth case in native erc20 token address endpoint feat: handle eth case in native erc20 token address endpoint Jan 17, 2024
@jrchatruc jrchatruc merged commit 605faac into native_erc20 Jan 17, 2024
10 of 14 checks passed
@jrchatruc jrchatruc deleted the fix_case_eth_in_native_erc20_endpoint branch January 17, 2024 16:36
Oppen pushed a commit that referenced this pull request Feb 9, 2024
feat(docs): Add Mirror hyperlink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants