-
Notifications
You must be signed in to change notification settings - Fork 920
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(wallet): add swap functionality on Polygon with 0x #12382
Conversation
A Storybook has been deployed to preview UI for the latest push |
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.
++ for cpp side of things.
components/brave_wallet_ui/components/shared/create-network-icon/index.tsx
Show resolved
Hide resolved
As long 0x services are restricted for several countries, like Venezuela, how this API gonna work on Brave? |
42a0913
to
8b796e5
Compare
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.
Good work!
Very exciting! 🙂
A Storybook has been deployed to preview UI for the latest push |
Tested locally the token-lists update using dev goupdater. Screen.Recording.2022-02-25.at.10.39.52.PM.mov |
Verification notes from @srirambv can be found via #12486 (comment). |
Overview
This PR integrates 0x API on Polygon aggregating popular liquidity sources such as QuickSwap, SushiSwap, Curve, Dodo, mStable, Dfyn, Cometh and more. Most of the heavy-lifting was already taken care of by the
useSwap
hook, although this PR brings a few general improvements and bug fixes.Summary of changes
🧙 Swap tab is now active when Polygon network is selected.
🪙 Preloaded tokens on Polygon. Add Polygon tokens list token-lists#5
✨

MATIC
, Polygon network, and ERC-20 tokens now use the Polygon logo.🔧 There's now a
makeNetworkAsset
utility available to obtain theBlockchainToken
corresponding to someEthereumChain
type. Hardcoded occurrences ofETH
asset have been replaced with a generic native token.🐞 Handle crash scenario when swap assets list has not been loaded yet into the Redux store.
✨ Refactor
create-network-icon
andcreate-placeholder-icon
to make sure it works for all EVM networks, and not just Ethereum.🐞 Fixed a bug in
useBalance
hook where the following two scenarios were considered equal:We instead now explicitly require callers to make use of
makeNetworkAsset()
in order to obtain the account balance:Resolves brave/brave-browser#21264.
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
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Demo 📹
0xb8717f921cd9c252f0a7b94856f23b6eea6544ea45ed3ab46e20431139802a32
screen-recording-2022-02-23-at-105646-pm_O2qbAr8Q.mov