diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index b1933db9b..0ac539581 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,18 +1,18 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "daily" + interval: 'daily' open-pull-requests-limit: 10 - package-ecosystem: npm - directory: "/" + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' open-pull-requests-limit: 10 versioning-strategy: increase ignore: # For all packages, ignore all minor & patch updates - - dependency-name: "*" + - dependency-name: '*' update-types: - [ "version-update:semver-minor", "version-update:semver-patch" ] + ['version-update:semver-minor', 'version-update:semver-patch'] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1bab9f4a0..f85830e06 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,35 +6,35 @@ Fixes # (issue) ๐Ÿ› ๏ธ ## Type of change -- [ ] Bug fix ๐Ÿž -- [ ] New feature โœจ -- [ ] Breaking change ๐Ÿ’ฅ -- [ ] Documentation update ๐Ÿ“– -- [ ] Refactor ๐Ÿ”ง +- [ ] Bug fix ๐Ÿž +- [ ] New feature โœจ +- [ ] Breaking change ๐Ÿ’ฅ +- [ ] Documentation update ๐Ÿ“– +- [ ] Refactor ๐Ÿ”ง ## Testing Describe tests and instructions to reproduce. ๐Ÿงช -- [ ] Local Tests (npm run test) -- [ ] Manual (CLI or web interface) -- [ ] Local GitHub Actions (act pull_request) +- [ ] Local Tests (npm run test) +- [ ] Manual (CLI or web interface) +- [ ] Local GitHub Actions (act pull_request) **Node version**: -- [ ] 18 -- [ ] 20 -- [x] 22 -- [ ] 23 +- [ ] 18 +- [ ] 20 +- [x] 22 +- [ ] 23 ### Test Results (if any) ## Checklist -- [ ] Style Guidelines followed โœ… -- [ ] Self-Reviewed ๐Ÿ‘€ -- [ ] Documentation Updated ๐Ÿ“š -- [ ] **Linters** - No New Warnings โš ๏ธ -- [ ] Effective Tests Added โœ”๏ธ -- [ ] Local Tests Pass โœ… -- [ ] No reduction of **Coverage** +- [ ] Style Guidelines followed โœ… +- [ ] Self-Reviewed ๐Ÿ‘€ +- [ ] Documentation Updated ๐Ÿ“š +- [ ] **Linters** - No New Warnings โš ๏ธ +- [ ] Effective Tests Added โœ”๏ธ +- [ ] Local Tests Pass โœ… +- [ ] No reduction of **Coverage** diff --git a/.github/workflows/ats.test.yml b/.github/workflows/ats.test.yml index c0a6c2bac..97e46c02b 100644 --- a/.github/workflows/ats.test.yml +++ b/.github/workflows/ats.test.yml @@ -1,78 +1,75 @@ name: Tests ATS on: - push: - branches: [main] - pull_request: - paths: - - 'packages/ats/**' - - 'apps/ats/**' - - 'package.json' - - '.github/workflows/*ats*.yml' - - '.github/workflows/*ats*.yaml' - workflow_dispatch: + push: + branches: [main] + pull_request: + paths: + - 'packages/ats/**' + - 'apps/ats/**' + - 'package.json' + - '.github/workflows/*ats*.yml' + - '.github/workflows/*ats*.yaml' + workflow_dispatch: permissions: - contents: read + contents: read jobs: - test-ats: - name: testing - runs-on: token-studio-linux-large - env: - NODE_OPTIONS: '--max-old-space-size=32768' - CONTRACT_SIZER_RUN_ON_COMPILE: 'false' - REPORT_GAS: 'false' - CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} - CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} - CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' - CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' - CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' - CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} - CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' - CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' - FACTORY_ADDRESS: '0.0.5480051' - RESOLVER_ADDRESS: '0.0.5479997' - FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' - FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' - DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' - AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' - REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' - REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' - REACT_APP_RESOLVER: '0.0.5479997' - REACT_APP_FACTORY: '0.0.5480051' - REACT_APP_SHOW_DISCLAIMER: 'true' - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + test-ats: + name: testing + runs-on: token-studio-linux-large + env: + NODE_OPTIONS: '--max-old-space-size=32768' + CONTRACT_SIZER_RUN_ON_COMPILE: 'false' + REPORT_GAS: 'false' + CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} + CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} + CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' + CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' + CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' + CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} + CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' + CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' + FACTORY_ADDRESS: '0.0.5480051' + RESOLVER_ADDRESS: '0.0.5479997' + FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' + FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' + DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' + AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' + REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' + REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' + REACT_APP_RESOLVER: '0.0.5479997' + REACT_APP_FACTORY: '0.0.5480051' + REACT_APP_SHOW_DISCLAIMER: 'true' + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - steps: - - name: Harden Runner - uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 - with: - egress-policy: audit + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup NodeJS Environment - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: 20.x + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.x - - name: Install root dependencies - run: npm ci --ignore-scripts + - name: Install dependencies + run: npm ci - - name: Install ATS dependencies only - run: npm ci --workspaces --workspace=packages/ats/contracts --workspace=packages/ats/sdk --workspace=apps/ats/web + - name: Build ATS packages + run: npm run ats:build - - name: Build ATS packages - run: npm run ats:build:all + - name: Run ATS tests + run: npm run ats:test - - name: Run ATS tests - run: npm run ats:test:all - - - name: Upload coverage report - if: ${{ !cancelled() && always() }} - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - name: Upload coverage report + if: ${{ !cancelled() && always() }} + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 diff --git a/.github/workflows/mp.test.yml b/.github/workflows/mp.test.yml index 12ec39442..97c0cb3f4 100644 --- a/.github/workflows/mp.test.yml +++ b/.github/workflows/mp.test.yml @@ -1,81 +1,71 @@ name: Tests Mass Payout on: - push: - branches: [main] - pull_request: - paths: - - 'packages/mass-payout/**' - - 'apps/mass-payout/**' - - 'package.json' - - '.github/workflows/*mp*.yml' - - '.github/workflows/*mp*.yaml' - workflow_dispatch: + push: + branches: [main] + pull_request: + paths: + - 'packages/mass-payout/**' + - 'apps/mass-payout/**' + - 'package.json' + - '.github/workflows/*mp*.yml' + - '.github/workflows/*mp*.yaml' + workflow_dispatch: permissions: - contents: read + contents: read jobs: - test-mass-payout: - name: testing - runs-on: token-studio-linux-large - env: - NODE_OPTIONS: '--max-old-space-size=32768' - CONTRACT_SIZER_RUN_ON_COMPILE: 'false' - REPORT_GAS: 'false' - CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} - CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} - CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' - CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' - CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' - CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} - CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' - CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' - FACTORY_ADDRESS: '0.0.5480051' - RESOLVER_ADDRESS: '0.0.5479997' - FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' - FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' - DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} - AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' - AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' - REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' - REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' - REACT_APP_RESOLVER: '0.0.5479997' - REACT_APP_FACTORY: '0.0.5480051' - REACT_APP_SHOW_DISCLAIMER: 'true' - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + test-mass-payout: + name: testing + runs-on: token-studio-linux-large + env: + NODE_OPTIONS: '--max-old-space-size=32768' + CONTRACT_SIZER_RUN_ON_COMPILE: 'false' + REPORT_GAS: 'false' + CLIENT_PRIVATE_KEY_ECDSA_1: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_1 }} + CLIENT_PUBLIC_KEY_ECDSA_1: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_1 }} + CLIENT_ACCOUNT_ID_ECDSA_1: '0.0.1328' + CLIENT_EVM_ADDRESS_ECDSA_1_CORRECT: '0x97C50bb12E1C6284cF2855cdba95c5D60AEE44CF' + CLIENT_EVM_ADDRESS_ECDSA_1: '0x0000000000000000000000000000000000000530' + CLIENT_PRIVATE_KEY_ECDSA_2: ${{ secrets.CLIENT_PRIVATE_KEY_ECDSA_2 }} + CLIENT_PUBLIC_KEY_ECDSA_2: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + CLIENT_ACCOUNT_ID_ECDSA_2: '0.0.2168740' + CLIENT_EVM_ADDRESS_ECDSA_2: '0x00000000000000000000000000000000002117A4' + FACTORY_ADDRESS: '0.0.5480051' + RESOLVER_ADDRESS: '0.0.5479997' + FIREBLOCKS_HEDERA_ACCOUNT_ID: '0.0.2168740' + FIREBLOCKS_HEDERA_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + DFNS_HEDERA_ACCOUNT_ID: '0.0.2168740' + DFNS_WALLET_PUBLIC_KEY: ${{ secrets.CLIENT_PUBLIC_KEY_ECDSA_2 }} + AWS_KMS_HEDERA_ACCOUNT_ID: '0.0.4394946' + AWS_KMS_HEDERA_PUBLIC_KEY: '302d300706052b8104000a03220003ee815bb9b5e53f5dbe7264a77e586127dfcb75da8c1246f5aa6ededdb13e6c21' + REACT_APP_MIRROR_NODE: 'https://testnet.mirrornode.hedera.com/api/v1/' + REACT_APP_RPC_NODE: 'https://testnet.hashio.io/api' + REACT_APP_RESOLVER: '0.0.5479997' + REACT_APP_FACTORY: '0.0.5480051' + REACT_APP_SHOW_DISCLAIMER: 'true' + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - steps: - - name: Harden Runner - uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 - with: - egress-policy: audit + steps: + - name: Harden Runner + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 + with: + egress-policy: audit - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup NodeJS Environment - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: 20.x + - name: Setup NodeJS Environment + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 22.x - - name: Install monorepo package dependencies (ats/contracts and ats/sdk) - run: npm ci # Change for npm run:install:ats:all:ci + - name: Install dependencies + run: npm ci - - name: Build mass-payout/contracts - run: npm run build:mp:contracts + # - name: Build mass-payout + # run: npm run mp:build - - name: Build mass-payout/sdk - run: npm run build:mp:sdk - - - name: Install mass-payout/web dependencies - run: npm run install:mp:web:lock - - - name: Build mass-payout/web - run: npm run build:mp:web - - - name: Run mass-payout/contracts tests - working-directory: packages/mass-payout/contracts - run: npm run test + # - name: Test mass-payout + # run: npm run mp:test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..14f5481e0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,31 @@ +# Dependencies +node_modules +package-lock.json +yarn.lock +pnpm-lock.yaml + +# Build outputs +build +dist +out +coverage +.turbo + +# Generated files +typechain-types +artifacts +cache + +# Hardhat +*.sol-coverage +gas-report.txt + +# IDE +.vscode +.idea + +# Environment files +.env* + +# Documentation +Smart Contracts Audit Report.pdf diff --git a/README.md b/README.md index 3945c23c7..307caed7b 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ - **[Installation](#installation)**
- **[Build](#build)**
- **[Setting Up the Environment](#setting-up-the-environment)**
- - **[Required Environment Variables](#required-environment-variables)**
- - **[Optional Environment Variables (Hedera Wallet Connect)](#optional-environment-variables-hedera-wallet-connect)**
- - **[Steps to set up the `.env` file](#steps-to-set-up-the-env-file)**
+ - **[Required Environment Variables](#required-environment-variables)**
+ - **[Optional Environment Variables (Hedera Wallet Connect)](#optional-environment-variables-hedera-wallet-connect)**
+ - **[Steps to set up the `.env` file](#steps-to-set-up-the-env-file)**
- **[Run](#run)**
- **[Support](#support)**
- **[Contributing](#contributing)**
@@ -68,10 +68,10 @@ This project is organized as a monorepo using npm workspaces to manage multiple ATS (Asset Tokenization Studio) is one of the main applications in the monorepo. Its components are organized as follows: - `packages/ats/` Contains the core business logic of ATS: - - `contracts/` Smart contracts that implement the tokenization logic. - - `sdk/` A TypeScript SDK to interact with the contracts from frontend or backend applications. + - `contracts/` Smart contracts that implement the tokenization logic. + - `sdk/` A TypeScript SDK to interact with the contracts from frontend or backend applications. - `apps/ats/` Contains the applications that consume the SDK: - - `web/` A React + Vite-based web application for interacting with ATS. + - `web/` A React + Vite-based web application for interacting with ATS. โš ๏ธ Note: The web module is not currently included in the npm workspaces because it uses Yarn for installation and build. This separation is due to compatibility constraints with some of its tooling. In future phases, we plan to integrate web into the npm workspaces once full compatibility is ensured. @@ -138,31 +138,31 @@ These variables are only required if you are integrating Hedera Wallet Connect f 1. Navigate to the `web` module folder. 2. Copy the `.env.sample` file to create a new `.env` file: - ```bash - cp .env.sample .env - ``` + ```bash + cp .env.sample .env + ``` 3. Open the `.env` file in your preferred text editor. 4. Replace the placeholder values with your actual environment settings. For example: - ```bash - REACT_APP_EQUITY_CONFIG_ID='0x0000000000000000000000000000000000000000000000000000000000000001' - REACT_APP_EQUITY_CONFIG_VERSION="0" - REACT_APP_BOND_CONFIG_ID="0x0000000000000000000000000000000000000000000000000000000000000002" - REACT_APP_BOND_CONFIG_VERSION="0" - REACT_APP_SHOW_DISCLAIMER="true" - - REACT_APP_MIRROR_NODE="https://testnet.mirrornode.hedera.com/api/v1/" - REACT_APP_RPC_NODE="https://testnet.hashio.io/api" - REACT_APP_RESOLVER='0.0.6349503' - REACT_APP_FACTORY='0.0.6349546' - - REACT_APP_PROJECT_ID="your_project_id_from_walletconnect" - REACT_APP_DAPP_NAME="Asset Tokenization Studio" - REACT_APP_DAPP_DESCRIPTION="Asset Tokenization Studio. Built on Hedera Hashgraph." - REACT_APP_DAPP_URL="https://wc.ats.com/" - REACT_APP_DAPP_ICONS='["https://stablecoinstudio.com/static/media/hedera-hbar-logo.4fd73fb360de0fc15d378e0c3ebe6c80.svg"]' - ``` + ```bash + REACT_APP_EQUITY_CONFIG_ID='0x0000000000000000000000000000000000000000000000000000000000000001' + REACT_APP_EQUITY_CONFIG_VERSION="0" + REACT_APP_BOND_CONFIG_ID="0x0000000000000000000000000000000000000000000000000000000000000002" + REACT_APP_BOND_CONFIG_VERSION="0" + REACT_APP_SHOW_DISCLAIMER="true" + + REACT_APP_MIRROR_NODE="https://testnet.mirrornode.hedera.com/api/v1/" + REACT_APP_RPC_NODE="https://testnet.hashio.io/api" + REACT_APP_RESOLVER='0.0.6349503' + REACT_APP_FACTORY='0.0.6349546' + + REACT_APP_PROJECT_ID="your_project_id_from_walletconnect" + REACT_APP_DAPP_NAME="Asset Tokenization Studio" + REACT_APP_DAPP_DESCRIPTION="Asset Tokenization Studio. Built on Hedera Hashgraph." + REACT_APP_DAPP_URL="https://wc.ats.com/" + REACT_APP_DAPP_ICONS='["https://stablecoinstudio.com/static/media/hedera-hbar-logo.4fd73fb360de0fc15d378e0c3ebe6c80.svg"]' + ``` 5. Save the file and proceed with running the application. diff --git a/addLicence.js b/addLicence.js index c18048c04..cd358ad4d 100755 --- a/addLicence.js +++ b/addLicence.js @@ -1,95 +1,88 @@ #!/usr/bin/env node -const { promises: fs } = require('fs'); -const path = require('path'); +import { promises as fs } from 'fs'; +import path from 'path'; async function findFiles(dir, extension) { - let files = []; - try { - const entries = await fs.readdir(dir, { withFileTypes: true }); - for (const entry of entries) { - const fullPath = path.join(dir, entry.name); - if (entry.isDirectory()) { - if (entry.name === 'node_modules') continue; - files = files.concat(await findFiles(fullPath, extension)); - } else if ( - entry.isFile() && - path.extname(fullPath) === `.${extension}` - ) { - files.push(fullPath); - } - } - } catch (error) { - console.error(`Error reading directory ${dir}:`, error); + let files = []; + try { + const entries = await fs.readdir(dir, { withFileTypes: true }); + for (const entry of entries) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (entry.name === 'node_modules') continue; + files = files.concat(await findFiles(fullPath, extension)); + } else if (entry.isFile() && path.extname(fullPath) === `.${extension}`) { + files.push(fullPath); + } } - return files; + } catch (error) { + console.error(`Error reading directory ${dir}:`, error); + } + return files; } function normalizeLicenseContent(content) { - return content - .trim() - .replace(/\r\n/g, '\n') // Normalize line endings - .split('\n') - .map((line) => line.trim().replace(/^\*/, '').trim()) - .join('\n') - .replace(/\s+/g, ' ') - .replace(/\n+/g, '\n'); + return content + .trim() + .replace(/\r\n/g, '\n') // Normalize line endings + .split('\n') + .map((line) => line.trim().replace(/^\*/, '').trim()) + .join('\n') + .replace(/\s+/g, ' ') + .replace(/\n+/g, '\n'); } async function prependContentToFiles( - rootDirectory, - contentFile, - fileExtension + rootDirectory, + contentFile, + fileExtension, ) { - try { - const content = await fs.readFile(contentFile, 'utf8'); - const comment = `/*\n${content}\n*/\n\n`; + try { + const content = await fs.readFile(contentFile, 'utf8'); + const comment = `/*\n${content}\n*/\n\n`; - // Create normalized version for comparison - const licenseNormalized = normalizeLicenseContent(content); + // Create normalized version for comparison + const licenseNormalized = normalizeLicenseContent(content); - const files = await findFiles(rootDirectory, fileExtension); - if (files.length === 0) { - console.log('No matching files found.'); - return; - } + const files = await findFiles(rootDirectory, fileExtension); + if (files.length === 0) { + console.log('No matching files found.'); + return; + } - for (const file of files) { - try { - const existingContent = await fs.readFile(file, 'utf8'); + for (const file of files) { + try { + const existingContent = await fs.readFile(file, 'utf8'); - // Check for existing license using more sophisticated detection - const existingHeaderMatch = - existingContent.match(/^\/\*[\s\S]*?\*\//); - let hasExistingLicense = false; + // Check for existing license using more sophisticated detection + const existingHeaderMatch = existingContent.match(/^\/\*[\s\S]*?\*\//); + let hasExistingLicense = false; - if (existingHeaderMatch) { - const existingHeader = existingHeaderMatch[0]; - const existingNormalized = normalizeLicenseContent( - existingHeader - .replace(/^\/\*+/, '') - .replace(/\*+\/$/, '') - ); + if (existingHeaderMatch) { + const existingHeader = existingHeaderMatch[0]; + const existingNormalized = normalizeLicenseContent( + existingHeader.replace(/^\/\*+/, '').replace(/\*+\/$/, ''), + ); - // Compare normalized content - hasExistingLicense = - existingNormalized === licenseNormalized; - } + // Compare normalized content + hasExistingLicense = existingNormalized === licenseNormalized; + } - if (!hasExistingLicense) { - await fs.writeFile(file, comment + existingContent); - console.log(`Prepended content to ${file}`); - } else { - console.log( - `Valid license header already exists in ${file}, skipping.` - ); - } - } catch (error) { - console.error(`Error processing file ${file}:`, error); - } + if (!hasExistingLicense) { + await fs.writeFile(file, comment + existingContent); + console.log(`Prepended content to ${file}`); + } else { + console.log( + `Valid license header already exists in ${file}, skipping.`, + ); } - } catch (error) { - console.error('Error:', error); + } catch (error) { + console.error(`Error processing file ${file}:`, error); + } } + } catch (error) { + console.error('Error:', error); + } } prependContentToFiles('./', './LICENSE', 'ts'); diff --git a/apps/ats/web/.eslintrc.cjs b/apps/ats/web/.eslintrc.cjs deleted file mode 100644 index 636cf9ec4..000000000 --- a/apps/ats/web/.eslintrc.cjs +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - env: { browser: true, es2020: true, node: true, jest: true }, - extends: [ - "eslint:recommended", - "plugin:prettier/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:react-hooks/recommended", - ], - parser: "@typescript-eslint/parser", - parserOptions: { ecmaVersion: "latest", sourceType: "module" }, - plugins: ["react-refresh"], - rules: { - "react-refresh/only-export-components": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-non-null-asserted-optional-chain": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-unused-vars": [ - "warn", // or "error" - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - caughtErrorsIgnorePattern: "^_", - }, - ], - }, -}; diff --git a/apps/ats/web/.prettierrc b/apps/ats/web/.prettierrc deleted file mode 100644 index 53c1c9233..000000000 --- a/apps/ats/web/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "printWidth": 80 -} - \ No newline at end of file diff --git a/apps/ats/web/babel.config.cjs b/apps/ats/web/babel.config.cjs index 3d017845e..2635589cb 100644 --- a/apps/ats/web/babel.config.cjs +++ b/apps/ats/web/babel.config.cjs @@ -1,7 +1,7 @@ module.exports = { presets: [ - ["@babel/preset-env", { targets: { node: "current" } }], - "@babel/preset-typescript", + ['@babel/preset-env', { targets: { node: 'current' } }], + '@babel/preset-typescript', ], - plugins: ["babel-plugin-transform-vite-meta-env"], + plugins: ['babel-plugin-transform-vite-meta-env'], }; diff --git a/apps/ats/web/jest.config.cjs b/apps/ats/web/jest.config.cjs index eb040ecd4..d847b549c 100644 --- a/apps/ats/web/jest.config.cjs +++ b/apps/ats/web/jest.config.cjs @@ -1,45 +1,44 @@ -process.env.TZ = "GMT"; +process.env.TZ = 'GMT'; module.exports = { - testEnvironment: "jest-environment-jsdom", - preset: "ts-jest", - ci: true, - testTimeout: 30000, - transform: { - "^.+\\.(ts|tsx)?$": ["ts-jest", { - tsconfig: './tsconfig.jest.json' - }], - "^.+\\.(js|jsx)$": "babel-jest", - "^.+\\.svg$": "/svgTransform.js", - }, - moduleFileExtensions: ["tsx", "ts", "js", "jsx"], - setupFiles: [ - "./jest.polyfills.js" - ], - setupFilesAfterEnv: [ - "@testing-library/jest-dom/extend-expect", - "./jest.setup.tsx", - ], - moduleNameMapper: { - "^react$": "/node_modules/react", - "^react-dom$": "/node_modules/react-dom", - "^@hashgraph/io-axios-services/(.*)$": - "/node_modules/@hashgraph/io-axios-services/lib/$1.js", - "\\.(css|less|scss|sass|ttf|png)$": "ts-jest", - }, - moduleDirectories: [ - "node_modules", - "/node_modules", - "/../../node_modules" - ], - collectCoverageFrom: [ - "**/views/**/*.{ts,tsx}", - "**/components/**/*.{ts,tsx}", - "**/layouts/**/*.{ts,tsx}", - "!**/node_modules/**", - "!**/vendor/**", - ], - transformIgnorePatterns: [ - "/node_modules/(?!(@hashgraph/asset-tokenization-sdk|@notabene/pii-sdk|multiformats|fireblocks-sdk|did-jwt|uuid|uint8arrays|@terminal3|jsonld)/)", + testEnvironment: 'jest-environment-jsdom', + preset: 'ts-jest', + testTimeout: 30000, + transform: { + '^.+\\.(ts|tsx)?$': [ + 'ts-jest', + { + tsconfig: './tsconfig.jest.json', + }, ], + '^.+\\.(js|jsx)$': 'babel-jest', + '^.+\\.svg$': '/svgTransform.js', + }, + moduleFileExtensions: ['tsx', 'ts', 'js', 'jsx'], + setupFiles: ['./jest.polyfills.js'], + setupFilesAfterEnv: [ + '@testing-library/jest-dom/extend-expect', + './jest.setup.tsx', + ], + moduleNameMapper: { + '^@hashgraph/io-axios-services/(.*)$': + '/node_modules/@hashgraph/io-axios-services/lib/$1.js', + '^@terminal3/(.*)$': '/__mocks__/@terminal3/$1.js', + '\\.(css|less|scss|sass|ttf|png)$': 'ts-jest', + }, + moduleDirectories: [ + 'node_modules', + '/node_modules', + '/../../node_modules', + ], + collectCoverageFrom: [ + '**/views/**/*.{ts,tsx}', + '**/components/**/*.{ts,tsx}', + '**/layouts/**/*.{ts,tsx}', + '!**/node_modules/**', + '!**/vendor/**', + ], + transformIgnorePatterns: [ + '/node_modules/(?!(@hashgraph/asset-tokenization-sdk|@notabene/pii-sdk|multiformats|fireblocks-sdk|did-jwt|uuid|uint8arrays|@terminal3|jsonld)/)', + ], }; diff --git a/apps/ats/web/jest.polyfills.js b/apps/ats/web/jest.polyfills.js index 13917a976..46afccd50 100644 --- a/apps/ats/web/jest.polyfills.js +++ b/apps/ats/web/jest.polyfills.js @@ -3,7 +3,7 @@ // but newer versions export LRUCache as a named export // Create a mock LRU constructor that jsonld expects -class LRU { +class _LRU { constructor(options = {}) { this.max = options.max || 100; this.cache = new Map(); @@ -44,13 +44,6 @@ class LRU { } } -// Override require for lru-cache to return our mock -const Module = require("module"); -const originalRequire = Module.prototype.require; - -Module.prototype.require = function (id) { - if (id === "lru-cache") { - return LRU; - } - return originalRequire.apply(this, arguments); -}; +// For ESM, use jest.mock or manual global override if needed +// Example for Jest: +// jest.mock('lru-cache', () => LRU); diff --git a/apps/ats/web/jest.setup.tsx b/apps/ats/web/jest.setup.tsx index 2bf09caa3..880759a9d 100644 --- a/apps/ats/web/jest.setup.tsx +++ b/apps/ats/web/jest.setup.tsx @@ -1,23 +1,27 @@ -process.env.VITE_API_URL = "http://localhost:8080/api/v1"; +process.env.VITE_API_URL = 'http://localhost:8080/api/v1'; // Mock Terminal3 modules to avoid LRU cache issues -jest.mock("@terminal3/verify_vc"); -jest.mock("@terminal3/bbs_vc"); +jest.mock('@terminal3/verify_vc'); +jest.mock('@terminal3/bbs_vc'); -import Select from "react-select"; +import Select from 'react-select'; // Polyfill for TextEncoder and TextDecoder -const { TextEncoder, TextDecoder } = require("util"); -global.TextEncoder = TextEncoder; -global.TextDecoder = TextDecoder; +import { TextEncoder, TextDecoder } from 'util'; +if (typeof (global as any).TextEncoder === 'undefined') { + (global as any).TextEncoder = TextEncoder; +} +if (typeof (global as any).TextDecoder === 'undefined') { + (global as any).TextDecoder = TextDecoder; +} -jest.doMock("chakra-react-select", () => ({ - ...jest.requireActual("chakra-react-select"), +jest.doMock('chakra-react-select', () => ({ + ...jest.requireActual('chakra-react-select'), // @ts-ignore Select: ({ _components, ...props }) => {fileName} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/Locker.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/Locker.tsx index a70a81c3c..50762a6e2 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/Locker.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/Locker.tsx @@ -1,4 +1,4 @@ -import { Center, HStack, Stack, useDisclosure, VStack } from "@chakra-ui/react"; +import { Center, HStack, Stack, useDisclosure, VStack } from '@chakra-ui/react'; import { Button, DefinitionList, @@ -7,47 +7,47 @@ import { PopUp, SearchInputController, Text, -} from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { isHederaValidAddress, required } from "../../../../utils/rules"; -import { useRolesStore } from "../../../../store/rolesStore"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import { Link as RouterLink, useParams } from "react-router-dom"; -import { useTranslation } from "react-i18next"; -import { RouterManager } from "../../../../router/RouterManager"; -import { RouteName } from "../../../../router/RouteName"; +} from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { isHederaValidAddress, required } from '../../../../utils/rules'; +import { useRolesStore } from '../../../../store/rolesStore'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import { Link as RouterLink, useParams } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; +import { RouterManager } from '../../../../router/RouterManager'; +import { RouteName } from '../../../../router/RouteName'; import { GET_LOCKERS, useGetLockers, -} from "../../../../hooks/queries/useGetLockers"; +} from '../../../../hooks/queries/useGetLockers'; import { GetLocksIdRequest, LockViewModel, ReleaseRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useState } from "react"; -import { formatDate } from "../../../../utils/format"; -import { DATE_TIME_FORMAT } from "../../../../utils/constants"; -import { useRelease } from "../../../../hooks/mutations/useLocker"; -import { useQueryClient } from "@tanstack/react-query"; -import { WarningCircle } from "@phosphor-icons/react"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useState } from 'react'; +import { formatDate } from '../../../../utils/format'; +import { DATE_TIME_FORMAT } from '../../../../utils/constants'; +import { useRelease } from '../../../../hooks/mutations/useLocker'; +import { useQueryClient } from '@tanstack/react-query'; +import { WarningCircle } from '@phosphor-icons/react'; export const Locker = () => { const queryClient = useQueryClient(); - const { id = "" } = useParams(); + const { id = '' } = useParams(); - const { t } = useTranslation("security", { - keyPrefix: "details.locker", + const { t } = useTranslation('security', { + keyPrefix: 'details.locker', }); - const { t: tButtons } = useTranslation("security", { - keyPrefix: "details.locker.actions", + const { t: tButtons } = useTranslation('security', { + keyPrefix: 'details.locker.actions', }); - const { t: tRelease } = useTranslation("security", { - keyPrefix: "details.locker.release", + const { t: tRelease } = useTranslation('security', { + keyPrefix: 'details.locker.release', }); - const [targetId, setTargetId] = useState(""); + const [targetId, setTargetId] = useState(''); const [lockToRelease, setLockToRelease] = useState(0); const [isReleasing, setIsReleasing] = useState(false); @@ -126,9 +126,9 @@ export const Locker = () => { isOpen={isOpen} onClose={onClose} icon={} - title={tRelease("confirmPopUp.title")} - description={tRelease("confirmPopUp.description")} - confirmText={tRelease("confirmPopUp.confirmText")} + title={tRelease('confirmPopUp.title')} + description={tRelease('confirmPopUp.description')} + confirmText={tRelease('confirmPopUp.confirmText')} onConfirm={() => { onClose(); handleRelease(); @@ -137,8 +137,8 @@ export const Locker = () => { onClose(); setLockToRelease(0); }} - cancelText={tRelease("confirmPopUp.cancelText")} - confirmButtonProps={{ status: "danger" }} + cancelText={tRelease('confirmPopUp.cancelText')} + confirmButtonProps={{ status: 'danger' }} /> {hasLockerRole && ( @@ -150,15 +150,15 @@ export const Locker = () => { })} variant="secondary" > - {tButtons("lock")} + {tButtons('lock')} )}
- {t("search.title")} - {t("search.description")} + {t('search.title')} + {t('search.description')} { > {}} size="sm" @@ -186,7 +186,7 @@ export const Locker = () => { isDisabled={!formState.isValid || isInitLoading} > - {t("search.search")} + {t('search.search')} @@ -206,10 +206,10 @@ export const Locker = () => { { /> {canBeReleased && hasLockerRole && ( )} @@ -238,7 +238,7 @@ export const Locker = () => { )} {lockers && lockers.length === 0 && !isLoading && (
- {t("list.noLocks")} + {t('list.noLocks')}
)} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/__tests__/Locker.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/__tests__/Locker.test.tsx index cd9056360..b41cefe1b 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/__tests__/Locker.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Locker/__tests__/Locker.test.tsx @@ -1,31 +1,31 @@ -import { fireEvent, waitFor } from "@testing-library/react"; -import { render } from "../../../../../test-utils"; -import { Locker } from "../Locker"; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../../../../test-utils'; +import { Locker } from '../Locker'; describe(`${Locker.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should render the search button disabled if the targetId is empty", () => { + test('should render the search button disabled if the targetId is empty', () => { const component = render(); - const searchButton = component.getByTestId("search-button"); + const searchButton = component.getByTestId('search-button'); expect(searchButton).toBeDisabled(); }); - test("should render the search button enabled if the targetId is not empty", async () => { + test('should render the search button enabled if the targetId is not empty', async () => { const component = render(); - const searchButton = component.getByTestId("search-button"); + const searchButton = component.getByTestId('search-button'); expect(searchButton).toBeDisabled(); - fireEvent.change(component.getByTestId("search"), { - target: { value: "0.0.12345" }, + fireEvent.change(component.getByTestId('search'), { + target: { value: '0.0.12345' }, }); await waitFor(() => { diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/MadurityDateItem.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/MadurityDateItem.tsx index 4e90d2e26..8e6f82a12 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/MadurityDateItem.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/MadurityDateItem.tsx @@ -1,37 +1,37 @@ import { GetBondDetailsRequest, UpdateMaturityDateRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useEffect, useState } from "react"; -import { FieldValues, useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { useUpdateBondMaturityDate } from "../../../hooks/mutations/useUpdateBonMaturityDate"; -import { dateToUnixTimestamp, formatDate } from "../../../utils/format"; -import { Flex } from "@chakra-ui/react"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useEffect, useState } from 'react'; +import { FieldValues, useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { useUpdateBondMaturityDate } from '../../../hooks/mutations/useUpdateBonMaturityDate'; +import { dateToUnixTimestamp, formatDate } from '../../../utils/format'; +import { Flex } from '@chakra-ui/react'; import { CalendarInputController, IconButton, PhosphorIcon, PopUp, Text, -} from "io-bricks-ui"; -import { Pencil, X, Info, Check } from "@phosphor-icons/react"; -import { useRolesStore } from "../../../store/rolesStore"; -import { SecurityRole } from "../../../utils/SecurityRole"; -import { useGetBondDetails } from "../../../hooks/queries/useGetSecurityDetails"; -import { useParams } from "react-router-dom"; -import { DATE_TIME_FORMAT } from "../../../utils/constants"; +} from 'io-bricks-ui'; +import { Pencil, X, Info, Check } from '@phosphor-icons/react'; +import { useRolesStore } from '../../../store/rolesStore'; +import { SecurityRole } from '../../../utils/SecurityRole'; +import { useGetBondDetails } from '../../../hooks/queries/useGetSecurityDetails'; +import { useParams } from 'react-router-dom'; +import { DATE_TIME_FORMAT } from '../../../utils/constants'; export const MaturityDateItem = ({ securityId }: { securityId: string }) => { - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { roles: accountRoles } = useRolesStore(); - const { t } = useTranslation("security", { - keyPrefix: "details.bond.updateMaturityDate.toast", + const { t } = useTranslation('security', { + keyPrefix: 'details.bond.updateMaturityDate.toast', }); const { control, reset, handleSubmit } = useForm({ - mode: "onChange", + mode: 'onChange', }); const [isEditMode, setIsEditMode] = useState(false); @@ -78,12 +78,12 @@ export const MaturityDateItem = ({ securityId }: { securityId: string }) => { return ( - + {isEditMode && ( <> { withTimeInput format={DATE_TIME_FORMAT} /> - + } aria-label="save button" - size={"sm"} + size={'sm'} onClick={() => { setShowConfirmPopUp(true); }} @@ -109,7 +109,7 @@ export const MaturityDateItem = ({ securityId }: { securityId: string }) => { } aria-label="cancel button" - size={"sm"} + size={'sm'} onClick={() => setIsEditMode(false)} /> @@ -122,7 +122,7 @@ export const MaturityDateItem = ({ securityId }: { securityId: string }) => { {accountRoles.includes(SecurityRole._BOND_MANAGER_ROLE) && ( } aria-label="edit button" variant="secondary" @@ -137,14 +137,14 @@ export const MaturityDateItem = ({ securityId }: { securityId: string }) => { id="confirmMaturityDate" isOpen={showConfirmPopUp} onClose={() => { - !isLoading && setShowConfirmPopUp(false); + if (!isLoading) setShowConfirmPopUp(false); }} closeOnOverlayClick={!isLoading} icon={} - title={t("title")} - description={t("subtitle")} - cancelText={t("cancelButtonText")} - confirmText={t("confirmButtonText")} + title={t('title')} + description={t('subtitle')} + cancelText={t('cancelButtonText')} + confirmText={t('confirmButtonText')} confirmButtonProps={{ isLoading: isLoading, }} @@ -152,7 +152,7 @@ export const MaturityDateItem = ({ securityId }: { securityId: string }) => { handleSubmit(onSubmit)(); }} onCancel={() => { - !isLoading && setShowConfirmPopUp(false); + if (!isLoading) setShowConfirmPopUp(false); }} /> diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Management/Management.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Management/Management.tsx index 117e8107b..f96e6f17a 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Management/Management.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Management/Management.tsx @@ -1,26 +1,26 @@ -import { HStack, Stack, VStack } from "@chakra-ui/react"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; import { Button, DefinitionList, Heading, InputController, Text, -} from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { useUpdateSecurityConfigVersion } from "../../../../hooks/mutations/useUpdateSecurityConfigVersion"; -import { useUpdateSecurityConfigId } from "../../../../hooks/mutations/useUpdateSecurityConfigId"; -import { useUpdateSecurityResolverAddress } from "../../../../hooks/mutations/useUpdateSecurityResolverAddress"; +} from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { useUpdateSecurityConfigVersion } from '../../../../hooks/mutations/useUpdateSecurityConfigVersion'; +import { useUpdateSecurityConfigId } from '../../../../hooks/mutations/useUpdateSecurityConfigId'; +import { useUpdateSecurityResolverAddress } from '../../../../hooks/mutations/useUpdateSecurityResolverAddress'; import { GetConfigInfoRequest, UpdateConfigRequest, UpdateConfigVersionRequest, UpdateResolverRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useGetConfigDetails } from "../../../../hooks/queries/useGetConfigDetails"; -import { collapseText } from "../../../../utils/format"; -import { required } from "../../../../utils/rules"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useGetConfigDetails } from '../../../../hooks/queries/useGetConfigDetails'; +import { collapseText } from '../../../../utils/format'; +import { required } from '../../../../utils/rules'; type ManagementFormSchema = { resolverId?: string; @@ -33,14 +33,14 @@ interface ManagementProps { } export const Management = ({ id }: ManagementProps) => { - const { t } = useTranslation("security", { - keyPrefix: "management", + const { t } = useTranslation('security', { + keyPrefix: 'management', }); const [isLoading, setIsLoading] = useState(false); const { control, reset, handleSubmit, watch } = useForm( { - mode: "onChange", + mode: 'onChange', }, ); @@ -120,30 +120,30 @@ export const Management = ({ id }: ManagementProps) => { }; return ( - + - - - {t("form.title")} - {t("form.subtitle")} + + + {t('form.title')} + {t('form.subtitle')} - + - watch("resolverId") - ? !!value || t("form.validations.configIdWhenResolverId") + watch('resolverId') + ? !!value || t('form.validations.configIdWhenResolverId') : true, }} isClearable @@ -151,7 +151,7 @@ export const Management = ({ id }: ManagementProps) => { { isClearable /> - - diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/HandleRoles.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/HandleRoles.tsx index e7b602857..ec422766f 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/HandleRoles.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/HandleRoles.tsx @@ -203,17 +203,17 @@ */ -import { Button, HStack, VStack } from "@chakra-ui/react"; -import { useTranslation } from "react-i18next"; -import { CheckboxGroupController, Text } from "io-bricks-ui"; -import { required } from "../../../../utils/rules"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { ApplyRolesRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { useApplyRoles } from "../../../../hooks/queries/useApplyRoles"; -import { rolesList, TSecurityType } from "./rolesList"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import { useSecurityStore } from "../../../../store/securityStore"; +import { Button, HStack, VStack } from '@chakra-ui/react'; +import { useTranslation } from 'react-i18next'; +import { CheckboxGroupController, Text } from 'io-bricks-ui'; +import { required } from '../../../../utils/rules'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { ApplyRolesRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { useApplyRoles } from '../../../../hooks/queries/useApplyRoles'; +import { rolesList, TSecurityType } from './rolesList'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import { useSecurityStore } from '../../../../store/securityStore'; interface EditRolesFormValues { roles: string[]; @@ -229,21 +229,21 @@ export const HandleRoles = ({ currentRoles: string[]; address: string; }) => { - const { t: tRoles } = useTranslation("roles"); - const { t: tInputs } = useTranslation("security", { - keyPrefix: "details.roleManagement.edit.inputs", + const { t: tRoles } = useTranslation('roles'); + const { t: tInputs } = useTranslation('security', { + keyPrefix: 'details.roleManagement.edit.inputs', }); - const { t } = useTranslation("security", { - keyPrefix: "details.roleManagement.edit", + const { t } = useTranslation('security', { + keyPrefix: 'details.roleManagement.edit', }); const { details: securityDetails } = useSecurityStore(); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { mutate: applyRoles, isLoading: isLoadingApply } = useApplyRoles(); const { handleSubmit: onHandleSubmit, control: controlRoles } = useForm({ - mode: "onSubmit", + mode: 'onSubmit', defaultValues: { roles: currentRoles, }, @@ -277,11 +277,11 @@ export const HandleRoles = ({ onSubmit={onHandleSubmit(onSubmitRoles)} > - {t("rolesDefinitions")} + {t('rolesDefinitions')} { @@ -307,7 +307,7 @@ export const HandleRoles = ({ type="submit" isLoading={isLoadingApply} > - {tInputs("apply.button")} + {tInputs('apply.button')} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RoleManagement.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RoleManagement.tsx index d6a0cac74..1f5278e8d 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RoleManagement.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RoleManagement.tsx @@ -203,15 +203,15 @@ */ -import { Stack } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { EditRole } from "./EditRole"; -import { SearchByRole } from "./SearchByRole"; +import { Stack } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { EditRole } from './EditRole'; +import { SearchByRole } from './SearchByRole'; export const RoleManagement = () => { - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.roleManagement.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.roleManagement.tabs', }); return ( @@ -220,9 +220,9 @@ export const RoleManagement = () => { tabs={[ { content: , - header: tTabs("edit"), + header: tTabs('edit'), }, - { content: , header: tTabs("search") }, + { content: , header: tTabs('search') }, ]} isFitted /> diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RolesProps.ts b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RolesProps.ts index 47d98eff1..fadc1090f 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RolesProps.ts +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/RolesProps.ts @@ -203,7 +203,7 @@ */ -import { SecurityViewModel } from "@hashgraph/asset-tokenization-sdk"; +import { SecurityViewModel } from '@hashgraph/asset-tokenization-sdk'; export interface RolesProps { roles: string[]; diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/SearchByRole.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/SearchByRole.tsx index e829709c4..0692d62ac 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/SearchByRole.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/SearchByRole.tsx @@ -203,25 +203,25 @@ */ -import { Button, HStack, Stack, VStack } from "@chakra-ui/react"; -import { Text, DefinitionList, SelectController } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { required } from "../../../../utils/rules"; -import { useForm } from "react-hook-form"; -import { SecurityDetails } from "../SecurityDetails"; +import { Button, HStack, Stack, VStack } from '@chakra-ui/react'; +import { Text, DefinitionList, SelectController } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { required } from '../../../../utils/rules'; +import { useForm } from 'react-hook-form'; +import { SecurityDetails } from '../SecurityDetails'; import { useGetRoleMemberCount, useGetRoleMembers, -} from "../../../../hooks/queries/useGetSecurityDetails"; +} from '../../../../hooks/queries/useGetSecurityDetails'; import { GetRoleMemberCountRequest, GetRoleMembersRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { rolesList, TSecurityType } from "./rolesList"; -import { useEffect, useState } from "react"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import { useSecurityStore } from "../../../../store/securityStore"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { rolesList, TSecurityType } from './rolesList'; +import { useEffect, useState } from 'react'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import { useSecurityStore } from '../../../../store/securityStore'; interface SearchByRoleFieldValue { role: { label: string; value: SecurityRole }; @@ -233,15 +233,15 @@ const COLUMN_MAX_WIDTH = `${COLUMN_WIDTH}px`; const TITLE_WIDTH = `${COLUMN_WIDTH * 2 + COLUMNS_GAP}px`; export const SearchByRole = () => { - const { t: tProperties } = useTranslation("properties"); - const { t: tRoles } = useTranslation("roles"); - const { t: tInputs } = useTranslation("security", { - keyPrefix: "details.roleManagement.search.inputs", + const { t: tProperties } = useTranslation('properties'); + const { t: tRoles } = useTranslation('roles'); + const { t: tInputs } = useTranslation('security', { + keyPrefix: 'details.roleManagement.search.inputs', }); - const { t } = useTranslation("security", { - keyPrefix: "details.roleManagement.search", + const { t } = useTranslation('security', { + keyPrefix: 'details.roleManagement.search', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details: securityDetails } = useSecurityStore(); const [roleToSearch, setRoleToSearch] = useState(); @@ -256,26 +256,26 @@ export const SearchByRole = () => { handleSubmit, watch, } = useForm({ - mode: "onSubmit", + mode: 'onSubmit', }); - const role = watch("role"); + const role = watch('role'); const roleMemberCountRequest = new GetRoleMemberCountRequest({ securityId: id, - role: roleToSearch ?? "", + role: roleToSearch ?? '', }); const { data: roleMemberCount, refetch: refetchRoleMemberCount } = useGetRoleMemberCount(roleMemberCountRequest, { enabled: false, - onSuccess: (data) => console.log("COUNT ", data), - onError: (error) => console.error("ERROR", error), + onSuccess: (data) => console.log('COUNT ', data), + onError: (error) => console.error('ERROR', error), onSettled: () => setIsRoleMemberCountLoading(false), }); const roleMembersRequest = new GetRoleMembersRequest({ securityId: id, - role: roleToSearch ?? "", + role: roleToSearch ?? '', start: 0, end: roleMemberCount ?? 0, }); @@ -315,8 +315,8 @@ export const SearchByRole = () => { w={TITLE_WIDTH} minW={COLUMN_WIDTH} > - {t("title")} - {t("subtitle")} + {t('title')} + {t('subtitle')} @@ -350,7 +350,7 @@ export const SearchByRole = () => { setIsRoleMemberCountLoading(false); setIsRoleMembersLoading(false); }} - {...tInputs("select", { returnObjects: true })} + {...tInputs('select', { returnObjects: true })} /> {roleMemberCount === 0 && !isRoleMemberCountLoading && ( - {t("noRoles")} + {t('noRoles')} )} {roleMembers && ( ({ - title: tProperties("id"), + title: tProperties('id'), description: account, canCopy: true, }))} - title={t("role", { role: role.label })} + title={t('role', { role: role.label })} layerStyle="whiteContainer" maxH="485px" overflowY="auto" diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/EditRole.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/EditRole.test.tsx index 0563232bd..a4d0ca444 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/EditRole.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/EditRole.test.tsx @@ -203,12 +203,12 @@ */ -import { EditRole } from "../EditRole"; -import { render } from "../../../../../test-utils"; +import { EditRole } from '../EditRole'; +import { render } from '../../../../../test-utils'; // TODO Improve tests when it is connected to SDK describe(`${EditRole.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/RoleManagement.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/RoleManagement.test.tsx index 79cfa4b78..3ba42f613 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/RoleManagement.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/RoleManagement.test.tsx @@ -203,12 +203,12 @@ */ -import { RoleManagement } from "../RoleManagement"; -import { render } from "../../../../../test-utils"; +import { RoleManagement } from '../RoleManagement'; +import { render } from '../../../../../test-utils'; // TODO Improve tests when it is connected to SDK describe(`${RoleManagement.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/SearchByRole.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/SearchByRole.test.tsx index 8f7a071ff..5afa3efbd 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/SearchByRole.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/__tests__/SearchByRole.test.tsx @@ -203,30 +203,30 @@ */ -import { SearchByRole } from "../SearchByRole"; -import { render } from "../../../../../test-utils"; -import { waitFor } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; +import { SearchByRole } from '../SearchByRole'; +import { render } from '../../../../../test-utils'; +import { waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; describe(`${SearchByRole.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test.only("should fill form", async () => { + test.only('should fill form', async () => { const component = factoryComponent(); - const submitButton = component.getByTestId("select-role-button"); + const submitButton = component.getByTestId('select-role-button'); expect(submitButton).toBeDisabled(); - const selector = component.container.querySelector("input#role")!; + const selector = component.container.querySelector('input#role')!; await userEvent.click(selector); - const adminRoleOption = component.getByText("Admin role"); + const adminRoleOption = component.getByText('Admin role'); expect(adminRoleOption).toBeVisible(); await userEvent.click(adminRoleOption); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/rolesList.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/rolesList.tsx index 4eb96b7bb..48826ae61 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/rolesList.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/rolesList.tsx @@ -203,9 +203,9 @@ */ -import { SecurityRole } from "../../../../utils/SecurityRole"; +import { SecurityRole } from '../../../../utils/SecurityRole'; -export type TSecurityType = "BOND" | "EQUITY"; +export type TSecurityType = 'BOND' | 'EQUITY'; export type TRole = { label: string; @@ -215,108 +215,108 @@ export type TRole = { export const rolesList: TRole[] = [ { - label: "admin", + label: 'admin', value: SecurityRole._DEFAULT_ADMIN_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "minter", + label: 'minter', value: SecurityRole._ISSUER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "freezer", + label: 'freezer', value: SecurityRole._FREEZE_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "controller", + label: 'controller', value: SecurityRole._CONTROLLER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "pause", + label: 'pause', value: SecurityRole._PAUSER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "controlList", + label: 'controlList', value: SecurityRole._CONTROLLIST_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "corporateActions", + label: 'corporateActions', value: SecurityRole._CORPORATEACTIONS_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "document", + label: 'document', value: SecurityRole._DOCUMENTER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "snapshot", + label: 'snapshot', value: SecurityRole._SNAPSHOT_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "bondManager", + label: 'bondManager', value: SecurityRole._BOND_MANAGER_ROLE, - allowedSecurities: ["BOND"], + allowedSecurities: ['BOND'], }, { - label: "adjustmentBalance", + label: 'adjustmentBalance', value: SecurityRole._ADJUSTMENT_BALANCE_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "locker", + label: 'locker', value: SecurityRole._LOCKER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "cap", + label: 'cap', value: SecurityRole._CAP_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "kyc", + label: 'kyc', value: SecurityRole._KYC_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "ssiManager", + label: 'ssiManager', value: SecurityRole._SSI_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "clearing", + label: 'clearing', value: SecurityRole._CLEARING_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "clearingValidator", + label: 'clearingValidator', value: SecurityRole._CLEARING_VALIDATOR_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "pauseManager", + label: 'pauseManager', value: SecurityRole._PAUSE_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "controlListManager", + label: 'controlListManager', value: SecurityRole._CONTROL_LIST_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "kycListManager", + label: 'kycListManager', value: SecurityRole._KYC_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, { - label: "internalKYCManager", + label: 'internalKYCManager', value: SecurityRole._INTERNAL_KYC_MANAGER_ROLE, - allowedSecurities: ["BOND", "EQUITY"], + allowedSecurities: ['BOND', 'EQUITY'], }, ]; diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManager.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManager.tsx index 23a70587a..04ee9ca95 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManager.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManager.tsx @@ -4,34 +4,34 @@ import { Stack, useDisclosure, VStack, -} from "@chakra-ui/react"; -import { createColumnHelper } from "@tanstack/table-core"; -import { Button, PhosphorIcon, PopUp, Table, Text } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { SSIManagerModal } from "./SSIManagerModal"; -import { Trash } from "@phosphor-icons/react"; -import { useMemo, useState } from "react"; -import { SSIManagerRevocationModal } from "./SSIManagerRevocationModal"; +} from '@chakra-ui/react'; +import { createColumnHelper } from '@tanstack/table-core'; +import { Button, PhosphorIcon, PopUp, Table, Text } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { SSIManagerModal } from './SSIManagerModal'; +import { Trash } from '@phosphor-icons/react'; +import { useMemo, useState } from 'react'; +import { SSIManagerRevocationModal } from './SSIManagerRevocationModal'; import { useGetIssuersList, useGetRevocationRegistryAddress, -} from "../../../../hooks/queries/useSSIManager"; +} from '../../../../hooks/queries/useSSIManager'; import { GetIssuerListMembersRequest, GetRevocationRegistryAddressRequest, RemoveIssuerRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { useRolesStore } from "../../../../store/rolesStore"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import { useRemoveIssuer } from "../../../../hooks/mutations/useSSIManager"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { useRolesStore } from '../../../../store/rolesStore'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import { useRemoveIssuer } from '../../../../hooks/mutations/useSSIManager'; interface AllowedListFields { accountId: string; } export const SSIManager = () => { - const { id: securityId = "" } = useParams(); + const { id: securityId = '' } = useParams(); const { roles: accountRoles } = useRolesStore(); @@ -47,20 +47,20 @@ export const SSIManager = () => { onOpen: onOpenRemoveModal, } = useDisclosure(); - const { t: tRevocation } = useTranslation("security", { - keyPrefix: "details.ssiManager.revocation", + const { t: tRevocation } = useTranslation('security', { + keyPrefix: 'details.ssiManager.revocation', }); - const { t: tList } = useTranslation("security", { - keyPrefix: "details.ssiManager.list", + const { t: tList } = useTranslation('security', { + keyPrefix: 'details.ssiManager.list', }); - const { t: tTable } = useTranslation("security", { - keyPrefix: "details.ssiManager.table", + const { t: tTable } = useTranslation('security', { + keyPrefix: 'details.ssiManager.table', }); - const { t: tRemove } = useTranslation("security", { - keyPrefix: "details.ssiManager.removePopUp", + const { t: tRemove } = useTranslation('security', { + keyPrefix: 'details.ssiManager.removePopUp', }); - const [accountToRemove, setAccountToRemove] = useState(""); + const [accountToRemove, setAccountToRemove] = useState(''); const [isRemoving, setIsRemoving] = useState(false); const columnsHelper = createColumnHelper(); @@ -101,15 +101,15 @@ export const SSIManager = () => { ); const columns = [ - columnsHelper.accessor("accountId", { - header: tTable("fields.accountId"), + columnsHelper.accessor('accountId', { + header: tTable('fields.accountId'), enableSorting: false, }), ...(hasSSIManagerRole ? [ columnsHelper.display({ - id: "remove", - header: tTable("fields.actions"), + id: 'remove', + header: tTable('fields.actions'), size: 5, enableSorting: false, cell(props) { @@ -129,7 +129,7 @@ export const SSIManager = () => { variant="table" size="xs" > - + ); }, @@ -149,16 +149,16 @@ export const SSIManager = () => { gap={4} mb={4} > - - + + - {tRevocation("title")} + {tRevocation('title')} {isLoadingRevocationRegistryAddress ? ( ) : ( - {revocationRegistryAddress ?? "-"} + {revocationRegistryAddress ?? '-'} )} @@ -169,7 +169,7 @@ export const SSIManager = () => { }} size="sm" > - {tRevocation("change")} + {tRevocation('change')} )} @@ -183,9 +183,9 @@ export const SSIManager = () => { pt={6} gap={4} > - + - {tList("title")} + {tList('title')} {hasSSIManagerRole && ( )} @@ -215,9 +215,9 @@ export const SSIManager = () => { isOpen={isOpenRemoveModal} onClose={onCloseRemoveModal} icon={} - title={tRemove("title")} - description={tRemove("description")} - confirmText={tRemove("confirmText")} + title={tRemove('title')} + description={tRemove('description')} + confirmText={tRemove('confirmText')} onConfirm={() => { setIsRemoving(true); @@ -236,7 +236,7 @@ export const SSIManager = () => { }); }} onCancel={onCloseRemoveModal} - cancelText={tRemove("cancelText")} + cancelText={tRemove('cancelText')} confirmButtonProps={{ isLoading: isRemoving, }} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerModal.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerModal.tsx index 603665c2f..e1edc4bbc 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerModal.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerModal.tsx @@ -8,27 +8,27 @@ import { ModalOverlay, ModalProps, VStack, -} from "@chakra-ui/react"; -import { Button, InputController } from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { isHederaValidAddress, required } from "../../../../utils/rules"; -import { useAddIssuer } from "../../../../hooks/mutations/useSSIManager"; -import { AddIssuerRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { useState } from "react"; +} from '@chakra-ui/react'; +import { Button, InputController } from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { isHederaValidAddress, required } from '../../../../utils/rules'; +import { useAddIssuer } from '../../../../hooks/mutations/useSSIManager'; +import { AddIssuerRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { useState } from 'react'; interface FormValues { accountId: string; } -interface SSIManagerModalProps extends Omit {} +type SSIManagerModalProps = Omit; export const SSIManagerModal = ({ isOpen, onClose }: SSIManagerModalProps) => { - const { id: securityId = "" } = useParams(); + const { id: securityId = '' } = useParams(); - const { t: tCreate } = useTranslation("security", { - keyPrefix: "details.ssiManager.create", + const { t: tCreate } = useTranslation('security', { + keyPrefix: 'details.ssiManager.create', }); const [isLoading, setIsLoading] = useState(false); @@ -38,7 +38,7 @@ export const SSIManagerModal = ({ isOpen, onClose }: SSIManagerModalProps) => { formState: { isValid }, handleSubmit, } = useForm({ - mode: "onChange", + mode: 'onChange', }); const { mutate } = useAddIssuer(); @@ -64,16 +64,16 @@ export const SSIManagerModal = ({ isOpen, onClose }: SSIManagerModalProps) => { return ( - - {tCreate("title")} + + {tCreate('title')} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerRevocationModal.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerRevocationModal.tsx index d3c78f31b..266e98025 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerRevocationModal.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SSIManager/SSIManagerRevocationModal.tsx @@ -8,30 +8,30 @@ import { ModalOverlay, ModalProps, VStack, -} from "@chakra-ui/react"; -import { Button, InputController } from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { useSetRevocationRegistryAddress } from "../../../../hooks/mutations/useSSIManager"; -import { useState } from "react"; -import { SetRevocationRegistryAddressRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { isHederaValidAddress, required } from "../../../../utils/rules"; +} from '@chakra-ui/react'; +import { Button, InputController } from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { useSetRevocationRegistryAddress } from '../../../../hooks/mutations/useSSIManager'; +import { useState } from 'react'; +import { SetRevocationRegistryAddressRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { isHederaValidAddress, required } from '../../../../utils/rules'; interface FormValues { accountId: string; } -interface SSIManagerRevocationModalProps extends Omit {} +type SSIManagerRevocationModalProps = Omit; export const SSIManagerRevocationModal = ({ isOpen, onClose, }: SSIManagerRevocationModalProps) => { - const { id: securityId = "" } = useParams(); + const { id: securityId = '' } = useParams(); - const { t: tRevocation } = useTranslation("security", { - keyPrefix: "details.ssiManager.revocation", + const { t: tRevocation } = useTranslation('security', { + keyPrefix: 'details.ssiManager.revocation', }); const [isLoading, setIsLoading] = useState(false); @@ -41,7 +41,7 @@ export const SSIManagerRevocationModal = ({ formState: { isValid }, handleSubmit, } = useForm({ - mode: "onChange", + mode: 'onChange', }); const { mutate } = useSetRevocationRegistryAddress(); @@ -67,16 +67,16 @@ export const SSIManagerRevocationModal = ({ return ( - - {tRevocation("title")} + + {tRevocation('title')} @@ -88,7 +88,7 @@ export const SSIManagerRevocationModal = ({ onClick={handleSubmit(onSubmit)} isLoading={isLoading} > - {tRevocation("change")} + {tRevocation('change')} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetails.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetails.tsx index 12521a3ef..aaf3e4483 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetails.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetails.tsx @@ -203,16 +203,16 @@ */ -import { DefinitionList, DefinitionListProps } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { useSecurityStore } from "../../../store/securityStore"; -import { useParams } from "react-router-dom"; -import { toNumber } from "../../../utils/format"; +import { DefinitionList, DefinitionListProps } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { useSecurityStore } from '../../../store/securityStore'; +import { useParams } from 'react-router-dom'; +import { toNumber } from '../../../utils/format'; -interface SecurityDetails extends Omit {} +type SecurityDetailsProps = Omit; -export const SecurityDetails = (props: SecurityDetails) => { - const { t: tProperties } = useTranslation("properties"); +export const SecurityDetails = (props: SecurityDetailsProps) => { + const { t: tProperties } = useTranslation('properties'); const { details } = useSecurityStore(); const { id } = useParams(); @@ -226,35 +226,35 @@ export const SecurityDetails = (props: SecurityDetails) => { description: details?.securityType ?? "", },*/ { - title: tProperties("name"), - description: details?.name ?? "", + title: tProperties('name'), + description: details?.name ?? '', }, { - title: tProperties("symbol"), - description: details?.symbol ?? "", + title: tProperties('symbol'), + description: details?.symbol ?? '', }, { - title: tProperties("decimal"), - description: details?.decimals ?? "", + title: tProperties('decimal'), + description: details?.decimals ?? '', }, { - title: tProperties("isin"), - description: details?.isin ?? "", + title: tProperties('isin'), + description: details?.isin ?? '', }, { - title: tProperties("id"), - description: id ?? "", + title: tProperties('id'), + description: id ?? '', }, { - title: tProperties("maxSupply"), + title: tProperties('maxSupply'), description: `${details?.maxSupply} ${details?.symbol}`, }, { - title: tProperties("totalSupply"), + title: tProperties('totalSupply'), description: `${details?.totalSupply} ${details?.symbol}`, }, { - title: tProperties("pendingToBeMinted"), + title: tProperties('pendingToBeMinted'), description: `${ toNumber(details?.maxSupply) - toNumber(details?.totalSupply) } ${details?.symbol}`, diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetailsExtended.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetailsExtended.tsx index 5fae10c39..6a2d26927 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetailsExtended.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/SecurityDetailsExtended.tsx @@ -209,21 +209,22 @@ import { ClipboardButton, Text, BasicDefinitionListItem, -} from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; +} from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; import { formatDate, formatNumberLocale, toNumber, -} from "../../../utils/format"; -import { useSecurityStore } from "../../../store/securityStore"; -import { useParams } from "react-router-dom"; -import { Flex } from "@chakra-ui/react"; -import { BondDetailsViewModel } from "@hashgraph/asset-tokenization-sdk"; -import { useEffect, useMemo } from "react"; -import { MaturityDateItem } from "./MadurityDateItem"; -import { DATE_TIME_FORMAT } from "../../../utils/constants"; -interface SecurityDetailsExtended extends Omit { +} from '../../../utils/format'; +import { useSecurityStore } from '../../../store/securityStore'; +import { useParams } from 'react-router-dom'; +import { Flex } from '@chakra-ui/react'; +import { BondDetailsViewModel } from '@hashgraph/asset-tokenization-sdk'; +import { useEffect, useMemo } from 'react'; +import { MaturityDateItem } from './MadurityDateItem'; +import { DATE_TIME_FORMAT } from '../../../utils/constants'; +interface SecurityDetailsExtendedProps + extends Omit { nominalValue?: number; bondDetailsResponse?: BondDetailsViewModel; } @@ -232,64 +233,64 @@ export const SecurityDetailsExtended = ({ nominalValue, bondDetailsResponse, ...props -}: SecurityDetailsExtended) => { - const { t: tProperties } = useTranslation("properties"); +}: SecurityDetailsExtendedProps) => { + const { t: tProperties } = useTranslation('properties'); const { details } = useSecurityStore(); const { id } = useParams(); const defaultItems: BasicDefinitionListItem[] = useMemo( () => [ { - title: tProperties("name"), - description: details?.name ?? "", + title: tProperties('name'), + description: details?.name ?? '', }, { - title: tProperties("symbol"), - description: details?.symbol ?? "", + title: tProperties('symbol'), + description: details?.symbol ?? '', }, { - title: tProperties("decimal"), - description: details?.decimals ?? "", + title: tProperties('decimal'), + description: details?.decimals ?? '', }, { - title: tProperties("isin"), - description: details?.isin ?? "", + title: tProperties('isin'), + description: details?.isin ?? '', }, { - title: tProperties("evmAddress"), - description: details?.evmDiamondAddress ?? "", + title: tProperties('evmAddress'), + description: details?.evmDiamondAddress ?? '', canCopy: true, }, { - title: tProperties("id"), + title: tProperties('id'), description: ( {id} - {tProperties("copyId")} + {tProperties('copyId')} ), }, { - title: tProperties("currency"), - description: "USD", + title: tProperties('currency'), + description: 'USD', }, // TODO: - format from ASCII when more currencies are available { - title: tProperties("nominalValue"), + title: tProperties('nominalValue'), description: formatNumberLocale(nominalValue, 2), }, { - title: tProperties("maxSupply"), + title: tProperties('maxSupply'), description: `${details?.maxSupply} ${details?.symbol}`, }, { - title: tProperties("totalSupply"), + title: tProperties('totalSupply'), description: `${details?.totalSupply} ${details?.symbol}`, }, { - title: tProperties("pendingToBeMinted"), + title: tProperties('pendingToBeMinted'), description: `${ toNumber(details?.maxSupply) - toNumber(details?.totalSupply) } ${details?.symbol}`, @@ -302,11 +303,11 @@ export const SecurityDetailsExtended = ({ useEffect(() => { if ( details && - details.type === "BOND" && - !defaultItems.find(({ title }) => title === tProperties("startingDate")) + details.type === 'BOND' && + !defaultItems.find(({ title }) => title === tProperties('startingDate')) ) { defaultItems.push({ - title: tProperties("startingDate"), + title: tProperties('startingDate'), description: formatDate( bondDetailsResponse?.startingDate, DATE_TIME_FORMAT, @@ -317,10 +318,10 @@ export const SecurityDetailsExtended = ({ bondDetailsResponse && bondDetailsResponse.maturityDate && id && - !defaultItems.find(({ title }) => title === tProperties("maturityDate")) + !defaultItems.find(({ title }) => title === tProperties('maturityDate')) ) { defaultItems.push({ - title: tProperties("maturityDate"), + title: tProperties('maturityDate'), description: , }); } diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Control.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Control.tsx index 92e27eab9..eea335157 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Control.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Control.tsx @@ -1,15 +1,15 @@ -import { Box } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { KYC } from "../KYC/KYC"; -import { SSIManager } from "../SSIManager/SSIManager"; -import { ControlList } from "../ControlList"; -import { SecurityViewModel } from "@hashgraph/asset-tokenization-sdk"; -import { useMemo } from "react"; -import { ExternalPause } from "../ExternalPause/ExternalPause"; -import { ExternalControl } from "../ExternalControl/ExternalControl"; -import { ExternalKYC } from "../ExternalKYC/ExternalKYC"; -import { AdminControlActionsButtons } from "../AdminControlActionsButtons"; +import { Box } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { KYC } from '../KYC/KYC'; +import { SSIManager } from '../SSIManager/SSIManager'; +import { ControlList } from '../ControlList'; +import { SecurityViewModel } from '@hashgraph/asset-tokenization-sdk'; +import { useMemo } from 'react'; +import { ExternalPause } from '../ExternalPause/ExternalPause'; +import { ExternalControl } from '../ExternalControl/ExternalControl'; +import { ExternalKYC } from '../ExternalKYC/ExternalKYC'; +import { AdminControlActionsButtons } from '../AdminControlActionsButtons'; interface ControlTabProps { details: SecurityViewModel; @@ -21,8 +21,8 @@ interface ControlTabProps { } export const ControlTab = ({ details, config }: ControlTabProps) => { - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.tabs', }); const isWhiteList = details.isWhiteList; @@ -33,31 +33,31 @@ export const ControlTab = ({ details, config }: ControlTabProps) => { if (config.showControlList) { tabs.push({ content: , - header: isWhiteList ? tTabs("allowedList") : tTabs("blockedList"), + header: isWhiteList ? tTabs('allowedList') : tTabs('blockedList'), }); } if (config.showKYC) { - tabs.push({ content: , header: tTabs("kyc") }); + tabs.push({ content: , header: tTabs('kyc') }); } if (config.showSSIManager) { - tabs.push({ content: , header: tTabs("ssiManager") }); + tabs.push({ content: , header: tTabs('ssiManager') }); } - tabs.push({ content: , header: tTabs("externalPause") }); + tabs.push({ content: , header: tTabs('externalPause') }); tabs.push({ content: , - header: tTabs("externalControlList"), + header: tTabs('externalControlList'), }); tabs.push({ content: , - header: tTabs("externalKYCList"), + header: tTabs('externalKYCList'), }); return tabs; }, [config, tTabs, isWhiteList]); return ( - + diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/CorporateActions.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/CorporateActions.tsx index 612f2ff25..b51dd380c 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/CorporateActions.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/CorporateActions.tsx @@ -1,11 +1,11 @@ -import { Box } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { BalanceAdjustment } from "../BalanceAdjustment/BalanceAdjustment"; -import { Dividends } from "../Dividends/Dividends"; -import { VotingRights } from "../VotingRights/VotingRights"; -import { Coupons } from "../Coupons/Coupons"; -import { useMemo } from "react"; +import { Box } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { BalanceAdjustment } from '../BalanceAdjustment/BalanceAdjustment'; +import { Dividends } from '../Dividends/Dividends'; +import { VotingRights } from '../VotingRights/VotingRights'; +import { Coupons } from '../Coupons/Coupons'; +import { useMemo } from 'react'; interface OperationsTabProps { config: { @@ -17,8 +17,8 @@ interface OperationsTabProps { } export const CorporateActionsTab = ({ config }: OperationsTabProps) => { - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.tabs', }); const tabs = useMemo(() => { @@ -27,19 +27,19 @@ export const CorporateActionsTab = ({ config }: OperationsTabProps) => { if (config.showBalanceAdjustment) { tabs.push({ content: , - header: tTabs("balanceAdjustment"), + header: tTabs('balanceAdjustment'), }); } if (config.showDividends) { - tabs.push({ content: , header: tTabs("dividends") }); + tabs.push({ content: , header: tTabs('dividends') }); } if (config.showVotingRights) { - tabs.push({ content: , header: tTabs("votingRights") }); + tabs.push({ content: , header: tTabs('votingRights') }); } if (config.showCoupons) { tabs.push({ content: , - header: tTabs("coupons"), + header: tTabs('coupons'), }); } @@ -47,7 +47,7 @@ export const CorporateActionsTab = ({ config }: OperationsTabProps) => { }, [config, tTabs]); return ( - + ); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Management.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Management.tsx index 3b7dd29ab..e7ee3406d 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Management.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Management.tsx @@ -1,11 +1,11 @@ -import { Box } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { RoleManagement } from "../RoleManagement/RoleManagement"; -import { useTranslation } from "react-i18next"; -import { Management } from "../Management/Management"; -import { useParams } from "react-router-dom"; -import { useMemo } from "react"; -import { DangerZone } from "../DangerZone"; +import { Box } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { RoleManagement } from '../RoleManagement/RoleManagement'; +import { useTranslation } from 'react-i18next'; +import { Management } from '../Management/Management'; +import { useParams } from 'react-router-dom'; +import { useMemo } from 'react'; +import { DangerZone } from '../DangerZone'; interface ManagementTabProps { config: { @@ -16,10 +16,10 @@ interface ManagementTabProps { } export const ManagementTab = ({ config }: ManagementTabProps) => { - const { id = "" } = useParams(); + const { id = '' } = useParams(); - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.tabs', }); const tabs = useMemo(() => { @@ -28,16 +28,16 @@ export const ManagementTab = ({ config }: ManagementTabProps) => { if (config.showRoleManagement) { tabs.push({ content: , - header: tTabs("roleManagement"), + header: tTabs('roleManagement'), }); } if (config.showDangerZone) { - tabs.push({ content: , header: "Danger Zone" }); + tabs.push({ content: , header: 'Danger Zone' }); } if (config.showConfiguration) { tabs.push({ content: , - header: tTabs("configuration"), + header: tTabs('configuration'), }); } @@ -45,7 +45,7 @@ export const ManagementTab = ({ config }: ManagementTabProps) => { }, [config, tTabs, id]); return ( - + ); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Operations.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Operations.tsx index 29e9ef451..9934fa056 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Operations.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Tabs/Operations.tsx @@ -1,12 +1,12 @@ -import { Box } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { Locker } from "../Locker/Locker"; -import { Hold } from "../Hold/Hold"; -import { Cap } from "../Cap/Cap"; -import { ClearingOperations } from "../ClearingOperations/ClearingOperations"; -import { useMemo } from "react"; -import { AdminActionsButtons } from "../AdminActionsButtons"; +import { Box } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { Locker } from '../Locker/Locker'; +import { Hold } from '../Hold/Hold'; +import { Cap } from '../Cap/Cap'; +import { ClearingOperations } from '../ClearingOperations/ClearingOperations'; +import { useMemo } from 'react'; +import { AdminActionsButtons } from '../AdminActionsButtons'; interface OperationsTabProps { config: { @@ -18,26 +18,26 @@ interface OperationsTabProps { } export const OperationsTab = ({ config }: OperationsTabProps) => { - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.tabs', }); const tabs = useMemo(() => { const tabs = []; if (config.showLocker) { - tabs.push({ content: , header: tTabs("locker") }); + tabs.push({ content: , header: tTabs('locker') }); } if (config.showHold) { - tabs.push({ content: , header: tTabs("hold") }); + tabs.push({ content: , header: tTabs('hold') }); } if (config.showCap) { - tabs.push({ content: , header: tTabs("cap") }); + tabs.push({ content: , header: tTabs('cap') }); } if (config.showClearingOperations) { tabs.push({ content: , - header: tTabs("clearingOperations"), + header: tTabs('clearingOperations'), }); } @@ -45,7 +45,7 @@ export const OperationsTab = ({ config }: OperationsTabProps) => { }, [config, tTabs]); return ( - + diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/ProgramVotingRights.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/ProgramVotingRights.tsx index 103a5ef85..b8546e04d 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/ProgramVotingRights.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/ProgramVotingRights.tsx @@ -203,23 +203,23 @@ */ -import { Button, Center, HStack, Stack, VStack } from "@chakra-ui/react"; +import { Button, Center, HStack, Stack, VStack } from '@chakra-ui/react'; import { CalendarInputController, InputController, PhosphorIcon, Text, Tooltip, -} from "io-bricks-ui"; -import { Info } from "@phosphor-icons/react"; -import { required } from "../../../../utils/rules"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { useParams } from "react-router-dom"; -import { SetVotingRightsRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useSetVotingRights } from "../../../../hooks/queries/VotingRights"; -import { dateToUnixTimestamp, textToHex } from "../../../../utils/format"; -import { DATE_TIME_FORMAT } from "../../../../utils/constants"; +} from 'io-bricks-ui'; +import { Info } from '@phosphor-icons/react'; +import { required } from '../../../../utils/rules'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { useParams } from 'react-router-dom'; +import { SetVotingRightsRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useSetVotingRights } from '../../../../hooks/queries/VotingRights'; +import { dateToUnixTimestamp, textToHex } from '../../../../utils/format'; +import { DATE_TIME_FORMAT } from '../../../../utils/constants'; interface ProgramVotingRightsFormValues { name: string; @@ -229,16 +229,16 @@ interface ProgramVotingRightsFormValues { export const ProgramVotingRights = () => { const { control, formState, handleSubmit, reset } = useForm({ - mode: "all", + mode: 'all', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "details.votingRights.program.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'details.votingRights.program.input', }); - const { t: t } = useTranslation("security", { - keyPrefix: "details.votingRights.program", + const { t: t } = useTranslation('security', { + keyPrefix: 'details.votingRights.program', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { mutate: setVotingRights, isLoading } = useSetVotingRights(); @@ -274,8 +274,8 @@ export const ProgramVotingRights = () => { > - {tForm("name.label")}* - + {tForm('name.label')}* + @@ -284,13 +284,13 @@ export const ProgramVotingRights = () => { control={control} id="name" rules={{ required }} - placeholder={tForm("name.placeholder")} + placeholder={tForm('name.placeholder')} /> - {tForm("date.label")}* - + {tForm('date.label')}* + @@ -299,7 +299,7 @@ export const ProgramVotingRights = () => { id="date" rules={{ required }} fromDate={new Date()} - placeholder={tForm("date.placeholder")} + placeholder={tForm('date.placeholder')} withTimeInput format={DATE_TIME_FORMAT} /> @@ -311,7 +311,7 @@ export const ProgramVotingRights = () => { isDisabled={!formState.isValid} type="submit" > - {t("button")} + {t('button')}
diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/SeeVotingRights.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/SeeVotingRights.tsx index 59c123721..b6b3698c3 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/SeeVotingRights.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/SeeVotingRights.tsx @@ -203,33 +203,33 @@ */ -import { Button, Center, HStack, Stack, VStack } from "@chakra-ui/react"; +import { Button, Center, HStack, Stack, VStack } from '@chakra-ui/react'; import { InputController, InputNumberController, PhosphorIcon, Text, Tooltip, -} from "io-bricks-ui"; +} from 'io-bricks-ui'; import { isHederaValidAddress, required, greaterThanZero, -} from "../../../../utils/rules"; -import { Info } from "@phosphor-icons/react"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; +} from '../../../../utils/rules'; +import { Info } from '@phosphor-icons/react'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; import { useGetVotingRights, useGetVotingRightsFor, -} from "../../../../hooks/queries/VotingRights"; +} from '../../../../hooks/queries/VotingRights'; import { GetVotingRightsForRequest, GetVotingRightsRequest, -} from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router-dom"; -import { Panel } from "../../../../components/Panel"; -import { hexToText } from "../../../../utils/format"; +} from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router-dom'; +import { Panel } from '../../../../components/Panel'; +import { hexToText } from '../../../../utils/format'; interface SeeVotingRightsFormValues { votingId: number; @@ -243,18 +243,18 @@ export const SeeVotingRights = () => { formState: { isValid }, watch, } = useForm({ - mode: "all", + mode: 'all', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "details.votingRights.see.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'details.votingRights.see.input', }); - const { t: tGlobal } = useTranslation("globals"); - const { t: tDetails } = useTranslation("security", { - keyPrefix: "details.votingRights.see.details", + const { t: tGlobal } = useTranslation('globals'); + const { t: tDetails } = useTranslation('security', { + keyPrefix: 'details.votingRights.see.details', }); - const { id = "" } = useParams(); - const accountId = watch("accountId"); - const votingId = watch("votingId"); + const { id = '' } = useParams(); + const accountId = watch('accountId'); + const votingId = watch('votingId'); const getVotingRightsForRequest = new GetVotingRightsForRequest({ securityId: id, @@ -288,7 +288,7 @@ export const SeeVotingRights = () => { refetchGetVotingRights(); }; - const votingIsPending = new Date(votingRights?.recordDate ?? "") < new Date(); + const votingIsPending = new Date(votingRights?.recordDate ?? '') < new Date(); return (
@@ -304,9 +304,9 @@ export const SeeVotingRights = () => { - {tForm("voting.label")}* + {tForm('voting.label')}* - + @@ -319,15 +319,15 @@ export const SeeVotingRights = () => { min: greaterThanZero, }, }} - placeholder={tForm("voting.placeholder")} + placeholder={tForm('voting.placeholder')} /> - {tForm("account.label")}* + {tForm('account.label')}* - + @@ -335,7 +335,7 @@ export const SeeVotingRights = () => { control={control} id="accountId" rules={{ required, isHederaValidAddress }} - placeholder={tForm("account.placeholder")} + placeholder={tForm('account.placeholder')} /> {votingRights && votingRightsFor && (
{votingIsPending - ? tDetails("pending") - : tDetails("number", { + ? tDetails('pending') + : tDetails('number', { number: votingRightsFor.tokenBalance, })} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/VotingRights.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/VotingRights.tsx index 0176c149e..1a23dde7e 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/VotingRights.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/VotingRights.tsx @@ -203,23 +203,23 @@ */ -import { Stack } from "@chakra-ui/react"; -import { Tabs } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { ProgramVotingRights } from "./ProgramVotingRights"; -import { SeeVotingRights } from "./SeeVotingRights"; +import { Stack } from '@chakra-ui/react'; +import { Tabs } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { ProgramVotingRights } from './ProgramVotingRights'; +import { SeeVotingRights } from './SeeVotingRights'; export const VotingRights = () => { - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.votingRights.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.votingRights.tabs', }); return ( , header: tTabs("program") }, - { content: , header: tTabs("see") }, + { content: , header: tTabs('program') }, + { content: , header: tTabs('see') }, ]} isFitted /> diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/ProgramVotingRights.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/ProgramVotingRights.test.tsx index eec29dd65..9e34fb1ab 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/ProgramVotingRights.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/ProgramVotingRights.test.tsx @@ -203,8 +203,8 @@ */ -import { ProgramVotingRights } from "../ProgramVotingRights"; -import { render } from "../../../../../test-utils"; +import { ProgramVotingRights } from '../ProgramVotingRights'; +import { render } from '../../../../../test-utils'; /* import userEvent from "@testing-library/user-event"; import { waitFor } from "@testing-library/react"; @@ -214,7 +214,7 @@ const name = "TestName"; */ describe(`${ProgramVotingRights.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/SeeVotingRights.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/SeeVotingRights.test.tsx index 295af00d1..ddaed2d23 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/SeeVotingRights.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/SeeVotingRights.test.tsx @@ -203,34 +203,34 @@ */ -import { SeeVotingRights } from "../SeeVotingRights"; -import { render } from "../../../../../test-utils"; -import userEvent from "@testing-library/user-event"; -import { waitFor } from "@testing-library/react"; +import { SeeVotingRights } from '../SeeVotingRights'; +import { render } from '../../../../../test-utils'; +import userEvent from '@testing-library/user-event'; +import { waitFor } from '@testing-library/react'; -const votingId = "123456"; -const accountId = "0.0.1234567"; +const votingId = '123456'; +const accountId = '0.0.1234567'; // TODO Improve tests when it is connected to SDK describe(`${SeeVotingRights.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should fill form", async () => { + test('should fill form', async () => { const component = factoryComponent(); - const submitButton = component.getByTestId("check-button"); + const submitButton = component.getByTestId('check-button'); expect(submitButton).toBeDisabled(); - const votingIdInput = component.getByTestId("votingId"); + const votingIdInput = component.getByTestId('votingId'); await userEvent.type(votingIdInput, votingId); - const accountIdInput = component.getByTestId("accountId"); + const accountIdInput = component.getByTestId('accountId'); await userEvent.type(accountIdInput, accountId); await waitFor(() => { diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/VotingRights.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/VotingRights.test.tsx index c92daeb6a..d4cb74524 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/VotingRights.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/VotingRights/__tests__/VotingRights.test.tsx @@ -203,11 +203,11 @@ */ -import { VotingRights } from "../VotingRights"; -import { render } from "../../../../../test-utils"; +import { VotingRights } from '../VotingRights'; +import { render } from '../../../../../test-utils'; describe(`${VotingRights.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ActionsButtons.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ActionsButtons.test.tsx index ff2887303..07d745733 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ActionsButtons.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ActionsButtons.test.tsx @@ -203,10 +203,10 @@ */ -import { ActionsButtons } from "../ActionsButtons"; -import { render } from "../../../../test-utils"; -import { useUserStore } from "../../../../store/userStore"; -import { User } from "../../../../utils/constants"; +import { ActionsButtons } from '../ActionsButtons'; +import { render } from '../../../../test-utils'; +import { useUserStore } from '../../../../store/userStore'; +import { User } from '../../../../utils/constants'; const initialStoreState = useUserStore.getState(); @@ -217,7 +217,7 @@ describe(`${ActionsButtons.name}`, () => { const factoryComponent = () => render(); - test("should render correctly admin buttons", () => { + test('should render correctly admin buttons', () => { useUserStore.setState({ ...initialStoreState, type: User.admin, @@ -225,10 +225,10 @@ describe(`${ActionsButtons.name}`, () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("admin"); + expect(component.asFragment()).toMatchSnapshot('admin'); }); - test("should render correctly holder buttons", () => { + test('should render correctly holder buttons', () => { useUserStore.setState({ ...initialStoreState, type: User.holder, @@ -236,6 +236,6 @@ describe(`${ActionsButtons.name}`, () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("holder"); + expect(component.asFragment()).toMatchSnapshot('holder'); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminActionsButtons.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminActionsButtons.test.tsx index cee1b1ca9..b49db997b 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminActionsButtons.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminActionsButtons.test.tsx @@ -203,30 +203,30 @@ */ -import { AdminActionsButtons } from "../AdminActionsButtons"; -import { render } from "../../../../test-utils"; -import { useRolesStore } from "../../../../store/rolesStore"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import userEvent from "@testing-library/user-event"; -import { RouterManager } from "../../../../router/RouterManager"; -import { RouteName } from "../../../../router/RouteName"; - -jest.mock("../../../../router/RouterManager", () => ({ +import { AdminActionsButtons } from '../AdminActionsButtons'; +import { render } from '../../../../test-utils'; +import { useRolesStore } from '../../../../store/rolesStore'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import userEvent from '@testing-library/user-event'; +import { RouterManager } from '../../../../router/RouterManager'; +import { RouteName } from '../../../../router/RouteName'; + +jest.mock('../../../../router/RouterManager', () => ({ RouterManager: { - ...jest.requireActual("../../../../router/RouterManager").RouterManager, + ...jest.requireActual('../../../../router/RouterManager').RouterManager, getUrl: jest.fn(), to: jest.fn(), }, })); -jest.mock("../../../../hooks/queries/usePauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/usePauseSecurity', () => ({ usePauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, })), })); -jest.mock("../../../../hooks/queries/useUnpauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/useUnpauseSecurity', () => ({ useUnpauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, @@ -244,30 +244,30 @@ describe(`${AdminActionsButtons.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("defaultAdminRole"); + expect(component.asFragment()).toMatchSnapshot('defaultAdminRole'); }); - test("by default admin has not minter role", () => { + test('by default admin has not minter role', () => { const component = factoryComponent(); - expect(component.queryByTestId("mint-button")).not.toBeInTheDocument(); + expect(component.queryByTestId('mint-button')).not.toBeInTheDocument(); }); - test("by default admin has not controller role", () => { + test('by default admin has not controller role', () => { const component = factoryComponent(); expect( - component.queryByTestId("force-transfer-button"), + component.queryByTestId('force-transfer-button'), ).not.toBeInTheDocument(); expect( - component.queryByTestId("force-redeem-button"), + component.queryByTestId('force-redeem-button'), ).not.toBeInTheDocument(); }); - describe("Admin has minter role", () => { + describe('Admin has minter role', () => { beforeEach(() => { useRolesStore.setState({ ...initialStoreState, @@ -275,22 +275,22 @@ describe(`${AdminActionsButtons.name}`, () => { }); }); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("minterRole"); + expect(component.asFragment()).toMatchSnapshot('minterRole'); }); - test("should show mint button", () => { + test('should show mint button', () => { const component = factoryComponent(); - expect(component.getByTestId("mint-button")).toBeInTheDocument(); + expect(component.getByTestId('mint-button')).toBeInTheDocument(); }); - test("if click on mint button should redirect to mint page", async () => { + test('if click on mint button should redirect to mint page', async () => { const component = factoryComponent(); - const button = component.getByTestId("mint-button"); + const button = component.getByTestId('mint-button'); expect(button).toBeInTheDocument(); await userEvent.click(button); @@ -298,12 +298,12 @@ describe(`${AdminActionsButtons.name}`, () => { expect(RouterManager.getUrl).toHaveBeenCalled(); expect(RouterManager.getUrl).toHaveBeenCalledWith( RouteName.DigitalSecurityMint, - { params: { id: "" } }, + { params: { id: '' } }, ); }); }); - describe("Admin has controller role", () => { + describe('Admin has controller role', () => { beforeEach(() => { useRolesStore.setState({ ...initialStoreState, @@ -311,25 +311,25 @@ describe(`${AdminActionsButtons.name}`, () => { }); }); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("controllerRole"); + expect(component.asFragment()).toMatchSnapshot('controllerRole'); }); - test("should show force transfer and force redeem buttons", () => { + test('should show force transfer and force redeem buttons', () => { const component = factoryComponent(); expect( - component.getByTestId("force-transfer-button"), + component.getByTestId('force-transfer-button'), ).toBeInTheDocument(); - expect(component.getByTestId("force-redeem-button")).toBeInTheDocument(); + expect(component.getByTestId('force-redeem-button')).toBeInTheDocument(); }); - test("if click on force transfer button should redirect to force transfer page", async () => { + test('if click on force transfer button should redirect to force transfer page', async () => { const component = factoryComponent(); - const button = component.getByTestId("force-transfer-button"); + const button = component.getByTestId('force-transfer-button'); expect(button).toBeInTheDocument(); await userEvent.click(button); @@ -337,14 +337,14 @@ describe(`${AdminActionsButtons.name}`, () => { expect(RouterManager.getUrl).toHaveBeenCalled(); expect(RouterManager.getUrl).toHaveBeenCalledWith( RouteName.DigitalSecurityForceTransfer, - { params: { id: "" } }, + { params: { id: '' } }, ); }); - test("if click on force redeem button should redirect to force redeem page", async () => { + test('if click on force redeem button should redirect to force redeem page', async () => { const component = factoryComponent(); - const button = component.getByTestId("force-redeem-button"); + const button = component.getByTestId('force-redeem-button'); expect(button).toBeInTheDocument(); await userEvent.click(button); @@ -352,7 +352,7 @@ describe(`${AdminActionsButtons.name}`, () => { expect(RouterManager.getUrl).toHaveBeenCalled(); expect(RouterManager.getUrl).toHaveBeenCalledWith( RouteName.DigitalSecurityForceRedeem, - { params: { id: "" } }, + { params: { id: '' } }, ); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminControlActionsButtons.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminControlActionsButtons.test.tsx index d5c87e7ce..465c84261 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminControlActionsButtons.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/AdminControlActionsButtons.test.tsx @@ -203,27 +203,27 @@ */ -import { render } from "../../../../test-utils"; -import { useRolesStore } from "../../../../store/rolesStore"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import { AdminControlActionsButtons } from "../AdminControlActionsButtons"; +import { render } from '../../../../test-utils'; +import { useRolesStore } from '../../../../store/rolesStore'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import { AdminControlActionsButtons } from '../AdminControlActionsButtons'; -jest.mock("../../../../router/RouterManager", () => ({ +jest.mock('../../../../router/RouterManager', () => ({ RouterManager: { - ...jest.requireActual("../../../../router/RouterManager").RouterManager, + ...jest.requireActual('../../../../router/RouterManager').RouterManager, getUrl: jest.fn(), to: jest.fn(), }, })); -jest.mock("../../../../hooks/queries/usePauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/usePauseSecurity', () => ({ usePauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, })), })); -jest.mock("../../../../hooks/queries/useUnpauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/useUnpauseSecurity', () => ({ useUnpauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, @@ -241,19 +241,19 @@ describe(`${AdminControlActionsButtons.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("defaultAdminRole"); + expect(component.asFragment()).toMatchSnapshot('defaultAdminRole'); }); - test("by default admin has not freeze manager role", () => { + test('by default admin has not freeze manager role', () => { const component = factoryComponent(); - expect(component.queryByTestId("freeze-button")).not.toBeInTheDocument(); + expect(component.queryByTestId('freeze-button')).not.toBeInTheDocument(); }); - describe("Admin has freeze manager role", () => { + describe('Admin has freeze manager role', () => { beforeEach(() => { useRolesStore.setState({ ...initialStoreState, @@ -261,16 +261,16 @@ describe(`${AdminControlActionsButtons.name}`, () => { }); }); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("minterRole"); + expect(component.asFragment()).toMatchSnapshot('minterRole'); }); - test("should show freeze manager button", () => { + test('should show freeze manager button', () => { const component = factoryComponent(); - expect(component.getByTestId("freeze-button")).toBeInTheDocument(); + expect(component.getByTestId('freeze-button')).toBeInTheDocument(); }); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Balance.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Balance.test.tsx index b2905e054..9f38846e1 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Balance.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Balance.test.tsx @@ -203,15 +203,15 @@ */ -import { Balance } from "../Balance"; -import { render } from "../../../../test-utils"; -import { SecurityViewModel } from "@hashgraph/asset-tokenization-sdk"; +import { Balance } from '../Balance'; +import { render } from '../../../../test-utils'; +import { SecurityViewModel } from '@hashgraph/asset-tokenization-sdk'; // TODO Improve tests when it is connected to SDK describe(`${Balance.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const detailsResponse: SecurityViewModel = { - name: "test", + name: 'test', }; const component = render( diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ControlList.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ControlList.test.tsx index 377d89dd5..309a0fcff 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ControlList.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/ControlList.test.tsx @@ -203,24 +203,24 @@ */ -import { ControlList } from "../ControlList"; -import { render } from "../../../../test-utils"; -import { useSecurityStore } from "../../../../store/securityStore"; +import { ControlList } from '../ControlList'; +import { render } from '../../../../test-utils'; +import { useSecurityStore } from '../../../../store/securityStore'; const initialStoreState = useSecurityStore.getState(); const testSecurity = { decimals: 18, - diamondAddress: "0.0.5863436", - evmDiamondAddress: "0x83887e04c70e0b857738f89d12bf018bc0fe0310", + diamondAddress: '0.0.5863436', + evmDiamondAddress: '0x83887e04c70e0b857738f89d12bf018bc0fe0310', isControllable: true, isWhiteList: true, - isin: "123456789102", - name: "Equity Total", + isin: '123456789102', + name: 'Equity Total', paused: false, - securityType: "EQUITY", - symbol: "ET", - totalSupply: "1150000000000000000000", + securityType: 'EQUITY', + symbol: 'ET', + totalSupply: '1150000000000000000000', }; describe(`${ControlList.name}`, () => { @@ -236,13 +236,13 @@ describe(`${ControlList.name}`, () => { const factoryComponent = () => render(); - test("should render correctly as whiteList", () => { + test('should render correctly as whiteList', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("whiteList"); + expect(component.asFragment()).toMatchSnapshot('whiteList'); }); - test("should render correctly as blockList", () => { + test('should render correctly as blockList', () => { useSecurityStore.setState( { ...initialStoreState, @@ -252,12 +252,12 @@ describe(`${ControlList.name}`, () => { ); const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("blockList"); + expect(component.asFragment()).toMatchSnapshot('blockList'); }); - test("should render table with list", () => { + test('should render table with list', () => { const component = factoryComponent(); - expect(component.getByTestId("table-control-list")).toBeInTheDocument(); + expect(component.getByTestId('table-control-list')).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/DangerZone.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/DangerZone.test.tsx index aecfe0137..e97c3c814 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/DangerZone.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/DangerZone.test.tsx @@ -1,27 +1,27 @@ -import { render } from "../../../../test-utils"; -import { useRolesStore } from "../../../../store/rolesStore"; -import { SecurityRole } from "../../../../utils/SecurityRole"; -import userEvent from "@testing-library/user-event"; -import { usePauseSecurity } from "../../../../hooks/queries/usePauseSecurity"; -import { useUnpauseSecurity } from "../../../../hooks/queries/useUnpauseSecurity"; -import { DangerZone } from "../DangerZone"; - -jest.mock("../../../../router/RouterManager", () => ({ +import { render } from '../../../../test-utils'; +import { useRolesStore } from '../../../../store/rolesStore'; +import { SecurityRole } from '../../../../utils/SecurityRole'; +import userEvent from '@testing-library/user-event'; +import { usePauseSecurity } from '../../../../hooks/queries/usePauseSecurity'; +import { useUnpauseSecurity } from '../../../../hooks/queries/useUnpauseSecurity'; +import { DangerZone } from '../DangerZone'; + +jest.mock('../../../../router/RouterManager', () => ({ RouterManager: { - ...jest.requireActual("../../../../router/RouterManager").RouterManager, + ...jest.requireActual('../../../../router/RouterManager').RouterManager, getUrl: jest.fn(), to: jest.fn(), }, })); -jest.mock("../../../../hooks/queries/usePauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/usePauseSecurity', () => ({ usePauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, })), })); -jest.mock("../../../../hooks/queries/useUnpauseSecurity", () => ({ +jest.mock('../../../../hooks/queries/useUnpauseSecurity', () => ({ useUnpauseSecurity: jest.fn(() => ({ mutate: jest.fn(), isLoading: false, @@ -39,19 +39,19 @@ describe(`${DangerZone.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("defaultAdminRole"); + expect(component.asFragment()).toMatchSnapshot('defaultAdminRole'); }); - test("by default admin has not pauser role", () => { + test('by default admin has not pauser role', () => { const component = factoryComponent(); - expect(component.queryByTestId("pauser-button")).not.toBeInTheDocument(); + expect(component.queryByTestId('pauser-button')).not.toBeInTheDocument(); }); - describe("Admin has pauser role", () => { + describe('Admin has pauser role', () => { beforeEach(() => { useRolesStore.setState({ ...initialStoreState, @@ -59,22 +59,22 @@ describe(`${DangerZone.name}`, () => { }); }); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("pauserRole"); + expect(component.asFragment()).toMatchSnapshot('pauserRole'); }); - test("should show pauser toogle", () => { + test('should show pauser toogle', () => { const component = factoryComponent(); - expect(component.getByTestId("pauser-button")).toBeInTheDocument(); + expect(component.getByTestId('pauser-button')).toBeInTheDocument(); }); - test("if click on pauser button should call to pause or unpause security function", async () => { + test('if click on pauser button should call to pause or unpause security function', async () => { const component = factoryComponent(); - const button = component.getByTestId("pauser-button"); + const button = component.getByTestId('pauser-button'); expect(button).toBeInTheDocument(); await userEvent.click(button); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Details.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Details.test.tsx index db4bdf5fe..e5dbb7c14 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Details.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/Details.test.tsx @@ -203,19 +203,19 @@ */ -import { Details } from "../Details"; -import { render } from "../../../../test-utils"; +import { Details } from '../Details'; +import { render } from '../../../../test-utils'; import { BondDetailsViewModel, EquityDetailsViewModel, SecurityViewModel, -} from "@hashgraph/asset-tokenization-sdk"; +} from '@hashgraph/asset-tokenization-sdk'; // TODO Improve tests when it is connected to SDK describe(`${Details.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const detailsResponse: SecurityViewModel = { - name: "test", + name: 'test', }; const component = render( diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/HolderActionsButtons.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/HolderActionsButtons.test.tsx index 3ca4568f3..278a9eccf 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/HolderActionsButtons.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/HolderActionsButtons.test.tsx @@ -203,15 +203,15 @@ */ -import { HolderActionsButtons } from "../HolderActionsButtons"; -import { render } from "../../../../test-utils"; -import userEvent from "@testing-library/user-event"; -import { RouteName } from "../../../../router/RouteName"; -import { RouterManager } from "../../../../router/RouterManager"; +import { HolderActionsButtons } from '../HolderActionsButtons'; +import { render } from '../../../../test-utils'; +import userEvent from '@testing-library/user-event'; +import { RouteName } from '../../../../router/RouteName'; +import { RouterManager } from '../../../../router/RouterManager'; -jest.mock("../../../../router/RouterManager", () => ({ +jest.mock('../../../../router/RouterManager', () => ({ RouterManager: { - ...jest.requireActual("../../../../router/RouterManager").RouterManager, + ...jest.requireActual('../../../../router/RouterManager').RouterManager, getUrl: jest.fn(), }, })); @@ -223,47 +223,47 @@ describe(`${HolderActionsButtons}.name`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should have a transfer button", () => { + test('should have a transfer button', () => { const component = factoryComponent(); - expect(component.getByTestId("transfer-button")).toBeInTheDocument(); + expect(component.getByTestId('transfer-button')).toBeInTheDocument(); }); - test("transfer button should redirect to transfer page", async () => { + test('transfer button should redirect to transfer page', async () => { const component = factoryComponent(); - const button = component.getByTestId("transfer-button"); + const button = component.getByTestId('transfer-button'); await userEvent.click(button); expect(RouterManager.getUrl).toHaveBeenCalled(); expect(RouterManager.getUrl).toHaveBeenCalledWith( RouteName.DigitalSecurityTransfer, - { params: { id: "" } }, + { params: { id: '' } }, ); }); - test("should have a redeem button", () => { + test('should have a redeem button', () => { const component = factoryComponent(); - expect(component.getByTestId("redeem-button")).toBeInTheDocument(); + expect(component.getByTestId('redeem-button')).toBeInTheDocument(); }); - test("redeem button should redirect to redeem page", async () => { + test('redeem button should redirect to redeem page', async () => { const component = factoryComponent(); - const button = component.getByTestId("redeem-button"); + const button = component.getByTestId('redeem-button'); await userEvent.click(button); expect(RouterManager.getUrl).toHaveBeenCalled(); expect(RouterManager.getUrl).toHaveBeenCalledWith( RouteName.DigitalSecurityRedeem, - { params: { id: "" } }, + { params: { id: '' } }, ); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/SecurityDetails.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/SecurityDetails.test.tsx index a1f0d7984..bb32166f8 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/SecurityDetails.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/SecurityDetails.test.tsx @@ -203,24 +203,24 @@ */ -import { SecurityDetails } from "../SecurityDetails"; -import { render } from "../../../../test-utils"; -import { useSecurityStore } from "../../../../store/securityStore"; +import { SecurityDetails } from '../SecurityDetails'; +import { render } from '../../../../test-utils'; +import { useSecurityStore } from '../../../../store/securityStore'; const initialStoreState = useSecurityStore.getState(); const testSecurity = { decimals: 18, - diamondAddress: "0.0.5863436", - evmDiamondAddress: "0x83887e04c70e0b857738f89d12bf018bc0fe0310", + diamondAddress: '0.0.5863436', + evmDiamondAddress: '0x83887e04c70e0b857738f89d12bf018bc0fe0310', isControllable: true, isWhiteList: false, - isin: "123456789102", - name: "Equity Total", + isin: '123456789102', + name: 'Equity Total', paused: false, - securityType: "EQUITY", - symbol: "ET", - totalSupply: "1150000000000000000000", + securityType: 'EQUITY', + symbol: 'ET', + totalSupply: '1150000000000000000000', }; describe(`${SecurityDetails.name}`, () => { @@ -236,13 +236,13 @@ describe(`${SecurityDetails.name}`, () => { const factoryComponent = () => render(); - test("should render correctly", () => { + test('should render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show loading state", () => { + test('should show loading state', () => { useSecurityStore.setState( { ...initialStoreState, @@ -253,10 +253,10 @@ describe(`${SecurityDetails.name}`, () => { const component = factoryComponent(); - expect(component.asFragment()).toMatchSnapshot("loading"); + expect(component.asFragment()).toMatchSnapshot('loading'); }); - test("total supply should be formatted", () => { + test('total supply should be formatted', () => { useSecurityStore.setState( { ...initialStoreState, @@ -267,12 +267,12 @@ describe(`${SecurityDetails.name}`, () => { const component = factoryComponent(); const totalSupply = component.getByTestId( - "definition-list-item-Total Supply", + 'definition-list-item-Total Supply', ); expect(totalSupply).toHaveTextContent( - "Total Supply1150000000000000000000 ET", + 'Total Supply1150000000000000000000 ET', ); - expect(component.asFragment()).toMatchSnapshot("loading"); + expect(component.asFragment()).toMatchSnapshot('loading'); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/__snapshots__/HolderActionsButtons.test.tsx.snap b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/__snapshots__/HolderActionsButtons.test.tsx.snap index b527cc69e..279daf007 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/__snapshots__/HolderActionsButtons.test.tsx.snap +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/__tests__/__snapshots__/HolderActionsButtons.test.tsx.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`() => { - const { t: tButtons } = (0, react_i18next_1.useTranslation)("security", { - keyPrefix: "details.actions", + const { t: tButtons } = (0, react_i18next_1.useTranslation)('security', { + keyPrefix: 'details.actions', }); - const { id = "" } = (0, react_router_dom_1.useParams)(); + const { id = '' } = (0, react_router_dom_1.useParams)(); const { data: isPaused } = (0, useGetSecurityDetails_1.useGetIsPaused)(new asset_tokenization_sdk_1.PauseRequest({ securityId: id })); if (isPaused) return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}); return ((0, jsx_runtime_1.jsxs)(react_1.HStack, { "data-testid": "holder-actions-buttons", w: "full", justifyContent: "flex-end", gap: 4, children: [(0, jsx_runtime_1.jsx)(io_bricks_ui_1.Button, { "data-testid": "transfer-button", as: react_router_dom_1.Link, to: RouterManager_1.RouterManager.getUrl(RouteName_1.RouteName.DigitalSecurityTransfer, { params: { id }, - }), variant: "secondary", children: tButtons("transfer") }), (0, jsx_runtime_1.jsx)(io_bricks_ui_1.Button, { "data-testid": "redeem-button", as: react_router_dom_1.Link, to: RouterManager_1.RouterManager.getUrl(RouteName_1.RouteName.DigitalSecurityRedeem, { + }), variant: "secondary", children: tButtons('transfer') }), (0, jsx_runtime_1.jsx)(io_bricks_ui_1.Button, { "data-testid": "redeem-button", as: react_router_dom_1.Link, to: RouterManager_1.RouterManager.getUrl(RouteName_1.RouteName.DigitalSecurityRedeem, { params: { id }, - }), variant: "secondary", children: tButtons("redeem") })] })); + }), variant: "secondary", children: tButtons('redeem') })] })); }.name should render correctly 1`] = `
{ - const { t: tHeader } = useTranslation("security", { - keyPrefix: "details.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'details.header', }); - const { t: tTabs } = useTranslation("security", { - keyPrefix: "details.tabs", + const { t: tTabs } = useTranslation('security', { + keyPrefix: 'details.tabs', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { address: walletAddress } = useWalletStore(); const { type: userType } = useUserStore(); @@ -271,7 +271,7 @@ export const DigitalSecurityDetails = () => { }), { retry: false, - enabled: securityDetails?.type === "EQUITY", + enabled: securityDetails?.type === 'EQUITY', }, ); @@ -282,7 +282,7 @@ export const DigitalSecurityDetails = () => { }), { retry: false, - enabled: securityDetails?.type === "BOND", + enabled: securityDetails?.type === 'BOND', }, ); @@ -332,11 +332,11 @@ export const DigitalSecurityDetails = () => { bondDetailsResponse={bondDetails ?? ({} as BondDetailsViewModel)} /> ), - header: tTabs("details"), + header: tTabs('details'), }, { content: , - header: tTabs("balance"), + header: tTabs('balance'), }, ]; @@ -354,11 +354,11 @@ export const DigitalSecurityDetails = () => { bondDetailsResponse={bondDetails ?? ({} as BondDetailsViewModel)} /> ), - header: tTabs("details"), + header: tTabs('details'), }, { content: , - header: tTabs("balance"), + header: tTabs('balance'), }, ]; @@ -433,21 +433,21 @@ export const DigitalSecurityDetails = () => { if (showManagementTab) { adminTabs.push({ content: , - header: tTabs("management"), + header: tTabs('management'), }); } if (showOperationTab) { adminTabs.push({ content: , - header: tTabs("operations"), + header: tTabs('operations'), }); } if (showCorporateActionsTab) { adminTabs.push({ content: , - header: tTabs("corporateActions"), + header: tTabs('corporateActions'), }); } @@ -456,14 +456,14 @@ export const DigitalSecurityDetails = () => { content: ( ), - header: tTabs("control"), + header: tTabs('control'), }); } if (showLoadingTab) { adminTabs.push({ content: <>, - header: "Loading...", + header: 'Loading...', }); } @@ -474,7 +474,7 @@ export const DigitalSecurityDetails = () => { return ( <> - + {isPaused && ( )} diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/__tests__/DigitalSecurityDetails.test.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/__tests__/DigitalSecurityDetails.test.tsx index 775459ab4..ed34182ba 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/__tests__/DigitalSecurityDetails.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/__tests__/DigitalSecurityDetails.test.tsx @@ -203,11 +203,11 @@ */ -import { DigitalSecurityDetails } from "../DigitalSecurityDetails"; -import { render } from "../../../test-utils"; +import { DigitalSecurityDetails } from '../DigitalSecurityDetails'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityDetails.name}`, () => { - test("render correctly", () => { + test('render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); diff --git a/apps/ats/web/src/views/DigitalSecurityForceRedeem/DigitalSecurityForceRedeem.tsx b/apps/ats/web/src/views/DigitalSecurityForceRedeem/DigitalSecurityForceRedeem.tsx index a03e71dd9..d1d3de31f 100644 --- a/apps/ats/web/src/views/DigitalSecurityForceRedeem/DigitalSecurityForceRedeem.tsx +++ b/apps/ats/web/src/views/DigitalSecurityForceRedeem/DigitalSecurityForceRedeem.tsx @@ -203,25 +203,25 @@ */ -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; import { Text, InputController, InputNumberController, Button, -} from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { useParams } from "react-router"; -import { ForceRedeemRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useForceRedeemSecurity } from "../../hooks/queries/useForceRedeemSecurity"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useSecurityStore } from "../../store/securityStore"; +} from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { useParams } from 'react-router'; +import { ForceRedeemRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useForceRedeemSecurity } from '../../hooks/queries/useForceRedeemSecurity'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useSecurityStore } from '../../store/securityStore'; interface ForceRedeemFormValues { source: string; @@ -229,22 +229,22 @@ interface ForceRedeemFormValues { } export const DigitalSecurityForceRedeem = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "forceRedeem.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'forceRedeem.header', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "forceRedeem.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'forceRedeem.input', }); - const { t } = useTranslation("security", { keyPrefix: "forceRedeem" }); - const { t: tGlobal } = useTranslation("globals"); + const { t } = useTranslation('security', { keyPrefix: 'forceRedeem' }); + const { t: tGlobal } = useTranslation('globals'); const { control, formState, handleSubmit, reset } = useForm({ - mode: "all", + mode: 'all', }); - const { t: TButton } = useTranslation("security", { - keyPrefix: "forceRedeem.button", + const { t: TButton } = useTranslation('security', { + keyPrefix: 'forceRedeem.button', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { address: walletAddress } = useWalletStore(); @@ -273,7 +273,7 @@ export const DigitalSecurityForceRedeem = () => { return ( <> - + { as="form" onSubmit={handleSubmit(submit)} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} { control={control} id="source" rules={{ required }} - label={tForm("source.label")} - placeholder={tForm("source.placeholder")} + label={tForm('source.label')} + placeholder={tForm('source.placeholder')} size="md" /> @@ -321,8 +321,8 @@ export const DigitalSecurityForceRedeem = () => { }} size="md" allowNegative={false} - label={tForm("amount.label")} - placeholder={tForm("amount.placeholder")} + label={tForm('amount.label')} + placeholder={tForm('amount.placeholder')} decimalScale={details?.decimals} fixedDecimalScale={true} thousandSeparator="," @@ -334,7 +334,7 @@ export const DigitalSecurityForceRedeem = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityForceRedeem/__tests__/DigitalSecurityForceRedeem.test.tsx b/apps/ats/web/src/views/DigitalSecurityForceRedeem/__tests__/DigitalSecurityForceRedeem.test.tsx index 953412f71..8a50bd9ba 100644 --- a/apps/ats/web/src/views/DigitalSecurityForceRedeem/__tests__/DigitalSecurityForceRedeem.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityForceRedeem/__tests__/DigitalSecurityForceRedeem.test.tsx @@ -203,38 +203,38 @@ */ -import { DigitalSecurityForceRedeem } from "../DigitalSecurityForceRedeem"; -import { render } from "../../../test-utils"; +import { DigitalSecurityForceRedeem } from '../DigitalSecurityForceRedeem'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityForceRedeem.name}`, () => { const factoryComponent = () => { return render(); }; - test("render correctly", () => { + test('render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show Goback button", () => { + test('should show Goback button', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("go-back-button"); + const breadcrumbs = component.getByTestId('go-back-button'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should show breadcrumbs", () => { + test('should show breadcrumbs', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("breadcrumb-desktop"); + const breadcrumbs = component.getByTestId('breadcrumb-desktop'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should form be rendered properly", () => { + test('should form be rendered properly', () => { const component = factoryComponent(); - const form = component.getByTestId("force-redeem-form"); + const form = component.getByTestId('force-redeem-form'); expect(form).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityForceTransfer/DigitalSecurityForceTransfer.tsx b/apps/ats/web/src/views/DigitalSecurityForceTransfer/DigitalSecurityForceTransfer.tsx index aad459334..e3d3a17eb 100644 --- a/apps/ats/web/src/views/DigitalSecurityForceTransfer/DigitalSecurityForceTransfer.tsx +++ b/apps/ats/web/src/views/DigitalSecurityForceTransfer/DigitalSecurityForceTransfer.tsx @@ -203,25 +203,25 @@ */ -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; import { Text, InputController, InputNumberController, Button, -} from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { ForceTransferRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router"; -import { useForceTransferSecurity } from "../../hooks/queries/useForceTransferSecurity"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useSecurityStore } from "../../store/securityStore"; +} from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { ForceTransferRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router'; +import { useForceTransferSecurity } from '../../hooks/queries/useForceTransferSecurity'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useSecurityStore } from '../../store/securityStore'; interface ForceTransferFormValues { source: string; @@ -230,20 +230,20 @@ interface ForceTransferFormValues { } export const DigitalSecurityForceTransfer = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "forceTransfer.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'forceTransfer.header', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "forceTransfer.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'forceTransfer.input', }); - const { t } = useTranslation("security", { keyPrefix: "forceTransfer" }); - const { t: tGlobal } = useTranslation("globals"); + const { t } = useTranslation('security', { keyPrefix: 'forceTransfer' }); + const { t: tGlobal } = useTranslation('globals'); const { control, formState, handleSubmit, reset } = - useForm({ mode: "all" }); - const { t: tButton } = useTranslation("security", { - keyPrefix: "forceTransfer.button", + useForm({ mode: 'all' }); + const { t: tButton } = useTranslation('security', { + keyPrefix: 'forceTransfer.button', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { address: walletAddress } = useWalletStore(); @@ -275,7 +275,7 @@ export const DigitalSecurityForceTransfer = () => { return ( <> - + { as="form" onSubmit={handleSubmit(submit)} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} { control={control} id="source" rules={{ required }} - label={tForm("source.label")} - placeholder={tForm("source.placeholder")} + label={tForm('source.label')} + placeholder={tForm('source.placeholder')} size="md" /> @@ -318,8 +318,8 @@ export const DigitalSecurityForceTransfer = () => { control={control} id="destination" rules={{ required }} - label={tForm("destination.label")} - placeholder={tForm("destination.placeholder")} + label={tForm('destination.label')} + placeholder={tForm('destination.placeholder')} size="md" /> @@ -334,8 +334,8 @@ export const DigitalSecurityForceTransfer = () => { }} size="md" allowNegative={false} - label={tForm("amount.label")} - placeholder={tForm("amount.placeholder")} + label={tForm('amount.label')} + placeholder={tForm('amount.placeholder')} decimalScale={details?.decimals} fixedDecimalScale={true} thousandSeparator="," @@ -347,7 +347,7 @@ export const DigitalSecurityForceTransfer = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityForceTransfer/__tests__/DigitalSecurityForceTransfer.test.tsx b/apps/ats/web/src/views/DigitalSecurityForceTransfer/__tests__/DigitalSecurityForceTransfer.test.tsx index f06ce2b09..30024a333 100644 --- a/apps/ats/web/src/views/DigitalSecurityForceTransfer/__tests__/DigitalSecurityForceTransfer.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityForceTransfer/__tests__/DigitalSecurityForceTransfer.test.tsx @@ -203,38 +203,38 @@ */ -import { DigitalSecurityForceTransfer } from "../DigitalSecurityForceTransfer"; -import { render } from "../../../test-utils"; +import { DigitalSecurityForceTransfer } from '../DigitalSecurityForceTransfer'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityForceTransfer.name}`, () => { const factoryComponent = () => { return render(); }; - test("render correctly", () => { + test('render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show Goback button", () => { + test('should show Goback button', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("go-back-button"); + const breadcrumbs = component.getByTestId('go-back-button'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should show breadcrumbs", () => { + test('should show breadcrumbs', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("breadcrumb-desktop"); + const breadcrumbs = component.getByTestId('breadcrumb-desktop'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should form be rendered properly", () => { + test('should form be rendered properly', () => { const component = factoryComponent(); - const form = component.getByTestId("force-transfer-form"); + const form = component.getByTestId('force-transfer-form'); expect(form).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityFreeze/DigitalSecurityFreeze.tsx b/apps/ats/web/src/views/DigitalSecurityFreeze/DigitalSecurityFreeze.tsx index 0fc93afc5..6cc8c99a9 100644 --- a/apps/ats/web/src/views/DigitalSecurityFreeze/DigitalSecurityFreeze.tsx +++ b/apps/ats/web/src/views/DigitalSecurityFreeze/DigitalSecurityFreeze.tsx @@ -202,10 +202,10 @@ limitations under the License. */ -import { useWatch } from "react-hook-form"; -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; +import { useWatch } from 'react-hook-form'; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; import { Text, InputController, @@ -214,24 +214,24 @@ import { ToggleController, Tooltip, PhosphorIcon, -} from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { useParams } from "react-router"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useSecurityStore } from "../../store/securityStore"; -import { Info } from "@phosphor-icons/react"; +} from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { useParams } from 'react-router'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useSecurityStore } from '../../store/securityStore'; +import { Info } from '@phosphor-icons/react'; import { useFreezeSecurity, useUnfreezeSecurity, -} from "../../hooks/mutations/useFreezeSecurity"; +} from '../../hooks/mutations/useFreezeSecurity'; import { UnfreezePartialTokensRequest, FreezePartialTokensRequest, -} from "@hashgraph/asset-tokenization-sdk"; +} from '@hashgraph/asset-tokenization-sdk'; interface MintFormValues { amount: number; @@ -240,20 +240,20 @@ interface MintFormValues { } export const DigitalSecurityFreeze = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "freeze.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'freeze.header', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "freeze.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'freeze.input', }); - const { t } = useTranslation("security", { keyPrefix: "freeze" }); - const { t: tGlobal } = useTranslation("globals"); - const { t: tProperties } = useTranslation("properties"); + const { t } = useTranslation('security', { keyPrefix: 'freeze' }); + const { t: tGlobal } = useTranslation('globals'); + const { t: tProperties } = useTranslation('properties'); const { control, formState, handleSubmit, reset } = useForm({ - mode: "all", + mode: 'all', }); const { address: walletAddress } = useWalletStore(); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { isLoading: isBalancePanelLoading, update } = useDetailsBalancePanel( id, @@ -266,7 +266,7 @@ export const DigitalSecurityFreeze = () => { const isUnfreeze = useWatch({ control, - name: "isUnfreeze", + name: 'isUnfreeze', defaultValue: false, }); @@ -304,7 +304,7 @@ export const DigitalSecurityFreeze = () => { return ( <> - + { onSubmit={handleSubmit(submit)} gap={3} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} - + - {tForm("isUnfreeze.label")} + {tForm('isUnfreeze.label')} @@ -352,12 +352,12 @@ export const DigitalSecurityFreeze = () => { size="md" allowNegative={false} label={tForm( - isUnfreeze ? "amountUnfreeze.label" : "amountFreeze.label", + isUnfreeze ? 'amountUnfreeze.label' : 'amountFreeze.label', )} placeholder={tForm( isUnfreeze - ? "amountUnfreeze.placeholder" - : "amountFreeze.placeholder", + ? 'amountUnfreeze.placeholder' + : 'amountFreeze.placeholder', )} decimalScale={details?.decimals} fixedDecimalScale={true} @@ -371,8 +371,8 @@ export const DigitalSecurityFreeze = () => { control={control} id="destination" rules={{ required }} - label={tForm("destination.label")} - placeholder={tForm("destination.placeholder")} + label={tForm('destination.label')} + placeholder={tForm('destination.placeholder')} size="md" /> @@ -381,7 +381,7 @@ export const DigitalSecurityFreeze = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLocker.tsx b/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLocker.tsx index 37b3dffcc..0df4da6d6 100644 --- a/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLocker.tsx +++ b/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLocker.tsx @@ -203,18 +203,18 @@ */ -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; -import { DigitalSecurityLockerForm } from "./DigitalSecurityLockerForm"; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; +import { DigitalSecurityLockerForm } from './DigitalSecurityLockerForm'; export const DigitalSecurityLocker = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "details.locker", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'details.locker', }); return ( <> - + ); diff --git a/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLockerForm.tsx b/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLockerForm.tsx index 71ee79009..c31c986c0 100644 --- a/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLockerForm.tsx +++ b/apps/ats/web/src/views/DigitalSecurityLocker/DigitalSecurityLockerForm.tsx @@ -1,4 +1,4 @@ -import { Center, HStack, Stack, VStack } from "@chakra-ui/react"; +import { Center, HStack, Stack, VStack } from '@chakra-ui/react'; import { Button, CalendarInputController, @@ -6,20 +6,20 @@ import { InputController, InputNumberController, Text, -} from "io-bricks-ui"; -import { DATE_TIME_FORMAT } from "../../utils/constants"; -import { useLocker } from "../../hooks/mutations/useLocker"; -import { useForm } from "react-hook-form"; -import { useParams } from "react-router-dom"; -import { useTranslation } from "react-i18next"; -import { LockRequest } from "@hashgraph/asset-tokenization-sdk"; -import { dateToUnixTimestamp } from "../../utils/format"; +} from 'io-bricks-ui'; +import { DATE_TIME_FORMAT } from '../../utils/constants'; +import { useLocker } from '../../hooks/mutations/useLocker'; +import { useForm } from 'react-hook-form'; +import { useParams } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; +import { LockRequest } from '@hashgraph/asset-tokenization-sdk'; +import { dateToUnixTimestamp } from '../../utils/format'; import { isAfterDate, isHederaValidAddress, min, required, -} from "../../utils/rules"; +} from '../../utils/rules'; interface DigitalSecurityLockerFormValues { expirationDate: string; @@ -30,17 +30,17 @@ interface DigitalSecurityLockerFormValues { export const DigitalSecurityLockerForm = () => { const { id: securityId } = useParams(); - const { t: tLocker } = useTranslation("security", { - keyPrefix: "details.locker", + const { t: tLocker } = useTranslation('security', { + keyPrefix: 'details.locker', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "details.locker.form", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'details.locker.form', }); - const { t: tGlobal } = useTranslation("globals"); + const { t: tGlobal } = useTranslation('globals'); const { formState, control, handleSubmit, reset } = useForm({ - mode: "onChange", + mode: 'onChange', }); const { mutate: lockMutation, isLoading: isLoadingLockMutation } = @@ -48,7 +48,7 @@ export const DigitalSecurityLockerForm = () => { const onSubmit = (data: DigitalSecurityLockerFormValues) => { const request = new LockRequest({ - securityId: securityId ?? "", + securityId: securityId ?? '', expirationTimestamp: dateToUnixTimestamp(data.expirationDate), amount: data.amount.toString(), targetId: data.targetId.toString(), @@ -64,8 +64,8 @@ export const DigitalSecurityLockerForm = () => { return (
- - {tLocker("title")} + + {tLocker('title')} { - {tForm("targetId.label")}* + {tForm('targetId.label')}* - {tForm("amount.label")}* + {tForm('amount.label')}* { control={control} id="amount" rules={{ required, min: min(0) }} - placeholder={tForm("amount.placeholder")} + placeholder={tForm('amount.placeholder')} /> - {tForm("expirationDate.label")}* + {tForm('expirationDate.label')}* { validate: isAfterDate(new Date(), DATE_TIME_FORMAT), }} fromDate={new Date()} - placeholder={tForm("expirationDate.placeholder")} + placeholder={tForm('expirationDate.placeholder')} withTimeInput format={DATE_TIME_FORMAT} /> @@ -128,7 +128,7 @@ export const DigitalSecurityLockerForm = () => { isDisabled={!formState.isValid} type="submit" > - {isLoadingLockMutation ? tGlobal("sending") : tGlobal("send")} + {isLoadingLockMutation ? tGlobal('sending') : tGlobal('send')} diff --git a/apps/ats/web/src/views/DigitalSecurityLocker/__tests__/DigitalSecurityLockerForm.test.tsx b/apps/ats/web/src/views/DigitalSecurityLocker/__tests__/DigitalSecurityLockerForm.test.tsx index a96968c20..b3ca70732 100644 --- a/apps/ats/web/src/views/DigitalSecurityLocker/__tests__/DigitalSecurityLockerForm.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityLocker/__tests__/DigitalSecurityLockerForm.test.tsx @@ -1,38 +1,38 @@ -import { fireEvent } from "@testing-library/react"; -import { render, selectCalendar } from "../../../test-utils"; -import { waitFor } from "@testing-library/react"; -import { DigitalSecurityLockerForm } from "../DigitalSecurityLockerForm"; +import { fireEvent } from '@testing-library/react'; +import { render, selectCalendar } from '../../../test-utils'; +import { waitFor } from '@testing-library/react'; +import { DigitalSecurityLockerForm } from '../DigitalSecurityLockerForm'; describe(`${DigitalSecurityLockerForm.name}`, () => { - test("should render correctly", () => { + test('should render correctly', () => { const component = render(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should disable the submit button if the form is invalid", () => { + test('should disable the submit button if the form is invalid', () => { const component = render(); - const submitButton = component.getByTestId("create-locker-button"); + const submitButton = component.getByTestId('create-locker-button'); expect(submitButton).toBeDisabled(); }); - test("should validate target Id field", async () => { + test('should validate target Id field', async () => { const component = render(); - fireEvent.change(component.getByTestId("targetId"), { - target: { value: "0x1234567890abcdef" }, + fireEvent.change(component.getByTestId('targetId'), { + target: { value: '0x1234567890abcdef' }, }); expect(await component.findByText(/Wrong address/i)).toBeInTheDocument(); }); - test("should validate amount field", async () => { + test('should validate amount field', async () => { const component = render(); - fireEvent.change(component.getByTestId("amount"), { - target: { value: "-1" }, + fireEvent.change(component.getByTestId('amount'), { + target: { value: '-1' }, }); expect( @@ -40,19 +40,19 @@ describe(`${DigitalSecurityLockerForm.name}`, () => { ).toBeInTheDocument(); }); - test("should enable the submit button if the form is valid", async () => { + test('should enable the submit button if the form is valid', async () => { const component = render(); - const submitButton = component.getByTestId("create-locker-button"); + const submitButton = component.getByTestId('create-locker-button'); expect(submitButton).toBeDisabled(); - fireEvent.change(component.getByTestId("targetId"), { - target: { value: "0.0.12345" }, + fireEvent.change(component.getByTestId('targetId'), { + target: { value: '0.0.12345' }, }); - fireEvent.change(component.getByTestId("amount"), { - target: { value: "10" }, + fireEvent.change(component.getByTestId('amount'), { + target: { value: '10' }, }); const tomorrow = new Date(); @@ -61,8 +61,8 @@ describe(`${DigitalSecurityLockerForm.name}`, () => { await selectCalendar( component, - "expirationDate", - tomorrow.getDate().toString().padStart(2, "0"), + 'expirationDate', + tomorrow.getDate().toString().padStart(2, '0'), ); await waitFor(() => { diff --git a/apps/ats/web/src/views/DigitalSecurityMint/DigitalSecurityMint.tsx b/apps/ats/web/src/views/DigitalSecurityMint/DigitalSecurityMint.tsx index 12ecf8ada..7442e8aef 100644 --- a/apps/ats/web/src/views/DigitalSecurityMint/DigitalSecurityMint.tsx +++ b/apps/ats/web/src/views/DigitalSecurityMint/DigitalSecurityMint.tsx @@ -203,25 +203,25 @@ */ -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; import { Text, InputController, InputNumberController, Button, -} from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { useParams } from "react-router"; -import { IssueRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useMintSecurity } from "../../hooks/queries/useMintSecurity"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useSecurityStore } from "../../store/securityStore"; +} from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { useParams } from 'react-router'; +import { IssueRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useMintSecurity } from '../../hooks/queries/useMintSecurity'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useSecurityStore } from '../../store/securityStore'; interface MintFormValues { amount: number; @@ -229,18 +229,18 @@ interface MintFormValues { } export const DigitalSecurityMint = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "mint.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'mint.header', }); - const { t: tForm } = useTranslation("security", { keyPrefix: "mint.input" }); - const { t } = useTranslation("security", { keyPrefix: "mint" }); - const { t: tGlobal } = useTranslation("globals"); - const { t: tProperties } = useTranslation("properties"); + const { t: tForm } = useTranslation('security', { keyPrefix: 'mint.input' }); + const { t } = useTranslation('security', { keyPrefix: 'mint' }); + const { t: tGlobal } = useTranslation('globals'); + const { t: tProperties } = useTranslation('properties'); const { control, formState, handleSubmit, reset } = useForm({ - mode: "all", + mode: 'all', }); const { address: walletAddress } = useWalletStore(); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { isLoading: isBalancePanelLoading, update } = useDetailsBalancePanel( id, @@ -265,7 +265,7 @@ export const DigitalSecurityMint = () => { return ( <> - + { as="form" onSubmit={handleSubmit(submit)} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} { }} size="md" allowNegative={false} - label={tForm("amount.label")} - placeholder={tForm("amount.placeholder")} + label={tForm('amount.label')} + placeholder={tForm('amount.placeholder')} decimalScale={details?.decimals} fixedDecimalScale={true} thousandSeparator="," @@ -316,8 +316,8 @@ export const DigitalSecurityMint = () => { control={control} id="destination" rules={{ required }} - label={tForm("destination.label")} - placeholder={tForm("destination.placeholder")} + label={tForm('destination.label')} + placeholder={tForm('destination.placeholder')} size="md" /> @@ -326,7 +326,7 @@ export const DigitalSecurityMint = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityMint/__tests__/DigitalSecurityIssue.test.tsx b/apps/ats/web/src/views/DigitalSecurityMint/__tests__/DigitalSecurityIssue.test.tsx index 928772710..0a92bb7d4 100644 --- a/apps/ats/web/src/views/DigitalSecurityMint/__tests__/DigitalSecurityIssue.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityMint/__tests__/DigitalSecurityIssue.test.tsx @@ -203,38 +203,38 @@ */ -import { DigitalSecurityMint } from "../DigitalSecurityMint"; -import { render } from "../../../test-utils"; +import { DigitalSecurityMint } from '../DigitalSecurityMint'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityMint.name}`, () => { const factoryComponent = () => { return render(); }; - test("render correctly", () => { + test('render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show Goback button", () => { + test('should show Goback button', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("go-back-button"); + const breadcrumbs = component.getByTestId('go-back-button'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should show breadcrumbs", () => { + test('should show breadcrumbs', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("breadcrumb-desktop"); + const breadcrumbs = component.getByTestId('breadcrumb-desktop'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should form be rendered properly", () => { + test('should form be rendered properly', () => { const component = factoryComponent(); - const form = component.getByTestId("mint-form"); + const form = component.getByTestId('mint-form'); expect(form).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityRedeem/DigitalSecurityRedeem.tsx b/apps/ats/web/src/views/DigitalSecurityRedeem/DigitalSecurityRedeem.tsx index cf179adfd..46fbefac1 100644 --- a/apps/ats/web/src/views/DigitalSecurityRedeem/DigitalSecurityRedeem.tsx +++ b/apps/ats/web/src/views/DigitalSecurityRedeem/DigitalSecurityRedeem.tsx @@ -203,43 +203,43 @@ */ -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; -import { Text, InputNumberController, Button } from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { useParams } from "react-router"; -import { useRedeemSecurity } from "../../hooks/queries/useRedeemSecurity"; -import { RedeemRequest } from "@hashgraph/asset-tokenization-sdk"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useSecurityStore } from "../../store/securityStore"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; +import { Text, InputNumberController, Button } from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { useParams } from 'react-router'; +import { useRedeemSecurity } from '../../hooks/queries/useRedeemSecurity'; +import { RedeemRequest } from '@hashgraph/asset-tokenization-sdk'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useSecurityStore } from '../../store/securityStore'; interface RedeemFormValues { amount: number; } export const DigitalSecurityRedeem = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "redeem.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'redeem.header', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "redeem.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'redeem.input', }); - const { t } = useTranslation("security", { keyPrefix: "redeem" }); - const { t: tGlobal } = useTranslation("globals"); + const { t } = useTranslation('security', { keyPrefix: 'redeem' }); + const { t: tGlobal } = useTranslation('globals'); const { control, formState, handleSubmit, reset } = useForm( { - mode: "all", + mode: 'all', }, ); - const { t: TButton } = useTranslation("security", { - keyPrefix: "redeem.button", + const { t: TButton } = useTranslation('security', { + keyPrefix: 'redeem.button', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { address: walletAddress } = useWalletStore(); @@ -264,7 +264,7 @@ export const DigitalSecurityRedeem = () => { return ( <> - + { as="form" onSubmit={handleSubmit(submit)} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} { }} size="md" allowNegative={false} - label={tForm("amount.label")} - placeholder={tForm("amount.placeholder")} + label={tForm('amount.label')} + placeholder={tForm('amount.placeholder')} decimalScale={details?.decimals} fixedDecimalScale={true} thousandSeparator="," @@ -314,7 +314,7 @@ export const DigitalSecurityRedeem = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityRedeem/__tests__/DigitalSecurityRedeem.test.tsx b/apps/ats/web/src/views/DigitalSecurityRedeem/__tests__/DigitalSecurityRedeem.test.tsx index 44c9d52a0..f25196393 100644 --- a/apps/ats/web/src/views/DigitalSecurityRedeem/__tests__/DigitalSecurityRedeem.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityRedeem/__tests__/DigitalSecurityRedeem.test.tsx @@ -203,38 +203,38 @@ */ -import { DigitalSecurityRedeem } from "../DigitalSecurityRedeem"; -import { render } from "../../../test-utils"; +import { DigitalSecurityRedeem } from '../DigitalSecurityRedeem'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityRedeem.name}`, () => { const factoryComponent = () => { return render(); }; - test("render correctly", () => { + test('render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show Goback button", () => { + test('should show Goback button', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("go-back-button"); + const breadcrumbs = component.getByTestId('go-back-button'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should show breadcrumbs", () => { + test('should show breadcrumbs', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("breadcrumb-desktop"); + const breadcrumbs = component.getByTestId('breadcrumb-desktop'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should form be rendered properly", () => { + test('should form be rendered properly', () => { const component = factoryComponent(); - const form = component.getByTestId("redeem-form"); + const form = component.getByTestId('redeem-form'); expect(form).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/DigitalSecurityTransfer/DigitalSecurityTransfer.tsx b/apps/ats/web/src/views/DigitalSecurityTransfer/DigitalSecurityTransfer.tsx index ace5f886d..84c7118b2 100644 --- a/apps/ats/web/src/views/DigitalSecurityTransfer/DigitalSecurityTransfer.tsx +++ b/apps/ats/web/src/views/DigitalSecurityTransfer/DigitalSecurityTransfer.tsx @@ -203,25 +203,25 @@ */ -import { HStack, Stack, VStack } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { useTranslation } from "react-i18next"; +import { HStack, Stack, VStack } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { useTranslation } from 'react-i18next'; import { Text, InputController, InputNumberController, Button, -} from "io-bricks-ui"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { required, min } from "../../utils/rules"; -import { CancelButton } from "../../components/CancelButton"; -import { useTransferSecurity } from "../../hooks/queries/useTransferSecurity"; -import { TransferRequest } from "@hashgraph/asset-tokenization-sdk"; -import { useParams } from "react-router"; -import { DetailsBalancePanel } from "../../components/DetailsBalancePanel"; -import { useWalletStore } from "../../store/walletStore"; -import { useDetailsBalancePanel } from "../../hooks/useDetailsBalancePanel"; -import { useSecurityStore } from "../../store/securityStore"; +} from 'io-bricks-ui'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { required, min } from '../../utils/rules'; +import { CancelButton } from '../../components/CancelButton'; +import { useTransferSecurity } from '../../hooks/queries/useTransferSecurity'; +import { TransferRequest } from '@hashgraph/asset-tokenization-sdk'; +import { useParams } from 'react-router'; +import { DetailsBalancePanel } from '../../components/DetailsBalancePanel'; +import { useWalletStore } from '../../store/walletStore'; +import { useDetailsBalancePanel } from '../../hooks/useDetailsBalancePanel'; +import { useSecurityStore } from '../../store/securityStore'; interface TransferFormValues { amount: number; @@ -229,22 +229,22 @@ interface TransferFormValues { } export const DigitalSecurityTransfer = () => { - const { t: tHeader } = useTranslation("security", { - keyPrefix: "transfer.header", + const { t: tHeader } = useTranslation('security', { + keyPrefix: 'transfer.header', }); - const { t: tForm } = useTranslation("security", { - keyPrefix: "transfer.input", + const { t: tForm } = useTranslation('security', { + keyPrefix: 'transfer.input', }); - const { t } = useTranslation("security", { keyPrefix: "transfer" }); - const { t: tGlobal } = useTranslation("globals"); + const { t } = useTranslation('security', { keyPrefix: 'transfer' }); + const { t: tGlobal } = useTranslation('globals'); const { control, formState, handleSubmit, reset } = useForm({ - mode: "all", + mode: 'all', }); - const { t: TButton } = useTranslation("security", { - keyPrefix: "transfer.button", + const { t: TButton } = useTranslation('security', { + keyPrefix: 'transfer.button', }); - const { id = "" } = useParams(); + const { id = '' } = useParams(); const { details } = useSecurityStore(); const { address: walletAddress } = useWalletStore(); @@ -270,7 +270,7 @@ export const DigitalSecurityTransfer = () => { return ( <> - + { as="form" onSubmit={handleSubmit(submit)} > - {t("title")} + {t('title')} - {t("subtitle")} + {t('subtitle')} - {tGlobal("mandatoryFields")} + {tGlobal('mandatoryFields')} { control={control} id="destination" rules={{ required }} - label={tForm("destination.label")} - placeholder={tForm("destination.placeholder")} + label={tForm('destination.label')} + placeholder={tForm('destination.placeholder')} size="md" /> @@ -318,8 +318,8 @@ export const DigitalSecurityTransfer = () => { }} size="md" allowNegative={false} - label={tForm("amount.label")} - placeholder={tForm("amount.placeholder")} + label={tForm('amount.label')} + placeholder={tForm('amount.placeholder')} decimalScale={details?.decimals} fixedDecimalScale={true} thousandSeparator="," @@ -331,7 +331,7 @@ export const DigitalSecurityTransfer = () => { w="full" mt={10} align="end" - justifyContent={"flex-end"} + justifyContent={'flex-end'} > diff --git a/apps/ats/web/src/views/DigitalSecurityTransfer/__tests__/DigitalSecurityTransfer.test.tsx b/apps/ats/web/src/views/DigitalSecurityTransfer/__tests__/DigitalSecurityTransfer.test.tsx index 71de7ce99..502d4a400 100644 --- a/apps/ats/web/src/views/DigitalSecurityTransfer/__tests__/DigitalSecurityTransfer.test.tsx +++ b/apps/ats/web/src/views/DigitalSecurityTransfer/__tests__/DigitalSecurityTransfer.test.tsx @@ -203,38 +203,38 @@ */ -import { DigitalSecurityTransfer } from "../DigitalSecurityTransfer"; -import { render } from "../../../test-utils"; +import { DigitalSecurityTransfer } from '../DigitalSecurityTransfer'; +import { render } from '../../../test-utils'; describe(`${DigitalSecurityTransfer.name}`, () => { const factoryComponent = () => { return render(); }; - test("render correctly", () => { + test('render correctly', () => { const component = factoryComponent(); expect(component.asFragment()).toMatchSnapshot(); }); - test("should show Goback button", () => { + test('should show Goback button', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("go-back-button"); + const breadcrumbs = component.getByTestId('go-back-button'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should show breadcrumbs", () => { + test('should show breadcrumbs', () => { const component = factoryComponent(); - const breadcrumbs = component.getByTestId("breadcrumb-desktop"); + const breadcrumbs = component.getByTestId('breadcrumb-desktop'); expect(breadcrumbs).toBeInTheDocument(); }); - test("should form be rendered properly", () => { + test('should form be rendered properly', () => { const component = factoryComponent(); - const form = component.getByTestId("transfer-form"); + const form = component.getByTestId('transfer-form'); expect(form).toBeInTheDocument(); }); }); diff --git a/apps/ats/web/src/views/ExternalControlDetails/ExternalControlDetails.tsx b/apps/ats/web/src/views/ExternalControlDetails/ExternalControlDetails.tsx index 6d6afd7c0..4c682e3e7 100644 --- a/apps/ats/web/src/views/ExternalControlDetails/ExternalControlDetails.tsx +++ b/apps/ats/web/src/views/ExternalControlDetails/ExternalControlDetails.tsx @@ -1,7 +1,7 @@ -import { Box, HStack, Stack, useDisclosure } from "@chakra-ui/react"; -import { History } from "../../components/History"; -import { RouteName } from "../../router/RouteName"; -import { RoutePath } from "../../router/RoutePath"; +import { Box, HStack, Stack, useDisclosure } from '@chakra-ui/react'; +import { History } from '../../components/History'; +import { RouteName } from '../../router/RouteName'; +import { RoutePath } from '../../router/RoutePath'; import { Button, ClipboardButton, @@ -10,38 +10,38 @@ import { SearchInputController, Table, Text, -} from "io-bricks-ui"; -import { isHederaValidAddress, required } from "../../utils/rules"; -import { useTranslation } from "react-i18next"; -import { useForm } from "react-hook-form"; -import { CellContext, createColumnHelper } from "@tanstack/table-core"; -import { Trash } from "@phosphor-icons/react"; -import { useState } from "react"; +} from 'io-bricks-ui'; +import { isHederaValidAddress, required } from '../../utils/rules'; +import { useTranslation } from 'react-i18next'; +import { useForm } from 'react-hook-form'; +import { CellContext, createColumnHelper } from '@tanstack/table-core'; +import { Trash } from '@phosphor-icons/react'; +import { useState } from 'react'; interface FieldsTable { address: string; } export const ExternalControlDetails = () => { - const { t: tRoutes } = useTranslation("routes"); - const { t } = useTranslation("externalControlDetails"); + const { t: tRoutes } = useTranslation('routes'); + const { t } = useTranslation('externalControlDetails'); const { isOpen, onClose, onOpen } = useDisclosure(); - const [_accountToRemove, setAccountToRemove] = useState(""); + const [_accountToRemove, setAccountToRemove] = useState(''); const { control, formState: { isValid }, handleSubmit, } = useForm({ - mode: "onChange", + mode: 'onChange', }); const columnsHelper = createColumnHelper(); const columns = [ - columnsHelper.accessor("address", { - header: t("table.address"), + columnsHelper.accessor('address', { + header: t('table.address'), enableSorting: false, size: 995, cell: ({ getValue }) => { @@ -50,14 +50,14 @@ export const ExternalControlDetails = () => { return ( {address} - + ); }, }), columnsHelper.display({ - id: "remove", - header: t("table.actions"), + id: 'remove', + header: t('table.actions'), size: 5, enableSorting: false, cell: (props) => renderRemove(props), @@ -83,7 +83,7 @@ export const ExternalControlDetails = () => { }} size="xs" > - + ); }; @@ -97,11 +97,11 @@ export const ExternalControlDetails = () => { excludePaths={[RoutePath.DASHBOARD]} /> { console.log("SEARCHING: ", search)} + placeholder={t('search.placeholder')} + onSearch={(search) => console.log('SEARCHING: ', search)} control={control} size="sm" rules={{ @@ -124,7 +124,7 @@ export const ExternalControlDetails = () => { /> @@ -132,7 +132,7 @@ export const ExternalControlDetails = () => { name="external-control-address" columns={columns} data={[]} - emptyComponent={{t("table.empty")}} + emptyComponent={{t('table.empty')}} /> { isOpen={isOpen} onClose={onClose} icon={} - title={t("modal.removeAddress.title")} - description={t("modal.removeAddress.description")} - confirmText={t("modal.removeAddress.confirmText")} + title={t('modal.removeAddress.title')} + description={t('modal.removeAddress.description')} + confirmText={t('modal.removeAddress.confirmText')} onConfirm={() => { onClose(); }} onCancel={onClose} - cancelText={t("modal.removeAddress.cancelText")} + cancelText={t('modal.removeAddress.cancelText')} /> ); diff --git a/apps/ats/web/src/views/ExternalControlList/Components/AddAddressModal.tsx b/apps/ats/web/src/views/ExternalControlList/Components/AddAddressModal.tsx index 05f12c9b6..e29eaae9d 100644 --- a/apps/ats/web/src/views/ExternalControlList/Components/AddAddressModal.tsx +++ b/apps/ats/web/src/views/ExternalControlList/Components/AddAddressModal.tsx @@ -8,25 +8,25 @@ import { ModalOverlay, ModalProps, VStack, -} from "@chakra-ui/react"; -import { Button, InputController } from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { ExternalControl } from "../ExternalControlList"; +} from '@chakra-ui/react'; +import { Button, InputController } from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { ExternalControl } from '../ExternalControlList'; import { useAddToBlackListMock, useAddToWhiteListMock, -} from "../../../hooks/mutations/useExternalControl"; +} from '../../../hooks/mutations/useExternalControl'; import { AddToBlackListMockRequest, AddToWhiteListMockRequest, -} from "@hashgraph/asset-tokenization-sdk"; +} from '@hashgraph/asset-tokenization-sdk'; interface FormValues { accountId: string; } -interface AddAddressModalProps extends Omit { +interface AddAddressModalProps extends Omit { externalControlSelected?: ExternalControl; } @@ -35,12 +35,12 @@ export const AddAddressModal = ({ isOpen, onClose, }: AddAddressModalProps) => { - const { t: tAddAddress } = useTranslation("externalControl", { - keyPrefix: "addAddress", + const { t: tAddAddress } = useTranslation('externalControl', { + keyPrefix: 'addAddress', }); const { control, handleSubmit, reset } = useForm({ - mode: "onChange", + mode: 'onChange', }); const { @@ -53,7 +53,7 @@ export const AddAddressModal = ({ } = useAddToWhiteListMock(); const onSubmit = (values: FormValues) => { - if (externalControlSelected?.type === "blacklist") { + if (externalControlSelected?.type === 'blacklist') { return addToBlackListMutate( new AddToBlackListMockRequest({ contractId: externalControlSelected.address, @@ -62,7 +62,7 @@ export const AddAddressModal = ({ ).finally(onClose); } - if (externalControlSelected?.type === "whitelist") { + if (externalControlSelected?.type === 'whitelist') { return addToWhiteListMutate( new AddToWhiteListMockRequest({ contractId: externalControlSelected.address, @@ -85,16 +85,16 @@ export const AddAddressModal = ({ }} > - - {tAddAddress("title")} + + {tAddAddress('title')} @@ -105,7 +105,7 @@ export const AddAddressModal = ({ type="submit" onClick={handleSubmit(onSubmit)} > - {tAddAddress("add")} + {tAddAddress('add')} diff --git a/apps/ats/web/src/views/ExternalControlList/Components/AddExternalControlButton.tsx b/apps/ats/web/src/views/ExternalControlList/Components/AddExternalControlButton.tsx index 4e1ffa9b8..a3fc9fed7 100644 --- a/apps/ats/web/src/views/ExternalControlList/Components/AddExternalControlButton.tsx +++ b/apps/ats/web/src/views/ExternalControlList/Components/AddExternalControlButton.tsx @@ -203,16 +203,16 @@ */ -import { PhosphorIcon, Button } from "io-bricks-ui"; -import type { ButtonProps } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { RouterManager } from "../../../router/RouterManager"; -import { RouteName } from "../../../router/RouteName"; -import { Link as RouterLink } from "react-router-dom"; -import { Plus } from "@phosphor-icons/react"; +import { PhosphorIcon, Button } from 'io-bricks-ui'; +import type { ButtonProps } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { RouterManager } from '../../../router/RouterManager'; +import { RouteName } from '../../../router/RouteName'; +import { Link as RouterLink } from 'react-router-dom'; +import { Plus } from '@phosphor-icons/react'; export const AddExternalControlButton = (props: ButtonProps) => { - const { t } = useTranslation("routes"); + const { t } = useTranslation('routes'); return ( diff --git a/apps/ats/web/src/views/ExternalControlList/Components/CreateNewExternalControlButton.tsx b/apps/ats/web/src/views/ExternalControlList/Components/CreateNewExternalControlButton.tsx index 7322394b0..09b8d5fd9 100644 --- a/apps/ats/web/src/views/ExternalControlList/Components/CreateNewExternalControlButton.tsx +++ b/apps/ats/web/src/views/ExternalControlList/Components/CreateNewExternalControlButton.tsx @@ -203,16 +203,16 @@ */ -import { Button } from "io-bricks-ui"; -import type { ButtonProps } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { RouterManager } from "../../../router/RouterManager"; -import { RouteName } from "../../../router/RouteName"; -import { Link as RouterLink } from "react-router-dom"; +import { Button } from 'io-bricks-ui'; +import type { ButtonProps } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { RouterManager } from '../../../router/RouterManager'; +import { RouteName } from '../../../router/RouteName'; +import { Link as RouterLink } from 'react-router-dom'; export const CreateNewExternalControlButton = (props: ButtonProps) => { - const { t: tHeader } = useTranslation("externalControl", { - keyPrefix: "list.header", + const { t: tHeader } = useTranslation('externalControl', { + keyPrefix: 'list.header', }); return ( @@ -223,7 +223,7 @@ export const CreateNewExternalControlButton = (props: ButtonProps) => { size="md" {...props} > - {tHeader("createNewExternalControl")} + {tHeader('createNewExternalControl')} ); }; diff --git a/apps/ats/web/src/views/ExternalControlList/Components/Header.tsx b/apps/ats/web/src/views/ExternalControlList/Components/Header.tsx index 96ea8c644..2944948e2 100644 --- a/apps/ats/web/src/views/ExternalControlList/Components/Header.tsx +++ b/apps/ats/web/src/views/ExternalControlList/Components/Header.tsx @@ -203,18 +203,18 @@ */ -import { HStack } from "@chakra-ui/react"; -import { Text } from "io-bricks-ui"; -import { useTranslation } from "react-i18next"; -import { AddExternalControlButton } from "./AddExternalControlButton"; -import { CreateNewExternalControlButton } from "./CreateNewExternalControlButton"; +import { HStack } from '@chakra-ui/react'; +import { Text } from 'io-bricks-ui'; +import { useTranslation } from 'react-i18next'; +import { AddExternalControlButton } from './AddExternalControlButton'; +import { CreateNewExternalControlButton } from './CreateNewExternalControlButton'; export const Header = () => { - const { t } = useTranslation("externalControl", { keyPrefix: "list.header" }); + const { t } = useTranslation('externalControl', { keyPrefix: 'list.header' }); return ( - - {t("title")} + + {t('title')} diff --git a/apps/ats/web/src/views/ExternalControlList/Components/RemoveAddressModal.tsx b/apps/ats/web/src/views/ExternalControlList/Components/RemoveAddressModal.tsx index 7a085c5df..891deb801 100644 --- a/apps/ats/web/src/views/ExternalControlList/Components/RemoveAddressModal.tsx +++ b/apps/ats/web/src/views/ExternalControlList/Components/RemoveAddressModal.tsx @@ -8,25 +8,25 @@ import { ModalOverlay, ModalProps, VStack, -} from "@chakra-ui/react"; -import { Button, InputController } from "io-bricks-ui"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { ExternalControl } from "../ExternalControlList"; +} from '@chakra-ui/react'; +import { Button, InputController } from 'io-bricks-ui'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { ExternalControl } from '../ExternalControlList'; import { useRemoveFromBlackListMock, useRemoveFromWhiteListMock, -} from "../../../hooks/mutations/useExternalControl"; +} from '../../../hooks/mutations/useExternalControl'; import { RemoveFromBlackListMockRequest, RemoveFromWhiteListMockRequest, -} from "@hashgraph/asset-tokenization-sdk"; +} from '@hashgraph/asset-tokenization-sdk'; interface FormValues { accountId: string; } -interface RemoveAddressModalProps extends Omit { +interface RemoveAddressModalProps extends Omit { externalControlSelected?: ExternalControl; } @@ -35,12 +35,12 @@ export const RemoveAddressModal = ({ isOpen, onClose, }: RemoveAddressModalProps) => { - const { t: tRemoveAddress } = useTranslation("externalControl", { - keyPrefix: "removeAddress", + const { t: tRemoveAddress } = useTranslation('externalControl', { + keyPrefix: 'removeAddress', }); const { control, handleSubmit, reset } = useForm({ - mode: "onChange", + mode: 'onChange', }); const { @@ -53,7 +53,7 @@ export const RemoveAddressModal = ({ } = useRemoveFromWhiteListMock(); const onSubmit = (values: FormValues) => { - if (externalControlSelected?.type === "blacklist") { + if (externalControlSelected?.type === 'blacklist') { return removeFromBlackListMockMutate( new RemoveFromBlackListMockRequest({ contractId: externalControlSelected.address, @@ -62,7 +62,7 @@ export const RemoveAddressModal = ({ ).finally(onClose); } - if (externalControlSelected?.type === "whitelist") { + if (externalControlSelected?.type === 'whitelist') { return removeFromWhiteListMockMutate( new RemoveFromWhiteListMockRequest({ contractId: externalControlSelected.address, @@ -86,16 +86,16 @@ export const RemoveAddressModal = ({ }} > - - {tRemoveAddress("title")} + + {tRemoveAddress('title')} @@ -106,7 +106,7 @@ export const RemoveAddressModal = ({ type="submit" onClick={handleSubmit(onSubmit)} > - {tRemoveAddress("remove")} + {tRemoveAddress('remove')} diff --git a/apps/ats/web/src/views/ExternalControlList/ExternalControlList.tsx b/apps/ats/web/src/views/ExternalControlList/ExternalControlList.tsx index b29b1f335..5cf3b72c5 100644 --- a/apps/ats/web/src/views/ExternalControlList/ExternalControlList.tsx +++ b/apps/ats/web/src/views/ExternalControlList/ExternalControlList.tsx @@ -1,4 +1,4 @@ -import { Box, HStack, Stack, useDisclosure } from "@chakra-ui/react"; +import { Box, HStack, Stack, useDisclosure } from '@chakra-ui/react'; import { Button, PhosphorIcon, @@ -6,29 +6,29 @@ import { Table, Text, useToast, -} from "io-bricks-ui"; -import { createColumnHelper } from "@tanstack/table-core"; +} from 'io-bricks-ui'; +import { createColumnHelper } from '@tanstack/table-core'; import { Question, Trash, UserCirclePlus, UserCircleMinus, MagnifyingGlass, -} from "@phosphor-icons/react"; -import { useTranslation } from "react-i18next"; -import { useEffect, useState } from "react"; -import { useExternalControlStore } from "../../store/externalControlStore"; -import { useUserStore } from "../../store/userStore"; -import { useRolesStore } from "../../store/rolesStore"; -import { User } from "../../utils/constants"; -import { Header } from "./Components/Header"; -import { AddAddressModal } from "./Components/AddAddressModal"; -import { RemoveAddressModal } from "./Components/RemoveAddressModal"; -import { CheckAddressModal } from "./Components/CheckAddressModal"; +} from '@phosphor-icons/react'; +import { useTranslation } from 'react-i18next'; +import { useEffect, useState } from 'react'; +import { useExternalControlStore } from '../../store/externalControlStore'; +import { useUserStore } from '../../store/userStore'; +import { useRolesStore } from '../../store/rolesStore'; +import { User } from '../../utils/constants'; +import { Header } from './Components/Header'; +import { AddAddressModal } from './Components/AddAddressModal'; +import { RemoveAddressModal } from './Components/RemoveAddressModal'; +import { CheckAddressModal } from './Components/CheckAddressModal'; export type ExternalControl = { address: string; - type: "whitelist" | "blacklist"; + type: 'whitelist' | 'blacklist'; }; export const ExternalControlList = () => { @@ -50,14 +50,14 @@ export const ExternalControlList = () => { onOpen: onOpenCheckModal, } = useDisclosure(); - const { t: tTable } = useTranslation("externalControl", { - keyPrefix: "list.table", + const { t: tTable } = useTranslation('externalControl', { + keyPrefix: 'list.table', }); - const { t: tModal } = useTranslation("externalControl", { - keyPrefix: "list.modal", + const { t: tModal } = useTranslation('externalControl', { + keyPrefix: 'list.modal', }); - const { t: tMessages } = useTranslation("externalControl", { - keyPrefix: "list.messages", + const { t: tMessages } = useTranslation('externalControl', { + keyPrefix: 'list.messages', }); const [externalControlSelected, setExternalControlSelected] = useState< @@ -76,26 +76,26 @@ export const ExternalControlList = () => { const columnHelper = createColumnHelper(); const columns = [ - columnHelper.accessor("address", { - header: tTable("address"), + columnHelper.accessor('address', { + header: tTable('address'), enableSorting: false, size: 100, }), - columnHelper.accessor("type", { - header: tTable("state"), + columnHelper.accessor('type', { + header: tTable('state'), enableSorting: false, size: 600, cell({ getValue }) { const value = getValue(); return ( - - {value === "blacklist" ? tTable("blacklist") : tTable("whitelist")} + + {value === 'blacklist' ? tTable('blacklist') : tTable('whitelist')} ); }, }), columnHelper.display({ - header: tTable("actions"), + header: tTable('actions'), enableSorting: false, cell(props) { const { @@ -114,7 +114,7 @@ export const ExternalControlList = () => { >