From 8afcab921339a4d2c8253b582825d3e1f5b4a7ca Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Tue, 15 Oct 2024 16:33:22 +0200 Subject: [PATCH 01/18] update eslint plugin --- package.json | 2 +- src/components/Dialog/index.tsx | 9 +++++---- yarn.lock | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 3ae18495..b78e9462 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "eslint": "^8.56.0", "eslint-plugin-jest": "^27.6.1", "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-hooks": "^5.0.0", "husky": ">=6", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index ec8bef0a..e10e5e6a 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -1,5 +1,5 @@ import { Modal } from 'react-daisyui'; -import { FC, createPortal, useCallback, useEffect, useRef, useState } from 'preact/compat'; +import { createPortal, useCallback, useEffect, useRef, useState } from 'preact/compat'; import { CloseButton } from '../CloseButton'; interface DialogProps { @@ -9,13 +9,13 @@ interface DialogProps { content: JSX.Element; actions?: JSX.Element; form?: { - onSubmit: (event?: Event) => void | Promise; + onSubmit: (event?: Event) => void; className?: string; }; id?: string; } -export const Dialog: FC = ({ visible, onClose, headerText, content, actions, id, form }) => { +export function Dialog({ visible, onClose, headerText, content, actions, id, form }: DialogProps) { const ref = useRef(null); // If it was the form submission we want to only close the dialog without calling onClose @@ -55,6 +55,7 @@ export const Dialog: FC = ({ visible, onClose, headerText, content, return () => { dialog.removeEventListener('close', closeListener); + dialog.close(); }; } }, [visible, closeListener, headerText]); @@ -92,4 +93,4 @@ export const Dialog: FC = ({ visible, onClose, headerText, content, , container, ); -}; +} diff --git a/yarn.lock b/yarn.lock index 98b6bc41..80b6a3e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8978,12 +8978,12 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react-hooks@npm:^4.6.0": - version: 4.6.2 - resolution: "eslint-plugin-react-hooks@npm:4.6.2" +"eslint-plugin-react-hooks@npm:^5.0.0": + version: 5.0.0 + resolution: "eslint-plugin-react-hooks@npm:5.0.0" peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - checksum: 10c0/4844e58c929bc05157fb70ba1e462e34f1f4abcbc8dd5bbe5b04513d33e2699effb8bca668297976ceea8e7ebee4e8fc29b9af9d131bcef52886feaa2308b2cc + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 + checksum: 10c0/bcb74b421f32e4203a7100405b57aab85526be4461e5a1da01bc537969a30012d2ee209a2c2a6cac543833a27188ce1e6ad71e4628d0bb4a2e5365cad86c5002 languageName: node linkType: hard @@ -14022,7 +14022,7 @@ __metadata: eslint: "npm:^8.56.0" eslint-plugin-jest: "npm:^27.6.1" eslint-plugin-react: "npm:^7.33.2" - eslint-plugin-react-hooks: "npm:^4.6.0" + eslint-plugin-react-hooks: "npm:^5.0.0" graphql: "npm:~16.9.0" graphql-request: "npm:~6.1.0" husky: "npm:>=6" From 47615f37b575071bd3ce12e118318f20d2677ef5 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Tue, 15 Oct 2024 19:21:19 +0200 Subject: [PATCH 02/18] update vite --- jest.config.cjs => jest.config.js | 2 +- package.json | 2 +- postcss.config.cjs => postcss.config.js | 2 +- release.config.cjs => release.config.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename jest.config.cjs => jest.config.js (97%) rename postcss.config.cjs => postcss.config.js (86%) rename release.config.cjs => release.config.js (97%) diff --git a/jest.config.cjs b/jest.config.js similarity index 97% rename from jest.config.cjs rename to jest.config.js index 45340848..22d43d37 100644 --- a/jest.config.cjs +++ b/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { roots: ['/src'], maxWorkers: 1, transform: { diff --git a/package.json b/package.json index b78e9462..c8e7d7fb 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "semantic-release": "^22.0.12", "tailwindcss": "^3.4.3", "typescript": "^5.5.4", - "vite": "^3.2.11" + "vite": "^5.4.9" }, "engines": { "npm": "please-use-yarn", diff --git a/postcss.config.cjs b/postcss.config.js similarity index 86% rename from postcss.config.cjs rename to postcss.config.js index e569373f..feab3515 100644 --- a/postcss.config.cjs +++ b/postcss.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { plugins: { 'postcss-import': {}, 'tailwindcss/nesting': {}, diff --git a/release.config.cjs b/release.config.js similarity index 97% rename from release.config.cjs rename to release.config.js index 552cc419..d34c181d 100644 --- a/release.config.cjs +++ b/release.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { branches: ['main'], plugins: [ [ From dc1d59d8d891ef23cca1ec525d5103b8e8f2ce69 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Tue, 15 Oct 2024 19:22:27 +0200 Subject: [PATCH 03/18] update stellar --- package.json | 2 +- src/components/Form/From/index.tsx | 2 +- .../Selector/AssetSelector/helpers.ts | 2 +- src/helpers/spacewalk.ts | 2 +- src/helpers/stellar.ts | 2 +- .../useCalculateGriefingCollateral.test.ts | 2 +- src/hooks/spacewalk/useBridgeSettings.ts | 2 +- .../useCalculateGriefingCollateral.ts | 2 +- src/pages/dashboard/PortfolioColumns.tsx | 2 +- src/pages/spacewalk/bridge/FeeBox.tsx | 2 +- src/pages/spacewalk/bridge/helpers.ts | 2 +- src/pages/spacewalk/bridge/index.tsx | 20 +- yarn.lock | 877 ++++++++++-------- 13 files changed, 536 insertions(+), 383 deletions(-) diff --git a/package.json b/package.json index c8e7d7fb..defa5803 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@polkadot/rpc-provider": "^13.2.1", "@polkadot/types": "^13.2.1", "@polkadot/util": "^12.6.2", + "@stellar/stellar-sdk": "^12.3.0", "@talismn/connect-components": "^1.1.7", "@talismn/connect-ui": "^1.1.2", "@talismn/connect-wallets": "^1.2.3", @@ -66,7 +67,6 @@ "react-router-dom": "^6.8.1", "react-table": "^7.8.0", "react-toastify": "^9.1.3", - "stellar-sdk": "^10.4.1", "ts-node": "^10.9.2", "yup": "^1.3.3" }, diff --git a/src/components/Form/From/index.tsx b/src/components/Form/From/index.tsx index de473eaa..4b82dcfd 100644 --- a/src/components/Form/From/index.tsx +++ b/src/components/Form/From/index.tsx @@ -1,6 +1,6 @@ import { UseFormRegisterReturn } from 'react-hook-form'; import { StateUpdater, Dispatch } from 'preact/hooks'; -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import { BlockchainAsset } from '../../Selector/AssetSelector/helpers'; diff --git a/src/components/Selector/AssetSelector/helpers.ts b/src/components/Selector/AssetSelector/helpers.ts index 5c9a3c82..6e386d3e 100644 --- a/src/components/Selector/AssetSelector/helpers.ts +++ b/src/components/Selector/AssetSelector/helpers.ts @@ -1,4 +1,4 @@ -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import { StateUpdater, Dispatch } from 'preact/hooks'; import { getIcon } from '../../../shared/AssetIcons'; import { OrmlTraitsAssetRegistryAssetMetadata } from '../../../hooks/useBuyout/types'; diff --git a/src/helpers/spacewalk.ts b/src/helpers/spacewalk.ts index d76f3b14..1bda2127 100644 --- a/src/helpers/spacewalk.ts +++ b/src/helpers/spacewalk.ts @@ -5,7 +5,7 @@ import { H256 } from '@polkadot/types/interfaces'; import { SpacewalkPrimitivesCurrencyId } from '@polkadot/types/lookup'; import bs58 from 'bs58'; import { DateTime } from 'luxon'; -import { Asset, Keypair } from 'stellar-sdk'; +import { Asset, Keypair } from '@stellar/stellar-sdk'; import { TenantName } from '../models/Tenant'; import { convertRawHexKeyToPublicKey } from './stellar'; diff --git a/src/helpers/stellar.ts b/src/helpers/stellar.ts index cf70686d..96460e1a 100644 --- a/src/helpers/stellar.ts +++ b/src/helpers/stellar.ts @@ -1,4 +1,4 @@ -import { Asset, Keypair, StrKey } from 'stellar-sdk'; +import { Asset, Keypair, StrKey } from '@stellar/stellar-sdk'; import { Buffer } from 'buffer'; // Applying this assignment to the global object here - because Buffer is used only in this file. If Buffer is to be used in several places - it should be added to the global object in the entry file of the application. diff --git a/src/hooks/spacewalk/__tests__/useCalculateGriefingCollateral.test.ts b/src/hooks/spacewalk/__tests__/useCalculateGriefingCollateral.test.ts index e2b09447..0eae5704 100644 --- a/src/hooks/spacewalk/__tests__/useCalculateGriefingCollateral.test.ts +++ b/src/hooks/spacewalk/__tests__/useCalculateGriefingCollateral.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import { waitFor } from '@testing-library/preact'; -import { Asset } from 'stellar-base'; +import { Asset } from '@stellar/stellar-sdk'; import Big from 'big.js'; import { useFeePallet } from '../useFeePallet'; import { useCalculateGriefingCollateral } from '../useCalculateGriefingCollateral'; diff --git a/src/hooks/spacewalk/useBridgeSettings.ts b/src/hooks/spacewalk/useBridgeSettings.ts index 9e406585..bcb89b3b 100644 --- a/src/hooks/spacewalk/useBridgeSettings.ts +++ b/src/hooks/spacewalk/useBridgeSettings.ts @@ -1,7 +1,7 @@ import Big from 'big.js'; import { useEffect, useMemo } from 'preact/compat'; import { StateUpdater, Dispatch } from 'preact/hooks'; -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import _ from 'lodash'; import { useGlobalState } from '../../GlobalStateProvider'; import { convertCurrencyToStellarAsset, shouldFilterOut } from '../../helpers/spacewalk'; diff --git a/src/hooks/spacewalk/useCalculateGriefingCollateral.ts b/src/hooks/spacewalk/useCalculateGriefingCollateral.ts index 96fd2359..3d91214a 100644 --- a/src/hooks/spacewalk/useCalculateGriefingCollateral.ts +++ b/src/hooks/spacewalk/useCalculateGriefingCollateral.ts @@ -1,4 +1,4 @@ -import { Asset } from 'stellar-base'; +import { Asset } from '@stellar/stellar-sdk'; import Big from 'big.js'; import { useEffect, useState, useMemo } from 'preact/compat'; import { nativeStellarToDecimal } from '../../shared/parseNumbers/metric'; diff --git a/src/pages/dashboard/PortfolioColumns.tsx b/src/pages/dashboard/PortfolioColumns.tsx index 6509de7e..c7eff1b6 100644 --- a/src/pages/dashboard/PortfolioColumns.tsx +++ b/src/pages/dashboard/PortfolioColumns.tsx @@ -1,5 +1,5 @@ import { ColumnDef } from '@tanstack/table-core'; -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import { getIcon } from '../../shared/AssetIcons'; export interface PortfolioAsset { diff --git a/src/pages/spacewalk/bridge/FeeBox.tsx b/src/pages/spacewalk/bridge/FeeBox.tsx index 65840545..4b21e19b 100644 --- a/src/pages/spacewalk/bridge/FeeBox.tsx +++ b/src/pages/spacewalk/bridge/FeeBox.tsx @@ -1,7 +1,7 @@ import { SubmittableExtrinsic } from '@polkadot/api/promise/types'; import Big from 'big.js'; import { useCallback, useEffect, useMemo, useState } from 'preact/compat'; -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import { useFeePallet } from '../../../hooks/spacewalk/useFeePallet'; import { ChainDecimals, nativeStellarToDecimal, nativeToDecimal } from '../../../shared/parseNumbers/metric'; diff --git a/src/pages/spacewalk/bridge/helpers.ts b/src/pages/spacewalk/bridge/helpers.ts index 4e01fd73..97964c31 100644 --- a/src/pages/spacewalk/bridge/helpers.ts +++ b/src/pages/spacewalk/bridge/helpers.ts @@ -1,4 +1,4 @@ -import { Asset } from 'stellar-base'; +import { Asset } from '@stellar/stellar-sdk'; const MYKOBO_EURC = new Asset('EURC', 'GAQRF3UGHBT6JYQZ7YSUYCIYWAF4T2SAA5237Q5LIQYJOHHFAWDXZ7NM'); const HIDDEN_SPACEWALK_ASSETS = [MYKOBO_EURC]; diff --git a/src/pages/spacewalk/bridge/index.tsx b/src/pages/spacewalk/bridge/index.tsx index 22560b3e..2950a248 100644 --- a/src/pages/spacewalk/bridge/index.tsx +++ b/src/pages/spacewalk/bridge/index.tsx @@ -1,7 +1,7 @@ import { createContext } from 'preact/compat'; import { StateUpdater, Dispatch, useMemo, useState, useContext } from 'preact/hooks'; import { Button, Card, Tabs } from 'react-daisyui'; -import { Asset } from 'stellar-sdk'; +import { Asset } from '@stellar/stellar-sdk'; import AmplitudeLogo from '../../../assets/AmplitudeLogo'; import PendulumLogo from '../../../assets/PendulumLogo'; import SettingsIcon from '../../../assets/SettingsIcon'; @@ -94,30 +94,30 @@ function Bridge() { setExtendedVaults, }} > -
+
setSettingsVisible(false)} bridgeDirection={bridgeDirection} /> -
- - - {chain.toLowerCase() === TenantName.Pendulum && } +
+ + + {chain.toLowerCase() === TenantName.Pendulum && } {(chain.toLowerCase() === TenantName.Amplitude || chain.toLowerCase() === TenantName.Foucoco) && ( - + )} To {chain} - - + + To Stellar