From 9eed1c88b377f83277578ba28db1f23aad3be9ff Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Mon, 18 Dec 2023 12:39:54 +0100 Subject: [PATCH 1/3] chore: Add a nova-sdk build and deploy workflow [WiP] --- .github/workflows/nova-build-temp.yaml | 76 ++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/nova-build-temp.yaml diff --git a/.github/workflows/nova-build-temp.yaml b/.github/workflows/nova-build-temp.yaml new file mode 100644 index 000000000..6fa4a5270 --- /dev/null +++ b/.github/workflows/nova-build-temp.yaml @@ -0,0 +1,76 @@ +name: Nova Deply Workflow (with SDK build) + +on: + workflow_dispatch: + inputs: + TARGET_COMMIT: + description: 'Target Commit Hash for the SDK' + required: true + default: '2.0' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt-get install -y python2 gcc-multilib g++-multilib build-essential libssl-dev rpm libsecret-1-dev software-properties-common apt-transport-https libudev-dev libusb-1.0-0-dev llvm-dev libclang-dev clang yarn + echo 'LIBCLANG_PATH=/usr/lib/llvm-11/lib' >> $GITHUB_ENV + echo 'DEBUG=electron-builder' >> $GITHUB_ENV + echo 'PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/snap' >> $GITHUB_ENV + + - name: Install Rust and wasm-bindgen-cli + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source $HOME/.cargo/env + cargo install wasm-bindgen-cli + rustup target add wasm32-unknown-unknown + + - name: Global Git Configuration + run: git config --global --add safe.directory ${{ github.workspace }} + + - name: Yarn Add crypto-browserify + run: yarn add crypto-browserify + + - name: Setup SDK + run: | + git clone -b 2.0 https://github.com/iotaledger/iota-sdk + echo "Checking out nova-sdk commit ${{ github.event.inputs.TARGET_COMMIT }}" + git checkout ${{ github.event.inputs.TARGET_COMMIT }} + + - name: Build Node.js Bindings + run: | + cd iota-sdk/bindings/nodejs + echo "Renaming nodejs sdk (sdk-nova)" + sed -i.bak '2s/.*/ \"name\": \"@iota\/sdk-nova\",/' package.json + rm package.json.bak + echo "Building nodejs bindings" + yarn + yarn build + cd .. + + - name: Build WASM Bindings + run: | + cd wasm + echo "Renaming wasm sdk (sdk-wasm-nova)" + sed -i.bak '2s/.*/ \"name\": \"@iota\/sdk-wasm-nova\",/' package.json + rm package.json.bak + echo "Building wasm bindings" + yarn + yarn build + cd ../.. + env: + TARGET_COMMIT: ${{ github.event.inputs.TARGET_COMMIT }} + + - name: See what we got + run: | + find -ls From 770813abb10e68cbcd85bf8c0bb4df781728e8c4 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Tue, 9 Jan 2024 10:30:24 +0100 Subject: [PATCH 2/3] Fix: Make http protocol for Influx endpoint configurable (#901) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add option to specify protocol for local setups * Split host to properly use port specified * Sorry little one --------- Co-authored-by: Begoña Álvarez de la Cruz --- api/src/models/db/INetwork.ts | 5 +++++ api/src/services/stardust/influx/influxDbClient.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api/src/models/db/INetwork.ts b/api/src/models/db/INetwork.ts index f7752e9d4..e48182a03 100644 --- a/api/src/models/db/INetwork.ts +++ b/api/src/models/db/INetwork.ts @@ -71,6 +71,11 @@ export interface INetwork { */ permaNodeJwt?: string; + /** + * The potocol used by the influxDB endpoint. + */ + analyticsInfluxDbProtocol?: "http" | "https"; + /** * The analytics influxDB endpoint. */ diff --git a/api/src/services/stardust/influx/influxDbClient.ts b/api/src/services/stardust/influx/influxDbClient.ts index afaee241e..5d472b995 100644 --- a/api/src/services/stardust/influx/influxDbClient.ts +++ b/api/src/services/stardust/influx/influxDbClient.ts @@ -115,9 +115,11 @@ export abstract class InfluxDbClient { * @returns Boolean representing that the client ping succeeded. */ public async buildClient(): Promise { - const protocol = "https"; + const protocol = this._network.analyticsInfluxDbProtocol || 'https'; const network = this._network.network; - const host = this._network.analyticsInfluxDbEndpoint; + var [host, portString] = this._network.analyticsInfluxDbEndpoint.split(':'); + // Parse port string to int, or use default port for protocol + const port = parseInt(portString) || (protocol === 'https' ? 443 : 80); const database = this._network.analyticsInfluxDbDatabase; const username = this._network.analyticsInfluxDbUsername; const password = this._network.analyticsInfluxDbPassword; @@ -131,7 +133,7 @@ export abstract class InfluxDbClient { } }; - const influxDbClient = new InfluxDB({ protocol, port: 443, host, database, username, password, options }); + const influxDbClient = new InfluxDB({ protocol, port, host, database, username, password, options }); return influxDbClient.ping(1500).then((pingResults: IPingStats[]) => { if (pingResults.length > 0) { From a3ed15cae28b18ae0c53a93aae83383dafb77b9e Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 15 Jan 2024 16:02:04 +0100 Subject: [PATCH 3/3] chore: Add prettier configs (#939) * chore: Add prettier configs for client/api. Adjust eslint rules for line max-len * feat: add prettier and eslint config to root * chore: run format script * fix: trailing commas * fix: no mixed operators * feat: add ci and pre-commit * feat: add stylelint to lint staged * fix: scss files * fix: stylelint conflicts * fix: add missing ts config * chore: format * chore: undo format * chore: format files * fix: add missing installs * fix: ternaries * fix: add missing stylelint config * fix: reformat tsconfig.json * feat: set prettier in each folder * fix: add missing lint * fix: add missing lint in client * chore: commit tsconfig * fix: ci lint check * feat: add prettier eslint plugin * chore: add missing ignore file * chore: revert formatting on files * chore: revert formatting on eslintignore * chore: Remove eslint/max-len from api + Remove prettier plugins for eslint config (no prettier diagnostics) * chore: run lintstaged only on src * chore: Remove unused eslint-plugin-prettier from api/client * chore: run format * fix: sync configuration from stylelint * ci: simplify lint-check workflow --------- Co-authored-by: JCNoguera --- .github/workflows/pr-lint-check.yaml | 33 + .gitignore | 2 + .husky/pre-commit | 4 + api/.eslintignore | 3 + api/.eslintrc.js | 1762 +++----- api/.prettierignore | 10 + api/.prettierrc | 14 + api/package-lock.json | 964 ++++- api/package.json | 13 +- api/src/clients/coinGeckoClient.ts | 9 +- api/src/clients/fixerClient.ts | 2 +- api/src/clients/legacy/client.ts | 66 +- api/src/errors/networkConfigurationError.ts | 3 +- api/src/errors/nodeInfoError.ts | 3 +- api/src/index.ts | 31 +- api/src/initServices.ts | 125 +- api/src/logger.ts | 12 +- api/src/models/api/ICurrenciesResponse.ts | 1 - api/src/models/api/IFeedSubscribeRequest.ts | 1 - api/src/models/api/INetworkBoundGetRequest.ts | 1 - api/src/models/api/INetworkGetResponse.ts | 1 - .../identity/IIdentityDidResolveResponse.ts | 3 +- .../identity/IIdentityDiffHistoryResponse.ts | 2 +- .../models/api/legacy/IAddressGetRequest.ts | 1 - .../api/stardust/IAddressBalanceRequest.ts | 1 - .../stardust/IAddressDetailsWithBalance.ts | 3 +- api/src/models/api/stardust/IAliasRequest.ts | 1 - api/src/models/api/stardust/IAliasResponse.ts | 1 - .../api/stardust/IAssociationsRequestBody.ts | 1 - .../api/stardust/IAssociationsResponse.ts | 4 +- api/src/models/api/stardust/IBlockRequest.ts | 1 - api/src/models/api/stardust/IBlockResponse.ts | 1 - .../models/api/stardust/INodeInfoResponse.ts | 1 - .../api/stardust/ITaggedOutputsRequest.ts | 1 - .../api/stardust/ITaggedOutputsResponse.ts | 1 - .../stardust/basic/IBasicOutputsResponse.ts | 1 - .../chronicle/IAddressBalanceResponse.ts | 1 - .../chronicle/IRichestAddressesResponse.ts | 1 - .../chronicle/ITokenDistributionResponse.ts | 1 - .../ITransactionHistoryDownloadResponse.ts | 1 - .../chronicle/ITransactionHistoryRequest.ts | 1 - .../chronicle/ITransactionHistoryResponse.ts | 1 - .../models/api/stardust/feed/IFeedUpdate.ts | 1 - .../api/stardust/foundry/IFoundryRequest.ts | 1 - .../api/stardust/foundry/IFoundryResponse.ts | 1 - .../milestone/ILatestMilestonesResponse.ts | 1 - .../milestone/IMilestoneBlocksResponse.ts | 16 +- .../milestone/IMilestoneStatsRequest.ts | 1 - .../api/stardust/nft/INftDetailsRequest.ts | 1 - .../api/stardust/nft/INftDetailsResponse.ts | 1 - .../IParticipationEventPayload.ts | 2 +- .../IParticipationEventStatus.ts | 3 +- api/src/models/api/stats/IAnalyticStats.ts | 1 - .../api/stats/IMilestoneAnalyticStats.ts | 1 - api/src/models/app/IRoute.ts | 6 +- .../legacy/IFindTransactionsRequest.ts | 1 - .../legacy/IFindTransactionsResponse.ts | 1 - api/src/models/db/ICurrencyState.ts | 1 - api/src/models/db/networkType.ts | 12 +- api/src/models/db/protocolVersion.ts | 7 +- api/src/models/db/uiTheme.ts | 6 +- api/src/models/influx/IInfluxDbCache.ts | 23 +- api/src/models/influx/IInfluxTimedEntries.ts | 1 - api/src/models/services/IFeedService.ts | 4 +- .../stardust/IShimmerClaimedResponse.ts | 1 - api/src/models/zmq/zmqEvent.ts | 4 +- api/src/routes.ts | 168 +- api/src/routes/chrysalis/identity/diff/get.ts | 18 +- .../routes/chrysalis/identity/history/get.ts | 23 +- .../chrysalis/identity/resolution/get.ts | 25 +- api/src/routes/chrysalis/message/get.ts | 5 +- api/src/routes/chrysalis/milestone/get.ts | 7 +- api/src/routes/chrysalis/output/get.ts | 7 +- api/src/routes/chrysalis/search.ts | 5 +- .../chrysalis/transactionhistory/get.ts | 5 +- api/src/routes/currency/get.ts | 2 +- api/src/routes/feed/subscribe.ts | 36 +- api/src/routes/feed/unsubscribe.ts | 15 +- api/src/routes/legacy/address/get.ts | 7 +- api/src/routes/legacy/milestones/get.ts | 5 +- api/src/routes/legacy/transactions/get.ts | 10 +- api/src/routes/legacy/trytes/post.ts | 7 +- api/src/routes/networks/get.ts | 12 +- api/src/routes/node/info.ts | 5 +- .../stardust/address/balance/chronicle/get.ts | 10 +- .../routes/stardust/address/balance/get.ts | 6 +- .../stardust/address/distribution/get.ts | 10 +- .../stardust/address/outputs/alias/get.ts | 5 +- .../stardust/address/outputs/basic/get.ts | 6 +- .../stardust/address/outputs/nft/get.ts | 5 +- .../routes/stardust/address/richest/get.ts | 10 +- .../routes/stardust/alias/foundries/get.ts | 5 +- api/src/routes/stardust/alias/get.ts | 5 +- .../stardust/analytics/influx/daily/get.ts | 66 +- .../stardust/analytics/influx/stats/get.ts | 28 +- api/src/routes/stardust/block/children/get.ts | 9 +- api/src/routes/stardust/block/get.ts | 5 +- api/src/routes/stardust/block/metadata/get.ts | 5 +- api/src/routes/stardust/foundry/get.ts | 5 +- .../identity/resolution-stardust/get.ts | 14 +- .../routes/stardust/milestone/blocks/get.ts | 10 +- api/src/routes/stardust/milestone/get.ts | 10 +- .../routes/stardust/milestone/influx/get.ts | 24 +- .../routes/stardust/milestone/latest/get.ts | 6 +- api/src/routes/stardust/nft/get.ts | 5 +- .../routes/stardust/output/associated/post.ts | 4 +- api/src/routes/stardust/output/get.ts | 5 +- api/src/routes/stardust/output/tagged/get.ts | 6 +- .../stardust/participation/events/get.ts | 5 +- api/src/routes/stardust/search.ts | 5 +- api/src/routes/stardust/transaction/get.ts | 5 +- .../transactionhistory/download/post.ts | 9 +- .../routes/stardust/transactionhistory/get.ts | 10 +- api/src/routes/stats/get.ts | 10 +- api/src/services/amazonDynamoDbService.ts | 102 +- .../services/chrysalis/baseStatsService.ts | 6 +- .../chrysalis/chrysalisFeedService.ts | 7 +- .../chrysalis/chrysalisItemsService.ts | 63 +- .../chrysalis/chrysalisStatsService.ts | 2 +- api/src/services/currencyService.ts | 37 +- api/src/services/legacy/baseStatsService.ts | 6 +- api/src/services/legacy/legacyItemsService.ts | 64 +- api/src/services/legacy/legacyStatsService.ts | 6 +- api/src/services/legacy/zmqService.ts | 31 +- api/src/services/localStorageService.ts | 12 +- api/src/services/networkService.ts | 7 +- api/src/services/stardust/chronicleService.ts | 131 +- .../services/stardust/feed/stardustFeed.ts | 64 +- .../stardust/influx/influxDbClient.ts | 283 +- .../stardust/influx/influxDbService.ts | 71 +- .../services/stardust/influx/influxQueries.ts | 31 +- api/src/services/stardust/nodeInfoService.ts | 2 +- .../stardust/stats/baseStatsService.ts | 7 +- .../stardust/stats/stardustStatsService.ts | 8 +- api/src/utils/apiHelper.ts | 69 +- .../utils/chrysalis/chrysalisTangleHelper.ts | 104 +- .../chrysalis/extendedSingleNodeClient.ts | 7 +- api/src/utils/chrysalis/identityHelper.ts | 40 +- api/src/utils/convertUtils.ts | 18 +- api/src/utils/fetchHelper.ts | 33 +- api/src/utils/hexHelper.ts | 6 +- api/src/utils/legacy/legacyTangleHelper.ts | 64 +- .../utils/stardust/associatedOutputsHelper.ts | 112 +- api/src/utils/stardust/searchExecutor.ts | 192 +- api/src/utils/stardust/searchQueryBuilder.ts | 18 +- .../utils/stardust/stardustTangleHelper.ts | 257 +- api/src/utils/stardust/utils.ts | 7 +- api/src/utils/validationHelper.ts | 2 +- client/.prettierignore | 11 + client/.prettierrc | 14 + client/.stylelintrc.json | 5 +- client/package-lock.json | 1099 ++++- client/package.json | 15 +- client/src/app/App.scss | 52 +- client/src/app/App.tsx | 45 +- client/src/app/AppUtils.tsx | 77 +- client/src/app/components/AsyncComponent.tsx | 4 +- client/src/app/components/Confirmation.scss | 100 +- client/src/app/components/Confirmation.tsx | 44 +- client/src/app/components/CopyButton.scss | 50 +- client/src/app/components/CopyButton.tsx | 16 +- client/src/app/components/Currency.tsx | 18 +- client/src/app/components/CurrencyButton.scss | 162 +- client/src/app/components/CurrencyButton.tsx | 48 +- client/src/app/components/DataToggle.scss | 92 +- client/src/app/components/DataToggle.tsx | 50 +- client/src/app/components/Disclaimer.scss | 46 +- client/src/app/components/Disclaimer.tsx | 18 +- .../src/app/components/FeedMilestoneInfo.scss | 3 +- .../src/app/components/FeedMilestoneInfo.tsx | 2 +- client/src/app/components/FiatSelector.scss | 228 +- client/src/app/components/FiatSelector.tsx | 23 +- .../src/app/components/FiatSelectorState.ts | 1 - client/src/app/components/FiatValue.tsx | 23 +- client/src/app/components/Icon.scss | 28 +- client/src/app/components/Icon.tsx | 84 +- client/src/app/components/JsonViewer.scss | 34 +- client/src/app/components/JsonViewer.tsx | 3 +- client/src/app/components/Modal.scss | 196 +- client/src/app/components/Modal.tsx | 40 +- .../src/app/components/NetworkSwitcher.scss | 289 +- client/src/app/components/NetworkSwitcher.tsx | 25 +- client/src/app/components/NotFound.scss | 1 - client/src/app/components/NotFound.tsx | 5 +- client/src/app/components/Pagination.scss | 12 +- client/src/app/components/Pagination.tsx | 80 +- client/src/app/components/PaginationProps.ts | 2 - client/src/app/components/PaginationState.tsx | 2 +- .../app/components/ReceiptPayloadState.tsx | 1 - client/src/app/components/SearchInput.scss | 184 +- client/src/app/components/SearchInput.tsx | 72 +- client/src/app/components/Spinner.scss | 52 +- client/src/app/components/Spinner.tsx | 7 +- client/src/app/components/Switcher.scss | 98 +- client/src/app/components/Switcher.tsx | 7 +- client/src/app/components/Tooltip.scss | 2 +- client/src/app/components/Tooltip.tsx | 4 +- client/src/app/components/ValueButton.scss | 116 +- client/src/app/components/ValueButton.tsx | 14 +- .../components/chrysalis/Bech32Address.tsx | 30 +- client/src/app/components/chrysalis/Feeds.tsx | 69 +- .../components/chrysalis/InclusionState.tsx | 18 +- .../chrysalis/IndexationPayload.tsx | 14 +- .../chrysalis/MessageTangleState.scss | 100 +- .../chrysalis/MessageTangleState.tsx | 134 +- .../app/components/chrysalis/MessageTree.scss | 116 +- .../app/components/chrysalis/MessageTree.tsx | 138 +- .../components/chrysalis/MessageTreeProps.tsx | 1 - .../chrysalis/MilestonePayload.scss | 92 +- .../components/chrysalis/MilestonePayload.tsx | 105 +- client/src/app/components/chrysalis/QR.tsx | 10 +- .../components/chrysalis/ReceiptPayload.tsx | 82 +- .../app/components/chrysalis/Transaction.scss | 202 +- .../app/components/chrysalis/Transaction.tsx | 139 +- .../chrysalis/TransactionPayload.scss | 126 +- .../chrysalis/TransactionPayload.tsx | 88 +- .../chrysalis/TransactionPayloadState.tsx | 1 - client/src/app/components/footer/Footer.scss | 314 +- client/src/app/components/footer/Footer.tsx | 42 +- .../app/components/footer/ShimmerFooter.scss | 352 +- .../app/components/footer/ShimmerFooter.tsx | 34 +- client/src/app/components/header/Header.scss | 725 ++-- client/src/app/components/header/Header.tsx | 200 +- .../src/app/components/header/HeaderState.ts | 3 +- .../src/app/components/hoc/TabbedSection.scss | 5 +- .../src/app/components/hoc/TabbedSection.tsx | 56 +- .../identity/IdentityChrysalisResolver.scss | 182 +- .../identity/IdentityChrysalisResolver.tsx | 109 +- .../identity/IdentityCompareDropdown.scss | 290 +- .../identity/IdentityCompareDropdown.tsx | 41 +- .../identity/IdentityCompareDropdownState.ts | 1 - .../components/identity/IdentityHistory.scss | 44 +- .../components/identity/IdentityHistory.tsx | 38 +- .../identity/IdentityHistoryState.ts | 1 - .../identity/IdentityJsonCompare.scss | 198 +- .../identity/IdentityJsonCompare.tsx | 97 +- .../identity/IdentityJsonCompareProps.ts | 1 - .../identity/IdentityMsgIdOverview.scss | 68 +- .../identity/IdentityMsgStatusIcon.tsx | 5 +- .../identity/IdentityMsgStatusIconProps.ts | 2 +- .../identity/IdentitySearchInput.scss | 104 +- .../identity/IdentitySearchInput.tsx | 19 +- .../identity/IdentityStardustResolver.scss | 41 +- .../identity/IdentityStardustResolver.tsx | 207 +- .../identity/IdentityStardustResolverProps.ts | 5 +- .../domains/IdentityDomainResolver.scss | 2 +- .../domains/IdentityDomainResolver.tsx | 80 +- .../domains/IdentityDomainResolverState.ts | 11 +- .../identity/tree/IdentityTree.scss | 16 +- .../components/identity/tree/IdentityTree.tsx | 8 +- .../identity/tree/IdentityTreeItem.scss | 372 +- .../identity/tree/IdentityTreeItem.tsx | 114 +- client/src/app/components/legacy/Feeds.tsx | 69 +- .../components/stardust/DownloadModal.scss | 192 +- .../app/components/stardust/DownloadModal.tsx | 44 +- .../src/app/components/stardust/Feature.tsx | 36 +- .../components/stardust/InclusionState.tsx | 16 +- client/src/app/components/stardust/Input.tsx | 23 +- .../app/components/stardust/NativeToken.tsx | 31 +- .../src/app/components/stardust/Output.scss | 3 +- client/src/app/components/stardust/Output.tsx | 178 +- .../app/components/stardust/OutputProps.tsx | 2 +- .../app/components/stardust/TruncatedId.tsx | 32 +- .../components/stardust/UnlockCondition.tsx | 94 +- .../src/app/components/stardust/Unlocks.tsx | 78 +- .../components/stardust/address/Address.tsx | 9 +- .../stardust/address/AddressBalance.scss | 4 +- .../stardust/address/AddressBalance.tsx | 36 +- .../stardust/address/Bech32Address.tsx | 30 +- .../section/AddressPageTabbedSections.tsx | 161 +- .../address/section/FeaturesSection.tsx | 6 +- .../section/alias/AliasFoundriesSection.scss | 15 +- .../section/alias/AliasFoundriesSection.tsx | 10 +- .../section/alias/AliasStateSection.tsx | 6 +- .../association/AssociatedOutputs.scss | 11 +- .../section/association/AssociatedOutputs.tsx | 63 +- .../association/AssociatedOutputsUtils.ts | 25 +- .../association/AssociationSection.tsx | 178 +- .../address/section/did/DidSection.tsx | 10 +- .../address/section/native-tokens/Asset.tsx | 98 +- .../section/native-tokens/AssetsTable.scss | 2 +- .../section/native-tokens/AssetsTable.tsx | 91 +- .../address/section/nft/ImagePlaceholder.scss | 3 +- .../address/section/nft/ImagePlaceholder.tsx | 12 +- .../stardust/address/section/nft/Nft.tsx | 54 +- .../section/nft/NftMetadataSection.scss | 4 +- .../section/nft/NftMetadataSection.tsx | 107 +- .../address/section/nft/NftMetadataUtils.tsx | 36 +- .../address/section/nft/NftSection.scss | 12 +- .../address/section/nft/NftSection.tsx | 69 +- .../address/section/voting/VotingEvent.scss | 4 +- .../address/section/voting/VotingEvent.tsx | 41 +- .../address/section/voting/VotingSection.scss | 3 +- .../address/section/voting/VotingSection.tsx | 17 +- .../address/section/voting/VotingUtils.ts | 9 +- .../stardust/block/BlockTangleState.scss | 1 - .../stardust/block/BlockTangleState.tsx | 84 +- .../stardust/block/BlockTangleStateProps.ts | 1 - .../stardust/block/MilestoneControls.scss | 1 - .../stardust/block/MilestoneControls.tsx | 9 +- .../stardust/block/payload/ReceiptPayload.tsx | 88 +- .../block/payload/TaggedDataPayload.tsx | 15 +- .../block/payload/TaggedDataPayloadProps.tsx | 1 - .../block/payload/TaggedDataPayloadState.tsx | 1 - .../block/payload/TransactionPayload.scss | 229 +- .../block/payload/TransactionPayload.tsx | 7 +- .../block/payload/TransactionPayloadProps.tsx | 1 - .../payload/milestone/MilestonePayload.scss | 3 +- .../payload/milestone/MilestonePayload.tsx | 53 +- .../milestone/MilestoneSignaturesSection.scss | 1 - .../milestone/MilestoneSignaturesSection.tsx | 6 +- .../block/section/BlockMetadataSection.tsx | 58 +- .../block/section/BlockPayloadSection.tsx | 56 +- .../ReferencedBlocksSection.scss | 3 +- .../ReferencedBlocksSection.tsx | 20 +- .../ReferencedBlocksSectionRow.tsx | 109 +- .../stardust/foundry/TokenInfoSection.scss | 6 +- .../stardust/foundry/TokenInfoSection.tsx | 65 +- .../stardust/history/TransactionCard.tsx | 60 +- .../stardust/history/TransactionEntryProps.ts | 1 - .../stardust/history/TransactionHistory.scss | 5 +- .../stardust/history/TransactionHistory.tsx | 50 +- .../stardust/history/TransactionRow.tsx | 50 +- .../stardust/statistics/ChartHeader.scss | 14 +- .../stardust/statistics/ChartHeader.tsx | 13 +- .../stardust/statistics/ChartInfoPanel.tsx | 20 +- .../stardust/statistics/ChartLegend.tsx | 11 +- .../stardust/statistics/ChartTooltip.scss | 6 +- .../stardust/statistics/ChartTooltip.tsx | 7 +- .../stardust/statistics/ChartUtils.tsx | 94 +- .../stardust/statistics/InfluxChartsTab.tsx | 24 +- .../stardust/statistics/RichestAddresses.scss | 3 +- .../stardust/statistics/RichestAddresses.tsx | 18 +- .../statistics/TokenDistributionTab.tsx | 22 +- .../stardust/statistics/charts/BarChart.tsx | 82 +- .../stardust/statistics/charts/Chart.scss | 5 +- .../stardust/statistics/charts/LineChart.tsx | 86 +- .../statistics/charts/RangeBarChart.scss | 6 +- .../statistics/charts/RangeBarChart.tsx | 50 +- .../statistics/charts/StackedBarChart.tsx | 95 +- .../statistics/charts/StackedLineChart.tsx | 130 +- client/src/app/context/NetworkContext.ts | 34 +- client/src/app/routes.tsx | 186 +- client/src/app/routes/IdentityResolver.scss | 147 +- client/src/app/routes/IdentityResolver.tsx | 35 +- client/src/app/routes/Search.scss | 64 +- client/src/app/routes/StreamsV0.scss | 136 +- client/src/app/routes/StreamsV0.tsx | 163 +- client/src/app/routes/chrysalis/Addr.scss | 396 +- client/src/app/routes/chrysalis/Addr.tsx | 138 +- client/src/app/routes/chrysalis/AddrState.ts | 1 - client/src/app/routes/chrysalis/Indexed.scss | 186 +- client/src/app/routes/chrysalis/Indexed.tsx | 97 +- .../src/app/routes/chrysalis/IndexedState.ts | 10 +- client/src/app/routes/chrysalis/Landing.scss | 2 - client/src/app/routes/chrysalis/Landing.tsx | 355 +- client/src/app/routes/chrysalis/Message.scss | 100 +- client/src/app/routes/chrysalis/Message.tsx | 217 +- client/src/app/routes/chrysalis/Search.tsx | 239 +- .../src/app/routes/chrysalis/Visualizer.scss | 244 +- .../src/app/routes/chrysalis/Visualizer.tsx | 258 +- client/src/app/routes/legacy/Address.scss | 224 +- client/src/app/routes/legacy/Address.tsx | 289 +- client/src/app/routes/legacy/Bundle.scss | 124 +- client/src/app/routes/legacy/Bundle.tsx | 346 +- client/src/app/routes/legacy/Landing.scss | 2 - client/src/app/routes/legacy/Landing.tsx | 242 +- client/src/app/routes/legacy/Search.tsx | 252 +- client/src/app/routes/legacy/Tag.scss | 100 +- client/src/app/routes/legacy/Tag.tsx | 274 +- client/src/app/routes/legacy/Transaction.scss | 246 +- client/src/app/routes/legacy/Transaction.tsx | 413 +- client/src/app/routes/legacy/Visualizer.scss | 244 +- client/src/app/routes/legacy/Visualizer.tsx | 252 +- .../src/app/routes/stardust/AddressPage.scss | 476 +-- .../src/app/routes/stardust/AddressPage.tsx | 57 +- .../src/app/routes/stardust/AddressState.ts | 99 +- client/src/app/routes/stardust/Block.scss | 138 +- client/src/app/routes/stardust/Block.tsx | 182 +- client/src/app/routes/stardust/BlockState.ts | 1 - client/src/app/routes/stardust/Foundry.tsx | 83 +- .../app/routes/stardust/NftRedirectRoute.tsx | 14 +- .../src/app/routes/stardust/OutputList.scss | 3 +- client/src/app/routes/stardust/OutputList.tsx | 47 +- .../src/app/routes/stardust/OutputPage.scss | 18 +- client/src/app/routes/stardust/OutputPage.tsx | 318 +- client/src/app/routes/stardust/Search.tsx | 213 +- .../app/routes/stardust/TransactionPage.tsx | 155 +- .../src/app/routes/stardust/Visualizer.scss | 544 +-- client/src/app/routes/stardust/Visualizer.tsx | 166 +- .../stardust/landing/AnalyticStats.scss | 1 - .../routes/stardust/landing/AnalyticStats.tsx | 102 +- .../app/routes/stardust/landing/InfoBox.scss | 1 - .../app/routes/stardust/landing/InfoBox.tsx | 26 +- .../app/routes/stardust/landing/Landing.scss | 5 +- .../app/routes/stardust/landing/Landing.tsx | 33 +- .../stardust/landing/MilestoneFeed.scss | 24 +- .../routes/stardust/landing/MilestoneFeed.tsx | 30 +- .../landing/MilestoneFeedAnalytics.tsx | 27 +- .../landing/ShimmerClaimedUtils.spec.ts | 20 +- .../stardust/landing/ShimmerClaimedUtils.ts | 18 +- .../stardust/statistics/StatisticsPage.scss | 7 +- .../stardust/statistics/StatisticsPage.tsx | 15 +- .../modals/chrysalis/address/main-header.json | 2 +- .../address/transaction-history.json | 10 +- .../chrysalis/message/indexation-payload.json | 10 +- .../modals/chrysalis/message/main-header.json | 10 +- .../chrysalis/message/milestone-payload.json | 10 +- .../message/transaction-payload.json | 10 +- .../assets/modals/chrysalis/message/tree.json | 10 +- .../modals/identity-resolver/content.json | 10 +- .../modals/identity-resolver/welcome.json | 10 +- .../modals/legacy/search/main-header.json | 2 +- .../stardust/address/assets-in-wallet.json | 12 +- .../stardust/address/associated-outputs.json | 2 +- .../modals/stardust/address/main-header.json | 12 +- .../stardust/address/nfts-in-wallet.json | 12 +- .../stardust/address/transaction-history.json | 6 +- .../src/assets/modals/stardust/alias/did.json | 10 +- .../modals/stardust/alias/foundries.json | 10 +- .../modals/stardust/alias/main-header.json | 10 +- .../assets/modals/stardust/alias/state.json | 10 +- .../modals/stardust/block/main-header.json | 10 +- .../modals/stardust/block/metadata.json | 6 +- .../stardust/block/milestone-payload.json | 10 +- .../block/milestone-referenced-blocks.json | 1 - .../stardust/block/tagged-data-payload.json | 10 +- .../stardust/block/transaction-payload.json | 10 +- .../modals/stardust/foundry/main-header.json | 10 +- .../modals/stardust/nft/main-header.json | 10 +- .../assets/modals/stardust/nft/metadata.json | 8 +- .../modals/stardust/output/main-header.json | 10 +- .../stardust/participation/main-header.json | 10 +- .../modals/stardust/search/main-header.json | 2 +- .../modals/stardust/statistics/graphs.json | 132 +- .../stardust/transaction/main-header.json | 10 +- .../assets/modals/visualizer/main-header.json | 2 +- .../src/assets/schemas/nft-schema-IRC27.json | 15 +- .../assets/schemas/token-schema-IRC30.json | 84 +- client/src/helpers/bigDecimal.ts | 27 +- .../helpers/chrysalis/bech32AddressHelper.ts | 5 +- .../helpers/chrysalis/transactionsHelper.ts | 92 +- client/src/helpers/downloadHelper.ts | 2 +- client/src/helpers/fetchHelper.ts | 61 +- client/src/helpers/foundationDataHelper.tsx | 25 +- .../helpers/hooks/useAddressAliasOutputs.ts | 22 +- client/src/helpers/hooks/useAddressBalance.ts | 7 +- .../helpers/hooks/useAddressBasicOutputs.ts | 22 +- client/src/helpers/hooks/useAddressHistory.ts | 22 +- .../src/helpers/hooks/useAddressNftOutputs.ts | 22 +- .../src/helpers/hooks/useAliasContainsDID.ts | 7 +- .../hooks/useAliasControlledFoundries.ts | 68 +- client/src/helpers/hooks/useAliasDetails.ts | 31 +- .../src/helpers/hooks/useAssociatedOutputs.ts | 31 +- client/src/helpers/hooks/useBlock.ts | 32 +- client/src/helpers/hooks/useBlockChildren.ts | 32 +- client/src/helpers/hooks/useBlockFeed.ts | 14 +- client/src/helpers/hooks/useBlockMetadata.ts | 12 +- client/src/helpers/hooks/useChartsState.ts | 68 +- .../helpers/hooks/useChronicleAnalytics.ts | 17 +- .../src/helpers/hooks/useCurrencyService.ts | 34 +- client/src/helpers/hooks/useFoundryDetails.ts | 32 +- .../src/helpers/hooks/useInputsAndOutputs.ts | 25 +- client/src/helpers/hooks/useIsMounted.ts | 1 - .../src/helpers/hooks/useMilestoneDetails.ts | 10 +- .../src/helpers/hooks/useMilestoneInterval.ts | 1 - .../hooks/useMilestoneReferencedBlock.ts | 32 +- client/src/helpers/hooks/useMilestoneStats.ts | 29 +- client/src/helpers/hooks/useNetworkConfig.ts | 10 +- client/src/helpers/hooks/useNetworkStats.ts | 47 +- client/src/helpers/hooks/useNftDetails.ts | 101 +- client/src/helpers/hooks/useNftMetadataUri.ts | 6 +- client/src/helpers/hooks/useOutputDetails.ts | 41 +- client/src/helpers/hooks/useOutputsDetails.ts | 53 +- .../hooks/useParticipationEventDetails.ts | 47 +- client/src/helpers/hooks/useResolvedDID.ts | 32 +- client/src/helpers/hooks/useTaggedOutputs.ts | 117 +- .../hooks/useTokenDistributionState.ts | 40 +- .../hooks/useTokenRegistryNativeTokenCheck.ts | 9 +- .../helpers/hooks/useTokenRegistryNftCheck.ts | 10 +- .../hooks/useTransactionHistoryDownload.ts | 45 +- .../hooks/useTransactionIncludedBlock.ts | 32 +- .../src/helpers/hooks/useVisualizerState.tsx | 95 +- client/src/helpers/identityHelper.ts | 41 +- client/src/helpers/jsonSyntaxHelper.ts | 10 +- client/src/helpers/networkHelper.ts | 12 +- client/src/helpers/nodeShader.ts | 29 +- client/src/helpers/numberHelper.ts | 2 - client/src/helpers/pageUtils.ts | 3 +- client/src/helpers/routeBuilder.ts | 23 +- client/src/helpers/stardust/base64Encode.ts | 11 +- .../helpers/stardust/bech32AddressHelper.ts | 21 +- client/src/helpers/stardust/bigIntHelper.ts | 8 +- client/src/helpers/stardust/convertUtils.ts | 18 +- client/src/helpers/stardust/crypto.ts | 20 +- client/src/helpers/stardust/hexHelper.ts | 6 +- client/src/helpers/stardust/ipfsHelper.ts | 9 +- client/src/helpers/stardust/metadataUtils.ts | 2 +- .../helpers/stardust/participationUtils.ts | 2 +- .../src/helpers/stardust/readStreamUtils.ts | 5 +- .../src/helpers/stardust/statisticsUtils.ts | 176 +- .../helpers/stardust/transactionsHelper.ts | 107 +- .../stardust/valueFormatHelper.spec.ts | 13 +- .../helpers/stardust/valueFormatHelper.tsx | 11 +- client/src/helpers/textHelper.ts | 9 +- client/src/helpers/trytesHelper.ts | 7 +- client/src/index.scss | 98 +- client/src/index.tsx | 41 +- client/src/models/IMilestoneFeedItem.ts | 1 - client/src/models/api/ICurrenciesResponse.ts | 1 - .../models/api/IIdentityDidHistoryResponse.ts | 1 - .../models/api/IIdentityDidResolveRequest.ts | 1 - .../api/IIdentityDiffHistoryResponse.ts | 1 - .../models/api/IIdentityResolveResponse.ts | 3 +- .../src/models/api/INetworkBoundGetRequest.ts | 1 - client/src/models/api/IRawResponse.ts | 1 - .../models/api/legacy/IAddressGetRequest.ts | 1 - .../src/models/api/stardust/IAliasRequest.ts | 1 - .../src/models/api/stardust/IAliasResponse.ts | 1 - .../api/stardust/IAssociationsResponse.ts | 3 +- client/src/models/api/stardust/IInput.ts | 1 - .../api/stardust/ILatestMilestonesReponse.ts | 1 - .../api/stardust/IMilestoneBlocksResponse.ts | 1 - .../api/stardust/IMilestoneDetailsResponse.ts | 1 - .../api/stardust/IMilestoneStatsRequest.ts | 1 - .../models/api/stardust/INodeInfoResponse.ts | 1 - client/src/models/api/stardust/IOutput.ts | 1 - .../api/stardust/ITaggedOutputsRequest.ts | 1 - .../api/stardust/ITaggedOutputsResponse.ts | 1 - .../stardust/ITransactionHistoryRequest.ts | 1 - .../stardust/ITransactionHistoryResponse.ts | 1 - .../address/IAddressBalanceRequest.ts | 1 - .../address/IAddressBalanceResponse.ts | 1 - .../address/IAddressDetailsRequest.ts | 1 - .../address/IAddressDetailsWithBalance.ts | 3 +- .../stardust/basic/IBasicOutputsResponse.ts | 1 - .../api/stardust/block/IBlockRequest.ts | 1 - .../api/stardust/block/IBlockResponse.ts | 1 - .../chronicle/IRichestAddressesResponse.ts | 1 - .../chronicle/ITokenDistributionResponse.ts | 1 - .../stardust/feed/IFeedSubscribeRequest.ts | 1 - .../models/api/stardust/feed/IFeedUpdate.ts | 1 - .../api/stardust/foundry/IFoundryRequest.ts | 1 - .../api/stardust/foundry/IFoundryResponse.ts | 1 - .../src/models/api/stardust/foundry/IToken.ts | 1 - .../api/stardust/foundry/ITokenMetadata.ts | 1 - .../stardust/influx/IInfluxDailyResponse.ts | 1 - .../api/stardust/nft/INftDetailsRequest.ts | 1 - .../api/stardust/nft/INftDetailsResponse.ts | 1 - .../IParticipationEventPayload.ts | 2 +- .../IParticipationEventStatus.ts | 3 +- client/src/models/api/stats/IAnalyticStats.ts | 1 - .../api/stats/IMilestoneAnalyticStats.ts | 1 - client/src/models/config/networkType.ts | 17 +- client/src/models/config/protocolVersion.ts | 6 +- client/src/models/confirmationState.ts | 9 +- client/src/models/graph/stardust/INodeData.ts | 1 - client/src/models/identityMsgStatus.ts | 6 +- client/src/models/services/IFilterSettings.ts | 2 - client/src/models/services/ISettings.ts | 1 - client/src/models/services/filterField.ts | 7 +- .../services/stardust/IFilterSettings.ts | 2 - client/src/models/tangleStatus.ts | 24 +- client/src/scss/buttons.scss | 76 +- client/src/scss/card.scss | 712 ++-- client/src/scss/fonts.scss | 44 +- client/src/scss/forms.scss | 378 +- client/src/scss/layout.scss | 170 +- client/src/scss/media-queries.scss | 18 +- client/src/scss/mixins.scss | 14 +- client/src/scss/section.scss | 210 +- client/src/scss/themes.scss | 256 +- client/src/services/apiClient.ts | 11 +- .../services/chrysalis/chrysalisApiClient.ts | 25 +- .../chrysalis/chrysalisApiStreamsV0Client.ts | 6 +- .../services/chrysalis/chrysalisFeedClient.ts | 44 +- .../chrysalis/chrysalisTangleCacheService.ts | 99 +- client/src/services/currencyService.ts | 123 +- client/src/services/feedClient.ts | 1 - .../services/identityDiffStorageService.ts | 1 - client/src/services/identityService.ts | 2 +- client/src/services/legacy/legacyApiClient.ts | 12 +- .../legacy/legacyApiStreamsV0Client.ts | 23 +- .../src/services/legacy/legacyFeedClient.ts | 41 +- .../legacy/legacyTangleCacheService.ts | 146 +- client/src/services/networkService.ts | 1 - client/src/services/nodeInfoService.ts | 3 +- client/src/services/settingsService.ts | 2 +- client/src/services/stardust/ipfsClient.ts | 14 +- .../services/stardust/stardustApiClient.ts | 140 +- .../services/stardust/stardustFeedClient.ts | 46 +- .../services/stardust/tokenRegistryClient.ts | 9 +- client/src/services/tangleCacheService.ts | 5 +- package-lock.json | 3635 +++++++++++++---- package.json | 38 +- 595 files changed, 18316 insertions(+), 17792 deletions(-) create mode 100644 .github/workflows/pr-lint-check.yaml create mode 100755 .husky/pre-commit create mode 100644 api/.prettierignore create mode 100644 api/.prettierrc create mode 100644 client/.prettierignore create mode 100644 client/.prettierrc diff --git a/.github/workflows/pr-lint-check.yaml b/.github/workflows/pr-lint-check.yaml new file mode 100644 index 000000000..82cfb84bb --- /dev/null +++ b/.github/workflows/pr-lint-check.yaml @@ -0,0 +1,33 @@ +name: Format & Lint Check + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + lint-check: + strategy: + fail-fast: false + matrix: + project: [api, client] + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ matrix.project }} + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "16" + + - name: Install Dependencies + run: npm install + + - name: Format Check + run: npm run format:check + + - name: Lint Check + run: npm run lint:check + diff --git a/.gitignore b/.gitignore index 78086f34b..163f1afd7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ config.local.feed.json config.staging.json config.prod.json env.js + +**/.eslintcache diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..146c0dfd0 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged --allow-empty diff --git a/api/.eslintignore b/api/.eslintignore index c03015788..2e5e259d6 100644 --- a/api/.eslintignore +++ b/api/.eslintignore @@ -1,2 +1,5 @@ .eslintrc.js *.d.ts + +dist/** +node_modules/** diff --git a/api/.eslintrc.js b/api/.eslintrc.js index 66bd39e0a..84e3ba85a 100644 --- a/api/.eslintrc.js +++ b/api/.eslintrc.js @@ -1,9 +1,9 @@ module.exports = { - "env": { - "browser": true, - "node": true + env: { + browser: true, + node: true, }, - "extends": [ + extends: [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", @@ -11,1334 +11,488 @@ module.exports = { "plugin:import/warnings", "plugin:import/typescript", "plugin:jsdoc/recommended", - "plugin:unicorn/recommended" + "plugin:unicorn/recommended", ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "tsconfigRootDir": __dirname, - "sourceType": "module" + parser: "@typescript-eslint/parser", + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: __dirname, + sourceType: "module", }, - "plugins": [ - "@typescript-eslint", - "import", - "jsdoc", - "unicorn" - ], - "rules": { - "@typescript-eslint/adjacent-overload-signatures": [ - "error" - ], - "@typescript-eslint/array-type": [ - "error" - ], - "@typescript-eslint/await-thenable": [ - "error" - ], - "@typescript-eslint/ban-ts-comment": [ - "error" - ], - "@typescript-eslint/ban-types": [ - "error" - ], - "@typescript-eslint/brace-style": [ - "error" - ], - "@typescript-eslint/class-literal-property-style": [ - "error" - ], - "@typescript-eslint/comma-spacing": [ - "error" - ], - "@typescript-eslint/consistent-type-assertions": [ - "error" - ], - "@typescript-eslint/consistent-type-definitions": [ - "error" - ], - "@typescript-eslint/default-param-last": [ - "error" - ], - "@typescript-eslint/dot-notation": [ - "error" - ], - "@typescript-eslint/explicit-function-return-type": [ - "off" - ], + plugins: ["@typescript-eslint", "import", "jsdoc", "unicorn"], + rules: { + "@typescript-eslint/adjacent-overload-signatures": ["error"], + "@typescript-eslint/array-type": ["error"], + "@typescript-eslint/await-thenable": ["error"], + "@typescript-eslint/ban-ts-comment": ["error"], + "@typescript-eslint/ban-types": ["error"], + "@typescript-eslint/brace-style": ["error"], + "@typescript-eslint/class-literal-property-style": ["error"], + "@typescript-eslint/comma-spacing": ["error"], + "@typescript-eslint/consistent-type-assertions": ["error"], + "@typescript-eslint/consistent-type-definitions": ["error"], + "@typescript-eslint/default-param-last": ["error"], + "@typescript-eslint/dot-notation": ["error"], + "@typescript-eslint/explicit-function-return-type": ["off"], "@typescript-eslint/explicit-member-accessibility": [ "error", { - "overrides": { - "constructors": "no-public" - } - } - ], - "@typescript-eslint/explicit-module-boundary-types": [ - "off" - ], - "@typescript-eslint/func-call-spacing": [ - "error" - ], - "@typescript-eslint/indent": [ - "off" - ], - "@typescript-eslint/init-declarations": [ - "off" - ], - "@typescript-eslint/keyword-spacing": [ - "error" - ], - "@typescript-eslint/lines-between-class-members": [ - "error" - ], - "@typescript-eslint/member-delimiter-style": [ - "error" - ], - "@typescript-eslint/member-ordering": [ - "error" - ], - "@typescript-eslint/method-signature-style": [ - "off" - ], + overrides: { + constructors: "no-public", + }, + }, + ], + "@typescript-eslint/explicit-module-boundary-types": ["off"], + "@typescript-eslint/func-call-spacing": ["error"], + "@typescript-eslint/indent": ["off"], + "@typescript-eslint/init-declarations": ["off"], + "@typescript-eslint/keyword-spacing": ["error"], + "@typescript-eslint/lines-between-class-members": ["error"], + "@typescript-eslint/member-delimiter-style": ["error"], + "@typescript-eslint/member-ordering": ["error"], + "@typescript-eslint/method-signature-style": ["off"], "@typescript-eslint/naming-convention": [ "error", { - "selector": "variable", - "format": [ - "camelCase", - "UPPER_CASE" - ] - } - ], - "@typescript-eslint/no-array-constructor": [ - "error" - ], - "@typescript-eslint/no-base-to-string": [ - "error" - ], - "@typescript-eslint/no-dupe-class-members": [ - "error" - ], - "@typescript-eslint/no-dynamic-delete": [ - "off" - ], - "@typescript-eslint/no-empty-function": [ - "off" - ], - "@typescript-eslint/no-empty-interface": [ - "error" - ], - "@typescript-eslint/no-explicit-any": [ - "error" - ], - "@typescript-eslint/no-extra-non-null-assertion": [ - "error" - ], - "@typescript-eslint/no-extra-parens": [ - "off" - ], - "@typescript-eslint/no-extra-semi": [ - "error" - ], - "@typescript-eslint/no-extraneous-class": [ - "off" - ], - "@typescript-eslint/no-floating-promises": [ - "error" - ], - "@typescript-eslint/no-for-in-array": [ - "error" - ], - "@typescript-eslint/no-implied-eval": [ - "error" - ], - "@typescript-eslint/no-inferrable-types": [ - "off" - ], - "@typescript-eslint/no-invalid-this": [ - "error" - ], - "@typescript-eslint/no-invalid-void-type": [ - "error" - ], - "@typescript-eslint/no-magic-numbers": [ - "off" - ], - "@typescript-eslint/no-misused-new": [ - "error" - ], + selector: "variable", + format: ["camelCase", "UPPER_CASE"], + }, + ], + "@typescript-eslint/no-array-constructor": ["error"], + "@typescript-eslint/no-base-to-string": ["error"], + "@typescript-eslint/no-dupe-class-members": ["error"], + "@typescript-eslint/no-dynamic-delete": ["off"], + "@typescript-eslint/no-empty-function": ["off"], + "@typescript-eslint/no-empty-interface": ["error"], + "@typescript-eslint/no-explicit-any": ["error"], + "@typescript-eslint/no-extra-non-null-assertion": ["error"], + "@typescript-eslint/no-extra-parens": ["off"], + "@typescript-eslint/no-extra-semi": ["error"], + "@typescript-eslint/no-extraneous-class": ["off"], + "@typescript-eslint/no-floating-promises": ["error"], + "@typescript-eslint/no-for-in-array": ["error"], + "@typescript-eslint/no-implied-eval": ["error"], + "@typescript-eslint/no-inferrable-types": ["off"], + "@typescript-eslint/no-invalid-this": ["error"], + "@typescript-eslint/no-invalid-void-type": ["error"], + "@typescript-eslint/no-magic-numbers": ["off"], + "@typescript-eslint/no-misused-new": ["error"], "@typescript-eslint/no-misused-promises": [ "error", { - "checksVoidReturn": false - } - ], - "@typescript-eslint/no-namespace": [ - "error" - ], - "@typescript-eslint/no-non-null-asserted-optional-chain": [ - "error" - ], - "@typescript-eslint/no-non-null-assertion": [ - "error" - ], - "@typescript-eslint/no-parameter-properties": [ - "off" - ], - "@typescript-eslint/no-require-imports": [ - "error" - ], - "@typescript-eslint/no-this-alias": [ - "error" - ], - "@typescript-eslint/no-throw-literal": [ - "error" - ], - "@typescript-eslint/no-type-alias": [ - "off" - ], - "@typescript-eslint/no-unnecessary-boolean-literal-compare": [ - "error" - ], - "@typescript-eslint/no-unnecessary-condition": [ - "off" - ], - "@typescript-eslint/no-unnecessary-qualifier": [ - "error" - ], - "@typescript-eslint/no-unnecessary-type-arguments": [ - "error" - ], - "@typescript-eslint/no-unnecessary-type-assertion": [ - "error" - ], - "@typescript-eslint/no-unsafe-assignment": [ - "off" - ], - "@typescript-eslint/no-unsafe-call": [ - "off" - ], - "@typescript-eslint/no-unsafe-member-access": [ - "off" - ], - "@typescript-eslint/no-unsafe-return": [ - "error" - ], - "@typescript-eslint/no-unused-expressions": [ - "error" - ], + checksVoidReturn: false, + }, + ], + "@typescript-eslint/no-namespace": ["error"], + "@typescript-eslint/no-non-null-asserted-optional-chain": ["error"], + "@typescript-eslint/no-non-null-assertion": ["error"], + "@typescript-eslint/no-parameter-properties": ["off"], + "@typescript-eslint/no-require-imports": ["error"], + "@typescript-eslint/no-this-alias": ["error"], + "@typescript-eslint/no-throw-literal": ["error"], + "@typescript-eslint/no-type-alias": ["off"], + "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"], + "@typescript-eslint/no-unnecessary-condition": ["off"], + "@typescript-eslint/no-unnecessary-qualifier": ["error"], + "@typescript-eslint/no-unnecessary-type-arguments": ["error"], + "@typescript-eslint/no-unnecessary-type-assertion": ["error"], + "@typescript-eslint/no-unsafe-assignment": ["off"], + "@typescript-eslint/no-unsafe-call": ["off"], + "@typescript-eslint/no-unsafe-member-access": ["off"], + "@typescript-eslint/no-unsafe-return": ["error"], + "@typescript-eslint/no-unused-expressions": ["error"], "@typescript-eslint/no-unused-vars": [ "error", { - "args": "none" - } - ], - "@typescript-eslint/no-unused-vars-experimental": [ - "off" - ], - "@typescript-eslint/no-use-before-define": [ - "off" - ], - "@typescript-eslint/no-useless-constructor": [ - "error" - ], - "@typescript-eslint/no-var-requires": [ - "error" - ], - "@typescript-eslint/prefer-as-const": [ - "error" - ], - "@typescript-eslint/prefer-for-of": [ - "off" - ], - "@typescript-eslint/prefer-function-type": [ - "error" - ], - "@typescript-eslint/prefer-includes": [ - "error" - ], - "@typescript-eslint/prefer-namespace-keyword": [ - "error" - ], - "@typescript-eslint/prefer-nullish-coalescing": [ - "off", - ], - "@typescript-eslint/prefer-optional-chain": [ - "error" - ], - "@typescript-eslint/prefer-readonly": [ - "error" - ], - "@typescript-eslint/prefer-readonly-parameter-types": [ - "off" - ], - "@typescript-eslint/prefer-reduce-type-parameter": [ - "error" - ], - "@typescript-eslint/prefer-regexp-exec": [ - "error" - ], - "@typescript-eslint/prefer-string-starts-ends-with": [ - "error" - ], - "@typescript-eslint/prefer-ts-expect-error": [ - "error" - ], - "@typescript-eslint/promise-function-async": [ - "error" - ], - "@typescript-eslint/quotes": [ - "error" - ], - "@typescript-eslint/require-array-sort-compare": [ - "off" - ], - "@typescript-eslint/require-await": [ - "off" - ], - "@typescript-eslint/restrict-plus-operands": [ - "error" - ], - "@typescript-eslint/restrict-template-expressions": [ - "off" - ], - "@typescript-eslint/return-await": [ - "error" - ], - "@typescript-eslint/semi": [ - "error" - ], + args: "none", + }, + ], + "@typescript-eslint/no-unused-vars-experimental": ["off"], + "@typescript-eslint/no-use-before-define": ["off"], + "@typescript-eslint/no-useless-constructor": ["error"], + "@typescript-eslint/no-var-requires": ["error"], + "@typescript-eslint/prefer-as-const": ["error"], + "@typescript-eslint/prefer-for-of": ["off"], + "@typescript-eslint/prefer-function-type": ["error"], + "@typescript-eslint/prefer-includes": ["error"], + "@typescript-eslint/prefer-namespace-keyword": ["error"], + "@typescript-eslint/prefer-nullish-coalescing": ["off"], + "@typescript-eslint/prefer-optional-chain": ["error"], + "@typescript-eslint/prefer-readonly": ["error"], + "@typescript-eslint/prefer-readonly-parameter-types": ["off"], + "@typescript-eslint/prefer-reduce-type-parameter": ["error"], + "@typescript-eslint/prefer-regexp-exec": ["error"], + "@typescript-eslint/prefer-string-starts-ends-with": ["error"], + "@typescript-eslint/prefer-ts-expect-error": ["error"], + "@typescript-eslint/promise-function-async": ["error"], + "@typescript-eslint/quotes": ["error"], + "@typescript-eslint/require-array-sort-compare": ["off"], + "@typescript-eslint/require-await": ["off"], + "@typescript-eslint/restrict-plus-operands": ["error"], + "@typescript-eslint/restrict-template-expressions": ["off"], + "@typescript-eslint/return-await": ["error"], + "@typescript-eslint/semi": ["error"], "@typescript-eslint/space-before-function-paren": [ "error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - } - ], - "@typescript-eslint/strict-boolean-expressions": [ - "off" - ], - "@typescript-eslint/switch-exhaustiveness-check": [ - "error" - ], - "@typescript-eslint/triple-slash-reference": [ - "error" - ], - "@typescript-eslint/type-annotation-spacing": [ - "error" - ], + anonymous: "never", + named: "never", + asyncArrow: "always", + }, + ], + "@typescript-eslint/strict-boolean-expressions": ["off"], + "@typescript-eslint/switch-exhaustiveness-check": ["error"], + "@typescript-eslint/triple-slash-reference": ["error"], + "@typescript-eslint/type-annotation-spacing": ["error"], "@typescript-eslint/typedef": [ "error", { - "arrowParameter": false - } - ], - "@typescript-eslint/unbound-method": [ - "error" - ], - "@typescript-eslint/unified-signatures": [ - "error" - ], - "accessor-pairs": [ - "error" - ], - "array-bracket-newline": [ - "error" - ], - "array-bracket-spacing": [ - "error" - ], - "array-element-newline": [ - "off" - ], - "arrow-body-style": [ - "error" - ], - "arrow-parens": [ - "error", - "as-needed" - ], - "arrow-spacing": [ - "error" - ], - "block-scoped-var": [ - "error" - ], - "block-spacing": [ - "error" - ], - "brace-style": [ - "off" - ], - "callback-return": [ - "off" - ], - "camelcase": [ - "error" - ], - "capitalized-comments": [ - "off" - ], - "class-methods-use-this": [ - "off" - ], - "comma-dangle": [ - "error" - ], - "comma-spacing": [ - "off" - ], - "comma-style": [ - "error" - ], - "complexity": [ - "off" - ], - "computed-property-spacing": [ - "error" - ], - "consistent-return": [ - "off" - ], - "consistent-this": [ - "error" - ], - "constructor-super": [ - "off" - ], - "curly": [ - "error" - ], - "default-case": [ - "error" - ], - "default-param-last": [ - "off" - ], - "dot-location": [ - "error", - "property" - ], - "dot-notation": [ - "off" - ], - "eol-last": [ - "error" - ], - "eqeqeq": [ - "error" - ], - "for-direction": [ - "error" - ], - "func-call-spacing": [ - "off" - ], - "func-name-matching": [ - "error" - ], - "func-names": [ - "error" - ], - "func-style": [ - "off" - ], - "function-call-argument-newline": [ - "off" - ], - "function-paren-newline": [ - "off" - ], - "generator-star-spacing": [ - "error", {"before": false, "after": true} - ], - "getter-return": [ - "off" - ], - "grouped-accessor-pairs": [ - "error" - ], - "guard-for-in": [ - "off" - ], - "id-blacklist": [ - "error" - ], - "id-length": [ - "off" - ], - "id-match": [ - "error" - ], - "implicit-arrow-linebreak": [ - "off" - ], - "import/default": [ - "error" - ], - "import/export": [ - "error" - ], - "import/named": [ - "off" - ], - "import/namespace": [ - "error" - ], - "import/no-duplicates": [ - "warn" - ], - "import/no-named-as-default": [ - "warn" - ], - "import/no-named-as-default-member": [ - "warn" - ], - "import/no-unresolved": [ - "error" - ], + arrowParameter: false, + }, + ], + "@typescript-eslint/unbound-method": ["error"], + "@typescript-eslint/unified-signatures": ["error"], + "accessor-pairs": ["error"], + "array-bracket-newline": ["error"], + "array-bracket-spacing": ["error"], + "array-element-newline": ["off"], + "arrow-body-style": ["off"], + "arrow-parens": ["error", "always"], + "arrow-spacing": ["error"], + "block-scoped-var": ["error"], + "block-spacing": ["error"], + "brace-style": ["off"], + "callback-return": ["off"], + camelcase: ["error"], + "capitalized-comments": ["off"], + "class-methods-use-this": ["off"], + "comma-dangle": ["off"], + "comma-spacing": ["off"], + "comma-style": ["error"], + complexity: ["off"], + "computed-property-spacing": ["error"], + "consistent-return": ["off"], + "consistent-this": ["error"], + "constructor-super": ["off"], + curly: ["error"], + "default-case": ["error"], + "default-param-last": ["off"], + "dot-location": ["error", "property"], + "dot-notation": ["off"], + "eol-last": ["error"], + eqeqeq: ["error"], + "for-direction": ["error"], + "func-call-spacing": ["off"], + "func-name-matching": ["error"], + "func-names": ["error"], + "func-style": ["off"], + "function-call-argument-newline": ["off"], + "function-paren-newline": ["off"], + "generator-star-spacing": ["error", { before: false, after: true }], + "getter-return": ["off"], + "grouped-accessor-pairs": ["error"], + "guard-for-in": ["off"], + "id-blacklist": ["error"], + "id-length": ["off"], + "id-match": ["error"], + "implicit-arrow-linebreak": ["off"], + "import/default": ["error"], + "import/export": ["error"], + "import/named": ["off"], + "import/namespace": ["error"], + "import/no-duplicates": ["warn"], + "import/no-named-as-default": ["warn"], + "import/no-named-as-default-member": ["warn"], + "import/no-unresolved": ["error"], "import/order": [ "error", { - "groups": [ - [ - "external", - "builtin" - ], - [ - "internal", - "index", - "sibling", - "parent" - ] + groups: [ + ["external", "builtin"], + ["internal", "index", "sibling", "parent"], ], - "alphabetize": { - "order": "asc", - "caseInsensitive": true - } - } - ], - "indent": [ - "off" - ], - "init-declarations": [ - "off" - ], - "jsx-quotes": [ - "error" - ], - "key-spacing": [ - "error" - ], - "keyword-spacing": [ - "off" - ], - "line-comment-position": [ - "off" - ], - "linebreak-style": [ - "error" - ], - "lines-around-comment": [ - "off" - ], - "lines-between-class-members": [ - "off" - ], - "max-classes-per-file": [ - "error" - ], - "max-depth": [ - "off" - ], - "max-len": [ - "error", - { - "ignorePattern": "^import", - "code": 140 - } - ], - "max-lines": [ - "off" - ], - "max-lines-per-function": [ - "off" - ], - "max-nested-callbacks": [ - "error" - ], - "max-params": [ - "off" - ], - "max-statements": [ - "off" - ], - "max-statements-per-line": [ - "error" - ], - "multiline-comment-style": [ - "off" - ], - "multiline-ternary": [ - "off" - ], - "new-cap": [ - "error" - ], - "new-parens": [ - "error" - ], - "newline-per-chained-call": [ - "error", { "ignoreChainWithDepth": 3 } - ], - "no-alert": [ - "error" - ], - "no-array-constructor": [ - "off" - ], - "no-async-promise-executor": [ - "error" - ], - "no-await-in-loop": [ - "off" - ], - "no-bitwise": [ - "error" - ], - "no-caller": [ - "error" - ], - "no-case-declarations": [ - "error" - ], - "no-class-assign": [ - "error" - ], - "no-compare-neg-zero": [ - "error" - ], - "no-cond-assign": [ - "error" - ], - "no-confusing-arrow": [ - "error" - ], - "no-console": [ - "off" - ], - "no-const-assign": [ - "off" - ], - "no-constant-condition": [ - "error" - ], - "no-constructor-return": [ - "error" - ], - "no-continue": [ - "error" - ], - "no-control-regex": [ - "error" - ], - "no-debugger": [ - "error" - ], - "no-delete-var": [ - "error" - ], - "no-div-regex": [ - "error" - ], - "no-dupe-args": [ - "off" - ], - "no-dupe-class-members": [ - "off" - ], - "no-dupe-else-if": [ - "error" - ], - "no-dupe-keys": [ - "off" - ], - "no-duplicate-case": [ - "error" - ], - "no-duplicate-imports": [ - "error" - ], - "no-else-return": [ - "error" - ], - "no-empty": [ - "off" - ], - "no-empty-character-class": [ - "error" - ], - "no-empty-function": [ - "off" - ], - "no-empty-pattern": [ - "error" - ], - "no-eq-null": [ - "error" - ], - "no-eval": [ - "error" - ], - "no-ex-assign": [ - "error" - ], - "no-extend-native": [ - "error" - ], - "no-extra-bind": [ - "error" - ], - "no-extra-boolean-cast": [ - "error" - ], - "no-extra-label": [ - "error" - ], - "no-extra-parens": [ - "off" - ], - "no-extra-semi": [ - "off" - ], - "no-fallthrough": [ - "error" - ], - "no-floating-decimal": [ - "error" - ], - "no-func-assign": [ - "off" - ], - "no-global-assign": [ - "error" - ], - "no-implicit-coercion": [ - "error" - ], - "no-implicit-globals": [ - "error" - ], - "no-implied-eval": [ - "error" - ], - "no-import-assign": [ - "off" - ], - "no-inline-comments": [ - "off" - ], - "no-inner-declarations": [ - "error" - ], - "no-invalid-regexp": [ - "error" - ], - "no-invalid-this": [ - "off" - ], - "no-irregular-whitespace": [ - "error" - ], - "no-iterator": [ - "error" - ], - "no-label-var": [ - "error" - ], - "no-labels": [ - "error" - ], - "no-lone-blocks": [ - "error" - ], - "no-lonely-if": [ - "error" - ], - "no-loop-func": [ - "off" - ], - "no-loss-of-precision": [ - "off" - ], - "no-magic-numbers": [ - "off" - ], - "no-misleading-character-class": [ - "error" - ], - "no-mixed-operators": [ - "error" - ], - "no-mixed-spaces-and-tabs": [ - "error" - ], - "no-multi-assign": [ - "error" - ], - "no-multi-spaces": [ - "error" - ], - "no-multi-str": [ - "error" - ], - "no-multiple-empty-lines": [ - "error" - ], - "no-negated-condition": [ - "off" - ], - "no-nested-ternary": [ - "off" - ], - "no-new": [ - "error" - ], - "no-new-func": [ - "error" - ], - "no-new-object": [ - "error" - ], - "no-new-symbol": [ - "off" - ], - "no-new-wrappers": [ - "error" - ], - "no-obj-calls": [ - "off" - ], - "no-octal": [ - "error" - ], - "no-octal-escape": [ - "error" - ], - "no-param-reassign": [ - "off" - ], - "no-plusplus": [ - "off" - ], - "no-proto": [ - "error" - ], - "no-prototype-builtins": [ - "error" - ], - "no-redeclare": [ - "off" - ], - "no-regex-spaces": [ - "error" - ], - "no-restricted-globals": [ - "error" - ], - "no-restricted-imports": [ - "error" - ], - "no-restricted-properties": [ - "error" - ], - "no-restricted-syntax": [ - "error" - ], - "no-return-assign": [ - "error" - ], - "no-return-await": [ - "off" - ], - "no-script-url": [ - "error" - ], - "no-self-assign": [ - "error" - ], - "no-self-compare": [ - "error" - ], - "no-sequences": [ - "error" - ], - "no-setter-return": [ - "off" - ], + alphabetize: { + order: "asc", + caseInsensitive: true, + }, + }, + ], + indent: ["off"], + "init-declarations": ["off"], + "jsx-quotes": ["error"], + "key-spacing": ["error"], + "keyword-spacing": ["off"], + "line-comment-position": ["off"], + "linebreak-style": ["error"], + "lines-around-comment": ["off"], + "lines-between-class-members": ["off"], + "max-classes-per-file": ["error"], + "max-depth": ["off"], + "max-lines": ["off"], + "max-lines-per-function": ["off"], + "max-nested-callbacks": ["error"], + "max-params": ["off"], + "max-statements": ["off"], + "max-statements-per-line": ["error"], + "multiline-comment-style": ["off"], + "multiline-ternary": ["off"], + "new-cap": ["error"], + "new-parens": ["error"], + "newline-per-chained-call": ["error", { ignoreChainWithDepth: 3 }], + "no-alert": ["error"], + "no-array-constructor": ["off"], + "no-async-promise-executor": ["error"], + "no-await-in-loop": ["off"], + "no-bitwise": ["error"], + "no-caller": ["error"], + "no-case-declarations": ["error"], + "no-class-assign": ["error"], + "no-compare-neg-zero": ["error"], + "no-cond-assign": ["error"], + "no-confusing-arrow": ["error"], + "no-console": ["off"], + "no-const-assign": ["off"], + "no-constant-condition": ["error"], + "no-constructor-return": ["error"], + "no-continue": ["error"], + "no-control-regex": ["error"], + "no-debugger": ["error"], + "no-delete-var": ["error"], + "no-div-regex": ["error"], + "no-dupe-args": ["off"], + "no-dupe-class-members": ["off"], + "no-dupe-else-if": ["error"], + "no-dupe-keys": ["off"], + "no-duplicate-case": ["error"], + "no-duplicate-imports": ["error"], + "no-else-return": ["error"], + "no-empty": ["off"], + "no-empty-character-class": ["error"], + "no-empty-function": ["off"], + "no-empty-pattern": ["error"], + "no-eq-null": ["error"], + "no-eval": ["error"], + "no-ex-assign": ["error"], + "no-extend-native": ["error"], + "no-extra-bind": ["error"], + "no-extra-boolean-cast": ["error"], + "no-extra-label": ["error"], + "no-extra-parens": ["off"], + "no-extra-semi": ["off"], + "no-fallthrough": ["error"], + "no-floating-decimal": ["error"], + "no-func-assign": ["off"], + "no-global-assign": ["error"], + "no-implicit-coercion": ["error"], + "no-implicit-globals": ["error"], + "no-implied-eval": ["error"], + "no-import-assign": ["off"], + "no-inline-comments": ["off"], + "no-inner-declarations": ["error"], + "no-invalid-regexp": ["error"], + "no-invalid-this": ["off"], + "no-irregular-whitespace": ["error"], + "no-iterator": ["error"], + "no-label-var": ["error"], + "no-labels": ["error"], + "no-lone-blocks": ["error"], + "no-lonely-if": ["error"], + "no-loop-func": ["off"], + "no-loss-of-precision": ["off"], + "no-magic-numbers": ["off"], + "no-misleading-character-class": ["error"], + "no-mixed-operators": ["error"], + "no-mixed-spaces-and-tabs": ["error"], + "no-multi-assign": ["error"], + "no-multi-spaces": ["error"], + "no-multi-str": ["error"], + "no-multiple-empty-lines": ["error"], + "no-negated-condition": ["off"], + "no-nested-ternary": ["off"], + "no-new": ["error"], + "no-new-func": ["error"], + "no-new-object": ["error"], + "no-new-symbol": ["off"], + "no-new-wrappers": ["error"], + "no-obj-calls": ["off"], + "no-octal": ["error"], + "no-octal-escape": ["error"], + "no-param-reassign": ["off"], + "no-plusplus": ["off"], + "no-proto": ["error"], + "no-prototype-builtins": ["error"], + "no-redeclare": ["off"], + "no-regex-spaces": ["error"], + "no-restricted-globals": ["error"], + "no-restricted-imports": ["error"], + "no-restricted-properties": ["error"], + "no-restricted-syntax": ["error"], + "no-return-assign": ["error"], + "no-return-await": ["off"], + "no-script-url": ["error"], + "no-self-assign": ["error"], + "no-self-compare": ["error"], + "no-sequences": ["error"], + "no-setter-return": ["off"], "no-shadow": "off", - "@typescript-eslint/no-shadow": [ - "error", { "ignoreTypeValueShadow": true } - ], - "no-shadow-restricted-names": [ - "error" - ], - "no-sparse-arrays": [ - "error" - ], - "no-tabs": [ - "error" - ], - "no-template-curly-in-string": [ - "error" - ], - "no-ternary": [ - "off" - ], - "no-this-before-super": [ - "off" - ], - "no-throw-literal": [ - "error" - ], - "no-trailing-spaces": [ - "error" - ], - "no-undef": [ - "off" - ], - "no-undef-init": [ - "error" - ], - "no-undefined": [ - "off" - ], - "no-underscore-dangle": [ - "off" - ], - "no-unexpected-multiline": [ - "error" - ], - "no-unmodified-loop-condition": [ - "error" - ], - "no-unneeded-ternary": [ - "error" - ], - "no-unreachable": [ - "off" - ], - "no-unsafe-finally": [ - "error" - ], - "no-unsafe-negation": [ - "off" - ], - "no-unused-expressions": [ - "off" - ], - "no-unused-labels": [ - "error" - ], + "@typescript-eslint/no-shadow": ["error", { ignoreTypeValueShadow: true }], + "no-shadow-restricted-names": ["error"], + "no-sparse-arrays": ["error"], + "no-tabs": ["error"], + "no-template-curly-in-string": ["error"], + "no-ternary": ["off"], + "no-this-before-super": ["off"], + "no-throw-literal": ["error"], + "no-trailing-spaces": ["error"], + "no-undef": ["off"], + "no-undef-init": ["error"], + "no-undefined": ["off"], + "no-underscore-dangle": ["off"], + "no-unexpected-multiline": ["error"], + "no-unmodified-loop-condition": ["error"], + "no-unneeded-ternary": ["error"], + "no-unreachable": ["off"], + "no-unsafe-finally": ["error"], + "no-unsafe-negation": ["off"], + "no-unused-expressions": ["off"], + "no-unused-labels": ["error"], "no-unused-vars": [ "error", { - "args": "none" - } - ], - "no-use-before-define": [ - "off" - ], - "no-useless-call": [ - "error" - ], - "no-useless-catch": [ - "error" - ], - "no-useless-computed-key": [ - "error" - ], - "no-useless-concat": [ - "error" - ], - "no-useless-constructor": [ - "off" - ], - "no-useless-escape": [ - "error" - ], - "no-useless-rename": [ - "error" - ], - "no-useless-return": [ - "error" - ], - "no-var": [ - "error" - ], - "no-void": [ - "error" - ], - "no-warning-comments": [ - "error" - ], - "no-whitespace-before-property": [ - "error" - ], - "no-with": [ - "error" - ], - "nonblock-statement-body-position": [ - "error" - ], - "object-curly-newline": [ - "error" - ], - "object-curly-spacing": [ - "error", - "always" - ], - "object-property-newline": [ - "off" - ], - "object-shorthand": [ - "error" - ], - "one-var": [ - "error", - "never" - ], - "one-var-declaration-per-line": [ - "error" - ], - "operator-assignment": [ - "error" - ], - "operator-linebreak": [ - "error", "after", { "overrides": { "?": "ignore", ":": "ignore" } } - ], - "padded-blocks": [ - "error", - "never" - ], - "padding-line-between-statements": [ - "error" - ], - "prefer-arrow-callback": [ - "error" - ], - "prefer-const": [ - "error" - ], - "prefer-destructuring": [ - "off" - ], - "prefer-exponentiation-operator": [ - "off" - ], - "prefer-named-capture-group": [ - "off" - ], - "prefer-numeric-literals": [ - "error" - ], - "prefer-object-spread": [ - "error" - ], - "prefer-promise-reject-errors": [ - "error" - ], - "prefer-regex-literals": [ - "error" - ], - "prefer-rest-params": [ - "error" - ], - "prefer-spread": [ - "error" - ], - "prefer-template": [ - "error" - ], - "quote-props": [ - "off" - ], - "quotes": [ - "off" - ], - "radix": [ - "error" - ], - "require-atomic-updates": [ - "off" - ], - "require-await": [ - "off" - ], - "require-unicode-regexp": [ - "off" - ], - "require-yield": [ - "error" - ], - "rest-spread-spacing": [ - "error" - ], - "semi": [ - "off" - ], - "semi-spacing": [ - "error" - ], - "semi-style": [ - "error" - ], - "sort-imports": [ - "off" - ], - "sort-keys": [ - "off" - ], - "sort-vars": [ - "error" - ], - "space-before-blocks": [ - "error" - ], - "space-before-function-paren": [ - "off" - ], - "space-in-parens": [ - "error" - ], - "space-infix-ops": [ - "error" - ], - "space-unary-ops": [ - "error" - ], - "spaced-comment": [ - "error" - ], - "strict": [ - "error" - ], - "switch-colon-spacing": [ - "error" - ], - "symbol-description": [ - "error" - ], - "template-curly-spacing": [ - "error" - ], - "template-tag-spacing": [ - "error" - ], - "unicode-bom": [ - "error" - ], - "unicorn/better-regex": [ - "error" - ], - "unicorn/catch-error-name": [ - "off" - ], - "unicorn/consistent-function-scoping": [ - "error" - ], - "unicorn/custom-error-definition": [ - "off" - ], - "unicorn/empty-brace-spaces": [ - "off" - ], - "unicorn/error-message": [ - "error" - ], - "unicorn/escape-case": [ - "error" - ], - "unicorn/expiring-todo-comments": [ - "error" - ], - "unicorn/explicit-length-check": [ - "error" - ], - "unicorn/filename-case": [ - "off" - ], - "unicorn/import-index": [ - "error" - ], - "unicorn/new-for-builtins": [ - "error" - ], - "unicorn/no-abusive-eslint-disable": [ - "error" - ], - "unicorn/no-array-instanceof": [ - "error" - ], - "unicorn/no-array-push-push": [ - "off" - ], - "unicorn/no-console-spaces": [ - "error" - ], - "unicorn/no-fn-reference-in-iterator": [ - "error" - ], - "unicorn/no-for-loop": [ - "off" - ], - "unicorn/no-hex-escape": [ - "error" - ], - "unicorn/no-keyword-prefix": [ - "off" - ], - "unicorn/no-nested-ternary": [ - "error" - ], - "unicorn/no-new-buffer": [ - "error" - ], - "unicorn/no-null": [ - "off" - ], - "unicorn/no-process-exit": [ - "error" - ], - "unicorn/no-reduce": [ - "off" - ], - "unicorn/no-unreadable-array-destructuring": [ - "error" - ], - "unicorn/no-unsafe-regex": [ - "off" - ], - "unicorn/no-unused-properties": [ - "off" - ], - "unicorn/no-useless-undefined": [ - "error" - ], - "unicorn/no-zero-fractions": [ - "error" - ], - "unicorn/number-literal-case": [ - "error" - ], - "unicorn/numeric-separators-style": [ - "off" - ], - "unicorn/prefer-add-event-listener": [ - "error" - ], - "unicorn/prefer-dataset": [ - "error" - ], - "unicorn/prefer-event-key": [ - "error" - ], - "unicorn/prefer-flat-map": [ - "error" - ], - "unicorn/prefer-includes": [ - "error" - ], - "unicorn/prefer-modern-dom-apis": [ - "error" - ], - "unicorn/prefer-negative-index": [ - "error" - ], - "unicorn/prefer-module": [ - "off" - ], - "unicorn/prefer-node-append": [ - "error" - ], - "unicorn/prefer-node-protocol": [ - "off" - ], - "unicorn/prefer-node-remove": [ - "error" - ], - "unicorn/prefer-number-properties": [ - "error" - ], - "unicorn/prefer-optional-catch-binding": [ - "error" - ], - "unicorn/prefer-query-selector": [ - "error" - ], - "unicorn/prefer-reflect-apply": [ - "error" - ], - "unicorn/prefer-replace-all": [ - "off" - ], - "unicorn/prefer-set-has": [ - "error" - ], - "unicorn/prefer-spread": [ - "off" - ], - "unicorn/prefer-starts-ends-with": [ - "error" - ], - "unicorn/prefer-string-slice": [ - "error" - ], - "unicorn/prefer-switch": [ - "off" - ], - "unicorn/prefer-text-content": [ - "error" - ], - "unicorn/prefer-trim-start-end": [ - "error" - ], - "unicorn/prefer-type-error": [ - "error" - ], - "unicorn/prevent-abbreviations": [ - "off" - ], - "unicorn/string-content": [ - "off" - ], - "unicorn/throw-new-error": [ - "error" - ], - "use-isnan": [ - "error" - ], - "valid-typeof": [ - "off" - ], - "vars-on-top": [ - "error" - ], - "wrap-iife": [ - "error" - ], - "wrap-regex": [ - "off" - ], - "yield-star-spacing": [ - "error" - ], - "yoda": [ - "error" - ], + args: "none", + }, + ], + "no-use-before-define": ["off"], + "no-useless-call": ["error"], + "no-useless-catch": ["error"], + "no-useless-computed-key": ["error"], + "no-useless-concat": ["error"], + "no-useless-constructor": ["off"], + "no-useless-escape": ["error"], + "no-useless-rename": ["error"], + "no-useless-return": ["error"], + "no-var": ["error"], + "no-void": ["error"], + "no-warning-comments": ["error"], + "no-whitespace-before-property": ["error"], + "no-with": ["error"], + "nonblock-statement-body-position": ["error"], + "object-curly-newline": ["error"], + "object-curly-spacing": ["error", "always"], + "object-property-newline": ["off"], + "object-shorthand": ["error"], + "one-var": ["error", "never"], + "one-var-declaration-per-line": ["error"], + "operator-assignment": ["error"], + "operator-linebreak": ["error", "after", { overrides: { "?": "ignore", ":": "ignore" } }], + "padded-blocks": ["error", "never"], + "padding-line-between-statements": ["error"], + "prefer-arrow-callback": ["off"], + "prefer-const": ["error"], + "prefer-destructuring": ["off"], + "prefer-exponentiation-operator": ["off"], + "prefer-named-capture-group": ["off"], + "prefer-numeric-literals": ["error"], + "prefer-object-spread": ["error"], + "prefer-promise-reject-errors": ["error"], + "prefer-regex-literals": ["error"], + "prefer-rest-params": ["error"], + "prefer-spread": ["error"], + "prefer-template": ["error"], + "quote-props": ["off"], + quotes: ["off"], + radix: ["error"], + "require-atomic-updates": ["off"], + "require-await": ["off"], + "require-unicode-regexp": ["off"], + "require-yield": ["error"], + "rest-spread-spacing": ["error"], + semi: ["off"], + "semi-spacing": ["error"], + "semi-style": ["error"], + "sort-imports": ["off"], + "sort-keys": ["off"], + "sort-vars": ["error"], + "space-before-blocks": ["error"], + "space-before-function-paren": ["off"], + "space-in-parens": ["error"], + "space-infix-ops": ["error"], + "space-unary-ops": ["error"], + "spaced-comment": ["error"], + strict: ["error"], + "switch-colon-spacing": ["error"], + "symbol-description": ["error"], + "template-curly-spacing": ["error"], + "template-tag-spacing": ["error"], + "unicode-bom": ["error"], + "unicorn/better-regex": ["error"], + "unicorn/catch-error-name": ["off"], + "unicorn/consistent-function-scoping": ["error"], + "unicorn/custom-error-definition": ["off"], + "unicorn/empty-brace-spaces": ["off"], + "unicorn/error-message": ["error"], + "unicorn/escape-case": ["error"], + "unicorn/expiring-todo-comments": ["error"], + "unicorn/explicit-length-check": ["error"], + "unicorn/filename-case": ["off"], + "unicorn/import-index": ["error"], + "unicorn/new-for-builtins": ["error"], + "unicorn/no-abusive-eslint-disable": ["error"], + "unicorn/no-array-instanceof": ["error"], + "unicorn/no-array-push-push": ["off"], + "unicorn/no-console-spaces": ["error"], + "unicorn/no-fn-reference-in-iterator": ["error"], + "unicorn/no-for-loop": ["off"], + "unicorn/no-hex-escape": ["error"], + "unicorn/no-keyword-prefix": ["off"], + "unicorn/no-nested-ternary": ["error"], + "unicorn/no-new-buffer": ["error"], + "unicorn/no-null": ["off"], + "unicorn/no-process-exit": ["error"], + "unicorn/no-reduce": ["off"], + "unicorn/no-unreadable-array-destructuring": ["error"], + "unicorn/no-unsafe-regex": ["off"], + "unicorn/no-unused-properties": ["off"], + "unicorn/no-useless-undefined": ["error"], + "unicorn/no-zero-fractions": ["error"], + "unicorn/number-literal-case": ["error"], + "unicorn/numeric-separators-style": ["off"], + "unicorn/prefer-add-event-listener": ["error"], + "unicorn/prefer-dataset": ["error"], + "unicorn/prefer-event-key": ["error"], + "unicorn/prefer-flat-map": ["error"], + "unicorn/prefer-includes": ["error"], + "unicorn/prefer-modern-dom-apis": ["error"], + "unicorn/prefer-negative-index": ["error"], + "unicorn/prefer-module": ["off"], + "unicorn/prefer-node-append": ["error"], + "unicorn/prefer-node-protocol": ["off"], + "unicorn/prefer-node-remove": ["error"], + "unicorn/prefer-number-properties": ["error"], + "unicorn/prefer-optional-catch-binding": ["error"], + "unicorn/prefer-query-selector": ["error"], + "unicorn/prefer-reflect-apply": ["error"], + "unicorn/prefer-replace-all": ["off"], + "unicorn/prefer-set-has": ["error"], + "unicorn/prefer-spread": ["off"], + "unicorn/prefer-starts-ends-with": ["error"], + "unicorn/prefer-string-slice": ["error"], + "unicorn/prefer-switch": ["off"], + "unicorn/prefer-text-content": ["error"], + "unicorn/prefer-trim-start-end": ["error"], + "unicorn/prefer-type-error": ["error"], + "unicorn/prevent-abbreviations": ["off"], + "unicorn/string-content": ["off"], + "unicorn/throw-new-error": ["error"], + "use-isnan": ["error"], + "valid-typeof": ["off"], + "vars-on-top": ["error"], + "wrap-iife": ["error"], + "wrap-regex": ["off"], + "yield-star-spacing": ["error"], + yoda: ["error"], "jsdoc/newline-after-description": "off", "jsdoc/require-param-type": "off", - "jsdoc/require-returns-type": "off" - } + "jsdoc/require-returns-type": "off", + }, }; diff --git a/api/.prettierignore b/api/.prettierignore new file mode 100644 index 000000000..7d1f8489c --- /dev/null +++ b/api/.prettierignore @@ -0,0 +1,10 @@ +.eslintrc.yaml +.eslintcache + +*.d.ts + +dist/* + +node_modules/* + +tsconfig.json diff --git a/api/.prettierrc b/api/.prettierrc new file mode 100644 index 000000000..a025b47fd --- /dev/null +++ b/api/.prettierrc @@ -0,0 +1,14 @@ +{ + "arrowParens": "always", + "bracketSameLine": false, + "bracketSpacing": true, + "semi": true, + "experimentalTernaries": false, + "singleQuote": false, + "trailingComma": "all", + "htmlWhitespaceSensitivity": "css", + "proseWrap": "preserve", + "printWidth": 140, + "tabWidth": 4, + "useTabs": false +} diff --git a/api/package-lock.json b/api/package-lock.json index 7b22cfa83..5d56a58b0 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -29,6 +29,7 @@ "express": "^4.18.1", "influx": "^5.9.3", "jszip": "^3.10.1", + "lint-staged": "^14.0.1", "moment": "^2.29.4", "node-cron": "^3.0.2", "node-fetch": "^2.6.7", @@ -47,12 +48,14 @@ "@typescript-eslint/parser": "^6.9.1", "copyfiles": "^2.4.1", "eslint": "^8.52.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsdoc": "^39.3.6", "eslint-plugin-unicorn": "^49.0.0", "jest": "^29.3.1", "nodemon": "^2.0.13", "npm-run-all": "^4.1.5", + "prettier": "^3.1.1", "rimraf": "^3.0.2", "ts-jest": "^29.0.3", "typescript": "^4.8.2" @@ -3051,7 +3054,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -3337,6 +3339,81 @@ "node": ">=0.8.0" } }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -3411,6 +3488,11 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==" + }, "node_modules/colorspace": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", @@ -3431,6 +3513,14 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "engines": { + "node": ">=16" + } + }, "node_modules/comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -3653,7 +3743,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -3875,6 +3964,11 @@ "stream-shift": "^1.0.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -4259,6 +4353,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -4529,6 +4635,11 @@ "node": ">=6" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, "node_modules/eventid": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/eventid/-/eventid-2.0.1.tgz", @@ -4785,7 +4896,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -5030,7 +5140,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, "engines": { "node": ">=10" }, @@ -5753,7 +5862,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, "engines": { "node": ">=0.12.0" } @@ -5898,8 +6006,7 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", @@ -6816,6 +6923,14 @@ "immediate": "~3.0.5" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -6830,6 +6945,253 @@ "uc.micro": "^1.0.1" } }, + "node_modules/lint-staged": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-14.0.1.tgz", + "integrity": "sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==", + "dependencies": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/lint-staged/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", + "dependencies": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/listr2/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -6909,6 +7271,122 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "dependencies": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/log-update/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/logform": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz", @@ -7047,8 +7525,7 @@ "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, "node_modules/merge2": { "version": "1.4.1", @@ -7071,7 +7548,6 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -7114,7 +7590,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, "engines": { "node": ">=6" } @@ -7796,7 +8271,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -7927,7 +8401,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, "engines": { "node": ">=8" } @@ -7962,7 +8435,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, "engines": { "node": ">=8.6" }, @@ -8107,6 +8579,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -8704,6 +9191,21 @@ "node": ">=10" } }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/retry-request": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-5.0.2.tgz", @@ -8940,7 +9442,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -8952,7 +9453,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, "engines": { "node": ">=8" } @@ -8982,8 +9482,7 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/simple-concat": { "version": "1.0.1", @@ -9077,6 +9576,43 @@ "node": ">=8" } }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/socket.io": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", @@ -9276,6 +9812,14 @@ } ] }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -9592,7 +10136,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -10085,7 +10628,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -10272,6 +10814,14 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -12668,7 +13218,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -12856,6 +13405,53 @@ } } }, + "cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "requires": { + "restore-cursor": "^4.0.0" + } + }, + "cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "requires": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -12925,6 +13521,11 @@ "simple-swizzle": "^0.2.2" } }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==" + }, "colorspace": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", @@ -12942,6 +13543,11 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==" + }, "comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -13114,7 +13720,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -13260,6 +13865,11 @@ "stream-shift": "^1.0.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, "ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -13556,6 +14166,13 @@ "text-table": "^0.2.0" } }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "requires": {} + }, "eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -13754,6 +14371,11 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, + "eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, "eventid": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/eventid/-/eventid-2.0.1.tgz", @@ -13961,7 +14583,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -14146,8 +14767,7 @@ "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" }, "get-symbol-description": { "version": "1.0.0", @@ -14662,8 +15282,7 @@ "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, "is-number-object": { "version": "1.0.7", @@ -14757,8 +15376,7 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "istanbul-lib-coverage": { "version": "3.2.2", @@ -15488,6 +16106,11 @@ "immediate": "~3.0.5" } }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==" + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -15502,6 +16125,150 @@ "uc.micro": "^1.0.1" } }, + "lint-staged": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-14.0.1.tgz", + "integrity": "sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==", + "requires": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" + }, + "dependencies": { + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" + }, + "execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==" + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==" + }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==" + }, + "npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "requires": { + "path-key": "^4.0.0" + } + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==" + }, + "pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==" + }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==" + } + } + }, + "listr2": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", + "requires": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -15568,6 +16335,76 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "requires": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "dependencies": { + "ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "requires": { + "type-fest": "^1.0.2" + } + }, + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==" + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "logform": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz", @@ -15673,8 +16510,7 @@ "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, "merge2": { "version": "1.4.1", @@ -15691,7 +16527,6 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, "requires": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -15718,8 +16553,7 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "mimic-response": { "version": "3.1.0", @@ -16235,7 +17069,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, "requires": { "mimic-fn": "^2.1.0" } @@ -16323,8 +17156,7 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { "version": "1.0.7", @@ -16352,8 +17184,7 @@ "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, "pidtree": { "version": "0.3.1", @@ -16452,6 +17283,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true + }, "pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -16896,6 +17733,15 @@ "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true }, + "restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "retry-request": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-5.0.2.tgz", @@ -17081,7 +17927,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -17089,8 +17934,7 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "shell-quote": { "version": "1.8.1", @@ -17111,8 +17955,7 @@ "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "simple-concat": { "version": "1.0.1", @@ -17173,6 +18016,27 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==" + } + } + }, "socket.io": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", @@ -17329,6 +18193,11 @@ } } }, + "string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==" + }, "string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -17575,7 +18444,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "requires": { "is-number": "^7.0.0" } @@ -17932,7 +18800,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "requires": { "isexe": "^2.0.0" } @@ -18060,6 +18927,11 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==" + }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/api/package.json b/api/package.json index fbc7a7ed4..4095e0283 100644 --- a/api/package.json +++ b/api/package.json @@ -13,8 +13,10 @@ "build-clean": "rimraf ./dist/*", "build-compile": "tsc", "build-watch": "tsc --watch", - "lint": "eslint src --ext .tsx,.ts", "build-lint": "eslint src --ext .tsx,.ts", + "format": "prettier --ignore-path=.prettierignore --write src && eslint --fix src", + "lint:check": "eslint src --ext .ts,.js", + "format:check": "prettier --ignore-path=.prettierignore src", "build-config": "copyfiles -u 2 ./src/data/config*.json ./dist/data/", "build": "npm-run-all build-clean build-compile build-lint build-config", "serve-mon": "nodemon ./dist/index", @@ -45,6 +47,7 @@ "express": "^4.18.1", "influx": "^5.9.3", "jszip": "^3.10.1", + "lint-staged": "^14.0.1", "moment": "^2.29.4", "node-cron": "^3.0.2", "node-fetch": "^2.6.7", @@ -63,14 +66,22 @@ "@typescript-eslint/parser": "^6.9.1", "copyfiles": "^2.4.1", "eslint": "^8.52.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsdoc": "^39.3.6", "eslint-plugin-unicorn": "^49.0.0", "jest": "^29.3.1", "nodemon": "^2.0.13", "npm-run-all": "^4.1.5", + "prettier": "^3.1.1", "rimraf": "^3.0.2", "ts-jest": "^29.0.3", "typescript": "^4.8.2" + }, + "lint-staged": { + "src/**/*.{ts,js}": [ + "prettier --ignore-path=.prettierignore --write", + "eslint --fix" + ] } } diff --git a/api/src/clients/coinGeckoClient.ts b/api/src/clients/coinGeckoClient.ts index 43d51957c..e4c7f8264 100644 --- a/api/src/clients/coinGeckoClient.ts +++ b/api/src/clients/coinGeckoClient.ts @@ -37,7 +37,7 @@ export class CoinGeckoClient { response = await FetchHelper.json( this._endpoint, `coins/${coin}/history?date=${day}-${month}-${year}`, - "get" + "get", ); } catch (err) { logger.error(`[CoinGecko] Fetch coin history failed. Cause: ${err}`); @@ -58,9 +58,8 @@ export class CoinGeckoClient { try { response = await FetchHelper.json( this._endpoint, - `coins/markets?vs_currency=${ - currency}&ids=${coin}&order=market_cap_desc&per_page=100&page=1&sparkline=false`, - "get" + `coins/markets?vs_currency=${currency}&ids=${coin}&order=market_cap_desc&per_page=100&page=1&sparkline=false`, + "get", ); } catch (err) { logger.error(`[CoinGecko] Fetch coin markets failed. Cause: ${err}`); @@ -82,7 +81,7 @@ export class CoinGeckoClient { response = await FetchHelper.json( this._endpoint, `coins/${coin}/market_chart?vs_currency=${currency}&days=1&interval=hourly`, - "get" + "get", ); } catch (err) { logger.error(`[CoinGecko] Fetch market chart failed. Cause: ${err}`); diff --git a/api/src/clients/fixerClient.ts b/api/src/clients/fixerClient.ts index 8925c1608..8665c07ed 100644 --- a/api/src/clients/fixerClient.ts +++ b/api/src/clients/fixerClient.ts @@ -39,7 +39,7 @@ export class FixerClient { `latest?base=${baseCurrency}&symbols=USD,JPY,GBP,CAD,SEK,CHF`, "get", null, - { apiKey: this._apiKey } + { apiKey: this._apiKey }, ); } catch (e) { logger.error(`Failed fetching latest from fixerAPI. Cause: ${e}`); diff --git a/api/src/clients/legacy/client.ts b/api/src/clients/legacy/client.ts index 1c16a6ab4..3b234220d 100644 --- a/api/src/clients/legacy/client.ts +++ b/api/src/clients/legacy/client.ts @@ -81,18 +81,18 @@ export class LegacyClient { `core/v0/transactions${params}`, "get", null, - headers + headers, ); if (response.error) { - logger.error(`[LegacyClient] findTransactions failed: ${(response.error)}\n + logger.error(`[LegacyClient] findTransactions failed: ${response.error}\n ${FetchHelper.convertToCurl(this._endpoint, `core/v0/transactions${params}`, "post", headers, null)} `); } return response; } catch (err) { - logger.error(`[LegacyClient] findTransactions error: ${(err.response?.data?.error) ?? err}`); + logger.error(`[LegacyClient] findTransactions error: ${err.response?.data?.error ?? err}`); } } @@ -114,19 +114,24 @@ export class LegacyClient { `core/v0/transactions/${request.txHash}/trytes`, "get", null, - headers + headers, ); if (response.error) { - logger.error(`[LegacyClient] getTrytes failed: ${(response.error)}\n - ${FetchHelper.convertToCurl(this._endpoint, - `core/v0/transactions/${request.txHash}/trytes`, "get", headers, null)} + logger.error(`[LegacyClient] getTrytes failed: ${response.error}\n + ${FetchHelper.convertToCurl( + this._endpoint, + `core/v0/transactions/${request.txHash}/trytes`, + "get", + headers, + null, + )} `); } return response; } catch (err) { - logger.error(`[LegacyClient] getTrytes error: ${(err.response?.data?.error) ?? err}`); + logger.error(`[LegacyClient] getTrytes error: ${err.response?.data?.error ?? err}`); } } @@ -148,19 +153,24 @@ export class LegacyClient { `core/v0/transactions/${request.txHash}/metadata`, "get", null, - headers + headers, ); if (response.error) { - logger.error(`[LegacyClient] getTransactionMetadata failed: ${(response.error)}\n - ${FetchHelper.convertToCurl(this._endpoint, - `core/v0/transactions/${request.txHash}/metadata`, "get", headers, null)} + logger.error(`[LegacyClient] getTransactionMetadata failed: ${response.error}\n + ${FetchHelper.convertToCurl( + this._endpoint, + `core/v0/transactions/${request.txHash}/metadata`, + "get", + headers, + null, + )} `); } return response; } catch (err) { - logger.error(`[LegacyClient] getTransactionMetadata error: ${(err.response?.data?.error) ?? err}`); + logger.error(`[LegacyClient] getTransactionMetadata error: ${err.response?.data?.error ?? err}`); } } @@ -182,19 +192,24 @@ export class LegacyClient { `core/v0/addresses/${request.address}/balance`, "get", null, - headers + headers, ); if (response.error) { - logger.error(`[LegacyClient] getBalance failed: ${(response.error)}\n - ${FetchHelper.convertToCurl(this._endpoint, - `core/v0/addresses/${request.address}/balance`, "get", headers, null)} + logger.error(`[LegacyClient] getBalance failed: ${response.error}\n + ${FetchHelper.convertToCurl( + this._endpoint, + `core/v0/addresses/${request.address}/balance`, + "get", + headers, + null, + )} `); } return response; } catch (err) { - logger.error(`[LegacyClient] getBalance error: ${(err.response?.data?.error) ?? err}`); + logger.error(`[LegacyClient] getBalance error: ${err.response?.data?.error ?? err}`); } } @@ -216,19 +231,24 @@ export class LegacyClient { `core/v0/milestones/by-index/${request.milestoneIndex}`, "get", null, - headers + headers, ); if (response.error) { - logger.error(`[LegacyClient] milestoneByIndex failed: ${(response.error)}\n - ${FetchHelper.convertToCurl(this._endpoint, - `core/v0/milestones/by-index/${request.milestoneIndex}`, "get", headers, null)} + logger.error(`[LegacyClient] milestoneByIndex failed: ${response.error}\n + ${FetchHelper.convertToCurl( + this._endpoint, + `core/v0/milestones/by-index/${request.milestoneIndex}`, + "get", + headers, + null, + )} `); } return response; } catch (err) { - logger.error(`[LegacyClient] milestoneByIndex error: ${(err.response?.data?.error) ?? err}`); + logger.error(`[LegacyClient] milestoneByIndex error: ${err.response?.data?.error ?? err}`); } } } diff --git a/api/src/errors/networkConfigurationError.ts b/api/src/errors/networkConfigurationError.ts index 13f70b339..17ff47d44 100644 --- a/api/src/errors/networkConfigurationError.ts +++ b/api/src/errors/networkConfigurationError.ts @@ -1,2 +1 @@ -export class NetworkConfigurationError extends Error { } - +export class NetworkConfigurationError extends Error {} diff --git a/api/src/errors/nodeInfoError.ts b/api/src/errors/nodeInfoError.ts index 4e7d85b3d..66e60480e 100644 --- a/api/src/errors/nodeInfoError.ts +++ b/api/src/errors/nodeInfoError.ts @@ -1,2 +1 @@ -export class NodeInfoError extends Error { } - +export class NodeInfoError extends Error {} diff --git a/api/src/index.ts b/api/src/index.ts index 2919a944c..b1d57b466 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -22,11 +22,9 @@ const config: IConfiguration = require(`./data/config.${configId}.json`); const configAllowedDomains: (string | RegExp)[] | undefined = []; const configAllowedMethods: string | undefined = - !config.allowedMethods || config.allowedMethods === "ALLOWED-METHODS" - ? undefined : config.allowedMethods; + !config.allowedMethods || config.allowedMethods === "ALLOWED-METHODS" ? undefined : config.allowedMethods; const configAllowedHeaders: string | undefined = - !config.allowedHeaders || config.allowedHeaders === "ALLOWED-HEADERS" - ? undefined : config.allowedHeaders; + !config.allowedHeaders || config.allowedHeaders === "ALLOWED-HEADERS" ? undefined : config.allowedHeaders; if (Array.isArray(config.allowedDomains)) { for (const dom of config.allowedDomains) { @@ -54,7 +52,10 @@ app.use((req, res, next) => { let allowedHeaders = configAllowedHeaders; if (config.routeCors) { - const foundRoute = matchRouteUrl(config.routeCors.map(c => c.path), req.url); + const foundRoute = matchRouteUrl( + config.routeCors.map((c) => c.path), + req.url, + ); if (foundRoute) { const routeCors = config.routeCors[foundRoute.index]; @@ -64,24 +65,13 @@ app.use((req, res, next) => { } } - cors( - req, - res, - allowedDomains, - allowedMethods, - allowedHeaders); + cors(req, res, allowedDomains, allowedMethods, allowedHeaders); next(); }); for (const route of routes) { app[route.method](route.path, async (req, res) => { - await executeRoute( - req, - res, - config, - route, - req.params, - config.verboseLogging); + await executeRoute(req, res, config, route, req.params, config.verboseLogging); }); } @@ -92,7 +82,7 @@ const sockets: { [socketId: string]: string; } = {}; -socketServer.on("connection", socket => { +socketServer.on("connection", (socket) => { logger.debug(`Socket::Connection [${socket.id}]`); socket.on("subscribe", async (data: INetworkBoundGetRequest) => { const response = await subscribe(config, socket, data); @@ -117,7 +107,7 @@ socketServer.on("connection", socket => { if (sockets[socket.id]) { await unsubscribe(config, socket, { subscriptionId: socket.id, - network: sockets[socket.id] + network: sockets[socket.id], }); delete sockets[socket.id]; } @@ -140,4 +130,3 @@ server.listen(port, async () => { } } }); - diff --git a/api/src/initServices.ts b/api/src/initServices.ts index df7880270..4c643f32e 100644 --- a/api/src/initServices.ts +++ b/api/src/initServices.ts @@ -29,9 +29,7 @@ import { StardustStatsService } from "./services/stardust/stats/stardustStatsSer const CURRENCY_UPDATE_INTERVAL_MS = 5 * 60000; const isKnownProtocolVersion = (networkConfig: INetwork) => - networkConfig.protocolVersion === LEGACY || - networkConfig.protocolVersion === CHRYSALIS || - networkConfig.protocolVersion === STARDUST; + networkConfig.protocolVersion === LEGACY || networkConfig.protocolVersion === CHRYSALIS || networkConfig.protocolVersion === STARDUST; /** * Initialise all the services for the workers. @@ -44,7 +42,7 @@ export async function initServices(config: IConfiguration) { ServiceFactory.register("network", () => networkService); await networkService.buildCache(); const networks = networkService.networks(); - const enabledNetworks = networks.filter(v => v.isEnabled); + const enabledNetworks = networks.filter((v) => v.isEnabled); for (const networkConfig of enabledNetworks) { if (networkConfig.feedEndpoint) { @@ -76,9 +74,7 @@ export async function initServices(config: IConfiguration) { } if (networkConfig.protocolVersion === LEGACY || networkConfig.protocolVersion === CHRYSALIS) { - const itemsService = ServiceFactory.get( - `items-${networkConfig.network}` - ); + const itemsService = ServiceFactory.get(`items-${networkConfig.network}`); if (itemsService) { itemsService.init(); } @@ -111,24 +107,16 @@ function initLegacyServices(networkConfig: INetwork): void { if (networkConfig.feedEndpoint) { logger.verbose(`Initializing Legacy services for ${networkConfig.network}`); ServiceFactory.register( - `zmq-${networkConfig.network}`, () => new ZmqService( - networkConfig.feedEndpoint, [ - "trytes", - "sn", - networkConfig.coordinatorAddress - ]) + `zmq-${networkConfig.network}`, + () => new ZmqService(networkConfig.feedEndpoint, ["trytes", "sn", networkConfig.coordinatorAddress]), ); ServiceFactory.register( - `feed-${networkConfig.network}`, () => new LegacyFeedService( - networkConfig.network, networkConfig.coordinatorAddress) + `feed-${networkConfig.network}`, + () => new LegacyFeedService(networkConfig.network, networkConfig.coordinatorAddress), ); - ServiceFactory.register( - `items-${networkConfig.network}`, - () => new LegacyItemsService(networkConfig.network)); + ServiceFactory.register(`items-${networkConfig.network}`, () => new LegacyItemsService(networkConfig.network)); - ServiceFactory.register( - `stats-${networkConfig.network}`, - () => new LegacyStatsService(networkConfig)); + ServiceFactory.register(`stats-${networkConfig.network}`, () => new LegacyStatsService(networkConfig)); } } @@ -138,22 +126,13 @@ function initLegacyServices(networkConfig: INetwork): void { */ function initChrysalisServices(networkConfig: INetwork): void { logger.verbose(`Initializing Chrysalis services for ${networkConfig.network}`); + ServiceFactory.register(`mqtt-${networkConfig.network}`, () => new ChrysalisMqttClient(networkConfig.feedEndpoint.split(";"))); ServiceFactory.register( - `mqtt-${networkConfig.network}`, () => new ChrysalisMqttClient( - networkConfig.feedEndpoint.split(";")) - ); - ServiceFactory.register( - `feed-${networkConfig.network}`, () => new ChrysalisFeedService( - networkConfig.network, networkConfig.provider, networkConfig.user, networkConfig.password) - ); - ServiceFactory.register( - `items-${networkConfig.network}`, - () => new ChrysalisItemsService(networkConfig.network) - ); - ServiceFactory.register( - `stats-${networkConfig.network}`, - () => new ChrysalisStatsService(networkConfig) + `feed-${networkConfig.network}`, + () => new ChrysalisFeedService(networkConfig.network, networkConfig.provider, networkConfig.user, networkConfig.password), ); + ServiceFactory.register(`items-${networkConfig.network}`, () => new ChrysalisItemsService(networkConfig.network)); + ServiceFactory.register(`stats-${networkConfig.network}`, () => new ChrysalisStatsService(networkConfig)); } /** @@ -164,62 +143,44 @@ function initStardustServices(networkConfig: INetwork): void { logger.verbose(`Initializing Stardust services for ${networkConfig.network}`); const stardustClient = new StardustClient({ nodes: [networkConfig.provider], - brokerOptions: { useWs: true } + brokerOptions: { useWs: true }, }); - ServiceFactory.register( - `client-${networkConfig.network}`, - () => stardustClient - ); + ServiceFactory.register(`client-${networkConfig.network}`, () => stardustClient); if (networkConfig.permaNodeEndpoint) { // Client with permanode needs the ignoreNodeHealth as chronicle is considered "not healthy" by the sdk // Related: https://github.com/iotaledger/inx-chronicle/issues/1302 const stardustPermanodeClient = new StardustClient({ nodes: [networkConfig.permaNodeEndpoint], - ignoreNodeHealth: true + ignoreNodeHealth: true, }); - ServiceFactory.register( - `permanode-client-${networkConfig.network}`, - () => stardustPermanodeClient - ); + ServiceFactory.register(`permanode-client-${networkConfig.network}`, () => stardustPermanodeClient); const chronicleService = new ChronicleService(networkConfig); - ServiceFactory.register( - `chronicle-${networkConfig.network}`, - () => chronicleService - ); + ServiceFactory.register(`chronicle-${networkConfig.network}`, () => chronicleService); } // eslint-disable-next-line no-void - void NodeInfoService.build(networkConfig).then(nodeInfoService => { - ServiceFactory.register( - `node-info-${networkConfig.network}`, - () => nodeInfoService - ); + void NodeInfoService.build(networkConfig).then((nodeInfoService) => { + ServiceFactory.register(`node-info-${networkConfig.network}`, () => nodeInfoService); const stardustFeed = new StardustFeed(networkConfig.network); - ServiceFactory.register( - `feed-${networkConfig.network}`, - () => stardustFeed - ); + ServiceFactory.register(`feed-${networkConfig.network}`, () => stardustFeed); }); const stardustStatsService = new StardustStatsService(networkConfig); - ServiceFactory.register( - `stats-${networkConfig.network}`, - () => stardustStatsService - ); + ServiceFactory.register(`stats-${networkConfig.network}`, () => stardustStatsService); const influxDBService = new InfluxDBService(networkConfig); - influxDBService.buildClient().then(hasClient => { - logger.debug(`[InfluxDb] Registering client with name "${networkConfig.network}". Has client: ${hasClient}`); - if (hasClient) { - ServiceFactory.register( - `influxdb-${networkConfig.network}`, - () => influxDBService - ); - } - }).catch(e => logger.warn(`Failed to build influxDb client for "${networkConfig.network}". Cause: ${e}`)); + influxDBService + .buildClient() + .then((hasClient) => { + logger.debug(`[InfluxDb] Registering client with name "${networkConfig.network}". Has client: ${hasClient}`); + if (hasClient) { + ServiceFactory.register(`influxdb-${networkConfig.network}`, () => influxDBService); + } + }) + .catch((e) => logger.warn(`Failed to build influxDb client for "${networkConfig.network}". Cause: ${e}`)); } /** @@ -229,18 +190,22 @@ function initStardustServices(networkConfig: INetwork): void { async function registerStorageServices(config: IConfiguration): Promise { if (config.rootStorageFolder) { logger.info("Registering 'local' persistence services..."); - ServiceFactory.register("network-storage", () => new LocalStorageService( - config.rootStorageFolder, "network", "network")); + ServiceFactory.register("network-storage", () => new LocalStorageService(config.rootStorageFolder, "network", "network")); - ServiceFactory.register("currency-storage", () => new LocalStorageService( - config.rootStorageFolder, "currency", "id")); + ServiceFactory.register( + "currency-storage", + () => new LocalStorageService(config.rootStorageFolder, "currency", "id"), + ); } else if (config.dynamoDbConnection) { logger.info("Registering 'dynamoDB' persistence services..."); - ServiceFactory.register("network-storage", () => new AmazonDynamoDbService( - config.dynamoDbConnection, "network", "network")); + ServiceFactory.register( + "network-storage", + () => new AmazonDynamoDbService(config.dynamoDbConnection, "network", "network"), + ); - ServiceFactory.register("currency-storage", () => new AmazonDynamoDbService( - config.dynamoDbConnection, "currency", "id")); + ServiceFactory.register( + "currency-storage", + () => new AmazonDynamoDbService(config.dynamoDbConnection, "currency", "id"), + ); } } - diff --git a/api/src/logger.ts b/api/src/logger.ts index e11e27c54..43a620ded 100644 --- a/api/src/logger.ts +++ b/api/src/logger.ts @@ -10,9 +10,9 @@ const { combine, timestamp: timestampFunc, label: labelFunc, printf } = format; const theFormat = combine( labelFunc({ label: `Explorer${version}` }), timestampFunc({ - format: () => (moment().format("DD-MM-YYYY HH:mm:ss.SSSZ")) + format: () => moment().format("DD-MM-YYYY HH:mm:ss.SSSZ"), }), - printf(({ level, message, label, timestamp }) => `[${timestamp}] [${label}] ${level}: ${message}`) + printf(({ level, message, label, timestamp }) => `[${timestamp}] [${label}] ${level}: ${message}`), ); const loggerFormat = process.env.NODE_ENV === "development" ? combine(format.colorize(), theFormat) : theFormat; @@ -27,8 +27,8 @@ if (process.env.GCLOUD_PROJECT) { transportList.push( new transports.Console({ level: logLevel, - format: loggerFormat - }) + format: loggerFormat, + }), ); } @@ -37,9 +37,7 @@ const logger = createLogger({ format: format.json(), defaultMeta: { service: `Explorer${version}` }, // @ts-expect-error Can't find a common type between Console and gCloud winston transport to make ts happy - transports: transportList + transports: transportList, }); - export default logger; - diff --git a/api/src/models/api/ICurrenciesResponse.ts b/api/src/models/api/ICurrenciesResponse.ts index e0fe448e9..aab9ab8da 100644 --- a/api/src/models/api/ICurrenciesResponse.ts +++ b/api/src/models/api/ICurrenciesResponse.ts @@ -15,4 +15,3 @@ export interface ICurrenciesResponse extends IResponse, ISignedResponse { [coinCode: string]: ICoinStats; }; } - diff --git a/api/src/models/api/IFeedSubscribeRequest.ts b/api/src/models/api/IFeedSubscribeRequest.ts index 5d5a8f756..76c46dce2 100644 --- a/api/src/models/api/IFeedSubscribeRequest.ts +++ b/api/src/models/api/IFeedSubscribeRequest.ts @@ -11,4 +11,3 @@ export interface IFeedSubscribeRequest { */ feedSelect?: IFeedSelect; } - diff --git a/api/src/models/api/INetworkBoundGetRequest.ts b/api/src/models/api/INetworkBoundGetRequest.ts index e107839bb..715a724d3 100644 --- a/api/src/models/api/INetworkBoundGetRequest.ts +++ b/api/src/models/api/INetworkBoundGetRequest.ts @@ -8,4 +8,3 @@ export interface INetworkBoundGetRequest { */ network: string; } - diff --git a/api/src/models/api/INetworkGetResponse.ts b/api/src/models/api/INetworkGetResponse.ts index 36edef267..3ef168d13 100644 --- a/api/src/models/api/INetworkGetResponse.ts +++ b/api/src/models/api/INetworkGetResponse.ts @@ -76,4 +76,3 @@ interface INetworkView { */ identityResolverEnabled?: boolean; } - diff --git a/api/src/models/api/chrysalis/identity/IIdentityDidResolveResponse.ts b/api/src/models/api/chrysalis/identity/IIdentityDidResolveResponse.ts index ab2b8f6a1..0db23e774 100644 --- a/api/src/models/api/chrysalis/identity/IIdentityDidResolveResponse.ts +++ b/api/src/models/api/chrysalis/identity/IIdentityDidResolveResponse.ts @@ -1,8 +1,7 @@ import { ILatestDocument } from "./IIdentityLatestDocument"; import { IResponse } from "../../IResponse"; -export interface IIdentityDidResolveResponse extends IResponse{ - +export interface IIdentityDidResolveResponse extends IResponse { /** * message id of resolved DID */ diff --git a/api/src/models/api/chrysalis/identity/IIdentityDiffHistoryResponse.ts b/api/src/models/api/chrysalis/identity/IIdentityDiffHistoryResponse.ts index 2d72ec90b..6fdb358ee 100644 --- a/api/src/models/api/chrysalis/identity/IIdentityDiffHistoryResponse.ts +++ b/api/src/models/api/chrysalis/identity/IIdentityDiffHistoryResponse.ts @@ -1,5 +1,5 @@ export interface IIdentityDiffHistoryResponse { - chainData?: {messageId: string; message: unknown; document: unknown}[]; + chainData?: { messageId: string; message: unknown; document: unknown }[]; spam?: string[]; error?: string; } diff --git a/api/src/models/api/legacy/IAddressGetRequest.ts b/api/src/models/api/legacy/IAddressGetRequest.ts index 13970291e..328b18fb5 100644 --- a/api/src/models/api/legacy/IAddressGetRequest.ts +++ b/api/src/models/api/legacy/IAddressGetRequest.ts @@ -1,4 +1,3 @@ - export interface IAddressGetRequest { /** * The network to search on. diff --git a/api/src/models/api/stardust/IAddressBalanceRequest.ts b/api/src/models/api/stardust/IAddressBalanceRequest.ts index 42dde0cd3..7b632de16 100644 --- a/api/src/models/api/stardust/IAddressBalanceRequest.ts +++ b/api/src/models/api/stardust/IAddressBalanceRequest.ts @@ -9,4 +9,3 @@ export interface IAddressBalanceRequest { */ address: string; } - diff --git a/api/src/models/api/stardust/IAddressDetailsWithBalance.ts b/api/src/models/api/stardust/IAddressDetailsWithBalance.ts index d8dd89916..4530cc523 100644 --- a/api/src/models/api/stardust/IAddressDetailsWithBalance.ts +++ b/api/src/models/api/stardust/IAddressDetailsWithBalance.ts @@ -3,7 +3,7 @@ import { BigInteger } from "big-integer"; /** * Address details with balance info. */ - export default interface IAddressDetailsWithBalance { +export default interface IAddressDetailsWithBalance { /** * The hex for the address the details are for. */ @@ -36,4 +36,3 @@ import { BigInteger } from "big-integer"; */ ledgerIndex: number; } - diff --git a/api/src/models/api/stardust/IAliasRequest.ts b/api/src/models/api/stardust/IAliasRequest.ts index 5454ce6af..5e26d0715 100644 --- a/api/src/models/api/stardust/IAliasRequest.ts +++ b/api/src/models/api/stardust/IAliasRequest.ts @@ -9,4 +9,3 @@ export interface IAliasRequest { */ aliasId: string; } - diff --git a/api/src/models/api/stardust/IAliasResponse.ts b/api/src/models/api/stardust/IAliasResponse.ts index 1c28fff93..a20ade9ed 100644 --- a/api/src/models/api/stardust/IAliasResponse.ts +++ b/api/src/models/api/stardust/IAliasResponse.ts @@ -7,4 +7,3 @@ export interface IAliasResponse extends IResponse { */ aliasDetails?: OutputResponse; } - diff --git a/api/src/models/api/stardust/IAssociationsRequestBody.ts b/api/src/models/api/stardust/IAssociationsRequestBody.ts index 22c770426..8d5c1b747 100644 --- a/api/src/models/api/stardust/IAssociationsRequestBody.ts +++ b/api/src/models/api/stardust/IAssociationsRequestBody.ts @@ -6,4 +6,3 @@ export interface IAssociationsRequestBody { */ addressDetails: IBech32AddressDetails; } - diff --git a/api/src/models/api/stardust/IAssociationsResponse.ts b/api/src/models/api/stardust/IAssociationsResponse.ts index 4ca813638..840e9d786 100644 --- a/api/src/models/api/stardust/IAssociationsResponse.ts +++ b/api/src/models/api/stardust/IAssociationsResponse.ts @@ -1,6 +1,5 @@ import { IResponse } from "../IResponse"; - export enum AssociationType { BASIC_ADDRESS, BASIC_SENDER, @@ -17,7 +16,7 @@ export enum AssociationType { NFT_EXPIRATION_RETURN, NFT_ISSUER, NFT_SENDER, - NFT_ID + NFT_ID, } export interface IAssociation { @@ -37,4 +36,3 @@ export interface IAssociationsResponse extends IResponse { */ associations?: IAssociation[]; } - diff --git a/api/src/models/api/stardust/IBlockRequest.ts b/api/src/models/api/stardust/IBlockRequest.ts index 86e13d956..a9b21aa1c 100644 --- a/api/src/models/api/stardust/IBlockRequest.ts +++ b/api/src/models/api/stardust/IBlockRequest.ts @@ -9,4 +9,3 @@ export interface IBlockRequest { */ blockId: string; } - diff --git a/api/src/models/api/stardust/IBlockResponse.ts b/api/src/models/api/stardust/IBlockResponse.ts index 322517a85..a9435135b 100644 --- a/api/src/models/api/stardust/IBlockResponse.ts +++ b/api/src/models/api/stardust/IBlockResponse.ts @@ -7,4 +7,3 @@ export interface IBlockResponse extends IResponse { */ block?: Block; } - diff --git a/api/src/models/api/stardust/INodeInfoResponse.ts b/api/src/models/api/stardust/INodeInfoResponse.ts index ea5978e9e..792038c3d 100644 --- a/api/src/models/api/stardust/INodeInfoResponse.ts +++ b/api/src/models/api/stardust/INodeInfoResponse.ts @@ -25,4 +25,3 @@ export interface INodeInfoResponse extends IResponse { */ rentStructure?: IRent; } - diff --git a/api/src/models/api/stardust/ITaggedOutputsRequest.ts b/api/src/models/api/stardust/ITaggedOutputsRequest.ts index 2efbf8332..90db50df9 100644 --- a/api/src/models/api/stardust/ITaggedOutputsRequest.ts +++ b/api/src/models/api/stardust/ITaggedOutputsRequest.ts @@ -22,4 +22,3 @@ export interface ITaggedOutputsRequest { */ cursor?: string; } - diff --git a/api/src/models/api/stardust/ITaggedOutputsResponse.ts b/api/src/models/api/stardust/ITaggedOutputsResponse.ts index 2dcfe5c2e..ef784127f 100644 --- a/api/src/models/api/stardust/ITaggedOutputsResponse.ts +++ b/api/src/models/api/stardust/ITaggedOutputsResponse.ts @@ -11,4 +11,3 @@ export interface ITaggedOutputsResponse { */ nftOutputs?: INftOutputsResponse; } - diff --git a/api/src/models/api/stardust/basic/IBasicOutputsResponse.ts b/api/src/models/api/stardust/basic/IBasicOutputsResponse.ts index 373201458..3c2d82d15 100644 --- a/api/src/models/api/stardust/basic/IBasicOutputsResponse.ts +++ b/api/src/models/api/stardust/basic/IBasicOutputsResponse.ts @@ -7,4 +7,3 @@ export interface IBasicOutputsResponse extends IResponse { */ outputs?: IOutputsResponse; } - diff --git a/api/src/models/api/stardust/chronicle/IAddressBalanceResponse.ts b/api/src/models/api/stardust/chronicle/IAddressBalanceResponse.ts index f49c36ad5..92fa362e1 100644 --- a/api/src/models/api/stardust/chronicle/IAddressBalanceResponse.ts +++ b/api/src/models/api/stardust/chronicle/IAddressBalanceResponse.ts @@ -16,4 +16,3 @@ export interface IAddressBalanceResponse extends IResponse { */ ledgerIndex?: number; } - diff --git a/api/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts b/api/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts index 4c3e85b48..75703df76 100644 --- a/api/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts +++ b/api/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts @@ -9,4 +9,3 @@ export interface IRichestAddressesResponse extends IResponse { top?: IRichAddress[]; ledgerIndex?: number; } - diff --git a/api/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts b/api/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts index 61f69a128..93e699c29 100644 --- a/api/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts +++ b/api/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts @@ -10,4 +10,3 @@ export interface ITokenDistributionResponse extends IResponse { distribution?: IDistributionEntry[]; ledgerIndex?: number; } - diff --git a/api/src/models/api/stardust/chronicle/ITransactionHistoryDownloadResponse.ts b/api/src/models/api/stardust/chronicle/ITransactionHistoryDownloadResponse.ts index 1657b9b3e..ec9415feb 100644 --- a/api/src/models/api/stardust/chronicle/ITransactionHistoryDownloadResponse.ts +++ b/api/src/models/api/stardust/chronicle/ITransactionHistoryDownloadResponse.ts @@ -14,4 +14,3 @@ export interface ITransactionHistoryDownloadResponse { */ items?: ITransactionHistoryItem[]; } - diff --git a/api/src/models/api/stardust/chronicle/ITransactionHistoryRequest.ts b/api/src/models/api/stardust/chronicle/ITransactionHistoryRequest.ts index 3ed510424..e27afe617 100644 --- a/api/src/models/api/stardust/chronicle/ITransactionHistoryRequest.ts +++ b/api/src/models/api/stardust/chronicle/ITransactionHistoryRequest.ts @@ -32,4 +32,3 @@ export interface ITransactionHistoryRequest { */ cursor?: string; } - diff --git a/api/src/models/api/stardust/chronicle/ITransactionHistoryResponse.ts b/api/src/models/api/stardust/chronicle/ITransactionHistoryResponse.ts index fba254cc2..dda38e18b 100644 --- a/api/src/models/api/stardust/chronicle/ITransactionHistoryResponse.ts +++ b/api/src/models/api/stardust/chronicle/ITransactionHistoryResponse.ts @@ -44,4 +44,3 @@ export interface ITransactionHistoryResponse extends IResponse { */ cursor?: string; } - diff --git a/api/src/models/api/stardust/feed/IFeedUpdate.ts b/api/src/models/api/stardust/feed/IFeedUpdate.ts index 1618e5b14..082687495 100644 --- a/api/src/models/api/stardust/feed/IFeedUpdate.ts +++ b/api/src/models/api/stardust/feed/IFeedUpdate.ts @@ -22,4 +22,3 @@ export interface IFeedUpdate { blockMetadata?: IFeedBlockMetadataUpdate; milestone?: IFeedMilestoneUpdate; } - diff --git a/api/src/models/api/stardust/foundry/IFoundryRequest.ts b/api/src/models/api/stardust/foundry/IFoundryRequest.ts index 235bde4fb..6c655435c 100644 --- a/api/src/models/api/stardust/foundry/IFoundryRequest.ts +++ b/api/src/models/api/stardust/foundry/IFoundryRequest.ts @@ -9,4 +9,3 @@ export interface IFoundryRequest { */ foundryId: string; } - diff --git a/api/src/models/api/stardust/foundry/IFoundryResponse.ts b/api/src/models/api/stardust/foundry/IFoundryResponse.ts index 8384e0c33..0dd481b93 100644 --- a/api/src/models/api/stardust/foundry/IFoundryResponse.ts +++ b/api/src/models/api/stardust/foundry/IFoundryResponse.ts @@ -7,4 +7,3 @@ export interface IFoundryResponse extends IResponse { */ foundryDetails?: OutputResponse; } - diff --git a/api/src/models/api/stardust/milestone/ILatestMilestonesResponse.ts b/api/src/models/api/stardust/milestone/ILatestMilestonesResponse.ts index 5c208eb02..ed7e7e3e0 100644 --- a/api/src/models/api/stardust/milestone/ILatestMilestonesResponse.ts +++ b/api/src/models/api/stardust/milestone/ILatestMilestonesResponse.ts @@ -28,4 +28,3 @@ export interface ILatestMilestonesReponse extends IResponse { */ milestones: ILatestMilestone[]; } - diff --git a/api/src/models/api/stardust/milestone/IMilestoneBlocksResponse.ts b/api/src/models/api/stardust/milestone/IMilestoneBlocksResponse.ts index 593a4344b..bae43d871 100644 --- a/api/src/models/api/stardust/milestone/IMilestoneBlocksResponse.ts +++ b/api/src/models/api/stardust/milestone/IMilestoneBlocksResponse.ts @@ -1,15 +1,15 @@ import { IResponse } from "../../IResponse"; export interface IMilestoneBlockInfo { - /** - * The block id. - */ - blockId: string; + /** + * The block id. + */ + blockId: string; - /** - * The payload type. - */ - payloadType: number; + /** + * The payload type. + */ + payloadType: number; } export interface IMilestoneBlocksResponse extends IResponse { diff --git a/api/src/models/api/stardust/milestone/IMilestoneStatsRequest.ts b/api/src/models/api/stardust/milestone/IMilestoneStatsRequest.ts index d10fd729b..aa30d976b 100644 --- a/api/src/models/api/stardust/milestone/IMilestoneStatsRequest.ts +++ b/api/src/models/api/stardust/milestone/IMilestoneStatsRequest.ts @@ -9,4 +9,3 @@ export interface IMilestoneStatsRequest { */ milestoneIndex: string; } - diff --git a/api/src/models/api/stardust/nft/INftDetailsRequest.ts b/api/src/models/api/stardust/nft/INftDetailsRequest.ts index b5def2ff8..b1f69d5da 100644 --- a/api/src/models/api/stardust/nft/INftDetailsRequest.ts +++ b/api/src/models/api/stardust/nft/INftDetailsRequest.ts @@ -9,4 +9,3 @@ export interface INftDetailsRequest { */ nftId?: string; } - diff --git a/api/src/models/api/stardust/nft/INftDetailsResponse.ts b/api/src/models/api/stardust/nft/INftDetailsResponse.ts index bf179c2ca..97206499e 100644 --- a/api/src/models/api/stardust/nft/INftDetailsResponse.ts +++ b/api/src/models/api/stardust/nft/INftDetailsResponse.ts @@ -7,4 +7,3 @@ export interface INftDetailsResponse extends IResponse { */ nftDetails?: OutputResponse; } - diff --git a/api/src/models/api/stardust/participation/IParticipationEventPayload.ts b/api/src/models/api/stardust/participation/IParticipationEventPayload.ts index 298db5b17..3351225e8 100644 --- a/api/src/models/api/stardust/participation/IParticipationEventPayload.ts +++ b/api/src/models/api/stardust/participation/IParticipationEventPayload.ts @@ -39,5 +39,5 @@ export interface IParticipationEventPayload { /** * The additional description text about the participation event. */ - additionalInfo?: string; + additionalInfo?: string; } diff --git a/api/src/models/api/stardust/participation/IParticipationEventStatus.ts b/api/src/models/api/stardust/participation/IParticipationEventStatus.ts index e0f4d8c49..f11153d25 100644 --- a/api/src/models/api/stardust/participation/IParticipationEventStatus.ts +++ b/api/src/models/api/stardust/participation/IParticipationEventStatus.ts @@ -12,7 +12,7 @@ export interface IParticipationEventStatus { /** * The answer status of the different questions of the event. */ - questions?: { answers: {value: number; current: number; accumulated: number}[] }[]; + questions?: { answers: { value: number; current: number; accumulated: number }[] }[]; /** * The staking status of the event. @@ -25,4 +25,3 @@ export interface IParticipationEventStatus { */ checksum: string; } - diff --git a/api/src/models/api/stats/IAnalyticStats.ts b/api/src/models/api/stats/IAnalyticStats.ts index 5287e6a2d..47c8e6109 100644 --- a/api/src/models/api/stats/IAnalyticStats.ts +++ b/api/src/models/api/stats/IAnalyticStats.ts @@ -8,4 +8,3 @@ export interface IAnalyticStats { dailyAddresses?: string; lockedStorageDeposit?: string; } - diff --git a/api/src/models/api/stats/IMilestoneAnalyticStats.ts b/api/src/models/api/stats/IMilestoneAnalyticStats.ts index 931ff1d71..e85bbce5b 100644 --- a/api/src/models/api/stats/IMilestoneAnalyticStats.ts +++ b/api/src/models/api/stats/IMilestoneAnalyticStats.ts @@ -11,4 +11,3 @@ export interface IMilestoneAnalyticStats extends IResponse { noPayload?: number; }; } - diff --git a/api/src/models/app/IRoute.ts b/api/src/models/app/IRoute.ts index 2b7d3ae9a..91d1559be 100644 --- a/api/src/models/app/IRoute.ts +++ b/api/src/models/app/IRoute.ts @@ -37,9 +37,5 @@ export interface IRoute { * @param body The request body. * @param header The headers in the http request. */ - inline?( - config: IConfiguration, - params: unknown, - body?: unknown, - headers?: { [id: string]: unknown }): Promise; + inline?(config: IConfiguration, params: unknown, body?: unknown, headers?: { [id: string]: unknown }): Promise; } diff --git a/api/src/models/clients/legacy/IFindTransactionsRequest.ts b/api/src/models/clients/legacy/IFindTransactionsRequest.ts index 3c8749d6c..bc74ee8d3 100644 --- a/api/src/models/clients/legacy/IFindTransactionsRequest.ts +++ b/api/src/models/clients/legacy/IFindTransactionsRequest.ts @@ -1,4 +1,3 @@ - export interface IFindTransactionsRequest { /** * The address of the searched transactions. diff --git a/api/src/models/clients/legacy/IFindTransactionsResponse.ts b/api/src/models/clients/legacy/IFindTransactionsResponse.ts index 59130dffc..a0abe197b 100644 --- a/api/src/models/clients/legacy/IFindTransactionsResponse.ts +++ b/api/src/models/clients/legacy/IFindTransactionsResponse.ts @@ -1,4 +1,3 @@ - export interface IFindTransactionsResponse { /** * Error. diff --git a/api/src/models/db/ICurrencyState.ts b/api/src/models/db/ICurrencyState.ts index 1455469a6..54db3921c 100644 --- a/api/src/models/db/ICurrencyState.ts +++ b/api/src/models/db/ICurrencyState.ts @@ -43,4 +43,3 @@ export interface ICurrencyState { [coinCode: string]: ICoinStats; }; } - diff --git a/api/src/models/db/networkType.ts b/api/src/models/db/networkType.ts index d3ed0821f..1ed69e50a 100644 --- a/api/src/models/db/networkType.ts +++ b/api/src/models/db/networkType.ts @@ -8,16 +8,7 @@ const TESTNET = "testnet"; const ALPHANET = "alphanet"; const CUSTOM = "custom"; -const networkTypes = [ - LEGACY_MAINNET, - CHRYSALIS_MAINNET, - MAINNET, - DEVNET, - SHIMMER, - TESTNET, - ALPHANET, - CUSTOM -] as const; +const networkTypes = [LEGACY_MAINNET, CHRYSALIS_MAINNET, MAINNET, DEVNET, SHIMMER, TESTNET, ALPHANET, CUSTOM] as const; /** * The network type. @@ -26,4 +17,3 @@ export type NetworkType = (typeof networkTypes)[number]; // eslint-disable-next-line @typescript-eslint/no-unsafe-argument export const isValidNetwork = (n: any): n is NetworkType => networkTypes.includes(n); - diff --git a/api/src/models/db/protocolVersion.ts b/api/src/models/db/protocolVersion.ts index d2a480584..2a16f1f50 100644 --- a/api/src/models/db/protocolVersion.ts +++ b/api/src/models/db/protocolVersion.ts @@ -3,11 +3,7 @@ export const LEGACY = "legacy"; export const CHRYSALIS = "chrysalis"; export const STARDUST = "stardust"; -const protocolVersions = [ - LEGACY, - CHRYSALIS, - STARDUST -] as const; +const protocolVersions = [LEGACY, CHRYSALIS, STARDUST] as const; /** * The protocol versions. @@ -16,4 +12,3 @@ export type ProtocolVersion = (typeof protocolVersions)[number]; // eslint-disable-next-line @typescript-eslint/no-unsafe-argument export const isValidProtocol = (p: any): p is ProtocolVersion => protocolVersions.includes(p); - diff --git a/api/src/models/db/uiTheme.ts b/api/src/models/db/uiTheme.ts index 115caa7b5..2d0e8947f 100644 --- a/api/src/models/db/uiTheme.ts +++ b/api/src/models/db/uiTheme.ts @@ -1,10 +1,6 @@ export const IOTA_UI = "iota_ui"; export const SHIMMER_UI = "shimmer_ui"; -const themes = [ - IOTA_UI, - SHIMMER_UI -] as const; +const themes = [IOTA_UI, SHIMMER_UI] as const; export type Theme = (typeof themes)[number]; - diff --git a/api/src/models/influx/IInfluxDbCache.ts b/api/src/models/influx/IInfluxDbCache.ts index ecd1e111d..e792ecb24 100644 --- a/api/src/models/influx/IInfluxDbCache.ts +++ b/api/src/models/influx/IInfluxDbCache.ts @@ -1,9 +1,19 @@ import { - IAddressesWithBalanceDailyInflux, IAliasActivityDailyInflux, IActiveAddressesDailyInflux, - IBlocksDailyInflux, ILedgerSizeDailyInflux, INftActivityDailyInflux, IOutputsDailyInflux, - IStorageDepositDailyInflux, ITokensHeldPerOutputDailyInflux, ITokensHeldWithUnlockConditionDailyInflux, - ITokensTransferredDailyInflux, ITransactionsDailyInflux, IUnclaimedGenesisOutputsDailyInflux, - IUnclaimedTokensDailyInflux, IUnlockConditionsPerTypeDailyInflux + IAddressesWithBalanceDailyInflux, + IAliasActivityDailyInflux, + IActiveAddressesDailyInflux, + IBlocksDailyInflux, + ILedgerSizeDailyInflux, + INftActivityDailyInflux, + IOutputsDailyInflux, + IStorageDepositDailyInflux, + ITokensHeldPerOutputDailyInflux, + ITokensHeldWithUnlockConditionDailyInflux, + ITokensTransferredDailyInflux, + ITransactionsDailyInflux, + IUnclaimedGenesisOutputsDailyInflux, + IUnclaimedTokensDailyInflux, + IUnlockConditionsPerTypeDailyInflux, } from "./IInfluxTimedEntries"; /** @@ -87,6 +97,5 @@ export const initializeEmptyDailyCache = () => ({ unclaimedTokensDaily: new Map(), unclaimedGenesisOutputsDaily: new Map(), ledgerSizeDaily: new Map(), - storageDepositDaily: new Map() + storageDepositDaily: new Map(), }); - diff --git a/api/src/models/influx/IInfluxTimedEntries.ts b/api/src/models/influx/IInfluxTimedEntries.ts index 539d9ad37..5ac7aa529 100644 --- a/api/src/models/influx/IInfluxTimedEntries.ts +++ b/api/src/models/influx/IInfluxTimedEntries.ts @@ -83,4 +83,3 @@ export type ILedgerSizeDailyInflux = ITimedEntry & { export type IStorageDepositDailyInflux = ITimedEntry & { storageDeposit: number | null; }; - diff --git a/api/src/models/services/IFeedService.ts b/api/src/models/services/IFeedService.ts index 676f1b1ec..ae900a4c7 100644 --- a/api/src/models/services/IFeedService.ts +++ b/api/src/models/services/IFeedService.ts @@ -12,9 +12,7 @@ export interface IFeedService { * @param callback The callback for new milestones. * @returns The subscription id. */ - subscribeMilestones( - callback: (milestone: number, id: string, timestamp: number, milestoneId?: string) => void - ): string; + subscribeMilestones(callback: (milestone: number, id: string, timestamp: number, milestoneId?: string) => void): string; /** * Unsubscribe from subscription. diff --git a/api/src/models/services/stardust/IShimmerClaimedResponse.ts b/api/src/models/services/stardust/IShimmerClaimedResponse.ts index c20c73c58..f6a861ce2 100644 --- a/api/src/models/services/stardust/IShimmerClaimedResponse.ts +++ b/api/src/models/services/stardust/IShimmerClaimedResponse.ts @@ -4,4 +4,3 @@ export interface IShimmerClaimedResponse { */ unclaimedShimmer?: string; } - diff --git a/api/src/models/zmq/zmqEvent.ts b/api/src/models/zmq/zmqEvent.ts index b5212f0ea..35bb03670 100644 --- a/api/src/models/zmq/zmqEvent.ts +++ b/api/src/models/zmq/zmqEvent.ts @@ -1,6 +1,4 @@ /** * The different event that can be passed through zmq. */ -export type ZmqEvent = - "sn" | - "trytes"; +export type ZmqEvent = "sn" | "trytes"; diff --git a/api/src/routes.ts b/api/src/routes.ts index d90417965..1836ae714 100644 --- a/api/src/routes.ts +++ b/api/src/routes.ts @@ -11,9 +11,9 @@ export const routes: IRoute[] = [ const packageJson = require("../package.json"); return { name: packageJson.name, - version: packageJson.version + version: packageJson.version, } as IResponse; - } + }, }, // Generic { path: "/init", method: "get", func: "init" }, @@ -32,115 +32,173 @@ export const routes: IRoute[] = [ { path: "/milestone/:network/:milestoneIndex", method: "get", folder: "chrysalis/milestone", func: "get" }, { path: "/output/:network/:outputId", method: "get", folder: "chrysalis/output", func: "get" }, { - path: "/transactionhistory/:network/:address", method: "get", - folder: "chrysalis/transactionhistory", func: "get" + path: "/transactionhistory/:network/:address", + method: "get", + folder: "chrysalis/transactionhistory", + func: "get", }, { - path: "/chrysalis/did/:network/:did/document", method: "get", - folder: "/chrysalis/identity/resolution", func: "get" + path: "/chrysalis/did/:network/:did/document", + method: "get", + folder: "/chrysalis/identity/resolution", + func: "get", }, { - path: "/chrysalis/did/:network/:did/history", method: "get", - folder: "/chrysalis/identity/history", func: "get" + path: "/chrysalis/did/:network/:did/history", + method: "get", + folder: "/chrysalis/identity/history", + func: "get", }, { - path: "/chrysalis/did/:network/diffHistory/:integrationMsgId", method: "post", - folder: "/chrysalis/identity/diff", func: "get", dataBody: true + path: "/chrysalis/did/:network/diffHistory/:integrationMsgId", + method: "post", + folder: "/chrysalis/identity/diff", + func: "get", + dataBody: true, }, // Stardust { path: "/stardust/search/:network/:query", method: "get", folder: "stardust", func: "search" }, { - path: "/stardust/balance/:network/:address", method: "get", - folder: "stardust/address/balance", func: "get" + path: "/stardust/balance/:network/:address", + method: "get", + folder: "stardust/address/balance", + func: "get", }, { - path: "/stardust/balance/chronicle/:network/:address", method: "get", - folder: "stardust/address/balance/chronicle", func: "get" + path: "/stardust/balance/chronicle/:network/:address", + method: "get", + folder: "stardust/address/balance/chronicle", + func: "get", }, { - path: "/stardust/address/outputs/basic/:network/:address", method: "get", - folder: "stardust/address/outputs/basic", func: "get" + path: "/stardust/address/outputs/basic/:network/:address", + method: "get", + folder: "stardust/address/outputs/basic", + func: "get", }, { - path: "/stardust/address/outputs/alias/:network/:address", method: "get", - folder: "stardust/address/outputs/alias", func: "get" + path: "/stardust/address/outputs/alias/:network/:address", + method: "get", + folder: "stardust/address/outputs/alias", + func: "get", }, { - path: "/stardust/address/outputs/nft/:network/:address", method: "get", - folder: "stardust/address/outputs/nft", func: "get" + path: "/stardust/address/outputs/nft/:network/:address", + method: "get", + folder: "stardust/address/outputs/nft", + func: "get", }, { path: "/stardust/block/:network/:blockId", method: "get", folder: "stardust/block", func: "get" }, { - path: "/stardust/block/metadata/:network/:blockId", method: "get", - folder: "stardust/block/metadata", func: "get" + path: "/stardust/block/metadata/:network/:blockId", + method: "get", + folder: "stardust/block/metadata", + func: "get", }, { - path: "/stardust/block/children/:network/:blockId", method: "get", - folder: "stardust/block/children", func: "get" + path: "/stardust/block/children/:network/:blockId", + method: "get", + folder: "stardust/block/children", + func: "get", }, { - path: "/stardust/milestone/latest/:network", method: "get", - folder: "stardust/milestone/latest", func: "get" + path: "/stardust/milestone/latest/:network", + method: "get", + folder: "stardust/milestone/latest", + func: "get", }, { path: "/stardust/milestone/:network/:milestoneIndex", method: "get", folder: "stardust/milestone", func: "get" }, { - path: "/stardust/milestone/blocks/:network/:milestoneId", method: "get", - folder: "stardust/milestone/blocks", func: "get" + path: "/stardust/milestone/blocks/:network/:milestoneId", + method: "get", + folder: "stardust/milestone/blocks", + func: "get", }, { - path: "/stardust/milestone/stats/:network/:milestoneIndex", method: "get", - folder: "stardust/milestone/influx", func: "get" + path: "/stardust/milestone/stats/:network/:milestoneIndex", + method: "get", + folder: "stardust/milestone/influx", + func: "get", }, { path: "/stardust/output/:network/:outputId", method: "get", folder: "stardust/output", func: "get" }, { - path: "/stardust/transaction/:network/:transactionId", method: "get", - folder: "stardust/transaction", func: "get" + path: "/stardust/transaction/:network/:transactionId", + method: "get", + folder: "stardust/transaction", + func: "get", }, { - path: "/stardust/output/associated/:network/:address", method: "post", - folder: "stardust/output/associated", func: "post", dataBody: true + path: "/stardust/output/associated/:network/:address", + method: "post", + folder: "stardust/output/associated", + func: "post", + dataBody: true, }, { - path: "/stardust/output/tagged/:network/:tag/:outputType", method: "get", - folder: "stardust/output/tagged", func: "get" + path: "/stardust/output/tagged/:network/:tag/:outputType", + method: "get", + folder: "stardust/output/tagged", + func: "get", }, { - path: "/stardust/transactionhistory/:network/:address", method: "get", - folder: "stardust/transactionhistory", func: "get" + path: "/stardust/transactionhistory/:network/:address", + method: "get", + folder: "stardust/transactionhistory", + func: "get", }, { - path: "/stardust/transactionhistory/dl/:network/:address", method: "post", - folder: "stardust/transactionhistory/download", func: "post", dataBody: true, dataResponse: true + path: "/stardust/transactionhistory/dl/:network/:address", + method: "post", + folder: "stardust/transactionhistory/download", + func: "post", + dataBody: true, + dataResponse: true, }, { path: "/stardust/nft/:network/:nftId", method: "get", folder: "stardust/nft", func: "get" }, { path: "/stardust/alias/:network/:aliasId", method: "get", folder: "stardust/alias", func: "get" }, { - path: "/stardust/alias/foundries/:network/:aliasAddress", method: "get", - folder: "stardust/alias/foundries", func: "get" + path: "/stardust/alias/foundries/:network/:aliasAddress", + method: "get", + folder: "stardust/alias/foundries", + func: "get", }, { path: "/stardust/foundry/:network/:foundryId", method: "get", folder: "stardust/foundry", func: "get" }, { - path: "/stardust/analytics/:network", method: "get", - folder: "stardust/analytics/influx/stats", func: "get", sign: true + path: "/stardust/analytics/:network", + method: "get", + folder: "stardust/analytics/influx/stats", + func: "get", + sign: true, }, { - path: "/stardust/analytics/daily/:network", method: "get", - folder: "stardust/analytics/influx/daily", func: "get", sign: true + path: "/stardust/analytics/daily/:network", + method: "get", + folder: "stardust/analytics/influx/daily", + func: "get", + sign: true, }, { - path: "/stardust/did/:network/:did/document", method: "get", - folder: "stardust/identity/resolution-stardust", func: "get" + path: "/stardust/did/:network/:did/document", + method: "get", + folder: "stardust/identity/resolution-stardust", + func: "get", }, { - path: "/stardust/participation/events/:network/:eventId", method: "get", - folder: "stardust/participation/events", func: "get" + path: "/stardust/participation/events/:network/:eventId", + method: "get", + folder: "stardust/participation/events", + func: "get", }, { - path: "/stardust/address/rich/:network", method: "get", - folder: "stardust/address/richest", func: "get" + path: "/stardust/address/rich/:network", + method: "get", + folder: "stardust/address/richest", + func: "get", }, { - path: "/stardust/token/distribution/:network", method: "get", - folder: "stardust/address/distribution", func: "get" - } + path: "/stardust/token/distribution/:network", + method: "get", + folder: "stardust/address/distribution", + func: "get", + }, ]; diff --git a/api/src/routes/chrysalis/identity/diff/get.ts b/api/src/routes/chrysalis/identity/diff/get.ts index 144c49d89..e27e8f2f7 100644 --- a/api/src/routes/chrysalis/identity/diff/get.ts +++ b/api/src/routes/chrysalis/identity/diff/get.ts @@ -16,11 +16,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param body The request body. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IIdentityDiffHistoryRequest, - body: IIdentityDiffHistoryBody -): Promise { +export async function get(config: IConfiguration, request: IIdentityDiffHistoryRequest, body: IIdentityDiffHistoryBody): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); @@ -30,7 +26,7 @@ export async function get( if (networkConfig.protocolVersion !== CHRYSALIS) { return { error: `Network is not supported. IOTA Identity only supports - chrysalis phase 2 networks, such as the IOTA main network.` + chrysalis phase 2 networks, such as the IOTA main network.`, }; } @@ -56,12 +52,12 @@ export async function get( async function resolveDiff( document: IIdentityDiffHistoryBody, nodeUrl: string, - permaNodeUrl?: string + permaNodeUrl?: string, ): Promise { try { const config: identity.IClientConfig = { nodes: [nodeUrl], - permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined + permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined, }; const client = await identity.Client.fromConfig(config); @@ -81,7 +77,7 @@ async function resolveDiff( const integrationMessage = { message: receiptObj.chainData[i], document: resolvedDocument.document(), - messageId: chainData[i].messageId() + messageId: chainData[i].messageId(), }; diffChainData.push(integrationMessage); } @@ -101,7 +97,7 @@ async function resolveDiff( async function resolveLegacyDiff( document: identityLegacy.Document, nodeUrl: string, - permaNodeUrl?: string + permaNodeUrl?: string, ): Promise { try { const config = new identityLegacy.Config(); @@ -126,7 +122,7 @@ async function resolveLegacyDiff( const integrationMessage = { message: receiptObj.chainData[i], document: IdentityHelper.convertLegacyDocument(document.toJSON() as Record), - messageId: chainData[i].messageId + messageId: chainData[i].messageId, }; diffChainData.push(integrationMessage); } diff --git a/api/src/routes/chrysalis/identity/history/get.ts b/api/src/routes/chrysalis/identity/history/get.ts index cc4566cbf..4a2ea1df6 100644 --- a/api/src/routes/chrysalis/identity/history/get.ts +++ b/api/src/routes/chrysalis/identity/history/get.ts @@ -26,7 +26,7 @@ export async function get(config: IConfiguration, request: IIdentityDidHistoryRe if (networkConfig.protocolVersion !== CHRYSALIS) { return { error: `Network is not supported. IOTA Identity only supports - chrysalis phase 2 networks, such as the IOTA main network.` + chrysalis phase 2 networks, such as the IOTA main network.`, }; } @@ -44,15 +44,11 @@ export async function get(config: IConfiguration, request: IIdentityDidHistoryRe * @param permaNodeUrl url of permanode. * @returns The response. */ -async function resolveHistory( - did: string, - nodeUrl: string, - permaNodeUrl?: string -): Promise { +async function resolveHistory(did: string, nodeUrl: string, permaNodeUrl?: string): Promise { try { const config: identity.IClientConfig = { nodes: [nodeUrl], - permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined + permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined, }; const client = await identity.Client.fromConfig(config); @@ -65,7 +61,7 @@ async function resolveHistory( for (const element of receipt.integrationChainData()) { const integrationMessage = { document: element.toJSON(), - messageId: element.toJSON().integrationMessageId + messageId: element.toJSON().integrationMessageId, }; integrationChainData.push(integrationMessage); } @@ -73,7 +69,7 @@ async function resolveHistory( const history = { integrationChainData, diffChainData: receiptObj.diffChainData, - diffChainSpam: receiptObj.diffChainSpam + diffChainSpam: receiptObj.diffChainSpam, }; return history; @@ -87,10 +83,7 @@ async function resolveHistory( * @param nodeUrl url of the network node. * @returns The response. */ -async function resolveLegacyHistory( - did: string, - nodeUrl: string -): Promise { +async function resolveLegacyHistory(did: string, nodeUrl: string): Promise { try { const config = new identityLegacy.Config(); config.setNode(nodeUrl); @@ -105,7 +98,7 @@ async function resolveLegacyHistory( for (const element of receipt.integrationChainData()) { const integrationMessage = { document: IdentityHelper.convertLegacyDocument(element.toJSON() as Record), - messageId: element.messageId + messageId: element.messageId, }; integrationChainData.push(integrationMessage); } @@ -113,7 +106,7 @@ async function resolveLegacyHistory( const history = { integrationChainData, diffChainData: receiptObj.diffChainData, - diffChainSpam: receiptObj.diffChainSpam + diffChainSpam: receiptObj.diffChainSpam, }; return history; diff --git a/api/src/routes/chrysalis/identity/resolution/get.ts b/api/src/routes/chrysalis/identity/resolution/get.ts index 39efcde82..b16b418ea 100644 --- a/api/src/routes/chrysalis/identity/resolution/get.ts +++ b/api/src/routes/chrysalis/identity/resolution/get.ts @@ -16,10 +16,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IIdentityDidResolveRequest -): Promise { +export async function get(config: IConfiguration, request: IIdentityDidResolveRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); @@ -30,7 +27,7 @@ export async function get( if (networkConfig.protocolVersion !== CHRYSALIS) { return { // eslint-disable-next-line max-len - error: "Network is not supported. IOTA Identity only supports chrysalis phase 2 networks, such as the IOTA main network. " + error: "Network is not supported. IOTA Identity only supports chrysalis phase 2 networks, such as the IOTA main network. ", }; } @@ -59,15 +56,11 @@ export async function get( * @param permaNodeUrl url of permanode. * @returns The response. */ -async function resolveIdentity( - did: string, - nodeUrl: string, - permaNodeUrl?: string -): Promise { +async function resolveIdentity(did: string, nodeUrl: string, permaNodeUrl?: string): Promise { try { const config: identity.IClientConfig = { nodes: [nodeUrl], - permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined + permanodes: permaNodeUrl ? [{ url: permaNodeUrl }] : undefined, }; const client = await identity.Client.fromConfig(config); @@ -76,7 +69,7 @@ async function resolveIdentity( return { document: res.toJSON(), version: "latest", - messageId: res.toJSON().integrationMessageId + messageId: res.toJSON().integrationMessageId, }; } catch (e) { return { error: improveErrorMessage(e) }; @@ -89,11 +82,7 @@ async function resolveIdentity( * @param permaNodeUrl url of permanode. * @returns The response. */ - async function resolveLegacyIdentity( - did: string, - nodeUrl: string, - permaNodeUrl?: string -): Promise { +async function resolveLegacyIdentity(did: string, nodeUrl: string, permaNodeUrl?: string): Promise { try { const config = new identityLegacy.Config(); config.setNode(nodeUrl); @@ -107,7 +96,7 @@ async function resolveIdentity( return { document: IdentityHelper.convertLegacyDocument(document), messageId: res.messageId, - version: "legacy" + version: "legacy", }; } catch (e) { return { error: improveErrorMessage(e) }; diff --git a/api/src/routes/chrysalis/message/get.ts b/api/src/routes/chrysalis/message/get.ts index 1fd45c7cd..fd84d1f29 100644 --- a/api/src/routes/chrysalis/message/get.ts +++ b/api/src/routes/chrysalis/message/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IMessageDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IMessageDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/chrysalis/milestone/get.ts b/api/src/routes/chrysalis/milestone/get.ts index dcbcaea7d..0e4dc89b6 100644 --- a/api/src/routes/chrysalis/milestone/get.ts +++ b/api/src/routes/chrysalis/milestone/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IMilestoneDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IMilestoneDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -29,6 +26,6 @@ export async function get( } return { - milestone: await ChrysalisTangleHelper.milestoneDetails(networkConfig, Number(request.milestoneIndex)) + milestone: await ChrysalisTangleHelper.milestoneDetails(networkConfig, Number(request.milestoneIndex)), }; } diff --git a/api/src/routes/chrysalis/output/get.ts b/api/src/routes/chrysalis/output/get.ts index 1fd3704b8..ff0c1d282 100644 --- a/api/src/routes/chrysalis/output/get.ts +++ b/api/src/routes/chrysalis/output/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IOutputDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IOutputDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -29,6 +26,6 @@ export async function get( } return { - output: await ChrysalisTangleHelper.outputDetails(networkConfig, request.outputId) + output: await ChrysalisTangleHelper.outputDetails(networkConfig, request.outputId), }; } diff --git a/api/src/routes/chrysalis/search.ts b/api/src/routes/chrysalis/search.ts index dfb219e81..95599dcf7 100644 --- a/api/src/routes/chrysalis/search.ts +++ b/api/src/routes/chrysalis/search.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function search( - config: IConfiguration, - request: ISearchRequest -): Promise { +export async function search(config: IConfiguration, request: ISearchRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/chrysalis/transactionhistory/get.ts b/api/src/routes/chrysalis/transactionhistory/get.ts index a16886d5c..43efb3cf0 100644 --- a/api/src/routes/chrysalis/transactionhistory/get.ts +++ b/api/src/routes/chrysalis/transactionhistory/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: ITransactionHistoryRequest -): Promise { +export async function get(config: IConfiguration, request: ITransactionHistoryRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/currency/get.ts b/api/src/routes/currency/get.ts index e37cffa7b..e757a93a1 100644 --- a/api/src/routes/currency/get.ts +++ b/api/src/routes/currency/get.ts @@ -21,7 +21,7 @@ export async function get(_: IConfiguration): Promise { return { fiatExchangeRatesEur: currency.fiatExchangeRatesEur, - coinStats: currency.coinStats + coinStats: currency.coinStats, }; } diff --git a/api/src/routes/feed/subscribe.ts b/api/src/routes/feed/subscribe.ts index 54c73af19..1d397c134 100644 --- a/api/src/routes/feed/subscribe.ts +++ b/api/src/routes/feed/subscribe.ts @@ -21,7 +21,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; export async function subscribe( _: IConfiguration, socket: SocketIO.Socket, - request: IFeedSubscribeRequest + request: IFeedSubscribeRequest, ): Promise { let response: IFeedSubscribeResponse; logger.verbose(`[subscribe] req = ${JSON.stringify(request)}`); @@ -35,12 +35,10 @@ export async function subscribe( const networkConfig = networkService.get(request.network); if (networkConfig.protocolVersion === LEGACY || networkConfig.protocolVersion === CHRYSALIS) { - const service = ServiceFactory.get( - `items-${request.network}` - ); + const service = ServiceFactory.get(`items-${request.network}`); if (service) { - service.subscribe(socket.id, async data => { + service.subscribe(socket.id, async (data) => { socket.emit("transactions", data); }); } @@ -51,35 +49,27 @@ export async function subscribe( const service = ServiceFactory.get(`feed-${request.network}`); if (service) { - await ( - request.feedSelect === "block" ? - service.subscribeBlocks( - socket.id, - async data => { - socket.emit("block", data); - } - ) : - service.subscribeMilestones( - socket.id, - async data => { - socket.emit("milestone", data); - } - ) - ); + await (request.feedSelect === "block" + ? service.subscribeBlocks(socket.id, async (data) => { + socket.emit("block", data); + }) + : service.subscribeMilestones(socket.id, async (data) => { + socket.emit("milestone", data); + })); } } else { return { - error: "Network protocol not supported for feed." + error: "Network protocol not supported for feed.", }; } response = { subscriptionId: socket.id, - network: request.network + network: request.network, }; } catch (err) { response = { - error: err.toString() + error: err.toString(), }; } diff --git a/api/src/routes/feed/unsubscribe.ts b/api/src/routes/feed/unsubscribe.ts index caa43bb75..de318d845 100644 --- a/api/src/routes/feed/unsubscribe.ts +++ b/api/src/routes/feed/unsubscribe.ts @@ -18,11 +18,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function unsubscribe( - _: IConfiguration, - socket: SocketIO.Socket, - request: IFeedUnsubscribeRequest -): Promise { +export async function unsubscribe(_: IConfiguration, socket: SocketIO.Socket, request: IFeedUnsubscribeRequest): Promise { let response: IResponse; logger.verbose(`[unsubscribe] req = ${JSON.stringify(request)}`); @@ -34,10 +30,7 @@ export async function unsubscribe( const networkConfig = networkService.get(request.network); if (networkConfig.protocolVersion === LEGACY || networkConfig.protocolVersion === CHRYSALIS) { - const itemsService = ServiceFactory.get( - `items-${request.network}` - ); + const itemsService = ServiceFactory.get(`items-${request.network}`); if (itemsService) { itemsService.unsubscribe(request.subscriptionId); @@ -57,14 +50,14 @@ export async function unsubscribe( } } else { return { - error: "Network protocol not supported for feed." + error: "Network protocol not supported for feed.", }; } response = {}; } catch (err) { response = { - error: err.toString() + error: err.toString(), }; } diff --git a/api/src/routes/legacy/address/get.ts b/api/src/routes/legacy/address/get.ts index 370a37717..49e03c1aa 100644 --- a/api/src/routes/legacy/address/get.ts +++ b/api/src/routes/legacy/address/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAddressGetRequest -): Promise { +export async function get(config: IConfiguration, request: IAddressGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,6 +28,6 @@ export async function get( const balance = await LegacyTangleHelper.getAddressBalance(networkConfig, request.address); return { - balance + balance, }; } diff --git a/api/src/routes/legacy/milestones/get.ts b/api/src/routes/legacy/milestones/get.ts index 493b290bb..c64283802 100644 --- a/api/src/routes/legacy/milestones/get.ts +++ b/api/src/routes/legacy/milestones/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IMilestoneGetRequest -): Promise { +export async function get(config: IConfiguration, request: IMilestoneGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); diff --git a/api/src/routes/legacy/transactions/get.ts b/api/src/routes/legacy/transactions/get.ts index d6ef8bab1..fd6fd295a 100644 --- a/api/src/routes/legacy/transactions/get.ts +++ b/api/src/routes/legacy/transactions/get.ts @@ -16,10 +16,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: ITransactionsGetRequest -): Promise { +export async function get(config: IConfiguration, request: ITransactionsGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -52,8 +49,7 @@ export async function get( } for (const mode of modes) { - const { hashes, cursor } = - await LegacyTangleHelper.findHashes(networkConfig, mode, request.hash, request.limit); + const { hashes, cursor } = await LegacyTangleHelper.findHashes(networkConfig, mode, request.hash, request.limit); if (hashes && hashes.length > 0) { foundMode = mode; @@ -78,6 +74,6 @@ export async function get( return { mode: foundMode, txHashes, - cursor: txCursor + cursor: txCursor, }; } diff --git a/api/src/routes/legacy/trytes/post.ts b/api/src/routes/legacy/trytes/post.ts index c78e21231..d68eee5c4 100644 --- a/api/src/routes/legacy/trytes/post.ts +++ b/api/src/routes/legacy/trytes/post.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function post( - config: IConfiguration, - request: ITrytesRetrieveRequest -): Promise { +export async function post(config: IConfiguration, request: ITrytesRetrieveRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,6 +28,6 @@ export async function post( return { trytes, - milestoneIndexes + milestoneIndexes, }; } diff --git a/api/src/routes/networks/get.ts b/api/src/routes/networks/get.ts index 19a823e45..dd4f2a502 100644 --- a/api/src/routes/networks/get.ts +++ b/api/src/routes/networks/get.ts @@ -18,7 +18,8 @@ export async function get(_: IConfiguration): Promise { // Only return networks that are not hidden and enabled // and copy the fields needed by the client // as we don't want to expose all the information - .filter(n => !n.isHidden && n.isEnabled).map(n => ({ + .filter((n) => !n.isHidden && n.isEnabled) + .map((n) => ({ network: n.network, label: n.label, protocolVersion: n.protocolVersion, @@ -27,12 +28,11 @@ export async function get(_: IConfiguration): Promise { isEnabled: n.isEnabled, showMarket: n.showMarket, uiTheme: n.uiTheme, - hasStatisticsSupport: ( + hasStatisticsSupport: Boolean(n.analyticsInfluxDbEndpoint) && Boolean(n.analyticsInfluxDbDatabase) && Boolean(n.analyticsInfluxDbUsername) && - Boolean(n.analyticsInfluxDbPassword) - ), + Boolean(n.analyticsInfluxDbPassword), description: n.description, bechHrp: n.bechHrp, didExample: n.didExample, @@ -40,7 +40,7 @@ export async function get(_: IConfiguration): Promise { milestoneInterval: n.milestoneInterval, circulatingSupply: n.circulatingSupply, identityResolverEnabled: n.identityResolverEnabled, - tokenRegistryEndpoint: n.tokenRegistryEndpoint - })) + tokenRegistryEndpoint: n.tokenRegistryEndpoint, + })), }; } diff --git a/api/src/routes/node/info.ts b/api/src/routes/node/info.ts index 8e50ed601..0b1334368 100644 --- a/api/src/routes/node/info.ts +++ b/api/src/routes/node/info.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function info( - _: IConfiguration, - request: INetworkBoundGetRequest -): Promise { +export async function info(_: IConfiguration, request: INetworkBoundGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); diff --git a/api/src/routes/stardust/address/balance/chronicle/get.ts b/api/src/routes/stardust/address/balance/chronicle/get.ts index 7a48712f6..806cc5e1a 100644 --- a/api/src/routes/stardust/address/balance/chronicle/get.ts +++ b/api/src/routes/stardust/address/balance/chronicle/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IAddressBalanceRequest -): Promise { +export async function get(_: IConfiguration, request: IAddressBalanceRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,10 +28,7 @@ export async function get( return {}; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); return chronicleService.addressBalance(request.address); } - diff --git a/api/src/routes/stardust/address/balance/get.ts b/api/src/routes/stardust/address/balance/get.ts index cf6eca2ac..2d0032c9b 100644 --- a/api/src/routes/stardust/address/balance/get.ts +++ b/api/src/routes/stardust/address/balance/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAddressBalanceRequest -): Promise { +export async function get(config: IConfiguration, request: IAddressBalanceRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -29,4 +26,3 @@ export async function get( return StardustTangleHelper.addressDetails(networkConfig, request.address); } - diff --git a/api/src/routes/stardust/address/distribution/get.ts b/api/src/routes/stardust/address/distribution/get.ts index 78a814350..077130d9c 100644 --- a/api/src/routes/stardust/address/distribution/get.ts +++ b/api/src/routes/stardust/address/distribution/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: INetworkBoundGetRequest -): Promise { +export async function get(_: IConfiguration, request: INetworkBoundGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,10 +28,7 @@ export async function get( return {}; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); return chronicleService.tokenDistributionLatest ?? { error: { code: "404", message: "no chronicle data" } }; } - diff --git a/api/src/routes/stardust/address/outputs/alias/get.ts b/api/src/routes/stardust/address/outputs/alias/get.ts index 1949b4ec2..6fcc1aec1 100644 --- a/api/src/routes/stardust/address/outputs/alias/get.ts +++ b/api/src/routes/stardust/address/outputs/alias/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAddressDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IAddressDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/address/outputs/basic/get.ts b/api/src/routes/stardust/address/outputs/basic/get.ts index 94cbe2dff..616fc181b 100644 --- a/api/src/routes/stardust/address/outputs/basic/get.ts +++ b/api/src/routes/stardust/address/outputs/basic/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAddressDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IAddressDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -29,4 +26,3 @@ export async function get( return StardustTangleHelper.basicOutputDetailsByAddress(networkConfig, request.address); } - diff --git a/api/src/routes/stardust/address/outputs/nft/get.ts b/api/src/routes/stardust/address/outputs/nft/get.ts index 69b7e4fac..85b8cd4bd 100644 --- a/api/src/routes/stardust/address/outputs/nft/get.ts +++ b/api/src/routes/stardust/address/outputs/nft/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAddressDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IAddressDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/address/richest/get.ts b/api/src/routes/stardust/address/richest/get.ts index 839f65eec..7cf9302d8 100644 --- a/api/src/routes/stardust/address/richest/get.ts +++ b/api/src/routes/stardust/address/richest/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: INetworkBoundGetRequest -): Promise { +export async function get(_: IConfiguration, request: INetworkBoundGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,10 +28,7 @@ export async function get( return {}; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); return chronicleService.richestAddressesLatest ?? { error: { code: "404", message: "no chronicle data" } }; } - diff --git a/api/src/routes/stardust/alias/foundries/get.ts b/api/src/routes/stardust/alias/foundries/get.ts index 1db9b1c0d..548673d73 100644 --- a/api/src/routes/stardust/alias/foundries/get.ts +++ b/api/src/routes/stardust/alias/foundries/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IFoundriesRequest -): Promise { +export async function get(config: IConfiguration, request: IFoundriesRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/alias/get.ts b/api/src/routes/stardust/alias/get.ts index 80cfaa762..41a2e6bc2 100644 --- a/api/src/routes/stardust/alias/get.ts +++ b/api/src/routes/stardust/alias/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IAliasRequest -): Promise { +export async function get(config: IConfiguration, request: IAliasRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/analytics/influx/daily/get.ts b/api/src/routes/stardust/analytics/influx/daily/get.ts index bcbe42b5a..7fb19ec33 100644 --- a/api/src/routes/stardust/analytics/influx/daily/get.ts +++ b/api/src/routes/stardust/analytics/influx/daily/get.ts @@ -3,11 +3,21 @@ import { INetworkBoundGetRequest } from "../../../../../models/api/INetworkBound import { IConfiguration } from "../../../../../models/configuration/IConfiguration"; import { STARDUST } from "../../../../../models/db/protocolVersion"; import { - IAddressesWithBalanceDailyInflux, IAliasActivityDailyInflux, IActiveAddressesDailyInflux, - IBlocksDailyInflux, ILedgerSizeDailyInflux, INftActivityDailyInflux, IOutputsDailyInflux, - IStorageDepositDailyInflux, ITokensHeldPerOutputDailyInflux, ITokensHeldWithUnlockConditionDailyInflux, - ITokensTransferredDailyInflux, ITransactionsDailyInflux, IUnclaimedGenesisOutputsDailyInflux, - IUnclaimedTokensDailyInflux, IUnlockConditionsPerTypeDailyInflux + IAddressesWithBalanceDailyInflux, + IAliasActivityDailyInflux, + IActiveAddressesDailyInflux, + IBlocksDailyInflux, + ILedgerSizeDailyInflux, + INftActivityDailyInflux, + IOutputsDailyInflux, + IStorageDepositDailyInflux, + ITokensHeldPerOutputDailyInflux, + ITokensHeldWithUnlockConditionDailyInflux, + ITokensTransferredDailyInflux, + ITransactionsDailyInflux, + IUnclaimedGenesisOutputsDailyInflux, + IUnclaimedTokensDailyInflux, + IUnlockConditionsPerTypeDailyInflux, } from "../../../../../models/influx/IInfluxTimedEntries"; import { NetworkService } from "../../../../../services/networkService"; import { InfluxDBService } from "../../../../../services/stardust/influx/influxDbService"; @@ -41,10 +51,7 @@ export interface IDailyAnalyticsResponse { * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: INetworkBoundGetRequest -): Promise { +export async function get(_: IConfiguration, request: INetworkBoundGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); const networkConfig = networkService.get(request.network); @@ -56,24 +63,25 @@ export async function get( const influxService = ServiceFactory.get(`influxdb-${request.network}`); - return influxService ? { - blocksDaily: influxService.blocksDaily, - transactionsDaily: influxService.transactionsDaily, - outputsDaily: influxService.outputsDaily, - tokensHeldDaily: influxService.tokensHeldDaily, - addressesWithBalanceDaily: influxService.addressesWithBalanceDaily, - activeAddressesDaily: influxService.activeAddressesDaily, - tokensTransferredDaily: influxService.tokensTransferredDaily, - aliasActivityDaily: influxService.aliasActivityDaily, - unlockConditionsPerTypeDaily: influxService.unlockConditionsPerTypeDaily, - nftActivityDaily: influxService.nftActivityDaily, - tokensHeldWithUnlockConditionDaily: influxService.tokensHeldWithUnlockConditionDaily, - unclaimedTokensDaily: influxService.unclaimedTokensDaily, - unclaimedGenesisOutputsDaily: influxService.unclaimedGenesisOutputsDaily, - ledgerSizeDaily: influxService.ledgerSizeDaily, - storageDepositDaily: influxService.storageDepositDaily - } : { - error: "Influx service not found for this network." - }; + return influxService + ? { + blocksDaily: influxService.blocksDaily, + transactionsDaily: influxService.transactionsDaily, + outputsDaily: influxService.outputsDaily, + tokensHeldDaily: influxService.tokensHeldDaily, + addressesWithBalanceDaily: influxService.addressesWithBalanceDaily, + activeAddressesDaily: influxService.activeAddressesDaily, + tokensTransferredDaily: influxService.tokensTransferredDaily, + aliasActivityDaily: influxService.aliasActivityDaily, + unlockConditionsPerTypeDaily: influxService.unlockConditionsPerTypeDaily, + nftActivityDaily: influxService.nftActivityDaily, + tokensHeldWithUnlockConditionDaily: influxService.tokensHeldWithUnlockConditionDaily, + unclaimedTokensDaily: influxService.unclaimedTokensDaily, + unclaimedGenesisOutputsDaily: influxService.unclaimedGenesisOutputsDaily, + ledgerSizeDaily: influxService.ledgerSizeDaily, + storageDepositDaily: influxService.storageDepositDaily, + } + : { + error: "Influx service not found for this network.", + }; } - diff --git a/api/src/routes/stardust/analytics/influx/stats/get.ts b/api/src/routes/stardust/analytics/influx/stats/get.ts index f8e1f0d6e..169d85ebe 100644 --- a/api/src/routes/stardust/analytics/influx/stats/get.ts +++ b/api/src/routes/stardust/analytics/influx/stats/get.ts @@ -20,10 +20,7 @@ type IAnalyticStatsReponse = IAnalyticStats & IShimmerClaimedResponse & IRespons * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: INetworkBoundGetRequest -): Promise { +export async function get(_: IConfiguration, request: INetworkBoundGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); const networkConfig = networkService.get(request.network); @@ -35,15 +32,16 @@ export async function get( const influxService = ServiceFactory.get(`influxdb-${request.network}`); - return influxService ? { - nativeTokens: influxService.nativeTokensCount, - nfts: influxService.nftsCount, - totalAddresses: influxService.addressesWithBalance, - dailyAddresses: "", - lockedStorageDeposit: influxService.lockedStorageDeposit, - unclaimedShimmer: influxService.totalUnclaimedShimmer - } : { - error: "Influx service not found for this network." - }; + return influxService + ? { + nativeTokens: influxService.nativeTokensCount, + nfts: influxService.nftsCount, + totalAddresses: influxService.addressesWithBalance, + dailyAddresses: "", + lockedStorageDeposit: influxService.lockedStorageDeposit, + unclaimedShimmer: influxService.totalUnclaimedShimmer, + } + : { + error: "Influx service not found for this network.", + }; } - diff --git a/api/src/routes/stardust/block/children/get.ts b/api/src/routes/stardust/block/children/get.ts index e01255beb..d60a2a54d 100644 --- a/api/src/routes/stardust/block/children/get.ts +++ b/api/src/routes/stardust/block/children/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IBlockRequest -): Promise { +export async function get(_: IConfiguration, request: IBlockRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -28,9 +25,7 @@ export async function get( return { error: "Endpoint available only on Stardust networks." }; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); if (chronicleService) { const blockChildrenResponse = await chronicleService.blockChildren(request.blockId); diff --git a/api/src/routes/stardust/block/get.ts b/api/src/routes/stardust/block/get.ts index 9680bf7ba..49ecc7457 100644 --- a/api/src/routes/stardust/block/get.ts +++ b/api/src/routes/stardust/block/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IBlockRequest -): Promise { +export async function get(_: IConfiguration, request: IBlockRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/block/metadata/get.ts b/api/src/routes/stardust/block/metadata/get.ts index ba0120304..efdcfeea0 100644 --- a/api/src/routes/stardust/block/metadata/get.ts +++ b/api/src/routes/stardust/block/metadata/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IBlockRequest -): Promise { +export async function get(_: IConfiguration, request: IBlockRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/foundry/get.ts b/api/src/routes/stardust/foundry/get.ts index f35078eea..d4d7836ed 100644 --- a/api/src/routes/stardust/foundry/get.ts +++ b/api/src/routes/stardust/foundry/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IFoundryRequest -): Promise { +export async function get(config: IConfiguration, request: IFoundryRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/identity/resolution-stardust/get.ts b/api/src/routes/stardust/identity/resolution-stardust/get.ts index e56ed2ab8..799f69040 100644 --- a/api/src/routes/stardust/identity/resolution-stardust/get.ts +++ b/api/src/routes/stardust/identity/resolution-stardust/get.ts @@ -14,10 +14,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns Resolved document or error. */ -export async function get( - _config: IConfiguration, - request: IIdentityStardustResolveRequest -): Promise { +export async function get(_config: IConfiguration, request: IIdentityStardustResolveRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -35,14 +32,14 @@ export async function get( return { document: { doc: document, - meta: resolvedDocument.metadata().toJSON() + meta: resolvedDocument.metadata().toJSON(), }, governorAddress, - stateControllerAddress + stateControllerAddress, }; } catch (e) { return { - error: buildErrorMessage(e.name as string) + error: buildErrorMessage(e.name as string), }; } } @@ -70,8 +67,7 @@ async function resolveIdentity(network: string, did: string): Promise:'"; + const didInvalidMessage = "The provided DID is invalid. A valid DID has the following format 'did:iota::'"; if (errorName === "InvalidMethodName" || errorName === "InvalidMethodId") { return `${errorName} error: ${didInvalidMessage}`; } diff --git a/api/src/routes/stardust/milestone/blocks/get.ts b/api/src/routes/stardust/milestone/blocks/get.ts index 9fe911b3b..204f48a19 100644 --- a/api/src/routes/stardust/milestone/blocks/get.ts +++ b/api/src/routes/stardust/milestone/blocks/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IMilestoneBlocksRequest -): Promise { +export async function get(_: IConfiguration, request: IMilestoneBlocksRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -28,9 +25,7 @@ export async function get( return { error: "Endpoint available only on Stardust networks." }; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); if (chronicleService) { const milestoneBlocksResponse = await chronicleService.milestoneBlocks(request.milestoneId); @@ -39,4 +34,3 @@ export async function get( return { error: "ChronicleService unavailable for this network." }; } - diff --git a/api/src/routes/stardust/milestone/get.ts b/api/src/routes/stardust/milestone/get.ts index e93dcf34d..bc71bb4be 100644 --- a/api/src/routes/stardust/milestone/get.ts +++ b/api/src/routes/stardust/milestone/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IMilestoneDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IMilestoneDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -28,10 +25,7 @@ export async function get( return {}; } - const milestoneDetails = await StardustTangleHelper.milestoneDetailsByIndex( - networkConfig, - Number(request.milestoneIndex) - ); + const milestoneDetails = await StardustTangleHelper.milestoneDetailsByIndex(networkConfig, Number(request.milestoneIndex)); return milestoneDetails; } diff --git a/api/src/routes/stardust/milestone/influx/get.ts b/api/src/routes/stardust/milestone/influx/get.ts index f509b87f0..d4cfa0fbe 100644 --- a/api/src/routes/stardust/milestone/influx/get.ts +++ b/api/src/routes/stardust/milestone/influx/get.ts @@ -7,17 +7,13 @@ import { NetworkService } from "../../../../services/networkService"; import { InfluxDBService } from "../../../../services/stardust/influx/influxDbService"; import { ValidationHelper } from "../../../../utils/validationHelper"; - /** * Find the object from the network. * @param _ The configuration. * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IMilestoneStatsRequest -): Promise { +export async function get(_: IConfiguration, request: IMilestoneStatsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -42,13 +38,13 @@ export async function get( maybeMsStats = await influxService.fetchAnalyticsForMilestone(milestoneIndex); } - - return maybeMsStats ? { - milestoneIndex: maybeMsStats.milestoneIndex, - blockCount: maybeMsStats.blockCount, - perPayloadType: maybeMsStats.perPayloadType - } : { - message: `Could not fetch milestone analytics for ${request.milestoneIndex}` - }; + return maybeMsStats + ? { + milestoneIndex: maybeMsStats.milestoneIndex, + blockCount: maybeMsStats.blockCount, + perPayloadType: maybeMsStats.perPayloadType, + } + : { + message: `Could not fetch milestone analytics for ${request.milestoneIndex}`, + }; } - diff --git a/api/src/routes/stardust/milestone/latest/get.ts b/api/src/routes/stardust/milestone/latest/get.ts index 1e53b2793..5e12b368a 100644 --- a/api/src/routes/stardust/milestone/latest/get.ts +++ b/api/src/routes/stardust/milestone/latest/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request.network The network in context. * @returns The response. */ -export async function get( - _: IConfiguration, - request: { network: string } -): Promise { +export async function get(_: IConfiguration, request: { network: string }): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,4 +28,3 @@ export async function get( return { milestones }; } - diff --git a/api/src/routes/stardust/nft/get.ts b/api/src/routes/stardust/nft/get.ts index faca552ff..32285bde8 100644 --- a/api/src/routes/stardust/nft/get.ts +++ b/api/src/routes/stardust/nft/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: INftDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: INftDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/output/associated/post.ts b/api/src/routes/stardust/output/associated/post.ts index c687ba4f2..3a5833f18 100644 --- a/api/src/routes/stardust/output/associated/post.ts +++ b/api/src/routes/stardust/output/associated/post.ts @@ -18,7 +18,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; export async function post( _: IConfiguration, request: IAssociationsRequest, - body: IAssociationsRequestBody + body: IAssociationsRequestBody, ): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); @@ -41,6 +41,6 @@ export async function post( } return { - associations + associations, }; } diff --git a/api/src/routes/stardust/output/get.ts b/api/src/routes/stardust/output/get.ts index 85623f2b5..720dea6f5 100644 --- a/api/src/routes/stardust/output/get.ts +++ b/api/src/routes/stardust/output/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IOutputDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: IOutputDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/output/tagged/get.ts b/api/src/routes/stardust/output/tagged/get.ts index 173978e29..c96ad74d9 100644 --- a/api/src/routes/stardust/output/tagged/get.ts +++ b/api/src/routes/stardust/output/tagged/get.ts @@ -15,10 +15,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: ITaggedOutputsRequest -): Promise { +export async function get(_: IConfiguration, request: ITaggedOutputsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -41,4 +38,3 @@ export async function get( return { error: "Unsupported output type" }; } - diff --git a/api/src/routes/stardust/participation/events/get.ts b/api/src/routes/stardust/participation/events/get.ts index b27ad3fbd..de54dfa68 100644 --- a/api/src/routes/stardust/participation/events/get.ts +++ b/api/src/routes/stardust/participation/events/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: IParticipationEventRequest -): Promise { +export async function get(config: IConfiguration, request: IParticipationEventRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/search.ts b/api/src/routes/stardust/search.ts index bf8ef6786..44ead06d8 100644 --- a/api/src/routes/stardust/search.ts +++ b/api/src/routes/stardust/search.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function search( - _: IConfiguration, - request: ISearchRequest -): Promise { +export async function search(_: IConfiguration, request: ISearchRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/transaction/get.ts b/api/src/routes/stardust/transaction/get.ts index 2775280d0..d95dbbd4f 100644 --- a/api/src/routes/stardust/transaction/get.ts +++ b/api/src/routes/stardust/transaction/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: ITransactionDetailsRequest -): Promise { +export async function get(config: IConfiguration, request: ITransactionDetailsRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); diff --git a/api/src/routes/stardust/transactionhistory/download/post.ts b/api/src/routes/stardust/transactionhistory/download/post.ts index 5d2633d78..26ba0d6e5 100644 --- a/api/src/routes/stardust/transactionhistory/download/post.ts +++ b/api/src/routes/stardust/transactionhistory/download/post.ts @@ -20,7 +20,7 @@ import { ValidationHelper } from "../../../../utils/validationHelper"; export async function post( _: IConfiguration, request: ITransactionHistoryRequest, - body: ITransactionHistoryDownloadBody + body: ITransactionHistoryDownloadBody, ): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); @@ -36,9 +36,7 @@ export async function post( return null; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); const result = await chronicleService.transactionHistoryDownload(request.address, body.targetDate); @@ -51,7 +49,7 @@ export async function post( response = { data: content, - contentType: "application/octet-stream" + contentType: "application/octet-stream", }; } catch (e) { logger.error(`Failed to zip transaction history for download. Cause: ${e}`); @@ -59,4 +57,3 @@ export async function post( return response; } - diff --git a/api/src/routes/stardust/transactionhistory/get.ts b/api/src/routes/stardust/transactionhistory/get.ts index cb65fbef8..128883995 100644 --- a/api/src/routes/stardust/transactionhistory/get.ts +++ b/api/src/routes/stardust/transactionhistory/get.ts @@ -13,10 +13,7 @@ import { ValidationHelper } from "../../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - config: IConfiguration, - request: ITransactionHistoryRequest -): Promise { +export async function get(config: IConfiguration, request: ITransactionHistoryRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -31,10 +28,7 @@ export async function get( return {}; } - const chronicleService = ServiceFactory.get( - `chronicle-${networkConfig.network}` - ); + const chronicleService = ServiceFactory.get(`chronicle-${networkConfig.network}`); return chronicleService.transactionHistory(request); } - diff --git a/api/src/routes/stats/get.ts b/api/src/routes/stats/get.ts index bf449c756..73c319948 100644 --- a/api/src/routes/stats/get.ts +++ b/api/src/routes/stats/get.ts @@ -12,10 +12,7 @@ import { ValidationHelper } from "../../utils/validationHelper"; * @param request The request. * @returns The response. */ -export async function get( - _: IConfiguration, - request: IStatsGetRequest -): Promise { +export async function get(_: IConfiguration, request: IStatsGetRequest): Promise { const networkService = ServiceFactory.get("network"); const networks = networkService.networkNames(); ValidationHelper.oneOf(request.network, networks, "network"); @@ -44,7 +41,7 @@ export async function get( ...stats, health, healthReason, - itemsPerSecondHistory + itemsPerSecondHistory, }; } @@ -54,7 +51,6 @@ export async function get( confirmationRate: 0, latestMilestoneIndex: 0, latestMilestoneIndexTime: 0, - health: 0 + health: 0, }; } - diff --git a/api/src/services/amazonDynamoDbService.ts b/api/src/services/amazonDynamoDbService.ts index eb49eaf6e..8f4dcbab0 100644 --- a/api/src/services/amazonDynamoDbService.ts +++ b/api/src/services/amazonDynamoDbService.ts @@ -48,35 +48,38 @@ export class AmazonDynamoDbService implements IStorageService { AttributeDefinitions: [ { AttributeName: this._idName, - AttributeType: "S" - } + AttributeType: "S", + }, ], KeySchema: [ { AttributeName: this._idName, - KeyType: "HASH" - } + KeyType: "HASH", + }, ], ProvisionedThroughput: { ReadCapacityUnits: 1, - WriteCapacityUnits: 1 + WriteCapacityUnits: 1, }, - TableName: this._fullTableName + TableName: this._fullTableName, }; await dbConnection.createTable(tableParams).promise(); log += `Waiting for '${this._fullTableName}'\n`; - await dbConnection.waitFor("tableExists", { - TableName: this._fullTableName - }).promise(); + await dbConnection + .waitFor("tableExists", { + TableName: this._fullTableName, + }) + .promise(); log += `Table '${this._fullTableName}' Created Successfully\n`; } catch (err) { - log += err.code === "ResourceInUseException" - ? `Table '${this._fullTableName}' Already Exists\n` - : `Table '${this._fullTableName}' Creation Failed\n${err.toString()}\n`; + log += + err.code === "ResourceInUseException" + ? `Table '${this._fullTableName}' Already Exists\n` + : `Table '${this._fullTableName}' Creation Failed\n${err.toString()}\n`; } return log; @@ -94,14 +97,15 @@ export class AmazonDynamoDbService implements IStorageService { const key = {}; key[this._idName] = id; - const response = await docClient.get({ - TableName: this._fullTableName, - Key: key - }).promise(); + const response = await docClient + .get({ + TableName: this._fullTableName, + Key: key, + }) + .promise(); return response.Item as T; - } catch { - } + } catch {} } /** @@ -111,10 +115,12 @@ export class AmazonDynamoDbService implements IStorageService { public async set(item: T): Promise { const docClient = this.createDocClient(); - await docClient.put({ - TableName: this._fullTableName, - Item: item - }).promise(); + await docClient + .put({ + TableName: this._fullTableName, + Item: item, + }) + .promise(); } /** @@ -127,10 +133,12 @@ export class AmazonDynamoDbService implements IStorageService { const key = {}; key[this._idName] = itemKey; - await docClient.delete({ - TableName: this._fullTableName, - Key: key - }).promise(); + await docClient + .delete({ + TableName: this._fullTableName, + Key: key, + }) + .promise(); } /** @@ -145,18 +153,19 @@ export class AmazonDynamoDbService implements IStorageService { let allItems: T[] = []; do { - const response = await docClient.scan({ - TableName: this._fullTableName, - ExclusiveStartKey: lastKey - }).promise(); + const response = await docClient + .scan({ + TableName: this._fullTableName, + ExclusiveStartKey: lastKey, + }) + .promise(); if (allItems) { allItems = allItems.concat(response.Items as T[]); } lastKey = response.LastEvaluatedKey; - } - while (lastKey); + } while (lastKey); return allItems; } catch { @@ -174,19 +183,18 @@ export class AmazonDynamoDbService implements IStorageService { for (let i = 0; i < Math.ceil(items.length / 25); i++) { const params: BatchWriteItemRequestMap = {}; - params[this._fullTableName] = items - .slice(i * 25, (i + 1) * 25) - .map(item => ( - { - PutRequest: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Item: item as any - } - })); - - await docClient.batchWrite({ - RequestItems: params - }).promise(); + params[this._fullTableName] = items.slice(i * 25, (i + 1) * 25).map((item) => ({ + PutRequest: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Item: item as any, + }, + })); + + await docClient + .batchWrite({ + RequestItems: params, + }) + .promise(); } } @@ -197,7 +205,7 @@ export class AmazonDynamoDbService implements IStorageService { const awsConfig = new aws.Config({ accessKeyId: this._config.accessKeyId, secretAccessKey: this._config.secretAccessKey, - region: this._config.region + region: this._config.region, }); aws.config.update(awsConfig); @@ -222,7 +230,7 @@ export class AmazonDynamoDbService implements IStorageService { return new aws.DynamoDB.DocumentClient({ apiVersion: "2012-10-08", - convertEmptyValues: true + convertEmptyValues: true, }); } } diff --git a/api/src/services/chrysalis/baseStatsService.ts b/api/src/services/chrysalis/baseStatsService.ts index acf9a5f7b..a7c8629b5 100644 --- a/api/src/services/chrysalis/baseStatsService.ts +++ b/api/src/services/chrysalis/baseStatsService.ts @@ -28,8 +28,8 @@ export abstract class BaseStatsService implements IStatsService { confirmedItemsPerSecond: 0, confirmationRate: 0, latestMilestoneIndex: 0, - latestMilestoneIndexTime: 0 - } + latestMilestoneIndexTime: 0, + }, ]; setInterval(async () => this.updateStatistics(), 2000); @@ -48,7 +48,7 @@ export abstract class BaseStatsService implements IStatsService { * @returns The historical statistics for the network. */ public getItemsPerSecondHistory(): number[] { - return this._statistics.map(s => s.itemsPerSecond); + return this._statistics.map((s) => s.itemsPerSecond); } /** diff --git a/api/src/services/chrysalis/chrysalisFeedService.ts b/api/src/services/chrysalis/chrysalisFeedService.ts index d051259d6..028e97694 100644 --- a/api/src/services/chrysalis/chrysalisFeedService.ts +++ b/api/src/services/chrysalis/chrysalisFeedService.ts @@ -41,14 +41,13 @@ export class ChrysalisFeedService implements IFeedService { this._user = user; this._password = password; - this._mqttClient.statusChanged(data => logger.debug(`[Mqtt] Chrysalis status changed (${data.state})`)); + this._mqttClient.statusChanged((data) => logger.debug(`[Mqtt] Chrysalis status changed (${data.state})`)); } /** * Connect the service. */ - public connect(): void { - } + public connect(): void {} /** * Get milestones from the feed. @@ -60,7 +59,7 @@ export class ChrysalisFeedService implements IFeedService { try { const apiClient = new SingleNodeClient(this._endpoint, { userName: this._user, - password: this._password + password: this._password, }); const ms = await apiClient.milestone(message.index); callback(message.index, ms.messageId, message.timestamp * 1000); diff --git a/api/src/services/chrysalis/chrysalisItemsService.ts b/api/src/services/chrysalis/chrysalisItemsService.ts index 88da13286..f5dd4b490 100644 --- a/api/src/services/chrysalis/chrysalisItemsService.ts +++ b/api/src/services/chrysalis/chrysalisItemsService.ts @@ -120,11 +120,9 @@ export class ChrysalisItemsService implements IItemsService { */ private startTimer(): void { this.stopTimer(); - this._timerId = setTimeout( - async () => { - await this.updateSubscriptions(); - }, - 500); + this._timerId = setTimeout(async () => { + await this.updateSubscriptions(); + }, 500); } /** @@ -141,18 +139,17 @@ export class ChrysalisItemsService implements IItemsService { * Update the subscriptions with newest trytes. */ private async updateSubscriptions(): Promise { - if (this._items.length > 0 || - Object.keys(this._itemMetadata).length > 0) { + if (this._items.length > 0 || Object.keys(this._itemMetadata).length > 0) { for (const subscriptionId in this._subscribers) { const data: IFeedSubscriptionItem = { subscriptionId, items: this._items, - itemsMetadata: this._itemMetadata + itemsMetadata: this._itemMetadata, }; try { await this._subscribers[subscriptionId](data); - } catch { } + } catch {} } this._items = []; @@ -162,38 +159,34 @@ export class ChrysalisItemsService implements IItemsService { this.startTimer(); } - /** * Start the subscriptions. */ private startSubscription(): void { this.stopSubscription(); - this._itemSubscriptionId = this._mqttClient.messagesRaw( - (topic: string, message: Uint8Array) => { - this._items.push(Converter.bytesToHex(message)); - }); - - this._metadataSubscriptionId = this._mqttClient.messagesMetadata( - (topic: string, metadata: IMessageMetadata) => { - this._itemMetadata[metadata.messageId] = { - milestone: metadata.milestoneIndex, - referenced: metadata.referencedByMilestoneIndex, - solid: metadata.isSolid, - conflicting: metadata.ledgerInclusionState === "conflicting", - included: metadata.ledgerInclusionState === "included", - ...this._itemMetadata[metadata.messageId] - }; - }); - - this._milestoneSubscriptionId = this._feedService.subscribeMilestones( - (milestone: number, id: string, timestamp: number) => { - this._itemMetadata[id] = { - milestone, - timestamp, - ...this._itemMetadata[id] - }; - }); + this._itemSubscriptionId = this._mqttClient.messagesRaw((topic: string, message: Uint8Array) => { + this._items.push(Converter.bytesToHex(message)); + }); + + this._metadataSubscriptionId = this._mqttClient.messagesMetadata((topic: string, metadata: IMessageMetadata) => { + this._itemMetadata[metadata.messageId] = { + milestone: metadata.milestoneIndex, + referenced: metadata.referencedByMilestoneIndex, + solid: metadata.isSolid, + conflicting: metadata.ledgerInclusionState === "conflicting", + included: metadata.ledgerInclusionState === "included", + ...this._itemMetadata[metadata.messageId], + }; + }); + + this._milestoneSubscriptionId = this._feedService.subscribeMilestones((milestone: number, id: string, timestamp: number) => { + this._itemMetadata[id] = { + milestone, + timestamp, + ...this._itemMetadata[id], + }; + }); } /** diff --git a/api/src/services/chrysalis/chrysalisStatsService.ts b/api/src/services/chrysalis/chrysalisStatsService.ts index 27de0a94f..a3ecfad98 100644 --- a/api/src/services/chrysalis/chrysalisStatsService.ts +++ b/api/src/services/chrysalis/chrysalisStatsService.ts @@ -20,7 +20,7 @@ export class ChrysalisStatsService extends BaseStatsService { confirmedItemsPerSecond: info.referencedMessagesPerSecond, confirmationRate: info.referencedRate, latestMilestoneIndex: info.latestMilestoneIndex, - latestMilestoneIndexTime: info.latestMilestoneTimestamp * 1000 + latestMilestoneIndexTime: info.latestMilestoneTimestamp * 1000, }); if (this._statistics.length > 30) { diff --git a/api/src/services/currencyService.ts b/api/src/services/currencyService.ts index 9518a0f33..11d53770a 100644 --- a/api/src/services/currencyService.ts +++ b/api/src/services/currencyService.ts @@ -27,7 +27,7 @@ export class CurrencyService { id: "default", lastFixerUpdate: 0, fiatExchangeRatesEur: {}, - coinStats: {} + coinStats: {}, }; /** @@ -82,16 +82,14 @@ export class CurrencyService { currentState = await currencyStorageService.get("default"); } - currentState = currentState?.coinStats === undefined ? - CurrencyService.INITIAL_STATE : - currentState; + currentState = currentState?.coinStats === undefined ? CurrencyService.INITIAL_STATE : currentState; - const lastFixerUpdate = currentState?.lastFixerUpdate > 0 ? - new Date(currentState.lastFixerUpdate) : - new Date(Date.now() - (2 * CurrencyService.MS_PER_DAY)); + const TWO_DAYS = 2 * CurrencyService.MS_PER_DAY; + const lastFixerUpdate = + currentState?.lastFixerUpdate > 0 ? new Date(currentState.lastFixerUpdate) : new Date(Date.now() - TWO_DAYS); // Update Fixer rates every 4 hours so we dont hit rate limit - if (nowMs - lastFixerUpdate.getTime() > (CurrencyService.MS_PER_MINUTE * 240)) { + if (nowMs - lastFixerUpdate.getTime() > CurrencyService.MS_PER_MINUTE * 240) { await this.updateFixerDxyRates(currentState, fullDate); } @@ -99,15 +97,15 @@ export class CurrencyService { const currentStats = currentState.coinStats[coin]; // If now date, default to 2 days ago - const lastCurrencyUpdate = currentStats?.lastUpdate ? - new Date(currentStats.lastUpdate) : - new Date(Date.now() - (2 * CurrencyService.MS_PER_DAY)); + const lastCurrencyUpdate = currentStats?.lastUpdate + ? new Date(currentStats.lastUpdate) + : new Date(Date.now() - TWO_DAYS); // If we have no state, an update over 5 minutes old, the day has changed, or force update if ( !currentStats || - nowMs - lastCurrencyUpdate.getTime() > (CurrencyService.MS_PER_MINUTE * 5) || - (lastCurrencyUpdate.getDate() !== now.getDate()) || + nowMs - lastCurrencyUpdate.getTime() > CurrencyService.MS_PER_MINUTE * 5 || + lastCurrencyUpdate.getDate() !== now.getDate() || force ) { await this.updateCoinStats(coin, currentState, fullDate); @@ -133,10 +131,7 @@ export class CurrencyService { * @param currentState Current currency state. * @param date The date string for logging. */ - private async updateFixerDxyRates( - currentState: ICurrencyState, - date: string - ): Promise { + private async updateFixerDxyRates(currentState: ICurrencyState, date: string): Promise { if ((this._config.fixerApiKey || "FIXER-API-KEY") === "FIXER-API-KEY") { logger.warn("Fixer Api key NOT FOUND!"); } else { @@ -161,11 +156,7 @@ export class CurrencyService { * @param currentState Current currency state. * @param date The date string for logging. */ - private async updateCoinStats( - coin: string, - currentState: ICurrencyState, - date: string - ): Promise { + private async updateCoinStats(coin: string, currentState: ICurrencyState, date: string): Promise { logger.verbose(`[Coin Gecko] Updating Coin stats (${date})...`); const coinGeckoClient = new CoinGeckoClient(); @@ -184,7 +175,7 @@ export class CurrencyService { price, marketCap, volume24h, - lastUpdate: Date.now() + lastUpdate: Date.now(), }; currentState.coinStats[coin] = coinStats; diff --git a/api/src/services/legacy/baseStatsService.ts b/api/src/services/legacy/baseStatsService.ts index acf9a5f7b..a7c8629b5 100644 --- a/api/src/services/legacy/baseStatsService.ts +++ b/api/src/services/legacy/baseStatsService.ts @@ -28,8 +28,8 @@ export abstract class BaseStatsService implements IStatsService { confirmedItemsPerSecond: 0, confirmationRate: 0, latestMilestoneIndex: 0, - latestMilestoneIndexTime: 0 - } + latestMilestoneIndexTime: 0, + }, ]; setInterval(async () => this.updateStatistics(), 2000); @@ -48,7 +48,7 @@ export abstract class BaseStatsService implements IStatsService { * @returns The historical statistics for the network. */ public getItemsPerSecondHistory(): number[] { - return this._statistics.map(s => s.itemsPerSecond); + return this._statistics.map((s) => s.itemsPerSecond); } /** diff --git a/api/src/services/legacy/legacyItemsService.ts b/api/src/services/legacy/legacyItemsService.ts index 620346bfd..fbb527424 100644 --- a/api/src/services/legacy/legacyItemsService.ts +++ b/api/src/services/legacy/legacyItemsService.ts @@ -187,9 +187,9 @@ export class LegacyItemsService implements IItemsService { return { itemsPerSecond: Number.parseFloat(ips.toFixed(2)), confirmedItemsPerSecond: Number.parseFloat(cips.toFixed(2)), - confirmationRate: Number.parseFloat((ips > 0 ? cips / ips * 100 : 0).toFixed(2)), + confirmationRate: Number.parseFloat((ips > 0 ? (cips / ips) * 100 : 0).toFixed(2)), latestMilestoneIndex: this._latestMilestoneIndex, - latestMilestoneIndexTime: this._latestMilestoneIndexTime + latestMilestoneIndexTime: this._latestMilestoneIndexTime, }; } @@ -199,31 +199,28 @@ export class LegacyItemsService implements IItemsService { private startSubscription(): void { this.stopSubscription(); - this._milestoneSubscriptionId = this._feedService.subscribeMilestones( - (milestone: number, id: string, timestamp: number) => { - this._latestMilestoneIndex = milestone; - this._latestMilestoneIndexTime = timestamp; - this._itemMetadata[id] = { - milestone, - ...this._itemMetadata[id] - }; - }); + this._milestoneSubscriptionId = this._feedService.subscribeMilestones((milestone: number, id: string, timestamp: number) => { + this._latestMilestoneIndex = milestone; + this._latestMilestoneIndexTime = timestamp; + this._itemMetadata[id] = { + milestone, + ...this._itemMetadata[id], + }; + }); - this._itemSubscriptionId = this._zmqService.subscribe( - "trytes", async (evnt: string, message: ITxTrytes) => { - this._totalItems++; + this._itemSubscriptionId = this._zmqService.subscribe("trytes", async (evnt: string, message: ITxTrytes) => { + this._totalItems++; - this._items.push(message.trytes); - }); + this._items.push(message.trytes); + }); - this._confirmedSubscriptionId = this._zmqService.subscribe( - "sn", async (evnt: string, message: ISn) => { - this._totalConfirmed++; - this._itemMetadata[message.transaction] = { - confirmed: message.index, - ...this._itemMetadata[message.transaction] - }; - }); + this._confirmedSubscriptionId = this._zmqService.subscribe("sn", async (evnt: string, message: ISn) => { + this._totalConfirmed++; + this._itemMetadata[message.transaction] = { + confirmed: message.index, + ...this._itemMetadata[message.transaction], + }; + }); } /** @@ -252,12 +249,10 @@ export class LegacyItemsService implements IItemsService { */ private startTimer(): void { this.stopTimer(); - this._timerId = setTimeout( - async () => { - this.handleTps(); - await this.updateSubscriptions(); - }, - 500); + this._timerId = setTimeout(async () => { + this.handleTps(); + await this.updateSubscriptions(); + }, 500); } /** @@ -274,18 +269,17 @@ export class LegacyItemsService implements IItemsService { * Update the subscriptions with newest trytes. */ private async updateSubscriptions(): Promise { - if (this._items.length > 0 || - Object.keys(this._itemMetadata).length > 0) { + if (this._items.length > 0 || Object.keys(this._itemMetadata).length > 0) { for (const subscriptionId in this._subscribers) { const data: IFeedSubscriptionItem = { subscriptionId, items: this._items, - itemsMetadata: this._itemMetadata + itemsMetadata: this._itemMetadata, }; try { await this._subscribers[subscriptionId](data); - } catch { } + } catch {} } this._items = []; @@ -306,7 +300,7 @@ export class LegacyItemsService implements IItemsService { this._ips.unshift({ itemCount: lastTxTotal, confirmedCount: lastConfirmedTotal, - ts: Date.now() + ts: Date.now(), }); this._ips = this._ips.slice(0, 100); } diff --git a/api/src/services/legacy/legacyStatsService.ts b/api/src/services/legacy/legacyStatsService.ts index 1bf5902cc..fc7cb7cfd 100644 --- a/api/src/services/legacy/legacyStatsService.ts +++ b/api/src/services/legacy/legacyStatsService.ts @@ -19,9 +19,7 @@ export class LegacyStatsService extends BaseStatsService { */ constructor(networkConfiguration: INetwork) { super(networkConfiguration); - this._legacyItemsService = ServiceFactory.get( - `items-${this._networkConfiguration.network}` - ); + this._legacyItemsService = ServiceFactory.get(`items-${this._networkConfiguration.network}`); } /** @@ -36,7 +34,7 @@ export class LegacyStatsService extends BaseStatsService { confirmedItemsPerSecond: stats.confirmedItemsPerSecond, confirmationRate: stats.confirmationRate, latestMilestoneIndex: stats.latestMilestoneIndex, - latestMilestoneIndexTime: stats.latestMilestoneIndexTime + latestMilestoneIndexTime: stats.latestMilestoneIndexTime, }); if (this._statistics.length > 30) { diff --git a/api/src/services/legacy/zmqService.ts b/api/src/services/legacy/zmqService.ts index 7607452d7..79397fd3f 100644 --- a/api/src/services/legacy/zmqService.ts +++ b/api/src/services/legacy/zmqService.ts @@ -103,8 +103,7 @@ export class ZmqService { } localSocket.close(); - } catch { - } + } catch {} } } @@ -122,10 +121,7 @@ export class ZmqService { * @param callback The callback to call with data for the event. * @returns An id to use for unsubscribe. */ - public subscribe( - event: "trytes", - callback: (eventName: string, data: ITxTrytes) => Promise - ): string; + public subscribe(event: "trytes", callback: (eventName: string, data: ITxTrytes) => Promise): string; /** * Subscribe to named event. @@ -136,7 +132,7 @@ export class ZmqService { public subscribe( event: ZmqEvent, // eslint-disable-next-line @typescript-eslint/no-explicit-any - callback: (eventName: string, data: any) => Promise + callback: (eventName: string, data: any) => Promise, ): string { return this.internalAddEventCallback(event, callback); } @@ -147,10 +143,7 @@ export class ZmqService { * @param callback The callback to call with data for the event. * @returns An id to use for unsubscribe. */ - public subscribeEvent( - event: ZmqEvent, - callback: (eventName: string, data: unknown) => Promise - ): string { + public subscribeEvent(event: ZmqEvent, callback: (eventName: string, data: unknown) => Promise): string { return this.internalAddEventCallback(event, callback); } @@ -160,10 +153,7 @@ export class ZmqService { * @param callback Callback to call with address data. * @returns An id to use for unsubscribe. */ - public subscribeAddress( - address: string, - callback: (event: string, data: IAddress) => Promise - ): string { + public subscribeAddress(address: string, callback: (event: string, data: IAddress) => Promise): string { if (!/^[9A-Z]{81}$/.test(address)) { throw new Error("The parameter 'address' must be 81 trytes."); } @@ -213,7 +203,7 @@ export class ZmqService { address: messageParams[3], trunk: messageParams[4], branch: messageParams[5], - bundle: messageParams[6] + bundle: messageParams[6], } as ISn; break; } @@ -221,7 +211,7 @@ export class ZmqService { case "trytes": { data = { trytes: messageParams[1], - txHash: messageParams[2] + txHash: messageParams[2], } as ITxTrytes; break; } @@ -234,7 +224,7 @@ export class ZmqService { data = { address: messageParams[0], transaction: messageParams[1], - milestoneIndex: mi + milestoneIndex: mi, } as IAddress; } } @@ -259,10 +249,7 @@ export class ZmqService { * @param callback The callback to store for the event. * @returns The id of the subscription. */ - protected internalAddEventCallback( - event: string, - callback: (eventName: string, data: unknown) => Promise - ): string { + protected internalAddEventCallback(event: string, callback: (eventName: string, data: unknown) => Promise): string { if (!this._subscriptions[event]) { this._subscriptions[event] = []; } diff --git a/api/src/services/localStorageService.ts b/api/src/services/localStorageService.ts index 062ff3875..22af908a4 100644 --- a/api/src/services/localStorageService.ts +++ b/api/src/services/localStorageService.ts @@ -58,8 +58,7 @@ export class LocalStorageService implements IStorageService { const buffer = await promises.readFile(fullPath); return JSON.parse(buffer.toString()) as T; - } catch { - } + } catch {} } /** @@ -73,8 +72,7 @@ export class LocalStorageService implements IStorageService { await promises.mkdir(this._fullFolderPath, { recursive: true }); await promises.writeFile(fullPath, Buffer.from(JSON.stringify(item, undefined, "\t"))); - } catch { - } + } catch {} } /** @@ -86,8 +84,7 @@ export class LocalStorageService implements IStorageService { const fullPath = path.join(this._fullFolderPath, `${itemKey}.json`); await promises.unlink(fullPath); - } catch { - } + } catch {} } /** @@ -107,8 +104,7 @@ export class LocalStorageService implements IStorageService { items.push(JSON.parse(buffer.toString()) as T); } - } catch { - } + } catch {} return items; } diff --git a/api/src/services/networkService.ts b/api/src/services/networkService.ts index 157f6f97a..dba1c6e86 100644 --- a/api/src/services/networkService.ts +++ b/api/src/services/networkService.ts @@ -47,7 +47,7 @@ export class NetworkService { if (Object.keys(newCache).length > 0) { this._cache = newCache; - this._cacheNames = Object.values(this._cache).map(n => n.network); + this._cacheNames = Object.values(this._cache).map((n) => n.network); } } @@ -86,10 +86,7 @@ export class NetworkService { } if (!isValidProtocol(network.protocolVersion)) { - throw new NetworkConfigurationError( - `Network ${network.network} has invalid protocol version "${network.protocolVersion}".` - ); + throw new NetworkConfigurationError(`Network ${network.network} has invalid protocol version "${network.protocolVersion}".`); } } } - diff --git a/api/src/services/stardust/chronicleService.ts b/api/src/services/stardust/chronicleService.ts index c8572a325..548bdcf44 100644 --- a/api/src/services/stardust/chronicleService.ts +++ b/api/src/services/stardust/chronicleService.ts @@ -20,7 +20,7 @@ const CHRONICLE_ENDPOINTS = { tokenDistribution: "/api/explorer/v2/ledger/token-distribution", balance: "/api/explorer/v2/balance/", milestoneBlocks: ["/api/explorer/v2/milestones/", "/blocks"], - blockChildren: ["/api/explorer/v2/blocks/", "/children"] + blockChildren: ["/api/explorer/v2/blocks/", "/children"], }; export class ChronicleService { @@ -76,20 +76,16 @@ export class ChronicleService { * @param address The address to fetch the balance for. * @returns The address balance response. */ - public async addressBalance( - address: string - ): Promise { + public async addressBalance(address: string): Promise { try { return await FetchHelper.json( this.chronicleEndpoint, `${CHRONICLE_ENDPOINTS.balance}${address}`, - "get" + "get", ); } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching address balance for ${address} on ${network}. Cause: ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching address balance for ${address} on ${network}. Cause: ${error}`); } } @@ -98,9 +94,7 @@ export class ChronicleService { * @param milestoneId The milestone id. * @returns The milestone blocks response. */ - public async milestoneBlocks( - milestoneId: string - ): Promise<{ milestoneId?: string; blocks?: string[]; error?: string } | undefined> { + public async milestoneBlocks(milestoneId: string): Promise<{ milestoneId?: string; blocks?: string[]; error?: string } | undefined> { const path = `${CHRONICLE_ENDPOINTS.milestoneBlocks[0]}${milestoneId}${CHRONICLE_ENDPOINTS.milestoneBlocks[1]}`; let cursor: string | undefined; const blocks: IMilestoneBlockInfo[] = []; @@ -112,7 +106,7 @@ export class ChronicleService { const response = await FetchHelper.json( this.chronicleEndpoint, `${path}${params}`, - "get" + "get", ); cursor = response.cursor; @@ -122,15 +116,11 @@ export class ChronicleService { } } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching milestone blocks for ${milestoneId} on ${network}. ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching milestone blocks for ${milestoneId} on ${network}. ${error}`); } } while (cursor); - const blockIds = blocks - .sort((a, b) => b.payloadType - a.payloadType) - .map(block => block.blockId); + const blockIds = blocks.sort((a, b) => b.payloadType - a.payloadType).map((block) => block.blockId); return { milestoneId, blocks: blockIds }; } @@ -140,24 +130,16 @@ export class ChronicleService { * @param blockId The block id. * @returns The blocks children response. */ - public async blockChildren( - blockId: string - ): Promise { + public async blockChildren(blockId: string): Promise { const path = `${CHRONICLE_ENDPOINTS.blockChildren[0]}${blockId}${CHRONICLE_ENDPOINTS.blockChildren[1]}`; try { - const response = await FetchHelper.json( - this.chronicleEndpoint, - `${path}`, - "get" - ); + const response = await FetchHelper.json(this.chronicleEndpoint, `${path}`, "get"); return response; } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching block children for ${blockId} on ${network}. Cause: ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching block children for ${blockId} on ${network}. Cause: ${error}`); return { error }; } } @@ -167,29 +149,23 @@ export class ChronicleService { * @param request The ITransactionHistoryRequest. * @returns The history reponse. */ - public async transactionHistory( - request: ITransactionHistoryRequest - ): Promise { + public async transactionHistory(request: ITransactionHistoryRequest): Promise { try { const params = { pageSize: request.pageSize, sort: request.sort, startMilestoneIndex: request.startMilestoneIndex, - cursor: request.cursor + cursor: request.cursor, }; return await FetchHelper.json( this.chronicleEndpoint, - `${CHRONICLE_ENDPOINTS.updatedByAddress}${request.address}${params ? - `${FetchHelper.urlParams(params)}` : - ""}`, - "get" + `${CHRONICLE_ENDPOINTS.updatedByAddress}${request.address}${params ? `${FetchHelper.urlParams(params)}` : ""}`, + "get", ); } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching tx history for ${request.address} on ${network}. Cause: ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching tx history for ${request.address} on ${network}. Cause: ${error}`); } } @@ -199,17 +175,14 @@ export class ChronicleService { * @param targetDate The date to use. * @returns The history reponse. */ - public async transactionHistoryDownload( - address: string, - targetDate: string - ): Promise { + public async transactionHistoryDownload(address: string, targetDate: string): Promise { try { let response: ITransactionHistoryResponse | undefined; let cursor: string | undefined; let isDone = false; const result: ITransactionHistoryDownloadResponse = { address, - items: [] + items: [], }; do { @@ -218,7 +191,7 @@ export class ChronicleService { response = await FetchHelper.json( this.chronicleEndpoint, `${CHRONICLE_ENDPOINTS.updatedByAddress}${address}${params}`, - "get" + "get", ); cursor = response.cursor; @@ -252,24 +225,20 @@ export class ChronicleService { * @param top The number of top addresses to return. * @returns The richest addresses reponse. */ - private async richestAddresses( - top: number | null - ): Promise { + private async richestAddresses(top: number | null): Promise { try { const params = { - top: top ?? 100 + top: top ?? 100, }; return await FetchHelper.json( this.chronicleEndpoint, `${CHRONICLE_ENDPOINTS.richestAddresses}${FetchHelper.urlParams(params)}`, - "get" + "get", ); } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching rich addresses on ${network}. Cause: ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching rich addresses on ${network}. Cause: ${error}`); } } @@ -282,13 +251,11 @@ export class ChronicleService { return await FetchHelper.json( this.chronicleEndpoint, `${CHRONICLE_ENDPOINTS.tokenDistribution}`, - "get" + "get", ); } catch (error) { const network = this.networkConfig.network; - logger.warn( - `[ChronicleService] Failed fetching token distribution data on ${network}. Cause: ${error}` - ); + logger.warn(`[ChronicleService] Failed fetching token distribution data on ${network}. Cause: ${error}`); } } @@ -304,27 +271,31 @@ export class ChronicleService { const populateCache = () => { logger.verbose("Fetching token distribution data..."); - this.richestAddresses(RICH_ADDRESSES_N).then(resp => { - if (!resp.error && resp.top) { - this.richestAddressesCache = { - top: resp.top, - ledgerIndex: resp.ledgerIndex - }; - } - }).catch(() => { - logger.warn(`Failed population of richest addresses cache on ${this.networkConfig.network}`); - }); - - this.tokenDistribution().then(resp => { - if (!resp.error && resp.distribution) { - this.tokenDistributionCache = { - distribution: resp.distribution, - ledgerIndex: resp.ledgerIndex - }; - } - }).catch(() => { - logger.warn(`Failed population of token distribution cache on ${this.networkConfig.network}`); - }); + this.richestAddresses(RICH_ADDRESSES_N) + .then((resp) => { + if (!resp.error && resp.top) { + this.richestAddressesCache = { + top: resp.top, + ledgerIndex: resp.ledgerIndex, + }; + } + }) + .catch(() => { + logger.warn(`Failed population of richest addresses cache on ${this.networkConfig.network}`); + }); + + this.tokenDistribution() + .then((resp) => { + if (!resp.error && resp.distribution) { + this.tokenDistributionCache = { + distribution: resp.distribution, + ledgerIndex: resp.ledgerIndex, + }; + } + }) + .catch(() => { + logger.warn(`Failed population of token distribution cache on ${this.networkConfig.network}`); + }); }; populateCache(); @@ -333,5 +304,3 @@ export class ChronicleService { }, RICH_ADDR_TOKEN_DIST_REFRESH_INTERVAL_MS); } } - - diff --git a/api/src/services/stardust/feed/stardustFeed.ts b/api/src/services/stardust/feed/stardustFeed.ts index 8fa14ae7e..b4db7d0f8 100644 --- a/api/src/services/stardust/feed/stardustFeed.ts +++ b/api/src/services/stardust/feed/stardustFeed.ts @@ -85,7 +85,6 @@ export class StardustFeed { } } - /** * Get the latest milestone cache state. * @returns The cache state. @@ -140,7 +139,7 @@ export class StardustFeed { try { const block: Block = this.parseMqttPayloadMessage(Block, message); const update: Partial = { - block + block, }; // eslint-disable-next-line no-void @@ -156,30 +155,32 @@ export class StardustFeed { const metadata: IBlockMetadata = JSON.parse(parsed.payload); // update cache let currentEntry = this.blockMetadataCache.get(metadata.blockId) ?? null; - currentEntry = currentEntry ? { - ...currentEntry, - milestone: metadata.milestoneIndex, - referenced: metadata.referencedByMilestoneIndex, - solid: metadata.isSolid, - conflicting: metadata.ledgerInclusionState === "conflicting", - conflictReason: metadata.conflictReason, - included: metadata.ledgerInclusionState === "included" - } : { - milestone: metadata.milestoneIndex, - referenced: metadata.referencedByMilestoneIndex, - solid: metadata.isSolid, - conflicting: metadata.ledgerInclusionState === "conflicting", - conflictReason: metadata.conflictReason, - included: metadata.ledgerInclusionState === "included" - }; + currentEntry = currentEntry + ? { + ...currentEntry, + milestone: metadata.milestoneIndex, + referenced: metadata.referencedByMilestoneIndex, + solid: metadata.isSolid, + conflicting: metadata.ledgerInclusionState === "conflicting", + conflictReason: metadata.conflictReason, + included: metadata.ledgerInclusionState === "included", + } + : { + milestone: metadata.milestoneIndex, + referenced: metadata.referencedByMilestoneIndex, + solid: metadata.isSolid, + conflicting: metadata.ledgerInclusionState === "conflicting", + conflictReason: metadata.conflictReason, + included: metadata.ledgerInclusionState === "included", + }; this.blockMetadataCache.set(metadata.blockId, currentEntry); const update: Partial = { blockMetadata: { blockId: metadata.blockId, - metadata: currentEntry - } + metadata: currentEntry, + }, }; // eslint-disable-next-line no-void @@ -204,8 +205,8 @@ export class StardustFeed { milestoneId, milestoneIndex, timestamp, - payload: milestonePayload - } + payload: milestonePayload, + }, }; // eslint-disable-next-line no-void @@ -227,7 +228,7 @@ export class StardustFeed { // push data through callback await this.blockSubscribers[subscriptionId]({ ...payload, - subscriptionId + subscriptionId, }); } catch (error) { logger.warn(`[FeedClient] Failed to send callback to block subscribers for ${subscriptionId}. Cause: ${error}`); @@ -246,7 +247,7 @@ export class StardustFeed { // push data through callback await this.milestoneSubscribers[subscriptionId]({ ...payload, - subscriptionId + subscriptionId, }); } catch (error) { logger.warn(`[FeedClient] Failed to send callback to milestone subscribers for ${subscriptionId}. Cause: ${error}`); @@ -262,14 +263,17 @@ export class StardustFeed { * @param timestamp The milestone timestamp. */ private async updateLatestMilestoneCache( - blockId: string, milestoneIndex: number, milestoneId: string, timestamp: number + blockId: string, + milestoneIndex: number, + milestoneId: string, + timestamp: number, ): Promise { - if (!this.latestMilestonesCache.map(ms => ms.blockId).includes(blockId)) { + if (!this.latestMilestonesCache.map((ms) => ms.blockId).includes(blockId)) { this.latestMilestonesCache.unshift({ blockId, milestoneId, index: milestoneIndex, - timestamp + timestamp, }); if (this.latestMilestonesCache.length > MAX_MILESTONE_LATEST) { @@ -281,10 +285,7 @@ export class StardustFeed { private parseMqttPayloadMessage(cls: ClassConstructor, serializedMessage: string): T { try { const message: { topic: string; payload: string } = JSON.parse(serializedMessage); - const payload: T = plainToInstance>( - cls, - JSON.parse(message.payload) as Record - ); + const payload: T = plainToInstance>(cls, JSON.parse(message.payload) as Record); return payload; } catch (error) { @@ -313,4 +314,3 @@ export class StardustFeed { }, CACHE_TRIM_INTERVAL_MS); } } - diff --git a/api/src/services/stardust/influx/influxDbClient.ts b/api/src/services/stardust/influx/influxDbClient.ts index 5d472b995..05cef55d8 100644 --- a/api/src/services/stardust/influx/influxDbClient.ts +++ b/api/src/services/stardust/influx/influxDbClient.ts @@ -2,13 +2,20 @@ import { INanoDate, InfluxDB, IPingStats, IResults, toNanoDate } from "influx"; import moment from "moment"; import cron from "node-cron"; import { - ADDRESSES_WITH_BALANCE_DAILY_QUERY, ALIAS_ACTIVITY_DAILY_QUERY, - TOTAL_ACTIVE_ADDRESSES_DAILY_QUERY, BLOCK_DAILY_QUERY, - LEDGER_SIZE_DAILY_QUERY, NFT_ACTIVITY_DAILY_QUERY, OUTPUTS_DAILY_QUERY, + ADDRESSES_WITH_BALANCE_DAILY_QUERY, + ALIAS_ACTIVITY_DAILY_QUERY, + TOTAL_ACTIVE_ADDRESSES_DAILY_QUERY, + BLOCK_DAILY_QUERY, + LEDGER_SIZE_DAILY_QUERY, + NFT_ACTIVITY_DAILY_QUERY, + OUTPUTS_DAILY_QUERY, STORAGE_DEPOSIT_DAILY_QUERY, - TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY, TOKENS_HELD_WITH_UC_DAILY_QUERY, - TOKENS_TRANSFERRED_DAILY_QUERY, TRANSACTION_DAILY_QUERY, - UNCLAIMED_GENESIS_OUTPUTS_DAILY_QUERY, UNCLAIMED_TOKENS_DAILY_QUERY, + TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY, + TOKENS_HELD_WITH_UC_DAILY_QUERY, + TOKENS_TRANSFERRED_DAILY_QUERY, + TRANSACTION_DAILY_QUERY, + UNCLAIMED_GENESIS_OUTPUTS_DAILY_QUERY, + UNCLAIMED_TOKENS_DAILY_QUERY, UNLOCK_CONDITIONS_PER_TYPE_DAILY_QUERY, ADDRESSES_WITH_BALANCE_TOTAL_QUERY, NATIVE_TOKENS_STAT_TOTAL_QUERY, @@ -16,21 +23,36 @@ import { SHIMMER_CLAIMED_TOTAL_QUERY, MILESTONE_STATS_QUERY, STORAGE_DEPOSIT_TOTAL_QUERY, - MILESTONE_STATS_QUERY_BY_INDEX + MILESTONE_STATS_QUERY_BY_INDEX, } from "./influxQueries"; import logger from "../../../logger"; import { INetwork } from "../../../models/db/INetwork"; import { SHIMMER } from "../../../models/db/networkType"; import { - DayKey, DAY_KEY_FORMAT, IInfluxAnalyticsCache, IInfluxDailyCache, - IInfluxMilestoneAnalyticsCache, initializeEmptyDailyCache + DayKey, + DAY_KEY_FORMAT, + IInfluxAnalyticsCache, + IInfluxDailyCache, + IInfluxMilestoneAnalyticsCache, + initializeEmptyDailyCache, } from "../../../models/influx/IInfluxDbCache"; import { - IAddressesWithBalanceDailyInflux, IAliasActivityDailyInflux, IActiveAddressesDailyInflux, - IBlocksDailyInflux, ILedgerSizeDailyInflux, INftActivityDailyInflux, IOutputsDailyInflux, - IStorageDepositDailyInflux, ITimedEntry, ITokensHeldPerOutputDailyInflux, - ITokensHeldWithUnlockConditionDailyInflux, ITokensTransferredDailyInflux, ITransactionsDailyInflux, - IUnclaimedGenesisOutputsDailyInflux, IUnclaimedTokensDailyInflux, IUnlockConditionsPerTypeDailyInflux + IAddressesWithBalanceDailyInflux, + IAliasActivityDailyInflux, + IActiveAddressesDailyInflux, + IBlocksDailyInflux, + ILedgerSizeDailyInflux, + INftActivityDailyInflux, + IOutputsDailyInflux, + IStorageDepositDailyInflux, + ITimedEntry, + ITokensHeldPerOutputDailyInflux, + ITokensHeldWithUnlockConditionDailyInflux, + ITokensTransferredDailyInflux, + ITransactionsDailyInflux, + IUnclaimedGenesisOutputsDailyInflux, + IUnclaimedTokensDailyInflux, + IUnlockConditionsPerTypeDailyInflux, } from "../../../models/influx/IInfluxTimedEntries"; type MilestoneUpdate = ITimedEntry & { @@ -115,11 +137,11 @@ export abstract class InfluxDbClient { * @returns Boolean representing that the client ping succeeded. */ public async buildClient(): Promise { - const protocol = this._network.analyticsInfluxDbProtocol || 'https'; + const protocol = this._network.analyticsInfluxDbProtocol || "https"; const network = this._network.network; - var [host, portString] = this._network.analyticsInfluxDbEndpoint.split(':'); + const [host, portString] = this._network.analyticsInfluxDbEndpoint.split(":"); // Parse port string to int, or use default port for protocol - const port = parseInt(portString) || (protocol === 'https' ? 443 : 80); + const port = Number.parseInt(portString, 10) || (protocol === "https" ? 443 : 80); const database = this._network.analyticsInfluxDbDatabase; const username = this._network.analyticsInfluxDbUsername; const password = this._network.analyticsInfluxDbPassword; @@ -129,30 +151,33 @@ export abstract class InfluxDbClient { const token = Buffer.from(`${username}:${password}`, "utf8").toString("base64"); const options = { headers: { - "Authorization": `Basic ${token}` - } + Authorization: `Basic ${token}`, + }, }; const influxDbClient = new InfluxDB({ protocol, port, host, database, username, password, options }); - return influxDbClient.ping(1500).then((pingResults: IPingStats[]) => { - if (pingResults.length > 0) { - const anyHostIsOnline = pingResults.some(ping => ping.online); + return influxDbClient + .ping(1500) + .then((pingResults: IPingStats[]) => { + if (pingResults.length > 0) { + const anyHostIsOnline = pingResults.some((ping) => ping.online); - if (anyHostIsOnline) { - logger.info(`[InfluxDb] Client started for "${network}"...`); - this._client = influxDbClient; - this.setupDataCollection(); - } + if (anyHostIsOnline) { + logger.info(`[InfluxDb] Client started for "${network}"...`); + this._client = influxDbClient; + this.setupDataCollection(); + } - return anyHostIsOnline; - } + return anyHostIsOnline; + } - return false; - }).catch(e => { - logger.verbose(`[InfluxDb] Ping failed for "${network}". ${e}`); - return false; - }); + return false; + }) + .catch((e) => { + logger.verbose(`[InfluxDb] Ping failed for "${network}". ${e}`); + return false; + }); } logger.warn(`[InfluxDb] Configuration not found for "${network}".`); @@ -165,9 +190,9 @@ export abstract class InfluxDbClient { */ public async collectMilestoneStatsByIndex(milestoneIndex: number) { try { - for (const update of await - this._client.query(MILESTONE_STATS_QUERY_BY_INDEX, { placeholders: { milestoneIndex } }) - ) { + for (const update of await this._client.query(MILESTONE_STATS_QUERY_BY_INDEX, { + placeholders: { milestoneIndex }, + })) { this.updateMilestoneCache(update); } } catch (err) { @@ -181,9 +206,7 @@ export abstract class InfluxDbClient { * @param z The second entry * @returns Negative number if first entry is before second, positive otherwise. */ - protected readonly ENTRIES_ASC_SORT = (a: ITimedEntry, z: ITimedEntry) => ( - moment(a.time).isBefore(moment(z.time)) ? -1 : 1 - ); + protected readonly ENTRIES_ASC_SORT = (a: ITimedEntry, z: ITimedEntry) => (moment(a.time).isBefore(moment(z.time)) ? -1 : 1); /** * Setup a InfluxDb data collection periodic job. @@ -237,80 +260,60 @@ export abstract class InfluxDbClient { */ private async collectGraphsDaily() { logger.verbose(`[InfluxDb] Collecting daily stats for "${this._network.network}"`); - this.updateCacheEntry( - BLOCK_DAILY_QUERY, - this._dailyCache.blocksDaily, - "Blocks Daily" - ); - this.updateCacheEntry( - TRANSACTION_DAILY_QUERY, - this._dailyCache.transactionsDaily, - "Transactions Daily" - ); - this.updateCacheEntry( - OUTPUTS_DAILY_QUERY, - this._dailyCache.outputsDaily, - "Outpus Daily" - ); + this.updateCacheEntry(BLOCK_DAILY_QUERY, this._dailyCache.blocksDaily, "Blocks Daily"); + this.updateCacheEntry(TRANSACTION_DAILY_QUERY, this._dailyCache.transactionsDaily, "Transactions Daily"); + this.updateCacheEntry(OUTPUTS_DAILY_QUERY, this._dailyCache.outputsDaily, "Outpus Daily"); this.updateCacheEntry( TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY, this._dailyCache.tokensHeldDaily, - "Tokens Held Daily" + "Tokens Held Daily", ); this.updateCacheEntry( ADDRESSES_WITH_BALANCE_DAILY_QUERY, this._dailyCache.addressesWithBalanceDaily, - "Addresses with balance Daily" + "Addresses with balance Daily", ); this.updateCacheEntry( TOTAL_ACTIVE_ADDRESSES_DAILY_QUERY, this._dailyCache.activeAddressesDaily, - "Number of Daily Active Addresses" + "Number of Daily Active Addresses", ); this.updateCacheEntry( TOKENS_TRANSFERRED_DAILY_QUERY, this._dailyCache.tokensTransferredDaily, - "Tokens transferred Daily" + "Tokens transferred Daily", ); this.updateCacheEntry( ALIAS_ACTIVITY_DAILY_QUERY, this._dailyCache.aliasActivityDaily, - "Alias activity Daily" + "Alias activity Daily", ); this.updateCacheEntry( UNLOCK_CONDITIONS_PER_TYPE_DAILY_QUERY, this._dailyCache.unlockConditionsPerTypeDaily, - "Unlock conditions per type Daily" - ); - this.updateCacheEntry( - NFT_ACTIVITY_DAILY_QUERY, - this._dailyCache.nftActivityDaily, - "Nft activity Daily" + "Unlock conditions per type Daily", ); + this.updateCacheEntry(NFT_ACTIVITY_DAILY_QUERY, this._dailyCache.nftActivityDaily, "Nft activity Daily"); this.updateCacheEntry( TOKENS_HELD_WITH_UC_DAILY_QUERY, this._dailyCache.tokensHeldWithUnlockConditionDaily, - "Tokens held with Unlock condition Daily" + "Tokens held with Unlock condition Daily", ); this.updateCacheEntry( UNCLAIMED_TOKENS_DAILY_QUERY, this._dailyCache.unclaimedTokensDaily, - "Unclaimed Tokens Daily" + "Unclaimed Tokens Daily", ); this.updateCacheEntry( UNCLAIMED_GENESIS_OUTPUTS_DAILY_QUERY, this._dailyCache.unclaimedGenesisOutputsDaily, - "Unclaimed genesis outputs Daily" - ); - this.updateCacheEntry( - LEDGER_SIZE_DAILY_QUERY, - this._dailyCache.ledgerSizeDaily, - "Ledger size Daily" + "Unclaimed genesis outputs Daily", ); + this.updateCacheEntry(LEDGER_SIZE_DAILY_QUERY, this._dailyCache.ledgerSizeDaily, "Ledger size Daily"); this.updateCacheEntry( STORAGE_DEPOSIT_DAILY_QUERY, this._dailyCache.storageDepositDaily, - "Storage Deposit Daily" + "Storage Deposit Daily", ); } @@ -321,35 +324,35 @@ export abstract class InfluxDbClient { private async collectAnalytics() { logger.verbose(`[InfluxDb] Collecting analytic stats for "${this._network.network}"`); try { - for (const update of await - this.queryInflux( - ADDRESSES_WITH_BALANCE_TOTAL_QUERY, null, this.getToNanoDate() - ) - ) { + for (const update of await this.queryInflux( + ADDRESSES_WITH_BALANCE_TOTAL_QUERY, + null, + this.getToNanoDate(), + )) { this._analyticsCache.addressesWithBalance = update.addressesWithBalance; } - for (const update of await - this.queryInflux( - NATIVE_TOKENS_STAT_TOTAL_QUERY, null, this.getToNanoDate() - ) - ) { + for (const update of await this.queryInflux( + NATIVE_TOKENS_STAT_TOTAL_QUERY, + null, + this.getToNanoDate(), + )) { this._analyticsCache.nativeTokensCount = update.nativeTokensCount; } - for (const update of await - this.queryInflux( - NFT_STAT_TOTAL_QUERY, null, this.getToNanoDate() - ) - ) { + for (const update of await this.queryInflux( + NFT_STAT_TOTAL_QUERY, + null, + this.getToNanoDate(), + )) { this._analyticsCache.nftsCount = update.nftsCount; } - for (const update of await - this.queryInflux( - STORAGE_DEPOSIT_TOTAL_QUERY, null, this.getToNanoDate() - ) - ) { + for (const update of await this.queryInflux( + STORAGE_DEPOSIT_TOTAL_QUERY, + null, + this.getToNanoDate(), + )) { this._analyticsCache.lockedStorageDeposit = update.lockedStorageDeposit; } } catch (err) { @@ -361,11 +364,11 @@ export abstract class InfluxDbClient { logger.verbose(`[InfluxDb] Collecting shimmer stats for "${this._network.network}"`); try { - for (const update of await - this.queryInflux( - SHIMMER_CLAIMED_TOTAL_QUERY, null, this.getToNanoDate() - ) - ) { + for (const update of await this.queryInflux( + SHIMMER_CLAIMED_TOTAL_QUERY, + null, + this.getToNanoDate(), + )) { this._analyticsCache.totalUnclaimedShimmer = update.totalUnclaimedShimmer; } } catch (err) { @@ -376,10 +379,7 @@ export abstract class InfluxDbClient { private async collectMilestoneStats() { logger.debug(`[InfluxDb] Collecting milestone stats for "${this._network.network}"`); try { - for (const update of await - this.queryInflux( - MILESTONE_STATS_QUERY, null, this.getToNanoDate() - )) { + for (const update of await this.queryInflux(MILESTONE_STATS_QUERY, null, this.getToNanoDate())) { this.updateMilestoneCache(update); } } catch (err) { @@ -389,9 +389,7 @@ export abstract class InfluxDbClient { private updateMilestoneCache(update: MilestoneUpdate) { if (update.milestoneIndex !== undefined && !this._milestoneCache.has(update.milestoneIndex)) { - const { - milestoneIndex, transaction, milestone, taggedData, treasuryTransaction, noPayload - } = update; + const { milestoneIndex, transaction, milestone, taggedData, treasuryTransaction, noPayload } = update; const blockCount = transaction + milestone + taggedData + treasuryTransaction + noPayload; this._milestoneCache.set(milestoneIndex, { milestoneIndex, @@ -401,13 +399,11 @@ export abstract class InfluxDbClient { milestone, taggedData, treasuryTransaction, - noPayload - } + noPayload, + }, }); - logger.debug( - `[InfluxDb] Added milestone index "${milestoneIndex}" to cache for "${this._network.network}"` - ); + logger.debug(`[InfluxDb] Added milestone index "${milestoneIndex}" to cache for "${this._network.network}"`); if (this._milestoneCache.size > MILESTONE_CACHE_MAX) { let lowestIndex: number; @@ -421,9 +417,7 @@ export abstract class InfluxDbClient { } } - logger.debug( - `[InfluxDb] Deleting milestone index "${lowestIndex}" ("${this._network.network}")` - ); + logger.debug(`[InfluxDb] Deleting milestone index "${lowestIndex}" ("${this._network.network}")`); this._milestoneCache.delete(lowestIndex); } @@ -444,7 +438,7 @@ export abstract class InfluxDbClient { queryTemplate: { full: string; partial: string }, cacheEntryToFetch: Map, description: string = "Daily entry", - debug: boolean = false + debug: boolean = false, ) { const network = this._network.network; const fromNanoDate: INanoDate | null = this.getFromNanoDate(cacheEntryToFetch); @@ -452,35 +446,35 @@ export abstract class InfluxDbClient { if (debug) { logger.debug( `[InfluxDb] Refreshing ${description} from date - ${fromNanoDate ? fromNanoDate.toISOString() : null} (${this._network.network})` + ${fromNanoDate ? fromNanoDate.toISOString() : null} (${this._network.network})`, ); } - const query = fromNanoDate ? - queryTemplate.partial : - queryTemplate.full; - - this.queryInflux(query, fromNanoDate, this.getToNanoDate()).then(results => { - for (const update of results) { - if (this.isAnyFieldNotNull(update)) { - if (debug) { - logger.debug( - `[InfluxDb] Setting ${description} cache entry (${network}):`, - moment(update.time).format(DAY_KEY_FORMAT) + const query = fromNanoDate ? queryTemplate.partial : queryTemplate.full; + + this.queryInflux(query, fromNanoDate, this.getToNanoDate()) + .then((results) => { + for (const update of results) { + if (this.isAnyFieldNotNull(update)) { + if (debug) { + logger.debug( + `[InfluxDb] Setting ${description} cache entry (${network}):`, + moment(update.time).format(DAY_KEY_FORMAT), + ); + } + + cacheEntryToFetch.set(moment(update.time).format(DAY_KEY_FORMAT), update); + } else if (debug) { + logger.warn( + `[InfluxDb] Found empty result entry while populating cache (${network}). + ${JSON.stringify(update)}`, ); } - - cacheEntryToFetch.set(moment(update.time).format(DAY_KEY_FORMAT), update); - } else if (debug) { - logger.warn( - `[InfluxDb] Found empty result entry while populating cache (${network}). - ${JSON.stringify(update)}` - ); } - } - }).catch(e => { - logger.warn(`[InfluxDb]] Query ${description} failed for (${network}). Cause ${e}`); - }); + }) + .catch((e) => { + logger.warn(`[InfluxDb]] Query ${description} failed for (${network}). Cause ${e}`); + }); } /** @@ -513,7 +507,7 @@ export abstract class InfluxDbClient { fromNanoDate = toNanoDate( // eslint-disable-next-line newline-per-chained-call - (lastDate.hours(0).minutes(0).seconds(1).valueOf() * NANOSECONDS_IN_MILLISECOND).toString() + (lastDate.hours(0).minutes(0).seconds(1).valueOf() * NANOSECONDS_IN_MILLISECOND).toString(), ); } @@ -529,9 +523,7 @@ export abstract class InfluxDbClient { * @returns Moment object representing the latest date of continous data. */ private computeLastDateOfContinousSeries(cacheEntry: Map): moment.Moment { - const sortedEntries = Array.from( - cacheEntry.values() - ).sort(this.ENTRIES_ASC_SORT); + const sortedEntries = Array.from(cacheEntry.values()).sort(this.ENTRIES_ASC_SORT); const oldestEntry = sortedEntries[0]; const start = moment(oldestEntry.time); @@ -564,7 +556,8 @@ export abstract class InfluxDbClient { * @returns True if any of the object fields (excludes time) is not null. */ private isAnyFieldNotNull(data: T): boolean { - return Object.getOwnPropertyNames(data).filter(fName => fName !== "time").some(fName => data[fName] !== null); + return Object.getOwnPropertyNames(data) + .filter((fName) => fName !== "time") + .some((fName) => data[fName] !== null); } } - diff --git a/api/src/services/stardust/influx/influxDbService.ts b/api/src/services/stardust/influx/influxDbService.ts index e7c0c6ce2..3fbd6b7d0 100644 --- a/api/src/services/stardust/influx/influxDbService.ts +++ b/api/src/services/stardust/influx/influxDbService.ts @@ -8,93 +8,63 @@ import { ITimedEntry } from "../../../models/influx/IInfluxTimedEntries"; */ export class InfluxDBService extends InfluxDbClient { public get blocksDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.blocksDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.blocksDaily); } public get transactionsDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.transactionsDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.transactionsDaily); } public get outputsDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.outputsDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.outputsDaily); } public get tokensHeldDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.tokensHeldDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.tokensHeldDaily); } public get addressesWithBalanceDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.addressesWithBalanceDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.addressesWithBalanceDaily); } public get activeAddressesDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.activeAddressesDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.activeAddressesDaily); } public get tokensTransferredDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.tokensTransferredDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.tokensTransferredDaily); } public get aliasActivityDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.aliasActivityDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.aliasActivityDaily); } public get unlockConditionsPerTypeDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.unlockConditionsPerTypeDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.unlockConditionsPerTypeDaily); } public get nftActivityDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.nftActivityDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.nftActivityDaily); } public get tokensHeldWithUnlockConditionDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.tokensHeldWithUnlockConditionDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.tokensHeldWithUnlockConditionDaily); } public get unclaimedTokensDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.unclaimedTokensDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.unclaimedTokensDaily); } public get unclaimedGenesisOutputsDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.unclaimedGenesisOutputsDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.unclaimedGenesisOutputsDaily); } public get ledgerSizeDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.ledgerSizeDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.ledgerSizeDaily); } public get storageDepositDaily() { - return this.mapToSortedValuesArray( - this._dailyCache.storageDepositDaily - ); + return this.mapToSortedValuesArray(this._dailyCache.storageDepositDaily); } public get addressesWithBalance() { @@ -126,9 +96,7 @@ export class InfluxDBService extends InfluxDbClient { return this._milestoneCache.get(milestoneIndex); } - public async fetchAnalyticsForMilestoneWithRetries( - milestoneIndex: number - ): Promise { + public async fetchAnalyticsForMilestoneWithRetries(milestoneIndex: number): Promise { const MAX_RETRY = 30; const RETRY_TIMEOUT = 350; @@ -140,16 +108,13 @@ export class InfluxDBService extends InfluxDbClient { logger.debug(`[InfluxDbService] Try ${retries} of fetching milestone stats for ${milestoneIndex}`); maybeMsStats = this._milestoneCache.get(milestoneIndex); - await new Promise(f => setTimeout(f, RETRY_TIMEOUT)); + await new Promise((f) => setTimeout(f, RETRY_TIMEOUT)); } return maybeMsStats; } private mapToSortedValuesArray(cacheEntry: Map): T[] { - return Array.from( - cacheEntry.values() - ).sort(this.ENTRIES_ASC_SORT); + return Array.from(cacheEntry.values()).sort(this.ENTRIES_ASC_SORT); } } - diff --git a/api/src/services/stardust/influx/influxQueries.ts b/api/src/services/stardust/influx/influxQueries.ts index 32085be19..6ae4ffde5 100644 --- a/api/src/services/stardust/influx/influxQueries.ts +++ b/api/src/services/stardust/influx/influxQueries.ts @@ -18,7 +18,7 @@ export const BLOCK_DAILY_QUERY = { FROM "stardust_block_activity" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const TRANSACTION_DAILY_QUERY = { @@ -37,7 +37,7 @@ export const TRANSACTION_DAILY_QUERY = { FROM "stardust_block_activity" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const OUTPUTS_DAILY_QUERY = { @@ -60,7 +60,7 @@ export const OUTPUTS_DAILY_QUERY = { FROM "stardust_ledger_outputs" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY = { @@ -83,7 +83,7 @@ export const TOKENS_HELD_BY_OUTPUTS_DAILY_QUERY = { FROM "stardust_ledger_outputs" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const ADDRESSES_WITH_BALANCE_DAILY_QUERY = { @@ -100,7 +100,7 @@ export const ADDRESSES_WITH_BALANCE_DAILY_QUERY = { FROM "stardust_addresses" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const TOTAL_ACTIVE_ADDRESSES_DAILY_QUERY = { @@ -117,7 +117,7 @@ export const TOTAL_ACTIVE_ADDRESSES_DAILY_QUERY = { FROM "stardust_daily_active_addresses" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const TOKENS_TRANSFERRED_DAILY_QUERY = { @@ -134,7 +134,7 @@ export const TOKENS_TRANSFERRED_DAILY_QUERY = { FROM "stardust_base_token_activity" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const ALIAS_ACTIVITY_DAILY_QUERY = { @@ -157,7 +157,7 @@ export const ALIAS_ACTIVITY_DAILY_QUERY = { FROM "stardust_output_activity" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const UNLOCK_CONDITIONS_PER_TYPE_DAILY_QUERY = { @@ -178,7 +178,7 @@ export const UNLOCK_CONDITIONS_PER_TYPE_DAILY_QUERY = { FROM "stardust_unlock_conditions" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const NFT_ACTIVITY_DAILY_QUERY = { @@ -199,7 +199,7 @@ export const NFT_ACTIVITY_DAILY_QUERY = { FROM "stardust_output_activity" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const TOKENS_HELD_WITH_UC_DAILY_QUERY = { @@ -220,7 +220,7 @@ export const TOKENS_HELD_WITH_UC_DAILY_QUERY = { FROM "stardust_unlock_conditions" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const UNCLAIMED_TOKENS_DAILY_QUERY = { @@ -237,7 +237,7 @@ export const UNCLAIMED_TOKENS_DAILY_QUERY = { FROM "stardust_unclaimed_rewards" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const UNCLAIMED_GENESIS_OUTPUTS_DAILY_QUERY = { @@ -254,7 +254,7 @@ export const UNCLAIMED_GENESIS_OUTPUTS_DAILY_QUERY = { FROM "stardust_unclaimed_rewards" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const LEDGER_SIZE_DAILY_QUERY = { @@ -273,7 +273,7 @@ export const LEDGER_SIZE_DAILY_QUERY = { FROM "stardust_ledger_size" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; export const STORAGE_DEPOSIT_DAILY_QUERY = { @@ -290,7 +290,7 @@ export const STORAGE_DEPOSIT_DAILY_QUERY = { FROM "stardust_ledger_size" WHERE time >= $from and time <= $to GROUP BY time(1d) fill(null) - ` + `, }; /* ANALYTIC QUERIES */ @@ -346,4 +346,3 @@ export const MILESTONE_STATS_QUERY_BY_INDEX = ` FROM "stardust_block_activity" WHERE "milestone_index" = $milestoneIndex `; - diff --git a/api/src/services/stardust/nodeInfoService.ts b/api/src/services/stardust/nodeInfoService.ts index 83e1c1e69..b4ddfc911 100644 --- a/api/src/services/stardust/nodeInfoService.ts +++ b/api/src/services/stardust/nodeInfoService.ts @@ -58,7 +58,7 @@ export class NodeInfoService { baseToken: response.nodeInfo.baseToken, protocolVersion: response.nodeInfo.protocol.version, bech32Hrp: response.nodeInfo.protocol.bech32Hrp, - rentStructure: response.nodeInfo.protocol.rentStructure + rentStructure: response.nodeInfo.protocol.rentStructure, }; return new NodeInfoService(network, nodeInfo); diff --git a/api/src/services/stardust/stats/baseStatsService.ts b/api/src/services/stardust/stats/baseStatsService.ts index 640966ca6..e2d35a7e5 100644 --- a/api/src/services/stardust/stats/baseStatsService.ts +++ b/api/src/services/stardust/stats/baseStatsService.ts @@ -28,8 +28,8 @@ export abstract class BaseStatsService implements IStatsService { confirmedItemsPerSecond: 0, confirmationRate: 0, latestMilestoneIndex: 0, - latestMilestoneIndexTime: 0 - } + latestMilestoneIndexTime: 0, + }, ]; setInterval(async () => this.updateStatistics(), 2000); @@ -48,7 +48,7 @@ export abstract class BaseStatsService implements IStatsService { * @returns The historical statistics for the network. */ public getItemsPerSecondHistory(): number[] { - return this._statistics.map(s => s.itemsPerSecond); + return this._statistics.map((s) => s.itemsPerSecond); } /** @@ -56,4 +56,3 @@ export abstract class BaseStatsService implements IStatsService { */ protected abstract updateStatistics(): Promise; } - diff --git a/api/src/services/stardust/stats/stardustStatsService.ts b/api/src/services/stardust/stats/stardustStatsService.ts index faac780ad..7de848839 100644 --- a/api/src/services/stardust/stats/stardustStatsService.ts +++ b/api/src/services/stardust/stats/stardustStatsService.ts @@ -3,7 +3,6 @@ import { BaseStatsService } from "./baseStatsService"; import { ServiceFactory } from "../../../factories/serviceFactory"; import logger from "../../../logger"; - /** * Class to handle stats service. */ @@ -22,12 +21,10 @@ export class StardustStatsService extends BaseStatsService { confirmedItemsPerSecond: response.nodeInfo.metrics.referencedBlocksPerSecond, confirmationRate: response.nodeInfo.metrics.referencedRate, latestMilestoneIndex: response.nodeInfo.status.latestMilestone.index, - latestMilestoneIndexTime: response.nodeInfo.status.latestMilestone.timestamp * 1000 + latestMilestoneIndexTime: response.nodeInfo.status.latestMilestone.timestamp * 1000, }); - logger.debug( - `[StardustStatsService] Updating network statistics for ${this._networkConfiguration.network}` - ); + logger.debug(`[StardustStatsService] Updating network statistics for ${this._networkConfiguration.network}`); if (this._statistics.length > 30) { this._statistics = this._statistics.slice(-30); @@ -38,4 +35,3 @@ export class StardustStatsService extends BaseStatsService { } } } - diff --git a/api/src/utils/apiHelper.ts b/api/src/utils/apiHelper.ts index f16aac143..e707ea475 100644 --- a/api/src/utils/apiHelper.ts +++ b/api/src/utils/apiHelper.ts @@ -18,10 +18,15 @@ import { IConfiguration } from "../models/configuration/IConfiguration"; * @param url The url to find. * @returns The params if the item matches. */ -export function matchRouteUrl(matchUrls: string[], url: string): { - index: number; - params: { [id: string]: string }; -} | undefined { +export function matchRouteUrl( + matchUrls: string[], + url: string, +): + | { + index: number; + params: { [id: string]: string }; + } + | undefined { const urlParts = url.replace(/\/$/, "").split("/"); for (let m = 0; m < matchUrls.length; m++) { @@ -33,9 +38,7 @@ export function matchRouteUrl(matchUrls: string[], url: string): { for (i = 0; i < urlParts.length && i < routeParts.length; i++) { if (routeParts[i] === urlParts[i]) { // This segment matches OK - } else if (routeParts[i].startsWith(":") && - (i < urlParts.length || routeParts[i].endsWith("?")) - ) { + } else if (routeParts[i].startsWith(":") && (i < urlParts.length || routeParts[i].endsWith("?"))) { // Its a param match in the url // or an undefined parameter past the end of the match if (i < urlParts.length) { @@ -48,7 +51,7 @@ export function matchRouteUrl(matchUrls: string[], url: string): { if (i === urlParts.length) { return { index: m, - params + params, }; } } @@ -70,7 +73,8 @@ export async function executeRoute( config: IConfiguration, route: IRoute, pathParams: { [id: string]: string }, - verboseLogging: boolean): Promise { + verboseLogging: boolean, +): Promise { let response: IResponse; const start = Date.now(); let filteredParams; @@ -112,7 +116,7 @@ export async function executeRoute( } } else { response = { - error: `Route '${route.path}' module '${modulePath}' does not contain a method '${route.func}'` + error: `Route '${route.path}' module '${modulePath}' does not contain a method '${route.func}'`, }; } } else { @@ -131,16 +135,15 @@ export async function executeRoute( response = { error: err.message }; } - if (verboseLogging || (response?.error)) { + if (verboseLogging || response?.error) { logger.debug(`<=== duration: ${Date.now() - start}ms`); logger.debug(inspect(response, false, undefined, false)); } if (route.sign && config.privateKeyEd25519 && config.privateKeyEd25519.length === 128) { - (response as ISignedResponse).signature = - Converter.bytesToHex(Ed25519.sign( - Converter.hexToBytes(config.privateKeyEd25519), - Converter.utf8ToBytes(JSON.stringify(response)))); + (response as ISignedResponse).signature = Converter.bytesToHex( + Ed25519.sign(Converter.hexToBytes(config.privateKeyEd25519), Converter.utf8ToBytes(JSON.stringify(response))), + ); } if (route.dataResponse) { @@ -154,13 +157,10 @@ export async function executeRoute( if (dataResponse.filename) { filename = `; filename="${dataResponse.filename}"`; } - res.setHeader( - "Content-Disposition", `${dataResponse.inline ? "inline" : "attachment"}${filename}` - ); + res.setHeader("Content-Disposition", `${dataResponse.inline ? "inline" : "attachment"}${filename}`); if (dataResponse.data) { - res.setHeader( - "Content-Length", dataResponse.data.length); + res.setHeader("Content-Length", dataResponse.data.length); res.send(dataResponse.data); } @@ -188,7 +188,7 @@ function logParams(obj: { [id: string]: unknown }): { [id: string]: unknown } { if (prop.constructor.name === "Object") { newobj[key] = logParams(prop as { [id: string]: unknown }); } else if (Array.isArray(prop)) { - newobj[key] = prop.map(item => logParams(item)); + newobj[key] = prop.map((item) => logParams(item)); } else { newobj[key] = prop; } @@ -212,7 +212,8 @@ export function cors( res: IHttpResponse, allowDomains: string | (string | RegExp)[] | undefined, allowMethods: string | undefined, - allowHeaders: string | undefined): void { + allowHeaders: string | undefined, +): void { if (!allowDomains || allowDomains === "*") { res.setHeader("Access-Control-Allow-Origin", "*"); } else if (allowDomains) { @@ -236,22 +237,20 @@ export function cors( } if (req.method === "OPTIONS") { - res.setHeader( - "Access-Control-Allow-Methods", - allowMethods || "GET, POST, OPTIONS, PUT, PATCH, DELETE" - ); + res.setHeader("Access-Control-Allow-Methods", allowMethods || "GET, POST, OPTIONS, PUT, PATCH, DELETE"); res.setHeader( "Access-Control-Allow-Headers", - allowHeaders || [ - "X-Requested-With", - "Access-Control-Allow-Origin", - "X-HTTP-Method-Override", - "Content-Type", - "Authorization", - "Accept", - "Accept-Encoding" - ].join(",") + allowHeaders || + [ + "X-Requested-With", + "Access-Control-Allow-Origin", + "X-HTTP-Method-Override", + "Content-Type", + "Authorization", + "Accept", + "Accept-Encoding", + ].join(","), ); } } diff --git a/api/src/utils/chrysalis/chrysalisTangleHelper.ts b/api/src/utils/chrysalis/chrysalisTangleHelper.ts index d02e5b6c4..4f0c9ff35 100644 --- a/api/src/utils/chrysalis/chrysalisTangleHelper.ts +++ b/api/src/utils/chrysalis/chrysalisTangleHelper.ts @@ -1,5 +1,13 @@ import { Blake2b } from "@iota/crypto.js"; -import { Bech32Helper, IAddressOutputsResponse, IMessagesResponse, IMilestoneResponse, IOutputResponse, serializeMessage, SingleNodeClient } from "@iota/iota.js-chrysalis"; +import { + Bech32Helper, + IAddressOutputsResponse, + IMessagesResponse, + IMilestoneResponse, + IOutputResponse, + serializeMessage, + SingleNodeClient, +} from "@iota/iota.js-chrysalis"; import { Converter, WriteStream } from "@iota/util.js"; import { ExtendedSingleNodeClient } from "./extendedSingleNodeClient"; import { IMessageDetailsResponse } from "../../models/api/chrysalis/IMessageDetailsResponse"; @@ -20,8 +28,7 @@ export class ChrysalisTangleHelper { * @returns The item found. */ public static async search(network: INetwork, query: string): Promise { - const nodeResult = await ChrysalisTangleHelper.searchApi( - network.provider, network.user, network.password, network.bechHrp, query); + const nodeResult = await ChrysalisTangleHelper.searchApi(network.provider, network.user, network.password, network.bechHrp, query); return nodeResult; } @@ -42,10 +49,11 @@ export class ChrysalisTangleHelper { password: string | undefined, bechHrp: string, query: string, - cursor?: string): Promise { + cursor?: string, + ): Promise { const client = new SingleNodeClient(provider, { userName: user, - password + password, }); const queryLower = HexHelper.stripPrefix(query.toLowerCase()); @@ -53,22 +61,20 @@ export class ChrysalisTangleHelper { // If the query starts with did:iota: then lookup a Decentralized identifier if (queryLower.startsWith("did:iota:")) { return { - did: query + did: query, }; } - } catch { - } + } catch {} try { // If the query is an integer then lookup a milestone if (/^\d+$/.test(query)) { const milestone = await client.milestone(Number.parseInt(query, 10)); return { - milestone + milestone, }; } - } catch { - } + } catch {} try { // If the query is bech format lookup address @@ -79,12 +85,11 @@ export class ChrysalisTangleHelper { return { address, - addressOutputIds: addressOutputs.outputIds + addressOutputIds: addressOutputs.outputIds, }; } } - } catch { - } + } catch {} // If the query is 64 bytes hex, try and look for a message if (Converter.isHex(queryLower) && queryLower.length === 64) { @@ -93,11 +98,10 @@ export class ChrysalisTangleHelper { if (Object.keys(message).length > 0) { return { - message + message, }; } - } catch { - } + } catch {} // If the query is 64 bytes hex, try and look for a transaction included message try { @@ -110,11 +114,10 @@ export class ChrysalisTangleHelper { return { message, - includedMessageId + includedMessageId, }; } - } catch { - } + } catch {} } try { @@ -123,11 +126,10 @@ export class ChrysalisTangleHelper { const output = await client.output(queryLower); return { - output + output, }; } - } catch { - } + } catch {} try { // If the query is bech format lookup address @@ -138,19 +140,20 @@ export class ChrysalisTangleHelper { const addressOutputs = await client.addressEd25519Outputs(queryLower); if (addressOutputs.count > 0) { - const state = (addressOutputs as (IAddressOutputsResponse & { - state?: unknown; - })).state; + const state = ( + addressOutputs as IAddressOutputsResponse & { + state?: unknown; + } + ).state; return { address, addressOutputIds: addressOutputs.outputIds, - cursor: state ? Converter.utf8ToHex(JSON.stringify(state)) : undefined + cursor: state ? Converter.utf8ToHex(JSON.stringify(state)) : undefined, }; } } - } catch { - } + } catch {} try { if (query.length > 0) { @@ -166,7 +169,8 @@ export class ChrysalisTangleHelper { if (query.length >= 2 && query.length <= 128 && Converter.isHex(queryLower)) { messages = await client.fetchJson( "get", - `messages?index=${queryLower}${cursorParam}`); + `messages?index=${queryLower}${cursorParam}`, + ); if (messages.count > 0) { indexMessageType = "hex"; @@ -177,7 +181,8 @@ export class ChrysalisTangleHelper { if (!indexMessageType && query.length <= 64) { messages = await client.fetchJson( "get", - `messages?index=${Converter.utf8ToHex(query)}${cursorParam}`); + `messages?index=${Converter.utf8ToHex(query)}${cursorParam}`, + ); if (messages.count > 0) { indexMessageType = "utf8"; @@ -188,12 +193,11 @@ export class ChrysalisTangleHelper { return { indexMessageIds: messages.messageIds, indexMessageType, - cursor: messages.state + cursor: messages.state, }; } } - } catch { - } + } catch {} return {}; } @@ -208,7 +212,7 @@ export class ChrysalisTangleHelper { try { const client = new SingleNodeClient(network.provider, { userName: network.user, - password: network.password + password: network.password, }); const metadata = await client.messageMetadata(messageId); @@ -216,10 +220,9 @@ export class ChrysalisTangleHelper { return { metadata, - childrenMessageIds: children ? children.childrenMessageIds : undefined + childrenMessageIds: children ? children.childrenMessageIds : undefined, }; - } catch { - } + } catch {} } /** @@ -232,11 +235,10 @@ export class ChrysalisTangleHelper { try { const client = new SingleNodeClient(network.provider, { userName: network.user, - password: network.password + password: network.password, }); return await client.output(outputId); - } catch { - } + } catch {} } /** @@ -245,16 +247,17 @@ export class ChrysalisTangleHelper { * @param request The request. * @returns The transactions. */ - public static async transactionHistory(network: INetwork, - request: ITransactionHistoryRequest): Promise { + public static async transactionHistory( + network: INetwork, + request: ITransactionHistoryRequest, + ): Promise { try { const client = new ExtendedSingleNodeClient(network.provider, { userName: network.user, - password: network.password + password: network.password, }); return await client.transactionHistory(request); - } catch { - } + } catch {} } /** @@ -263,16 +266,13 @@ export class ChrysalisTangleHelper { * @param milestoneIndex The milestone iindex to get the details. * @returns The item details. */ - public static async milestoneDetails( - network: INetwork, milestoneIndex: number): Promise { + public static async milestoneDetails(network: INetwork, milestoneIndex: number): Promise { try { const client = new SingleNodeClient(network.provider, { userName: network.user, - password: network.password + password: network.password, }); return await client.milestone(milestoneIndex); - } catch { - } + } catch {} } } - diff --git a/api/src/utils/chrysalis/extendedSingleNodeClient.ts b/api/src/utils/chrysalis/extendedSingleNodeClient.ts index 1870c11fe..82e21a166 100644 --- a/api/src/utils/chrysalis/extendedSingleNodeClient.ts +++ b/api/src/utils/chrysalis/extendedSingleNodeClient.ts @@ -10,9 +10,10 @@ export class ExtendedSingleNodeClient extends SingleNodeClient { // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars const { network, address, ...params } = request; - const res = await - this.fetchJson("get", - `addresses/ed25519/${address}/tx-history${params ? `${FetchHelper.urlParams(params)}` : ""}`); + const res = await this.fetchJson( + "get", + `addresses/ed25519/${address}/tx-history${params ? `${FetchHelper.urlParams(params)}` : ""}`, + ); return res; } catch (e) { return { error: e }; diff --git a/api/src/utils/chrysalis/identityHelper.ts b/api/src/utils/chrysalis/identityHelper.ts index a5c15caa9..89d1d7544 100644 --- a/api/src/utils/chrysalis/identityHelper.ts +++ b/api/src/utils/chrysalis/identityHelper.ts @@ -6,21 +6,20 @@ export class IdentityHelper { * @param legacyDocument document in legacy structure * @returns document in latest structure */ - public static convertLegacyDocument( - legacyDocument: Record): ILatestDocument { - const transformedDocument = { - doc: legacyDocument, - meta: { - updated: legacyDocument.updated, - created: legacyDocument.created - }, - proof: legacyDocument.proof - }; - delete transformedDocument.doc.updated; - delete transformedDocument.doc.created; - delete transformedDocument.doc.proof; + public static convertLegacyDocument(legacyDocument: Record): ILatestDocument { + const transformedDocument = { + doc: legacyDocument, + meta: { + updated: legacyDocument.updated, + created: legacyDocument.created, + }, + proof: legacyDocument.proof, + }; + delete transformedDocument.doc.updated; + delete transformedDocument.doc.created; + delete transformedDocument.doc.proof; - return transformedDocument; + return transformedDocument; } /** @@ -28,13 +27,12 @@ export class IdentityHelper { * @param latestDocument document in latest structure * @returns document in legacy structure */ - public static revertLegacyDocument( - latestDocument: ILatestDocument): Record { - const transformedDocument: Record = { - ...latestDocument.doc, - ...latestDocument.meta - }; + public static revertLegacyDocument(latestDocument: ILatestDocument): Record { + const transformedDocument: Record = { + ...latestDocument.doc, + ...latestDocument.meta, + }; - return transformedDocument; + return transformedDocument; } } diff --git a/api/src/utils/convertUtils.ts b/api/src/utils/convertUtils.ts index 8f4ddcf63..c298cf12e 100644 --- a/api/src/utils/convertUtils.ts +++ b/api/src/utils/convertUtils.ts @@ -42,17 +42,12 @@ export class Converter { str += String.fromCharCode(((value & 0x1f) << 6) | (array[i + 1] & 0x3f)); i += 1; } else if (value > 0xdf && value < 0xf0) { - str += String.fromCharCode( - ((value & 0x0f) << 12) | ((array[i + 1] & 0x3f) << 6) | (array[i + 2] & 0x3f) - ); + str += String.fromCharCode(((value & 0x0f) << 12) | ((array[i + 1] & 0x3f) << 6) | (array[i + 2] & 0x3f)); i += 2; } else { // surrogate pair const charCode = - (((value & 0x07) << 18) | - ((array[i + 1] & 0x3f) << 12) | - ((array[i + 2] & 0x3f) << 6) | - (array[i + 3] & 0x3f)) - + (((value & 0x07) << 18) | ((array[i + 1] & 0x3f) << 12) | ((array[i + 2] & 0x3f) << 6) | (array[i + 3] & 0x3f)) - 0x010000; str += String.fromCharCode((charCode >> 10) | 0xd800, (charCode & 0x03ff) | 0xdc00); @@ -90,7 +85,7 @@ export class Converter { 0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), - 0x80 | (charcode & 0x3f) + 0x80 | (charcode & 0x3f), ); } } @@ -112,7 +107,7 @@ export class Converter { includePrefix: boolean = false, startIndex?: number, length?: number | undefined, - reverse?: boolean + reverse?: boolean, ): string { let hex = ""; this.buildHexLookups(); @@ -150,8 +145,7 @@ export class Converter { let n = 0; while (i < length) { array[n++] = - (Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)] << 4) | - Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)]; + (Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)] << 4) | Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)]; } if (reverse) { @@ -245,5 +239,3 @@ export class Converter { } } } - - diff --git a/api/src/utils/fetchHelper.ts b/api/src/utils/fetchHelper.ts index ec4f50333..aa465d3f8 100644 --- a/api/src/utils/fetchHelper.ts +++ b/api/src/utils/fetchHelper.ts @@ -21,7 +21,7 @@ export class FetchHelper { method: "get" | "post" | "put" | "delete", payload?: T, headers?: { [id: string]: string }, - timeout?: number + timeout?: number, ): Promise { headers = headers ?? {}; headers["Content-Type"] = "application/json"; @@ -32,26 +32,20 @@ export class FetchHelper { if (timeout !== undefined) { controller = new AbortController(); - timerId = setTimeout( - () => { - if (controller) { - controller.abort(); - } - }, - timeout - ); + timerId = setTimeout(() => { + if (controller) { + controller.abort(); + } + }, timeout); } try { - const res = await fetch( - `${baseUrl.replace(/\/$/, "")}${path.length > 0 ? `/${path.replace(/^\//, "")}` : ""}`, - { - method, - headers, - body: payload ? JSON.stringify(payload) : undefined, - signal: controller ? controller.signal : undefined - } - ); + const res = await fetch(`${baseUrl.replace(/\/$/, "")}${path.length > 0 ? `/${path.replace(/^\//, "")}` : ""}`, { + method, + headers, + body: payload ? JSON.stringify(payload) : undefined, + signal: controller ? controller.signal : undefined, + }); const json = await res.json(); return json as U; @@ -89,8 +83,7 @@ export class FetchHelper { * @param req The request. * @returns The curl command. */ - public static convertToCurl( - baseUrl: string, path: string, method: string, headers: { [id: string]: string }, req?: unknown): string { + public static convertToCurl(baseUrl: string, path: string, method: string, headers: { [id: string]: string }, req?: unknown): string { const endpoint = `${baseUrl.replace(/\/$/, "")}${path.length > 0 ? `/${path.replace(/^\//, "")}` : ""}`; const curl = [`curl ${endpoint} \\`]; diff --git a/api/src/utils/hexHelper.ts b/api/src/utils/hexHelper.ts index a0c632dee..8e8e19813 100644 --- a/api/src/utils/hexHelper.ts +++ b/api/src/utils/hexHelper.ts @@ -9,10 +9,7 @@ export class HexHelper { /** * Const defining the maximum value for a 256 bit int. */ - public static readonly BIG_INT_MAX_256_BIT: BigInteger = bigInt( - "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - 16 - ); + public static readonly BIG_INT_MAX_256_BIT: BigInteger = bigInt("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16); /** * Convert the big int 256 bit to hex string. @@ -68,4 +65,3 @@ export class HexHelper { return hex.startsWith("0x"); } } - diff --git a/api/src/utils/legacy/legacyTangleHelper.ts b/api/src/utils/legacy/legacyTangleHelper.ts index 5fbaf5f1c..ff90c53f0 100644 --- a/api/src/utils/legacy/legacyTangleHelper.ts +++ b/api/src/utils/legacy/legacyTangleHelper.ts @@ -20,30 +20,30 @@ export class LegacyTangleHelper { network: INetwork, hashTypeName: TransactionsGetMode, hash: string, - limit?: number): Promise<{ - /** - * The hashes we found in the lookup - */ - hashes: string[]; - /** - * Cursor for getting more items. - */ - cursor?: ITransactionsCursor; - }> { + limit?: number, + ): Promise<{ + /** + * The hashes we found in the lookup + */ + hashes: string[]; + /** + * Cursor for getting more items. + */ + cursor?: ITransactionsCursor; + }> { const findReq = {}; findReq[hashTypeName] = [hash]; let hashes: string[] = []; - const cursor: ITransactionsCursor = { - }; + const cursor: ITransactionsCursor = {}; try { const client = new LegacyClient(network.provider, network.user, network.password); const response = await client.findTransactions({ ...findReq, - maxresults: 5000 + maxresults: 5000, }); if (response?.txHashes && response.txHashes.length > 0) { @@ -68,7 +68,7 @@ export class LegacyTangleHelper { return { hashes, - cursor + cursor, }; } @@ -80,18 +80,18 @@ export class LegacyTangleHelper { */ public static async getTrytes( network: INetwork, - txHashes: string[]): Promise<{ - /** - * The trytes for the requested transactions. - */ - trytes?: string[]; - - /** - * The confirmation state of the transactions. - */ - milestoneIndexes?: number[]; - } - > { + txHashes: string[], + ): Promise<{ + /** + * The trytes for the requested transactions. + */ + trytes?: string[]; + + /** + * The confirmation state of the transactions. + */ + milestoneIndexes?: number[]; + }> { const allTrytes: { /** * The legacy index. @@ -112,7 +112,7 @@ export class LegacyTangleHelper { }[] = txHashes.map((h, idx) => ({ index: idx, txHash: h, milestoneIndex: null })); try { - const missingTrytes = allTrytes.filter(a => !a.trytes); + const missingTrytes = allTrytes.filter((a) => !a.trytes); if (missingTrytes.length > 0) { const client = new LegacyClient(network.provider, network.user, network.password); @@ -129,7 +129,7 @@ export class LegacyTangleHelper { } try { - const missingState = allTrytes.filter(a => a.milestoneIndex === null); + const missingState = allTrytes.filter((a) => a.milestoneIndex === null); if (missingState.length > 0) { const client = new LegacyClient(network.provider, network.user, network.password); @@ -145,8 +145,8 @@ export class LegacyTangleHelper { } return { - trytes: allTrytes.map(t => t.trytes || "9".repeat(2673)), - milestoneIndexes: allTrytes.map(t => t.milestoneIndex ?? 0) + trytes: allTrytes.map((t) => t.trytes || "9".repeat(2673)), + milestoneIndexes: allTrytes.map((t) => t.milestoneIndex ?? 0), }; } @@ -156,9 +156,7 @@ export class LegacyTangleHelper { * @param addressHash The addresss hash to get the balance. * @returns The balance for the address. */ - public static async getAddressBalance( - network: INetwork, - addressHash: string): Promise { + public static async getAddressBalance(network: INetwork, addressHash: string): Promise { try { const client = new LegacyClient(network.provider, network.user, network.password); diff --git a/api/src/utils/stardust/associatedOutputsHelper.ts b/api/src/utils/stardust/associatedOutputsHelper.ts index 818a1ca77..b5b736a0f 100644 --- a/api/src/utils/stardust/associatedOutputsHelper.ts +++ b/api/src/utils/stardust/associatedOutputsHelper.ts @@ -1,5 +1,11 @@ import { - Client, IOutputsResponse, QueryParameter, AliasQueryParameter, FoundryQueryParameter, NftQueryParameter, AddressType + Client, + IOutputsResponse, + QueryParameter, + AliasQueryParameter, + FoundryQueryParameter, + NftQueryParameter, + AddressType, } from "@iota/sdk"; import { ServiceFactory } from "../../factories/serviceFactory"; import { AssociationType } from "../../models/api/stardust/IAssociationsResponse"; @@ -31,37 +37,37 @@ export class AssociatedOutputsHelper { promises.push( // Basic output -> owner address this.fetchAssociatedOutputIds( - async query => client.basicOutputIds([query]), + async (query) => client.basicOutputIds([query]), { address }, - AssociationType.BASIC_ADDRESS - ) + AssociationType.BASIC_ADDRESS, + ), ); promises.push( // Basic output -> storage return address this.fetchAssociatedOutputIds( - async query => client.basicOutputIds([query]), + async (query) => client.basicOutputIds([query]), { storageDepositReturnAddress: address }, - AssociationType.BASIC_STORAGE_RETURN - ) + AssociationType.BASIC_STORAGE_RETURN, + ), ); promises.push( // Basic output -> expiration return address this.fetchAssociatedOutputIds( - async query => client.basicOutputIds([query]), + async (query) => client.basicOutputIds([query]), { expirationReturnAddress: address }, - AssociationType.BASIC_EXPIRATION_RETURN - ) + AssociationType.BASIC_EXPIRATION_RETURN, + ), ); promises.push( // Basic output -> sender address this.fetchAssociatedOutputIds( - async query => client.basicOutputIds([query]), + async (query) => client.basicOutputIds([query]), { sender: address }, - AssociationType.BASIC_SENDER - ) + AssociationType.BASIC_SENDER, + ), ); // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison @@ -69,57 +75,53 @@ export class AssociatedOutputsHelper { const aliasId = this.addressDetails.hex; promises.push( // Alias id - this.fetchAssociatedOutputIds( - async query => client.aliasOutputId(query), - aliasId, - AssociationType.ALIAS_ID - ) + this.fetchAssociatedOutputIds(async (query) => client.aliasOutputId(query), aliasId, AssociationType.ALIAS_ID), ); } promises.push( // Alias output -> state controller address this.fetchAssociatedOutputIds( - async query => client.aliasOutputIds([query]), + async (query) => client.aliasOutputIds([query]), { stateController: address }, - AssociationType.ALIAS_STATE_CONTROLLER - ) + AssociationType.ALIAS_STATE_CONTROLLER, + ), ); promises.push( // Alias output -> governor address this.fetchAssociatedOutputIds( - async query => client.aliasOutputIds([query]), + async (query) => client.aliasOutputIds([query]), { governor: address }, - AssociationType.ALIAS_GOVERNOR - ) + AssociationType.ALIAS_GOVERNOR, + ), ); promises.push( // Alias output -> issuer address this.fetchAssociatedOutputIds( - async query => client.aliasOutputIds([query]), + async (query) => client.aliasOutputIds([query]), { issuer: address }, - AssociationType.ALIAS_ISSUER - ) + AssociationType.ALIAS_ISSUER, + ), ); promises.push( // Alias output -> sender address this.fetchAssociatedOutputIds( - async query => client.aliasOutputIds([query]), + async (query) => client.aliasOutputIds([query]), { sender: address }, - AssociationType.ALIAS_SENDER - ) + AssociationType.ALIAS_SENDER, + ), ); promises.push( // Foundry output -> alias address this.fetchAssociatedOutputIds( - async query => client.foundryOutputIds([query]), + async (query) => client.foundryOutputIds([query]), { aliasAddress: address }, - AssociationType.FOUNDRY_ALIAS - ) + AssociationType.FOUNDRY_ALIAS, + ), ); // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison @@ -127,57 +129,53 @@ export class AssociatedOutputsHelper { const nftId = this.addressDetails.hex; promises.push( // Nft id - this.fetchAssociatedOutputIds( - async query => client.nftOutputId(query), - nftId, - AssociationType.NFT_ID - ) + this.fetchAssociatedOutputIds(async (query) => client.nftOutputId(query), nftId, AssociationType.NFT_ID), ); } promises.push( // Nft output -> owner address this.fetchAssociatedOutputIds( - async query => client.nftOutputIds([query]), + async (query) => client.nftOutputIds([query]), { address }, - AssociationType.NFT_ADDRESS - ) + AssociationType.NFT_ADDRESS, + ), ); promises.push( // Nft output -> storage return address this.fetchAssociatedOutputIds( - async query => client.nftOutputIds([query]), + async (query) => client.nftOutputIds([query]), { storageDepositReturnAddress: address }, - AssociationType.NFT_STORAGE_RETURN - ) + AssociationType.NFT_STORAGE_RETURN, + ), ); promises.push( // Nft output -> expiration return address this.fetchAssociatedOutputIds( - async query => client.nftOutputIds([query]), + async (query) => client.nftOutputIds([query]), { expirationReturnAddress: address }, - AssociationType.NFT_EXPIRATION_RETURN - ) + AssociationType.NFT_EXPIRATION_RETURN, + ), ); promises.push( // Nft output -> issuer address this.fetchAssociatedOutputIds( - async query => client.nftOutputIds([query]), + async (query) => client.nftOutputIds([query]), { issuer: address }, - AssociationType.NFT_ISSUER - ) + AssociationType.NFT_ISSUER, + ), ); promises.push( // Nft output -> sender address this.fetchAssociatedOutputIds( - async query => client.nftOutputIds([query]), + async (query) => client.nftOutputIds([query]), { sender: address }, - AssociationType.NFT_SENDER - ) + AssociationType.NFT_SENDER, + ), ); await Promise.all(promises); @@ -192,16 +190,14 @@ export class AssociatedOutputsHelper { private async fetchAssociatedOutputIds( fetch: (req: T) => Promise, args: T, - association: AssociationType + association: AssociationType, ): Promise { const associationToOutputIds = this.associationToOutputIds; let cursor: string; do { try { - const response = typeof args === "string" ? - await fetch(args) : - await fetch({ ...args, cursor }); + const response = typeof args === "string" ? await fetch(args) : await fetch({ ...args, cursor }); if (typeof response === "string") { const outputIds = associationToOutputIds.get(association); @@ -220,7 +216,7 @@ export class AssociatedOutputsHelper { cursor = response.cursor; } - } catch { } + } catch {} } while (cursor); } } diff --git a/api/src/utils/stardust/searchExecutor.ts b/api/src/utils/stardust/searchExecutor.ts index a7a5ff6ec..7fb1c33dc 100644 --- a/api/src/utils/stardust/searchExecutor.ts +++ b/api/src/utils/stardust/searchExecutor.ts @@ -31,211 +31,188 @@ export class SearchExecutor { if (searchQuery.did) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.tryFetchNodeThenPermanode( - searchQuery.aliasId, - "aliasOutputId", - network - ).then( - aliasOutputs => { + StardustTangleHelper.tryFetchNodeThenPermanode(searchQuery.aliasId, "aliasOutputId", network) + .then((aliasOutputs) => { if (aliasOutputs) { promisesResult = { aliasId: searchQuery.aliasId, - did: searchQuery.did + did: searchQuery.did, }; resolve(); } else { reject(new Error("Output (aliasId) not present")); } - } - ).catch(_ => { - reject(new Error("Output (aliasId) fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Output (aliasId) fetch failed")); + }); + }), ); } if (searchQuery.milestoneIndex) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.milestoneDetailsByIndex(network, searchQuery.milestoneIndex).then( - milestoneDetails => { + StardustTangleHelper.milestoneDetailsByIndex(network, searchQuery.milestoneIndex) + .then((milestoneDetails) => { if (milestoneDetails) { promisesResult = { - milestone: milestoneDetails + milestone: milestoneDetails, }; resolve(); } else { reject(new Error("Milestone (by index) details not present")); } - } - ).catch(_ => { - reject(new Error("Milestone by index failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Milestone by index failed")); + }); + }), ); } if (searchQuery.milestoneId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.milestoneDetailsById(network, searchQuery.milestoneId).then( - milestoneDetails => { + StardustTangleHelper.milestoneDetailsById(network, searchQuery.milestoneId) + .then((milestoneDetails) => { if (milestoneDetails) { promisesResult = { - milestone: milestoneDetails + milestone: milestoneDetails, }; resolve(); } else { reject(new Error("Milestone (by milestoneId) details not present")); } - } - ).catch(_ => { - reject(new Error("Milestone by milestoneId failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Milestone by milestoneId failed")); + }); + }), ); } if (searchQuery.blockId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.block(network, searchQuery.blockId).then( - blockResponse => { + StardustTangleHelper.block(network, searchQuery.blockId) + .then((blockResponse) => { if (blockResponse && !blockResponse.error) { promisesResult = { - block: blockResponse.block + block: blockResponse.block, }; resolve(); } else { reject(new Error("Block response not present")); } - } - ).catch(_ => { - reject(new Error("Block fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Block fetch failed")); + }); + }), ); } if (searchQuery.transactionId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.transactionIncludedBlock( - network, - searchQuery.transactionId - ).then( - txDetailsResponse => { + StardustTangleHelper.transactionIncludedBlock(network, searchQuery.transactionId) + .then((txDetailsResponse) => { if (txDetailsResponse.block && Object.keys(txDetailsResponse.block).length > 0) { promisesResult = { - transactionBlock: txDetailsResponse.block + transactionBlock: txDetailsResponse.block, }; resolve(); } else { reject(new Error("Block (by transactionId) response not present")); } - } - ).catch(_ => { - reject(new Error("Block (by transactionId) fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Block (by transactionId) fetch failed")); + }); + }), ); } if (searchQuery.output) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.tryFetchNodeThenPermanode( - searchQuery.output, - "getOutput", - network - ).then( - output => { + StardustTangleHelper.tryFetchNodeThenPermanode(searchQuery.output, "getOutput", network) + .then((output) => { if (output) { promisesResult = { output }; resolve(); } else { reject(new Error("Output response not present")); } - } - ).catch(_ => { - reject(new Error("Output fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Output fetch failed")); + }); + }), ); } if (searchQuery.aliasId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.tryFetchNodeThenPermanode( - searchQuery.aliasId, - "aliasOutputId", - network - ).then( - aliasOutputs => { + StardustTangleHelper.tryFetchNodeThenPermanode(searchQuery.aliasId, "aliasOutputId", network) + .then((aliasOutputs) => { if (aliasOutputs) { promisesResult = { - aliasId: searchQuery.aliasId + aliasId: searchQuery.aliasId, }; resolve(); } else { reject(new Error("Output (aliasId) not present")); } - } - ).catch(_ => { - reject(new Error("Output (aliasId) fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Output (aliasId) fetch failed")); + }); + }), ); } if (searchQuery.nftId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.tryFetchNodeThenPermanode( - searchQuery.nftId, - "nftOutputId", - network - ).then( - nftOutputs => { + StardustTangleHelper.tryFetchNodeThenPermanode(searchQuery.nftId, "nftOutputId", network) + .then((nftOutputs) => { if (nftOutputs) { promisesResult = { - nftId: searchQuery.nftId + nftId: searchQuery.nftId, }; resolve(); } else { reject(new Error("Output (nftId) not present")); } - } - ).catch(_ => { - reject(new Error("Output (nftId) fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Output (nftId) fetch failed")); + }); + }), ); } if (searchQuery.foundryId) { promises.push( new Promise((resolve, reject) => { - StardustTangleHelper.tryFetchNodeThenPermanode( - searchQuery.foundryId, - "foundryOutputId", - network - ).then( - foundryOutput => { + StardustTangleHelper.tryFetchNodeThenPermanode(searchQuery.foundryId, "foundryOutputId", network) + .then((foundryOutput) => { if (foundryOutput) { promisesResult = { - foundryId: searchQuery.foundryId + foundryId: searchQuery.foundryId, }; resolve(); } else { reject(new Error("Output (foundryId) not present")); } - } - ).catch(_ => { - reject(new Error("Output (foundryId) fetch failed")); - }); - }) + }) + .catch((_) => { + reject(new Error("Output (foundryId) fetch failed")); + }); + }), ); } @@ -243,25 +220,24 @@ export class SearchExecutor { promises.push( new Promise((resolve, reject) => { StardustTangleHelper.taggedOutputs(network, searchQuery.tag) - .then( - response => { - if (!response.basicOutputs.error || !response.nftOutputs.error) { - promisesResult = { - taggedOutputs: response - }; - resolve(); - } else { - reject(new Error("Tagged outputs not present")); - } + .then((response) => { + if (!response.basicOutputs.error || !response.nftOutputs.error) { + promisesResult = { + taggedOutputs: response, + }; + resolve(); + } else { + reject(new Error("Tagged outputs not present")); } - ).catch(_ => { + }) + .catch((_) => { reject(new Error("Tagged outputs not present")); }); - }) + }), ); } - await Promise.any(promises).catch(_ => { }); + await Promise.any(promises).catch((_) => {}); if (promisesResult !== null) { return promisesResult; @@ -269,7 +245,7 @@ export class SearchExecutor { if (searchQuery.address?.bech32) { return { - addressDetails: searchQuery.address + addressDetails: searchQuery.address, }; } diff --git a/api/src/utils/stardust/searchQueryBuilder.ts b/api/src/utils/stardust/searchQueryBuilder.ts index b6477dd46..5443db78a 100644 --- a/api/src/utils/stardust/searchQueryBuilder.ts +++ b/api/src/utils/stardust/searchQueryBuilder.ts @@ -31,7 +31,6 @@ interface QueryDetails { isBech32: boolean; } - export interface SearchQuery { /** * The query string in lower case. @@ -146,7 +145,8 @@ export class SearchQueryBuilder { } else if ( // if the hex without prefix is 76 characters and first byte is 08, // it might be a FoundryId (tokenId) - queryDetails.hex && queryDetails.hexNoPrefix && + queryDetails.hex && + queryDetails.hexNoPrefix && Converter.isHex(queryDetails.hex, true) && queryDetails.hexNoPrefix.length === 76 && Number.parseInt(queryDetails.hexNoPrefix.slice(0, 2), 16) === AddressType.Alias @@ -154,15 +154,14 @@ export class SearchQueryBuilder { foundryId = queryDetails.hex; } else if ( // if the hex is 70 characters it might be an output - queryDetails?.hex && queryDetails.hex.length === 70 + queryDetails?.hex && + queryDetails.hex.length === 70 ) { output = queryDetails.hex; } // also perform a tag search - const maybeTag = Converter.isHex(this.query, true) ? - HexHelper.addPrefix(this.query) : - Converter.utf8ToHex(this.query, true); + const maybeTag = Converter.isHex(this.query, true) ? HexHelper.addPrefix(this.query) : Converter.utf8ToHex(this.query, true); if (maybeTag.length < 66) { tag = maybeTag; } @@ -180,7 +179,7 @@ export class SearchQueryBuilder { aliasId, nftId, foundryId, - tag + tag, }; } @@ -213,7 +212,7 @@ export class SearchQueryBuilder { hex = HexHelper.addPrefix(result.toString()); hexNoPrefix = HexHelper.stripPrefix(result.toString()); } - } catch { } + } catch {} } if (!isBech32) { @@ -230,7 +229,7 @@ export class SearchQueryBuilder { hexNoPrefix, type: addressType, typeLabel: this.typeLabel(addressType), - isBech32 + isBech32, }; } @@ -258,4 +257,3 @@ export class SearchQueryBuilder { return did.slice(Math.max(0, did.lastIndexOf(":") + 3)); } } - diff --git a/api/src/utils/stardust/stardustTangleHelper.ts b/api/src/utils/stardust/stardustTangleHelper.ts index 614fc8572..3d0b22dba 100644 --- a/api/src/utils/stardust/stardustTangleHelper.ts +++ b/api/src/utils/stardust/stardustTangleHelper.ts @@ -1,8 +1,18 @@ /* eslint-disable no-warning-comments */ import { __ClientMethods__, - OutputResponse, Client, IBlockMetadata, MilestonePayload, IOutputsResponse, - HexEncodedString, Block, Utils, QueryParameter, NftQueryParameter, AliasQueryParameter, FoundryQueryParameter + OutputResponse, + Client, + IBlockMetadata, + MilestonePayload, + IOutputsResponse, + HexEncodedString, + Block, + Utils, + QueryParameter, + NftQueryParameter, + AliasQueryParameter, + FoundryQueryParameter, } from "@iota/sdk"; import { SearchExecutor } from "./searchExecutor"; import { SearchQueryBuilder, SearchQuery } from "./searchQueryBuilder"; @@ -44,9 +54,7 @@ export class StardustTangleHelper { * @param addressBech32 The address to get the details for in bech32 format. * @returns The address details. */ - public static async addressDetails( - network: INetwork, addressBech32: string - ): Promise { + public static async addressDetails(network: INetwork, addressBech32: string): Promise { const { bechHrp } = network; const client = ServiceFactory.get(`client-${network.network}`); const searchQuery: SearchQuery = new SearchQueryBuilder(addressBech32, bechHrp).build(); @@ -64,12 +72,12 @@ export class StardustTangleHelper { ...addressBalanceDetails, hex: searchQuery.address.hex, bech32: searchQuery.address.bech32, - type: searchQuery.address.type + type: searchQuery.address.type, }; return addressDetails; } - } catch { } + } catch {} } /** @@ -80,11 +88,7 @@ export class StardustTangleHelper { */ public static async block(network: INetwork, blockId: string): Promise { blockId = HexHelper.addPrefix(blockId); - const block = await this.tryFetchNodeThenPermanode( - blockId, - "getBlock", - network - ); + const block = await this.tryFetchNodeThenPermanode(blockId, "getBlock", network); if (!block) { return { error: `Couldn't find block with id ${blockId}` }; @@ -93,7 +97,7 @@ export class StardustTangleHelper { try { if (block && Object.keys(block).length > 0) { return { - block + block, }; } } catch (e) { @@ -110,15 +114,11 @@ export class StardustTangleHelper { */ public static async blockDetails(network: INetwork, blockId: string): Promise { blockId = HexHelper.addPrefix(blockId); - const metadata = await this.tryFetchNodeThenPermanode( - blockId, - "getBlockMetadata", - network - ); + const metadata = await this.tryFetchNodeThenPermanode(blockId, "getBlockMetadata", network); if (metadata) { return { - metadata + metadata, }; } } @@ -129,16 +129,9 @@ export class StardustTangleHelper { * @param transactionId The transaction id to get the details. * @returns The item details. */ - public static async transactionIncludedBlock( - network: INetwork, - transactionId: string - ): Promise { + public static async transactionIncludedBlock(network: INetwork, transactionId: string): Promise { transactionId = HexHelper.addPrefix(transactionId); - const block = await this.tryFetchNodeThenPermanode( - transactionId, - "getIncludedBlock", - network - ); + const block = await this.tryFetchNodeThenPermanode(transactionId, "getIncludedBlock", network); if (!block) { return { error: `Couldn't find block from transaction id ${transactionId}` }; @@ -147,7 +140,7 @@ export class StardustTangleHelper { try { if (block && Object.keys(block).length > 0) { return { - block + block, }; } } catch (e) { @@ -162,15 +155,9 @@ export class StardustTangleHelper { * @returns The item details. */ public static async outputDetails(network: INetwork, outputId: string): Promise { - const outputResponse = await this.tryFetchNodeThenPermanode( - outputId, - "getOutput", - network - ); + const outputResponse = await this.tryFetchNodeThenPermanode(outputId, "getOutput", network); - return outputResponse ? - { output: outputResponse } : - { message: "Output not found" }; + return outputResponse ? { output: outputResponse } : { message: "Output not found" }; } /** @@ -188,14 +175,13 @@ export class StardustTangleHelper { promises.push(promise); } try { - await Promise.all(promises) - .then(results => { - for (const outputDetails of results) { - if (outputDetails.output?.output && outputDetails.output?.metadata) { - outputResponses.push(outputDetails.output); - } + await Promise.all(promises).then((results) => { + for (const outputDetails of results) { + if (outputDetails.output?.output && outputDetails.output?.metadata) { + outputResponses.push(outputDetails.output); } - }); + } + }); return outputResponses; } catch (e) { @@ -209,14 +195,8 @@ export class StardustTangleHelper { * @param milestoneId The milestone id to get the details. * @returns The milestone details. */ - public static async milestoneDetailsById( - network: INetwork, milestoneId: string - ): Promise { - const milestonePayload = await this.tryFetchNodeThenPermanode( - milestoneId, - "getMilestoneById", - network - ); + public static async milestoneDetailsById(network: INetwork, milestoneId: string): Promise { + const milestonePayload = await this.tryFetchNodeThenPermanode(milestoneId, "getMilestoneById", network); if (milestonePayload) { const nodeInfoService = ServiceFactory.get(`node-info-${network.network}`); @@ -226,7 +206,7 @@ export class StardustTangleHelper { return { blockId, milestoneId, - milestone: milestonePayload + milestone: milestonePayload, }; } } @@ -237,13 +217,11 @@ export class StardustTangleHelper { * @param milestoneIndex The milestone index to get the details. * @returns The milestone details. */ - public static async milestoneDetailsByIndex( - network: INetwork, milestoneIndex: number - ): Promise { + public static async milestoneDetailsByIndex(network: INetwork, milestoneIndex: number): Promise { const milestonePayload = await this.tryFetchNodeThenPermanode( milestoneIndex, "getMilestoneByIndex", - network + network, ); if (milestonePayload) { @@ -256,7 +234,7 @@ export class StardustTangleHelper { return { blockId, milestoneId, - milestone: milestonePayload + milestone: milestonePayload, }; } } @@ -267,9 +245,7 @@ export class StardustTangleHelper { * @param addressBech32 The address in bech32 format. * @returns The basic output details. */ - public static async basicOutputDetailsByAddress( - network: INetwork, addressBech32: string - ): Promise { + public static async basicOutputDetailsByAddress(network: INetwork, addressBech32: string): Promise { let cursor: string | undefined; let outputIds: string[] = []; @@ -277,7 +253,7 @@ export class StardustTangleHelper { const outputIdsResponse = await this.tryFetchNodeThenPermanode( [{ address: addressBech32 }, { cursor: cursor ?? "" }], "basicOutputIds", - network + network, ); outputIds = outputIds.concat(outputIdsResponse.items); @@ -287,7 +263,7 @@ export class StardustTangleHelper { const outputResponses = await this.outputsDetails(network, outputIds); return { - outputs: outputResponses + outputs: outputResponses, }; } @@ -297,9 +273,7 @@ export class StardustTangleHelper { * @param addressBech32 The address in bech32 format. * @returns The alias output details. */ - public static async aliasOutputDetailsByAddress( - network: INetwork, addressBech32: string - ): Promise { + public static async aliasOutputDetailsByAddress(network: INetwork, addressBech32: string): Promise { let cursor: string | undefined; let outputIds: string[] = []; @@ -307,7 +281,7 @@ export class StardustTangleHelper { const outputIdsResponse = await this.tryFetchNodeThenPermanode( [{ stateController: addressBech32 }, { cursor: cursor ?? "" }], "aliasOutputIds", - network + network, ); outputIds = outputIds.concat(outputIdsResponse.items); @@ -317,7 +291,7 @@ export class StardustTangleHelper { const outputResponses = await this.outputsDetails(network, outputIds); return { - outputs: outputResponses + outputs: outputResponses, }; } @@ -327,9 +301,7 @@ export class StardustTangleHelper { * @param addressBech32 The address in bech32 format. * @returns The alias output details. */ - public static async nftOutputDetailsByAddress( - network: INetwork, addressBech32: string - ): Promise { + public static async nftOutputDetailsByAddress(network: INetwork, addressBech32: string): Promise { let cursor: string | undefined; let outputIds: string[] = []; @@ -337,7 +309,7 @@ export class StardustTangleHelper { const outputIdsResponse = await this.tryFetchNodeThenPermanode( [{ address: addressBech32 }, { cursor: cursor ?? "" }], "nftOutputIds", - network + network, ); outputIds = outputIds.concat(outputIdsResponse.items); @@ -346,7 +318,7 @@ export class StardustTangleHelper { const outputResponses = await this.outputsDetails(network, outputIds); return { - outputs: outputResponses + outputs: outputResponses, }; } @@ -356,22 +328,13 @@ export class StardustTangleHelper { * @param aliasId The aliasId to get the details for. * @returns The alias details. */ - public static async aliasDetails( - network: INetwork, - aliasId: string - ): Promise { - const aliasOutputId = await this.tryFetchNodeThenPermanode( - aliasId, - "aliasOutputId", - network - ); + public static async aliasDetails(network: INetwork, aliasId: string): Promise { + const aliasOutputId = await this.tryFetchNodeThenPermanode(aliasId, "aliasOutputId", network); if (aliasOutputId) { const outputResponse = await this.outputDetails(network, aliasOutputId); - return outputResponse.error ? - { error: outputResponse.error } : - { aliasDetails: outputResponse.output }; + return outputResponse.error ? { error: outputResponse.error } : { aliasDetails: outputResponse.output }; } return { message: "Alias output not found" }; @@ -383,25 +346,22 @@ export class StardustTangleHelper { * @param aliasAddress The alias address to get the controlled Foundries for. * @returns The foundry outputs. */ - public static async aliasFoundries( - network: INetwork, - aliasAddress: string - ): Promise { + public static async aliasFoundries(network: INetwork, aliasAddress: string): Promise { try { const response = await this.tryFetchNodeThenPermanode( [{ aliasAddress }], "foundryOutputIds", - network + network, ); if (response) { return { - foundryOutputsResponse: response + foundryOutputsResponse: response, }; } return { message: "Foundries output not found" }; - } catch { } + } catch {} } /** @@ -410,22 +370,13 @@ export class StardustTangleHelper { * @param foundryId The foundryId to get the details for. * @returns The foundry details. */ - public static async foundryDetails( - network: INetwork, - foundryId: string - ): Promise { - const foundryOutputId = await this.tryFetchNodeThenPermanode( - foundryId, - "foundryOutputId", - network - ); + public static async foundryDetails(network: INetwork, foundryId: string): Promise { + const foundryOutputId = await this.tryFetchNodeThenPermanode(foundryId, "foundryOutputId", network); if (foundryOutputId) { const outputResponse = await this.outputDetails(network, foundryOutputId); - return outputResponse.error ? - { error: outputResponse.error } : - { foundryDetails: outputResponse.output }; + return outputResponse.error ? { error: outputResponse.error } : { foundryDetails: outputResponse.output }; } return { message: "Foundry output not found" }; @@ -437,27 +388,18 @@ export class StardustTangleHelper { * @param nftId The nftId to get the details for. * @returns The nft details. */ - public static async nftDetails( - network: INetwork, - nftId: string - ): Promise { + public static async nftDetails(network: INetwork, nftId: string): Promise { try { - const nftOutputId = await this.tryFetchNodeThenPermanode( - nftId, - "nftOutputId", - network - ); + const nftOutputId = await this.tryFetchNodeThenPermanode(nftId, "nftOutputId", network); if (nftOutputId) { const outputResponse = await this.outputDetails(network, nftOutputId); - return outputResponse.error ? - { error: outputResponse.error } : - { nftDetails: outputResponse.output }; + return outputResponse.error ? { error: outputResponse.error } : { nftDetails: outputResponse.output }; } return { message: "Nft output not found" }; - } catch { } + } catch {} } /** @@ -472,23 +414,20 @@ export class StardustTangleHelper { network: INetwork, encodedTag: HexEncodedString, pageSize: number, - cursor?: string + cursor?: string, ): Promise { try { const params: NftQueryParameter[] = [{ tag: encodedTag }, { pageSize }, { cursor: cursor ?? "" }]; - const basicOutputIdsResponse: IOutputsResponse = await this.tryFetchNodeThenPermanode< - QueryParameter[], - IOutputsResponse - >( + const basicOutputIdsResponse: IOutputsResponse = await this.tryFetchNodeThenPermanode( params, "basicOutputIds", - network + network, ); if (basicOutputIdsResponse?.items.length > 0) { return { outputs: basicOutputIdsResponse }; } - } catch { } + } catch {} return { error: `Basic outputs not found with given tag ${encodedTag}` }; } @@ -505,23 +444,20 @@ export class StardustTangleHelper { network: INetwork, encodedTag: HexEncodedString, pageSize: number, - cursor?: string + cursor?: string, ): Promise { try { const params: NftQueryParameter[] = [{ tag: encodedTag }, { pageSize }, { cursor: cursor ?? "" }]; - const nftOutputIdsResponse: IOutputsResponse = await this.tryFetchNodeThenPermanode< - NftQueryParameter[], - IOutputsResponse - >( + const nftOutputIdsResponse: IOutputsResponse = await this.tryFetchNodeThenPermanode( params, "nftOutputIds", - network + network, ); if (nftOutputIdsResponse?.items.length > 0) { return { outputs: nftOutputIdsResponse }; } - } catch { } + } catch {} return { error: `Nft outputs not found with given tag ${encodedTag}` }; } @@ -532,16 +468,13 @@ export class StardustTangleHelper { * @param tag The tag hex. * @returns . */ - public static async taggedOutputs( - network: INetwork, - tag: HexEncodedString - ): Promise { + public static async taggedOutputs(network: INetwork, tag: HexEncodedString): Promise { const basicOutputs = await this.taggedBasicOutputs(network, tag, 10); const nftOutputs = await this.taggedNftOutputs(network, tag, 10); return { basicOutputs, - nftOutputs + nftOutputs, }; } @@ -551,28 +484,16 @@ export class StardustTangleHelper { * @param eventId The id of the event. * @returns The participation event details. */ - public static async participationEventDetails( - network: INetwork, eventId: string - ): Promise { + public static async participationEventDetails(network: INetwork, eventId: string): Promise { const basePluginPath: string = "api/participation/v1/"; const method = "GET"; const methodPath: string = `events/${eventId}`; - const info = await this.nodePluginFetch( - network, - basePluginPath, - method, - methodPath - ); - const status = await this.nodePluginFetch( - network, - basePluginPath, - method, - `${methodPath}/status` - ); + const info = await this.nodePluginFetch(network, basePluginPath, method, methodPath); + const status = await this.nodePluginFetch(network, basePluginPath, method, `${methodPath}/status`); return { info, - status + status, }; } @@ -582,14 +503,8 @@ export class StardustTangleHelper { * @param query The query to use for finding items. * @returns The item found. */ - public static async search( - network: INetwork, - query: string - ): Promise { - return new SearchExecutor( - network, - new SearchQueryBuilder(query, network.bechHrp).build() - ).run(); + public static async search(network: INetwork, query: string): Promise { + return new SearchExecutor(network, new SearchQueryBuilder(query, network.bechHrp).build()).run(); } /** @@ -600,11 +515,7 @@ export class StardustTangleHelper { * @param network The network config in context. * @returns The results or null if call(s) failed. */ - public static async tryFetchNodeThenPermanode( - args: A, - methodName: ExtractedMethodNames, - network: INetwork - ): Promise | null { + public static async tryFetchNodeThenPermanode(args: A, methodName: ExtractedMethodNames, network: INetwork): Promise | null { const { permaNodeEndpoint, disableApiFallback } = network; const isFallbackEnabled = !disableApiFallback; const client = ServiceFactory.get(`client-${network.network}`); @@ -613,7 +524,7 @@ export class StardustTangleHelper { // try fetch from node const result: Promise = client[methodName](args); return await result; - } catch { } + } catch {} if (permaNodeEndpoint && isFallbackEnabled) { const permanodeClient = ServiceFactory.get(`permanode-client-${network.network}`); @@ -621,7 +532,7 @@ export class StardustTangleHelper { // try fetch from permanode (chronicle) const result: Promise = permanodeClient[methodName](args); return await result; - } catch { } + } catch {} } return null; @@ -643,21 +554,15 @@ export class StardustTangleHelper { method: "GET" | "POST", methodPath: string, queryParams?: string[], - request?: string + request?: string, ): Promise | null { const client = ServiceFactory.get(`client-${network.network}`); try { - const response: S = await client.callPluginRoute( - basePluginPath, - method, - methodPath, - queryParams, - request - ) as S; + const response: S = (await client.callPluginRoute(basePluginPath, method, methodPath, queryParams, request)) as S; return response; - } catch { } + } catch {} return null; } diff --git a/api/src/utils/stardust/utils.ts b/api/src/utils/stardust/utils.ts index 40638a6f7..c79a594a4 100644 --- a/api/src/utils/stardust/utils.ts +++ b/api/src/utils/stardust/utils.ts @@ -25,7 +25,7 @@ export function blockIdFromMilestonePayload(protocolVersion: number, payload: Mi */ export async function addressBalance( client: Client, - address: string + address: string, ): Promise<{ balance: BigInteger; nativeTokens: { [id: string]: BigInteger }; @@ -65,7 +65,7 @@ export async function addressBalance( expirationResponse = await client.basicOutputIds([ { expirationReturnAddress: address }, { expiresBefore: Math.floor(Date.now() / 1000) }, - { cursor: expirationCursor } + { cursor: expirationCursor }, ]); for (const outputId of expirationResponse.items) { @@ -81,7 +81,6 @@ export async function addressBalance( return { balance: total, nativeTokens, - ledgerIndex + ledgerIndex, }; } - diff --git a/api/src/utils/validationHelper.ts b/api/src/utils/validationHelper.ts index 56d75f9ea..53bd126d4 100644 --- a/api/src/utils/validationHelper.ts +++ b/api/src/utils/validationHelper.ts @@ -19,7 +19,7 @@ export class ValidationHelper { * @param name The parameter name. */ public static numberFromString(str: string, name: string): void { - if (str === undefined || str === null || str.trim().length === 0 || !(/^-?\d+$/.test(str.trim()))) { + if (str === undefined || str === null || str.trim().length === 0 || !/^-?\d+$/.test(str.trim())) { throw new Error(`The parameter '${name}' has an invalid value.`); } } diff --git a/client/.prettierignore b/client/.prettierignore new file mode 100644 index 000000000..f5831d37a --- /dev/null +++ b/client/.prettierignore @@ -0,0 +1,11 @@ +.eslintrc.yaml +.eslintcache + +*.d.ts + +dist/** +node_modules/** +public/env.js +build/** + +tsconfig.json diff --git a/client/.prettierrc b/client/.prettierrc new file mode 100644 index 000000000..a025b47fd --- /dev/null +++ b/client/.prettierrc @@ -0,0 +1,14 @@ +{ + "arrowParens": "always", + "bracketSameLine": false, + "bracketSpacing": true, + "semi": true, + "experimentalTernaries": false, + "singleQuote": false, + "trailingComma": "all", + "htmlWhitespaceSensitivity": "css", + "proseWrap": "preserve", + "printWidth": 140, + "tabWidth": 4, + "useTabs": false +} diff --git a/client/.stylelintrc.json b/client/.stylelintrc.json index 71f1aa025..8625f9c1f 100644 --- a/client/.stylelintrc.json +++ b/client/.stylelintrc.json @@ -18,6 +18,9 @@ "selector-no-qualifying-type": null, "selector-class-pattern": [ "^([a-z][a-z0-9]*)([-|_]{0,2}[a-z0-9]+)*$" - ] + ], + "indentation": 4, + "max-line-length": 140, + "string-quotes": "double" } } diff --git a/client/package-lock.json b/client/package-lock.json index f49563495..63f013734 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -71,12 +71,15 @@ "class-transformer": "^0.5.1", "copyfiles": "^2.4.1", "eslint": "^8.1.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsdoc": "^39.3.6", "eslint-plugin-react": "^7.31.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-unicorn": "^49.0.0", + "lint-staged": "^14.0.1", "npm-run-all": "^4.1.5", + "prettier": "^3.1.1", "sass": "^1.54.6", "stylelint": "^14.11.0", "stylelint-config-property-sort-order-smacss": "^9.0.0", @@ -2502,6 +2505,21 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dev": true, + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -3349,6 +3367,121 @@ "node": ">=4" } }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -3379,6 +3512,12 @@ "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3390,6 +3529,15 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, "node_modules/comment-json": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.2.3.tgz", @@ -4096,6 +4244,12 @@ "tslib": "^2.0.3" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -4128,6 +4282,12 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, "node_modules/emotion": { "version": "10.0.27", "resolved": "https://registry.npmjs.org/emotion/-/emotion-10.0.27.tgz", @@ -4422,6 +4582,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -4999,6 +5171,12 @@ "node": ">= 0.6" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -5018,6 +5196,29 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, "node_modules/expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", @@ -5381,6 +5582,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", @@ -5739,6 +5952,15 @@ "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", "dev": true }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6203,6 +6425,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -6817,11 +7051,178 @@ "node": ">= 0.8.0" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/lint-staged": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-14.0.1.tgz", + "integrity": "sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==", + "dev": true, + "dependencies": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/lint-staged/node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/listr2": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", + "dev": true, + "dependencies": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -6898,6 +7299,126 @@ "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true }, + "node_modules/log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "dev": true, + "dependencies": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -7106,6 +7627,12 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -7185,6 +7712,18 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -7669,6 +8208,33 @@ "which": "bin/which" } }, + "node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -7821,6 +8387,21 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -8207,7 +8788,22 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "engines": { - "node": ">= 0.8.0" + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, "node_modules/pretty-format": { @@ -8845,6 +9441,46 @@ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -8855,6 +9491,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -9419,6 +10061,15 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -9533,6 +10184,18 @@ "node": ">=8" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", @@ -10155,6 +10818,18 @@ "node": ">=4" } }, + "node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -12976,6 +13651,15 @@ "uri-js": "^4.2.2" } }, + "ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dev": true, + "requires": { + "type-fest": "^1.0.2" + } + }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -13619,6 +14303,75 @@ "escape-string-regexp": "^1.0.5" } }, + "cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "requires": { + "restore-cursor": "^4.0.0" + } + }, + "cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "requires": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true + }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + } + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -13649,6 +14402,12 @@ "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -13657,6 +14416,12 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "dev": true + }, "comment-json": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.2.3.tgz", @@ -14197,6 +14962,12 @@ "tslib": "^2.0.3" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -14231,6 +15002,12 @@ } } }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, "emotion": { "version": "10.0.27", "resolved": "https://registry.npmjs.org/emotion/-/emotion-10.0.27.tgz", @@ -14552,6 +15329,13 @@ } } }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "requires": {} + }, "eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -14892,6 +15676,12 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" }, + "eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, "events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -14908,6 +15698,23 @@ "safe-buffer": "^5.1.1" } }, + "execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, "expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", @@ -15201,6 +16008,12 @@ "hasown": "^2.0.0" } }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, "get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", @@ -15473,6 +16286,12 @@ "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", "dev": true }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -15782,6 +16601,12 @@ "call-bind": "^1.0.2" } }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true + }, "is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -16245,11 +17070,114 @@ "type-check": "~0.4.0" } }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "lint-staged": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-14.0.1.tgz", + "integrity": "sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==", + "dev": true, + "requires": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" + }, + "dependencies": { + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true + }, + "pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true + }, + "yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true + } + } + }, + "listr2": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", + "dev": true, + "requires": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -16307,6 +17235,80 @@ "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true }, + "log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "dev": true, + "requires": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true + }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + } + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + } + } + } + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -16468,6 +17470,12 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -16525,6 +17533,12 @@ "mime-db": "1.52.0" } }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, "min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -16931,6 +17945,23 @@ } } }, + "npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -17041,6 +18072,15 @@ "wrappy": "1" } }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, "optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -17308,6 +18348,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true + }, "pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -17798,12 +18844,45 @@ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" }, + "restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "dependencies": { + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + } + } + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -18251,6 +19330,12 @@ "safe-buffer": "~5.2.0" } }, + "string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -18340,6 +19425,12 @@ "ansi-regex": "^5.0.1" } }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", @@ -18847,6 +19938,12 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", diff --git a/client/package.json b/client/package.json index 58891f12f..72902e6fb 100644 --- a/client/package.json +++ b/client/package.json @@ -13,10 +13,12 @@ "postinstall": "./script/postinstall.sh", "start": "vite", "preview": "vite preview", - "lint": "eslint src --ext .tsx,.ts", + "format": "prettier --ignore-path=.prettierignore --write src && eslint src --ext .tsx,.ts --fix", + "lint:check": "eslint src --ext .tsx,.ts", + "format:check": "prettier --ignore-path=.prettierignore --check src", "sass-lint": "stylelint ./src/**/*.scss", "build-internal": "tsc && vite build", - "build": "run-s lint sass-lint build-internal", + "build": "run-s lint:check sass-lint build-internal", "test": "vitest" }, "dependencies": { @@ -81,12 +83,15 @@ "class-transformer": "^0.5.1", "copyfiles": "^2.4.1", "eslint": "^8.1.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsdoc": "^39.3.6", "eslint-plugin-react": "^7.31.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-unicorn": "^49.0.0", + "lint-staged": "^14.0.1", "npm-run-all": "^4.1.5", + "prettier": "^3.1.1", "sass": "^1.54.6", "stylelint": "^14.11.0", "stylelint-config-property-sort-order-smacss": "^9.0.0", @@ -107,5 +112,9 @@ "not dead", "not ie <= 11", "not op_mini all" - ] + ], + "lint-staged": { + "src/**/*.{ts,js,tsx,jsx}": "eslint --cache --fix", + "src/**/*.{ts,js,scss,css}": "prettier --ignore-path=.prettierignore --write" + } } diff --git a/client/src/app/App.scss b/client/src/app/App.scss index 4a9518204..e98b59071 100644 --- a/client/src/app/App.scss +++ b/client/src/app/App.scss @@ -1,36 +1,36 @@ -@import '../scss/fonts'; -@import '../scss/media-queries'; -@import '../scss/mixins'; -@import '../scss/variables'; +@import "../scss/fonts"; +@import "../scss/media-queries"; +@import "../scss/mixins"; +@import "../scss/variables"; .app { - -webkit-tap-highlight-color: rgb(255 255 255 / 0%); - display: flex; - flex: 1; - flex-direction: column; - - .content { - margin-top: $navbar-height-desktop; - min-height: 300px; - position: relative; + -webkit-tap-highlight-color: rgb(255 255 255 / 0%); + display: flex; flex: 1; + flex-direction: column; - @include desktop-down { - margin-top: calc(2 * #{$navbar-height-mobile}); + .content { + margin-top: $navbar-height-desktop; + min-height: 300px; + position: relative; + flex: 1; + + @include desktop-down { + margin-top: calc(2 * #{$navbar-height-mobile}); + } } - } - .maintenance { - display: flex; - justify-content: center; - margin: 100px 0; + .maintenance { + display: flex; + justify-content: center; + margin: 100px 0; - .maintenance-inner { - @include font-size(18px); + .maintenance-inner { + @include font-size(18px); - max-width: $desktop-width; - color: var(--body-color); - font-family: $metropolis; + max-width: $desktop-width; + color: var(--body-color); + font-family: $metropolis; + } } - } } diff --git a/client/src/app/App.tsx b/client/src/app/App.tsx index d72336ffd..7e543fc55 100644 --- a/client/src/app/App.tsx +++ b/client/src/app/App.tsx @@ -3,10 +3,7 @@ import React, { useEffect, useState } from "react"; import { Helmet } from "react-helmet"; import { RouteComponentProps } from "react-router-dom"; import { AppRouteProps } from "./AppRouteProps"; -import { - buildMetaLabel, buildUtilities, getFooterItems, - getPages, getFaviconHelmet, networkContextWrapper -} from "./AppUtils"; +import { buildMetaLabel, buildUtilities, getFooterItems, getPages, getFaviconHelmet, networkContextWrapper } from "./AppUtils"; import Disclaimer from "./components/Disclaimer"; import Footer from "./components/footer/Footer"; import ShimmerFooter from "./components/footer/ShimmerFooter"; @@ -23,9 +20,12 @@ import { NetworkService } from "~services/networkService"; import { NodeInfoService } from "~services/nodeInfoService"; import "./App.scss"; -const App: React.FC> = ( - { history, match: { params: { network, action } } } -) => { +const App: React.FC> = ({ + history, + match: { + params: { network, action }, + }, +}) => { const [networks, setNetworks] = useState([]); const [networksLoaded, setNetworksLoaded] = useState(false); @@ -44,7 +44,7 @@ const App: React.FC> = ( } }, [networksLoaded]); - const networkConfig = networks.find(n => n.network === network); + const networkConfig = networks.find((n) => n.network === network); const identityResolverEnabled = networkConfig?.identityResolverEnabled ?? true; const currentNetworkName = networkConfig?.network; const isShimmer = isShimmerUiTheme(networkConfig?.uiTheme); @@ -60,16 +60,13 @@ const App: React.FC> = ( body?.classList.remove("shimmer"); } - const routes = buildAppRoutes( - networkConfig?.protocolVersion ?? "", - withNetworkContext - ); + const routes = buildAppRoutes(networkConfig?.protocolVersion ?? "", withNetworkContext); const metaLabel = buildMetaLabel(currentNetworkName); const faviconHelmet = getFaviconHelmet(isShimmer); return ( -
+
@@ -85,7 +82,7 @@ const App: React.FC> = ( history={history} search={ history.push(`/${currentNetworkName}/search/${query}`)} + onSearch={(query) => history.push(`/${currentNetworkName}/search/${query}`)} protocolVersion={networkConfig?.protocolVersion ?? STARDUST} /> } @@ -93,23 +90,20 @@ const App: React.FC> = ( utilities={buildUtilities(network ?? "", networks, identityResolverEnabled)} />
- {networks.length > 0 ? + {networks.length > 0 ? ( {!networkConfig && (
-
- The network provided does not exist, please check the url. -
+
The network provided does not exist, please check the url.
)} {networkConfig && routes} -
: ( -
-
- Explorer is currently undergoing maintenance, please check back later. -
-
- )} + + ) : ( +
+
Explorer is currently undergoing maintenance, please check back later.
+
+ )}
{isShimmer ? ( @@ -122,4 +116,3 @@ const App: React.FC> = ( }; export default App; - diff --git a/client/src/app/AppUtils.tsx b/client/src/app/AppUtils.tsx index 08baa7403..b75c349ee 100644 --- a/client/src/app/AppUtils.tsx +++ b/client/src/app/AppUtils.tsx @@ -6,25 +6,23 @@ import { ALPHANET, CHRYSALIS_MAINNET, DEVNET, LEGACY_MAINNET, MAINNET, NetworkTy import { IOTA_UI, Theme } from "~models/config/uiTheme"; import { IReducedNodeInfo } from "~services/nodeInfoService"; -export const networkContextWrapper = ( - currentNetwork: string | undefined, - nodeInfo: IReducedNodeInfo | null, - uiTheme: Theme | undefined -) => function withNetworkContext(wrappedComponent: ReactNode) { - return currentNetwork && nodeInfo ? ( - - {wrappedComponent} - - ) : null; -}; +export const networkContextWrapper = (currentNetwork: string | undefined, nodeInfo: IReducedNodeInfo | null, uiTheme: Theme | undefined) => + function withNetworkContext(wrappedComponent: ReactNode) { + return currentNetwork && nodeInfo ? ( + + {wrappedComponent} + + ) : null; + }; export const getPages = (currentNetwork: INetwork | undefined, networks: INetwork[]) => { const pages = []; @@ -42,11 +40,7 @@ export const getPages = (currentNetwork: INetwork | undefined, networks: INetwor return pages; }; -export const buildUtilities = ( - currentNetwork: string, - networks: INetwork[], - identityResolverEnabled: boolean -) => { +export const buildUtilities = (currentNetwork: string, networks: INetwork[], identityResolverEnabled: boolean) => { const utilities = []; if (networks.length > 0 && currentNetwork !== CHRYSALIS_MAINNET) { utilities.push({ label: "Streams v0", url: `/${currentNetwork}/streams/0/` }); @@ -67,11 +61,11 @@ export const buildUtilities = ( */ export const getFooterItems = (currentNetwork: string, networks: INetwork[], identityResolverEnabled: boolean) => { if (networks.length > 0) { - let footerArray = networks.filter(network => network.isEnabled) - .map(n => ({ label: n.label, url: n.network.toString() })); + let footerArray = networks.filter((network) => network.isEnabled).map((n) => ({ label: n.label, url: n.network.toString() })); if (currentNetwork !== CHRYSALIS_MAINNET) { - footerArray = footerArray.concat({ label: "Streams v0", url: `${currentNetwork}/streams/0/` }) + footerArray = footerArray + .concat({ label: "Streams v0", url: `${currentNetwork}/streams/0/` }) .concat({ label: "Visualizer", url: `${currentNetwork}/visualizer/` }); } @@ -119,30 +113,11 @@ export const getFaviconHelmet = (isShimmer: boolean) => { return ( - - - - - + + + + + ); }; - diff --git a/client/src/app/components/AsyncComponent.tsx b/client/src/app/components/AsyncComponent.tsx index 3658a3763..b269dcf6c 100644 --- a/client/src/app/components/AsyncComponent.tsx +++ b/client/src/app/components/AsyncComponent.tsx @@ -29,8 +29,8 @@ class AsyncComponent extends Component { * @param callback The callback for the setState. */ public setState( - state: ((prevState: Readonly, props: Readonly

) => (Pick | S | null)) | (Pick | S | null), - callback?: () => void + state: ((prevState: Readonly, props: Readonly

) => Pick | S | null) | (Pick | S | null), + callback?: () => void, ): void { if (this._isMounted) { super.setState(state, callback); diff --git a/client/src/app/components/Confirmation.scss b/client/src/app/components/Confirmation.scss index 152cd8ced..2c457c2be 100644 --- a/client/src/app/components/Confirmation.scss +++ b/client/src/app/components/Confirmation.scss @@ -1,53 +1,53 @@ -@import '../../scss/fonts'; -@import '../../scss/mixins'; -@import '../../scss/variables'; -@import '../../scss/themes'; +@import "../../scss/fonts"; +@import "../../scss/mixins"; +@import "../../scss/variables"; +@import "../../scss/themes"; .confirmation { - @include font-size(12px); - - display: flex; - align-items: center; - height: 24px; - margin-left: 20px; - padding: 0 8px; - border: 0; - border-radius: 6px; - outline: none; - background-color: $gray-light; - color: $gray-midnight; - font-family: $metropolis; - font-weight: bold; - white-space: nowrap; - cursor: pointer; - - &.confirmation__confirmed { - background-color: #73b183; - color: $white; - } - - &.confirmation__referenced { - background-color: #73b183; - color: $white; - } - - &.confirmation__pending { - background-color: var(--light-bg); - color: #8493ad; - } - - &.confirmation__reattachment { - background-color: #4140df; - color: #978df2; - } - - &.confirmation__consistency { - background-color: $danger; - color: $white; - } - - &.confirmation__conflicting { - background-color: $danger; - color: $white; - } + @include font-size(12px); + + display: flex; + align-items: center; + height: 24px; + margin-left: 20px; + padding: 0 8px; + border: 0; + border-radius: 6px; + outline: none; + background-color: $gray-light; + color: $gray-midnight; + font-family: $metropolis; + font-weight: bold; + white-space: nowrap; + cursor: pointer; + + &.confirmation__confirmed { + background-color: #73b183; + color: $white; + } + + &.confirmation__referenced { + background-color: #73b183; + color: $white; + } + + &.confirmation__pending { + background-color: var(--light-bg); + color: #8493ad; + } + + &.confirmation__reattachment { + background-color: #4140df; + color: #978df2; + } + + &.confirmation__consistency { + background-color: $danger; + color: $white; + } + + &.confirmation__conflicting { + background-color: $danger; + color: $white; + } } diff --git a/client/src/app/components/Confirmation.tsx b/client/src/app/components/Confirmation.tsx index 8bbdb6962..bb5080443 100644 --- a/client/src/app/components/Confirmation.tsx +++ b/client/src/app/components/Confirmation.tsx @@ -14,29 +14,33 @@ class Confirmation extends Component { public render(): ReactNode { return (

- {this.props.state === "unknown" && ("Unknown")} + {this.props.state === "unknown" && "Unknown"} {this.props.state === "confirmed" && - (`Confirmed${this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 - ? ` by MS ${this.props.milestoneIndex}` : ""}`)} - {this.props.state === "pending" && ("Pending")} - {this.props.state === "subtangle" && ("Subtangle not updated")} - {this.props.state === "reattachment" && ("Reattachment Confirmed")} - {this.props.state === "consistency" && ("Invalid Consistency")} + `Confirmed${ + this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 + ? ` by MS ${this.props.milestoneIndex}` + : "" + }`} + {this.props.state === "pending" && "Pending"} + {this.props.state === "subtangle" && "Subtangle not updated"} + {this.props.state === "reattachment" && "Reattachment Confirmed"} + {this.props.state === "consistency" && "Invalid Consistency"} {this.props.state === "conflicting" && - (`Conflicting${this.props.milestoneIndex !== undefined && this.props.milestoneIndex < 0 - ? ` at MS ${this.props.milestoneIndex}` : ""}`)} + `Conflicting${ + this.props.milestoneIndex !== undefined && this.props.milestoneIndex < 0 + ? ` at MS ${this.props.milestoneIndex}` + : "" + }`}
); } diff --git a/client/src/app/components/CopyButton.scss b/client/src/app/components/CopyButton.scss index 3f67b0711..c8b42204c 100644 --- a/client/src/app/components/CopyButton.scss +++ b/client/src/app/components/CopyButton.scss @@ -4,36 +4,36 @@ @import "../../scss/media-queries"; .copy-button { - .copy-button-btn { - border: 0; - outline: none; - padding: 0; - background: none; - cursor: pointer; + .copy-button-btn { + border: 0; + outline: none; + padding: 0; + background: none; + cursor: pointer; - span { - color: $gray-10!important; - font-size: 16px!important; - } + span { + color: $gray-10 !important; + font-size: 16px !important; + } - &:hover { - text-decoration: none!important; - span { - color: var(--link-highlight)!important; - } - } + &:hover { + text-decoration: none !important; + span { + color: var(--link-highlight) !important; + } + } - &:focus { - box-shadow: none; + &:focus { + box-shadow: none; + } } - } - .copy-button--message { - line-height: 0!important; + .copy-button--message { + line-height: 0 !important; - span { - color: $main-green!important; - font-size: 16px!important; + span { + color: $main-green !important; + font-size: 16px !important; + } } - } } diff --git a/client/src/app/components/CopyButton.tsx b/client/src/app/components/CopyButton.tsx index 469697a23..99f5bccaa 100644 --- a/client/src/app/components/CopyButton.tsx +++ b/client/src/app/components/CopyButton.tsx @@ -17,7 +17,7 @@ class CopyButton extends Component { super(props); this.state = { - active: false + active: false, }; } @@ -36,11 +36,9 @@ class CopyButton extends Component { )}
@@ -58,11 +56,9 @@ class CopyButton extends Component { } this.setState({ active: true }); - setTimeout( - () => { - this.setState({ active: false }); - }, - 2000); + setTimeout(() => { + this.setState({ active: false }); + }, 2000); } } diff --git a/client/src/app/components/Currency.tsx b/client/src/app/components/Currency.tsx index ab276c75d..dcf56ad04 100644 --- a/client/src/app/components/Currency.tsx +++ b/client/src/app/components/Currency.tsx @@ -52,11 +52,9 @@ abstract class Currency extends AsyncComponent const currency = this._currencyService.getSettingsFiatCode(); if (this._currencyData && currency) { this._currencyData.fiatCode = currency; - this.setState( - { currency }, - () => { - this.updateCurrency(); - }); + this.setState({ currency }, () => { + this.updateCurrency(); + }); } }); } @@ -82,11 +80,12 @@ abstract class Currency extends AsyncComponent this._currencyService.saveFiatCode(currency); this.setState( { - currency + currency, }, () => { this.updateCurrency(); - }); + }, + ); } } @@ -98,10 +97,7 @@ abstract class Currency extends AsyncComponent if (isAvailable && currencyData && this._isMounted) { this._currencyData = currencyData; - this.setState( - { currency: this._currencyData.fiatCode }, - () => this.updateCurrency() - ); + this.setState({ currency: this._currencyData.fiatCode }, () => this.updateCurrency()); } }); } diff --git a/client/src/app/components/CurrencyButton.scss b/client/src/app/components/CurrencyButton.scss index 1ff792e5b..462183ee4 100644 --- a/client/src/app/components/CurrencyButton.scss +++ b/client/src/app/components/CurrencyButton.scss @@ -1,100 +1,100 @@ -@import '../../scss/fonts'; -@import '../../scss/mixins'; -@import '../../scss/variables'; +@import "../../scss/fonts"; +@import "../../scss/mixins"; +@import "../../scss/variables"; .currency-button { - display: flex; - flex-direction: column; - height: 180px; - padding: 24px 21px; - border-radius: 6px; - background: linear-gradient(207.65deg, $gray-10, $gray-midnight); - - .currency-button--label { - @include font-size(12px); - - color: $main-green; - font-family: $metropolis; - font-weight: bold; - text-transform: uppercase; - } - - .currency-button--value { - @include font-size(28px); - - margin: 30px 0; - color: $white; - font-family: $metropolis; - font-weight: bold; - text-align: center; - } - - .currency-button--selector { display: flex; - align-items: center; - justify-content: space-between; - height: 40px; - padding: 4px 4px 4px 14px; + flex-direction: column; + height: 180px; + padding: 24px 21px; border-radius: 6px; - background-color: rgba($gray-midnight, 0.3); + background: linear-gradient(207.65deg, $gray-10, $gray-midnight); - .rate--label { - @include font-size(12px); + .currency-button--label { + @include font-size(12px); - margin-right: 10px; - color: $white; - font-family: $inter; - font-weight: bold; - white-space: nowrap; + color: $main-green; + font-family: $metropolis; + font-weight: bold; + text-transform: uppercase; } - .rate--value { - @include font-size(12px); - - margin-left: 5px; - color: var(--link-highlight); - font-family: $inter; - font-weight: normal; - text-decoration: none; + .currency-button--value { + @include font-size(28px); - &:hover { - text-decoration: underline; - } + margin: 30px 0; + color: $white; + font-family: $metropolis; + font-weight: bold; + text-align: center; } - .select-wrapper { - select { - border: 0; - background-color: rgba(0, 0, 0, 0.2); - color: $white; + .currency-button--selector { + display: flex; + align-items: center; + justify-content: space-between; + height: 40px; + padding: 4px 4px 4px 14px; + border-radius: 6px; + background-color: rgba($gray-midnight, 0.3); + + .rate--label { + @include font-size(12px); + + margin-right: 10px; + color: $white; + font-family: $inter; + font-weight: bold; + white-space: nowrap; + } + + .rate--value { + @include font-size(12px); + + margin-left: 5px; + color: var(--link-highlight); + font-family: $inter; + font-weight: normal; + text-decoration: none; - img { - padding-top: 5px; + &:hover { + text-decoration: underline; + } } - } - } - button { - @include font-size(12px); + .select-wrapper { + select { + border: 0; + background-color: rgba(0, 0, 0, 0.2); + color: $white; - width: 20px; - height: 20px; - border-bottom: 2px solid transparent; - border-radius: 0; - background: none; - color: $gray; - font-family: $inter; - cursor: pointer; + img { + padding-top: 5px; + } + } + } - &.selected { - border-bottom: 2px solid var(--link-highlight); - color: $white; - font-weight: bold; - } - } + button { + @include font-size(12px); + + width: 20px; + height: 20px; + border-bottom: 2px solid transparent; + border-radius: 0; + background: none; + color: $gray; + font-family: $inter; + cursor: pointer; + + &.selected { + border-bottom: 2px solid var(--link-highlight); + color: $white; + font-weight: bold; + } + } - button + button { - margin-left: 15px; + button + button { + margin-left: 15px; + } } - } } diff --git a/client/src/app/components/CurrencyButton.tsx b/client/src/app/components/CurrencyButton.tsx index 88607debf..5f2bc885d 100644 --- a/client/src/app/components/CurrencyButton.tsx +++ b/client/src/app/components/CurrencyButton.tsx @@ -19,7 +19,7 @@ class CurrencyButton extends Currency this.state = { currency: "USD", valueCurrency: "", - priceCurrency: "" + priceCurrency: "", }; } @@ -42,34 +42,24 @@ class CurrencyButton extends Currency return (
-
- Conversion -
-
- {this.state.valueCurrency} -
+
Conversion
+
{this.state.valueCurrency}
Rate - + {this.state.priceCurrency}
- this.setCurrency(e.target.value)}> + {supportedFiatCurrencies.map((cur) => ( + ))} - - expand_more - + expand_more
@@ -82,20 +72,10 @@ class CurrencyButton extends Currency protected updateCurrency(): void { if (this._currencyData) { this.setState({ - valueCurrency: - this._currencyService.convertIota( - this.props.value, - this._currencyData, - true, - 2), - priceCurrency: this._currencyData.coinStats?.iota?.price ? - this._currencyService.convertFiatBase( - this._currencyData.coinStats.iota.price, - this._currencyData, - true, - 3, - 8) - : "--" + valueCurrency: this._currencyService.convertIota(this.props.value, this._currencyData, true, 2), + priceCurrency: this._currencyData.coinStats?.iota?.price + ? this._currencyService.convertFiatBase(this._currencyData.coinStats.iota.price, this._currencyData, true, 3, 8) + : "--", }); } } diff --git a/client/src/app/components/DataToggle.scss b/client/src/app/components/DataToggle.scss index a6ce8aff0..9df307f8d 100644 --- a/client/src/app/components/DataToggle.scss +++ b/client/src/app/components/DataToggle.scss @@ -5,56 +5,56 @@ @import "../../scss/themes"; .data-toggle { - @include font-size(14px, 21px); - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; - min-height: 56px; - padding: 16px; - border-radius: 6px; - background-color: var(--light-bg); - color: var(--body-color); - font-family: $inter; - white-space: pre-wrap; - - @include phone-down { - display: block; - flex-wrap: wrap; - } - - .data-toggle--content { - word-break: break-word; - - .json-viewer { - max-height: 1000px; - overflow-y: auto; - } - } - - .data-toggle--tabs { + @include font-size(14px, 21px); + width: 100%; display: flex; - align-self: flex-start; - justify-content: flex-end; - margin-left: 16px; + align-items: center; + justify-content: space-between; + min-height: 56px; + padding: 16px; + border-radius: 6px; + background-color: var(--light-bg); + color: var(--body-color); + font-family: $inter; + white-space: pre-wrap; @include phone-down { - margin-top: 16px; + display: block; + flex-wrap: wrap; + } + + .data-toggle--content { + word-break: break-word; + + .json-viewer { + max-height: 1000px; + overflow-y: auto; + } } - .data-toggle--tab { - width: max-content; - margin: 0 2px; - padding: 2px 12px; - color: var(--type-color); - cursor: pointer; - - &.data-toggle--tab__active { - border-radius: 12px; - background: $gray-7; - color: $white; - font-weight: 700; - } + .data-toggle--tabs { + display: flex; + align-self: flex-start; + justify-content: flex-end; + margin-left: 16px; + + @include phone-down { + margin-top: 16px; + } + + .data-toggle--tab { + width: max-content; + margin: 0 2px; + padding: 2px 12px; + color: var(--type-color); + cursor: pointer; + + &.data-toggle--tab__active { + border-radius: 12px; + background: $gray-7; + color: $white; + font-weight: 700; + } + } } - } } diff --git a/client/src/app/components/DataToggle.tsx b/client/src/app/components/DataToggle.tsx index 0ecff8f4d..375b9aba1 100644 --- a/client/src/app/components/DataToggle.tsx +++ b/client/src/app/components/DataToggle.tsx @@ -22,9 +22,7 @@ interface DataToggleOption { content?: string; } -const DataToggle: React.FC = ( - { sourceData, link, withSpacedHex, isParticipationEventMetadata } -) => { +const DataToggle: React.FC = ({ sourceData, link, withSpacedHex, isParticipationEventMetadata }) => { const [options, setOptions] = useState([]); const [isJson, setIsJson] = useState(false); const [activeOption, setActiveOption] = useState(); @@ -41,14 +39,14 @@ const DataToggle: React.FC = ( utf8View = Converter.hexToUtf8(sourceData); try { jsonView = JSON.stringify(JSON.parse(utf8View), undefined, " "); - } catch { } + } catch {} } if (isParticipationEventMetadata) { const readStream = new ReadStream(Converter.hexToBytes(sourceData)); const participations = deserializeParticipationEventMetadata(readStream); try { jsonView = JSON.stringify(participations, undefined, " "); - } catch { } + } catch {} } if (hasSpacesBetweenBytes) { @@ -66,39 +64,41 @@ const DataToggle: React.FC = ( }, [sourceData]); useEffect(() => { - const option = options[activeTab]; - if (option) { - setIsJson(option.label === "JSON"); - setActiveOption(option); - } + const option = options[activeTab]; + if (option) { + setIsJson(option.label === "JSON"); + setActiveOption(option); + } }, [activeTab, options]); const content = activeOption?.content; return (
- {link ? - {content} : - (isJson ? -
: -
{content}
)} + {link ? ( + + {content} + + ) : isJson ? ( +
+ +
+ ) : ( +
{content}
+ )}
- {options.map((option, index) => ( + {options.map((option, index) => option.content ? (
setActiveTab(index)} > {option.label} -
) : null - ))} +
+ ) : null, + )}
- +
diff --git a/client/src/app/components/Disclaimer.scss b/client/src/app/components/Disclaimer.scss index 539fc9195..d3dc36c0d 100644 --- a/client/src/app/components/Disclaimer.scss +++ b/client/src/app/components/Disclaimer.scss @@ -4,32 +4,32 @@ @import "../../scss/media-queries"; .disclaimer { - @include font-size(12px); + @include font-size(12px); - display: flex; - position: fixed; - z-index: 1000; - right: 0; - bottom: 0; - left: 0; - flex-direction: row; - align-items: center; - justify-content: space-between; - padding: 20px; - border-top: 1px solid $gray-daylight; - background: $gray-midnight; - color: $white; - font-family: $metropolis; + display: flex; + position: fixed; + z-index: 1000; + right: 0; + bottom: 0; + left: 0; + flex-direction: row; + align-items: center; + justify-content: space-between; + padding: 20px; + border-top: 1px solid $gray-daylight; + background: $gray-midnight; + color: $white; + font-family: $metropolis; - .description { - margin-right: 20px; + .description { + margin-right: 20px; - @include tablet-down { - margin-right: 4px; + @include tablet-down { + margin-right: 4px; + } } - } - a { - color: var(--link-highlight); - } + a { + color: var(--link-highlight); + } } diff --git a/client/src/app/components/Disclaimer.tsx b/client/src/app/components/Disclaimer.tsx index 85a6e64dc..e453b93f9 100644 --- a/client/src/app/components/Disclaimer.tsx +++ b/client/src/app/components/Disclaimer.tsx @@ -15,7 +15,7 @@ class Disclaimer extends Component { super(props); this.state = { - ackCookies: true + ackCookies: true, }; } @@ -41,22 +41,12 @@ class Disclaimer extends Component { return this.state.ackCookies ? null : (
- - This website uses cookies to ensure you get the best experience. - - + This website uses cookies to ensure you get the best experience. + Learn more. -
diff --git a/client/src/app/components/FeedMilestoneInfo.scss b/client/src/app/components/FeedMilestoneInfo.scss index 1b1969251..c083e5edb 100644 --- a/client/src/app/components/FeedMilestoneInfo.scss +++ b/client/src/app/components/FeedMilestoneInfo.scss @@ -15,7 +15,8 @@ margin-bottom: 4px; } - .latest-index, .seconds { + .latest-index, + .seconds { display: flex; h3 { diff --git a/client/src/app/components/FeedMilestoneInfo.tsx b/client/src/app/components/FeedMilestoneInfo.tsx index 64d1e3169..4fd6b7c74 100644 --- a/client/src/app/components/FeedMilestoneInfo.tsx +++ b/client/src/app/components/FeedMilestoneInfo.tsx @@ -30,7 +30,7 @@ const FeedMilestoneInfo: React.FC = ({ milestoneIndex, f FeedMilestoneInfo.defaultProps = { frequencyTarget: undefined, - milestoneIndex: undefined + milestoneIndex: undefined, }; export default FeedMilestoneInfo; diff --git a/client/src/app/components/FiatSelector.scss b/client/src/app/components/FiatSelector.scss index b02ce9134..6b706789a 100644 --- a/client/src/app/components/FiatSelector.scss +++ b/client/src/app/components/FiatSelector.scss @@ -5,123 +5,123 @@ @import "./../../scss/themes"; .fiat-selector { - position: relative; - margin-left: 16px; - font-family: $inter; - - .fiat-selector__button { - @include font-size(14px); - - display: flex; - align-items: center; - height: 32px; - margin: 0; - padding: 0 48px 0 20px; - transition: border-color 0.2s ease; - border: 1px solid var(--input-border-color); - border-radius: 8px; - outline: none; - background-color: transparent; - box-shadow: none; - color: var(--body-color); - appearance: none; - - @include phone-down { - padding: 0 32px 0 8px; + position: relative; + margin-left: 16px; + font-family: $inter; + + .fiat-selector__button { + @include font-size(14px); + + display: flex; + align-items: center; + height: 32px; + margin: 0; + padding: 0 48px 0 20px; + transition: border-color 0.2s ease; + border: 1px solid var(--input-border-color); + border-radius: 8px; + outline: none; + background-color: transparent; + box-shadow: none; + color: var(--body-color); + appearance: none; + + @include phone-down { + padding: 0 32px 0 8px; + } + + &:focus { + border-color: var(--input-focus-border-color); + } + + &:-ms-expand { + display: none; + } + + &:-moz-focusring { + color: transparent; + text-shadow: 0 0 0 $gray-10; + + * { + color: $gray-10; + text-shadow: none; + } + } } - &:focus { - border-color: var(--input-focus-border-color); + .fiat-selector__entries { + position: absolute; + z-index: 5; + width: 356px; + max-height: 500px; + padding-bottom: 14px; + overflow: auto; + border: 1px solid var(--input-border-color); + border-radius: 6px; + background-color: var(--body-background); + color: var(--body-color); + + @include font-size(14px); + + @include desktop-down { + right: 0; + } + + @include phone-down { + position: fixed; + top: $navbar-height-mobile; + width: 100%; + max-height: calc(100vh - $navbar-height-mobile); + border-top: 0; + } + + .group-header { + padding: 24px 20px 14px; + color: $gray-5; + font-weight: 500; + cursor: default; + } + + .fiat-selector__currency { + display: flex; + margin: 0 20px; + padding: 10px 0; + cursor: pointer; + + .acronym { + width: 38px; + margin-right: 8px; + color: var(--fiat-acronym-color); + font-weight: 600; + letter-spacing: 0.5px; + } + + .full-name { + color: $gray-7; + } + + &:not(:last-child) { + border-bottom: 1px solid var(--input-border-color); + } + } } - &:-ms-expand { - display: none; + .chevron { + position: absolute; + z-index: 2; + top: 50%; + transform: translateY(-50%); + right: 10px; + transition: transform 0.2s ease; + color: $gray; + pointer-events: none; + + &.opened { + transform: translateY(-50%) rotate(-180deg); + } + + @include phone-down { + right: 1px; + } } - - &:-moz-focusring { - color: transparent; - text-shadow: 0 0 0 $gray-10; - - * { - color: $gray-10; - text-shadow: none; - } - } - } - - .fiat-selector__entries { - position: absolute; - z-index: 5; - width: 356px; - max-height: 500px; - padding-bottom: 14px; - overflow: auto; - border: 1px solid var(--input-border-color); - border-radius: 6px; - background-color: var(--body-background); - color: var(--body-color); - - @include font-size(14px); - - @include desktop-down { - right: 0; - } - - @include phone-down { - position: fixed; - top: $navbar-height-mobile; - width: 100%; - max-height: calc(100vh - $navbar-height-mobile); - border-top: 0; - } - - .group-header { - padding: 24px 20px 14px; - color: $gray-5; - font-weight: 500; - cursor: default; - } - - .fiat-selector__currency { - display: flex; - margin: 0 20px; - padding: 10px 0; - cursor: pointer; - - .acronym { - width: 38px; - margin-right: 8px; - color: var(--fiat-acronym-color); - font-weight: 600; - letter-spacing: 0.5px; - } - - .full-name { - color: $gray-7; - } - - &:not(:last-child) { - border-bottom: 1px solid var(--input-border-color); - } - } - } - - .chevron { - position: absolute; - z-index: 2; - top: 50%; - transform: translateY(-50%); - right: 10px; - transition: transform 0.2s ease; - color: $gray; - pointer-events: none; - - &.opened { - transform: translateY(-50%) rotate(-180deg); - } - - @include phone-down { - right: 1px; - } - } } diff --git a/client/src/app/components/FiatSelector.tsx b/client/src/app/components/FiatSelector.tsx index 3d3cb1463..4075c5ca3 100644 --- a/client/src/app/components/FiatSelector.tsx +++ b/client/src/app/components/FiatSelector.tsx @@ -26,7 +26,7 @@ class FiatSelector extends Currency { super(props); this.dropdown = React.createRef(); this.setState({ - isExpanded: false + isExpanded: false, }); } @@ -69,7 +69,7 @@ class FiatSelector extends Currency { const supportedFiatCurrencies = this._currencyService.getFiatCurrencies(); return ( -
+
- - expand_more - - { - this.state?.isExpanded && + expand_more + {this.state?.isExpanded && (
Currencies
- {supportedFiatCurrencies.map(currency => renderCurrency(currency))} + {supportedFiatCurrencies.map((currency) => renderCurrency(currency))}
- } -
+ )} +
); } /** * Update formatted currencies. */ - protected updateCurrency(): void { } + protected updateCurrency(): void {} /** * Handler to detect clicks outside the dropdown @@ -102,9 +99,7 @@ class FiatSelector extends Currency { */ private readonly outsideClickHandler = (event: MouseEvent) => { const target = event.target as HTMLElement; - if (this.dropdown.current && - !this.dropdown.current.contains(target) && - target.className !== FiatSelector.BUTTON_CLASSNAME) { + if (this.dropdown.current && !this.dropdown.current.contains(target) && target.className !== FiatSelector.BUTTON_CLASSNAME) { this.closeDropdown(); } }; diff --git a/client/src/app/components/FiatSelectorState.ts b/client/src/app/components/FiatSelectorState.ts index 629226dfa..8e0bd41fa 100644 --- a/client/src/app/components/FiatSelectorState.ts +++ b/client/src/app/components/FiatSelectorState.ts @@ -6,4 +6,3 @@ export interface FiatSelectorState extends CurrencyState { */ isExpanded: boolean; } - diff --git a/client/src/app/components/FiatValue.tsx b/client/src/app/components/FiatValue.tsx index 6fc23265f..6cd8bd58b 100644 --- a/client/src/app/components/FiatValue.tsx +++ b/client/src/app/components/FiatValue.tsx @@ -29,7 +29,7 @@ class FiatValue extends Currency { this.state = { valueCurrency: "", - currency: "USD" + currency: "USD", }; } @@ -48,9 +48,7 @@ class FiatValue extends Currency { * @returns The node to render. */ public render(): ReactNode { - return ( - {this.state.valueCurrency} - ); + return {this.state.valueCurrency}; } /** @@ -60,20 +58,9 @@ class FiatValue extends Currency { if (this._currencyData) { const tokenInfo: INodeInfoBaseToken = this.context.tokenInfo; - const valueCurrency = tokenInfo.name ? - this._currencyService.convertBaseToken( - this.props.value, - tokenInfo, - this._currencyData, - true, - 2 - ) : - this._currencyService.convertIota( - this.props.value, - this._currencyData, - true, - 2 - ); + const valueCurrency = tokenInfo.name + ? this._currencyService.convertBaseToken(this.props.value, tokenInfo, this._currencyData, true, 2) + : this._currencyService.convertIota(this.props.value, this._currencyData, true, 2); this.setState({ valueCurrency }); } diff --git a/client/src/app/components/Icon.scss b/client/src/app/components/Icon.scss index fbe9a6460..6fb620e23 100644 --- a/client/src/app/components/Icon.scss +++ b/client/src/app/components/Icon.scss @@ -2,20 +2,20 @@ @import "../../scss/themes"; .icon { - &.boxed { - display: flex; - align-items: center; - justify-content: center; - width: 40px; - height: 40px; - padding: 5px; - border-radius: 30px; - background: var(--header-svg-bg); + &.boxed { + display: flex; + align-items: center; + justify-content: center; + width: 40px; + height: 40px; + padding: 5px; + border-radius: 30px; + background: var(--header-svg-bg); - svg { - path { - fill: var(--body-color); - } + svg { + path { + fill: var(--body-color); + } + } } - } } diff --git a/client/src/app/components/Icon.tsx b/client/src/app/components/Icon.tsx index eb778aacc..e21fac63f 100644 --- a/client/src/app/components/Icon.tsx +++ b/client/src/app/components/Icon.tsx @@ -14,21 +14,21 @@ const ICONS: { clipRule?: string | number; }[]; }[] = [ - { - name: "wallet", - width: "20", - height: "20", - path: [ - { - // eslint-disable-next-line max-len - d: "M6 0C2.68629 0 0 2.68629 0 6V14C0 17.3137 2.68629 20 6 20H14C17.3137 20 20 17.3137 20 14V6C20 2.68629 17.3137 0 14 0H6ZM18 6C18 3.79086 16.2091 2 14 2H6C3.79086 2 2 3.79086 2 6V14C2 16.2091 3.79086 18 6 18H14C16.2091 18 18 16.2091 18 14L14 14C11.7909 14 10 12.2091 10 10C10 7.79086 11.7909 6 14 6L18 6ZM14 8H18V12H14C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8Z", - fill: "#25395F", - fillRule: "evenodd", - clipRule: "evenodd" - } - ] - } - ]; + { + name: "wallet", + width: "20", + height: "20", + path: [ + { + // eslint-disable-next-line max-len + d: "M6 0C2.68629 0 0 2.68629 0 6V14C0 17.3137 2.68629 20 6 20H14C17.3137 20 20 17.3137 20 14V6C20 2.68629 17.3137 0 14 0H6ZM18 6C18 3.79086 16.2091 2 14 2H6C3.79086 2 2 3.79086 2 6V14C2 16.2091 3.79086 18 6 18H14C16.2091 18 18 16.2091 18 14L14 14C11.7909 14 10 12.2091 10 10C10 7.79086 11.7909 6 14 6L18 6ZM14 8H18V12H14C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8Z", + fill: "#25395F", + fillRule: "evenodd", + clipRule: "evenodd", + }, + ], + }, +]; /** * Component which will display the inclusion state. @@ -39,31 +39,11 @@ class Icon extends Component { * @returns The node to render. */ public render(): ReactNode { - const selectedIcon = ICONS.find(_icon => _icon.name === this.props.icon); + const selectedIcon = ICONS.find((_icon) => _icon.name === this.props.icon); - return ( - selectedIcon ? ( - this.props.boxed ? ( -
- - {selectedIcon.path.map((path, index) => ( - - ))} - -
- ) : ( + return selectedIcon ? ( + this.props.boxed ? ( +
{ xmlns="http://www.w3.org/2000/svg" > {selectedIcon.path.map((path, index) => ( - + ))} - ) - ) : null - ); +
+ ) : ( + + {selectedIcon.path.map((path, index) => ( + + ))} + + ) + ) : null; } } diff --git a/client/src/app/components/JsonViewer.scss b/client/src/app/components/JsonViewer.scss index bfa71531a..95c2549ce 100644 --- a/client/src/app/components/JsonViewer.scss +++ b/client/src/app/components/JsonViewer.scss @@ -3,26 +3,26 @@ @import "../../scss/variables"; .json-viewer { - font-family: "Courier New", Courier, monospace; - white-space: pre-wrap; + font-family: "Courier New", Courier, monospace; + white-space: pre-wrap; - .string { - color: green; - } + .string { + color: green; + } - .number { - color: darkorange; - } + .number { + color: darkorange; + } - .boolean { - color: blue; - } + .boolean { + color: blue; + } - .null { - color: magenta; - } + .null { + color: magenta; + } - .key { - color: $gray-10; - } + .key { + color: $gray-10; + } } diff --git a/client/src/app/components/JsonViewer.tsx b/client/src/app/components/JsonViewer.tsx index 807c40b8b..da12e364f 100644 --- a/client/src/app/components/JsonViewer.tsx +++ b/client/src/app/components/JsonViewer.tsx @@ -16,8 +16,7 @@ class JsonViewer extends Component {
); diff --git a/client/src/app/components/Modal.scss b/client/src/app/components/Modal.scss index 0f578843b..ab39bab8b 100644 --- a/client/src/app/components/Modal.scss +++ b/client/src/app/components/Modal.scss @@ -5,115 +5,115 @@ @import "../../scss/themes"; .modal { - display: inline-block; + display: inline-block; - button { - border: none; - background-color: transparent; + button { + border: none; + background-color: transparent; - &:focus { - box-shadow: none; + &:focus { + box-shadow: none; + } } - } - .modal--icon { - display: flex; - align-items: center; - padding: 0 8px; + .modal--icon { + display: flex; + align-items: center; + padding: 0 8px; - span { - color: #b0bfd9; - font-size: 20px; - } - } - - .modal--bg { - position: fixed; - z-index: 2000; - top: 0; - left: 0; - width: 100%; - height: 100vh; - background: rgba(19, 31, 55, 0.75); - } - - .modal--content { - position: fixed; - z-index: 3000; - top: 50%; - left: 50%; - width: 100%; - max-width: 660px; - max-height: 100%; - padding: 32px; - transform: translate(-50%, -50%); - border: 1px solid #e8eefb; - border-radius: 6px; - background-color: var(--body-background); - box-shadow: 0 4px 8px rgba(19, 31, 55, 0.04); - - @include tablet-down { - width: 100%; - overflow-y: auto; + span { + color: #b0bfd9; + font-size: 20px; + } } - .modal--title { - @include font-size(20px); - - display: flex; - align-items: center; - justify-content: space-between; - padding-bottom: 22px; - border-bottom: 1px solid #e8eefb; - color: var(--body-color); - font-family: $metropolis; - font-weight: 600; - letter-spacing: 0.02em; - - button { - color: var(--body-color); - } + .modal--bg { + position: fixed; + z-index: 2000; + top: 0; + left: 0; + width: 100%; + height: 100vh; + background: rgba(19, 31, 55, 0.75); } - .modal--description { - margin-top: 24px; - - a { - color: var(--mint-green-bg); - } - - ol { - margin-left: 16px; - } - - p, - ol { - @include font-size(14px, 21px); - - color: var(--modal-color); - font-family: $inter; - font-weight: 400; + .modal--content { + position: fixed; + z-index: 3000; + top: 50%; + left: 50%; + width: 100%; + max-width: 660px; + max-height: 100%; + padding: 32px; + transform: translate(-50%, -50%); + border: 1px solid #e8eefb; + border-radius: 6px; + background-color: var(--body-background); + box-shadow: 0 4px 8px rgba(19, 31, 55, 0.04); + + @include tablet-down { + width: 100%; + overflow-y: auto; + } - &:not(:last-child) { - margin-bottom: 24px; + .modal--title { + @include font-size(20px); + + display: flex; + align-items: center; + justify-content: space-between; + padding-bottom: 22px; + border-bottom: 1px solid #e8eefb; + color: var(--body-color); + font-family: $metropolis; + font-weight: 600; + letter-spacing: 0.02em; + + button { + color: var(--body-color); + } } - } - - .modal--actions { - margin: 24px 0; - pointer-events: auto; - .modal--action { - @include font-size(14px, 21px); - - padding: 6px 20px; - border: 1px solid #d8e1f4; - border-radius: 6px; - background: var(--light-bg); - color: var(--expanded-color); - font-family: $inter; - text-decoration: none; + + .modal--description { + margin-top: 24px; + + a { + color: var(--mint-green-bg); + } + + ol { + margin-left: 16px; + } + + p, + ol { + @include font-size(14px, 21px); + + color: var(--modal-color); + font-family: $inter; + font-weight: 400; + + &:not(:last-child) { + margin-bottom: 24px; + } + } + + .modal--actions { + margin: 24px 0; + pointer-events: auto; + .modal--action { + @include font-size(14px, 21px); + + padding: 6px 20px; + border: 1px solid #d8e1f4; + border-radius: 6px; + background: var(--light-bg); + color: var(--expanded-color); + font-family: $inter; + text-decoration: none; + } + } } - } } - } } diff --git a/client/src/app/components/Modal.tsx b/client/src/app/components/Modal.tsx index 4acf074b3..42cef73cf 100644 --- a/client/src/app/components/Modal.tsx +++ b/client/src/app/components/Modal.tsx @@ -3,7 +3,6 @@ import { ModalProps } from "./ModalProps"; import { ModalState } from "./ModalState"; import "./Modal.scss"; - /** * Component to reuse for info modals. */ @@ -15,7 +14,7 @@ class Modal extends Component { constructor(props: ModalProps) { super(props); this.state = { - show: false + show: false, }; } @@ -26,15 +25,8 @@ class Modal extends Component { public render(): ReactNode { return (
- {this.state.show && ( @@ -42,10 +34,7 @@ class Modal extends Component {
{this.props.data?.title} -
@@ -67,7 +56,6 @@ class Modal extends Component { ))}
)} -
{ } private handleShow(): void { - this.setState({ show: true }, - () => { - if (this.props?.showModal) { - this.props.showModal(this.state.show); - } + this.setState({ show: true }, () => { + if (this.props?.showModal) { + this.props.showModal(this.state.show); } - ); + }); } private handleHide(): void { - this.setState({ show: false }, - () => { - if (this.props?.showModal) { - this.props.showModal(this.state.show); - } + this.setState({ show: false }, () => { + if (this.props?.showModal) { + this.props.showModal(this.state.show); } - ); + }); } } diff --git a/client/src/app/components/NetworkSwitcher.scss b/client/src/app/components/NetworkSwitcher.scss index d35a74e26..6667f070f 100644 --- a/client/src/app/components/NetworkSwitcher.scss +++ b/client/src/app/components/NetworkSwitcher.scss @@ -5,182 +5,181 @@ @import "../../scss/themes"; .network--switcher { - width: 180px; - - @include tablet-down { - &::before { - content: ""; - position: absolute; - top: -3px; - left: -20px; - width: 100vw; - height: 1px; - background-color: var(--border-color); + width: 180px; + + @include tablet-down { + &::before { + content: ""; + position: absolute; + top: -3px; + left: -20px; + width: 100vw; + height: 1px; + background-color: var(--border-color); + } } - } - .network--switcher__header { - justify-content: center; - font-family: $metropolis; + .network--switcher__header { + justify-content: center; + font-family: $metropolis; - &.opened { - .icon { - span { - transform: rotate(-180deg); + &.opened { + .icon { + span { + transform: rotate(-180deg); + } + } } - } - } - .network--switcher__dropdown { - text-align: center; + .network--switcher__dropdown { + text-align: center; - .label { - @include font-size(16px, 18px); + .label { + @include font-size(16px, 18px); - color: var(--header-label-color); - font-weight: 600; - letter-spacing: 0.01em; - } + color: var(--header-label-color); + font-weight: 600; + letter-spacing: 0.01em; + } - .eyebrow { - @include font-size(10px, 15px); + .eyebrow { + @include font-size(10px, 15px); - color: $mint-green-6; - font-weight: 600; - letter-spacing: 0.15em; - text-transform: uppercase; - } + color: $mint-green-6; + font-weight: 600; + letter-spacing: 0.15em; + text-transform: uppercase; + } - @include desktop-down { - width: 100%; - } - } + @include desktop-down { + width: 100%; + } + } - .icon { - margin-left: 12px; + .icon { + margin-left: 12px; - span { - transition: transform 0.2s ease; - color: var(--header-icon-color); - } + span { + transition: transform 0.2s ease; + color: var(--header-icon-color); + } + } } - } - } .network--expanded { - position: fixed; - z-index: 2; - top: $navbar-height-desktop; - right: 0; - width: 520px; - max-height: 0; - overflow: hidden; - transition: max-height 0.3s ease-in-out; - border-radius: 12px; - background: var(--body-background); - box-shadow: var(--box-shadow-down); - - @include desktop-down { - width: 468px; - top: $navbar-height-mobile * 2; - } - - @include phone-down { - width: 100vw; - border-radius: unset; - } - - &.opened { - max-height: 1000px; + position: fixed; + z-index: 2; + top: $navbar-height-desktop; + right: 0; + width: 520px; + max-height: 0; + overflow: hidden; + transition: max-height 0.3s ease-in-out; + border-radius: 12px; + background: var(--body-background); + box-shadow: var(--box-shadow-down); @include desktop-down { - top: $navbar-height-mobile * 2; + width: 468px; + top: $navbar-height-mobile * 2; } - } - .networks { - display: flex; - flex-direction: column; - margin: auto; - padding: 32px 12px; + @include phone-down { + width: 100vw; + border-radius: unset; + } - @media (max-width: 1200px) { - display: block; + &.opened { + max-height: 1000px; - div.network { - width: 100%; - } + @include desktop-down { + top: $navbar-height-mobile * 2; + } } - .network { - display: flex; - flex-direction: row; - padding: 0 10px; - - .network--cards { + .networks { display: flex; flex-direction: column; - width: 100vw; - - .network--card { - min-height: 86px; - margin-bottom: 16px; - padding: 8px; - border-radius: 12px; - cursor: pointer; - - &.selected { - background: rgba(20, 202, 191, 0.08); - - .network--icon { - background: $mint-green-6; - - svg path { - fill: $white; - } - } - } + margin: auto; + padding: 32px 12px; - &:hover:not(.selected) { - background: var(--light-bg); - } + @media (max-width: 1200px) { + display: block; - .network--icon { - min-width: 64px; - height: 64px; - border-radius: 8px; - background: $gray-2; - background: var(--header-svg-bg); - - svg path { - fill: var(--header-icon-color); - } - } - - .network--content { - margin-left: 24px; - - .label { - color: var(--body-color); - font-family: $metropolis; - font-weight: 600; - letter-spacing: 0.01em; - - @include font-size(16px, 24px); + div.network { + width: 100%; } + } - .protocol { - color: var(--expanded-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - - @include font-size(12px, 18px); + .network { + display: flex; + flex-direction: row; + padding: 0 10px; + + .network--cards { + display: flex; + flex-direction: column; + width: 100vw; + + .network--card { + min-height: 86px; + margin-bottom: 16px; + padding: 8px; + border-radius: 12px; + cursor: pointer; + + &.selected { + background: rgba(20, 202, 191, 0.08); + + .network--icon { + background: $mint-green-6; + + svg path { + fill: $white; + } + } + } + + &:hover:not(.selected) { + background: var(--light-bg); + } + + .network--icon { + min-width: 64px; + height: 64px; + border-radius: 8px; + background: $gray-2; + background: var(--header-svg-bg); + + svg path { + fill: var(--header-icon-color); + } + } + + .network--content { + margin-left: 24px; + + .label { + color: var(--body-color); + font-family: $metropolis; + font-weight: 600; + letter-spacing: 0.01em; + + @include font-size(16px, 24px); + } + + .protocol { + color: var(--expanded-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + + @include font-size(12px, 18px); + } + } + } } - } } - } } - } } diff --git a/client/src/app/components/NetworkSwitcher.tsx b/client/src/app/components/NetworkSwitcher.tsx index b8afdfe77..b3a070cae 100644 --- a/client/src/app/components/NetworkSwitcher.tsx +++ b/client/src/app/components/NetworkSwitcher.tsx @@ -11,7 +11,7 @@ import "./NetworkSwitcher.scss"; const PROTOCOL_VERIONS_TO_LABEL = { [LEGACY]: "Legacy", [CHRYSALIS]: "Chrysalis", - [STARDUST]: "Stardust" + [STARDUST]: "Stardust", }; /** @@ -42,9 +42,7 @@ class NetworkSwitcher extends Component {
{!isSingleNetwork && (
- - expand_more - + expand_more
)} @@ -54,10 +52,7 @@ class NetworkSwitcher extends Component {
onChange(network.network)} >
@@ -65,9 +60,7 @@ class NetworkSwitcher extends Component {
{network.label}
-
- {PROTOCOL_VERIONS_TO_LABEL[network.protocolVersion]} -
+
{PROTOCOL_VERIONS_TO_LABEL[network.protocolVersion]}
@@ -76,15 +69,9 @@ class NetworkSwitcher extends Component {
- {isExpanded && ( -
- )} - + {isExpanded &&
}
-
+ ); } } diff --git a/client/src/app/components/NotFound.scss b/client/src/app/components/NotFound.scss index a8bf13bff..147b08d0f 100644 --- a/client/src/app/components/NotFound.scss +++ b/client/src/app/components/NotFound.scss @@ -57,4 +57,3 @@ } } } - diff --git a/client/src/app/components/NotFound.tsx b/client/src/app/components/NotFound.tsx index b3e5dd546..475f8caf4 100644 --- a/client/src/app/components/NotFound.tsx +++ b/client/src/app/components/NotFound.tsx @@ -15,9 +15,7 @@ const NotFound: React.FC = ({ query, searchTarget }) => (

Not found

-

- {`We could not find any ${searchTarget} with that query.`} -

+

{`We could not find any ${searchTarget} with that query.`}


    @@ -35,4 +33,3 @@ const NotFound: React.FC = ({ query, searchTarget }) => ( ); export default NotFound; - diff --git a/client/src/app/components/Pagination.scss b/client/src/app/components/Pagination.scss index 35361746b..a4320fff5 100644 --- a/client/src/app/components/Pagination.scss +++ b/client/src/app/components/Pagination.scss @@ -1,8 +1,8 @@ -@import '../../scss/fonts'; -@import '../../scss/mixins'; -@import '../../scss/media-queries'; -@import '../../scss/variables'; -@import '../../scss/themes'; +@import "../../scss/fonts"; +@import "../../scss/mixins"; +@import "../../scss/media-queries"; +@import "../../scss/variables"; +@import "../../scss/themes"; .pagination { display: flex; @@ -41,7 +41,7 @@ .arrow { &::before { position: relative; - content: ''; + content: ""; display: inline-block; width: 0.4em; height: 0.4em; diff --git a/client/src/app/components/Pagination.tsx b/client/src/app/components/Pagination.tsx index ad249a663..88e71650f 100644 --- a/client/src/app/components/Pagination.tsx +++ b/client/src/app/components/Pagination.tsx @@ -12,7 +12,7 @@ class Pagination extends AsyncComponent { /** * Dots for pagination. */ - private static readonly DOTS: string = "..."; + private static readonly DOTS: string = "..."; /** * Create a new instance of Pagination. @@ -23,7 +23,7 @@ class Pagination extends AsyncComponent { this.state = { paginationRange: [], lastPage: 0, - isMobile: false + isMobile: false, }; } @@ -33,11 +33,8 @@ class Pagination extends AsyncComponent { */ public componentDidUpdate(prevProps: PaginationProps): void { if (this.props !== prevProps) { - this.setState( - { paginationRange: this.updatePaginationRange() }, - () => this.setState( - { lastPage: this.state.paginationRange.at(-1) as number } - ) + this.setState({ paginationRange: this.updatePaginationRange() }, () => + this.setState({ lastPage: this.state.paginationRange.at(-1) as number }), ); } } @@ -47,11 +44,8 @@ class Pagination extends AsyncComponent { */ public componentDidMount(): void { super.componentDidMount(); - this.setState( - { paginationRange: this.updatePaginationRange() }, - () => this.setState( - { lastPage: this.state.paginationRange.at(-1) as number } - ) + this.setState({ paginationRange: this.updatePaginationRange() }, () => + this.setState({ lastPage: this.state.paginationRange.at(-1) as number }), ); window.addEventListener("resize", this.resize.bind(this)); this.resize(); @@ -61,10 +55,7 @@ class Pagination extends AsyncComponent { const isMobileViewPort = window.innerWidth < 768; if (this.state.isMobile !== isMobileViewPort && this._isMounted) { - this.setState( - { isMobile: isMobileViewPort }, - () => this.setState({ paginationRange: this.updatePaginationRange() }) - ); + this.setState({ isMobile: isMobileViewPort }, () => this.setState({ paginationRange: this.updatePaginationRange() })); } } @@ -86,13 +77,13 @@ class Pagination extends AsyncComponent {
    • { const page = this.props.currentPage < 11 ? 1 : this.props.currentPage - 10; @@ -104,7 +95,7 @@ class Pagination extends AsyncComponent {
    • { this.props.onPageChange(this.props.currentPage - 1); @@ -112,16 +103,20 @@ class Pagination extends AsyncComponent { >
    • - {this.state.paginationRange.map((pageNumber: (number|string), idx: number) => { + {this.state.paginationRange.map((pageNumber: number | string, idx: number) => { if (pageNumber === Pagination.DOTS) { - return
    • {pageNumber}
    • ; + return ( +
    • + {pageNumber} +
    • + ); } return (
    • this.props.onPageChange(pageNumber as number)} > @@ -131,7 +126,7 @@ class Pagination extends AsyncComponent { })}
    • { this.props.onPageChange(this.props.currentPage + 1); @@ -142,12 +137,10 @@ class Pagination extends AsyncComponent {
    • { - const page = this.props.currentPage > this.state.lastPage - 10 - ? this.state.lastPage - : this.props.currentPage + 10; + const page = this.props.currentPage > this.state.lastPage - 10 ? this.state.lastPage : this.props.currentPage + 10; this.props.onPageChange(page); }} > @@ -158,13 +151,12 @@ class Pagination extends AsyncComponent { ); } - /** * Update pagination range. * @returns The range of available pages. */ - protected updatePaginationRange(): (string|number)[] { - let paginationRange: (string|number)[] = []; + protected updatePaginationRange(): (string | number)[] { + let paginationRange: (string | number)[] = []; const totalPageCount: number = Math.ceil(this.props.totalCount / this.props.pageSize); @@ -176,10 +168,7 @@ class Pagination extends AsyncComponent { } const leftSiblingIndex = Math.max(this.props.currentPage - this.props.siblingsCount, 1); - const rightSiblingIndex = Math.min( - this.props.currentPage + this.props.siblingsCount, - totalPageCount - ); + const rightSiblingIndex = Math.min(this.props.currentPage + this.props.siblingsCount, totalPageCount); /* * Do not show dots if there is only one position left @@ -192,18 +181,15 @@ class Pagination extends AsyncComponent { const lastPageIndex = totalPageCount; if (!shouldShowLeftDots && shouldShowRightDots) { - const leftItemCount = 3 + (2 * this.props.siblingsCount); + const leftItemCount = 3 + 2 * this.props.siblingsCount; const leftRange = this.range(1, leftItemCount); paginationRange = [...leftRange, Pagination.DOTS, totalPageCount]; } if (shouldShowLeftDots && !shouldShowRightDots) { - const rightItemCount = 3 + (2 * this.props.siblingsCount); - const rightRange = this.range( - totalPageCount - rightItemCount + 1, - totalPageCount - ); + const rightItemCount = 3 + 2 * this.props.siblingsCount; + const rightRange = this.range(totalPageCount - rightItemCount + 1, totalPageCount); paginationRange = [firstPageIndex, Pagination.DOTS, ...rightRange]; } @@ -220,21 +206,17 @@ class Pagination extends AsyncComponent { const rightRemainingPages = totalPageCount - (this.props.currentPage + this.props.siblingsCount); const leftRemainingPages = this.props.currentPage - this.props.siblingsCount; - if (!this.state.isMobile && - this.props.extraPageRangeLimit && - rightRemainingPages > this.props.extraPageRangeLimit) { - const remainderMidPoint = Math.floor((rightRemainingPages) / 2) + this.props.currentPage; - const rMiddleRange: (string|number)[] = this.range(remainderMidPoint - 1, remainderMidPoint + 1); + if (!this.state.isMobile && this.props.extraPageRangeLimit && rightRemainingPages > this.props.extraPageRangeLimit) { + const remainderMidPoint = Math.floor(rightRemainingPages / 2) + this.props.currentPage; + const rMiddleRange: (string | number)[] = this.range(remainderMidPoint - 1, remainderMidPoint + 1); rMiddleRange.push(Pagination.DOTS); const lastItemIndex = paginationRange.length - 1; paginationRange.splice(lastItemIndex, 0, ...rMiddleRange); } - if (!this.state.isMobile && - this.props.extraPageRangeLimit && - leftRemainingPages > this.props.extraPageRangeLimit) { + if (!this.state.isMobile && this.props.extraPageRangeLimit && leftRemainingPages > this.props.extraPageRangeLimit) { const remainderMidPoint = Math.floor(leftRemainingPages / 2); - const lMiddleRange: (string|number)[] = this.range(remainderMidPoint - 1, remainderMidPoint + 1); + const lMiddleRange: (string | number)[] = this.range(remainderMidPoint - 1, remainderMidPoint + 1); lMiddleRange.unshift(Pagination.DOTS); paginationRange.splice(1, 0, ...lMiddleRange); } diff --git a/client/src/app/components/PaginationProps.ts b/client/src/app/components/PaginationProps.ts index 429667da2..533a17ad7 100644 --- a/client/src/app/components/PaginationProps.ts +++ b/client/src/app/components/PaginationProps.ts @@ -1,5 +1,4 @@ export interface PaginationProps { - /** * The total number of pages. */ @@ -35,5 +34,4 @@ export interface PaginationProps { * @param page Page navigated to. */ onPageChange(page: number): void; - } diff --git a/client/src/app/components/PaginationState.tsx b/client/src/app/components/PaginationState.tsx index 22611baed..b4fa02d0b 100644 --- a/client/src/app/components/PaginationState.tsx +++ b/client/src/app/components/PaginationState.tsx @@ -7,7 +7,7 @@ export interface PaginationState { /** * Pagination range. */ - paginationRange: (number|string)[]; + paginationRange: (number | string)[]; /** * Is mobile view. diff --git a/client/src/app/components/ReceiptPayloadState.tsx b/client/src/app/components/ReceiptPayloadState.tsx index e94d4fef9..127c7954e 100644 --- a/client/src/app/components/ReceiptPayloadState.tsx +++ b/client/src/app/components/ReceiptPayloadState.tsx @@ -4,4 +4,3 @@ export interface ReceiptPayloadState { */ formatFull: boolean; } - diff --git a/client/src/app/components/SearchInput.scss b/client/src/app/components/SearchInput.scss index a792da9ce..0bb7a4a02 100644 --- a/client/src/app/components/SearchInput.scss +++ b/client/src/app/components/SearchInput.scss @@ -5,116 +5,116 @@ @import "../../scss/themes"; .search-input { - display: flex; - position: relative; - flex: 1; - flex-direction: row; - align-items: center; - max-width: 400px; - height: 40px; - - span { - position: absolute; - left: 16px; - color: var(--search-svg); - } - - .search--text-input { - @include font-size(14px); - + display: flex; + position: relative; flex: 1; + flex-direction: row; + align-items: center; + max-width: 400px; height: 40px; - padding: 12px 12px 12px 52px; - transition: border-color 0.2s ease; - border: 1px solid var(--input-border-color); - border-radius: 6px; - background-color: transparent; - box-shadow: none; - color: var(--body-color); - font-family: $inter; - - &::placeholder { - color: var(--input-border-color); - } - &:focus { - border-color: var(--input-focus-border-color); + span { + position: absolute; + left: 16px; + color: var(--search-svg); } - @include phone-down { - @include font-size(12px); + .search--text-input { + @include font-size(14px); + + flex: 1; + height: 40px; + padding: 12px 12px 12px 52px; + transition: border-color 0.2s ease; + border: 1px solid var(--input-border-color); + border-radius: 6px; + background-color: transparent; + box-shadow: none; + color: var(--body-color); + font-family: $inter; + + &::placeholder { + color: var(--input-border-color); + } + + &:focus { + border-color: var(--input-focus-border-color); + } + + @include phone-down { + @include font-size(12px); - height: 32px; + height: 32px; + } } - } } .search-input--compact { - display: none; - z-index: 10; - margin-left: 8px; + display: none; + z-index: 10; + margin-left: 8px; - @include desktop-down { - display: block; - } - - button { - @include phone-down { - padding: 2px 4px; + @include desktop-down { + display: block; } - border: 0; - background: none; + button { + @include phone-down { + padding: 2px 4px; + } - &:focus { - box-shadow: none; - } + border: 0; + background: none; - span { - color: var(--header-icon-color); - } - } + &:focus { + box-shadow: none; + } - .text-input { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: $navbar-height-mobile; - background: var(--body-background); - color: var(--body-color); + span { + color: var(--header-icon-color); + } + } - .search--text-input { - width: 100%; - height: 100%; - padding-right: 48px; - padding-left: 24px; - border: 0; - background: transparent; - font-family: $inter; - - &:focus { - box-shadow: none; - } + .text-input { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: $navbar-height-mobile; + background: var(--body-background); + color: var(--body-color); + + .search--text-input { + width: 100%; + height: 100%; + padding-right: 48px; + padding-left: 24px; + border: 0; + background: transparent; + font-family: $inter; + + &:focus { + box-shadow: none; + } + } + + span { + position: absolute; + top: 50%; + right: 16px; + transform: translateY(-50%); + color: var(--header-icon-color); + } } - span { - position: absolute; - top: 50%; - right: 16px; - transform: translateY(-50%); - color: var(--header-icon-color); + .bg-placeholder { + position: absolute; + z-index: 3; + top: $navbar-height-mobile; + left: 0; + width: 100%; + height: 100vh; + opacity: var(--search-bg-opacity); + background: hsla(0, 0%, 90.6%, 0.8); } - } - - .bg-placeholder { - position: absolute; - z-index: 3; - top: $navbar-height-mobile; - left: 0; - width: 100%; - height: 100vh; - opacity: var(--search-bg-opacity); - background: hsla(0, 0%, 90.6%, 0.8); - } } diff --git a/client/src/app/components/SearchInput.tsx b/client/src/app/components/SearchInput.tsx index d80ac2ca6..ce5a3656a 100644 --- a/client/src/app/components/SearchInput.tsx +++ b/client/src/app/components/SearchInput.tsx @@ -21,7 +21,7 @@ class SearchInput extends AsyncComponent { this.state = { query: "", isValid: false, - showSearchInput: false + showSearchInput: false, }; } @@ -33,45 +33,33 @@ class SearchInput extends AsyncComponent { return ( {/* -------------- Desktop Search ---------------- */} -
      - - search - +
      + search this.setState({ - query: this.props.protocolVersion === LEGACY - ? e.target.value.toUpperCase().trim() - : e.target.value, - isValid: this.isValid(this.props.protocolVersion === LEGACY - ? e.target.value.toUpperCase().trim() - : e.target.value) - })} - onKeyDown={e => { + onChange={(e) => + this.setState({ + query: this.props.protocolVersion === LEGACY ? e.target.value.toUpperCase().trim() : e.target.value, + isValid: this.isValid( + this.props.protocolVersion === LEGACY ? e.target.value.toUpperCase().trim() : e.target.value, + ), + }) + } + onKeyDown={(e) => { if (e.keyCode === 13 && this.state.isValid) { this.doSearch(); } }} placeholder="Search the tangle..." /> -
      {/* -------------- Mobile Search ---------------- */}
      - {this.state.showSearchInput && ( @@ -81,15 +69,20 @@ class SearchInput extends AsyncComponent { type="text" autoFocus value={this.state.query} - onChange={e => this.setState({ - query: this.props.protocolVersion === LEGACY - ? e.target.value.toUpperCase().trim() - : e.target.value, - isValid: this.isValid(this.props.protocolVersion === LEGACY - ? e.target.value.toUpperCase().trim() - : e.target.value) - })} - onKeyDown={e => { + onChange={(e) => + this.setState({ + query: + this.props.protocolVersion === LEGACY + ? e.target.value.toUpperCase().trim() + : e.target.value, + isValid: this.isValid( + this.props.protocolVersion === LEGACY + ? e.target.value.toUpperCase().trim() + : e.target.value, + ), + }) + } + onKeyDown={(e) => { if (e.keyCode === 13 && this.state.isValid) { this.doSearch(); this.setState({ showSearchInput: false }); @@ -116,7 +109,6 @@ class SearchInput extends AsyncComponent { )}
      - ); } @@ -141,9 +133,7 @@ class SearchInput extends AsyncComponent { return false; } - return ((query.trim().length > 0 && query.trim().length <= 27) || - query.trim().length === 81 || - query.trim().length === 90); + return (query.trim().length > 0 && query.trim().length <= 27) || query.trim().length === 81 || query.trim().length === 90; } return query.trim().length > 0; @@ -153,9 +143,7 @@ class SearchInput extends AsyncComponent { * Perform the search. */ private doSearch(): void { - this.props.onSearch(this.props.protocolVersion === LEGACY - ? this.state.query.trim().toUpperCase() - : this.state.query.trim()); + this.props.onSearch(this.props.protocolVersion === LEGACY ? this.state.query.trim().toUpperCase() : this.state.query.trim()); // Clear search input field when a search has been made. this.setState({ query: "" }); diff --git a/client/src/app/components/Spinner.scss b/client/src/app/components/Spinner.scss index 970dce11c..54080fe9b 100644 --- a/client/src/app/components/Spinner.scss +++ b/client/src/app/components/Spinner.scss @@ -1,37 +1,37 @@ -@import '../../scss/fonts'; -@import '../../scss/mixins'; -@import '../../scss/variables'; +@import "../../scss/fonts"; +@import "../../scss/mixins"; +@import "../../scss/variables"; .spinner { - position: relative; - top: 20px; - left: 20px; - width: 40px; - height: 40px; - animation: pulse 1s ease-in-out infinite; - border-radius: 100%; - background-color: #c3d0e4; + position: relative; + top: 20px; + left: 20px; + width: 40px; + height: 40px; + animation: pulse 1s ease-in-out infinite; + border-radius: 100%; + background-color: #c3d0e4; - &.spinner--compact { - top: 10px; - left: 10px; - width: 20px; - height: 20px; - } + &.spinner--compact { + top: 10px; + left: 10px; + width: 20px; + height: 20px; + } } @keyframes pulse { - 0% { - transform: translate(-50%, -50%) scale(0); - opacity: 1; - } + 0% { + transform: translate(-50%, -50%) scale(0); + opacity: 1; + } - 100% { - transform: translate(-50%, -50%) scale(1); - opacity: 0; - } + 100% { + transform: translate(-50%, -50%) scale(1); + opacity: 0; + } } .spinner + * { - margin-left: 20px; + margin-left: 20px; } diff --git a/client/src/app/components/Spinner.tsx b/client/src/app/components/Spinner.tsx index 779747e1a..9a22ecbf5 100644 --- a/client/src/app/components/Spinner.tsx +++ b/client/src/app/components/Spinner.tsx @@ -12,12 +12,7 @@ class Spinner extends Component { * @returns The node to render. */ public render(): ReactNode { - return ( -
      - ); + return
      ; } } diff --git a/client/src/app/components/Switcher.scss b/client/src/app/components/Switcher.scss index 2f26ffdf8..0771d2bfb 100644 --- a/client/src/app/components/Switcher.scss +++ b/client/src/app/components/Switcher.scss @@ -4,65 +4,65 @@ @import "../../scss/variables"; .switch-wrapper { - display: flex; - align-items: center; + display: flex; + align-items: center; - & > span { - @include font-size(12px, 18px); + & > span { + @include font-size(12px, 18px); - margin-right: 16px; - color: var(--header-color); - font-family: $inter; - font-weight: 500; + margin-right: 16px; + color: var(--header-color); + font-family: $inter; + font-weight: 500; - @include phone-down { - margin-right: 8px; + @include phone-down { + margin-right: 8px; + } } - } - .switch { - position: relative; - width: 32px; - height: 20px; + .switch { + position: relative; + width: 32px; + height: 20px; - .slider { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - transition: 0.4s; - border-radius: 16px; - background-color: $gray-4; - cursor: pointer; + .slider { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + transition: 0.4s; + border-radius: 16px; + background-color: $gray-4; + cursor: pointer; - &::before { - content: ""; - position: absolute; - top: 10%; - width: 50%; - height: 80%; - transform: translateX(2px); - transition: 0.4s; - border-radius: 50%; - background-color: white; - } - } + &::before { + content: ""; + position: absolute; + top: 10%; + width: 50%; + height: 80%; + transform: translateX(2px); + transition: 0.4s; + border-radius: 50%; + background-color: white; + } + } - input { - width: 0; - height: 0; - opacity: 0; + input { + width: 0; + height: 0; + opacity: 0; - &:checked { - & + .slider { - background-color: $green-6; + &:checked { + & + .slider { + background-color: $green-6; - &::before { - transform: translateX(calc(100% - 2px)); - } + &::before { + transform: translateX(calc(100% - 2px)); + } + } + } } - } } - } } diff --git a/client/src/app/components/Switcher.tsx b/client/src/app/components/Switcher.tsx index 414f674c1..0747e341d 100644 --- a/client/src/app/components/Switcher.tsx +++ b/client/src/app/components/Switcher.tsx @@ -15,12 +15,7 @@ class Switcher extends Component {
      {this.props.label}
      diff --git a/client/src/app/components/Tooltip.scss b/client/src/app/components/Tooltip.scss index fa32e727b..024a7aa5a 100644 --- a/client/src/app/components/Tooltip.scss +++ b/client/src/app/components/Tooltip.scss @@ -1,4 +1,4 @@ -@import '../../scss/fonts.scss'; +@import "../../scss/fonts.scss"; .tooltip { position: relative; diff --git a/client/src/app/components/Tooltip.tsx b/client/src/app/components/Tooltip.tsx index 7c14a6518..231966d19 100644 --- a/client/src/app/components/Tooltip.tsx +++ b/client/src/app/components/Tooltip.tsx @@ -45,9 +45,7 @@ const Tooltip: React.FC = ({ children, tooltipContent, childrenCla }; Tooltip.defaultProps = { - childrenClass: undefined + childrenClass: undefined, }; export default Tooltip; - - diff --git a/client/src/app/components/ValueButton.scss b/client/src/app/components/ValueButton.scss index 8987d06a8..e2f3335b6 100644 --- a/client/src/app/components/ValueButton.scss +++ b/client/src/app/components/ValueButton.scss @@ -1,72 +1,72 @@ -@import '../../scss/fonts'; -@import '../../scss/mixins'; -@import '../../scss/variables'; +@import "../../scss/fonts"; +@import "../../scss/mixins"; +@import "../../scss/variables"; .value-button { - display: flex; - flex-direction: column; - height: 180px; - padding: 24px 21px; - border-radius: 6px; - background: linear-gradient(207.65deg, $gray-10, $gray-midnight); + display: flex; + flex-direction: column; + height: 180px; + padding: 24px 21px; + border-radius: 6px; + background: linear-gradient(207.65deg, $gray-10, $gray-midnight); - .value-button--label { - @include font-size(12px); + .value-button--label { + @include font-size(12px); - color: $main-green; - font-family: $metropolis; - font-weight: bold; - text-transform: uppercase; - } + color: $main-green; + font-family: $metropolis; + font-weight: bold; + text-transform: uppercase; + } - .value-button--value { - @include font-size(28px); + .value-button--value { + @include font-size(28px); - margin: 30px 0; - color: $white; - font-family: $metropolis; - font-weight: bold; - text-align: center; - } + margin: 30px 0; + color: $white; + font-family: $metropolis; + font-weight: bold; + text-align: center; + } - .value-button--selector { - display: flex; - justify-content: center; - height: 40px; - padding: 10px; - border-radius: 6px; - background-color: rgba($gray-midnight, 0.3); + .value-button--selector { + display: flex; + justify-content: center; + height: 40px; + padding: 10px; + border-radius: 6px; + background-color: rgba($gray-midnight, 0.3); - button { - @include font-size(12px); + button { + @include font-size(12px); - display: flex; - justify-content: center; - width: 20px; - height: 20px; - padding: 0; - border: 0; - border-bottom: 2px solid transparent; - border-radius: 0; - background: none; - color: $gray; - font-family: $inter; - text-decoration: none; - cursor: pointer; + display: flex; + justify-content: center; + width: 20px; + height: 20px; + padding: 0; + border: 0; + border-bottom: 2px solid transparent; + border-radius: 0; + background: none; + color: $gray; + font-family: $inter; + text-decoration: none; + cursor: pointer; - + button { - margin-left: 15px; - } + + button { + margin-left: 15px; + } - &.selected { - border-bottom: 2px solid var(--link-highlight); - color: $white; - font-weight: bold; - } + &.selected { + border-bottom: 2px solid var(--link-highlight); + color: $white; + font-weight: bold; + } - &:hover { - text-decoration: none; - } + &:hover { + text-decoration: none; + } + } } - } } diff --git a/client/src/app/components/ValueButton.tsx b/client/src/app/components/ValueButton.tsx index 56227b857..fc7c065ba 100644 --- a/client/src/app/components/ValueButton.tsx +++ b/client/src/app/components/ValueButton.tsx @@ -19,7 +19,7 @@ class ValueButton extends Component { const bestUnits = UnitsHelper.calculateBest(props.value); this.state = { - units: bestUnits + units: bestUnits, }; } @@ -32,7 +32,7 @@ class ValueButton extends Component { const bestUnits = UnitsHelper.calculateBest(this.props.value); this.setState({ - units: bestUnits + units: bestUnits, }); } } @@ -44,14 +44,10 @@ class ValueButton extends Component { public render(): ReactNode { return (
      -
      - {this.props.label ?? "Value"} -
      -
      - {UnitsHelper.formatUnits(this.props.value, this.state.units)} -
      +
      {this.props.label ?? "Value"}
      +
      {UnitsHelper.formatUnits(this.props.value, this.state.units)}
      - {Object.keys(UnitsHelper.UNIT_MAP).map(unit => ( + {Object.keys(UnitsHelper.UNIT_MAP).map((unit) => ( )} - {!this.props.history && ( - {this.props.addressDetails.bech32} - )} + {!this.props.history && {this.props.addressDetails.bech32}} {this.props.showCopyButton && }
      )} {this.props.advancedMode && this.props.addressDetails?.typeLabel && this.props.addressDetails?.hex && (
      -
      - {this.props.addressDetails.typeLabel} Address -
      +
      {this.props.addressDetails.typeLabel} Address
      {this.props.history && ( )} - {!this.props.history && ( - {this.props.addressDetails?.hex} - )} + {!this.props.history && {this.props.addressDetails?.hex}}
      diff --git a/client/src/app/components/chrysalis/Feeds.tsx b/client/src/app/components/chrysalis/Feeds.tsx index c936a12d3..ebb2ebbdc 100644 --- a/client/src/app/components/chrysalis/Feeds.tsx +++ b/client/src/app/components/chrysalis/Feeds.tsx @@ -94,20 +94,18 @@ abstract class Feeds

      , S exten /** * Update formatted currencies. */ - protected updateCurrency(): void { - } + protected updateCurrency(): void {} /** * The items have been updated. * @param newItems The updated items. */ protected itemsUpdated(newItems: IFeedItem[]): void { - const isLatestMilestoneFeedInfoEnabled = this._networkConfig && - this._networkConfig.network !== LEGACY_MAINNET && - this._networkConfig.network !== CUSTOM; + const isLatestMilestoneFeedInfoEnabled = + this._networkConfig && this._networkConfig.network !== LEGACY_MAINNET && this._networkConfig.network !== CUSTOM; if (isLatestMilestoneFeedInfoEnabled && newItems) { - const milestones = newItems.filter(i => i.payloadType === "MS"); + const milestones = newItems.filter((i) => i.payloadType === "MS"); let newIndex; for (const ms of milestones) { const index: number | undefined = ms.properties?.index as number; @@ -126,20 +124,18 @@ abstract class Feeds

      , S exten * The confirmed items have been updated. * @param metaData The updated confirmed items. */ - protected metadataUpdated(metaData: { [id: string]: IFeedItemMetadata }): void { } + protected metadataUpdated(metaData: { [id: string]: IFeedItemMetadata }): void {} /** * Build the feeds for transactions. */ private buildItems(): void { if (this._feedClient) { - this._itemSubscriptionId = this._feedClient.subscribe( - (updatedItems, metadata) => { - if (this._isMounted) { - this.updateItems(updatedItems, metadata); - } + this._itemSubscriptionId = this._feedClient.subscribe((updatedItems, metadata) => { + if (this._isMounted) { + this.updateItems(updatedItems, metadata); } - ); + }); this.updateItems(this._feedClient.getItems(), {}); } @@ -179,26 +175,26 @@ abstract class Feeds

      , S exten private updateTps(): void { if (this._isMounted && this._apiClient && this._networkConfig) { // eslint-disable-next-line @typescript-eslint/no-floating-promises - this._apiClient.stats({ - network: this._networkConfig.network, - includeHistory: true - }).then(ips => { - const itemsPerSecond = ips.itemsPerSecond ?? 0; - const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; - const confirmedRate = ips.confirmationRate ? - (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; - - this.setState({ - itemsPerSecond: itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--", - confirmedItemsPerSecond: confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--", - confirmedItemsPerSecondPercent: confirmedRate > 0 - ? `${confirmedRate.toFixed(2)}%` : "--", - latestMilestoneIndex: this.state.latestMilestoneIndex ?? ips.latestMilestoneIndex, - // Increase values by +100 to add more area under the graph - itemsPerSecondHistory: (ips.itemsPerSecondHistory ?? []).map(v => v + 100) - }); - }) - .catch(err => { + this._apiClient + .stats({ + network: this._networkConfig.network, + includeHistory: true, + }) + .then((ips) => { + const itemsPerSecond = ips.itemsPerSecond ?? 0; + const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; + const confirmedRate = ips.confirmationRate ? (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; + + this.setState({ + itemsPerSecond: itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--", + confirmedItemsPerSecond: confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--", + confirmedItemsPerSecondPercent: confirmedRate > 0 ? `${confirmedRate.toFixed(2)}%` : "--", + latestMilestoneIndex: this.state.latestMilestoneIndex ?? ips.latestMilestoneIndex, + // Increase values by +100 to add more area under the graph + itemsPerSecondHistory: (ips.itemsPerSecondHistory ?? []).map((v) => v + 100), + }); + }) + .catch((err) => { console.error(err); }) .finally(() => { @@ -212,13 +208,10 @@ abstract class Feeds

      , S exten */ private initNetworkServices(): void { const networkService = ServiceFactory.get("network"); - this._networkConfig = this.props.match.params.network - ? networkService.get(this.props.match.params.network) - : undefined; + this._networkConfig = this.props.match.params.network ? networkService.get(this.props.match.params.network) : undefined; this._apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); - this._feedClient = ServiceFactory.get( - `feed-${this.props.match.params.network}`); + this._feedClient = ServiceFactory.get(`feed-${this.props.match.params.network}`); this.updateTps(); this.buildItems(); diff --git a/client/src/app/components/chrysalis/InclusionState.tsx b/client/src/app/components/chrysalis/InclusionState.tsx index 7a183b5ba..42951b9de 100644 --- a/client/src/app/components/chrysalis/InclusionState.tsx +++ b/client/src/app/components/chrysalis/InclusionState.tsx @@ -16,7 +16,7 @@ class InclusionState extends Component { * The default props. */ public static defaultProps: InclusionStateProps = { - state: undefined + state: undefined, }; /** @@ -26,17 +26,11 @@ class InclusionState extends Component { public render(): ReactNode { return (

      - {this.props.state === undefined && ("The message is not yet referenced by a milestone.")} - {this.props.state === "included" && ( - "The message is referenced by a milestone, the transaction is included in the ledger." - )} - {this.props.state === "noTransaction" && ( - "The message is referenced by a milestone, the data is included in the ledger" + - ", but there is no value transfer." - )} - {this.props.state === "conflicting" && ( - "The message has a conflict and will not be included in the ledger." - )} + {this.props.state === undefined && "The message is not yet referenced by a milestone."} + {this.props.state === "included" && "The message is referenced by a milestone, the transaction is included in the ledger."} + {this.props.state === "noTransaction" && + "The message is referenced by a milestone, the data is included in the ledger" + ", but there is no value transfer."} + {this.props.state === "conflicting" && "The message has a conflict and will not be included in the ledger."}
      ); } diff --git a/client/src/app/components/chrysalis/IndexationPayload.tsx b/client/src/app/components/chrysalis/IndexationPayload.tsx index 02e7eec90..5f8861c8e 100644 --- a/client/src/app/components/chrysalis/IndexationPayload.tsx +++ b/client/src/app/components/chrysalis/IndexationPayload.tsx @@ -6,7 +6,6 @@ import { IndexationPayloadProps } from "./IndexationPayloadProps"; import { IndexationPayloadState } from "./IndexationPayloadState"; import Modal from "../../components/Modal"; - /** * Component which will display a indexation payload. */ @@ -19,7 +18,7 @@ class IndexationPayload extends Component
      -

      - Indexation Payload -

      +

      Indexation Payload

      @@ -62,10 +59,7 @@ class IndexationPayload extends Component Data
      - + )}
      diff --git a/client/src/app/components/chrysalis/MessageTangleState.scss b/client/src/app/components/chrysalis/MessageTangleState.scss index 5c8d4756a..ee608403f 100644 --- a/client/src/app/components/chrysalis/MessageTangleState.scss +++ b/client/src/app/components/chrysalis/MessageTangleState.scss @@ -5,67 +5,67 @@ @import "../../../scss/themes"; .messages-tangle-state { - display: flex; - align-items: center; + display: flex; + align-items: center; - @include tablet-down { - margin-top: 4px; - } + @include tablet-down { + margin-top: 4px; + } - .message-tangle-reference { - @include font-size(12px); + .message-tangle-reference { + @include font-size(12px); - color: $gray-5; - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; + color: $gray-5; + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; - .message-tangle-reference__link { - color: $blue-5; - cursor: pointer; + .message-tangle-reference__link { + color: $blue-5; + cursor: pointer; + } } - } - .message-tangle-state { - @include font-size(12px); + .message-tangle-state { + @include font-size(12px); - display: flex; - align-items: center; - height: 24px; - margin-left: 16px; - padding: 0 8px; - border: 0; - border-radius: 6px; - outline: none; - background-color: $gray-light; - color: $gray-midnight; - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - white-space: nowrap; + display: flex; + align-items: center; + height: 24px; + margin-left: 16px; + padding: 0 8px; + border: 0; + border-radius: 6px; + outline: none; + background-color: $gray-light; + color: $gray-midnight; + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + white-space: nowrap; - &.message-tangle-state__confirmed { - background-color: var(--message-confirmed-bg); - color: $mint-green-7; - } + &.message-tangle-state__confirmed { + background-color: var(--message-confirmed-bg); + color: $mint-green-7; + } - &.message-tangle-state__conflicting { - background-color: var(--message-conflicting-bg); - color: $error; - } + &.message-tangle-state__conflicting { + background-color: var(--message-conflicting-bg); + color: $error; + } - &.message-tangle-state__milestone { - background-color: $mint-green-1; - color: $mint-green-7; - } + &.message-tangle-state__milestone { + background-color: $mint-green-1; + color: $mint-green-7; + } - &.message-tangle-state__pending { - background-color: var(--light-bg); - color: #8493ad; - } + &.message-tangle-state__pending { + background-color: var(--light-bg); + color: #8493ad; + } - &.confirmation__no-click { - pointer-events: none; + &.confirmation__no-click { + pointer-events: none; + } } - } } diff --git a/client/src/app/components/chrysalis/MessageTangleState.tsx b/client/src/app/components/chrysalis/MessageTangleState.tsx index a6fa7ab21..07012d50b 100644 --- a/client/src/app/components/chrysalis/MessageTangleState.tsx +++ b/client/src/app/components/chrysalis/MessageTangleState.tsx @@ -24,11 +24,9 @@ class MessageTangleState extends AsyncComponent( - `tangle-cache-${CHRYSALIS}` - ); + this._tangleCacheService = ServiceFactory.get(`tangle-cache-${CHRYSALIS}`); this.state = { - messageId: "" + messageId: "", }; } @@ -58,71 +56,72 @@ class MessageTangleState extends AsyncComponent - {this.props.status === "referenced" && + {this.props.status === "referenced" && (
      + {this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 ? ( +
      + Referenced by{" "} + { + if (this.props.onClick) { + this.props.onClick(this.state.messageId); + } + }} + > + Milestone {this.props.milestoneIndex} + {" "} + {this.state.timestamp} +
      + ) : ( + "" + )} +
      + )} - {this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 - ? ( -
      - Referenced by {" "} - { - if (this.props.onClick) { - this.props.onClick(this.state.messageId); - } - }} - >Milestone {this.props.milestoneIndex} - - {" "} {this.state.timestamp} -
      - ) : ""} -
      } - - {this.props.status === "milestone" && + {this.props.status === "milestone" && (
      + {this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 ? ( +
      + { + if (this.props.onClick) { + this.props.onClick(this.state.messageId); + } + }} + > + Milestone {this.props.milestoneIndex} + {" "} + created at {this.state.timestamp} +
      + ) : ( + "" + )} +
      + )} - {this.props.milestoneIndex !== undefined && this.props.milestoneIndex > 1 - ? ( -
      - { - if (this.props.onClick) { - this.props.onClick(this.state.messageId); - } - }} - >Milestone {" "} {this.props.milestoneIndex} - - {" "} created at {this.state.timestamp} -
      - ) : ""} -
} - - {this.props.status !== "milestone" && + {this.props.status !== "milestone" && (
- {this.props.status === "unknown" && ("Unknown")} - {this.props.status === "referenced" && !this.props.hasConflicts && ("Confirmed")} - {this.props.status === "pending" && ("Pending")} - {this.props.hasConflicts && ("Conflicting")} -
} + {this.props.status === "unknown" && "Unknown"} + {this.props.status === "referenced" && !this.props.hasConflicts && "Confirmed"} + {this.props.status === "pending" && "Pending"} + {this.props.hasConflicts && "Conflicting"} +
+ )} ); } @@ -132,14 +131,11 @@ class MessageTangleState extends AsyncComponent { if (this.props.milestoneIndex) { - const result = await this._tangleCacheService.milestoneDetails( - this.props.network, this.props.milestoneIndex); + const result = await this._tangleCacheService.milestoneDetails(this.props.network, this.props.milestoneIndex); if (result) { this.setState({ - timestamp: result.timestamp - ? ` at ${DateHelper.formatShort(DateHelper.milliseconds(result.timestamp))}` - : undefined, - messageId: result.messageId + timestamp: result.timestamp ? ` at ${DateHelper.formatShort(DateHelper.milliseconds(result.timestamp))}` : undefined, + messageId: result.messageId, }); } } diff --git a/client/src/app/components/chrysalis/MessageTree.scss b/client/src/app/components/chrysalis/MessageTree.scss index 128e9aa05..028d7761a 100644 --- a/client/src/app/components/chrysalis/MessageTree.scss +++ b/client/src/app/components/chrysalis/MessageTree.scss @@ -5,78 +5,78 @@ @import "../../../scss/mixins"; .message-tree-title { - @include font-size(12px); + @include font-size(12px); - position: relative; - color: var(--header-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; + position: relative; + color: var(--header-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; - div { - position: absolute; - top: 0; + div { + position: absolute; + top: 0; - &.parents-title { - left: 0; - } + &.parents-title { + left: 0; + } - &.children-title { - transform: translateX(100%); + &.children-title { + transform: translateX(100%); + } } - } } .tree { - position: relative; - opacity: 1; + position: relative; + opacity: 1; - &.busy { - opacity: 0.5; - cursor: wait; - } + &.busy { + opacity: 0.5; + cursor: wait; + } - .parent, - .child, - .item, - .root { - @include font-size(12px); + .parent, + .child, + .item, + .root { + @include font-size(12px); - display: flex; - position: absolute; - align-items: center; - justify-content: center; - overflow: hidden; - border-radius: 4px; - background-color: var(--message-tree-bg); - color: var(--expanded-color); - font-family: $ibm-plex-mono; - font-weight: 400; - font-size: 0.65rem; - letter-spacing: 0.5px; - cursor: pointer; - } + display: flex; + position: absolute; + align-items: center; + justify-content: center; + overflow: hidden; + border-radius: 4px; + background-color: var(--message-tree-bg); + color: var(--expanded-color); + font-family: $ibm-plex-mono; + font-weight: 400; + font-size: 0.65rem; + letter-spacing: 0.5px; + cursor: pointer; + } - .parent { - padding: 8px 16px; - } + .parent { + padding: 8px 16px; + } - .root { - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background: rgba(0, 224, 202, 0.2); - color: $mint-green-7; - } + .root { + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background: rgba(0, 224, 202, 0.2); + color: $mint-green-7; + } - .edge { - position: absolute; - z-index: -1; - width: 100%; - height: 100%; + .edge { + position: absolute; + z-index: -1; + width: 100%; + height: 100%; - line { - stroke: var(--message-tree-bg); + line { + stroke: var(--message-tree-bg); + } } - } } diff --git a/client/src/app/components/chrysalis/MessageTree.tsx b/client/src/app/components/chrysalis/MessageTree.tsx index fd7f98fdf..7b51f833a 100644 --- a/client/src/app/components/chrysalis/MessageTree.tsx +++ b/client/src/app/components/chrysalis/MessageTree.tsx @@ -11,7 +11,7 @@ const DESKTOP_CONFIG: TreeConfig = { verticalSpace: 20, horizontalSpace: 80, itemHeight: 40, - itemWidth: 300 + itemWidth: 300, }; /** @@ -21,7 +21,7 @@ const MOBILE_CONFIG: TreeConfig = { verticalSpace: 18, horizontalSpace: 16, itemHeight: 24, - itemWidth: 98 + itemWidth: 98, }; /** @@ -41,7 +41,7 @@ class MessageTree extends Component { items: [], edges: [], currentMessage: this.props.messageId, - isBusy: false + isBusy: false, }; } @@ -52,14 +52,13 @@ class MessageTree extends Component { window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); window.addEventListener("resize", this.resize.bind(this)); this.resize(); this.loadItemsUI(); } - public resize() { const isMobile = window.innerWidth < 768; const config = isMobile ? MOBILE_CONFIG : DESKTOP_CONFIG; @@ -68,13 +67,15 @@ class MessageTree extends Component { this.setState( { config, - width: (config.itemWidth * 3) + (config.horizontalSpace * 2), - height: (Math.max(this.props.parentsIds.length, this.props.childrenIds.length) * - (config.itemHeight + config.verticalSpace)) - - config.verticalSpace - }, () => { + width: config.itemWidth * 3 + config.horizontalSpace * 2, + height: + Math.max(this.props.parentsIds.length, this.props.childrenIds.length) * (config.itemHeight + config.verticalSpace) - + config.verticalSpace, + }, + () => { this.loadItemsUI(); - }); + }, + ); } } @@ -84,7 +85,7 @@ class MessageTree extends Component { window.scrollTo({ left: 0, top: top - OFFSET, - behavior: "smooth" + behavior: "smooth", }); } @@ -92,13 +93,16 @@ class MessageTree extends Component { if (prevProps !== this.props) { this.setState( { - height: (Math.max(this.props.parentsIds.length, this.props.childrenIds.length) * - (this.state.config.itemHeight + this.state.config.verticalSpace)) - - this.state.config.verticalSpace - }, () => { + height: + Math.max(this.props.parentsIds.length, this.props.childrenIds.length) * + (this.state.config.itemHeight + this.state.config.verticalSpace) - + this.state.config.verticalSpace, + }, + () => { this.loadItemsUI(); this.setState({ isBusy: false }); - }); + }, + ); } } @@ -117,17 +121,16 @@ class MessageTree extends Component {
- {/* Headings */}
Parents
- {this.state.items?.some(item => item.type === "child") && ( + {this.state.items?.some((item) => item.type === "child") && (
Children @@ -139,12 +142,11 @@ class MessageTree extends Component { className={classNames("tree", { busy: this.state.isBusy })} style={{ height: `${this.state.height}px`, - width: `${this.state.width}px` + width: `${this.state.width}px`, }} > - {/* Parents and Children */} - {this.state.items?.map(item => ( + {this.state.items?.map((item) => (
{ right: item.type === "child" ? "0" : "none", top: `${item.top}px`, wordBreak: this.state.config === DESKTOP_CONFIG ? "break-word" : "normal", - textAlign: "center" + textAlign: "center", }} className="parent" key={item.id} @@ -164,11 +166,13 @@ class MessageTree extends Component { }); }} > - { - this.state.config === DESKTOP_CONFIG - ? item.id - : {item.id.slice(0, 4)}...{item.id.slice(-4)} - } + {this.state.config === DESKTOP_CONFIG ? ( + item.id + ) : ( + + {item.id.slice(0, 4)}...{item.id.slice(-4)} + + )}
))} @@ -179,72 +183,62 @@ class MessageTree extends Component { height: `${this.state.config.itemHeight}px`, width: `${this.state.config.itemWidth}px`, wordBreak: this.state.config === DESKTOP_CONFIG ? "break-word" : "normal", - textAlign: "center" + textAlign: "center", }} > - { - this.state.config === DESKTOP_CONFIG - ? this.state.currentMessage - // eslint-disable-next-line max-len - : {this.state.currentMessage.slice(0, 4)}...{this.state.currentMessage.slice(-4)} - } + {this.state.config === DESKTOP_CONFIG ? ( + this.state.currentMessage + ) : ( + // eslint-disable-next-line max-len + + {this.state.currentMessage.slice(0, 4)}...{this.state.currentMessage.slice(-4)} + + )}
{/* Edges */} - {this.state.edges?.map(edge => - ( - - ) - )} + {this.state.edges?.map((edge) => ( + + ))}
- + ); } - private loadItemsUI(): void { - const parentsHeight = ((this.state.config.itemHeight + this.state.config.verticalSpace) * - this.props.parentsIds.length) - this.state.config.verticalSpace; - const childrenHeight = ((this.state.config.itemHeight + this.state.config.verticalSpace) * - this.props.childrenIds.length) - this.state.config.verticalSpace; + const parentsHeight = + (this.state.config.itemHeight + this.state.config.verticalSpace) * this.props.parentsIds.length - + this.state.config.verticalSpace; + const childrenHeight = + (this.state.config.itemHeight + this.state.config.verticalSpace) * this.props.childrenIds.length - + this.state.config.verticalSpace; const parentsOffsetTop = childrenHeight > parentsHeight ? (childrenHeight - parentsHeight) / 2 : 0; const childrenOffsetTop = parentsHeight > childrenHeight ? (parentsHeight - childrenHeight) / 2 : 0; - const parents: ItemUI[] = this.props.parentsIds.map((parent, i) => ( - { - top: ((this.state.config.itemHeight + this.state.config.verticalSpace) * i) + parentsOffsetTop, - id: parent, - type: "parent" - } - )); + const parents: ItemUI[] = this.props.parentsIds.map((parent, i) => ({ + top: (this.state.config.itemHeight + this.state.config.verticalSpace) * i + parentsOffsetTop, + id: parent, + type: "parent", + })); const children: ItemUI[] = this.props.childrenIds.map((child, i) => ({ - top: ((this.state.config.itemHeight + this.state.config.verticalSpace) * i) + childrenOffsetTop, + top: (this.state.config.itemHeight + this.state.config.verticalSpace) * i + childrenOffsetTop, id: child, - type: "child" + type: "child", })); const items: ItemUI[] = parents.concat(children); - const edges: EdgeUI[] = items.map((item, i) => - ({ + const edges: EdgeUI[] = items.map((item, i) => ({ id: `edge--${item.type}-${item.id}`, - x1: item.type === "parent" ? this.state.config.itemWidth : (this.state.width) - this.state.config.itemWidth, - x2: ((this.state.width) - (this.state.config.itemWidth * (item.type === "parent" ? 1 : -1))) * 0.5, - y1: item.top + (this.state.config.itemHeight * 0.5), - y2: Math.max(parentsHeight, childrenHeight) * 0.5 - } - )); + x1: item.type === "parent" ? this.state.config.itemWidth : this.state.width - this.state.config.itemWidth, + x2: (this.state.width - this.state.config.itemWidth * (item.type === "parent" ? 1 : -1)) * 0.5, + y1: item.top + this.state.config.itemHeight * 0.5, + y2: Math.max(parentsHeight, childrenHeight) * 0.5, + })); this.setState({ items, edges }); } } diff --git a/client/src/app/components/chrysalis/MessageTreeProps.tsx b/client/src/app/components/chrysalis/MessageTreeProps.tsx index 5edd60db6..091948877 100644 --- a/client/src/app/components/chrysalis/MessageTreeProps.tsx +++ b/client/src/app/components/chrysalis/MessageTreeProps.tsx @@ -1,4 +1,3 @@ - export interface MessageTreeProps { parentsIds: string[]; childrenIds: string[]; diff --git a/client/src/app/components/chrysalis/MilestonePayload.scss b/client/src/app/components/chrysalis/MilestonePayload.scss index 68d3ad8a2..7593754d7 100644 --- a/client/src/app/components/chrysalis/MilestonePayload.scss +++ b/client/src/app/components/chrysalis/MilestonePayload.scss @@ -5,60 +5,60 @@ @import "../../../scss/themes"; .milestone-payload { - .milestone-action { - @include font-size(14px, 21px); + .milestone-action { + @include font-size(14px, 21px); - position: relative; - width: 120px; - padding: 9px; - border: 1px solid $gray-3; - border-radius: 6px; - background: var(--light-bg); - color: var(--expanded-color); - font-family: $inter; - font-weight: 400; - letter-spacing: 0.5px; - text-align: center; - text-decoration: none; - cursor: pointer; + position: relative; + width: 120px; + padding: 9px; + border: 1px solid $gray-3; + border-radius: 6px; + background: var(--light-bg); + color: var(--expanded-color); + font-family: $inter; + font-weight: 400; + letter-spacing: 0.5px; + text-align: center; + text-decoration: none; + cursor: pointer; - @include tablet-down { - width: 32px; - height: 32px; - border-radius: 100%; - } + @include tablet-down { + width: 32px; + height: 32px; + border-radius: 100%; + } - span { - width: 100%; + span { + width: 100%; - @include tablet-down { - display: none; - } - } + @include tablet-down { + display: none; + } + } - svg { - display: none; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); + svg { + display: none; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); - path { - stroke: var(--body-color); - } + path { + stroke: var(--body-color); + } - @include tablet-down { - display: block; - } - } + @include tablet-down { + display: block; + } + } - &:hover { - color: var(--link-highlight); - } + &:hover { + color: var(--link-highlight); + } - &:disabled { - opacity: 0.3; - pointer-events: none; + &:disabled { + opacity: 0.3; + pointer-events: none; + } } - } } diff --git a/client/src/app/components/chrysalis/MilestonePayload.tsx b/client/src/app/components/chrysalis/MilestonePayload.tsx index beb11fe9f..3b1b40d7c 100644 --- a/client/src/app/components/chrysalis/MilestonePayload.tsx +++ b/client/src/app/components/chrysalis/MilestonePayload.tsx @@ -29,12 +29,11 @@ class MilestonePayload extends AsyncComponent(`tangle-cache-${CHRYSALIS}`); - this.state = { nextIndex: -1, previousIndex: -1, hasPrevious: false, - hasNext: false + hasNext: false, }; } @@ -56,9 +55,7 @@ class MilestonePayload extends AsyncComponent
-

- Milestone Payload -

+

Milestone Payload

{(this.state.hasPrevious || this.state.hasNext) && ( @@ -66,90 +63,61 @@ class MilestonePayload extends AsyncComponent - this.loadIndex(this.state.previousIndex.toString(), true)} + onClick={async () => this.loadIndex(this.state.previousIndex.toString(), true)} className="milestone-action margin-r-t" > Previous -
)}
-
- Index -
-
- {this.props.payload.index} -
+
Index
+
{this.props.payload.index}
-
- Date -
+
Date
- {this.props.payload.timestamp && DateHelper.format( - DateHelper.milliseconds( - this.props.payload.timestamp - ) - )} + {this.props.payload.timestamp && DateHelper.format(DateHelper.milliseconds(this.props.payload.timestamp))}
{this.props.advancedMode && (
-
- Inclusion Merkle Proof -
-
- {this.props.payload.inclusionMerkleProof} -
+
Inclusion Merkle Proof
+
{this.props.payload.inclusionMerkleProof}
{this.props.payload.nextPoWScore !== 0 && this.props.payload.nextPoWScoreMilestoneIndex !== 0 && (
-
- Next PoW Score -
-
- {this.props.payload.nextPoWScore} -
+
Next PoW Score
+
{this.props.payload.nextPoWScore}
- -
- Next PoW Score Milestone Index -
-
- {this.props.payload.nextPoWScoreMilestoneIndex} -
+
Next PoW Score Milestone Index
+
{this.props.payload.nextPoWScoreMilestoneIndex}
)} {this.props.payload.publicKeys && (
-
- Public Keys -
+
Public Keys
- {this.props.payload.publicKeys?.map(pubKey => ( + {this.props.payload.publicKeys?.map((pubKey) => (
{pubKey}
@@ -158,11 +126,9 @@ class MilestonePayload extends AsyncComponent )}
-
- Signatures -
+
Signatures
- {this.props.payload.signatures.map(sig => ( + {this.props.payload.signatures.map((sig) => (
{sig}
@@ -181,27 +147,28 @@ class MilestonePayload extends AsyncComponent { - const result = await this._tangleCacheService.milestoneDetails( - this.props.network, Number.parseInt(index, 10)); + const result = await this._tangleCacheService.milestoneDetails(this.props.network, Number.parseInt(index, 10)); if (result) { window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); - this.setState({ - milestone: result - }, async () => { - await this.checkForAdjacentMilestones(); - if (updateUrl) { - window.location.href = `/${this.props.network}/message/${this.state.milestone?.messageId}`; - } - }); + this.setState( + { + milestone: result, + }, + async () => { + await this.checkForAdjacentMilestones(); + if (updateUrl) { + window.location.href = `/${this.props.network}/message/${this.state.milestone?.messageId}`; + } + }, + ); } else { - this.props.history.replace(`/${this.props.network - }/search/${index}`); + this.props.history.replace(`/${this.props.network}/search/${index}`); } } @@ -216,15 +183,13 @@ class MilestonePayload extends AsyncComponent 0) { - const resultPrevious = await this._tangleCacheService.milestoneDetails( - this.props.network, previousIndex); + const resultPrevious = await this._tangleCacheService.milestoneDetails(this.props.network, previousIndex); if (resultPrevious) { hasPrevious = true; } } - const resultNext = await this._tangleCacheService.milestoneDetails( - this.props.network, nextIndex); + const resultNext = await this._tangleCacheService.milestoneDetails(this.props.network, nextIndex); if (resultNext) { hasNext = true; } @@ -233,7 +198,7 @@ class MilestonePayload extends AsyncComponent { constructor(props: QRProps) { super(props); this.state = { - cells: [] + cells: [], }; } @@ -51,7 +51,7 @@ class QR extends Component { height={this.size} viewBox={`0 0 ${this.state.cells.length} ${this.state.cells.length}`} > - {this.state.cells.map((row, rowIndex) => ( + {this.state.cells.map((row, rowIndex) => row.map((cell, cellIndex) => ( { width={1} x={cellIndex} y={rowIndex} - />) - ) - ))} + /> + )), + )}
{QR.LABEL}
diff --git a/client/src/app/components/chrysalis/ReceiptPayload.tsx b/client/src/app/components/chrysalis/ReceiptPayload.tsx index a37888e93..2a9f98980 100644 --- a/client/src/app/components/chrysalis/ReceiptPayload.tsx +++ b/client/src/app/components/chrysalis/ReceiptPayload.tsx @@ -25,14 +25,12 @@ class ReceiptPayload extends Component super(props); const networkService = ServiceFactory.get("network"); - const networkConfig = this.props.network - ? networkService.get(this.props.network) - : undefined; + const networkConfig = this.props.network ? networkService.get(this.props.network) : undefined; this._bech32Hrp = networkConfig?.bechHrp ?? "iota"; this.state = { - formatFull: false + formatFull: false, }; } @@ -47,84 +45,54 @@ class ReceiptPayload extends Component

Receipt Payload

-
- Migrated At -
-
- {this.props.payload.migratedAt} -
-
- Final -
+
Migrated At
+
{this.props.payload.migratedAt}
+
Final
-
- {this.props.payload.final ? "Yes" : "No"} -
+
{this.props.payload.final ? "Yes" : "No"}
{this.props.payload.funds.map((f, idx) => ( -
+

Migrated Fund {idx}

-
- Tail Transaction Hash -
-
- {f.tailTransactionHash} -
+
Tail Transaction Hash
+
{f.tailTransactionHash}
-
- Deposit -
+
Deposit
))} -
- Input Transaction Milestone Id -
-
- {this.props.payload.transaction.input.milestoneId} -
-
- Output Transaction Amount to Treasury -
+
Input Transaction Milestone Id
+
{this.props.payload.transaction.input.milestoneId}
+
Output Transaction Amount to Treasury
    {pages && pages.length > 0 && - pages.map(page => ( - this.resetExpandedDropdowns()} - > + pages.map((page) => ( + this.resetExpandedDropdowns()}>
  • - + {page.label}
  • - ))}
  • this.setState({ - isUtilitiesExpanded: !this.state.isUtilitiesExpanded - })} + isUtilitiesExpanded: !this.state.isUtilitiesExpanded, + }) + } >
    Utilities
    - - expand_more - + expand_more
  • {/* ----- Only visible in mobile ----- */} -
    - {utilities?.map(utility => ( + {utilities?.map((utility) => ( this.setState({ isMenuExpanded: false, - isNetworkSwitcherExpanded: false - })} + isNetworkSwitcherExpanded: false, + }) + } >
  • {utility.label}
  • @@ -290,24 +264,23 @@ class Header extends Component { isExpanded={this.state.isNetworkSwitcherExpanded} onClick={() => { this.setState({ - isNetworkSwitcherExpanded: - !this.state.isNetworkSwitcherExpanded, - isUtilitiesExpanded: false + isNetworkSwitcherExpanded: !this.state.isNetworkSwitcherExpanded, + isUtilitiesExpanded: false, }); }} - onChange={targetNetwork => { + onChange={(targetNetwork) => { history?.push( - action === "streams" ? - `/${targetNetwork}/streams/0/` : - (action === "visualizer" ? - `/${targetNetwork}/visualizer/` : - `/${targetNetwork}`) + action === "streams" + ? `/${targetNetwork}/streams/0/` + : action === "visualizer" + ? `/${targetNetwork}/visualizer/` + : `/${targetNetwork}`, ); }} />
    - + ); } @@ -318,7 +291,7 @@ class Header extends Component { this.setState({ isUtilitiesExpanded: false, isNetworkSwitcherExpanded: false, - isMenuExpanded: false + isMenuExpanded: false, }); } @@ -326,13 +299,16 @@ class Header extends Component { * Toggle the display mode. */ private toggleMode(): void { - this.setState({ - darkMode: !this.state.darkMode - }, () => { - this._settingsService.saveSingle("darkMode", this.state.darkMode); - const event = new CustomEvent("theme-change", { detail: { darkMode: this.state.darkMode } }); - window.dispatchEvent(event); - }); + this.setState( + { + darkMode: !this.state.darkMode, + }, + () => { + this._settingsService.saveSingle("darkMode", this.state.darkMode); + const event = new CustomEvent("theme-change", { detail: { darkMode: this.state.darkMode } }); + window.dispatchEvent(event); + }, + ); this.toggleModeClass(); } diff --git a/client/src/app/components/header/HeaderState.ts b/client/src/app/components/header/HeaderState.ts index 5bf99c2f0..a03913efb 100644 --- a/client/src/app/components/header/HeaderState.ts +++ b/client/src/app/components/header/HeaderState.ts @@ -2,7 +2,6 @@ * The state for the Header component. */ export interface HeaderState { - /** * Is the network switcher menu expanded. */ @@ -26,5 +25,5 @@ export interface HeaderState { /** * Show info modal on full page. */ - show: boolean; + show: boolean; } diff --git a/client/src/app/components/hoc/TabbedSection.scss b/client/src/app/components/hoc/TabbedSection.scss index 55eca338e..a9a5d803e 100644 --- a/client/src/app/components/hoc/TabbedSection.scss +++ b/client/src/app/components/hoc/TabbedSection.scss @@ -6,7 +6,7 @@ .tabbed-section { .tabbed-section--tabs-wrapper { display: flex; - margin-top:16px; + margin-top: 16px; border-bottom: 1px solid var(--border-color); overflow: auto; @@ -103,7 +103,6 @@ .tab-content { &:not(.active) { display: none; - }; + } } } - diff --git a/client/src/app/components/hoc/TabbedSection.tsx b/client/src/app/components/hoc/TabbedSection.tsx index 1db50f7b9..f252f47c2 100644 --- a/client/src/app/components/hoc/TabbedSection.tsx +++ b/client/src/app/components/hoc/TabbedSection.tsx @@ -85,58 +85,36 @@ const TabbedSection: React.FC = ({ tabsEnum, children, tabOp const tabsView = (
    {TABS.map((tab, idx) => { - const isDisabled = tabOptions ? - (tabOptions[tab]?.disabled === undefined ? false : tabOptions[tab].disabled) - : false; + const isDisabled = tabOptions ? (tabOptions[tab]?.disabled === undefined ? false : tabOptions[tab].disabled) : false; - const counter = tabOptions ? - (tabOptions[tab]?.counter === undefined ? 0 : tabOptions[tab].counter) - : 0; + const counter = tabOptions ? (tabOptions[tab]?.counter === undefined ? 0 : tabOptions[tab].counter) : 0; - const isLoading = tabOptions ? - (tabOptions[tab]?.isLoading === undefined ? false : tabOptions[tab].isLoading) - : false; + const isLoading = tabOptions ? (tabOptions[tab]?.isLoading === undefined ? false : tabOptions[tab].isLoading) : false; - const infoContent = tabOptions ? - (tabOptions[tab]?.infoContent === undefined ? undefined : tabOptions[tab].infoContent) + const infoContent = tabOptions + ? tabOptions[tab]?.infoContent === undefined + ? undefined + : tabOptions[tab].infoContent : undefined; - const hidden = tabOptions ? - (tabOptions[tab]?.hidden === undefined ? false : tabOptions[tab].hidden) - : false; + const hidden = tabOptions ? (tabOptions[tab]?.hidden === undefined ? false : tabOptions[tab].hidden) : false; return ( ); })} @@ -147,10 +125,7 @@ const TabbedSection: React.FC = ({ tabsEnum, children, tabOp
    {tabsView} {children.map((child, idx) => ( -
    +
    {child}
    ))} @@ -159,8 +134,7 @@ const TabbedSection: React.FC = ({ tabsEnum, children, tabOp }; TabbedSection.defaultProps = { - tabOptions: undefined + tabOptions: undefined, }; export default TabbedSection; - diff --git a/client/src/app/components/identity/IdentityChrysalisResolver.scss b/client/src/app/components/identity/IdentityChrysalisResolver.scss index 38d725141..2b6f26f12 100644 --- a/client/src/app/components/identity/IdentityChrysalisResolver.scss +++ b/client/src/app/components/identity/IdentityChrysalisResolver.scss @@ -4,122 +4,122 @@ @import "../../../scss/variables"; .did-error { - display: flex; - flex-direction: column; - justify-content: center; - width: 100%; - height: 300px; - - p { - @include font-size(14px, 21px); - - color: $error !important; - font-family: $inter; - letter-spacing: 0.5px; - text-align: center; - } + display: flex; + flex-direction: column; + justify-content: center; + width: 100%; + height: 300px; + + p { + @include font-size(14px, 21px); + + color: $error !important; + font-family: $inter; + letter-spacing: 0.5px; + text-align: center; + } } .wrapper { - display: flex; - justify-content: center; - - .inner { display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; + justify-content: center; - > .row { + .inner { + display: flex; + flex: 1; flex-direction: column; - } - } + max-width: $desktop-width; + margin: 40px 20px; - @include phone-down { - padding-right: 0; - padding-left: 0; - } + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; - .status { - @include font-size(14px); - } + > .row { + flex-direction: column; + } + } - .cards { - flex: 1; - margin-right: 24px; + @include phone-down { + padding-right: 0; + padding-left: 0; + } + + .status { + @include font-size(14px); + } - @include phone-down { - margin-right: unset; - } + .cards { + flex: 1; + margin-right: 24px; - .item-details { - @include font-size(14px); + @include phone-down { + margin-right: unset; + } - font-family: $metropolis; + .item-details { + @include font-size(14px); - .item-details-root { - word-break: break-all; + font-family: $metropolis; + + .item-details-root { + word-break: break-all; + } + } } - } } - } } .identity-json-header { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - width: 100%; - padding: 10px; - border: 1px solid $gray-3; - border-radius: 6px 6px 0 0; - background-color: var(--header-identity); - - a { - color: $gray; - - svg { - margin-right: 8px; - - path { - fill: var(--did-color); - } - - &:hover { - path { - fill: var(--body-color); + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 10px; + border: 1px solid $gray-3; + border-radius: 6px 6px 0 0; + background-color: var(--header-identity); + + a { + color: $gray; + + svg { + margin-right: 8px; + + path { + fill: var(--did-color); + } + + &:hover { + path { + fill: var(--body-color); + } + } } - } } - } } .json-wraper { - padding: 8px; - border: 1px solid $gray-3; - border-top: 0; + padding: 8px; + border: 1px solid $gray-3; + border-top: 0; - * { - word-break: break-all; - } + * { + word-break: break-all; + } } .legacy-method { - margin-bottom: 20px; - padding: 20px; - border-radius: 6px; - background-color: rgb(250, 247, 208); - color: $warning; - font-family: $metropolis; - - a { - color: $blue-5 !important; - } + margin-bottom: 20px; + padding: 20px; + border-radius: 6px; + background-color: rgb(250, 247, 208); + color: $warning; + font-family: $metropolis; + + a { + color: $blue-5 !important; + } } diff --git a/client/src/app/components/identity/IdentityChrysalisResolver.tsx b/client/src/app/components/identity/IdentityChrysalisResolver.tsx index d68d1b4f8..de8510122 100644 --- a/client/src/app/components/identity/IdentityChrysalisResolver.tsx +++ b/client/src/app/components/identity/IdentityChrysalisResolver.tsx @@ -57,7 +57,7 @@ class IdentityChrysalisResolver extends AsyncComponent< messageTangleStatus: "pending", resolvedHistory: undefined, historyError: false, - version: undefined + version: undefined, }; } @@ -68,10 +68,7 @@ class IdentityChrysalisResolver extends AsyncComponent< return; } - const res = await ServiceFactory.get("identity").resolveIdentity( - this.state.did, - this.props.match.params.network - ); + const res = await ServiceFactory.get("identity").resolveIdentity(this.state.did, this.props.match.params.network); if (typeof res.error === "object") { res.error = JSON.stringify(res.error); @@ -80,7 +77,7 @@ class IdentityChrysalisResolver extends AsyncComponent< if (res.error) { this.setState({ error: true, - errorMessage: res.error + errorMessage: res.error, }); return; } @@ -90,7 +87,7 @@ class IdentityChrysalisResolver extends AsyncComponent< resolvedIdentity: res, isIdentityResolved: true, latestMessageId: res.messageId ?? undefined, - version: res.version + version: res.version, }); await this.updateMessageDetails(res.messageId ?? ""); @@ -109,7 +106,6 @@ class IdentityChrysalisResolver extends AsyncComponent< IdentityDiffStorageService.instance.clearAll(); } - /** * Render the component. * @returns The node to render. @@ -119,9 +115,7 @@ class IdentityChrysalisResolver extends AsyncComponent<
    -

    - Decentralized Identifier -

    +

    Decentralized Identifier

    @@ -130,18 +124,13 @@ class IdentityChrysalisResolver extends AsyncComponent<
    - This DID was created by a deprecated version of the identity - {" "} - library. If this is your DID you can recreate it using the - {" "} + This DID was created by a deprecated version of the identity library. If this is your DID you can + recreate it using the{" "} - + latest version - . + + .
    )} @@ -149,24 +138,22 @@ class IdentityChrysalisResolver extends AsyncComponent<

    General

    - {!this.state.error && - !(this.state.latestMessageId === this.EMPTY_MESSAGE_ID) && ( - this.props.history.push( - `/${this.props.match.params.network - }/search/${messageId}`) - : undefined} - /> - )} + {!this.state.error && !(this.state.latestMessageId === this.EMPTY_MESSAGE_ID) && ( + + this.props.history.push(`/${this.props.match.params.network}/search/${messageId}`) + : undefined + } + /> + )}
    -
    DID
    @@ -176,17 +163,12 @@ class IdentityChrysalisResolver extends AsyncComponent<
    {this.state.resolvedIdentity && !this.state.error && - this.state.resolvedIdentity?.messageId !== - this.EMPTY_MESSAGE_ID && ( + this.state.resolvedIdentity?.messageId !== this.EMPTY_MESSAGE_ID && (
    Latest Message Id
    -
    - {this.state.resolvedIdentity?.messageId} -
    - +
    {this.state.resolvedIdentity?.messageId}
    +
    )} @@ -195,7 +177,8 @@ class IdentityChrysalisResolver extends AsyncComponent<
    -

    Content +

    + Content

    @@ -214,27 +197,19 @@ class IdentityChrysalisResolver extends AsyncComponent<
    { this.props.history.push( // eslint-disable-next-line max-len - `/${this.props.match.params.network}/message/${this.state.resolvedIdentity?.messageId}` + `/${this.props.match.params.network}/message/${this.state.resolvedIdentity?.messageId}`, ); }} />
    @@ -249,13 +224,7 @@ class IdentityChrysalisResolver extends AsyncComponent< card--value-textarea__json " > - +
    )} @@ -269,9 +238,9 @@ class IdentityChrysalisResolver extends AsyncComponent<
    - {this.state.isIdentityResolved && - this.state.version && - } + {this.state.isIdentityResolved && this.state.version && ( + + )}
); @@ -285,7 +254,7 @@ class IdentityChrysalisResolver extends AsyncComponent< this.setState({ metadata: details?.metadata, - messageTangleStatus: this.calculateStatus(details?.metadata) + messageTangleStatus: this.calculateStatus(details?.metadata), }); if (!details?.metadata?.referencedByMilestoneIndex) { diff --git a/client/src/app/components/identity/IdentityCompareDropdown.scss b/client/src/app/components/identity/IdentityCompareDropdown.scss index 50dec6e3f..0fa1a840b 100644 --- a/client/src/app/components/identity/IdentityCompareDropdown.scss +++ b/client/src/app/components/identity/IdentityCompareDropdown.scss @@ -4,171 +4,171 @@ @import "../../../scss/themes"; .identity-compare-dropdown { - .dropdown-wrapper { - position: relative; - padding-left: 12px; - - &::before { - content: ""; - position: absolute; - top: 50%; - left: 0; - width: 1px; - height: 24px; - transform: translateY(-50%); - background-color: $gray-3; - - @include tablet-down { - display: none; - } - } - } - - .noselect { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - .compare-selector { - display: flex; - align-items: center; - justify-content: space-between; - min-width: 150px; - height: 30px; - padding: 5px 10px; - transition: transform 0.2s ease; - border-radius: 5px; - white-space: nowrap; - - .close { - color: var(--expanded-color); - font-size: 16px; + .dropdown-wrapper { + position: relative; + padding-left: 12px; + + &::before { + content: ""; + position: absolute; + top: 50%; + left: 0; + width: 1px; + height: 24px; + transform: translateY(-50%); + background-color: $gray-3; + + @include tablet-down { + display: none; + } + } } - .dropdown { - transition: transform 0.2s ease; - color: var(--expanded-color); + .noselect { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } - &.opened { - span { - transform: rotate(-180deg); - } + .compare-selector { + display: flex; + align-items: center; + justify-content: space-between; + min-width: 150px; + height: 30px; + padding: 5px 10px; + transition: transform 0.2s ease; + border-radius: 5px; + white-space: nowrap; + + .close { + color: var(--expanded-color); + font-size: 16px; + } + + .dropdown { + transition: transform 0.2s ease; + color: var(--expanded-color); + } + + &.opened { + span { + transform: rotate(-180deg); + } + } + + .message-selected { + padding: 2px 8px; + border-radius: 6px; + background: rgba(20, 202, 191, 0.08); + + p { + color: var(--body-color); + font-family: $ibm-plex-mono; + font-weight: normal; + letter-spacing: 0.02em; + line-height: 20px; + + @include font-size(14px); + } + + .dropdown { + position: absolute; + top: 50%; + transform: translateY(-50%); + } + } + + img { + width: 13px; + margin-left: 10px; + transition: transform 0.2s ease; + } + + &:hover { + cursor: pointer; + } + + p { + @include phone-down { + font-size: 0.7em !important; + } + } } - .message-selected { - padding: 2px 8px; - border-radius: 6px; - background: rgba(20, 202, 191, 0.08); - - p { - color: var(--body-color); - font-family: $ibm-plex-mono; - font-weight: normal; - letter-spacing: 0.02em; - line-height: 20px; + p.dropdown-placeholder { + align-self: center; + color: var(--expanded-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; - @include font-size(14px); - } + @include font-size(12px, 18px); + } - .dropdown { + .dropdown-content { + display: flex; position: absolute; - top: 50%; - transform: translateY(-50%); - } + top: 45px; + flex-direction: column; + width: 200px; + max-height: 200px; + overflow-y: auto; + border: 1px solid $gray-3; + border-radius: 5px; + background-color: var(--body-background); + scrollbar-width: thin; + + &::-webkit-scrollbar { + width: 6px; + } } - img { - width: 13px; - margin-left: 10px; - transition: transform 0.2s ease; - } + .dropdown-item { + position: static; + width: 100%; + min-height: 52px; + overflow: hidden; + cursor: pointer; - &:hover { - cursor: pointer; + &:hover { + background-color: $light-green !important; + } } - p { - @include phone-down { - font-size: 0.7em !important; - } + .dropdown-item-selected { + background-color: var(--header-identity); } - } - - p.dropdown-placeholder { - align-self: center; - color: var(--expanded-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - - @include font-size(12px, 18px); - } - - .dropdown-content { - display: flex; - position: absolute; - top: 45px; - flex-direction: column; - width: 200px; - max-height: 200px; - overflow-y: auto; - border: 1px solid $gray-3; - border-radius: 5px; - background-color: var(--body-background); - scrollbar-width: thin; - - &::-webkit-scrollbar { - width: 6px; - } - } - .dropdown-item { - position: static; - width: 100%; - min-height: 52px; - overflow: hidden; - cursor: pointer; + .dropdown-item-title { + margin-top: 12px; + margin-left: 10px; - &:hover { - background-color: $light-green !important; + p { + margin-left: 10px; + } } - } - .dropdown-item-selected { - background-color: var(--header-identity); - } + .dropdown-item-timestamp { + margin-top: 7px; + margin-left: 30px; + } - .dropdown-item-title { - margin-top: 12px; - margin-left: 10px; + .reset-button { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + padding: 0 7px; + border: 0; + background: transparent; + } - p { - margin-left: 10px; + .dropdown-item-warning { + margin: 20px 5px; + color: $warning !important; } - } - - .dropdown-item-timestamp { - margin-top: 7px; - margin-left: 30px; - } - - .reset-button { - display: flex; - align-items: center; - justify-content: center; - height: 100%; - padding: 0 7px; - border: 0; - background: transparent; - } - - .dropdown-item-warning { - margin: 20px 5px; - color: $warning !important; - } } diff --git a/client/src/app/components/identity/IdentityCompareDropdown.tsx b/client/src/app/components/identity/IdentityCompareDropdown.tsx index 1ac8a921f..741e683b5 100644 --- a/client/src/app/components/identity/IdentityCompareDropdown.tsx +++ b/client/src/app/components/identity/IdentityCompareDropdown.tsx @@ -14,14 +14,14 @@ class IdentityCompareDropdown extends Component { + window.addEventListener("mouseup", (e) => { if (this.state.contentShown) { e.stopPropagation(); this.setState({ - contentShown: false + contentShown: false, }); } }); @@ -31,7 +31,7 @@ class IdentityCompareDropdown extends Component { + onMouseUp={(e) => { e.stopPropagation(); }} > @@ -39,37 +39,31 @@ class IdentityCompareDropdown extends Component { + onMouseUp={(e) => { e.stopPropagation(); }} - onClick={e => { + onClick={(e) => { e.stopPropagation(); this.setState({ - contentShown: !this.state.contentShown + contentShown: !this.state.contentShown, }); }} > {this.props.selectedMessage?.messageId ? (
+ - - -

- {IdentityHelper.shortenMsgId(this.props.selectedMessage.messageId)} -

+

{IdentityHelper.shortenMsgId(this.props.selectedMessage.messageId)}

{/* --------- Reset Button --------- */} {this.props.selectedMessage && ( )}
@@ -77,9 +71,7 @@ class IdentityCompareDropdown extends ComponentCompare with

)} - - arrow_drop_down - + arrow_drop_down
{/* --------- dropdown content --------- */} @@ -88,16 +80,15 @@ class IdentityCompareDropdown extends Component (
{ + onMouseUp={(e) => { e.stopPropagation(); }} - onClick={e => { + onClick={(e) => { this.setState({ - contentShown: !this.state.contentShown + contentShown: !this.state.contentShown, }); this.props.onSelectionChange(value); }} @@ -127,8 +118,6 @@ class IdentityCompareDropdown extends Component )}
- -
); } diff --git a/client/src/app/components/identity/IdentityCompareDropdownState.ts b/client/src/app/components/identity/IdentityCompareDropdownState.ts index 7760c7bf9..b65e9d69a 100644 --- a/client/src/app/components/identity/IdentityCompareDropdownState.ts +++ b/client/src/app/components/identity/IdentityCompareDropdownState.ts @@ -1,5 +1,4 @@ export interface IdentityCompareDropdownState { - /** * if the dropdown menu is shown. */ diff --git a/client/src/app/components/identity/IdentityHistory.scss b/client/src/app/components/identity/IdentityHistory.scss index 04449420d..a93583584 100644 --- a/client/src/app/components/identity/IdentityHistory.scss +++ b/client/src/app/components/identity/IdentityHistory.scss @@ -4,35 +4,35 @@ @import "../../../scss/variables"; .load-history-button { - justify-content: center; - width: 120px; - padding: 9px; - border: 1px solid #d8e1f4; - border-radius: 6px; - background: var(--light-bg); - color: var(--expanded-color); - font-family: $inter; - font-weight: 400; - letter-spacing: 0.5px; + justify-content: center; + width: 120px; + padding: 9px; + border: 1px solid #d8e1f4; + border-radius: 6px; + background: var(--light-bg); + color: var(--expanded-color); + font-family: $inter; + font-weight: 400; + letter-spacing: 0.5px; - @include font-size(14px); + @include font-size(14px); - &:hover { - text-decoration: none; - } + &:hover { + text-decoration: none; + } } .history-content { - display: flex; - align-items: center; + display: flex; + align-items: center; } .history-tree { - height: 100%; - margin-right: 20px; - margin-left: 0; + height: 100%; + margin-right: 20px; + margin-left: 0; - @include phone-down { - margin-right: 0; - } + @include phone-down { + margin-right: 0; + } } diff --git a/client/src/app/components/identity/IdentityHistory.tsx b/client/src/app/components/identity/IdentityHistory.tsx index 0084226b3..2999d2821 100644 --- a/client/src/app/components/identity/IdentityHistory.tsx +++ b/client/src/app/components/identity/IdentityHistory.tsx @@ -14,10 +14,10 @@ import { IdentityResolverProps } from "../../routes/IdentityResolverProps"; import Spinner from "../Spinner"; export default class IdentityHistory extends Component< - RouteComponentProps & {version: string}, + RouteComponentProps & { version: string }, IdentityHistoryState > { - constructor(props: RouteComponentProps & {version: string}) { + constructor(props: RouteComponentProps & { version: string }) { super(props); this.state = { @@ -26,7 +26,7 @@ export default class IdentityHistory extends Component< resolvedHistory: {}, selectedMessage: undefined, error: undefined, - compareWith: [] + compareWith: [], }; } @@ -87,18 +87,14 @@ export default class IdentityHistory extends Component< this.setState({ selectedMessage: selectedItem, compareWith: compareWith - ? compareWith.concat( - this.getPreviousMessages(selectedItem.parentMessageId ?? "", true) - ) + ? compareWith.concat(this.getPreviousMessages(selectedItem.parentMessageId ?? "", true)) : this.getPreviousMessages(selectedItem.messageId), - selectedComparisonMessage: undefined + selectedComparisonMessage: undefined, }); }} onDiffMessagesUpdate={() => { this.setState({ - compareWith: this.getPreviousMessages( - this.state.selectedMessage?.messageId ?? "" - ) + compareWith: this.getPreviousMessages(this.state.selectedMessage?.messageId ?? ""), }); }} /> @@ -108,9 +104,9 @@ export default class IdentityHistory extends Component< network={this.props.match.params.network} selectedMessage={this.state.selectedMessage} compareWith={this.state.compareWith} - onCompareSelectionChange={message => { + onCompareSelectionChange={(message) => { this.setState({ - selectedComparisonMessage: message + selectedComparisonMessage: message, }); }} selectedComparisonMessage={this.state.selectedComparisonMessage} @@ -133,9 +129,7 @@ export default class IdentityHistory extends Component< return []; } - const index = integrationChainData.findIndex( - (element: { messageId: string }) => element.messageId === messageId - ); + const index = integrationChainData.findIndex((element: { messageId: string }) => element.messageId === messageId); let previousMessages: IIdentityMessageWrapper[] = []; @@ -154,7 +148,7 @@ export default class IdentityHistory extends Component< document: integrationChainData[i].document, isDiff: false, message: integrationChainData[i].document, - messageId: integrationChainData[i].messageId + messageId: integrationChainData[i].messageId, }; previousMessages.push(msg); @@ -167,7 +161,7 @@ export default class IdentityHistory extends Component< window.history.replaceState( null, "", - `/${this.props.match.params.network}/identity-resolver/${this.props.match.params.did}?debugview=true` + `/${this.props.match.params.network}/identity-resolver/${this.props.match.params.did}?debugview=true`, ); if (!this.props.match.params.did) { @@ -179,7 +173,7 @@ export default class IdentityHistory extends Component< const res = await ServiceFactory.get("identity").resolveHistory( this.props.match.params.did, this.props.match.params.network, - this.props.version + this.props.version, ); // handle if response contains Error. @@ -189,7 +183,7 @@ export default class IdentityHistory extends Component< } this.setState({ error: res.error, - loadingHistory: false + loadingHistory: false, }); return; } @@ -206,12 +200,12 @@ export default class IdentityHistory extends Component< messageId: res.integrationChainData?.[0].messageId, message: res.integrationChainData?.[0].document, document: res.integrationChainData?.[0].document, - isDiff: false - } + isDiff: false, + }, }); this.setState({ - compareWith: this.getPreviousMessages(res.integrationChainData?.[0].messageId ?? "") + compareWith: this.getPreviousMessages(res.integrationChainData?.[0].messageId ?? ""), }); } } diff --git a/client/src/app/components/identity/IdentityHistoryState.ts b/client/src/app/components/identity/IdentityHistoryState.ts index 13477f03c..40f0e52df 100644 --- a/client/src/app/components/identity/IdentityHistoryState.ts +++ b/client/src/app/components/identity/IdentityHistoryState.ts @@ -2,7 +2,6 @@ import { IIdentityMessageWrapper } from "~models/identity/IIdentityMessageWrappe import { IIdentityDidHistoryResponse } from "~models/api/IIdentityDidHistoryResponse"; export interface IdentityHistoryState { - /** * if history data are already loaded from Server. */ diff --git a/client/src/app/components/identity/IdentityJsonCompare.scss b/client/src/app/components/identity/IdentityJsonCompare.scss index 716553108..f530d744e 100644 --- a/client/src/app/components/identity/IdentityJsonCompare.scss +++ b/client/src/app/components/identity/IdentityJsonCompare.scss @@ -4,146 +4,146 @@ @import "../../../scss/layout.scss"; .container { - width: 100%; + width: 100%; } .diff-wrapper { - border: 1px solid $gray-3; - border-top: 0; + border: 1px solid $gray-3; + border-top: 0; - * { - word-break: break-all; - } + * { + word-break: break-all; + } } .json-viewer { - @include font-size(12px, 20px); + @include font-size(12px, 20px); - color: var(--did-color); - font-family: $ibm-plex-mono; - letter-spacing: 0.02em; - white-space: pre-wrap; + color: var(--did-color); + font-family: $ibm-plex-mono; + letter-spacing: 0.02em; + white-space: pre-wrap; - .string { - color: green; - } + .string { + color: green; + } - .number { - color: darkorange; - } + .number { + color: darkorange; + } - .boolean { - color: blue; - } + .boolean { + color: blue; + } - .null { - color: magenta; - } + .null { + color: magenta; + } - .key { - color: var(--did-color); - } + .key { + color: var(--did-color); + } } .compare-elements { - display: flex; - flex-direction: row; - flex-wrap: wrap; - - .compare-icon { - align-self: center; - justify-self: center; - margin: 0 3px; - } - - @include tablet-down { display: flex; - flex-direction: column; - justify-content: center; - gap: 5px; + flex-direction: row; + flex-wrap: wrap; .compare-icon { - display: none; + align-self: center; + justify-self: center; + margin: 0 3px; } - } - @include desktop-down { - display: flex; - flex-direction: column; - justify-content: center; - gap: 5px; + @include tablet-down { + display: flex; + flex-direction: column; + justify-content: center; + gap: 5px; - .compare-icon { - display: none; + .compare-icon { + display: none; + } + } + + @include desktop-down { + display: flex; + flex-direction: column; + justify-content: center; + gap: 5px; + + .compare-icon { + display: none; + } } - } } .toggle-box { - display: flex; - flex-wrap: nowrap; - align-items: center; - justify-content: space-between; - height: 25px; - margin-right: 5px; - margin-left: 5px; - overflow: hidden; - border: 1px solid $gray-3; - border-radius: 5px; - cursor: pointer; - - @include phone-down { - flex-direction: column; - height: 50px; - } + display: flex; + flex-wrap: nowrap; + align-items: center; + justify-content: space-between; + height: 25px; + margin-right: 5px; + margin-left: 5px; + overflow: hidden; + border: 1px solid $gray-3; + border-radius: 5px; + cursor: pointer; + + @include phone-down { + flex-direction: column; + height: 50px; + } } .toggle-button { - height: 100%; - padding: 3px 8px; - color: var(--expanded-color); - font-family: $inter; - font-weight: 500; + height: 100%; + padding: 3px 8px; + color: var(--expanded-color); + font-family: $inter; + font-weight: 500; - @include font-size(12px, 18px); + @include font-size(12px, 18px); - @include phone-down { - width: 100%; - text-align: center; - } + @include phone-down { + width: 100%; + text-align: center; + } } .toggle-button-active { - background-color: $light-green; - color: var(--body-color); + background-color: $light-green; + color: var(--body-color); } .download-button { - margin-left: 8px; + margin-left: 8px; - svg { - path { - fill: var(--did-color); + svg { + path { + fill: var(--did-color); + } } - } } .toggle-separator { - width: 1px; - height: 100%; - background-color: $gray-3; + width: 1px; + height: 100%; + background-color: $gray-3; - @include phone-down { - width: 100%; - height: 1px; - } - - .no-select { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } + @include phone-down { + width: 100%; + height: 1px; + } + + .no-select { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } } diff --git a/client/src/app/components/identity/IdentityJsonCompare.tsx b/client/src/app/components/identity/IdentityJsonCompare.tsx index 919cb5e92..a33c4e663 100644 --- a/client/src/app/components/identity/IdentityJsonCompare.tsx +++ b/client/src/app/components/identity/IdentityJsonCompare.tsx @@ -15,7 +15,7 @@ class IdentityJsonCompare extends Component { + onSelectionChange={(selectedMessage) => { this.props.onCompareSelectionChange(selectedMessage); }} /> @@ -56,9 +56,9 @@ class IdentityJsonCompare extends Component { + onClick={(e) => { this.setState({ - toggleState: this.state.toggleState === "doc" ? "msg" : "doc" + toggleState: this.state.toggleState === "doc" ? "msg" : "doc", }); if (this.props.selectedMessage?.isDiff) { this.props.onCompareSelectionChange(); @@ -67,7 +67,7 @@ class IdentityJsonCompare extends Component @@ -124,39 +120,34 @@ class IdentityJsonCompare extends Component
@@ -184,7 +175,7 @@ class IdentityJsonCompare extends Component ); diff --git a/client/src/app/components/identity/IdentityJsonCompareProps.ts b/client/src/app/components/identity/IdentityJsonCompareProps.ts index 691d593ec..8716ef75d 100644 --- a/client/src/app/components/identity/IdentityJsonCompareProps.ts +++ b/client/src/app/components/identity/IdentityJsonCompareProps.ts @@ -30,5 +30,4 @@ export interface IdentityJsonCompareProps { * @param message message that has been clicked. */ onCompareSelectionChange(message?: IIdentityMessageWrapper): void; - } diff --git a/client/src/app/components/identity/IdentityMsgIdOverview.scss b/client/src/app/components/identity/IdentityMsgIdOverview.scss index b36038364..398a573c5 100644 --- a/client/src/app/components/identity/IdentityMsgIdOverview.scss +++ b/client/src/app/components/identity/IdentityMsgIdOverview.scss @@ -2,39 +2,39 @@ @import "../../../scss/mixins"; @import "../../../scss/variables"; -.identity-msg-id{ - .msg-id-overview { - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - width: fit-content; - min-width: 150px; - height: 30px; - padding: 6px 10px; - border-radius: 6px; - - p { - color: var(--body-color); - - &.code { - @include font-size(14px); - - font-family: $ibm-plex-mono; - font-weight: normal; - letter-spacing: 0.02em; - line-height: 20px; - } - } - - &.pointer { - &:hover { - cursor: pointer; - } - } - - svg { - margin-right: 10px; +.identity-msg-id { + .msg-id-overview { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: fit-content; + min-width: 150px; + height: 30px; + padding: 6px 10px; + border-radius: 6px; + + p { + color: var(--body-color); + + &.code { + @include font-size(14px); + + font-family: $ibm-plex-mono; + font-weight: normal; + letter-spacing: 0.02em; + line-height: 20px; + } + } + + &.pointer { + &:hover { + cursor: pointer; + } + } + + svg { + margin-right: 10px; + } } - } } diff --git a/client/src/app/components/identity/IdentityMsgStatusIcon.tsx b/client/src/app/components/identity/IdentityMsgStatusIcon.tsx index f6ee3428e..18899b1da 100644 --- a/client/src/app/components/identity/IdentityMsgStatusIcon.tsx +++ b/client/src/app/components/identity/IdentityMsgStatusIcon.tsx @@ -30,10 +30,7 @@ export default class IdentityMsgStatusIcon extends Component - + diff --git a/client/src/app/components/identity/IdentityMsgStatusIconProps.ts b/client/src/app/components/identity/IdentityMsgStatusIconProps.ts index a81fd9e90..275b2603b 100644 --- a/client/src/app/components/identity/IdentityMsgStatusIconProps.ts +++ b/client/src/app/components/identity/IdentityMsgStatusIconProps.ts @@ -1,6 +1,6 @@ import { IdentityMsgStatus } from "~models/identityMsgStatus"; -export interface IdentityMsgStatusIconProps{ +export interface IdentityMsgStatusIconProps { /** * status of the Identity Message */ diff --git a/client/src/app/components/identity/IdentitySearchInput.scss b/client/src/app/components/identity/IdentitySearchInput.scss index e53b8d3c6..064f4c50c 100644 --- a/client/src/app/components/identity/IdentitySearchInput.scss +++ b/client/src/app/components/identity/IdentitySearchInput.scss @@ -5,69 +5,69 @@ @import "../../../scss/themes"; .identity-search-input { - display: flex; - position: relative; - flex: 1; - flex-direction: row; - align-items: center; - width: 100%; - margin: 0; - backdrop-filter: blur(1px); + display: flex; + position: relative; + flex: 1; + flex-direction: row; + align-items: center; + width: 100%; + margin: 0; + backdrop-filter: blur(1px); - .identity-search--text-input { - @include font-size(14px); + .identity-search--text-input { + @include font-size(14px); - flex: 1; - height: 48px; - padding: 12px 12px 12px 52px; - transition: border-color 0.2s ease; - border: 1px solid var(--input-border-color); - border-radius: 6px; - background-color: transparent; - box-shadow: none; - color: var(--body-color); - font-family: $inter; + flex: 1; + height: 48px; + padding: 12px 12px 12px 52px; + transition: border-color 0.2s ease; + border: 1px solid var(--input-border-color); + border-radius: 6px; + background-color: transparent; + box-shadow: none; + color: var(--body-color); + font-family: $inter; - &::placeholder { - color: var(--input-border-color); - } + &::placeholder { + color: var(--input-border-color); + } - &:focus { - border-color: var(--input-focus-border-color); - } + &:focus { + border-color: var(--input-focus-border-color); + } - @include phone-down { - @include font-size(12px); + @include phone-down { + @include font-size(12px); - height: 32px; + height: 32px; + } } - } - p { - position: absolute; - top: 45px; - margin: 10px 0 !important; - color: $warning !important; - } + p { + position: absolute; + top: 45px; + margin: 10px 0 !important; + color: $warning !important; + } - &.identity-search-input--compact { - .identity-search--text-input { - @include font-size(12px); + &.identity-search-input--compact { + .identity-search--text-input { + @include font-size(12px); - height: 38px; - } + height: 38px; + } - p { - position: absolute; - top: 35px; - margin: 10px 0 !important; - color: $warning !important; + p { + position: absolute; + top: 35px; + margin: 10px 0 !important; + color: $warning !important; + } } - } - span { - position: absolute; - left: 16px; - color: var(--search-svg); - } + span { + position: absolute; + left: 16px; + color: var(--search-svg); + } } diff --git a/client/src/app/components/identity/IdentitySearchInput.tsx b/client/src/app/components/identity/IdentitySearchInput.tsx index 97088194d..a5f8522c7 100644 --- a/client/src/app/components/identity/IdentitySearchInput.tsx +++ b/client/src/app/components/identity/IdentitySearchInput.tsx @@ -18,7 +18,7 @@ class SearchInput extends AsyncComponent - - search - + search + onChange={(e) => this.setState({ - did: e.target.value, - isValid: this.isValid(e.target.value) - })} - onKeyPress={e => { + did: e.target.value, + isValid: this.isValid(e.target.value), + }) + } + onKeyPress={(e) => { if (e.key === "Enter") { this.doSearch(); } diff --git a/client/src/app/components/identity/IdentityStardustResolver.scss b/client/src/app/components/identity/IdentityStardustResolver.scss index 81cf8fd10..59ef866d5 100644 --- a/client/src/app/components/identity/IdentityStardustResolver.scss +++ b/client/src/app/components/identity/IdentityStardustResolver.scss @@ -5,35 +5,34 @@ @import "../../../scss/layout.scss"; .did-error { - display: flex; - flex-direction: column; - justify-content: center; - width: 100%; - height: 300px; + display: flex; + flex-direction: column; + justify-content: center; + width: 100%; + height: 300px; - p { - @include font-size(14px, 21px); + p { + @include font-size(14px, 21px); - color: $error !important; - font-family: $inter; - letter-spacing: 0.5px; - text-align: center; - } + color: $error !important; + font-family: $inter; + letter-spacing: 0.5px; + text-align: center; + } } .json-wraper-stardust-identity { - color: $gray; - padding: 8px; - border: 1px solid $gray-3 !important; - border-radius: 7px; + color: $gray; + padding: 8px; + border: 1px solid $gray-3 !important; + border-radius: 7px; - * { - word-break: break-all; - } + * { + word-break: break-all; + } } - // Override key color in JSON viewer. .key { - color: var(--did-color) !important; + color: var(--did-color) !important; } diff --git a/client/src/app/components/identity/IdentityStardustResolver.tsx b/client/src/app/components/identity/IdentityStardustResolver.tsx index ac675ea2d..3c2dceb43 100644 --- a/client/src/app/components/identity/IdentityStardustResolver.tsx +++ b/client/src/app/components/identity/IdentityStardustResolver.tsx @@ -1,5 +1,11 @@ import * as identity from "@iota/identity-wasm/web"; -import { DomainLinkageConfiguration, EdDSAJwsVerifier, JwtCredentialValidationOptions, JwtDomainLinkageValidator, LinkedDomainService } from "@iota/identity-wasm/web"; +import { + DomainLinkageConfiguration, + EdDSAJwsVerifier, + JwtCredentialValidationOptions, + JwtDomainLinkageValidator, + LinkedDomainService, +} from "@iota/identity-wasm/web"; import React, { Fragment, useEffect, useState } from "react"; import IdentityDomainResolver from "./domains/IdentityDomainResolver"; import { IdentityStardustResolverProps } from "./IdentityStardustResolverProps"; @@ -12,7 +18,6 @@ import Spinner from "../Spinner"; import { IIdentityStardustResolveResponse } from "~/models/api/IIdentityStardustResolveResponse"; const IdentityStardustResolver: React.FC = ({ resolvedDID, network }) => { - const [DID, setDID] = useState(""); const [governorAddress, setGovernorAddress] = useState(""); const [stateControllerAddress, setStateControllerAddress] = useState(""); @@ -24,15 +29,15 @@ const IdentityStardustResolver: React.FC = ({ res return; } - setDID(resolvedDID.document.doc.id as string ?? "") - setGovernorAddress(resolvedDID.document?.meta.governorAddress ?? "") - setStateControllerAddress(resolvedDID.document?.meta.stateControllerAddress ?? "") - setErrorMessage(resolvedDID.error ?? "") + setDID((resolvedDID.document.doc.id as string) ?? ""); + setGovernorAddress(resolvedDID.document?.meta.governorAddress ?? ""); + setStateControllerAddress(resolvedDID.document?.meta.stateControllerAddress ?? ""); + setErrorMessage(resolvedDID.error ?? ""); constructVerifiedDomains(resolvedDID).then((newVerifiedDomains) => { setVerifiedDomains(newVerifiedDomains); - }) - }, [resolvedDID]) + }); + }, [resolvedDID]); return (
@@ -42,58 +47,53 @@ const IdentityStardustResolver: React.FC = ({ res
- {resolvedDID?.document && - !errorMessage && ( - -
-
Governor
-
- -
-
State Controller
-
- -
-
Linked Domains
- -
- - - )} +
+
Linked Domains
+ +
+ + )}

DID Document

- {!resolvedDID && !errorMessage && (

Resolving DID ...

@@ -117,24 +117,15 @@ const IdentityStardustResolver: React.FC = ({ res card--value-textarea__json " > - +
)}
{resolvedDID && !errorMessage && ( -
-

- Metadata -

+

Metadata

- +
-
)}
); -} +}; // } export default IdentityStardustResolver; async function constructVerifiedDomains(resolvedDID: IIdentityStardustResolveResponse): Promise>> { - const newVerifiedDomains = new Map>(); await ServiceFactory.get("identity").initLibrary(); @@ -172,58 +155,58 @@ async function constructVerifiedDomains(resolvedDID: IIdentityStardustResolveRes // Get the Linked Domain Services from the DID Document. const linkedDomainServices = didDocument .service() - .filter(service => LinkedDomainService.isValid(service)) - .map(service => LinkedDomainService.fromService(service)); - + .filter((service) => LinkedDomainService.isValid(service)) + .map((service) => LinkedDomainService.fromService(service)); for (const entry of linkedDomainServices) { for (const domain of entry.domains()) { - newVerifiedDomains.set(domain, new Promise((resolve, reject) => { - // Note that according to the specs, the DID Configuration resource must exist - // at the origin's root, Well-Known Resource directory. - const configurationUrl = new URL("/.well-known/did-configuration.json", domain); - - return fetch(configurationUrl).then((response) => { - - return response.json().then((jsonResponse) => { - - let parsedConfigurationResource; - - try { - - parsedConfigurationResource = DomainLinkageConfiguration.fromJSON(jsonResponse); - - try { - new JwtDomainLinkageValidator(new EdDSAJwsVerifier()).validateLinkage( - didDocument, - parsedConfigurationResource, - domain, - new JwtCredentialValidationOptions() - ); - - // all good - resolve(); - } catch (err) { - - // return the error from the library - reject(err); - } - - } catch (err) { + newVerifiedDomains.set( + domain, + new Promise((resolve, reject) => { + // Note that according to the specs, the DID Configuration resource must exist + // at the origin's root, Well-Known Resource directory. + const configurationUrl = new URL("/.well-known/did-configuration.json", domain); + + return fetch(configurationUrl) + .then((response) => { + return response + .json() + .then((jsonResponse) => { + let parsedConfigurationResource; + + try { + parsedConfigurationResource = DomainLinkageConfiguration.fromJSON(jsonResponse); + + try { + new JwtDomainLinkageValidator(new EdDSAJwsVerifier()).validateLinkage( + didDocument, + parsedConfigurationResource, + domain, + new JwtCredentialValidationOptions(), + ); + + // all good + resolve(); + } catch (err) { + // return the error from the library + reject(err); + } + } catch (err) { + console.log(err); + reject(new Error(`Domain Linkage credential invalid domain ${domain}`)); + } + }) + .catch((err) => { + console.log(err); + reject(new Error(`could not parse configuration from domain ${domain}`)); + }); + }) + .catch((err) => { console.log(err); - reject(new Error(`Domain Linkage credential invalid domain ${domain}`)); - } - - }).catch((err) => { - console.log(err); - reject(new Error(`could not parse configuration from domain ${domain}`)); - }); - }).catch((err) => { - console.log(err); - reject(new Error(`could not fetch configuration from ${domain}, this could be a CORS error`)); - }); - - })); + reject(new Error(`could not fetch configuration from ${domain}, this could be a CORS error`)); + }); + }), + ); } } diff --git a/client/src/app/components/identity/IdentityStardustResolverProps.ts b/client/src/app/components/identity/IdentityStardustResolverProps.ts index fe3806e4a..10227c275 100644 --- a/client/src/app/components/identity/IdentityStardustResolverProps.ts +++ b/client/src/app/components/identity/IdentityStardustResolverProps.ts @@ -1,8 +1,7 @@ import { IIdentityStardustResolveResponse } from "~/models/api/IIdentityStardustResolveResponse"; export interface IdentityStardustResolverProps { - - resolvedDID: IIdentityStardustResolveResponse | null, + resolvedDID: IIdentityStardustResolveResponse | null; - network: string, + network: string; } diff --git a/client/src/app/components/identity/domains/IdentityDomainResolver.scss b/client/src/app/components/identity/domains/IdentityDomainResolver.scss index 9b87f33ef..f6da50221 100644 --- a/client/src/app/components/identity/domains/IdentityDomainResolver.scss +++ b/client/src/app/components/identity/domains/IdentityDomainResolver.scss @@ -4,4 +4,4 @@ .flex-wrap-wrap { flex-wrap: wrap; -} \ No newline at end of file +} diff --git a/client/src/app/components/identity/domains/IdentityDomainResolver.tsx b/client/src/app/components/identity/domains/IdentityDomainResolver.tsx index 25dd3df60..2180e7cb9 100644 --- a/client/src/app/components/identity/domains/IdentityDomainResolver.tsx +++ b/client/src/app/components/identity/domains/IdentityDomainResolver.tsx @@ -7,14 +7,11 @@ import "./IdentityDomainResolver.scss"; import Spinner from "../../Spinner"; import Tooltip from "../../Tooltip"; - -class IdentityDomainResolver extends AsyncComponent { +class IdentityDomainResolver extends AsyncComponent { constructor(props: IdentityDomainResolverProps) { super(props); this.state = { - verifiedDomainsPresentation: new Map() + verifiedDomainsPresentation: new Map(), }; } @@ -25,7 +22,7 @@ class IdentityDomainResolver extends AsyncComponent - {this.state.verifiedDomainsPresentation.size ? [...this.state.verifiedDomainsPresentation.keys()].map(key => ( -
- -
- {this.state.verifiedDomainsPresentation.get(key)?.status === Status.InFlight && - } - {this.state.verifiedDomainsPresentation.get(key)?.status === Status.Verified && - } - {this.state.verifiedDomainsPresentation.get(key)?.status === Status.Error && - ( - - - + {this.state.verifiedDomainsPresentation.size ? ( + [...this.state.verifiedDomainsPresentation.keys()].map((key) => ( +
+
+ {key} +
+
+ {this.state.verifiedDomainsPresentation.get(key)?.status === Status.InFlight && } + {this.state.verifiedDomainsPresentation.get(key)?.status === Status.Verified && ( + )} + {this.state.verifiedDomainsPresentation.get(key)?.status === Status.Error && ( + + + + )} +
-
- )) :
no linked domains
} + )) + ) : ( +
no linked domains
+ )}
); } @@ -69,23 +64,26 @@ class IdentityDomainResolver extends AsyncComponent { - this.setState({ - verifiedDomainsPresentation: new Map(this.state.verifiedDomainsPresentation).set(key, - { status: Status.Verified } - ) - }); - }).catch(err => { - this.setState({ - verifiedDomainsPresentation: new Map(this.state.verifiedDomainsPresentation).set(key, - { status: Status.Error, message: err.message } - ) + value + .then(() => { + this.setState({ + verifiedDomainsPresentation: new Map(this.state.verifiedDomainsPresentation).set(key, { + status: Status.Verified, + }), + }); + }) + .catch((err) => { + this.setState({ + verifiedDomainsPresentation: new Map(this.state.verifiedDomainsPresentation).set(key, { + status: Status.Error, + message: err.message, + }), + }); }); - }); } } this.setState({ - verifiedDomainsPresentation: newVerifiedDomainsPresentation + verifiedDomainsPresentation: newVerifiedDomainsPresentation, }); } } diff --git a/client/src/app/components/identity/domains/IdentityDomainResolverState.ts b/client/src/app/components/identity/domains/IdentityDomainResolverState.ts index 93f562360..7790a85bd 100644 --- a/client/src/app/components/identity/domains/IdentityDomainResolverState.ts +++ b/client/src/app/components/identity/domains/IdentityDomainResolverState.ts @@ -5,8 +5,11 @@ export enum Status { } export interface IdentityDomainResolverState { - verifiedDomainsPresentation: Map; + verifiedDomainsPresentation: Map< + string, + { + status: Status; + message?: string; + } + >; } diff --git a/client/src/app/components/identity/tree/IdentityTree.scss b/client/src/app/components/identity/tree/IdentityTree.scss index c14a03c24..3ba7e139d 100644 --- a/client/src/app/components/identity/tree/IdentityTree.scss +++ b/client/src/app/components/identity/tree/IdentityTree.scss @@ -1,11 +1,11 @@ .identity-tree { - min-width: 300px; - max-height: 400px; - overflow-x: hidden; - overflow-y: auto; - scrollbar-width: thin; + min-width: 300px; + max-height: 400px; + overflow-x: hidden; + overflow-y: auto; + scrollbar-width: thin; - &::-webkit-scrollbar { - width: 6px; - } + &::-webkit-scrollbar { + width: 6px; + } } diff --git a/client/src/app/components/identity/tree/IdentityTree.tsx b/client/src/app/components/identity/tree/IdentityTree.tsx index 7e498bcd1..8c01f8270 100644 --- a/client/src/app/components/identity/tree/IdentityTree.tsx +++ b/client/src/app/components/identity/tree/IdentityTree.tsx @@ -19,8 +19,8 @@ export default class IdentityMessageIdOverview extends Component { this.setState({ - selectedMessage: selectedItem ?? "" + selectedMessage: selectedItem ?? "", }); this.props.onItemClick(selectedItem, compareWith); }} diff --git a/client/src/app/components/identity/tree/IdentityTreeItem.scss b/client/src/app/components/identity/tree/IdentityTreeItem.scss index 68f593163..ca5bc40db 100644 --- a/client/src/app/components/identity/tree/IdentityTreeItem.scss +++ b/client/src/app/components/identity/tree/IdentityTreeItem.scss @@ -6,253 +6,253 @@ $item-height: 64px; .tree-item-container { - position: relative; - min-width: 200px; - height: $item-height; - margin-right: 10px; - border-radius: 6px; - overflow: hidden; - cursor: pointer; - - &:hover { - background: rgba(72, 87, 118, 0.08); - } - - .push-right { - left: 60px !important; - } - - .upper-left-straight-line { - position: absolute; - left: 25px; - width: 2px; - height: 33px; - background-color: #eeeeee; - } - - .msg-icon-left { - position: absolute; - z-index: 3; - top: 20px; - left: 20px; - } + position: relative; + min-width: 200px; + height: $item-height; + margin-right: 10px; + border-radius: 6px; + overflow: hidden; + cursor: pointer; - .msg-icon-right { - position: absolute; - z-index: 3; - top: 21px; - left: 44px; - } + &:hover { + background: rgba(72, 87, 118, 0.08); + } - .lower-left-straight-line { - position: absolute; - top: 31px; - left: 25px; - width: 2px; - height: 33px; - background-color: #eeeeee; - } + .push-right { + left: 60px !important; + } - .upper-right-straight-line { - position: absolute; - left: 48px; - width: 2px; - height: 33px; - background-color: #eeeeee; - } + .upper-left-straight-line { + position: absolute; + left: 25px; + width: 2px; + height: 33px; + background-color: #eeeeee; + } - .lower-right-straight-line { - position: absolute; - top: 31px; - left: 48px; - width: 2px; - height: 33px; - background-color: #eeeeee; - } - - .no-diff-title { - position: absolute; - top: 18px; - left: 60px; - color: $gray-5; - font-family: $inter; - letter-spacing: 0.5px; + .msg-icon-left { + position: absolute; + z-index: 3; + top: 20px; + left: 20px; + } - @include font-size(12px, 18px); - } + .msg-icon-right { + position: absolute; + z-index: 3; + top: 21px; + left: 44px; + } - .content { - display: flex; - position: absolute; - top: -5px; - left: 40px; - justify-content: space-between; - width: calc(100% - 50px); - margin-top: 12px !important; - margin-bottom: 12px; - padding: 8px; - border-radius: 6px; + .lower-left-straight-line { + position: absolute; + top: 31px; + left: 25px; + width: 2px; + height: 33px; + background-color: #eeeeee; + } - .title { - color: var(--expanded-color); - font-family: $ibm-plex-mono; - font-weight: 500; - letter-spacing: 0.02em; + .upper-right-straight-line { + position: absolute; + left: 48px; + width: 2px; + height: 33px; + background-color: #eeeeee; + } - @include font-size(12px, 16px); + .lower-right-straight-line { + position: absolute; + top: 31px; + left: 48px; + width: 2px; + height: 33px; + background-color: #eeeeee; } - .time-stamp { - color: $gray-5; - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; + .no-diff-title { + position: absolute; + top: 18px; + left: 60px; + color: $gray-5; + font-family: $inter; + letter-spacing: 0.5px; - @include font-size(12px, 18px); + @include font-size(12px, 18px); } - .diff-icon-active { - svg { - path { - fill: $gray; + .content { + display: flex; + position: absolute; + top: -5px; + left: 40px; + justify-content: space-between; + width: calc(100% - 50px); + margin-top: 12px !important; + margin-bottom: 12px; + padding: 8px; + border-radius: 6px; + + .title { + color: var(--expanded-color); + font-family: $ibm-plex-mono; + font-weight: 500; + letter-spacing: 0.02em; + + @include font-size(12px, 16px); } - } - } - .diff-icon { - display: flex; - position: relative; - align-items: center; - justify-content: center; - width: 30px; - height: 30px; - - &:hover { - svg { - path { - fill: var(--did-color); - } + .time-stamp { + color: $gray-5; + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + + @include font-size(12px, 18px); + } + + .diff-icon-active { + svg { + path { + fill: $gray; + } + } + } + + .diff-icon { + display: flex; + position: relative; + align-items: center; + justify-content: center; + width: 30px; + height: 30px; + + &:hover { + svg { + path { + fill: var(--did-color); + } + } + } } - } } - } } .loading-diff-icon { - position: absolute; - z-index: 3; - top: 22px; - left: 43px; - width: 10px; - height: 10px; - animation: diff-anim 1s; - animation-iteration-count: infinite; - border: solid $gray-5 1px; - border-radius: 5px; - background-color: $gray-light; + position: absolute; + z-index: 3; + top: 22px; + left: 43px; + width: 10px; + height: 10px; + animation: diff-anim 1s; + animation-iteration-count: infinite; + border: solid $gray-5 1px; + border-radius: 5px; + background-color: $gray-light; } .no-diff-icon { - position: absolute; - z-index: 3; - top: 22px; - left: 43px; - width: 10px; - height: 10px; - border-radius: 50%; - background-color: $gray-5; + position: absolute; + z-index: 3; + top: 22px; + left: 43px; + width: 10px; + height: 10px; + border-radius: 50%; + background-color: $gray-5; } @keyframes diff-anim { - from { - border: solid $gray-5 4px; - } + from { + border: solid $gray-5 4px; + } - to { - border: solid $gray-5 0; - } + to { + border: solid $gray-5 0; + } } .loading-diff-title { - position: absolute; - top: 22px; - left: 60px; - color: $gray-5; - font-family: $metropolis; - font-size: 0.8em; + position: absolute; + top: 22px; + left: 60px; + color: $gray-5; + font-family: $metropolis; + font-size: 0.8em; } .expand-animation { - -webkit-animation-name: expand; - animation-name: expand; - -webkit-animation-duration: 0.5s; - animation-duration: 0.8s; - -webkit-animation-fill-mode: both; - animation-fill-mode: both; + -webkit-animation-name: expand; + animation-name: expand; + -webkit-animation-duration: 0.5s; + animation-duration: 0.8s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; } @-webkit-keyframes expand { - 0% { - height: 0; - } + 0% { + height: 0; + } - 100% { - height: $item-height; - } + 100% { + height: $item-height; + } } @keyframes expand { - 0% { - height: 0; - } + 0% { + height: 0; + } - 100% { - height: $item-height; - } + 100% { + height: $item-height; + } } .tree-item-selected { - background: rgba(20, 202, 191, 0.08); + background: rgba(20, 202, 191, 0.08); } .no-select { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .backward-curved-line { - position: absolute; - z-index: 2; - top: -33px; - left: 26px; + position: absolute; + z-index: 2; + top: -33px; + left: 26px; } .identity-item-wrapper { - position: relative; + position: relative; } .forward-curved-line { - position: absolute; - z-index: 2; - top: 28px; - left: 25px; + position: absolute; + z-index: 2; + top: 28px; + left: 25px; } .fade-animation { - animation-name: fade-anim; - animation-duration: 1s; + animation-name: fade-anim; + animation-duration: 1s; } @keyframes fade-anim { - 0% { - opacity: 0; - } + 0% { + opacity: 0; + } - 100% { - opacity: 1; - } + 100% { + opacity: 1; + } } diff --git a/client/src/app/components/identity/tree/IdentityTreeItem.tsx b/client/src/app/components/identity/tree/IdentityTreeItem.tsx index b6a3a5b81..e3fdabae2 100644 --- a/client/src/app/components/identity/tree/IdentityTreeItem.tsx +++ b/client/src/app/components/identity/tree/IdentityTreeItem.tsx @@ -35,7 +35,7 @@ export default class IdentityTreeItem extends Component - {(this.state.diffHistory?.chainData?.length === 0 || - this.state.loadingChildren || - this.state.error) && ( -
- {/* --------- Loading Diff Chain... --------- */} - {this.state.loadingChildren && ( -
- {!this.props.firstMsg && ( - -
-
- - )} -
-

Loading Diff Chain

-
- )} + {(this.state.diffHistory?.chainData?.length === 0 || this.state.loadingChildren || this.state.error) && ( +
+ {/* --------- Loading Diff Chain... --------- */} + {this.state.loadingChildren && ( +
+ {!this.props.firstMsg && ( + +
+
+ + )} +
+

Loading Diff Chain

+
+ )} - {/* --------- ⚠ Error or No Diffs Found --------- */} - {!this.state.loadingChildren && - (this.state.diffHistory?.chainData?.length === 0 || this.state.error) && ( -
- {!this.props.firstMsg && ( - -
-
- - )} + {/* --------- ⚠ Error or No Diffs Found --------- */} + {!this.state.loadingChildren && (this.state.diffHistory?.chainData?.length === 0 || this.state.error) && ( +
+ {!this.props.firstMsg && ( + +
+
+ + )} -
- {this.state.diffHistory?.chainData?.length === 0 && ( -

No diffs found

- )} - {this.state.error &&

Error

} -
+
+ {this.state.diffHistory?.chainData?.length === 0 && ( +

No diffs found

)} - {!this.props.firstMsg &&
{BACKWARDS_CURVED_LINE}
} -
{FORWARD_CURVED_LINE}
-
- )} + {this.state.error &&

Error

} +
+ )} + {!this.props.firstMsg &&
{BACKWARDS_CURVED_LINE}
} +
{FORWARD_CURVED_LINE}
+
+ )} {/* --------- Diff children if Parent is Integration message --------- */} {!this.state.loadingChildren && this.state.diffHistory?.chainData?.map((value, index) => ( @@ -108,14 +105,11 @@ export default class IdentityTreeItem extends Component { - this.props.onItemClick( - content, - this.getPreviousMessages(content.messageId) - ); + onItemClick={(content) => { + this.props.onItemClick(content, this.getPreviousMessages(content.messageId)); }} onDiffMessagesUpdate={this.props.onDiffMessagesUpdate} /> @@ -127,12 +121,12 @@ export default class IdentityTreeItem extends Component { if (this.props.selectedMessage.messageId === this.props.itemMessage.messageId) { this.setState({ - hasChildren: false + hasChildren: false, }); return; } @@ -166,7 +160,7 @@ export default class IdentityTreeItem extends Component {/* --------- Title and timestamp --------- */} @@ -185,18 +179,12 @@ export default class IdentityTreeItem extends Component { + onClick={async (event) => { event.stopPropagation(); await this.handleDiffButtonOnClick(); }} > - + , S exten /** * Update formatted currencies. */ - protected updateCurrency(): void { - } + protected updateCurrency(): void {} /** * The items have been updated. * @param newItems The updated items. */ protected itemsUpdated(newItems: IFeedItem[]): void { - const isLatestMilestoneFeedInfoEnabled = this._networkConfig && - this._networkConfig.network !== LEGACY_MAINNET && - this._networkConfig.network !== CUSTOM; + const isLatestMilestoneFeedInfoEnabled = + this._networkConfig && this._networkConfig.network !== LEGACY_MAINNET && this._networkConfig.network !== CUSTOM; if (isLatestMilestoneFeedInfoEnabled && newItems) { - const milestones = newItems.filter(i => i.payloadType === "MS"); + const milestones = newItems.filter((i) => i.payloadType === "MS"); let newIndex; for (const ms of milestones) { const index: number | undefined = ms.properties?.index as number; @@ -126,20 +124,18 @@ abstract class Feeds

, S exten * The confirmed items have been updated. * @param metaData The updated confirmed items. */ - protected metadataUpdated(metaData: { [id: string]: IFeedItemMetadata }): void { } + protected metadataUpdated(metaData: { [id: string]: IFeedItemMetadata }): void {} /** * Build the feeds for transactions. */ private buildItems(): void { if (this._feedClient) { - this._itemSubscriptionId = this._feedClient.subscribe( - (updatedItems, metadata) => { - if (this._isMounted) { - this.updateItems(updatedItems, metadata); - } + this._itemSubscriptionId = this._feedClient.subscribe((updatedItems, metadata) => { + if (this._isMounted) { + this.updateItems(updatedItems, metadata); } - ); + }); this.updateItems(this._feedClient.getItems(), {}); } @@ -179,26 +175,26 @@ abstract class Feeds

, S exten private updateTps(): void { if (this._isMounted && this._apiClient && this._networkConfig) { // eslint-disable-next-line @typescript-eslint/no-floating-promises - this._apiClient.stats({ - network: this._networkConfig.network, - includeHistory: true - }).then(ips => { - const itemsPerSecond = ips.itemsPerSecond ?? 0; - const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; - const confirmedRate = ips.confirmationRate ? - (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; - - this.setState({ - itemsPerSecond: itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--", - confirmedItemsPerSecond: confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--", - confirmedItemsPerSecondPercent: confirmedRate > 0 - ? `${confirmedRate.toFixed(2)}%` : "--", - latestMilestoneIndex: this.state.latestMilestoneIndex ?? ips.latestMilestoneIndex, - // Increase values by +100 to add more area under the graph - itemsPerSecondHistory: (ips.itemsPerSecondHistory ?? []).map(v => v + 100) - }); - }) - .catch(err => { + this._apiClient + .stats({ + network: this._networkConfig.network, + includeHistory: true, + }) + .then((ips) => { + const itemsPerSecond = ips.itemsPerSecond ?? 0; + const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; + const confirmedRate = ips.confirmationRate ? (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; + + this.setState({ + itemsPerSecond: itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--", + confirmedItemsPerSecond: confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--", + confirmedItemsPerSecondPercent: confirmedRate > 0 ? `${confirmedRate.toFixed(2)}%` : "--", + latestMilestoneIndex: this.state.latestMilestoneIndex ?? ips.latestMilestoneIndex, + // Increase values by +100 to add more area under the graph + itemsPerSecondHistory: (ips.itemsPerSecondHistory ?? []).map((v) => v + 100), + }); + }) + .catch((err) => { console.error(err); }) .finally(() => { @@ -212,13 +208,10 @@ abstract class Feeds

, S exten */ private initNetworkServices(): void { const networkService = ServiceFactory.get("network"); - this._networkConfig = this.props.match.params.network - ? networkService.get(this.props.match.params.network) - : undefined; + this._networkConfig = this.props.match.params.network ? networkService.get(this.props.match.params.network) : undefined; this._apiClient = ServiceFactory.get(`api-client-${LEGACY}`); - this._feedClient = ServiceFactory.get( - `feed-${this.props.match.params.network}`); + this._feedClient = ServiceFactory.get(`feed-${this.props.match.params.network}`); this.updateTps(); this.buildItems(); diff --git a/client/src/app/components/stardust/DownloadModal.scss b/client/src/app/components/stardust/DownloadModal.scss index b76b7708d..7aee50709 100644 --- a/client/src/app/components/stardust/DownloadModal.scss +++ b/client/src/app/components/stardust/DownloadModal.scss @@ -5,113 +5,111 @@ @import "../../../scss/themes"; .download-modal { - display: inline-block; + display: inline-block; - button { - border: none; - background-color: transparent; + button { + border: none; + background-color: transparent; - &:focus { - box-shadow: none; + &:focus { + box-shadow: none; + } } - } - - .modal--icon { - span { - color: #b0bfd9; - font-size: 20px; - } - } - - .modal--bg { - position: fixed; - z-index: 2000; - top: 0; - left: 0; - width: 100%; - height: 100vh; - background: rgba(19, 31, 55, 0.75); - } - - .modal--content { - position: fixed; - z-index: 3000; - top: 50%; - left: 50%; - width: 100%; - max-width: 660px; - max-height: 100%; - padding: 32px; - transform: translate(-50%, -50%); - border: 1px solid #e8eefb; - border-radius: 6px; - background-color: var(--body-background); - box-shadow: 0 4px 8px rgba(19, 31, 55, 0.04); - - @include tablet-down { - width: 100%; - overflow-y: auto; + .modal--icon { + span { + color: #b0bfd9; + font-size: 20px; + } } - .modal--header { - display: flex; - align-items: center; - justify-content: space-between; - padding-bottom: 22px; - border-bottom: 1px solid #e8eefb; - letter-spacing: 0.02em; - - .modal--title { - @include font-size(20px); + .modal--bg { + position: fixed; + z-index: 2000; + top: 0; + left: 0; + width: 100%; + height: 100vh; + background: rgba(19, 31, 55, 0.75); + } - color: var(--body-color); - font-family: $metropolis; - font-weight: 600; + .modal--content { + position: fixed; + z-index: 3000; + top: 50%; + left: 50%; + width: 100%; + max-width: 660px; + max-height: 100%; + padding: 32px; + transform: translate(-50%, -50%); + border: 1px solid #e8eefb; + border-radius: 6px; + background-color: var(--body-background); + box-shadow: 0 4px 8px rgba(19, 31, 55, 0.04); + + @include tablet-down { + width: 100%; + overflow-y: auto; } - button { - color: var(--body-color); + .modal--header { + display: flex; + align-items: center; + justify-content: space-between; + padding-bottom: 22px; + border-bottom: 1px solid #e8eefb; + letter-spacing: 0.02em; + + .modal--title { + @include font-size(20px); + + color: var(--body-color); + font-family: $metropolis; + font-weight: 600; + } + + button { + color: var(--body-color); + } } - } - - .modal--body { - margin-top: 24px; - - .input-container { - width: 100%; - - .date-label { - color: var(--body-color); - font-family: $inter; - font-weight: 500; - margin-bottom: 8px; - margin-right: 8px; - } - } - - .confirm-button { - cursor: pointer; - margin: 24px 0 8px 0; - align-self: center; - width: fit-content; - padding: 8px 12px; - border: 1px solid #ccc; - color: $mint-green-7; - - &.disabled { - color: $mint-green-1; - } - - .spinner-container { - display: flex; - align-items: center; - justify-content: center; - width: 57px; - height: 16px; - } - } + .modal--body { + margin-top: 24px; + + .input-container { + width: 100%; + + .date-label { + color: var(--body-color); + font-family: $inter; + font-weight: 500; + margin-bottom: 8px; + margin-right: 8px; + } + } + + .confirm-button { + cursor: pointer; + margin: 24px 0 8px 0; + align-self: center; + width: fit-content; + padding: 8px 12px; + border: 1px solid #ccc; + color: $mint-green-7; + + &.disabled { + color: $mint-green-1; + } + + .spinner-container { + display: flex; + align-items: center; + justify-content: center; + width: 57px; + height: 16px; + } + } + } } - } } diff --git a/client/src/app/components/stardust/DownloadModal.tsx b/client/src/app/components/stardust/DownloadModal.tsx index 832358458..139e44657 100644 --- a/client/src/app/components/stardust/DownloadModal.tsx +++ b/client/src/app/components/stardust/DownloadModal.tsx @@ -43,26 +43,15 @@ const DownloadModal: React.FC = ({ network, address }) => { return (

- {showModal && (
-
- Transaction History Download -
-
@@ -72,9 +61,7 @@ const DownloadModal: React.FC = ({ network, address }) => {
Select target date
- - info - + info
@@ -84,36 +71,24 @@ const DownloadModal: React.FC = ({ network, address }) => { isValidDate={(current: moment.Moment) => current.isBefore(moment())} inputProps={{ placeholder: "MM/DD/YYYY" }} timeFormat={false} - onChange={value => onDateSelect(value as string)} + onChange={(value) => onDateSelect(value as string)} />
{isDownloading ? ( - ) : ( - )}
-
onModalToggle(false)} - /> +
onModalToggle(false)} /> )}
@@ -121,4 +96,3 @@ const DownloadModal: React.FC = ({ network, address }) => { }; export default DownloadModal; - diff --git a/client/src/app/components/stardust/Feature.tsx b/client/src/app/components/stardust/Feature.tsx index 424be7a30..665e96cf6 100644 --- a/client/src/app/components/stardust/Feature.tsx +++ b/client/src/app/components/stardust/Feature.tsx @@ -7,37 +7,20 @@ import DropdownIcon from "~assets/dropdown-arrow.svg?react"; import { NameHelper } from "~helpers/stardust/nameHelper"; import DataToggle from "../DataToggle"; -const Feature: React.FC = ( - { feature, isImmutable, isPreExpanded, isParticipationEventMetadata } -) => { +const Feature: React.FC = ({ feature, isImmutable, isPreExpanded, isParticipationEventMetadata }) => { const [isExpanded, setIsExpanded] = useState(isPreExpanded ?? false); return (
-
setIsExpanded(!isExpanded)} - > -
+
setIsExpanded(!isExpanded)}> +
-
- {NameHelper.getFeatureTypeName(feature.type, isImmutable)} -
+
{NameHelper.getFeatureTypeName(feature.type, isImmutable)}
{isExpanded && (
- {feature.type === FeatureType.Sender && ( -
- )} - {feature.type === FeatureType.Issuer && ( -
- )} + {feature.type === FeatureType.Sender &&
} + {feature.type === FeatureType.Issuer &&
} {feature.type === FeatureType.Metadata && (
= ( )} {feature.type === FeatureType.Tag && (
- {(feature as TagFeature).tag && ( - - )} + {(feature as TagFeature).tag && }
)}
diff --git a/client/src/app/components/stardust/InclusionState.tsx b/client/src/app/components/stardust/InclusionState.tsx index abaaebdb4..717e8683a 100644 --- a/client/src/app/components/stardust/InclusionState.tsx +++ b/client/src/app/components/stardust/InclusionState.tsx @@ -10,21 +10,13 @@ interface InclusionStateProps { const InclusionState: React.FC = ({ state }) => (
- {state === undefined && ("The block is not yet referenced by a milestone.")} - {state === "included" && ( - "The block is confirmed by a milestone and the transaction successfully mutated the ledger state." - )} - {state === "noTransaction" && ( - "The block is referenced by a milestone but there is no value transfer." - )} - {state === "conflicting" && ( - "The block is confirmed by a milestone but the transaction is conflicting." - )} + {state === undefined && "The block is not yet referenced by a milestone."} + {state === "included" && "The block is confirmed by a milestone and the transaction successfully mutated the ledger state."} + {state === "noTransaction" && "The block is referenced by a milestone but there is no value transfer."} + {state === "conflicting" && "The block is confirmed by a milestone but the transaction is conflicting."}
); - InclusionState.defaultProps = { state: undefined }; export default InclusionState; - diff --git a/client/src/app/components/stardust/Input.tsx b/client/src/app/components/stardust/Input.tsx index 565d8171e..8fa0dcfb2 100644 --- a/client/src/app/components/stardust/Input.tsx +++ b/client/src/app/components/stardust/Input.tsx @@ -33,10 +33,7 @@ const Input: React.FC = ({ input, network }) => { const fallbackInputView = ( -
setIsExpanded(!isExpanded)} - > +
setIsExpanded(!isExpanded)}>
@@ -45,7 +42,7 @@ const Input: React.FC = ({ input, network }) => {
{input.amount && ( { + onClick={(e) => { setIsFormattedBalance(!isFormattedBalance); e.stopPropagation(); }} @@ -72,28 +69,30 @@ const Input: React.FC = ({ input, network }) => {
Transaction Id
- + {input.transactionId}
Transaction Output Index
{input.transactionInputIndex}
-
)} + + )} ); - const outputId = Utils.computeOutputId( - input.transactionId, input.transactionInputIndex - ); + const outputId = Utils.computeOutputId(input.transactionId, input.transactionInputIndex); - return input.output ? + return input.output ? ( : fallbackInputView; + /> + ) : ( + fallbackInputView + ); }; export default Input; diff --git a/client/src/app/components/stardust/NativeToken.tsx b/client/src/app/components/stardust/NativeToken.tsx index f02f99e34..72cf1c03c 100644 --- a/client/src/app/components/stardust/NativeToken.tsx +++ b/client/src/app/components/stardust/NativeToken.tsx @@ -13,7 +13,7 @@ class NativeToken extends AsyncComponent { super(props); this.state = { - isExpanded: this.props.isPreExpanded ?? false + isExpanded: this.props.isPreExpanded ?? false, }; } @@ -34,33 +34,18 @@ class NativeToken extends AsyncComponent { return (
-
this.setState({ isExpanded: !isExpanded })} - > -
+
this.setState({ isExpanded: !isExpanded })}> +
-
- Native token -
+
Native token
{isExpanded && (
-
- Token id: -
-
- {tokenId} -
-
- Amount: -
-
- {Number(amount)} -
+
Token id:
+
{tokenId}
+
Amount:
+
{Number(amount)}
)}
diff --git a/client/src/app/components/stardust/Output.scss b/client/src/app/components/stardust/Output.scss index 2f318c74d..d36cf2947 100644 --- a/client/src/app/components/stardust/Output.scss +++ b/client/src/app/components/stardust/Output.scss @@ -61,7 +61,7 @@ } .unlock-condition-icon { - color: #FEC900; + color: #fec900; font-size: 18px; @media (min-width: #{768px}) and (max-width: #{820px}) { @@ -94,4 +94,3 @@ transform: rotate(90deg); } } - diff --git a/client/src/app/components/stardust/Output.tsx b/client/src/app/components/stardust/Output.tsx index 5ac6e54aa..65af6ff5b 100644 --- a/client/src/app/components/stardust/Output.tsx +++ b/client/src/app/components/stardust/Output.tsx @@ -1,11 +1,22 @@ /* eslint-disable react/static-property-placement */ import { - AddressType, AliasAddress, AliasOutput, - CommonOutput, ExpirationUnlockCondition, FoundryOutput, ImmutableAliasAddressUnlockCondition, - INodeInfoBaseToken, NftOutput, OutputType, SimpleTokenScheme, + AddressType, + AliasAddress, + AliasOutput, + CommonOutput, + ExpirationUnlockCondition, + FoundryOutput, + ImmutableAliasAddressUnlockCondition, + INodeInfoBaseToken, + NftOutput, + OutputType, + SimpleTokenScheme, StorageDepositReturnUnlockCondition, TimelockUnlockCondition, - TokenSchemeType, UnlockCondition as IUnlockCondition, UnlockConditionType, Utils + TokenSchemeType, + UnlockCondition as IUnlockCondition, + UnlockConditionType, + Utils, } from "@iota/sdk-wasm/web"; import classNames from "classnames"; import React, { Component, ReactNode } from "react"; @@ -51,7 +62,7 @@ class Output extends Component { this.state = { isExpanded: this.props.isPreExpanded ?? false, - isFormattedBalance: true + isFormattedBalance: true, }; } @@ -60,61 +71,55 @@ class Output extends Component { * @returns The node to render. */ public render(): ReactNode { - const { - outputId, output, amount, showCopyAmount, network, isPreExpanded, displayFullOutputId, isLinksDisabled - } = this.props; + const { outputId, output, amount, showCopyAmount, network, isPreExpanded, displayFullOutputId, isLinksDisabled } = this.props; const { isExpanded, isFormattedBalance } = this.state; const tokenInfo: INodeInfoBaseToken = this.context.tokenInfo; const aliasOrNftBech32 = this.buildAddressForAliasOrNft(); const foundryId = this.buildFoundryId(); - const outputIdTransactionPart = displayFullOutputId ? - `${outputId.slice(0, -4)}` : - `${outputId.slice(0, 8)}....${outputId.slice(-8, -4)}`; + const outputIdTransactionPart = displayFullOutputId + ? `${outputId.slice(0, -4)}` + : `${outputId.slice(0, 8)}....${outputId.slice(-8, -4)}`; const outputIdIndexPart = outputId.slice(-4); const isSpecialCondition = this.hasSpecialCondition(); const isParticipationOutput = TransactionsHelper.isParticipationEventOutput(output); - const specialUnlockCondition = ( - output.type !== OutputType.Treasury && isSpecialCondition) && ( - (output as CommonOutput).unlockConditions.map((unlockCondition, idx) => ( - - - {unlockCondition.type === UnlockConditionType.StorageDepositReturn && "arrow_back"} - {unlockCondition.type === UnlockConditionType.Expiration && "hourglass_bottom"} - {unlockCondition.type === UnlockConditionType.Timelock && "schedule"} - - - )) - ); + const specialUnlockCondition = + output.type !== OutputType.Treasury && + isSpecialCondition && + (output as CommonOutput).unlockConditions.map((unlockCondition, idx) => ( + + + {unlockCondition.type === UnlockConditionType.StorageDepositReturn && "arrow_back"} + {unlockCondition.type === UnlockConditionType.Expiration && "hourglass_bottom"} + {unlockCondition.type === UnlockConditionType.Timelock && "schedule"} + + + )); const outputHeader = ( -
this.setState({ isExpanded: !isExpanded })} - className="card--value card-header--wrapper" - > +
this.setState({ isExpanded: !isExpanded })} className="card--value card-header--wrapper">
-
( - {isLinksDisabled ? + {isLinksDisabled ? (
{outputIdTransactionPart} {outputIdIndexPart} -
: +
+ ) : ( {outputIdTransactionPart} {outputIdIndexPart} - } + + )} )
@@ -124,7 +129,7 @@ class Output extends Component {
{ + onClick={(e) => { this.setState({ isFormattedBalance: !isFormattedBalance }); e.stopPropagation(); }} @@ -158,10 +163,7 @@ class Output extends Component {
State metadata:
- +
)} @@ -198,31 +200,20 @@ class Output extends Component {
Serial number:
{(output as FoundryOutput).serialNumber}
Token scheme type:
-
- {(output as FoundryOutput).tokenScheme.type} -
+
{(output as FoundryOutput).tokenScheme.type}
{(output as FoundryOutput).tokenScheme.type === TokenSchemeType.Simple && (
Minted tokens:
- {Number( - ((output as FoundryOutput).tokenScheme as SimpleTokenScheme) - .mintedTokens - )} + {Number(((output as FoundryOutput).tokenScheme as SimpleTokenScheme).mintedTokens)}
Melted tokens:
- {Number( - ((output as FoundryOutput).tokenScheme as SimpleTokenScheme) - .meltedTokens - )} + {Number(((output as FoundryOutput).tokenScheme as SimpleTokenScheme).meltedTokens)}
Maximum supply:
- {Number( - ((output as FoundryOutput).tokenScheme as SimpleTokenScheme) - .maximumSupply - )} + {Number(((output as FoundryOutput).tokenScheme as SimpleTokenScheme).maximumSupply)}
)} @@ -233,11 +224,7 @@ class Output extends Component { {output.type !== OutputType.Treasury && ( {(output as CommonOutput).unlockConditions.map((unlockCondition, idx) => ( - + ))} {(output as CommonOutput).features?.map((feature, idx) => ( { isParticipationEventMetadata={isParticipationOutput} /> ))} - {output.type === OutputType.Alias && ( - (output as AliasOutput) - .immutableFeatures?.map((immutableFeature, idx) => ( - - )) - )} - {output.type === OutputType.Nft && ( - (output as NftOutput) - .immutableFeatures?.map((immutableFeature, idx) => ( - - )) - )} - {output.type === OutputType.Foundry && ( - (output as FoundryOutput) - .immutableFeatures?.map((immutableFeature, idx) => ( - - )) - )} + {output.type === OutputType.Alias && + (output as AliasOutput).immutableFeatures?.map((immutableFeature, idx) => ( + + ))} + {output.type === OutputType.Nft && + (output as NftOutput).immutableFeatures?.map((immutableFeature, idx) => ( + + ))} + {output.type === OutputType.Foundry && + (output as FoundryOutput).immutableFeatures?.map((immutableFeature, idx) => ( + + ))} {(output as CommonOutput).nativeTokens?.map((token, idx) => ( - + ))} )} @@ -316,11 +277,7 @@ class Output extends Component { addressType = AddressType.Nft; } - return Bech32AddressHelper.buildAddress( - this.context.bech32Hrp, - address, - addressType - ).bech32; + return Bech32AddressHelper.buildAddress(this.context.bech32Hrp, address, addressType).bech32; } /** @@ -337,11 +294,7 @@ class Output extends Component { const serialNumber = (output as FoundryOutput).serialNumber; const tokenSchemeType = (output as FoundryOutput).tokenScheme.type; - return Utils.computeTokenId( - aliasId, - serialNumber, - tokenSchemeType - ); + return Utils.computeTokenId(aliasId, serialNumber, tokenSchemeType); } } @@ -389,10 +342,11 @@ class Output extends Component { if (this.props.output.type !== OutputType.Treasury) { const commonOutput = this.props.output as CommonOutput; - specialUnlockConditionExists = commonOutput.unlockConditions.some(condition => - condition.type === UnlockConditionType.StorageDepositReturn || - condition.type === UnlockConditionType.Expiration || - condition.type === UnlockConditionType.Timelock + specialUnlockConditionExists = commonOutput.unlockConditions.some( + (condition) => + condition.type === UnlockConditionType.StorageDepositReturn || + condition.type === UnlockConditionType.Expiration || + condition.type === UnlockConditionType.Timelock, ); } return specialUnlockConditionExists; diff --git a/client/src/app/components/stardust/OutputProps.tsx b/client/src/app/components/stardust/OutputProps.tsx index 11559cd5b..6c76dbe03 100644 --- a/client/src/app/components/stardust/OutputProps.tsx +++ b/client/src/app/components/stardust/OutputProps.tsx @@ -39,5 +39,5 @@ export interface OutputProps { /** * Disable links if block is conflicting. */ - isLinksDisabled?: boolean; + isLinksDisabled?: boolean; } diff --git a/client/src/app/components/stardust/TruncatedId.tsx b/client/src/app/components/stardust/TruncatedId.tsx index 3dddc1280..ebf5d780d 100644 --- a/client/src/app/components/stardust/TruncatedId.tsx +++ b/client/src/app/components/stardust/TruncatedId.tsx @@ -10,27 +10,14 @@ interface TruncatedIdProps { } const TruncatedId: React.FC = ({ id, link, showCopyButton }) => { - const content = link && link.length > 0 ? ( - - {id} - - ) : ( - - {id} - - ); + const content = + link && link.length > 0 ? ( + + {id} + + ) : ( + {id} + ); return (
@@ -42,8 +29,7 @@ const TruncatedId: React.FC = ({ id, link, showCopyButton }) = TruncatedId.defaultProps = { link: undefined, - showCopyButton: undefined + showCopyButton: undefined, }; export default TruncatedId; - diff --git a/client/src/app/components/stardust/UnlockCondition.tsx b/client/src/app/components/stardust/UnlockCondition.tsx index 4f44505ae..c4dacd149 100644 --- a/client/src/app/components/stardust/UnlockCondition.tsx +++ b/client/src/app/components/stardust/UnlockCondition.tsx @@ -1,8 +1,13 @@ import { - AddressUnlockCondition, ExpirationUnlockCondition, GovernorAddressUnlockCondition, - ImmutableAliasAddressUnlockCondition, INodeInfoBaseToken, - StateControllerAddressUnlockCondition, StorageDepositReturnUnlockCondition, - TimelockUnlockCondition, UnlockConditionType + AddressUnlockCondition, + ExpirationUnlockCondition, + GovernorAddressUnlockCondition, + ImmutableAliasAddressUnlockCondition, + INodeInfoBaseToken, + StateControllerAddressUnlockCondition, + StorageDepositReturnUnlockCondition, + TimelockUnlockCondition, + UnlockConditionType, } from "@iota/sdk-wasm/web"; import classNames from "classnames"; import React, { ReactNode } from "react"; @@ -35,7 +40,7 @@ class UnlockCondition extends AsyncComponent -
this.setState({ isExpanded: !isExpanded })} - > +
this.setState({ isExpanded: !isExpanded })}>
-
- {NameHelper.getUnlockConditionTypeName(unlockCondition.type)} -
+
{NameHelper.getUnlockConditionTypeName(unlockCondition.type)}
{isExpanded && (
{unlockCondition.type === UnlockConditionType.Address && ( -
+
)} {unlockCondition.type === UnlockConditionType.StorageDepositReturn && ( -
- Return address -
-
-
- Amount: -
+
Return address
+
+
Amount:
this.setState({ isFormattedBalance: !isFormattedBalance })} > {formatAmount( - Number( - (unlockCondition as StorageDepositReturnUnlockCondition).amount - ), + Number((unlockCondition as StorageDepositReturnUnlockCondition).amount), tokenInfo, - !isFormattedBalance + !isFormattedBalance, )}
)} - {unlockCondition.type === UnlockConditionType.Timelock && - (unlockCondition as TimelockUnlockCondition).unixTime && ( - -
- Unix time -
-
- {DateHelper.formatShort( - (unlockCondition as TimelockUnlockCondition).unixTime * 1000 - )} -
-
- )} + {unlockCondition.type === UnlockConditionType.Timelock && (unlockCondition as TimelockUnlockCondition).unixTime && ( + +
Unix time
+
+ {DateHelper.formatShort((unlockCondition as TimelockUnlockCondition).unixTime * 1000)} +
+
+ )} {unlockCondition.type === UnlockConditionType.Expiration && ( -
+
{(unlockCondition as ExpirationUnlockCondition).unixTime && ( -
- Unix time -
+
Unix time
- {DateHelper.formatShort( - (unlockCondition as ExpirationUnlockCondition).unixTime * 1000 - )} + {DateHelper.formatShort((unlockCondition as ExpirationUnlockCondition).unixTime * 1000)}
)} )} {unlockCondition.type === UnlockConditionType.GovernorAddress && ( -
+
)} {unlockCondition.type === UnlockConditionType.ImmutableAliasAddress && ( -
+
)} {unlockCondition.type === UnlockConditionType.StateControllerAddress && ( -
+
)}
)} @@ -159,4 +130,3 @@ class UnlockCondition extends AsyncComponent = ({ unlocks }) => { return (
-
setIsExpanded(!isExpanded)} - className="card--value card-header--wrapper" - > +
setIsExpanded(!isExpanded)} className="card--value card-header--wrapper">
- +
- { - isExpanded && ( -
- { - unlocks.map((unlock, idx) => ( - unlock.type === UnlockType.Signature ? -
- {displayUnlocksTypeAndIndex(unlock.type, idx)} -
- Public Key: -
- -
-
-
- Signature: -
- -
-
-
: -
- {displayUnlocksTypeAndIndex((unlock as ReferenceUnlock).type, idx)} -
- References unlock at index: - {(unlock as ReferenceUnlock).reference} -
+ {isExpanded && ( +
+ {unlocks.map((unlock, idx) => + unlock.type === UnlockType.Signature ? ( +
+ {displayUnlocksTypeAndIndex(unlock.type, idx)} +
+ Public Key: +
+
- )) - } -
- ) - } +
+
+ Signature: +
+ +
+
+
+ ) : ( +
+ {displayUnlocksTypeAndIndex((unlock as ReferenceUnlock).type, idx)} +
+ References unlock at index: + {(unlock as ReferenceUnlock).reference} +
+
+ ), + )} +
+ )}
); }; export default Unlocks; - diff --git a/client/src/app/components/stardust/address/Address.tsx b/client/src/app/components/stardust/address/Address.tsx index 667382bbd..740015ce9 100644 --- a/client/src/app/components/stardust/address/Address.tsx +++ b/client/src/app/components/stardust/address/Address.tsx @@ -25,17 +25,12 @@ class Address extends Component { * @returns The node to render. */ public render(): ReactNode { - const address = Bech32AddressHelper.buildAddress( - this.context.bech32Hrp, - this.props.address - ); + const address = Bech32AddressHelper.buildAddress(this.context.bech32Hrp, this.props.address); const link = `/${this.context.name}/addr/${address.bech32}`; return (
-
- {NameHelper.getAddressTypeName(this.props.address.type)} -
+
{NameHelper.getAddressTypeName(this.props.address.type)}
diff --git a/client/src/app/components/stardust/address/AddressBalance.scss b/client/src/app/components/stardust/address/AddressBalance.scss index 92af1ed09..e5795729b 100644 --- a/client/src/app/components/stardust/address/AddressBalance.scss +++ b/client/src/app/components/stardust/address/AddressBalance.scss @@ -45,7 +45,8 @@ } } - .balance-smr, .balance-fiat { + .balance-smr, + .balance-fiat { color: #b0bfd9; font-size: 18px; } @@ -74,4 +75,3 @@ } } } - diff --git a/client/src/app/components/stardust/address/AddressBalance.tsx b/client/src/app/components/stardust/address/AddressBalance.tsx index fa1862a71..c548a674f 100644 --- a/client/src/app/components/stardust/address/AddressBalance.tsx +++ b/client/src/app/components/stardust/address/AddressBalance.tsx @@ -39,28 +39,24 @@ const AddressBalance: React.FC = ({ balance, spendableBalan setIsFormatFull: React.Dispatch>, showInfo: boolean, showWallet: boolean, - amount: number | null + amount: number | null, ) => (
{showWallet && }
{label}
- {showInfo && + {showInfo && ( - - info - - } + info + + )}
{amount !== null && amount > 0 ? (
- setIsFormatFull(!isFormatFull)} - className="balance-smr pointer margin-r-5" - > + setIsFormatFull(!isFormatFull)} className="balance-smr pointer margin-r-5"> {formatAmount(amount, tokenInfo, isFormatFull)} @@ -73,16 +69,16 @@ const AddressBalance: React.FC = ({ balance, spendableBalan
)}
- ) : 0} + ) : ( + 0 + )}
); const isMarketed = isMarketedNetwork(network); - const conditionalBalance = spendableBalance === null ? - undefined : - balance - spendableBalance; + const conditionalBalance = spendableBalance === null ? undefined : balance - spendableBalance; const shouldShowExtendedBalance = conditionalBalance !== undefined && spendableBalance !== undefined; return ( @@ -94,25 +90,24 @@ const AddressBalance: React.FC = ({ balance, spendableBalan setFormatBalanceFull, false, true, - shouldShowExtendedBalance ? spendableBalance : balance + shouldShowExtendedBalance ? spendableBalance : balance, )} - {shouldShowExtendedBalance && ( + {shouldShowExtendedBalance && buildBalanceView( "Conditionally Locked Balance", formatConditionalBalanceFull, setFormatConditionalBalanceFull, true, false, - conditionalBalance - ) - )} + conditionalBalance, + )} {buildBalanceView( "Storage Deposit", formatStorageBalanceFull, setFormatStorageBalanceFull, false, false, - storageRentBalance + storageRentBalance, )}
@@ -120,4 +115,3 @@ const AddressBalance: React.FC = ({ balance, spendableBalan }; export default AddressBalance; - diff --git a/client/src/app/components/stardust/address/Bech32Address.tsx b/client/src/app/components/stardust/address/Bech32Address.tsx index 51afe588b..3c4896662 100644 --- a/client/src/app/components/stardust/address/Bech32Address.tsx +++ b/client/src/app/components/stardust/address/Bech32Address.tsx @@ -15,49 +15,39 @@ class Bech32Address extends Component {
{this.props.addressDetails?.bech32 && (
- {!this.props.hideLabel && ( -
- {this.props.addressDetails.typeLabel} Address -
- )} + {!this.props.hideLabel &&
{this.props.addressDetails.typeLabel} Address
}
{this.props.history && ( )} - {!this.props.history && ( - - )} + {!this.props.history && }
)} {this.props.advancedMode && this.props.addressDetails?.typeLabel && this.props.addressDetails?.hex && (
-
- {this.props.addressDetails.typeLabel} Id -
+
{this.props.addressDetails.typeLabel} Id
{this.props.history && ( )} - {!this.props.history && ( - - )} + {!this.props.history && }
)} diff --git a/client/src/app/components/stardust/address/section/AddressPageTabbedSections.tsx b/client/src/app/components/stardust/address/section/AddressPageTabbedSections.tsx index ea925a944..71cbb1c4c 100644 --- a/client/src/app/components/stardust/address/section/AddressPageTabbedSections.tsx +++ b/client/src/app/components/stardust/address/section/AddressPageTabbedSections.tsx @@ -26,13 +26,13 @@ enum DEFAULT_TABS { NativeTokens = "Native Tokens", Nfts = "NFTs", AssocOutputs = "Associated Outputs", - Voting = "Voting" + Voting = "Voting", } enum ALIAS_TABS { State = "State", Foundries = "Foundries", - DID = "DID" + DID = "DID", } enum NFT_TABS { @@ -47,37 +47,37 @@ const buildDefaultTabsOptions = ( isNftOutputsLoading: boolean, associatedOutputCount: number, isAssociatedOutputsLoading: boolean, - eventDetailsCount?: number + eventDetailsCount?: number, ) => ({ [DEFAULT_TABS.Transactions]: { disabled: false, isLoading: isAddressHistoryLoading, - infoContent: transactionHistoryMessage + infoContent: transactionHistoryMessage, }, [DEFAULT_TABS.NativeTokens]: { disabled: tokensCount === 0, counter: tokensCount, isLoading: isAddressOutputsLoading, - infoContent: nativeTokensMessage + infoContent: nativeTokensMessage, }, [DEFAULT_TABS.Nfts]: { disabled: nftCount === 0, counter: nftCount, isLoading: isNftOutputsLoading, - infoContent: addressNftsMessage + infoContent: addressNftsMessage, }, [DEFAULT_TABS.AssocOutputs]: { disabled: associatedOutputCount === 0, counter: associatedOutputCount, isLoading: isAssociatedOutputsLoading, - infoContent: associatedOuputsMessage + infoContent: associatedOuputsMessage, }, [DEFAULT_TABS.Voting]: { disabled: false, counter: eventDetailsCount, infoContent: votingMessage, - hidden: !eventDetailsCount - } + hidden: !eventDetailsCount, + }, }); const buildAliasAddressTabsOptions = ( @@ -91,29 +91,26 @@ const buildAliasAddressTabsOptions = ( [ALIAS_TABS.State]: { disabled: isAliasStateTabDisabled, isLoading: isAliasDetailsLoading, - infoContent: stateMessage + infoContent: stateMessage, }, [ALIAS_TABS.Foundries]: { disabled: isAliasFoundriesTabDisabled, isLoading: isAliasFoundriesLoading, - infoContent: foundriesMessage + infoContent: foundriesMessage, }, [ALIAS_TABS.DID]: { disabled: isAliasDIDTabDisabled, isLoading: isAliasDIDLoading, - infoContent: didMessage - } + infoContent: didMessage, + }, }); -const buildNftAddressTabsOptions = ( - isNftMetadataTabDisabled: boolean, - isNftDetailsLoading: boolean -) => ({ +const buildNftAddressTabsOptions = (isNftMetadataTabDisabled: boolean, isNftDetailsLoading: boolean) => ({ [NFT_TABS.NftMetadata]: { disabled: isNftMetadataTabDisabled, isLoading: isNftDetailsLoading, - infoContent: nftMetadataMessage - } + infoContent: nftMetadataMessage, + }, }); interface IAddressPageTabbedSectionsProps { @@ -127,31 +124,40 @@ interface IAddressPageTabbedSectionsProps { readonly setAssociatedOutputsLoading: (isLoading: boolean) => void; } -export const AddressPageTabbedSections: React.FC = ( - { - network, - addressPageState, - setTransactionHistoryLoading, - setTransactionHistoryDisabled, - setTokenCount, - setNftCount, - setAssociatedOutputsCount, - setAssociatedOutputsLoading - } -) => { +export const AddressPageTabbedSections: React.FC = ({ + network, + addressPageState, + setTransactionHistoryLoading, + setTransactionHistoryDisabled, + setTokenCount, + setNftCount, + setAssociatedOutputsCount, + setAssociatedOutputsLoading, +}) => { const { bech32AddressDetails, - addressOutputs, isBasicOutputsLoading, + addressOutputs, + isBasicOutputsLoading, isAliasOutputsLoading, - addressNftOutputs, isNftOutputsLoading, - nftMetadata, nftIssuerId, isNftDetailsLoading, - aliasOutput, isAliasDetailsLoading, - aliasFoundries, isAliasFoundriesLoading, - isAddressHistoryLoading, isAddressHistoryDisabled, + addressNftOutputs, + isNftOutputsLoading, + nftMetadata, + nftIssuerId, + isNftDetailsLoading, + aliasOutput, + isAliasDetailsLoading, + aliasFoundries, + isAliasFoundriesLoading, + isAddressHistoryLoading, + isAddressHistoryDisabled, isAssociatedOutputsLoading, - tokensCount, nftCount, associatedOutputCount, - eventDetails, aliasContainsDID, - resolvedDID, isDIDLoading + tokensCount, + nftCount, + associatedOutputCount, + eventDetails, + aliasContainsDID, + resolvedDID, + isDIDLoading, } = addressPageState; if (!bech32AddressDetails) { @@ -173,12 +179,7 @@ export const AddressPageTabbedSections: React.FC, - , + , , - + , ]; - const aliasAddressSections = addressType === AddressType.Alias ? [ - , - , - - ] : null; + const aliasAddressSections = + addressType === AddressType.Alias + ? [ + , + , + , + ] + : null; - const nftAddressSections = addressType === AddressType.Nft ? [ - - ] : null; + const nftAddressSections = + addressType === AddressType.Nft + ? [] + : null; let tabEnums = DEFAULT_TABS; const defaultTabsOptions = buildDefaultTabsOptions( - isAddressHistoryLoading, tokensCount, isAddressOutputsLoading, - nftCount, isNftOutputsLoading, associatedOutputCount, isAssociatedOutputsLoading, - eventDetailsCount + isAddressHistoryLoading, + tokensCount, + isAddressOutputsLoading, + nftCount, + isNftOutputsLoading, + associatedOutputCount, + isAssociatedOutputsLoading, + eventDetailsCount, ); let tabOptions = defaultTabsOptions; let tabbedSections = defaultSections; @@ -247,7 +238,7 @@ export const AddressPageTabbedSections: React.FC + {tabbedSections} ); }; - diff --git a/client/src/app/components/stardust/address/section/FeaturesSection.tsx b/client/src/app/components/stardust/address/section/FeaturesSection.tsx index 312083108..969e966f0 100644 --- a/client/src/app/components/stardust/address/section/FeaturesSection.tsx +++ b/client/src/app/components/stardust/address/section/FeaturesSection.tsx @@ -19,9 +19,7 @@ const FeaturesSection: React.FC = ({ output }) => (

Features

- {output?.features?.map((feature, idx) => ( - - ))} + {output?.features?.map((feature, idx) => )}
)} {optional(output?.immutableFeatures).nonEmpty() && ( @@ -40,7 +38,7 @@ const FeaturesSection: React.FC = ({ output }) => ( ); FeaturesSection.defaultProps = { - output: undefined + output: undefined, }; export default FeaturesSection; diff --git a/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.scss b/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.scss index 030a2bd55..61a93ab8f 100644 --- a/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.scss +++ b/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.scss @@ -1,15 +1,14 @@ @import "../../../../../../scss/mixins.scss"; .controlled-foundry--card { - border: none !important; - margin-bottom: 48px; + border: none !important; + margin-bottom: 48px; - .field { - margin-bottom: 8px; + .field { + margin-bottom: 8px; - .card--label { - @include font-size(14px, 21px); + .card--label { + @include font-size(14px, 21px); + } } - } } - diff --git a/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.tsx b/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.tsx index 56b305f03..94a73c87f 100644 --- a/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.tsx +++ b/client/src/app/components/stardust/address/section/alias/AliasFoundriesSection.tsx @@ -32,25 +32,21 @@ const AliasFoundriesSection: React.FC = ({ network,
Foundry Id
{page?.map((foundryId, k) => (
- +
))}
-
+
setPageNumber(newPage)} + onPageChange={(newPage) => setPageNumber(newPage)} />
); }; export default AliasFoundriesSection; - diff --git a/client/src/app/components/stardust/address/section/alias/AliasStateSection.tsx b/client/src/app/components/stardust/address/section/alias/AliasStateSection.tsx index 7e5a8d7e6..6ccfac051 100644 --- a/client/src/app/components/stardust/address/section/alias/AliasStateSection.tsx +++ b/client/src/app/components/stardust/address/section/alias/AliasStateSection.tsx @@ -25,10 +25,7 @@ const AliasStateSection: React.FC = ({ output }) => {
State Metadata
- +
)} @@ -38,4 +35,3 @@ const AliasStateSection: React.FC = ({ output }) => { }; export default AliasStateSection; - diff --git a/client/src/app/components/stardust/address/section/association/AssociatedOutputs.scss b/client/src/app/components/stardust/address/section/association/AssociatedOutputs.scss index 3d9f035b8..101bc5462 100644 --- a/client/src/app/components/stardust/address/section/association/AssociatedOutputs.scss +++ b/client/src/app/components/stardust/address/section/association/AssociatedOutputs.scss @@ -14,7 +14,6 @@ @include phone-down { font-size: 16px; } - } .tabs-wrapper { @@ -50,7 +49,6 @@ padding: 3px 5px; } } - } } @@ -117,7 +115,8 @@ } } - tr, .card { + tr, + .card { .found-in--wrapper { display: flex; @@ -128,7 +127,8 @@ } tr { - .found-in, .date-created { + .found-in, + .date-created { color: $gray-6; } @@ -144,7 +144,8 @@ } .card { - .found-in, .date-created { + .found-in, + .date-created { .value { color: $gray-6; } diff --git a/client/src/app/components/stardust/address/section/association/AssociatedOutputs.tsx b/client/src/app/components/stardust/address/section/association/AssociatedOutputs.tsx index 6a1f76d69..825d7d4d3 100644 --- a/client/src/app/components/stardust/address/section/association/AssociatedOutputs.tsx +++ b/client/src/app/components/stardust/address/section/association/AssociatedOutputs.tsx @@ -26,9 +26,7 @@ interface AssociatedOutputsProps { readonly setIsLoading?: (isLoading: boolean) => void; } -const AssociatedOutputs: React.FC = ( - { network, addressDetails, setOutputCount, setIsLoading } -) => { +const AssociatedOutputs: React.FC = ({ network, addressDetails, setOutputCount, setIsLoading }) => { const [currentTab, setCurrentTab] = useState("Basic"); const [associations, isLoading] = useAssociatedOutputs(network, addressDetails, setOutputCount); const [tabsToRender, setTabsToRender] = useState([]); @@ -49,44 +47,41 @@ const AssociatedOutputs: React.FC = ( const associationTypesToRender: AssociationType[] | undefined = outputTypeToAssociations.get(currentTab); - return ( - associations.length === 0 ? null : ( -
-
-
- {tabsToRender.map((tab, idx) => ( - - ))} -
+ return associations.length === 0 ? null : ( +
+
+
+ {tabsToRender.map((tab, idx) => ( + + ))}
- {associationTypesToRender?.map((associationType, idx) => { - const targetAssociation: IAssociation | undefined = associations.find( - association => association.type === associationType - ); - return ( - - ); - })}
- ) + {associationTypesToRender?.map((associationType, idx) => { + const targetAssociation: IAssociation | undefined = associations.find( + (association) => association.type === associationType, + ); + return ( + + ); + })} +
); }; AssociatedOutputs.defaultProps = { setIsLoading: undefined, - setOutputCount: undefined + setOutputCount: undefined, }; export default AssociatedOutputs; - diff --git a/client/src/app/components/stardust/address/section/association/AssociatedOutputsUtils.ts b/client/src/app/components/stardust/address/section/association/AssociatedOutputsUtils.ts index d43ef87ec..f56170343 100644 --- a/client/src/app/components/stardust/address/section/association/AssociatedOutputsUtils.ts +++ b/client/src/app/components/stardust/address/section/association/AssociatedOutputsUtils.ts @@ -9,8 +9,8 @@ export const outputTypeToAssociations: Map { const tabs: AssociatedOutputTab[] = []; if (associations.length > 0) { - if (associations.some(association => AssociationType[association.type].startsWith("BASIC"))) { + if (associations.some((association) => AssociationType[association.type].startsWith("BASIC"))) { tabs.push("Basic"); } - if (associations.some(association => AssociationType[association.type].startsWith("NFT"))) { + if (associations.some((association) => AssociationType[association.type].startsWith("NFT"))) { tabs.push("NFT"); } - if (associations.some(association => AssociationType[association.type].startsWith("ALIAS"))) { + if (associations.some((association) => AssociationType[association.type].startsWith("ALIAS"))) { tabs.push("Alias"); } - if (associations.some(association => AssociationType[association.type].startsWith("FOUNDRY"))) { + if (associations.some((association) => AssociationType[association.type].startsWith("FOUNDRY"))) { tabs.push("Foundry"); } } return tabs; }; - diff --git a/client/src/app/components/stardust/address/section/association/AssociationSection.tsx b/client/src/app/components/stardust/address/section/association/AssociationSection.tsx index 84c1a44b3..7b6c8a6e0 100644 --- a/client/src/app/components/stardust/address/section/association/AssociationSection.tsx +++ b/client/src/app/components/stardust/address/section/association/AssociationSection.tsx @@ -70,116 +70,100 @@ const AssociationSection: React.FC = ({ association, ou }; const onLoadMore = () => { - setLoadMoreCounter( - loadMoreCounter === undefined ? - 0 : - loadMoreCounter + 1 - ); + setLoadMoreCounter(loadMoreCounter === undefined ? 0 : loadMoreCounter + 1); }; const count = outputIds?.length; - return ( - count ? -
-
-
- -
-

{ASSOCIATION_TYPE_TO_LABEL[association]} ({count})

- {isExpanded && isLoading && ( -
- -
- )} + return count ? ( +
+
+
+
- {!isExpanded || outputTableItems.length === 0 ? null : ( - - - - - - - - - - - {outputTableItems.map((details, idx) => { - const { outputId, dateCreated, ago, amount } = details; - - return ( - - - - - - ); - })} - -
OUTPUT IDDATE CREATEDAMOUNT
- - {dateCreated} ({ago}) - setIsFormatBalance(!isFormatBalance)} - className="pointer margin-r-5" - > - {formatAmount(Number(amount), tokenInfo, isFormatBalance)} - -
- -
+

+ {ASSOCIATION_TYPE_TO_LABEL[association]} ({count}) +

+ {isExpanded && isLoading && ( +
+ +
+ )} +
+ {!isExpanded || outputTableItems.length === 0 ? null : ( + + + + + + + + + + {outputTableItems.map((details, idx) => { const { outputId, dateCreated, ago, amount } = details; return ( -
-
-
Output Id
- - - -
-
-
Date Created
-
{dateCreated} ({ago})
+
+ + + + + ); + })} + +
OUTPUT IDDATE CREATEDAMOUNT
+ + + {dateCreated} ({ago}) + + setIsFormatBalance(!isFormatBalance)} className="pointer margin-r-5"> + {formatAmount(Number(amount), tokenInfo, isFormatBalance)} + +
+ +
+ {outputTableItems.map((details, idx) => { + const { outputId, dateCreated, ago, amount } = details; + + return ( +
+
+
Output Id
+ + + +
+
+
Date Created
+
+ {dateCreated} ({ago})
-
-
Amount
-
- setIsFormatBalance(!isFormatBalance)} - className="pointer margin-r-5" - > - {formatAmount(Number(amount), tokenInfo, isFormatBalance)} - -
+
+
+
Amount
+
+ setIsFormatBalance(!isFormatBalance)} className="pointer margin-r-5"> + {formatAmount(Number(amount), tokenInfo, isFormatBalance)} +
- ); - })} +
+ ); + })} +
+ {outputTableItems.length < count && ( +
+
- {outputTableItems.length < count && ( -
- -
- )} - - )} -
: null - ); + )} +
+ )} +
+ ) : null; }; export default AssociationSection; - diff --git a/client/src/app/components/stardust/address/section/did/DidSection.tsx b/client/src/app/components/stardust/address/section/did/DidSection.tsx index 141153c37..89dec513e 100644 --- a/client/src/app/components/stardust/address/section/did/DidSection.tsx +++ b/client/src/app/components/stardust/address/section/did/DidSection.tsx @@ -3,22 +3,18 @@ import IdentityStardustResolver from "../../../../identity/IdentityStardustResol import { IIdentityStardustResolveResponse } from "~/models/api/IIdentityStardustResolveResponse"; interface DIDSectionProps { - resolvedDID: IIdentityStardustResolveResponse | null, - network: string, + resolvedDID: IIdentityStardustResolveResponse | null; + network: string; } const DIDSection: React.FC = ({ resolvedDID, network }) => { return (
- +
); }; export default DIDSection; - diff --git a/client/src/app/components/stardust/address/section/native-tokens/Asset.tsx b/client/src/app/components/stardust/address/section/native-tokens/Asset.tsx index df957c5b6..5a04371d8 100644 --- a/client/src/app/components/stardust/address/section/native-tokens/Asset.tsx +++ b/client/src/app/components/stardust/address/section/native-tokens/Asset.tsx @@ -15,9 +15,7 @@ import TruncatedId from "../../../TruncatedId"; /** * Component which will display an asset. */ -const Asset: React.FC = ( - { network, tableFormat, token } -) => { +const Asset: React.FC = ({ network, tableFormat, token }) => { const [foundryDetails, isLoading] = useFoundryDetails(network, token.id); const [tokenMetadata, setTokenMetadata] = useState(null); const [isWhitelisted] = useTokenRegistryNativeTokenCheck(token.id); @@ -26,9 +24,7 @@ const Asset: React.FC = ( if (isWhitelisted && foundryDetails) { const immutableFeatures = (foundryDetails?.output as FoundryOutput).immutableFeatures; - const metadata = immutableFeatures?.find( - feature => feature.type === FeatureType.Metadata - ) as MetadataFeature; + const metadata = immutableFeatures?.find((feature) => feature.type === FeatureType.Metadata) as MetadataFeature; if (metadata) { updateTokenInfo(metadata); @@ -46,7 +42,7 @@ const Asset: React.FC = ( if (result.valid) { setTokenMetadata(tokenInfo); } - } catch { } + } catch {} }; const buildTokenName = (name: string, logoUrl?: string): string | ReactElement => { @@ -65,68 +61,46 @@ const Asset: React.FC = ( * Render the component. * @returns The node to render. */ - return ( - tableFormat ? ( - - + return tableFormat ? ( + + + {isLoading ? : tokenMetadata?.name ? buildTokenName(tokenMetadata.name, tokenMetadata.logoUrl) : "-"} + + {isLoading ? : tokenMetadata?.symbol ?? "-"} + + + + {token.amount.toString() ?? "-"} + + ) : ( +
+
+
Name
+
{isLoading ? ( + ) : tokenMetadata?.name ? ( + buildTokenName(tokenMetadata.name, tokenMetadata.logoUrl) ) : ( - tokenMetadata?.name ? buildTokenName(tokenMetadata.name, tokenMetadata.logoUrl) : "-" + "-" )} - - - {isLoading ? ( - - ) : ( - tokenMetadata?.symbol ?? "-" - )} - - - - - {token.amount.toString() ?? "-"} - - ) : ( -
-
-
Name
-
- {isLoading ? ( - - ) : ( - tokenMetadata?.name ? buildTokenName(tokenMetadata.name, tokenMetadata.logoUrl) : "-" - )} -
-
-
-
Symbol
-
- {isLoading ? ( - - ) : ( - tokenMetadata?.symbol ?? "-" - )} -
-
-
Token id
-
- -
-
-
-
Quantity
-
{token.amount.toString() ?? "-"}
+
+
+
Symbol
+
{isLoading ? : tokenMetadata?.symbol ?? "-"}
+
+
+
Token id
+
+
- ) +
+
Quantity
+
{token.amount.toString() ?? "-"}
+
+
); }; diff --git a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.scss b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.scss index f62c34645..f203b9871 100644 --- a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.scss +++ b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.scss @@ -99,4 +99,4 @@ vertical-align: middle; height: 16px; width: 16px; -} \ No newline at end of file +} diff --git a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx index 96d0c0c34..ad6f4b299 100644 --- a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx +++ b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx @@ -1,6 +1,4 @@ -import { - OutputType, OutputResponse, CommonOutput -} from "@iota/sdk-wasm/web"; +import { OutputType, OutputResponse, CommonOutput } from "@iota/sdk-wasm/web"; import React, { useEffect, useState } from "react"; import Asset from "./Asset"; import { IToken } from "~models/api/stardust/foundry/IToken"; @@ -29,10 +27,14 @@ const AssetsTable: React.FC = ({ networkId, outputs, setTokenC const theTokens: IToken[] = []; for (const outputResponse of outputs) { const output = outputResponse.output; - if (output.type === OutputType.Basic || output.type === OutputType.Alias || - output.type === OutputType.Foundry || output.type === OutputType.Nft) { + if ( + output.type === OutputType.Basic || + output.type === OutputType.Alias || + output.type === OutputType.Foundry || + output.type === OutputType.Nft + ) { for (const token of (output as CommonOutput).nativeTokens ?? []) { - const existingToken = theTokens.find(t => t.id === token.id); + const existingToken = theTokens.find((t) => t.id === token.id); if (existingToken) { existingToken.amount += token.amount; } else { @@ -57,58 +59,47 @@ const AssetsTable: React.FC = ({ networkId, outputs, setTokenC } }, [tokens, pageNumber]); - return ( - tokens && tokens?.length > 0 ? ( -
- - - - - - - - - - - {currentPage.map((token, k) => ( - - - - ))} - -
NameSymbolToken idQuantity
- - {/* Only visible in mobile -- Card assets*/} -
+ return tokens && tokens?.length > 0 ? ( +
+ + + + + + + + + + {currentPage.map((token, k) => ( - + ))} - - setPageNumber(number)} - /> + +
NameSymbolToken idQuantity
+ + {/* Only visible in mobile -- Card assets*/} +
+ {currentPage.map((token, k) => ( + + + + ))}
- ) : null - ); + setPageNumber(number)} + /> +
+ ) : null; }; AssetsTable.defaultProps = { - setTokenCount: undefined + setTokenCount: undefined, }; export default AssetsTable; diff --git a/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.scss b/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.scss index a94da59d3..6efb463cd 100644 --- a/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.scss +++ b/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.scss @@ -41,7 +41,7 @@ .nft-image-placeholder__content { @include font-size(16px); - letter-spacing: 0.10em; + letter-spacing: 0.1em; font-family: $metropolis-light; line-height: 1.5em; text-align: center; @@ -49,4 +49,3 @@ } } } - diff --git a/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.tsx b/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.tsx index a17f5e196..e2e2ffc51 100644 --- a/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.tsx +++ b/client/src/app/components/stardust/address/section/nft/ImagePlaceholder.tsx @@ -11,15 +11,10 @@ interface ImagePlaceholderProps { } export const ImagePlaceholder: React.FC = ({ message, color, compact, isLoading }) => ( -
+
{message} - {isLoading && ( - - )} + {isLoading && }
); @@ -27,6 +22,5 @@ export const ImagePlaceholder: React.FC = ({ message, col ImagePlaceholder.defaultProps = { color: undefined, compact: false, - isLoading: false + isLoading: false, }; - diff --git a/client/src/app/components/stardust/address/section/nft/Nft.tsx b/client/src/app/components/stardust/address/section/nft/Nft.tsx index 9790ef10e..992fdbe3f 100644 --- a/client/src/app/components/stardust/address/section/nft/Nft.tsx +++ b/client/src/app/components/stardust/address/section/nft/Nft.tsx @@ -2,9 +2,13 @@ import { NftAddress } from "@iota/sdk-wasm/web"; import React, { useContext, useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { - isSupportedImageFormat, noMetadataPlaceholder, - nonStandardMetadataPlaceholder, unregisteredMetadataPlaceholder, - unsupportedImageFormatPlaceholderCompact, getNftImageContent, loadingImagePlaceholderCompact + isSupportedImageFormat, + noMetadataPlaceholder, + nonStandardMetadataPlaceholder, + unregisteredMetadataPlaceholder, + unsupportedImageFormatPlaceholderCompact, + getNftImageContent, + loadingImagePlaceholderCompact, } from "./NftMetadataUtils"; import { NftProps } from "./NftProps"; import nftSchemeIRC27 from "~assets/schemas/nft-schema-IRC27.json"; @@ -19,9 +23,7 @@ import "./Nft.scss"; const Nft: React.FC = ({ network, nft }) => { const id = nft.nftId; - const standardMetadata = nft.metadata ? - tryParseMetadata(nft.metadata, nftSchemeIRC27) - : null; + const standardMetadata = nft.metadata ? tryParseMetadata(nft.metadata, nftSchemeIRC27) : null; const { bech32Hrp } = useContext(NetworkContext); const address: NftAddress = new NftAddress(id); const nftAddress = Bech32AddressHelper.buildAddress(bech32Hrp, address); @@ -36,40 +38,26 @@ const Nft: React.FC = ({ network, nft }) => { } }, [standardMetadata]); - const unsupportedFormatOrLoading = isNftUriLoading ? ( - loadingImagePlaceholderCompact - ) : ( - unsupportedImageFormatPlaceholderCompact - ); + const unsupportedFormatOrLoading = isNftUriLoading ? loadingImagePlaceholderCompact : unsupportedImageFormatPlaceholderCompact; - const standardMetadataImageContent = isWhitelisted ? - (standardMetadata && uri && isSupportedImageFormat(standardMetadata.type) ? ( - getNftImageContent(standardMetadata.type, uri, "nft-card__image") - ) : ( - unsupportedFormatOrLoading - )) : ( - unregisteredMetadataPlaceholder - ); + const standardMetadataImageContent = isWhitelisted + ? standardMetadata && uri && isSupportedImageFormat(standardMetadata.type) + ? getNftImageContent(standardMetadata.type, uri, "nft-card__image") + : unsupportedFormatOrLoading + : unregisteredMetadataPlaceholder; - const nftImageContent = nft.metadata ? (standardMetadata ? (standardMetadataImageContent) : ( - nonStandardMetadataPlaceholder - )) : ( - noMetadataPlaceholder - ); + const nftImageContent = nft.metadata + ? standardMetadata + ? standardMetadataImageContent + : nonStandardMetadataPlaceholder + : noMetadataPlaceholder; return (
- - {nftImageContent} - + {nftImageContent} - +
{name && isWhitelisted && {name}} diff --git a/client/src/app/components/stardust/address/section/nft/NftMetadataSection.scss b/client/src/app/components/stardust/address/section/nft/NftMetadataSection.scss index 3618880e4..bd9679ef5 100644 --- a/client/src/app/components/stardust/address/section/nft/NftMetadataSection.scss +++ b/client/src/app/components/stardust/address/section/nft/NftMetadataSection.scss @@ -1,6 +1,6 @@ @import "../../../../../../scss/media-queries"; -.nft-metadata{ +.nft-metadata { display: flex; flex-direction: row; @@ -49,7 +49,7 @@ } } - .value{ + .value { font-size: 12px !important; line-height: 18px; font-weight: 500; diff --git a/client/src/app/components/stardust/address/section/nft/NftMetadataSection.tsx b/client/src/app/components/stardust/address/section/nft/NftMetadataSection.tsx index b7f569fd4..16a9e7fee 100644 --- a/client/src/app/components/stardust/address/section/nft/NftMetadataSection.tsx +++ b/client/src/app/components/stardust/address/section/nft/NftMetadataSection.tsx @@ -1,8 +1,11 @@ import React, { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { - getNftImageContent, isSupportedImageFormat, loadingImagePlaceholder, MESSAGE_NFT_SCHEMA_STANDARD, - unsupportedImageFormatPlaceholder + getNftImageContent, + isSupportedImageFormat, + loadingImagePlaceholder, + MESSAGE_NFT_SCHEMA_STANDARD, + unsupportedImageFormatPlaceholder, } from "./NftMetadataUtils"; import nftSchemeIRC27 from "~assets/schemas/nft-schema-IRC27.json"; import { useNftMetadataUri } from "~helpers/hooks/useNftMetadataUri"; @@ -43,121 +46,86 @@ const NftMetadataSection: React.FC = ({ network, nft, i } }, [nft.metadata]); - const unsupportedFormatOrLoading = isNftUriLoading ? ( - loadingImagePlaceholder - ) : ( - unsupportedImageFormatPlaceholder - ); + const unsupportedFormatOrLoading = isNftUriLoading ? loadingImagePlaceholder : unsupportedImageFormatPlaceholder; - const whitelistedNft = ( + const whitelistedNft = standardMetadata && isWhitelisted ? (
- {(uri && isSupportedImageFormat(standardMetadata?.type) ? ( - getNftImageContent(standardMetadata.type, uri, "nft-metadata__image") - ) : ( - unsupportedFormatOrLoading - ))} + {uri && isSupportedImageFormat(standardMetadata?.type) + ? getNftImageContent(standardMetadata.type, uri, "nft-metadata__image") + : unsupportedFormatOrLoading}
  • Name: - - {standardMetadata.name} - + {standardMetadata.name}
  • Token Standard: - - {standardMetadata.standard} - + {standardMetadata.standard}
  • Version: - - {standardMetadata.version} - + {standardMetadata.version}
  • Type: - - {standardMetadata.type} - + {standardMetadata.type}
  • - { - standardMetadata.collectionName && + {standardMetadata.collectionName && (
  • Collection Name: - - {standardMetadata.collectionName} - + {standardMetadata.collectionName}
  • - } - { - nft.issuerId && + )} + {nft.issuerId && (
  • Issuer Id: - +
  • - } - { - standardMetadata.issuerName && + )} + {standardMetadata.issuerName && (
  • Issuer Name: - - {standardMetadata.issuerName} - + {standardMetadata.issuerName}
  • - } + )}
- { - standardMetadata.royalties && + {standardMetadata.royalties && (

Royalties

- +
- } - { - standardMetadata.attributes && + )} + {standardMetadata.attributes && (

Attributes

- +
- } - { - standardMetadata.description && + )} + {standardMetadata.description && (

Description

- - {standardMetadata.description} - + {standardMetadata.description}
- } + )}
- ) : null - ); + ) : null; - const notWhitelistedIRC27 = ( + const notWhitelistedIRC27 = standardMetadata && !isWhitelisted ? (
@@ -174,8 +142,7 @@ const NftMetadataSection: React.FC = ({ network, nft, i
- ) : null - ); + ) : null; const notIRC27Metadata = (
@@ -188,9 +155,7 @@ const NftMetadataSection: React.FC = ({ network, nft, i const noMetadata = (
-

- There is no metadata for this Nft. -

+

There is no metadata for this Nft.

); diff --git a/client/src/app/components/stardust/address/section/nft/NftMetadataUtils.tsx b/client/src/app/components/stardust/address/section/nft/NftMetadataUtils.tsx index 4f3a5fc07..0412103cf 100644 --- a/client/src/app/components/stardust/address/section/nft/NftMetadataUtils.tsx +++ b/client/src/app/components/stardust/address/section/nft/NftMetadataUtils.tsx @@ -1,29 +1,15 @@ import React from "react"; import { ImagePlaceholder } from "./ImagePlaceholder"; -export const MESSAGE_NFT_SCHEMA_STANDARD = - "The metadata conforms to the IRC27 standard schema! Please consider submitting an entry to the"; +export const MESSAGE_NFT_SCHEMA_STANDARD = "The metadata conforms to the IRC27 standard schema! Please consider submitting an entry to the"; export const noMetadataPlaceholder = ; export const nonStandardMetadataPlaceholder = ; export const unsupportedImageFormatPlaceholderCompact = ; export const unsupportedImageFormatPlaceholder = ; export const unregisteredMetadataPlaceholder = ; -export const loadingImagePlaceholderCompact = ( - -); -export const loadingImagePlaceholder = ( - -); +export const loadingImagePlaceholderCompact = ; +export const loadingImagePlaceholder = ; /** * Supported image MIME formats. @@ -52,20 +38,8 @@ export function isSupportedImageFormat(nftType: string | undefined): boolean { */ export function getNftImageContent(contentType: string, uri: string, className: string): JSX.Element { return contentType === "video/mp4" ? ( -
{questions.map((question, idx) => (
-
- Question -
+
Question
{question.text} -
- {question.additionalInfo} -
+
{question.additionalInfo}
{getAnswer(idx, question.answers)}
))}
-
+
); }; diff --git a/client/src/app/components/stardust/address/section/voting/VotingSection.scss b/client/src/app/components/stardust/address/section/voting/VotingSection.scss index ec5f06a4c..daf1b1982 100644 --- a/client/src/app/components/stardust/address/section/voting/VotingSection.scss +++ b/client/src/app/components/stardust/address/section/voting/VotingSection.scss @@ -36,6 +36,5 @@ padding: 3px 5px; } } - } -} \ No newline at end of file +} diff --git a/client/src/app/components/stardust/address/section/voting/VotingSection.tsx b/client/src/app/components/stardust/address/section/voting/VotingSection.tsx index 1a4d85c34..3dbcbc77c 100644 --- a/client/src/app/components/stardust/address/section/voting/VotingSection.tsx +++ b/client/src/app/components/stardust/address/section/voting/VotingSection.tsx @@ -30,7 +30,7 @@ const VotingSection: React.FC = ({ eventDetails }) => { }, [eventDetails]); useEffect(() => { - const filteredResults = eventDetails.filter(event => event.status?.status.startsWith(currentTab ?? "")); + const filteredResults = eventDetails.filter((event) => event.status?.status.startsWith(currentTab ?? "")); setFilteredEventDetails(filteredResults); setPageNumber(1); }, [currentTab]); @@ -51,7 +51,7 @@ const VotingSection: React.FC = ({ eventDetails }) => {
-
- {currentPage?.map((event, idx) => ( - - ))} -
+
{currentPage?.map((event, idx) => )}
setPageNumber(newPage)} + onPageChange={(newPage) => setPageNumber(newPage)} /> -
+
); }; diff --git a/client/src/app/components/stardust/address/section/voting/VotingUtils.ts b/client/src/app/components/stardust/address/section/voting/VotingUtils.ts index eb80a104b..b31418586 100644 --- a/client/src/app/components/stardust/address/section/voting/VotingUtils.ts +++ b/client/src/app/components/stardust/address/section/voting/VotingUtils.ts @@ -5,19 +5,18 @@ export type VotingEventTab = "upcoming" | "commencing" | "holding" | "ended"; export const buildVotingEventTabs = (events: IEventDetails[]): VotingEventTab[] => { const tabs: VotingEventTab[] = []; if (events.length > 0) { - if (events.some(event => event.status?.status.startsWith("upcoming"))) { + if (events.some((event) => event.status?.status.startsWith("upcoming"))) { tabs.push("upcoming"); } - if (events.some(event => event.status?.status.startsWith("commencing"))) { + if (events.some((event) => event.status?.status.startsWith("commencing"))) { tabs.push("commencing"); } - if (events.some(event => event.status?.status.startsWith("holding"))) { + if (events.some((event) => event.status?.status.startsWith("holding"))) { tabs.push("holding"); } - if (events.some(event => event.status?.status.startsWith("ended"))) { + if (events.some((event) => event.status?.status.startsWith("ended"))) { tabs.push("ended"); } } return tabs; }; - diff --git a/client/src/app/components/stardust/block/BlockTangleState.scss b/client/src/app/components/stardust/block/BlockTangleState.scss index acecfa9b7..ce8ae18e1 100644 --- a/client/src/app/components/stardust/block/BlockTangleState.scss +++ b/client/src/app/components/stardust/block/BlockTangleState.scss @@ -32,7 +32,6 @@ color: var(--link-color); cursor: pointer; } - } .block-tangle-state { diff --git a/client/src/app/components/stardust/block/BlockTangleState.tsx b/client/src/app/components/stardust/block/BlockTangleState.tsx index f62716b56..7b77ad341 100644 --- a/client/src/app/components/stardust/block/BlockTangleState.tsx +++ b/client/src/app/components/stardust/block/BlockTangleState.tsx @@ -6,9 +6,7 @@ import { useMilestoneDetails } from "~helpers/hooks/useMilestoneDetails"; import Tooltip from "../../Tooltip"; import "./BlockTangleState.scss"; -const BlockTangleState: React.FC = ( - { network, status, milestoneIndex, hasConflicts, conflictReason, onClick } -) => { +const BlockTangleState: React.FC = ({ network, status, milestoneIndex, hasConflicts, conflictReason, onClick }) => { const [ago, setAgo] = useState(); const [blockId, setBlockId] = useState(); const [milestoneDetails] = useMilestoneDetails(network, milestoneIndex ?? null); @@ -22,57 +20,49 @@ const BlockTangleState: React.FC = ( return (
- {status === "milestone" && + {status === "milestone" && (
- {milestoneIndex && ("Confirmed")} - {!milestoneIndex && ("Pending")} + {milestoneIndex && "Confirmed"} + {!milestoneIndex && "Pending"}
- {milestoneIndex && ( - - Created {" "}{ago} - - )} + {milestoneIndex && Created {ago}}
-
} +
+ )} - {status !== "milestone" && + {status !== "milestone" && (
- {status === "unknown" && ("Unknown")} - {status === "referenced" && !hasConflicts && ("Confirmed")} - {status === "pending" && ("Pending")} - {hasConflicts && + {status === "unknown" && "Unknown"} + {status === "referenced" && !hasConflicts && "Confirmed"} + {status === "pending" && "Pending"} + {hasConflicts && ( Conflicting - } + + )}
{status === "referenced" && milestoneIndex !== undefined && milestoneIndex > 1 ? (
@@ -84,12 +74,16 @@ const BlockTangleState: React.FC = ( onClick(blockId); } }} - >Milestone {milestoneIndex} + > + Milestone {milestoneIndex} {ago}
- ) : ""} -
} + ) : ( + "" + )} + + )}
); }; diff --git a/client/src/app/components/stardust/block/BlockTangleStateProps.ts b/client/src/app/components/stardust/block/BlockTangleStateProps.ts index 29f15e4f7..f3a1fd0ff 100644 --- a/client/src/app/components/stardust/block/BlockTangleStateProps.ts +++ b/client/src/app/components/stardust/block/BlockTangleStateProps.ts @@ -31,4 +31,3 @@ export interface BlockTangleStateProps { */ onClick?(blockId?: string): void; } - diff --git a/client/src/app/components/stardust/block/MilestoneControls.scss b/client/src/app/components/stardust/block/MilestoneControls.scss index 208014b66..d00b2f5ea 100644 --- a/client/src/app/components/stardust/block/MilestoneControls.scss +++ b/client/src/app/components/stardust/block/MilestoneControls.scss @@ -46,4 +46,3 @@ } } } - diff --git a/client/src/app/components/stardust/block/MilestoneControls.tsx b/client/src/app/components/stardust/block/MilestoneControls.tsx index a41b0b6bc..10dd79774 100644 --- a/client/src/app/components/stardust/block/MilestoneControls.tsx +++ b/client/src/app/components/stardust/block/MilestoneControls.tsx @@ -21,14 +21,10 @@ const MilestoneControls: React.FC = ({ milestone }) => { useEffect(() => { if (previousMsDetails?.milestone) { - setPreviousMsBlockId( - TransactionsHelper.blockIdFromMilestonePayload(protocolVersion, previousMsDetails.milestone) - ); + setPreviousMsBlockId(TransactionsHelper.blockIdFromMilestonePayload(protocolVersion, previousMsDetails.milestone)); } if (nextMsDetails?.milestone) { - setNextMsBlockId( - TransactionsHelper.blockIdFromMilestonePayload(protocolVersion, nextMsDetails.milestone) - ); + setNextMsBlockId(TransactionsHelper.blockIdFromMilestonePayload(protocolVersion, nextMsDetails.milestone)); } }, [nextMsDetails, previousMsDetails]); @@ -59,4 +55,3 @@ const MilestoneControls: React.FC = ({ milestone }) => { }; export default MilestoneControls; - diff --git a/client/src/app/components/stardust/block/payload/ReceiptPayload.tsx b/client/src/app/components/stardust/block/payload/ReceiptPayload.tsx index 2cf7d6474..45a27a5f6 100644 --- a/client/src/app/components/stardust/block/payload/ReceiptPayload.tsx +++ b/client/src/app/components/stardust/block/payload/ReceiptPayload.tsx @@ -31,7 +31,7 @@ class ReceiptPayload extends Component super(props); this.state = { - formatFull: false + formatFull: false, }; } @@ -49,92 +49,55 @@ class ReceiptPayload extends Component

Receipt Payload

-
- Migrated At -
+
Migrated At
+
{this.props.payload.migratedAt}
+
Final
- {this.props.payload.migratedAt} -
-
- Final -
-
-
- {this.props.payload.final ? "Yes" : "No"} -
+
{this.props.payload.final ? "Yes" : "No"}
{this.props.payload.funds.map((f, idx) => ( -
+

Migrated Fund {idx}

-
- Tail Transaction Hash -
-
- {f.tailTransactionHash} -
+
Tail Transaction Hash
+
{f.tailTransactionHash}
-
- Deposit -
+
Deposit
))} -
- Input Transaction Milestone Id -
-
- {this.props.payload.transaction.input.milestoneId} -
-
- Output Transaction Amount to Treasury -
+
Input Transaction Milestone Id
+
{this.props.payload.transaction.input.milestoneId}
+
Output Transaction Amount to Treasury
@@ -144,4 +107,3 @@ class ReceiptPayload extends Component } export default ReceiptPayload; - diff --git a/client/src/app/components/stardust/block/payload/TaggedDataPayload.tsx b/client/src/app/components/stardust/block/payload/TaggedDataPayload.tsx index 589c6738d..70baaaa92 100644 --- a/client/src/app/components/stardust/block/payload/TaggedDataPayload.tsx +++ b/client/src/app/components/stardust/block/payload/TaggedDataPayload.tsx @@ -16,7 +16,7 @@ class TaggedDataPayload extends Component Tag
- + )} {hexData && ( @@ -55,10 +52,7 @@ class TaggedDataPayload extends Component Data
- + )}
@@ -68,4 +62,3 @@ class TaggedDataPayload extends Component{inputs.length}
- {inputs.map((input, idx) => )} + {inputs.map((input, idx) => ( + + ))}
@@ -100,4 +102,3 @@ class TransactionPayload extends AsyncComponent { public render(): ReactNode { const { network, milestonePayload, history } = this.props; const { - index, timestamp, previousMilestoneId, inclusionMerkleRoot, - appliedMerkleRoot, metadata, options, signatures + index, + timestamp, + previousMilestoneId, + inclusionMerkleRoot, + appliedMerkleRoot, + metadata, + options, + signatures, }: IMilestonePayload = milestonePayload; let receiptMilestoneOption: ReceiptMilestoneOption | null = null; let protocolParamsMilestoneOption: ProtocolParamsMilestoneOption | null = null; - if (options?.some((option => option.type === MilestoneOptionType.Receipt))) { - receiptMilestoneOption = options.find( - option => option.type === MilestoneOptionType.Receipt - ) as ReceiptMilestoneOption; + if (options?.some((option) => option.type === MilestoneOptionType.Receipt)) { + receiptMilestoneOption = options.find((option) => option.type === MilestoneOptionType.Receipt) as ReceiptMilestoneOption; } - if (options?.some((option => option.type === MilestoneOptionType.ProtocolParams))) { + if (options?.some((option) => option.type === MilestoneOptionType.ProtocolParams)) { protocolParamsMilestoneOption = options.find( - option => option.type === MilestoneOptionType.ProtocolParams + (option) => option.type === MilestoneOptionType.ProtocolParams, ) as ProtocolParamsMilestoneOption; } @@ -59,13 +66,7 @@ class MilestonePayload extends AsyncComponent {
Date
-
- {timestamp && DateHelper.format( - DateHelper.milliseconds( - timestamp - ) - )} -
+
{timestamp && DateHelper.format(DateHelper.milliseconds(timestamp))}
Previous milestone Id
@@ -97,32 +98,21 @@ class MilestonePayload extends AsyncComponent {
Target milestone index
-
- {protocolParamsMilestoneOption?.targetMilestoneIndex} -
+
{protocolParamsMilestoneOption?.targetMilestoneIndex}
Target protocol version
-
- {protocolParamsMilestoneOption?.protocolVersion} -
+
{protocolParamsMilestoneOption?.protocolVersion}
Protocol paramaters
-
- {protocolParamsMilestoneOption?.params} -
+
{protocolParamsMilestoneOption?.params}
)} {receiptMilestoneOption && (
- +
)}
@@ -133,4 +123,3 @@ class MilestonePayload extends AsyncComponent { } export default MilestonePayload; - diff --git a/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.scss b/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.scss index f64a7772e..467430489 100644 --- a/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.scss +++ b/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.scss @@ -58,4 +58,3 @@ } } } - diff --git a/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.tsx b/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.tsx index 0ca7224f1..fc10c25ab 100644 --- a/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.tsx +++ b/client/src/app/components/stardust/block/payload/milestone/MilestoneSignaturesSection.tsx @@ -14,10 +14,7 @@ const MilestoneSignaturesSection: React.FC = ({ signat return (
-
setExpanded(!expanded)} - > +
setExpanded(!expanded)}>
@@ -45,4 +42,3 @@ const MilestoneSignaturesSection: React.FC = ({ signat }; export default MilestoneSignaturesSection; - diff --git a/client/src/app/components/stardust/block/section/BlockMetadataSection.tsx b/client/src/app/components/stardust/block/section/BlockMetadataSection.tsx index 69db6423a..043ca9219 100644 --- a/client/src/app/components/stardust/block/section/BlockMetadataSection.tsx +++ b/client/src/app/components/stardust/block/section/BlockMetadataSection.tsx @@ -13,29 +13,28 @@ interface BlockMetadataSectionProps { readonly isLinksDisabled: boolean; } -const BlockMetadataSection: React.FC = ( - { network, metadata, metadataError, blockChildren, conflictReason, isLinksDisabled } -) => ( +const BlockMetadataSection: React.FC = ({ + network, + metadata, + metadataError, + blockChildren, + conflictReason, + isLinksDisabled, +}) => (
- {!metadata && !metadataError && ()} - {metadataError && ( -

Failed to retrieve metadata. {metadataError}

- )} + {!metadata && !metadataError && } + {metadataError &&

Failed to retrieve metadata. {metadataError}

} {metadata && !metadataError && (
Is Solid
- - {metadata?.isSolid ? "Yes" : "No"} - + {metadata?.isSolid ? "Yes" : "No"}
-
- Inclusion Status -
+
Inclusion Status
@@ -49,38 +48,20 @@ const BlockMetadataSection: React.FC = (
{metadata?.parents && (
-
- Parents -
+
Parents
{metadata.parents.map((parent, idx) => ( -
- +
+
))}
)} {blockChildren && (
-
- Children -
+
Children
{blockChildren.map((child, idx) => ( -
- +
+
))}
@@ -96,8 +77,7 @@ BlockMetadataSection.defaultProps = { blockChildren: undefined, conflictReason: undefined, metadata: undefined, - metadataError: undefined + metadataError: undefined, }; export default BlockMetadataSection; - diff --git a/client/src/app/components/stardust/block/section/BlockPayloadSection.tsx b/client/src/app/components/stardust/block/section/BlockPayloadSection.tsx index ccc726e29..7460c5a36 100644 --- a/client/src/app/components/stardust/block/section/BlockPayloadSection.tsx +++ b/client/src/app/components/stardust/block/section/BlockPayloadSection.tsx @@ -1,6 +1,11 @@ import { - Block, PayloadType, Unlock, TransactionPayload as ITransactionPayload, - MilestonePayload as IMilestonePayload, RegularTransactionEssence, TaggedDataPayload as ITaggedDataPayload + Block, + PayloadType, + Unlock, + TransactionPayload as ITransactionPayload, + MilestonePayload as IMilestonePayload, + RegularTransactionEssence, + TaggedDataPayload as ITaggedDataPayload, } from "@iota/sdk-wasm/web"; import * as H from "history"; import React from "react"; @@ -22,13 +27,18 @@ interface BlockPayloadSectionProps { readonly isLinksDisabled: boolean; } -const BlockPayloadSection: React.FC = ( - { network, protocolVersion, block, inputs, outputs, unlocks, transferTotal, history, isLinksDisabled } -) => { - if ( - block.payload?.type === PayloadType.Transaction && - inputs && unlocks && outputs && transferTotal !== undefined - ) { +const BlockPayloadSection: React.FC = ({ + network, + protocolVersion, + block, + inputs, + outputs, + unlocks, + transferTotal, + history, + isLinksDisabled, +}) => { + if (block.payload?.type === PayloadType.Transaction && inputs && unlocks && outputs && transferTotal !== undefined) { const transactionPayload = block.payload as ITransactionPayload; const transactionEssence = transactionPayload.essence as RegularTransactionEssence; @@ -43,21 +53,14 @@ const BlockPayloadSection: React.FC = ( isLinksDisabled={isLinksDisabled} />
- { - transactionEssence.payload?.type === PayloadType.TaggedData && + {transactionEssence.payload?.type === PayloadType.TaggedData && (
- +
- } + )} ); - } else if ( - block.payload?.type === PayloadType.Milestone - ) { + } else if (block.payload?.type === PayloadType.Milestone) { return ( = ( protocolVersion={protocolVersion} /> ); - } else if ( - block.payload?.type === PayloadType.TaggedData - ) { + } else if (block.payload?.type === PayloadType.TaggedData) { return (
- +
); } @@ -87,8 +84,7 @@ BlockPayloadSection.defaultProps = { inputs: undefined, outputs: undefined, transferTotal: undefined, - unlocks: undefined + unlocks: undefined, }; export default BlockPayloadSection; - diff --git a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.scss b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.scss index 60f7e2a47..37cbc1825 100644 --- a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.scss +++ b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.scss @@ -42,7 +42,7 @@ } .refblocks__tx-value { - text-align: right!important; + text-align: right !important; } } @@ -144,4 +144,3 @@ margin-top: 28px; } } - diff --git a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.tsx b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.tsx index 469c2ad36..f211d7d76 100644 --- a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.tsx +++ b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSection.tsx @@ -38,31 +38,26 @@ const ReferencedBlocksSection: React.FC = ({ block {currentPage.map((blockId, idx) => ( - + ))}
{currentPage.map((blockId, idx) => ( - + ))}
- ) : } + ) : ( + + )} {showPagination && ( setPageNumber(page)} + onPageChange={(page) => setPageNumber(page)} /> )}
@@ -70,8 +65,7 @@ const ReferencedBlocksSection: React.FC = ({ block }; ReferencedBlocksSection.defaultProps = { - blockIds: undefined + blockIds: undefined, }; export default ReferencedBlocksSection; - diff --git a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSectionRow.tsx b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSectionRow.tsx index 8599338c9..def58af5a 100644 --- a/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSectionRow.tsx +++ b/client/src/app/components/stardust/block/section/referenced-blocks/ReferencedBlocksSectionRow.tsx @@ -21,80 +21,61 @@ const ReferencedBlocksSectionRow: React.FC = ({ blockId, isTable }) => { const [isFormattedValue, setIsFormattedValue] = useState(true); const payloadType = NameHelper.getPayloadType(block ?? undefined); - const transactionValue = transferTotal ? - formatAmount(Number(transferTotal), tokenInfo, !isFormattedValue) : - "--"; + const transactionValue = transferTotal ? formatAmount(Number(transferTotal), tokenInfo, !isFormattedValue) : "--"; - return ( - isTable ? ( - - - - - {isLoading ? : payloadType} - { - isLoading ? - : -
setIsFormattedValue(!isFormattedValue)} - className={classNames({ "pointer": transactionValue !== "--" })} - > - {transactionValue} -
- } - - - ) : ( -
-
-
- Block Id: -
-
- + return isTable ? ( + + + + + {isLoading ? : payloadType} + + {isLoading ? ( + + ) : ( +
setIsFormattedValue(!isFormattedValue)} + className={classNames({ pointer: transactionValue !== "--" })} + > + {transactionValue}
+ )} + + + ) : ( +
+
+
Block Id:
+
+
- {isLoading ? : ( - +
+ {isLoading ? ( + + ) : ( + +
+
Payload type:
+
{payloadType}
+
+ {transactionValue !== "--" && (
-
- Payload type: -
-
- {payloadType} +
Value:
+
+ setIsFormattedValue(!isFormattedValue)} className="pointer margin-r-5"> + {transactionValue} +
- {transactionValue !== "--" && ( -
-
- Value: -
-
- setIsFormattedValue(!isFormattedValue)} - className="pointer margin-r-5" - > - {transactionValue} - -
-
- )} - - )} -
- ) + )} +
+ )} +
); }; ReferencedBlocksSectionRow.defaultProps = { - isTable: undefined + isTable: undefined, }; export default ReferencedBlocksSectionRow; - diff --git a/client/src/app/components/stardust/foundry/TokenInfoSection.scss b/client/src/app/components/stardust/foundry/TokenInfoSection.scss index b3cc0f349..8b649ed21 100644 --- a/client/src/app/components/stardust/foundry/TokenInfoSection.scss +++ b/client/src/app/components/stardust/foundry/TokenInfoSection.scss @@ -3,10 +3,10 @@ @import "../../../../scss/media-queries"; @import "../../../../scss/variables"; -.token-info{ +.token-info { display: flex; flex-direction: column; - + .token-metadata__logo { width: 32px; height: 32px; @@ -33,4 +33,4 @@ background-color: var(--light-bg); color: $gray; } -} \ No newline at end of file +} diff --git a/client/src/app/components/stardust/foundry/TokenInfoSection.tsx b/client/src/app/components/stardust/foundry/TokenInfoSection.tsx index 537cd9293..e0d189268 100644 --- a/client/src/app/components/stardust/foundry/TokenInfoSection.tsx +++ b/client/src/app/components/stardust/foundry/TokenInfoSection.tsx @@ -39,9 +39,7 @@ const TokenInfoSection: React.FC = ({ tokenId, tokenSchem {tokenMetadata && isWhitelisted && (
-
- Name -
+
Name
{tokenMetadata.logoUrl && ( @@ -52,39 +50,24 @@ const TokenInfoSection: React.FC = ({ tokenId, tokenSchem /> )} - - {tokenMetadata.name} - - - {tokenMetadata.symbol} - + {tokenMetadata.name} + {tokenMetadata.symbol}
{tokenMetadata.description && (
-
- Description -
+
Description
- - {tokenMetadata.description} - + {tokenMetadata.description}
)} {tokenMetadata.logoUrl && (
-
- Resources -
+
Resources
- + {tokenMetadata.logoUrl} @@ -94,43 +77,27 @@ const TokenInfoSection: React.FC = ({ tokenId, tokenSchem
)}
-
- Token scheme -
+
Token scheme
- - {tokenScheme.type} - + {tokenScheme.type}
-
- Maximum supply -
+
Maximum supply
- - {maximumSupply} - + {maximumSupply}
-
- Minted tokens -
+
Minted tokens
- - {mintedTokens} - + {mintedTokens}
-
- Melted tokens -
+
Melted tokens
- - {meltedTokens} - + {meltedTokens}
@@ -138,7 +105,7 @@ const TokenInfoSection: React.FC = ({ tokenId, tokenSchem ); }; TokenInfoSection.defaultProps = { - tokenMetadata: undefined + tokenMetadata: undefined, }; export default TokenInfoSection; diff --git a/client/src/app/components/stardust/history/TransactionCard.tsx b/client/src/app/components/stardust/history/TransactionCard.tsx index f047121bc..e48e9342a 100644 --- a/client/src/app/components/stardust/history/TransactionCard.tsx +++ b/client/src/app/components/stardust/history/TransactionCard.tsx @@ -9,67 +9,55 @@ import { CHRYSALIS_MAINNET } from "~models/config/networkType"; import NetworkContext from "../../../context/NetworkContext"; import TruncatedId from "../TruncatedId"; -const TransactionCard: React.FC = ( - { outputId, transactionId, date, milestoneIndex, value, isSpent, isFormattedAmounts, setIsFormattedAmounts } -) => { +const TransactionCard: React.FC = ({ + outputId, + transactionId, + date, + milestoneIndex, + value, + isSpent, + isFormattedAmounts, + setIsFormattedAmounts, +}) => { const { name: network, tokenInfo } = useContext(NetworkContext); const ago = moment(date * 1000).fromNow(); const valueView = ( - setIsFormattedAmounts(!isFormattedAmounts)} > + setIsFormattedAmounts(!isFormattedAmounts)}> {`${isSpent ? "-" : "+"} ${formatAmount(value, tokenInfo, !isFormattedAmounts)}`} ); - const isTransactionFromStardustGenesis = milestoneIndex && - TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndex); - const transactionLink = isTransactionFromStardustGenesis ? - `/${CHRYSALIS_MAINNET}/search/${transactionId}` : - `/${network}/transaction/${transactionId}`; + const isTransactionFromStardustGenesis = + milestoneIndex && TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndex); + const transactionLink = isTransactionFromStardustGenesis + ? `/${CHRYSALIS_MAINNET}/search/${transactionId}` + : `/${network}/transaction/${transactionId}`; return (
-
- Transaction Id -
+
Transaction Id
- +
-
- Output Id -
+
Output Id
- +
-
- Date -
-
- {`${DateHelper.formatShort(date * 1000)} (${ago})`} -
+
Date
+
{`${DateHelper.formatShort(date * 1000)} (${ago})`}
-
- Value -
-
- {valueView} -
+
Value
+
{valueView}
); }; export default TransactionCard; - diff --git a/client/src/app/components/stardust/history/TransactionEntryProps.ts b/client/src/app/components/stardust/history/TransactionEntryProps.ts index 4dd351098..981519548 100644 --- a/client/src/app/components/stardust/history/TransactionEntryProps.ts +++ b/client/src/app/components/stardust/history/TransactionEntryProps.ts @@ -45,4 +45,3 @@ export interface ITransactionEntryProps { */ darkBackgroundRow?: boolean; } - diff --git a/client/src/app/components/stardust/history/TransactionHistory.scss b/client/src/app/components/stardust/history/TransactionHistory.scss index 3c9076b7d..4081bd470 100644 --- a/client/src/app/components/stardust/history/TransactionHistory.scss +++ b/client/src/app/components/stardust/history/TransactionHistory.scss @@ -36,7 +36,7 @@ th { @include font-size(12px); - text-align: center!important; + text-align: center !important; color: $gray-6; font-weight: 600; text-align: left; @@ -47,7 +47,8 @@ padding: 16px 0; text-align: center; - &.transaction-id, &.output-id { + &.transaction-id, + &.output-id { @include font-size(14px); color: var(--link-color); font-family: $ibm-plex-mono; diff --git a/client/src/app/components/stardust/history/TransactionHistory.tsx b/client/src/app/components/stardust/history/TransactionHistory.tsx index a36cf2bd6..6a1e47611 100644 --- a/client/src/app/components/stardust/history/TransactionHistory.tsx +++ b/client/src/app/components/stardust/history/TransactionHistory.tsx @@ -13,14 +13,8 @@ interface TransactionHistoryProps { readonly setDisabled?: (isDisabled: boolean) => void; } -const TransactionHistory: React.FC = ( - { network, address, setLoading, setDisabled } -) => { - const [historyView, outputDetailsMap, loadMore, isLoading, hasMore] = useAddressHistory( - network, - address, - setDisabled - ); +const TransactionHistory: React.FC = ({ network, address, setLoading, setDisabled }) => { + const [historyView, outputDetailsMap, loadMore, isLoading, hasMore] = useAddressHistory(network, address, setDisabled); const [isFormattedAmounts, setIsFormattedAmounts] = useState(true); useEffect(() => { @@ -29,7 +23,7 @@ const TransactionHistory: React.FC = ( let isDarkBackgroundRow = false; - return (historyView.length > 0 && address ? ( + return historyView.length > 0 && address ? (
@@ -44,15 +38,15 @@ const TransactionHistory: React.FC = ( - {historyView.length > 0 && ( + {historyView.length > 0 && historyView.map((historyItem, idx) => { const outputDetails = outputDetailsMap[historyItem.outputId]; if (!outputDetails) { return null; } - const transactionId = historyItem.isSpent ? - outputDetails.metadata.transactionIdSpent : - outputDetails.metadata.transactionId; + const transactionId = historyItem.isSpent + ? outputDetails.metadata.transactionIdSpent + : outputDetails.metadata.transactionId; if (!transactionId) { return null; @@ -63,9 +57,9 @@ const TransactionHistory: React.FC = ( const previousItemDetails = outputDetailsMap[historyView[idx - 1].outputId]; const previousSpent = historyView[idx - 1].isSpent; if (previousItemDetails) { - const previousTransactionId = previousSpent ? - previousItemDetails.metadata.transactionIdSpent : - previousItemDetails.metadata.transactionId; + const previousTransactionId = previousSpent + ? previousItemDetails.metadata.transactionIdSpent + : previousItemDetails.metadata.transactionId; if (transactionId !== previousTransactionId) { isDarkBackgroundRow = !isDarkBackgroundRow; @@ -88,22 +82,21 @@ const TransactionHistory: React.FC = ( /> ); - }) - )} + })} {/* Only visible in mobile -- Card transactions*/}
- {historyView.length > 0 && ( + {historyView.length > 0 && historyView.map((historyItem, idx) => { const outputDetails = outputDetailsMap[historyItem.outputId]; if (!outputDetails) { return null; } - const transactionId = historyItem.isSpent ? - outputDetails.metadata.transactionIdSpent : - outputDetails.metadata.transactionId; + const transactionId = historyItem.isSpent + ? outputDetails.metadata.transactionIdSpent + : outputDetails.metadata.transactionId; if (!transactionId) { return null; @@ -123,21 +116,19 @@ const TransactionHistory: React.FC = ( /> ); - }) - )} + })}
{hasMore && historyView.length > 0 && (
)} -
) : +
+ ) : (
-

- There are no transactions for this address. -

+

There are no transactions for this address.

@@ -146,8 +137,7 @@ const TransactionHistory: React.FC = ( TransactionHistory.defaultProps = { address: undefined, - setDisabled: undefined + setDisabled: undefined, }; export default TransactionHistory; - diff --git a/client/src/app/components/stardust/history/TransactionRow.tsx b/client/src/app/components/stardust/history/TransactionRow.tsx index eb48516c2..1bc2b6dd5 100644 --- a/client/src/app/components/stardust/history/TransactionRow.tsx +++ b/client/src/app/components/stardust/history/TransactionRow.tsx @@ -11,35 +11,33 @@ import NetworkContext from "../../../context/NetworkContext"; import Tooltip from "../../Tooltip"; import TruncatedId from "../TruncatedId"; -const TransactionRow: React.FC = ( - { - outputId, - transactionId, - date, - milestoneIndex, - value, - isSpent, - isFormattedAmounts, - setIsFormattedAmounts, - darkBackgroundRow - } -) => { +const TransactionRow: React.FC = ({ + outputId, + transactionId, + date, + milestoneIndex, + value, + isSpent, + isFormattedAmounts, + setIsFormattedAmounts, + darkBackgroundRow, +}) => { const { name: network, tokenInfo } = useContext(NetworkContext); const outputIdTransaction = outputId.slice(0, -4); const outputIdIndex = outputId.slice(-4); const ago = moment(date * 1000).fromNow(); const valueView = ( - setIsFormattedAmounts(!isFormattedAmounts)} > + setIsFormattedAmounts(!isFormattedAmounts)}> {`${isSpent ? "-" : "+"} ${formatAmount(value, tokenInfo, !isFormattedAmounts)}`} ); - const isTransactionFromStardustGenesis = milestoneIndex && - TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndex); - const transactionLink = isTransactionFromStardustGenesis ? - `/${CHRYSALIS_MAINNET}/search/${transactionId}` : - `/${network}/transaction/${transactionId}`; + const isTransactionFromStardustGenesis = + milestoneIndex && TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndex); + const transactionLink = isTransactionFromStardustGenesis + ? `/${CHRYSALIS_MAINNET}/search/${transactionId}` + : `/${network}/transaction/${transactionId}`; return ( @@ -47,10 +45,7 @@ const TransactionRow: React.FC = ( {isTransactionFromStardustGenesis && ( - + warning @@ -64,15 +59,10 @@ const TransactionRow: React.FC = ( {outputIdIndex} - {date === 0 ? ( - Genesis - ) : ( - {`${DateHelper.formatShort(date * 1000)} (${ago})`} - )} - {valueView} + {date === 0 ? Genesis : {`${DateHelper.formatShort(date * 1000)} (${ago})`}} + {valueView} ); }; export default TransactionRow; - diff --git a/client/src/app/components/stardust/statistics/ChartHeader.scss b/client/src/app/components/stardust/statistics/ChartHeader.scss index 19b25c8ec..360ac22c3 100644 --- a/client/src/app/components/stardust/statistics/ChartHeader.scss +++ b/client/src/app/components/stardust/statistics/ChartHeader.scss @@ -18,7 +18,10 @@ font-weight: 700; letter-spacing: 0.5px; line-height: 24px; - font-feature-settings: 'pnum' on, 'lnum' on, 'ss01' on; + font-feature-settings: + "pnum" on, + "lnum" on, + "ss01" on; @include phone-down { padding-left: 4px; @@ -50,8 +53,8 @@ } } .charts-css.legend li:first-child::before { - background-color: var(--modal-color,transparent); - border-color: var(--border-color,var(--border-color,#000)); + background-color: var(--modal-color, transparent); + border-color: var(--border-color, var(--border-color, #000)); } .charts-css.legend-circle li::before { @@ -64,10 +67,9 @@ content: ""; display: inline-block; vertical-align: middle; - -webkit-margin-end: .5rem; - margin-inline-end: .5rem; + -webkit-margin-end: 0.5rem; + margin-inline-end: 0.5rem; border-width: 2px; border-style: solid; } } - diff --git a/client/src/app/components/stardust/statistics/ChartHeader.tsx b/client/src/app/components/stardust/statistics/ChartHeader.tsx index a8cb2bcb2..a8fa400ad 100644 --- a/client/src/app/components/stardust/statistics/ChartHeader.tsx +++ b/client/src/app/components/stardust/statistics/ChartHeader.tsx @@ -20,19 +20,12 @@ const ChartHeader: React.FC = ({ title, info, disabled, legend {title && (

{title}

- {info && ( - - )} + {info && }
)}
- {!disabled && legend && ( - - )} + {!disabled && legend && }
); @@ -40,7 +33,7 @@ ChartHeader.defaultProps = { disabled: undefined, info: undefined, legend: undefined, - title: undefined + title: undefined, }; export default ChartHeader; diff --git a/client/src/app/components/stardust/statistics/ChartInfoPanel.tsx b/client/src/app/components/stardust/statistics/ChartInfoPanel.tsx index b432e0633..7f4cdc855 100644 --- a/client/src/app/components/stardust/statistics/ChartInfoPanel.tsx +++ b/client/src/app/components/stardust/statistics/ChartInfoPanel.tsx @@ -5,19 +5,15 @@ interface ChartTooltipProps { readonly value: string | number; } -const ChartInfoPanel: React.FC = ({ label, value }) => - ( -
-
-
- {label} -
-
-

{value}

-
+const ChartInfoPanel: React.FC = ({ label, value }) => ( +
+
+
{label}
+
+

{value}

- ); +
+); export default ChartInfoPanel; - diff --git a/client/src/app/components/stardust/statistics/ChartLegend.tsx b/client/src/app/components/stardust/statistics/ChartLegend.tsx index e264ec126..65409f0e6 100644 --- a/client/src/app/components/stardust/statistics/ChartLegend.tsx +++ b/client/src/app/components/stardust/statistics/ChartLegend.tsx @@ -12,14 +12,8 @@ const ChartLegend: React.FC = ({ labels, colors }) => ( const thisColor = colors[idx]; return ( -
-
+
+
{label}
); @@ -28,4 +22,3 @@ const ChartLegend: React.FC = ({ labels, colors }) => ( ); export default ChartLegend; - diff --git a/client/src/app/components/stardust/statistics/ChartTooltip.scss b/client/src/app/components/stardust/statistics/ChartTooltip.scss index 01231080b..da8c83c9d 100644 --- a/client/src/app/components/stardust/statistics/ChartTooltip.scss +++ b/client/src/app/components/stardust/statistics/ChartTooltip.scss @@ -14,7 +14,8 @@ z-index: 10; #content { - p, span { + p, + span { font-family: $inter; letter-spacing: 0.5px; } @@ -34,7 +35,8 @@ } @include phone-down { - p, span { + p, + span { @include font-size(10px); } } diff --git a/client/src/app/components/stardust/statistics/ChartTooltip.tsx b/client/src/app/components/stardust/statistics/ChartTooltip.tsx index 4a2f81396..6bf51d3ac 100644 --- a/client/src/app/components/stardust/statistics/ChartTooltip.tsx +++ b/client/src/app/components/stardust/statistics/ChartTooltip.tsx @@ -10,7 +10,7 @@ const ChartTooltip: React.FC = ({ tooltipRef }) => { const getPosition = useCallback( ({ clientX, clientY }: { clientX: number; clientY: number }) => setPosition({ x: clientX, y: clientY }), - [] + [], ); useLayoutEffect(() => { @@ -27,7 +27,7 @@ const ChartTooltip: React.FC = ({ tooltipRef }) => { const remainingWidthLeft = position.x; if (remainingWidthRight <= tooltipWidth && remainingWidthLeft <= tooltipWidth) { - x = position.x - (tooltipWidth / 2); + x = position.x - tooltipWidth / 2; } else if (remainingWidthRight <= tooltipWidth) { x = position.x - tooltipWidth; } @@ -41,7 +41,7 @@ const ChartTooltip: React.FC = ({ tooltipRef }) => { ref={tooltipRef} style={{ top: position.y + 16, - left: getX() + left: getX(), }} >
@@ -50,4 +50,3 @@ const ChartTooltip: React.FC = ({ tooltipRef }) => { }; export default ChartTooltip; - diff --git a/client/src/app/components/stardust/statistics/ChartUtils.tsx b/client/src/app/components/stardust/statistics/ChartUtils.tsx index c67d20bba..332925f2c 100644 --- a/client/src/app/components/stardust/statistics/ChartUtils.tsx +++ b/client/src/app/components/stardust/statistics/ChartUtils.tsx @@ -17,21 +17,19 @@ export const noDataView = () => (
); - const formatToMagnituge = (val: number) => format(d3FormatSpecifier(val)); -export const useSingleValueTooltip = ( - data: { [name: string]: number; time: number }[], - label?: string -) => { - const buildTooltip = useCallback((dataPoint: { [name: string]: number }): string => ( - ` +export const useSingleValueTooltip = (data: { [name: string]: number; time: number }[], label?: string) => { + const buildTooltip = useCallback( + (dataPoint: { [name: string]: number }): string => + `

${moment.unix(dataPoint.time).format("DD-MM-YYYY")}

${label ?? "count"}: ${formatToMagnituge(dataPoint.n)(dataPoint.n)}

- ` - ), [data, label]); + `, + [data, label], + ); return buildTooltip; }; @@ -39,28 +37,32 @@ export const useMultiValueTooltip = ( data: { [name: string]: number; time: number }[], subgroups: string[], colors: string[], - groupLabels?: string[] + groupLabels?: string[], ) => { - const buildTooltip = useCallback((dataPoint: { [key: string]: number }): string => (` + const buildTooltip = useCallback( + (dataPoint: { [key: string]: number }): string => `

${moment.unix(dataPoint.time).format("DD-MM-YYYY")}

- ${subgroups.map((subgroup, idx) => (` + ${subgroups + .map( + (subgroup, idx) => `

${groupLabels ? groupLabels[idx] : subgroup}: ${formatToMagnituge(dataPoint[subgroup])(dataPoint[subgroup])}

- `)).join("")}` - ), [data, subgroups, groupLabels, colors]); + `, + ) + .join("")}`, + [data, subgroups, groupLabels, colors], + ); return buildTooltip; }; -export const useTokenDistributionTooltip = ( - data: IDistributionEntry[] | null, - tokenInfo: INodeInfoBaseToken -) => { - const buildTooltip = useCallback((dataPoint: IDistributionEntry): string => ( - ` +export const useTokenDistributionTooltip = (data: IDistributionEntry[] | null, tokenInfo: INodeInfoBaseToken) => { + const buildTooltip = useCallback( + (dataPoint: IDistributionEntry): string => + `

${"Number of addresses"}: ${dataPoint.addressCount} @@ -69,35 +71,39 @@ export const useTokenDistributionTooltip = ( ${`Total ${tokenInfo.unit} held`}: ~${formatAmount(Number(dataPoint.totalBalance), tokenInfo, false, 0)}

- ` - ), [data]); + `, + [data], + ); return buildTooltip; }; export const useChartWrapperSize: () => [ { wrapperWidth?: number; wrapperHeight?: number }, - React.Dispatch> + React.Dispatch>, ] = () => { const [chartWrapper, setChartWrapper] = useState(null); const [wrapperSize, setWrapperSize] = useState<{ wrapperWidth?: number; wrapperHeight?: number }>({ wrapperWidth: undefined, - wrapperHeight: undefined + wrapperHeight: undefined, }); - const handleResize = useCallback(debounce(() => { - setWrapperSize({ - wrapperWidth: chartWrapper?.clientWidth ?? 0, - wrapperHeight: chartWrapper?.clientHeight ?? 0 - }); - }), [chartWrapper]); + const handleResize = useCallback( + debounce(() => { + setWrapperSize({ + wrapperWidth: chartWrapper?.clientWidth ?? 0, + wrapperHeight: chartWrapper?.clientHeight ?? 0, + }); + }), + [chartWrapper], + ); useEffect(() => { handleResize(); let observer: ResizeObserver | null = null; if (chartWrapper) { - observer = new ResizeObserver(resizeEntry => { + observer = new ResizeObserver((resizeEntry) => { if ( resizeEntry?.length > 0 && resizeEntry[0].contentRect?.width !== wrapperSize.wrapperWidth && @@ -147,10 +153,8 @@ export const determineGraphLeftPadding = (dataMaxY: number) => { export const d3FormatSpecifier = (dataMaxY: number) => (dataMaxY < 1 ? "~g" : "~s"); -export const getSubunitThreshold = (tokenInfo: INodeInfoBaseToken) => ( - tokenInfo?.decimals && tokenInfo.decimals > 0 ? - Math.pow(10, tokenInfo.decimals) : null -); +export const getSubunitThreshold = (tokenInfo: INodeInfoBaseToken) => + tokenInfo?.decimals && tokenInfo.decimals > 0 ? Math.pow(10, tokenInfo.decimals) : null; const formatHidden = timeFormat(""); const formatDay = timeFormat("%a %d"); @@ -174,23 +178,20 @@ const tickMultiFormat = (date: Date | NumberValue) => { return formatYear(theDate); }; -export const buildXAxis: (scale: ScaleTime) => Axis = scale => +export const buildXAxis: (scale: ScaleTime) => Axis = (scale) => axisBottom(scale).ticks(8).tickFormat(tickMultiFormat) as Axis; export const buildYAxis = (scale: ScaleLinear, theYMax: number) => axisLeft(scale.nice()).tickFormat(format(d3FormatSpecifier(theYMax))); -export const timestampToDate = (timestamp: number) => moment.unix(timestamp) - .hours(0) - .minutes(0) - .toDate(); +export const timestampToDate = (timestamp: number) => moment.unix(timestamp).hours(0).minutes(0).toDate(); export const computeDataIncludedInSelection = ( scale: ScaleTime, data: { [name: string]: number; time: number; - }[] + }[], ) => { const selectedData: { [name: string]: number; time: number }[] = []; @@ -209,12 +210,5 @@ export const computeDataIncludedInSelection = ( return selectedData; }; -export const computeHalfLineWidth = ( - data: { [name: string]: number; time: number }[], - x: ScaleTime -) => ( - data.length > 1 ? - ((x(timestampToDate(data[1].time)) ?? 0) - (x(timestampToDate(data[0].time)) ?? 0)) / 2 : - 0 -); - +export const computeHalfLineWidth = (data: { [name: string]: number; time: number }[], x: ScaleTime) => + data.length > 1 ? ((x(timestampToDate(data[1].time)) ?? 0) - (x(timestampToDate(data[0].time)) ?? 0)) / 2 : 0; diff --git a/client/src/app/components/stardust/statistics/InfluxChartsTab.tsx b/client/src/app/components/stardust/statistics/InfluxChartsTab.tsx index 688c2b208..82d8e9646 100644 --- a/client/src/app/components/stardust/statistics/InfluxChartsTab.tsx +++ b/client/src/app/components/stardust/statistics/InfluxChartsTab.tsx @@ -30,13 +30,11 @@ export const InfluxChartsTab: React.FC = () => { unclaimedGenesisOutputs, ledgerSize, storageDeposit, - analyticStats + analyticStats, ] = useChartsState(); - const lockedStorageDepositValue = formatAmount( - Number(analyticStats?.lockedStorageDeposit), - tokenInfo - ).replace(COMMAS_REGEX, ",") ?? "-"; + const lockedStorageDepositValue = + formatAmount(Number(analyticStats?.lockedStorageDeposit), tokenInfo).replace(COMMAS_REGEX, ",") ?? "-"; const ids = idGenerator(); @@ -100,18 +98,9 @@ export const InfluxChartsTab: React.FC = () => {
- - - + + +
{
- ); }; diff --git a/client/src/app/components/stardust/statistics/RichestAddresses.scss b/client/src/app/components/stardust/statistics/RichestAddresses.scss index 2e23fac06..17b4ef225 100644 --- a/client/src/app/components/stardust/statistics/RichestAddresses.scss +++ b/client/src/app/components/stardust/statistics/RichestAddresses.scss @@ -24,7 +24,7 @@ .entry__idx { text-align: center; - width:16px; + width: 16px; margin-right: 1rem; color: $gray-5; } @@ -66,4 +66,3 @@ } } } - diff --git a/client/src/app/components/stardust/statistics/RichestAddresses.tsx b/client/src/app/components/stardust/statistics/RichestAddresses.tsx index 16c5da35a..3268c4603 100644 --- a/client/src/app/components/stardust/statistics/RichestAddresses.tsx +++ b/client/src/app/components/stardust/statistics/RichestAddresses.tsx @@ -19,26 +19,15 @@ export const RichestAddresses: React.FC = ({ data }) =>
    {data?.map((entry, idx) => ( -
  • +
  • {idx + 1}.
    - +
    -
    - {formatAmount( - Number(entry.balance), - tokenInfo, - false, - 0 - )} -
    +
    {formatAmount(Number(entry.balance), tokenInfo, false, 0)}
  • ))} @@ -46,4 +35,3 @@ export const RichestAddresses: React.FC = ({ data }) =>
); }; - diff --git a/client/src/app/components/stardust/statistics/TokenDistributionTab.tsx b/client/src/app/components/stardust/statistics/TokenDistributionTab.tsx index 04b5efb2d..942eebee0 100644 --- a/client/src/app/components/stardust/statistics/TokenDistributionTab.tsx +++ b/client/src/app/components/stardust/statistics/TokenDistributionTab.tsx @@ -14,18 +14,22 @@ export const TokenDistributionTab: React.FC = () => { let data = tokenDistribution; const subunitThreshold = getSubunitThreshold(tokenInfo); if (subunitThreshold) { - const negativeRanges = tokenDistribution?.filter(entry => entry.range.start < subunitThreshold); - const positiveRanges = tokenDistribution?.filter(entry => entry.range.start >= subunitThreshold); + const negativeRanges = tokenDistribution?.filter((entry) => entry.range.start < subunitThreshold); + const positiveRanges = tokenDistribution?.filter((entry) => entry.range.start >= subunitThreshold); if (negativeRanges && positiveRanges) { const merged: IDistributionEntry = { - addressCount: negativeRanges.map(e => e.addressCount) - .reduce((sum, curr) => sum + Number(curr), 0).toString(), - totalBalance: negativeRanges.map(e => e.totalBalance) - .reduce((sum, curr) => sum + Number(curr), 0).toString(), + addressCount: negativeRanges + .map((e) => e.addressCount) + .reduce((sum, curr) => sum + Number(curr), 0) + .toString(), + totalBalance: negativeRanges + .map((e) => e.totalBalance) + .reduce((sum, curr) => sum + Number(curr), 0) + .toString(), range: { - start: Math.min(...negativeRanges.map(e => e.range.start)), - end: Math.max(...negativeRanges.map(e => e.range.end)) - } + start: Math.min(...negativeRanges.map((e) => e.range.start)), + end: Math.max(...negativeRanges.map((e) => e.range.end)), + }, }; data = [merged, ...positiveRanges]; diff --git a/client/src/app/components/stardust/statistics/charts/BarChart.tsx b/client/src/app/components/stardust/statistics/charts/BarChart.tsx index 9e37754b0..359b3da52 100644 --- a/client/src/app/components/stardust/statistics/charts/BarChart.tsx +++ b/client/src/app/components/stardust/statistics/charts/BarChart.tsx @@ -17,7 +17,7 @@ import { TRANSITIONS_DURATION_MS, useChartWrapperSize, useSingleValueTooltip, - useTouchMoveEffect + useTouchMoveEffect, } from "../ChartUtils"; import "./Chart.scss"; @@ -51,13 +51,13 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, select(theSvg.current).select("*").remove(); // chart dimensions - const yMax = max(data, d => d.n) ?? 1; + const yMax = max(data, (d) => d.n) ?? 1; const leftMargin = determineGraphLeftPadding(yMax); const MARGIN = { top: 30, right: 20, bottom: 50, left: leftMargin }; const INNER_WIDTH = width - MARGIN.left - MARGIN.right; const INNER_HEIGHT = height - MARGIN.top - MARGIN.bottom; - const dates = data.map(d => timestampToDate(d.time)); + const dates = data.map((d) => timestampToDate(d.time)); // SVG const svg = select(theSvg.current) @@ -70,17 +70,15 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, const x = scaleTime() .domain([dates[0], dates.at(-1) ?? dates[0]]) .range([0, INNER_WIDTH]); - const xAxisSelection = svg.append("g") + const xAxisSelection = svg + .append("g") .attr("class", "axis axis--x") .attr("transform", `translate(0, ${INNER_HEIGHT})`) .call(buildXAxis(x)); // Y - const y = scaleLinear().domain([0, yMax]) - .range([INNER_HEIGHT, 0]); - const yAxisSelection = svg.append("g") - .attr("class", "axis axis--y") - .call(buildYAxis(y, yMax)); + const y = scaleLinear().domain([0, yMax]).range([INNER_HEIGHT, 0]); + const yAxisSelection = svg.append("g").attr("class", "axis axis--y").call(buildYAxis(y, yMax)); // clip path svg.append("defs") @@ -94,15 +92,17 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, // brushing const brush = brushX() - .extent([[0, 0], [INNER_WIDTH, height]]) - .on("end", e => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); + .extent([ + [0, 0], + [INNER_WIDTH, height], + ]) + .on("end", (e) => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); - const brushSelection = svg.append("g") - .attr("class", "brush") - .call(brush); + const brushSelection = svg.append("g").attr("class", "brush").call(brush); // bars - const barsSelection = svg.append("g") + const barsSelection = svg + .append("g") .attr("class", "the-bars") .attr("clip-path", `url(#clip-${chartId})`) .selectAll("g") @@ -110,14 +110,14 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, .enter() .append("rect") .attr("class", "bar") - .attr("x", d => x(timestampToDate(d.time)) - ((INNER_WIDTH / data.length) / 2)) - .attr("y", d => y(d.n)) + .attr("x", (d) => x(timestampToDate(d.time)) - INNER_WIDTH / data.length / 2) + .attr("y", (d) => y(d.n)) .attr("fill", color) .attr("rx", 2) .on("mouseover", mouseoverHandler) .on("mouseout", mouseoutHandler) .attr("width", INNER_WIDTH / data.length) - .attr("height", d => INNER_HEIGHT - y(d.n)); + .attr("height", (d) => INNER_HEIGHT - y(d.n)); const onBrushHandler = (event: D3BrushEvent<{ [key: string]: number }>) => { if (!event.selection) { @@ -136,18 +136,20 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, // to prevent infinite brushing if (selectedData.length > 1) { - const yMaxUpdate = max(selectedData, d => d.n) ?? 1; + const yMaxUpdate = max(selectedData, (d) => d.n) ?? 1; y.domain([0, yMaxUpdate]); // Update axis xAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildXAxis(x)); yAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildYAxis(y, yMaxUpdate)); // Update bars - barsSelection.transition().duration(TRANSITIONS_DURATION_MS) - .attr("x", d => x(timestampToDate(d.time)) - ((INNER_WIDTH / selectedData.length) / 2)) - .attr("y", d => y(d.n)) + barsSelection + .transition() + .duration(TRANSITIONS_DURATION_MS) + .attr("x", (d) => x(timestampToDate(d.time)) - INNER_WIDTH / selectedData.length / 2) + .attr("y", (d) => y(d.n)) .attr("width", INNER_WIDTH / selectedData.length) - .attr("height", d => INNER_HEIGHT - y(d.n)); + .attr("height", (d) => INNER_HEIGHT - y(d.n)); } }; @@ -157,11 +159,13 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, xAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildXAxis(x)); y.domain([0, yMax]); yAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildYAxis(y, yMax)); - barsSelection.transition().duration(TRANSITIONS_DURATION_MS) - .attr("x", d => x(timestampToDate(d.time)) - ((INNER_WIDTH / data.length) / 2)) - .attr("y", d => y(d.n)) + barsSelection + .transition() + .duration(TRANSITIONS_DURATION_MS) + .attr("x", (d) => x(timestampToDate(d.time)) - INNER_WIDTH / data.length / 2) + .attr("y", (d) => y(d.n)) .attr("width", INNER_WIDTH / data.length) - .attr("height", d => INNER_HEIGHT - y(d.n)); + .attr("height", (d) => INNER_HEIGHT - y(d.n)); }); } }, [data, wrapperWidth, wrapperHeight]); @@ -172,16 +176,9 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, * @param _ The unused event param * @param dataPoint The data point rendered by this rect */ - function mouseoverHandler( - this: SVGRectElement | BaseType, - _: unknown, - dataPoint: { [key: string]: number } - ) { + function mouseoverHandler(this: SVGRectElement | BaseType, _: unknown, dataPoint: { [key: string]: number }) { // show tooltip - select(theTooltip.current) - .style("display", "block") - .select("#content") - .html(buildTooltip(dataPoint)); + select(theTooltip.current).style("display", "block").select("#content").html(buildTooltip(dataPoint)); // add highlight select(this).classed("active", true); } @@ -193,18 +190,12 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, // remove tooltip select(theTooltip.current).style("display", "none"); // remove highlight - select(theSvg.current) - .select(".active") - .classed("active", false); + select(theSvg.current).select(".active").classed("active", false); } return (
- + {data.length === 0 ? ( noDataView() ) : ( @@ -220,8 +211,7 @@ const BarChart: React.FC = ({ chartId, title, info, data, label, BarChart.defaultProps = { info: undefined, label: undefined, - title: undefined + title: undefined, }; export default BarChart; - diff --git a/client/src/app/components/stardust/statistics/charts/Chart.scss b/client/src/app/components/stardust/statistics/charts/Chart.scss index f0a8515d8..b8bf94f32 100644 --- a/client/src/app/components/stardust/statistics/charts/Chart.scss +++ b/client/src/app/components/stardust/statistics/charts/Chart.scss @@ -11,7 +11,7 @@ border-radius: 8px; flex: 1; - &.chart-wrapper--no-data{ + &.chart-wrapper--no-data { height: 350px; } @@ -21,7 +21,8 @@ svg.hook { rect { - &.bar.active, &.stacked-bar.active { + &.bar.active, + &.stacked-bar.active { opacity: 0.7; } } diff --git a/client/src/app/components/stardust/statistics/charts/LineChart.tsx b/client/src/app/components/stardust/statistics/charts/LineChart.tsx index b66162e91..8dcf0862d 100644 --- a/client/src/app/components/stardust/statistics/charts/LineChart.tsx +++ b/client/src/app/components/stardust/statistics/charts/LineChart.tsx @@ -19,7 +19,7 @@ import { TRANSITIONS_DURATION_MS, useChartWrapperSize, useSingleValueTooltip, - useTouchMoveEffect + useTouchMoveEffect, } from "../ChartUtils"; import "./Chart.scss"; @@ -53,13 +53,13 @@ const LineChart: React.FC = ({ chartId, title, info, data, label select(theSvg.current).select("*").remove(); // chart dimensions - const yMax = max(data, d => d.n) ?? 1; + const yMax = max(data, (d) => d.n) ?? 1; const leftMargin = determineGraphLeftPadding(yMax); const MARGIN = { top: 30, right: 20, bottom: 50, left: leftMargin }; const INNER_WIDTH = width - MARGIN.left - MARGIN.right; const INNER_HEIGHT = height - MARGIN.top - MARGIN.bottom; - const dates = data.map(d => timestampToDate(d.time)); + const dates = data.map((d) => timestampToDate(d.time)); // SVG const svg = select(theSvg.current) @@ -72,16 +72,15 @@ const LineChart: React.FC = ({ chartId, title, info, data, label const x = scaleTime() .domain([dates[0], dates.at(-1) ?? dates[0]]) .range([0, INNER_WIDTH]); - const xAxisSelection = svg.append("g") + const xAxisSelection = svg + .append("g") .attr("class", "axis axis--x") .attr("transform", `translate(0, ${INNER_HEIGHT})`) .call(buildXAxis(x)); // Y const y = scaleLinear().domain([0, yMax]).range([INNER_HEIGHT, 0]); - const yAxisSelection = svg.append("g") - .attr("class", "axis axis--y") - .call(buildYAxis(y, yMax)); + const yAxisSelection = svg.append("g").attr("class", "axis axis--y").call(buildYAxis(y, yMax)); // clip path svg.append("defs") @@ -95,21 +94,23 @@ const LineChart: React.FC = ({ chartId, title, info, data, label // brushing const brush = brushX() - .extent([[0, 0], [INNER_WIDTH, height]]) - .on("end", e => { + .extent([ + [0, 0], + [INNER_WIDTH, height], + ]) + .on("end", (e) => { onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>); }); - const brushSelection = svg.append("g") - .attr("class", "brush") - .call(brush); + const brushSelection = svg.append("g").attr("class", "brush").call(brush); // line const lineGen = line<{ [name: string]: number; time: number }>() - .x(d => x(timestampToDate(d.time)) ?? 0) - .y(d => y(d.n)); + .x((d) => x(timestampToDate(d.time)) ?? 0) + .y((d) => y(d.n)); - const lineSelection = svg.append("g") + const lineSelection = svg + .append("g") .attr("class", "the-line") .attr("clip-path", `url(#clip-${chartId})`) .append("path") @@ -135,7 +136,7 @@ const LineChart: React.FC = ({ chartId, title, info, data, label .style("stroke", color) .style("stroke-width", 5) .style("stroke-opacity", 0) - .attr("transform", d => `translate(${x(timestampToDate(d.time))}, ${y(d.n)})`) + .attr("transform", (d) => `translate(${x(timestampToDate(d.time))}, ${y(d.n)})`) .attr("class", (_, i) => `circle-${i}`); svg.append("g") @@ -145,9 +146,7 @@ const LineChart: React.FC = ({ chartId, title, info, data, label .enter() .append("rect") .attr("fill", "transparent") - .attr("x", (_, idx) => ( - idx === 0 ? 0 : (x(timestampToDate(data[idx].time)) ?? 0) - halfLineWidth - )) + .attr("x", (_, idx) => (idx === 0 ? 0 : (x(timestampToDate(data[idx].time)) ?? 0) - halfLineWidth)) .attr("y", 0) .attr("class", (_, i) => `rect-${i}`) .attr("height", INNER_HEIGHT) @@ -182,7 +181,7 @@ const LineChart: React.FC = ({ chartId, title, info, data, label // to prevent infinite brushing if (selectedData.length > 1) { - const yMaxUpdate = max(selectedData, d => d.n) ?? 1; + const yMaxUpdate = max(selectedData, (d) => d.n) ?? 1; y.domain([0, yMaxUpdate]); // Update axis and lines position @@ -213,27 +212,16 @@ const LineChart: React.FC = ({ chartId, title, info, data, label * @param _ The unused event param * @param dataPoint The data point rendered by this rect */ - function mouseoverHandler( - this: SVGRectElement | BaseType, - _: MouseEvent, - dataPoint: { [key: string]: number } - ) { + function mouseoverHandler(this: SVGRectElement | BaseType, _: MouseEvent, dataPoint: { [key: string]: number }) { // show tooltip - select(theTooltip.current) - .style("display", "block") - .select("#content") - .html(buildTooltip(dataPoint)); + select(theTooltip.current).style("display", "block").select("#content").html(buildTooltip(dataPoint)); // add highlight const eleClass = (this as SVGRectElement).classList[0]; const idx = eleClass.slice(eleClass.indexOf("-") + 1); - select(theSvg.current) - .selectAll(`.circle-${idx}`) - .attr("r", 2) - .style("stroke-opacity", 0.5); + select(theSvg.current).selectAll(`.circle-${idx}`).attr("r", 2).style("stroke-opacity", 0.5); - select(this) - .classed("active", true); + select(this).classed("active", true); } /** @@ -243,32 +231,20 @@ const LineChart: React.FC = ({ chartId, title, info, data, label // remove tooltip select(theTooltip.current).style("display", "none"); // remove highlight - const activeElement = select(theSvg.current) - .select(".active"); + const activeElement = select(theSvg.current).select(".active"); if (activeElement.size() > 0) { const elClass = activeElement.attr("class"); - const idx = elClass.slice( - elClass.indexOf("rect-") + 5, - elClass.lastIndexOf(" ") - ); - - select(theSvg.current) - .selectAll(`.circle-${idx}`) - .attr("r", 0) - .style("stroke-opacity", 0); - - activeElement - .classed("active", false); + const idx = elClass.slice(elClass.indexOf("rect-") + 5, elClass.lastIndexOf(" ")); + + select(theSvg.current).selectAll(`.circle-${idx}`).attr("r", 0).style("stroke-opacity", 0); + + activeElement.classed("active", false); } } return (
- + {data.length === 0 ? ( noDataView() ) : ( @@ -284,7 +260,7 @@ const LineChart: React.FC = ({ chartId, title, info, data, label LineChart.defaultProps = { info: undefined, label: undefined, - title: undefined + title: undefined, }; export default LineChart; diff --git a/client/src/app/components/stardust/statistics/charts/RangeBarChart.scss b/client/src/app/components/stardust/statistics/charts/RangeBarChart.scss index f93143ef8..da39d7231 100644 --- a/client/src/app/components/stardust/statistics/charts/RangeBarChart.scss +++ b/client/src/app/components/stardust/statistics/charts/RangeBarChart.scss @@ -1,4 +1,3 @@ - @import "../../../../../scss/mixins"; @import "../../../../../scss/variables"; @import "../../../../../scss/fonts"; @@ -6,7 +5,7 @@ @import "../../../../../scss/media-queries"; .range-chart-wrapper { - &.chart-wrapper--no-data{ + &.chart-wrapper--no-data { height: 350px; } @@ -64,7 +63,8 @@ } } - text.axis-x-label, text.axis-y-label { + text.axis-x-label, + text.axis-y-label { @include font-size(16px); font-weight: bold; fill: $gray-6; diff --git a/client/src/app/components/stardust/statistics/charts/RangeBarChart.tsx b/client/src/app/components/stardust/statistics/charts/RangeBarChart.tsx index 5640c052c..27a32a370 100644 --- a/client/src/app/components/stardust/statistics/charts/RangeBarChart.tsx +++ b/client/src/app/components/stardust/statistics/charts/RangeBarChart.tsx @@ -41,9 +41,8 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa const width = wrapperWidth; const height = wrapperHeight; // data dependent vars - const dataY = yField === "addressCount" ? - data.map(d => Number(d[yField])) : - data.map(d => Number(d[yField]) / subunitThreshold); + const dataY = + yField === "addressCount" ? data.map((d) => Number(d[yField])) : data.map((d) => Number(d[yField]) / subunitThreshold); const dataMaxY = Math.max(...dataY); const leftMargin = width < 600 ? 50 : 60; const rangeLabel = (range: { start: number; end: number }) => { @@ -51,7 +50,7 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa const end = format(d3FormatSpecifier(range.end / subunitThreshold))(range.end / subunitThreshold); return `${start} - ${end}`; }; - const ranges = data.map(d => rangeLabel(d.range)); + const ranges = data.map((d) => rangeLabel(d.range)); const MARGIN = { top: 20, right: 20, bottom: 60, left: leftMargin }; const INNER_WIDTH = width - MARGIN.left - MARGIN.right; @@ -63,13 +62,9 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa .append("g") .attr("transform", `translate(${MARGIN.left}, ${MARGIN.top})`); - const x = scaleBand().domain(ranges) - .range([0, INNER_WIDTH]) - .paddingInner(0.2); + const x = scaleBand().domain(ranges).range([0, INNER_WIDTH]).paddingInner(0.2); - const y = scaleLinear() - .domain([0, dataMaxY]) - .range([INNER_HEIGHT, 0]); + const y = scaleLinear().domain([0, dataMaxY]).range([INNER_HEIGHT, 0]); // x axis svg.append("g") @@ -105,19 +100,14 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa .data(data) .join("rect") .attr("class", "bar") - .attr("x", d => x(rangeLabel(d.range)) ?? 0) + .attr("x", (d) => x(rangeLabel(d.range)) ?? 0) .attr("width", x.bandwidth()) - .attr("y", d => y( - yField === "addressCount" ? - Number(d[yField]) : - Number(d[yField]) / subunitThreshold - )) + .attr("y", (d) => y(yField === "addressCount" ? Number(d[yField]) : Number(d[yField]) / subunitThreshold)) .attr("rx", 2) - .attr("height", d => INNER_HEIGHT - y( - yField === "addressCount" ? - Number(d[yField]) : - Number(d[yField]) / subunitThreshold - )) + .attr( + "height", + (d) => INNER_HEIGHT - y(yField === "addressCount" ? Number(d[yField]) : Number(d[yField]) / subunitThreshold), + ) .style("fill", isShimmerUi ? "#14CABF" : "#3ca2ff"); // hidden hover areas @@ -128,7 +118,7 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa .enter() .append("rect") .attr("fill", "transparent") - .attr("x", d => x(rangeLabel(d.range)) ?? 0) + .attr("x", (d) => x(rangeLabel(d.range)) ?? 0) .attr("y", 0) .attr("class", (_, i) => `rect rect-${i}`) .attr("rx", 3) @@ -145,16 +135,9 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa * @param _ The unused event param * @param dataPoint The distribution entry */ - function mouseoverHandler( - this: SVGRectElement | BaseType, - _: unknown, - dataPoint: IDistributionEntry - ) { + function mouseoverHandler(this: SVGRectElement | BaseType, _: unknown, dataPoint: IDistributionEntry) { // show tooltip - select(theTooltip.current) - .style("display", "block") - .select("#content") - .html(buildTooltip(dataPoint)); + select(theTooltip.current).style("display", "block").select("#content").html(buildTooltip(dataPoint)); // add highlight select(this).classed("active", true); } @@ -166,9 +149,7 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa // remove tooltip select(theTooltip.current).style("display", "none"); // remove highlight - select(theSvg.current) - .select(".active") - .classed("active", false); + select(theSvg.current).select(".active").classed("active", false); } return ( @@ -184,4 +165,3 @@ export const RangeBarChart: React.FC = ({ data, yField, yLa
); }; - diff --git a/client/src/app/components/stardust/statistics/charts/StackedBarChart.tsx b/client/src/app/components/stardust/statistics/charts/StackedBarChart.tsx index c43b9f63d..14903136d 100644 --- a/client/src/app/components/stardust/statistics/charts/StackedBarChart.tsx +++ b/client/src/app/components/stardust/statistics/charts/StackedBarChart.tsx @@ -17,7 +17,7 @@ import { buildXAxis, buildYAxis, computeDataIncludedInSelection, - TRANSITIONS_DURATION_MS + TRANSITIONS_DURATION_MS, } from "../ChartUtils"; import "./Chart.scss"; @@ -31,15 +31,7 @@ interface StackedBarChartProps { readonly data: { [name: string]: number; time: number }[]; } -const StackedBarChart: React.FC = ({ - chartId, - title, - info, - subgroups, - groupLabels, - colors, - data -}) => { +const StackedBarChart: React.FC = ({ chartId, title, info, subgroups, groupLabels, colors, data }) => { const [{ wrapperWidth, wrapperHeight }, setTheRef] = useChartWrapperSize(); const chartWrapperRef = useCallback((chartWrapper: HTMLDivElement) => { if (chartWrapper !== null) { @@ -61,13 +53,13 @@ const StackedBarChart: React.FC = ({ // chart dimensions const yMax = Math.max( - ...data.map(d => { + ...data.map((d) => { let sum = 0; for (const key of subgroups) { sum += d[key]; } return sum; - }) + }), ); const leftMargin = determineGraphLeftPadding(yMax); const MARGIN = { top: 30, right: 20, bottom: 50, left: leftMargin }; @@ -76,9 +68,7 @@ const StackedBarChart: React.FC = ({ const color = scaleOrdinal().domain(subgroups).range(colors); - const groups = data.map( - d => timestampToDate(d.time) - ); + const groups = data.map((d) => timestampToDate(d.time)); const stackedData = stack().keys(subgroups)(data); // SVG @@ -92,16 +82,15 @@ const StackedBarChart: React.FC = ({ const x = scaleTime() .domain([groups[0], groups.at(-1) ?? groups[0]]) .range([0, INNER_WIDTH]); - const xAxisSelection = svg.append("g") + const xAxisSelection = svg + .append("g") .attr("class", "axis axis--x") .attr("transform", `translate(0, ${INNER_HEIGHT})`) .call(buildXAxis(x)); // Y const y = scaleLinear().domain([0, yMax]).range([INNER_HEIGHT, 0]); - const yAxisSelection = svg.append("g") - .attr("class", "axis axis--y") - .call(buildYAxis(y, yMax)); + const yAxisSelection = svg.append("g").attr("class", "axis axis--y").call(buildYAxis(y, yMax)); // clip path svg.append("defs") @@ -115,31 +104,33 @@ const StackedBarChart: React.FC = ({ // brushing const brush = brushX() - .extent([[0, 0], [INNER_WIDTH, height]]) - .on("end", e => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); + .extent([ + [0, 0], + [INNER_WIDTH, height], + ]) + .on("end", (e) => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); - const brushSelection = svg.append("g") - .attr("class", "brush") - .call(brush); + const brushSelection = svg.append("g").attr("class", "brush").call(brush); // bars - const barsSelection = svg.append("g") + const barsSelection = svg + .append("g") .attr("class", "stacked-bars") .attr("clip-path", `url(#clip-${chartId})`) .selectAll("g") .data(stackedData) .join("g") - .attr("fill", d => color(d.key)) + .attr("fill", (d) => color(d.key)) .selectAll("rect") - .data(d => d) + .data((d) => d) .join("rect") - .attr("x", d => x(timestampToDate(d.data.time)) - ((INNER_WIDTH / data.length) / 2)) - .attr("y", d => y(d[1])) + .attr("x", (d) => x(timestampToDate(d.data.time)) - INNER_WIDTH / data.length / 2) + .attr("y", (d) => y(d[1])) .attr("rx", 2) .attr("class", (_, i) => `stacked-bar rect-${i}`) .on("mouseover", mouseoverHandler) .on("mouseout", mouseoutHandler) - .attr("height", d => y(d[0]) - y(d[1])) + .attr("height", (d) => y(d[0]) - y(d[1])) .attr("width", INNER_WIDTH / data.length); const onBrushHandler = (event: D3BrushEvent<{ [key: string]: number }>) => { @@ -160,13 +151,13 @@ const StackedBarChart: React.FC = ({ // to prevent infinite brushing if (selectedData.length > 1) { const yMaxUpdate = Math.max( - ...selectedData.map(d => { + ...selectedData.map((d) => { let sum = 0; for (const key of subgroups) { sum += d[key]; } return sum; - }) + }), ); y.domain([0, yMaxUpdate]); // Update axis @@ -174,10 +165,12 @@ const StackedBarChart: React.FC = ({ yAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildYAxis(y, yMaxUpdate)); // Update bars - barsSelection.transition().duration(TRANSITIONS_DURATION_MS) - .attr("x", d => x(timestampToDate(d.data.time)) - ((INNER_WIDTH / selectedData.length) / 2)) - .attr("y", d => y(d[1])) - .attr("height", d => y(d[0]) - y(d[1])) + barsSelection + .transition() + .duration(TRANSITIONS_DURATION_MS) + .attr("x", (d) => x(timestampToDate(d.data.time)) - INNER_WIDTH / selectedData.length / 2) + .attr("y", (d) => y(d[1])) + .attr("height", (d) => y(d[0]) - y(d[1])) .attr("width", INNER_WIDTH / selectedData.length); } }; @@ -188,10 +181,12 @@ const StackedBarChart: React.FC = ({ xAxisSelection.transition().call(buildXAxis(x)); y.domain([0, yMax]); yAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildYAxis(y, yMax)); - barsSelection.transition().duration(TRANSITIONS_DURATION_MS) - .attr("x", d => x(timestampToDate(d.data.time)) - ((INNER_WIDTH / data.length) / 2)) - .attr("y", d => y(d[1])) - .attr("height", d => y(d[0]) - y(d[1])) + barsSelection + .transition() + .duration(TRANSITIONS_DURATION_MS) + .attr("x", (d) => x(timestampToDate(d.data.time)) - INNER_WIDTH / data.length / 2) + .attr("y", (d) => y(d[1])) + .attr("height", (d) => y(d[0]) - y(d[1])) .attr("width", INNER_WIDTH / data.length); }); } @@ -203,16 +198,9 @@ const StackedBarChart: React.FC = ({ * @param _ The unused event param * @param dataPoint The data point rendered by this rect */ - function mouseoverHandler( - this: SVGRectElement | BaseType, - _: unknown, - dataPoint: SeriesPoint<{ [key: string]: number }> - ) { + function mouseoverHandler(this: SVGRectElement | BaseType, _: unknown, dataPoint: SeriesPoint<{ [key: string]: number }>) { // show tooltip - select(theTooltip.current) - .style("display", "block") - .select("#content") - .html(buildTooltip(dataPoint.data)); + select(theTooltip.current).style("display", "block").select("#content").html(buildTooltip(dataPoint.data)); // add highlight select(this).classed("active", true); } @@ -224,9 +212,7 @@ const StackedBarChart: React.FC = ({ // remove tooltip select(theTooltip.current).style("display", "none"); // remove highlight - select(theSvg.current) - .select(".active") - .classed("active", false); + select(theSvg.current).select(".active").classed("active", false); } return ( @@ -236,7 +222,7 @@ const StackedBarChart: React.FC = ({ info={info} legend={{ labels: groupLabels ?? subgroups, - colors + colors, }} disabled={data.length === 0} /> @@ -255,8 +241,7 @@ const StackedBarChart: React.FC = ({ StackedBarChart.defaultProps = { groupLabels: undefined, info: undefined, - title: undefined + title: undefined, }; export default StackedBarChart; - diff --git a/client/src/app/components/stardust/statistics/charts/StackedLineChart.tsx b/client/src/app/components/stardust/statistics/charts/StackedLineChart.tsx index 142f17ac8..695293e9d 100644 --- a/client/src/app/components/stardust/statistics/charts/StackedLineChart.tsx +++ b/client/src/app/components/stardust/statistics/charts/StackedLineChart.tsx @@ -18,7 +18,7 @@ import { TRANSITIONS_DURATION_MS, useChartWrapperSize, useMultiValueTooltip, - useTouchMoveEffect + useTouchMoveEffect, } from "../ChartUtils"; import "./Chart.scss"; @@ -32,15 +32,7 @@ interface StackedLineChartProps { readonly data: { [name: string]: number; time: number }[]; } -const StackedLineChart: React.FC = ({ - chartId, - title, - info, - subgroups, - groupLabels, - colors, - data -}) => { +const StackedLineChart: React.FC = ({ chartId, title, info, subgroups, groupLabels, colors, data }) => { const [{ wrapperWidth, wrapperHeight }, setTheRef] = useChartWrapperSize(); const chartWrapperRef = useCallback((chartWrapper: HTMLDivElement) => { if (chartWrapper !== null) { @@ -61,7 +53,7 @@ const StackedLineChart: React.FC = ({ select(theSvg.current).selectAll("*").remove(); // chart dimensions - const yMax = Math.max(...data.map(d => Math.max(...subgroups.map(key => d[key])))); + const yMax = Math.max(...data.map((d) => Math.max(...subgroups.map((key) => d[key])))); const leftMargin = determineGraphLeftPadding(yMax); const MARGIN = { top: 30, right: 20, bottom: 50, left: leftMargin }; const INNER_WIDTH = width - MARGIN.left - MARGIN.right; @@ -70,7 +62,7 @@ const StackedLineChart: React.FC = ({ const color = scaleOrdinal().domain(subgroups).range(colors); const stackedData = stack().keys(subgroups)(data); - const groups = data.map(d => timestampToDate(d.time)); + const groups = data.map((d) => timestampToDate(d.time)); // SVG const svg = select(theSvg.current) @@ -84,16 +76,15 @@ const StackedLineChart: React.FC = ({ .domain([groups[0], groups.at(-1) ?? groups[0]]) .range([0, INNER_WIDTH]); - const xAxisSelection = svg.append("g") + const xAxisSelection = svg + .append("g") .attr("class", "axis axis--x") .attr("transform", `translate(0, ${INNER_HEIGHT})`) .call(buildXAxis(x)); // Y const y = scaleLinear().domain([0, yMax]).range([INNER_HEIGHT, 0]); - const yAxisSelection = svg.append("g") - .attr("class", "axis axis--y") - .call(buildYAxis(y, yMax)); + const yAxisSelection = svg.append("g").attr("class", "axis axis--y").call(buildYAxis(y, yMax)); // clip path svg.append("defs") @@ -107,35 +98,35 @@ const StackedLineChart: React.FC = ({ // area fill const areaGen = area>() - .x(d => x(timestampToDate(d.data.time)) ?? 0) - .y0(_ => y(0)) - .y1(d => y(d[1] - d[0])); + .x((d) => x(timestampToDate(d.data.time)) ?? 0) + .y0((_) => y(0)) + .y1((d) => y(d[1] - d[0])); - const theArea = svg.append("g") - .attr("class", "areas") - .attr("clip-path", `url(#clip-${chartId})`); + const theArea = svg.append("g").attr("class", "areas").attr("clip-path", `url(#clip-${chartId})`); - const areaSelection = theArea.selectAll("g") + const areaSelection = theArea + .selectAll("g") .data(stackedData) .join("path") - .style("fill", d => getGradient(d.key, color(d.key))) + .style("fill", (d) => getGradient(d.key, color(d.key))) .attr("opacity", 0.5) .attr("class", "area") .attr("d", areaGen); // area lines path const lineGen = line>() - .x(d => x(timestampToDate(d.data.time)) ?? 0) - .y(d => y(d[1] - d[0])); + .x((d) => x(timestampToDate(d.data.time)) ?? 0) + .y((d) => y(d[1] - d[0])); - const lineSelection = svg.append("g") + const lineSelection = svg + .append("g") .attr("class", "lines") .attr("clip-path", `url(#clip-${chartId})`) .selectAll("g") .data(stackedData) .join("path") .attr("fill", "none") - .attr("stroke", d => color(d.key)) + .attr("stroke", (d) => color(d.key)) .attr("stroke-width", 2) .attr("class", "line") .attr("d", lineGen); @@ -157,8 +148,8 @@ const StackedLineChart: React.FC = ({ .style("stroke", color(dataStack.key)) .style("stroke-width", 5) .style("stroke-opacity", 0) - .attr("cx", d => x(timestampToDate(d.data.time)) ?? 0) - .attr("cy", d => y(d[1] - d[0])) + .attr("cx", (d) => x(timestampToDate(d.data.time)) ?? 0) + .attr("cy", (d) => y(d[1] - d[0])) .attr("r", 0) .attr("class", (_, i) => `circle-${i}`); } @@ -172,28 +163,24 @@ const StackedLineChart: React.FC = ({ .enter() .append("rect") .attr("fill", "transparent") - .attr("x", (_, idx) => ( - idx === 0 ? 0 : (x(timestampToDate(data[idx].time)) ?? 0) - halfLineWidth - )) + .attr("x", (_, idx) => (idx === 0 ? 0 : (x(timestampToDate(data[idx].time)) ?? 0) - halfLineWidth)) .attr("y", 0) .attr("class", (_, i) => `rect-${i}`) .attr("height", INNER_HEIGHT) - .attr("width", (_, idx) => ( - (idx === 0 || idx === data.length - 1) ? - halfLineWidth : halfLineWidth * 2 - )) + .attr("width", (_, idx) => (idx === 0 || idx === data.length - 1 ? halfLineWidth : halfLineWidth * 2)) .on("mouseover", mouseoverHandler) .on("mouseout", mouseoutHandler); }; // brushing const brush = brushX() - .extent([[0, 0], [INNER_WIDTH, height]]) - .on("end", e => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); + .extent([ + [0, 0], + [INNER_WIDTH, height], + ]) + .on("end", (e) => onBrushHandler(e as D3BrushEvent<{ [key: string]: number }>)); - const brushSelection = svg.append("g") - .attr("class", "brush") - .call(brush); + const brushSelection = svg.append("g").attr("class", "brush").call(brush); let idleTimeout: NodeJS.Timer | null = null; const idled = () => { @@ -220,7 +207,7 @@ const StackedLineChart: React.FC = ({ // to prevent infinite brushing if (selectedData.length > 1) { - const yMaxUpdate = Math.max(...selectedData.map(d => Math.max(...subgroups.map(key => d[key])))); + const yMaxUpdate = Math.max(...selectedData.map((d) => Math.max(...subgroups.map((key) => d[key])))); y.domain([0, yMaxUpdate]); // Update axis yAxisSelection.transition().duration(TRANSITIONS_DURATION_MS).call(buildYAxis(y, yMaxUpdate)); @@ -256,7 +243,8 @@ const StackedLineChart: React.FC = ({ * @returns The gradient */ function getGradient(id: string, color: string): string { - const areaGradient = select(theSvg.current).append("defs") + const areaGradient = select(theSvg.current) + .append("defs") .append("linearGradient") .attr("id", `aG-${id}`) .attr("x1", "0%") @@ -264,16 +252,9 @@ const StackedLineChart: React.FC = ({ .attr("x2", "0%") .attr("y2", "100%"); - areaGradient - .append("stop") - .attr("offset", "30%") - .attr("stop-color", color) - .attr("stop-opacity", 0.6); + areaGradient.append("stop").attr("offset", "30%").attr("stop-color", color).attr("stop-opacity", 0.6); - areaGradient.append("stop") - .attr("offset", "90%") - .attr("stop-color", "white") - .attr("stop-opacity", 0); + areaGradient.append("stop").attr("offset", "90%").attr("stop-color", "white").attr("stop-opacity", 0); return `url(#aG-${id})`; } @@ -284,26 +265,15 @@ const StackedLineChart: React.FC = ({ * @param _ The unused event param * @param dataPoint The data point rendered by this rect */ - function mouseoverHandler( - this: SVGRectElement | BaseType, - _: MouseEvent, - dataPoint: { [key: string]: number } - ) { + function mouseoverHandler(this: SVGRectElement | BaseType, _: MouseEvent, dataPoint: { [key: string]: number }) { // show tooltip - select(theTooltip.current) - .style("display", "block") - .select("#content") - .html(buildTootip(dataPoint)); + select(theTooltip.current).style("display", "block").select("#content").html(buildTootip(dataPoint)); // add highlight const eleClass = (this as SVGRectElement).classList[0]; const idx = eleClass.slice(eleClass.indexOf("-") + 1); - select(theSvg.current) - .selectAll(`.circle-${idx}`) - .attr("r", 2) - .style("stroke-opacity", 0.5); + select(theSvg.current).selectAll(`.circle-${idx}`).attr("r", 2).style("stroke-opacity", 0.5); - select(this) - .classed("active", true); + select(this).classed("active", true); } /** @@ -313,22 +283,14 @@ const StackedLineChart: React.FC = ({ // remove tooltip select(theTooltip.current).style("display", "none"); // remove highlight - const activeElement = select(theSvg.current) - .select(".active"); + const activeElement = select(theSvg.current).select(".active"); if (activeElement.size() > 0) { const elClass = activeElement.attr("class"); - const idx = elClass.slice( - elClass.indexOf("rect-") + 5, - elClass.lastIndexOf(" ") - ); - - select(theSvg.current) - .selectAll(`.circle-${idx}`) - .attr("r", 0) - .style("stroke-opacity", 0); - - activeElement - .classed("active", false); + const idx = elClass.slice(elClass.indexOf("rect-") + 5, elClass.lastIndexOf(" ")); + + select(theSvg.current).selectAll(`.circle-${idx}`).attr("r", 0).style("stroke-opacity", 0); + + activeElement.classed("active", false); } } @@ -339,7 +301,7 @@ const StackedLineChart: React.FC = ({ info={info} legend={{ labels: groupLabels ?? subgroups, - colors + colors, }} disabled={data.length === 0} /> @@ -358,7 +320,7 @@ const StackedLineChart: React.FC = ({ StackedLineChart.defaultProps = { groupLabels: undefined, info: undefined, - title: undefined + title: undefined, }; export default StackedLineChart; diff --git a/client/src/app/context/NetworkContext.ts b/client/src/app/context/NetworkContext.ts index 4465b56c6..0a43115e0 100644 --- a/client/src/app/context/NetworkContext.ts +++ b/client/src/app/context/NetworkContext.ts @@ -33,23 +33,23 @@ interface INetworkContextProps { } const defaultState = { - name: "", - tokenInfo: { - name: "", - tickerSymbol: "", - unit: "", - decimals: 0, - subunit: undefined, - useMetricPrefix: true - }, - bech32Hrp: "", - protocolVersion: -1, - rentStructure: { - vByteCost: -1, - vByteFactorData: -1, - vByteFactorKey: -1 - }, - uiTheme: IOTA_UI + name: "", + tokenInfo: { + name: "", + tickerSymbol: "", + unit: "", + decimals: 0, + subunit: undefined, + useMetricPrefix: true, + }, + bech32Hrp: "", + protocolVersion: -1, + rentStructure: { + vByteCost: -1, + vByteFactorData: -1, + vByteFactorKey: -1, + }, + uiTheme: IOTA_UI, }; const networkContext = createContext(defaultState); diff --git a/client/src/app/routes.tsx b/client/src/app/routes.tsx index fdc9bb8cb..1ad83ecf5 100644 --- a/client/src/app/routes.tsx +++ b/client/src/app/routes.tsx @@ -53,175 +53,119 @@ function* keyGenerator(count: number): IterableIterator { } } -const buildAppRoutes = ( - protocolVersion: string, - withNetworkContext: (wrappedComponent: React.ReactNode) => JSX.Element | null -) => { +const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedComponent: React.ReactNode) => JSX.Element | null) => { const keys = keyGenerator(0); const commonRoutes = [ - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - + )} - /> + />, ]; const legacyRoutes = [ - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} - /> + component={(props: RouteComponentProps) => } + />, ]; const chrysalisRoutes = [ - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} + component={(props: RouteComponentProps) => } />, - ) => ( - - )} - /> + component={(props: RouteComponentProps) => } + />, ]; const stardustRoutes = [ - , - , - , - , - , - , - , - , - , - , - + , + , + , + , + , + , + , + , + , + , + , ]; return ( {commonRoutes} - {protocolVersion === LEGACY && ( - legacyRoutes - )} - {protocolVersion === CHRYSALIS && ( - chrysalisRoutes - )} - {protocolVersion === STARDUST && ( - withNetworkContext(stardustRoutes) - )} + {protocolVersion === LEGACY && legacyRoutes} + {protocolVersion === CHRYSALIS && chrysalisRoutes} + {protocolVersion === STARDUST && withNetworkContext(stardustRoutes)} ); }; export default buildAppRoutes; - diff --git a/client/src/app/routes/IdentityResolver.scss b/client/src/app/routes/IdentityResolver.scss index 74b7ca81a..46c2d3543 100644 --- a/client/src/app/routes/IdentityResolver.scss +++ b/client/src/app/routes/IdentityResolver.scss @@ -4,91 +4,90 @@ @import "../../scss/variables"; .identity { - display: flex; - flex-direction: column; - - h2 { display: flex; - align-items: center; - } - - .example-did { - p { - color: var(--expanded-color); - font-family: $inter; - } + flex-direction: column; - &:hover { - cursor: pointer; + h2 { + display: flex; + align-items: center; } - } - .wrapper { - display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; + .example-did { + p { + color: var(--expanded-color); + font-family: $inter; } - } - - @include phone-down { - padding-right: 0; - padding-left: 0; - } - - .status { - @include font-size(14px); - } - - .cards { - flex: 1; - margin-right: 24px; - @include phone-down { - margin-right: unset; + &:hover { + cursor: pointer; } + } - .item-details { - @include font-size(14px); - - font-family: $metropolis; - - .item-details-root { - word-break: break-all; - } + .wrapper { + display: flex; + justify-content: center; + + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; + + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; + + > .row { + flex-direction: column; + } + } + + @include phone-down { + padding-right: 0; + padding-left: 0; + } + + .status { + @include font-size(14px); + } + + .cards { + flex: 1; + margin-right: 24px; + + @include phone-down { + margin-right: unset; + } + + .item-details { + @include font-size(14px); + + font-family: $metropolis; + + .item-details-root { + word-break: break-all; + } + } + } } - } } - } - - .tool-description { - margin: 30px 0; - color: $gray !important; - font-family: $inter; - font-size: 1em !important; - line-height: 1.6; - } + + .tool-description { + margin: 30px 0; + color: $gray !important; + font-family: $inter; + font-size: 1em !important; + line-height: 1.6; + } } .unsupported-network { - margin-bottom: 20px; - padding: 20px; - border-radius: 6px; - background-color: rgba(250, 212, 208, 1); - color: $danger; - font-family: $metropolis; + margin-bottom: 20px; + padding: 20px; + border-radius: 6px; + background-color: rgba(250, 212, 208, 1); + color: $danger; + font-family: $metropolis; } - diff --git a/client/src/app/routes/IdentityResolver.tsx b/client/src/app/routes/IdentityResolver.tsx index c6b9309c4..06fbb210a 100644 --- a/client/src/app/routes/IdentityResolver.tsx +++ b/client/src/app/routes/IdentityResolver.tsx @@ -13,7 +13,6 @@ import IdentitySearchInput from "../components/identity/IdentitySearchInput"; import Modal from "../components/Modal"; import "./IdentityResolver.scss"; - class IdentityResolver extends AsyncComponent< RouteComponentProps & { protocolVersion: string }, IdentityResolverState @@ -22,7 +21,7 @@ class IdentityResolver extends AsyncComponent< super(props); this.state = { - didExample: undefined + didExample: undefined, }; } @@ -46,33 +45,29 @@ class IdentityResolver extends AsyncComponent< {!this.props.match.params.did && ( {this.props.protocolVersion === LEGACY && ( -
- This network is not supported! -
+
This network is not supported!
)}
-

- Decentralized Identifier -

+

Decentralized Identifier

- The Identity Resolver is a tool for resolving Decentralized - Identifiers (DIDs) into their associated DID Document, by retrieving - the information from an IOTA or Shimmer network. + The Identity Resolver is a tool for resolving Decentralized Identifiers (DIDs) into + their associated DID Document, by retrieving the information from an IOTA or Shimmer + network.

{this.props.protocolVersion !== LEGACY && (
{ + onSearch={(e) => { this.props.history.push( - `/${this.props.match.params.network}/identity-resolver/${e}` + `/${this.props.match.params.network}/identity-resolver/${e}`, ); }} network={this.props.match.params.network} @@ -85,7 +80,7 @@ class IdentityResolver extends AsyncComponent< className="load-history-button" onClick={() => { this.props.history.push( - `/${this.props.match.params.network}/identity-resolver/${this.state.didExample}` + `/${this.props.match.params.network}/identity-resolver/${this.state.didExample}`, ); }} type="button" @@ -100,14 +95,10 @@ class IdentityResolver extends AsyncComponent<
{this.props.protocolVersion === LEGACY && (
-
- This network is not supported! -
+
This network is not supported!
)} - {this.props.protocolVersion === CHRYSALIS && ( - - )} + {this.props.protocolVersion === CHRYSALIS && }
)}
@@ -122,9 +113,9 @@ class IdentityResolver extends AsyncComponent< const networkService = ServiceFactory.get("network"); const networks = networkService.networks(); - const network = networks.find(n => n.network === this.props.match.params.network); + const network = networks.find((n) => n.network === this.props.match.params.network); this.setState({ - didExample: network?.didExample + didExample: network?.didExample, }); } } diff --git a/client/src/app/routes/Search.scss b/client/src/app/routes/Search.scss index 54c66b7d5..e30c36e2a 100644 --- a/client/src/app/routes/Search.scss +++ b/client/src/app/routes/Search.scss @@ -5,48 +5,48 @@ @import "../../scss/themes"; .search { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; + flex-direction: column; + + .wrapper { + display: flex; + justify-content: center; - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - h3 { - margin-bottom: 20px; - } + h3 { + margin-bottom: 20px; + } - p { - @include font-size(16px); + p { + @include font-size(16px); - font-family: $metropolis; - } + font-family: $metropolis; + } - ul { - @include font-size(16px); + ul { + @include font-size(16px); - margin-left: 40px; - font-family: $metropolis; + margin-left: 40px; + font-family: $metropolis; - li { - margin-bottom: 10px; - color: var(--body-color); + li { + margin-bottom: 10px; + color: var(--body-color); - > span { - &:first-child { - margin-right: 10px; - color: $main-green; + > span { + &:first-child { + margin-right: 10px; + color: $main-green; + } + } + } } - } } - } } - } } diff --git a/client/src/app/routes/StreamsV0.scss b/client/src/app/routes/StreamsV0.scss index 05a48fdbc..c540a9409 100644 --- a/client/src/app/routes/StreamsV0.scss +++ b/client/src/app/routes/StreamsV0.scss @@ -4,75 +4,75 @@ @import "../../scss/variables"; .streams-v0 { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; - } - } - - @include phone-down { - padding-right: 0; - padding-left: 0; - } - - h1 { - margin-bottom: 20px; - } - - p { - @include font-size(12px); - - color: $gray-10; - font-family: $metropolis; - font-weight: bold; - } - - .status { - @include font-size(14px); - } - - .cards { - flex: 1; - margin-right: 24px; - - @include phone-down { - margin-right: unset; - } - - .item-details { - @include font-size(14px); - - padding-top: 20px; - - @include phone-down { - padding-top: 0; - } - - font-family: $metropolis; - - .item-details-root { - word-break: break-all; - } + flex-direction: column; + + .wrapper { + display: flex; + justify-content: center; + + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; + + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; + + > .row { + flex-direction: column; + } + } + + @include phone-down { + padding-right: 0; + padding-left: 0; + } + + h1 { + margin-bottom: 20px; + } + + p { + @include font-size(12px); + + color: $gray-10; + font-family: $metropolis; + font-weight: bold; + } + + .status { + @include font-size(14px); + } + + .cards { + flex: 1; + margin-right: 24px; + + @include phone-down { + margin-right: unset; + } + + .item-details { + @include font-size(14px); + + padding-top: 20px; + + @include phone-down { + padding-top: 0; + } + + font-family: $metropolis; + + .item-details-root { + word-break: break-all; + } + } + } } - } } - } } diff --git a/client/src/app/routes/StreamsV0.tsx b/client/src/app/routes/StreamsV0.tsx index d4567cf31..f1a4e0319 100644 --- a/client/src/app/routes/StreamsV0.tsx +++ b/client/src/app/routes/StreamsV0.tsx @@ -56,7 +56,7 @@ class StreamsV0 extends AsyncComponent, sideKey: props.match.params.key ?? "", sideKeyValidation: "", isValid: false, - packets: [] + packets: [], }; } @@ -73,7 +73,7 @@ class StreamsV0 extends AsyncComponent, window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); } @@ -102,15 +102,13 @@ class StreamsV0 extends AsyncComponent,
-
- Root -
+
Root
this.setState( - { root: e.target.value.toUpperCase() }, () => this.validate() - )} + onChange={(e) => + this.setState({ root: e.target.value.toUpperCase() }, () => this.validate()) + } disabled={this.state.statusBusy} className="form-input-long" maxLength={81} @@ -123,51 +121,34 @@ class StreamsV0 extends AsyncComponent,
)}
-
- Mode -
+
Mode
-
- Side Key -
+
Side Key
this.setState( - { sideKey: e.target.value.toUpperCase() }, () => this.validate() - )} + onChange={(e) => + this.setState({ sideKey: e.target.value.toUpperCase() }, () => this.validate()) + } disabled={this.state.mode !== "restricted" || this.state.statusBusy} className="form-input-long" maxLength={81} />
-
-   -
+
 
)} - {item.messageType === "Trytes" && ( - `Message ${item.messageType}` - )} + {item.messageType === "Trytes" && `Message ${item.messageType}`} - +
- {item.showRawMessageTrytes - ? item.rawMessageTrytes - : (item.messageType === "JSON" - ? - : item.message)} + {item.showRawMessageTrytes ? ( + item.rawMessageTrytes + ) : item.messageType === "JSON" ? ( + + ) : ( + item.message + )}
{this.state.packets.length - 1 === idx && ( -
- Next Root -
-
- {item.nextRoot} -
+
Next Root
+
{item.nextRoot}
)}
@@ -292,10 +248,8 @@ class StreamsV0 extends AsyncComponent, {this.state.status && (
- {this.state.statusBusy && ()} -

- {this.state.status} -

+ {this.state.statusBusy && } +

{this.state.status}

)} @@ -303,7 +257,7 @@ class StreamsV0 extends AsyncComponent,
-
+
); } @@ -333,7 +287,7 @@ class StreamsV0 extends AsyncComponent, this.setState({ rootValidation, sideKeyValidation, - isValid: root.length > 0 && rootValidation.length === 0 && sideKeyValidation.length === 0 + isValid: root.length > 0 && rootValidation.length === 0 && sideKeyValidation.length === 0, }); return rootValidation.length === 0 && sideKeyValidation.length === 0; @@ -357,13 +311,14 @@ class StreamsV0 extends AsyncComponent, { statusBusy: true, status: "Waiting for channel data...", - packets: [] + packets: [], }, async () => { this._nextRoot = this.state.root; this._timeout = 100; await this.loadNextPacket(true); - }); + }, + ); } } @@ -385,7 +340,11 @@ class StreamsV0 extends AsyncComponent, private async loadNextPacket(force?: boolean): Promise { if (this._nextRoot && (this._updateTimer || force) && this.state.statusBusy) { const packet = await this._tangleCacheService.getStreamsV0Packet( - this.props.match.params.network, this._nextRoot, this.state.mode, this.state.sideKey); + this.props.match.params.network, + this._nextRoot, + this.state.mode, + this.state.sideKey, + ); if (packet) { const packets = this.state.packets; @@ -398,7 +357,7 @@ class StreamsV0 extends AsyncComponent, message: decoded.message, messageType: decoded.messageType, rawMessageTrytes: packet.payload, - showRawMessageTrytes: false + showRawMessageTrytes: false, }); this.setState({ packets }); diff --git a/client/src/app/routes/chrysalis/Addr.scss b/client/src/app/routes/chrysalis/Addr.scss index eeb8a5928..fa1e66853 100644 --- a/client/src/app/routes/chrysalis/Addr.scss +++ b/client/src/app/routes/chrysalis/Addr.scss @@ -4,233 +4,233 @@ @import "../../../scss/variables"; .addr { - display: flex; - flex-direction: column; - - .addr--header { display: flex; - align-items: center; - justify-content: space-between; - - .addr--header__switch { - display: flex; - align-items: center; - - & > span { - @include font-size(12px, 18px); - - margin-right: 16px; - color: $gray-6; - font-family: $inter; - font-weight: 500; - } - - .switch { - display: inline-block; - position: relative; - width: 32px; - height: 20px; - } - - .switch input { - width: 0; - height: 0; - opacity: 0; - } - - .slider { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - transition: 0.4s; - background-color: $gray-4; - cursor: pointer; - } - - .slider::before { - content: ""; - position: absolute; - bottom: 2.5px; - left: 2.5px; - width: 15px; - height: 15px; - transition: 0.4s; - background-color: white; - } - - input:checked + .slider { - background-color: $green-6; - } - - input:focus + .slider { - box-shadow: 0 0 1px $green-6; - } - - input:checked + .slider::before { - transform: translateX(12px); - } - - .slider.round { - border-radius: 16px; - } - - .slider.round::before { - border-radius: 50%; - } - } - } + flex-direction: column; - .wrapper { - display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; - } - } + .addr--header { + display: flex; + align-items: center; + justify-content: space-between; - .balance { - margin-left: 16px; + .addr--header__switch { + display: flex; + align-items: center; - .pointer { - cursor: pointer; - } - } + & > span { + @include font-size(12px, 18px); - .cards { - flex: 1; - margin-right: 24px; + margin-right: 16px; + color: $gray-6; + font-family: $inter; + font-weight: 500; + } - @include desktop-down { - flex: unset; - width: 100%; - margin-right: 0; - } + .switch { + display: inline-block; + position: relative; + width: 32px; + height: 20px; + } - .value-buttons { - .col { - flex: 1; - width: auto; - } - } + .switch input { + width: 0; + height: 0; + opacity: 0; + } - @include desktop-down { - .value-buttons { - flex-direction: column; + .slider { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + transition: 0.4s; + background-color: $gray-4; + cursor: pointer; + } - .col { - flex: unset; - width: 100%; + .slider::before { + content: ""; + position: absolute; + bottom: 2.5px; + left: 2.5px; + width: 15px; + height: 15px; + transition: 0.4s; + background-color: white; } - .col + .col { - margin-top: 23px; - margin-left: 0; + input:checked + .slider { + background-color: $green-6; } - } - } - .col + .col { - margin-left: 23px; + input:focus + .slider { + box-shadow: 0 0 1px $green-6; + } - @include tablet-down { - margin-left: 0; - } - } - } + input:checked + .slider::before { + transform: translateX(12px); + } - .card + .card { - margin-top: 23px; - } + .slider.round { + border-radius: 16px; + } + + .slider.round::before { + border-radius: 50%; + } + } } - } - .transaction--section { - @include tablet-down { - .section--header { - flex-direction: column; - align-items: flex-start; + .wrapper { + display: flex; + justify-content: center; - .transactions-filter { - margin-top: 24px; + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; + + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; + + > .row { + flex-direction: column; + } + } + + .balance { + margin-left: 16px; + + .pointer { + cursor: pointer; + } + } + + .cards { + flex: 1; + margin-right: 24px; + + @include desktop-down { + flex: unset; + width: 100%; + margin-right: 0; + } + + .value-buttons { + .col { + flex: 1; + width: auto; + } + } + + @include desktop-down { + .value-buttons { + flex-direction: column; + + .col { + flex: unset; + width: 100%; + } + + .col + .col { + margin-top: 23px; + margin-left: 0; + } + } + } + + .col + .col { + margin-left: 23px; + + @include tablet-down { + margin-left: 0; + } + } + } + + .card + .card { + margin-top: 23px; + } } - } } - .transactions-filter { - display: flex; - font-family: $inter; - font-size: 12px; - font-weight: 500; - - button { - @include font-size(12px, 18px); - - padding: 3px 12px; - border: 0.2px solid var(--input-border-color); - border-radius: 0; - background-color: var(--body-background); - color: $gray-5; - color: var(--header-color); - letter-spacing: 0.5px; - - &:focus { - box-shadow: none; - } + .transaction--section { + @include tablet-down { + .section--header { + flex-direction: column; + align-items: flex-start; - &.active { - background-color: rgba(20, 202, 191, 0.12); - color: var(--header-color); + .transactions-filter { + margin-top: 24px; + } + } } - &:first-child { - border-radius: 6px 0 0 6px; + .transactions-filter { + display: flex; + font-family: $inter; + font-size: 12px; + font-weight: 500; + + button { + @include font-size(12px, 18px); + + padding: 3px 12px; + border: 0.2px solid var(--input-border-color); + border-radius: 0; + background-color: var(--body-background); + color: $gray-5; + color: var(--header-color); + letter-spacing: 0.5px; + + &:focus { + box-shadow: none; + } + + &.active { + background-color: rgba(20, 202, 191, 0.12); + color: var(--header-color); + } + + &:first-child { + border-radius: 6px 0 0 6px; + } + + &:last-child { + border-radius: 0 6px 6px 0; + } + } } - &:last-child { - border-radius: 0 6px 6px 0; + .section--header__filter { + display: flex; } - } - } - .section--header__filter { - display: flex; - } - - .sort-disclaimer { - align-items: center; - background-color: var(--header-svg-bg); - color: var(--body-color); - border-radius: 6px; - display: flex; - flex-direction: row; - font-family: $inter; - font-size: 0.875rem; - justify-content: center; - margin: 0 auto; - margin-bottom: 24px; - padding: 10px 24px; - text-align: center; + .sort-disclaimer { + align-items: center; + background-color: var(--header-svg-bg); + color: var(--body-color); + border-radius: 6px; + display: flex; + flex-direction: row; + font-family: $inter; + font-size: 0.875rem; + justify-content: center; + margin: 0 auto; + margin-bottom: 24px; + padding: 10px 24px; + text-align: center; + } } - } - .general-content { - @include tablet-down { - flex-direction: column; + .general-content { + @include tablet-down { + flex-direction: column; + } } - } } diff --git a/client/src/app/routes/chrysalis/Addr.tsx b/client/src/app/routes/chrysalis/Addr.tsx index 6fe5fc8dc..258d54362 100644 --- a/client/src/app/routes/chrysalis/Addr.tsx +++ b/client/src/app/routes/chrysalis/Addr.tsx @@ -53,19 +53,14 @@ class Addr extends AsyncComponent, AddrSt super(props); const networkService = ServiceFactory.get("network"); - const networkConfig = this.props.match.params.network - ? networkService.get(this.props.match.params.network) - : undefined; + const networkConfig = this.props.match.params.network ? networkService.get(this.props.match.params.network) : undefined; this._tangleCacheService = ServiceFactory.get(`tangle-cache-${CHRYSALIS}`); this._bechHrp = networkConfig?.bechHrp ?? "iota"; this.state = { - ...Bech32AddressHelper.buildAddress( - this._bechHrp, - props.match.params.address - ), + ...Bech32AddressHelper.buildAddress(this._bechHrp, props.match.params.address), formatFull: false, statusBusy: true, status: "Loading transactions...", @@ -74,18 +69,21 @@ class Addr extends AsyncComponent, AddrSt currentPage: 1, pageSize: 10, currentPageTransactions: [], - isFormattedBalance: false + isFormattedBalance: false, }; } private get currentPageTransactions() { const firstPageIndex = (this.state.currentPage - 1) * this.state.pageSize; - const lastPageIndex = (this.state.currentPage === Math.ceil(this.txsHistory.length / this.state.pageSize)) ? this.txsHistory.length : firstPageIndex + this.state.pageSize; + const lastPageIndex = + this.state.currentPage === Math.ceil(this.txsHistory.length / this.state.pageSize) + ? this.txsHistory.length + : firstPageIndex + this.state.pageSize; const transactionsPage = this.txsHistory.slice(firstPageIndex, lastPageIndex); - const sortedTransactions: ITransactionHistoryItem[] = transactionsPage.sort((a, b) => ( - a.referencedByMilestoneIndex > b.referencedByMilestoneIndex ? -1 : 1 - )); + const sortedTransactions: ITransactionHistoryItem[] = transactionsPage.sort((a, b) => + a.referencedByMilestoneIndex > b.referencedByMilestoneIndex ? -1 : 1, + ); return sortedTransactions; } @@ -98,34 +96,35 @@ class Addr extends AsyncComponent, AddrSt */ public async componentDidMount(): Promise { super.componentDidMount(); - const result = await this._tangleCacheService.search( - this.props.match.params.network, this.props.match.params.address); + const result = await this._tangleCacheService.search(this.props.match.params.network, this.props.match.params.address); if (result?.address) { window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); - this.setState({ - address: result.address, - bech32AddressDetails: Bech32AddressHelper.buildAddress( - this._bechHrp, - result.address.address, - result.address.addressType - ), - balance: result.address.balance, - outputIds: result.addressOutputIds, - historicOutputIds: result.historicAddressOutputIds - }, async () => { - await this.getTransactionHistory(); - }); + this.setState( + { + address: result.address, + bech32AddressDetails: Bech32AddressHelper.buildAddress( + this._bechHrp, + result.address.address, + result.address.addressType, + ), + balance: result.address.balance, + outputIds: result.addressOutputIds, + historicOutputIds: result.historicAddressOutputIds, + }, + async () => { + await this.getTransactionHistory(); + }, + ); } else { this.props.history.replace(`/${this.props.match.params.network}/search/${this.props.match.params.address}`); } } - /** * Render the component. * @returns The node to render. @@ -137,9 +136,7 @@ class Addr extends AsyncComponent, AddrSt
-

- Address -

+

Address

@@ -148,9 +145,7 @@ class Addr extends AsyncComponent, AddrSt
-

- General -

+

General

@@ -200,46 +195,47 @@ class Addr extends AsyncComponent, AddrSt
-
- Final balance -
+
Final balance
{this.state.balance > 0 ? (
this.setState({ - isFormattedBalance: !this.state.isFormattedBalance - })} + onClick={() => + this.setState({ + isFormattedBalance: !this.state.isFormattedBalance, + }) + } className="pointer margin-r-5" > - {this.state.isFormattedBalance ? this.state.balance : UnitsHelper.formatBest(this.state.balance)} + {this.state.isFormattedBalance + ? this.state.balance + : UnitsHelper.formatBest(this.state.balance)} ( )
- ) : 0} + ) : ( + 0 + )}
)}
- {this.state.bech32AddressDetails?.bech32 && - ( - // eslint-disable-next-line react/jsx-pascal-case - - )} + {this.state.bech32AddressDetails?.bech32 && ( + // eslint-disable-next-line react/jsx-pascal-case + + )}
{this.state.outputs && this.state.outputs.length === 0 && (
-

- There are no transactions for this address. -

+

There are no transactions for this address.

)} @@ -248,17 +244,13 @@ class Addr extends AsyncComponent, AddrSt
-

- Transaction History -

+

Transaction History

{this.state.status && (
- {this.state.statusBusy && ()} -

- {this.state.status} -

+ {this.state.statusBusy && } +

{this.state.status}

)}
@@ -281,8 +273,7 @@ class Addr extends AsyncComponent, AddrSt - {this.currentPageTransactions.map((transaction, k) => - ( + {this.currentPageTransactions.map((transaction, k) => ( , AddrSt date={DateHelper.formatShort(transaction?.milestoneTimestampReferenced * 1000)} amount={transaction?.addressBalanceChange} tableFormat={true} - hasConflicts={!transaction.ledgerInclusionState || - transaction.ledgerInclusionState === "conflicting"} + hasConflicts={ + !transaction.ledgerInclusionState || + transaction.ledgerInclusionState === "conflicting" + } /> ))} @@ -304,8 +297,7 @@ class Addr extends AsyncComponent, AddrSt {/* Only visible in mobile -- Card transactions*/}
- {this.currentPageTransactions.map((transaction, k) => - ( + {this.currentPageTransactions.map((transaction, k) => ( , AddrSt pageSize={this.state.pageSize} extraPageRangeLimit={20} siblingsCount={1} - onPageChange={page => this.setState({ currentPage: page })} + onPageChange={(page) => this.setState({ currentPage: page })} /> -
)} +
+ )}
@@ -338,15 +331,18 @@ class Addr extends AsyncComponent, AddrSt } private async getTransactionHistory() { - const transactionHistory = await this._tangleCacheService.transactionsHistory({ - network: this.props.match.params.network, - address: this.state.address?.address ?? "" - }, false); + const transactionHistory = await this._tangleCacheService.transactionsHistory( + { + network: this.props.match.params.network, + address: this.state.address?.address ?? "", + }, + false, + ); this.setState({ status: "", statusBusy: false, - transactionHistory + transactionHistory, }); } } diff --git a/client/src/app/routes/chrysalis/AddrState.ts b/client/src/app/routes/chrysalis/AddrState.ts index 8779d9420..c1b7b1cf8 100644 --- a/client/src/app/routes/chrysalis/AddrState.ts +++ b/client/src/app/routes/chrysalis/AddrState.ts @@ -3,7 +3,6 @@ import { IAddressResponse, IOutputResponse } from "@iota/iota.js"; import { ITransactionHistoryResponse, ITransactionHistoryItem } from "~models/api/chrysalis/ITransactionHistoryResponse"; import { IBech32AddressDetails } from "~models/api/IBech32AddressDetails"; - export interface AddrState { /** * Address. diff --git a/client/src/app/routes/chrysalis/Indexed.scss b/client/src/app/routes/chrysalis/Indexed.scss index f5e5a2f58..e288437ff 100644 --- a/client/src/app/routes/chrysalis/Indexed.scss +++ b/client/src/app/routes/chrysalis/Indexed.scss @@ -4,105 +4,105 @@ @import "../../../scss/variables"; .indexed { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; + flex-direction: column; - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - } + .wrapper { + display: flex; + justify-content: center; + + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; + + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; + } - .indexed-number { - @include font-size(12px); + .indexed-number { + @include font-size(12px); + + display: flex; + align-items: center; + height: 24px; + margin-left: 20px; + padding: 0 8px; + border-radius: 6px; + background-color: var(--light-bg); + color: $gray; + font-family: $metropolis; + font-weight: bold; + white-space: nowrap; + } - display: flex; - align-items: center; - height: 24px; - margin-left: 20px; - padding: 0 8px; - border-radius: 6px; - background-color: var(--light-bg); - color: $gray; - font-family: $metropolis; - font-weight: bold; - white-space: nowrap; - } - - .indexed-messages { - &.scroll-limit { - max-height: 550px; - overflow-y: auto; - - &.scroll-limit__disabled { - opacity: 0.5; - } - } + .indexed-messages { + &.scroll-limit { + max-height: 550px; + overflow-y: auto; + + &.scroll-limit__disabled { + opacity: 0.5; + } + } + + .indexed-message { + width: 100%; + + &:hover { + background-color: var(--light-bg); + } + + button { + @include font-size(14px); + + width: 100%; + border: none; + background: none; + color: var(--body-color); + font-family: $ibm-plex-mono; + font-weight: normal; + letter-spacing: 0.02em; + line-height: 20px; + + span { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover { + text-decoration: underline; + } + } + } + } + } - .indexed-message { - width: 100%; - - &:hover { - background-color: var(--light-bg); - } - - button { - @include font-size(14px); - - width: 100%; - border: none; - background: none; - color: var(--body-color); - font-family: $ibm-plex-mono; - font-weight: normal; - letter-spacing: 0.02em; - line-height: 20px; - - span { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - - &:hover { - text-decoration: underline; - } + .indexed-actions { + button { + @include font-size(14px, 21px); + + display: flex; + position: relative; + justify-content: center; + width: 120px; + padding: 9px; + border: 1px solid $gray-3; + border-radius: 6px; + background: var(--light-bg); + color: var(--expanded-color); + font-family: $inter; + font-weight: 400; + letter-spacing: 0.5px; + text-align: center; + text-decoration: none; + cursor: pointer; + } } - } - } - } - - .indexed-actions { - button { - @include font-size(14px, 21px); - - display: flex; - position: relative; - justify-content: center; - width: 120px; - padding: 9px; - border: 1px solid $gray-3; - border-radius: 6px; - background: var(--light-bg); - color: var(--expanded-color); - font-family: $inter; - font-weight: 400; - letter-spacing: 0.5px; - text-align: center; - text-decoration: none; - cursor: pointer; } - } } - } } diff --git a/client/src/app/routes/chrysalis/Indexed.tsx b/client/src/app/routes/chrysalis/Indexed.tsx index 80b33d4c1..e29aca4f9 100644 --- a/client/src/app/routes/chrysalis/Indexed.tsx +++ b/client/src/app/routes/chrysalis/Indexed.tsx @@ -34,15 +34,13 @@ class Indexed extends AsyncComponent, Ind constructor(props: RouteComponentProps) { super(props); - this._tangleCacheService = ServiceFactory.get( - `tangle-cache-${CHRYSALIS}` - ); + this._tangleCacheService = ServiceFactory.get(`tangle-cache-${CHRYSALIS}`); this._settingsService = ServiceFactory.get("settings"); this.state = { statusBusy: true, status: "Loading indexed data...", - advancedMode: this._settingsService.get().advancedMode ?? false + advancedMode: this._settingsService.get().advancedMode ?? false, }; } @@ -52,20 +50,17 @@ class Indexed extends AsyncComponent, Ind public async componentDidMount(): Promise { super.componentDidMount(); - const result = await this._tangleCacheService.search( - this.props.match.params.network, this.props.match.params.index - ); + const result = await this._tangleCacheService.search(this.props.match.params.network, this.props.match.params.index); if (result?.indexMessageIds && result?.indexMessageType) { window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); - const hexIndex = result.indexMessageType === "hex" ? - this.props.match.params.index : - Converter.utf8ToHex(this.props.match.params.index); + const hexIndex = + result.indexMessageType === "hex" ? this.props.match.params.index : Converter.utf8ToHex(this.props.match.params.index); this.setState({ messageIds: result.indexMessageIds, @@ -73,7 +68,7 @@ class Indexed extends AsyncComponent, Ind indexLengthBytes: hexIndex.length / 2, cursor: result.cursor, status: "", - statusBusy: false + statusBusy: false, }); } else { this.props.history.replace(`/${this.props.match.params.network}/search/${this.props.match.params.index}`); @@ -96,63 +91,48 @@ class Indexed extends AsyncComponent, Ind
-

General

- {this.state.statusBusy && ()} - + {this.state.statusBusy && }
{this.state.hexIndex && (
- - Index - + Index
- -
)} + +
+ )}

Indexed Messages

{this.state.messageIds !== undefined && ( - - {this.state.messageIds.length} - + {this.state.messageIds.length} )}
- {this.state.status && ( -

{this.state.status}

- )} + {this.state.status &&

{this.state.status}

} {this.state.messageIds && this.state.messageIds.length === 0 && ( -
- There are no messages for this index. -
+
There are no messages for this index.
)} {this.state.messageIds && this.state.messageIds.length > 0 && - this.state.messageIds.map(messageId => ( -
+ this.state.messageIds.map((messageId) => ( +
@@ -192,22 +172,25 @@ class Indexed extends AsyncComponent, Ind * @param useCursor Use the cursor to load chunk. */ private loadNextChunk(useCursor: boolean): void { - this.setState({ - statusBusy: true - }, async () => { - const result = await this._tangleCacheService.search( - this.props.match.params.network, - this.props.match.params.index, - useCursor ? this.state.cursor : undefined - ); - - this.setState({ - statusBusy: false, - status: "", - messageIds: result?.indexMessageIds, - cursor: result?.cursor - }); - }); + this.setState( + { + statusBusy: true, + }, + async () => { + const result = await this._tangleCacheService.search( + this.props.match.params.network, + this.props.match.params.index, + useCursor ? this.state.cursor : undefined, + ); + + this.setState({ + statusBusy: false, + status: "", + messageIds: result?.indexMessageIds, + cursor: result?.cursor, + }); + }, + ); } } diff --git a/client/src/app/routes/chrysalis/IndexedState.ts b/client/src/app/routes/chrysalis/IndexedState.ts index 4cce072fe..38f0a9563 100644 --- a/client/src/app/routes/chrysalis/IndexedState.ts +++ b/client/src/app/routes/chrysalis/IndexedState.ts @@ -27,10 +27,10 @@ export interface IndexedState { /** * Display advanced mode. */ - advancedMode: boolean; + advancedMode: boolean; - /** - * Cursor for next chunk of data. - */ - cursor?: string; + /** + * Cursor for next chunk of data. + */ + cursor?: string; } diff --git a/client/src/app/routes/chrysalis/Landing.scss b/client/src/app/routes/chrysalis/Landing.scss index 62233390a..8735fee1a 100644 --- a/client/src/app/routes/chrysalis/Landing.scss +++ b/client/src/app/routes/chrysalis/Landing.scss @@ -587,7 +587,6 @@ transform: translate(-130px, -40px); } } - } .feeds-wrapper { @@ -598,4 +597,3 @@ } } } - diff --git a/client/src/app/routes/chrysalis/Landing.tsx b/client/src/app/routes/chrysalis/Landing.tsx index eb8c513ab..e9fd2afa2 100644 --- a/client/src/app/routes/chrysalis/Landing.tsx +++ b/client/src/app/routes/chrysalis/Landing.tsx @@ -34,7 +34,7 @@ class Landing extends Feeds, LandingState network: CUSTOM, protocolVersion: CHRYSALIS, hasStatisticsSupport: false, - isEnabled: false + isEnabled: false, }; this.state = { @@ -57,7 +57,7 @@ class Landing extends Feeds, LandingState currency: "USD", formatFull: false, isFeedPaused: false, - isFilterExpanded: false + isFilterExpanded: false, }; } @@ -69,7 +69,6 @@ class Landing extends Feeds, LandingState const settings = this._settingsService.get(); - let filterSettings: IFilterSettings | undefined; if (this._networkConfig && settings.filters) { @@ -81,9 +80,8 @@ class Landing extends Feeds, LandingState valueMinimumUnits: filterSettings?.valueMinimumUnits ?? "i", valueMaximum: filterSettings?.valueMaximum ?? "3", valueMaximumUnits: filterSettings?.valueMaximumUnits ?? "Pi", - valuesFilter: filterSettings?.valuesFilter ?? - getFilterFieldDefaults(this._networkConfig?.protocolVersion ?? CHRYSALIS), - formatFull: settings.formatFull + valuesFilter: filterSettings?.valuesFilter ?? getFilterFieldDefaults(this._networkConfig?.protocolVersion ?? CHRYSALIS), + formatFull: settings.formatFull, }); } @@ -107,8 +105,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.isEnabled && (
- Messages per sec - + Messages per sec
{NumberHelper.roundTo(Number(this.state.itemsPerSecond), 1) || "0"} @@ -117,9 +114,7 @@ class Landing extends Feeds, LandingState
Inclusion rate - - {this.state.confirmedItemsPerSecondPercent} - + {this.state.confirmedItemsPerSecondPercent}
{this.state.networkConfig.showMarket && (
@@ -130,9 +125,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.showMarket && (
Price / MI - - {this.state.priceCurrency} - + {this.state.priceCurrency}
)}
@@ -149,34 +142,31 @@ class Landing extends Feeds, LandingState >

This network is superseded by - Mainnet (stardust). + + Mainnet (stardust) + + .

- - It can only be used to browse historic data before milestone 7669900 - + It can only be used to browse historic data before milestone 7669900

- { - !this.state.networkConfig.isEnabled && ( -
-
- {this.state.networkConfig.isEnabled === undefined - ? "This network is not recognised." - : "This network is currently disabled in explorer."} -
+ {!this.state.networkConfig.isEnabled && ( +
+
+ {this.state.networkConfig.isEnabled === undefined + ? "This network is not recognised." + : "This network is currently disabled in explorer."}
- ) - } -
-
-
- +
+ )} +
+
+
); } - const isLatestMilestoneFeedInfoEnabled = this._networkConfig && - this._networkConfig.network !== CUSTOM; + const isLatestMilestoneFeedInfoEnabled = this._networkConfig && this._networkConfig.network !== CUSTOM; return (
@@ -192,8 +182,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.isEnabled && (
- Messages per sec - + Messages per sec
{NumberHelper.roundTo(Number(this.state.itemsPerSecond), 1) || "--"} @@ -202,9 +191,7 @@ class Landing extends Feeds, LandingState
Inclusion rate - - {this.state.confirmedItemsPerSecondPercent} - + {this.state.confirmedItemsPerSecondPercent}
{this.state.networkConfig.showMarket && (
@@ -215,9 +202,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.showMarket && (
Price / MI - - {this.state.priceCurrency} - + {this.state.priceCurrency}
)}
@@ -239,13 +224,15 @@ class Landing extends Feeds, LandingState onClick={() => { this.setState({ isFeedPaused: !this.state.isFeedPaused, - frozenMessages: this.state.filteredItems + frozenMessages: this.state.filteredItems, }); }} > - {this.state.isFeedPaused - ? play_arrow - : pause} + {this.state.isFeedPaused ? ( + play_arrow + ) : ( + pause + )}
- {this.state.valuesFilter.filter(f => f.isEnabled).length} + {this.state.valuesFilter.filter((f) => f.isEnabled).length}
{this.state.isFilterExpanded && ( @@ -280,33 +265,30 @@ class Landing extends Feeds, LandingState
- {this.state.valuesFilter.map(payload => ( + {this.state.valuesFilter.map((payload) => ( -
-
+
+ )} +
+
+
+
); } @@ -427,24 +396,19 @@ class Landing extends Feeds, LandingState protected updateCurrency(): void { if (this._currencyData) { this.setState({ - marketCapCurrency: - this._currencyData.coinStats?.iota?.marketCap ? - this._currencyService.convertFiatBase( - this._currencyData.coinStats.iota.marketCap, - this._currencyData, - true, - 2, - undefined, - true) - : "--", - priceCurrency: this._currencyData.coinStats?.iota?.price ? - this._currencyService.convertFiatBase( - this._currencyData.coinStats.iota.price, - this._currencyData, - true, - 3, - 8) - : "--" + marketCapCurrency: this._currencyData.coinStats?.iota?.marketCap + ? this._currencyService.convertFiatBase( + this._currencyData.coinStats.iota.marketCap, + this._currencyData, + true, + 2, + undefined, + true, + ) + : "--", + priceCurrency: this._currencyData.coinStats?.iota?.price + ? this._currencyService.convertFiatBase(this._currencyData.coinStats.iota.price, this._currencyData, true, 3, 8) + : "--", }); } } @@ -463,15 +427,13 @@ class Landing extends Feeds, LandingState */ private applyFilters(): void { if (this._isMounted && this._feedClient) { - const minLimit = UnitsHelper.convertUnits( - Number.parseFloat(this.state.valueMinimum), this.state.valueMinimumUnits, "i"); - const maxLimit = UnitsHelper.convertUnits( - Number.parseFloat(this.state.valueMaximum), this.state.valueMaximumUnits, "i"); + const minLimit = UnitsHelper.convertUnits(Number.parseFloat(this.state.valueMinimum), this.state.valueMinimumUnits, "i"); + const maxLimit = UnitsHelper.convertUnits(Number.parseFloat(this.state.valueMaximum), this.state.valueMaximumUnits, "i"); const filters = [ { payloadType: "Zero only", - filter: (item: IFeedItem) => item.value === 0 + filter: (item: IFeedItem) => item.value === 0, }, { payloadType: "Non-zero only", @@ -479,7 +441,7 @@ class Landing extends Feeds, LandingState item.value !== undefined && item.value !== 0 && Math.abs(item.value) >= minLimit && - Math.abs(item.value) <= maxLimit + Math.abs(item.value) <= maxLimit, }, { payloadType: "Transaction", @@ -487,26 +449,21 @@ class Landing extends Feeds, LandingState item.value !== undefined && item.value !== 0 && Math.abs(item.value) >= minLimit && - Math.abs(item.value) <= maxLimit + Math.abs(item.value) <= maxLimit, }, { payloadType: "Milestone", - filter: (item: IFeedItem) => - item.payloadType === "MS" - + filter: (item: IFeedItem) => item.payloadType === "MS", }, { payloadType: "Indexed", - filter: (item: IFeedItem) => - item.payloadType === "Index" + filter: (item: IFeedItem) => item.payloadType === "Index", }, { payloadType: "No payload", - filter: (item: IFeedItem) => - item.payloadType === "None" - - } - ].filter(f => { + filter: (item: IFeedItem) => item.payloadType === "None", + }, + ].filter((f) => { let aux = false; for (const payload of this.state.valuesFilter) { if (f.payloadType === payload.label && payload.isEnabled) { @@ -516,12 +473,10 @@ class Landing extends Feeds, LandingState return aux; }); - const filteredMessages = this.state.isFeedPaused - ? this.state.frozenMessages - : this._feedClient.getItems(); + const filteredMessages = this.state.isFeedPaused ? this.state.frozenMessages : this._feedClient.getItems(); this.setState({ filteredItems: filteredMessages - .filter(item => { + .filter((item) => { let aux = false; for (const f of filters) { const filter = f.filter; @@ -530,9 +485,8 @@ class Landing extends Feeds, LandingState } } return aux; - } - ) - .slice(0, 10) + }) + .slice(0, 10), }); } } @@ -578,7 +532,7 @@ class Landing extends Feeds, LandingState valueMinimum: this.state.valueMinimum, valueMinimumUnits: this.state.valueMinimumUnits, valueMaximum: this.state.valueMaximum, - valueMaximumUnits: this.state.valueMaximumUnits + valueMaximumUnits: this.state.valueMaximumUnits, }; this._settingsService.save(); @@ -592,7 +546,7 @@ class Landing extends Feeds, LandingState * @param payloadType The payload type to toggle. */ private toggleFilter(payloadType: string): void { - const valuesFilter = this.state.valuesFilter.map(payload => { + const valuesFilter = this.state.valuesFilter.map((payload) => { if (payload.label === payloadType) { payload.isEnabled = !payload.isEnabled; } @@ -605,80 +559,57 @@ class Landing extends Feeds, LandingState * Reset filters to default values */ private resetFilters(): void { - this.setState({ - valueMinimum: "0", - valueMinimumUnits: "i", - valueMaximum: "1", - valueMaximumUnits: "Ti", - valuesFilter: this.state.valuesFilter.map(filter => ({ ...filter, isEnabled: true })) - }, async () => this.updateFilters()); + this.setState( + { + valueMinimum: "0", + valueMinimumUnits: "i", + valueMaximum: "1", + valueMaximumUnits: "Ti", + valuesFilter: this.state.valuesFilter.map((filter) => ({ ...filter, isEnabled: true })), + }, + async () => this.updateFilters(), + ); } private transactionDropdown(type: "minimum" | "maximum"): ReactNode { return (
- - {type === "minimum" ? "Min value" : "Max value"} - + {type === "minimum" ? "Min value" : "Max value"} - (type === "minimum" - ? this.updateMinimum(e.target.value) - : this.updateMaximum(e.target.value) - ) - } + onChange={(e) => (type === "minimum" ? this.updateMinimum(e.target.value) : this.updateMaximum(e.target.value))} />
- - arrow_drop_down - + arrow_drop_down
@@ -686,6 +617,4 @@ class Landing extends Feeds, LandingState } } - export default Landing; - diff --git a/client/src/app/routes/chrysalis/Message.scss b/client/src/app/routes/chrysalis/Message.scss index e05857267..70d60ff18 100644 --- a/client/src/app/routes/chrysalis/Message.scss +++ b/client/src/app/routes/chrysalis/Message.scss @@ -4,58 +4,58 @@ @import "../../../scss/variables"; .message { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 25px; - - @include desktop-down { - flex: unset; - width: 100%; - max-width: 100%; - margin: 40px 24px; - padding-right: 24px; - padding-left: 24px; - - > .row { - flex-direction: column; - } - } + flex-direction: column; - @include tablet-down { - margin: 28px 0; - } - - .message--header { + .wrapper { display: flex; - align-items: center; - justify-content: space-between; - } - - .section .section--header .messages--number { - @include font-size(12px); - - display: flex; - align-items: center; - height: 24px; - margin-left: 20px; - padding: 0 8px; - border-radius: 6px; - background-color: var(--light-bg); - color: $gray; - font-family: $metropolis; - font-weight: bold; - white-space: nowrap; - } + justify-content: center; + + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 25px; + + @include desktop-down { + flex: unset; + width: 100%; + max-width: 100%; + margin: 40px 24px; + padding-right: 24px; + padding-left: 24px; + + > .row { + flex-direction: column; + } + } + + @include tablet-down { + margin: 28px 0; + } + + .message--header { + display: flex; + align-items: center; + justify-content: space-between; + } + + .section .section--header .messages--number { + @include font-size(12px); + + display: flex; + align-items: center; + height: 24px; + margin-left: 20px; + padding: 0 8px; + border-radius: 6px; + background-color: var(--light-bg); + color: $gray; + font-family: $metropolis; + font-weight: bold; + white-space: nowrap; + } + } } - } } diff --git a/client/src/app/routes/chrysalis/Message.tsx b/client/src/app/routes/chrysalis/Message.tsx index 9cccbf849..b874ec6ad 100644 --- a/client/src/app/routes/chrysalis/Message.tsx +++ b/client/src/app/routes/chrysalis/Message.tsx @@ -1,4 +1,11 @@ -import { CONFLICT_REASON_STRINGS, IMessageMetadata, INDEXATION_PAYLOAD_TYPE, MILESTONE_PAYLOAD_TYPE, TRANSACTION_PAYLOAD_TYPE, UnitsHelper } from "@iota/iota.js"; +import { + CONFLICT_REASON_STRINGS, + IMessageMetadata, + INDEXATION_PAYLOAD_TYPE, + MILESTONE_PAYLOAD_TYPE, + TRANSACTION_PAYLOAD_TYPE, + UnitsHelper, +} from "@iota/iota.js"; import React, { ReactNode } from "react"; import { RouteComponentProps } from "react-router-dom"; import mainHeaderMessage from "~assets/modals/chrysalis/message/main-header.json"; @@ -58,23 +65,18 @@ class Message extends AsyncComponent, MessageS constructor(props: RouteComponentProps) { super(props); - this._tangleCacheService = ServiceFactory.get( - `tangle-cache-${CHRYSALIS}` - ); + this._tangleCacheService = ServiceFactory.get(`tangle-cache-${CHRYSALIS}`); this._settingsService = ServiceFactory.get("settings"); - const networkService = ServiceFactory.get("network"); - const networkConfig = this.props.match.params.network - ? networkService.get(this.props.match.params.network) - : undefined; + const networkConfig = this.props.match.params.network ? networkService.get(this.props.match.params.network) : undefined; this._bechHrp = networkConfig?.bechHrp ?? "iota"; this.state = { messageTangleStatus: "pending", childrenBusy: true, - advancedMode: this._settingsService.get().advancedMode ?? false + advancedMode: this._settingsService.get().advancedMode ?? false, }; } @@ -108,21 +110,20 @@ class Message extends AsyncComponent, MessageS
-

- Message -

+

Message

this.setState( - { - advancedMode: e.target.checked - }, - () => this._settingsService.saveSingle( - "advancedMode", - this.state.advancedMode))} + onToggle={(e) => + this.setState( + { + advancedMode: e.target.checked, + }, + () => this._settingsService.saveSingle("advancedMode", this.state.advancedMode), + ) + } />
@@ -135,33 +136,27 @@ class Message extends AsyncComponent, MessageS this.props.history.push( - `/${this.props.match.params.network - }/search/${messageId}`) - : undefined} + onClick={ + this.state.metadata?.referencedByMilestoneIndex + ? (messageId: string) => + this.props.history.push(`/${this.props.match.params.network}/search/${messageId}`) + : undefined + } />
-
- Message ID -
+
Message ID
- - {this.state.actualMessageId} - + {this.state.actualMessageId}
{this.state.transactionId && (
-
- Transaction Id -
+
Transaction Id
{this.state.transactionId} @@ -169,54 +164,42 @@ class Message extends AsyncComponent, MessageS
)}
-
- Payload Type -
+
Payload Type
- {this.state.message?.payload?.type === TRANSACTION_PAYLOAD_TYPE && - ("Transaction")} - {this.state.message?.payload?.type === MILESTONE_PAYLOAD_TYPE && - ("Milestone")} - {this.state.message?.payload?.type === INDEXATION_PAYLOAD_TYPE && - ("Index")} - {this.state.message?.payload?.type === undefined && - ("No Payload")} + {this.state.message?.payload?.type === TRANSACTION_PAYLOAD_TYPE && "Transaction"} + {this.state.message?.payload?.type === MILESTONE_PAYLOAD_TYPE && "Milestone"} + {this.state.message?.payload?.type === INDEXATION_PAYLOAD_TYPE && "Index"} + {this.state.message?.payload?.type === undefined && "No Payload"}
{this.state.advancedMode && (
-
- Nonce -
+
Nonce
{this.state.message?.nonce}
)} - {this.state.message?.payload?.type === TRANSACTION_PAYLOAD_TYPE && - this.state.transferTotal !== undefined && ( -
-
- Value -
-
- {UnitsHelper.formatUnits(this.state.transferTotal, - UnitsHelper.calculateBest(this.state.transferTotal))} - {" "} - () -
+ {this.state.message?.payload?.type === TRANSACTION_PAYLOAD_TYPE && this.state.transferTotal !== undefined && ( +
+
Value
+
+ {UnitsHelper.formatUnits( + this.state.transferTotal, + UnitsHelper.calculateBest(this.state.transferTotal), + )}{" "} + ()
- )} +
+ )}
- {this.state.message?.payload && ( {this.state.message.payload.type === TRANSACTION_PAYLOAD_TYPE && this.state.inputs && this.state.outputs && - this.state.transferTotal !== undefined && - ( + this.state.transferTotal !== undefined && (
, MessageS payload={this.state.message.payload.essence.payload} advancedMode={this.state.advancedMode} /> -
)} +
+ )} {this.state.message.payload.type === MILESTONE_PAYLOAD_TYPE && (
@@ -282,44 +266,28 @@ class Message extends AsyncComponent, MessageS
- {!this.state.metadata && !this.state.metadataError && ( - - )} + {!this.state.metadata && !this.state.metadataError && } {this.state.metadataError && ( -

- Failed to retrieve metadata. {this.state.metadataError} -

+

Failed to retrieve metadata. {this.state.metadataError}

)} {this.state.metadata && !this.state.metadataError && (
-
- Is Solid -
+
Is Solid
- - {this.state.metadata?.isSolid ? "Yes" : "No"} - + {this.state.metadata?.isSolid ? "Yes" : "No"}
-
- Ledger Inclusion -
+
Ledger Inclusion
- +
{this.state.conflictReason && (
-
- Conflict Reason -
-
- {this.state.conflictReason} -
+
Conflict Reason
+
{this.state.conflictReason}
)}
@@ -331,9 +299,7 @@ class Message extends AsyncComponent, MessageS
-

- Messages tree -

+

Messages tree

@@ -349,7 +315,7 @@ class Message extends AsyncComponent, MessageS
-
+
); } @@ -357,17 +323,15 @@ class Message extends AsyncComponent, MessageS * Update the message details. */ private async updateMessageDetails(): Promise { - const details = await this._tangleCacheService.messageDetails( - this.props.match.params.network, this.state.actualMessageId ?? ""); + const details = await this._tangleCacheService.messageDetails(this.props.match.params.network, this.state.actualMessageId ?? ""); this.setState({ metadata: details?.metadata, metadataError: details?.error, conflictReason: this.calculateConflictReason(details?.metadata), - childrenIds: details?.childrenIds && details?.childrenIds.length > 0 - ? details?.childrenIds : (this.state.childrenIds ?? []), + childrenIds: details?.childrenIds && details?.childrenIds.length > 0 ? details?.childrenIds : this.state.childrenIds ?? [], messageTangleStatus: this.calculateStatus(details?.metadata), - childrenBusy: false + childrenBusy: false, }); if (!details?.metadata?.referencedByMilestoneIndex) { @@ -407,9 +371,10 @@ class Message extends AsyncComponent, MessageS let conflictReason: string = ""; if (metadata?.ledgerInclusionState === "conflicting") { - conflictReason = metadata.conflictReason && CONFLICT_REASON_STRINGS[metadata.conflictReason] - ? CONFLICT_REASON_STRINGS[metadata.conflictReason] - : "The reason for the conflict is unknown"; + conflictReason = + metadata.conflictReason && CONFLICT_REASON_STRINGS[metadata.conflictReason] + ? CONFLICT_REASON_STRINGS[metadata.conflictReason] + : "The reason for the conflict is unknown"; } return conflictReason; @@ -421,8 +386,7 @@ class Message extends AsyncComponent, MessageS * @param updateUrl Update the url. */ private async loadMessage(messageId: string, updateUrl: boolean): Promise { - const result = await this._tangleCacheService.search( - this.props.match.params.network, messageId); + const result = await this._tangleCacheService.search(this.props.match.params.network, messageId); if (result?.message) { const message = result.message; @@ -430,21 +394,20 @@ class Message extends AsyncComponent, MessageS window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); } - const { inputs, outputs, unlockAddresses, transferTotal } = - await TransactionsHelper.getInputsAndOutputs(message, - this.props.match.params.network, - this._bechHrp, - this._tangleCacheService); + const { inputs, outputs, unlockAddresses, transferTotal } = await TransactionsHelper.getInputsAndOutputs( + message, + this.props.match.params.network, + this._bechHrp, + this._tangleCacheService, + ); let transactionId; if (message.payload?.type === TRANSACTION_PAYLOAD_TYPE) { - transactionId = TransactionsHelper.computeTransactionIdFromTransactionPayload( - message.payload - ); + transactionId = TransactionsHelper.computeTransactionIdFromTransactionPayload(message.payload); } this.setState({ @@ -452,25 +415,29 @@ class Message extends AsyncComponent, MessageS outputs, unlockAddresses, transferTotal, - transactionId + transactionId, }); - this.setState({ - actualMessageId: result.includedMessageId ?? messageId, - message - }, async () => { - await this.updateMessageDetails(); - }); + this.setState( + { + actualMessageId: result.includedMessageId ?? messageId, + message, + }, + async () => { + await this.updateMessageDetails(); + }, + ); if (updateUrl) { - window.history.pushState(undefined, window.document.title, `/${this.props.match.params.network - }/message/${result.includedMessageId ?? messageId}`); + window.history.pushState( + undefined, + window.document.title, + `/${this.props.match.params.network}/message/${result.includedMessageId ?? messageId}`, + ); } } else { - this.props.history.replace(`/${this.props.match.params.network - }/search/${messageId}`); + this.props.history.replace(`/${this.props.match.params.network}/search/${messageId}`); } } } export default Message; - diff --git a/client/src/app/routes/chrysalis/Search.tsx b/client/src/app/routes/chrysalis/Search.tsx index 5096f35cc..1c80c7dc8 100644 --- a/client/src/app/routes/chrysalis/Search.tsx +++ b/client/src/app/routes/chrysalis/Search.tsx @@ -28,8 +28,7 @@ class Search extends AsyncComponent, Searc const networkService = ServiceFactory.get("network"); const protocolVersion: ProtocolVersion = - (props.match.params.network && - networkService.get(props.match.params.network)?.protocolVersion) || CHRYSALIS; + (props.match.params.network && networkService.get(props.match.params.network)?.protocolVersion) || CHRYSALIS; this._tangleCacheService = ServiceFactory.get(`tangle-cache-${CHRYSALIS}`); this.state = { @@ -38,7 +37,7 @@ class Search extends AsyncComponent, Searc status: "", completion: "", redirect: "", - invalidError: "" + invalidError: "", }; } @@ -69,100 +68,90 @@ class Search extends AsyncComponent, Searc public render(): ReactNode { return this.state.redirect ? ( - ) - : ( -
-
-
-

- Search -

- {!this.state.completion && this.state.status && ( -
-
-

Searching

-
-
- {this.state.statusBusy && ()} -

- {this.state.status} -

-
+ ) : ( +
+
+
+

Search

+ {!this.state.completion && this.state.status && ( +
+
+

Searching

- )} - {this.state.completion === "notFound" && ( -
-
-

Not found

-
-
-

- We could not find any messages, addresses, outputs, milestones - or indexes for the query. -

-
-
-
    -
  • - Query - {this.props.match.params.query} -
  • -
-
-
-

The following formats are supported:

-
+
+ {this.state.statusBusy && } +

{this.state.status}

+
+
+ )} + {this.state.completion === "notFound" && ( +
+
+

Not found

+
+
+

We could not find any messages, addresses, outputs, milestones or indexes for the query.

+
+
  • - Messages - 64 Hex characters -
  • -
  • - Message using Transaction Id - 64 Hex characters -
  • -
  • - Addresses - 64 Hex characters or Bech32 Format -
  • -
  • - Outputs - 68 Hex characters -
  • -
  • - Milestone Index - Numeric -
  • -
  • - Indexes - Maximum 64 UTF-8 chars or maximum 128 hex chars -
  • -
  • - DID - 64 Hex characters starting with did:iota: + Query + {this.props.match.params.query}
-
-

Please perform another search with a valid hash.

+
+

The following formats are supported:

+
+
    +
  • + Messages + 64 Hex characters +
  • +
  • + Message using Transaction Id + 64 Hex characters +
  • +
  • + Addresses + 64 Hex characters or Bech32 Format +
  • +
  • + Outputs + 68 Hex characters +
  • +
  • + Milestone Index + Numeric +
  • +
  • + Indexes + Maximum 64 UTF-8 chars or maximum 128 hex chars +
  • +
  • + DID + 64 Hex characters starting with did:iota: +
  • +
+
+

Please perform another search with a valid hash.

- )} - {this.state.completion === "invalid" && ( -
-
-

Incorrect query format

-
-
-

- {this.state.invalidError}. -

-
+
+ )} + {this.state.completion === "invalid" && ( +
+
+

Incorrect query format

+
+
+

{this.state.invalidError}.

- )} -
+
+ )}
-
- ); +
+
+ ); } /** @@ -181,47 +170,43 @@ class Search extends AsyncComponent, Searc status = "Detecting query type..."; statusBusy = true; if (this._isMounted) { - setTimeout( - async () => { - if (this._isMounted) { - const response = await this._tangleCacheService.search( - this.props.match.params.network, - query - ); + setTimeout(async () => { + if (this._isMounted) { + const response = await this._tangleCacheService.search(this.props.match.params.network, query); - if (response) { - let objType = ""; - let objParam = query; - if (response.message) { - objType = "message"; - } else if (response.address) { - objType = "addr"; - } else if (response.indexMessageIds) { - objType = "indexed"; - } else if (response.output) { - objType = "message"; - objParam = response.output.messageId; - } else if (response.milestone) { - objType = "message"; - objParam = response.milestone?.messageId; - } else if (response.did) { - objType = "identity-resolver"; - objParam = response.did; - } - this.setState({ - status: "", - statusBusy: false, - redirect: `/${this.props.match.params.network}/${objType}/${objParam}` - }); - } else { - this.setState({ - completion: "notFound", - status: "", - statusBusy: false - }); + if (response) { + let objType = ""; + let objParam = query; + if (response.message) { + objType = "message"; + } else if (response.address) { + objType = "addr"; + } else if (response.indexMessageIds) { + objType = "indexed"; + } else if (response.output) { + objType = "message"; + objParam = response.output.messageId; + } else if (response.milestone) { + objType = "message"; + objParam = response.milestone?.messageId; + } else if (response.did) { + objType = "identity-resolver"; + objParam = response.did; } + this.setState({ + status: "", + statusBusy: false, + redirect: `/${this.props.match.params.network}/${objType}/${objParam}`, + }); + } else { + this.setState({ + completion: "notFound", + status: "", + statusBusy: false, + }); } - }, 0); + } + }, 0); } } else { invalidError = "the query is empty"; @@ -233,7 +218,7 @@ class Search extends AsyncComponent, Searc status, completion, redirect, - invalidError + invalidError, }); } } diff --git a/client/src/app/routes/chrysalis/Visualizer.scss b/client/src/app/routes/chrysalis/Visualizer.scss index ce6cdf811..e685b31ee 100644 --- a/client/src/app/routes/chrysalis/Visualizer.scss +++ b/client/src/app/routes/chrysalis/Visualizer.scss @@ -5,157 +5,157 @@ @import "../../../scss/themes"; .visualizer-chrysalis { - margin: 30px 40px; - - .heading { - min-width: 230px; - } - - @include phone-down { - margin: 20px; - } - - .graph-border { - display: flex; - position: relative; - flex: 1; - align-items: stretch; - justify-content: stretch; - height: 70vh; - overflow: hidden; - border: 1px solid var(--input-border-color); - border-radius: 6px; - - .viva { - position: relative; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: var(--visualizer-bg); - } + margin: 30px 40px; - .selected-node { - @include font-size(12px); + .heading { + min-width: 230px; + } - position: absolute; - z-index: 1; - margin: 5px; - background-color: $white; - color: var(--link-highlight); - font-family: $metropolis; - word-break: break-all; + @include phone-down { + margin: 20px; } - .action-panel-container { - display: flex; - position: absolute; - z-index: 2; - top: 20px; - right: 20px; + .graph-border { + display: flex; + position: relative; + flex: 1; + align-items: stretch; + justify-content: stretch; + height: 70vh; + overflow: hidden; + border: 1px solid var(--input-border-color); + border-radius: 6px; + + .viva { + position: relative; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: var(--visualizer-bg); + } + + .selected-node { + @include font-size(12px); - .pause-button { - padding: 6px; - color: var(--header-icon-color); + position: absolute; + z-index: 1; + margin: 5px; + background-color: $white; + color: var(--link-highlight); + font-family: $metropolis; + word-break: break-all; + } - &:hover { - color: var(--link-highlight); + .action-panel-container { + display: flex; + position: absolute; + z-index: 2; + top: 20px; + right: 20px; + + .pause-button { + padding: 6px; + color: var(--header-icon-color); + + &:hover { + color: var(--link-highlight); + } + } } - } } - } - .filter { - flex: 1; + .filter { + flex: 1; - @include tablet-down { - display: none; - } + @include tablet-down { + display: none; + } - .card--content { - padding: 10px 30px; - } + .card--content { + padding: 10px 30px; + } - button { - white-space: nowrap; - } - } - - .sidepanel-border { - flex: 0 0 220px; - border: 1px solid var(--input-border-color); - border-radius: 6px; - background-color: transparent; - - @include tablet-down { - &.tablet-hidden, - &.phone-hidden { - display: none; - } + button { + white-space: nowrap; + } } - .hash { - width: 135px; + .sidepanel-border { + flex: 0 0 220px; + border: 1px solid var(--input-border-color); + border-radius: 6px; + background-color: transparent; + + @include tablet-down { + &.tablet-hidden, + &.phone-hidden { + display: none; + } + } + + .hash { + width: 135px; + } } - } - .key { - flex: 1; + .key { + flex: 1; - .card--content { - padding: 10px 20px; + .card--content { + padding: 10px 20px; - .card--label { - margin: 6px 20px 6px 0; - } + .card--label { + margin: 6px 20px 6px 0; + } + } } - } - .visualizer--key { - @include font-size(12px); + .visualizer--key { + @include font-size(12px); - margin-right: 10px; - font-family: $metropolis; + margin-right: 10px; + font-family: $metropolis; - &.visualizer--key__value { - margin: 6px 12px 6px 0; - padding: 6px; - border-radius: 6px; - color: $white; - text-align: center; + &.visualizer--key__value { + margin: 6px 12px 6px 0; + padding: 6px; + border-radius: 6px; + color: $white; + text-align: center; - &.pending { - background-color: #bbbbbb; - } + &.pending { + background-color: #bbbbbb; + } - &.referenced { - background-color: #61e884; - } + &.referenced { + background-color: #61e884; + } - &.included { - background-color: #4caaff; - } + &.included { + background-color: #4caaff; + } - &.conflicting { - background-color: #ff8b5c; - } + &.conflicting { + background-color: #ff8b5c; + } - &.confirmed-value { - background-color: #3f985a; - } + &.confirmed-value { + background-color: #3f985a; + } - &.confirmed-zero { - background-color: #0fc1b7; - } + &.confirmed-zero { + background-color: #0fc1b7; + } - &.milestone { - background-color: #666af6; - } + &.milestone { + background-color: #666af6; + } - &.search-result { - margin-right: 20px; - background-color: #e79c18; - } + &.search-result { + margin-right: 20px; + background-color: #e79c18; + } + } } - } } diff --git a/client/src/app/routes/chrysalis/Visualizer.tsx b/client/src/app/routes/chrysalis/Visualizer.tsx index aee89f372..e4cbef1e1 100644 --- a/client/src/app/routes/chrysalis/Visualizer.tsx +++ b/client/src/app/routes/chrysalis/Visualizer.tsx @@ -33,17 +33,17 @@ class Visualizer extends Feeds, Visual /** * Edge colour default. */ - private static readonly EDGE_COLOR_DARK: number = 0xFFFFFF33; + private static readonly EDGE_COLOR_DARK: number = 0xffffff33; /** * Edge color confirming. */ - private static readonly EDGE_COLOR_CONFIRMING: number = 0xFF5AAAFF; + private static readonly EDGE_COLOR_CONFIRMING: number = 0xff5aaaff; /** * Edge color confirmed by. */ - private static readonly EDGE_COLOR_CONFIRMED_BY: number = 0x0000FFFF; + private static readonly EDGE_COLOR_CONFIRMED_BY: number = 0x0000ffff; /** * Vertex pending zero colour. @@ -160,7 +160,7 @@ class Visualizer extends Feeds, Visual itemCount: 0, selectedFeedItem: undefined, filter: "", - isActive: true + isActive: true, }; } @@ -175,7 +175,7 @@ class Visualizer extends Feeds, Visual window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); } @@ -193,10 +193,8 @@ class Visualizer extends Feeds, Visual * @returns The node to render. */ public render(): ReactNode { - const { - itemCount, selectedFeedItem, filter, isActive, - itemsPerSecond, confirmedItemsPerSecond, confirmedItemsPerSecondPercent - } = this.state; + const { itemCount, selectedFeedItem, filter, isActive, itemsPerSecond, confirmedItemsPerSecond, confirmedItemsPerSecondPercent } = + this.state; if (this._darkMode !== this._settingsService.get().darkMode) { this._darkMode = this._settingsService.get().darkMode; this.styleConnections(); @@ -210,18 +208,19 @@ class Visualizer extends Feeds, Visual
-
- Search -
+
Search
this.setState( - { - filter: e.target.value - }, - () => this.restyleNodes())} + onChange={(e) => + this.setState( + { + filter: e.target.value, + }, + () => this.restyleNodes(), + ) + } maxLength={2000} />
@@ -233,24 +232,14 @@ class Visualizer extends Feeds, Visual

Statistics

-
- Messages -
-
- {itemCount} -
-
- MPS / CMPS -
+
Messages
+
{itemCount}
+
MPS / CMPS
{itemsPerSecond} / {confirmedItemsPerSecond}
-
- Referenced Rate -
-
- {confirmedItemsPerSecondPercent} -
+
Referenced Rate
+
{confirmedItemsPerSecondPercent}
{selectedFeedItem && ( <> @@ -259,74 +248,62 @@ class Visualizer extends Feeds, Visual
<> -
- Message -
+
Message
- {selectedFeedItem?.properties?.Tag && - selectedFeedItem.metaData?.milestone === undefined && ( - <> -
- Tag -
- - - )} - {selectedFeedItem?.properties?.Index && ( + {selectedFeedItem?.properties?.Tag && selectedFeedItem.metaData?.milestone === undefined && ( <> -
- Index UTF8 -
+
Tag
-
- Index Hex + + )} + {selectedFeedItem?.properties?.Index && ( + <> +
Index UTF8
+ +
Index Hex
{selectedFeedItem?.properties.Index as string} @@ -335,25 +312,16 @@ class Visualizer extends Feeds, Visual )} {selectedFeedItem.metaData?.milestone !== undefined && ( <> -
- Milestone -
-
- {selectedFeedItem.metaData.milestone} -
+
Milestone
+
{selectedFeedItem.metaData.milestone}
+ + )} + {selectedFeedItem?.value !== undefined && selectedFeedItem.metaData?.milestone === undefined && ( + <> +
Value
+
{UnitsHelper.formatBest(selectedFeedItem?.value)}
)} - {selectedFeedItem?.value !== undefined && - selectedFeedItem.metaData?.milestone === undefined && ( - <> -
- Value -
-
- {UnitsHelper.formatBest(selectedFeedItem?.value)} -
- - )}
@@ -367,18 +335,16 @@ class Visualizer extends Feeds, Visual this.selectNode(); } }} - ref={r => this.setupGraph(r)} + ref={(r) => this.setupGraph(r)} />
-
@@ -387,39 +353,19 @@ class Visualizer extends Feeds, Visual
-
- Key -
-
- Pending -
+
Key
+
Pending
<> -
- Referenced -
-
- Included -
-
- Conflicting -
+
Referenced
+
Included
+
Conflicting
-
- Milestone -
-
- Search Result -
+
Milestone
+
Search Result
-
+
); } @@ -438,7 +384,7 @@ class Visualizer extends Feeds, Visual if (!existingNode) { this._graph.addNode(item.id, { feedItem: item, - added: now + added: now, }); this._existingIds.push(item.id); @@ -482,7 +428,7 @@ class Visualizer extends Feeds, Visual if (node.data) { node.data.feedItem.metaData = { ...node.data.feedItem.metaData, - ...metaData[meta] + ...metaData[meta], }; } this.styleNode(node, this.testForHighlight(highlightRegEx, node.id, node.data)); @@ -510,31 +456,30 @@ class Visualizer extends Feeds, Visual gravity: -2, dragCoeff: 0.02, timeStep: 20, - theta: 0.8 + theta: 0.8, }); this._graphics.setNodeProgram(buildNodeShader()); - this._graphics.node(node => this.calculateNodeStyle( - node, this.testForHighlight(this.highlightNodesRegEx(), node.id, node.data))); + this._graphics.node((node) => + this.calculateNodeStyle(node, this.testForHighlight(this.highlightNodesRegEx(), node.id, node.data)), + ); - this._graphics.link(() => Viva.Graph.View.webglLine(this._darkMode - ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT)); + this._graphics.link(() => Viva.Graph.View.webglLine(this._darkMode ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT)); const events = Viva.Graph.webglInputEvents(this._graphics, this._graph); - events.click(node => this.selectNode(node)); - events.dblClick(node => { - window.open(`${window.location.origin}${RouteBuilder.buildItem( - this._networkConfig, node.id)}`, "_blank"); + events.click((node) => this.selectNode(node)); + events.dblClick((node) => { + window.open(`${window.location.origin}${RouteBuilder.buildItem(this._networkConfig, node.id)}`, "_blank"); }); - events.mouseEnter(node => { + events.mouseEnter((node) => { if (!this.state.selectedFeedItem) { this.highlightConnections(node.id); } }); - events.mouseLeave(_node => { + events.mouseLeave((_node) => { if (!this.state.selectedFeedItem) { this.styleConnections(); } @@ -544,7 +489,7 @@ class Visualizer extends Feeds, Visual container: graphElem, graphics: this._graphics, layout, - renderLinks: true + renderLinks: true, }); this._renderer.run(); @@ -598,7 +543,10 @@ class Visualizer extends Feeds, Visual * @param highlight Highlight the node. * @returns The size and color for the node. */ - private calculateNodeStyle(node: Viva.Graph.INode | undefined, highlight: boolean): { + private calculateNodeStyle( + node: Viva.Graph.INode | undefined, + highlight: boolean, + ): { color: string; size: number; } { @@ -633,7 +581,7 @@ class Visualizer extends Feeds, Visual return { color, - size + size, }; } @@ -671,9 +619,7 @@ class Visualizer extends Feeds, Visual private selectNode(node?: Viva.Graph.INode): void { const isDeselect = !node || this.state.selectedFeedItem?.id === node.id; this.setState({ - selectedFeedItem: isDeselect || !node - ? undefined - : node.data?.feedItem + selectedFeedItem: isDeselect || !node ? undefined : node.data?.feedItem, }); this.styleConnections(); @@ -717,9 +663,7 @@ class Visualizer extends Feeds, Visual this._graph.forEachLink((link: Viva.Graph.ILink) => { const linkUI = this._graphics?.getLinkUI(link.id); if (linkUI) { - linkUI.color = this._darkMode - ? Visualizer.EDGE_COLOR_DARK - : Visualizer.EDGE_COLOR_LIGHT; + linkUI.color = this._darkMode ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT; } }); } @@ -757,10 +701,7 @@ class Visualizer extends Feeds, Visual * @param data The data node to match. * @returns True if we should highlight the node. */ - private testForHighlight( - regEx: RegExp | undefined, - nodeId: string | undefined, - data: INodeData | undefined): boolean { + private testForHighlight(regEx: RegExp | undefined, nodeId: string | undefined, data: INodeData | undefined): boolean { if (!regEx || !nodeId || !data) { return false; } @@ -772,8 +713,7 @@ class Visualizer extends Feeds, Visual if (data.feedItem) { for (const key in data.feedItem.properties) { const val = data.feedItem.properties[key] as string; - if (regEx.test(val) || - (Converter.isHex(val) && regEx.test(Converter.hexToUtf8(val)))) { + if (regEx.test(val) || (Converter.isHex(val) && regEx.test(Converter.hexToUtf8(val)))) { return true; } } @@ -790,7 +730,7 @@ class Visualizer extends Feeds, Visual this._graphics.updateSize(); this._graphics.scale(1, { x: this._graphElement.clientWidth / 2, - y: this._graphElement.clientHeight / 2 + y: this._graphElement.clientHeight / 2, }); } } diff --git a/client/src/app/routes/legacy/Address.scss b/client/src/app/routes/legacy/Address.scss index 1516a1836..fd91e753e 100644 --- a/client/src/app/routes/legacy/Address.scss +++ b/client/src/app/routes/legacy/Address.scss @@ -4,131 +4,131 @@ @import "../../../scss/variables"; .address { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; - } - } - - h1 { - margin-bottom: 20px; - } - - p { - @include font-size(12px); - - color: $gray-10; - font-family: $metropolis; - font-weight: bold; - } - - .status { - @include font-size(14px); - } + flex-direction: column; - .cards { - flex: 1; - margin-right: 24px; + .wrapper { + display: flex; + justify-content: center; - @include desktop-down { - flex: unset; - width: 100%; - margin-right: 0; - } - - .value-buttons { - .col { + .inner { + display: flex; flex: 1; - width: auto; - } - } - - @include desktop-down { - .value-buttons { flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - .col { - flex: unset; - width: 100%; - } + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; - .col + .col { - margin-top: 23px; - margin-left: 0; + > .row { + flex-direction: column; + } } - } - } - - .arrow { - margin-top: 6px; - font-size: 30px; - } - .item-details + .item-details { - margin-top: 40px; - } + h1 { + margin-bottom: 20px; + } - .card + .card { - margin-top: 23px; - } + p { + @include font-size(12px); - .col + .col { - margin-left: 23px; + color: $gray-10; + font-family: $metropolis; + font-weight: bold; + } - @include tablet-down { - margin-left: 0; - } - } + .status { + @include font-size(14px); + } - .value { - @include font-size(18px); - - display: flex; - align-items: center; - padding: 8px 8px 6px 8px; - border-radius: 6px; - font-family: $metropolis-bold; - - &.value__positive { - background-color: #e7f4d9; - color: #5da06e; - } - - &.value__negative { - background-color: #ffe5d9; - color: #eb5446; - } - - &.value__zero { - background-color: var(--body-background); - color: #8493ad; - } - - &.value__inprogress { - border: 1px solid #c3d0e4; - background-color: var(--body-background); - color: #c3d0e4; - } + .cards { + flex: 1; + margin-right: 24px; + + @include desktop-down { + flex: unset; + width: 100%; + margin-right: 0; + } + + .value-buttons { + .col { + flex: 1; + width: auto; + } + } + + @include desktop-down { + .value-buttons { + flex-direction: column; + + .col { + flex: unset; + width: 100%; + } + + .col + .col { + margin-top: 23px; + margin-left: 0; + } + } + } + + .arrow { + margin-top: 6px; + font-size: 30px; + } + + .item-details + .item-details { + margin-top: 40px; + } + + .card + .card { + margin-top: 23px; + } + + .col + .col { + margin-left: 23px; + + @include tablet-down { + margin-left: 0; + } + } + + .value { + @include font-size(18px); + + display: flex; + align-items: center; + padding: 8px 8px 6px 8px; + border-radius: 6px; + font-family: $metropolis-bold; + + &.value__positive { + background-color: #e7f4d9; + color: #5da06e; + } + + &.value__negative { + background-color: #ffe5d9; + color: #eb5446; + } + + &.value__zero { + background-color: var(--body-background); + color: #8493ad; + } + + &.value__inprogress { + border: 1px solid #c3d0e4; + background-color: var(--body-background); + color: #c3d0e4; + } + } + } } - } } - } } diff --git a/client/src/app/routes/legacy/Address.tsx b/client/src/app/routes/legacy/Address.tsx index 9507f9cc2..60033cc00 100644 --- a/client/src/app/routes/legacy/Address.tsx +++ b/client/src/app/routes/legacy/Address.tsx @@ -46,8 +46,10 @@ class Address extends AsyncComponent, Add let address; let checksum; - if ((this.props.match.params.address.length === 81 || this.props.match.params.address.length === 90) && - TrytesHelper.isTrytes(this.props.match.params.address)) { + if ( + (this.props.match.params.address.length === 81 || this.props.match.params.address.length === 90) && + TrytesHelper.isTrytes(this.props.match.params.address) + ) { address = props.match.params.address.slice(0, 81); checksum = addChecksum(this.props.match.params.address.slice(0, 81)).slice(-9); } @@ -59,7 +61,7 @@ class Address extends AsyncComponent, Add address, checksum, showOnlyValueTransactions: false, - showOnlyConfirmedTransactions: false + showOnlyConfirmedTransactions: false, }; } @@ -76,7 +78,7 @@ class Address extends AsyncComponent, Add const balance = await this._tangleCacheService.getAddressBalance( this.props.match.params.network, - this.props.match.params.address + this.props.match.params.address, ); this.setState( @@ -84,14 +86,14 @@ class Address extends AsyncComponent, Add showOnlyValueTransactions: settings.showOnlyValueTransactions ?? false, showOnlyConfirmedTransactions: settings.showOnlyConfirmedTransactions ?? false, formatFull: settings.formatFull, - balance + balance, }, async () => { const { txHashes, cursor } = await this._tangleCacheService.findTransactionHashes( this.props.match.params.network, "address", this.props.match.params.address, - 250 + 250, ); let status = ""; @@ -100,12 +102,17 @@ class Address extends AsyncComponent, Add status = "There are no transactions for the requested address."; } - const items = txHashes ? txHashes.map(h => ({ - txHash: h - })) : undefined; + const items = txHashes + ? txHashes.map((h) => ({ + txHash: h, + })) + : undefined; const filteredItems = this.filterItems( - items, settings.showOnlyValueTransactions, settings.showOnlyConfirmedTransactions); + items, + settings.showOnlyValueTransactions, + settings.showOnlyConfirmedTransactions, + ); this.setState( { @@ -113,13 +120,11 @@ class Address extends AsyncComponent, Add filteredItems, status, statusBusy: status.length > 0 ? -1 : 1, - cursor + cursor, }, async () => { if (txHashes) { - const txs = await this._tangleCacheService.getTransactions( - this.props.match.params.network, - txHashes); + const txs = await this._tangleCacheService.getTransactions(this.props.match.params.network, txHashes); const bundleConfirmations: { [id: string]: string } = {}; @@ -134,17 +139,24 @@ class Address extends AsyncComponent, Add } } - const fullItems = txHashes.map((h, idx) => ({ - txHash: h, - details: txs[idx] - })).sort((itemA, itemB) => - (DateHelper.milliseconds(itemB.details.tx.timestamp === 0 - ? itemB.details.tx.attachmentTimestamp - : itemB.details.tx.timestamp)) - - (DateHelper.milliseconds(itemA.details.tx.timestamp === 0 - ? itemA.details.tx.attachmentTimestamp - : itemA.details.tx.timestamp)) - ); + const fullItems = txHashes + .map((h, idx) => ({ + txHash: h, + details: txs[idx], + })) + .sort( + (itemA, itemB) => + DateHelper.milliseconds( + itemB.details.tx.timestamp === 0 + ? itemB.details.tx.attachmentTimestamp + : itemB.details.tx.timestamp, + ) - + DateHelper.milliseconds( + itemA.details.tx.timestamp === 0 + ? itemA.details.tx.attachmentTimestamp + : itemA.details.tx.timestamp, + ), + ); this.setState({ items: fullItems, @@ -152,11 +164,14 @@ class Address extends AsyncComponent, Add filteredItems: this.filterItems( fullItems, this.state.showOnlyValueTransactions, - this.state.showOnlyConfirmedTransactions) + this.state.showOnlyConfirmedTransactions, + ), }); } - }); - }); + }, + ); + }, + ); } else { this.props.history.replace(`/${this.props.match.params.network}/search/${this.props.match.params.address}`); } @@ -179,15 +194,11 @@ class Address extends AsyncComponent, Add

General

-
- Address -
+
Address
{this.state.address} - - {this.state.checksum} - + {this.state.checksum}
@@ -206,34 +217,34 @@ class Address extends AsyncComponent, Add )} {this.state.balance !== undefined && this.state.balance === 0 && (
-
- Balance -
-
- 0 -
+
Balance
+
0
)} -
- Transaction Filter -
+
Transaction Filter
Show Value Transactions Only this.setState( - { - showOnlyValueTransactions: e.target.checked, - filteredItems: this.filterItems( - this.state.items, - e.target.checked, - this.state.showOnlyConfirmedTransactions) - }, - () => this._settingsService.saveSingle( - "showOnlyValueTransactions", - this.state.showOnlyValueTransactions))} + onChange={(e) => + this.setState( + { + showOnlyValueTransactions: e.target.checked, + filteredItems: this.filterItems( + this.state.items, + e.target.checked, + this.state.showOnlyConfirmedTransactions, + ), + }, + () => + this._settingsService.saveSingle( + "showOnlyValueTransactions", + this.state.showOnlyValueTransactions, + ), + ) + } />
@@ -242,17 +253,23 @@ class Address extends AsyncComponent, Add type="checkbox" checked={this.state.showOnlyConfirmedTransactions} className="margin-l-t" - onChange={e => this.setState( - { - showOnlyConfirmedTransactions: e.target.checked, - filteredItems: this.filterItems( - this.state.items, - this.state.showOnlyValueTransactions, - e.target.checked) - }, - () => this._settingsService.saveSingle( - "showOnlyConfirmedTransactions", - this.state.showOnlyConfirmedTransactions))} + onChange={(e) => + this.setState( + { + showOnlyConfirmedTransactions: e.target.checked, + filteredItems: this.filterItems( + this.state.items, + this.state.showOnlyValueTransactions, + e.target.checked, + ), + }, + () => + this._settingsService.saveSingle( + "showOnlyConfirmedTransactions", + this.state.showOnlyConfirmedTransactions, + ), + ) + } />
@@ -260,10 +277,8 @@ class Address extends AsyncComponent, Add {this.state.status && (
- {this.state.statusBusy === 0 && ()} -

- {this.state.status} -

+ {this.state.statusBusy === 0 && } +

{this.state.status}

)} @@ -272,16 +287,14 @@ class Address extends AsyncComponent, Add

Transactions

- {this.state.items !== undefined && - this.state.filteredItems !== undefined && ( - - {this.state.filteredItems.length}{ - this.state.cursor?.hasMore && ("+") - } - - )} + {this.state.items !== undefined && this.state.filteredItems !== undefined && ( + + {this.state.filteredItems.length} + {this.state.cursor?.hasMore && "+"} + + )}
- {this.state.statusBusy === 1 && ()} + {this.state.statusBusy === 1 && }
{this.state.items && @@ -292,74 +305,67 @@ class Address extends AsyncComponent, Add There are no transactions visible with the current filter.
)} - {this.state.filteredItems?.map(item => ( + {this.state.filteredItems?.map((item) => (
{item.details && ( -
+
- +
{DateHelper.format( DateHelper.milliseconds( item.details.tx.timestamp === 0 ? item.details.tx.attachmentTimestamp - : item.details.tx.timestamp) + : item.details.tx.timestamp, + ), )}
)}
- + {item.txHash}
@@ -367,21 +373,13 @@ class Address extends AsyncComponent, Add
- - chevron_right - + chevron_right {item.details.tx.bundle} @@ -396,7 +394,7 @@ class Address extends AsyncComponent, Add
-
+
); } @@ -420,35 +418,30 @@ class Address extends AsyncComponent, Add details?: ICachedTransaction; }[], showOnlyValueTransactions?: boolean, - showOnlyConfirmedTransactions?: boolean - ): { - /** - * The transaction hash. - */ - txHash: string; + showOnlyConfirmedTransactions?: boolean, + ): + | { + /** + * The transaction hash. + */ + txHash: string; - /** - * The details details. - */ - details?: ICachedTransaction; - }[] | undefined { + /** + * The details details. + */ + details?: ICachedTransaction; + }[] + | undefined { if (!items) { return; } - return items - .filter(i => + return items.filter( + (i) => !i.details || (i.details && - ( - (i.details.tx.value === 0 && !showOnlyValueTransactions) || - (i.details.tx.value !== 0) - ) && - ( - !showOnlyConfirmedTransactions || - (showOnlyConfirmedTransactions && i.details.confirmationState === "confirmed") - ) - ) - ); + ((i.details.tx.value === 0 && !showOnlyValueTransactions) || i.details.tx.value !== 0) && + (!showOnlyConfirmedTransactions || (showOnlyConfirmedTransactions && i.details.confirmationState === "confirmed"))), + ); } } diff --git a/client/src/app/routes/legacy/Bundle.scss b/client/src/app/routes/legacy/Bundle.scss index 010aee58a..3426140fb 100644 --- a/client/src/app/routes/legacy/Bundle.scss +++ b/client/src/app/routes/legacy/Bundle.scss @@ -4,81 +4,81 @@ @import "../../../scss/variables"; .bundle { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - h1 { - margin-bottom: 20px; - } - - p { - @include font-size(12px); - - color: $gray-10; - font-family: $metropolis; - font-weight: bold; - } - - .arrow { - margin-top: 6px; - font-size: 30px; - } + flex-direction: column; - .status { - @include font-size(14px); - } + .wrapper { + display: flex; + justify-content: center; - .cards { - flex: 1; - margin-right: 24px; - - .inputs-outputs { - margin-top: 5px; - margin-bottom: 30px; - - @include tablet-down { + .inner { + display: flex; + flex: 1; flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - .card + .card { - margin-top: 23px; - margin-left: 0; + h1 { + margin-bottom: 20px; } - } - .card--row { - margin-bottom: 32px; - } + p { + @include font-size(12px); - .card { - flex: 1; + color: $gray-10; + font-family: $metropolis; + font-weight: bold; + } - @include tablet-down { - flex: unset; - width: 100%; + .arrow { + margin-top: 6px; + font-size: 30px; } - } - .card + .card { - margin-left: 23px; + .status { + @include font-size(14px); + } - @include tablet-down { - margin-top: 23px; - margin-left: 0; + .cards { + flex: 1; + margin-right: 24px; + + .inputs-outputs { + margin-top: 5px; + margin-bottom: 30px; + + @include tablet-down { + flex-direction: column; + + .card + .card { + margin-top: 23px; + margin-left: 0; + } + } + + .card--row { + margin-bottom: 32px; + } + + .card { + flex: 1; + + @include tablet-down { + flex: unset; + width: 100%; + } + } + + .card + .card { + margin-left: 23px; + + @include tablet-down { + margin-top: 23px; + margin-left: 0; + } + } + } } - } } - } } - } } diff --git a/client/src/app/routes/legacy/Bundle.tsx b/client/src/app/routes/legacy/Bundle.tsx index d79ffd046..581854439 100644 --- a/client/src/app/routes/legacy/Bundle.tsx +++ b/client/src/app/routes/legacy/Bundle.tsx @@ -35,8 +35,7 @@ class Bundle extends Currency, BundleState this._tangleCacheService = ServiceFactory.get(`tangle-cache-${LEGACY}`); let bundle; - if (this.props.match.params.bundle.length === 81 && - TrytesHelper.isTrytes(this.props.match.params.bundle)) { + if (this.props.match.params.bundle.length === 81 && TrytesHelper.isTrytes(this.props.match.params.bundle)) { bundle = props.match.params.bundle; } @@ -46,7 +45,7 @@ class Bundle extends Currency, BundleState bundle, groups: [], currency: "USD", - formatFull: false + formatFull: false, }; } @@ -62,15 +61,12 @@ class Bundle extends Currency, BundleState const { txHashes } = await this._tangleCacheService.findTransactionHashes( this.props.match.params.network, "bundle", - this.props.match.params.bundle + this.props.match.params.bundle, ); - const bundleGroupsPlain = await this._tangleCacheService.getBundleGroups( - this.props.match.params.network, - txHashes - ); + const bundleGroupsPlain = await this._tangleCacheService.getBundleGroups(this.props.match.params.network, txHashes); - const confirmationStates = bundleGroupsPlain.map(bg => bg[0].confirmationState); + const confirmationStates = bundleGroupsPlain.map((bg) => bg[0].confirmationState); const confirmedIndex = confirmationStates.indexOf("confirmed"); @@ -115,7 +111,7 @@ class Bundle extends Currency, BundleState }[] = []; for (let i = 0; i < bundleGroupsPlain.length; i++) { - const isMissing = bundleGroupsPlain[i].some(t => t.isEmpty); + const isMissing = bundleGroupsPlain[i].some((t) => t.isEmpty); if (!isMissing) { let total = 0; @@ -135,34 +131,36 @@ class Bundle extends Currency, BundleState confirmationState = confirmationStates[i]; } - let inputAddresses = new Set(bundleGroupsPlain[i] - .filter(t => t.tx.value < 0).map(t => t.tx.address)); - const outputAddresses = new Set(bundleGroupsPlain[i] - .filter(t => t.tx.value > 0).map(t => t.tx.address)); + let inputAddresses = new Set(bundleGroupsPlain[i].filter((t) => t.tx.value < 0).map((t) => t.tx.address)); + const outputAddresses = new Set(bundleGroupsPlain[i].filter((t) => t.tx.value > 0).map((t) => t.tx.address)); if (inputAddresses.size === 0) { - inputAddresses = new Set(bundleGroupsPlain[i].map(t => t.tx.address)); + inputAddresses = new Set(bundleGroupsPlain[i].map((t) => t.tx.address)); } bundleGroups.push({ inputs: bundleGroupsPlain[i] - .filter(t => inputAddresses.has(t.tx.address) && t.tx.value <= 0) - .map(t => ({ + .filter((t) => inputAddresses.has(t.tx.address) && t.tx.value <= 0) + .map((t) => ({ details: t, valueCurrency: this._currencyData - ? this._currencyService.convertIota(t.tx.value, this._currencyData, true, 2) : "" + ? this._currencyService.convertIota(t.tx.value, this._currencyData, true, 2) + : "", })), outputs: bundleGroupsPlain[i] - .filter(t => outputAddresses.has(t.tx.address) && t.tx.value >= 0) - .map(t => ({ + .filter((t) => outputAddresses.has(t.tx.address) && t.tx.value >= 0) + .map((t) => ({ details: t, valueCurrency: this._currencyData - ? this._currencyService.convertIota(t.tx.value, this._currencyData, true, 2) : "" + ? this._currencyService.convertIota(t.tx.value, this._currencyData, true, 2) + : "", })), - timestamp: DateHelper.milliseconds(bundleGroupsPlain[i][0].tx.timestamp === 0 - ? bundleGroupsPlain[i][0].tx.attachmentTimestamp - : bundleGroupsPlain[i][0].tx.timestamp), - confirmationState + timestamp: DateHelper.milliseconds( + bundleGroupsPlain[i][0].tx.timestamp === 0 + ? bundleGroupsPlain[i][0].tx.attachmentTimestamp + : bundleGroupsPlain[i][0].tx.timestamp, + ), + confirmationState, }); } } @@ -171,7 +169,7 @@ class Bundle extends Currency, BundleState groups: bundleGroups, formatFull: this._settingsService.get().formatFull, statusBusy: false, - status: "" + status: "", }); } else { this.props.history.replace(`/${this.props.match.params.network}/search/${this.props.match.params.bundle}`); @@ -196,23 +194,18 @@ class Bundle extends Currency, BundleState

General

- this.setCurrency(e.target.value)}> + {supportedFiatCurrencies.map((cur) => ( + ))} - - expand_more - + expand_more
-
- Bundle -
+
Bundle
{this.state.bundle} @@ -222,10 +215,8 @@ class Bundle extends Currency, BundleState {this.state.status && (
- {this.state.statusBusy && ()} -

- {this.state.status} -

+ {this.state.statusBusy && } +

{this.state.status}

)} @@ -236,158 +227,137 @@ class Bundle extends Currency, BundleState
)} - {!this.state.statusBusy && this.state.groups?.map((group, idx) => ( - -
-

- {DateHelper.format(group.timestamp)} -

- -
-
-
-
-

Inputs

- {group.inputs.length} -
-
- {group.inputs.length === 0 && ( -

There are no inputs.

- )} - {group.inputs.map((item, idx2) => ( -
-
- - - {item.valueCurrency} - -
-
- - {item.details.tx.hash} - -
-
- - - chevron_left - - - - {item.details.tx.address} - -
-
- ))} -
+ {!this.state.statusBusy && + this.state.groups?.map((group, idx) => ( + +
+

{DateHelper.format(group.timestamp)}

+
-
-
-

Outputs

- {group.outputs.length} +
+
+
+

Inputs

+ {group.inputs.length} +
+
+ {group.inputs.length === 0 &&

There are no inputs.

} + {group.inputs.map((item, idx2) => ( +
+
+ + {item.valueCurrency} +
+
+ + {item.details.tx.hash} + +
+
+ + chevron_left + + + {item.details.tx.address} + +
+
+ ))} +
+
+
+

Outputs

+ {group.outputs.length} +
-
- {group.outputs.length === 0 && ( -

There are no outputs.

- )} - {group.outputs.map((item, idx2) => ( -
-
- - - {item.valueCurrency} - +
+ {group.outputs.length === 0 &&

There are no outputs.

} + {group.outputs.map((item, idx2) => ( +
+
+ + {item.valueCurrency} +
+
+ + {item.details.tx.hash} + +
+
+ + {item.details.tx.address} + + + chevron_right + +
-
- - {item.details.tx.hash} - -
-
- - {item.details.tx.address} - - - - chevron_right - - -
-
- ))} + ))} +
-
- - ))} + + ))}
-
+
); } @@ -400,17 +370,15 @@ class Bundle extends Currency, BundleState for (const group of groups) { for (const input of group.inputs) { - input.valueCurrency = this._currencyService.convertIota( - input.details.tx.value, this._currencyData, true, 2); + input.valueCurrency = this._currencyService.convertIota(input.details.tx.value, this._currencyData, true, 2); } for (const output of group.outputs) { - output.valueCurrency = this._currencyService.convertIota( - output.details.tx.value, this._currencyData, true, 2); + output.valueCurrency = this._currencyService.convertIota(output.details.tx.value, this._currencyData, true, 2); } } this.setState({ - groups + groups, }); } } diff --git a/client/src/app/routes/legacy/Landing.scss b/client/src/app/routes/legacy/Landing.scss index a4c98c32c..7aa27fc9a 100644 --- a/client/src/app/routes/legacy/Landing.scss +++ b/client/src/app/routes/legacy/Landing.scss @@ -587,7 +587,6 @@ transform: translate(-130px, -40px); } } - } .feeds-wrapper { @@ -598,4 +597,3 @@ } } } - diff --git a/client/src/app/routes/legacy/Landing.tsx b/client/src/app/routes/legacy/Landing.tsx index 468c78c02..785ea581d 100644 --- a/client/src/app/routes/legacy/Landing.tsx +++ b/client/src/app/routes/legacy/Landing.tsx @@ -34,7 +34,7 @@ class Landing extends Feeds, LandingState network: CUSTOM, protocolVersion: LEGACY, hasStatisticsSupport: false, - isEnabled: false + isEnabled: false, }; this.state = { @@ -57,7 +57,7 @@ class Landing extends Feeds, LandingState currency: "USD", formatFull: false, isFeedPaused: false, - isFilterExpanded: false + isFilterExpanded: false, }; } @@ -69,7 +69,6 @@ class Landing extends Feeds, LandingState const settings = this._settingsService.get(); - let filterSettings: IFilterSettings | undefined; if (this._networkConfig && settings.filters) { @@ -81,9 +80,8 @@ class Landing extends Feeds, LandingState valueMinimumUnits: filterSettings?.valueMinimumUnits ?? "i", valueMaximum: filterSettings?.valueMaximum ?? "3", valueMaximumUnits: filterSettings?.valueMaximumUnits ?? "Pi", - valuesFilter: filterSettings?.valuesFilter ?? - getFilterFieldDefaults(this._networkConfig?.protocolVersion ?? LEGACY), - formatFull: settings.formatFull + valuesFilter: filterSettings?.valuesFilter ?? getFilterFieldDefaults(this._networkConfig?.protocolVersion ?? LEGACY), + formatFull: settings.formatFull, }); } @@ -92,9 +90,8 @@ class Landing extends Feeds, LandingState * @returns The node to render. */ public render(): ReactNode { - const isLatestMilestoneFeedInfoEnabled = this._networkConfig && - this._networkConfig.network !== LEGACY_MAINNET && - this._networkConfig.network !== CUSTOM; + const isLatestMilestoneFeedInfoEnabled = + this._networkConfig && this._networkConfig.network !== LEGACY_MAINNET && this._networkConfig.network !== CUSTOM; return (
@@ -110,8 +107,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.isEnabled && (
- Transactions per sec - + Transactions per sec
{NumberHelper.roundTo(Number(this.state.itemsPerSecond), 1) || "--"} @@ -120,9 +116,7 @@ class Landing extends Feeds, LandingState
Inclusion rate - - {this.state.confirmedItemsPerSecondPercent} - + {this.state.confirmedItemsPerSecondPercent}
{this.state.networkConfig.showMarket && (
@@ -133,9 +127,7 @@ class Landing extends Feeds, LandingState {this.state.networkConfig.showMarket && (
Price / MI - - {this.state.priceCurrency} - + {this.state.priceCurrency}
)}
@@ -157,13 +149,15 @@ class Landing extends Feeds, LandingState onClick={() => { this.setState({ isFeedPaused: !this.state.isFeedPaused, - frozenMessages: this.state.filteredItems + frozenMessages: this.state.filteredItems, }); }} > - {this.state.isFeedPaused - ? play_arrow - : pause} + {this.state.isFeedPaused ? ( + play_arrow + ) : ( + pause + )}
- {this.state.valuesFilter.filter(f => f.isEnabled).length} + {this.state.valuesFilter.filter((f) => f.isEnabled).length}
{this.state.isFilterExpanded && ( @@ -198,35 +190,30 @@ class Landing extends Feeds, LandingState
- {this.state.valuesFilter.map(payload => ( + {this.state.valuesFilter.map((payload) => ( - ))}
@@ -234,9 +221,7 @@ class Landing extends Feeds, LandingState
{ - this.setState( - { isFilterExpanded: !this.state.isFilterExpanded } - ); + this.setState({ isFilterExpanded: !this.state.isFilterExpanded }); }} />
@@ -251,22 +236,14 @@ class Landing extends Feeds, LandingState )}
- - Transaction - - - Amount - + Transaction + Amount
- {this.state.filteredItems.length === 0 && ( -

There are no items with the current filter.

- )} - {this.state.filteredItems.map(item => ( + {this.state.filteredItems.length === 0 &&

There are no items with the current filter.

} + {this.state.filteredItems.map((item) => (
- - Transaction - + Transaction , LandingState
- - Amount - + Amount @@ -297,12 +276,10 @@ class Landing extends Feeds, LandingState
))}
-
-
-
-
- {this.state.networkConfig.description}
+
+
+
{this.state.networkConfig.description}
{this.state.networkConfig.faucet && (
Get tokens from the Faucet: @@ -317,22 +294,19 @@ class Landing extends Feeds, LandingState
)}
- { - !this.state.networkConfig.isEnabled && ( -
-
- {this.state.networkConfig.isEnabled === undefined - ? "This network is not recognised." - : "This network is currently disabled in explorer."} -
+ {!this.state.networkConfig.isEnabled && ( +
+
+ {this.state.networkConfig.isEnabled === undefined + ? "This network is not recognised." + : "This network is currently disabled in explorer."}
- ) - } -
- -
-
-
+
+ )} +
+
+
+
); } @@ -342,24 +316,19 @@ class Landing extends Feeds, LandingState protected updateCurrency(): void { if (this._currencyData) { this.setState({ - marketCapCurrency: - this._currencyData.coinStats?.iota?.marketCap ? - this._currencyService.convertFiatBase( - this._currencyData.coinStats.iota.marketCap, - this._currencyData, - true, - 2, - undefined, - true) - : "--", - priceCurrency: this._currencyData.coinStats?.iota?.price ? - this._currencyService.convertFiatBase( - this._currencyData.coinStats.iota.price, - this._currencyData, - true, - 3, - 8) - : "--" + marketCapCurrency: this._currencyData.coinStats?.iota?.marketCap + ? this._currencyService.convertFiatBase( + this._currencyData.coinStats.iota.marketCap, + this._currencyData, + true, + 2, + undefined, + true, + ) + : "--", + priceCurrency: this._currencyData.coinStats?.iota?.price + ? this._currencyService.convertFiatBase(this._currencyData.coinStats.iota.price, this._currencyData, true, 3, 8) + : "--", }); } } @@ -378,15 +347,13 @@ class Landing extends Feeds, LandingState */ private applyFilters(): void { if (this._isMounted && this._feedClient) { - const minLimit = UnitsHelper.convertUnits( - Number.parseFloat(this.state.valueMinimum), this.state.valueMinimumUnits, "i"); - const maxLimit = UnitsHelper.convertUnits( - Number.parseFloat(this.state.valueMaximum), this.state.valueMaximumUnits, "i"); + const minLimit = UnitsHelper.convertUnits(Number.parseFloat(this.state.valueMinimum), this.state.valueMinimumUnits, "i"); + const maxLimit = UnitsHelper.convertUnits(Number.parseFloat(this.state.valueMaximum), this.state.valueMaximumUnits, "i"); const filters = [ { payloadType: "Zero only", - filter: (item: IFeedItem) => item.value === 0 + filter: (item: IFeedItem) => item.value === 0, }, { payloadType: "Non-zero only", @@ -394,7 +361,7 @@ class Landing extends Feeds, LandingState item.value !== undefined && item.value !== 0 && Math.abs(item.value) >= minLimit && - Math.abs(item.value) <= maxLimit + Math.abs(item.value) <= maxLimit, }, { payloadType: "Transaction", @@ -402,26 +369,21 @@ class Landing extends Feeds, LandingState item.value !== undefined && item.value !== 0 && Math.abs(item.value) >= minLimit && - Math.abs(item.value) <= maxLimit + Math.abs(item.value) <= maxLimit, }, { payloadType: "Milestone", - filter: (item: IFeedItem) => - item.payloadType === "MS" - + filter: (item: IFeedItem) => item.payloadType === "MS", }, { payloadType: "Indexed", - filter: (item: IFeedItem) => - item.payloadType === "Index" + filter: (item: IFeedItem) => item.payloadType === "Index", }, { payloadType: "No payload", - filter: (item: IFeedItem) => - item.payloadType === "None" - - } - ].filter(f => { + filter: (item: IFeedItem) => item.payloadType === "None", + }, + ].filter((f) => { let aux = false; for (const payload of this.state.valuesFilter) { if (f.payloadType === payload.label && payload.isEnabled) { @@ -431,12 +393,10 @@ class Landing extends Feeds, LandingState return aux; }); - const filteredMessages = this.state.isFeedPaused - ? this.state.frozenMessages - : this._feedClient.getItems(); + const filteredMessages = this.state.isFeedPaused ? this.state.frozenMessages : this._feedClient.getItems(); this.setState({ filteredItems: filteredMessages - .filter(item => { + .filter((item) => { let aux = false; for (const f of filters) { const filter = f.filter; @@ -445,9 +405,8 @@ class Landing extends Feeds, LandingState } } return aux; - } - ) - .slice(0, 10) + }) + .slice(0, 10), }); } } @@ -465,7 +424,7 @@ class Landing extends Feeds, LandingState valueMinimum: this.state.valueMinimum, valueMinimumUnits: this.state.valueMinimumUnits, valueMaximum: this.state.valueMaximum, - valueMaximumUnits: this.state.valueMaximumUnits + valueMaximumUnits: this.state.valueMaximumUnits, }; this._settingsService.save(); @@ -479,7 +438,7 @@ class Landing extends Feeds, LandingState * @param payloadType The payload type to toggle. */ private toggleFilter(payloadType: string): void { - const valuesFilter = this.state.valuesFilter.map(payload => { + const valuesFilter = this.state.valuesFilter.map((payload) => { if (payload.label === payloadType) { payload.isEnabled = !payload.isEnabled; } @@ -492,16 +451,17 @@ class Landing extends Feeds, LandingState * Reset filters to default values */ private resetFilters(): void { - this.setState({ - valueMinimum: "0", - valueMinimumUnits: "i", - valueMaximum: "1", - valueMaximumUnits: "Ti", - valuesFilter: this.state.valuesFilter.map(filter => ({ ...filter, isEnabled: true })) - }, async () => this.updateFilters()); + this.setState( + { + valueMinimum: "0", + valueMinimumUnits: "i", + valueMaximum: "1", + valueMaximumUnits: "Ti", + valuesFilter: this.state.valuesFilter.map((filter) => ({ ...filter, isEnabled: true })), + }, + async () => this.updateFilters(), + ); } } - export default Landing; - diff --git a/client/src/app/routes/legacy/Search.tsx b/client/src/app/routes/legacy/Search.tsx index 822f202d9..23e954df3 100644 --- a/client/src/app/routes/legacy/Search.tsx +++ b/client/src/app/routes/legacy/Search.tsx @@ -46,7 +46,7 @@ class Search extends AsyncComponent, Searc status: "", completion: "", redirect: "", - invalidError: "" + invalidError: "", }; } @@ -77,94 +77,82 @@ class Search extends AsyncComponent, Searc public render(): ReactNode { return this.state.redirect ? ( - ) - : ( -
-
-
-

- Search -

- {!this.state.completion && this.state.status && ( -
-
-

Searching

-
-
- {this.state.statusBusy && ()} -

- {this.state.status} -

-
+ ) : ( +
+
+
+

Search

+ {!this.state.completion && this.state.status && ( +
+
+

Searching

- )} - {this.state.completion === "notFound" && ( -
-
-

Not found

-
-
-

- We could not find any transactions, bundles, addresses, milestones - or tags for the query. -

-
-
-
    -
  • - Query - {this.props.match.params.query} -
  • -
-
-
+
+ {this.state.statusBusy && } +

{this.state.status}

- )} - {this.state.completion === "invalid" && ( -
-
-

Incorrect query format

-
-
-

- The supplied hash does not appear to be valid, { - this.state.invalidError - }. -

-
-

The following formats are supported:

-
+
+ )} + {this.state.completion === "notFound" && ( +
+
+

Not found

+
+
+

We could not find any transactions, bundles, addresses, milestones or tags for the query.

+
+
  • - Tags - <= 27 Trytes -
  • -
  • - Transactions - 81 Trytes -
  • -
  • - Bundles - 81 Trytes -
  • -
  • - Addresses - 81 or 90 Trytes -
  • -
  • - Milestone Index - Numeric + Query + {this.props.match.params.query}
-
-

Please perform another search with a valid hash.

- )} -
+
+ )} + {this.state.completion === "invalid" && ( +
+
+

Incorrect query format

+
+
+

The supplied hash does not appear to be valid, {this.state.invalidError}.

+
+

The following formats are supported:

+
+
    +
  • + Tags + <= 27 Trytes +
  • +
  • + Transactions + 81 Trytes +
  • +
  • + Bundles + 81 Trytes +
  • +
  • + Addresses + 81 or 90 Trytes +
  • +
  • + Milestone Index + Numeric +
  • +
+
+

Please perform another search with a valid hash.

+
+
+ )}
-
- ); +
+
+ ); } /** @@ -185,29 +173,28 @@ class Search extends AsyncComponent, Searc status = "Searching milestone by index..."; statusBusy = true; if (this._isMounted) { - setTimeout( - async () => { - if (this._isMounted) { - const { milestoneHash } = await this._apiClient.milestoneGet({ - network: this.props.match.params.network, - milestoneIndex: index - }); + setTimeout(async () => { + if (this._isMounted) { + const { milestoneHash } = await this._apiClient.milestoneGet({ + network: this.props.match.params.network, + milestoneIndex: index, + }); - if (milestoneHash) { - this.setState({ - status: "", - statusBusy: false, - redirect: `/${this.props.match.params.network}/transaction/${milestoneHash}` - }); - } else { - this.setState({ - completion: "notFound", - status: "", - statusBusy: false - }); - } + if (milestoneHash) { + this.setState({ + status: "", + statusBusy: false, + redirect: `/${this.props.match.params.network}/transaction/${milestoneHash}`, + }); + } else { + this.setState({ + completion: "notFound", + status: "", + statusBusy: false, + }); } - }, 0); + } + }, 0); } } else if (TrytesHelper.isTrytes(query)) { if (query.length <= 27) { @@ -218,41 +205,40 @@ class Search extends AsyncComponent, Searc status = "Detecting hash type..."; statusBusy = true; if (this._isMounted) { - setTimeout( - async () => { - if (this._isMounted) { - const { hashType } = await this._tangleCacheService.findTransactionHashes( - this.props.match.params.network, - undefined, - query - ); + setTimeout(async () => { + if (this._isMounted) { + const { hashType } = await this._tangleCacheService.findTransactionHashes( + this.props.match.params.network, + undefined, + query, + ); - if (hashType) { - let ht = ""; + if (hashType) { + let ht = ""; - if (hashType === "address") { - ht = "address"; - } else if (hashType === "bundle") { - ht = "bundle"; - } else if (hashType === "tag") { - ht = "tag"; - } else if (hashType === "transaction") { - ht = "transaction"; - } - this.setState({ - status: "", - statusBusy: false, - redirect: `/${this.props.match.params.network}/${ht}/${query}` - }); - } else { - this.setState({ - completion: "notFound", - status: "", - statusBusy: false - }); + if (hashType === "address") { + ht = "address"; + } else if (hashType === "bundle") { + ht = "bundle"; + } else if (hashType === "tag") { + ht = "tag"; + } else if (hashType === "transaction") { + ht = "transaction"; } + this.setState({ + status: "", + statusBusy: false, + redirect: `/${this.props.match.params.network}/${ht}/${query}`, + }); + } else { + this.setState({ + completion: "notFound", + status: "", + statusBusy: false, + }); } - }, 0); + } + }, 0); } } else { invalidError = `the hash length ${query.length} is not valid`; @@ -272,7 +258,7 @@ class Search extends AsyncComponent, Searc status, completion, redirect, - invalidError + invalidError, }); } } diff --git a/client/src/app/routes/legacy/Tag.scss b/client/src/app/routes/legacy/Tag.scss index 7a5f1283e..3b7ff1cda 100644 --- a/client/src/app/routes/legacy/Tag.scss +++ b/client/src/app/routes/legacy/Tag.scss @@ -4,69 +4,69 @@ @import "../../../scss/variables"; .tag { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; + flex-direction: column; - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; + .wrapper { + display: flex; + justify-content: center; - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - > .row { - flex-direction: column; - } - } + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; - h1 { - margin-bottom: 20px; - } + > .row { + flex-direction: column; + } + } - p { - @include font-size(12px); + h1 { + margin-bottom: 20px; + } - color: $gray-10; - font-family: $metropolis; - font-weight: bold; - } + p { + @include font-size(12px); - .status { - @include font-size(14px); - } + color: $gray-10; + font-family: $metropolis; + font-weight: bold; + } - .cards { - flex: 1; - margin-right: 24px; + .status { + @include font-size(14px); + } - @include desktop-down { - flex: unset; - width: 100%; - margin-right: 0; - } + .cards { + flex: 1; + margin-right: 24px; - .arrow { - margin-top: 6px; - font-size: 30px; - } + @include desktop-down { + flex: unset; + width: 100%; + margin-right: 0; + } - .item-details + .item-details { - margin-top: 40px; - } + .arrow { + margin-top: 6px; + font-size: 30px; + } + + .item-details + .item-details { + margin-top: 40px; + } - .card + .card { - margin-top: 23px; + .card + .card { + margin-top: 23px; + } + } } - } } - } } diff --git a/client/src/app/routes/legacy/Tag.tsx b/client/src/app/routes/legacy/Tag.tsx index eb23f6e84..8cacdd2b3 100644 --- a/client/src/app/routes/legacy/Tag.tsx +++ b/client/src/app/routes/legacy/Tag.tsx @@ -43,8 +43,7 @@ class Tag extends AsyncComponent, TagState> { let tag; let tagFill; - if (this.props.match.params.tag.length <= 27 && - TrytesHelper.isTrytes(this.props.match.params.tag)) { + if (this.props.match.params.tag.length <= 27 && TrytesHelper.isTrytes(this.props.match.params.tag)) { tag = props.match.params.tag.replace(/9*$/, ""); tagFill = "9".repeat(27 - tag.length); @@ -61,7 +60,7 @@ class Tag extends AsyncComponent, TagState> { tagFill, formatFull: false, showOnlyValueTransactions: false, - showOnlyConfirmedTransactions: false + showOnlyConfirmedTransactions: false, }; } @@ -80,14 +79,14 @@ class Tag extends AsyncComponent, TagState> { { showOnlyValueTransactions: settings.showOnlyValueTransactions ?? false, showOnlyConfirmedTransactions: settings.showOnlyConfirmedTransactions ?? false, - formatFull: settings.formatFull + formatFull: settings.formatFull, }, async () => { const { txHashes, cursor } = await this._tangleCacheService.findTransactionHashes( this.props.match.params.network, "tag", this.props.match.params.tag, - 250 + 250, ); let status = ""; @@ -95,12 +94,17 @@ class Tag extends AsyncComponent, TagState> { status = "There are no transactions for the requested tag."; } - const items = txHashes ? txHashes.map(h => ({ - txHash: h - })) : undefined; + const items = txHashes + ? txHashes.map((h) => ({ + txHash: h, + })) + : undefined; const filteredItems = this.filterItems( - items, settings.showOnlyValueTransactions, settings.showOnlyConfirmedTransactions); + items, + settings.showOnlyValueTransactions, + settings.showOnlyConfirmedTransactions, + ); this.setState( { @@ -108,13 +112,11 @@ class Tag extends AsyncComponent, TagState> { filteredItems, status, statusBusy: status.length > 0 ? -1 : 1, - cursor + cursor, }, async () => { if (txHashes) { - const txs = await this._tangleCacheService.getTransactions( - this.props.match.params.network, - txHashes); + const txs = await this._tangleCacheService.getTransactions(this.props.match.params.network, txHashes); const bundleConfirmations: { [id: string]: string } = {}; @@ -129,17 +131,24 @@ class Tag extends AsyncComponent, TagState> { } } - const fullItems = txHashes.map((h, idx) => ({ - txHash: h, - details: txs[idx] - })).sort((itemA, itemB) => - (DateHelper.milliseconds(itemB.details.tx.timestamp === 0 - ? itemB.details.tx.attachmentTimestamp - : itemB.details.tx.timestamp)) - - (DateHelper.milliseconds(itemA.details.tx.timestamp === 0 - ? itemA.details.tx.attachmentTimestamp - : itemA.details.tx.timestamp)) - ); + const fullItems = txHashes + .map((h, idx) => ({ + txHash: h, + details: txs[idx], + })) + .sort( + (itemA, itemB) => + DateHelper.milliseconds( + itemB.details.tx.timestamp === 0 + ? itemB.details.tx.attachmentTimestamp + : itemB.details.tx.timestamp, + ) - + DateHelper.milliseconds( + itemA.details.tx.timestamp === 0 + ? itemA.details.tx.attachmentTimestamp + : itemA.details.tx.timestamp, + ), + ); this.setState({ items: fullItems, @@ -147,11 +156,14 @@ class Tag extends AsyncComponent, TagState> { filteredItems: this.filterItems( fullItems, this.state.showOnlyValueTransactions, - this.state.showOnlyConfirmedTransactions) + this.state.showOnlyConfirmedTransactions, + ), }); } - }); - }); + }, + ); + }, + ); } else { this.props.history.replace(`/${this.props.match.params.network}/search/${this.props.match.params.tag}`); } @@ -174,37 +186,37 @@ class Tag extends AsyncComponent, TagState> {

General

-
- Tag -
+
Tag
{this.state.tag} - - {this.state.tagFill} - + {this.state.tagFill}
-
- Transaction Filter -
+
Transaction Filter
Show Value Transactions Only this.setState( - { - showOnlyValueTransactions: e.target.checked, - filteredItems: this.filterItems( - this.state.items, - e.target.checked, - this.state.showOnlyConfirmedTransactions) - }, - () => this._settingsService.saveSingle( - "showOnlyValueTransactions", - this.state.showOnlyValueTransactions))} + onChange={(e) => + this.setState( + { + showOnlyValueTransactions: e.target.checked, + filteredItems: this.filterItems( + this.state.items, + e.target.checked, + this.state.showOnlyConfirmedTransactions, + ), + }, + () => + this._settingsService.saveSingle( + "showOnlyValueTransactions", + this.state.showOnlyValueTransactions, + ), + ) + } />
@@ -212,17 +224,23 @@ class Tag extends AsyncComponent, TagState> { this.setState( - { - showOnlyConfirmedTransactions: e.target.checked, - filteredItems: this.filterItems( - this.state.items, - this.state.showOnlyValueTransactions, - e.target.checked) - }, - () => this._settingsService.saveSingle( - "showOnlyConfirmedTransactions", - this.state.showOnlyConfirmedTransactions))} + onChange={(e) => + this.setState( + { + showOnlyConfirmedTransactions: e.target.checked, + filteredItems: this.filterItems( + this.state.items, + this.state.showOnlyValueTransactions, + e.target.checked, + ), + }, + () => + this._settingsService.saveSingle( + "showOnlyConfirmedTransactions", + this.state.showOnlyConfirmedTransactions, + ), + ) + } />
@@ -230,10 +248,8 @@ class Tag extends AsyncComponent, TagState> { {this.state.status && (
- {this.state.statusBusy === 0 && ()} -

- {this.state.status} -

+ {this.state.statusBusy === 0 && } +

{this.state.status}

)} @@ -242,16 +258,14 @@ class Tag extends AsyncComponent, TagState> {

Transactions

- {this.state.items !== undefined && - this.state.filteredItems !== undefined && ( - - {this.state.filteredItems.length}{ - this.state.cursor?.hasMore && ("+") - } - - )} + {this.state.items !== undefined && this.state.filteredItems !== undefined && ( + + {this.state.filteredItems.length} + {this.state.cursor?.hasMore && "+"} + + )}
- {this.state.statusBusy === 1 && ()} + {this.state.statusBusy === 1 && }
{this.state.items && @@ -262,74 +276,67 @@ class Tag extends AsyncComponent, TagState> { There are no transactions visible with the current filter.
)} - {this.state.filteredItems?.map(item => ( + {this.state.filteredItems?.map((item) => (
{item.details && ( -
+
- +
{DateHelper.format( DateHelper.milliseconds( item.details.tx.timestamp === 0 ? item.details.tx.attachmentTimestamp - : item.details.tx.timestamp) + : item.details.tx.timestamp, + ), )}
)}
- + {item.txHash}
@@ -337,21 +344,13 @@ class Tag extends AsyncComponent, TagState> {
- - chevron_right - + chevron_right {item.details.tx.bundle} @@ -390,35 +389,30 @@ class Tag extends AsyncComponent, TagState> { details?: ICachedTransaction; }[], showOnlyValueTransactions?: boolean, - showOnlyConfirmedTransactions?: boolean - ): { - /** - * The transaction hash. - */ - txHash: string; + showOnlyConfirmedTransactions?: boolean, + ): + | { + /** + * The transaction hash. + */ + txHash: string; - /** - * The details details. - */ - details?: ICachedTransaction; - }[] | undefined { + /** + * The details details. + */ + details?: ICachedTransaction; + }[] + | undefined { if (!items) { return; } - return items - .filter(i => + return items.filter( + (i) => !i.details || (i.details && - ( - (i.details.tx.value === 0 && !showOnlyValueTransactions) || - (i.details.tx.value !== 0) - ) && - ( - !showOnlyConfirmedTransactions || - (showOnlyConfirmedTransactions && i.details.confirmationState === "confirmed") - ) - ) - ); + ((i.details.tx.value === 0 && !showOnlyValueTransactions) || i.details.tx.value !== 0) && + (!showOnlyConfirmedTransactions || (showOnlyConfirmedTransactions && i.details.confirmationState === "confirmed"))), + ); } } diff --git a/client/src/app/routes/legacy/Transaction.scss b/client/src/app/routes/legacy/Transaction.scss index c82fe9ed7..53311c1c4 100644 --- a/client/src/app/routes/legacy/Transaction.scss +++ b/client/src/app/routes/legacy/Transaction.scss @@ -4,148 +4,148 @@ @import "../../../scss/variables"; .transaction { - display: flex; - flex-direction: column; - - .wrapper { display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; - } - } - - h1 { - margin-bottom: 20px; - } - - .h1-sub { - @include font-size(14px); - - margin-left: 23px; - color: $main-green; - font-family: $metropolis; - - @include tablet-down { - margin-top: 23px; - margin-left: 0; - } - } + flex-direction: column; - p { - @include font-size(12px); + .wrapper { + display: flex; + justify-content: center; - color: $gray-10; - font-family: $metropolis; - font-weight: bold; - } - - .btn-navigation { - height: 16px; - } - - .svg-navigation { - width: 16px; - height: 16px; - } - - .status { - @include font-size(14px); - } - - .cards { - flex: 1; - margin-right: 24px; + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - @include desktop-down { - flex: unset; - width: 100%; - margin-right: 0; - } + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; - @include tablet-down { - .card--header__space-between { - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - } - } + > .row { + flex-direction: column; + } + } - .card--content { - .arrow { - color: $main-green; - font-size: 30px; - line-height: 60%; - } - } + h1 { + margin-bottom: 20px; + } - .children-container { - max-height: 200px; - margin: 20px 30px 30px 10px; - padding: 0 0 0 20px; - overflow: auto; - } + .h1-sub { + @include font-size(14px); - .value-buttons { - .col { - flex: 1; - width: auto; - } + margin-left: 23px; + color: $main-green; + font-family: $metropolis; - .col + .col { - margin-left: 24px; - } - } + @include tablet-down { + margin-top: 23px; + margin-left: 0; + } + } - @include desktop-down { - .value-buttons { - flex-direction: column; + p { + @include font-size(12px); - .col { - flex: unset; - width: 100%; + color: $gray-10; + font-family: $metropolis; + font-weight: bold; } - .col + .col { - margin-top: 23px; - margin-left: 0; + .btn-navigation { + height: 16px; } - } - } - .card + .card { - margin-top: 23px; - } + .svg-navigation { + width: 16px; + height: 16px; + } - .row { - .col { - .card { - flex: 1; + .status { + @include font-size(14px); } - } - } - @include tablet-down { - .row--split { - .col + .col { - margin-top: 23px; + .cards { + flex: 1; + margin-right: 24px; + + @include desktop-down { + flex: unset; + width: 100%; + margin-right: 0; + } + + @include tablet-down { + .card--header__space-between { + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; + } + } + + .card--content { + .arrow { + color: $main-green; + font-size: 30px; + line-height: 60%; + } + } + + .children-container { + max-height: 200px; + margin: 20px 30px 30px 10px; + padding: 0 0 0 20px; + overflow: auto; + } + + .value-buttons { + .col { + flex: 1; + width: auto; + } + + .col + .col { + margin-left: 24px; + } + } + + @include desktop-down { + .value-buttons { + flex-direction: column; + + .col { + flex: unset; + width: 100%; + } + + .col + .col { + margin-top: 23px; + margin-left: 0; + } + } + } + + .card + .card { + margin-top: 23px; + } + + .row { + .col { + .card { + flex: 1; + } + } + } + + @include tablet-down { + .row--split { + .col + .col { + margin-top: 23px; + } + } + } } - } } - } } - } } diff --git a/client/src/app/routes/legacy/Transaction.tsx b/client/src/app/routes/legacy/Transaction.tsx index 86e6a1a06..4e20cff35 100644 --- a/client/src/app/routes/legacy/Transaction.tsx +++ b/client/src/app/routes/legacy/Transaction.tsx @@ -48,8 +48,7 @@ class Transaction extends AsyncComponent(`tangle-cache-${LEGACY}`); let hash; - if (this.props.match.params.txHash.length === 81 && - TrytesHelper.isTrytes(this.props.match.params.txHash)) { + if (this.props.match.params.txHash.length === 81 && TrytesHelper.isTrytes(this.props.match.params.txHash)) { hash = props.match.params.txHash; } @@ -58,7 +57,7 @@ class Transaction extends AsyncComponent
-

- Transaction -

+

Transaction

@@ -145,18 +143,12 @@ class Transaction extends AsyncComponent {this.state.details && (
- {DateHelper.format( - DateHelper.milliseconds( - this.state.details.tx.timestamp - ) - )} + {DateHelper.format(DateHelper.milliseconds(this.state.details.tx.timestamp))}
)}
-
- Hash -
+
Hash
{this.state.hash} @@ -170,9 +162,7 @@ class Transaction extends AsyncComponent
@@ -180,27 +170,18 @@ class Transaction extends AsyncComponent -
- Value -
-
- 0 -
+
Value
+
0
)} -
- Address -
+
Address
{this.state.address} - - {this.state.checksum} - + {this.state.checksum}
@@ -211,10 +192,8 @@ class Transaction extends AsyncComponent
- {this.state.statusBusy && ()} -

- {this.state.status} -

+ {this.state.statusBusy && } +

{this.state.status}

)} @@ -230,16 +209,14 @@ class Transaction extends AsyncComponent {this.state.isBundleValidMessage} @@ -247,15 +224,10 @@ class Transaction extends AsyncComponent
-
- Bundle Hash -
+
Bundle Hash
{this.state.details?.tx.bundle} @@ -263,23 +235,15 @@ class Transaction extends AsyncComponent
-
- Index -
+
Index
- - chevron_left - + chevron_left {this.state.details.tx.currentIndex + 1} @@ -287,18 +251,12 @@ class Transaction extends AsyncComponent - - chevron_right - + chevron_right
@@ -310,15 +268,10 @@ class Transaction extends AsyncComponent
-
- Tag -
+
Tag
{this.state.details.tx.tag} @@ -327,15 +280,10 @@ class Transaction extends AsyncComponent
-
- Obsolete Tag -
+
Obsolete Tag
{this.state.details.tx.obsoleteTag} @@ -346,15 +294,10 @@ class Transaction extends AsyncComponent {this.state.streamsV0Root && (
-
- Streams v0 Decoder Root -
+
Streams v0 Decoder Root
{this.state.streamsV0Root} @@ -369,43 +312,47 @@ class Transaction extends AsyncComponent this.setState( - { - showRawMessageTrytes: - !this.state.showRawMessageTrytes - })} + onClick={() => + this.setState({ + showRawMessageTrytes: !this.state.showRawMessageTrytes, + }) + } > - Message {this.state.showRawMessageTrytes - ? "Trytes" : this.state.messageType} + Message{" "} + {this.state.showRawMessageTrytes + ? "Trytes" + : this.state.messageType} )} - {this.state.messageType === "Trytes" && ( - `Message ${this.state.messageType}` - )} + {this.state.messageType === "Trytes" && `Message ${this.state.messageType}`} -
- {this.state.showRawMessageTrytes - ? this.state.rawMessageTrytes - : (this.state.messageType === "JSON" - ? - : this.state.message)} + {this.state.showRawMessageTrytes ? ( + this.state.rawMessageTrytes + ) : this.state.messageType === "JSON" ? ( + + ) : ( + this.state.message + )}
{this.state.messageSpan && (
@@ -423,32 +370,20 @@ class Transaction extends AsyncComponentParents
-
- Trunk -
+
Trunk
{this.state.details.tx.trunkTransaction}
-
- Branch -
+
Branch
{this.state.details.tx.branchTransaction} @@ -462,40 +397,24 @@ class Transaction extends AsyncComponentPoW
-
- Weight Magnitude -
-
- {this.state.mwm} -
-
- Nonce -
-
- {this.state.details.tx.nonce} -
-
- Attachment Lower Bound -
+
Weight Magnitude
+
{this.state.mwm}
+
Nonce
+
{this.state.details.tx.nonce}
+
Attachment Lower Bound
{this.state.details.tx.attachmentTimestampLowerBound}
-
- Attachment Upper Bound -
+
Attachment Upper Bound
{this.state.details.tx.attachmentTimestampUpperBound}
{this.state.details.tx.attachmentTimestamp !== 0 && ( -
- Attachment Timestamp -
+
Attachment Timestamp
{DateHelper.format( - DateHelper.milliseconds( - this.state.details.tx.attachmentTimestamp - ) + DateHelper.milliseconds(this.state.details.tx.attachmentTimestamp), )}
@@ -510,18 +429,14 @@ class Transaction extends AsyncComponent
- - Trytes - - {this.state.details && ( - - )} + Trytes + {this.state.details && }
{this.state.raw} @@ -534,36 +449,22 @@ class Transaction extends AsyncComponent

Children

{this.state.children !== undefined && ( - - {this.state.children.length} - + {this.state.children.length} )}
- {this.state.childrenBusy && ()} - {this.state.children?.map(child => ( + {this.state.childrenBusy && } + {this.state.children?.map((child) => (
- - {child} - + {child}
))} - {!this.state.childrenBusy && - this.state.children && - this.state.children.length === 0 && ( -

There are no children for this message.

- )} - + {!this.state.childrenBusy && this.state.children && this.state.children.length === 0 && ( +

There are no children for this message.

+ )}
- - )}
@@ -589,7 +490,7 @@ class Transaction extends AsyncComponent { if (this.state.details) { - const thisGroup = - await this._tangleCacheService.getTransactionBundleGroup( - this.props.match.params.network, - this.state.details); + const thisGroup = await this._tangleCacheService.getTransactionBundleGroup( + this.props.match.params.network, + this.state.details, + ); if (thisGroup.length > 0) { - const thisIndex = thisGroup.findIndex(t => t.tx.hash === this.state.details?.tx.hash); + const thisIndex = thisGroup.findIndex((t) => t.tx.hash === this.state.details?.tx.hash); // Some really old bundle formats dont pass the isBundle test, so if they are already // confirmed use that knowledge instead. - const isBundleValid = this.state.details.confirmationState === "confirmed" - ? true - : isBundle(thisGroup.map(t => t.tx)); + const isBundleValid = + this.state.details.confirmationState === "confirmed" ? true : isBundle(thisGroup.map((t) => t.tx)); let total = 0; for (const g of thisGroup) { total += g.tx.value; @@ -636,7 +535,7 @@ class Transaction extends AsyncComponent t.tx.signatureMessageFragment).join(""); + let combinedMessages = thisGroup.map((t) => t.tx.signatureMessageFragment).join(""); try { const parsedStreamsV0 = parseMessage(combinedMessages, details.tx.address); @@ -644,13 +543,14 @@ class Transaction extends AsyncComponent this.checkConfirmation(), 10000); } - const isBundleValidState = isConsistent - ? (isBundleValid ? "valid" : "invalid") - : "consistency"; + const isBundleValidState = isConsistent ? (isBundleValid ? "valid" : "invalid") : "consistency"; let isBundleValidMessage = "Valid"; if (isBundleValidState !== "valid") { - isBundleValidMessage = this.state.isBundleValid === "consistency" - ? "Invalid consistency - transaction will never confirm" - : "Invalid - transaction will never confirm"; + isBundleValidMessage = + this.state.isBundleValid === "consistency" + ? "Invalid consistency - transaction will never confirm" + : "Invalid - transaction will never confirm"; } - this.setState({ - nextTransaction: - this.state.details.tx.currentIndex < this.state.details.tx.lastIndex - ? this.state.details.tx.trunkTransaction : undefined, - previousTransaction: - thisIndex > 0 ? thisGroup[thisIndex - 1].tx.hash : undefined, - isBundleValid: isBundleValidState, - isBundleValidMessage, - milestoneIndex: this.getMilestoneIndex(thisGroup), - message, - messageType, - messageSpan, - rawMessageTrytes, - streamsV0Root - }, async () => { - const children = await this._tangleCacheService.getTransactionChildren( - this.props.match.params.network, this.props.match.params.txHash); - - this.setState({ - children, - childrenBusy: false - }); - }); + this.setState( + { + nextTransaction: + this.state.details.tx.currentIndex < this.state.details.tx.lastIndex + ? this.state.details.tx.trunkTransaction + : undefined, + previousTransaction: thisIndex > 0 ? thisGroup[thisIndex - 1].tx.hash : undefined, + isBundleValid: isBundleValidState, + isBundleValidMessage, + milestoneIndex: this.getMilestoneIndex(thisGroup), + message, + messageType, + messageSpan, + rawMessageTrytes, + streamsV0Root, + }, + async () => { + const children = await this._tangleCacheService.getTransactionChildren( + this.props.match.params.network, + this.props.match.params.txHash, + ); + + this.setState({ + children, + childrenBusy: false, + }); + }, + ); } else { this.setState({ isBundleValid: "warning", - isBundleValidMessage: "Unknown - transactions from the bundle are unavailable" + isBundleValidMessage: "Unknown - transactions from the bundle are unavailable", }); } } - }); + }, + ); } } @@ -719,9 +624,12 @@ class Transaction extends AsyncComponent= 2) { const networkService = ServiceFactory.get("network"); const networkConfig = networkService.get(this.props.match.params.network); - if (networkConfig && thisGroup[0].tx.address === networkConfig.coordinatorAddress && + if ( + networkConfig && + thisGroup[0].tx.address === networkConfig.coordinatorAddress && networkConfig.coordinatorSecurityLevel !== undefined && - thisGroup.length === networkConfig.coordinatorSecurityLevel + 1) { + thisGroup.length === networkConfig.coordinatorSecurityLevel + 1 + ) { const mi = value(trytesToTrits(thisGroup[0].tx.tag)); if (!Number.isNaN(mi)) { milestoneIndex = mi; @@ -737,7 +645,10 @@ class Transaction extends AsyncComponent { const transactions = await this._tangleCacheService.getTransactions( - this.props.match.params.network, [this.props.match.params.txHash], true); + this.props.match.params.network, + [this.props.match.params.txHash], + true, + ); if (transactions && transactions.length > 0 && transactions[0].confirmationState === "confirmed") { if (this._timerId) { @@ -747,8 +658,8 @@ class Transaction extends AsyncComponent, Visual /** * Edge colour default. */ - private static readonly EDGE_COLOR_DARK: number = 0xFFFFFF33; + private static readonly EDGE_COLOR_DARK: number = 0xffffff33; /** * Edge color confirming. */ - private static readonly EDGE_COLOR_CONFIRMING: number = 0xFF5AAAFF; + private static readonly EDGE_COLOR_CONFIRMING: number = 0xff5aaaff; /** * Edge color confirmed by. */ - private static readonly EDGE_COLOR_CONFIRMED_BY: number = 0x0000FFFF; + private static readonly EDGE_COLOR_CONFIRMED_BY: number = 0x0000ffff; /** * Vertex pending zero colour. @@ -160,7 +160,7 @@ class Visualizer extends Feeds, Visual itemCount: 0, selectedFeedItem: undefined, filter: "", - isActive: true + isActive: true, }; } @@ -175,7 +175,7 @@ class Visualizer extends Feeds, Visual window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); } @@ -193,10 +193,8 @@ class Visualizer extends Feeds, Visual * @returns The node to render. */ public render(): ReactNode { - const { - itemCount, selectedFeedItem, filter, isActive, - itemsPerSecond, confirmedItemsPerSecond, confirmedItemsPerSecondPercent - } = this.state; + const { itemCount, selectedFeedItem, filter, isActive, itemsPerSecond, confirmedItemsPerSecond, confirmedItemsPerSecondPercent } = + this.state; if (this._darkMode !== this._settingsService.get().darkMode) { this._darkMode = this._settingsService.get().darkMode; this.styleConnections(); @@ -210,18 +208,19 @@ class Visualizer extends Feeds, Visual
-
- Search -
+
Search
this.setState( - { - filter: e.target.value.toUpperCase() - }, - () => this.restyleNodes())} + onChange={(e) => + this.setState( + { + filter: e.target.value.toUpperCase(), + }, + () => this.restyleNodes(), + ) + } maxLength={90} />
@@ -233,24 +232,14 @@ class Visualizer extends Feeds, Visual

Statistics

-
- Transactions -
-
- {itemCount} -
-
- TPS / CTPS -
+
Transactions
+
{itemCount}
+
TPS / CTPS
{itemsPerSecond} / {confirmedItemsPerSecond}
-
- Confirmation Rate -
-
- {confirmedItemsPerSecondPercent} -
+
Confirmation Rate
+
{confirmedItemsPerSecondPercent}
{selectedFeedItem && ( <> @@ -259,38 +248,31 @@ class Visualizer extends Feeds, Visual
<> -
- Transaction -
+
Transaction
{selectedFeedItem?.properties?.Address && ( <> -
- Address -
+
Address
{selectedFeedItem?.properties.Address as string} @@ -299,67 +281,51 @@ class Visualizer extends Feeds, Visual )} {selectedFeedItem?.properties?.Bundle && ( <> -
- Bundle -
+
Bundle
)} - {selectedFeedItem?.properties?.Tag && - selectedFeedItem.metaData?.milestone === undefined && ( - <> -
- Tag -
- - - )} - {selectedFeedItem.metaData?.milestone !== undefined && ( + {selectedFeedItem?.properties?.Tag && selectedFeedItem.metaData?.milestone === undefined && ( <> -
- Milestone -
-
- {selectedFeedItem.metaData.milestone} +
Tag
+ )} - {selectedFeedItem?.value !== undefined && - selectedFeedItem.metaData?.milestone === undefined && ( - <> -
- Value -
-
- {UnitsHelper.formatBest(selectedFeedItem?.value)} -
- - )} + {selectedFeedItem.metaData?.milestone !== undefined && ( + <> +
Milestone
+
{selectedFeedItem.metaData.milestone}
+ + )} + {selectedFeedItem?.value !== undefined && selectedFeedItem.metaData?.milestone === undefined && ( + <> +
Value
+
{UnitsHelper.formatBest(selectedFeedItem?.value)}
+ + )}
@@ -373,18 +339,16 @@ class Visualizer extends Feeds, Visual this.selectNode(); } }} - ref={r => this.setupGraph(r)} + ref={(r) => this.setupGraph(r)} />
-
@@ -393,34 +357,18 @@ class Visualizer extends Feeds, Visual
-
- Key -
-
- Pending -
+
Key
+
Pending
<> -
- Value Confirmed -
-
- Zero Confirmed -
+
Value Confirmed
+
Zero Confirmed
-
- Milestone -
-
- Search Result -
+
Milestone
+
Search Result
-
+
); } @@ -439,7 +387,7 @@ class Visualizer extends Feeds, Visual if (!existingNode) { this._graph.addNode(item.id, { feedItem: item, - added: now + added: now, }); this._existingIds.push(item.id); @@ -483,7 +431,7 @@ class Visualizer extends Feeds, Visual if (node.data) { node.data.feedItem.metaData = { ...node.data.feedItem.metaData, - ...metaData[meta] + ...metaData[meta], }; } this.styleNode(node, this.testForHighlight(highlightRegEx, node.id, node.data)); @@ -511,31 +459,30 @@ class Visualizer extends Feeds, Visual gravity: -2, dragCoeff: 0.02, timeStep: 20, - theta: 0.8 + theta: 0.8, }); this._graphics.setNodeProgram(buildNodeShader()); - this._graphics.node(node => this.calculateNodeStyle( - node, this.testForHighlight(this.highlightNodesRegEx(), node.id, node.data))); + this._graphics.node((node) => + this.calculateNodeStyle(node, this.testForHighlight(this.highlightNodesRegEx(), node.id, node.data)), + ); - this._graphics.link(() => Viva.Graph.View.webglLine(this._darkMode - ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT)); + this._graphics.link(() => Viva.Graph.View.webglLine(this._darkMode ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT)); const events = Viva.Graph.webglInputEvents(this._graphics, this._graph); - events.click(node => this.selectNode(node)); - events.dblClick(node => { - window.open(`${window.location.origin}${RouteBuilder.buildItem( - this._networkConfig, node.id)}`, "_blank"); + events.click((node) => this.selectNode(node)); + events.dblClick((node) => { + window.open(`${window.location.origin}${RouteBuilder.buildItem(this._networkConfig, node.id)}`, "_blank"); }); - events.mouseEnter(node => { + events.mouseEnter((node) => { if (!this.state.selectedFeedItem) { this.highlightConnections(node.id); } }); - events.mouseLeave(_node => { + events.mouseLeave((_node) => { if (!this.state.selectedFeedItem) { this.styleConnections(); } @@ -545,7 +492,7 @@ class Visualizer extends Feeds, Visual container: graphElem, graphics: this._graphics, layout, - renderLinks: true + renderLinks: true, }); this._renderer.run(); @@ -599,7 +546,10 @@ class Visualizer extends Feeds, Visual * @param highlight Highlight the node. * @returns The size and color for the node. */ - private calculateNodeStyle(node: Viva.Graph.INode | undefined, highlight: boolean): { + private calculateNodeStyle( + node: Viva.Graph.INode | undefined, + highlight: boolean, + ): { color: string; size: number; } { @@ -634,7 +584,7 @@ class Visualizer extends Feeds, Visual return { color, - size + size, }; } @@ -672,9 +622,7 @@ class Visualizer extends Feeds, Visual private selectNode(node?: Viva.Graph.INode): void { const isDeselect = !node || this.state.selectedFeedItem?.id === node.id; this.setState({ - selectedFeedItem: isDeselect || !node - ? undefined - : node.data?.feedItem + selectedFeedItem: isDeselect || !node ? undefined : node.data?.feedItem, }); this.styleConnections(); @@ -718,9 +666,7 @@ class Visualizer extends Feeds, Visual this._graph.forEachLink((link: Viva.Graph.ILink) => { const linkUI = this._graphics?.getLinkUI(link.id); if (linkUI) { - linkUI.color = this._darkMode - ? Visualizer.EDGE_COLOR_DARK - : Visualizer.EDGE_COLOR_LIGHT; + linkUI.color = this._darkMode ? Visualizer.EDGE_COLOR_DARK : Visualizer.EDGE_COLOR_LIGHT; } }); } @@ -758,10 +704,7 @@ class Visualizer extends Feeds, Visual * @param data The data node to match. * @returns True if we should highlight the node. */ - private testForHighlight( - regEx: RegExp | undefined, - nodeId: string | undefined, - data: INodeData | undefined): boolean { + private testForHighlight(regEx: RegExp | undefined, nodeId: string | undefined, data: INodeData | undefined): boolean { if (!regEx || !nodeId || !data) { return false; } @@ -773,8 +716,7 @@ class Visualizer extends Feeds, Visual if (data.feedItem) { for (const key in data.feedItem.properties) { const val = data.feedItem.properties[key] as string; - if (regEx.test(val) || - (Converter.isHex(val) && regEx.test(Converter.hexToUtf8(val)))) { + if (regEx.test(val) || (Converter.isHex(val) && regEx.test(Converter.hexToUtf8(val)))) { return true; } } @@ -791,7 +733,7 @@ class Visualizer extends Feeds, Visual this._graphics.updateSize(); this._graphics.scale(1, { x: this._graphElement.clientWidth / 2, - y: this._graphElement.clientHeight / 2 + y: this._graphElement.clientHeight / 2, }); } } diff --git a/client/src/app/routes/stardust/AddressPage.scss b/client/src/app/routes/stardust/AddressPage.scss index b2eceafe7..1dfa7b72a 100644 --- a/client/src/app/routes/stardust/AddressPage.scss +++ b/client/src/app/routes/stardust/AddressPage.scss @@ -4,280 +4,280 @@ @import "../../../scss/variables"; .address-page { - display: flex; - flex-direction: column; - - .addr--header { display: flex; - align-items: center; - - .addr--header__switch { - display: flex; - align-items: center; - - & > span { - @include font-size(12px, 18px); - - margin-right: 16px; - color: $gray-6; - font-family: $inter; - font-weight: 500; - } - - .switch { - display: inline-block; - position: relative; - width: 32px; - height: 20px; - } - - .switch input { - width: 0; - height: 0; - opacity: 0; - } - - .slider { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - transition: 0.4s; - background-color: $gray-4; - cursor: pointer; - } - - .slider::before { - content: ""; - position: absolute; - bottom: 2.5px; - left: 2.5px; - width: 15px; - height: 15px; - transition: 0.4s; - background-color: white; - } - - input:checked + .slider { - background-color: $green-6; - } - - input:focus + .slider { - box-shadow: 0 0 1px $green-6; - } - - input:checked + .slider::before { - transform: translateX(12px); - } - - .slider.round { - border-radius: 16px; - } - - .slider.round::before { - border-radius: 50%; - } - } - } + flex-direction: column; - .wrapper { - display: flex; - justify-content: center; - - .inner { - display: flex; - flex: 1; - flex-direction: column; - max-width: $desktop-width; - margin: 40px 20px; - - @include desktop-down { - max-width: 100%; - padding-right: 20px; - padding-left: 20px; - - > .row { - flex-direction: column; - } - } + .addr--header { + display: flex; + align-items: center; - .cards { - flex: 1; - margin-right: 24px; + .addr--header__switch { + display: flex; + align-items: center; - @include desktop-down { - flex: unset; - width: 100%; - margin-right: 0; - } + & > span { + @include font-size(12px, 18px); - .value-buttons { - .col { - flex: 1; - width: auto; - } - } + margin-right: 16px; + color: $gray-6; + font-family: $inter; + font-weight: 500; + } - @include desktop-down { - .value-buttons { - flex-direction: column; + .switch { + display: inline-block; + position: relative; + width: 32px; + height: 20px; + } - .col { - flex: unset; - width: 100%; + .switch input { + width: 0; + height: 0; + opacity: 0; } - .col + .col { - margin-top: 23px; - margin-left: 0; + .slider { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + transition: 0.4s; + background-color: $gray-4; + cursor: pointer; } - } - } - .col + .col { - margin-left: 23px; + .slider::before { + content: ""; + position: absolute; + bottom: 2.5px; + left: 2.5px; + width: 15px; + height: 15px; + transition: 0.4s; + background-color: white; + } - @include tablet-down { - margin-left: 0; - } - } - } + input:checked + .slider { + background-color: $green-6; + } - .card + .card { - margin-top: 23px; - } - } - } + input:focus + .slider { + box-shadow: 0 0 1px $green-6; + } - .asset-summary { - display: flex; - flex-direction: row; - justify-content: space-between; - margin-top: 24px; + input:checked + .slider::before { + transform: translateX(12px); + } + + .slider.round { + border-radius: 16px; + } - .section--assets { - background: var(--card-body); - border-radius: 6px; - width: 469px; - height: 85px; + .slider.round::before { + border-radius: 50%; + } + } + } - .inner--asset { + .wrapper { display: flex; - flex-direction: row; - justify-content: space-between; - margin: 30px; + justify-content: center; - .assets { - display: flex; - flex-direction: column; - } - } + .inner { + display: flex; + flex: 1; + flex-direction: column; + max-width: $desktop-width; + margin: 40px 20px; - .svg-navigation { - width: 16px; - height: 16px; - margin-top: 6px; - } + @include desktop-down { + max-width: 100%; + padding-right: 20px; + padding-left: 20px; - @include tablet-down { - width: 100%; - } - } + > .row { + flex-direction: column; + } + } - .section--NFT { - background: var(--card-body); - border-radius: 6px; - width: 469px; - height: 85px; - margin-left: 20px; + .cards { + flex: 1; + margin-right: 24px; + + @include desktop-down { + flex: unset; + width: 100%; + margin-right: 0; + } + + .value-buttons { + .col { + flex: 1; + width: auto; + } + } + + @include desktop-down { + .value-buttons { + flex-direction: column; + + .col { + flex: unset; + width: 100%; + } + + .col + .col { + margin-top: 23px; + margin-left: 0; + } + } + } + + .col + .col { + margin-left: 23px; + + @include tablet-down { + margin-left: 0; + } + } + } - .inner--asset { + .card + .card { + margin-top: 23px; + } + } + } + + .asset-summary { display: flex; flex-direction: row; justify-content: space-between; - margin: 30px; + margin-top: 24px; + + .section--assets { + background: var(--card-body); + border-radius: 6px; + width: 469px; + height: 85px; + + .inner--asset { + display: flex; + flex-direction: row; + justify-content: space-between; + margin: 30px; + + .assets { + display: flex; + flex-direction: column; + } + } - .assets { - display: flex; - flex-direction: column; + .svg-navigation { + width: 16px; + height: 16px; + margin-top: 6px; + } + + @include tablet-down { + width: 100%; + } } - } - - .svg-navigation { - width: 16px; - height: 16px; - margin-top: 6px; - } - - @include tablet-down { - margin-top: 20px; - width: 100%; - margin-left: 0px; - } - } - @include tablet-down { - flex-direction: column; + .section--NFT { + background: var(--card-body); + border-radius: 6px; + width: 469px; + height: 85px; + margin-left: 20px; + + .inner--asset { + display: flex; + flex-direction: row; + justify-content: space-between; + margin: 30px; + + .assets { + display: flex; + flex-direction: column; + } + } + + .svg-navigation { + width: 16px; + height: 16px; + margin-top: 6px; + } + + @include tablet-down { + margin-top: 20px; + width: 100%; + margin-left: 0px; + } + } + + @include tablet-down { + flex-direction: column; + } } - } - - .no-border { - border-bottom: none; - } - - .transaction--section { - @include tablet-down { - .section--header { - flex-direction: column; - align-items: flex-start; - } + + .no-border { + border-bottom: none; } - } - .general-content { - padding-bottom: 26px; + .transaction--section { + @include tablet-down { + .section--header { + flex-direction: column; + align-items: flex-start; + } + } + } - @include phone-down { - flex-direction: column; - } - } + .general-content { + padding-bottom: 26px; - .qr-content { - @include tablet-down { - align-self: flex-end; + @include phone-down { + flex-direction: column; + } } - @include phone-down { - align-self: center; - } - } - - .feature-block { - .card--label { - @include font-size(12px); - - display: flex; - align-items: center; - height: 32px; - color: var(--card-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - white-space: nowrap; + .qr-content { + @include tablet-down { + align-self: flex-end; + } + + @include phone-down { + align-self: center; + } } - .card--value { - @include font-size(14px, 20px); - margin-bottom: 12px; - color: var(--body-color); - font-family: $ibm-plex-mono; - word-break: break-all; - - a, - button { - color: var(--link-color); - } + .feature-block { + .card--label { + @include font-size(12px); + + display: flex; + align-items: center; + height: 32px; + color: var(--card-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + white-space: nowrap; + } + + .card--value { + @include font-size(14px, 20px); + margin-bottom: 12px; + color: var(--body-color); + font-family: $ibm-plex-mono; + word-break: break-all; + + a, + button { + color: var(--link-color); + } + } } - } } diff --git a/client/src/app/routes/stardust/AddressPage.tsx b/client/src/app/routes/stardust/AddressPage.tsx index cbf7ab6e4..fee122518 100644 --- a/client/src/app/routes/stardust/AddressPage.tsx +++ b/client/src/app/routes/stardust/AddressPage.tsx @@ -14,14 +14,23 @@ import { AddressPageTabbedSections } from "../../components/stardust/address/sec import { AddressRouteProps } from "../AddressRouteProps"; import "./AddressPage.scss"; -const AddressPage: React.FC> = ( - { match: { params: { network, address } } } -) => { +const AddressPage: React.FC> = ({ + match: { + params: { network, address }, + }, +}) => { const [state, setState] = useAddressPageState(); const { - bech32AddressDetails, balance, sigLockedBalance, storageRentBalance, - isBasicOutputsLoading, isAliasOutputsLoading, isNftOutputsLoading, - isNftDetailsLoading, isAddressHistoryLoading, isAssociatedOutputsLoading + bech32AddressDetails, + balance, + sigLockedBalance, + storageRentBalance, + isBasicOutputsLoading, + isAliasOutputsLoading, + isNftOutputsLoading, + isNftDetailsLoading, + isAddressHistoryLoading, + isAssociatedOutputsLoading, } = state; if (!bech32AddressDetails) { @@ -35,10 +44,7 @@ const AddressPage: React.FC> = (
- +
@@ -46,10 +52,7 @@ const AddressPage: React.FC> = ( } const isAddressOutputsLoading = isBasicOutputsLoading || isAliasOutputsLoading || isNftOutputsLoading; - const isPageLoading = isAddressOutputsLoading || - isNftDetailsLoading || - isAddressHistoryLoading || - isAssociatedOutputsLoading; + const isPageLoading = isAddressOutputsLoading || isNftDetailsLoading || isAddressHistoryLoading || isAssociatedOutputsLoading; const addressType = bech32AddressDetails.type; @@ -67,9 +70,7 @@ const AddressPage: React.FC> = (
-

- {bech32AddressDetails.typeLabel?.replace("Ed25519", "Address")} -

+

{bech32AddressDetails.typeLabel?.replace("Ed25519", "Address")}

{isPageLoading && } @@ -77,17 +78,12 @@ const AddressPage: React.FC> = (
-

- General -

+

General

- + {balance !== null && ( > = ( key={address} network={network} addressPageState={state} - setTransactionHistoryLoading={isLoading => setState({ isAddressHistoryLoading: isLoading })} - setTransactionHistoryDisabled={val => setState({ isAddressHistoryDisabled: val })} - setTokenCount={count => setState({ tokensCount: count })} - setNftCount={count => setState({ nftCount: count })} - setAssociatedOutputsLoading={val => setState({ isAssociatedOutputsLoading: val })} - setAssociatedOutputsCount={count => setState({ associatedOutputCount: count })} + setTransactionHistoryLoading={(isLoading) => setState({ isAddressHistoryLoading: isLoading })} + setTransactionHistoryDisabled={(val) => setState({ isAddressHistoryDisabled: val })} + setTokenCount={(count) => setState({ tokensCount: count })} + setNftCount={(count) => setState({ nftCount: count })} + setAssociatedOutputsLoading={(val) => setState({ isAssociatedOutputsLoading: val })} + setAssociatedOutputsCount={(count) => setState({ associatedOutputCount: count })} />
)} @@ -117,4 +113,3 @@ const AddressPage: React.FC> = ( }; export default AddressPage; - diff --git a/client/src/app/routes/stardust/AddressState.ts b/client/src/app/routes/stardust/AddressState.ts index 1de6ce7a8..bc26829d8 100644 --- a/client/src/app/routes/stardust/AddressState.ts +++ b/client/src/app/routes/stardust/AddressState.ts @@ -1,7 +1,14 @@ import { Bech32Helper } from "@iota/iota.js"; import { - HexEncodedString, AliasOutput, MetadataFeature, OutputResponse, - OutputType, AddressType, Output, BasicOutput, FeatureType + HexEncodedString, + AliasOutput, + MetadataFeature, + OutputResponse, + OutputType, + AddressType, + Output, + BasicOutput, + FeatureType, } from "@iota/sdk-wasm/web"; import { Reducer, useContext, useEffect, useReducer } from "react"; import { useLocation, useParams } from "react-router-dom"; @@ -104,7 +111,8 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch>>( - (currentState, newState) => ({ ...currentState, ...newState }), initialState + (currentState, newState) => ({ ...currentState, ...newState }), + initialState, ); const addressBech32: string | null = state.bech32AddressDetails?.bech32 ?? null; @@ -113,18 +121,13 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch { const locationState = location.state as IAddressPageLocationProps; - const { addressDetails } = locationState?.addressDetails ? locationState : - { addressDetails: Bech32AddressHelper.buildAddress(bech32Hrp, addressFromPath) }; + const { addressDetails } = locationState?.addressDetails + ? locationState + : { addressDetails: Bech32AddressHelper.buildAddress(bech32Hrp, addressFromPath) }; const isBech32 = Bech32Helper.matches(addressFromPath, bech32Hrp); @@ -141,7 +145,7 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch { setState({ - addressBasicOutputs, isBasicOutputsLoading, addressAliasOutputs, isAliasOutputsLoading, - addressNftOutputs, isNftOutputsLoading, nftMetadata, nftIssuerId: issuerId, isNftDetailsLoading, - aliasOutput, isAliasDetailsLoading, aliasFoundries, isAliasFoundriesLoading, - balance, sigLockedBalance, eventDetails, aliasContainsDID, resolvedDID, isDIDLoading + addressBasicOutputs, + isBasicOutputsLoading, + addressAliasOutputs, + isAliasOutputsLoading, + addressNftOutputs, + isNftOutputsLoading, + nftMetadata, + nftIssuerId: issuerId, + isNftDetailsLoading, + aliasOutput, + isAliasDetailsLoading, + aliasFoundries, + isAliasFoundriesLoading, + balance, + sigLockedBalance, + eventDetails, + aliasContainsDID, + resolvedDID, + isDIDLoading, }); }, [ - addressBasicOutputs, isBasicOutputsLoading, addressAliasOutputs, isAliasOutputsLoading, - addressNftOutputs, isNftOutputsLoading, nftMetadata, issuerId, isNftDetailsLoading, - aliasOutput, isAliasDetailsLoading, aliasFoundries, isAliasFoundriesLoading, - balance, sigLockedBalance, eventDetails, aliasContainsDID, resolvedDID, isDIDLoading + addressBasicOutputs, + isBasicOutputsLoading, + addressAliasOutputs, + isAliasOutputsLoading, + addressNftOutputs, + isNftOutputsLoading, + nftMetadata, + issuerId, + isNftDetailsLoading, + aliasOutput, + isAliasDetailsLoading, + aliasFoundries, + isAliasFoundriesLoading, + balance, + sigLockedBalance, + eventDetails, + aliasContainsDID, + resolvedDID, + isDIDLoading, ]); useEffect(() => { if (addressBasicOutputs && addressAliasOutputs && addressNftOutputs) { const mergedOutputResponses = [...addressBasicOutputs, ...addressAliasOutputs, ...addressNftOutputs]; - const outputs = mergedOutputResponses.map(or => or.output); - const storageRentBalanceUpdate = TransactionsHelper.computeStorageRentBalance( - outputs, - rentStructure - ); + const outputs = mergedOutputResponses.map((or) => or.output); + const storageRentBalanceUpdate = TransactionsHelper.computeStorageRentBalance(outputs, rentStructure); setState({ addressOutputs: mergedOutputResponses, - storageRentBalance: storageRentBalanceUpdate + storageRentBalance: storageRentBalanceUpdate, }); } if (addressBasicOutputs && !state.participations) { let foundParticipations: IParticipation[] = []; for (const outputResponse of addressBasicOutputs) { - if (outputResponse.output.type === OutputType.Basic && + if ( + outputResponse.output.type === OutputType.Basic && TransactionsHelper.isParticipationEventOutput(outputResponse.output) ) { const metadataFeature = (outputResponse.output as BasicOutput).features?.find( - feature => feature.type === FeatureType.Metadata + (feature) => feature.type === FeatureType.Metadata, ) as MetadataFeature; if (metadataFeature) { @@ -195,7 +227,7 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch 0) { setState({ - participations: foundParticipations + participations: foundParticipations, }); } } @@ -203,4 +235,3 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch .row { - flex-direction: column; - } - } + @include desktop-down { + flex: unset; + width: 100%; + max-width: 100%; + margin: 40px 24px; + padding-right: 24px; + padding-left: 24px; - @include tablet-down { - margin: 28px 0; - } + > .row { + flex-direction: column; + } + } - @include phone-down { - padding: 0 8px; - } + @include tablet-down { + margin: 28px 0; + } - .block--header { - display: flex; - justify-content: space-between; + @include phone-down { + padding: 0 8px; + } - @include tablet-down { - flex-direction: column; - justify-content: flex-start; - } + .block--header { + display: flex; + justify-content: space-between; + + @include tablet-down { + flex-direction: column; + justify-content: flex-start; + } - .header--wrapper { - h1 { - @include phone-down { - font-size: 1.45rem; + .header--wrapper { + h1 { + @include phone-down { + font-size: 1.45rem; + } + } } } - } - } - .section .section--header .messages--number { - @include font-size(12px); + .section .section--header .messages--number { + @include font-size(12px); - display: flex; - align-items: center; - height: 24px; - margin-left: 20px; - padding: 0 8px; - border-radius: 6px; - background-color: var(--light-bg); - color: $gray; - font-family: $metropolis; - font-weight: bold; - white-space: nowrap; - } + display: flex; + align-items: center; + height: 24px; + margin-left: 20px; + padding: 0 8px; + border-radius: 6px; + background-color: var(--light-bg); + color: $gray; + font-family: $metropolis; + font-weight: bold; + white-space: nowrap; + } - .link { - @include font-size(14px); + .link { + @include font-size(14px); - color: var(--link-color); - font-family: $ibm-plex-mono; - font-weight: normal; - letter-spacing: 0.02em; - line-height: 20px; - } - } + color: var(--link-color); + font-family: $ibm-plex-mono; + font-weight: normal; + letter-spacing: 0.02em; + line-height: 20px; + } + } - .section--data { - .amount-transacted { - @include font-size(15px); - font-weight: 700; + .section--data { + .amount-transacted { + @include font-size(15px); + font-weight: 700; + } } } - } } diff --git a/client/src/app/routes/stardust/Block.tsx b/client/src/app/routes/stardust/Block.tsx index 0899ad0a8..acdcbdef9 100644 --- a/client/src/app/routes/stardust/Block.tsx +++ b/client/src/app/routes/stardust/Block.tsx @@ -1,6 +1,4 @@ -import { - MilestonePayload, PayloadType, TransactionPayload, Utils -} from "@iota/sdk-wasm/web"; +import { MilestonePayload, PayloadType, TransactionPayload, Utils } from "@iota/sdk-wasm/web"; import React, { useContext, useEffect, useState } from "react"; import { RouteComponentProps } from "react-router-dom"; import { BlockProps } from "./BlockProps"; @@ -32,9 +30,12 @@ import TruncatedId from "../../components/stardust/TruncatedId"; import NetworkContext from "../../context/NetworkContext"; import "./Block.scss"; -const Block: React.FC> = ( - { history, match: { params: { network, blockId } } } -) => { +const Block: React.FC> = ({ + history, + match: { + params: { network, blockId }, + }, +}) => { const { tokenInfo, protocolVersion } = useContext(NetworkContext); const [isFormattedBalance, setIsFormattedBalance] = useState(true); const [transactionId, setTransactionId] = useState(); @@ -43,15 +44,11 @@ const Block: React.FC> = ( const [blockChildren] = useBlockChildren(network, blockId); const [blockMetadata, isBlockMetadataLoading] = useBlockMetadata(network, blockId); const [inputs, unlocks, outputs, transferTotal, isInputsAndOutputsLoading] = useInputsAndOutputs(network, block); - const [milestoneReferencedBlocks, isMilestoneReferencedBlockLoading] = useMilestoneReferencedBlocks( - network, milestoneId - ); + const [milestoneReferencedBlocks, isMilestoneReferencedBlockLoading] = useMilestoneReferencedBlocks(network, milestoneId); useEffect(() => { if (block?.payload?.type === PayloadType.Transaction) { - const tsxId = Utils.transactionId( - block.payload as TransactionPayload - ); + const tsxId = Utils.transactionId(block.payload as TransactionPayload); setTransactionId(tsxId); } if (block?.payload?.type === PayloadType.Milestone) { @@ -66,10 +63,7 @@ const Block: React.FC> = ( const isMilestoneBlock = block?.payload?.type === PayloadType.Milestone; const isTransactionBlock = block?.payload?.type === PayloadType.Transaction; const isLinksDisabled = metadata?.ledgerInclusionState === "conflicting"; - const isLoading = isBlockLoading || - isInputsAndOutputsLoading || - isBlockMetadataLoading || - isMilestoneReferencedBlockLoading; + const isLoading = isBlockLoading || isInputsAndOutputsLoading || isBlockMetadataLoading || isMilestoneReferencedBlockLoading; const milestoneIndex = isMilestoneBlock ? (block?.payload as MilestonePayload).index : undefined; let pageTitle = "Block"; switch (block?.payload?.type) { @@ -97,16 +91,11 @@ const Block: React.FC> = (
-

- {pageTitle} -

+

{pageTitle}

- +
@@ -128,7 +117,7 @@ const Block: React.FC> = ( transferTotal={transferTotal ?? undefined} history={history} isLinksDisabled={isLinksDisabled} - /> + />, ); tabbedSections.push( > = ( blockChildren={blockChildren} conflictReason={conflictReason} isLinksDisabled={isLinksDisabled} - /> + />, ); } if (isMilestoneBlock) { - tabbedSections.push( - - ); + tabbedSections.push(); } const blockContent = block ? ( @@ -156,18 +143,14 @@ const Block: React.FC> = (
-
- Block ID -
+
Block ID
{milestoneId && (
-
- Milestone ID -
+
Milestone ID
@@ -175,9 +158,7 @@ const Block: React.FC> = ( )} {transactionId && (
-
- Transaction Id -
+
Transaction Id
> = (
)}
-
- Payload Type -
-
- {NameHelper.getPayloadType(block)} -
+
Payload Type
+
{NameHelper.getPayloadType(block)}
{!isMilestoneBlock && (
-
- Nonce -
+
Nonce
{block?.nonce}
)} - {block?.payload?.type === PayloadType.Transaction && - transferTotal !== null && ( -
-
- Amount transacted -
-
- setIsFormattedBalance(!isFormattedBalance)} - className="pointer margin-r-5" - > - {formatAmount( - transferTotal, - tokenInfo, - !isFormattedBalance - )} - - {isMarketed && ( - - ( - - ) - - )} -
+ {block?.payload?.type === PayloadType.Transaction && transferTotal !== null && ( +
+
Amount transacted
+
+ setIsFormattedBalance(!isFormattedBalance)} className="pointer margin-r-5"> + {formatAmount(transferTotal, tokenInfo, !isFormattedBalance)} + + {isMarketed && ( + + ( + + ) + + )}
- )} +
+ )} {tabbedSections} - + ) : null; return ( @@ -289,16 +256,14 @@ const Block: React.FC> = ( milestoneIndex={metadata?.referencedByMilestoneIndex} hasConflicts={isLinksDisabled} conflictReason={conflictReason} - onClick={metadata?.referencedByMilestoneIndex - ? (theBlockId: string) => history.push(`/${network}/block/${theBlockId}`) - : undefined} + onClick={ + metadata?.referencedByMilestoneIndex + ? (theBlockId: string) => history.push(`/${network}/block/${theBlockId}`) + : undefined + } />
- {isMilestoneBlock && ( - - )} + {isMilestoneBlock && }
{blockContent}
@@ -308,4 +273,3 @@ const Block: React.FC> = ( }; export default Block; - diff --git a/client/src/app/routes/stardust/BlockState.ts b/client/src/app/routes/stardust/BlockState.ts index a2ca55587..33adef790 100644 --- a/client/src/app/routes/stardust/BlockState.ts +++ b/client/src/app/routes/stardust/BlockState.ts @@ -22,4 +22,3 @@ export interface BlockMetadata { */ blockTangleStatus: TangleStatus; } - diff --git a/client/src/app/routes/stardust/Foundry.tsx b/client/src/app/routes/stardust/Foundry.tsx index 0113f9447..2f7518cd5 100644 --- a/client/src/app/routes/stardust/Foundry.tsx +++ b/client/src/app/routes/stardust/Foundry.tsx @@ -1,5 +1,10 @@ import { - AddressType, AliasAddress, FeatureType, FoundryOutput, ImmutableAliasAddressUnlockCondition, MetadataFeature + AddressType, + AliasAddress, + FeatureType, + FoundryOutput, + ImmutableAliasAddressUnlockCondition, + MetadataFeature, } from "@iota/sdk-wasm/web"; import React, { useContext, useEffect, useState } from "react"; import { RouteComponentProps } from "react-router"; @@ -30,12 +35,14 @@ import "./Foundry.scss"; enum FOUNDRY_PAGE_TABS { TokenInfo = "Token Info", Features = "Features", - NativeTokens = "Native Tokens" + NativeTokens = "Native Tokens", } -const Foundry: React.FC> = ( - { match: { params: { network, foundryId } } } -) => { +const Foundry: React.FC> = ({ + match: { + params: { network, foundryId }, + }, +}) => { const isMounted = useIsMounted(); const { tokenInfo, bech32Hrp } = useContext(NetworkContext); @@ -50,14 +57,11 @@ const Foundry: React.FC> = ( useEffect(() => { if (foundryDetails) { const output = foundryDetails?.output as FoundryOutput; - const immutableAliasUnlockCondition = - output.unlockConditions[0] as ImmutableAliasAddressUnlockCondition; + const immutableAliasUnlockCondition = output.unlockConditions[0] as ImmutableAliasAddressUnlockCondition; const aliasId = (immutableAliasUnlockCondition.address as AliasAddress).aliasId; const immutableFeatures = (foundryDetails?.output as FoundryOutput).immutableFeatures; - const metadataFeature = immutableFeatures?.find( - feature => feature.type === FeatureType.Metadata - ) as MetadataFeature; + const metadataFeature = immutableFeatures?.find((feature) => feature.type === FeatureType.Metadata) as MetadataFeature; if (isMounted && metadataFeature) { const parsedMetadata = tryParseMetadata(metadataFeature.data, tokenSchemeIRC30); @@ -76,9 +80,9 @@ const Foundry: React.FC> = ( const serialNumber = foundryOutput.serialNumber; const balance = Number(foundryOutput.amount); - const controllerAliasBech32 = controllerAlias ? - Bech32AddressHelper.buildAddress(bech32Hrp, controllerAlias, AddressType.Alias) : - undefined; + const controllerAliasBech32 = controllerAlias + ? Bech32AddressHelper.buildAddress(bech32Hrp, controllerAlias, AddressType.Alias) + : undefined; foundryContent = ( @@ -89,20 +93,14 @@ const Foundry: React.FC> = (
-
- Serial number -
+
Serial number
- - {serialNumber} - + {serialNumber}
{controllerAlias && controllerAliasBech32 && (
-
- Controller Alias -
+
Controller Alias
> = (
-
- Balance -
+
Balance
{balance && ( - setIsFormattedBalance(!isFormattedBalance)} - className="pointer margin-r-5" - > + setIsFormattedBalance(!isFormattedBalance)} className="pointer margin-r-5"> {formatAmount(balance, tokenInfo, !isFormattedBalance)} {isMarketed && ( @@ -149,26 +142,18 @@ const Foundry: React.FC> = ( [FOUNDRY_PAGE_TABS.NativeTokens]: { disabled: tokenCount === 0, counter: tokenCount, - infoContent: nativeTokensMessage + infoContent: nativeTokensMessage, }, [FOUNDRY_PAGE_TABS.Features]: { - disabled: !foundryOutput.features && !foundryOutput.immutableFeatures - } + disabled: !foundryOutput.features && !foundryOutput.immutableFeatures, + }, }} > - + - + - + ); } @@ -178,19 +163,12 @@ const Foundry: React.FC> = (
-

- Foundry -

+

Foundry

{isFoundryDetailsLoading && }
- {foundryError ? - : - foundryContent} + {foundryError ? : foundryContent}
@@ -198,4 +176,3 @@ const Foundry: React.FC> = ( }; export default Foundry; - diff --git a/client/src/app/routes/stardust/NftRedirectRoute.tsx b/client/src/app/routes/stardust/NftRedirectRoute.tsx index a78a6f584..de3131aa8 100644 --- a/client/src/app/routes/stardust/NftRedirectRoute.tsx +++ b/client/src/app/routes/stardust/NftRedirectRoute.tsx @@ -18,19 +18,19 @@ interface NftRedirectRouteProps { const ADDRESS_ROUTE = "addr"; -const NftRedirectRoute: React.FC> = ( - { match: { params: { network, nftId } } } -) => { +const NftRedirectRoute: React.FC> = ({ + match: { + params: { network, nftId }, + }, +}) => { const { bech32Hrp } = useContext(NetworkContext); const nftAddress = Bech32AddressHelper.buildAddress(bech32Hrp, nftId, AddressType.Nft); const redirectState = { - addressDetails: nftAddress + addressDetails: nftAddress, }; const routeParam = nftAddress.bech32; const redirect = `/${network}/${ADDRESS_ROUTE}/${routeParam}`; - return ( - - ); + return ; }; export default NftRedirectRoute; diff --git a/client/src/app/routes/stardust/OutputList.scss b/client/src/app/routes/stardust/OutputList.scss index 2509ce9da..a5b7e1c8f 100644 --- a/client/src/app/routes/stardust/OutputList.scss +++ b/client/src/app/routes/stardust/OutputList.scss @@ -41,7 +41,8 @@ justify-content: space-between; } - .output-list__basic, .output-list__nft { + .output-list__basic, + .output-list__nft { .load-more--button { margin: 24px 0 8px 0; align-self: center; diff --git a/client/src/app/routes/stardust/OutputList.tsx b/client/src/app/routes/stardust/OutputList.tsx index ae9b0d74c..cd6d732a4 100644 --- a/client/src/app/routes/stardust/OutputList.tsx +++ b/client/src/app/routes/stardust/OutputList.tsx @@ -11,12 +11,14 @@ const OUTPUTS_OVER_LIMIT_MESSAGE = "There are more than 100 outputs with this ta export enum OUTPUT_LIST_TABS { Basic = "Basic outputs", - Nft = "Nft outputs" + Nft = "Nft outputs", } -const OutputList: React.FC> = ( - { match: { params: { network } } } -) => { +const OutputList: React.FC> = ({ + match: { + params: { network }, + }, +}) => { const [ tag, currentPageBasic, @@ -34,7 +36,7 @@ const OutputList: React.FC> = ( nftOutputLimitReached, hasMoreBasicOutputs, hasMoreNftOutputs, - loadMoreCallback + loadMoreCallback, ] = useTaggedOutputs(network); return ( @@ -51,12 +53,12 @@ const OutputList: React.FC> = ( tabOptions={{ [OUTPUT_LIST_TABS.Basic]: { disabled: isBasicLoading || totalBasicItems === 0, - isLoading: isBasicLoading + isLoading: isBasicLoading, }, [OUTPUT_LIST_TABS.Nft]: { disabled: isNftLoading || totalNftItems === 0, - isLoading: isNftLoading - } + isLoading: isNftLoading, + }, }} >
@@ -80,20 +82,14 @@ const OutputList: React.FC> = ( totalCount={totalBasicItems} pageSize={pageSize} siblingsCount={1} - onPageChange={page => setPageNumberBasic(page)} + onPageChange={(page) => setPageNumberBasic(page)} /> )} - {basicOutputLimitReached ? hasMoreBasicOutputs && ( -
- {OUTPUTS_OVER_LIMIT_MESSAGE} -
+ {basicOutputLimitReached ? ( + hasMoreBasicOutputs &&
{OUTPUTS_OVER_LIMIT_MESSAGE}
) : (
-
@@ -122,20 +118,14 @@ const OutputList: React.FC> = ( totalCount={totalNftItems} pageSize={pageSize} siblingsCount={1} - onPageChange={page => setPageNumberNft(page)} + onPageChange={(page) => setPageNumberNft(page)} /> )} - {nftOutputLimitReached ? hasMoreNftOutputs && ( -
- {OUTPUTS_OVER_LIMIT_MESSAGE} -
+ {nftOutputLimitReached ? ( + hasMoreNftOutputs &&
{OUTPUTS_OVER_LIMIT_MESSAGE}
) : (
-
@@ -151,4 +141,3 @@ const OutputList: React.FC> = ( }; export default OutputList; - diff --git a/client/src/app/routes/stardust/OutputPage.scss b/client/src/app/routes/stardust/OutputPage.scss index 09048cbbd..4dbbe8f8b 100644 --- a/client/src/app/routes/stardust/OutputPage.scss +++ b/client/src/app/routes/stardust/OutputPage.scss @@ -62,23 +62,23 @@ overflow: hidden; } .tooltip__special { - background-color: #FFF4DF; + background-color: #fff4df; border-radius: 4px; padding: 0 4px; font-weight: 400; } - + .wrap { - left: 0; - right: 0; - margin-left: auto; - margin-right: auto; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto; width: 170px; .arrow { - left: 0; - right: 0; - margin-left: auto; + left: 0; + right: 0; + margin-left: auto; margin-right: auto; } } diff --git a/client/src/app/routes/stardust/OutputPage.tsx b/client/src/app/routes/stardust/OutputPage.tsx index f5e17731a..9297fc0f9 100644 --- a/client/src/app/routes/stardust/OutputPage.tsx +++ b/client/src/app/routes/stardust/OutputPage.tsx @@ -15,9 +15,11 @@ import TruncatedId from "../../components/stardust/TruncatedId"; import Tooltip from "../../components/Tooltip"; import "./OutputPage.scss"; -const OutputPage: React.FC> = ( - { match: { params: { network, outputId } } } -) => { +const OutputPage: React.FC> = ({ + match: { + params: { network, outputId }, + }, +}) => { const [output, outputMetadata, , outputError] = useOutputDetails(network, outputId); if (outputError) { @@ -27,15 +29,10 @@ const OutputPage: React.FC> = (
-

- Output -

+

Output

- +
@@ -43,188 +40,153 @@ const OutputPage: React.FC> = ( } const { - blockId, transactionId, outputIndex, isSpent, milestoneIndexSpent, milestoneTimestampSpent, - transactionIdSpent, milestoneIndexBooked, milestoneTimestampBooked + blockId, + transactionId, + outputIndex, + isSpent, + milestoneIndexSpent, + milestoneTimestampSpent, + transactionIdSpent, + milestoneIndexBooked, + milestoneTimestampBooked, } = outputMetadata ?? {}; - const isTransactionFromStardustGenesis = milestoneIndexBooked && - TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndexBooked); - const transctionLink = isTransactionFromStardustGenesis ? - `/${CHRYSALIS_MAINNET}/search/${transactionId}` : - `/${network}/transaction/${transactionId}`; - - return (output && -
-
-
-
-
-

- Output -

- -
-
-
-
- -
+ const isTransactionFromStardustGenesis = + milestoneIndexBooked && TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndexBooked); + const transctionLink = isTransactionFromStardustGenesis + ? `/${CHRYSALIS_MAINNET}/search/${transactionId}` + : `/${network}/transaction/${transactionId}`; -
+ return ( + (output && ( +
+
+
+
-

Metadata

+

Output

+
- - {blockId && ( -
-
- Block ID -
-
- - {formatSpecialBlockId(blockId)} - - -
+
+
+
- )} - {transactionId && ( -
-
- Transaction ID -
-
- {isTransactionFromStardustGenesis && ( - - - warning - - - )} - +
+
+

Metadata

- )} - {outputIndex !== undefined && ( -
-
- Output index -
-
- - {outputIndex} - -
-
- )} - - {isSpent !== undefined && ( -
-
- Is spent ? -
-
- - {isSpent.toString()} - -
-
- )} - - {milestoneIndexSpent !== undefined && ( -
-
- Spent at milestone -
-
- - {milestoneIndexSpent} - -
-
- )} - - {milestoneTimestampSpent !== undefined && ( -
-
- Spent at milestone timestamp -
-
- - {DateHelper.formatShort(milestoneTimestampSpent * 1000)} - -
-
- )} - - {transactionIdSpent && ( -
-
- Spent in transaction with ID -
-
- - {transactionIdSpent} - - -
-
- )} - - {milestoneIndexBooked !== undefined && ( -
-
- Booked at milestone -
-
- - {milestoneIndexBooked} - -
-
- )} - - {milestoneTimestampBooked !== undefined && milestoneTimestampBooked !== 0 && ( -
-
- Booked on -
-
- - {DateHelper.formatShort(milestoneTimestampBooked * 1000)} - -
-
- )} + {blockId && ( +
+
Block ID
+
+ + {formatSpecialBlockId(blockId)} + + +
+
+ )} + + {transactionId && ( +
+
Transaction ID
+
+ {isTransactionFromStardustGenesis && ( + + warning + + )} + +
+
+ )} + + {outputIndex !== undefined && ( +
+
Output index
+
+ {outputIndex} +
+
+ )} + + {isSpent !== undefined && ( +
+
Is spent ?
+
+ {isSpent.toString()} +
+
+ )} + + {milestoneIndexSpent !== undefined && ( +
+
Spent at milestone
+
+ {milestoneIndexSpent} +
+
+ )} + + {milestoneTimestampSpent !== undefined && ( +
+
Spent at milestone timestamp
+
+ {DateHelper.formatShort(milestoneTimestampSpent * 1000)} +
+
+ )} + + {transactionIdSpent && ( +
+
Spent in transaction with ID
+
+ + {transactionIdSpent} + + +
+
+ )} + + {milestoneIndexBooked !== undefined && ( +
+
Booked at milestone
+
+ {milestoneIndexBooked} +
+
+ )} + + {milestoneTimestampBooked !== undefined && milestoneTimestampBooked !== 0 && ( +
+
Booked on
+
+ {DateHelper.formatShort(milestoneTimestampBooked * 1000)} +
+
+ )} +
-
-
) ?? null; + )) ?? + null + ); }; export default OutputPage; - diff --git a/client/src/app/routes/stardust/Search.tsx b/client/src/app/routes/stardust/Search.tsx index b131d5030..844bf0f4f 100644 --- a/client/src/app/routes/stardust/Search.tsx +++ b/client/src/app/routes/stardust/Search.tsx @@ -41,8 +41,8 @@ class Search extends AsyncComponent, Searc super(props); const networkService = ServiceFactory.get("network"); - const protocolVersion: ProtocolVersion = (props.match.params.network && - networkService.get(props.match.params.network)?.protocolVersion) || STARDUST; + const protocolVersion: ProtocolVersion = + (props.match.params.network && networkService.get(props.match.params.network)?.protocolVersion) || STARDUST; this._apiClient = ServiceFactory.get(`api-client-${STARDUST}`); @@ -53,7 +53,7 @@ class Search extends AsyncComponent, Searc completion: "", redirect: "", search: "", - invalidError: "" + invalidError: "", }; } @@ -83,29 +83,26 @@ class Search extends AsyncComponent, Searc */ public render(): ReactNode { return this.state.redirect ? ( - ) : (
-

- Search -

+

Search

{!this.state.completion && this.state.status && (

Searching

- {this.state.statusBusy && ()} -

- {this.state.status} -

+ {this.state.statusBusy && } +

{this.state.status}

)} @@ -115,10 +112,7 @@ class Search extends AsyncComponent, Searc

Not found

-

- We could not find any blocks, addresses, outputs, milestones - or indexes for the query. -

+

We could not find any blocks, addresses, outputs, milestones or indexes for the query.


    @@ -188,17 +182,13 @@ class Search extends AsyncComponent, Searc

    Incorrect query format

- {this.state.protocolVersion === STARDUST && ( -

- {this.state.invalidError}. -

- )} + {this.state.protocolVersion === STARDUST &&

{this.state.invalidError}.

}
)}
-
+
); } @@ -218,101 +208,95 @@ class Search extends AsyncComponent, Searc status = "Detecting query type..."; statusBusy = true; if (this._isMounted) { - setTimeout( - async () => { - if (this._isMounted) { - const response = await this._apiClient.search({ - network: this.props.match.params.network, - query - }); + setTimeout(async () => { + if (this._isMounted) { + const response = await this._apiClient.search({ + network: this.props.match.params.network, + query, + }); - if (response && Object.keys(response).length > 0) { - const routeSearch = new Map(); - let route = ""; - let routeParam = query; - let redirectState = {}; - if (response.block) { - route = "block"; - } else if (response.addressDetails?.hex) { - route = "addr"; - redirectState = { - addressDetails: response.addressDetails - }; - } else if (response.output) { - route = "output"; - const outputId = Utils.computeOutputId( - response.output.metadata.transactionId, - response.output.metadata.outputIndex - ); - routeParam = outputId; - } else if (response.taggedOutputs) { - route = "outputs"; - redirectState = { - outputIds: response.taggedOutputs, - tag: query - }; - routeParam = ""; - } else if (response.transactionBlock) { - route = "transaction"; - } else if (response.aliasId) { - route = "addr"; - const aliasAddress = this.buildAddressFromIdAndType( - response.aliasId, AddressType.Alias - ); - redirectState = { - addressDetails: aliasAddress - }; - routeParam = aliasAddress.bech32; - if (response.did) { - routeSearch.set("tab", "DID"); - } - } else if (response.foundryId) { - route = "foundry"; - routeParam = response.foundryId; - } else if (response.nftId) { - route = "addr"; - const nftAddress = this.buildAddressFromIdAndType( - response.nftId, - AddressType.Nft - ); - redirectState = { - addressDetails: nftAddress - }; - routeParam = nftAddress.bech32; - } else if (response.milestone?.blockId) { - route = "block"; - routeParam = response.milestone?.blockId; + if (response && Object.keys(response).length > 0) { + const routeSearch = new Map(); + let route = ""; + let routeParam = query; + let redirectState = {}; + if (response.block) { + route = "block"; + } else if (response.addressDetails?.hex) { + route = "addr"; + redirectState = { + addressDetails: response.addressDetails, + }; + } else if (response.output) { + route = "output"; + const outputId = Utils.computeOutputId( + response.output.metadata.transactionId, + response.output.metadata.outputIndex, + ); + routeParam = outputId; + } else if (response.taggedOutputs) { + route = "outputs"; + redirectState = { + outputIds: response.taggedOutputs, + tag: query, + }; + routeParam = ""; + } else if (response.transactionBlock) { + route = "transaction"; + } else if (response.aliasId) { + route = "addr"; + const aliasAddress = this.buildAddressFromIdAndType(response.aliasId, AddressType.Alias); + redirectState = { + addressDetails: aliasAddress, + }; + routeParam = aliasAddress.bech32; + if (response.did) { + routeSearch.set("tab", "DID"); } + } else if (response.foundryId) { + route = "foundry"; + routeParam = response.foundryId; + } else if (response.nftId) { + route = "addr"; + const nftAddress = this.buildAddressFromIdAndType(response.nftId, AddressType.Nft); + redirectState = { + addressDetails: nftAddress, + }; + routeParam = nftAddress.bech32; + } else if (response.milestone?.blockId) { + route = "block"; + routeParam = response.milestone?.blockId; + } - const getEncodedSearch = () => { - if (routeSearch.size === 0) { - return ""; - } + const getEncodedSearch = () => { + if (routeSearch.size === 0) { + return ""; + } - const searchParams = new URLSearchParams(); - for (const [key, value] of routeSearch.entries()) { - searchParams.append(key, value); - } + const searchParams = new URLSearchParams(); + for (const [key, value] of routeSearch.entries()) { + searchParams.append(key, value); + } - return `?${searchParams.toString()}`; - }; + return `?${searchParams.toString()}`; + }; - this.setState({ - status: "", - statusBusy: false, - redirect: `/${this.props.match.params.network}/${route}/${routeParam}`, - search: getEncodedSearch(), - redirectState - }); - } else { - this.setState({ - completion: "notFound", - status: "", - statusBusy: false - }); - } + this.setState({ + status: "", + statusBusy: false, + redirect: `/${this.props.match.params.network}/${route}/${routeParam}`, + search: getEncodedSearch(), + redirectState, + }); + } else { + this.setState({ + completion: "notFound", + status: "", + statusBusy: false, + }); } - }, 0); + } + }, 0); } } else { invalidError = "the query is empty"; @@ -324,7 +308,7 @@ class Search extends AsyncComponent, Searc status, completion, redirect, - invalidError + invalidError, }); } @@ -334,4 +318,3 @@ class Search extends AsyncComponent, Searc } export default Search; - diff --git a/client/src/app/routes/stardust/TransactionPage.tsx b/client/src/app/routes/stardust/TransactionPage.tsx index 58a515228..b805a26c7 100644 --- a/client/src/app/routes/stardust/TransactionPage.tsx +++ b/client/src/app/routes/stardust/TransactionPage.tsx @@ -26,12 +26,15 @@ import "./TransactionPage.scss"; enum TRANSACTION_PAGE_TABS { Payload = "Payload", - BlockMetadata = "Block Metadata" + BlockMetadata = "Block Metadata", } -const TransactionPage: React.FC> = ( - { history, match: { params: { network, transactionId } } } -) => { +const TransactionPage: React.FC> = ({ + history, + match: { + params: { network, transactionId }, + }, +}) => { const { tokenInfo } = useContext(NetworkContext); const [block, isIncludedBlockLoading, blockError] = useTransactionIncludedBlock(network, transactionId); const [inputs, unlocks, outputs, transferTotal, isInputsAndOutputsLoading] = useInputsAndOutputs(network, block); @@ -63,16 +66,11 @@ const TransactionPage: React.FC> = (
-

- Transaction -

+

Transaction

{isIncludedBlockLoading && }
- +
@@ -88,47 +86,30 @@ const TransactionPage: React.FC> = (
-
- Transaction ID -
+
Transaction ID
- +
{includedBlockId && (
-
- Included in block -
+
Included in block
- +
)} {tangleNetworkId && (
-
- Network ID -
+
Network ID
- - {tangleNetworkId} - + {tangleNetworkId}
)} {inputsCommitment && (
-
- Input commitment -
+
Input commitment
@@ -136,9 +117,7 @@ const TransactionPage: React.FC> = ( )} {block?.nonce && (
-
- Nonce -
+
Nonce
{block?.nonce}
@@ -146,19 +125,10 @@ const TransactionPage: React.FC> = ( )} {transferTotal !== null && (
-
- Amount transacted -
+
Amount transacted
- setIsFormattedBalance(!isFormattedBalance)} - className="pointer margin-r-5" - > - {formatAmount( - transferTotal, - tokenInfo, - !isFormattedBalance - )} + setIsFormattedBalance(!isFormattedBalance)} className="pointer margin-r-5"> + {formatAmount(transferTotal, tokenInfo, !isFormattedBalance)} {isMarketed && ( @@ -176,27 +146,21 @@ const TransactionPage: React.FC> = ( [TRANSACTION_PAGE_TABS.Payload]: { disabled: !inputs || !unlocks || !outputs, isLoading: isInputsAndOutputsLoading, - infoContent: transactionPayloadMessage + infoContent: transactionPayloadMessage, }, [TRANSACTION_PAGE_TABS.BlockMetadata]: { isLoading: isBlockMetadataLoading, - infoContent: metadataInfoMessage - } + infoContent: metadataInfoMessage, + }, }} > - {inputs && - unlocks && - outputs ? - ( -
- -
- ) : <>} + {inputs && unlocks && outputs ? ( +
+ +
+ ) : ( + <> + )} > = ( />
- {metadataError && ( -

- Failed to retrieve metadata. {metadataError} -

- )} + {metadataError &&

Failed to retrieve metadata. {metadataError}

} {metadata && !metadataError && (
-
- Is Solid -
+
Is Solid
- - {metadata?.isSolid ? "Yes" : "No"} - + {metadata?.isSolid ? "Yes" : "No"}
-
- Inclusion Status -
+
Inclusion Status
- +
{conflictReason && (
-
- Conflict Reason -
-
- {conflictReason} -
+
Conflict Reason
+
{conflictReason}
)} {metadata?.parents && (
-
- Parents -
+
Parents
{metadata.parents.map((parent, idx) => ( -
- +
+
))}
@@ -278,9 +217,7 @@ const TransactionPage: React.FC> = (
-

- Transaction -

+

Transaction

{isIncludedBlockLoading && }
@@ -289,16 +226,18 @@ const TransactionPage: React.FC> = ( status={blockTangleStatus} milestoneIndex={metadata?.referencedByMilestoneIndex} hasConflicts={metadata?.ledgerInclusionState === "conflicting"} - onClick={metadata?.referencedByMilestoneIndex - ? (blockId: string) => history.push(`/${network}/block/${blockId}`) - : undefined} + onClick={ + metadata?.referencedByMilestoneIndex + ? (blockId: string) => history.push(`/${network}/block/${blockId}`) + : undefined + } />
{transactionContent}
-
+
); }; diff --git a/client/src/app/routes/stardust/Visualizer.scss b/client/src/app/routes/stardust/Visualizer.scss index 7e1a73d48..57af672cf 100644 --- a/client/src/app/routes/stardust/Visualizer.scss +++ b/client/src/app/routes/stardust/Visualizer.scss @@ -5,311 +5,311 @@ @import "../../../scss/themes"; .visualizer-stardust { - position: relative; - margin: 16px 40px; + position: relative; + margin: 16px 40px; - .heading { - min-width: 230px; - } + .heading { + min-width: 230px; + } - @include phone-down { - margin: 20px; - } + @include phone-down { + margin: 20px; + } - .search-filter { - flex: 1; - margin-bottom: 16px; + .search-filter { + flex: 1; + margin-bottom: 16px; - @include tablet-down { - display: none; - } + @include tablet-down { + display: none; + } - .card--content { - padding: 8px 16px; - } + .card--content { + padding: 8px 16px; + } - button { - white-space: nowrap; + button { + white-space: nowrap; + } } - } - .graph-border { - display: flex; - position: relative; - flex: 1; - align-items: stretch; - justify-content: stretch; - height: 80vh; - overflow: hidden; - border: 1px solid var(--input-border-color); - border-radius: 6px; - - .viva { - position: relative; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: var(--stardust-visualizer-bg); - } + .graph-border { + display: flex; + position: relative; + flex: 1; + align-items: stretch; + justify-content: stretch; + height: 80vh; + overflow: hidden; + border: 1px solid var(--input-border-color); + border-radius: 6px; + + .viva { + position: relative; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: var(--stardust-visualizer-bg); + } - .selected-node { - @include font-size(12px); + .selected-node { + @include font-size(12px); - position: absolute; - z-index: 1; - margin: 5px; - background-color: $white; - color: var(--link-highlight); - font-family: $metropolis; - word-break: break-all; - } + position: absolute; + z-index: 1; + margin: 5px; + background-color: $white; + color: var(--link-highlight); + font-family: $metropolis; + word-break: break-all; + } - .action-panel-container { - display: flex; - position: absolute; - z-index: 2; - top: 20px; - right: 20px; + .action-panel-container { + display: flex; + position: absolute; + z-index: 2; + top: 20px; + right: 20px; - .pause-button { - padding: 6px; - color: var(--header-icon-color); + .pause-button { + padding: 6px; + color: var(--header-icon-color); - &:hover { - color: var(--link-highlight); + &:hover { + color: var(--link-highlight); + } + } } - } } - } - - .stats-panel-container { - display: flex; - position: absolute; - z-index: 1; - top: 0; - right: 30px; - bottom: 0; - align-items: center; - justify-content: center; - pointer-events: none; - - .stats-panel { - background: var(--body-background); - - .card--value, - .card--label { - text-align: right; - } - .card--label { - justify-content: flex-end; - } - .card--content { - padding: 20px 30px; - } + + .stats-panel-container { + display: flex; + position: absolute; + z-index: 1; + top: 0; + right: 30px; + bottom: 0; + align-items: center; + justify-content: center; + pointer-events: none; + + .stats-panel { + background: var(--body-background); + + .card--value, + .card--label { + text-align: right; + } + .card--label { + justify-content: flex-end; + } + .card--content { + padding: 20px 30px; + } + } + + @include tablet-down { + top: 60px; + left: 20px; + bottom: auto; + justify-content: left; + + .stats-panel { + .card--value, + .card--label { + text-align: left; + } + .card--label { + justify-content: flex-start; + } + .card--content { + padding: 0; + } + .stats-panel__info { + padding: 0 10px; + display: inline-block; + } + } + } + + @include phone-down { + left: 10px; + .stats-panel { + .card--value, + .card--label { + font-size: 12px; + } + .stats-panel__info:last-of-type { + display: block; + } + } + } } - @include tablet-down { - top: 60px; - left: 20px; - bottom: auto; - justify-content: left; + .info-panel { + background: var(--body-background); + position: relative; + display: flex; + position: absolute; + z-index: 2; + top: 100px; + left: 20px; + width: 320px; + overflow: visible; + + @include tablet-down { + top: 140px; + width: 46%; + } - .stats-panel { - .card--value, - .card--label { - text-align: left; + @include phone-down { + top: 200px; + left: 10px; + width: 60%; } - .card--label { - justify-content: flex-start; + + button { + position: absolute; + top: 8px; + right: 8px; } + .card--content { - padding: 0; - } - .stats-panel__info{ - padding: 0 10px; - display: inline-block; + padding: 20px 30px; + + .card--value, + .card--label { + align-items: center; + + @include phone-down { + .block-tangle-state__confirmed { + text-indent: -9999px; + padding: 0 5px; + + &::before { + content: "\2713"; + text-indent: 0px; + color: var(--mint-green-bg); + font-size: 16px; + font-weight: bold; + } + } + + .blocks-tangle-state .block-tangle-state { + margin-right: 0; + padding: 0 5px; + .tooltip .children { + &::before { + content: "\2717"; + padding-top: 4px; + color: $error; + font-size: 16px; + font-weight: bold; + } + span { + display: none; + } + } + } + } + } } - } - } - @include phone-down { - left: 10px; - .stats-panel { - .card--value, - .card--label { - font-size: 12px; + .tooltip { + .wrap { + width: 180px; + } } - .stats-panel__info:last-of-type{ - display: block; + + .info-panel__dropdown { + .card--content__input--dropdown { + display: none; + + @include phone-down { + display: block; + } + } } - } - } - } - - .info-panel { - background: var(--body-background); - position: relative; - display: flex; - position: absolute; - z-index: 2; - top: 100px; - left: 20px; - width: 320px; - overflow: visible; - - @include tablet-down { - top: 140px; - width: 46%; - } - - @include phone-down { - top: 200px; - left: 10px; - width: 60%; - } - - button { - position: absolute; - top: 8px; - right: 8px; - } - - .card--content { - padding: 20px 30px; - - .card--value, .card--label { - align-items: center; + .info-panel__reattachments { @include phone-down { - .block-tangle-state__confirmed { - text-indent: -9999px; - padding: 0 5px; - - &::before { - content: "\2713"; - text-indent: 0px; - color: var(--mint-green-bg); - font-size: 16px; - font-weight: bold; - } - } - - .blocks-tangle-state .block-tangle-state { - margin-right: 0; - padding: 0 5px; - .tooltip .children { - &::before { - content: "\2717"; - padding-top: 4px; - color: $error; - font-size: 16px; - font-weight: bold; - } - span { - display: none; - } + display: none; + + &.info-panel__reattachments--opened { + display: block; } - } } - } - } - - .tooltip { - .wrap { - width: 180px; } - } + } - .info-panel__dropdown { - .card--content__input--dropdown { - display: none; + .key-panel-container { + display: flex; + position: absolute; + z-index: 1; + right: 30px; + bottom: 10px; + left: 30px; + justify-content: center; + pointer-events: none; + + .key-panel { + background: var(--body-background); + display: flex; + flex-direction: row; + flex-wrap: wrap; + padding: 16px; + + .key-panel-item { + display: flex; + flex-direction: row; + align-items: center; + margin: 0 16px; + + @include desktop-down { + width: 110px; + margin: 0; + } - @include phone-down { - display: block; - } - } - } + .key-marker { + width: 12px; + height: 12px; + margin-right: 10px; + border-radius: 3px; - .info-panel__reattachments { - @include phone-down { - display: none; + &.vertex-state--pending { + background-color: #bbbbbb; + } + + &.vertex-state--included { + background-color: #4caaff; + } + + &.vertex-state--referenced { + background-color: #61e884; + } + + &.vertex-state--conflicting { + background-color: #ff8b5c; + } - &.info-panel__reattachments--opened { - display: block; - } + &.vertex-state--milestone { + background-color: #666af6; + } + + &.vertex-state--search-result { + background-color: #c061e8; + } + } + + .key-label { + @include font-size(14px); + + color: var(--body-color); + font-family: $metropolis; + font-weight: 500; + } + } } - } - } - - .key-panel-container { - display: flex; - position: absolute; - z-index: 1; - right: 30px; - bottom: 10px; - left: 30px; - justify-content: center; - pointer-events: none; - - .key-panel { - background: var(--body-background); - display: flex; - flex-direction: row; - flex-wrap: wrap; - padding: 16px; - - .key-panel-item { - display: flex; - flex-direction: row; - align-items: center; - margin: 0 16px; - - @include desktop-down { - width: 110px; - margin: 0; - } - - .key-marker { - width: 12px; - height: 12px; - margin-right: 10px; - border-radius: 3px; - - &.vertex-state--pending { - background-color: #bbbbbb; - } - - &.vertex-state--included { - background-color: #4caaff; - } - - &.vertex-state--referenced { - background-color: #61e884; - } - - &.vertex-state--conflicting { - background-color: #ff8b5c; - } - - &.vertex-state--milestone { - background-color: #666af6; - } - - &.vertex-state--search-result { - background-color: #C061E8; - } - } - - .key-label { - @include font-size(14px); - - color: var(--body-color); - font-family: $metropolis; - font-weight: 500; - } - } - } - } + } } - diff --git a/client/src/app/routes/stardust/Visualizer.tsx b/client/src/app/routes/stardust/Visualizer.tsx index cd7d98dce..50d73692e 100644 --- a/client/src/app/routes/stardust/Visualizer.tsx +++ b/client/src/app/routes/stardust/Visualizer.tsx @@ -18,9 +18,11 @@ import NetworkContext from "../../context/NetworkContext"; import { VisualizerRouteProps } from "../VisualizerRouteProps"; import "./Visualizer.scss"; -export const Visualizer: React.FC> = ( - { match: { params: { network } } } -) => { +export const Visualizer: React.FC> = ({ + match: { + params: { network }, + }, +}) => { const { tokenInfo } = useContext(NetworkContext); const [networkConfig] = useNetworkConfig(network); const [blocksPerSecond, confirmedBlocksPerSecond, confirmedBlocksPerSecondPercent] = useNetworkStats(network); @@ -37,15 +39,12 @@ export const Visualizer: React.FC> = ( selectedFeedItem, isFormatAmountsFull, setIsFormatAmountsFull, - lastClick + lastClick, ] = useVisualizerState(network, graphElement); const getStatus = (referenced?: number) => (referenced ? "referenced" : undefined); - const getConflictReasonMessage = (conflictReason?: ConflictReason) => ( - conflictReason ? - CONFLICT_REASON_STRINGS[conflictReason] : - undefined - ); + const getConflictReasonMessage = (conflictReason?: ConflictReason) => + conflictReason ? CONFLICT_REASON_STRINGS[conflictReason] : undefined; const properties = selectedFeedItem?.properties; return ( @@ -62,7 +61,7 @@ export const Visualizer: React.FC> = ( className="input form-input-long" type="text" value={filter} - onChange={e => setFilter(e.target.value)} + onChange={(e) => setFilter(e.target.value)} maxLength={2000} />
@@ -81,9 +80,7 @@ export const Visualizer: React.FC> = (
@@ -93,9 +90,7 @@ export const Visualizer: React.FC> = (
Blocks
-
- {blocksCount} -
+
{blocksCount}
BPS / CBPS
@@ -105,9 +100,7 @@ export const Visualizer: React.FC> = (
Referenced Rate
-
- {confirmedBlocksPerSecondPercent} -
+
{confirmedBlocksPerSecondPercent}
@@ -122,27 +115,21 @@ export const Visualizer: React.FC> = (
<> -
Block - {selectedFeedItem.payloadType !== "Milestone" && - selectedFeedItem.metadata && ( - - - - )} +
+ Block + {selectedFeedItem.payloadType !== "Milestone" && selectedFeedItem.metadata && ( + + + + )}
- +
@@ -150,11 +137,7 @@ export const Visualizer: React.FC> = (
Transaction id
- +
@@ -163,26 +146,19 @@ export const Visualizer: React.FC> = ( {properties?.tag && (
Tag
-
- {hexToUtf8(properties.tag)} -
+
{hexToUtf8(properties.tag)}
Hex
-
- {properties.tag} -
+
{properties.tag}
)} {selectedFeedItem.metadata?.milestone !== undefined && ( {properties?.milestoneId && ( -
- Milestone id -
+
Milestone id
@@ -190,54 +166,35 @@ export const Visualizer: React.FC> = (
)} -
- Milestone index -
+
Milestone index
- + {selectedFeedItem.metadata.milestone}
{properties?.timestamp && ( -
- Timestamp -
+
Timestamp
- {DateHelper.formatShort( - DateHelper.milliseconds( - properties.timestamp - ) - )} + {DateHelper.formatShort(DateHelper.milliseconds(properties.timestamp))}
)}
)} - {selectedFeedItem?.value !== undefined && - selectedFeedItem.metadata?.milestone === undefined && ( - -
Value
-
- setIsFormatAmountsFull(!isFormatAmountsFull)} - className="pointer margin-r-5" - > - { - formatAmount( - selectedFeedItem?.value, - tokenInfo, - isFormatAmountsFull ?? undefined - ) - } - -
-
- )} + {selectedFeedItem?.value !== undefined && selectedFeedItem.metadata?.milestone === undefined && ( + +
Value
+
+ setIsFormatAmountsFull(!isFormatAmountsFull)} + className="pointer margin-r-5" + > + {formatAmount(selectedFeedItem?.value, tokenInfo, isFormatAmountsFull ?? undefined)} + +
+
+ )} {selectedFeedItem?.reattachments && selectedFeedItem.reattachments.length > 0 && (
> = ( onClick={() => setIsExpanded(!isExpanded)} >
-
- Reattachments -
+
Reattachments
{selectedFeedItem.reattachments.map((item, index) => (
@@ -284,9 +233,7 @@ export const Visualizer: React.FC> = ( network={network} status={getStatus(item.metadata?.referenced)} hasConflicts={item.metadata?.conflicting} - conflictReason={getConflictReasonMessage( - item.metadata?.conflictReason - )} + conflictReason={getConflictReasonMessage(item.metadata?.conflictReason)} /> )} @@ -331,4 +278,3 @@ export const Visualizer: React.FC> = (
); }; - diff --git a/client/src/app/routes/stardust/landing/AnalyticStats.scss b/client/src/app/routes/stardust/landing/AnalyticStats.scss index 7d75f952d..998f53a28 100644 --- a/client/src/app/routes/stardust/landing/AnalyticStats.scss +++ b/client/src/app/routes/stardust/landing/AnalyticStats.scss @@ -87,4 +87,3 @@ } } } - diff --git a/client/src/app/routes/stardust/landing/AnalyticStats.tsx b/client/src/app/routes/stardust/landing/AnalyticStats.tsx index 6b6a4c414..0b22b5567 100644 --- a/client/src/app/routes/stardust/landing/AnalyticStats.tsx +++ b/client/src/app/routes/stardust/landing/AnalyticStats.tsx @@ -11,9 +11,7 @@ interface AnalyticStatsProps { readonly tokenInfo: INodeInfoBaseToken; } -const AnalyticStats: React.FC = ( - { analytics, circulatingSupply, tokenInfo } -) => { +const AnalyticStats: React.FC = ({ analytics, circulatingSupply, tokenInfo }) => { const nativeTokensCount = analytics?.nativeTokens; const nftsCount = analytics?.nfts; const totalAddresses = analytics?.totalAddresses; @@ -23,63 +21,51 @@ const AnalyticStats: React.FC = ( if (analytics?.unclaimedShimmer && circulatingSupply) { // magic number since influx doesn't account for the unclaimable portion of 20% const shimmerClaimed = circulatingSupply - (Number.parseInt(analytics.unclaimedShimmer, 10) - 362724101812273); - claimedAndPercentLabels = buildShimmerClaimedStats( - shimmerClaimed.toString(), - String(circulatingSupply), - tokenInfo - ); + claimedAndPercentLabels = buildShimmerClaimedStats(shimmerClaimed.toString(), String(circulatingSupply), tokenInfo); } - return ( - analytics && !analytics.error ? ( -
- {totalAddresses !== undefined && ( -
- Total active Addresses - {totalAddresses} -
- )} - {claimedAndPercentLabels !== undefined && ( -
- Rewards claimed - {claimedAndPercentLabels[1]} -
- )} - {claimedAndPercentLabels !== undefined && ( -
- Total Shimmer claimed - - {claimedAndPercentLabels[0]} - -
- )} - {nftsCount !== undefined && ( -
- NFTs minted - {nftsCount} -
- )} - {nativeTokensCount !== undefined && ( -
- Tokens created - {nativeTokensCount} -
- )} - {lockedStorageDepositValue !== undefined && ( -
- Locked storage deposit - - {formatAmount( - Number(lockedStorageDepositValue), - tokenInfo - ).replace(COMMAS_REGEX, ",")} - -
- )} -
- ) : null - ); + return analytics && !analytics.error ? ( +
+ {totalAddresses !== undefined && ( +
+ Total active Addresses + {totalAddresses} +
+ )} + {claimedAndPercentLabels !== undefined && ( +
+ Rewards claimed + {claimedAndPercentLabels[1]} +
+ )} + {claimedAndPercentLabels !== undefined && ( +
+ Total Shimmer claimed + {claimedAndPercentLabels[0]} +
+ )} + {nftsCount !== undefined && ( +
+ NFTs minted + {nftsCount} +
+ )} + {nativeTokensCount !== undefined && ( +
+ Tokens created + {nativeTokensCount} +
+ )} + {lockedStorageDepositValue !== undefined && ( +
+ Locked storage deposit + + {formatAmount(Number(lockedStorageDepositValue), tokenInfo).replace(COMMAS_REGEX, ",")} + +
+ )} +
+ ) : null; }; export default AnalyticStats; - diff --git a/client/src/app/routes/stardust/landing/InfoBox.scss b/client/src/app/routes/stardust/landing/InfoBox.scss index 30bcc0649..bfec221e5 100644 --- a/client/src/app/routes/stardust/landing/InfoBox.scss +++ b/client/src/app/routes/stardust/landing/InfoBox.scss @@ -93,4 +93,3 @@ } } } - diff --git a/client/src/app/routes/stardust/landing/InfoBox.tsx b/client/src/app/routes/stardust/landing/InfoBox.tsx index 408da2ec8..50bd31449 100644 --- a/client/src/app/routes/stardust/landing/InfoBox.tsx +++ b/client/src/app/routes/stardust/landing/InfoBox.tsx @@ -11,24 +11,24 @@ interface InfoBoxProps { readonly showMarket: boolean; } -const InfoBox: React.FC = ( - { baseToken, itemsPerSecond, confirmedItemsPerSecondPercent, marketCapCurrency, priceCurrency, showMarket } -) => ( +const InfoBox: React.FC = ({ + baseToken, + itemsPerSecond, + confirmedItemsPerSecondPercent, + marketCapCurrency, + priceCurrency, + showMarket, +}) => (
- Blocks per sec - + Blocks per sec
- - {NumberHelper.roundTo(Number(itemsPerSecond), 1) || "--"} - + {NumberHelper.roundTo(Number(itemsPerSecond), 1) || "--"}
Inclusion rate - - {confirmedItemsPerSecondPercent} - + {confirmedItemsPerSecondPercent}
{showMarket && (
@@ -39,9 +39,7 @@ const InfoBox: React.FC = ( {showMarket && (
Price - - {priceCurrency} - + {priceCurrency}
)}
diff --git a/client/src/app/routes/stardust/landing/Landing.scss b/client/src/app/routes/stardust/landing/Landing.scss index 08c42e174..d14789ea8 100644 --- a/client/src/app/routes/stardust/landing/Landing.scss +++ b/client/src/app/routes/stardust/landing/Landing.scss @@ -54,7 +54,6 @@ transform: translate(-130px, -40px); } } - } .header-wrapper.shimmer { @@ -257,14 +256,12 @@ } .card--content { - padding:10px 0px; + padding: 10px 0px; } @include phone-down { margin-top: 0px; } } - } } - diff --git a/client/src/app/routes/stardust/landing/Landing.tsx b/client/src/app/routes/stardust/landing/Landing.tsx index 2a79db409..264594a37 100644 --- a/client/src/app/routes/stardust/landing/Landing.tsx +++ b/client/src/app/routes/stardust/landing/Landing.tsx @@ -14,9 +14,11 @@ import NetworkContext from "../../../context/NetworkContext"; import { LandingRouteProps } from "../../LandingRouteProps"; import "./Landing.scss"; -export const Landing: React.FC> = ( - { match: { params: { network } } } -) => { +export const Landing: React.FC> = ({ + match: { + params: { network }, + }, +}) => { const { tokenInfo } = useContext(NetworkContext); const [milestones, latestMilestoneIndex] = useBlockFeed(network); const [networkConfig] = useNetworkConfig(network); @@ -28,12 +30,14 @@ export const Landing: React.FC> = ( return (
-
+

{networkConfig.isEnabled ? "Explore network" : ""}

-

{networkConfig.label}

+
+

{networkConfig.label}

+
> = ( />
- +
@@ -67,18 +67,12 @@ export const Landing: React.FC> = (
{networkConfig.description}
{networkConfig.faucet && (
- Get tokens from the - {" "} - + + Get tokens from the{" "} + Faucet -
)}
@@ -97,4 +91,3 @@ export const Landing: React.FC> = (
); }; - diff --git a/client/src/app/routes/stardust/landing/MilestoneFeed.scss b/client/src/app/routes/stardust/landing/MilestoneFeed.scss index 3e8874b82..718375e7f 100644 --- a/client/src/app/routes/stardust/landing/MilestoneFeed.scss +++ b/client/src/app/routes/stardust/landing/MilestoneFeed.scss @@ -24,7 +24,7 @@ &.seconds { display: inline-block; - min-width: 44px!important; + min-width: 44px !important; } } } @@ -55,7 +55,11 @@ display: none; } - &.ms-index, &.ms-id, &.ms-blocks, &.ms-txs, &.ms-timestamp { + &.ms-index, + &.ms-id, + &.ms-blocks, + &.ms-txs, + &.ms-timestamp { text-align: left; } @@ -67,7 +71,8 @@ min-width: 136px; } - &.ms-blocks, &.ms-txs { + &.ms-blocks, + &.ms-txs { min-width: 60px; } @@ -120,7 +125,6 @@ } } } - } .feed-item--label { @@ -161,7 +165,8 @@ text-align: left; } - &.ms-blocks, &.ms-txs { + &.ms-blocks, + &.ms-txs { text-align: left; min-width: 60px; } @@ -174,7 +179,7 @@ @include tablet-down { @include font-size(14px, 20px); - + padding-left: 8px; font-weight: 400; font-family: $ibm-plex-mono; @@ -184,7 +189,11 @@ } @include tablet-down { - &.ms-index, &.ms-id, &.ms-blocks, &.ms-txs, &.ms-timestamp { + &.ms-index, + &.ms-id, + &.ms-blocks, + &.ms-txs, + &.ms-timestamp { text-align: left; } } @@ -214,4 +223,3 @@ } } } - diff --git a/client/src/app/routes/stardust/landing/MilestoneFeed.tsx b/client/src/app/routes/stardust/landing/MilestoneFeed.tsx index 2bc7bf755..061d32468 100644 --- a/client/src/app/routes/stardust/landing/MilestoneFeed.tsx +++ b/client/src/app/routes/stardust/landing/MilestoneFeed.tsx @@ -20,14 +20,12 @@ interface MilestoneFeedProps { const MilestoneFeed: React.FC = ({ networkConfig, milestones, latestMilestoneIndex }) => { const network = networkConfig.network; const secondsSinceLast = useMilestoneInterval(latestMilestoneIndex); - const secondsSinceLastView = secondsSinceLast ? ( - {secondsSinceLast.toFixed(2)}s ago - ) : ""; + const secondsSinceLastView = secondsSinceLast ? {secondsSinceLast.toFixed(2)}s ago : ""; let highestIndex = 0; const milestonesToRender: IMilestoneFeedItem[] = []; for (const milestone of milestones) { - if (!milestonesToRender.some(ms => ms.index === milestone.index)) { + if (!milestonesToRender.some((ms) => ms.index === milestone.index)) { if (milestone.index > highestIndex) { highestIndex = milestone.index; } @@ -53,10 +51,8 @@ const MilestoneFeed: React.FC = ({ networkConfig, milestones Txs Timestamp
- {milestonesToRender.length === 0 && ( -

There are no milestones in the feed.

- )} - {milestonesToRender.map(milestone => { + {milestonesToRender.length === 0 &&

There are no milestones in the feed.

} + {milestonesToRender.map((milestone) => { const blockId = HexHelper.addPrefix(milestone.blockId); const milestoneId = milestone.milestoneId; const timestamp = milestone.timestamp * 1000; @@ -67,27 +63,17 @@ const MilestoneFeed: React.FC = ({ networkConfig, milestones
Index - + {milestone.index}
- +
- +
Timestamp @@ -103,7 +89,7 @@ const MilestoneFeed: React.FC = ({ networkConfig, milestones }; MilestoneFeed.defaultProps = { - latestMilestoneIndex: undefined + latestMilestoneIndex: undefined, }; export default MilestoneFeed; diff --git a/client/src/app/routes/stardust/landing/MilestoneFeedAnalytics.tsx b/client/src/app/routes/stardust/landing/MilestoneFeedAnalytics.tsx index 863557ede..557ecd12c 100644 --- a/client/src/app/routes/stardust/landing/MilestoneFeedAnalytics.tsx +++ b/client/src/app/routes/stardust/landing/MilestoneFeedAnalytics.tsx @@ -26,31 +26,29 @@ const MilestoneFeedAnalyics: React.FC = ({ network,
Blocks - {isLoading ? - : + {isLoading ? ( + + ) : (
- + {includedBlocks ?? "--"} -
} +
+ )}
Txs - {isLoading ? - : + {isLoading ? ( + + ) : (
- + {txs ?? "--"} -
} +
+ )}
@@ -58,4 +56,3 @@ const MilestoneFeedAnalyics: React.FC = ({ network, }; export default MilestoneFeedAnalyics; - diff --git a/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.spec.ts b/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.spec.ts index 106a47161..435bf33d0 100644 --- a/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.spec.ts +++ b/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.spec.ts @@ -7,7 +7,7 @@ const TOKEN_INFO: INodeInfoBaseToken = { unit: "SMR", subunit: "glow", decimals: 6, - useMetricPrefix: false + useMetricPrefix: false, }; test("buildShimmerClaimedStats should display percent", () => { @@ -89,27 +89,15 @@ test("buildShimmerClaimedStats should not display magnitudes, but SMR formatted expect(claimed).toBe("1,234,198,475 SMR"); expect(percent).toBe("61.7%"); - [claimed, percent] = buildShimmerClaimedStats( - "1234198475000000000", - "2000000000000000000", - TOKEN_INFO - ); + [claimed, percent] = buildShimmerClaimedStats("1234198475000000000", "2000000000000000000", TOKEN_INFO); expect(claimed).toBe("1,234,198,475,000 SMR"); expect(percent).toBe("61.7%"); - [claimed, percent] = buildShimmerClaimedStats( - "1276198475000000000000", - "2000000000000000000000", - TOKEN_INFO - ); + [claimed, percent] = buildShimmerClaimedStats("1276198475000000000000", "2000000000000000000000", TOKEN_INFO); expect(claimed).toBe("1,276,198,475,000,000 SMR"); expect(percent).toBe("63.8%"); - [claimed, percent] = buildShimmerClaimedStats( - "1234198475000000000000000", - "2000000000000000000000000", - TOKEN_INFO - ); + [claimed, percent] = buildShimmerClaimedStats("1234198475000000000000000", "2000000000000000000000000", TOKEN_INFO); expect(claimed).toBe("1,234,198,475,000,000,000 SMR"); expect(percent).toBe("61.7%"); }); diff --git a/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.ts b/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.ts index 6884e0f1a..912eb98dd 100644 --- a/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.ts +++ b/client/src/app/routes/stardust/landing/ShimmerClaimedUtils.ts @@ -4,29 +4,19 @@ import { formatAmount } from "~helpers/stardust/valueFormatHelper"; export const COMMAS_REGEX = /\B(?=(\d{3})+(?!\d))/g; -export const buildShimmerClaimedStats = ( - claimed: string, - supply: string, - tokenInfo: INodeInfoBaseToken -): [string, string] => { +export const buildShimmerClaimedStats = (claimed: string, supply: string, tokenInfo: INodeInfoBaseToken): [string, string] => { const bigInt = BigInt(claimed); const claimedBd = BigDecimal.fromBigInt(bigInt); let claimedFinal = claimedBd.toString(); const formatFull = bigInt < Math.pow(10, tokenInfo.decimals - 3); - const decimals = bigInt < Math.pow(10, tokenInfo.decimals) ? - 3 : - (bigInt < Math.pow(10, tokenInfo.decimals + 2) ? 2 : 0); + const decimals = bigInt < Math.pow(10, tokenInfo.decimals) ? 3 : bigInt < Math.pow(10, tokenInfo.decimals + 2) ? 2 : 0; claimedFinal = formatAmount(Number(claimedFinal), tokenInfo, formatFull, decimals); claimedFinal = claimedFinal.replaceAll(COMMAS_REGEX, ","); - const claimedPercentBd = new BigDecimal("100", 2).multiply( - claimedBd.toString() - ).divide(supply); + const claimedPercentBd = new BigDecimal("100", 2).multiply(claimedBd.toString()).divide(supply); - const claimedPercentFinal = claimedPercentBd.toString() === "0" ? - "<0.01%" : - claimedPercentBd.toString().concat("%"); + const claimedPercentFinal = claimedPercentBd.toString() === "0" ? "<0.01%" : claimedPercentBd.toString().concat("%"); return [claimedFinal, claimedPercentFinal]; }; diff --git a/client/src/app/routes/stardust/statistics/StatisticsPage.scss b/client/src/app/routes/stardust/statistics/StatisticsPage.scss index 9eccb52a4..2a7789e70 100644 --- a/client/src/app/routes/stardust/statistics/StatisticsPage.scss +++ b/client/src/app/routes/stardust/statistics/StatisticsPage.scss @@ -2,7 +2,7 @@ @import "../../../../scss/media-queries"; @import "../../../../scss/variables"; @import "../../../../scss/fonts"; -@import "../../../../scss/themes"; +@import "../../../../scss/themes"; .statistics-page { .statistics-row { @@ -47,12 +47,11 @@ .card--label { white-space: normal; - } + } .card--value { word-break: normal; } - } + } } } } - diff --git a/client/src/app/routes/stardust/statistics/StatisticsPage.tsx b/client/src/app/routes/stardust/statistics/StatisticsPage.tsx index 807a987fb..95c726aad 100644 --- a/client/src/app/routes/stardust/statistics/StatisticsPage.tsx +++ b/client/src/app/routes/stardust/statistics/StatisticsPage.tsx @@ -7,7 +7,7 @@ import "./StatisticsPage.scss"; enum STATISTICS_PAGE_TABS { Charts = "Charts", - TokenDistribution = "Token distribution" + TokenDistribution = "Token distribution", } interface StatisticsPageProps { @@ -20,21 +20,16 @@ const StatisticsPage: React.FC> = () =>
-

- Statistics -

+

Statistics

- +
-
-
+
+
); export default StatisticsPage; - diff --git a/client/src/assets/modals/chrysalis/address/main-header.json b/client/src/assets/modals/chrysalis/address/main-header.json index a6b37ae79..c56587fba 100644 --- a/client/src/assets/modals/chrysalis/address/main-header.json +++ b/client/src/assets/modals/chrysalis/address/main-header.json @@ -1,4 +1,4 @@ { "title": "Address", "description": "

Addresses are similar to a personal account, something viewable and sendable to people you want to do business with. This personal account belongs to a seed. In the world of cryptography, a seed refers to a 'private key'. Simply put, you have the seed (your private key) keeping your address (your account) safe.

" -} \ No newline at end of file +} diff --git a/client/src/assets/modals/chrysalis/address/transaction-history.json b/client/src/assets/modals/chrysalis/address/transaction-history.json index 24e1d0ecd..418257bdc 100644 --- a/client/src/assets/modals/chrysalis/address/transaction-history.json +++ b/client/src/assets/modals/chrysalis/address/transaction-history.json @@ -2,10 +2,10 @@ "title": "Transaction History", "description": "

The history of all transactions for this address. Transactions are the cornerstone of value-based transfers in the IOTA network.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/iota.rs/explanations/messages_payloads_and_transactions", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/iota.rs/explanations/messages_payloads_and_transactions", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/chrysalis/message/indexation-payload.json b/client/src/assets/modals/chrysalis/message/indexation-payload.json index d85be65f0..013d88b46 100644 --- a/client/src/assets/modals/chrysalis/message/indexation-payload.json +++ b/client/src/assets/modals/chrysalis/message/indexation-payload.json @@ -2,10 +2,10 @@ "title": "Indexation Payload", "description": "

The concept of the payload allows for the addition of an index to the encapsulating message, as well as some arbitrary data. Nodes expose an application programming interface that enables the querying of messages by the index. Index payloads may also be contained within a transaction payload.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/learn/about-iota/messages#indexation-payload", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/learn/about-iota/messages#indexation-payload", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/chrysalis/message/main-header.json b/client/src/assets/modals/chrysalis/message/main-header.json index f8459fa9e..965e00660 100644 --- a/client/src/assets/modals/chrysalis/message/main-header.json +++ b/client/src/assets/modals/chrysalis/message/main-header.json @@ -2,10 +2,10 @@ "title": "Message", "description": "

A Message consists of basic information that defines the type and structure of the message, and it can also contain different payloads. A payload is an attachment that can include an IOTA transaction and many other kinds of data.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/learn/about-iota/data-transfer#what-is-an-iota-message", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/learn/about-iota/data-transfer#what-is-an-iota-message", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/chrysalis/message/milestone-payload.json b/client/src/assets/modals/chrysalis/message/milestone-payload.json index 0d687a600..74a6c6e49 100644 --- a/client/src/assets/modals/chrysalis/message/milestone-payload.json +++ b/client/src/assets/modals/chrysalis/message/milestone-payload.json @@ -2,10 +2,10 @@ "title": "Milestone Payload", "description": "

A milestone payload contains the Milestone Essence, which consists of the actual milestone information (like its index number or position in the Tangle), which is signed using the Ed25519 signature scheme. It uses keys of 32 bytes, while the generated signatures are 64 bytes.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/learn/about-iota/messages#milestone-payload", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/learn/about-iota/messages#milestone-payload", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/chrysalis/message/transaction-payload.json b/client/src/assets/modals/chrysalis/message/transaction-payload.json index 0cbb9ac02..77c1acd30 100644 --- a/client/src/assets/modals/chrysalis/message/transaction-payload.json +++ b/client/src/assets/modals/chrysalis/message/transaction-payload.json @@ -2,10 +2,10 @@ "title": "Transaction Payload", "description": "

A transaction payload is made up of two parts:

  1. The Transaction Essence part, which contains the inputs, outputs, and an optional embedded payload.
  2. The Unlock Blocks, which unlocks the Transaction Essence's inputs. In case the unlock block contains a signature, it signs the entire Transaction Essence part.
", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/learn/about-iota/messages#transaction-payload", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/learn/about-iota/messages#transaction-payload", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/chrysalis/message/tree.json b/client/src/assets/modals/chrysalis/message/tree.json index 7ce0abf29..dc67c2b13 100644 --- a/client/src/assets/modals/chrysalis/message/tree.json +++ b/client/src/assets/modals/chrysalis/message/tree.json @@ -2,10 +2,10 @@ "title": "Message Tree", "description": "

A message directly references up to 8 previous messages that we call its parents. As a message has parent messages, it also has children (the messages the parent references).

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/learn/glossary#p", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/learn/glossary#p", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/identity-resolver/content.json b/client/src/assets/modals/identity-resolver/content.json index 5653af33b..8cc09c9e6 100644 --- a/client/src/assets/modals/identity-resolver/content.json +++ b/client/src/assets/modals/identity-resolver/content.json @@ -2,10 +2,10 @@ "title": "Content", "description": "

A set of data describing the DID subject, including mechanisms, such as public keys and pseudonymous biometrics, that the DID subject or a DID delegate can use to authenticate itself and prove its association with the DID. A DID document may also contain other attributes or claims describing the DID subject. A DID document may have one or more different representations as defined in the W3C DID Specification Registries W3C DID Specification Registries.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/identity.rs/glossary#did-document", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/identity.rs/glossary#did-document", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/identity-resolver/welcome.json b/client/src/assets/modals/identity-resolver/welcome.json index 917235f09..b70442176 100644 --- a/client/src/assets/modals/identity-resolver/welcome.json +++ b/client/src/assets/modals/identity-resolver/welcome.json @@ -2,10 +2,10 @@ "title": "Decentralized identifier", "description": "

Decentralized Identity or Self-Sovereign Identity (SSI) defines a new method for identity management and authentication. It removes the centralized aspects and puts the Identity subject in full control over its own identity. Decentralized identity provides a solution for the increasing amount of database breaches, the lack of trust in any digital setting, and the increasingly difficult to comply with privacy legislation, such as GDPR.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/identity.rs/decentralized_identity", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/identity.rs/decentralized_identity", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/legacy/search/main-header.json b/client/src/assets/modals/legacy/search/main-header.json index 91b779577..e23a06520 100644 --- a/client/src/assets/modals/legacy/search/main-header.json +++ b/client/src/assets/modals/legacy/search/main-header.json @@ -1,4 +1,4 @@ { "title": "Search Criteria", "description": "

All searches must be either valid Trytes (letters A-Z + the number 9) or numeric.
The following formats are supported:

  1. Tags <= 27 Trytes
  2. Transactions 81 Trytes
  3. Bundles 81 or 90 Trytes (Checksum)
  4. Milestone Index Numeric
" -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/address/assets-in-wallet.json b/client/src/assets/modals/stardust/address/assets-in-wallet.json index c65dadecb..4416f8327 100644 --- a/client/src/assets/modals/stardust/address/assets-in-wallet.json +++ b/client/src/assets/modals/stardust/address/assets-in-wallet.json @@ -2,10 +2,10 @@ "title": "Assets in wallet", "description": "

Besides the base tokens, your address can also own native tokens. You can think of them as of a custom currency.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/tokenization", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/tokenization", + "isExternal": true + } ] -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/address/associated-outputs.json b/client/src/assets/modals/stardust/address/associated-outputs.json index ed235a587..1149f3413 100644 --- a/client/src/assets/modals/stardust/address/associated-outputs.json +++ b/client/src/assets/modals/stardust/address/associated-outputs.json @@ -1,4 +1,4 @@ { "title": "Associated Outputs", "description": "

All outputs that have unlock conditions or features which refer to this address.

" -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/address/main-header.json b/client/src/assets/modals/stardust/address/main-header.json index 11dbd696e..45f1590b0 100644 --- a/client/src/assets/modals/stardust/address/main-header.json +++ b/client/src/assets/modals/stardust/address/main-header.json @@ -2,10 +2,10 @@ "title": "Address", "description": "

Addresses are similar to a personal account, something viewable and sendable to people you want to do business with. This personal account belongs to a seed. In the world of cryptography, a seed refers to a 'private key'. Simply put, you have the seed (your private key) keeping your address (your account) safe.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/iota.rs/explanations/address_key_space", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/iota.rs/explanations/address_key_space", + "isExternal": true + } ] -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/address/nfts-in-wallet.json b/client/src/assets/modals/stardust/address/nfts-in-wallet.json index b24741ff0..f21e2ca9a 100644 --- a/client/src/assets/modals/stardust/address/nfts-in-wallet.json +++ b/client/src/assets/modals/stardust/address/nfts-in-wallet.json @@ -2,10 +2,10 @@ "title": "Non-fungible Tokens (NFTs)", "description": "

Non-fungible tokens are unique, cannot be mixed with other tokens, and store some immutable data.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/tokenization#non-fungible-tokens-nfts", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/tokenization#non-fungible-tokens-nfts", + "isExternal": true + } ] -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/address/transaction-history.json b/client/src/assets/modals/stardust/address/transaction-history.json index 9ff69bc53..738d94a1f 100644 --- a/client/src/assets/modals/stardust/address/transaction-history.json +++ b/client/src/assets/modals/stardust/address/transaction-history.json @@ -3,9 +3,9 @@ "description": "

The history of all transactions for this address. It displays all blocks that consume or create outputs targeting this address.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers#transfer-of-funds", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers#transfer-of-funds", + "isExternal": true } ] } diff --git a/client/src/assets/modals/stardust/alias/did.json b/client/src/assets/modals/stardust/alias/did.json index d2f227bbb..60770a7ae 100644 --- a/client/src/assets/modals/stardust/alias/did.json +++ b/client/src/assets/modals/stardust/alias/did.json @@ -2,10 +2,10 @@ "title": "Decentralized identifier", "description": "

Decentralized Identity or Self-Sovereign Identity (SSI) defines a new method for identity management and authentication. It removes the centralized aspects and puts the Identity subject in full control over its own identity. Decentralized identity provides a solution for the increasing amount of database breaches, the lack of trust in any digital setting, and the increasingly difficult to comply with privacy legislation, such as GDPR.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/identity.rs/welcome/", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/identity.rs/welcome/", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/alias/foundries.json b/client/src/assets/modals/stardust/alias/foundries.json index 046505484..67691c11e 100644 --- a/client/src/assets/modals/stardust/alias/foundries.json +++ b/client/src/assets/modals/stardust/alias/foundries.json @@ -2,10 +2,10 @@ "title": "Native Tokens and Foundries", "description": "

This is the list of the token foundries that this alias output controls. They manage the supply of the native tokens on the network.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/foundry", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/foundry", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/alias/main-header.json b/client/src/assets/modals/stardust/alias/main-header.json index 356ba1cc8..fc23627b6 100644 --- a/client/src/assets/modals/stardust/alias/main-header.json +++ b/client/src/assets/modals/stardust/alias/main-header.json @@ -2,10 +2,10 @@ "title": "Alias Transactions", "description": "

Aliases offer multiple additional features that make advanced features of the protocol work: smart contract chains, native tokens and NFTs all require alias outputs.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/alias", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/alias", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/alias/state.json b/client/src/assets/modals/stardust/alias/state.json index 6cf4b2325..6909d0faf 100644 --- a/client/src/assets/modals/stardust/alias/state.json +++ b/client/src/assets/modals/stardust/alias/state.json @@ -2,10 +2,10 @@ "title": "State Transition", "description": "

During the state transaction, the state controller of the alias output increases the state counter and changes the state metadata. There can be only one valid state at a time — the one that is defined in the alias output that wasn't yet consumed.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/alias#state-transition", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/alias#state-transition", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/block/main-header.json b/client/src/assets/modals/stardust/block/main-header.json index 80401d68f..efa6875f3 100644 --- a/client/src/assets/modals/stardust/block/main-header.json +++ b/client/src/assets/modals/stardust/block/main-header.json @@ -2,10 +2,10 @@ "title": "Block", "description": "

Blocks are atomic units that make the Tangle. By inluding blocks in the Tangle, nodes agree on which outputs are created and consumed, changing the balance of tokens in the network. Blocks can convey other data, too.

", "links": [ - { - "label": "Read more", - "href": "https://github.com/Wollac/protocol-rfcs/blob/tangle-message-data/tips/TIP-0024/tip-0024.md", - "isExternal": true - } + { + "label": "Read more", + "href": "https://github.com/Wollac/protocol-rfcs/blob/tangle-message-data/tips/TIP-0024/tip-0024.md", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/block/metadata.json b/client/src/assets/modals/stardust/block/metadata.json index 27fc657c0..f7f9c37fb 100644 --- a/client/src/assets/modals/stardust/block/metadata.json +++ b/client/src/assets/modals/stardust/block/metadata.json @@ -3,9 +3,9 @@ "description": "

Nodes can store additional information about blocks: if a node considers a block valid, the time when it received a block, and which timestamp should be attached to it. This information is not part of the Tangle and is not synchronized between the nodes: the block metadata reflects each node's local perception and differs between the nodes.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/IOTA-2.0-Research-Specifications/2.2MessageLayout#226-metadata", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/IOTA-2.0-Research-Specifications/2.2MessageLayout#226-metadata", + "isExternal": true } ] } diff --git a/client/src/assets/modals/stardust/block/milestone-payload.json b/client/src/assets/modals/stardust/block/milestone-payload.json index ebb69c83b..e08d39cb8 100644 --- a/client/src/assets/modals/stardust/block/milestone-payload.json +++ b/client/src/assets/modals/stardust/block/milestone-payload.json @@ -2,10 +2,10 @@ "title": "Milestone Payload", "description": "

This block is a milestone. To be valid, all blocks must directly or indirectly refer to one of the milestones that are issued by the Coordinator node of the network.

", "links": [ - { - "label": "Read more", - "href": "https://github.com/iotaledger/tips/blob/milestone-with-signature-blocks/tips/TIP-0029/tip-0029.md", - "isExternal": true - } + { + "label": "Read more", + "href": "https://github.com/iotaledger/tips/blob/milestone-with-signature-blocks/tips/TIP-0029/tip-0029.md", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/block/milestone-referenced-blocks.json b/client/src/assets/modals/stardust/block/milestone-referenced-blocks.json index d9ce25b74..48be1937c 100644 --- a/client/src/assets/modals/stardust/block/milestone-referenced-blocks.json +++ b/client/src/assets/modals/stardust/block/milestone-referenced-blocks.json @@ -2,4 +2,3 @@ "title": "Milestone Referenced Blocks", "description": "

The blocks that are confirmed by this Milestone.

" } - diff --git a/client/src/assets/modals/stardust/block/tagged-data-payload.json b/client/src/assets/modals/stardust/block/tagged-data-payload.json index 48b375140..ccbd807b1 100644 --- a/client/src/assets/modals/stardust/block/tagged-data-payload.json +++ b/client/src/assets/modals/stardust/block/tagged-data-payload.json @@ -2,10 +2,10 @@ "title": "Tagged Data Payload", "description": "

This block has some tagged data. Indexers can filter out blocks that have the same tag, simplifying some practical applications of the network. For example, the participation plugin collects all blocks that have a tag matching the voting event ID and parse the data behind that tag to calculate the result.

", "links": [ - { - "label": "Read more", - "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0023/tip-0023.md", - "isExternal": true - } + { + "label": "Read more", + "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0023/tip-0023.md", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/block/transaction-payload.json b/client/src/assets/modals/stardust/block/transaction-payload.json index 010720495..5646799df 100644 --- a/client/src/assets/modals/stardust/block/transaction-payload.json +++ b/client/src/assets/modals/stardust/block/transaction-payload.json @@ -2,10 +2,10 @@ "title": "Transaction Payload", "description": "

This block is a transaction: the outputs on the left got consumed to create outputs on the right. You can find the owners of the new outputs in their address unlock conditions.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/foundry/main-header.json b/client/src/assets/modals/stardust/foundry/main-header.json index ec89cbce9..b7599fcb1 100644 --- a/client/src/assets/modals/stardust/foundry/main-header.json +++ b/client/src/assets/modals/stardust/foundry/main-header.json @@ -2,10 +2,10 @@ "title": "Foundry", "description": "

Stardust introduces the concept of native tokens, or also called user-defined custom tokens. These tokens are minted into existence by token foundries, represented as Foundry Outputs on protocol level. The foundry defines the supply control rules, that is, how many tokens can ever be created.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/foundry", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/foundry", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/nft/main-header.json b/client/src/assets/modals/stardust/nft/main-header.json index bf5241900..6a33575fb 100644 --- a/client/src/assets/modals/stardust/nft/main-header.json +++ b/client/src/assets/modals/stardust/nft/main-header.json @@ -2,10 +2,10 @@ "title": "NFT as a wallet", "description": "

NFT addresses are how non-fungible tokens are implemented in the protocol. Each NFT address stores some immutable data and is controlled by another address (for example, by someone's wallet).

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/nft", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/nft", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/nft/metadata.json b/client/src/assets/modals/stardust/nft/metadata.json index 3d6df1920..a98478ee9 100644 --- a/client/src/assets/modals/stardust/nft/metadata.json +++ b/client/src/assets/modals/stardust/nft/metadata.json @@ -3,9 +3,9 @@ "description": "

IRC27 is a series of standards to support interoperable and universal NFT systems throughout the IOTA ecosystem, to provide a more robust and secure system for creators and buyers.

", "links": [ { - "label": "Read more", - "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0027/tip-0027.md", - "isExternal": true + "label": "Read more", + "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0027/tip-0027.md", + "isExternal": true } ] -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/output/main-header.json b/client/src/assets/modals/stardust/output/main-header.json index 240a99a9d..04793f2ce 100644 --- a/client/src/assets/modals/stardust/output/main-header.json +++ b/client/src/assets/modals/stardust/output/main-header.json @@ -2,10 +2,10 @@ "title": "Output", "description": "

Unspent outputs define the owner of the tokens, the kind of tokens and their amount, as well as conditions by which you can unlock them.

", "links": [ - { - "label": "Read more", - "href": "http://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/rethink_utxo", - "isExternal": true - } + { + "label": "Read more", + "href": "http://wiki.iota.org/shimmer/introduction/explanations/what_is_stardust/rethink_utxo", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/participation/main-header.json b/client/src/assets/modals/stardust/participation/main-header.json index 84cf6be5b..57ee3e589 100644 --- a/client/src/assets/modals/stardust/participation/main-header.json +++ b/client/src/assets/modals/stardust/participation/main-header.json @@ -2,10 +2,10 @@ "title": "Voting", "description": "

IOTA and Shimmer provides a system for community members to create and vote on ballots. On-Tangle voting enables token-holders to participate in voting or staking events.

", "links": [ - { - "label": "Read more", - "href": "https://github.com/iota-community/treasury/blob/main/specifications/hornet-participation-plugin.md#structure-of-the-participation", - "isExternal": true - } + { + "label": "Read more", + "href": "https://github.com/iota-community/treasury/blob/main/specifications/hornet-participation-plugin.md#structure-of-the-participation", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/stardust/search/main-header.json b/client/src/assets/modals/stardust/search/main-header.json index ad818cc6b..fd935a71b 100644 --- a/client/src/assets/modals/stardust/search/main-header.json +++ b/client/src/assets/modals/stardust/search/main-header.json @@ -1,4 +1,4 @@ { "title": "Search Criteria", "description": "

All hex searches work with and without 0x prefix.
The following formats are supported:

  1. Blocks 64 Hex characters
  2. Block using Transaction Id 64 Hex characters
  3. Addresses Bech32 Format
  4. Nft/Alias Addresses 66 Hex characters or Bech32 Format
  5. Outputs 68 Hex characters
  6. Alias Id 64 Hex characters
  7. Foundry Id 76 Hex characters
  8. Token Id 76 Hex characters
  9. NFT Id 64 Hex characters
  10. Milestone Id 64 Hex characters
  11. Milestone Index Numeric
  12. DID 64 Hex characters starting with did:iota:<network>:
" -} \ No newline at end of file +} diff --git a/client/src/assets/modals/stardust/statistics/graphs.json b/client/src/assets/modals/stardust/statistics/graphs.json index 5a3fe2bfe..c2a00cbc7 100644 --- a/client/src/assets/modals/stardust/statistics/graphs.json +++ b/client/src/assets/modals/stardust/statistics/graphs.json @@ -4,9 +4,9 @@ "description": "

Shimmer nodes issue blocks to exchange data, including the information about token transactions. The higher readings could indicate a higher overall activity on the network.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#blocks-and-outputs", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#blocks-and-outputs", + "isExternal": true } ] }, @@ -15,9 +15,9 @@ "description": "

How many blocks the network has issued in a day. The values are separated by the block payload type.

", "links": [ { - "label": "Read more", - "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0024/tip-0024.md#payloads", - "isExternal": true + "label": "Read more", + "href": "https://github.com/iotaledger/tips/blob/main/tips/TIP-0024/tip-0024.md#payloads", + "isExternal": true } ] }, @@ -26,9 +26,9 @@ "description": "

How many transactions the network has processed in a day. The values are separated between confirmed transactions and conflicting transactions (these were rejected).

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", + "isExternal": true } ] }, @@ -37,9 +37,9 @@ "description": "

Shimmer tracks token ownership through outputs. As transactions create new outputs and exhaust the old ones, the total amount of base tokens stays the same, but their owners change. Outputs of special types are also used for NFTs, foundries, and aliases.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#blocks-and-outputs", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#blocks-and-outputs", + "isExternal": true } ] }, @@ -48,9 +48,9 @@ "description": "

How many outputs are there of each output type. The more special outputs there are, the more NFTs, native assets, and smart contract chains is there on the network.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs/#output-types", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs/#output-types", + "isExternal": true } ] }, @@ -59,9 +59,9 @@ "description": "

The base token distribution by each output type on a given day. The base tokens that belong to outputs of the special types are mostly locked as security deposits.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", + "isExternal": true } ] }, @@ -70,9 +70,9 @@ "description": "

Addresses own unspent outputs, and the sum of the tokens in these outputs makes the balance of the address. As each wallet has multiple addresses, and a person can have multiple wallets, this data does not represent the number of the Shimmer users, but it could correlate with it.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", + "isExternal": true } ] }, @@ -81,9 +81,9 @@ "description": "

The total number of addresses that are referenced by unspent outputs, which is measured daily.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", + "isExternal": true } ] }, @@ -92,9 +92,9 @@ "description": "

The total number of addresses that are referenced by unspent outputs, which is measured daily.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", + "isExternal": true } ] }, @@ -103,9 +103,9 @@ "description": "

How many addresses sent or received a transaction in a day.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", + "isExternal": true } ] }, @@ -114,9 +114,9 @@ "description": "

The volume of transactions in base tokens in a day.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/data-and-value-transfer", + "isExternal": true } ] }, @@ -125,9 +125,9 @@ "description": "

The activity on the network that is associated with things like minting and sending NFTs, or updating the state of an alias output.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs", + "isExternal": true } ] }, @@ -136,9 +136,9 @@ "description": "

The daily activity over all alias outputs. It counts the network changes that involve alias outputs and group them by their nature: how many alias outputs were created and destroyed, how many times governors changed, and how many times alias states were updated.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs/#alias-output", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs/#alias-output", + "isExternal": true } ] }, @@ -147,9 +147,9 @@ "description": "

The daily activity over all NFT outputs. It counts the network changes that involve NFT outputs and group them by their nature: how many NFT outputs were created and destroyed, and how many times had they change hands.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs/#nft-output", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs/#nft-output", + "isExternal": true } ] }, @@ -158,9 +158,9 @@ "description": "

Outputs can limit access to their associated tokens through unlock conditions. They are commonly used to relieve the old storage deposit with the tokens of the new owner, or to limit the output by the time when it is should be claimed.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#unlock-conditions-addresses-and-seeds", + "isExternal": true } ] }, @@ -169,9 +169,9 @@ "description": "

The total amount of outputs that have unlock conditions, by the condition type.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs/#unlock-conditions", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs/#unlock-conditions", + "isExternal": true } ] }, @@ -180,9 +180,9 @@ "description": "

The total amount of base tokens that are locked by the unlock conditions, by the condition type.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/outputs/#unlock-conditions", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/outputs/#unlock-conditions", + "isExternal": true } ] }, @@ -191,9 +191,9 @@ "description": "

Genesis was the initial distribution of the tokens on the Shimmer network. It includes the rewards from the staking on the IOTA network which happened before the Shimmer launch.

", "links": [ { - "label": "Read more", - "href": "https://blog.shimmer.network/shimmer-network-and-token-launch", - "isExternal": true + "label": "Read more", + "href": "https://blog.shimmer.network/shimmer-network-and-token-launch", + "isExternal": true } ] }, @@ -202,9 +202,9 @@ "description": "

The total amount of tokens that are locked behind the unclaimed outputs that were created by the Genesis transaction. Once a token owner issues a transaction that consumes one of these outputs, we count these tokens as claimed.

", "links": [ { - "label": "Read more", - "href": "https://blog.shimmer.network/how-to-claim-smr-firefly", - "isExternal": true + "label": "Read more", + "href": "https://blog.shimmer.network/how-to-claim-smr-firefly", + "isExternal": true } ] }, @@ -213,9 +213,9 @@ "description": "

The total amount of unclaimed outputs that were created by the Genesis transaction. Once a token owner issues a transaction that consumes one of these outputs, we count that output as claimed.

", "links": [ { - "label": "Read more", - "href": "https://blog.shimmer.network/how-to-claim-smr-firefly", - "isExternal": true + "label": "Read more", + "href": "https://blog.shimmer.network/how-to-claim-smr-firefly", + "isExternal": true } ] }, @@ -224,9 +224,9 @@ "description": "

The statistics about the data storage on the network. The total storage is limited, but the more base tokens an output has, the more information it can store. This is called the storage deposit.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", + "isExternal": true } ] }, @@ -239,9 +239,9 @@ "description": "

The total amount of base tokens that are locked as the storage deposit.

", "links": [ { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", - "isExternal": true + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/learn/welcome/#storage-deposits", + "isExternal": true } ] } diff --git a/client/src/assets/modals/stardust/transaction/main-header.json b/client/src/assets/modals/stardust/transaction/main-header.json index a37f1a80a..cd6216450 100644 --- a/client/src/assets/modals/stardust/transaction/main-header.json +++ b/client/src/assets/modals/stardust/transaction/main-header.json @@ -2,10 +2,10 @@ "title": "Transaction", "description": "

Transaction payloads consume existing outputs and create new ones with new owners, effectively moving the tokens around the network.

", "links": [ - { - "label": "Read more", - "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers", - "isExternal": true - } + { + "label": "Read more", + "href": "https://wiki.iota.org/shimmer/introduction/explanations/ledger/simple_transfers", + "isExternal": true + } ] } diff --git a/client/src/assets/modals/visualizer/main-header.json b/client/src/assets/modals/visualizer/main-header.json index c352d3061..d9dc83df6 100644 --- a/client/src/assets/modals/visualizer/main-header.json +++ b/client/src/assets/modals/visualizer/main-header.json @@ -1,4 +1,4 @@ { "title": "Visualizer", "description": "

The visualizer tool shows new transactions and how do they get attached to the Tangle in real time.

" -} \ No newline at end of file +} diff --git a/client/src/assets/schemas/nft-schema-IRC27.json b/client/src/assets/schemas/nft-schema-IRC27.json index 0d065a6ef..5f158dfd3 100644 --- a/client/src/assets/schemas/nft-schema-IRC27.json +++ b/client/src/assets/schemas/nft-schema-IRC27.json @@ -42,18 +42,9 @@ "description": "name of the artist" }, "attributes": { - "oneOf": [ - { "type": "object" }, - { "type": "array"} - ], + "oneOf": [{ "type": "object" }, { "type": "array" }], "description": "array containing any additional data as objects." } }, - "required": [ - "standard", - "type", - "version", - "uri", - "name" - ] -} \ No newline at end of file + "required": ["standard", "type", "version", "uri", "name"] +} diff --git a/client/src/assets/schemas/token-schema-IRC30.json b/client/src/assets/schemas/token-schema-IRC30.json index 98f0bc542..d762113f3 100644 --- a/client/src/assets/schemas/token-schema-IRC30.json +++ b/client/src/assets/schemas/token-schema-IRC30.json @@ -1,48 +1,42 @@ { - "title": "IRC30 Native Token Metadata Schema", - "description": "A JSON schema for validating IRC30 compliant native token metadata", - "type": "object", - "properties": { - "standard": { - "description": "The IRC standard of the token metadata", - "type": "string", - "pattern": "^IRC30$" + "title": "IRC30 Native Token Metadata Schema", + "description": "A JSON schema for validating IRC30 compliant native token metadata", + "type": "object", + "properties": { + "standard": { + "description": "The IRC standard of the token metadata", + "type": "string", + "pattern": "^IRC30$" + }, + "name": { + "description": "The human-readable name of the native token", + "type": "string" + }, + "description": { + "description": "The human-readable description of the token", + "type": "string" + }, + "symbol": { + "description": "The symbol/ticker of the token", + "type": "string" + }, + "decimals": { + "description": "Number of decimals the token uses (divide the token amount by decimals to get its user representation)", + "type": "integer", + "minimum": 0 + }, + "url": { + "description": "URL pointing to more resources about the token", + "type": "string" + }, + "logoUrl": { + "description": "URL pointing to an image resource of the token logo", + "type": "string" + }, + "logo": { + "description": "The logo of the token encoded as a byte string", + "type": "string" + } }, - "name": { - "description": "The human-readable name of the native token", - "type": "string" - }, - "description": { - "description": "The human-readable description of the token", - "type": "string" - }, - "symbol": { - "description": "The symbol/ticker of the token", - "type": "string" - }, - "decimals": { - "description": "Number of decimals the token uses (divide the token amount by decimals to get its user representation)", - "type": "integer", - "minimum": 0 - }, - "url": { - "description": "URL pointing to more resources about the token", - "type": "string" - }, - "logoUrl": { - "description": "URL pointing to an image resource of the token logo", - "type": "string" - }, - "logo": { - "description": "The logo of the token encoded as a byte string", - "type": "string" - } - }, - "required": [ - "standard", - "name", - "symbol", - "decimals" - ] + "required": ["standard", "name", "symbol", "decimals"] } - diff --git a/client/src/helpers/bigDecimal.ts b/client/src/helpers/bigDecimal.ts index 2dbea2068..ecbd1d043 100644 --- a/client/src/helpers/bigDecimal.ts +++ b/client/src/helpers/bigDecimal.ts @@ -19,40 +19,29 @@ export default class BigDecimal { const [whole, fraction] = value.split(".").concat(""); this.decimals = decimals; this.rounded = rounded; - this.n = BigInt( - whole + fraction.padEnd(this.decimals, "0").slice(0, this.decimals) - ) + BigInt(this.rounded && fraction[this.decimals] >= "5"); + this.n = + BigInt(whole + fraction.padEnd(this.decimals, "0").slice(0, this.decimals)) + + BigInt(this.rounded && fraction[this.decimals] >= "5"); } public static fromBigInt(bigint: bigint, decimals = 0, rounded = false): BigDecimal { - return Object.assign( - Object.create(BigDecimal.prototype), - { n: bigint, decimals, rounded } - ) as BigDecimal; + return Object.assign(Object.create(BigDecimal.prototype), { n: bigint, decimals, rounded }) as BigDecimal; } public divRound(dividend: bigint, divisor: bigint): BigDecimal { return BigDecimal.fromBigInt( - (dividend / divisor) + (this.rounded ? dividend * 2n / divisor % 2n : 0n), + dividend / divisor + (this.rounded ? ((dividend * 2n) / divisor) % 2n : 0n), this.decimals, - this.rounded + this.rounded, ); } public add(other: string): BigDecimal { - return BigDecimal.fromBigInt( - this.n + new BigDecimal(other, this.decimals, this.rounded).n, - this.decimals, - this.rounded - ); + return BigDecimal.fromBigInt(this.n + new BigDecimal(other, this.decimals, this.rounded).n, this.decimals, this.rounded); } public subtract(other: string): BigDecimal { - return BigDecimal.fromBigInt( - this.n - new BigDecimal(other, this.decimals, this.rounded).n, - this.decimals, - this.rounded - ); + return BigDecimal.fromBigInt(this.n - new BigDecimal(other, this.decimals, this.rounded).n, this.decimals, this.rounded); } public multiply(other: string): BigDecimal { diff --git a/client/src/helpers/chrysalis/bech32AddressHelper.ts b/client/src/helpers/chrysalis/bech32AddressHelper.ts index 0b04e6442..05225fef6 100644 --- a/client/src/helpers/chrysalis/bech32AddressHelper.ts +++ b/client/src/helpers/chrysalis/bech32AddressHelper.ts @@ -23,8 +23,7 @@ export class Bech32AddressHelper { type = result.addressType; hex = Converter.bytesToHex(result.addressBytes); } - } catch { - } + } catch {} } if (!bech32) { @@ -38,7 +37,7 @@ export class Bech32AddressHelper { bech32, hex, type, - typeLabel: Bech32AddressHelper.typeLabel(type) + typeLabel: Bech32AddressHelper.typeLabel(type), }; } diff --git a/client/src/helpers/chrysalis/transactionsHelper.ts b/client/src/helpers/chrysalis/transactionsHelper.ts index f45ccc25e..3ddf75272 100644 --- a/client/src/helpers/chrysalis/transactionsHelper.ts +++ b/client/src/helpers/chrysalis/transactionsHelper.ts @@ -1,5 +1,19 @@ import { Blake2b } from "@iota/crypto.js"; -import { Ed25519Address, ED25519_ADDRESS_TYPE, IMessage, IReferenceUnlockBlock, ISignatureUnlockBlock, IUTXOInput, REFERENCE_UNLOCK_BLOCK_TYPE, SIGNATURE_UNLOCK_BLOCK_TYPE, SIG_LOCKED_DUST_ALLOWANCE_OUTPUT_TYPE, SIG_LOCKED_SINGLE_OUTPUT_TYPE, TRANSACTION_PAYLOAD_TYPE, serializeTransactionPayload, ITransactionPayload } from "@iota/iota.js"; +import { + Ed25519Address, + ED25519_ADDRESS_TYPE, + IMessage, + IReferenceUnlockBlock, + ISignatureUnlockBlock, + IUTXOInput, + REFERENCE_UNLOCK_BLOCK_TYPE, + SIGNATURE_UNLOCK_BLOCK_TYPE, + SIG_LOCKED_DUST_ALLOWANCE_OUTPUT_TYPE, + SIG_LOCKED_SINGLE_OUTPUT_TYPE, + TRANSACTION_PAYLOAD_TYPE, + serializeTransactionPayload, + ITransactionPayload, +} from "@iota/iota.js"; import { Converter, WriteStream } from "@iota/util.js"; import { DateHelper } from "~helpers/dateHelper"; import { IBech32AddressDetails } from "~models/api/IBech32AddressDetails"; @@ -18,19 +32,25 @@ interface Input { } interface Output { - index: number; type: 0 | 1; address: IBech32AddressDetails; amount: number; isRemainder: boolean; + index: number; + type: 0 | 1; + address: IBech32AddressDetails; + amount: number; + isRemainder: boolean; } export class TransactionsHelper { public static async getInputsAndOutputs( transactionMessage: IMessage | undefined, - network: string, _bechHrp: string, tangleCacheService: ChrysalisTangleCacheService): - Promise<{ - inputs: (IUTXOInput & Input)[]; - outputs: Output[]; - unlockAddresses: IBech32AddressDetails[]; - transferTotal: number; - }> { + network: string, + _bechHrp: string, + tangleCacheService: ChrysalisTangleCacheService, + ): Promise<{ + inputs: (IUTXOInput & Input)[]; + outputs: Output[]; + unlockAddresses: IBech32AddressDetails[]; + transferTotal: number; + }> { const inputs: (IUTXOInput & Input)[] = []; const outputs: Output[] = []; let transferTotal = 0; @@ -46,9 +66,7 @@ export class TransactionsHelper { signatureBlocks.push(sigUnlockBlock); } else if (transactionMessage.payload.unlockBlocks[i].type === REFERENCE_UNLOCK_BLOCK_TYPE) { const refUnlockBlock = transactionMessage.payload.unlockBlocks[i] as IReferenceUnlockBlock; - signatureBlocks.push( - transactionMessage.payload.unlockBlocks[refUnlockBlock.reference] as ISignatureUnlockBlock - ); + signatureBlocks.push(transactionMessage.payload.unlockBlocks[refUnlockBlock.reference] as ISignatureUnlockBlock); } } @@ -56,13 +74,9 @@ export class TransactionsHelper { unlockAddresses.push( Bech32AddressHelper.buildAddress( _bechHrp, - Converter.bytesToHex( - new Ed25519Address(Converter.hexToBytes(signatureBlocks[i].signature.publicKey)) - .toAddress() - ), - signatureBlocks[i].type === SIGNATURE_UNLOCK_BLOCK_TYPE - ? ED25519_ADDRESS_TYPE : undefined - ) + Converter.bytesToHex(new Ed25519Address(Converter.hexToBytes(signatureBlocks[i].signature.publicKey)).toAddress()), + signatureBlocks[i].type === SIGNATURE_UNLOCK_BLOCK_TYPE ? ED25519_ADDRESS_TYPE : undefined, + ), ); } @@ -73,11 +87,9 @@ export class TransactionsHelper { writeOutputStream.writeUInt16("transactionOutputIndex", input.transactionOutputIndex); const outputHash = `${input.transactionId}${writeOutputStream.finalHex()}`; const transactionOutputIndex = input.transactionOutputIndex; - const transactionResult = await tangleCacheService.search( - network, input.transactionId); + const transactionResult = await tangleCacheService.search(network, input.transactionId); let amount = 0; - if (transactionResult?.message && transactionResult?.message.payload?.type === - TRANSACTION_PAYLOAD_TYPE) { + if (transactionResult?.message && transactionResult?.message.payload?.type === TRANSACTION_PAYLOAD_TYPE) { amount = transactionResult.message.payload?.essence.outputs[transactionOutputIndex].amount; } inputs.push({ @@ -88,25 +100,28 @@ export class TransactionsHelper { transactionUrl: `/${network}/search/${outputHash}`, transactionAddress: unlockAddresses[i], signature: signatureBlocks[i].signature.signature, - publicKey: signatureBlocks[i].signature.publicKey + publicKey: signatureBlocks[i].signature.publicKey, }); } let remainderIndex = 1000; for (let i = 0; i < transactionMessage.payload.essence.outputs.length; i++) { - if (transactionMessage.payload.essence.outputs[i].type === SIG_LOCKED_SINGLE_OUTPUT_TYPE || - transactionMessage.payload.essence.outputs[i].type === SIG_LOCKED_DUST_ALLOWANCE_OUTPUT_TYPE) { + if ( + transactionMessage.payload.essence.outputs[i].type === SIG_LOCKED_SINGLE_OUTPUT_TYPE || + transactionMessage.payload.essence.outputs[i].type === SIG_LOCKED_DUST_ALLOWANCE_OUTPUT_TYPE + ) { const address = Bech32AddressHelper.buildAddress( _bechHrp, transactionMessage.payload.essence.outputs[i].address.address, - transactionMessage.payload.essence.outputs[i].address.type); - const isRemainder = inputs.some(input => input.transactionAddress.bech32 === address.bech32); + transactionMessage.payload.essence.outputs[i].address.type, + ); + const isRemainder = inputs.some((input) => input.transactionAddress.bech32 === address.bech32); outputs.push({ - index: isRemainder ? (remainderIndex++) + i : i, + index: isRemainder ? remainderIndex++ + i : i, type: transactionMessage.payload.essence.outputs[i].type, address, amount: transactionMessage.payload.essence.outputs[i].amount, - isRemainder + isRemainder, }); if (!isRemainder) { transferTotal += transactionMessage.payload.essence.outputs[i].amount; @@ -115,18 +130,15 @@ export class TransactionsHelper { } for (let i = 0; i < inputs.length; i++) { - const outputResponse = await tangleCacheService.outputDetails( - network, inputs[i].outputHash - ); + const outputResponse = await tangleCacheService.outputDetails(network, inputs[i].outputHash); if (outputResponse?.output) { inputs[i].transactionAddress = Bech32AddressHelper.buildAddress( _bechHrp, outputResponse.output.address.address, - outputResponse.output.address.type + outputResponse.output.address.type, ); - inputs[i].transactionUrl = - `/${network}/message/${outputResponse.messageId}`; + inputs[i].transactionUrl = `/${network}/message/${outputResponse.messageId}`; } } @@ -145,12 +157,11 @@ export class TransactionsHelper { public static async getMessageStatus( network: string, messageId: string, - tangleCacheService: ChrysalisTangleCacheService + tangleCacheService: ChrysalisTangleCacheService, ): Promise<{ messageTangleStatus: TangleStatus; date: string }> { let messageTangleStatus: TangleStatus = "unknown"; let date: string = ""; - const details = await tangleCacheService.messageDetails( - network, messageId ?? ""); + const details = await tangleCacheService.messageDetails(network, messageId ?? ""); if (details) { if (details?.metadata) { if (details.metadata.milestoneIndex) { @@ -163,8 +174,7 @@ export class TransactionsHelper { } const milestoneIndex = details?.metadata?.referencedByMilestoneIndex; if (milestoneIndex) { - const result = await tangleCacheService.milestoneDetails( - network, milestoneIndex); + const result = await tangleCacheService.milestoneDetails(network, milestoneIndex); if (result?.timestamp) { date = DateHelper.formatShort(DateHelper.milliseconds(result.timestamp)); } diff --git a/client/src/helpers/downloadHelper.ts b/client/src/helpers/downloadHelper.ts index beef70beb..e663280e7 100644 --- a/client/src/helpers/downloadHelper.ts +++ b/client/src/helpers/downloadHelper.ts @@ -20,7 +20,7 @@ export class DownloadHelper { * @returns The data url. */ public static createJsonDataUrl(object: unknown): string { - const b64 = Converter.bytesToBase64(Converter.utf8ToBytes((JSON.stringify(object, undefined, "\t")))); + const b64 = Converter.bytesToBase64(Converter.utf8ToBytes(JSON.stringify(object, undefined, "\t"))); return `data:application/json;base64,${b64}`; } diff --git a/client/src/helpers/fetchHelper.ts b/client/src/helpers/fetchHelper.ts index edc364c88..59d572aae 100644 --- a/client/src/helpers/fetchHelper.ts +++ b/client/src/helpers/fetchHelper.ts @@ -1,4 +1,3 @@ - /** * Fetch from an endpoint. */ @@ -19,7 +18,7 @@ export class FetchHelper { method: "get" | "post" | "put" | "delete", payload?: T, headers?: { [id: string]: string }, - timeout?: number + timeout?: number, ): Promise { headers ??= {}; headers["Content-Type"] = "application/json"; @@ -29,26 +28,20 @@ export class FetchHelper { if (timeout !== undefined) { controller = new AbortController(); - timerId = setTimeout( - () => { - if (controller) { - controller.abort(); - } - }, - timeout - ); + timerId = setTimeout(() => { + if (controller) { + controller.abort(); + } + }, timeout); } try { - const res = await fetch( - `${baseUrl.replace(/\/$/, "")}/${path.replace(/^\//, "")}`, - { - method, - headers, - body: payload ? JSON.stringify(payload) : undefined, - signal: controller ? controller.signal : undefined - } - ); + const res = await fetch(`${baseUrl.replace(/\/$/, "")}/${path.replace(/^\//, "")}`, { + method, + headers, + body: payload ? JSON.stringify(payload) : undefined, + signal: controller ? controller.signal : undefined, + }); const json = await res.json(); return json as U; @@ -77,7 +70,7 @@ export class FetchHelper { method: "get" | "post" | "put" | "delete", payload?: unknown, headers?: { [id: string]: string }, - timeout?: number + timeout?: number, ): Promise { headers ??= {}; @@ -86,26 +79,20 @@ export class FetchHelper { if (timeout !== undefined) { controller = new AbortController(); - timerId = setTimeout( - () => { - if (controller) { - controller.abort(); - } - }, - timeout - ); + timerId = setTimeout(() => { + if (controller) { + controller.abort(); + } + }, timeout); } try { - const response = await fetch( - `${baseUrl.replace(/\/$/, "")}/${path.replace(/^\//, "")}`, - { - method, - headers, - body: payload ? JSON.stringify(payload) : undefined, - signal: controller ? controller.signal : undefined - } - ); + const response = await fetch(`${baseUrl.replace(/\/$/, "")}/${path.replace(/^\//, "")}`, { + method, + headers, + body: payload ? JSON.stringify(payload) : undefined, + signal: controller ? controller.signal : undefined, + }); return response; } catch (err) { diff --git a/client/src/helpers/foundationDataHelper.tsx b/client/src/helpers/foundationDataHelper.tsx index 7e5f3089c..e72ca668e 100644 --- a/client/src/helpers/foundationDataHelper.tsx +++ b/client/src/helpers/foundationDataHelper.tsx @@ -68,24 +68,15 @@ export class FoundationDataHelper { url: string; }[]; }, - key?: Key): React.ReactNode { + key?: Key, + ): React.ReactNode { return ( {info.label && ( - + )} {info.value && ( - + )} {info.urls?.map((link, idx) => ( @@ -126,9 +117,7 @@ export class FoundationDataHelper { key={key} target="_blank" rel="noopener noreferrer" - dangerouslySetInnerHTML={ - { __html: FoundationDataHelper.buildLines(value) } - } + dangerouslySetInnerHTML={{ __html: FoundationDataHelper.buildLines(value) }} /> ); } @@ -138,9 +127,7 @@ export class FoundationDataHelper { className="data-link" key={key} to={url.replace("local:/", "")} - dangerouslySetInnerHTML={ - { __html: FoundationDataHelper.buildLines(value) } - } + dangerouslySetInnerHTML={{ __html: FoundationDataHelper.buildLines(value) }} /> ); } diff --git a/client/src/helpers/hooks/useAddressAliasOutputs.ts b/client/src/helpers/hooks/useAddressAliasOutputs.ts index 6cfb652d7..54d257651 100644 --- a/client/src/helpers/hooks/useAddressAliasOutputs.ts +++ b/client/src/helpers/hooks/useAddressAliasOutputs.ts @@ -11,9 +11,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param addressBech32 The address in bech32 format * @returns The output responses and loading bool. */ -export function useAddressAliasOutputs( - network: string, addressBech32: string | null -): [OutputResponse[] | null, boolean] { +export function useAddressAliasOutputs(network: string, addressBech32: string | null): [OutputResponse[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [outputs, setOutputs] = useState(null); @@ -25,13 +23,16 @@ export function useAddressAliasOutputs( if (addressBech32) { // eslint-disable-next-line no-void void (async () => { - apiClient.aliasOutputsDetails({ network, address: addressBech32 }).then(response => { - if (!response?.error && response.outputs && isMounted) { - setOutputs(response.outputs); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .aliasOutputsDetails({ network, address: addressBech32 }) + .then((response) => { + if (!response?.error && response.outputs && isMounted) { + setOutputs(response.outputs); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -40,4 +41,3 @@ export function useAddressAliasOutputs( return [outputs, isLoading]; } - diff --git a/client/src/helpers/hooks/useAddressBalance.ts b/client/src/helpers/hooks/useAddressBalance.ts index 43b4f2e24..f3946e62c 100644 --- a/client/src/helpers/hooks/useAddressBalance.ts +++ b/client/src/helpers/hooks/useAddressBalance.ts @@ -10,12 +10,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param address The bech32 address * @returns The address balance, signature locked balance and a loading bool. */ -export function useAddressBalance(network: string, address: string | null): - [ - number | null, - number | null, - boolean - ] { +export function useAddressBalance(network: string, address: string | null): [number | null, number | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [balance, setBalance] = useState(null); diff --git a/client/src/helpers/hooks/useAddressBasicOutputs.ts b/client/src/helpers/hooks/useAddressBasicOutputs.ts index f62866750..3b6118f91 100644 --- a/client/src/helpers/hooks/useAddressBasicOutputs.ts +++ b/client/src/helpers/hooks/useAddressBasicOutputs.ts @@ -11,9 +11,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param addressBech32 The address in bech32 format * @returns The output responses and loading bool. */ -export function useAddressBasicOutputs( - network: string, addressBech32: string | null -): [OutputResponse[] | null, boolean] { +export function useAddressBasicOutputs(network: string, addressBech32: string | null): [OutputResponse[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [outputs, setOutputs] = useState(null); @@ -25,13 +23,16 @@ export function useAddressBasicOutputs( if (addressBech32) { // eslint-disable-next-line no-void void (async () => { - apiClient.basicOutputsDetails({ network, address: addressBech32 }).then(response => { - if (!response?.error && response.outputs && isMounted) { - setOutputs(response.outputs); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .basicOutputsDetails({ network, address: addressBech32 }) + .then((response) => { + if (!response?.error && response.outputs && isMounted) { + setOutputs(response.outputs); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -40,4 +41,3 @@ export function useAddressBasicOutputs( return [outputs, isLoading]; } - diff --git a/client/src/helpers/hooks/useAddressHistory.ts b/client/src/helpers/hooks/useAddressHistory.ts index aa631c055..6ac48f787 100644 --- a/client/src/helpers/hooks/useAddressHistory.ts +++ b/client/src/helpers/hooks/useAddressHistory.ts @@ -21,7 +21,7 @@ interface IOutputDetailsMap { export function useAddressHistory( network: string, address?: string, - setDisabled?: (isDisabled: boolean) => void + setDisabled?: (isDisabled: boolean) => void, ): [ITransactionHistoryItem[], IOutputDetailsMap, () => void, boolean, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); @@ -45,10 +45,11 @@ export function useAddressHistory( address, pageSize: PAGE_SIZE, sort: SORT, - cursor + cursor, }; - apiClient.transactionHistory(request) + apiClient + .transactionHistory(request) .then((response: ITransactionHistoryResponse | undefined) => { const items = response?.items ?? []; if (items.length > 0 && isMounted) { @@ -71,25 +72,26 @@ export function useAddressHistory( const detailsPage: IOutputDetailsMap = {}; for (const item of history) { - const promise = apiClient.outputDetails({ network, outputId: item.outputId }) - .then(response => { + const promise = apiClient + .outputDetails({ network, outputId: item.outputId }) + .then((response) => { const details = response.output; if (!response.error && details?.output && details?.metadata) { const outputDetails = { output: details.output, - metadata: details.metadata + metadata: details.metadata, }; detailsPage[item.outputId] = outputDetails; } }) - .catch(e => console.log(e)); + .catch((e) => console.log(e)); promises.push(promise); } Promise.allSettled(promises) - .then(_ => { + .then((_) => { if (isMounted) { setOutputDetailsMap(detailsPage); setIsAddressHistoryLoading(false); @@ -104,7 +106,8 @@ export function useAddressHistory( setHistoryView(updatedHistoryView); } - }).catch(_ => { + }) + .catch((_) => { console.log("Failed loading transaction history details!"); }) .finally(() => { @@ -115,4 +118,3 @@ export function useAddressHistory( return [historyView, outputDetailsMap, loadHistory, isAddressHistoryLoading, Boolean(cursor)]; } - diff --git a/client/src/helpers/hooks/useAddressNftOutputs.ts b/client/src/helpers/hooks/useAddressNftOutputs.ts index 01228c775..8319f3212 100644 --- a/client/src/helpers/hooks/useAddressNftOutputs.ts +++ b/client/src/helpers/hooks/useAddressNftOutputs.ts @@ -11,9 +11,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param addressBech32 The address in bech32 format * @returns The output responses and loading bool. */ -export function useAddressNftOutputs( - network: string, addressBech32: string | null -): [OutputResponse[] | null, boolean] { +export function useAddressNftOutputs(network: string, addressBech32: string | null): [OutputResponse[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [outputs, setOutputs] = useState(null); @@ -25,13 +23,16 @@ export function useAddressNftOutputs( if (addressBech32) { // eslint-disable-next-line no-void void (async () => { - apiClient.nftOutputsDetails({ network, address: addressBech32 }).then(response => { - if (!response?.error && response.outputs && isMounted) { - setOutputs(response.outputs); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .nftOutputsDetails({ network, address: addressBech32 }) + .then((response) => { + if (!response?.error && response.outputs && isMounted) { + setOutputs(response.outputs); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -40,4 +41,3 @@ export function useAddressNftOutputs( return [outputs, isLoading]; } - diff --git a/client/src/helpers/hooks/useAliasContainsDID.ts b/client/src/helpers/hooks/useAliasContainsDID.ts index 20c296903..c38113814 100644 --- a/client/src/helpers/hooks/useAliasContainsDID.ts +++ b/client/src/helpers/hooks/useAliasContainsDID.ts @@ -7,13 +7,11 @@ import { Converter } from "~helpers/stardust/convertUtils"; * @param alias The alias output to check * @returns The result. */ -export function useAliasContainsDID( - alias: AliasOutput | null -): [boolean] { +export function useAliasContainsDID(alias: AliasOutput | null): [boolean] { const [aliasContainsDID, setAliasContainsDID] = useState(false); useEffect(() => { - if(alias && alias.stateMetadata && Converter.isHex(alias.stateMetadata, true)) { + if (alias && alias.stateMetadata && Converter.isHex(alias.stateMetadata, true)) { const metaDataBytes = hexToBytes(alias.stateMetadata); // Check if the first three bytes contain "DID" according to specification: https://wiki.iota.org/identity.rs/references/specifications/iota-did-method-spec/#anatomy-of-the-state-metadata if (metaDataBytes.length >= 3) { @@ -26,4 +24,3 @@ export function useAliasContainsDID( return [aliasContainsDID]; } - diff --git a/client/src/helpers/hooks/useAliasControlledFoundries.ts b/client/src/helpers/hooks/useAliasControlledFoundries.ts index d6ed735ae..29740486e 100644 --- a/client/src/helpers/hooks/useAliasControlledFoundries.ts +++ b/client/src/helpers/hooks/useAliasControlledFoundries.ts @@ -12,11 +12,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param aliasAddress The alias address * @returns The alias foundries and loading bool. */ -export function useAliasControlledFoundries(network: string, aliasAddress: IBech32AddressDetails | null): - [ - string[] | null, - boolean - ] { +export function useAliasControlledFoundries(network: string, aliasAddress: IBech32AddressDetails | null): [string[] | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [aliasFoundries, setAliasFoundries] = useState(null); @@ -28,27 +24,27 @@ export function useAliasControlledFoundries(network: string, aliasAddress: IBech const foundries: string[] = []; // eslint-disable-next-line no-void void (async () => { - apiClient.aliasFoundries({ - network, - aliasAddress: aliasAddress.bech32 - }).then(async foundryOutputs => { - if ( - foundryOutputs?.foundryOutputsResponse && - foundryOutputs?.foundryOutputsResponse?.items.length > 0 - ) { - for (const foundryOutputId of foundryOutputs.foundryOutputsResponse.items) { - const foundryId = await fetchFoundryId(foundryOutputId); - if (foundryId) { - foundries.push(foundryId); + apiClient + .aliasFoundries({ + network, + aliasAddress: aliasAddress.bech32, + }) + .then(async (foundryOutputs) => { + if (foundryOutputs?.foundryOutputsResponse && foundryOutputs?.foundryOutputsResponse?.items.length > 0) { + for (const foundryOutputId of foundryOutputs.foundryOutputsResponse.items) { + const foundryId = await fetchFoundryId(foundryOutputId); + if (foundryId) { + foundries.push(foundryId); + } + } + if (isMounted) { + setAliasFoundries(foundries); } } - if (isMounted) { - setAliasFoundries(foundries); - } - } - }).finally(() => { - setIsLoading(false); - }); + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -56,23 +52,17 @@ export function useAliasControlledFoundries(network: string, aliasAddress: IBech }, [network, aliasAddress]); const fetchFoundryId = async (outputId: HexEncodedString) => { - const foundryId = apiClient.outputDetails({ network, outputId }).then( - response => { - const details = response.output; - if (aliasAddress?.hex && !response.error && details?.output?.type === OutputType.Foundry) { - const output = details.output as FoundryOutput; - const serialNumber = output.serialNumber; - const tokenSchemeType = output.tokenScheme.type; - const tokenId = Utils.computeTokenId( - aliasAddress.hex, - serialNumber, - tokenSchemeType - ); + const foundryId = apiClient.outputDetails({ network, outputId }).then((response) => { + const details = response.output; + if (aliasAddress?.hex && !response.error && details?.output?.type === OutputType.Foundry) { + const output = details.output as FoundryOutput; + const serialNumber = output.serialNumber; + const tokenSchemeType = output.tokenScheme.type; + const tokenId = Utils.computeTokenId(aliasAddress.hex, serialNumber, tokenSchemeType); - return tokenId; - } + return tokenId; } - ); + }); return foundryId; }; diff --git a/client/src/helpers/hooks/useAliasDetails.ts b/client/src/helpers/hooks/useAliasDetails.ts index 8c4111a6f..166132134 100644 --- a/client/src/helpers/hooks/useAliasDetails.ts +++ b/client/src/helpers/hooks/useAliasDetails.ts @@ -12,11 +12,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param aliasId The alias id * @returns The output response and loading bool. */ -export function useAliasDetails(network: string, aliasId: string | null): - [ - AliasOutput | null, - boolean - ] { +export function useAliasDetails(network: string, aliasId: string | null): [AliasOutput | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [aliasOutput, setAliasOutput] = useState(null); @@ -27,18 +23,21 @@ export function useAliasDetails(network: string, aliasId: string | null): if (aliasId) { // eslint-disable-next-line no-void void (async () => { - apiClient.aliasDetails({ - network, - aliasId: HexHelper.addPrefix(aliasId) - }).then(response => { - if (!response?.error && isMounted) { - const output = response.aliasDetails?.output as AliasOutput; + apiClient + .aliasDetails({ + network, + aliasId: HexHelper.addPrefix(aliasId), + }) + .then((response) => { + if (!response?.error && isMounted) { + const output = response.aliasDetails?.output as AliasOutput; - setAliasOutput(output); - } - }).finally(() => { - setIsLoading(false); - }); + setAliasOutput(output); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useAssociatedOutputs.ts b/client/src/helpers/hooks/useAssociatedOutputs.ts index 36218d77e..891da438c 100644 --- a/client/src/helpers/hooks/useAssociatedOutputs.ts +++ b/client/src/helpers/hooks/useAssociatedOutputs.ts @@ -16,7 +16,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; export function useAssociatedOutputs( network: string, addressDetails: IBech32AddressDetails, - setOutputCount?: (count: number) => void + setOutputCount?: (count: number) => void, ): [IAssociation[], boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); @@ -27,24 +27,25 @@ export function useAssociatedOutputs( setIsAssociationsLoading(true); // eslint-disable-next-line no-void void (async () => { - apiClient.associatedOutputs({ network, addressDetails }).then(response => { - if (response?.associations && isMounted) { - setAssociations(response.associations); + apiClient + .associatedOutputs({ network, addressDetails }) + .then((response) => { + if (response?.associations && isMounted) { + setAssociations(response.associations); - if (setOutputCount) { - const outputsCount = response.associations.flatMap( - association => association.outputIds.length - ).reduce((acc, next) => acc + next, 0); - setOutputCount(outputsCount); + if (setOutputCount) { + const outputsCount = response.associations + .flatMap((association) => association.outputIds.length) + .reduce((acc, next) => acc + next, 0); + setOutputCount(outputsCount); + } } - } - } - ).finally(() => { - setIsAssociationsLoading(false); - }); + }) + .finally(() => { + setIsAssociationsLoading(false); + }); })(); }, [network, addressDetails]); return [associations, isAssociationsLoading]; } - diff --git a/client/src/helpers/hooks/useBlock.ts b/client/src/helpers/hooks/useBlock.ts index 7fec82d48..c6dd12e2c 100644 --- a/client/src/helpers/hooks/useBlock.ts +++ b/client/src/helpers/hooks/useBlock.ts @@ -12,12 +12,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param blockId The block id * @returns The block, loading bool and an error message. */ -export function useBlock(network: string, blockId: string | null): - [ - Block | null, - boolean, - string? - ] { +export function useBlock(network: string, blockId: string | null): [Block | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [block, setBlock] = useState(null); @@ -30,17 +25,20 @@ export function useBlock(network: string, blockId: string | null): if (blockId) { // eslint-disable-next-line no-void void (async () => { - apiClient.block({ - network, - blockId: HexHelper.addPrefix(blockId) - }).then(response => { - if (isMounted) { - setBlock(response.block ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .block({ + network, + blockId: HexHelper.addPrefix(blockId), + }) + .then((response) => { + if (isMounted) { + setBlock(response.block ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useBlockChildren.ts b/client/src/helpers/hooks/useBlockChildren.ts index 2f6648bb7..3cc87db77 100644 --- a/client/src/helpers/hooks/useBlockChildren.ts +++ b/client/src/helpers/hooks/useBlockChildren.ts @@ -12,12 +12,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param blockId The block id * @returns The children block ids, loading bool and an error string. */ -export function useBlockChildren(network: string, blockId: string | null): - [ - HexEncodedString[] | null, - boolean, - string? - ] { +export function useBlockChildren(network: string, blockId: string | null): [HexEncodedString[] | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [blockChildren, setBlockChildren] = useState(null); @@ -30,17 +25,20 @@ export function useBlockChildren(network: string, blockId: string | null): if (blockId) { // eslint-disable-next-line no-void void (async () => { - apiClient.blockChildren({ - network, - blockId: HexHelper.addPrefix(blockId) - }).then(response => { - if (isMounted) { - setBlockChildren(response.children ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .blockChildren({ + network, + blockId: HexHelper.addPrefix(blockId), + }) + .then((response) => { + if (isMounted) { + setBlockChildren(response.children ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useBlockFeed.ts b/client/src/helpers/hooks/useBlockFeed.ts index f2a7bf513..a28680830 100644 --- a/client/src/helpers/hooks/useBlockFeed.ts +++ b/client/src/helpers/hooks/useBlockFeed.ts @@ -16,10 +16,7 @@ const FEED_PROBE_THRESHOLD: number = 10000; * @param network The network in context. * @returns Milestones and latestMilestonIndex */ -export function useBlockFeed(network: string): [ - IMilestoneFeedItem[], - (number | null) -] { +export function useBlockFeed(network: string): [IMilestoneFeedItem[], number | null] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const feedProbe = useRef(null); @@ -33,9 +30,7 @@ export function useBlockFeed(network: string): [ if (apiClient) { const latestMilestones: ILatestMilestonesReponse = await apiClient.latestMilestones(network); if (isMounted && latestMilestones.milestones && latestMilestones.milestones.length > 0) { - setMilestones( - latestMilestones.milestones.slice(0, MAX_MILESTONE_ITEMS) - ); + setMilestones(latestMilestones.milestones.slice(0, MAX_MILESTONE_ITEMS)); } } }, [network]); @@ -78,13 +73,13 @@ export function useBlockFeed(network: string): [ setLatestMilestoneIndex(newMilestone.milestoneIndex); } if (isMounted) { - setMilestones(prevMilestones => { + setMilestones((prevMilestones) => { const milestonesUpdate = [...prevMilestones]; milestonesUpdate.unshift({ blockId: newMilestone.blockId, milestoneId: newMilestone.milestoneId, index: newMilestone.milestoneIndex, - timestamp: newMilestone.timestamp + timestamp: newMilestone.timestamp, }); if (milestonesUpdate.length > MAX_MILESTONE_ITEMS) { milestonesUpdate.pop(); @@ -108,4 +103,3 @@ export function useBlockFeed(network: string): [ return [milestones, latestMilestonIndex]; } - diff --git a/client/src/helpers/hooks/useBlockMetadata.ts b/client/src/helpers/hooks/useBlockMetadata.ts index 85c1d55a5..39a4e18b6 100644 --- a/client/src/helpers/hooks/useBlockMetadata.ts +++ b/client/src/helpers/hooks/useBlockMetadata.ts @@ -13,11 +13,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param blockId The block id * @returns The block metadata and loading bool. */ -export function useBlockMetadata(network: string, blockId: string | null): - [ - BlockMetadata, - boolean - ] { +export function useBlockMetadata(network: string, blockId: string | null): [BlockMetadata, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [blockMetadata, setBlockMetadata] = useState({ blockTangleStatus: "pending" }); @@ -32,7 +28,7 @@ export function useBlockMetadata(network: string, blockId: string | null): try { const details = await apiClient.blockDetails({ network, - blockId: HexHelper.addPrefix(blockId) + blockId: HexHelper.addPrefix(blockId), }); if (isMounted) { @@ -40,7 +36,7 @@ export function useBlockMetadata(network: string, blockId: string | null): metadata: details?.metadata, metadataError: details?.error, conflictReason: calculateConflictReason(details?.metadata), - blockTangleStatus: calculateStatus(details?.metadata) + blockTangleStatus: calculateStatus(details?.metadata), }); if (!details?.metadata?.referencedByMilestoneIndex) { @@ -53,7 +49,7 @@ export function useBlockMetadata(network: string, blockId: string | null): if (error instanceof Error && isMounted) { setBlockMetadata({ metadataError: error.message, - blockTangleStatus: "pending" + blockTangleStatus: "pending", }); } } finally { diff --git a/client/src/helpers/hooks/useChartsState.ts b/client/src/helpers/hooks/useChartsState.ts index abb86cf0a..dd7c10973 100644 --- a/client/src/helpers/hooks/useChartsState.ts +++ b/client/src/helpers/hooks/useChartsState.ts @@ -26,7 +26,7 @@ export function useChartsState(): [ DataPoint[], DataPoint[], DataPoint[], - (IAnalyticStats | null), + IAnalyticStats | null, ] { const { name: network } = useContext(NetworkContext); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); @@ -49,37 +49,43 @@ export function useChartsState(): [ const [analyticStats, setAnalyticStats] = useState(null); useEffect(() => { - apiClient.influxAnalytics({ network }).then(influxStats => { - if (!influxStats.error && influxStats) { - const graphsData: IStatisticsGraphsData = mapDailyStatsToGraphsData(influxStats); + apiClient + .influxAnalytics({ network }) + .then((influxStats) => { + if (!influxStats.error && influxStats) { + const graphsData: IStatisticsGraphsData = mapDailyStatsToGraphsData(influxStats); - setDailyBlocks(graphsData.blocksDaily); - setTransactions(graphsData.transactionsDaily); - setOutputs(graphsData.outputsDaily); - setTokensHeld(graphsData.tokensHeldDaily); - setAddressesWithBalance(graphsData.addressesWithBalanceDaily); - setActiveAddresses(graphsData.activeAddresses); - setTokensTransferred(graphsData.tokensTransferredDaily); - setAliasActivity(graphsData.aliasActivityDaily); - setUnlockConditionsPerType(graphsData.unlockConditionsPerTypeDaily); - setNftActivity(graphsData.nftActivityDaily); - setTokensHeldWithUnlockCondition(graphsData.tokensHeldWithUnlockConditionDaily); - setUnclaimedTokens(graphsData.unclaimedTokensDaily); - setUnclaimedGenesisOutputs(graphsData.unclaimedGenesisOutputsDaily); - setLedgerSize(graphsData.ledgerSizeDaily); - setStorageDeposit(graphsData.storageDepositDaily); - } else { - console.log("Fetching influx stats failed", influxStats.error); - } - }).catch(e => console.log("Influx analytics fetch failed", e)); + setDailyBlocks(graphsData.blocksDaily); + setTransactions(graphsData.transactionsDaily); + setOutputs(graphsData.outputsDaily); + setTokensHeld(graphsData.tokensHeldDaily); + setAddressesWithBalance(graphsData.addressesWithBalanceDaily); + setActiveAddresses(graphsData.activeAddresses); + setTokensTransferred(graphsData.tokensTransferredDaily); + setAliasActivity(graphsData.aliasActivityDaily); + setUnlockConditionsPerType(graphsData.unlockConditionsPerTypeDaily); + setNftActivity(graphsData.nftActivityDaily); + setTokensHeldWithUnlockCondition(graphsData.tokensHeldWithUnlockConditionDaily); + setUnclaimedTokens(graphsData.unclaimedTokensDaily); + setUnclaimedGenesisOutputs(graphsData.unclaimedGenesisOutputsDaily); + setLedgerSize(graphsData.ledgerSizeDaily); + setStorageDeposit(graphsData.storageDepositDaily); + } else { + console.log("Fetching influx stats failed", influxStats.error); + } + }) + .catch((e) => console.log("Influx analytics fetch failed", e)); - apiClient.chronicleAnalytics({ network }).then(analytics => { - if (!analytics.error && analytics) { - setAnalyticStats(analytics); - } else { - console.log("Fetching chronicle stats failed", analytics.error); - } - }).catch(e => console.log("Chronicle analytics fetch failed", e)); + apiClient + .chronicleAnalytics({ network }) + .then((analytics) => { + if (!analytics.error && analytics) { + setAnalyticStats(analytics); + } else { + console.log("Fetching chronicle stats failed", analytics.error); + } + }) + .catch((e) => console.log("Chronicle analytics fetch failed", e)); }, [network]); return [ @@ -98,6 +104,6 @@ export function useChartsState(): [ unclaimedGenesisOutputs, ledgerSize, storageDeposit, - analyticStats + analyticStats, ]; } diff --git a/client/src/helpers/hooks/useChronicleAnalytics.ts b/client/src/helpers/hooks/useChronicleAnalytics.ts index c91f7777c..1c60f46ac 100644 --- a/client/src/helpers/hooks/useChronicleAnalytics.ts +++ b/client/src/helpers/hooks/useChronicleAnalytics.ts @@ -15,9 +15,7 @@ const CHRONICLE_ANALYTICS_REFRESH_MINUTES = 5; * @param network The network in context. * @returns The Chronicle analytic stats. */ -export function useChronicleAnalytics(network: string): [ - (IAnalyticStats | null) -] { +export function useChronicleAnalytics(network: string): [IAnalyticStats | null] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [updateTimerId, setUpdateTimerId] = useState(null); @@ -34,10 +32,13 @@ export function useChronicleAnalytics(network: string): [ void fetchAnalytics(); setUpdateTimerId( - setInterval(() => { - // eslint-disable-next-line no-void - void fetchAnalytics(); - }, CHRONICLE_ANALYTICS_REFRESH_MINUTES * 60 * 1000) + setInterval( + () => { + // eslint-disable-next-line no-void + void fetchAnalytics(); + }, + CHRONICLE_ANALYTICS_REFRESH_MINUTES * 60 * 1000, + ), ); } @@ -60,7 +61,7 @@ export function useChronicleAnalytics(network: string): [ totalAddresses: analyticStats?.totalAddresses, dailyAddresses: analyticStats?.dailyAddresses, lockedStorageDeposit: analyticStats?.lockedStorageDeposit, - unclaimedShimmer: analyticStats?.unclaimedShimmer + unclaimedShimmer: analyticStats?.unclaimedShimmer, }); } else { console.log("Analytics stats refresh failed."); diff --git a/client/src/helpers/hooks/useCurrencyService.ts b/client/src/helpers/hooks/useCurrencyService.ts index 21af2202c..e91d5e90a 100644 --- a/client/src/helpers/hooks/useCurrencyService.ts +++ b/client/src/helpers/hooks/useCurrencyService.ts @@ -9,10 +9,7 @@ import { CurrencyService } from "~services/currencyService"; * @param isIota Is the base currency Iota. * @returns The current currency and currecny data. */ -export function useCurrencyService(isIota: boolean): [ - string, - string -] { +export function useCurrencyService(isIota: boolean): [string, string] { const isMounted = useIsMounted(); const [currencyService] = useState(ServiceFactory.get("currency")); const [currencyData, setCurrencyData] = useState(null); @@ -21,7 +18,6 @@ export function useCurrencyService(isIota: boolean): [ const [marketCap, setMarketCap] = useState("--"); const [price, setPrice] = useState("--"); - useEffect(() => { const data = buildCurrency(); @@ -61,34 +57,12 @@ export function useCurrencyService(isIota: boolean): [ useEffect(() => { if (currencyData) { const coinPrice = isIota ? currencyData?.coinStats?.iota.price : currencyData?.coinStats?.shimmer.price; - const coinMarketCap = isIota ? - currencyData?.coinStats?.iota.marketCap : - currencyData?.coinStats?.shimmer.marketCap; + const coinMarketCap = isIota ? currencyData?.coinStats?.iota.marketCap : currencyData?.coinStats?.shimmer.marketCap; - setMarketCap( - coinMarketCap ? - currencyService.convertFiatBase( - coinMarketCap, - currencyData, - true, - 2, - undefined, - true - ) : "--" - ); - setPrice( - coinPrice ? - currencyService.convertFiatBase( - coinPrice, - currencyData, - true, - 3, - 8 - ) : "--" - ); + setMarketCap(coinMarketCap ? currencyService.convertFiatBase(coinMarketCap, currencyData, true, 2, undefined, true) : "--"); + setPrice(coinPrice ? currencyService.convertFiatBase(coinPrice, currencyData, true, 3, 8) : "--"); } }, [isIota, currency, currencyData]); return [price, marketCap]; } - diff --git a/client/src/helpers/hooks/useFoundryDetails.ts b/client/src/helpers/hooks/useFoundryDetails.ts index 36a461e0a..a0b1ddea9 100644 --- a/client/src/helpers/hooks/useFoundryDetails.ts +++ b/client/src/helpers/hooks/useFoundryDetails.ts @@ -12,12 +12,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param foundryId The foundry id * @returns The output response, loading bool and an error message. */ -export function useFoundryDetails(network: string, foundryId: string | null): - [ - OutputResponse | null, - boolean, - string? - ] { +export function useFoundryDetails(network: string, foundryId: string | null): [OutputResponse | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [foundryDetails, setFoundryDetails] = useState(null); @@ -29,17 +24,20 @@ export function useFoundryDetails(network: string, foundryId: string | null): if (foundryId) { // eslint-disable-next-line no-void void (async () => { - apiClient.foundryDetails({ - network, - foundryId: HexHelper.addPrefix(foundryId) - }).then(response => { - if (isMounted) { - setFoundryDetails(response.foundryDetails ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .foundryDetails({ + network, + foundryId: HexHelper.addPrefix(foundryId), + }) + .then((response) => { + if (isMounted) { + setFoundryDetails(response.foundryDetails ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useInputsAndOutputs.ts b/client/src/helpers/hooks/useInputsAndOutputs.ts index f9d58b591..2b065fb64 100644 --- a/client/src/helpers/hooks/useInputsAndOutputs.ts +++ b/client/src/helpers/hooks/useInputsAndOutputs.ts @@ -15,14 +15,10 @@ import { TransactionsHelper } from "../stardust/transactionsHelper"; * @param block The block * @returns The inputs, unlocks, outputs, transfer total an a loading bool. */ -export function useInputsAndOutputs(network: string, block: Block | null): - [ - IInput[] | null, - Unlock[] | null, - IOutput[] | null, - number | null, - boolean - ] { +export function useInputsAndOutputs( + network: string, + block: Block | null, +): [IInput[] | null, Unlock[] | null, IOutput[] | null, number | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const { bech32Hrp } = useContext(NetworkContext); @@ -38,13 +34,12 @@ export function useInputsAndOutputs(network: string, block: Block | null): if (block?.payload?.type === PayloadType.Transaction) { // eslint-disable-next-line no-void void (async () => { - const { inputs, unlocks, outputs, transferTotal } = - await TransactionsHelper.getInputsAndOutputs( - block, - network, - bech32Hrp, - apiClient - ); + const { inputs, unlocks, outputs, transferTotal } = await TransactionsHelper.getInputsAndOutputs( + block, + network, + bech32Hrp, + apiClient, + ); if (isMounted) { setInputs(inputs); setUnlocks(unlocks); diff --git a/client/src/helpers/hooks/useIsMounted.ts b/client/src/helpers/hooks/useIsMounted.ts index 76dc968db..d641f1a55 100644 --- a/client/src/helpers/hooks/useIsMounted.ts +++ b/client/src/helpers/hooks/useIsMounted.ts @@ -10,4 +10,3 @@ export const useIsMounted = () => { return isMounted.current; }; - diff --git a/client/src/helpers/hooks/useMilestoneDetails.ts b/client/src/helpers/hooks/useMilestoneDetails.ts index 102238905..e4c29d601 100644 --- a/client/src/helpers/hooks/useMilestoneDetails.ts +++ b/client/src/helpers/hooks/useMilestoneDetails.ts @@ -18,11 +18,7 @@ interface IMilestoneDetails { * @param milestoneIndex The milestone index * @returns The milestone details and loading bool. */ -export function useMilestoneDetails(network: string, milestoneIndex: number | null): - [ - IMilestoneDetails | null, - boolean - ] { +export function useMilestoneDetails(network: string, milestoneIndex: number | null): [IMilestoneDetails | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [milestoneDetails, setMilestoneDetails] = useState(null); @@ -36,7 +32,7 @@ export function useMilestoneDetails(network: string, milestoneIndex: number | nu try { const details = await apiClient.milestoneDetails({ network, - milestoneIndex + milestoneIndex, }); if (isMounted) { setMilestoneDetails(details); @@ -50,7 +46,7 @@ export function useMilestoneDetails(network: string, milestoneIndex: number | nu } catch (error) { if (error instanceof Error && isMounted) { setMilestoneDetails({ - error: error.message + error: error.message, }); } } finally { diff --git a/client/src/helpers/hooks/useMilestoneInterval.ts b/client/src/helpers/hooks/useMilestoneInterval.ts index 61bf6e918..f28ebf78d 100644 --- a/client/src/helpers/hooks/useMilestoneInterval.ts +++ b/client/src/helpers/hooks/useMilestoneInterval.ts @@ -27,4 +27,3 @@ export const useMilestoneInterval = (milestoneIndex: number | undefined) => { return seconds; }; - diff --git a/client/src/helpers/hooks/useMilestoneReferencedBlock.ts b/client/src/helpers/hooks/useMilestoneReferencedBlock.ts index 4f121e41a..1bcd26bba 100644 --- a/client/src/helpers/hooks/useMilestoneReferencedBlock.ts +++ b/client/src/helpers/hooks/useMilestoneReferencedBlock.ts @@ -11,12 +11,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param milestoneId The milestone id * @returns The blocks, loading bool and an error message. */ -export function useMilestoneReferencedBlocks(network: string, milestoneId: string | null): - [ - string[] | null, - boolean, - string? - ] { +export function useMilestoneReferencedBlocks(network: string, milestoneId: string | null): [string[] | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [milestoneReferencedBlocks, setMilestoneReferencedBlocks] = useState(null); @@ -28,17 +23,20 @@ export function useMilestoneReferencedBlocks(network: string, milestoneId: strin if (milestoneId) { // eslint-disable-next-line no-void void (async () => { - apiClient.milestoneReferencedBlocks({ - network, - milestoneId: HexHelper.addPrefix(milestoneId) - }).then(response => { - if (isMounted) { - setMilestoneReferencedBlocks(response.blocks ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .milestoneReferencedBlocks({ + network, + milestoneId: HexHelper.addPrefix(milestoneId), + }) + .then((response) => { + if (isMounted) { + setMilestoneReferencedBlocks(response.blocks ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useMilestoneStats.ts b/client/src/helpers/hooks/useMilestoneStats.ts index f06185b2e..46eda8e8d 100644 --- a/client/src/helpers/hooks/useMilestoneStats.ts +++ b/client/src/helpers/hooks/useMilestoneStats.ts @@ -11,11 +11,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param milestoneIndex The milestone index * @returns The milestone stats and a loading bool. */ -export function useMilestoneStats(network: string, milestoneIndex: string | null): - [ - IMilestoneAnalyticStats | null, - boolean - ] { +export function useMilestoneStats(network: string, milestoneIndex: string | null): [IMilestoneAnalyticStats | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [milestoneStats, setMilestoneStats] = useState(null); @@ -26,16 +22,19 @@ export function useMilestoneStats(network: string, milestoneIndex: string | null if (milestoneIndex) { // eslint-disable-next-line no-void void (async () => { - apiClient.milestoneStats({ - network, - milestoneIndex - }).then(response => { - if (isMounted) { - setMilestoneStats(response ?? null); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .milestoneStats({ + network, + milestoneIndex, + }) + .then((response) => { + if (isMounted) { + setMilestoneStats(response ?? null); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useNetworkConfig.ts b/client/src/helpers/hooks/useNetworkConfig.ts index 1b72a504c..1eba5d215 100644 --- a/client/src/helpers/hooks/useNetworkConfig.ts +++ b/client/src/helpers/hooks/useNetworkConfig.ts @@ -10,16 +10,14 @@ import { NetworkService } from "~services/networkService"; * @param network The network in context. * @returns The network config in context. */ -export function useNetworkConfig(network: string): [ - (INetwork) -] { +export function useNetworkConfig(network: string): [INetwork] { const [networkService] = useState(ServiceFactory.get("network")); const [networkConfig, setNetworkConfig] = useState({ label: "Custom network", network: CUSTOM, protocolVersion: STARDUST, hasStatisticsSupport: false, - isEnabled: false + isEnabled: false, }); useEffect(() => { @@ -29,8 +27,8 @@ export function useNetworkConfig(network: string): [ network: CUSTOM, protocolVersion: STARDUST, hasStatisticsSupport: false, - isEnabled: false - } + isEnabled: false, + }, ); }, [network]); diff --git a/client/src/helpers/hooks/useNetworkStats.ts b/client/src/helpers/hooks/useNetworkStats.ts index fe4f6da29..c342bef33 100644 --- a/client/src/helpers/hooks/useNetworkStats.ts +++ b/client/src/helpers/hooks/useNetworkStats.ts @@ -9,12 +9,7 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param network The network in context. * @returns The network stats. */ -export function useNetworkStats(network: string): [ - string, - string, - string, - number[] -] { +export function useNetworkStats(network: string): [string, string, string, number[]] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [updateTimerId, setUpdateTimerId] = useState(null); @@ -39,29 +34,29 @@ export function useNetworkStats(network: string): [ const updateNetworkStats = () => { if (isMounted && apiClient && network) { // eslint-disable-next-line @typescript-eslint/no-floating-promises - apiClient.stats({ - network, - includeHistory: true - }).then(ips => { - const itemsPerSecond = ips.itemsPerSecond ?? 0; - const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; - const confirmedRate = ips.confirmationRate - ? (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; + apiClient + .stats({ + network, + includeHistory: true, + }) + .then((ips) => { + const itemsPerSecond = ips.itemsPerSecond ?? 0; + const confirmedItemsPerSecond = ips.confirmedItemsPerSecond ?? 0; + const confirmedRate = ips.confirmationRate ? (ips.confirmationRate > 100 ? 100 : ips.confirmationRate) : 0; - setBlocksPerSecond(itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--"); - setConfirmedBlocksPerSecond(confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--"); - setConfirmedBlocksPerSecondPercent(confirmedRate > 0 ? `${confirmedRate.toFixed(2)}%` : "--"); - setBlocksPerSecondHistory((ips.itemsPerSecondHistory ?? []).map(v => v + 100)); - }).catch(err => { - console.error(err); - }).finally(() => { - setUpdateTimerId( - setTimeout(async () => updateNetworkStats(), 4000) - ); - }); + setBlocksPerSecond(itemsPerSecond >= 0 ? itemsPerSecond.toFixed(2) : "--"); + setConfirmedBlocksPerSecond(confirmedItemsPerSecond >= 0 ? confirmedItemsPerSecond.toFixed(2) : "--"); + setConfirmedBlocksPerSecondPercent(confirmedRate > 0 ? `${confirmedRate.toFixed(2)}%` : "--"); + setBlocksPerSecondHistory((ips.itemsPerSecondHistory ?? []).map((v) => v + 100)); + }) + .catch((err) => { + console.error(err); + }) + .finally(() => { + setUpdateTimerId(setTimeout(async () => updateNetworkStats(), 4000)); + }); } }; return [blocksPerSecond, confirmedBlocksPerSecond, confirmedBlocksPerSecondPercent, blocksPerSecondHistory]; } - diff --git a/client/src/helpers/hooks/useNftDetails.ts b/client/src/helpers/hooks/useNftDetails.ts index 1952a071b..d6960eea2 100644 --- a/client/src/helpers/hooks/useNftDetails.ts +++ b/client/src/helpers/hooks/useNftDetails.ts @@ -3,7 +3,11 @@ import { AliasAddress, Ed25519Address, FeatureType, - HexEncodedString, IssuerFeature, MetadataFeature, NftAddress, NftOutput + HexEncodedString, + IssuerFeature, + MetadataFeature, + NftAddress, + NftOutput, } from "@iota/sdk-wasm/web"; import { useEffect, useState } from "react"; import { useIsMounted } from "./useIsMounted"; @@ -12,20 +16,13 @@ import { STARDUST } from "~models/config/protocolVersion"; import { StardustApiClient } from "~services/stardust/stardustApiClient"; import { HexHelper } from "../stardust/hexHelper"; - /** * Fetch nft output details * @param network The Network in context * @param nftId The nft id * @returns The output responses and loading bool. */ -export function useNftDetails(network: string, nftId: string | null): - [ - NftOutput | null, - HexEncodedString | null, - string | null, - boolean - ] { +export function useNftDetails(network: string, nftId: string | null): [NftOutput | null, HexEncodedString | null, string | null, boolean] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [nftOutput, setNftOutput] = useState(null); @@ -41,54 +38,57 @@ export function useNftDetails(network: string, nftId: string | null): if (nftId) { // eslint-disable-next-line no-void void (async () => { - apiClient.nftDetails({ - network, - nftId: HexHelper.addPrefix(nftId) - }).then(response => { - if (!response?.error) { - const output = response.nftDetails?.output as NftOutput; + apiClient + .nftDetails({ + network, + nftId: HexHelper.addPrefix(nftId), + }) + .then((response) => { + if (!response?.error) { + const output = response.nftDetails?.output as NftOutput; - const metadataFeature = output?.immutableFeatures?.find( - feature => feature.type === FeatureType.Metadata - ) as MetadataFeature; + const metadataFeature = output?.immutableFeatures?.find( + (feature) => feature.type === FeatureType.Metadata, + ) as MetadataFeature; - const issuerFeature = output?.immutableFeatures?.find( - feature => feature.type === FeatureType.Issuer - ) as IssuerFeature; + const issuerFeature = output?.immutableFeatures?.find( + (feature) => feature.type === FeatureType.Issuer, + ) as IssuerFeature; - let issuerId = null; - if (issuerFeature) { - switch (issuerFeature.address.type) { - case AddressType.Ed25519: { - const ed25519Address = issuerFeature.address as Ed25519Address; - issuerId = ed25519Address.pubKeyHash; - break; - } - case AddressType.Alias: { - const aliasAddress = issuerFeature.address as AliasAddress; - issuerId = aliasAddress.aliasId; - break; - } - case AddressType.Nft: { - const nftAddress = issuerFeature.address as NftAddress; - issuerId = nftAddress.nftId; - break; - } - default: { - break; + let issuerId = null; + if (issuerFeature) { + switch (issuerFeature.address.type) { + case AddressType.Ed25519: { + const ed25519Address = issuerFeature.address as Ed25519Address; + issuerId = ed25519Address.pubKeyHash; + break; + } + case AddressType.Alias: { + const aliasAddress = issuerFeature.address as AliasAddress; + issuerId = aliasAddress.aliasId; + break; + } + case AddressType.Nft: { + const nftAddress = issuerFeature.address as NftAddress; + issuerId = nftAddress.nftId; + break; + } + default: { + break; + } } } - } - if (isMounted) { - setNftMetadata(metadataFeature?.data ?? null); - setNftOutput(output); - setNftIssuerId(issuerId); + if (isMounted) { + setNftMetadata(metadataFeature?.data ?? null); + setNftOutput(output); + setNftIssuerId(issuerId); + } } - } - }).finally(() => { - setIsLoading(false); - }); + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -97,4 +97,3 @@ export function useNftDetails(network: string, nftId: string | null): return [nftOutput, nftMetadata, nftIssuerId, isLoading]; } - diff --git a/client/src/helpers/hooks/useNftMetadataUri.ts b/client/src/helpers/hooks/useNftMetadataUri.ts index 3b109c3c0..781801f5c 100644 --- a/client/src/helpers/hooks/useNftMetadataUri.ts +++ b/client/src/helpers/hooks/useNftMetadataUri.ts @@ -7,11 +7,7 @@ import { getIPFSHash, getIpfsUri } from "../stardust/ipfsHelper"; * @param link The image link * @returns The uri and loading bool. */ -export function useNftMetadataUri(link?: string): - [ - string | null, - boolean - ] { +export function useNftMetadataUri(link?: string): [string | null, boolean] { const isMounted = useIsMounted(); const [uri, setUri] = useState(null); const [isLoading, setIsLoading] = useState(true); diff --git a/client/src/helpers/hooks/useOutputDetails.ts b/client/src/helpers/hooks/useOutputDetails.ts index 0294b2537..02c2cf970 100644 --- a/client/src/helpers/hooks/useOutputDetails.ts +++ b/client/src/helpers/hooks/useOutputDetails.ts @@ -12,13 +12,10 @@ import { HexHelper } from "../stardust/hexHelper"; * @param outputId The output id * @returns The output, metadata, loading bool and error message. */ -export function useOutputDetails(network: string, outputId: string | null): - [ - Output | null, - IOutputMetadataResponse | null, - boolean, - string? - ] { +export function useOutputDetails( + network: string, + outputId: string | null, +): [Output | null, IOutputMetadataResponse | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [output, setOutput] = useState(null); @@ -33,19 +30,22 @@ export function useOutputDetails(network: string, outputId: string | null): if (outputId) { // eslint-disable-next-line no-void void (async () => { - apiClient.outputDetails({ - network, - outputId: HexHelper.addPrefix(outputId) - }).then(response => { - if (isMounted) { - const details = response.output; - setOutput(details?.output ?? null); - setMetadata(details?.metadata ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .outputDetails({ + network, + outputId: HexHelper.addPrefix(outputId), + }) + .then((response) => { + if (isMounted) { + const details = response.output; + setOutput(details?.output ?? null); + setMetadata(details?.metadata ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); @@ -54,4 +54,3 @@ export function useOutputDetails(network: string, outputId: string | null): return [output, metadata, isLoading, error]; } - diff --git a/client/src/helpers/hooks/useOutputsDetails.ts b/client/src/helpers/hooks/useOutputsDetails.ts index 3f2266379..134bc5bae 100644 --- a/client/src/helpers/hooks/useOutputsDetails.ts +++ b/client/src/helpers/hooks/useOutputsDetails.ts @@ -17,12 +17,7 @@ interface IOutputDetails { * @param outputIds The output ids * @returns The outputs responses, loading bool and an error message. */ -export function useOutputsDetails(network: string, outputIds: string[] | null): - [ - IOutputDetails[], - boolean, - string? - ] { +export function useOutputsDetails(network: string, outputIds: string[] | null): [IOutputDetails[], boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [outputs, setOutputs] = useState([]); @@ -36,35 +31,39 @@ export function useOutputsDetails(network: string, outputIds: string[] | null): const items: IOutputDetails[] = []; for (const outputId of outputIds) { - const promise = apiClient.outputDetails({ - network, - outputId: HexHelper.addPrefix(outputId) - }).then(response => { - const details = response.output; - if (!response?.error && details?.output && details?.metadata) { - const fetchedOutputDetails = { - output: details.output, - metadata: details.metadata - }; - const item: IOutputDetails = { - outputDetails: fetchedOutputDetails, - outputId - }; - items.push(item); - } else { - setError(response.error); - } - }).catch(e => console.log(e)); + const promise = apiClient + .outputDetails({ + network, + outputId: HexHelper.addPrefix(outputId), + }) + .then((response) => { + const details = response.output; + if (!response?.error && details?.output && details?.metadata) { + const fetchedOutputDetails = { + output: details.output, + metadata: details.metadata, + }; + const item: IOutputDetails = { + outputDetails: fetchedOutputDetails, + outputId, + }; + items.push(item); + } else { + setError(response.error); + } + }) + .catch((e) => console.log(e)); promises.push(promise); } Promise.allSettled(promises) - .then(_ => { + .then((_) => { if (isMounted) { setOutputs(items); } - }).catch(_ => { + }) + .catch((_) => { setError("Failed loading output details!"); }) .finally(() => { diff --git a/client/src/helpers/hooks/useParticipationEventDetails.ts b/client/src/helpers/hooks/useParticipationEventDetails.ts index 8de0ad68b..1ae54a957 100644 --- a/client/src/helpers/hooks/useParticipationEventDetails.ts +++ b/client/src/helpers/hooks/useParticipationEventDetails.ts @@ -19,17 +19,10 @@ export interface IEventDetails { * @param participations The participations * @returns The participation event details, status and loading bool. */ -export function useParticipationEventDetails(participations?: IParticipation[]): - [ - IEventDetails[], - boolean, - string? - ] { +export function useParticipationEventDetails(participations?: IParticipation[]): [IEventDetails[], boolean, string?] { const { name: network } = useContext(NetworkContext); const isMounted = useIsMounted(); - const [apiClient] = useState( - ServiceFactory.get(`api-client-${STARDUST}`) - ); + const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [error, setError] = useState(); const [eventDetails, setEventDetails] = useState([]); const [isLoading, setIsLoading] = useState(true); @@ -41,31 +34,35 @@ export function useParticipationEventDetails(participations?: IParticipation[]): const events: IEventDetails[] = []; for (const participation of participations) { - const promise = apiClient.participationEventDetails({ + const promise = apiClient + .participationEventDetails({ network, - eventId: participation.eventId - }).then(response => { - if (!response?.error && response.info) { - const event: IEventDetails = { - participation, - info: response.info, - status: response.status - }; - events.push(event); - } else { - setError(response.error); - } - }).catch(e => console.log(e)); + eventId: participation.eventId, + }) + .then((response) => { + if (!response?.error && response.info) { + const event: IEventDetails = { + participation, + info: response.info, + status: response.status, + }; + events.push(event); + } else { + setError(response.error); + } + }) + .catch((e) => console.log(e)); promises.push(promise); } Promise.allSettled(promises) - .then(_ => { + .then((_) => { if (isMounted) { setEventDetails(events); } - }).catch(_ => { + }) + .catch((_) => { setError("Failed loading event details!"); }) .finally(() => { diff --git a/client/src/helpers/hooks/useResolvedDID.ts b/client/src/helpers/hooks/useResolvedDID.ts index 2c9478461..6f6bf2a0c 100644 --- a/client/src/helpers/hooks/useResolvedDID.ts +++ b/client/src/helpers/hooks/useResolvedDID.ts @@ -11,11 +11,11 @@ import { IIdentityStardustResolveResponse } from "~/models/api/IIdentityStardust * @param addressHex Hex representation of the alias address * @returns The DID response and loading bool. */ -export function useResolvedDID(network: string, bech32Hrp: string , addressHex: string | null): - [ - IIdentityStardustResolveResponse | null, - boolean - ] { +export function useResolvedDID( + network: string, + bech32Hrp: string, + addressHex: string | null, +): [IIdentityStardustResolveResponse | null, boolean] { const isMounted = useIsMounted(); const [identityService] = useState(ServiceFactory.get("identity")); const [identityResponse, setidentityResponse] = useState(null); @@ -26,17 +26,17 @@ export function useResolvedDID(network: string, bech32Hrp: string , addressHex: if (addressHex) { // eslint-disable-next-line no-void void (async () => { - identityService.resolveIdentityStardust( - `did:iota:${bech32Hrp}:${addressHex}`, - network - ).then(response => { - if (isMounted) { - setidentityResponse(response); - } - }).then(() => identityService.initLibrary()) - .finally(() => { - setIsLoading(false); - }); + identityService + .resolveIdentityStardust(`did:iota:${bech32Hrp}:${addressHex}`, network) + .then((response) => { + if (isMounted) { + setidentityResponse(response); + } + }) + .then(() => identityService.initLibrary()) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useTaggedOutputs.ts b/client/src/helpers/hooks/useTaggedOutputs.ts index b87d8e49e..cdab575eb 100644 --- a/client/src/helpers/hooks/useTaggedOutputs.ts +++ b/client/src/helpers/hooks/useTaggedOutputs.ts @@ -27,26 +27,26 @@ const OUTPUTS_LIMIT = 100; * @returns The taggedOutputs state. */ export function useTaggedOutputs( - network: string + network: string, ): [ - string, - OutputListItem[], - OutputListItem[], - number, - number, - number, - number, - React.Dispatch>, - React.Dispatch>, - number, - boolean, - boolean, - boolean, - boolean, - boolean, - boolean, - (outputType: "basic" | "nft") => Promise - ] { + string, + OutputListItem[], + OutputListItem[], + number, + number, + number, + number, + React.Dispatch>, + React.Dispatch>, + number, + boolean, + boolean, + boolean, + boolean, + boolean, + boolean, + (outputType: "basic" | "nft") => Promise, +] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const location = useLocation(); @@ -54,7 +54,7 @@ export function useTaggedOutputs( const history = useHistory(); const { outputIds, tag } = location.state ?? { outputIds: [], - tag: "" + tag: "", }; const [basicOutputItems, setBasicOutputItems] = useState(null); @@ -75,7 +75,7 @@ export function useTaggedOutputs( const loadOutputDetails = async ( outputs: string[], setState: React.Dispatch>, - setLoading: React.Dispatch> + setLoading: React.Dispatch>, ) => { setLoading(true); const itemsUpdate: OutputListItem[] = []; @@ -83,24 +83,19 @@ export function useTaggedOutputs( for (const outputId of outputs) { promises.push( - apiClient.outputDetails({ network, outputId }) - .then(response => { - const details = response.output; - if ( - !response.error && - details?.output && - details?.metadata - ) { - const item: OutputListItem = { - outputDetails: { - output: details.output, - metadata: details.metadata - }, - outputId - }; - itemsUpdate.push(item); - } - }) + apiClient.outputDetails({ network, outputId }).then((response) => { + const details = response.output; + if (!response.error && details?.output && details?.metadata) { + const item: OutputListItem = { + outputDetails: { + output: details.output, + metadata: details.metadata, + }, + outputId, + }; + itemsUpdate.push(item); + } + }), ); } @@ -108,7 +103,7 @@ export function useTaggedOutputs( await Promise.all(promises); if (isMounted) { - setState(prevState => ([...(prevState ?? []), ...itemsUpdate])); + setState((prevState) => [...(prevState ?? []), ...itemsUpdate]); } } finally { setLoading(false); @@ -116,27 +111,33 @@ export function useTaggedOutputs( }; const loadMore = async (outputType: "basic" | "nft") => { - apiClient.outputsByTag({ - network, tag, outputType, cursor: outputType === "basic" ? basicOutputsCursor : nftOutputsCursor - }).then(response => { - if (!response.error && response.outputs) { - if (outputType === "basic") { - // eslint-disable-next-line no-void - void loadOutputDetails(response.outputs.items, setBasicOutputItems, setIsBasicLoading); - if (isMounted) { - setBasicOutputsCursor(response.outputs.cursor); + apiClient + .outputsByTag({ + network, + tag, + outputType, + cursor: outputType === "basic" ? basicOutputsCursor : nftOutputsCursor, + }) + .then((response) => { + if (!response.error && response.outputs) { + if (outputType === "basic") { + // eslint-disable-next-line no-void + void loadOutputDetails(response.outputs.items, setBasicOutputItems, setIsBasicLoading); + if (isMounted) { + setBasicOutputsCursor(response.outputs.cursor); + } } - } - if (outputType === "nft") { - // eslint-disable-next-line no-void - void loadOutputDetails(response.outputs.items, setNftOutputItems, setIsNftLoading); - if (isMounted) { - setNftOutputsCursor(response.outputs.cursor); + if (outputType === "nft") { + // eslint-disable-next-line no-void + void loadOutputDetails(response.outputs.items, setNftOutputItems, setIsNftLoading); + if (isMounted) { + setNftOutputsCursor(response.outputs.cursor); + } } } - } - }).catch(_ => { }); + }) + .catch((_) => {}); }; useEffect(() => { @@ -210,6 +211,6 @@ export function useTaggedOutputs( nftOutputLimitReached, hasMoreBasicOutputs, hasMoreNftOutputs, - loadMore + loadMore, ]; } diff --git a/client/src/helpers/hooks/useTokenDistributionState.ts b/client/src/helpers/hooks/useTokenDistributionState.ts index 14fb03f63..ade50ed3e 100644 --- a/client/src/helpers/hooks/useTokenDistributionState.ts +++ b/client/src/helpers/hooks/useTokenDistributionState.ts @@ -10,33 +10,35 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * State holder for Statistics page token distribution section. * @returns The token distribution state. */ -export function useTokenDistributionState(): [ - (IRichAddress[] | null), - (IDistributionEntry[] | null) -] { +export function useTokenDistributionState(): [IRichAddress[] | null, IDistributionEntry[] | null] { const { name: network } = useContext(NetworkContext); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [richestAddresses, setRichestAddresses] = useState(null); const [tokenDistribution, setTokenDistribution] = useState(null); useEffect(() => { - apiClient.tokenDistribution({ network }).then(response => { - if (!response.error && response.distribution) { - setTokenDistribution(response.distribution); - } else { - console.log(`Fetching token distribution failed (${network})`, response.error); - } - }).catch(e => console.log(`Fetching token distribution failed (${network})`, e)); + apiClient + .tokenDistribution({ network }) + .then((response) => { + if (!response.error && response.distribution) { + setTokenDistribution(response.distribution); + } else { + console.log(`Fetching token distribution failed (${network})`, response.error); + } + }) + .catch((e) => console.log(`Fetching token distribution failed (${network})`, e)); - apiClient.richestAddresses({ network }).then(response => { - if (!response.error && response.top) { - setRichestAddresses(response.top); - } else { - console.log(`Fetching richest addresses failed (${network})`, response.error); - } - }).catch(e => console.log(`Fetching richest addresses failed (${network})`, e)); + apiClient + .richestAddresses({ network }) + .then((response) => { + if (!response.error && response.top) { + setRichestAddresses(response.top); + } else { + console.log(`Fetching richest addresses failed (${network})`, response.error); + } + }) + .catch((e) => console.log(`Fetching richest addresses failed (${network})`, e)); }, [network]); return [richestAddresses, tokenDistribution]; } - diff --git a/client/src/helpers/hooks/useTokenRegistryNativeTokenCheck.ts b/client/src/helpers/hooks/useTokenRegistryNativeTokenCheck.ts index ab383bb8a..8ef4115d8 100644 --- a/client/src/helpers/hooks/useTokenRegistryNativeTokenCheck.ts +++ b/client/src/helpers/hooks/useTokenRegistryNativeTokenCheck.ts @@ -9,15 +9,11 @@ import { TokenRegistryClient } from "~services/stardust/tokenRegistryClient"; * @param tokenId The token id to check * @returns The whitelisted boolean. */ -export function useTokenRegistryNativeTokenCheck(tokenId: string | null): [ - boolean -] { +export function useTokenRegistryNativeTokenCheck(tokenId: string | null): [boolean] { const { name: network } = useContext(NetworkContext); const isMounted = useIsMounted(); const [isWhitelisted, setIsWhitelisted] = useState(false); - const [client] = useState( - ServiceFactory.get("token-registry") - ); + const [client] = useState(ServiceFactory.get("token-registry")); useEffect(() => { setIsWhitelisted(false); @@ -35,4 +31,3 @@ export function useTokenRegistryNativeTokenCheck(tokenId: string | null): [ return [isWhitelisted]; } - diff --git a/client/src/helpers/hooks/useTokenRegistryNftCheck.ts b/client/src/helpers/hooks/useTokenRegistryNftCheck.ts index 0f7644197..7de1c7f89 100644 --- a/client/src/helpers/hooks/useTokenRegistryNftCheck.ts +++ b/client/src/helpers/hooks/useTokenRegistryNftCheck.ts @@ -10,17 +10,12 @@ import { TokenRegistryClient } from "~services/stardust/tokenRegistryClient"; * @param nftId The nft id to check * @returns The whitelisted boolean. */ -export function useTokenRegistryNftCheck(issuerId: string | null, nftId?: string): [ - boolean, - boolean -] { +export function useTokenRegistryNftCheck(issuerId: string | null, nftId?: string): [boolean, boolean] { const { name: network } = useContext(NetworkContext); const isMounted = useIsMounted(); const [isWhitelisted, setIsWhitelisted] = useState(false); const [isChecking, setIsChecking] = useState(true); - const [client] = useState( - ServiceFactory.get("token-registry") - ); + const [client] = useState(ServiceFactory.get("token-registry")); useEffect(() => { setIsWhitelisted(false); @@ -40,4 +35,3 @@ export function useTokenRegistryNftCheck(issuerId: string | null, nftId?: string return [isWhitelisted, isChecking]; } - diff --git a/client/src/helpers/hooks/useTransactionHistoryDownload.ts b/client/src/helpers/hooks/useTransactionHistoryDownload.ts index 3fb4d2f6a..7cc729e43 100644 --- a/client/src/helpers/hooks/useTransactionHistoryDownload.ts +++ b/client/src/helpers/hooks/useTransactionHistoryDownload.ts @@ -11,15 +11,9 @@ import { StardustApiClient } from "~services/stardust/stardustApiClient"; * @param targetDate The target date * @returns The loading bool and an error message. */ -export function useTransactionHistoryDownload(network: string, address: string, targetDate: string | null): - [ - boolean, - string? - ] { +export function useTransactionHistoryDownload(network: string, address: string, targetDate: string | null): [boolean, string?] { const isMounted = useIsMounted(); - const [apiClient] = useState( - ServiceFactory.get(`api-client-${STARDUST}`) - ); + const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [error, setError] = useState(); const [isDownloading, setIsDownloading] = useState(true); @@ -28,24 +22,23 @@ export function useTransactionHistoryDownload(network: string, address: string, if (targetDate) { // eslint-disable-next-line no-void void (async () => { - apiClient.transactionHistoryDownload( - network, - address, - targetDate - ).then(response => { - if (response.raw) { - // eslint-disable-next-line no-void - void response.raw.blob().then(blob => { - if (isMounted) { - triggerDownload(blob, address); - } - }); - } else if (response.error && isMounted) { - setError(response.error); - } - }).finally(() => { - setIsDownloading(false); - }); + apiClient + .transactionHistoryDownload(network, address, targetDate) + .then((response) => { + if (response.raw) { + // eslint-disable-next-line no-void + void response.raw.blob().then((blob) => { + if (isMounted) { + triggerDownload(blob, address); + } + }); + } else if (response.error && isMounted) { + setError(response.error); + } + }) + .finally(() => { + setIsDownloading(false); + }); })(); } else { setIsDownloading(false); diff --git a/client/src/helpers/hooks/useTransactionIncludedBlock.ts b/client/src/helpers/hooks/useTransactionIncludedBlock.ts index 030b6aa00..6f701b049 100644 --- a/client/src/helpers/hooks/useTransactionIncludedBlock.ts +++ b/client/src/helpers/hooks/useTransactionIncludedBlock.ts @@ -12,12 +12,7 @@ import { HexHelper } from "../stardust/hexHelper"; * @param transactionId The transaction id * @returns The block, loading bool and an error string. */ -export function useTransactionIncludedBlock(network: string, transactionId: string | null): - [ - Block | null, - boolean, - string? - ] { +export function useTransactionIncludedBlock(network: string, transactionId: string | null): [Block | null, boolean, string?] { const isMounted = useIsMounted(); const [apiClient] = useState(ServiceFactory.get(`api-client-${STARDUST}`)); const [block, setBlock] = useState(null); @@ -29,17 +24,20 @@ export function useTransactionIncludedBlock(network: string, transactionId: stri if (transactionId) { // eslint-disable-next-line no-void void (async () => { - apiClient.transactionIncludedBlockDetails({ - network, - transactionId: HexHelper.addPrefix(transactionId) - }).then(response => { - if (isMounted) { - setBlock(response.block ?? null); - setError(response.error); - } - }).finally(() => { - setIsLoading(false); - }); + apiClient + .transactionIncludedBlockDetails({ + network, + transactionId: HexHelper.addPrefix(transactionId), + }) + .then((response) => { + if (isMounted) { + setBlock(response.block ?? null); + setError(response.error); + } + }) + .finally(() => { + setIsLoading(false); + }); })(); } else { setIsLoading(false); diff --git a/client/src/helpers/hooks/useVisualizerState.tsx b/client/src/helpers/hooks/useVisualizerState.tsx index 01380abe3..0c77e6778 100644 --- a/client/src/helpers/hooks/useVisualizerState.tsx +++ b/client/src/helpers/hooks/useVisualizerState.tsx @@ -12,9 +12,9 @@ import { Converter } from "../stardust/convertUtils"; const MAX_ITEMS: number = 2500; const FEED_PROBE_THRESHOLD: number = 3000; const EDGE_COLOR_LIGHT: number = 0x00000055; -const EDGE_COLOR_DARK: number = 0xFFFFFF33; -const EDGE_COLOR_CONFIRMING: number = 0xFF5AAAFF; -const EDGE_COLOR_CONFIRMED_BY: number = 0x0000FFFF; +const EDGE_COLOR_DARK: number = 0xffffff33; +const EDGE_COLOR_CONFIRMING: number = 0xff5aaaff; +const EDGE_COLOR_CONFIRMED_BY: number = 0x0000ffff; const COLOR_PENDING: string = "0xbbbbbb"; const COLOR_REFERENCED: string = "0x61e884"; const COLOR_CONFLICTING: string = "0xff8b5c"; @@ -28,22 +28,23 @@ const COLOR_SEARCH_RESULT: string = "0xC061E8"; * @param graphElement The div element ref to hook the graph * @returns Milestones and latestMilestonIndex */ -export function useVisualizerState(network: string, graphElement: React.MutableRefObject): [ - (() => void), - ((node?: Viva.Graph.INode) => void), +export function useVisualizerState( + network: string, + graphElement: React.MutableRefObject, +): [ + () => void, + (node?: Viva.Graph.INode) => void, string, React.Dispatch>, boolean, number, - (IFeedBlockData | null), - (boolean | null), + IFeedBlockData | null, + boolean | null, React.Dispatch>, - number | null + number | null, ] { const [settingsService] = useState(ServiceFactory.get("settings")); - const [darkMode, setDarkMode] = useState( - settingsService.get().darkMode ?? null - ); + const [darkMode, setDarkMode] = useState(settingsService.get().darkMode ?? null); const [filter, setFilter] = useState(""); const [isActive, setIsActive] = useState(true); const [isFormatAmountsFull, setIsFormatAmountsFull] = useState(null); @@ -114,7 +115,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR if (!existingNode) { graph.current.addNode(blockId, { feedItem: newBlock, - added: now + added: now, }); existingIds.current.push(blockId); @@ -153,7 +154,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR if (node.data) { node.data.feedItem.metadata = { ...node.data.feedItem.metadata, - ...updatedMetadata[blockId] + ...updatedMetadata[blockId], }; } @@ -196,29 +197,27 @@ export function useVisualizerState(network: string, graphElement: React.MutableR gravity: -2, dragCoeff: 0.02, timeStep: 20, - theta: 0.8 + theta: 0.8, }); graphics.current.setNodeProgram(buildNodeShader()); - graphics.current.node(node => calculateNodeStyle( - node, testForHighlight(highlightNodesRegEx(), node.id, node.data))); + graphics.current.node((node) => calculateNodeStyle(node, testForHighlight(highlightNodesRegEx(), node.id, node.data))); - graphics.current.link(() => Viva.Graph.View.webglLine(darkMode - ? EDGE_COLOR_DARK : EDGE_COLOR_LIGHT)); + graphics.current.link(() => Viva.Graph.View.webglLine(darkMode ? EDGE_COLOR_DARK : EDGE_COLOR_LIGHT)); const events = Viva.Graph.webglInputEvents(graphics.current, graph.current); - events.click(node => selectNode(node)); - events.dblClick(node => { + events.click((node) => selectNode(node)); + events.dblClick((node) => { window.open(`${window.location.origin}/${network}/block/${node.id}`, "_blank"); }); - events.mouseEnter(node => { + events.mouseEnter((node) => { if (!selectedFeedItemBlockId.current) { highlightConnections(node.id); } }); - events.mouseLeave(_ => { + events.mouseLeave((_) => { if (!selectedFeedItemBlockId.current) { styleConnections(); } @@ -228,15 +227,12 @@ export function useVisualizerState(network: string, graphElement: React.MutableR container: graphElement.current, graphics: graphics.current, layout, - renderLinks: true + renderLinks: true, }); renderer.current.run(); - graphics.current.scale( - 1, - { x: graphElement.current.clientWidth / 2, y: graphElement.current.clientHeight / 2 } - ); + graphics.current.scale(1, { x: graphElement.current.clientWidth / 2, y: graphElement.current.clientHeight / 2 }); for (let i = 0; i < 12; i++) { renderer.current.zoomOut(); @@ -308,7 +304,10 @@ export function useVisualizerState(network: string, graphElement: React.MutableR * @param highlight Highlight the node. * @returns The size and color for the node. */ - function calculateNodeStyle(node: Viva.Graph.INode | undefined, highlight: boolean): { + function calculateNodeStyle( + node: Viva.Graph.INode | undefined, + highlight: boolean, + ): { color: string; size: number; } { @@ -334,19 +333,15 @@ export function useVisualizerState(network: string, graphElement: React.MutableR color = COLOR_PENDING; } - const reattached = selectedFeedItem?.reattachments?.find( - item => item.blockId === node.data?.feedItem.blockId - ); - if (selectedFeedItem?.blockId === node.data?.feedItem.blockId || - reattached - ) { + const reattached = selectedFeedItem?.reattachments?.find((item) => item.blockId === node.data?.feedItem.blockId); + if (selectedFeedItem?.blockId === node.data?.feedItem.blockId || reattached) { size = 50; } } return { color, - size + size, }; } @@ -388,16 +383,16 @@ export function useVisualizerState(network: string, graphElement: React.MutableR feedItem.reattachments = []; graph.current?.forEachNode((n: Viva.Graph.INode) => { const reattached = n.data?.feedItem; - if (reattached?.blockId !== feedItem?.blockId && + if ( + reattached?.blockId !== feedItem?.blockId && reattached?.properties?.transactionId && - reattached?.properties.transactionId === feedItem?.properties?.transactionId) { + reattached?.properties.transactionId === feedItem?.properties?.transactionId + ) { feedItem.reattachments?.push(reattached); } }); } - setSelectedFeedItem( - isDeselect || !node ? null : feedItem ?? null - ); + setSelectedFeedItem(isDeselect || !node ? null : feedItem ?? null); styleConnections(); @@ -439,9 +434,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR graph.current?.forEachLink((link: Viva.Graph.ILink) => { const linkUI = graphics.current?.getLinkUI(link.id); if (linkUI) { - linkUI.color = darkMode ? - EDGE_COLOR_DARK : - EDGE_COLOR_LIGHT; + linkUI.color = darkMode ? EDGE_COLOR_DARK : EDGE_COLOR_LIGHT; } }); } @@ -476,10 +469,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR * @param data The data node to match. * @returns True if we should highlight the node. */ - function testForHighlight( - regEx: RegExp | undefined, - nodeId: string | undefined, - data: INodeData | undefined): boolean { + function testForHighlight(regEx: RegExp | undefined, nodeId: string | undefined, data: INodeData | undefined): boolean { if (!regEx || !nodeId || !data) { return false; } @@ -492,9 +482,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR let key: keyof typeof properties; for (key in properties) { const val = String(properties[key]); - if (regEx.test(val) || - (Converter.isHex(val, true) && regEx.test(Converter.hexToUtf8(val))) - ) { + if (regEx.test(val) || (Converter.isHex(val, true) && regEx.test(Converter.hexToUtf8(val)))) { return true; } } @@ -511,7 +499,7 @@ export function useVisualizerState(network: string, graphElement: React.MutableR graphics.current?.updateSize(); graphics.current?.scale(1, { x: graphElement.current.clientWidth / 2, - y: graphElement.current.clientHeight / 2 + y: graphElement.current.clientHeight / 2, }); } } @@ -548,7 +536,6 @@ export function useVisualizerState(network: string, graphElement: React.MutableR selectedFeedItem, isFormatAmountsFull, setIsFormatAmountsFull, - lastClick.current + lastClick.current, ]; } - diff --git a/client/src/helpers/identityHelper.ts b/client/src/helpers/identityHelper.ts index a9866bb18..ea57d7b87 100644 --- a/client/src/helpers/identityHelper.ts +++ b/client/src/helpers/identityHelper.ts @@ -12,28 +12,27 @@ export class IdentityHelper { return `${msgId.slice(0, 7)}....${msgId.slice(-7)}`; } - /** - * transforms a identity document based on messageType and version - * @param document document to transform - * @param messageType type of message - * @param version version of the identity document - * @returns transformed document - */ - public static transformDocument( - document: unknown, messageType: "diff" | "integration", version: string): Record { - let transformedDocument = document as Record; - if (messageType === "integration" && version === "legacy") { - transformedDocument = { - ...(document as IIdentityDocument).doc, - ...(document as IIdentityDocument).meta, - proof: (document as IIdentityDocument).proof - }; - } + /** + * transforms a identity document based on messageType and version + * @param document document to transform + * @param messageType type of message + * @param version version of the identity document + * @returns transformed document + */ + public static transformDocument(document: unknown, messageType: "diff" | "integration", version: string): Record { + let transformedDocument = document as Record; + if (messageType === "integration" && version === "legacy") { + transformedDocument = { + ...(document as IIdentityDocument).doc, + ...(document as IIdentityDocument).meta, + proof: (document as IIdentityDocument).proof, + }; + } - if (messageType === "integration") { - delete transformedDocument.integrationMessageId; - } + if (messageType === "integration") { + delete transformedDocument.integrationMessageId; + } - return transformedDocument; + return transformedDocument; } } diff --git a/client/src/helpers/jsonSyntaxHelper.ts b/client/src/helpers/jsonSyntaxHelper.ts index 7837a6abb..2fdbe929b 100644 --- a/client/src/helpers/jsonSyntaxHelper.ts +++ b/client/src/helpers/jsonSyntaxHelper.ts @@ -8,13 +8,13 @@ export class JsonSyntaxHelper { */ public static syntaxHighlight(json: string): string { return json - .replaceAll('&', "&") - .replaceAll('<', "<") - .replaceAll('>', ">") + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") .replaceAll( // eslint-disable-next-line max-len /("(\\u[\dA-Za-z]{4}|\\[^u]|[^"\\])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?)/g, - match => { + (match) => { let cls = "number"; if (match.startsWith('"')) { cls = match.endsWith(":") ? "key" : "string"; @@ -24,7 +24,7 @@ export class JsonSyntaxHelper { cls = "null"; } return `${match}`; - } + }, ); } } diff --git a/client/src/helpers/networkHelper.ts b/client/src/helpers/networkHelper.ts index 2b60a3644..d92d1a28b 100644 --- a/client/src/helpers/networkHelper.ts +++ b/client/src/helpers/networkHelper.ts @@ -1,6 +1,13 @@ import { - ALPHANET, CHRYSALIS_MAINNET, CUSTOM, DEVNET, LEGACY_MAINNET, - MAINNET, NetworkType, SHIMMER, TESTNET + ALPHANET, + CHRYSALIS_MAINNET, + CUSTOM, + DEVNET, + LEGACY_MAINNET, + MAINNET, + NetworkType, + SHIMMER, + TESTNET, } from "~models/config/networkType"; import { SHIMMER_UI, Theme } from "~models/config/uiTheme"; @@ -53,4 +60,3 @@ export const isMarketedNetwork = (networkType: NetworkType | string | undefined) return true; }; - diff --git a/client/src/helpers/nodeShader.ts b/client/src/helpers/nodeShader.ts index 4e3cd504b..3892cf85e 100644 --- a/client/src/helpers/nodeShader.ts +++ b/client/src/helpers/nodeShader.ts @@ -19,7 +19,7 @@ export function buildNodeShader(): WebGLProgram { " } else {", " gl_FragColor = vec4(0);", " }", - "}" + "}", ].join("\n"); const nodesVS = [ "attribute vec2 a_vertexPos;", @@ -38,7 +38,7 @@ export function buildNodeShader(): WebGLProgram { " color.g = mod(c, 256.0); c = floor(c/256.0);", " color.r = mod(c, 256.0); c = floor(c/256.0); color /= 255.0;", " color.a = 1.0;", - "}" + "}", ].join("\n"); let program: WebGLProgram; let gl: WebGLRenderingContext; @@ -79,9 +79,9 @@ export function buildNodeShader(): WebGLProgram { position: (nodeUI: { color: number; size: number; id: number }, pos: { x: number; y: number }) => { const idx = nodeUI.id; nodes[idx * ATTRIBUTES_PER_PRIMITIVE] = pos.x; - nodes[(idx * ATTRIBUTES_PER_PRIMITIVE) + 1] = -pos.y; - nodes[(idx * ATTRIBUTES_PER_PRIMITIVE) + 2] = nodeUI.color; - nodes[(idx * ATTRIBUTES_PER_PRIMITIVE) + 3] = nodeUI.size; + nodes[idx * ATTRIBUTES_PER_PRIMITIVE + 1] = -pos.y; + nodes[idx * ATTRIBUTES_PER_PRIMITIVE + 2] = nodeUI.color; + nodes[idx * ATTRIBUTES_PER_PRIMITIVE + 3] = nodeUI.size; }, /** * Request from webgl renderer to actually draw our stuff into the @@ -97,7 +97,14 @@ export function buildNodeShader(): WebGLProgram { gl.uniform2f(locations.screenSize, canvasWidth, canvasHeight); } gl.vertexAttribPointer(locations.vertexPos, 2, gl.FLOAT, false, ATTRIBUTES_PER_PRIMITIVE * Float32Array.BYTES_PER_ELEMENT, 0); - gl.vertexAttribPointer(locations.customAttributes, 2, gl.FLOAT, false, ATTRIBUTES_PER_PRIMITIVE * Float32Array.BYTES_PER_ELEMENT, 2 * 4); + gl.vertexAttribPointer( + locations.customAttributes, + 2, + gl.FLOAT, + false, + ATTRIBUTES_PER_PRIMITIVE * Float32Array.BYTES_PER_ELEMENT, + 2 * 4, + ); gl.drawArrays(gl.POINTS, 0, nodesCount); }, @@ -140,7 +147,12 @@ export function buildNodeShader(): WebGLProgram { // Instead we swap deleted node with the "last" node in the // buffer and decrease marker of the "last" node. Gives nice O(1) // performance, but make code slightly harder than it could be: - webglUtils.copyArrayPart(nodes, node.id * ATTRIBUTES_PER_PRIMITIVE, nodesCount * ATTRIBUTES_PER_PRIMITIVE, ATTRIBUTES_PER_PRIMITIVE); + webglUtils.copyArrayPart( + nodes, + node.id * ATTRIBUTES_PER_PRIMITIVE, + nodesCount * ATTRIBUTES_PER_PRIMITIVE, + ATTRIBUTES_PER_PRIMITIVE, + ); } }, /** @@ -148,7 +160,6 @@ export function buildNodeShader(): WebGLProgram { * buffers. We don't use it here, but it's needed by API (see the comment * in the removeNode() method) */ - replaceProperties() { - } + replaceProperties() {}, }; } diff --git a/client/src/helpers/numberHelper.ts b/client/src/helpers/numberHelper.ts index 4abe18d28..65b44b46c 100644 --- a/client/src/helpers/numberHelper.ts +++ b/client/src/helpers/numberHelper.ts @@ -1,4 +1,3 @@ - export class NumberHelper { /** * Get the number rounded to n decimals. @@ -14,4 +13,3 @@ export class NumberHelper { return /^-?\d+$/.test(value); } } - diff --git a/client/src/helpers/pageUtils.ts b/client/src/helpers/pageUtils.ts index 0d1a3e73e..99bf9293c 100644 --- a/client/src/helpers/pageUtils.ts +++ b/client/src/helpers/pageUtils.ts @@ -2,7 +2,6 @@ export const scrollToTop = () => { window.scrollTo({ left: 0, top: 0, - behavior: "smooth" + behavior: "smooth", }); }; - diff --git a/client/src/helpers/routeBuilder.ts b/client/src/helpers/routeBuilder.ts index 4435940ac..b09e553b6 100644 --- a/client/src/helpers/routeBuilder.ts +++ b/client/src/helpers/routeBuilder.ts @@ -13,16 +13,19 @@ export class RouteBuilder { * @param item.milestoneIndex The milestone index for the item. * @returns The milestone route. */ - public static buildMilestone(networkConfig: INetwork | undefined, item: { - /** - * The id. - */ - id: string; - /** - * The milestone index. - */ - milestoneIndex: number; - }): string { + public static buildMilestone( + networkConfig: INetwork | undefined, + item: { + /** + * The id. + */ + id: string; + /** + * The milestone index. + */ + milestoneIndex: number; + }, + ): string { const parts = []; if (networkConfig) { parts.push(networkConfig.network); diff --git a/client/src/helpers/stardust/base64Encode.ts b/client/src/helpers/stardust/base64Encode.ts index a54b50c09..3c6f172c4 100644 --- a/client/src/helpers/stardust/base64Encode.ts +++ b/client/src/helpers/stardust/base64Encode.ts @@ -85,7 +85,7 @@ export class Base64 { "119": 48, "120": 49, "121": 50, - "122": 51 + "122": 51, }; /** @@ -129,9 +129,7 @@ export class Base64 { } if (placeHoldersLen === 2) { - tmp = - (Base64._REVERSE_LOOKUP[base64.charCodeAt(i)] << 2) | - (Base64._REVERSE_LOOKUP[base64.charCodeAt(i + 1)] >> 4); + tmp = (Base64._REVERSE_LOOKUP[base64.charCodeAt(i)] << 2) | (Base64._REVERSE_LOOKUP[base64.charCodeAt(i + 1)] >> 4); arr[curByte++] = tmp & 0xff; } @@ -170,9 +168,7 @@ export class Base64 { parts.push(`${Base64._LOOKUP[tmp >> 2] + Base64._LOOKUP[(tmp << 4) & 0x3f]}==`); } else if (extraBytes === 2) { tmp = (bytes[len - 2] << 8) + bytes[len - 1]; - parts.push( - `${Base64._LOOKUP[tmp >> 10] + Base64._LOOKUP[(tmp >> 4) & 0x3f] + Base64._LOOKUP[(tmp << 2) & 0x3f]}=` - ); + parts.push(`${Base64._LOOKUP[tmp >> 10] + Base64._LOOKUP[(tmp >> 4) & 0x3f] + Base64._LOOKUP[(tmp << 2) & 0x3f]}=`); } return parts.join(""); @@ -247,4 +243,3 @@ export class Base64 { return output.join(""); } } - diff --git a/client/src/helpers/stardust/bech32AddressHelper.ts b/client/src/helpers/stardust/bech32AddressHelper.ts index acaff9cbe..e0155f93a 100644 --- a/client/src/helpers/stardust/bech32AddressHelper.ts +++ b/client/src/helpers/stardust/bech32AddressHelper.ts @@ -13,9 +13,7 @@ export class Bech32AddressHelper { * @returns The parts of the address. */ public static buildAddress(hrp: string, address: string | Address, typeHint?: number): IBech32AddressDetails { - return typeof address === "string" - ? this.buildAddressFromString(hrp, address, typeHint) - : this.buildAddressFromTypes(hrp, address); + return typeof address === "string" ? this.buildAddressFromString(hrp, address, typeHint) : this.buildAddressFromTypes(hrp, address); } private static buildAddressFromString(hrp: string, address: string, typeHint?: number): IBech32AddressDetails { @@ -31,8 +29,7 @@ export class Bech32AddressHelper { type = result.addressType; hex = Converter.bytesToHex(result.addressBytes, true); } - } catch { - } + } catch {} } if (!bech32) { @@ -46,7 +43,7 @@ export class Bech32AddressHelper { bech32, hex, type, - typeLabel: Bech32AddressHelper.typeLabel(type) + typeLabel: Bech32AddressHelper.typeLabel(type), }; } @@ -54,17 +51,11 @@ export class Bech32AddressHelper { let hex: string = ""; if (address.type === AddressType.Ed25519) { - hex = HexHelper.stripPrefix( - (address as Ed25519Address).pubKeyHash - ); + hex = HexHelper.stripPrefix((address as Ed25519Address).pubKeyHash); } else if (address.type === AddressType.Alias) { - hex = HexHelper.stripPrefix( - (address as AliasAddress).aliasId - ); + hex = HexHelper.stripPrefix((address as AliasAddress).aliasId); } else if (address.type === AddressType.Nft) { - hex = HexHelper.stripPrefix( - (address as NftAddress).nftId - ); + hex = HexHelper.stripPrefix((address as NftAddress).nftId); } return this.buildAddressFromString(hrp, hex, address.type); diff --git a/client/src/helpers/stardust/bigIntHelper.ts b/client/src/helpers/stardust/bigIntHelper.ts index 1417ae3ed..7670d0722 100644 --- a/client/src/helpers/stardust/bigIntHelper.ts +++ b/client/src/helpers/stardust/bigIntHelper.ts @@ -29,12 +29,7 @@ export class BigIntHelper { * @returns The bigint. */ public static read4(data: Uint8Array, byteOffset: number): BigInteger { - const v0 = - (data[byteOffset + 0] + - (data[byteOffset + 1] << 8) + - (data[byteOffset + 2] << 16) + - (data[byteOffset + 3] << 24)) >>> - 0; + const v0 = (data[byteOffset + 0] + (data[byteOffset + 1] << 8) + (data[byteOffset + 2] << 16) + (data[byteOffset + 3] << 24)) >>> 0; return bigInt(v0); } @@ -99,4 +94,3 @@ export class BigIntHelper { data.set(littleEndian, byteOffset); } } - diff --git a/client/src/helpers/stardust/convertUtils.ts b/client/src/helpers/stardust/convertUtils.ts index 650aa8eaf..1fa88caa5 100644 --- a/client/src/helpers/stardust/convertUtils.ts +++ b/client/src/helpers/stardust/convertUtils.ts @@ -43,17 +43,12 @@ export class Converter { str += String.fromCharCode(((value & 0x1f) << 6) | (array[i + 1] & 0x3f)); i += 1; } else if (value > 0xdf && value < 0xf0) { - str += String.fromCharCode( - ((value & 0x0f) << 12) | ((array[i + 1] & 0x3f) << 6) | (array[i + 2] & 0x3f) - ); + str += String.fromCharCode(((value & 0x0f) << 12) | ((array[i + 1] & 0x3f) << 6) | (array[i + 2] & 0x3f)); i += 2; } else { // surrogate pair const charCode = - (((value & 0x07) << 18) | - ((array[i + 1] & 0x3f) << 12) | - ((array[i + 2] & 0x3f) << 6) | - (array[i + 3] & 0x3f)) - + (((value & 0x07) << 18) | ((array[i + 1] & 0x3f) << 12) | ((array[i + 2] & 0x3f) << 6) | (array[i + 3] & 0x3f)) - 0x010000; str += String.fromCharCode((charCode >> 10) | 0xd800, (charCode & 0x03ff) | 0xdc00); @@ -91,7 +86,7 @@ export class Converter { 0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), - 0x80 | (charcode & 0x3f) + 0x80 | (charcode & 0x3f), ); } } @@ -113,7 +108,7 @@ export class Converter { includePrefix: boolean = false, startIndex?: number, length?: number | undefined, - reverse?: boolean + reverse?: boolean, ): string { let hex = ""; this.buildHexLookups(); @@ -151,8 +146,7 @@ export class Converter { let n = 0; while (i < length) { array[n++] = - (Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)] << 4) | - Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)]; + (Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)] << 4) | Converter.DECODE_LOOKUP[strippedHex.charCodeAt(i++)]; } if (reverse) { @@ -287,5 +281,3 @@ export class Converter { } } } - - diff --git a/client/src/helpers/stardust/crypto.ts b/client/src/helpers/stardust/crypto.ts index b04429d9f..fcf0e5d2a 100644 --- a/client/src/helpers/stardust/crypto.ts +++ b/client/src/helpers/stardust/crypto.ts @@ -29,8 +29,8 @@ export class Blake2b { * @internal */ private static readonly BLAKE2B_IV32 = new Uint32Array([ - 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1, - 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19 + 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1, 0x510e527f, 0x2b3e6c1f, + 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19, ]); /** @@ -38,12 +38,11 @@ export class Blake2b { * @internal */ private static readonly SIGMA8 = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, 11, - 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, 9, 0, 5, - 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, 12, 5, 1, 15, - 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, 6, 15, 14, 9, 11, - 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, 11, 8, 12, 0, 5, 2, 15, + 13, 10, 14, 3, 6, 7, 1, 9, 4, 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, + 3, 13, 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, 13, 11, 7, 14, + 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, + 3, 12, 13, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, ]; /** @@ -52,7 +51,7 @@ export class Blake2b { * because this is Javascript and we don't have uint64s * @internal */ - private static readonly SIGMA82 = new Uint8Array(Blake2b.SIGMA8.map(x => x * 2)); + private static readonly SIGMA82 = new Uint8Array(Blake2b.SIGMA8.map((x) => x * 2)); /** * The V vector. @@ -91,7 +90,7 @@ export class Blake2b { h: new Uint32Array(16), t: 0, // input count c: 0, // pointer within buffer - outlen // output length in bytes + outlen, // output length in bytes }; this.init(outlen, key); } @@ -348,4 +347,3 @@ export class Blake2b { this._v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1); } } - diff --git a/client/src/helpers/stardust/hexHelper.ts b/client/src/helpers/stardust/hexHelper.ts index a0c632dee..8e8e19813 100644 --- a/client/src/helpers/stardust/hexHelper.ts +++ b/client/src/helpers/stardust/hexHelper.ts @@ -9,10 +9,7 @@ export class HexHelper { /** * Const defining the maximum value for a 256 bit int. */ - public static readonly BIG_INT_MAX_256_BIT: BigInteger = bigInt( - "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - 16 - ); + public static readonly BIG_INT_MAX_256_BIT: BigInteger = bigInt("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16); /** * Convert the big int 256 bit to hex string. @@ -68,4 +65,3 @@ export class HexHelper { return hex.startsWith("0x"); } } - diff --git a/client/src/helpers/stardust/ipfsHelper.ts b/client/src/helpers/stardust/ipfsHelper.ts index 6243a55ef..51646c674 100644 --- a/client/src/helpers/stardust/ipfsHelper.ts +++ b/client/src/helpers/stardust/ipfsHelper.ts @@ -7,8 +7,8 @@ const IPFS_ENDPOINT = "https://ipfs.io"; const IPFS_PATH = "/ipfs/"; interface IpfsLink { - path?: string; - hash: string; + path?: string; + hash: string; } /** * Get hash from ipfs link. @@ -19,7 +19,7 @@ export function getIPFSHash(url?: string): string | undefined { const ipfsPrefix = "ipfs://"; if (url?.startsWith(ipfsPrefix)) { - return url.slice(ipfsPrefix.length); + return url.slice(ipfsPrefix.length); } } @@ -41,8 +41,7 @@ export async function getIpfsUri(link: IpfsLink): Promise { } ipfsLink = `${ipfsLink}/${encodeURIComponent(ipfsEntry.name)}`; } - } catch { } + } catch {} return `${IPFS_ENDPOINT}${ipfsLink}`; } - diff --git a/client/src/helpers/stardust/metadataUtils.ts b/client/src/helpers/stardust/metadataUtils.ts index 1e85a879e..c39fd2608 100644 --- a/client/src/helpers/stardust/metadataUtils.ts +++ b/client/src/helpers/stardust/metadataUtils.ts @@ -15,7 +15,7 @@ export function tryParseMetadata(metadataHex: HexEncodedString, schema: jsons if (result.valid) { return json as S; } - } catch { } + } catch {} return null; } diff --git a/client/src/helpers/stardust/participationUtils.ts b/client/src/helpers/stardust/participationUtils.ts index 18d7ec753..799cf58c0 100644 --- a/client/src/helpers/stardust/participationUtils.ts +++ b/client/src/helpers/stardust/participationUtils.ts @@ -60,6 +60,6 @@ function deserializeParticipation(readStream: ReadStream): Participation { return { eventId, answersCount, - answers + answers, }; } diff --git a/client/src/helpers/stardust/readStreamUtils.ts b/client/src/helpers/stardust/readStreamUtils.ts index 2b191034f..13a4a19f4 100644 --- a/client/src/helpers/stardust/readStreamUtils.ts +++ b/client/src/helpers/stardust/readStreamUtils.ts @@ -74,9 +74,7 @@ export class ReadStream { this._readIndex = readIndex; if (readIndex >= this._storage.length) { - throw new Error( - `You cannot set the readIndex to ${readIndex} as the stream is only ${this._storage.length} in length` - ); + throw new Error(`You cannot set the readIndex to ${readIndex} as the stream is only ${this._storage.length} in length`); } } @@ -225,4 +223,3 @@ export class ReadStream { return val !== 0; } } - diff --git a/client/src/helpers/stardust/statisticsUtils.ts b/client/src/helpers/stardust/statisticsUtils.ts index 529668187..2867d8841 100644 --- a/client/src/helpers/stardust/statisticsUtils.ts +++ b/client/src/helpers/stardust/statisticsUtils.ts @@ -31,86 +31,101 @@ export interface DataPoint { */ export function mapDailyStatsToGraphsData(data: IInfluxDailyResponse): IStatisticsGraphsData { return { - blocksDaily: data.blocksDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - transaction: day.transaction ?? 0, - milestone: day.milestone ?? 0, - taggedData: day.taggedData ?? 0, - noPayload: day.noPayload ?? 0 - })) ?? [], - transactionsDaily: data.transactionsDaily?.map(t => ({ - time: moment(t.time).add(1, "minute").unix(), - confirmed: t.confirmed ?? 0, - conflicting: t.conflicting ?? 0 - })) ?? [], - outputsDaily: data.outputsDaily?.map(output => ({ - time: moment(output.time).add(1, "minute").unix(), - basic: output.basic ?? 0, - alias: output.alias ?? 0, - foundry: output.foundry ?? 0, - nft: output.nft ?? 0 - })) ?? [], - tokensHeldDaily: data.tokensHeldDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - basic: day.basic ?? 0, - alias: day.alias ?? 0, - foundry: day.foundry ?? 0, - nft: day.nft ?? 0 - })) ?? [], - addressesWithBalanceDaily: data.addressesWithBalanceDaily?.map(entry => ({ - time: moment(entry.time).add(1, "minute").unix(), - n: entry.addressesWithBalance ?? 0 - })) ?? [], - activeAddresses: data.activeAddressesDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - n: day.activeAddresses ?? 0 - })) ?? [], - tokensTransferredDaily: data.tokensTransferredDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - n: day.tokens ?? 0 - })) ?? [], - aliasActivityDaily: data.aliasActivityDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - created: day.created ?? 0, - governorChanged: day.governorChanged ?? 0, - stateChanged: day.stateChanged ?? 0, - destroyed: day.destroyed ?? 0 - })) ?? [], - unlockConditionsPerTypeDaily: data.unlockConditionsPerTypeDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - timelock: day.timelock ?? 0, - storageDepositReturn: day.storageDepositReturn ?? 0, - expiration: day.expiration ?? 0 - })) ?? [], - nftActivityDaily: data.nftActivityDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - created: day.created ?? 0, - transferred: day.transferred ?? 0, - destroyed: day.destroyed ?? 0 - })) ?? [], - tokensHeldWithUnlockConditionDaily: data.tokensHeldWithUnlockConditionDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - timelock: day.timelock ?? 0, - storageDepositReturn: day.storageDepositReturn ?? 0, - expiration: day.expiration ?? 0 - })) ?? [], - unclaimedTokensDaily: data.unclaimedTokensDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - n: day.unclaimed ?? 0 - })) ?? [], - unclaimedGenesisOutputsDaily: data.unclaimedGenesisOutputsDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - n: day.unclaimed ?? 0 - })) ?? [], - ledgerSizeDaily: data.ledgerSizeDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - keyBytes: day.keyBytes ?? 0, - dataBytes: day.dataBytes ?? 0 - })) ?? [], - storageDepositDaily: data.storageDepositDaily?.map(day => ({ - time: moment(day.time).add(1, "minute").unix(), - n: day.storageDeposit ?? 0 - })) ?? [] + blocksDaily: + data.blocksDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + transaction: day.transaction ?? 0, + milestone: day.milestone ?? 0, + taggedData: day.taggedData ?? 0, + noPayload: day.noPayload ?? 0, + })) ?? [], + transactionsDaily: + data.transactionsDaily?.map((t) => ({ + time: moment(t.time).add(1, "minute").unix(), + confirmed: t.confirmed ?? 0, + conflicting: t.conflicting ?? 0, + })) ?? [], + outputsDaily: + data.outputsDaily?.map((output) => ({ + time: moment(output.time).add(1, "minute").unix(), + basic: output.basic ?? 0, + alias: output.alias ?? 0, + foundry: output.foundry ?? 0, + nft: output.nft ?? 0, + })) ?? [], + tokensHeldDaily: + data.tokensHeldDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + basic: day.basic ?? 0, + alias: day.alias ?? 0, + foundry: day.foundry ?? 0, + nft: day.nft ?? 0, + })) ?? [], + addressesWithBalanceDaily: + data.addressesWithBalanceDaily?.map((entry) => ({ + time: moment(entry.time).add(1, "minute").unix(), + n: entry.addressesWithBalance ?? 0, + })) ?? [], + activeAddresses: + data.activeAddressesDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + n: day.activeAddresses ?? 0, + })) ?? [], + tokensTransferredDaily: + data.tokensTransferredDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + n: day.tokens ?? 0, + })) ?? [], + aliasActivityDaily: + data.aliasActivityDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + created: day.created ?? 0, + governorChanged: day.governorChanged ?? 0, + stateChanged: day.stateChanged ?? 0, + destroyed: day.destroyed ?? 0, + })) ?? [], + unlockConditionsPerTypeDaily: + data.unlockConditionsPerTypeDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + timelock: day.timelock ?? 0, + storageDepositReturn: day.storageDepositReturn ?? 0, + expiration: day.expiration ?? 0, + })) ?? [], + nftActivityDaily: + data.nftActivityDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + created: day.created ?? 0, + transferred: day.transferred ?? 0, + destroyed: day.destroyed ?? 0, + })) ?? [], + tokensHeldWithUnlockConditionDaily: + data.tokensHeldWithUnlockConditionDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + timelock: day.timelock ?? 0, + storageDepositReturn: day.storageDepositReturn ?? 0, + expiration: day.expiration ?? 0, + })) ?? [], + unclaimedTokensDaily: + data.unclaimedTokensDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + n: day.unclaimed ?? 0, + })) ?? [], + unclaimedGenesisOutputsDaily: + data.unclaimedGenesisOutputsDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + n: day.unclaimed ?? 0, + })) ?? [], + ledgerSizeDaily: + data.ledgerSizeDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + keyBytes: day.keyBytes ?? 0, + dataBytes: day.dataBytes ?? 0, + })) ?? [], + storageDepositDaily: + data.storageDepositDaily?.map((day) => ({ + time: moment(day.time).add(1, "minute").unix(), + n: day.storageDeposit ?? 0, + })) ?? [], }; } @@ -124,4 +139,3 @@ export function* idGenerator(): Generator { yield (id++).toString(); } } - diff --git a/client/src/helpers/stardust/transactionsHelper.ts b/client/src/helpers/stardust/transactionsHelper.ts index 86187e484..8128f49d0 100644 --- a/client/src/helpers/stardust/transactionsHelper.ts +++ b/client/src/helpers/stardust/transactionsHelper.ts @@ -2,12 +2,30 @@ import { AddressUnlockCondition, BasicOutput, - Block, CommonOutput, FeatureType, GovernorAddressUnlockCondition, - ImmutableAliasAddressUnlockCondition, InputType, IRent, MilestonePayload, Output, OutputType, PayloadType, - ReferenceUnlock, RegularTransactionEssence, SignatureUnlock, + Block, + CommonOutput, + FeatureType, + GovernorAddressUnlockCondition, + ImmutableAliasAddressUnlockCondition, + InputType, + IRent, + MilestonePayload, + Output, + OutputType, + PayloadType, + ReferenceUnlock, + RegularTransactionEssence, + SignatureUnlock, StateControllerAddressUnlockCondition, TagFeature, - TransactionPayload, TreasuryOutput, Unlock, UnlockCondition, UnlockConditionType, UnlockType, Utils, UTXOInput + TransactionPayload, + TreasuryOutput, + Unlock, + UnlockCondition, + UnlockConditionType, + UnlockType, + Utils, + UTXOInput, } from "@iota/sdk-wasm/web"; import bigInt from "big-integer"; import { Converter } from "./convertUtils"; @@ -38,8 +56,11 @@ const HEX_PARTICIPATE = "0x5041525449434950415445"; export const STARDUST_GENESIS_MILESTONE = 7669900; export class TransactionsHelper { - public static async getInputsAndOutputs(block: Block | undefined, network: string, - _bechHrp: string, apiClient: StardustApiClient + public static async getInputsAndOutputs( + block: Block | undefined, + network: string, + _bechHrp: string, + apiClient: StardustApiClient, ): Promise { const GENESIS_HASH = "0".repeat(64); const inputs: IInput[] = []; @@ -78,8 +99,8 @@ export class TransactionsHelper { unlockAddresses.push( Bech32AddressHelper.buildAddress( _bechHrp, - Utils.hexPublicKeyToBech32Address(signatureUnlock.signature.publicKey, _bechHrp) - ) + Utils.hexPublicKeyToBech32Address(signatureUnlock.signature.publicKey, _bechHrp), + ), ); } @@ -97,10 +118,7 @@ export class TransactionsHelper { const utxoInput = input as UTXOInput; isGenesis = utxoInput.transactionId === GENESIS_HASH; - const outputId = Utils.computeOutputId( - utxoInput.transactionId, - utxoInput.transactionOutputIndex - ); + const outputId = Utils.computeOutputId(utxoInput.transactionId, utxoInput.transactionOutputIndex); const response = await apiClient.outputDetails({ network, outputId }); const details = response.output; @@ -108,7 +126,7 @@ export class TransactionsHelper { if (!response.error && details?.output && details?.metadata) { outputDetails = { output: details.output, - metadata: details.metadata + metadata: details.metadata, }; amount = Number(details.output.amount); } @@ -121,7 +139,7 @@ export class TransactionsHelper { isGenesis, outputId, output: outputDetails, - address + address, }); } } @@ -136,16 +154,18 @@ export class TransactionsHelper { outputs.push({ id: outputId, output, - amount: Number(payloadEssence.outputs[i].amount) + amount: Number(payloadEssence.outputs[i].amount), }); } else { const output = payloadEssence.outputs[i] as CommonOutput; const address: IBech32AddressDetails = TransactionsHelper.bechAddressFromAddressUnlockCondition( - output.unlockConditions, _bechHrp, output.type + output.unlockConditions, + _bechHrp, + output.type, ); - const isRemainder = inputs.some(input => input.address.bech32 === address.bech32); + const isRemainder = inputs.some((input) => input.address.bech32 === address.bech32); if (isRemainder) { remainderOutputs.push({ @@ -153,7 +173,7 @@ export class TransactionsHelper { address, amount: Number(payloadEssence.outputs[i].amount), isRemainder, - output + output, }); } else { outputs.push({ @@ -161,7 +181,7 @@ export class TransactionsHelper { address, amount: Number(payloadEssence.outputs[i].amount), isRemainder, - output + output, }); } @@ -202,9 +222,7 @@ export class TransactionsHelper { * @returns The BLAKE2b-256 hash for Alias Id. */ public static buildIdHashForAlias(aliasId: string, outputId: string): string { - return HexHelper.toBigInt256(aliasId).eq(bigInt.zero) ? - Utils.computeAliasId(outputId) : - aliasId; + return HexHelper.toBigInt256(aliasId).eq(bigInt.zero) ? Utils.computeAliasId(outputId) : aliasId; } /** @@ -214,18 +232,16 @@ export class TransactionsHelper { * @returns The BLAKE2b-256 hash for Nft Id. */ public static buildIdHashForNft(nftId: string, outputId: string): string { - return HexHelper.toBigInt256(nftId).eq(bigInt.zero) ? - Utils.computeNftId(outputId) : - nftId; + return HexHelper.toBigInt256(nftId).eq(bigInt.zero) ? Utils.computeNftId(outputId) : nftId; } public static computeStorageRentBalance(outputs: Output[], rentStructure: IRent): number { - const outputsWithoutSdruc = outputs.filter(output => { + const outputsWithoutSdruc = outputs.filter((output) => { if (output.type === OutputType.Treasury) { return false; } const hasStorageDepositUnlockCondition = (output as CommonOutput).unlockConditions.some( - uc => uc.type === UnlockConditionType.StorageDepositReturn + (uc) => uc.type === UnlockConditionType.StorageDepositReturn, ); return !hasStorageDepositUnlockCondition; @@ -233,7 +249,7 @@ export class TransactionsHelper { const rentBalance = outputsWithoutSdruc.reduce( (acc, output) => acc + Number(Utils.computeStorageDeposit(output, rentStructure)), - 0 + 0, ); return rentBalance; } @@ -245,9 +261,7 @@ export class TransactionsHelper { */ public static isParticipationEventOutput(output: Output): boolean { if (output.type === OutputType.Basic) { - const tagFeature = (output as BasicOutput).features?.find( - feature => feature.type === FeatureType.Tag - ) as TagFeature; + const tagFeature = (output as BasicOutput).features?.find((feature) => feature.type === FeatureType.Tag) as TagFeature; if (tagFeature) { return tagFeature.tag === HEX_PARTICIPATE; @@ -285,30 +299,30 @@ export class TransactionsHelper { private static bechAddressFromAddressUnlockCondition( unlockConditions: UnlockCondition[], _bechHrp: string, - outputType: number + outputType: number, ): IBech32AddressDetails { let address: IBech32AddressDetails = { bech32: "" }; let unlockCondition; if (outputType === OutputType.Basic || outputType === OutputType.Nft) { - unlockCondition = unlockConditions?.filter( - ot => ot.type === UnlockConditionType.Address - ).map(ot => ot as AddressUnlockCondition)[0]; + unlockCondition = unlockConditions + ?.filter((ot) => ot.type === UnlockConditionType.Address) + .map((ot) => ot as AddressUnlockCondition)[0]; } else if (outputType === OutputType.Alias) { - if (unlockConditions.some(ot => ot.type === UnlockConditionType.StateControllerAddress)) { - unlockCondition = unlockConditions?.filter( - ot => ot.type === UnlockConditionType.StateControllerAddress - ).map(ot => ot as StateControllerAddressUnlockCondition)[0]; + if (unlockConditions.some((ot) => ot.type === UnlockConditionType.StateControllerAddress)) { + unlockCondition = unlockConditions + ?.filter((ot) => ot.type === UnlockConditionType.StateControllerAddress) + .map((ot) => ot as StateControllerAddressUnlockCondition)[0]; } - if (unlockConditions.some(ot => ot.type === UnlockConditionType.GovernorAddress)) { - unlockCondition = unlockConditions?.filter( - ot => ot.type === UnlockConditionType.GovernorAddress - ).map(ot => ot as GovernorAddressUnlockCondition)[0]; + if (unlockConditions.some((ot) => ot.type === UnlockConditionType.GovernorAddress)) { + unlockCondition = unlockConditions + ?.filter((ot) => ot.type === UnlockConditionType.GovernorAddress) + .map((ot) => ot as GovernorAddressUnlockCondition)[0]; } } else if (outputType === OutputType.Foundry) { - unlockCondition = unlockConditions?.filter( - ot => ot.type === UnlockConditionType.ImmutableAliasAddress - ).map(ot => ot as ImmutableAliasAddressUnlockCondition)[0]; + unlockCondition = unlockConditions + ?.filter((ot) => ot.type === UnlockConditionType.ImmutableAliasAddress) + .map((ot) => ot as ImmutableAliasAddressUnlockCondition)[0]; } if (unlockCondition?.address) { @@ -318,4 +332,3 @@ export class TransactionsHelper { return address; } } - diff --git a/client/src/helpers/stardust/valueFormatHelper.spec.ts b/client/src/helpers/stardust/valueFormatHelper.spec.ts index bc8fd0a7f..ac47dedf3 100644 --- a/client/src/helpers/stardust/valueFormatHelper.spec.ts +++ b/client/src/helpers/stardust/valueFormatHelper.spec.ts @@ -1,12 +1,12 @@ import { formatAmount } from "./valueFormatHelper"; const tokenInfo = { - "name": "IOTA", - "tickerSymbol": "IOTA", - "unit": "IOTA", - "subunit": "micro", - "decimals": 6, - "useMetricPrefix": false + name: "IOTA", + tickerSymbol: "IOTA", + unit: "IOTA", + subunit: "micro", + decimals: 6, + useMetricPrefix: false, }; test("formatAmount should format 1 subunit properly", () => { @@ -60,4 +60,3 @@ test("formatAmount should honour precision 0", () => { test("formatAmount should format big values properly", () => { expect(formatAmount(1450896407249092, tokenInfo)).toBe("1450896407.24 IOTA"); }); - diff --git a/client/src/helpers/stardust/valueFormatHelper.tsx b/client/src/helpers/stardust/valueFormatHelper.tsx index 111d96c49..628a54035 100644 --- a/client/src/helpers/stardust/valueFormatHelper.tsx +++ b/client/src/helpers/stardust/valueFormatHelper.tsx @@ -16,12 +16,7 @@ const GENESIS_BLOCK_ID = "0x0000000000000000000000000000000000000000000000000000 * @param decimalPlaces The decimal places to show. * @returns The formatted string. */ -export function formatAmount( - value: number, - tokenInfo: INodeInfoBaseToken, - formatFull: boolean = false, - decimalPlaces: number = 2 -): string { +export function formatAmount(value: number, tokenInfo: INodeInfoBaseToken, formatFull: boolean = false, decimalPlaces: number = 2): string { if (formatFull) { return `${value} ${tokenInfo.subunit ?? tokenInfo.unit}`; } @@ -39,9 +34,7 @@ export function formatAmount( * @param {string|number} value - The number to format. Can be a string or a number. * @returns {string} The formatted number as a string, with commas separating thousands. */ -export function formatNumberWithCommas( - value: bigint -): string { +export function formatNumberWithCommas(value: bigint): string { return value.toLocaleString("en", { useGrouping: true }); } diff --git a/client/src/helpers/textHelper.ts b/client/src/helpers/textHelper.ts index 9d87cf268..4f3fe0967 100644 --- a/client/src/helpers/textHelper.ts +++ b/client/src/helpers/textHelper.ts @@ -12,8 +12,8 @@ export class TextHelper { */ public static encodeNonASCII(value: string): string | undefined { return value - // eslint-disable-next-line unicorn/prefer-code-point - ? value.replaceAll(/[\u007F-\uFFFF]/g, chr => `\\u${(`0000${chr.charCodeAt(0).toString(16)}`).slice(-4)}`) + ? // eslint-disable-next-line unicorn/prefer-code-point + value.replaceAll(/[\u007F-\uFFFF]/g, (chr) => `\\u${`0000${chr.charCodeAt(0).toString(16)}`.slice(-4)}`) : undefined; } @@ -24,10 +24,7 @@ export class TextHelper { */ public static decodeNonASCII(value: string): string | undefined { return value - ? value.replaceAll( - /\\u(\w{4})/gi, - (_match, grp) => String.fromCodePoint(Number.parseInt(grp as string, 16)) - ) + ? value.replaceAll(/\\u(\w{4})/gi, (_match, grp) => String.fromCodePoint(Number.parseInt(grp as string, 16))) : undefined; } diff --git a/client/src/helpers/trytesHelper.ts b/client/src/helpers/trytesHelper.ts index 3e3d46284..e98dad61c 100644 --- a/client/src/helpers/trytesHelper.ts +++ b/client/src/helpers/trytesHelper.ts @@ -34,7 +34,7 @@ export class TrytesHelper { const ascii = trytesToAscii(trimmed); const json = TextHelper.decodeNonASCII(ascii); - return json ? JSON.parse(json) as T : undefined; + return json ? (JSON.parse(json) as T) : undefined; } /** @@ -86,12 +86,11 @@ export class TrytesHelper { } } } - } catch { - } + } catch {} return { message, - messageType + messageType, }; } diff --git a/client/src/index.scss b/client/src/index.scss index 58bd3d2d5..19c0e962a 100644 --- a/client/src/index.scss +++ b/client/src/index.scss @@ -9,81 +9,81 @@ @import "./scss/themes"; html { - height: 100%; + height: 100%; } * { - box-sizing: border-box; - margin: 0; - padding: 0; + box-sizing: border-box; + margin: 0; + padding: 0; } h1 { - @include font-size(32px, 40px); + @include font-size(32px, 40px); - color: var(--body-color); - font-family: $metropolis-semi-bold; + color: var(--body-color); + font-family: $metropolis-semi-bold; } h2 { - @include font-size(20px, 24px); + @include font-size(20px, 24px); - color: var(--body-color); - font-family: $metropolis-semi-bold; - letter-spacing: 0.02em; + color: var(--body-color); + font-family: $metropolis-semi-bold; + letter-spacing: 0.02em; } h3 { - @include font-size(16px, 20px); + @include font-size(16px, 20px); - color: $gray-10; - font-family: $metropolis-semi-bold; + color: $gray-10; + font-family: $metropolis-semi-bold; } body { - height: 100%; - transition: background 0.3s; - background: var(--body-background); - - #root { - display: flex; - flex-direction: column; - width: 100%; - min-height: 100vh; - - .success { - color: $success; + height: 100%; + transition: background 0.3s; + background: var(--body-background); + + #root { + display: flex; + flex-direction: column; + width: 100%; + min-height: 100vh; + + .success { + color: $success; + } + + .warning { + color: $warning; + } + + .danger { + color: $danger; + } + + .info { + color: $info; + } + + .active-item { + color: var(--active-item-color); + } } - - .warning { - color: $warning; - } - - .danger { - color: $danger; - } - - .info { - color: $info; - } - - .active-item { - color: var(--active-item-color); - } - } } ::-webkit-scrollbar-track { - border-radius: 0; - background-color: $gray-daylight; + border-radius: 0; + background-color: $gray-daylight; } ::-webkit-scrollbar { - width: 12px; - background-color: $gray-daylight; + width: 12px; + background-color: $gray-daylight; } ::-webkit-scrollbar-thumb { - border-radius: 0; - background-color: var(--header-color); + border-radius: 0; + background-color: var(--header-color); } diff --git a/client/src/index.tsx b/client/src/index.tsx index e6a065165..a7a9dfc04 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -32,24 +32,25 @@ import { TokenRegistryClient } from "~services/stardust/tokenRegistryClient"; // eslint-disable-next-line @typescript-eslint/no-explicit-any const apiEndpoint = (window as any).env.API_ENDPOINT; -initialiseServices().then(async () => { - // load the wasm - await initStardustSdk("/wasm/iota_sdk_stardust_wasm_bg.wasm"); +initialiseServices() + .then(async () => { + // load the wasm + await initStardustSdk("/wasm/iota_sdk_stardust_wasm_bg.wasm"); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const container = document.querySelector("#root")!; - const root = createRoot(container); - root.render( - - ) => ( - )} - /> - - ); -}).catch(err => console.error(err)); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const container = document.querySelector("#root")!; + const root = createRoot(container); + root.render( + + ) => } + /> + , + ); + }) + .catch((err) => console.error(err)); /** * Register all the services. @@ -85,21 +86,21 @@ async function initialiseServices(): Promise { case LEGACY: { ServiceFactory.register( `feed-${netConfig.network}`, - serviceName => new LegacyFeedClient(apiEndpoint, serviceName.slice(5)) + (serviceName) => new LegacyFeedClient(apiEndpoint, serviceName.slice(5)), ); break; } case CHRYSALIS: { ServiceFactory.register( `feed-${netConfig.network}`, - serviceName => new ChrysalisFeedClient(apiEndpoint, serviceName.slice(5)) + (serviceName) => new ChrysalisFeedClient(apiEndpoint, serviceName.slice(5)), ); break; } case STARDUST: { ServiceFactory.register( `feed-${netConfig.network}`, - serviceName => new StardustFeedClient(apiEndpoint, serviceName.slice(5)) + (serviceName) => new StardustFeedClient(apiEndpoint, serviceName.slice(5)), ); break; } diff --git a/client/src/models/IMilestoneFeedItem.ts b/client/src/models/IMilestoneFeedItem.ts index 601305623..ac92bb4be 100644 --- a/client/src/models/IMilestoneFeedItem.ts +++ b/client/src/models/IMilestoneFeedItem.ts @@ -19,4 +19,3 @@ export interface IMilestoneFeedItem { */ timestamp: number; } - diff --git a/client/src/models/api/ICurrenciesResponse.ts b/client/src/models/api/ICurrenciesResponse.ts index 76548c24b..a6fc604bc 100644 --- a/client/src/models/api/ICurrenciesResponse.ts +++ b/client/src/models/api/ICurrenciesResponse.ts @@ -35,4 +35,3 @@ export interface ICoinStats { */ volume24h: number; } - diff --git a/client/src/models/api/IIdentityDidHistoryResponse.ts b/client/src/models/api/IIdentityDidHistoryResponse.ts index 2912690f6..331294f98 100644 --- a/client/src/models/api/IIdentityDidHistoryResponse.ts +++ b/client/src/models/api/IIdentityDidHistoryResponse.ts @@ -11,4 +11,3 @@ interface IntegrationChainData { document: IIdentityDocument; messageId: string; } - diff --git a/client/src/models/api/IIdentityDidResolveRequest.ts b/client/src/models/api/IIdentityDidResolveRequest.ts index b8781ace3..d1226a545 100644 --- a/client/src/models/api/IIdentityDidResolveRequest.ts +++ b/client/src/models/api/IIdentityDidResolveRequest.ts @@ -1,4 +1,3 @@ - export interface IIdentityDidResolveRequest { /** * The network to search on. diff --git a/client/src/models/api/IIdentityDiffHistoryResponse.ts b/client/src/models/api/IIdentityDiffHistoryResponse.ts index 6376d553b..e9e8fa6f3 100644 --- a/client/src/models/api/IIdentityDiffHistoryResponse.ts +++ b/client/src/models/api/IIdentityDiffHistoryResponse.ts @@ -10,4 +10,3 @@ export interface DiffMessage { created: string; updated: string; } - diff --git a/client/src/models/api/IIdentityResolveResponse.ts b/client/src/models/api/IIdentityResolveResponse.ts index 2fedc3b6a..f2aab0e86 100644 --- a/client/src/models/api/IIdentityResolveResponse.ts +++ b/client/src/models/api/IIdentityResolveResponse.ts @@ -1,8 +1,7 @@ import { IIdentityDocument } from "./../identity/IIdentityDocument"; import { IResponse } from "./IResponse"; -export interface IIdentityDidResolveResponse extends IResponse{ - +export interface IIdentityDidResolveResponse extends IResponse { /** * message id of resolved DID */ diff --git a/client/src/models/api/INetworkBoundGetRequest.ts b/client/src/models/api/INetworkBoundGetRequest.ts index e107839bb..715a724d3 100644 --- a/client/src/models/api/INetworkBoundGetRequest.ts +++ b/client/src/models/api/INetworkBoundGetRequest.ts @@ -8,4 +8,3 @@ export interface INetworkBoundGetRequest { */ network: string; } - diff --git a/client/src/models/api/IRawResponse.ts b/client/src/models/api/IRawResponse.ts index 1c218a707..1ac566ed9 100644 --- a/client/src/models/api/IRawResponse.ts +++ b/client/src/models/api/IRawResponse.ts @@ -6,4 +6,3 @@ export interface IRawResponse extends IResponse { */ raw?: Response; } - diff --git a/client/src/models/api/legacy/IAddressGetRequest.ts b/client/src/models/api/legacy/IAddressGetRequest.ts index 13970291e..328b18fb5 100644 --- a/client/src/models/api/legacy/IAddressGetRequest.ts +++ b/client/src/models/api/legacy/IAddressGetRequest.ts @@ -1,4 +1,3 @@ - export interface IAddressGetRequest { /** * The network to search on. diff --git a/client/src/models/api/stardust/IAliasRequest.ts b/client/src/models/api/stardust/IAliasRequest.ts index 5454ce6af..5e26d0715 100644 --- a/client/src/models/api/stardust/IAliasRequest.ts +++ b/client/src/models/api/stardust/IAliasRequest.ts @@ -9,4 +9,3 @@ export interface IAliasRequest { */ aliasId: string; } - diff --git a/client/src/models/api/stardust/IAliasResponse.ts b/client/src/models/api/stardust/IAliasResponse.ts index 733d84cb1..e82094682 100644 --- a/client/src/models/api/stardust/IAliasResponse.ts +++ b/client/src/models/api/stardust/IAliasResponse.ts @@ -7,4 +7,3 @@ export interface IAliasResponse extends IResponse { */ aliasDetails?: OutputResponse; } - diff --git a/client/src/models/api/stardust/IAssociationsResponse.ts b/client/src/models/api/stardust/IAssociationsResponse.ts index 028c49c85..840e9d786 100644 --- a/client/src/models/api/stardust/IAssociationsResponse.ts +++ b/client/src/models/api/stardust/IAssociationsResponse.ts @@ -16,7 +16,7 @@ export enum AssociationType { NFT_EXPIRATION_RETURN, NFT_ISSUER, NFT_SENDER, - NFT_ID + NFT_ID, } export interface IAssociation { @@ -36,4 +36,3 @@ export interface IAssociationsResponse extends IResponse { */ associations?: IAssociation[]; } - diff --git a/client/src/models/api/stardust/IInput.ts b/client/src/models/api/stardust/IInput.ts index b1562d18e..32c846efe 100644 --- a/client/src/models/api/stardust/IInput.ts +++ b/client/src/models/api/stardust/IInput.ts @@ -31,4 +31,3 @@ export interface IInput { */ isGenesis: boolean; } - diff --git a/client/src/models/api/stardust/ILatestMilestonesReponse.ts b/client/src/models/api/stardust/ILatestMilestonesReponse.ts index 60465c874..bbe1e3acc 100644 --- a/client/src/models/api/stardust/ILatestMilestonesReponse.ts +++ b/client/src/models/api/stardust/ILatestMilestonesReponse.ts @@ -7,4 +7,3 @@ export interface ILatestMilestonesReponse extends IResponse { */ milestones: IMilestoneFeedItem[]; } - diff --git a/client/src/models/api/stardust/IMilestoneBlocksResponse.ts b/client/src/models/api/stardust/IMilestoneBlocksResponse.ts index e3dbf5da9..3293971e6 100644 --- a/client/src/models/api/stardust/IMilestoneBlocksResponse.ts +++ b/client/src/models/api/stardust/IMilestoneBlocksResponse.ts @@ -11,4 +11,3 @@ export interface IMilestoneBlocksResponse extends IResponse { */ blocks?: string[]; } - diff --git a/client/src/models/api/stardust/IMilestoneDetailsResponse.ts b/client/src/models/api/stardust/IMilestoneDetailsResponse.ts index cdcef1f43..937923dc4 100644 --- a/client/src/models/api/stardust/IMilestoneDetailsResponse.ts +++ b/client/src/models/api/stardust/IMilestoneDetailsResponse.ts @@ -17,4 +17,3 @@ export interface IMilestoneDetailsResponse extends IResponse { */ milestone?: MilestonePayload; } - diff --git a/client/src/models/api/stardust/IMilestoneStatsRequest.ts b/client/src/models/api/stardust/IMilestoneStatsRequest.ts index d10fd729b..aa30d976b 100644 --- a/client/src/models/api/stardust/IMilestoneStatsRequest.ts +++ b/client/src/models/api/stardust/IMilestoneStatsRequest.ts @@ -9,4 +9,3 @@ export interface IMilestoneStatsRequest { */ milestoneIndex: string; } - diff --git a/client/src/models/api/stardust/INodeInfoResponse.ts b/client/src/models/api/stardust/INodeInfoResponse.ts index bb80b4f5f..4d4be693c 100644 --- a/client/src/models/api/stardust/INodeInfoResponse.ts +++ b/client/src/models/api/stardust/INodeInfoResponse.ts @@ -25,4 +25,3 @@ export interface INodeInfoResponse extends IResponse { */ rentStructure?: IRent; } - diff --git a/client/src/models/api/stardust/IOutput.ts b/client/src/models/api/stardust/IOutput.ts index 1abdec667..48c3d8f53 100644 --- a/client/src/models/api/stardust/IOutput.ts +++ b/client/src/models/api/stardust/IOutput.ts @@ -23,4 +23,3 @@ export interface IOutput { */ isRemainder?: boolean; } - diff --git a/client/src/models/api/stardust/ITaggedOutputsRequest.ts b/client/src/models/api/stardust/ITaggedOutputsRequest.ts index 2efbf8332..90db50df9 100644 --- a/client/src/models/api/stardust/ITaggedOutputsRequest.ts +++ b/client/src/models/api/stardust/ITaggedOutputsRequest.ts @@ -22,4 +22,3 @@ export interface ITaggedOutputsRequest { */ cursor?: string; } - diff --git a/client/src/models/api/stardust/ITaggedOutputsResponse.ts b/client/src/models/api/stardust/ITaggedOutputsResponse.ts index 2dcfe5c2e..ef784127f 100644 --- a/client/src/models/api/stardust/ITaggedOutputsResponse.ts +++ b/client/src/models/api/stardust/ITaggedOutputsResponse.ts @@ -11,4 +11,3 @@ export interface ITaggedOutputsResponse { */ nftOutputs?: INftOutputsResponse; } - diff --git a/client/src/models/api/stardust/ITransactionHistoryRequest.ts b/client/src/models/api/stardust/ITransactionHistoryRequest.ts index 1e50e5818..6105f3b35 100644 --- a/client/src/models/api/stardust/ITransactionHistoryRequest.ts +++ b/client/src/models/api/stardust/ITransactionHistoryRequest.ts @@ -32,4 +32,3 @@ export interface ITransactionHistoryRequest { */ cursor?: string; } - diff --git a/client/src/models/api/stardust/ITransactionHistoryResponse.ts b/client/src/models/api/stardust/ITransactionHistoryResponse.ts index e076e2bcc..a11597750 100644 --- a/client/src/models/api/stardust/ITransactionHistoryResponse.ts +++ b/client/src/models/api/stardust/ITransactionHistoryResponse.ts @@ -44,4 +44,3 @@ export interface ITransactionHistoryResponse extends IResponse { */ cursor?: string; } - diff --git a/client/src/models/api/stardust/address/IAddressBalanceRequest.ts b/client/src/models/api/stardust/address/IAddressBalanceRequest.ts index 42dde0cd3..7b632de16 100644 --- a/client/src/models/api/stardust/address/IAddressBalanceRequest.ts +++ b/client/src/models/api/stardust/address/IAddressBalanceRequest.ts @@ -9,4 +9,3 @@ export interface IAddressBalanceRequest { */ address: string; } - diff --git a/client/src/models/api/stardust/address/IAddressBalanceResponse.ts b/client/src/models/api/stardust/address/IAddressBalanceResponse.ts index f49c36ad5..92fa362e1 100644 --- a/client/src/models/api/stardust/address/IAddressBalanceResponse.ts +++ b/client/src/models/api/stardust/address/IAddressBalanceResponse.ts @@ -16,4 +16,3 @@ export interface IAddressBalanceResponse extends IResponse { */ ledgerIndex?: number; } - diff --git a/client/src/models/api/stardust/address/IAddressDetailsRequest.ts b/client/src/models/api/stardust/address/IAddressDetailsRequest.ts index cf9adc84f..0a8aa0b4f 100644 --- a/client/src/models/api/stardust/address/IAddressDetailsRequest.ts +++ b/client/src/models/api/stardust/address/IAddressDetailsRequest.ts @@ -9,4 +9,3 @@ export interface IAddressDetailsRequest { */ address: string; } - diff --git a/client/src/models/api/stardust/address/IAddressDetailsWithBalance.ts b/client/src/models/api/stardust/address/IAddressDetailsWithBalance.ts index da4c42c68..aa49e9ebb 100644 --- a/client/src/models/api/stardust/address/IAddressDetailsWithBalance.ts +++ b/client/src/models/api/stardust/address/IAddressDetailsWithBalance.ts @@ -4,7 +4,7 @@ import { IResponse } from "../../IResponse"; /** * Address details with balance info. */ - export default interface IAddressDetailsWithBalance extends IResponse { +export default interface IAddressDetailsWithBalance extends IResponse { /** * The hex for the address the details are for. */ @@ -37,4 +37,3 @@ import { IResponse } from "../../IResponse"; */ ledgerIndex: number; } - diff --git a/client/src/models/api/stardust/basic/IBasicOutputsResponse.ts b/client/src/models/api/stardust/basic/IBasicOutputsResponse.ts index fff2bbb13..689101ff7 100644 --- a/client/src/models/api/stardust/basic/IBasicOutputsResponse.ts +++ b/client/src/models/api/stardust/basic/IBasicOutputsResponse.ts @@ -7,4 +7,3 @@ export interface IBasicOutputsResponse extends IResponse { */ outputs?: IOutputsResponse; } - diff --git a/client/src/models/api/stardust/block/IBlockRequest.ts b/client/src/models/api/stardust/block/IBlockRequest.ts index e22b99aab..781d93d64 100644 --- a/client/src/models/api/stardust/block/IBlockRequest.ts +++ b/client/src/models/api/stardust/block/IBlockRequest.ts @@ -9,4 +9,3 @@ export interface IBlockRequest { */ blockId: string; } - diff --git a/client/src/models/api/stardust/block/IBlockResponse.ts b/client/src/models/api/stardust/block/IBlockResponse.ts index 3de517f29..4e759e104 100644 --- a/client/src/models/api/stardust/block/IBlockResponse.ts +++ b/client/src/models/api/stardust/block/IBlockResponse.ts @@ -7,4 +7,3 @@ export interface IBlockResponse extends IResponse { */ block: Block; } - diff --git a/client/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts b/client/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts index ed5a5dedb..149397e4a 100644 --- a/client/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts +++ b/client/src/models/api/stardust/chronicle/IRichestAddressesResponse.ts @@ -9,4 +9,3 @@ export interface IRichestAddressesResponse extends IResponse { top?: IRichAddress[]; ledgerIndex?: number; } - diff --git a/client/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts b/client/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts index 05cb5dec2..c4fb5acfe 100644 --- a/client/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts +++ b/client/src/models/api/stardust/chronicle/ITokenDistributionResponse.ts @@ -10,4 +10,3 @@ export interface ITokenDistributionResponse extends IResponse { distribution?: IDistributionEntry[]; ledgerIndex?: number; } - diff --git a/client/src/models/api/stardust/feed/IFeedSubscribeRequest.ts b/client/src/models/api/stardust/feed/IFeedSubscribeRequest.ts index a12bbb6d6..9a2a2a2cf 100644 --- a/client/src/models/api/stardust/feed/IFeedSubscribeRequest.ts +++ b/client/src/models/api/stardust/feed/IFeedSubscribeRequest.ts @@ -11,4 +11,3 @@ export interface IFeedSubscribeRequest { */ feedSelect: IFeedSelect; } - diff --git a/client/src/models/api/stardust/feed/IFeedUpdate.ts b/client/src/models/api/stardust/feed/IFeedUpdate.ts index cf8fc6f14..e668fe287 100644 --- a/client/src/models/api/stardust/feed/IFeedUpdate.ts +++ b/client/src/models/api/stardust/feed/IFeedUpdate.ts @@ -22,4 +22,3 @@ export interface IFeedUpdate { blockMetadata?: IFeedBlockMetadataUpdate; milestone?: IFeedMilestoneUpdate; } - diff --git a/client/src/models/api/stardust/foundry/IFoundryRequest.ts b/client/src/models/api/stardust/foundry/IFoundryRequest.ts index 235bde4fb..6c655435c 100644 --- a/client/src/models/api/stardust/foundry/IFoundryRequest.ts +++ b/client/src/models/api/stardust/foundry/IFoundryRequest.ts @@ -9,4 +9,3 @@ export interface IFoundryRequest { */ foundryId: string; } - diff --git a/client/src/models/api/stardust/foundry/IFoundryResponse.ts b/client/src/models/api/stardust/foundry/IFoundryResponse.ts index fc07d8b8a..e3e5bf9b5 100644 --- a/client/src/models/api/stardust/foundry/IFoundryResponse.ts +++ b/client/src/models/api/stardust/foundry/IFoundryResponse.ts @@ -7,4 +7,3 @@ export interface IFoundryResponse extends IResponse { */ foundryDetails?: OutputResponse; } - diff --git a/client/src/models/api/stardust/foundry/IToken.ts b/client/src/models/api/stardust/foundry/IToken.ts index 4ec594b0b..de3b1115e 100644 --- a/client/src/models/api/stardust/foundry/IToken.ts +++ b/client/src/models/api/stardust/foundry/IToken.ts @@ -8,4 +8,3 @@ export interface IToken { */ amount: bigint; } - diff --git a/client/src/models/api/stardust/foundry/ITokenMetadata.ts b/client/src/models/api/stardust/foundry/ITokenMetadata.ts index 0a4fdc25c..bb2530bdf 100644 --- a/client/src/models/api/stardust/foundry/ITokenMetadata.ts +++ b/client/src/models/api/stardust/foundry/ITokenMetadata.ts @@ -32,4 +32,3 @@ export interface ITokenMetadata { */ logo?: string; } - diff --git a/client/src/models/api/stardust/influx/IInfluxDailyResponse.ts b/client/src/models/api/stardust/influx/IInfluxDailyResponse.ts index b656815b9..7bb25d1c0 100644 --- a/client/src/models/api/stardust/influx/IInfluxDailyResponse.ts +++ b/client/src/models/api/stardust/influx/IInfluxDailyResponse.ts @@ -112,4 +112,3 @@ export interface IInfluxDailyResponse extends IResponse { ledgerSizeDaily?: ILedgerSizeDailyInflux[]; storageDepositDaily?: IStorageDepositDailyInflux[]; } - diff --git a/client/src/models/api/stardust/nft/INftDetailsRequest.ts b/client/src/models/api/stardust/nft/INftDetailsRequest.ts index b5def2ff8..b1f69d5da 100644 --- a/client/src/models/api/stardust/nft/INftDetailsRequest.ts +++ b/client/src/models/api/stardust/nft/INftDetailsRequest.ts @@ -9,4 +9,3 @@ export interface INftDetailsRequest { */ nftId?: string; } - diff --git a/client/src/models/api/stardust/nft/INftDetailsResponse.ts b/client/src/models/api/stardust/nft/INftDetailsResponse.ts index 19e253a8d..9f4e69d8b 100644 --- a/client/src/models/api/stardust/nft/INftDetailsResponse.ts +++ b/client/src/models/api/stardust/nft/INftDetailsResponse.ts @@ -7,4 +7,3 @@ export interface INftDetailsResponse extends IResponse { */ nftDetails?: OutputResponse; } - diff --git a/client/src/models/api/stardust/participation/IParticipationEventPayload.ts b/client/src/models/api/stardust/participation/IParticipationEventPayload.ts index 298db5b17..3351225e8 100644 --- a/client/src/models/api/stardust/participation/IParticipationEventPayload.ts +++ b/client/src/models/api/stardust/participation/IParticipationEventPayload.ts @@ -39,5 +39,5 @@ export interface IParticipationEventPayload { /** * The additional description text about the participation event. */ - additionalInfo?: string; + additionalInfo?: string; } diff --git a/client/src/models/api/stardust/participation/IParticipationEventStatus.ts b/client/src/models/api/stardust/participation/IParticipationEventStatus.ts index e0f4d8c49..f11153d25 100644 --- a/client/src/models/api/stardust/participation/IParticipationEventStatus.ts +++ b/client/src/models/api/stardust/participation/IParticipationEventStatus.ts @@ -12,7 +12,7 @@ export interface IParticipationEventStatus { /** * The answer status of the different questions of the event. */ - questions?: { answers: {value: number; current: number; accumulated: number}[] }[]; + questions?: { answers: { value: number; current: number; accumulated: number }[] }[]; /** * The staking status of the event. @@ -25,4 +25,3 @@ export interface IParticipationEventStatus { */ checksum: string; } - diff --git a/client/src/models/api/stats/IAnalyticStats.ts b/client/src/models/api/stats/IAnalyticStats.ts index a3614042f..283d46b14 100644 --- a/client/src/models/api/stats/IAnalyticStats.ts +++ b/client/src/models/api/stats/IAnalyticStats.ts @@ -12,4 +12,3 @@ export interface IAnalyticStats extends IResponse { lockedStorageDeposit?: string; unclaimedShimmer?: string; } - diff --git a/client/src/models/api/stats/IMilestoneAnalyticStats.ts b/client/src/models/api/stats/IMilestoneAnalyticStats.ts index 931ff1d71..e85bbce5b 100644 --- a/client/src/models/api/stats/IMilestoneAnalyticStats.ts +++ b/client/src/models/api/stats/IMilestoneAnalyticStats.ts @@ -11,4 +11,3 @@ export interface IMilestoneAnalyticStats extends IResponse { noPayload?: number; }; } - diff --git a/client/src/models/config/networkType.ts b/client/src/models/config/networkType.ts index fb74f1496..5c2e77597 100644 --- a/client/src/models/config/networkType.ts +++ b/client/src/models/config/networkType.ts @@ -12,12 +12,11 @@ export const CUSTOM = "custom"; * The network type. */ export type NetworkType = - typeof LEGACY_MAINNET | - typeof CHRYSALIS_MAINNET | - typeof MAINNET | - typeof DEVNET | - typeof SHIMMER | - typeof TESTNET | - typeof ALPHANET | - typeof CUSTOM; - + | typeof LEGACY_MAINNET + | typeof CHRYSALIS_MAINNET + | typeof MAINNET + | typeof DEVNET + | typeof SHIMMER + | typeof TESTNET + | typeof ALPHANET + | typeof CUSTOM; diff --git a/client/src/models/config/protocolVersion.ts b/client/src/models/config/protocolVersion.ts index c0276dedf..5b2828da9 100644 --- a/client/src/models/config/protocolVersion.ts +++ b/client/src/models/config/protocolVersion.ts @@ -6,8 +6,4 @@ export const STARDUST = "stardust"; /** * The protocol versions. */ -export type ProtocolVersion = - typeof LEGACY | - typeof CHRYSALIS | - typeof STARDUST; - +export type ProtocolVersion = typeof LEGACY | typeof CHRYSALIS | typeof STARDUST; diff --git a/client/src/models/confirmationState.ts b/client/src/models/confirmationState.ts index 31127cda3..7802ca728 100644 --- a/client/src/models/confirmationState.ts +++ b/client/src/models/confirmationState.ts @@ -1,8 +1 @@ -export type ConfirmationState = - "unknown" | - "confirmed" | - "pending" | - "subtangle" | - "reattachment" | - "consistency" | - "conflicting"; +export type ConfirmationState = "unknown" | "confirmed" | "pending" | "subtangle" | "reattachment" | "consistency" | "conflicting"; diff --git a/client/src/models/graph/stardust/INodeData.ts b/client/src/models/graph/stardust/INodeData.ts index 2f370d978..f54b163b1 100644 --- a/client/src/models/graph/stardust/INodeData.ts +++ b/client/src/models/graph/stardust/INodeData.ts @@ -16,4 +16,3 @@ export interface INodeData { */ graphId?: number; } - diff --git a/client/src/models/identityMsgStatus.ts b/client/src/models/identityMsgStatus.ts index c2fc0e489..0b1bdf6b4 100644 --- a/client/src/models/identityMsgStatus.ts +++ b/client/src/models/identityMsgStatus.ts @@ -1,5 +1 @@ -export type IdentityMsgStatus = - "diff" | - "integration" | - "invalid" | - "unavailable"; +export type IdentityMsgStatus = "diff" | "integration" | "invalid" | "unavailable"; diff --git a/client/src/models/services/IFilterSettings.ts b/client/src/models/services/IFilterSettings.ts index 18b3dc576..eb4343946 100644 --- a/client/src/models/services/IFilterSettings.ts +++ b/client/src/models/services/IFilterSettings.ts @@ -27,5 +27,3 @@ export interface IFilterSettings { */ valueMaximumUnits?: Units; } - - diff --git a/client/src/models/services/ISettings.ts b/client/src/models/services/ISettings.ts index 323412c06..cf69e0ef3 100644 --- a/client/src/models/services/ISettings.ts +++ b/client/src/models/services/ISettings.ts @@ -1,4 +1,3 @@ - import { ICurrencySettings } from "./ICurrencySettings"; import { IFilterSettings } from "./IFilterSettings"; import { IFilterSettings as IStardustFilterSettings } from "./stardust/IFilterSettings"; diff --git a/client/src/models/services/filterField.ts b/client/src/models/services/filterField.ts index b0cedd67b..2099d436a 100644 --- a/client/src/models/services/filterField.ts +++ b/client/src/models/services/filterField.ts @@ -17,7 +17,7 @@ export function getFilterFieldDefaults(protocolVersion: ProtocolVersion): Filter case LEGACY: { filterFields = [ { label: "Zero only", isEnabled: true }, - { label: "Non-zero only", isEnabled: true } + { label: "Non-zero only", isEnabled: true }, ]; break; } @@ -26,7 +26,7 @@ export function getFilterFieldDefaults(protocolVersion: ProtocolVersion): Filter { label: "Transaction", isEnabled: true }, { label: "Milestone", isEnabled: true }, { label: "Data", isEnabled: true }, - { label: "No payload", isEnabled: true } + { label: "No payload", isEnabled: true }, ]; break; } @@ -36,7 +36,7 @@ export function getFilterFieldDefaults(protocolVersion: ProtocolVersion): Filter { label: "Transaction", isEnabled: true }, { label: "Milestone", isEnabled: true }, { label: "Indexed", isEnabled: true }, - { label: "No payload", isEnabled: true } + { label: "No payload", isEnabled: true }, ]; break; } @@ -44,4 +44,3 @@ export function getFilterFieldDefaults(protocolVersion: ProtocolVersion): Filter return filterFields; } - diff --git a/client/src/models/services/stardust/IFilterSettings.ts b/client/src/models/services/stardust/IFilterSettings.ts index 68f8d5ba3..a32d8a1b8 100644 --- a/client/src/models/services/stardust/IFilterSettings.ts +++ b/client/src/models/services/stardust/IFilterSettings.ts @@ -28,5 +28,3 @@ export interface IFilterSettings { */ valueMaximumMagnitude?: Units; } - - diff --git a/client/src/models/tangleStatus.ts b/client/src/models/tangleStatus.ts index df3d0adc6..cdf421f79 100644 --- a/client/src/models/tangleStatus.ts +++ b/client/src/models/tangleStatus.ts @@ -1,16 +1,12 @@ import { CONFLICT_REASON_STRINGS, IBlockMetadata } from "@iota/sdk-wasm/web"; -export type TangleStatus = - "unknown" | - "pending" | - "referenced" | - "milestone"; +export type TangleStatus = "unknown" | "pending" | "referenced" | "milestone"; - /** - * Calculate the status for the block. - * @param metadata The metadata to calculate the status from. - * @returns The block status. - */ +/** + * Calculate the status for the block. + * @param metadata The metadata to calculate the status from. + * @returns The block status. + */ export function calculateStatus(metadata?: IBlockMetadata): TangleStatus { let blockTangleStatus: TangleStatus = "unknown"; @@ -36,11 +32,11 @@ export function calculateConflictReason(metadata?: IBlockMetadata): string { let conflictReason: string = ""; if (metadata?.ledgerInclusionState === "conflicting") { - conflictReason = metadata.conflictReason && CONFLICT_REASON_STRINGS[metadata.conflictReason] - ? CONFLICT_REASON_STRINGS[metadata.conflictReason] - : "The reason for the conflict is unknown"; + conflictReason = + metadata.conflictReason && CONFLICT_REASON_STRINGS[metadata.conflictReason] + ? CONFLICT_REASON_STRINGS[metadata.conflictReason] + : "The reason for the conflict is unknown"; } return conflictReason; } - diff --git a/client/src/scss/buttons.scss b/client/src/scss/buttons.scss index 82d66892e..324541530 100644 --- a/client/src/scss/buttons.scss +++ b/client/src/scss/buttons.scss @@ -1,46 +1,46 @@ -@import './fonts'; -@import './mixins'; -@import './variables'; +@import "./fonts"; +@import "./mixins"; +@import "./variables"; button { - @include font-size(16px); - - display: flex; - padding: 6px 10px; - border: 1px solid $dark-green; - border-radius: 6px; - outline: none; - background: $dark-green; - color: $white; - font-family: $metropolis; - font-weight: bold; - cursor: pointer; - - &:disabled { - opacity: 0.5; - pointer-events: none; - } - - &:focus { - box-shadow: 0 0 3px 0 var(--link-highlight); - } - - &:-moz-focusring { - text-shadow: 0 0 0 $gray-10; - } - - &.button--danger { - border-color: $danger; - background-color: $danger; + @include font-size(16px); + + display: flex; + padding: 6px 10px; + border: 1px solid $dark-green; + border-radius: 6px; + outline: none; + background: $dark-green; color: $white; - } + font-family: $metropolis; + font-weight: bold; + cursor: pointer; - &.button--unstyled { - border: 0; - background-color: transparent; + &:disabled { + opacity: 0.5; + pointer-events: none; + } &:focus { - box-shadow: none; + box-shadow: 0 0 3px 0 var(--link-highlight); + } + + &:-moz-focusring { + text-shadow: 0 0 0 $gray-10; + } + + &.button--danger { + border-color: $danger; + background-color: $danger; + color: $white; + } + + &.button--unstyled { + border: 0; + background-color: transparent; + + &:focus { + box-shadow: none; + } } - } } diff --git a/client/src/scss/card.scss b/client/src/scss/card.scss index a03237a07..d848fa3f5 100644 --- a/client/src/scss/card.scss +++ b/client/src/scss/card.scss @@ -1,441 +1,441 @@ -@use 'sass:color'; -@import './fonts'; -@import './layout'; -@import './media-queries'; -@import './mixins'; -@import './variables'; -@import './themes'; +@use "sass:color"; +@import "./fonts"; +@import "./layout"; +@import "./media-queries"; +@import "./mixins"; +@import "./variables"; +@import "./themes"; .card { - display: flex; - flex-direction: column; - overflow: hidden; - border: 1px solid var(--input-border-color); - border-radius: 6px; - background-color: transparent; - - h2 { display: flex; - align-items: center; - } + flex-direction: column; + overflow: hidden; + border: 1px solid var(--input-border-color); + border-radius: 6px; + background-color: transparent; - h3 { - display: flex; - align-items: center; - } - - input[type='checkbox'] { - @include font-size(24px); - - width: 24px; - height: 24px; - padding: 0; - font-weight: bold; - vertical-align: middle; - appearance: none; - - &:checked { - &::after { - content: '\2713'; - position: relative; - bottom: 4px; - left: 0; - color: $main-green; - } - } - } - - button { - @include font-size(12px); - - padding: 0; - border: 0; - background: none; - color: inherit; - font-family: inherit; - font-size: inherit; - font-weight: inherit; - text-align: left; - cursor: pointer; - - &:hover { - color: var(--link-highlight); - text-decoration: underline; + h2 { + display: flex; + align-items: center; } - &:focus { - box-shadow: none; + h3 { + display: flex; + align-items: center; } - &:disabled { - opacity: 0.3; - cursor: default; - } - } - - a { - @include font-size(12px); - - color: inherit; - font-family: inherit; - font-size: inherit; - font-weight: inherit; - text-align: left; - text-decoration: none; - cursor: pointer; - - &:hover { - color: var(--link-highlight); - text-decoration: underline; - } + input[type="checkbox"] { + @include font-size(24px); - &:focus { - box-shadow: none; + width: 24px; + height: 24px; + padding: 0; + font-weight: bold; + vertical-align: middle; + appearance: none; + + &:checked { + &::after { + content: "\2713"; + position: relative; + bottom: 4px; + left: 0; + color: $main-green; + } + } } - &:disabled, - &.disabled { - opacity: 0.3; - cursor: default; - pointer-events: none; - } - } + button { + @include font-size(12px); - .card--header-count { - @include font-size(12px); + padding: 0; + border: 0; + background: none; + color: inherit; + font-family: inherit; + font-size: inherit; + font-weight: inherit; + text-align: left; + cursor: pointer; - display: flex; - align-items: center; - height: 24px; - margin-left: 20px; - padding: 0 8px; - border-radius: 6px; - background-color: var(--light-bg); - color: $gray; - font-family: $metropolis; - font-weight: bold; - white-space: nowrap; - - &.card--header-count__success { - background-color: #73b183; - color: $white; - } + &:hover { + color: var(--link-highlight); + text-decoration: underline; + } - &.card--header-count__warning { - background-color: $warning; - color: $white; - } + &:focus { + box-shadow: none; + } - &.card--header-count__error { - background-color: $danger; - color: $white; + &:disabled { + opacity: 0.3; + cursor: default; + } } - } - .card--header-info { - @include font-size(12px, 12px); + a { + @include font-size(12px); + + color: inherit; + font-family: inherit; + font-size: inherit; + font-weight: inherit; + text-align: left; + text-decoration: none; + cursor: pointer; - margin-left: 20px; - font-family: $metropolis; - } + &:hover { + color: var(--link-highlight); + text-decoration: underline; + } - .card--header { - display: flex; - flex-direction: row; - align-items: center; - min-height: 50px; - margin: 20px 26px 0; - padding-bottom: 14px; - color: var(--body-color); - - @include phone-down { - min-height: unset; - margin: 20px 20px 0; - } + &:focus { + box-shadow: none; + } - @include tablet-down { - &.card--header__tablet-responsive { - flex-direction: column; - align-items: flex-start; - } + &:disabled, + &.disabled { + opacity: 0.3; + cursor: default; + pointer-events: none; + } } - .card--header__title { - @include font-size(14px, 21px); + .card--header-count { + @include font-size(12px); + + display: flex; + align-items: center; + height: 24px; + margin-left: 20px; + padding: 0 8px; + border-radius: 6px; + background-color: var(--light-bg); + color: $gray; + font-family: $metropolis; + font-weight: bold; + white-space: nowrap; + + &.card--header-count__success { + background-color: #73b183; + color: $white; + } + + &.card--header-count__warning { + background-color: $warning; + color: $white; + } - line-height: 100%; + &.card--header-count__error { + background-color: $danger; + color: $white; + } + } - + .dot-separator + span { - @include font-size(14px, 14px); + .card--header-info { + @include font-size(12px, 12px); - color: $gray-6; - font-family: $inter; - } + margin-left: 20px; + font-family: $metropolis; } - &.card--header__space-between { - justify-content: space-between; + .card--header { + display: flex; + flex-direction: row; + align-items: center; + min-height: 50px; + margin: 20px 26px 0; + padding-bottom: 14px; + color: var(--body-color); - .select-wrapper { - @include tablet-down { - display: none; + @include phone-down { + min-height: unset; + margin: 20px 20px 0; } - &.select-wrapper--card-header { - display: inline-block; + @include tablet-down { + &.card--header__tablet-responsive { + flex-direction: column; + align-items: flex-start; + } } - } - } - &.card--header-secondary { - min-height: auto; - margin: 0 0 0 26px; - padding: 0; - border: 0; - } - } + .card--header__title { + @include font-size(14px, 21px); - p { - @include font-size(14px); + line-height: 100%; - color: $gray; - font-family: $metropolis; - } + + .dot-separator + span { + @include font-size(14px, 14px); - .card--content { - padding: 0 30px 20px; + color: $gray-6; + font-family: $inter; + } + } - @include phone-down { - padding: 15px 20px; - } + &.card--header__space-between { + justify-content: space-between; - input { - padding: 0 20px; - } + .select-wrapper { + @include tablet-down { + display: none; + } - .card--content__input { - display: flex; + &.select-wrapper--card-header { + display: inline-block; + } + } + } - .color { - color: #108cff; - } + &.card--header-secondary { + min-height: auto; + margin: 0 0 0 26px; + padding: 0; + border: 0; + } + } - .card--content__input--dropdown { - cursor: pointer; + p { + @include font-size(14px); + + color: $gray; + font-family: $metropolis; + } - svg { - transition: transform 0.25s ease; + .card--content { + padding: 0 30px 20px; - path { - fill: var(--card-color); - } + @include phone-down { + padding: 15px 20px; } - &.opened > svg { - transform: rotate(90deg); + input { + padding: 0 20px; } - } - } - } - .card--inline-row + .card--inline-row { - margin-top: 23px; - } + .card--content__input { + display: flex; - .card--action { - @include font-size(12px); + .color { + color: #108cff; + } - padding: 11px; - border: 1px solid $gray; - border-radius: 6px; - background: transparent; - color: $gray; - font-family: $inter; - font-weight: bold; - text-decoration: none; - cursor: pointer; - - &:hover { - color: var(--link-highlight); - } + .card--content__input--dropdown { + cursor: pointer; - &:disabled { - opacity: 0.3; - pointer-events: none; - } + svg { + transition: transform 0.25s ease; + + path { + fill: var(--card-color); + } + } - &.card--action-icon { - @include font-size(20px); + &.opened > svg { + transform: rotate(90deg); + } + } + } + } - padding: 8px; - border: 0; + .card--inline-row + .card--inline-row { + margin-top: 23px; } - } - .card--action__busy { - @include font-size(12px); + .card--action { + @include font-size(12px); - margin-left: 20px; - color: $main-green; - font-family: $metropolis; - font-weight: bold; - } + padding: 11px; + border: 1px solid $gray; + border-radius: 6px; + background: transparent; + color: $gray; + font-family: $inter; + font-weight: bold; + text-decoration: none; + cursor: pointer; - .card--action + .card--action { - margin-left: 10px; - } + &:hover { + color: var(--link-highlight); + } - .card--value { - @include font-size(14px, 20px); + &:disabled { + opacity: 0.3; + pointer-events: none; + } - margin-bottom: 12px; - color: var(--body-color); - font-family: $ibm-plex-mono; - word-break: break-all; + &.card--action-icon { + @include font-size(20px); - .section--data { - .label { - color: var(--card-color); - } + padding: 8px; + border: 0; + } } - input { - padding: 0 20px; - background-color: var(--body-background); + .card--action__busy { + @include font-size(12px); - &[type='checkbox'] { - padding: 0; - } + margin-left: 20px; + color: $main-green; + font-family: $metropolis; + font-weight: bold; } - a, - button { - color: var(--link-color); + .card--action + .card--action { + margin-left: 10px; } - &.card--value__highlight { - @include font-size(12px); + .card--value { + @include font-size(14px, 20px); - color: $main-green; - font-weight: bold; - } + margin-bottom: 12px; + color: var(--body-color); + font-family: $ibm-plex-mono; + word-break: break-all; - &.card--value__no-margin { - margin-bottom: 0; - } + .section--data { + .label { + color: var(--card-color); + } + } - .card--value__secondary, - &.card--value__secondary { - @include font-size(12px); + input { + padding: 0 20px; + background-color: var(--body-background); - color: $main-green; - } + &[type="checkbox"] { + padding: 0; + } + } - .card--value__tertiary { - @include font-size(10px); + a, + button { + color: var(--link-color); + } - color: $main-green; - font-weight: normal; - } + &.card--value__highlight { + @include font-size(12px); - &.card--value__large, - .card--value__large { - @include font-size(18px); - } + color: $main-green; + font-weight: bold; + } - &.card--value-textarea { - min-height: 150px; - max-height: 150px; - padding: 10px; - overflow: auto; - background: var(--light-bg); - - &.card--value-textarea__ascii, - &.card--value-textarea__utf8 { - max-height: 350px; - white-space: pre-wrap; - } - - &.card--value-textarea__hex { - max-height: 350px; - font-family: 'Courier New', Courier, monospace; - word-break: break-word; - white-space: pre-wrap; - } - - &.card--value-textarea__json { - max-height: 350px; - font-family: 'Courier New', Courier, monospace; - white-space: pre-wrap; - } - - &.card--value-textarea__tall { - max-height: 280px; - } - - &.card--value-textarea__fit { - min-height: auto; - } - } + &.card--value__no-margin { + margin-bottom: 0; + } - &.card--value__light, - .card--value__light { - color: $gray; - } + .card--value__secondary, + &.card--value__secondary { + @include font-size(12px); + + color: $main-green; + } + + .card--value__tertiary { + @include font-size(10px); + + color: $main-green; + font-weight: normal; + } + + &.card--value__large, + .card--value__large { + @include font-size(18px); + } + + &.card--value-textarea { + min-height: 150px; + max-height: 150px; + padding: 10px; + overflow: auto; + background: var(--light-bg); + + &.card--value-textarea__ascii, + &.card--value-textarea__utf8 { + max-height: 350px; + white-space: pre-wrap; + } + + &.card--value-textarea__hex { + max-height: 350px; + font-family: "Courier New", Courier, monospace; + word-break: break-word; + white-space: pre-wrap; + } + + &.card--value-textarea__json { + max-height: 350px; + font-family: "Courier New", Courier, monospace; + white-space: pre-wrap; + } + + &.card--value-textarea__tall { + max-height: 280px; + } + + &.card--value-textarea__fit { + min-height: auto; + } + } - a { - &:hover { &.card--value__light, .card--value__light { - color: color.adjust($main-green-highlight, $red: 10); + color: $gray; + } + + a { + &:hover { + &.card--value__light, + .card--value__light { + color: color.adjust($main-green-highlight, $red: 10); + } + } } - } } - } - .card--label { - @include font-size(12px); + .card--label { + @include font-size(12px); - display: flex; - align-items: center; - height: 32px; - color: var(--card-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - white-space: nowrap; - - button, - .button { - @include font-size(12px); - - padding: 0; - border: 0; - background: none; - color: inherit; - font-family: inherit; - font-size: inherit; - font-weight: inherit; - text-align: left; - text-transform: inherit; - cursor: pointer; - - &:hover { - color: var(--link-highlight); - text-decoration: underline; - } - - &:focus { - box-shadow: none; - } - } + display: flex; + align-items: center; + height: 32px; + color: var(--card-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + white-space: nowrap; + + button, + .button { + @include font-size(12px); + + padding: 0; + border: 0; + background: none; + color: inherit; + font-family: inherit; + font-size: inherit; + font-weight: inherit; + text-align: left; + text-transform: inherit; + cursor: pointer; + + &:hover { + color: var(--link-highlight); + text-decoration: underline; + } + + &:focus { + box-shadow: none; + } + } - &.card--label__no-case { - text-transform: none; - } + &.card--label__no-case { + text-transform: none; + } - &.card--label__no-height { - height: auto; + &.card--label__no-height { + height: auto; + } } - } } diff --git a/client/src/scss/fonts.scss b/client/src/scss/fonts.scss index 5f9b821fe..9e88c1da9 100644 --- a/client/src/scss/fonts.scss +++ b/client/src/scss/fonts.scss @@ -1,23 +1,23 @@ // stylelint-disable-next-line value-keyword-case -$fallback-fonts: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; -$metropolis: 'Metropolis Regular', $fallback-fonts; -$metropolis-italic: 'Metropolis Regular Italic', $fallback-fonts; -$metropolis-extra-light: 'Metropolis Extra Light', $fallback-fonts; -$metropolis-extra-light-italic: 'Metropolis Extra Light Italic', $fallback-fonts; -$metropolis-light: 'Metropolis Light', $fallback-fonts; -$metropolis-light-italic: 'Metropolis Light Italic', $fallback-fonts; -$metropolis-thin: 'Metropolis Thin', $fallback-fonts; -$metropolis-thin-italic: 'Metropolis Thin Italic', $fallback-fonts; -$metropolis-medium: 'Metropolis Medium', $fallback-fonts; -$metropolis-medium-italic: 'Metropolis Medium Italic', $fallback-fonts; -$metropolis-semi-bold: 'Metropolis Semi Bold', $fallback-fonts; -$metropolis-semi-bold-italic: 'Metropolis Semi Bold Italic', $fallback-fonts; -$metropolis-bold: 'Metropolis Bold', $fallback-fonts; -$metropolis-bold-italic: 'Metropolis Bold Italic', $fallback-fonts; -$metropolis-extra-bold: 'Metropolis Extra Bold', $fallback-fonts; -$metropolis-extra-bold-italic: 'Metropolis Extra Bold Italic', $fallback-fonts; -$metropolis-black: 'Metropolis Black', $fallback-fonts; -$metropolis-black-italic: 'Metropolis Black Italic', $fallback-fonts; -$ibm-plex-mono: 'IBM Plex Mono', 'monospace', $fallback-fonts; -$inter: 'Inter', $fallback-fonts; +$fallback-fonts: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", + "Segoe UI Symbol"; +$metropolis: "Metropolis Regular", $fallback-fonts; +$metropolis-italic: "Metropolis Regular Italic", $fallback-fonts; +$metropolis-extra-light: "Metropolis Extra Light", $fallback-fonts; +$metropolis-extra-light-italic: "Metropolis Extra Light Italic", $fallback-fonts; +$metropolis-light: "Metropolis Light", $fallback-fonts; +$metropolis-light-italic: "Metropolis Light Italic", $fallback-fonts; +$metropolis-thin: "Metropolis Thin", $fallback-fonts; +$metropolis-thin-italic: "Metropolis Thin Italic", $fallback-fonts; +$metropolis-medium: "Metropolis Medium", $fallback-fonts; +$metropolis-medium-italic: "Metropolis Medium Italic", $fallback-fonts; +$metropolis-semi-bold: "Metropolis Semi Bold", $fallback-fonts; +$metropolis-semi-bold-italic: "Metropolis Semi Bold Italic", $fallback-fonts; +$metropolis-bold: "Metropolis Bold", $fallback-fonts; +$metropolis-bold-italic: "Metropolis Bold Italic", $fallback-fonts; +$metropolis-extra-bold: "Metropolis Extra Bold", $fallback-fonts; +$metropolis-extra-bold-italic: "Metropolis Extra Bold Italic", $fallback-fonts; +$metropolis-black: "Metropolis Black", $fallback-fonts; +$metropolis-black-italic: "Metropolis Black Italic", $fallback-fonts; +$ibm-plex-mono: "IBM Plex Mono", "monospace", $fallback-fonts; +$inter: "Inter", $fallback-fonts; diff --git a/client/src/scss/forms.scss b/client/src/scss/forms.scss index c0a1192a4..48312fffb 100644 --- a/client/src/scss/forms.scss +++ b/client/src/scss/forms.scss @@ -1,247 +1,247 @@ -@import './mixins'; -@import './variables'; -@import './themes'; -@import './media-queries'; +@import "./mixins"; +@import "./variables"; +@import "./themes"; +@import "./media-queries"; .select-wrapper { - display: inline-block; - position: relative; - - span { - position: absolute; - z-index: 2; - top: 19%; - right: 5%; - color: $gray; - pointer-events: none; - - @include desktop-down { - top: 15%; + display: inline-block; + position: relative; + + span { + position: absolute; + z-index: 2; + top: 19%; + right: 5%; + color: $gray; + pointer-events: none; + + @include desktop-down { + top: 15%; + } + } + + select { + @include font-size(14px); + + height: 40px; + margin: 0; + padding: 0 48px 0 20px; + transition: border-color 0.2s ease; + border: 1px solid var(--input-border-color); + border-radius: 6px; + outline: none; + background-color: transparent; + color: var(--body-color); + font-family: $inter; + appearance: none; + + &:focus { + border-color: var(--input-focus-border-color); + } + + &:-ms-expand { + display: none; + } + + &:-moz-focusring { + color: transparent; + text-shadow: 0 0 0 $gray-10; + + * { + color: $gray-10; + text-shadow: none; + } + } + + &.select-plus { + position: relative; + min-width: 100px; + height: 48px; + margin-right: -1px; + border-radius: 6px 0 0 6px; + + &:focus { + z-index: 1; + } + } + + option { + background-color: var(--body-background); + color: var(--body-color); + } } - } - select { + &.select-wrapper--small { + select { + @include font-size(12px); + + height: 32px; + } + + span { + top: 15%; + } + } +} + +input { @include font-size(14px); height: 40px; margin: 0; - padding: 0 48px 0 20px; - transition: border-color 0.2s ease; border: 1px solid var(--input-border-color); border-radius: 6px; outline: none; - background-color: transparent; color: var(--body-color); font-family: $inter; - appearance: none; &:focus { - border-color: var(--input-focus-border-color); - } - - &:-ms-expand { - display: none; + box-shadow: 0 0 3px 0 var(--link-highlight); } &:-moz-focusring { - color: transparent; - text-shadow: 0 0 0 $gray-10; - - * { - color: $gray-10; - text-shadow: none; - } + color: transparent; + text-shadow: 0 0 0 $gray-10; } - &.select-plus { - position: relative; - min-width: 100px; - height: 48px; - margin-right: -1px; - border-radius: 6px 0 0 6px; + &.input-plus { + position: relative; + height: 48px; + border-radius: 0 6px 6px 0; - &:focus { - z-index: 1; - } - } - - option { - background-color: var(--body-background); - color: var(--body-color); - } - } - - &.select-wrapper--small { - select { - @include font-size(12px); - - height: 32px; - } - - span { - top: 15%; + &:focus { + z-index: 1; + } } - } } -input { - @include font-size(14px); - - height: 40px; - margin: 0; - border: 1px solid var(--input-border-color); - border-radius: 6px; - outline: none; - color: var(--body-color); - font-family: $inter; - - &:focus { - box-shadow: 0 0 3px 0 var(--link-highlight); - } - - &:-moz-focusring { - color: transparent; - text-shadow: 0 0 0 $gray-10; - } - - &.input-plus { - position: relative; - height: 48px; - border-radius: 0 6px 6px 0; +button { + outline: none; &:focus { - z-index: 1; + box-shadow: 0 0 3px 0 var(--link-highlight); } - } -} - -button { - outline: none; - &:focus { - box-shadow: 0 0 3px 0 var(--link-highlight); - } - - &:-moz-focusring { - text-shadow: 0 0 0 $gray-10; - } + &:-moz-focusring { + text-shadow: 0 0 0 $gray-10; + } } .form-validation { - @include font-size(12px); + @include font-size(12px); - font-family: $metropolis; + font-family: $metropolis; } .form-label-width { - min-width: 200px; + min-width: 200px; } .form-input-long { - width: 100%; - background-color: transparent; + width: 100%; + background-color: transparent; } .card { - .form-button { - @include font-size(12px); - - display: flex; - align-items: center; - justify-content: center; - height: 32px; - padding: 0 21px; - border: 1px solid var(--input-border-color); - border-radius: 6px; - outline: none; - background-color: transparent; - color: var(--body-color); - font-family: $metropolis; - cursor: pointer; + .form-button { + @include font-size(12px); - &.selected { - border-color: var(--link-highlight); - background-color: var(--link-highlight); - color: $white; - font-weight: 600; - } + display: flex; + align-items: center; + justify-content: center; + height: 32px; + padding: 0 21px; + border: 1px solid var(--input-border-color); + border-radius: 6px; + outline: none; + background-color: transparent; + color: var(--body-color); + font-family: $metropolis; + cursor: pointer; + + &.selected { + border-color: var(--link-highlight); + background-color: var(--link-highlight); + color: $white; + font-weight: 600; + } - &:disabled { - opacity: 0.5; - pointer-events: none; - } + &:disabled { + opacity: 0.5; + pointer-events: none; + } - &:focus { - box-shadow: 0 0 3px 0 var(--link-highlight); - } + &:focus { + box-shadow: 0 0 3px 0 var(--link-highlight); + } - &:-moz-focusring { - color: transparent; - text-shadow: 0 0 0 $white; + &:-moz-focusring { + color: transparent; + text-shadow: 0 0 0 $white; + } } - } } .calendar-wrapper { - position: relative; - display: inline-block; + position: relative; + display: inline-block; - .material-icons { - position: absolute; - color: var(--body-color); - right: 10px; - top: 9px; - } + .material-icons { + position: absolute; + color: var(--body-color); + right: 10px; + top: 9px; + } - .rdt { - font-family: $inter; + .rdt { + font-family: $inter; - table { - thead tr th { - @include font-size(12px); + table { + thead tr th { + @include font-size(12px); - font-weight: 600; - text-transform: uppercase; - /* stylelint-disable selector-class-pattern */ - &.rdtSwitch, - &.rdtPrev, - &.rdtNext { - @include font-size(18px); + font-weight: 600; + text-transform: uppercase; + /* stylelint-disable selector-class-pattern */ + &.rdtSwitch, + &.rdtPrev, + &.rdtNext { + @include font-size(18px); - text-transform: capitalize; - } - } + text-transform: capitalize; + } + } - tbody { - @include font-size(14px); - } - } + tbody { + @include font-size(14px); + } + } - .rdtPicker { - background-color: var(--body-background); - color: var(--body-color); - - td.rdtDay:hover, - td.rdtHour:hover, - td.rdtMinute:hover, - td.rdtSecond:hover, - .rdtTimeToggle:hover, - thead tr:first-of-type th:hover, - td.rdtMonth:hover, - td.rdtYear:hover { - background: var(--calendar-hover); - } - - td.rdtActive, - td.rdtActive:hover { - background-color: var(--link-color); - } - } - /* stylelint-enable selector-class-pattern */ - input { - background-color: transparent; - padding: 5px 10px; - cursor: pointer; + .rdtPicker { + background-color: var(--body-background); + color: var(--body-color); + + td.rdtDay:hover, + td.rdtHour:hover, + td.rdtMinute:hover, + td.rdtSecond:hover, + .rdtTimeToggle:hover, + thead tr:first-of-type th:hover, + td.rdtMonth:hover, + td.rdtYear:hover { + background: var(--calendar-hover); + } + + td.rdtActive, + td.rdtActive:hover { + background-color: var(--link-color); + } + } + /* stylelint-enable selector-class-pattern */ + input { + background-color: transparent; + padding: 5px 10px; + cursor: pointer; + } } - } } diff --git a/client/src/scss/layout.scss b/client/src/scss/layout.scss index 89d0786de..ac46389d5 100644 --- a/client/src/scss/layout.scss +++ b/client/src/scss/layout.scss @@ -1,226 +1,226 @@ -@import './media-queries'; -@import './mixins'; -@import './variables'; +@import "./media-queries"; +@import "./mixins"; +@import "./variables"; .row { - display: flex; - flex-direction: row; + display: flex; + flex-direction: row; - @include tablet-down { - &.row--tablet-responsive { - flex-direction: column; + @include tablet-down { + &.row--tablet-responsive { + flex-direction: column; - &.middle { - align-items: flex-start; - } + &.middle { + align-items: flex-start; + } + } } - } - &.center { - justify-content: center; - } + &.center { + justify-content: center; + } - &.end { - justify-content: flex-end; - } + &.end { + justify-content: flex-end; + } - &.space-between { - justify-content: space-between; - } + &.space-between { + justify-content: space-between; + } - &.wrap { - flex-wrap: wrap; - } + &.wrap { + flex-wrap: wrap; + } - &.top { - align-items: flex-start; - } + &.top { + align-items: flex-start; + } - &.middle { - align-items: center; - } + &.middle { + align-items: center; + } - &.bottom { - align-items: flex-end; - } + &.bottom { + align-items: flex-end; + } } .col { - display: flex; - flex-direction: column; + display: flex; + flex-direction: column; - &.fill { - flex: 1; - } + &.fill { + flex: 1; + } } .w100 { - width: 100%; + width: 100%; } .pointer { - cursor: pointer; + cursor: pointer; } .line-breaks { - white-space: pre; + white-space: pre; } .margin-0 { - margin: 0 !important; + margin: 0 !important; } .margin-b-0 { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .margin-b-2 { - margin-bottom: 2px !important; + margin-bottom: 2px !important; } .margin-r-2 { - margin-right: 2px !important; + margin-right: 2px !important; } .margin-r-5 { - margin-right: 5px !important; + margin-right: 5px !important; } .margin-t-0 { - margin-top: 0 !important; + margin-top: 0 !important; } .margin-t-2 { - margin-top: 2px !important; + margin-top: 2px !important; } .margin-l-2 { - margin-left: 2px !important; + margin-left: 2px !important; } .margin-b-s { - margin-bottom: 20px; + margin-bottom: 20px; } .margin-r-s { - margin-right: 20px; + margin-right: 20px; } .margin-t-s { - margin-top: 20px; + margin-top: 20px; } .margin-l-s { - margin-left: 20px; + margin-left: 20px; } .margin-b-t { - margin-bottom: 10px; + margin-bottom: 10px; } .margin-r-t { - margin-right: 10px; + margin-right: 10px; } .margin-t-t { - margin-top: 10px; + margin-top: 10px; } .margin-l-t { - margin-left: 10px; + margin-left: 10px; } .margin-b-m { - margin-bottom: 30px; + margin-bottom: 30px; } .margin-r-m { - margin-right: 30px; + margin-right: 30px; } .margin-t-m { - margin-top: 30px; + margin-top: 30px; } .margin-l-m { - margin-left: 30px; + margin-left: 30px; } .padding-l-t { - padding-left: 10px; + padding-left: 10px; } .padding-l-8 { - padding-left: 8px; + padding-left: 8px; } .padding-b-0 { - padding-bottom: 0; + padding-bottom: 0; } .padding-b-s { - padding-bottom: 20px; + padding-bottom: 20px; } .padding-r-s { - padding-right: 20px; + padding-right: 20px; } .padding-t-s { - padding-top: 20px; + padding-top: 20px; } .padding-l-s { - padding-left: 20px; + padding-left: 20px; } .padding-b-m { - padding-bottom: 30px; + padding-bottom: 30px; } .padding-r-m { - padding-right: 30px; + padding-right: 30px; } .padding-t-m { - padding-top: 30px; + padding-top: 30px; } .padding-l-m { - padding-left: 30px; + padding-left: 30px; } .relative { - position: relative; + position: relative; } .overflow-hidden { - overflow: hidden; + overflow: hidden; } .overflow-unset { - overflow: unset; + overflow: unset; } .overflow-ellipsis { - overflow: hidden !important; - text-overflow: ellipsis !important; - word-break: normal !important; + overflow: hidden !important; + text-overflow: ellipsis !important; + word-break: normal !important; } .hidden { - display: none !important; + display: none !important; } .dot-separator { - @include font-size(20px); + @include font-size(20px); - margin: 0 6px; - color: $gray-6; + margin: 0 6px; + color: $gray-6; } .truncate { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } diff --git a/client/src/scss/media-queries.scss b/client/src/scss/media-queries.scss index 34f1abacc..b57bdad3f 100644 --- a/client/src/scss/media-queries.scss +++ b/client/src/scss/media-queries.scss @@ -3,19 +3,19 @@ $tablet-width: 768px; $phone-width: 480px; @mixin desktop-down { - @media (max-width: #{$desktop-width}) { - @content; - } + @media (max-width: #{$desktop-width}) { + @content; + } } @mixin tablet-down { - @media (max-width: #{$tablet-width}) { - @content; - } + @media (max-width: #{$tablet-width}) { + @content; + } } @mixin phone-down { - @media (max-width: #{$phone-width}) { - @content; - } + @media (max-width: #{$phone-width}) { + @content; + } } diff --git a/client/src/scss/mixins.scss b/client/src/scss/mixins.scss index e8b074aa8..29e4f8f7a 100644 --- a/client/src/scss/mixins.scss +++ b/client/src/scss/mixins.scss @@ -1,13 +1,13 @@ -@use 'sass:math'; +@use "sass:math"; $rem-base-font: 16px !default; @mixin font-size($font-size, $line-height: 0) { - font-size: $font-size; - font-size: math.div($font-size, $rem-base-font) * 1rem; + font-size: $font-size; + font-size: math.div($font-size, $rem-base-font) * 1rem; - @if $line-height > 0 { - line-height: $line-height; - line-height: math.div($line-height, $rem-base-font) * 1rem; - } + @if $line-height > 0 { + line-height: $line-height; + line-height: math.div($line-height, $rem-base-font) * 1rem; + } } diff --git a/client/src/scss/section.scss b/client/src/scss/section.scss index d59ee0c15..d593bfa0f 100644 --- a/client/src/scss/section.scss +++ b/client/src/scss/section.scss @@ -1,138 +1,138 @@ -@import './fonts'; -@import './layout'; -@import './media-queries'; -@import './mixins'; -@import './variables'; -@import './themes'; +@import "./fonts"; +@import "./layout"; +@import "./media-queries"; +@import "./mixins"; +@import "./variables"; +@import "./themes"; .section { - display: flex; - flex-direction: column; - padding: 52px 0; - border-bottom: 1px solid var(--border-color); - - @include tablet-down { - padding-top: 24px; - } - - &:last-child { - padding-bottom: 12px; - border-bottom: 0; - } - - .section--header { display: flex; - flex-direction: row; - align-items: center; - margin-bottom: 34px; - } + flex-direction: column; + padding: 52px 0; + border-bottom: 1px solid var(--border-color); - .section--data { - margin-bottom: 26px; + @include tablet-down { + padding-top: 24px; + } &:last-child { - margin-bottom: 0; + padding-bottom: 12px; + border-bottom: 0; } - .label { - @include font-size(12px); + .section--header { + display: flex; + flex-direction: row; + align-items: center; + margin-bottom: 34px; + } - margin-bottom: 4px; - color: var(--header-color); - font-family: $inter; - font-weight: 500; - letter-spacing: 0.5px; - white-space: nowrap; + .section--data { + margin-bottom: 26px; - &.indent { - margin-left: 8px; - } - } + &:last-child { + margin-bottom: 0; + } - .value { - @include font-size(14px); + .label { + @include font-size(12px); - color: var(--body-color); - font-family: $inter; - letter-spacing: 0.5px; - word-break: break-all; + margin-bottom: 4px; + color: var(--header-color); + font-family: $inter; + font-weight: 500; + letter-spacing: 0.5px; + white-space: nowrap; - &.code { - @include font-size(14px); + &.indent { + margin-left: 8px; + } + } + + .value { + @include font-size(14px); + + color: var(--body-color); + font-family: $inter; + letter-spacing: 0.5px; + word-break: break-all; + + &.code { + @include font-size(14px); - font-family: $ibm-plex-mono; - font-weight: normal; - letter-spacing: 0.02em; - line-height: 20px; - } + font-family: $ibm-plex-mono; + font-weight: normal; + letter-spacing: 0.02em; + line-height: 20px; + } - &.highlight { - color: var(--link-color); - } + &.highlight { + color: var(--link-color); + } - &.featured { - @include font-size(16px, 24px); + &.featured { + @include font-size(16px, 24px); - color: var(--body-color); - font-weight: 700; - letter-spacing: 0.75px; + color: var(--body-color); + font-weight: 700; + letter-spacing: 0.75px; - span { - color: $gray-6; + span { + color: $gray-6; + } + } + + &.indent { + margin-left: 8px; + } } - } - &.indent { - margin-left: 8px; - } + &.max-w-55 { + max-width: 55%; + + @include tablet-down { + max-width: 100%; + } + } } - &.max-w-55 { - max-width: 55%; + a { + @include font-size(12px); - @include tablet-down { - max-width: 100%; - } - } - } - - a { - @include font-size(12px); - - color: inherit; - font-family: inherit; - font-size: inherit; - font-weight: inherit; - text-align: left; - text-decoration: none; - cursor: pointer; - - &:hover { - color: var(--link-highlight); - text-decoration: underline; - } + color: inherit; + font-family: inherit; + font-size: inherit; + font-weight: inherit; + text-align: left; + text-decoration: none; + cursor: pointer; + + &:hover { + color: var(--link-highlight); + text-decoration: underline; + } - &:focus { - box-shadow: none; + &:focus { + box-shadow: none; + } } - } - p { - @include font-size(14px); + p { + @include font-size(14px); - color: $gray; - font-family: $metropolis; - } + color: $gray; + font-family: $metropolis; + } - &.no-border-bottom { - border-bottom: 0; - } + &.no-border-bottom { + border-bottom: 0; + } - .text--no-decoration:hover { - text-decoration: none; - } + .text--no-decoration:hover { + text-decoration: none; + } } .highlight { - color: var(--link-color); + color: var(--link-color); } diff --git a/client/src/scss/themes.scss b/client/src/scss/themes.scss index 015d13a30..20831edc6 100644 --- a/client/src/scss/themes.scss +++ b/client/src/scss/themes.scss @@ -1,134 +1,134 @@ -@import './variables'; +@import "./variables"; :root { - --body-background: #{$white}; - --card-body: #f8f9fa; - --body-color: #{$gray-9}; - --active-item-color: #{$gray-midnight}; - --navbar-bg: rgb(255 255 255 / 70%); - --navbar-color: #{$gray-6}; - --header-bg: linear-gradient(360deg, #e1e9f9 0.06%, #f3f7ff 99.2%); - --bubble-1: url('~assets/bubble-1.svg'); - --bubble-2: url('~assets/bubble-2.svg'); - --header-color: #{$gray-6}; - --type-color: #{$gray-7}; - --header-box-bg: rgb(255 255 255 / 60%); - --header-label-color: #{$gray-midnight}; - --header-icon-color: #{$gray-7}; - --header-svg-bg: #{$gray-2}; - --border-color: #{$gray-3}; - --fiat-acronym-color: #{$gray-11}; - --expanded-color: #{$gray-7}; - --light-bg: #{$gray-1}; - --link-color: #{$blue-5}; - --link-highlight: #{$blue-5}; - --amount-color: #3ca2ff; - --tabbed-section-tab-active: #3ca2ff; - --input-border-color: #d9e1ef; - --input-focus-border-color: #{$gray-7}; - --modal-color: #{$gray-7}; - --message-confirmed-bg: #{$mint-green-1}; - --message-conflicting-bg: rgb(202 73 61 / 24%); - --qr-color: #{$gray-9}; - --box-shadow-down: 0 4px 30px rgb(132 147 173 / 10%); - --header-identity: #{$gray-daylight}; - --did-color: #{$gray-7}; - --search-bg-opacity: 0.6; - --card-color: #{$gray-6}; - --message-tree-bg: #{$gray-2}; - --visualizer-bg: #{$white}; - --pagination-color: #{$gray-6}; - --pagination-bg-hover-color: #b1d9fd; - --pagination-bg-selected-color: #3ca2ff; - --pagination-selected-color: #{$white}; - --pagination-arrow-color: #{$gray-8}; - --pagination-disabled-color: #{$gray-5}; - --search-svg: #{$gray-6}; - --identity-added: #e6ffed; - --identity-removed: #ffeef0; - --mint-green-bg: #{$mint-green-6}; - --shimmer-bg: url('~assets/header-bg-light.svg'); - --stardust-visualizer-bg: #{$white}; - --transaction-history-dark-row: #{$gray-1}; - --associated-outputs-tabs-bg: #{$white}; - --associated-outputs-tabs-active: #8ac7ff; - --date-input-theme: light; - --statistics-charts-tooltip-bg: #{$gray-2}; - --statistics-charts-axis: #{$gray-1}; - --statistics-select-bg: #{$gray-1}; - --statistics-select-border: #{$gray-1}; - --calendar-bg: #{$white}; - --calendar-hover: #{$gray-1}; + --body-background: #{$white}; + --card-body: #f8f9fa; + --body-color: #{$gray-9}; + --active-item-color: #{$gray-midnight}; + --navbar-bg: rgb(255 255 255 / 70%); + --navbar-color: #{$gray-6}; + --header-bg: linear-gradient(360deg, #e1e9f9 0.06%, #f3f7ff 99.2%); + --bubble-1: url("~assets/bubble-1.svg"); + --bubble-2: url("~assets/bubble-2.svg"); + --header-color: #{$gray-6}; + --type-color: #{$gray-7}; + --header-box-bg: rgb(255 255 255 / 60%); + --header-label-color: #{$gray-midnight}; + --header-icon-color: #{$gray-7}; + --header-svg-bg: #{$gray-2}; + --border-color: #{$gray-3}; + --fiat-acronym-color: #{$gray-11}; + --expanded-color: #{$gray-7}; + --light-bg: #{$gray-1}; + --link-color: #{$blue-5}; + --link-highlight: #{$blue-5}; + --amount-color: #3ca2ff; + --tabbed-section-tab-active: #3ca2ff; + --input-border-color: #d9e1ef; + --input-focus-border-color: #{$gray-7}; + --modal-color: #{$gray-7}; + --message-confirmed-bg: #{$mint-green-1}; + --message-conflicting-bg: rgb(202 73 61 / 24%); + --qr-color: #{$gray-9}; + --box-shadow-down: 0 4px 30px rgb(132 147 173 / 10%); + --header-identity: #{$gray-daylight}; + --did-color: #{$gray-7}; + --search-bg-opacity: 0.6; + --card-color: #{$gray-6}; + --message-tree-bg: #{$gray-2}; + --visualizer-bg: #{$white}; + --pagination-color: #{$gray-6}; + --pagination-bg-hover-color: #b1d9fd; + --pagination-bg-selected-color: #3ca2ff; + --pagination-selected-color: #{$white}; + --pagination-arrow-color: #{$gray-8}; + --pagination-disabled-color: #{$gray-5}; + --search-svg: #{$gray-6}; + --identity-added: #e6ffed; + --identity-removed: #ffeef0; + --mint-green-bg: #{$mint-green-6}; + --shimmer-bg: url("~assets/header-bg-light.svg"); + --stardust-visualizer-bg: #{$white}; + --transaction-history-dark-row: #{$gray-1}; + --associated-outputs-tabs-bg: #{$white}; + --associated-outputs-tabs-active: #8ac7ff; + --date-input-theme: light; + --statistics-charts-tooltip-bg: #{$gray-2}; + --statistics-charts-axis: #{$gray-1}; + --statistics-select-bg: #{$gray-1}; + --statistics-select-border: #{$gray-1}; + --calendar-bg: #{$white}; + --calendar-hover: #{$gray-1}; - body.darkmode { - --body-background: #091326; - --card-body: #141e31; - --body-color: #fcfcfc; - --active-item-color: #{$gray-daylight}; - --navbar-bg: rgb(6 16 35 / 70%); - --navbar-color: #{$gray-5}; - --header-bg: linear-gradient(180deg, #{$gray-7} 0%, #{$gray-9} 100%); - --bubble-1: url('~assets/bubble-1-darkmode.svg'); - --bubble-2: url('~assets/bubble-2-darkmode.svg'); - --header-color: #{$gray-5}; - --type-color: #{$gray-3}; - --header-box-bg: rgb(6 16 35 / 70%); - --header-label-color: #{$gray-3}; - --header-icon-color: #{$gray-5}; - --header-svg-bg: #202e4a; - --border-color: #{$gray-5}; - --fiat-acronym-color: #{$white}; - --expanded-color: #{$gray-5}; - --light-bg: #48577614; - --input-border-color: #{$gray-5}; - --input-focus-border-color: #{$gray-3}; - --modal-color: #{$gray-3}; - --message-confirmed-bg: rgb(0 224 202 / 20%); - --qr-color: #{$white}; - --box-shadow-down: 0 4px 30px rgb(137 141 145 / 10%); - --header-identity: #{$gray-midnight}; - --did-color: #{$gray-4}; - --search-bg-opacity: 0.2; - --card-color: #{$gray-4}; - --message-tree-bg: #ffffff1f; - --visualizer-bg: #{$gray-midnight}; - --pagination-color: #{$gray-5}; - --pagination-selected-color: #{$gray-9}; - --pagination-arrrow-color: #{$gray-1}; - --pagination-disabled-color: #{$gray-3}; - --search-svg: #{$gray-5}; - --identity-added: rgb(20 202 191 / 8%); - --identity-removed: rgb(118 45 52 / 49%); - --mint-green-bg: #{$mint-green-7}; - --feeds-bg: #00121f; - --shimmer-bg: url('~assets/header-bg-dark.svg'); - --stardust-visualizer-bg: #0f202c; - --transaction-history-dark-row: #{$gray-9}; - --associated-outputs-tabs-bg: #00121f; - --date-input-theme: dark; - --statistics-charts-tooltip-bg: #{$gray-9}; - --statistics-charts-axis: #{$gray-9}; - --statistics-select-bg: #{$gray-9}; - --statistics-select-border: #{$gray-8}; - --calendar-bg: #{$gray-9}; - --calendar-hover: #{$gray-7}; - } + body.darkmode { + --body-background: #091326; + --card-body: #141e31; + --body-color: #fcfcfc; + --active-item-color: #{$gray-daylight}; + --navbar-bg: rgb(6 16 35 / 70%); + --navbar-color: #{$gray-5}; + --header-bg: linear-gradient(180deg, #{$gray-7} 0%, #{$gray-9} 100%); + --bubble-1: url("~assets/bubble-1-darkmode.svg"); + --bubble-2: url("~assets/bubble-2-darkmode.svg"); + --header-color: #{$gray-5}; + --type-color: #{$gray-3}; + --header-box-bg: rgb(6 16 35 / 70%); + --header-label-color: #{$gray-3}; + --header-icon-color: #{$gray-5}; + --header-svg-bg: #202e4a; + --border-color: #{$gray-5}; + --fiat-acronym-color: #{$white}; + --expanded-color: #{$gray-5}; + --light-bg: #48577614; + --input-border-color: #{$gray-5}; + --input-focus-border-color: #{$gray-3}; + --modal-color: #{$gray-3}; + --message-confirmed-bg: rgb(0 224 202 / 20%); + --qr-color: #{$white}; + --box-shadow-down: 0 4px 30px rgb(137 141 145 / 10%); + --header-identity: #{$gray-midnight}; + --did-color: #{$gray-4}; + --search-bg-opacity: 0.2; + --card-color: #{$gray-4}; + --message-tree-bg: #ffffff1f; + --visualizer-bg: #{$gray-midnight}; + --pagination-color: #{$gray-5}; + --pagination-selected-color: #{$gray-9}; + --pagination-arrrow-color: #{$gray-1}; + --pagination-disabled-color: #{$gray-3}; + --search-svg: #{$gray-5}; + --identity-added: rgb(20 202 191 / 8%); + --identity-removed: rgb(118 45 52 / 49%); + --mint-green-bg: #{$mint-green-7}; + --feeds-bg: #00121f; + --shimmer-bg: url("~assets/header-bg-dark.svg"); + --stardust-visualizer-bg: #0f202c; + --transaction-history-dark-row: #{$gray-9}; + --associated-outputs-tabs-bg: #00121f; + --date-input-theme: dark; + --statistics-charts-tooltip-bg: #{$gray-9}; + --statistics-charts-axis: #{$gray-9}; + --statistics-select-bg: #{$gray-9}; + --statistics-select-border: #{$gray-8}; + --calendar-bg: #{$gray-9}; + --calendar-hover: #{$gray-7}; + } - body.shimmer { - --link-color: #{$mint-green-7}; - --link-highlight: #{$main-green-highlight}; - --associated-outputs-tabs-active: #{$mint-green-1}; - --tabbed-section-tab-active: #{$mint-green-7}; - --pagination-bg-hover-color: #{$mint-green-1}; - --pagination-bg-selected-color: #{$mint-green-6}; - --header-bg: #f2f6f9; - --navbar-bg: rgb(255 255 255 / 20%); - --amount-color: #{$mint-green-7}; - } + body.shimmer { + --link-color: #{$mint-green-7}; + --link-highlight: #{$main-green-highlight}; + --associated-outputs-tabs-active: #{$mint-green-1}; + --tabbed-section-tab-active: #{$mint-green-7}; + --pagination-bg-hover-color: #{$mint-green-1}; + --pagination-bg-selected-color: #{$mint-green-6}; + --header-bg: #f2f6f9; + --navbar-bg: rgb(255 255 255 / 20%); + --amount-color: #{$mint-green-7}; + } - body.shimmer.darkmode { - --body-background: #00121f; - --header-bg: #00121f; - --navbar-bg: #00121f; - } + body.shimmer.darkmode { + --body-background: #00121f; + --header-bg: #00121f; + --navbar-bg: #00121f; + } } diff --git a/client/src/services/apiClient.ts b/client/src/services/apiClient.ts index 00f4c6b68..eeb5b55b9 100644 --- a/client/src/services/apiClient.ts +++ b/client/src/services/apiClient.ts @@ -31,7 +31,7 @@ export class ApiClient { path: string, method: "get" | "post" | "put" | "delete", request?: U, - timeout?: number + timeout?: number, ): Promise { let response: T; @@ -39,7 +39,7 @@ export class ApiClient { response = await FetchHelper.json(this._endpoint, path, method, request, undefined, timeout); } catch (err) { response = { - error: `There was a problem communicating with the API.\n${err}` + error: `There was a problem communicating with the API.\n${err}`, } as T; } @@ -58,22 +58,21 @@ export class ApiClient { path: string, method: "get" | "post" | "put" | "delete", request?: unknown, - timeout?: number + timeout?: number, ): Promise { let result: IRawResponse; const headers = { "Content-Type": "application/json" }; try { result = { - raw: await FetchHelper.raw(this._endpoint, path, method, request, headers, timeout) + raw: await FetchHelper.raw(this._endpoint, path, method, request, headers, timeout), }; } catch (err) { result = { - error: `There was a problem communicating with the API.\n${err}` + error: `There was a problem communicating with the API.\n${err}`, }; } return result; } } - diff --git a/client/src/services/chrysalis/chrysalisApiClient.ts b/client/src/services/chrysalis/chrysalisApiClient.ts index e03e46903..c536d8fb8 100644 --- a/client/src/services/chrysalis/chrysalisApiClient.ts +++ b/client/src/services/chrysalis/chrysalisApiClient.ts @@ -49,7 +49,7 @@ export class ChrysalisApiClient extends ApiClient { public async search(request: ISearchRequest): Promise { return this.callApi( `search/${request.network}/${request.query}${request.cursor ? `?cursor=${request.cursor}` : ""}`, - "get" + "get", ); } @@ -80,7 +80,7 @@ export class ChrysalisApiClient extends ApiClient { const { network, address, ...params } = request; return this.callApi( `transactionhistory/${network}/${address}${params ? FetchHelper.urlParams(params) : ""}`, - "get" + "get", ); } @@ -90,10 +90,7 @@ export class ChrysalisApiClient extends ApiClient { * @returns The response from the request. */ public async milestoneDetails(request: IMilestoneDetailsRequest): Promise { - return this.callApi( - `milestone/${request.network}/${request.milestoneIndex}`, - "get" - ); + return this.callApi(`milestone/${request.network}/${request.milestoneIndex}`, "get"); } /** @@ -104,7 +101,7 @@ export class ChrysalisApiClient extends ApiClient { public async stats(request: IStatsGetRequest): Promise { return this.callApi( `stats/${request.network}?includeHistory=${request.includeHistory ? "true" : "false"}`, - "get" + "get", ); } @@ -114,9 +111,7 @@ export class ChrysalisApiClient extends ApiClient { * @returns The response from the request. */ public async didDocument(request: IIdentityDidResolveRequest): Promise { - return this.callApi( - `chrysalis/did/${request.network}/${request.did}/document`, "get" - ); + return this.callApi(`chrysalis/did/${request.network}/${request.did}/document`, "get"); } /** @@ -127,7 +122,7 @@ export class ChrysalisApiClient extends ApiClient { public async didHistory(request: IIdentityDidHistoryRequest): Promise { return this.callApi( `chrysalis/did/${request.network}/${request.did}/history?version=${request.version}`, - "get" + "get", ); } @@ -137,15 +132,11 @@ export class ChrysalisApiClient extends ApiClient { * @param payload body of request * @returns The response from the request. */ - public async diffHistory( - request: IIdentityDiffHistoryRequest, - payload: unknown - ): Promise { + public async diffHistory(request: IIdentityDiffHistoryRequest, payload: unknown): Promise { return this.callApi( `chrysalis/did/${request.network}/diffHistory/${request.integrationMsgId}?version=${request.version}`, "post", - payload + payload, ); } } - diff --git a/client/src/services/chrysalis/chrysalisApiStreamsV0Client.ts b/client/src/services/chrysalis/chrysalisApiStreamsV0Client.ts index 3d02e242e..247f9f287 100644 --- a/client/src/services/chrysalis/chrysalisApiStreamsV0Client.ts +++ b/client/src/services/chrysalis/chrysalisApiStreamsV0Client.ts @@ -36,14 +36,14 @@ export class ChrysalisApiStreamsV0Client { const hex = Converter.bytesToHex(indexationKey); const result = await this._apiClient.search({ network: this._network, - query: hex + query: hex, }); return { index: hex, maxResults: 1000, count: result.indexMessageIds ? result.indexMessageIds.length : 0, - messageIds: result.indexMessageIds ?? [] + messageIds: result.indexMessageIds ?? [], }; } @@ -55,7 +55,7 @@ export class ChrysalisApiStreamsV0Client { public async message(messageId: string): Promise { const result = await this._apiClient.search({ network: this._network, - query: messageId + query: messageId, }); if (result.message) { diff --git a/client/src/services/chrysalis/chrysalisFeedClient.ts b/client/src/services/chrysalis/chrysalisFeedClient.ts index 9afdea156..ec0873187 100644 --- a/client/src/services/chrysalis/chrysalisFeedClient.ts +++ b/client/src/services/chrysalis/chrysalisFeedClient.ts @@ -1,5 +1,11 @@ import { Blake2b } from "@iota/crypto.js"; -import { deserializeMessage, INDEXATION_PAYLOAD_TYPE, MILESTONE_PAYLOAD_TYPE, SIG_LOCKED_SINGLE_OUTPUT_TYPE, TRANSACTION_PAYLOAD_TYPE } from "@iota/iota.js"; +import { + deserializeMessage, + INDEXATION_PAYLOAD_TYPE, + MILESTONE_PAYLOAD_TYPE, + SIG_LOCKED_SINGLE_OUTPUT_TYPE, + TRANSACTION_PAYLOAD_TYPE, +} from "@iota/iota.js"; import { Converter, ReadStream } from "@iota/util.js"; import { TrytesHelper } from "~helpers/trytesHelper"; import { IFeedSubscribeResponse } from "~models/api/IFeedSubscribeResponse"; @@ -26,7 +32,7 @@ export class ChrysalisFeedClient extends FeedClient { try { if (!this._subscriptionId) { const subscribeRequest: INetworkBoundGetRequest = { - network: this._networkId + network: this._networkId, }; this._socket.emit("subscribe", subscribeRequest); @@ -39,51 +45,49 @@ export class ChrysalisFeedClient extends FeedClient { if (subscriptionMessage.subscriptionId === this._subscriptionId) { if (subscriptionMessage.itemsMetadata) { for (const metadataId in subscriptionMessage.itemsMetadata) { - const existing = this._items.find(c => c.id === metadataId); + const existing = this._items.find((c) => c.id === metadataId); if (existing) { existing.metaData = { ...existing.metaData, - ...subscriptionMessage.itemsMetadata[metadataId] + ...subscriptionMessage.itemsMetadata[metadataId], }; } } } const filteredNewItems = subscriptionMessage.items - .map(item => this.convertItem(item)) - .filter(nh => !this._existingIds.includes(nh.id)); + .map((item) => this.convertItem(item)) + .filter((nh) => !this._existingIds.includes(nh.id)); if (filteredNewItems.length > 0) { this._items = filteredNewItems.slice().concat(this._items); let removeItems: IFeedItem[] = []; - const transactionPayload = this._items.filter(t => t.payloadType === "Transaction"); - const transactionPayloadToRemoveCount = - transactionPayload.length - FeedClient.MIN_ITEMS_PER_TYPE; + const transactionPayload = this._items.filter((t) => t.payloadType === "Transaction"); + const transactionPayloadToRemoveCount = transactionPayload.length - FeedClient.MIN_ITEMS_PER_TYPE; if (transactionPayloadToRemoveCount > 0) { - removeItems = - removeItems.concat(transactionPayload.slice(-transactionPayloadToRemoveCount)); + removeItems = removeItems.concat(transactionPayload.slice(-transactionPayloadToRemoveCount)); } - const indexPayload = this._items.filter(t => t.payloadType === "Index"); + const indexPayload = this._items.filter((t) => t.payloadType === "Index"); const indexPayloadToRemoveCount = indexPayload.length - FeedClient.MIN_ITEMS_PER_TYPE; if (indexPayloadToRemoveCount > 0) { removeItems = removeItems.concat(indexPayload.slice(-indexPayloadToRemoveCount)); } - const msPayload = this._items.filter(t => t.payloadType === "MS"); + const msPayload = this._items.filter((t) => t.payloadType === "MS"); const msPayloadToRemoveCount = msPayload.length - FeedClient.MIN_ITEMS_PER_TYPE; if (msPayloadToRemoveCount > 0) { removeItems = removeItems.concat(msPayload.slice(-msPayloadToRemoveCount)); } - const nonePayload = this._items.filter(t => t.payloadType === "None"); + const nonePayload = this._items.filter((t) => t.payloadType === "None"); const nonePayloadToRemoveCount = nonePayload.length - FeedClient.MIN_ITEMS_PER_TYPE; if (nonePayloadToRemoveCount > 0) { removeItems = removeItems.concat(nonePayload.slice(-nonePayloadToRemoveCount)); } - this._items = this._items.filter(t => !removeItems.includes(t)); + this._items = this._items.filter((t) => !removeItems.includes(t)); - this._existingIds = this._items.map(t => t.id); + this._existingIds = this._items.map((t) => t.id); } for (const sub in this._subscribers) { @@ -92,7 +96,7 @@ export class ChrysalisFeedClient extends FeedClient { } }); } - } catch { } + } catch {} return subscriptionId; } @@ -108,10 +112,10 @@ export class ChrysalisFeedClient extends FeedClient { if (this._subscriptionId && Object.keys(this._subscribers).length === 0) { const unsubscribeRequest: IFeedUnsubscribeRequest = { network: this._networkId, - subscriptionId: this._subscriptionId + subscriptionId: this._subscriptionId, }; this._socket.emit("unsubscribe", unsubscribeRequest); - this._socket.on("unsubscribe", () => { }); + this._socket.on("unsubscribe", () => {}); } } catch { } finally { @@ -174,7 +178,7 @@ export class ChrysalisFeedClient extends FeedClient { value, parents: message?.parentMessageIds ?? [], properties, - payloadType + payloadType, }; } } diff --git a/client/src/services/chrysalis/chrysalisTangleCacheService.ts b/client/src/services/chrysalis/chrysalisTangleCacheService.ts index 7d2359ba4..42d92408c 100644 --- a/client/src/services/chrysalis/chrysalisTangleCacheService.ts +++ b/client/src/services/chrysalis/chrysalisTangleCacheService.ts @@ -60,20 +60,28 @@ export class ChrysalisTangleCacheService extends TangleCacheService { * @param key The key for the fetch if restricted mode. * @returns The balance for the address. */ - public async getStreamsV0Packet(network: string, root: string, mode: MamMode, key: string): Promise<{ - /** - * The payload at the given root. - */ - payload: string; - /** - * The next root. - */ - nextRoot: string; - /** - * The tag. - */ - tag: string; - } | undefined> { + public async getStreamsV0Packet( + network: string, + root: string, + mode: MamMode, + key: string, + ): Promise< + | { + /** + * The payload at the given root. + */ + payload: string; + /** + * The next root. + */ + nextRoot: string; + /** + * The tag. + */ + tag: string; + } + | undefined + > { const streamsV0Cache = this._streamsV0[network]; if (streamsV0Cache) { @@ -89,7 +97,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { payload: result.message, nextRoot: result.nextRoot, tag: result.tag, - cached: Date.now() + cached: Date.now(), }; } } catch (err) { @@ -116,19 +124,21 @@ export class ChrysalisTangleCacheService extends TangleCacheService { const response = await apiClient.search({ network: networkId, query, - cursor + cursor, }); - if (response.address || + if ( + response.address || response.message || response.indexMessageIds || response.milestone || response.output || response.did || - response.addressOutputIds) { + response.addressOutputIds + ) { this._chrysalisSearchCache[networkId][fullQuery] = { data: response, - cached: Date.now() + cached: Date.now(), }; } } @@ -144,11 +154,12 @@ export class ChrysalisTangleCacheService extends TangleCacheService { */ public async messageDetails( networkId: string, - messageId: string): Promise<{ - metadata?: IMessageMetadata; - childrenIds?: string[]; - error?: string; - }> { + messageId: string, + ): Promise<{ + metadata?: IMessageMetadata; + childrenIds?: string[]; + error?: string; + }> { const apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); const response = await apiClient.messageDetails({ network: networkId, messageId }); @@ -157,7 +168,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { return { metadata: response.metadata, childrenIds: response.childrenMessageIds, - error: response.error + error: response.error, }; } @@ -170,9 +181,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { * @param outputId The output to get the details for. * @returns The details response. */ - public async outputDetails( - networkId: string, - outputId: string): Promise { + public async outputDetails(networkId: string, outputId: string): Promise { if (!this._chrysalisSearchCache[networkId][outputId]?.data?.output) { const apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); @@ -181,7 +190,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { if (response?.output) { this._chrysalisSearchCache[networkId][outputId] = { data: { output: response.output }, - cached: Date.now() + cached: Date.now(), }; } } @@ -195,9 +204,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { * @param milestoneIndex The output to get the details for. * @returns The details response. */ - public async milestoneDetails( - networkId: string, - milestoneIndex: number): Promise { + public async milestoneDetails(networkId: string, milestoneIndex: number): Promise { if (!this._chrysalisSearchCache[networkId][milestoneIndex]?.data?.milestone) { const apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); @@ -206,7 +213,7 @@ export class ChrysalisTangleCacheService extends TangleCacheService { if (response?.milestone) { this._chrysalisSearchCache[networkId][milestoneIndex] = { data: { milestone: response.milestone }, - cached: Date.now() + cached: Date.now(), }; } } @@ -222,36 +229,33 @@ export class ChrysalisTangleCacheService extends TangleCacheService { */ public async transactionsHistory( request: ITransactionHistoryRequest, - skipCache: boolean = false + skipCache: boolean = false, ): Promise { - if (!this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`] - ?.data?.transactionHistory || skipCache) { + if ( + !this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`]?.data?.transactionHistory || + skipCache + ) { const apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); const response = await apiClient.transactionHistory(request); if (response?.history) { const cachedHistory = - this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`] - ?.data?.transactionHistory?.history ?? []; + this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`]?.data?.transactionHistory + ?.history ?? []; this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`] = { data: { transactionHistory: { ...response, - history: [ - ...cachedHistory, - ...response.history - ] - } + history: [...cachedHistory, ...response.history], + }, }, - cached: Date.now() + cached: Date.now(), }; } } - return this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`] - ?.data - ?.transactionHistory; + return this._chrysalisSearchCache[request.network][`${request.address}--transaction-history`]?.data?.transactionHistory; } /** @@ -272,4 +276,3 @@ export class ChrysalisTangleCacheService extends TangleCacheService { } } } - diff --git a/client/src/services/currencyService.ts b/client/src/services/currencyService.ts index f2f3049d5..a84aaf30c 100644 --- a/client/src/services/currencyService.ts +++ b/client/src/services/currencyService.ts @@ -19,7 +19,7 @@ export class CurrencyService { GBP: "£", CAD: "$", SEK: "kr", - CHF: "CHF" + CHF: "CHF", }; /** @@ -32,7 +32,7 @@ export class CurrencyService { GBP: "British Pound Sterling", CAD: "Canadian Dollar", SEK: "Swedish Krona", - CHF: "Swiss Franc" + CHF: "Swiss Franc", }; /** @@ -69,36 +69,25 @@ export class CurrencyService { * Load the currencies data. * @param callback Called when currencies are loaded. */ - public loadCurrencies( - callback: ( - available: boolean, - data?: ICurrencySettings, - err?: unknown - ) => void - ): void { + public loadCurrencies(callback: (available: boolean, data?: ICurrencySettings, err?: unknown) => void): void { const settings = this._settingsService.get(); let hasData = false; // If we already have some data use that to begin with - if (settings.coinStats && - settings.fiatExchangeRatesEur && - Object.keys(settings.fiatExchangeRatesEur).length > 0) { - callback( - true, - { - fiatCode: settings.fiatCode, - fiatExchangeRatesEur: settings.fiatExchangeRatesEur, - coinStats: settings.coinStats - } - ); + if (settings.coinStats && settings.fiatExchangeRatesEur && Object.keys(settings.fiatExchangeRatesEur).length > 0) { + callback(true, { + fiatCode: settings.fiatCode, + fiatExchangeRatesEur: settings.fiatExchangeRatesEur, + coinStats: settings.coinStats, + }); hasData = true; } // If the data is missing then load it inline which can return errors // if the data is out of date try and get some new info in the background // if it fails we don't care about the outcome as we already have data - const lastUpdate = settings ? (settings.lastCurrencyUpdate ?? 0) : 0; - if (!hasData || Date.now() - lastUpdate > (5 * CurrencyService.MS_PER_MINUTE)) { + const lastUpdate = settings ? settings.lastCurrencyUpdate ?? 0 : 0; + if (!hasData || Date.now() - lastUpdate > 5 * CurrencyService.MS_PER_MINUTE) { setTimeout(async () => this.loadData(callback), 0); } } @@ -131,15 +120,11 @@ export class CurrencyService { * @param numDigits The number of digits to display. * @returns The converted fiat. */ - public convertIota( - valueIota: number, - currencyData: ICurrencySettings, - includeSymbol: boolean, - numDigits: number): string { + public convertIota(valueIota: number, currencyData: ICurrencySettings, includeSymbol: boolean, numDigits: number): string { let converted = ""; if (currencyData.fiatExchangeRatesEur && currencyData.fiatCode && currencyData.coinStats?.iota?.price) { const iotaStats = currencyData.coinStats.iota; - const selectedFiatToBase = currencyData.fiatExchangeRatesEur.find(c => c.id === currencyData.fiatCode); + const selectedFiatToBase = currencyData.fiatExchangeRatesEur.find((c) => c.id === currencyData.fiatCode); if (selectedFiatToBase) { const miota = valueIota / 1000000; @@ -149,7 +134,9 @@ export class CurrencyService { converted += `${this.getSymbol(currencyData.fiatCode)} `; } - converted += fiat.toFixed(numDigits).toString() + converted += fiat + .toFixed(numDigits) + .toString() .replaceAll(/\B(?=(\d{3})+(?!\d))/g, ","); } } @@ -170,7 +157,8 @@ export class CurrencyService { tokenInfo: INodeInfoBaseToken, currencyData: ICurrencySettings, includeSymbol: boolean, - numDigits: number): string { + numDigits: number, + ): string { let converted = ""; const coinName = tokenInfo.name.toLocaleLowerCase(); @@ -178,7 +166,7 @@ export class CurrencyService { if (fiatExchangeRatesEur && fiatCode && coinStats?.[coinName]?.price) { const tokenStats = coinStats[coinName]; - const selectedFiatToBase = fiatExchangeRatesEur.find(c => c.id === fiatCode); + const selectedFiatToBase = fiatExchangeRatesEur.find((c) => c.id === fiatCode); if (selectedFiatToBase) { const baseTokenValue = tokenInfo.subunit ? value / Math.pow(10, tokenInfo.decimals) : value; @@ -188,7 +176,9 @@ export class CurrencyService { converted += `${this.getSymbol(fiatCode)} `; } - converted += fiat.toFixed(numDigits).toString() + converted += fiat + .toFixed(numDigits) + .toString() .replaceAll(/\B(?=(\d{3})+(?!\d))/g, ","); } } @@ -211,11 +201,11 @@ export class CurrencyService { includeSymbol: boolean, numDigits: number, extendToFindMax?: number, - includeSuffix?: boolean + includeSuffix?: boolean, ): string { let converted = ""; if (currencyData.fiatExchangeRatesEur && currencyData.fiatCode) { - const selectedFiatToBase = currencyData.fiatExchangeRatesEur.find(c => c.id === currencyData.fiatCode); + const selectedFiatToBase = currencyData.fiatExchangeRatesEur.find((c) => c.id === currencyData.fiatCode); if (selectedFiatToBase) { const fiat = valueInBase * selectedFiatToBase.rate; @@ -227,9 +217,7 @@ export class CurrencyService { if (extendToFindMax === undefined) { converted += includeSuffix ? this.abbreviate(fiat, numDigits) - : fiat - .toFixed(numDigits) - .replaceAll(/\B(?=(\d{3})+(?!\d))/g, ","); + : fiat.toFixed(numDigits).replaceAll(/\B(?=(\d{3})+(?!\d))/g, ","); } else { const regEx = new RegExp(`^-?\\d*\\.?0*\\d{0,${numDigits}}`); const found = regEx.exec(fiat.toFixed(extendToFindMax)); @@ -303,10 +291,12 @@ export class CurrencyService { { value: 1e9, symbol: "B" }, { value: 1e12, symbol: "T" }, { value: 1e15, symbol: "P" }, - { value: 1e18, symbol: "E" } + { value: 1e18, symbol: "E" }, ]; - const item = units.slice().reverse() - .find(unit => value >= unit.value); + const item = units + .slice() + .reverse() + .find((unit) => value >= unit.value); return item ? (value / item.value).toFixed(digits) + item.symbol : "0"; } @@ -316,45 +306,32 @@ export class CurrencyService { * @param callback Called when currencies are loaded. * @returns True if the load was succesful. */ - private async loadData( - callback: ( - available: boolean, - data?: ICurrencySettings, - err?: unknown - ) => void - ): Promise { + private async loadData(callback: (available: boolean, data?: ICurrencySettings, err?: unknown) => void): Promise { try { const currencyResponse = await this._apiClient.currencies(); if (currencyResponse.error) { callback(false); } else if (!currencyResponse.coinStats || !currencyResponse.fiatExchangeRatesEur) { - callback(false); - } else { - const settings = this._settingsService.get(); - - settings.lastCurrencyUpdate = Date.now(); - const cur = currencyResponse.fiatExchangeRatesEur || {}; - const ids = Object.keys(cur).sort(); - settings.fiatExchangeRatesEur = ids.map(i => ({ id: i, rate: cur[i] })); - settings.coinStats = currencyResponse.coinStats; - - this._settingsService.save(); - - callback( - true, - { - fiatCode: settings.fiatCode, - fiatExchangeRatesEur: settings.fiatExchangeRatesEur, - coinStats: settings.coinStats - }); - } + callback(false); + } else { + const settings = this._settingsService.get(); + + settings.lastCurrencyUpdate = Date.now(); + const cur = currencyResponse.fiatExchangeRatesEur || {}; + const ids = Object.keys(cur).sort(); + settings.fiatExchangeRatesEur = ids.map((i) => ({ id: i, rate: cur[i] })); + settings.coinStats = currencyResponse.coinStats; + + this._settingsService.save(); + + callback(true, { + fiatCode: settings.fiatCode, + fiatExchangeRatesEur: settings.fiatExchangeRatesEur, + coinStats: settings.coinStats, + }); + } } catch (err) { - callback( - false, - undefined, - err - ); + callback(false, undefined, err); } } } - diff --git a/client/src/services/feedClient.ts b/client/src/services/feedClient.ts index 0ad0684b8..05e16a38d 100644 --- a/client/src/services/feedClient.ts +++ b/client/src/services/feedClient.ts @@ -79,4 +79,3 @@ export class FeedClient { this._subscribers = {}; } } - diff --git a/client/src/services/identityDiffStorageService.ts b/client/src/services/identityDiffStorageService.ts index d23a9e709..f8698238c 100644 --- a/client/src/services/identityDiffStorageService.ts +++ b/client/src/services/identityDiffStorageService.ts @@ -41,4 +41,3 @@ export class IdentityDiffStorageService { this.diffMap.clear(); } } - diff --git a/client/src/services/identityService.ts b/client/src/services/identityService.ts index a584ccffc..887eea416 100644 --- a/client/src/services/identityService.ts +++ b/client/src/services/identityService.ts @@ -46,7 +46,7 @@ export class IdentityService { integrationMsgId: string, network: string, version: string, - payload: unknown + payload: unknown, ): Promise { const apiClient = ServiceFactory.get(`api-client-${CHRYSALIS}`); const response = await apiClient.diffHistory({ network, integrationMsgId, version }, payload); diff --git a/client/src/services/legacy/legacyApiClient.ts b/client/src/services/legacy/legacyApiClient.ts index f1a913e41..e156e461b 100644 --- a/client/src/services/legacy/legacyApiClient.ts +++ b/client/src/services/legacy/legacyApiClient.ts @@ -40,7 +40,9 @@ export class LegacyApiClient extends ApiClient { */ public async stats(request: IStatsGetRequest): Promise { return this.callApi( - `stats/${request.network}?includeHistory=${request.includeHistory ? "true" : "false"}`, "get"); + `stats/${request.network}?includeHistory=${request.includeHistory ? "true" : "false"}`, + "get", + ); } /** @@ -49,8 +51,7 @@ export class LegacyApiClient extends ApiClient { * @returns The response from the request. */ public async milestoneGet(request: IMilestoneGetRequest): Promise { - return this.callApi( - `milestones/${request.network}/${request.milestoneIndex}`, "get"); + return this.callApi(`milestones/${request.network}/${request.milestoneIndex}`, "get"); } /** @@ -61,10 +62,7 @@ export class LegacyApiClient extends ApiClient { public async transactionsGet(request: ITransactionsGetRequest): Promise { const { network, hash, ...rest } = request; - return this.callApi( - `transactions/${network}/${hash}/${FetchHelper.urlParams(rest)}`, - "get" - ); + return this.callApi(`transactions/${network}/${hash}/${FetchHelper.urlParams(rest)}`, "get"); } /** diff --git a/client/src/services/legacy/legacyApiStreamsV0Client.ts b/client/src/services/legacy/legacyApiStreamsV0Client.ts index 75f478f10..d3c01e287 100644 --- a/client/src/services/legacy/legacyApiStreamsV0Client.ts +++ b/client/src/services/legacy/legacyApiStreamsV0Client.ts @@ -35,7 +35,8 @@ export class LegacyApiStreamsV0Client { public async prepareTransfers( seed: string | Int8Array, transfers: readonly Transfer[], - options?: Partial): Promise { + options?: Partial, + ): Promise { throw new Error("This method is not supported by the API"); } @@ -51,7 +52,8 @@ export class LegacyApiStreamsV0Client { trytes: readonly string[], depth: number, minWeightMagnitude: number, - reference?: string | undefined): Promise { + reference?: string | undefined, + ): Promise { throw new Error("This method is not supported by the API"); } @@ -86,13 +88,11 @@ export class LegacyApiStreamsV0Client { throw new Error("This method is not supported by the API"); } - const response = await this._apiClient.transactionsGet( - { - mode: "address", - network: this._network, - hash: request.address - } - ); + const response = await this._apiClient.transactionsGet({ + mode: "address", + network: this._network, + hash: request.address, + }); let txs: Transaction[] = []; if (response?.txHashes && response?.txHashes.length > 0) { @@ -100,12 +100,11 @@ export class LegacyApiStreamsV0Client { const trytesResponse = await this._apiClient.trytesRetrieve({ network: this._network, - txHashes + txHashes, }); if (trytesResponse?.trytes) { - txs = trytesResponse.trytes.map( - (t, idx) => asTransactionObject(t, txHashes[idx])); + txs = trytesResponse.trytes.map((t, idx) => asTransactionObject(t, txHashes[idx])); } } diff --git a/client/src/services/legacy/legacyFeedClient.ts b/client/src/services/legacy/legacyFeedClient.ts index 025605976..258c05d35 100644 --- a/client/src/services/legacy/legacyFeedClient.ts +++ b/client/src/services/legacy/legacyFeedClient.ts @@ -24,7 +24,7 @@ export class LegacyFeedClient extends FeedClient { try { if (!this._subscriptionId) { const subscribeRequest: INetworkBoundGetRequest = { - network: this._networkId + network: this._networkId, }; this._socket.emit("subscribe", subscribeRequest); @@ -37,40 +37,41 @@ export class LegacyFeedClient extends FeedClient { if (subscriptionMessage.subscriptionId === this._subscriptionId) { if (subscriptionMessage.itemsMetadata) { for (const metadataId in subscriptionMessage.itemsMetadata) { - const existing = this._items.find(c => c.id === metadataId); + const existing = this._items.find((c) => c.id === metadataId); if (existing) { existing.metaData = { ...existing.metaData, - ...subscriptionMessage.itemsMetadata[metadataId] + ...subscriptionMessage.itemsMetadata[metadataId], }; } } } const filteredNewItems = subscriptionMessage.items - .map(item => this.convertItem(item)) - .filter(nh => !this._existingIds.includes(nh.id)); + .map((item) => this.convertItem(item)) + .filter((nh) => !this._existingIds.includes(nh.id)); if (filteredNewItems.length > 0) { this._items = filteredNewItems.slice().concat(this._items); let removeItems: IFeedItem[] = []; - const zero = this._items.filter(t => t.payloadType === "Transaction" && t.value === 0); + const zero = this._items.filter((t) => t.payloadType === "Transaction" && t.value === 0); const zeroToRemoveCount = zero.length - FeedClient.MIN_ITEMS_PER_TYPE; if (zeroToRemoveCount > 0) { removeItems = removeItems.concat(zero.slice(-zeroToRemoveCount)); } - const nonZero = this._items.filter(t => t.payloadType === "Transaction" && - t.value !== 0 && t.value !== undefined); + const nonZero = this._items.filter( + (t) => t.payloadType === "Transaction" && t.value !== 0 && t.value !== undefined, + ); const nonZeroToRemoveCount = nonZero.length - FeedClient.MIN_ITEMS_PER_TYPE; if (nonZeroToRemoveCount > 0) { removeItems = removeItems.concat(nonZero.slice(-nonZeroToRemoveCount)); } - this._items = this._items.filter(t => !removeItems.includes(t)); + this._items = this._items.filter((t) => !removeItems.includes(t)); - this._existingIds = this._items.map(t => t.id); + this._existingIds = this._items.map((t) => t.id); } for (const sub in this._subscribers) { @@ -79,7 +80,7 @@ export class LegacyFeedClient extends FeedClient { } }); } - } catch { } + } catch {} return subscriptionId; } @@ -95,10 +96,10 @@ export class LegacyFeedClient extends FeedClient { if (this._subscriptionId && Object.keys(this._subscribers).length === 0) { const unsubscribeRequest: IFeedUnsubscribeRequest = { network: this._networkId, - subscriptionId: this._subscriptionId + subscriptionId: this._subscriptionId, }; this._socket.emit("unsubscribe", unsubscribeRequest); - this._socket.on("unsubscribe", () => { }); + this._socket.on("unsubscribe", () => {}); } } catch { } finally { @@ -125,17 +126,13 @@ export class LegacyFeedClient extends FeedClient { return { id: tx.hash, value: tx.value, - parents: [ - tx.trunkTransaction, - tx.branchTransaction - ], + parents: [tx.trunkTransaction, tx.branchTransaction], properties: { - "Tag": tx.tag, - "Address": tx.address, - "Bundle": tx.bundle + Tag: tx.tag, + Address: tx.address, + Bundle: tx.bundle, }, - payloadType: "Transaction" + payloadType: "Transaction", }; } } - diff --git a/client/src/services/legacy/legacyTangleCacheService.ts b/client/src/services/legacy/legacyTangleCacheService.ts index cc14e65e6..ec0901cd9 100644 --- a/client/src/services/legacy/legacyTangleCacheService.ts +++ b/client/src/services/legacy/legacyTangleCacheService.ts @@ -31,7 +31,7 @@ export class LegacyTangleCacheService extends TangleCacheService { hashType: TransactionsGetMode | undefined, hash: string, limit?: number, - nextCursor?: ITransactionsCursor + nextCursor?: ITransactionsCursor, ): Promise<{ /** * The lookup hashes. @@ -85,11 +85,11 @@ export class LegacyTangleCacheService extends TangleCacheService { hash, mode: hashType, limit, - cursor: nextCursor + cursor: nextCursor, }); if (!response.error) { - if ((response.txHashes && response.txHashes.length > 0)) { + if (response.txHashes && response.txHashes.length > 0) { txHashes = response.txHashes ?? []; hashType ??= response.mode; cursor = response.cursor ?? {}; @@ -100,7 +100,7 @@ export class LegacyTangleCacheService extends TangleCacheService { cacheHashType[hash] = { txHashes, cached: Date.now(), - cursor + cursor, }; } } @@ -114,7 +114,7 @@ export class LegacyTangleCacheService extends TangleCacheService { return { txHashes: txHashes ?? [], cursor, - hashType + hashType, }; } @@ -125,23 +125,22 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param skipCache Skip looking in the cache. * @returns The trytes for the hashes. */ - public async getTransactions( - networkId: string, - txHashes: string[], - skipCache: boolean = false - ): - Promise { + public async getTransactions(networkId: string, txHashes: string[], skipCache: boolean = false): Promise { let cachedTransactions: ICachedTransaction[] | undefined; const tranCache = this._transactionCache[networkId]; if (tranCache) { const now = Date.now(); - const unknownHashes = skipCache ? txHashes : txHashes.filter(h => - !tranCache[h] || - tranCache[h].tx === undefined || - tranCache[h].confirmationState === "unknown" || - now - tranCache[h].cached > 60000); + const unknownHashes = skipCache + ? txHashes + : txHashes.filter( + (h) => + !tranCache[h] || + tranCache[h].tx === undefined || + tranCache[h].confirmationState === "unknown" || + now - tranCache[h].cached > 60000, + ); if (unknownHashes.length > 0) { try { @@ -149,12 +148,10 @@ export class LegacyTangleCacheService extends TangleCacheService { const response = await apiClient.trytesRetrieve({ network: networkId, - txHashes: unknownHashes + txHashes: unknownHashes, }); - if (!response.error && - response.trytes && - response.milestoneIndexes) { + if (!response.error && response.trytes && response.milestoneIndexes) { for (let i = 0; i < response.trytes.length; i++) { const unknownHash = unknownHashes[i]; tranCache[unknownHash] = tranCache[unknownHash] || {}; @@ -180,7 +177,7 @@ export class LegacyTangleCacheService extends TangleCacheService { tranCache[unknownHash].tx = { ...tx, timestamp, - attachmentTimestamp + attachmentTimestamp, }; tranCache[unknownHash].isEmpty = TrytesHelper.isEmpty(response.trytes[i]); @@ -194,8 +191,7 @@ export class LegacyTangleCacheService extends TangleCacheService { tranCache[unknownHash].milestoneIndex = response.milestoneIndexes[i]; } } - } catch { - } + } catch {} } for (const txHash of txHashes) { @@ -204,23 +200,25 @@ export class LegacyTangleCacheService extends TangleCacheService { } } - cachedTransactions = txHashes.map(h => - tranCache[h] || { - tx: asTransactionObject("9".repeat(2673)), - confirmationState: "unknown", - cached: 0, - manual: false, - isEmpty: true - }); + cachedTransactions = txHashes.map( + (h) => + tranCache[h] || { + tx: asTransactionObject("9".repeat(2673)), + confirmationState: "unknown", + cached: 0, + manual: false, + isEmpty: true, + }, + ); } if (!cachedTransactions) { - cachedTransactions = txHashes.map(h => ({ + cachedTransactions = txHashes.map((h) => ({ tx: asTransactionObject("9".repeat(2673)), confirmationState: "unknown", milestoneIndex: 0, cached: 0, - isEmpty: true + isEmpty: true, })); } @@ -233,11 +231,7 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param txHash The hashes of the transactions to get. * @returns The trytes for the children. */ - public async getTransactionChildren( - networkId: string, - txHash: string - ): - Promise { + public async getTransactionChildren(networkId: string, txHash: string): Promise { if (!this._transactionCache[networkId]?.[txHash]?.children) { try { const apiClient = ServiceFactory.get(`api-client-${LEGACY}`); @@ -245,7 +239,7 @@ export class LegacyTangleCacheService extends TangleCacheService { const response = await apiClient.transactionsGet({ network: networkId, hash: txHash, - mode: "approvee" + mode: "approvee", }); if (!response.error) { @@ -253,8 +247,7 @@ export class LegacyTangleCacheService extends TangleCacheService { this._transactionCache[networkId][txHash] = this._transactionCache[networkId][txHash] || {}; this._transactionCache[networkId][txHash].children = [...new Set(response.txHashes)]; } - } catch { - } + } catch {} } return this._transactionCache[networkId]?.[txHash]?.children ?? []; @@ -266,12 +259,8 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param txHashes The transaction hashes in the bundle. * @returns The grouped transactions in the bundle. */ - public async getBundleGroups( - networkId: string, - txHashes: string[] - ): Promise { - const cachedTransactions = - await this.getTransactions(networkId, txHashes); + public async getBundleGroups(networkId: string, txHashes: string[]): Promise { + const cachedTransactions = await this.getTransactions(networkId, txHashes); const byHash: { [id: string]: ICachedTransaction } = {}; const bundleGroups: ICachedTransaction[][] = []; @@ -317,27 +306,24 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param addressHash The addresss hash to get the balance. * @returns The balance for the address. */ - public async getAddressBalance( - networkId: string, - addressHash: string): Promise { + public async getAddressBalance(networkId: string, addressHash: string): Promise { const addrBalance = this._addressBalances[networkId]; if (addrBalance) { const now = Date.now(); - if (!addrBalance[addressHash] || - now - addrBalance[addressHash].balance > 30000) { + if (!addrBalance[addressHash] || now - addrBalance[addressHash].balance > 30000) { try { const apiClient = ServiceFactory.get(`api-client-${LEGACY}`); const response = await apiClient.addressGet({ network: networkId, - address: addressHash + address: addressHash, }); addrBalance[addressHash] = { balance: response.balance ?? 0, - cached: now + cached: now, }; } catch (err) { console.error(err); @@ -356,9 +342,7 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param transaction The transaction to use as the starting point. * @returns The transactions bundle group. */ - public async getTransactionBundleGroup( - networkId: string, - transaction: ICachedTransaction): Promise { + public async getTransactionBundleGroup(networkId: string, transaction: ICachedTransaction): Promise { let thisGroup: ICachedTransaction[] = []; if (transaction.tx.lastIndex === 0) { thisGroup = [transaction]; @@ -369,8 +353,7 @@ export class LegacyTangleCacheService extends TangleCacheService { let trunk = transaction.tx.trunkTransaction; thisGroup = [transaction]; for (let i = 1; i <= transaction.tx.lastIndex; i++) { - const cachedTransactions = - await this.getTransactions(networkId, [trunk]); + const cachedTransactions = await this.getTransactions(networkId, [trunk]); if (cachedTransactions.length > 0) { const txo = cachedTransactions[0]; if (txo) { @@ -386,7 +369,7 @@ export class LegacyTangleCacheService extends TangleCacheService { if (txHashes.length > 0) { const bundleGroups = await this.getBundleGroups(networkId, txHashes); - const bg = bundleGroups.find(group => group.findIndex(t => t.tx.hash === transaction.tx.hash) >= 0); + const bg = bundleGroups.find((group) => group.findIndex((t) => t.tx.hash === transaction.tx.hash) >= 0); if (bg) { thisGroup = [...bg]; } @@ -403,28 +386,34 @@ export class LegacyTangleCacheService extends TangleCacheService { * @param key The key for the fetch if restricted mode. * @returns The balance for the address. */ - public async getStreamsV0Packet(network: string, root: string, mode: MamMode, key: string): Promise<{ - /** - * The payload at the given root. - */ - payload: string; - /** - * The next root. - */ - nextRoot: string; - /** - * The tag. - */ - tag: string; - } | undefined> { + public async getStreamsV0Packet( + network: string, + root: string, + mode: MamMode, + key: string, + ): Promise< + | { + /** + * The payload at the given root. + */ + payload: string; + /** + * The next root. + */ + nextRoot: string; + /** + * The tag. + */ + tag: string; + } + | undefined + > { const streamsV0Cache = this._streamsV0[network]; if (streamsV0Cache) { if (!streamsV0Cache[root]) { try { - const api = new LegacyApiStreamsV0Client( - ServiceFactory.get(`api-client-${LEGACY}`), network - ); + const api = new LegacyApiStreamsV0Client(ServiceFactory.get(`api-client-${LEGACY}`), network); // eslint-disable-next-line @typescript-eslint/no-explicit-any const result = await mamFetch(api as any, root, mode, key); @@ -434,7 +423,7 @@ export class LegacyTangleCacheService extends TangleCacheService { payload: result.message, nextRoot: result.nextRoot, tag: result.tag, - cached: Date.now() + cached: Date.now(), }; } } catch (err) { @@ -453,4 +442,3 @@ export class LegacyTangleCacheService extends TangleCacheService { super.staleCheck(); } } - diff --git a/client/src/services/networkService.ts b/client/src/services/networkService.ts index 4e3048c83..88fbddde8 100644 --- a/client/src/services/networkService.ts +++ b/client/src/services/networkService.ts @@ -51,4 +51,3 @@ export class NetworkService { return this._cache ? Object.values(this._cache) : []; } } - diff --git a/client/src/services/nodeInfoService.ts b/client/src/services/nodeInfoService.ts index 47d284237..07c33770a 100644 --- a/client/src/services/nodeInfoService.ts +++ b/client/src/services/nodeInfoService.ts @@ -50,7 +50,7 @@ export class NodeInfoService { */ public async buildCache(): Promise { const networksService = ServiceFactory.get("network"); - const stardustNetworks = networksService.networks().filter(n => n.protocolVersion === STARDUST); + const stardustNetworks = networksService.networks().filter((n) => n.protocolVersion === STARDUST); for (const networkDetails of stardustNetworks) { const apiClient = ServiceFactory.get(`api-client-${STARDUST}`); @@ -64,4 +64,3 @@ export class NodeInfoService { } } } - diff --git a/client/src/services/settingsService.ts b/client/src/services/settingsService.ts index 6226f69f9..af96d4217 100644 --- a/client/src/services/settingsService.ts +++ b/client/src/services/settingsService.ts @@ -30,7 +30,7 @@ export class SettingsService { this._settings = this._localStorageService.load("settings"); if (!this._settings) { this._settings = { - fiatCode: "USD" + fiatCode: "USD", }; } } diff --git a/client/src/services/stardust/ipfsClient.ts b/client/src/services/stardust/ipfsClient.ts index 509172e77..835e7e8a5 100644 --- a/client/src/services/stardust/ipfsClient.ts +++ b/client/src/services/stardust/ipfsClient.ts @@ -50,12 +50,8 @@ export class IpfsClient { public static async ls(path: string): Promise { let ipfsEntry; try { - const response = await FetchHelper.raw( - IPFS_ENDPOINT, - `${IPFS_PATH}?arg=${path}`, - "get" - ); - const lsResponse = await response.json() as ILSResponse; + const response = await FetchHelper.raw(IPFS_ENDPOINT, `${IPFS_PATH}?arg=${path}`, "get"); + const lsResponse = (await response.json()) as ILSResponse; const result = lsResponse.Objects[0]; if (result) { @@ -64,7 +60,7 @@ export class IpfsClient { ipfsEntry = IpfsClient.mapLinkToIpfsEntry(links[0], path); } } - } catch { } + } catch {} return ipfsEntry; } @@ -77,7 +73,7 @@ export class IpfsClient { path: path + (link.Name ? `/${link.Name}` : ""), size: link.Size, cid: hash, - type: IpfsClient.typeOf(link) + type: IpfsClient.typeOf(link), }; if (link.Mode) { @@ -86,7 +82,7 @@ export class IpfsClient { if (link.Mtime !== undefined && link.Mtime !== null) { entry.mtime = { - secs: link.Mtime + secs: link.Mtime, }; if (link.MtimeNsecs !== undefined && link.MtimeNsecs !== null) { diff --git a/client/src/services/stardust/stardustApiClient.ts b/client/src/services/stardust/stardustApiClient.ts index 14741c0c1..19e586421 100644 --- a/client/src/services/stardust/stardustApiClient.ts +++ b/client/src/services/stardust/stardustApiClient.ts @@ -61,10 +61,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async nodeInfo(request: INetworkBoundGetRequest): Promise { - return this.callApi( - `node-info/${request.network}`, - "get" - ); + return this.callApi(`node-info/${request.network}`, "get"); } /** @@ -73,10 +70,7 @@ export class StardustApiClient extends ApiClient { * @returns The Address balance reponse */ public async addressBalance(request: IAddressBalanceRequest): Promise { - return this.callApi( - `stardust/balance/${request.network}/${request.address}`, - "get" - ); + return this.callApi(`stardust/balance/${request.network}/${request.address}`, "get"); } /** @@ -85,10 +79,7 @@ export class StardustApiClient extends ApiClient { * @returns The Address balance reponse */ public async addressBalanceChronicle(request: IAddressBalanceRequest): Promise { - return this.callApi( - `stardust/balance/chronicle/${request.network}/${request.address}`, - "get" - ); + return this.callApi(`stardust/balance/chronicle/${request.network}/${request.address}`, "get"); } /** @@ -99,7 +90,7 @@ export class StardustApiClient extends ApiClient { public async basicOutputsDetails(request: IAddressDetailsRequest): Promise { return this.callApi( `stardust/address/outputs/basic/${request.network}/${request.address}`, - "get" + "get", ); } @@ -111,7 +102,7 @@ export class StardustApiClient extends ApiClient { public async aliasOutputsDetails(request: IAddressDetailsRequest): Promise { return this.callApi( `stardust/address/outputs/alias/${request.network}/${request.address}`, - "get" + "get", ); } @@ -121,10 +112,7 @@ export class StardustApiClient extends ApiClient { * @returns The Address outputs response */ public async nftOutputsDetails(request: IAddressDetailsRequest): Promise { - return this.callApi( - `stardust/address/outputs/nft/${request.network}/${request.address}`, - "get" - ); + return this.callApi(`stardust/address/outputs/nft/${request.network}/${request.address}`, "get"); } /** @@ -133,10 +121,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async search(request: ISearchRequest): Promise { - return this.callApi( - `stardust/search/${request.network}/${request.query}`, - "get" - ); + return this.callApi(`stardust/search/${request.network}/${request.query}`, "get"); } /** @@ -145,9 +130,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async block(request: IBlockRequest): Promise { - return this.callApi( - `stardust/block/${request.network}/${request.blockId}`, "get" - ); + return this.callApi(`stardust/block/${request.network}/${request.blockId}`, "get"); } /** @@ -156,9 +139,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async blockDetails(request: IBlockDetailsRequest): Promise { - return this.callApi( - `stardust/block/metadata/${request.network}/${request.blockId}`, "get" - ); + return this.callApi(`stardust/block/metadata/${request.network}/${request.blockId}`, "get"); } /** @@ -167,9 +148,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async blockChildren(request: IBlockChildrenRequest): Promise { - return this.callApi( - `stardust/block/children/${request.network}/${request.blockId}`, "get" - ); + return this.callApi(`stardust/block/children/${request.network}/${request.blockId}`, "get"); } /** @@ -177,11 +156,10 @@ export class StardustApiClient extends ApiClient { * @param request The request to send. * @returns The response from the request. */ - public async transactionIncludedBlockDetails( - request: ITransactionDetailsRequest - ): Promise { + public async transactionIncludedBlockDetails(request: ITransactionDetailsRequest): Promise { return this.callApi( - `stardust/transaction/${request.network}/${request.transactionId}`, "get" + `stardust/transaction/${request.network}/${request.transactionId}`, + "get", ); } @@ -191,9 +169,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async outputDetails(request: IOutputDetailsRequest): Promise { - return this.callApi( - `stardust/output/${request.network}/${request.outputId}`, "get" - ); + return this.callApi(`stardust/output/${request.network}/${request.outputId}`, "get"); } /** @@ -206,7 +182,7 @@ export class StardustApiClient extends ApiClient { return this.callApi( `stardust/output/tagged/${request.network}/${request.tag}/${request.outputType}${params}`, - "get" + "get", ); } @@ -219,7 +195,7 @@ export class StardustApiClient extends ApiClient { return this.callApi( `stardust/output/associated/${request.network}/${request.addressDetails.bech32}`, "post", - { addressDetails: request.addressDetails } + { addressDetails: request.addressDetails }, ); } @@ -229,10 +205,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async milestoneDetails(request: IMilestoneDetailsRequest): Promise { - return this.callApi( - `stardust/milestone/${request.network}/${request.milestoneIndex}`, - "get" - ); + return this.callApi(`stardust/milestone/${request.network}/${request.milestoneIndex}`, "get"); } /** @@ -243,7 +216,7 @@ export class StardustApiClient extends ApiClient { public async milestoneStats(request: IMilestoneStatsRequest): Promise { return this.callApi( `stardust/milestone/stats/${request.network}/${request.milestoneIndex}`, - "get" + "get", ); } @@ -253,10 +226,7 @@ export class StardustApiClient extends ApiClient { * @returns The latest milestones response. */ public async latestMilestones(network: string): Promise { - return this.callApi( - `stardust/milestone/latest/${network}`, - "get" - ); + return this.callApi(`stardust/milestone/latest/${network}`, "get"); } /** @@ -266,12 +236,10 @@ export class StardustApiClient extends ApiClient { * @param request.milestoneId The milestone in context. * @returns The milestone referenced blocks. */ - public async milestoneReferencedBlocks( - request: { network: string; milestoneId: string } - ): Promise { + public async milestoneReferencedBlocks(request: { network: string; milestoneId: string }): Promise { return this.callApi( `stardust/milestone/blocks/${request.network}/${request.milestoneId}`, - "get" + "get", ); } @@ -285,12 +253,12 @@ export class StardustApiClient extends ApiClient { pageSize: request.pageSize, sort: request.sort, startMilestoneIndex: request.startMilestoneIndex, - cursor: request.cursor + cursor: request.cursor, }; return this.callApi( `stardust/transactionhistory/${request.network}/${request.address}${FetchHelper.urlParams(params)}`, - "get" + "get", ); } @@ -301,29 +269,17 @@ export class StardustApiClient extends ApiClient { * @param targetDate The date to use. * @returns The history. */ - public async transactionHistoryDownload( - network: string, - address: string, - targetDate: string - ): Promise { - return this.callApiRaw( - `stardust/transactionhistory/dl/${network}/${address}`, - "post", - { targetDate } - ); + public async transactionHistoryDownload(network: string, address: string, targetDate: string): Promise { + return this.callApiRaw(`stardust/transactionhistory/dl/${network}/${address}`, "post", { targetDate }); } - /** * Get the nft details by NFT address. * @param request The request to send. * @returns The response from the request. */ public async nftDetails(request: INftDetailsRequest): Promise { - return this.callApi( - `stardust/nft/${request.network}/${request.nftId}`, - "get" - ); + return this.callApi(`stardust/nft/${request.network}/${request.nftId}`, "get"); } /** @@ -332,10 +288,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async aliasDetails(request: IAliasRequest): Promise { - return this.callApi( - `stardust/alias/${request.network}/${request.aliasId}`, - "get" - ); + return this.callApi(`stardust/alias/${request.network}/${request.aliasId}`, "get"); } /** @@ -344,10 +297,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async aliasFoundries(request: IFoundriesRequest): Promise { - return this.callApi( - `stardust/alias/foundries/${request.network}/${request.aliasAddress}`, - "get" - ); + return this.callApi(`stardust/alias/foundries/${request.network}/${request.aliasAddress}`, "get"); } /** @@ -356,10 +306,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async foundryDetails(request: IFoundryRequest): Promise { - return this.callApi( - `stardust/foundry/${request.network}/${request.foundryId}`, - "get" - ); + return this.callApi(`stardust/foundry/${request.network}/${request.foundryId}`, "get"); } /** @@ -368,10 +315,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async chronicleAnalytics(request: INetworkBoundGetRequest): Promise { - return this.callApi( - `stardust/analytics/${request.network}`, - "get" - ); + return this.callApi(`stardust/analytics/${request.network}`, "get"); } /** @@ -381,9 +325,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async influxAnalytics(request: { network: string }): Promise { - return this.callApi( - `stardust/analytics/daily/${request.network}`, "get" - ); + return this.callApi(`stardust/analytics/daily/${request.network}`, "get"); } /** @@ -394,15 +336,12 @@ export class StardustApiClient extends ApiClient { public async stats(request: IStatsGetRequest): Promise { return this.callApi( `stats/${request.network}?includeHistory=${request.includeHistory ? "true" : "false"}`, - "get" + "get", ); } public async didDocument(request: IIdentityStardustResolveRequest): Promise { - return this.callApi( - `stardust/did/${request.network}/${request.did}/document`, - "get" - ); + return this.callApi(`stardust/did/${request.network}/${request.did}/document`, "get"); } /** @@ -413,7 +352,7 @@ export class StardustApiClient extends ApiClient { public async participationEventDetails(request: IParticipationEventRequest): Promise { return this.callApi( `stardust/participation/events/${request.network}/${request.eventId}`, - "get" + "get", ); } @@ -423,10 +362,7 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async richestAddresses(request: INetworkBoundGetRequest): Promise { - return this.callApi( - `stardust/address/rich/${request.network}`, - "get" - ); + return this.callApi(`stardust/address/rich/${request.network}`, "get"); } /** @@ -435,10 +371,6 @@ export class StardustApiClient extends ApiClient { * @returns The response from the request. */ public async tokenDistribution(request: INetworkBoundGetRequest): Promise { - return this.callApi( - `stardust/token/distribution/${request.network}/`, - "get" - ); + return this.callApi(`stardust/token/distribution/${request.network}/`, "get"); } } - diff --git a/client/src/services/stardust/stardustFeedClient.ts b/client/src/services/stardust/stardustFeedClient.ts index 56a56f8d4..039965fa5 100644 --- a/client/src/services/stardust/stardustFeedClient.ts +++ b/client/src/services/stardust/stardustFeedClient.ts @@ -7,7 +7,7 @@ import { RegularTransactionEssence, TaggedDataPayload, TransactionPayload, - Utils + Utils, } from "@iota/sdk-wasm/web"; import { io, Socket } from "socket.io-client"; import { ServiceFactory } from "~factories/serviceFactory"; @@ -93,7 +93,7 @@ export class StardustFeedClient { */ public subscribeBlocks( onBlockDataCallback?: (blockData: IFeedBlockData) => void, - onMetadataUpdatedCallback?: (metadataUpdate: { [id: string]: IFeedBlockMetadata }) => void + onMetadataUpdatedCallback?: (metadataUpdate: { [id: string]: IFeedBlockMetadata }) => void, ) { this.socket = io(this.endpoint, { upgrade: true, transports: ["websocket"] }); @@ -108,16 +108,12 @@ export class StardustFeedClient { if (!this.blockSubscriptionId && this._networkConfig?.network && this.socket) { const subscribeRequest: IFeedSubscribeRequest = { network: this._networkConfig.network, - feedSelect: "block" + feedSelect: "block", }; this.socket.on("subscribe", (subscribeResponse: IFeedSubscribeResponse) => { if (subscribeResponse.error) { - console.log( - "Failed subscribing to feed", - this._networkConfig?.network, - subscribeResponse.error - ); + console.log("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); } else { this.blockSubscriptionId = subscribeResponse.subscriptionId; } @@ -129,12 +125,10 @@ export class StardustFeedClient { if (existingBlockData) { existingBlockData.metadata = { ...existingBlockData.metadata, - ...update.blockMetadata.metadata + ...update.blockMetadata.metadata, }; - onMetadataUpdatedCallback?.( - { [existingBlockData.blockId]: existingBlockData.metadata } - ); + onMetadataUpdatedCallback?.({ [existingBlockData.blockId]: existingBlockData.metadata }); } } @@ -147,10 +141,7 @@ export class StardustFeedClient { onBlockDataCallback?.(block); } - if ( - block.payloadType === "Milestone" && - !this.latestMilestones.has(block.blockId) - ) { + if (block.payloadType === "Milestone" && !this.latestMilestones.has(block.blockId)) { this.latestMilestones.set(block.blockId, block); } } @@ -168,9 +159,7 @@ export class StardustFeedClient { * Subscribe to the feed of milestones. * @param onMilestoneCallback the callback for block data updates. */ - public subscribeMilestones( - onMilestoneCallback?: (milestoneData: IFeedMilestoneData) => void - ) { + public subscribeMilestones(onMilestoneCallback?: (milestoneData: IFeedMilestoneData) => void) { this.socket = io(this.endpoint, { upgrade: true, transports: ["websocket"] }); // If reconnect fails then also try polling mode. @@ -184,18 +173,14 @@ export class StardustFeedClient { if (!this.milestoneSubscriptionId && this._networkConfig?.network && this.socket) { const subscribeRequest: IFeedSubscribeRequest = { network: this._networkConfig.network, - feedSelect: "milestone" + feedSelect: "milestone", }; this.socket.emit("subscribe", subscribeRequest); this.socket.on("subscribe", (subscribeResponse: IFeedSubscribeResponse) => { if (subscribeResponse.error) { - console.log( - "Failed subscribing to feed", - this._networkConfig?.network, - subscribeResponse.error - ); + console.log("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); } else { this.milestoneSubscriptionId = subscribeResponse.subscriptionId; } @@ -222,10 +207,10 @@ export class StardustFeedClient { const unsubscribeRequest: IFeedUnsubscribeRequest = { network: this._networkConfig.network, subscriptionId: this.blockSubscriptionId, - feedSelect: "block" + feedSelect: "block", }; - this.socket.on("unsubscribe", () => { }); + this.socket.on("unsubscribe", () => {}); this.socket.emit("unsubscribe", unsubscribeRequest); success = true; } @@ -251,10 +236,10 @@ export class StardustFeedClient { const unsubscribeRequest: IFeedUnsubscribeRequest = { network: this._networkConfig.network, subscriptionId: this.milestoneSubscriptionId, - feedSelect: "milestone" + feedSelect: "milestone", }; - this.socket.on("unsubscribe", () => { }); + this.socket.on("unsubscribe", () => {}); this.socket.emit("unsubscribe", unsubscribeRequest); success = true; } @@ -322,7 +307,7 @@ export class StardustFeedClient { value, parents: block?.parents ?? [], properties, - payloadType + payloadType, }; } @@ -355,4 +340,3 @@ export class StardustFeedClient { }, CACHE_TRIM_INTERVAL_MS); } } - diff --git a/client/src/services/stardust/tokenRegistryClient.ts b/client/src/services/stardust/tokenRegistryClient.ts index aec974261..658458bb8 100644 --- a/client/src/services/stardust/tokenRegistryClient.ts +++ b/client/src/services/stardust/tokenRegistryClient.ts @@ -31,11 +31,7 @@ export class TokenRegistryClient { let response; try { - response = await FetchHelper.json( - endpoint, - `${BASE_PATH}${network}${NFTS_PATH}${id}`, - "get" - ); + response = await FetchHelper.json(endpoint, `${BASE_PATH}${network}${NFTS_PATH}${id}`, "get"); } catch (e) { console.log("Failed to check token registry", e); } @@ -57,7 +53,7 @@ export class TokenRegistryClient { response = await FetchHelper.json( endpoint, `${BASE_PATH}${network}${NATIVE_TOKENS_PATH}${id}`, - "get" + "get", ); } catch (e) { console.log("Failed to check token registry", e); @@ -66,4 +62,3 @@ export class TokenRegistryClient { return response?.success ?? false; } } - diff --git a/client/src/services/tangleCacheService.ts b/client/src/services/tangleCacheService.ts index 48f09ffb1..ba7ad96a9 100644 --- a/client/src/services/tangleCacheService.ts +++ b/client/src/services/tangleCacheService.ts @@ -46,7 +46,6 @@ export class TangleCacheService { * The hash type. */ [hashKey in TransactionsGetMode]?: { - /** * The hash. */ @@ -64,7 +63,7 @@ export class TangleCacheService { */ cached: number; }; - } + }; }; }; @@ -150,7 +149,7 @@ export class TangleCacheService { tag: {}, address: {}, bundle: {}, - transaction: {} + transaction: {}, }; this._addressBalances[networkConfig.network] = {}; diff --git a/package-lock.json b/package-lock.json index 0423c1666..01d7aea45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,740 +1,2901 @@ { - "name": "explorer", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "explorer", - "dependencies": { - "husky": "^8.0.3" - }, - "devDependencies": { - "concurrently": "^8.2.2", - "rimraf": "^5.0.5" - } - }, - "node_modules/@babel/runtime": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.4.tgz", - "integrity": "sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==", - "dev": true, - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/concurrently": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", - "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.2", - "date-fns": "^2.30.0", - "lodash": "^4.17.21", - "rxjs": "^7.8.1", - "shell-quote": "^1.8.1", - "spawn-command": "0.0.2", - "supports-color": "^8.1.1", - "tree-kill": "^1.2.2", - "yargs": "^17.7.2" - }, - "bin": { - "conc": "dist/bin/concurrently.js", - "concurrently": "dist/bin/concurrently.js" - }, - "engines": { - "node": "^14.13.0 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/date-fns": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.21.0" - }, - "engines": { - "node": ">=0.11" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/date-fns" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/husky": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", - "bin": { - "husky": "lib/bin.js" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", - "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", - "dev": true, - "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", - "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", - "dev": true - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", - "dev": true, - "dependencies": { - "glob": "^10.3.7" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dev": true, - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/shell-quote": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/spawn-command": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", - "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", - "dev": true - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, - "bin": { - "tree-kill": "cli.js" - } - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "engines": { - "node": ">=12" - } + "name": "explorer", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "explorer", + "dependencies": { + "husky": "^8.0.3" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.18.1", + "concurrently": "^8.2.2", + "lint-staged": "^14.0.1", + "rimraf": "^5.0.5", + "typescript": "^4.9.5" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.4.tgz", + "integrity": "sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "peer": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "dev": true, + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "dev": true, + "peer": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "dev": true, + "peer": true + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", + "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/type-utils": "6.18.1", + "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz", + "integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==", + "dev": true, + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", + "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", + "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/utils": "6.18.1", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", + "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", + "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/visitor-keys": "6.18.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", + "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.18.1", + "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/typescript-estree": "6.18.1", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", + "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.18.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true, + "peer": true + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peer": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dev": true, + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "peer": true + }, + "node_modules/concurrently": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", + "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "date-fns": "^2.30.0", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "spawn-command": "0.0.2", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "peer": true + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "peer": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "dev": true, + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "peer": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "peer": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "peer": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "peer": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, + "node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "peer": true + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "peer": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "peer": true + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "peer": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "peer": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "peer": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/flat-cache/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flat-cache/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "peer": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true, + "peer": true + }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "peer": true + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "peer": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "peer": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "peer": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "peer": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "peer": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "peer": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "peer": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "peer": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lint-staged": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-14.0.1.tgz", + "integrity": "sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==", + "dev": true, + "dependencies": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/listr2": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", + "dev": true, + "dependencies": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/listr2/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "peer": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "peer": true + }, + "node_modules/log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "dev": true, + "dependencies": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/log-update/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/lru-cache": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/npm-run-path": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "peer": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "peer": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "peer": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, + "node_modules/rimraf": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", + "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", + "dev": true, + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "peer": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "peer": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "peer": true + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } } - } } diff --git a/package.json b/package.json index 679e9edfa..ce1d1e301 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,23 @@ { - "name": "explorer", - "scripts": { - "setup:client": "cd client && npm install && npm run postinstall", - "setup:api": "cd api && npm install && npm run build-compile && npm run build-config", - "setup:dev": "npm run clear && npm run prepare && npm run setup:client && npm run setup:api", - "clear": "rimraf api/node_modules api/dist client/node_modules client/build", - "dev": "concurrently 'cd api && npm run start-dev' 'cd client && npm run start'", - "pre-push": "concurrently 'cd api && npm run build-compile && npm run build-lint && npm run build-config' 'cd client && npm run build'", - "prepare": "husky install" - }, - "devDependencies": { - "concurrently": "^8.2.2", - "rimraf": "^5.0.5" - }, - "dependencies": { - "husky": "^8.0.3" - } + "name": "explorer", + "scripts": { + "setup:client": "cd client && npm install && npm run postinstall", + "setup:api": "cd api && npm install && npm run build-compile && npm run build-config", + "setup:dev": "npm run clear && npm run prepare && npm run setup:client && npm run setup:api", + "clear": "rimraf api/node_modules api/dist client/node_modules client/build", + "dev": "concurrently 'cd api && npm run start-dev' 'cd client && npm run start'", + "pre-push": "concurrently 'cd api && npm run build-compile && npm run build-lint && npm run build-config' 'cd client && npm run build'", + "prepare": "husky install", + "format": "concurrently 'cd api && npm run format' 'cd client && npm run format'" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.18.1", + "concurrently": "^8.2.2", + "lint-staged": "^14.0.1", + "rimraf": "^5.0.5", + "typescript": "^4.9.5" + }, + "dependencies": { + "husky": "^8.0.3" + } }