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: Ramp #1747

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
fa0dcbc
feat: add ramp routes
UrbanWill Dec 10, 2024
815adea
feat: initial BuyForm setup
UrbanWill Dec 11, 2024
6a0a845
feat: added NumberInputWithDropdown component
UrbanWill Dec 11, 2024
ddbd15f
feat: getRampCurrencies, add ramp base path to env
UrbanWill Dec 12, 2024
c2d827d
feat: consume useGetRampCurrencies, update form
UrbanWill Dec 12, 2024
931e0f5
feat: added useGetRampAssetsByCurrency, updated buy form
UrbanWill Dec 12, 2024
f55969a
feat: debounced amount inputs to fetch up to date quotes
UrbanWill Dec 13, 2024
726b443
feat: update token/fiat based on form interaction
UrbanWill Dec 15, 2024
77ca542
feat: select account UI
UrbanWill Dec 15, 2024
749ed41
chore: added RAMP base path, path and api to env vars
UrbanWill Dec 15, 2024
e17b82f
feat: create url params and navigate on submit
UrbanWill Dec 15, 2024
f86ca1d
feat: format token plank before external navigation
UrbanWill Dec 15, 2024
09d23cf
feat: move ramp routes to Portfolio routes and layout
UrbanWill Dec 15, 2024
6de5d8b
feat: added missing UI for NumberInputWithDropDown
UrbanWill Dec 16, 2024
24b42c0
feat: added RampAccountOption
UrbanWill Dec 16, 2024
949dcea
feat: off ramp form
UrbanWill Dec 16, 2024
774e91e
feat: offramp assets hook
UrbanWill Dec 16, 2024
a74fb3a
feat: added ramp to popup routes
UrbanWill Dec 18, 2024
ca0333c
feat: added ramp ui to popup
UrbanWill Dec 18, 2024
5cf6879
fix: dropdown overflow on popup view
UrbanWill Dec 18, 2024
7add807
chore: pulled dev and solved conflicts
UrbanWill Dec 18, 2024
04994fb
fix: selected token should match chain
UrbanWill Dec 18, 2024
57f9720
feat: fetch ramp quote based on fiat or token amount
UrbanWill Dec 30, 2024
780faa1
feat: bi-directional onramp quote
UrbanWill Dec 31, 2024
dcb1737
feat: bi-directional offramp quote
UrbanWill Dec 31, 2024
cb646b4
fix: handle unsupported tokens when switching between buy/sell forms
UrbanWill Jan 1, 2025
16873eb
feat: searchable Dropdown
UrbanWill Jan 2, 2025
9dcf4a3
feat: step decimals, throw error if bad quote, cleanup
UrbanWill Jan 2, 2025
fe3fa2d
fix: searchInput import
UrbanWill Jan 2, 2025
6002ac3
feat: select button placeholder
UrbanWill Jan 2, 2025
a4331ba
feat: added Ramp url to mobile nav
UrbanWill Jan 2, 2025
01022e3
feat: added fiat currency info, logo and name
UrbanWill Jan 3, 2025
9f1b7e5
Merge branch 'feat/ramp' of github.com:TalismanSociety/talisman into …
UrbanWill Jan 3, 2025
f6107f8
chore: added SearchInput to components package
UrbanWill Jan 3, 2025
0380561
chore: moved SearchInput from components to talisman-ui package, upda…
UrbanWill Jan 3, 2025
1b55a8d
feat: add hostAppName and default flow to ramp url
UrbanWill Jan 3, 2025
456aafa
feat: cross reference supported tokens with chain data
UrbanWill Jan 4, 2025
e942ec2
feat: convert address by chain, display asset chain name
UrbanWill Jan 4, 2025
8415d45
feat: support evm tokens, activate network/token to store, perf impro…
UrbanWill Jan 5, 2025
da05268
feat: added evm token ids
UrbanWill Jan 6, 2025
89c288a
fix: minor form input UI fixes
UrbanWill Jan 6, 2025
415c7a9
feat: added toggle buy switch to expanded view
UrbanWill Jan 6, 2025
498f6da
chore: display DashboardAccountsSidebar on Ramp routes
UrbanWill Jan 6, 2025
5f99f7c
chore: hide navigation chevron on expanded view
UrbanWill Jan 6, 2025
792d95b
chore: remove old buy components
UrbanWill Jan 6, 2025
12e9ff4
feat: updated fetch remote config, mocked values, log token/chain not…
UrbanWill Jan 6, 2025
9bc43e9
chore: pulled dev and solved conflicts
UrbanWill Jan 6, 2025
dc24bd6
fix: circular dependency import
UrbanWill Jan 7, 2025
c7bd600
fix: labels, styles & placeholders
UrbanWill Jan 7, 2025
99c8a6e
fix: network specific account icon
UrbanWill Jan 7, 2025
6fa28d0
feat: min fiat amount error message
UrbanWill Jan 7, 2025
bd6cc60
chore: center cols and buy btn
UrbanWill Jan 7, 2025
6fafa4b
fix: "popup view" on exapnded clipping
UrbanWill Jan 7, 2025
ff157f7
chore: update ramp routes
UrbanWill Jan 7, 2025
9edc6a1
chore: moved ramp env vars to remote config
UrbanWill Jan 8, 2025
7ca0dbe
feat: sort tokens/accounts depending on each others chain type,
UrbanWill Jan 8, 2025
9ee83ae
feat: add account prompt
UrbanWill Jan 8, 2025
f0e5fe6
fix: added shouldRevalidate to onClea
UrbanWill Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add account prompt
  • Loading branch information
UrbanWill committed Jan 8, 2025
commit 9ee83aee5dfcb7bcd4dd77ec8ba4245bb09ece2b
6 changes: 1 addition & 5 deletions apps/extension/src/ui/domains/Ramp/RampAccountOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ export const RampAccountOption = ({ account }: RampAccountOptionProps) => {
return (
<div className="flex items-center justify-between">
<div className="flex items-center gap-5">
<AccountIcon
className="!text-xl"
address={account.address}
genesisHash={account.genesisHash}
/>
<AccountIcon className="!text-xl" address={account.address} />
<div>
<div className="text-white">{account.name}</div>
<div className="text-tiny">{shortenAddress(account.address)}</div>
Expand Down
23 changes: 23 additions & 0 deletions apps/extension/src/ui/domains/Ramp/RampConnectAccount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom"

import { api } from "@ui/api"
import { IS_POPUP } from "@ui/util/constants"

type RampConnectAccountProps = {
isEvm: boolean
}

export const RampConnectAccount = ({ isEvm }: RampConnectAccountProps) => {
const { t } = useTranslation()
const navigate = useNavigate()

return (
<button
className="border-grey-750 bg-black-secondary flex h-[5.5rem] w-max min-w-full items-center justify-center rounded-[12px] border-[1px] px-6 py-3"
onClick={() => (IS_POPUP ? api.dashboardOpen("/accounts/add") : navigate("/accounts/add"))}
>
{t(`Add ${isEvm ? "an ethereum" : "a substrate"} account `)}
</button>
)
}
37 changes: 21 additions & 16 deletions apps/extension/src/ui/domains/Ramp/RampForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useGetRampQuote } from "./hooks/useGetRampQuote"
import useSupportedTokens from "./hooks/useSupportedTokens"
import { NumberInputWithDropDown } from "./NumberInputWithDropDown"
import { RampAccountOption } from "./RampAccountOption"
import { RampConnectAccount } from "./RampConnectAccount"
import { RampOptionSwitchHeader } from "./RampOptionSwitchHeader"
import { RampAssetWithTokenAndChain, RampCurrency } from "./types"
import { truncateToSignificantDigits } from "./utils"
Expand Down Expand Up @@ -550,22 +551,26 @@ export const RampForm = () => {
<div>{t("Select account")}</div>
</div>
<div className="text-xs">{t("Deposit Account")}</div>
<Dropdown
items={accountsWithBalance.filter((acc) => acc.address !== selectedAccount?.address)}
propertyKey="address"
renderItem={(item) => <RampAccountOption account={item} />}
onChange={handleAccountChange}
placeholder={t("Select account")}
value={selectedAccount}
key={address} // uncontrolled component, will reset if value changes
buttonClassName="bg-black-secondary h-full px-6 py-3 rounded-[12px]"
optionClassName="px-6 py-3"
className="border-grey-750 bg-black-secondary flex h-[5.5rem] rounded-[12px] border-[1px]"
onClear={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.stopPropagation()
setValue("address", "")
}}
/>
{rampTokenAssetSymbol && accountsWithBalance.length === 0 ? (
<RampConnectAccount isEvm={rampTokenIsEvm} />
) : (
<Dropdown
items={accountsWithBalance.filter((acc) => acc.address !== selectedAccount?.address)}
propertyKey="address"
renderItem={(item) => <RampAccountOption account={item} />}
onChange={handleAccountChange}
placeholder={t("Select account")}
value={selectedAccount}
key={address} // uncontrolled component, will reset if value changes
buttonClassName="bg-black-secondary h-full px-6 py-3 rounded-[12px]"
optionClassName="px-6 py-3"
className="border-grey-750 bg-black-secondary flex h-[5.5rem] rounded-[12px] border-[1px]"
onClear={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.stopPropagation()
setValue("address", "")
}}
/>
)}
</div>
<Button
type="submit"
Expand Down
6 changes: 4 additions & 2 deletions packages/talisman-ui/src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ export const Dropdown = <T extends Record<string, unknown>>({
{value ? renderItem(value, propertyLabel) : placeholder}
</div>
{!disabled && canClear ? (
<XIcon className="shrink-0 text-[1.2em]" onClick={onClear} />
<button onClick={onClear}>
<XIcon className="shrink-0 text-[1.2em]" />
</button>
) : (
<ChevronDownIcon className="shrink-0 text-[1.2em]" />
!disabled && <ChevronDownIcon className="shrink-0 text-[1.2em]" />
)}
</Listbox.Button>
<div className="relative w-full">
Expand Down
Loading