-
Notifications
You must be signed in to change notification settings - Fork 128
feat: shielded swaps #1980
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
Open
mateuszjasiuk
wants to merge
48
commits into
main
Choose a base branch
from
feat/shielded-swaps
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: shielded swaps #1980
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
d879ff7
feat: osmosis swap messages
mateuszjasiuk 472e93f
feat: hardcoded values for transparent osmosis swap
mateuszjasiuk ec2138a
feat: hardcoded values for shielded osmosis swap
mateuszjasiuk 33c7cba
feat: osmosis calcs shiz wip
mateuszjasiuk 6678d71
feat: query osmosis sqs for quote
mateuszjasiuk e2f3121
feat: correct osmosis swap data
mateuszjasiuk 93453b6
feat: correct slippage and price
mateuszjasiuk 4199570
feat: wire in swaps
mateuszjasiuk 068de06
feat: use correct namada assets
mateuszjasiuk d183d19
swaps wip
mateuszjasiuk d0e34c1
fix: rebase errors
mateuszjasiuk 14194fd
feat: wip channels
mateuszjasiuk b1dc7fb
feat: swapping UI
mateuszjasiuk ac349b6
chore: rebase cleanup
mateuszjasiuk 7aa69f5
feat: ui
mateuszjasiuk b57df32
feat: UI assets selectors
mateuszjasiuk 190c816
feat: UI display denominated values
mateuszjasiuk d736342
feat: UI display fiat values
mateuszjasiuk 7a6475e
feat: persist last selected swap assets in local storage
mateuszjasiuk 29642ae
feat: replace assets logic
mateuszjasiuk e06cc82
feat: validation and state improvements
mateuszjasiuk da1fe3b
feat: debounce the quote calls
mateuszjasiuk dc9b5c7
feat: improve validations for tokens without balance
mateuszjasiuk 5041a82
feat: display swap details - fee
mateuszjasiuk d33a29c
feat: do not update outdated state in async call
mateuszjasiuk 7aee983
feat: enable shielded swaps
mateuszjasiuk 5c8f54b
feat: shielded swaps toast
mateuszjasiuk 98ca15b
feat: shielded swaps animations and fixes
mateuszjasiuk f2128a7
feat: shielded swaps - prod ready refactor
mateuszjasiuk c1d288d
feat: shielded swaps - refactor cd
mateuszjasiuk 605a490
feat: error handling
mateuszjasiuk cf5b0bb
feat: navigation
mateuszjasiuk 0d016f8
feat: merge swap state with assets
mateuszjasiuk 650df67
feat: disposable signer
mateuszjasiuk bb7cd95
feat: refund target
mateuszjasiuk 3563a94
chore: cleanup
mateuszjasiuk 88dff2e
feat: parse tx osmosis swap name in the extension
mateuszjasiuk 6423d4d
feat: move connect wallet button to the calculations view
mateuszjasiuk 6336392
chore: cleanup todos
mateuszjasiuk 7acbb50
fix: rebase conflicts
mateuszjasiuk e2dc20d
chore: use beta sdkjs
mateuszjasiuk 9e06daf
chore: cleanup
mateuszjasiuk cd9a7aa
fix: tests
mateuszjasiuk b8b8892
fix: code review comments
mateuszjasiuk fd2c475
fix: move animation and success view up
mateuszjasiuk 5ead24e
fix: display Connect to osmosis when last connected chain is not osmosis
mateuszjasiuk 09ab13d
feat: add link to osmosis
mateuszjasiuk 2b3389c
fix: import amountMaxDecimalPlaces from utils into transfersource
neocybereth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,5 +36,8 @@ yarn-error.log* | |
| !.yarn/sdks | ||
| !.yarn/versions | ||
|
|
||
| .yalc | ||
| yalc.lock | ||
|
|
||
| # Local Netlify folder | ||
| .netlify | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { routes } from "App/routes"; | ||
| import { BsQuestionCircleFill } from "react-icons/bs"; | ||
| import { Link, useNavigate } from "react-router-dom"; | ||
| import { IconTooltip } from "./IconTooltip"; | ||
|
|
||
| export const LedgerDeviceTooltip = (): JSX.Element => { | ||
| const navigate = useNavigate(); | ||
| return ( | ||
| <IconTooltip | ||
| className="absolute w-4 h-4 top-0 right-0 mt-4 mr-5" | ||
| icon={<BsQuestionCircleFill className="w-4 h-4 text-yellow" />} | ||
| text={ | ||
| <span> | ||
| If your device is connected and the app is open, please go to{" "} | ||
| <Link | ||
| onClick={(e) => { | ||
| e.preventDefault(); | ||
| navigate(routes.settingsLedger, { | ||
| state: { backgroundLocation: location }, | ||
| }); | ||
| }} | ||
| to={routes.settingsLedger} | ||
| className="text-yellow" | ||
| > | ||
| Settings | ||
| </Link>{" "} | ||
| and pair your device with Namadillo. | ||
| </span> | ||
| } | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { Stack } from "@namada/components"; | ||
| import { Search } from "App/Common/Search"; | ||
| import { SelectModal } from "App/Common/SelectModal"; | ||
| import { TokenCard } from "App/Common/TokenCard"; | ||
| import { ConnectedWalletInfo } from "App/Transfer/ConnectedWalletInfo"; | ||
| import { nativeTokenAddressAtom } from "atoms/chain/atoms"; | ||
| import { applicationFeaturesAtom } from "atoms/settings/atoms"; | ||
| import BigNumber from "bignumber.js"; | ||
| import clsx from "clsx"; | ||
| import { useAtomValue } from "jotai"; | ||
| import { useMemo, useState } from "react"; | ||
| import { twMerge } from "tailwind-merge"; | ||
| import { Address, Asset, NamadaAsset } from "types"; | ||
|
|
||
| type DisplayAmount = BigNumber; | ||
| type FiatAmount = BigNumber; | ||
| type SelectWalletModalProps = { | ||
| onClose: () => void; | ||
| onSelect: (address: Address) => void; | ||
| assets: Asset[]; | ||
| walletAddress: string; | ||
| ibcTransfer?: "deposit" | "withdraw"; | ||
| balances?: Record<Address, [DisplayAmount, FiatAmount?]>; | ||
| }; | ||
|
|
||
| export const SelectAssetModal = ({ | ||
| onClose, | ||
| onSelect, | ||
| assets, | ||
| walletAddress, | ||
| ibcTransfer, | ||
| balances, | ||
| }: SelectWalletModalProps): JSX.Element => { | ||
| const { namTransfersEnabled } = useAtomValue(applicationFeaturesAtom); | ||
| const nativeTokenAddress = useAtomValue(nativeTokenAddressAtom).data; | ||
|
|
||
| const [filter, setFilter] = useState(""); | ||
|
|
||
| const filteredAssets = useMemo(() => { | ||
| return assets.filter( | ||
| (asset) => | ||
| asset.name.toLowerCase().indexOf(filter.toLowerCase()) >= 0 || | ||
| asset.symbol.toLowerCase().indexOf(filter.toLowerCase()) >= 0 | ||
| ); | ||
| }, [assets, filter]); | ||
|
|
||
| return ( | ||
| <SelectModal title="Select Asset" onClose={onClose}> | ||
| <ConnectedWalletInfo walletAddress={walletAddress} /> | ||
| <div className="my-4"> | ||
| <Search placeholder="Search asset" onChange={setFilter} /> | ||
| </div> | ||
| <Stack | ||
| as="ul" | ||
| gap={0} | ||
| className="max-h-[400px] overflow-auto dark-scrollbar pb-4 mr-[-0.5rem]" | ||
| > | ||
| {filteredAssets.map((asset) => { | ||
| // Fpr IbcTransfer(Deposits), we consider base denom as a token address. | ||
| const tokenAddress = | ||
| ibcTransfer === "deposit" ? | ||
| asset.base | ||
| : (asset as NamadaAsset).address; | ||
|
|
||
| const disabled = | ||
| !namTransfersEnabled && asset.address === nativeTokenAddress; | ||
| return ( | ||
| <li key={asset.base} className="text-sm"> | ||
| <button | ||
| onClick={() => { | ||
| onSelect(tokenAddress); | ||
| onClose(); | ||
| }} | ||
| className={twMerge( | ||
| clsx( | ||
| "text-left px-4 py-2.5", | ||
| "w-full rounded-sm border border-transparent", | ||
| "hover:border-neutral-400 transition-colors duration-150", | ||
| { "pointer-events-none opacity-50": disabled } | ||
| ) | ||
| )} | ||
| disabled={disabled} | ||
| > | ||
| <TokenCard | ||
| asset={asset} | ||
| address={tokenAddress} | ||
| disabled={disabled} | ||
| balance={balances?.[tokenAddress]} | ||
| /> | ||
| </button> | ||
| </li> | ||
| ); | ||
| })} | ||
| {filteredAssets.length === 0 && ( | ||
| <p className="py-2 font-light">There are no available assets</p> | ||
| )} | ||
| </Stack> | ||
| </SelectModal> | ||
| ); | ||
| }; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...adillo/src/App/Transfer/SelectedAsset.tsx → ...amadillo/src/App/Common/SelectedAsset.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.