From 24c7b6c20be16ad946f0dbcf3946bc92fc753b46 Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 17 Nov 2023 08:09:40 +0200 Subject: [PATCH 1/5] feat: use new tokens API --- package-lock.json | 9 --- packages/app/package.json | 1 - packages/app/src/components/FeeData.vue | 8 +-- .../app/src/components/TokenAmountPrice.vue | 36 ++++------- .../app/src/components/TokenIconLabel.vue | 19 +++--- .../src/components/balances/BalanceValue.vue | 23 +++----- .../app/src/components/balances/Table.vue | 10 +++- .../common/table/fields/TokenPrice.vue | 4 +- .../src/components/token/TokenListTable.vue | 4 +- .../transactions/EthAmountPrice.vue | 8 +-- .../app/src/components/transactions/Table.vue | 26 +++++--- .../TokenAmountPriceTableCell.vue | 59 +++++++------------ .../infoTable/TransferTableCell.vue | 2 +- .../app/src/components/transfers/Table.vue | 3 +- packages/app/src/composables/common/Api.d.ts | 3 + packages/app/src/composables/useToken.ts | 21 +------ .../app/src/composables/useTokenLibrary.ts | 23 +++----- packages/app/src/composables/useTokenPrice.ts | 58 ------------------ .../app/src/composables/useTransaction.ts | 10 +++- packages/app/src/utils/constants.ts | 9 +-- packages/app/tests/components/FeeData.spec.ts | 10 ++-- .../tests/components/TokenAmountPrice.spec.ts | 16 ++--- .../tests/components/TokenIconLabel.spec.ts | 15 ++--- .../components/balances/BalanceValue.spec.ts | 15 ++--- .../tests/components/balances/Table.spec.ts | 23 ++++---- .../components/token/TokenListTable.spec.ts | 11 ++-- .../components/transactions/Table.spec.ts | 21 ++----- .../TokenAmountPriceTableCell.spec.ts | 24 ++------ .../transactions/TransferTableCell.spec.ts | 1 - .../tests/components/transfers/Table.spec.ts | 18 ++---- .../app/tests/composables/useToken.spec.ts | 14 +++-- .../tests/composables/useTokenLibrary.spec.ts | 44 +++++++------- .../tests/composables/useTokenPrice.spec.ts | 54 ----------------- .../tests/composables/useTransaction.spec.ts | 33 +++++++---- packages/app/tests/mocks.ts | 14 +++++ 35 files changed, 230 insertions(+), 419 deletions(-) delete mode 100644 packages/app/src/composables/useTokenPrice.ts delete mode 100644 packages/app/tests/composables/useTokenPrice.spec.ts diff --git a/package-lock.json b/package-lock.json index 4740048ce2..7e845b2567 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5952,14 +5952,6 @@ "integrity": "sha512-JW7nHREPqEtjBWz3EfxLarkmJBD8vi7Kx/1AQ6eBZnz12eHc1VkOyrc6mpR5ogTf0dOUNXFAfZut+cDe2dn4kQ==", "dev": true }, - "node_modules/@matterlabs/token-library": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@matterlabs/token-library/-/token-library-2.9.0.tgz", - "integrity": "sha512-Xkp0n0NdmG5UqHMRtY6BJSWbfTgv8OjhkWYuaevhwjb8+0uv3GpJC++2webB0jdebDVQBFUiwcC+Er7E49sryQ==", - "dependencies": { - "ohmyfetch": "^0.4.21" - } - }, "node_modules/@mdx-js/loader": { "version": "1.6.22", "resolved": "https://registry.npmjs.org/@mdx-js/loader/-/loader-1.6.22.tgz", @@ -54492,7 +54484,6 @@ "license": "MIT", "dependencies": { "@matterlabs/composables": "1.1.7", - "@matterlabs/token-library": "2.9.0", "@vueuse/components": "8.9.2", "@vueuse/core": "8.9.2", "date-fns": "2.28.0", diff --git a/packages/app/package.json b/packages/app/package.json index 7dcfb315ae..9e7060b904 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -26,7 +26,6 @@ }, "dependencies": { "@matterlabs/composables": "1.1.7", - "@matterlabs/token-library": "2.9.0", "@vueuse/components": "8.9.2", "@vueuse/core": "8.9.2", "date-fns": "2.28.0", diff --git a/packages/app/src/components/FeeData.vue b/packages/app/src/components/FeeData.vue index 4663877049..fadf95e40d 100644 --- a/packages/app/src/components/FeeData.vue +++ b/packages/app/src/components/FeeData.vue @@ -62,7 +62,7 @@ import useToken from "@/composables/useToken"; import type { Token } from "@/composables/useToken"; import type { FeeData } from "@/composables/useTransaction"; -import { ETH_TOKEN } from "@/utils/constants"; +import { ETH_TOKEN_L2_ADDRESS } from "@/utils/constants"; const props = defineProps({ showDetails: { @@ -81,7 +81,7 @@ const collapsed = ref(false); const buttonTitle = computed(() => collapsed.value ? t("transactions.table.feeDetails.closeDetails") : t("transactions.table.feeDetails.moreDetails") ); -getTokenInfo(ETH_TOKEN.l2Address); +getTokenInfo(ETH_TOKEN_L2_ADDRESS); const initialFee = computed(() => { if (props.feeData) { @@ -89,8 +89,8 @@ const initialFee = computed(() => { } return null; }); -const token = computed(() => { - return tokenInfo.value ?? { ...ETH_TOKEN, usdPrice: null }; +const token = computed(() => { + return tokenInfo.value; });