-
Notifications
You must be signed in to change notification settings - Fork 889
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
Add eth_getCode support for getting address bytecode #17215
Conversation
"eth_getCode", "", MakeJsonRpcErrorResponse(-32005, "Error!")); | ||
result = GetCode("0x0d8775f648430679a709e98d2b0cb6250d2887ef", | ||
mojom::CoinType::ETH, mojom::kMainnetChainId); | ||
EXPECT_FALSE(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also check error and error_message when it is absl::nullopt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick review. I amended a change to follow a pattern in that file of passing in the expected values.
18b7d0950425c995900c66e478012f0d7713af97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gave a look through the parsing logic here and seems good to me from a security perspective
This is intended to be used to check if an address is an EOA or a contract You can query > const apiProxy = getWalletPanelApiProxy() > const jsonRpcService = apiProxy.jsonRpcService > console.log('BAT rpc service get code: ', await jsonRpcService.getCode('0x0d8775f648430679a709e98d2b0cb6250d2887ef', BraveWallet.CoinType.ETH, '0x1')) > console.log('EOA rpc service get code: ', await jsonRpcService.getCode('0x...', BraveWallet.CoinType.ETH, '0x1')) This would output the bytecode in hex format for the BAT price and the string 0x for the EOA address.
This is intended to be used to check if an address is an EOA or a contract You can query ```js const apiProxy = getWalletPanelApiProxy() const jsonRpcService = apiProxy.jsonRpcService console.log('BAT rpc service get code: ', await jsonRpcService.getCode('0x0d8775f648430679a709e98d2b0cb6250d2887ef', BraveWallet.CoinType.ETH, '0x1')) console.log('EOA rpc service get code: ', await jsonRpcService.getCode('0x...', BraveWallet.CoinType.ETH, '0x1')) ``` This would output the bytecode in hex format for the BAT price and the string 0x for the EOA address.
…17426) * Add eth_getCode support for getting address bytecode (#17215) This is intended to be used to check if an address is an EOA or a contract You can query ```js const apiProxy = getWalletPanelApiProxy() const jsonRpcService = apiProxy.jsonRpcService console.log('BAT rpc service get code: ', await jsonRpcService.getCode('0x0d8775f648430679a709e98d2b0cb6250d2887ef', BraveWallet.CoinType.ETH, '0x1')) console.log('EOA rpc service get code: ', await jsonRpcService.getCode('0x...', BraveWallet.CoinType.ETH, '0x1')) ``` This would output the bytecode in hex format for the BAT price and the string 0x for the EOA address. * Merge pull request #17333 from brave/view-contract-in-transaction-panel fix(wallet): View Contract in Transaction Panel --------- Co-authored-by: Brian R. Bondy <[email protected]>
Resolves brave/brave-browser#28518
This is intended to be used to check if an address is an EOA or a contract
You can query
This would output the bytecode in hex format for the BAT price and the string 0x for the EOA address.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: