From 64ef2c4265008492bcbf4a57f0de014315ff1bb0 Mon Sep 17 00:00:00 2001 From: mootz12 Date: Mon, 16 Sep 2024 13:41:26 -0400 Subject: [PATCH] chore: upgrade wallet-kit to v1.2 and next to v14 --- next-env.d.ts | 2 +- next.config.mjs | 5 +- package-lock.json | 389 ++++++++++-------- package.json | 11 +- src/components/backstop/BackstopAPR.tsx | 15 +- src/components/backstop/BackstopHeader.tsx | 6 +- src/components/backstop/BackstopJoinAnvil.tsx | 5 +- src/components/borrow/BorrowMarketCard.tsx | 6 +- src/components/borrow/BorrowPositionCard.tsx | 7 +- src/components/common/FlameIcon.tsx | 18 +- src/components/common/Icon.tsx | 39 +- src/components/dashboard/PositionOverview.tsx | 7 +- src/components/lend/LendMarketCard.tsx | 6 +- src/components/lend/LendPositionCard.tsx | 6 +- src/components/pool/PoolIcon.tsx | 10 +- src/contexts/wallet.tsx | 13 +- src/pages/backstop-token.tsx | 4 +- src/pages/borrow.tsx | 5 +- src/pages/repay.tsx | 8 +- src/pages/supply.tsx | 12 +- src/pages/withdraw.tsx | 24 +- 21 files changed, 335 insertions(+), 263 deletions(-) diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03..a4a7b3f 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/next.config.mjs b/next.config.mjs index da19137..e927e27 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -4,9 +4,10 @@ const nextConfig = { reactStrictMode: true, images: { - unoptimized: true, // Note: Required for static builds + unoptimized: true, }, trailingSlash: true, + output: 'export', }; -export default nextConfig +export default nextConfig; diff --git a/package-lock.json b/package-lock.json index ff379e5..f0a3853 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,18 +8,18 @@ "name": "blend-ui", "version": "1.1.0", "dependencies": { - "@blend-capital/blend-sdk": "2.0.1", - "@creit.tech/stellar-wallets-kit": "0.8.2", + "@blend-capital/blend-sdk": "2.0.3", + "@creit.tech/stellar-wallets-kit": "1.2.1", "@emotion/react": "^11.9.3", "@emotion/styled": "^11.9.3", "@mui/icons-material": "^5.8.4", "@mui/material": "^5.8.6", - "@stellar/freighter-api": "^2.0.0", + "@stellar/freighter-api": "^3.0.0", "@stellar/stellar-sdk": "12.2.0", "@tanstack/react-query": "5.52.0", "bignumber.js": "^9.0.2", "copy-to-clipboard": "^3.3.3", - "next": "^12.3.4", + "next": "^14.2.11", "react": "^18.2.0", "react-countdown": "^2.3.5", "react-dom": "^18.2.0", @@ -192,9 +192,9 @@ } }, "node_modules/@blend-capital/blend-sdk": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@blend-capital/blend-sdk/-/blend-sdk-2.0.1.tgz", - "integrity": "sha512-KpkFwdY07+ErxjzF/PEaIWr+IS6NiZIm0nzxGqMBDaXTXYoANg9j1YEr8RQMf04Rdqsl8aSPD934mjJ1sE8Qbw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@blend-capital/blend-sdk/-/blend-sdk-2.0.3.tgz", + "integrity": "sha512-KdtHfTNA+9RVuL9nXixLYsyNw8zieKXESPyaVPE7tQ+OX5fxOKXCXZXuS3z9ohiJJBzwARoMgI6IfgEw01JJhQ==", "license": "MIT", "dependencies": { "@stellar/stellar-sdk": "12.2.0", @@ -202,28 +202,77 @@ "follow-redirects": ">=1.15.6" } }, - "node_modules/@creit-tech/xbull-wallet-connect": { - "version": "0.2.0", - "resolved": "git+ssh://git@github.com/Creit-Tech/xBull-Wallet-Connect.git#a93e2e0d97c61bbd83fedcca0c71feef9f28b2d3", - "dependencies": { - "rxjs": "^7.5.5", - "tweetnacl": "^1.0.3", - "tweetnacl-util": "^0.15.1" - } - }, "node_modules/@creit.tech/stellar-wallets-kit": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/@creit.tech/stellar-wallets-kit/-/stellar-wallets-kit-0.8.2.tgz", - "integrity": "sha512-Uqa7ywA/vj+8+LTuDbLoE12OhFfuL/y9lziTKHv6jmmUnN9oPr1e6qiSX1kMJ+y9HOrDcj/e65kSck5Ao0i1dQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@creit.tech/stellar-wallets-kit/-/stellar-wallets-kit-1.2.1.tgz", + "integrity": "sha512-MHvA6kwXaOFIdbQiGcYGNtn6RICpIWpnzarkdEGJq7EQkR3Is5bgv4izfcWj62QDdYwB2PqaIc+oGC/WLL1yUg==", "dependencies": { "@albedo-link/intent": "0.12.0", - "@creit-tech/xbull-wallet-connect": "github:Creit-Tech/xBull-Wallet-Connect#0.2.0", + "@creit.tech/xbull-wallet-connect": "0.3.0", "@lobstrco/signer-extension-api": "1.0.0-beta.0", - "@stellar/freighter-api": "2.0.0", + "@ngneat/elf": "2.5.1", + "@ngneat/elf-devtools": "1.3.0", + "@ngneat/elf-entities": "5.0.2", + "@ngneat/elf-persist-state": "1.2.1", + "@stellar/freighter-api": "3.0.0", "@walletconnect/modal": "2.6.2", "@walletconnect/sign-client": "2.11.2", - "events": "^3.3.0", - "lit": "^2.2.4" + "events": "3.3.0", + "lit": "3.2.0", + "rxjs": "7.8.1" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@creit.tech/stellar-wallets-kit/node_modules/@lit/reactive-element": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.4.tgz", + "integrity": "sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.2.0" + } + }, + "node_modules/@creit.tech/stellar-wallets-kit/node_modules/lit": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-3.2.0.tgz", + "integrity": "sha512-s6tI33Lf6VpDu7u4YqsSX78D28bYQulM+VAzsGch4fx2H0eLZnJsUBsPWmGYSGoKDNbjtRv02rio1o+UdPVwvw==", + "license": "BSD-3-Clause", + "dependencies": { + "@lit/reactive-element": "^2.0.4", + "lit-element": "^4.1.0", + "lit-html": "^3.2.0" + } + }, + "node_modules/@creit.tech/stellar-wallets-kit/node_modules/lit-element": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.1.0.tgz", + "integrity": "sha512-gSejRUQJuMQjV2Z59KAS/D4iElUhwKpIyJvZ9w+DIagIQjfJnhR20h2Q5ddpzXGS+fF0tMZ/xEYGMnKmaI/iww==", + "license": "BSD-3-Clause", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.2.0", + "@lit/reactive-element": "^2.0.4", + "lit-html": "^3.2.0" + } + }, + "node_modules/@creit.tech/stellar-wallets-kit/node_modules/lit-html": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.2.0.tgz", + "integrity": "sha512-pwT/HwoxqI9FggTrYVarkBKFN9MlTUpLrDHubTmW4SrkL3kkqW5gxwbxMMUnbbRHBC0WTZnYHcjDSCM559VyfA==", + "license": "BSD-3-Clause", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/@creit.tech/xbull-wallet-connect": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@creit.tech/xbull-wallet-connect/-/xbull-wallet-connect-0.3.0.tgz", + "integrity": "sha512-pByi0bTAWd2ZdolVtkXcAU1DYTtz/cJc/IkRUz9x9/1NsFVyrM4UxE8tHgVZ3mwrJ4josoDwYP957ynQw195YQ==", + "dependencies": { + "rxjs": "^7.5.5", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1" }, "engines": { "node": ">=16" @@ -780,9 +829,9 @@ } }, "node_modules/@next/env": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/env/-/env-12.3.4.tgz", - "integrity": "sha512-H/69Lc5Q02dq3o+dxxy5O/oNxFsZpdL6WREtOOtOM1B/weonIwDXkekr1KV5DPVPr12IHFPrMrcJQ6bgPMfn7A==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.11.tgz", + "integrity": "sha512-HYsQRSIXwiNqvzzYThrBwq6RhXo3E0n8j8nQnAs8i4fCEo2Zf/3eS0IiRA8XnRg9Ha0YnpkyJZIZg1qEwemrHw==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -794,42 +843,10 @@ "glob": "7.1.7" } }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz", - "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz", - "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-darwin-arm64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz", - "integrity": "sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.11.tgz", + "integrity": "sha512-eiY9u7wEJZWp/Pga07Qy3ZmNEfALmmSS1HtsJF3y1QEyaExu7boENz11fWqDmZ3uvcyAxCMhTrA1jfVxITQW8g==", "cpu": [ "arm64" ], @@ -843,9 +860,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.4.tgz", - "integrity": "sha512-PPF7tbWD4k0dJ2EcUSnOsaOJ5rhT3rlEt/3LhZUGiYNL8KvoqczFrETlUx0cUYaXe11dRA3F80Hpt727QIwByQ==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.11.tgz", + "integrity": "sha512-lnB0zYCld4yE0IX3ANrVMmtAbziBb7MYekcmR6iE9bujmgERl6+FK+b0MBq0pl304lYe7zO4yxJus9H/Af8jbg==", "cpu": [ "x64" ], @@ -858,42 +875,10 @@ "node": ">= 10" } }, - "node_modules/@next/swc-freebsd-x64": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz", - "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz", - "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz", - "integrity": "sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.11.tgz", + "integrity": "sha512-Ulo9TZVocYmUAtzvZ7FfldtwUoQY0+9z3BiXZCLSUwU2bp7GqHA7/bqrfsArDlUb2xeGwn3ZuBbKtNK8TR0A8w==", "cpu": [ "arm64" ], @@ -907,9 +892,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz", - "integrity": "sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.11.tgz", + "integrity": "sha512-fH377DnKGyUnkWlmUpFF1T90m0dADBfK11dF8sOQkiELF9M+YwDRCGe8ZyDzvQcUd20Rr5U7vpZRrAxKwd3Rzg==", "cpu": [ "arm64" ], @@ -923,9 +908,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz", - "integrity": "sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.11.tgz", + "integrity": "sha512-a0TH4ZZp4NS0LgXP/488kgvWelNpwfgGTUCDXVhPGH6pInb7yIYNgM4kmNWOxBFt+TIuOH6Pi9NnGG4XWFUyXQ==", "cpu": [ "x64" ], @@ -939,9 +924,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz", - "integrity": "sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.11.tgz", + "integrity": "sha512-DYYZcO4Uir2gZxA4D2JcOAKVs8ZxbOFYPpXSVIgeoQbREbeEHxysVsg3nY4FrQy51e5opxt5mOHl/LzIyZBoKA==", "cpu": [ "x64" ], @@ -955,9 +940,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz", - "integrity": "sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.11.tgz", + "integrity": "sha512-PwqHeKG3/kKfPpM6of1B9UJ+Er6ySUy59PeFu0Un0LBzJTRKKAg2V6J60Yqzp99m55mLa+YTbU6xj61ImTv9mg==", "cpu": [ "arm64" ], @@ -971,9 +956,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz", - "integrity": "sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.11.tgz", + "integrity": "sha512-0U7PWMnOYIvM74GY6rbH6w7v+vNPDVH1gUhlwHpfInJnNe5LkmUZqhp7FNWeNa5wbVgRcRi1F1cyxp4dmeLLvA==", "cpu": [ "ia32" ], @@ -987,9 +972,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz", - "integrity": "sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.11.tgz", + "integrity": "sha512-gQpS7mcgovWoaTG1FbS5/ojF7CGfql1Q0ZLsMrhcsi2Sr9HEqsUZ70MPJyaYBXbk6iEAP7UXMD9HC8KY1qNwvA==", "cpu": [ "x64" ], @@ -1002,6 +987,40 @@ "node": ">= 10" } }, + "node_modules/@ngneat/elf": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@ngneat/elf/-/elf-2.5.1.tgz", + "integrity": "sha512-13BItNZFgHglTiXuP9XhisNczwQ5QSzH+imAv9nAPsdbCq/3ortqkIYRnlxB8DGPVcuIjLujQ4OcZa+9QWgZtw==", + "license": "MIT", + "peerDependencies": { + "rxjs": ">=7.0.0" + } + }, + "node_modules/@ngneat/elf-devtools": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ngneat/elf-devtools/-/elf-devtools-1.3.0.tgz", + "integrity": "sha512-J9+4Vk/S/nKFGnXGZUDYrIx/K8Jfv4TLpzR3voBSOtSeq+c8Q0hdmo8iW7oaK6y5FWFDk0VJktlEh9cjylYxFg==", + "license": "MIT" + }, + "node_modules/@ngneat/elf-entities": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ngneat/elf-entities/-/elf-entities-5.0.2.tgz", + "integrity": "sha512-G4ag51lvM3tOSgpxVVFYAgsh/bOL5BkNb4Z0VtosaM/CTWTHoNrf8UdvcaeJ3+sP1RS3bmEdZ9xUE8ifnVxssA==", + "license": "MIT", + "peerDependencies": { + "@ngneat/elf": ">=2.5.0", + "rxjs": ">=7.0.0" + } + }, + "node_modules/@ngneat/elf-persist-state": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@ngneat/elf-persist-state/-/elf-persist-state-1.2.1.tgz", + "integrity": "sha512-R+5IRLC35cDT403sSs37UeqqOpHNnCwHl3eicPv/Rc+JJ7Av1bcQClSF2mHC0jE4pkYmEuVghpzUntvmrKCCwA==", + "license": "MIT", + "peerDependencies": { + "rxjs": ">=7.0.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1484,9 +1503,10 @@ } }, "node_modules/@stellar/freighter-api": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-2.0.0.tgz", - "integrity": "sha512-j/R7MLPL8S3QhwOEdAxSl7MgWBTXWlOXQKQyXR8mPk1JMKKR4tF8e4U+Fs9TPQH0HZoYqfVDvLOOUrTMMY058Q==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-3.0.0.tgz", + "integrity": "sha512-AI1AeHnCPLMcM8d6182FScOJjCFd1tLZcNuu5M10NmtuLfNzavw+f991dWBoz6h41mOKjauIaojR+7VfU2nULg==", + "license": "Apache-2.0" }, "node_modules/@stellar/js-xdr": { "version": "3.1.2", @@ -1526,12 +1546,19 @@ "urijs": "^1.19.1" } }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "license": "Apache-2.0" + }, "node_modules/@swc/helpers": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.11.tgz", - "integrity": "sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw==", - "license": "MIT", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", + "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", + "license": "Apache-2.0", "dependencies": { + "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, @@ -2497,6 +2524,17 @@ "ieee754": "^1.2.1" } }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -2609,6 +2647,12 @@ "consola": "^3.2.3" } }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, "node_modules/clipboardy": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-4.0.0.tgz", @@ -4059,8 +4103,7 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/h3": { "version": "1.11.1", @@ -5132,51 +5175,48 @@ "dev": true }, "node_modules/next": { - "version": "12.3.4", - "resolved": "https://registry.npmjs.org/next/-/next-12.3.4.tgz", - "integrity": "sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ==", + "version": "14.2.11", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.11.tgz", + "integrity": "sha512-8MDFqHBhdmR2wdfaWc8+lW3A/hppFe1ggQ9vgIu/g2/2QEMYJrPoQP6b+VNk56gIug/bStysAmrpUKtj3XN8Bw==", "license": "MIT", "dependencies": { - "@next/env": "12.3.4", - "@swc/helpers": "0.4.11", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.0.7", - "use-sync-external-store": "1.2.0" + "@next/env": "14.2.11", + "@swc/helpers": "0.5.5", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", + "postcss": "8.4.31", + "styled-jsx": "5.1.1" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": ">=12.22.0" + "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-android-arm-eabi": "12.3.4", - "@next/swc-android-arm64": "12.3.4", - "@next/swc-darwin-arm64": "12.3.4", - "@next/swc-darwin-x64": "12.3.4", - "@next/swc-freebsd-x64": "12.3.4", - "@next/swc-linux-arm-gnueabihf": "12.3.4", - "@next/swc-linux-arm64-gnu": "12.3.4", - "@next/swc-linux-arm64-musl": "12.3.4", - "@next/swc-linux-x64-gnu": "12.3.4", - "@next/swc-linux-x64-musl": "12.3.4", - "@next/swc-win32-arm64-msvc": "12.3.4", - "@next/swc-win32-ia32-msvc": "12.3.4", - "@next/swc-win32-x64-msvc": "12.3.4" + "@next/swc-darwin-arm64": "14.2.11", + "@next/swc-darwin-x64": "14.2.11", + "@next/swc-linux-arm64-gnu": "14.2.11", + "@next/swc-linux-arm64-musl": "14.2.11", + "@next/swc-linux-x64-gnu": "14.2.11", + "@next/swc-linux-x64-musl": "14.2.11", + "@next/swc-win32-arm64-msvc": "14.2.11", + "@next/swc-win32-ia32-msvc": "14.2.11", + "@next/swc-win32-x64-msvc": "14.2.11" }, "peerDependencies": { - "fibers": ">= 3.1.0", - "node-sass": "^6.0.0 || ^7.0.0", - "react": "^17.0.2 || ^18.0.0-0", - "react-dom": "^17.0.2 || ^18.0.0-0", + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", "sass": "^1.3.0" }, "peerDependenciesMeta": { - "fibers": { + "@opentelemetry/api": { "optional": true }, - "node-sass": { + "@playwright/test": { "optional": true }, "sass": { @@ -5635,9 +5675,9 @@ } }, "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -5646,11 +5686,15 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.4", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -6034,6 +6078,7 @@ "version": "7.8.1", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" } @@ -6258,9 +6303,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -6292,6 +6337,14 @@ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==" }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", @@ -6445,10 +6498,13 @@ } }, "node_modules/styled-jsx": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.0.7.tgz", - "integrity": "sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, "engines": { "node": ">= 12.0.0" }, @@ -6597,7 +6653,8 @@ "node_modules/tweetnacl-util": { "version": "0.15.1", "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==" + "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", + "license": "Unlicense" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/package.json b/package.json index 07296ca..906bcd6 100644 --- a/package.json +++ b/package.json @@ -8,25 +8,22 @@ "build": "next build", "build:mainnet": "TARGET_ENV=production node loadEnv.js && next build", "build:testnet": "TARGET_ENV=testnet node loadEnv.js && next build", - "build-static": "next build && next export", - "build-static:mainnet": "TARGET_ENV=production node loadEnv.js && next build && next export", - "build-static:testnet": "TARGET_ENV=testnet node loadEnv.js && next build && next export", "start": "next start", "lint": "next lint" }, "dependencies": { - "@blend-capital/blend-sdk": "2.0.1", - "@creit.tech/stellar-wallets-kit": "0.8.2", + "@blend-capital/blend-sdk": "2.0.3", + "@creit.tech/stellar-wallets-kit": "1.2.1", "@emotion/react": "^11.9.3", "@emotion/styled": "^11.9.3", "@mui/icons-material": "^5.8.4", "@mui/material": "^5.8.6", - "@stellar/freighter-api": "^2.0.0", + "@stellar/freighter-api": "^3.0.0", "@stellar/stellar-sdk": "12.2.0", "@tanstack/react-query": "5.52.0", "bignumber.js": "^9.0.2", "copy-to-clipboard": "^3.3.3", - "next": "^12.3.4", + "next": "^14.2.11", "react": "^18.2.0", "react-countdown": "^2.3.5", "react-dom": "^18.2.0", diff --git a/src/components/backstop/BackstopAPR.tsx b/src/components/backstop/BackstopAPR.tsx index 5c1c1ae..6bbfecf 100644 --- a/src/components/backstop/BackstopAPR.tsx +++ b/src/components/backstop/BackstopAPR.tsx @@ -79,13 +79,14 @@ export const BackstopAPR: React.FC = ({ poolId, sx, ...props {toPercentage(estBackstopApr)} - {backstopEmissionsPerDayPerLpToken && backstopEmissionsPerDayPerLpToken > 0 && ( - - )} + {backstopEmissionsPerDayPerLpToken !== undefined && + backstopEmissionsPerDayPerLpToken > 0 && ( + + )} ); diff --git a/src/components/backstop/BackstopHeader.tsx b/src/components/backstop/BackstopHeader.tsx index db5c02d..cec23f0 100644 --- a/src/components/backstop/BackstopHeader.tsx +++ b/src/components/backstop/BackstopHeader.tsx @@ -21,11 +21,7 @@ export const BackstopHeader: React.FC = ({ type, sx, ...pro }} {...props} > - + {headerText} diff --git a/src/components/backstop/BackstopJoinAnvil.tsx b/src/components/backstop/BackstopJoinAnvil.tsx index 0a0eedc..9735b06 100644 --- a/src/components/backstop/BackstopJoinAnvil.tsx +++ b/src/components/backstop/BackstopJoinAnvil.tsx @@ -38,10 +38,9 @@ export const BackstopJoinAnvil = () => { const { data: blndBalanceRes } = useTokenBalance(BLND_ID, BLND_ASSET, horizonAccount); const { data: usdcBalanceRes } = useTokenBalance(USDC_ID, USDC_ASSET, horizonAccount); const { data: lpBalanceRes } = useTokenBalance( - backstop?.backstopToken.id, + backstop?.backstopToken?.id ?? '', undefined, - undefined, - backstop !== undefined + horizonAccount ); const [currentToken, setCurrentToken] = useState<{ diff --git a/src/components/borrow/BorrowMarketCard.tsx b/src/components/borrow/BorrowMarketCard.tsx index 0767083..8481cc6 100644 --- a/src/components/borrow/BorrowMarketCard.tsx +++ b/src/components/borrow/BorrowMarketCard.tsx @@ -30,6 +30,8 @@ export const BorrowMarketCard: React.FC = ({ const tableWidth = `${(100 / tableNum).toFixed(2)}%`; const liabilityFactor = reserve.getLiabilityFactor(); + const emissionsPerAsset = reserve.emissionsPerYearPerBorrowedAsset(); + return ( = ({ }} > {formatter.toPercentage(reserve.borrowApr)} - {reserve.borrowEmissions && ( + {emissionsPerAsset > 0 && ( diff --git a/src/components/borrow/BorrowPositionCard.tsx b/src/components/borrow/BorrowPositionCard.tsx index 2896a3a..7d83af3 100644 --- a/src/components/borrow/BorrowPositionCard.tsx +++ b/src/components/borrow/BorrowPositionCard.tsx @@ -31,6 +31,9 @@ export const BorrowPositionCard: React.FC = ({ const tableNum = viewType === ViewType.REGULAR ? 5 : 3; const tableWidth = `${(100 / tableNum).toFixed(2)}%`; const buttonWidth = `${((100 / tableNum) * 1.5).toFixed(2)}%`; + + const emissionsPerAsset = reserve.emissionsPerYearPerBorrowedAsset(); + return ( = ({ }} > {formatter.toPercentage(reserve.borrowApr)} - {reserve.borrowEmissions && ( + {emissionsPerAsset > 0 && ( diff --git a/src/components/common/FlameIcon.tsx b/src/components/common/FlameIcon.tsx index c4d5736..5831c26 100644 --- a/src/components/common/FlameIcon.tsx +++ b/src/components/common/FlameIcon.tsx @@ -1,5 +1,5 @@ import { Box, Tooltip, useTheme } from '@mui/material'; -import Image from 'next/image'; +import { Icon } from './Icon'; export function FlameIcon({ width = 32, @@ -11,6 +11,10 @@ export function FlameIcon({ title?: string; }) { const theme = useTheme(); + const size = Math.min(width, height); + const iconHeight = Math.floor(size * 0.8); + // flame icon width is 77% of the of the height + const iconWidth = Math.floor(size * 0.77 * 0.8); return ( - emmission + ); diff --git a/src/components/common/Icon.tsx b/src/components/common/Icon.tsx index 69c2db2..5d85ecf 100644 --- a/src/components/common/Icon.tsx +++ b/src/components/common/Icon.tsx @@ -1,29 +1,38 @@ -import { Icon as MuiIcon, IconProps as MuiIconProps } from '@mui/material'; +import { Box, SxProps, Theme } from '@mui/material'; import Image from 'next/image'; -export interface IconProps extends MuiIconProps { +export interface IconProps { src: string; alt: string; - height?: string; - width?: string; + height?: number; + width?: number; isCircle?: boolean; // defaults to true + sx?: SxProps; + onError?: (error: React.SyntheticEvent) => void; } -export const Icon: React.FC = ({ src, alt, height, width, isCircle, sx, ...props }) => { - const resolvedHeight = height != undefined ? height : '30px'; - const resolvedWidth = width != undefined ? width : '30px'; - const resolvedIsCircle = isCircle == undefined ? true : isCircle; +export const Icon: React.FC = ({ + src, + alt, + height = 30, + width = 30, + isCircle = true, + sx, + onError, +}) => { return ( - - {alt} - + {alt} + ); }; diff --git a/src/components/dashboard/PositionOverview.tsx b/src/components/dashboard/PositionOverview.tsx index 5849367..e05090e 100644 --- a/src/components/dashboard/PositionOverview.tsx +++ b/src/components/dashboard/PositionOverview.tsx @@ -122,11 +122,8 @@ export const PositionOverview: React.FC = ({ poolId }) => { = ({ const tableNum = viewType === ViewType.REGULAR ? 5 : 3; const tableWidth = `${(100 / tableNum).toFixed(2)}%`; + + const emissionsPerAsset = reserve.emissionsPerYearPerSuppliedAsset(); return ( = ({ }} > {formatter.toPercentage(reserve.supplyApr)} - {reserve.supplyEmissions && ( + {emissionsPerAsset > 0 && ( diff --git a/src/components/lend/LendPositionCard.tsx b/src/components/lend/LendPositionCard.tsx index c874406..5855f69 100644 --- a/src/components/lend/LendPositionCard.tsx +++ b/src/components/lend/LendPositionCard.tsx @@ -28,6 +28,8 @@ export const LendPositionCard: React.FC = ({ const assetFloat = reserve.toAssetFromBTokenFloat(bTokens); + const emissionsPerAsset = reserve.emissionsPerYearPerSuppliedAsset(); + const tableNum = viewType === ViewType.REGULAR ? 5 : 3; const tableWidth = `${(100 / tableNum).toFixed(2)}%`; const buttonWidth = `${((100 / tableNum) * 1.5).toFixed(2)}%`; @@ -77,12 +79,12 @@ export const LendPositionCard: React.FC = ({ }} > {formatter.toPercentage(reserve.supplyApr)} - {reserve.supplyEmissions && ( + {emissionsPerAsset > 0 && ( diff --git a/src/components/pool/PoolIcon.tsx b/src/components/pool/PoolIcon.tsx index ecf7a03..082d434 100644 --- a/src/components/pool/PoolIcon.tsx +++ b/src/components/pool/PoolIcon.tsx @@ -1,6 +1,6 @@ -import { Icon, IconProps } from '@mui/material'; -import Image from 'next/image'; +import { IconProps } from '@mui/material'; import React, { useState } from 'react'; +import { Icon } from '../common/Icon'; export interface PoolIconProps extends IconProps { name: string; @@ -10,9 +10,5 @@ export const PoolIcon: React.FC = ({ name, ...props }) => { const [imgSrc, setImgSrc] = useState(`/icons/pools/${name.toLowerCase()}.svg`); const onError = () => setImgSrc(`/icons/pools/blend.svg`); - return ( - - {`${name}`} - - ); + return ; }; diff --git a/src/contexts/wallet.tsx b/src/contexts/wallet.tsx index 466134c..2f224cc 100644 --- a/src/contexts/wallet.tsx +++ b/src/contexts/wallet.tsx @@ -19,7 +19,7 @@ import { WalletNetwork, XBULL_ID, xBullModule, -} from '@creit.tech/stellar-wallets-kit/build/index'; +} from '@creit.tech/stellar-wallets-kit/index'; import { getNetworkDetails as getFreighterNetwork } from '@stellar/freighter-api'; import { Asset, @@ -170,7 +170,7 @@ export const WalletProvider = ({ children = null as any }) => { */ async function handleSetWalletAddress(): Promise { try { - const publicKey = await walletKit.getPublicKey(); + const { address: publicKey } = await walletKit.getAddress(); if (publicKey === '' || publicKey == undefined) { console.error('Unable to load wallet key: ', publicKey); return false; @@ -223,13 +223,12 @@ export const WalletProvider = ({ children = null as any }) => { if (connected) { setTxStatus(TxStatus.SIGNING); try { - let { result } = await walletKit.signTx({ - xdr: xdr, - publicKeys: [walletAddress], - network: network.passphrase as WalletNetwork, + let { signedTxXdr } = await walletKit.signTransaction(xdr, { + address: walletAddress, + networkPassphrase: network.passphrase as WalletNetwork, }); setTxStatus(TxStatus.SUBMITTING); - return result; + return signedTxXdr; } catch (e: any) { if (e === 'User declined access') { setTxFailure('Transaction rejected by wallet.'); diff --git a/src/pages/backstop-token.tsx b/src/pages/backstop-token.tsx index 41d4a64..0571d93 100644 --- a/src/pages/backstop-token.tsx +++ b/src/pages/backstop-token.tsx @@ -58,7 +58,9 @@ const BackstopToken: NextPage = () => { src={'/icons/pageicons/blnd_usdc_pair.svg'} alt={`blndusdclp`} isCircle={false} - sx={{ marginRight: '12px', height: '42px', width: '42px' }} + height={30} + width={45} + sx={{ marginRight: '12px' }} /> {title} { const availableToBorrow = reserve ? totalSupplied * maxUtilFloat - reserve.totalLiabilitiesFloat() : 0; + const emissionsPerAsset = reserve !== undefined ? reserve.emissionsPerYearPerBorrowedAsset() : 0; return ( <> @@ -98,12 +99,12 @@ const Borrow: NextPage = () => { text={
{toPercentage(reserve?.borrowApr)}{' '} - {reserve?.borrowEmissions && ( + {emissionsPerAsset > 0 && ( diff --git a/src/pages/repay.tsx b/src/pages/repay.tsx index 1c181bd..1a0041f 100644 --- a/src/pages/repay.tsx +++ b/src/pages/repay.tsx @@ -29,6 +29,8 @@ const Repay: NextPage = () => { reserve !== undefined ); + const emissionsPerAsset = reserve !== undefined ? reserve.emissionsPerYearPerBorrowedAsset() : 0; + const currentDebt = reserve && poolUser ? poolUser.getLiabilitiesFloat(reserve) : undefined; return ( @@ -75,13 +77,13 @@ const Repay: NextPage = () => { text={
{toPercentage(reserve?.borrowApr)}{' '} - {reserve?.borrowEmissions && ( + {emissionsPerAsset > 0 && ( )} diff --git a/src/pages/supply.tsx b/src/pages/supply.tsx index a70d2ef..880f3ce 100644 --- a/src/pages/supply.tsx +++ b/src/pages/supply.tsx @@ -10,7 +10,7 @@ import { Row } from '../components/common/Row'; import { Section, SectionSize } from '../components/common/Section'; import { StackedText } from '../components/common/StackedText'; import { LendAnvil } from '../components/lend/LendAnvil'; -import { useHorizonAccount, usePool, usePoolUser, useTokenBalance } from '../hooks/api'; +import { useHorizonAccount, usePool, useTokenBalance } from '../hooks/api'; import { getEmissionTextFromValue, toBalance, toPercentage } from '../utils/formatter'; import { getTokenLinkFromReserve } from '../utils/token'; @@ -23,7 +23,6 @@ const Supply: NextPage = () => { const safeAssetId = typeof assetId == 'string' && /^[0-9A-Z]{56}$/.test(assetId) ? assetId : ''; const { data: pool } = usePool(safePoolId); - const { data: poolUser } = usePoolUser(pool); const reserve = pool?.reserves.get(safeAssetId); const { data: horizonAccount } = useHorizonAccount(); const { data: tokenBalance } = useTokenBalance( @@ -33,8 +32,7 @@ const Supply: NextPage = () => { reserve !== undefined ); - const currentDebt = reserve && poolUser ? poolUser.getLiabilitiesFloat(reserve) : undefined; - + const emissionsPerAsset = reserve !== undefined ? reserve.emissionsPerYearPerSuppliedAsset() : 0; return ( <> @@ -99,13 +97,13 @@ const Supply: NextPage = () => { text={
{toPercentage(reserve?.supplyApr)}{' '} - {reserve?.supplyEmissions && ( + {emissionsPerAsset > 0 && ( )} diff --git a/src/pages/withdraw.tsx b/src/pages/withdraw.tsx index 0cbed0c..a32880f 100644 --- a/src/pages/withdraw.tsx +++ b/src/pages/withdraw.tsx @@ -24,6 +24,7 @@ const Withdraw: NextPage = () => { const reserve = pool?.reserves.get(safeAssetId); const currentDeposit = reserve && poolUser ? poolUser.getCollateralFloat(reserve) : undefined; + const emissionsPerAsset = reserve !== undefined ? reserve.emissionsPerYearPerSuppliedAsset() : 0; return ( <> @@ -68,19 +69,16 @@ const Withdraw: NextPage = () => { title="Supply APR" text={
- {toPercentage(reserve?.supplyApr)} - {reserve?.supplyApr && ( - <> - {' '} - - + {toPercentage(reserve?.supplyApr)}{' '} + {emissionsPerAsset > 0 && ( + )}
}