Skip to content

Commit

Permalink
Release/5.22.0 (#1365)
Browse files Browse the repository at this point in the history
* Feature/soroswap (#1347)

* Feature/hash signing 2 (#1303)

* flips the session store flag, updates listeners to not be intialized … (#1169)

* capture amplitude errors to better understand why they're triggering sentry (#1167)

* flips the session store flag, updates listeners to not be intialized async for v3

* updates e2e tests for manifest v3

---------

Co-authored-by: Piyal Basu <[email protected]>

* add scripts tag for Firefox (#1294)

* uses chrome storage in migrations instead of local storage

* checks for migrated account in migration logic to set migrated network

* don't babel-polyfill contentScript (#1297)

* don't clear all of localStore on recoverAccount (#1301)

* add hash signing option (ui and data storage)

* fix redux state update; show custom errors from hardware wallet

* Added translations

* when experimental mode is enabled, switch network

* PR comments

* rm logs

---------

Co-authored-by: aristides <[email protected]>

* Feature/trustline sac (#1289)

* Bump axios, @docusaurus/core and @docusaurus/preset-classic in /docs (#1244)

Removes [axios](https://github.com/axios/axios). It's no longer used after updating ancestor dependencies [axios](https://github.com/axios/axios), [@docusaurus/core](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus) and [@docusaurus/preset-classic](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-preset-classic). These dependencies need to be updated together.


Removes `axios`

Updates `@docusaurus/core` from 2.4.1 to 3.2.1
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.2.1/packages/docusaurus)

Updates `@docusaurus/preset-classic` from 2.4.1 to 3.2.1
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.2.1/packages/docusaurus-preset-classic)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
- dependency-name: "@docusaurus/core"
  dependency-type: direct:production
- dependency-name: "@docusaurus/preset-classic"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump express from 4.18.2 to 4.19.2 in /docs (#1216)

Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump tar from 6.1.15 to 6.2.1 (#1231)

Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.15 to 6.2.1.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v6.1.15...v6.2.1)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump express from 4.18.2 to 4.19.2 (#1214)

Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump webpack-dev-middleware from 5.3.3 to 5.3.4 in /docs (#1208)

Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md)
- [Commits](webpack/webpack-dev-middleware@v5.3.3...v5.3.4)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump webpack-dev-middleware from 5.3.3 to 5.3.4 (#1207)

Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md)
- [Commits](webpack/webpack-dev-middleware@v5.3.3...v5.3.4)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump follow-redirects from 1.15.4 to 1.15.6 in /docs (#1198)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump follow-redirects from 1.15.2 to 1.15.6 (#1197)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump ip from 2.0.0 to 2.0.1 (#1128)

Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1.
- [Commits](indutny/node-ip@v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* Bump axios, @docusaurus/core and @docusaurus/preset-classic in /docs (#1055)

Removes [axios](https://github.com/axios/axios). It's no longer used after updating ancestor dependencies [axios](https://github.com/axios/axios), [@docusaurus/core](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus) and [@docusaurus/preset-classic](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-preset-classic). These dependencies need to be updated together.


Removes `axios`

Updates `@docusaurus/core` from 2.4.1 to 3.0.1
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.0.1/packages/docusaurus)

Updates `@docusaurus/preset-classic` from 2.4.1 to 3.0.1
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.0.1/packages/docusaurus-preset-classic)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
- dependency-name: "@docusaurus/core"
  dependency-type: direct:production
- dependency-name: "@docusaurus/preset-classic"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piyal Basu <[email protected]>

* first pass at adding remove dropdown

* replaces all remaining instances of wallet-sdk

* tweaks tx detail row layouts to avoid overflows

* adds getContractSpec, uses it to display parameter names in tx sign detail view

* migrates KeyManager to ts-wallet-sdk

* upgrades react and react dom types to 18

* adds react types to extension workspace, fixes type errors

* set styles for dropdown

* Added translations

* adds standalone version of getContractSpec and related helpers

* Added translations

* Added translations

* undo husky pre push comments

* Feature/p21 futurenet release (#1278)

* switch between stellar-sdk and stellar-sdk-next based on network

* increase max diff pixel ratio for playwright

* rm console

* adds tx timeout in send and swap settings

* Added translations

* tweaks tooltip text

* Added translations

* happy path for new add asset flow

* fix trustline error warning and fix naming

* Added translations

* rollback dep upgrades

* rollback changes

* rollback package-lock upgrade

* add snapshots for manage assets and send payment (#1309)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aristides Staffieri <[email protected]>

* guard against dispatching incorrect parameter (#1305)

* adds Hardware sign usage in ReviewAuth for use during invokeHostFn signing, tweaks soroban icon to not overflow in signing details (#1282)

* adds loader for hardware signing during signing (#1284)

Co-authored-by: Piyal Basu <[email protected]>

* adds sign blob error for encoding mismatch (#1300)

* fix bad merge

* [BUG] replaces all instances of pickTransfer with getTokenSpec workflow (#1312)

* replaces all instances of pickTransfer with getTokenSpec workflow

* check for transfer once token spec is confirmed

* rm unused dep

* fixes bad merge from upstream in ManageAssets

* Added translations

* remove accidental mobile4 dir addition

---------

Co-authored-by: Piyal Basu <[email protected]>

* Test/data storage (#1304)

* adds test for data storage get item

* adds tests for network migrations

* adds test for remaining migrations

* reverts bad merge from upstream

---------

Co-authored-by: Piyal Basu <[email protected]>

* [CHORE] upgrades all webpack related deps (#1307)

* upgrades all webpack related deps

* updates lock file

* updates migrations test for recent changes

* [CHORE] upgrade to docusaurus v3 (#1306)

* upgrade to docusaurus v3

* edit manifest for chrome before uploading (#1315)

* use single quotes (#1316)

---------

Co-authored-by: Piyal Basu <[email protected]>

* Fix manage assets tests (#1317)

* fix tests for new manage assets flow

* fix broken manage-assets tests

* rm unused dep

* fix e2e tests

* fix query for visible loader

* fix assets test

* selector for individual asset balance

* add better error messaging for liabilities when removing an asset (#1319)

* add better error messaging for liabilities when removing an asset

* add tests and rm sellingLiabilities

* rm more selling liabilities

* fix diff

* fix diff again

* verify params before fetching issuer info (#1320)

* add better error messaging for liabilities when removing an asset

* add tests and rm sellingLiabilities

* rm more selling liabilities

* fix diff

* fix diff again

* verify params before fetching issuer info

* test soroswap api

* pin docusaurus core to match versions

* adding soroswap tokens to swap dropdown

* split dataStorageAccess into a different file to allow for jest mocks with circular deps

* updates all references for new dataStorage path

* fix add asset padding; fix ledger trustline error; fix token-spec check (#1324)

* fix add asset padding; fix ledger trustline error; fix token-spec check

* use dynamic verified token in e2e test

* undo the hw wallet trustline error fix while I figure out how to do it properly

* revert isTokenSpec change

* better trustline error handling; fix remove token (#1326)

* starting work on bestpath

* upgrade redux toolkit (#1333)

* upgrade redux toolkit

* allow a longer timeout to account for network congestion

* styling and copy fixes

* Added translations

* upgrade soroswap sdk and break out simulation component

* Bugfix/5.20.0 qa (#1334)

* styling and copy fixes

* Added translations

* Bugfix/5.20.0 legal copy (#1337)

* legal copy changes

* Added translations

* fix go back button

* use history.goBack for go back button

* show icons for soroswap tokens and final cleanup

* remove axios and auto add the token after successful token swap

* adding comments

* enable linting

* simplify asset dropdown logic

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: aristides <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* uses key val for public keys for inflation dest and trustor fields

* adding documentation to the Soroswap methods (#1350)

* removes sentry exceptions from expected failures to fetch contract specs

* check if either asset is a soroswap token (#1353)

* adds warning for current account xlm insufficient for fee

* adds loading state for getting balances before check

* uses correct logic to check for enough xlm to cover fee

* use correct denomination for fee in xlm comparison

* make warning dismissable

* small ui fix for asset selector in ChooseAsset (#1359)

* Bump got from 11.8.2 to 11.8.5

Bumps [got](https://github.com/sindresorhus/got) from 11.8.2 to 11.8.5.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](sindresorhus/got@v11.8.2...v11.8.5)

---
updated-dependencies:
- dependency-name: got
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ws from 6.2.2 to 6.2.3

Bumps [ws](https://github.com/websockets/ws) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@6.2.2...6.2.3)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* adds malicious variant to connection request views

* adds blockaid duck

* moves blockaid scanSite to helper from duck workflow

* reverts accidental merge of blockaid scan site work

* add Soroswap link to UI (#1362)

* add Soroswap link to UI

* center subtitle

* add mocks for balance retrieval and fee calculation (#1366)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: aristides <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 11, 2024
1 parent d1b607a commit 482efff
Show file tree
Hide file tree
Showing 26 changed files with 1,064 additions and 159 deletions.
8 changes: 8 additions & 0 deletions @shared/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ export interface AssetDomains {
[code: string]: string;
}

export interface SoroswapToken {
code: string;
contract: string;
decimals: number;
icon: string;
name: string;
}

export interface NativeToken {
type: SdkAssetType;
code: string;
Expand Down
22 changes: 22 additions & 0 deletions extension/INTEGRATING_SOROSWAP.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# How to integrate with Soroswap

Integrating with [Soroswap](https://app.soroswap.finance/) allows wallets to
swap between Soroban tokens using a smart contract.

In this repo, you will find all of our logic for constructing a swap between
Soroban tokens at the path: /`src/popup/helpers/sorobanSwap.ts`.

In this file, you will find 3 key methods that utilize `soroswap-router-sdk` and
`stellar-sdk`. Please see this file for a detailed breakdown of how each of the
below functions works.

1. `getSoroswapTokens()`: This will retrieve the tokens that Soroswap supports
on each network.

2. `soroswapGetBestPath()`: This function builds the path between your starting
asset and your destination asset. This will also tell you the conversion rate
between the 2 assets. This function will be used in the 2nd function below.

3. `buildAndSimulateSoroswapTx()`: Once we have the path, we can construct a
Stellar transaction to send your starting asset and receive your destination
asset.
3 changes: 2 additions & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"sass-loader": "^14.2.1",
"semver": "^7.5.4",
"ses": "^0.18.5",
"soroswap-router-sdk": "^1.2.8",
"stellar-hd-wallet": "^0.0.10",
"stellar-identicon-js": "^1.0.0",
"stellar-sdk": "yarn:stellar-sdk@^12.1.0",
Expand Down Expand Up @@ -111,4 +112,4 @@
"stellar-sdk>stellar-base>sodium-native": false
}
}
}
}
19 changes: 5 additions & 14 deletions extension/public/static/manifest/v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@
},
"background": {
"service_worker": "background.min.js",
"scripts": [
"background.min.js"
]
"scripts": ["background.min.js"]
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"contentScript.min.js"
],
"matches": ["<all_urls>"],
"js": ["contentScript.min.js"],
"run_at": "document_start"
}
],
Expand All @@ -41,9 +35,6 @@
"48": "images/icon48.png",
"128": "images/icon128.png"
},
"permissions": [
"storage",
"alarms"
],
"permissions": ["storage", "alarms"],
"manifest_version": 3
}
}
2 changes: 1 addition & 1 deletion extension/src/popup/components/SubviewHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "./styles.scss";
interface SubviewHeaderProps {
customBackAction?: () => void;
customBackIcon?: React.ReactNode;
title: string;
title: string | React.ReactNode;
subtitle?: React.ReactNode;
hasBackButton?: boolean;
rightButton?: React.ReactNode;
Expand Down
25 changes: 20 additions & 5 deletions extension/src/popup/components/account/AccountAssets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export const AssetIcon = ({
retryAssetIconFetch,
isLPShare = false,
isSorobanToken = false,
icon,
}: {
assetIcons: AssetIcons;
code: string;
issuerKey: string;
retryAssetIconFetch?: (arg: { key: string; code: string }) => void;
isLPShare?: boolean;
isSorobanToken?: boolean;
icon?: string;
}) => {
/*
We load asset icons in 2 ways:
Expand All @@ -64,8 +66,13 @@ export const AssetIcon = ({
// For all non-XLM assets (assets where we need to fetch the icon from elsewhere), start by showing a loading state as there is work to do
const [isLoading, setIsLoading] = useState(!isXlm);

const { soroswapTokens } = useSelector(transactionSubmissionSelector);

const canonicalAsset = assetIcons[getCanonicalFromAsset(code, issuerKey)];
const imgSrc = hasError ? ImageMissingIcon : canonicalAsset || "";
let imgSrc = hasError ? ImageMissingIcon : canonicalAsset || "";
if (icon) {
imgSrc = icon;
}

const _isSorobanToken = !isSorobanToken
? issuerKey && isSorobanIssuer(issuerKey)
Expand All @@ -80,9 +87,17 @@ export const AssetIcon = ({
);
}

// Placeholder for Soroban tokens
if (_isSorobanToken) {
return <SorobanTokenIcon />;
// Get icons for Soroban tokens
if (_isSorobanToken && !icon) {
const soroswapTokenDetail = soroswapTokens.find(
(token) => token.contract === issuerKey,
);
// check to see if we have an icon from an external service, like Soroswap
if (soroswapTokenDetail?.icon) {
imgSrc = soroswapTokenDetail?.icon;
} else {
return <SorobanTokenIcon />;
}
}

// If we're waiting on the icon lookup (Method 1), just return the loader until this re-renders with `assetIcons`. We can't do anything until we have it.
Expand All @@ -93,7 +108,7 @@ export const AssetIcon = ({
}

// if we have an asset path, start loading the path in an `<img>`
return canonicalAsset || isXlm ? (
return canonicalAsset || isXlm || imgSrc ? (
<div
className={`AccountAssets__asset--logo ${
hasError ? "AccountAssets__asset--error" : ""
Expand Down
82 changes: 54 additions & 28 deletions extension/src/popup/components/manageAssets/ChooseAsset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";

import { ROUTES } from "popup/constants/routes";
import { sortBalances } from "popup/helpers/account";
import { useIsSwap } from "popup/helpers/useIsSwap";
import { useIsSoroswapEnabled, useIsSwap } from "popup/helpers/useIsSwap";
import {
transactionSubmissionSelector,
AssetSelectType,
Expand All @@ -19,6 +19,7 @@ import { SubviewHeader } from "popup/components/SubviewHeader";
import { View } from "popup/basics/layout/View";
import { getCanonicalFromAsset } from "helpers/stellar";
import { getAssetDomain } from "popup/helpers/getAssetDomain";
import { getNativeContractDetails } from "popup/helpers/searchAsset";

import { Balances } from "@shared/api/types";

Expand All @@ -33,18 +34,17 @@ interface ChooseAssetProps {

export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
const { t } = useTranslation();
const { assetIcons, assetSelect } = useSelector(
const { assetIcons, assetSelect, soroswapTokens } = useSelector(
transactionSubmissionSelector,
);
const isSorobanSuported = useSelector(settingsSorobanSupportedSelector);
const { networkUrl, networkPassphrase } = useSelector(
settingsNetworkDetailsSelector,
);
const networkDetails = useSelector(settingsNetworkDetailsSelector);

const [assetRows, setAssetRows] = useState([] as ManageAssetCurrency[]);
const ManageAssetRowsWrapperRef = useRef<HTMLDivElement>(null);
const [isLoading, setIsLoading] = useState(false);
const isSwap = useIsSwap();
const isSoroswapEnabled = useIsSoroswapEnabled();

const managingAssets = assetSelect.type === AssetSelectType.MANAGE;

Expand All @@ -68,7 +68,8 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
contractId,
} = sortedBalances[i];

if (isSwap && "decimals" in sortedBalances[i]) {
// If we are in the swap flow and the asset has decimals (is a token), we skip it if Soroswap is not enabled
if ("decimals" in sortedBalances[i] && isSwap && !isSoroswapEnabled) {
// eslint-disable-next-line
continue;
}
Expand All @@ -81,8 +82,8 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
// eslint-disable-next-line no-await-in-loop
domain = await getAssetDomain(
issuer.key as string,
networkUrl,
networkPassphrase,
networkDetails.networkUrl,
networkDetails.networkPassphrase,
);
} catch (e) {
console.error(e);
Expand Down Expand Up @@ -110,6 +111,31 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
}
}

if (isSoroswapEnabled && isSwap && !assetSelect.isSource) {
soroswapTokens.forEach((token) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const canonical = getCanonicalFromAsset(token.code, token.contract);
const nativeContractDetails =
getNativeContractDetails(networkDetails);

// if we have a balance for a token, it will have been handled above.
// This is designed to populate tokens available from Soroswap that the user does not already have
if (
balances &&
!balances[canonical] &&
token.contract !== nativeContractDetails.contract
) {
collection.push({
code: token.code,
issuer: token.contract,
image: token.icon,
domain: "",
icon: token.icon,
});
}
});
}

setAssetRows(collection);
setIsLoading(false);
};
Expand All @@ -118,11 +144,13 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
}, [
assetIcons,
balances,
networkUrl,
managingAssets,
isSorobanSuported,
isSwap,
networkPassphrase,
isSoroswapEnabled,
assetSelect.isSource,
soroswapTokens,
networkDetails,
]);

return (
Expand Down Expand Up @@ -152,24 +180,22 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => {
</div>
</div>
</View.Content>
<View.Footer isInline allowWrap>
{managingAssets && (
<>
<div className="ChooseAsset__button">
<Link to={ROUTES.searchAsset}>
<Button
size="md"
isFullWidth
variant="secondary"
data-testid="ChooseAssetAddAssetButton"
>
{t("Add an asset")}
</Button>
</Link>
</div>
</>
)}
</View.Footer>
{managingAssets && (
<View.Footer isInline allowWrap>
<div className="ChooseAsset__button">
<Link to={ROUTES.searchAsset}>
<Button
size="md"
isFullWidth
variant="secondary"
data-testid="ChooseAssetAddAssetButton"
>
{t("Add an asset")}
</Button>
</Link>
</div>
</View.Footer>
)}
</React.Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import "./styles.scss";
export type ManageAssetCurrency = StellarToml.Api.Currency & {
domain: string;
contract?: string;
icon?: string;
};

export interface NewAssetFlags {
Expand Down
Loading

0 comments on commit 482efff

Please sign in to comment.