From 661a6c97aa800ee5323d833aabc2f3f42d61c885 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:38:41 -0500 Subject: [PATCH 1/8] move mainnet/consensus one level down --- indexers/consensus/.gitignore | 62 +++ indexers/consensus/LICENSE | 21 + indexers/consensus/README.md | 42 ++ indexers/consensus/package.json | 58 +++ indexers/consensus/project.ts | 75 ++++ indexers/consensus/schema.graphql | 115 +++++ indexers/consensus/src/index.ts | 3 + indexers/consensus/src/mappings/db.ts | 269 ++++++++++++ indexers/consensus/src/mappings/helper.ts | 71 ++++ .../consensus/src/mappings/mappingHandlers.ts | 397 ++++++++++++++++++ indexers/consensus/src/mappings/types.ts | 17 + indexers/consensus/src/mappings/utils.ts | 58 +++ indexers/consensus/tsconfig.json | 20 + 13 files changed, 1208 insertions(+) create mode 100644 indexers/consensus/.gitignore create mode 100644 indexers/consensus/LICENSE create mode 100644 indexers/consensus/README.md create mode 100644 indexers/consensus/package.json create mode 100644 indexers/consensus/project.ts create mode 100644 indexers/consensus/schema.graphql create mode 100644 indexers/consensus/src/index.ts create mode 100644 indexers/consensus/src/mappings/db.ts create mode 100644 indexers/consensus/src/mappings/helper.ts create mode 100644 indexers/consensus/src/mappings/mappingHandlers.ts create mode 100644 indexers/consensus/src/mappings/types.ts create mode 100644 indexers/consensus/src/mappings/utils.ts create mode 100644 indexers/consensus/tsconfig.json diff --git a/indexers/consensus/.gitignore b/indexers/consensus/.gitignore new file mode 100644 index 000000000..36045d79b --- /dev/null +++ b/indexers/consensus/.gitignore @@ -0,0 +1,62 @@ +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# lock files +yarn.lock +package-lock.json + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Generated files +target/ +dist/ +src/types +project.yaml + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +.data +.eslintcache + +# ENV local files +.env.local +.env.develop.local \ No newline at end of file diff --git a/indexers/consensus/LICENSE b/indexers/consensus/LICENSE new file mode 100644 index 000000000..f168fbe14 --- /dev/null +++ b/indexers/consensus/LICENSE @@ -0,0 +1,21 @@ +MIT LICENSE + +Copyright 2020-2024 SubQuery Pte Ltd authors & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/indexers/consensus/README.md b/indexers/consensus/README.md new file mode 100644 index 000000000..c6294b978 --- /dev/null +++ b/indexers/consensus/README.md @@ -0,0 +1,42 @@ +# Autonomys Astral Explorer Consensus + +The Autonomys Astral Explorer Consensus is a specialized SubQuery project that indexes all consensus-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the consensus tracking functionality for the Astral Explorer, providing real-time data on validator activities and network consensus. + +## Overview + +This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: + +1. Indexing all consensus-related events using the relevant pallets +2. Capturing system remarks for additional consensus actions +3. Tracking and updating validator performance and network consensus metrics + +## Project Structure + +The project consists of the following key components: + +- `project.ts`: Defines the project configuration, including network endpoints and data sources. +- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. +- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. + +## Key Features + +- Real-time tracking of consensus events +- Monitoring of system remarks for specific consensus actions +- Validator performance calculation and updates +- Support for querying consensus history and network statistics + +## Running the Project + +To run this project locally: + +1. Ensure you have Node.js and Docker installed on your system. +2. Clone the repository: `git clone https://github.com/autonomys/astral.git` +3. Navigate to the project directory: `cd astral/indexers/consensus` +4. Install dependencies: `yarn install` +5. Start the project: `yarn dev` + +This will start the SubQuery node, PostgreSQL database, and GraphQL query service. + +## Querying the Data + +Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/consensus/package.json b/indexers/consensus/package.json new file mode 100644 index 000000000..7a7fa6c47 --- /dev/null +++ b/indexers/consensus/package.json @@ -0,0 +1,58 @@ +{ + "name": "consensus", + "version": "1.0.0", + "description": "Autonomys Network - Consensus", + "main": "dist/index.js", + "scripts": { + "build": "subql codegen && subql build", + "codegen": "subql codegen", + "start:docker": "docker-compose pull && docker-compose up --remove-orphans", + "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", + "prepack": "rm -rf dist && npm run build", + "test": "subql build && subql-node test", + "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" + }, + "homepage": "https://github.com/autonomys/astral", + "files": [ + "dist", + "schema.graphql", + "project.yaml" + ], + "repository": { + "type": "git", + "url": "https://github.com/autonomys/astral" + }, + "author": { + "name": "Autonomys", + "url": "https://www.autonomys.xyz" + }, + "bugs": { + "url": "https://github.com/autonomys/astral/issues" + }, + "license": "MIT", + "devDependencies": { + "@apollo/client": "^3.7.16", + "@autonomys/auto-consensus": "^1.2.1", + "@autonomys/auto-dag-data": "^1.2.1", + "@autonomys/auto-utils": "^1.2.1", + "@polkadot/api": "^12.4.2", + "@polkadot/types": "^14.1.1", + "@polkadot/util": "^13.2.2", + "@polkadot/util-crypto": "^13.2.2", + "@subql/cli": "^5.4.0", + "@subql/common-substrate": "^4.3.5", + "@subql/node": "^5.6.0", + "@subql/types": "^3.11.4", + "@types/node": "^22.9.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "dotenv": "^16.4.5", + "graphql": "^16.9.0", + "prom-client": "^14.2.0", + "rxjs": "^7.8.1", + "typescript": "^5.2.2" + }, + "resolutions": { + "ipfs-unixfs": "6.0.6" + } +} diff --git a/indexers/consensus/project.ts b/indexers/consensus/project.ts new file mode 100644 index 000000000..0fd4e4ad6 --- /dev/null +++ b/indexers/consensus/project.ts @@ -0,0 +1,75 @@ +import { + SubstrateDatasourceKind, + SubstrateHandlerKind, + SubstrateProject, +} from "@subql/types"; +import * as dotenv from "dotenv"; +import path from "path"; + +// Load the appropriate .env file +const dotenvPath = path.resolve(__dirname, `../../../.env`); +dotenv.config({ path: dotenvPath }); + +// Can expand the Datasource processor types via the genreic param +const project: SubstrateProject = { + specVersion: "1.0.0", + version: "0.0.1", + name: "autonomys-consensus", + description: "Autonomys Network - Consensus", + repository: "https://github.com/autonomys/astral", + runner: { + node: { + name: "@subql/node", + version: ">=5.2.9", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /* The genesis hash of the network (hash of block 0) */ + chainId: process.env.CHAIN_ID!, + /** + * These endpoint(s) should be public non-pruned archive node + * We recommend providing more than one endpoint for improved reliability, performance, and uptime + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters + * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited + */ + endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, + // @ts-ignore + types: { + Solution: { + public_key: "AccountId32", + reward_address: "AccountId32", + }, + SubPreDigest: { + slot: "u64", + solution: "Solution", + }, + }, + }, + dataSources: [ + { + kind: SubstrateDatasourceKind.Runtime, + startBlock: 1, + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: SubstrateHandlerKind.Block, + handler: "handleBlock", + }, + ], + }, + }, + ], +}; + +// Must set default to the project instance +export default project; diff --git a/indexers/consensus/schema.graphql b/indexers/consensus/schema.graphql new file mode 100644 index 000000000..a8ede486d --- /dev/null +++ b/indexers/consensus/schema.graphql @@ -0,0 +1,115 @@ +# Core Consensus Entities + +type Block @entity { + id: ID! + sortId: String! @index + height: BigInt! @index + hash: String! @index + timestamp: Date! @index + parentHash: String! + specId: String! + stateRoot: String! + extrinsicsRoot: String! + spacePledged: BigInt! + blockchainSize: BigInt! + extrinsicsCount: Int! + eventsCount: Int! + transfersCount: Int! + rewardsCount: Int! + blockRewardsCount: Int! + voteRewardsCount: Int! + transferValue: BigInt! + rewardValue: BigInt! + blockRewardValue: BigInt! + voteRewardValue: BigInt! + authorId: String! @index +} + +type Log @entity { + id: ID! + sortId: String! @index + blockHeight: BigInt! @index + blockHash: String! @index + indexInBlock: Int! @index + kind: String! + value: String + timestamp: Date! @index +} + +type Extrinsic @entity { + id: ID! + sortId: String! @index + hash: String! @index + blockHeight: BigInt! @index + blockHash: String! @index + section: String! @index + module: String! @index + name: String! + indexInBlock: Int! + success: Boolean! @index + timestamp: Date! @index + nonce: BigInt! + signer: String! @index + signature: String! + args: String! + error: String! + tip: BigInt! + fee: BigInt! + pos: Int! + cid: String @index +} + +type Event @entity { + id: ID! + sortId: String! @index + blockHeight: BigInt! @index + blockHash: String! @index + extrinsicId: String! @index + extrinsicHash: String! @index + section: String! @index + module: String! @index + name: String! + indexInBlock: BigInt! + timestamp: Date! @index + phase: String! + pos: Int! + args: String! + cid: String @index +} + +# Accounts Entities + +type AccountHistory @entity { + id: ID! + nonce: BigInt! + free: BigInt! + reserved: BigInt! + total: BigInt @index + createdAt: BigInt! @index +} + +type Transfer @entity { + id: ID! + blockHeight: BigInt! @index + blockHash: String! @index + extrinsicId: String! @index + eventId: String! @index + from: String! @index + to: String! @index + value: BigInt! + fee: BigInt! + success: Boolean! + timestamp: Date! @index +} + +type Reward @entity { + id: ID! + blockHeight: BigInt! @index + blockHash: String! @index + extrinsicId: String! @index + eventId: String! @index + accountId: String! @index + rewardType: String! @index + amount: BigInt! + timestamp: Date! @index +} diff --git a/indexers/consensus/src/index.ts b/indexers/consensus/src/index.ts new file mode 100644 index 000000000..509161575 --- /dev/null +++ b/indexers/consensus/src/index.ts @@ -0,0 +1,3 @@ +//Exports all handler functions +export * from "./mappings/mappingHandlers"; +import "@polkadot/api-augment"; diff --git a/indexers/consensus/src/mappings/db.ts b/indexers/consensus/src/mappings/db.ts new file mode 100644 index 000000000..633e8575b --- /dev/null +++ b/indexers/consensus/src/mappings/db.ts @@ -0,0 +1,269 @@ +import { + AccountHistory, + Block, + Event, + Extrinsic, + Log, + Reward, + Transfer, +} from "../types"; +import { dateEntry, getSortId, moduleName } from "./utils"; + +// Core Consensus DB Functions + +export async function createAndSaveBlock( + hash: string, + height: bigint, + timestamp: Date, + parentHash: string, + specId: string, + stateRoot: string, + extrinsicsRoot: string, + spacePledged: bigint, + blockchainSize: bigint, + extrinsicsCount: number, + eventsCount: number, + transfersCount: number, + rewardsCount: number, + blockRewardsCount: number, + voteRewardsCount: number, + transferValue: bigint, + rewardValue: bigint, + blockRewardValue: bigint, + voteRewardValue: bigint, + authorId: string +): Promise { + const id = height.toString(); + const sortId = getSortId(height); + const block = Block.create({ + id, + sortId, + height, + hash, + timestamp, + parentHash, + specId, + stateRoot, + extrinsicsRoot, + spacePledged, + blockchainSize, + extrinsicsCount, + eventsCount, + transfersCount, + rewardsCount, + blockRewardsCount, + voteRewardsCount, + transferValue, + rewardValue, + blockRewardValue, + voteRewardValue, + authorId, + }); + await block.save(); + return block; +} + +export async function createAndSaveLog( + blockHeight: bigint, + blockHash: string, + indexInBlock: number, + kind: string, + value: string, + timestamp: Date +): Promise { + const id = `${blockHeight}-${indexInBlock}`; + const sortId = getSortId(blockHeight, BigInt(indexInBlock)); + const log = Log.create({ + id, + sortId, + blockHeight, + blockHash, + indexInBlock, + kind, + value, + timestamp, + }); + await log.save(); + return log; +} + +export async function saveLog(logs: Log[]): Promise { + await Promise.all(logs.map((log) => log.save())); +} + +export function createExtrinsic( + hash: string, + blockHeight: bigint, + blockHash: string, + indexInBlock: number, + section: string, + module: string, + success: boolean, + timestamp: Date, + nonce: bigint, + signer: string, + signature: string, + args: string, + error: string, + tip: bigint, + fee: bigint, + pos: number, + cid?: string +): Extrinsic { + const extrinsicId = `${blockHeight}-${indexInBlock}`; + const sortId = getSortId(blockHeight, BigInt(indexInBlock)); + return Extrinsic.create({ + id: extrinsicId, + sortId, + hash, + blockHeight, + blockHash, + indexInBlock, + section, + module, + name: moduleName(section, module), + success, + timestamp, + nonce, + signer, + signature, + args, + error, + tip, + fee, + pos, + cid, + }); +} + +export async function saveExtrinsics(extrinsics: Extrinsic[]): Promise { + await Promise.all(extrinsics.map((extrinsic) => extrinsic.save())); +} + +export function createEvent( + blockHeight: bigint, + blockHash: string, + indexInBlock: bigint, + extrinsicId: string, + extrinsicHash: string, + section: string, + module: string, + timestamp: Date, + phase: string, + pos: number, + args: string, + cid?: string +): Event { + const id = `${blockHeight}-${indexInBlock.toString()}`; + const sortId = getSortId(blockHeight, BigInt(indexInBlock)); + return Event.create({ + id, + sortId, + blockHeight, + blockHash, + extrinsicId, + extrinsicHash, + indexInBlock, + section, + module, + name: moduleName(section, module), + timestamp, + phase, + pos, + args, + cid, + }); +} + +export async function saveEvents(events: Event[]): Promise { + await Promise.all(events.map((event) => event.save())); +} + +// Accounts DB Functions + +export function createAccountHistory( + id: string, + blockNumber: bigint, + nonce: bigint, + free: bigint, + reserved: bigint, + total: bigint +): AccountHistory { + const accountHistory = AccountHistory.create({ + id, + nonce, + free, + reserved, + total, + ...dateEntry(blockNumber), + }); + return accountHistory; +} + +export async function saveAccountHistories( + accountHistories: AccountHistory[] +): Promise { + await Promise.all( + accountHistories.map((accountHistory) => accountHistory.save()) + ); +} + +export function createTransfer( + blockHeight: bigint, + blockHash: string, + extrinsicId: string, + eventId: string, + from: string, + to: string, + value: bigint, + fee: bigint, + success: boolean, + timestamp: Date +): Transfer { + const id = extrinsicId + "-" + eventId; + return Transfer.create({ + id, + blockHeight, + blockHash, + extrinsicId, + eventId, + from, + to, + value, + fee, + success, + timestamp, + }); +} + +export async function saveTransfers(transfers: Transfer[]): Promise { + await Promise.all(transfers.map((transfer) => transfer.save())); +} + +export function createReward( + blockHeight: bigint, + blockHash: string, + extrinsicId: string, + eventId: string, + accountId: string, + rewardType: string, + amount: bigint, + timestamp: Date +): Reward { + const id = accountId + "-" + eventId; + return Reward.create({ + id, + blockHeight, + blockHash, + extrinsicId, + eventId, + accountId, + rewardType, + amount, + timestamp, + }); +} + +export async function saveRewards(rewards: Reward[]): Promise { + await Promise.all(rewards.map((reward) => reward.save())); +} diff --git a/indexers/consensus/src/mappings/helper.ts b/indexers/consensus/src/mappings/helper.ts new file mode 100644 index 000000000..03791e34f --- /dev/null +++ b/indexers/consensus/src/mappings/helper.ts @@ -0,0 +1,71 @@ +import { + cidOfNode, + cidToString, + decodeNode, + PBNode, +} from "@autonomys/auto-dag-data"; +import { stringify } from "@autonomys/auto-utils"; +import { Bytes } from "@polkadot/types"; +import { compactStripLength } from "@polkadot/util"; +import { SubstrateBlock } from "@subql/types"; +import { Cid, ModifiedArgs, ParsedArgs } from "./types"; +import { decodeLog, hexToUint8Array } from "./utils"; + +const DEFAULT_ACCOUNT_ID = "0x00"; + +export const getBlockAuthor = (block: SubstrateBlock): string => { + const { digest } = block.block.header; + const preRuntimeRaw = digest.logs.find((digestI) => digestI.isPreRuntime); + if (preRuntimeRaw) { + const value = decodeLog(preRuntimeRaw.asPreRuntime); + if (value) { + api.registry.register({ + Solution: { + public_key: "AccountId32", + reward_address: "AccountId32", + }, + SubPreDigest: { + slot: "u64", + solution: "Solution", + }, + }); + const type = api.registry.createType("SubPreDigest", value.data); + const publicKey = (type.toPrimitive() as any).solution.public_key; + const rewardAddress = (type.toPrimitive() as any).solution.reward_address; + return rewardAddress; + } + } + return DEFAULT_ACCOUNT_ID; +}; + +export const parseDataToCid = (data: string): ParsedArgs => { + let cid: Cid = undefined; + let modifiedArgs: ModifiedArgs = undefined; + let node: PBNode | null = null; + try { + const hexString = data.startsWith("0x") ? data.slice(2) : data; + const buffer = Buffer.from(hexString, "hex"); + try { + const [length, bytes] = compactStripLength(buffer); + const isValidLength = length === bytes.length; + try { + const encoded = isValidLength + ? Bytes.from(buffer) + : hexToUint8Array(data); + node = decodeNode(encoded); + } catch (error) { + node = decodeNode(buffer); + } + cid = cidToString(cidOfNode(node)); + } catch (error) { + const encoded = Bytes.from(buffer); + const node = decodeNode(encoded); + cid = cidToString(cidOfNode(node)); + } + modifiedArgs = stringify({ cid }); + } catch (error) { + logger.error("Error decoding remark or seedHistory extrinsic"); + logger.error(error); + } + return { cid, modifiedArgs }; +}; diff --git a/indexers/consensus/src/mappings/mappingHandlers.ts b/indexers/consensus/src/mappings/mappingHandlers.ts new file mode 100644 index 000000000..4fa4f71ab --- /dev/null +++ b/indexers/consensus/src/mappings/mappingHandlers.ts @@ -0,0 +1,397 @@ +global.TextEncoder = require("util").TextEncoder; +global.TextDecoder = require("util").TextDecoder; +global.Buffer = require("buffer/").Buffer; + +import { + account, + blockchainSize, + spacePledge, +} from "@autonomys/auto-consensus"; +import type { ApiAtBlockHash } from "@autonomys/auto-utils"; +import { stringify } from "@autonomys/auto-utils"; +import { SubstrateBlock } from "@subql/types"; +import { Event, Extrinsic, Reward, Transfer } from "../types"; +import { + createAccountHistory, + createAndSaveBlock, + createAndSaveLog, + createEvent, + createExtrinsic, + createReward, + createTransfer, + saveAccountHistories, + saveEvents, + saveExtrinsics, + saveRewards, + saveTransfers, +} from "./db"; +import { getBlockAuthor, parseDataToCid } from "./helper"; +import { ExtrinsicPrimitive, LogValue } from "./types"; + +export async function handleBlock(_block: SubstrateBlock): Promise { + const { + block: { + header: { number, parentHash, stateRoot, extrinsicsRoot, digest }, + hash, + extrinsics, + }, + timestamp, + specVersion, + events, + } = _block; + const height = BigInt(number.toString()); + const blockHash = hash.toString(); + const blockTimestamp = timestamp ? timestamp : new Date(0); + const authorId = getBlockAuthor(_block); + const eventsCount = events.length; + const extrinsicsCount = extrinsics.length; + + const newExtrinsics: Extrinsic[] = []; + const newEvents: Event[] = []; + const newTransfers: Transfer[] = []; + const newRewards: Reward[] = []; + + const extrinsicMethodsToUpdate: [string, string][] = []; + const eventMethodsToUpdate: [string, string][] = []; + const logKindsToUpdate: string[] = []; + const addressToUpdate: string[] = []; + + let eventIndex = 0; + let totalBlockRewardsCount = 0; + let totalVoteRewardsCount = 0; + let totalTransferValue = BigInt(0); + let totalRewardValue = BigInt(0); + let totalBlockRewardValue = BigInt(0); + let totalVoteRewardValue = BigInt(0); + + // Calculate space pledged and blockchain size concurrently + const [_spacePledged, _blockchainSize] = await Promise.all([ + spacePledge(api as unknown as ApiAtBlockHash), + blockchainSize(api as unknown as ApiAtBlockHash), + ]); + + // Process extrinsics + extrinsics.forEach((extrinsic, extrinsicIdx) => { + const extrinsicMethodToPrimitive = + extrinsic.method.toPrimitive() as ExtrinsicPrimitive; + + const extrinsicEvents = events.filter( + (e) => + e.phase.isApplyExtrinsic && + e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx + ); + + const feeEvent = events.find( + (e) => + e.phase.isApplyExtrinsic && + e.event.section === "balances" && + e.event.method === "Withdraw" + ); + const fee = + feeEvent && feeEvent.event && feeEvent.event.data[1] + ? BigInt(feeEvent.event.data[1].toString()) + : BigInt(0); + + const errorEvent = events.find( + (e) => + e.event.section === "system" && e.event.method === "ExtrinsicFailed" + ); + const successEvent = events.find( + (e) => + e.event.section === "system" && e.event.method === "ExtrinsicSuccess" + ); + const error = errorEvent ? stringify(errorEvent.event.data) : ""; + + const pos = extrinsicEvents ? extrinsicIdx : 0; + const extrinsicSigner = extrinsic.signer.toString(); + + // Detect data storage extrinsics and parse args to cid + let cid: string | undefined = undefined; + let args: string = stringify(extrinsicMethodToPrimitive.args); + if ( + (extrinsic.method.section === "historySeeding" && + extrinsic.method.method === "seedHistory") || + (extrinsic.method.section === "system" && + (extrinsic.method.method === "remarkWithEvent" || + extrinsic.method.method === "remark")) + ) { + const parsedArgs = parseDataToCid(extrinsicMethodToPrimitive.args.remark); + cid = parsedArgs.cid; + // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db + args = parsedArgs.modifiedArgs ?? args; + } + + newExtrinsics.push( + createExtrinsic( + extrinsic.hash.toString(), + height, + blockHash, + extrinsicIdx, + extrinsic.method.section, + extrinsic.method.method, + successEvent ? true : false, + timestamp ? timestamp : new Date(0), + BigInt(extrinsic.nonce.toString()), + extrinsicSigner, + extrinsic.signature.toString(), + args, + error, + BigInt(extrinsic.tip.toString()), + fee, + pos, + cid + ) + ); + extrinsicMethodsToUpdate.push([ + extrinsic.method.section, + extrinsic.method.method, + ]); + addressToUpdate.push(extrinsicSigner); + + // Process extrinsic events + extrinsicEvents.forEach((event) => { + const extrinsicId = extrinsic + ? height + "-" + extrinsicIdx.toString() + : ""; + + // Detect data storage extrinsics and parse args to cid + let cid: string | undefined = undefined; + let args: string = stringify(event.event.data); + if ( + event.event.section === "system" && + event.event.method === "Remarked" + ) { + const parsedArgs = parseDataToCid(event.event.data[1].toString()); + cid = parsedArgs.cid; + // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db + args = parsedArgs.modifiedArgs ?? args; + } + + newEvents.push( + createEvent( + height, + blockHash, + BigInt(eventIndex), + extrinsicId, + extrinsic.hash.toString(), + event.event.section, + event.event.method, + timestamp ? timestamp : new Date(0), + event.phase.type, + pos, + args, + cid + ) + ); + eventMethodsToUpdate.push([event.event.section, event.event.method]); + + // Process specific events + switch (`${event.event.section}.${event.event.method}`) { + case "balances.Transfer": { + const from = event.event.data[0].toString(); + const to = event.event.data[1].toString(); + const amount = BigInt(event.event.data[2].toString()); + + addressToUpdate.push(from, to); + + totalTransferValue += amount; + + const newTransfer = createTransfer( + height, + blockHash, + extrinsicId, + height + "-" + eventIndex, + from, + to, + amount, + fee, + successEvent ? true : false, + timestamp ? timestamp : new Date(0) + ); + newTransfers.push(newTransfer); + + break; + } + default: + break; + } + + // Increment event index + eventIndex++; + }); + + // Get finalization events + const finalizationEvents = events.filter((e) => e.phase.isFinalization); + + // Process finalization events + finalizationEvents.forEach(async (event) => { + newEvents.push( + createEvent( + height, + blockHash, + BigInt(eventIndex), + height + "-" + event.phase.type, + extrinsic.hash.toString(), + event.event.section, + event.event.method, + timestamp ? timestamp : new Date(0), + event.phase.type, + pos, + args, + cid + ) + ); + eventMethodsToUpdate.push([event.event.section, event.event.method]); + + // Process specific events + switch (`${event.event.section}.${event.event.method}`) { + case "rewards.VoteReward": { + const voter = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + + addressToUpdate.push(voter); + + totalVoteRewardsCount++; + totalRewardValue += reward; + totalVoteRewardValue += reward; + + const newReward = createReward( + height, + blockHash, + height + "-" + event.phase.type, + height + "-" + eventIndex, + voter, + "rewards.VoteReward", + reward, + timestamp ? timestamp : new Date(0) + ); + newRewards.push(newReward); + + break; + } + case "rewards.BlockReward": { + const blockAuthor = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + + addressToUpdate.push(blockAuthor); + + totalBlockRewardsCount++; + totalRewardValue += reward; + totalBlockRewardValue += reward; + + const newReward = createReward( + height, + blockHash, + height + "-" + event.phase.type, + height + "-" + eventIndex, + blockAuthor, + "rewards.BlockReward", + reward, + timestamp ? timestamp : new Date(0) + ); + newRewards.push(newReward); + + break; + } + default: + break; + } + + // Increment event index + eventIndex++; + }); + }); + + // Create and save block logs + await Promise.all( + digest.logs.map((log, i) => { + const logData = log.toHuman(); + const logJson = log.toPrimitive(); + const kind = logData ? Object.keys(logData)[0] : ""; + const rawKind = logJson ? Object.keys(logJson)[0] : ""; + const _value = logJson ? logJson[rawKind as keyof typeof logJson] : ""; + const value: LogValue = + Array.isArray(_value) && _value.length === 2 + ? { data: _value[1], engine: _value[0] } + : { data: _value }; + + logKindsToUpdate.push(kind); + return createAndSaveLog( + height, + blockHash, + i, + kind, + stringify(value), + blockTimestamp + ); + }) + ); + + // Build sections + const allSections = [ + ...extrinsicMethodsToUpdate.map((method) => method[0]), + ...eventMethodsToUpdate.map((method) => method[0]), + ]; + + // Remove duplicate entry before updating entities + const uniqueAddresses = [...new Set(addressToUpdate)]; + const uniqueSections = [...new Set(allSections)]; + const uniqueExtrinsicMethods = [...new Set(extrinsicMethodsToUpdate)]; + const uniqueEventMethods = [...new Set(eventMethodsToUpdate)]; + const uniqueLogKinds = [...new Set(logKindsToUpdate)]; + + // Update accounts + const accounts = await Promise.all( + uniqueAddresses.map((address) => account(api as any, address)) + ); + // Create and save accounts + const accountHistories = await Promise.all( + accounts.map((account, i) => + createAccountHistory( + uniqueAddresses[i], + height, + BigInt(account.nonce.toString()), + account.data.free, + account.data.reserved, + account.data.free + account.data.reserved + ) + ) + ); + + // Save many entities in parallel + await Promise.all([ + // Save extrinsic and events + saveExtrinsics(newExtrinsics), + saveEvents(newEvents), + + // Save transfers and rewards + saveTransfers(newTransfers), + saveRewards(newRewards), + // Save account + saveAccountHistories(accountHistories), + ]); + + // Create block + await createAndSaveBlock( + blockHash, + height, + blockTimestamp, + parentHash.toString(), + specVersion.toString(), + stateRoot.toString(), + extrinsicsRoot.toString(), + _spacePledged, + _blockchainSize, + extrinsicsCount, + eventsCount, + newTransfers.length, + newRewards.length, + totalBlockRewardsCount, + totalVoteRewardsCount, + totalTransferValue, + totalRewardValue, + totalBlockRewardValue, + totalVoteRewardValue, + authorId + ); +} diff --git a/indexers/consensus/src/mappings/types.ts b/indexers/consensus/src/mappings/types.ts new file mode 100644 index 000000000..d2fc41c3c --- /dev/null +++ b/indexers/consensus/src/mappings/types.ts @@ -0,0 +1,17 @@ +export type ExtrinsicPrimitive = { + callIndex: string; + args: any; +}; + +export type LogValue = { + data: any; + engine?: string; +}; + +export type Cid = string | undefined; +export type ModifiedArgs = string | undefined; + +export type ParsedArgs = { + cid: Cid; + modifiedArgs: ModifiedArgs; +}; diff --git a/indexers/consensus/src/mappings/utils.ts b/indexers/consensus/src/mappings/utils.ts new file mode 100644 index 000000000..bc0f31f62 --- /dev/null +++ b/indexers/consensus/src/mappings/utils.ts @@ -0,0 +1,58 @@ +import { capitalizeFirstLetter } from "@autonomys/auto-utils"; +import { SubstrateBlock } from "@subql/types"; + +export const dateEntry = (blockNumber: number | bigint) => { + if (typeof blockNumber === "number") { + blockNumber = BigInt(blockNumber); + } + return { + createdAt: blockNumber, + updatedAt: blockNumber, + }; +}; + +export const getBlockNumberFromBlock = (block: SubstrateBlock): number => { + try { + return block.block.header.number.toNumber(); + } catch (error) { + logger.error(`Error getting block number: ${error}`); + throw error; + } +}; + +export const decodeLog = (value: null | Uint8Array | Uint8Array[]) => { + if (!value) return null; + + if (Array.isArray(value)) { + return { + engine: value[0].toString(), + data: value[1], + }; + } + + return { data: value }; +}; + +export const moduleName = (section: string, method: string) => + `${capitalizeFirstLetter(section)}.${capitalizeFirstLetter(method)}`; + +export const getSortId = ( + blockHeight: bigint, + indexInBlock?: bigint +): string => { + const totalLength = 32; + const str1 = blockHeight.toString().padStart(totalLength, "0"); + + if (indexInBlock === undefined) return str1; + + const str2 = indexInBlock.toString().padStart(totalLength, "0"); + return `${str1}-${str2}`; +}; + +export const hexToUint8Array = (hex: string): Uint8Array => { + if (hex.length % 2 !== 0) + throw new Error("Hex string must have an even length"); + return new Uint8Array( + hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] + ); +}; diff --git a/indexers/consensus/tsconfig.json b/indexers/consensus/tsconfig.json new file mode 100644 index 000000000..3d926b019 --- /dev/null +++ b/indexers/consensus/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "declaration": true, + "importHelpers": true, + "resolveJsonModule": true, + "module": "commonjs", + "outDir": "dist", + "rootDir": "src", + "target": "es2017", + "strict": true + }, + "include": [ + "src/**/*", + "../node_modules/@subql/types-core/dist/global.d.d.ts", + "../node_modules/@subql/types/dist/global.d.ts" + ] +} From 5fa27560896804b6369873a5731a10a9e752970b Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:38:59 -0500 Subject: [PATCH 2/8] move mainnet/files one level down --- indexers/files/.gitignore | 62 ++++++++ indexers/files/LICENSE | 21 +++ indexers/files/README.md | 40 +++++ indexers/files/package.json | 57 +++++++ indexers/files/project.ts | 95 ++++++++++++ indexers/files/schema.graphql | 67 ++++++++ indexers/files/src/index.ts | 3 + indexers/files/src/mappings/db.ts | 146 ++++++++++++++++++ .../files/src/mappings/mappingHandlers.ts | 139 +++++++++++++++++ indexers/files/src/mappings/types.ts | 9 ++ indexers/files/tsconfig.json | 20 +++ 11 files changed, 659 insertions(+) create mode 100644 indexers/files/.gitignore create mode 100644 indexers/files/LICENSE create mode 100644 indexers/files/README.md create mode 100644 indexers/files/package.json create mode 100644 indexers/files/project.ts create mode 100644 indexers/files/schema.graphql create mode 100644 indexers/files/src/index.ts create mode 100644 indexers/files/src/mappings/db.ts create mode 100644 indexers/files/src/mappings/mappingHandlers.ts create mode 100644 indexers/files/src/mappings/types.ts create mode 100644 indexers/files/tsconfig.json diff --git a/indexers/files/.gitignore b/indexers/files/.gitignore new file mode 100644 index 000000000..36045d79b --- /dev/null +++ b/indexers/files/.gitignore @@ -0,0 +1,62 @@ +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# lock files +yarn.lock +package-lock.json + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Generated files +target/ +dist/ +src/types +project.yaml + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +.data +.eslintcache + +# ENV local files +.env.local +.env.develop.local \ No newline at end of file diff --git a/indexers/files/LICENSE b/indexers/files/LICENSE new file mode 100644 index 000000000..f168fbe14 --- /dev/null +++ b/indexers/files/LICENSE @@ -0,0 +1,21 @@ +MIT LICENSE + +Copyright 2020-2024 SubQuery Pte Ltd authors & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/indexers/files/README.md b/indexers/files/README.md new file mode 100644 index 000000000..5705e493f --- /dev/null +++ b/indexers/files/README.md @@ -0,0 +1,40 @@ +# Autonomys Astral Indexer - Files + +The Autonomys Astral Indexer - Files is a specialized SubQuery project that indexes all files on the Autonomys Mainnen. This project is designed to support the files tracking functionality for the Astral Explorer, providing real-time data on files. + +## Overview + +This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: + +1. Indexing all files and CIDs on the Autonomys Mainnet + +## Project Structure + +The project consists of the following key components: + +- `project.ts`: Defines the project configuration, including network endpoints and data sources. +- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. +- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. + +## Key Features + +- Real-time tracking of consensus events +- Monitoring of system remarks for specific consensus actions +- Validator performance calculation and updates +- Support for querying consensus history and network statistics + +## Running the Project + +To run this project locally: + +1. Ensure you have Node.js and Docker installed on your system. +2. Clone the repository: `git clone https://github.com/autonomys/astral.git` +3. Navigate to the project directory: `cd astral/indexers/consensus` +4. Install dependencies: `yarn install` +5. Start the project: `yarn dev` + +This will start the SubQuery node, PostgreSQL database, and GraphQL query service. + +## Querying the Data + +Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/files/package.json b/indexers/files/package.json new file mode 100644 index 000000000..3f0e44fad --- /dev/null +++ b/indexers/files/package.json @@ -0,0 +1,57 @@ +{ + "name": "files", + "version": "1.0.0", + "description": "Autonomys Network - Files", + "main": "dist/index.js", + "scripts": { + "build": "subql codegen && subql build", + "codegen": "subql codegen", + "start:docker": "docker-compose pull && docker-compose up --remove-orphans", + "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", + "prepack": "rm -rf dist && npm run build", + "test": "subql build && subql-node test", + "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" + }, + "homepage": "https://github.com/autonomys/astral", + "files": [ + "dist", + "schema.graphql", + "project.yaml" + ], + "repository": { + "type": "git", + "url": "https://github.com/autonomys/astral" + }, + "author": { + "name": "Autonomys", + "url": "https://www.autonomys.xyz" + }, + "bugs": { + "url": "https://github.com/autonomys/astral/issues" + }, + "license": "MIT", + "devDependencies": { + "@apollo/client": "^3.7.16", + "@autonomys/auto-dag-data": "^1.2.1", + "@autonomys/auto-utils": "^1.2.1", + "@polkadot/api": "^12.4.2", + "@polkadot/types": "^14.1.1", + "@polkadot/util": "^13.2.2", + "@polkadot/util-crypto": "^13.2.2", + "@subql/cli": "^5.4.0", + "@subql/common-substrate": "^4.3.5", + "@subql/node": "^5.6.0", + "@subql/types": "^3.11.4", + "@types/node": "^22.9.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "dotenv": "^16.4.5", + "graphql": "^16.9.0", + "prom-client": "^14.2.0", + "rxjs": "^7.8.1", + "typescript": "^5.2.2" + }, + "resolutions": { + "ipfs-unixfs": "6.0.6" + } +} diff --git a/indexers/files/project.ts b/indexers/files/project.ts new file mode 100644 index 000000000..489656158 --- /dev/null +++ b/indexers/files/project.ts @@ -0,0 +1,95 @@ +import { + SubstrateDatasourceKind, + SubstrateHandlerKind, + SubstrateProject, +} from "@subql/types"; +import * as dotenv from "dotenv"; +import path from "path"; + +// Load the appropriate .env file +const dotenvPath = path.resolve(__dirname, `../../../.env`); +dotenv.config({ path: dotenvPath }); + +// Can expand the Datasource processor types via the genreic param +const project: SubstrateProject = { + specVersion: "1.0.0", + version: "0.0.1", + name: "autonomys-files", + description: "Autonomys Network - Files", + repository: "https://github.com/autonomys/astral", + runner: { + node: { + name: "@subql/node", + version: ">=5.2.9", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /* The genesis hash of the network (hash of block 0) */ + chainId: process.env.CHAIN_ID!, + /** + * These endpoint(s) should be public non-pruned archive node + * We recommend providing more than one endpoint for improved reliability, performance, and uptime + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters + * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited + */ + endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, + // @ts-ignore + types: { + Solution: { + public_key: "AccountId32", + reward_address: "AccountId32", + }, + SubPreDigest: { + slot: "u64", + solution: "Solution", + }, + }, + }, + dataSources: [ + { + kind: SubstrateDatasourceKind.Runtime, + startBlock: 1, + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: SubstrateHandlerKind.Call, + handler: "handleCall", + filter: { + module: "historySeeding", + method: "seedHistory", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleCall", + filter: { + module: "system", + method: "remarkWithEvent", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleCall", + filter: { + module: "system", + method: "remark", + }, + }, + ], + }, + }, + ], +}; + +// Must set default to the project instance +export default project; diff --git a/indexers/files/schema.graphql b/indexers/files/schema.graphql new file mode 100644 index 000000000..f0248cc0f --- /dev/null +++ b/indexers/files/schema.graphql @@ -0,0 +1,67 @@ +type Cid @entity { + id: ID! + blockHeight: BigInt! @index + blockHash: String! @index + extrinsicId: String! @index + extrinsicHash: String! @index + indexInBlock: Int! @index + links: [String]! + timestamp: Date! @index +} + +type Chunk @entity { + id: ID! + type: String! @index + linkDepth: Int! @index + size: BigInt + name: String + data: String + uploadOptions: String +} + +type Metadata @entity { + id: ID! + size: BigInt! @index + name: String @index +} + +type MetadataCid @entity { + id: ID! + parentCid: String! @index + childCid: String! @index +} + +type Folder @entity { + id: ID! + size: BigInt! @index + name: String @index +} + +type FolderCid @entity { + id: ID! + parentCid: String! @index + childCid: String! @index +} + +type File @entity { + id: ID! + size: BigInt! @index + name: String @index +} + +type FileCid @entity { + id: ID! + parentCid: String! @index + childCid: String! @index +} + +type Error @entity { + id: ID! + blockHeight: BigInt! @index + blockHash: String! @index + extrinsicId: String! @index + extrinsicHash: String! @index + indexInBlock: Int! @index + error: String! + timestamp: Date! @index +} diff --git a/indexers/files/src/index.ts b/indexers/files/src/index.ts new file mode 100644 index 000000000..509161575 --- /dev/null +++ b/indexers/files/src/index.ts @@ -0,0 +1,3 @@ +//Exports all handler functions +export * from "./mappings/mappingHandlers"; +import "@polkadot/api-augment"; diff --git a/indexers/files/src/mappings/db.ts b/indexers/files/src/mappings/db.ts new file mode 100644 index 000000000..344c6f10b --- /dev/null +++ b/indexers/files/src/mappings/db.ts @@ -0,0 +1,146 @@ +import { + Chunk, + Cid, + Error, + File, + FileCid, + Folder, + FolderCid, + Metadata, + MetadataCid, +} from "../types"; + +export async function createAndSaveCid( + cid: string, + blockHeight: bigint, + blockHash: string, + extrinsicId: string, + extrinsicHash: string, + indexInBlock: number, + links: string[], + timestamp: Date +): Promise { + const _cid = Cid.create({ + id: cid, + blockHeight, + blockHash, + extrinsicId, + extrinsicHash, + indexInBlock, + links, + timestamp, + }); + await _cid.save(); + return _cid; +} + +export async function createAndSaveChunk( + cid: string, + type: string, + linkDepth: number, + size?: bigint, + name?: string, + data?: string, + uploadOptions?: string +): Promise { + const chunk = Chunk.create({ + id: cid, + type, + linkDepth, + size, + name, + data, + uploadOptions, + }); + await chunk.save(); + return chunk; +} + +const prepareRelation = (cid: string, link: string) => ({ + id: `${cid}:${link}`, + parentCid: cid, + childCid: link, +}); + +export async function createAndSaveMetadata( + cid: string, + links: string[], + name?: string +): Promise { + const metadata = Metadata.create({ + id: cid, + size: BigInt(0), + name, + }); + await metadata.save(); + if (links.length > 0) { + const relations = links.map((link) => + MetadataCid.create(prepareRelation(cid, link)) + ); + await Promise.all(relations.map((relation) => relation.save())); + } + return metadata; +} + +export async function createAndSaveFolder( + cid: string, + links: string[], + name?: string +): Promise { + const folder = Folder.create({ + id: cid, + size: BigInt(0), + name, + }); + await folder.save(); + if (links.length > 0) { + const relations = links.map((link) => + FolderCid.create(prepareRelation(cid, link)) + ); + await Promise.all(relations.map((relation) => relation.save())); + } + return folder; +} + +export async function createAndSaveFile( + cid: string, + links: string[], + name?: string +): Promise { + const file = File.create({ + id: cid, + size: BigInt(0), + name, + }); + await file.save(); + if (links.length > 0) { + const relations = links.map((link) => + FileCid.create(prepareRelation(cid, link)) + ); + await Promise.all(relations.map((relation) => relation.save())); + } + return file; +} + +export async function createAndSaveError( + blockHeight: bigint, + blockHash: string, + extrinsicId: string, + extrinsicHash: string, + indexInBlock: number, + error: string, + timestamp: Date +): Promise { + const _error = Error.create({ + id: extrinsicId, + blockHeight, + blockHash, + extrinsicId, + extrinsicHash, + indexInBlock, + error, + timestamp, + }); + await _error.save(); + return _error; +} diff --git a/indexers/files/src/mappings/mappingHandlers.ts b/indexers/files/src/mappings/mappingHandlers.ts new file mode 100644 index 000000000..17f13a9a8 --- /dev/null +++ b/indexers/files/src/mappings/mappingHandlers.ts @@ -0,0 +1,139 @@ +global.TextEncoder = require("util").TextEncoder; +global.TextDecoder = require("util").TextDecoder; +global.Buffer = require("buffer/").Buffer; + +import { + cidOfNode, + cidToString, + decodeNode, + IPLDNodeData, + MetadataType, + PBNode, +} from "@autonomys/auto-dag-data"; +import { stringify } from "@autonomys/auto-utils"; +import { Bytes } from "@polkadot/types"; +import { compactStripLength } from "@polkadot/util"; +import { SubstrateExtrinsic } from "@subql/types"; +import { + createAndSaveChunk, + createAndSaveCid, + createAndSaveError, + createAndSaveFile, + createAndSaveFolder, + createAndSaveMetadata, +} from "./db"; +import { ExtrinsicPrimitive } from "./types"; + +const hexToUint8Array = (hex: string): Uint8Array => { + if (hex.length % 2 !== 0) + throw new Error("Hex string must have an even length"); + return new Uint8Array( + hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] + ); +}; + +export async function handleCall(_call: SubstrateExtrinsic): Promise { + const { + idx, + block: { + timestamp, + block: { + header: { number, hash: blockHash }, + }, + }, + extrinsic: { method, hash }, + success, + } = _call; + // Skip if extrinsic failed + if (!success) return; + + const methodToPrimitive = method.toPrimitive() as ExtrinsicPrimitive; + try { + const data = methodToPrimitive.args.remark; + const hexString = data.startsWith("0x") ? data.slice(2) : data; + const buffer = Buffer.from(hexString, "hex"); + const [length, bytes] = compactStripLength(buffer); + const isValidLength = length === bytes.length; + let node: PBNode | null = null; + + try { + const encoded = isValidLength + ? Bytes.from(buffer) + : hexToUint8Array(data); + node = decodeNode(encoded); + } catch (error) { + node = decodeNode(buffer); + } + const cid = cidToString(cidOfNode(node)); + const links = node.Links.map((l) => cidToString(l.Hash)); + if (cid) { + await createAndSaveCid( + cid, + BigInt(number.toString()), + blockHash.toString(), + `${number}-${idx}`, + hash.toString(), + idx, + links, + timestamp ? timestamp : new Date(0) + ); + + if (node.Data) { + const nodeData = IPLDNodeData.decode(node.Data); + let stringifyData = ""; + try { + const data = JSON.parse(stringify(nodeData.data)).data; + if (!data) throw new Error("Data is null"); + + const dataAsArrayBuffer = new Uint8Array(data); + stringifyData = stringify(dataAsArrayBuffer); + } catch { + stringifyData = stringify(nodeData.data); + } + await createAndSaveChunk( + cid, + nodeData.type, + nodeData.linkDepth, + nodeData.size, + nodeData.name, + stringifyData, + stringify(nodeData.uploadOptions) + ); + + switch (nodeData.type) { + case MetadataType.Metadata: + await createAndSaveMetadata(cid, links, nodeData.name); + break; + case MetadataType.Folder: + await createAndSaveFolder(cid, links, nodeData.name); + break; + case MetadataType.File: + await createAndSaveFile(cid, links, nodeData.name); + break; + // Skip inlinks and chunks as they are already saved in chunks table + case MetadataType.FileInlink: + case MetadataType.FileChunk: + case MetadataType.FolderInlink: + case MetadataType.MetadataInlink: + case MetadataType.MetadataChunk: + break; + default: + logger.warn(`Unknown node type: ${nodeData.type} for cid: ${cid}`); + break; + } + } + } + } catch (error: any) { + logger.error("Error decoding remark or seedHistory extrinsic"); + logger.error(error); + await createAndSaveError( + BigInt(number.toString()), + blockHash.toString(), + `${number}-${idx}`, + hash.toString(), + idx, + stringify(error), + timestamp ? timestamp : new Date(0) + ); + } +} diff --git a/indexers/files/src/mappings/types.ts b/indexers/files/src/mappings/types.ts new file mode 100644 index 000000000..85c656081 --- /dev/null +++ b/indexers/files/src/mappings/types.ts @@ -0,0 +1,9 @@ +export type ExtrinsicPrimitive = { + callIndex: string; + args: any; +}; + +export type ExtrinsicHuman = ExtrinsicPrimitive & { + method: string; + section: string; +}; diff --git a/indexers/files/tsconfig.json b/indexers/files/tsconfig.json new file mode 100644 index 000000000..3d926b019 --- /dev/null +++ b/indexers/files/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "declaration": true, + "importHelpers": true, + "resolveJsonModule": true, + "module": "commonjs", + "outDir": "dist", + "rootDir": "src", + "target": "es2017", + "strict": true + }, + "include": [ + "src/**/*", + "../node_modules/@subql/types-core/dist/global.d.d.ts", + "../node_modules/@subql/types/dist/global.d.ts" + ] +} From 00012a1ae80a420c6f7e739fb04b3b0db10d2ea1 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:39:20 -0500 Subject: [PATCH 3/8] move mainnet/leaderboard one level down --- indexers/leaderboard/.gitignore | 62 ++ indexers/leaderboard/LICENSE | 21 + indexers/leaderboard/README.md | 42 ++ indexers/leaderboard/package.json | 55 ++ indexers/leaderboard/project.ts | 63 ++ indexers/leaderboard/schema.graphql | 247 +++++++ indexers/leaderboard/src/index.ts | 3 + indexers/leaderboard/src/mappings/db.ts | 612 ++++++++++++++++++ .../src/mappings/mappingHandlers.ts | 423 ++++++++++++ indexers/leaderboard/tsconfig.json | 20 + 10 files changed, 1548 insertions(+) create mode 100644 indexers/leaderboard/.gitignore create mode 100644 indexers/leaderboard/LICENSE create mode 100644 indexers/leaderboard/README.md create mode 100644 indexers/leaderboard/package.json create mode 100644 indexers/leaderboard/project.ts create mode 100644 indexers/leaderboard/schema.graphql create mode 100644 indexers/leaderboard/src/index.ts create mode 100644 indexers/leaderboard/src/mappings/db.ts create mode 100644 indexers/leaderboard/src/mappings/mappingHandlers.ts create mode 100644 indexers/leaderboard/tsconfig.json diff --git a/indexers/leaderboard/.gitignore b/indexers/leaderboard/.gitignore new file mode 100644 index 000000000..36045d79b --- /dev/null +++ b/indexers/leaderboard/.gitignore @@ -0,0 +1,62 @@ +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# lock files +yarn.lock +package-lock.json + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Generated files +target/ +dist/ +src/types +project.yaml + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +.data +.eslintcache + +# ENV local files +.env.local +.env.develop.local \ No newline at end of file diff --git a/indexers/leaderboard/LICENSE b/indexers/leaderboard/LICENSE new file mode 100644 index 000000000..f168fbe14 --- /dev/null +++ b/indexers/leaderboard/LICENSE @@ -0,0 +1,21 @@ +MIT LICENSE + +Copyright 2020-2024 SubQuery Pte Ltd authors & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/indexers/leaderboard/README.md b/indexers/leaderboard/README.md new file mode 100644 index 000000000..19e680c4a --- /dev/null +++ b/indexers/leaderboard/README.md @@ -0,0 +1,42 @@ +# Autonomys Astral Explorer Leaderboard + +The Autonomys Astral Explorer Leaderboard is a specialized SubQuery project that indexes all asset transfers and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the leaderboard functionality for the Astral Explorer, providing real-time data on user activities and rankings. + +## Overview + +This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: + +1. Indexing all asset transfers using the balances pallet +2. Capturing system remarks for additional user actions +3. Calculating and updating user scores based on various activities + +## Project Structure + +The project consists of the following key components: + +- `project.ts`: Defines the project configuration, including network endpoints and data sources. +- `schema.graphql`: Outlines the data structure for transfers, accounts, and leaderboard entries. +- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. + +## Key Features + +- Real-time tracking of asset transfers +- Monitoring of system remarks for specific user actions +- Leaderboard score calculation and updates +- Support for querying transfer history and account statistics + +## Running the Project + +To run this project locally: + +1. Ensure you have Node.js and Docker installed on your system. +2. Clone the repository: `git clone https://github.com/autonomys/astral.git` +3. Navigate to the project directory: `cd astral/indexers/leaderboard` +4. Install dependencies: `yarn install` +5. Start the project: `yarn dev` + +This will start the SubQuery node, PostgreSQL database, and GraphQL query service. + +## Querying the Data + +Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/leaderboard/package.json b/indexers/leaderboard/package.json new file mode 100644 index 000000000..945576a45 --- /dev/null +++ b/indexers/leaderboard/package.json @@ -0,0 +1,55 @@ +{ + "name": "leaderboard", + "version": "1.0.0", + "description": "Autonomys Network - Leaderboard", + "main": "dist/index.js", + "scripts": { + "build": "subql codegen && subql build", + "codegen": "subql codegen", + "start:docker": "docker-compose pull && docker-compose up --remove-orphans", + "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", + "prepack": "rm -rf dist && npm run build", + "test": "subql build && subql-node test", + "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" + }, + "homepage": "https://github.com/autonomys/astral", + "files": [ + "dist", + "schema.graphql", + "project.yaml" + ], + "repository": { + "type": "git", + "url": "https://github.com/autonomys/astral" + }, + "author": { + "name": "Autonomys", + "url": "https://www.autonomys.xyz" + }, + "bugs": { + "url": "https://github.com/autonomys/astral/issues" + }, + "license": "MIT", + "devDependencies": { + "@apollo/client": "^3.7.16", + "@polkadot/api": "^12.4.2", + "@polkadot/types": "^14.1.1", + "@polkadot/util": "^13.2.2", + "@polkadot/util-crypto": "^13.2.2", + "@subql/cli": "^5.4.0", + "@subql/common-substrate": "^4.3.5", + "@subql/node": "^5.6.0", + "@subql/types": "^3.11.4", + "@types/node": "^22.9.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "dotenv": "^16.4.5", + "graphql": "^16.9.0", + "prom-client": "^14.2.0", + "rxjs": "^7.8.1", + "typescript": "^5.2.2" + }, + "resolutions": { + "ipfs-unixfs": "6.0.6" + } +} diff --git a/indexers/leaderboard/project.ts b/indexers/leaderboard/project.ts new file mode 100644 index 000000000..a32a12c04 --- /dev/null +++ b/indexers/leaderboard/project.ts @@ -0,0 +1,63 @@ +import { + SubstrateDatasourceKind, + SubstrateHandlerKind, + SubstrateProject, +} from "@subql/types"; +import * as dotenv from "dotenv"; +import path from "path"; +// Load the appropriate .env file +const dotenvPath = path.resolve(__dirname, `../../../.env`); +dotenv.config({ path: dotenvPath }); + +// Can expand the Datasource processor types via the genreic param +const project: SubstrateProject = { + specVersion: "1.0.0", + version: "0.0.1", + name: "autonomys-leaderboard", + description: "Autonomys Network - Leaderboard", + runner: { + node: { + name: "@subql/node", + version: ">=5.2.9", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /* The genesis hash of the network (hash of block 0) */ + chainId: process.env.CHAIN_ID!, + /** + * These endpoint(s) should be public non-pruned archive node + * We recommend providing more than one endpoint for improved reliability, performance, and uptime + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters + * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited + */ + endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, + dictionary: process.env.DICTIONARY_URL!, + }, + dataSources: [ + { + kind: SubstrateDatasourceKind.Runtime, + startBlock: 1, + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: SubstrateHandlerKind.Block, + handler: "handleBlock", + }, + ], + }, + }, + ], +}; + +// Must set default to the project instance +export default project; diff --git a/indexers/leaderboard/schema.graphql b/indexers/leaderboard/schema.graphql new file mode 100644 index 000000000..41789f17d --- /dev/null +++ b/indexers/leaderboard/schema.graphql @@ -0,0 +1,247 @@ +# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by +# Add the `@index` or `@index(unique: true)` annotation after any non-key field +# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field + +# account +type AccountTransferSenderTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountTransferSenderTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountTransferReceiverTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountTransferReceiverTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountRemarkCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountExtrinsicTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountExtrinsicSuccessTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountExtrinsicFailedTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type AccountTransactionFeePaidTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +# farmer +type FarmerVoteTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type FarmerVoteTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type FarmerBlockTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type FarmerBlockTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type FarmerVoteAndBlockTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type FarmerVoteAndBlockTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +# operator +type OperatorTotalRewardsCollectedHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type OperatorTotalTaxCollectedHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type OperatorBundleTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type OperatorDepositsTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type OperatorDepositsTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type OperatorWithdrawalsTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +# nominator/account +type NominatorDepositsTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type NominatorDepositsTotalValueHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} + +type NominatorWithdrawalsTotalCountHistory @entity { + id: ID! + accountId: String! @index + value: BigInt! @index + lastContributionAt: Date! + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! +} diff --git a/indexers/leaderboard/src/index.ts b/indexers/leaderboard/src/index.ts new file mode 100644 index 000000000..509161575 --- /dev/null +++ b/indexers/leaderboard/src/index.ts @@ -0,0 +1,3 @@ +//Exports all handler functions +export * from "./mappings/mappingHandlers"; +import "@polkadot/api-augment"; diff --git a/indexers/leaderboard/src/mappings/db.ts b/indexers/leaderboard/src/mappings/db.ts new file mode 100644 index 000000000..4b81d2e8c --- /dev/null +++ b/indexers/leaderboard/src/mappings/db.ts @@ -0,0 +1,612 @@ +import { + AccountExtrinsicFailedTotalCountHistory, + AccountExtrinsicSuccessTotalCountHistory, + AccountExtrinsicTotalCountHistory, + AccountRemarkCountHistory, + AccountTransactionFeePaidTotalValueHistory, + AccountTransferReceiverTotalCountHistory, + AccountTransferReceiverTotalValueHistory, + AccountTransferSenderTotalCountHistory, + AccountTransferSenderTotalValueHistory, + FarmerBlockTotalCountHistory, + FarmerBlockTotalValueHistory, + FarmerVoteAndBlockTotalCountHistory, + FarmerVoteAndBlockTotalValueHistory, + FarmerVoteTotalCountHistory, + FarmerVoteTotalValueHistory, + NominatorDepositsTotalCountHistory, + NominatorDepositsTotalValueHistory, + NominatorWithdrawalsTotalCountHistory, + OperatorBundleTotalCountHistory, + OperatorDepositsTotalCountHistory, + OperatorDepositsTotalValueHistory, + OperatorTotalRewardsCollectedHistory, + OperatorTotalTaxCollectedHistory, + OperatorWithdrawalsTotalCountHistory, +} from "../types"; + +type Cache = { + accountExtrinsicFailedTotalCountHistory: AccountExtrinsicFailedTotalCountHistory[]; + accountExtrinsicSuccessTotalCountHistory: AccountExtrinsicSuccessTotalCountHistory[]; + accountExtrinsicTotalCountHistory: AccountExtrinsicTotalCountHistory[]; + accountRemarkCountHistory: AccountRemarkCountHistory[]; + accountTransactionFeePaidTotalValueHistory: AccountTransactionFeePaidTotalValueHistory[]; + accountTransferReceiverTotalCountHistory: AccountTransferReceiverTotalCountHistory[]; + accountTransferReceiverTotalValueHistory: AccountTransferReceiverTotalValueHistory[]; + accountTransferSenderTotalCountHistory: AccountTransferSenderTotalCountHistory[]; + accountTransferSenderTotalValueHistory: AccountTransferSenderTotalValueHistory[]; + farmerBlockTotalCountHistory: FarmerBlockTotalCountHistory[]; + farmerBlockTotalValueHistory: FarmerBlockTotalValueHistory[]; + farmerVoteAndBlockTotalCountHistory: FarmerVoteAndBlockTotalCountHistory[]; + farmerVoteAndBlockTotalValueHistory: FarmerVoteAndBlockTotalValueHistory[]; + farmerVoteTotalCountHistory: FarmerVoteTotalCountHistory[]; + farmerVoteTotalValueHistory: FarmerVoteTotalValueHistory[]; + nominatorDepositsTotalCountHistory: NominatorDepositsTotalCountHistory[]; + nominatorDepositsTotalValueHistory: NominatorDepositsTotalValueHistory[]; + nominatorWithdrawalsTotalCountHistory: NominatorWithdrawalsTotalCountHistory[]; + operatorBundleTotalCountHistory: OperatorBundleTotalCountHistory[]; + operatorDepositsTotalCountHistory: OperatorDepositsTotalCountHistory[]; + operatorDepositsTotalValueHistory: OperatorDepositsTotalValueHistory[]; + operatorTotalRewardsCollectedHistory: OperatorTotalRewardsCollectedHistory[]; + operatorTotalTaxCollectedHistory: OperatorTotalTaxCollectedHistory[]; + operatorWithdrawalsTotalCountHistory: OperatorWithdrawalsTotalCountHistory[]; +}; + +export const initializeCache = (): Cache => ({ + accountExtrinsicFailedTotalCountHistory: [], + accountExtrinsicSuccessTotalCountHistory: [], + accountExtrinsicTotalCountHistory: [], + accountRemarkCountHistory: [], + accountTransactionFeePaidTotalValueHistory: [], + accountTransferReceiverTotalCountHistory: [], + accountTransferReceiverTotalValueHistory: [], + accountTransferSenderTotalCountHistory: [], + accountTransferSenderTotalValueHistory: [], + farmerBlockTotalCountHistory: [], + farmerBlockTotalValueHistory: [], + farmerVoteAndBlockTotalCountHistory: [], + farmerVoteAndBlockTotalValueHistory: [], + farmerVoteTotalCountHistory: [], + farmerVoteTotalValueHistory: [], + nominatorDepositsTotalCountHistory: [], + nominatorDepositsTotalValueHistory: [], + nominatorWithdrawalsTotalCountHistory: [], + operatorBundleTotalCountHistory: [], + operatorDepositsTotalCountHistory: [], + operatorDepositsTotalValueHistory: [], + operatorTotalRewardsCollectedHistory: [], + operatorTotalTaxCollectedHistory: [], + operatorWithdrawalsTotalCountHistory: [], +}); + +export const saveCache = async (cache: Cache) => { + await Promise.all( + cache.accountTransferSenderTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountTransferReceiverTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountTransferSenderTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountTransferReceiverTotalValueHistory.map((item) => item.save()) + ); + await Promise.all(cache.accountRemarkCountHistory.map((item) => item.save())); + await Promise.all( + cache.accountExtrinsicTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountExtrinsicSuccessTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountExtrinsicFailedTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.accountTransactionFeePaidTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerVoteTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerVoteTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerBlockTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerBlockTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerVoteAndBlockTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.farmerVoteAndBlockTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.nominatorDepositsTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.nominatorDepositsTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.nominatorWithdrawalsTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorBundleTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorDepositsTotalCountHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorDepositsTotalValueHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorTotalRewardsCollectedHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorTotalTaxCollectedHistory.map((item) => item.save()) + ); + await Promise.all( + cache.operatorWithdrawalsTotalCountHistory.map((item) => item.save()) + ); +}; + +export function createAccountTransferSenderTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountTransferSenderTotalCountHistory { + return AccountTransferSenderTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountTransferSenderTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountTransferSenderTotalValueHistory { + return AccountTransferSenderTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountTransferReceiverTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountTransferReceiverTotalCountHistory { + return AccountTransferReceiverTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountTransferReceiverTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountTransferReceiverTotalValueHistory { + return AccountTransferReceiverTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountRemarkCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountRemarkCountHistory { + return AccountRemarkCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountExtrinsicTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountExtrinsicTotalCountHistory { + return AccountExtrinsicTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountExtrinsicSuccessTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountExtrinsicSuccessTotalCountHistory { + return AccountExtrinsicSuccessTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountExtrinsicFailedTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountExtrinsicFailedTotalCountHistory { + return AccountExtrinsicFailedTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createAccountTransactionFeePaidTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): AccountTransactionFeePaidTotalValueHistory { + return AccountTransactionFeePaidTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +// Farmer entities +export function createFarmerVoteTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerVoteTotalCountHistory { + return FarmerVoteTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createFarmerVoteTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerVoteTotalValueHistory { + return FarmerVoteTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createFarmerBlockTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerBlockTotalCountHistory { + return FarmerBlockTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createFarmerBlockTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerBlockTotalValueHistory { + return FarmerBlockTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createFarmerVoteAndBlockTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerVoteAndBlockTotalCountHistory { + return FarmerVoteAndBlockTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createFarmerVoteAndBlockTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): FarmerVoteAndBlockTotalValueHistory { + return FarmerVoteAndBlockTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +// Operator entities +export function createOperatorTotalRewardsCollected( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorTotalRewardsCollectedHistory { + return OperatorTotalRewardsCollectedHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createOperatorTotalTaxCollected( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorTotalTaxCollectedHistory { + return OperatorTotalTaxCollectedHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createOperatorBundleTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorBundleTotalCountHistory { + return OperatorBundleTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createOperatorDepositsTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorDepositsTotalCountHistory { + return OperatorDepositsTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createOperatorDepositsTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorDepositsTotalValueHistory { + return OperatorDepositsTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createOperatorWithdrawalsTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): OperatorWithdrawalsTotalCountHistory { + return OperatorWithdrawalsTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +// Nominator entities +export function createNominatorDepositsTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): NominatorDepositsTotalCountHistory { + return NominatorDepositsTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createNominatorDepositsTotalValue( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): NominatorDepositsTotalValueHistory { + return NominatorDepositsTotalValueHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} + +export function createNominatorWithdrawalsTotalCount( + accountId: string, + value: bigint, + blockHeight: bigint, + extrinsicId: string, + eventId: string, + lastContributionAt: Date = new Date() +): NominatorWithdrawalsTotalCountHistory { + return NominatorWithdrawalsTotalCountHistory.create({ + id: `${accountId}-${extrinsicId}-${eventId}`, + accountId, + value, + lastContributionAt, + blockHeight, + extrinsicId, + eventId, + }); +} diff --git a/indexers/leaderboard/src/mappings/mappingHandlers.ts b/indexers/leaderboard/src/mappings/mappingHandlers.ts new file mode 100644 index 000000000..14d9b6f65 --- /dev/null +++ b/indexers/leaderboard/src/mappings/mappingHandlers.ts @@ -0,0 +1,423 @@ +import { SubstrateBlock } from "@subql/types"; +import * as db from "./db"; + +export async function handleBlock(_block: SubstrateBlock): Promise { + const { + block: { + header: { number }, + extrinsics, + }, + timestamp, + events, + } = _block; + const height = BigInt(number.toString()); + + let cache = db.initializeCache(); + let eventIndex = 0; + + // Process extrinsics + extrinsics.forEach((extrinsic, extrinsicIdx) => { + const extrinsicEvents = events.filter( + (e) => + e.phase.isApplyExtrinsic && + e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx + ); + const successEvent = events.find( + (e) => + e.event.section === "system" && e.event.method === "ExtrinsicSuccess" + ); + const successEventId = events.findIndex( + (e) => + e.event.section === "system" && e.event.method === "ExtrinsicSuccess" + ); + const extrinsicId = extrinsic ? height + "-" + extrinsicIdx.toString() : ""; + const extrinsicSigner = extrinsic.signer.toString(); + + cache.accountExtrinsicTotalCountHistory.push( + db.createAccountExtrinsicTotalCount( + extrinsicSigner, + BigInt(1), + height, + extrinsicId, + height + "-" + successEventId.toString(), + timestamp + ) + ); + if (successEvent) { + cache.accountExtrinsicSuccessTotalCountHistory.push( + db.createAccountExtrinsicSuccessTotalCount( + extrinsicSigner, + BigInt(1), + height, + extrinsicId, + height + "-" + successEventId.toString(), + timestamp + ) + ); + + // Process specific extrinsic + switch (`${extrinsic.method.section}.${extrinsic.method.method}`) { + case "system.remark": + case "system.remarkWithEvent": { + cache.accountRemarkCountHistory.push( + db.createAccountRemarkCount( + extrinsicSigner, + BigInt(1), + height, + extrinsicId, + "", + timestamp + ) + ); + break; + } + } + + // Process extrinsic events + extrinsicEvents.forEach((event, eventIdx) => { + const eventId = height + "-" + eventIndex; + + // Process specific events + switch (`${event.event.section}.${event.event.method}`) { + case "balances.Transfer": { + const from = event.event.data[0].toString(); + const to = event.event.data[1].toString(); + const amount = BigInt(event.event.data[2].toString()); + + cache.accountTransferSenderTotalCountHistory.push( + db.createAccountTransferSenderTotalCount( + from, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.accountTransferSenderTotalValueHistory.push( + db.createAccountTransferSenderTotalValue( + from, + amount, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + cache.accountTransferReceiverTotalCountHistory.push( + db.createAccountTransferReceiverTotalCount( + to, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.accountTransferReceiverTotalValueHistory.push( + db.createAccountTransferReceiverTotalValue( + to, + amount, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "transactionPayment.TransactionFeePaid": { + const who = event.event.data[0].toString(); + const actualFee = BigInt(event.event.data[1].toString()); + const tip = BigInt(event.event.data[2].toString()); + + cache.accountTransactionFeePaidTotalValueHistory.push( + db.createAccountTransactionFeePaidTotalValue( + who, + actualFee + tip, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "domains.OperatorRewarded": { + const operatorId = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + if (reward === BigInt(0)) break; + + cache.operatorTotalRewardsCollectedHistory.push( + db.createOperatorTotalRewardsCollected( + operatorId, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "domains.OperatorTaxCollected": { + const operatorId = event.event.data[0].toString(); + const tax = BigInt(event.event.data[1].toString()); + + cache.operatorTotalTaxCollectedHistory.push( + db.createOperatorTotalTaxCollected( + operatorId, + tax, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + break; + } + case "domains.BundleStored": { + const bundleAuthor = event.event.data[0].toString(); + + cache.operatorBundleTotalCountHistory.push( + db.createOperatorBundleTotalCount( + bundleAuthor, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "domains.OperatorRegistered": { + const operatorId = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + + cache.operatorTotalRewardsCollectedHistory.push( + db.createOperatorTotalRewardsCollected( + operatorId, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "domains.OperatorNominated": { + const operatorId = event.event.data[0].toString(); + const nominatorId = event.event.data[1].toString(); + const amount = BigInt(event.event.data[2].toString()); + + cache.operatorDepositsTotalCountHistory.push( + db.createOperatorDepositsTotalCount( + operatorId, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.operatorDepositsTotalValueHistory.push( + db.createOperatorDepositsTotalValue( + operatorId, + amount, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + cache.nominatorDepositsTotalCountHistory.push( + db.createNominatorDepositsTotalCount( + nominatorId, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.nominatorDepositsTotalValueHistory.push( + db.createNominatorDepositsTotalValue( + nominatorId, + amount, + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + case "domains.WithdrewStake": { + const operatorId = event.event.data[0].toString(); + const nominatorId = event.event.data[1].toString(); + + cache.operatorWithdrawalsTotalCountHistory.push( + db.createOperatorWithdrawalsTotalCount( + operatorId, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.nominatorWithdrawalsTotalCountHistory.push( + db.createNominatorWithdrawalsTotalCount( + nominatorId, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + break; + } + default: + break; + } + + // Increment event index + eventIndex++; + }); + } else { + // Process fail extrinsic + cache.accountExtrinsicFailedTotalCountHistory.push( + db.createAccountExtrinsicFailedTotalCount( + extrinsicSigner, + BigInt(1), + height, + extrinsicId, + height + "-" + successEventId.toString(), + timestamp + ) + ); + } + }); + + const finalizationEvents = events.filter((e) => e.phase.isFinalization); + + // Process finalization events + finalizationEvents.forEach((event) => { + const extrinsicId = height + "-" + event.phase.type; // AKA (blockHeight-Finalization) + const eventId = height + "-" + eventIndex; + + // Process specific events + switch (`${event.event.section}.${event.event.method}`) { + case "rewards.VoteReward": { + const voter = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + + cache.farmerVoteTotalCountHistory.push( + db.createFarmerVoteTotalCount( + voter, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.farmerVoteTotalValueHistory.push( + db.createFarmerVoteTotalValue( + voter, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + cache.farmerVoteAndBlockTotalCountHistory.push( + db.createFarmerVoteAndBlockTotalCount( + voter, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.farmerVoteAndBlockTotalValueHistory.push( + db.createFarmerVoteAndBlockTotalValue( + voter, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + break; + } + case "rewards.BlockReward": { + const blockAuthor = event.event.data[0].toString(); + const reward = BigInt(event.event.data[1].toString()); + + cache.farmerBlockTotalCountHistory.push( + db.createFarmerBlockTotalCount( + blockAuthor, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.farmerBlockTotalValueHistory.push( + db.createFarmerBlockTotalValue( + blockAuthor, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + cache.farmerVoteAndBlockTotalCountHistory.push( + db.createFarmerVoteAndBlockTotalCount( + blockAuthor, + BigInt(1), + height, + extrinsicId, + eventId, + timestamp + ) + ); + cache.farmerVoteAndBlockTotalValueHistory.push( + db.createFarmerVoteAndBlockTotalValue( + blockAuthor, + reward, + height, + extrinsicId, + eventId, + timestamp + ) + ); + + break; + } + default: + break; + } + + // Increment event index + eventIndex++; + }); + + // Save cache + await db.saveCache(cache); +} diff --git a/indexers/leaderboard/tsconfig.json b/indexers/leaderboard/tsconfig.json new file mode 100644 index 000000000..fe36b561c --- /dev/null +++ b/indexers/leaderboard/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "declaration": true, + "importHelpers": true, + "resolveJsonModule": true, + "module": "commonjs", + "outDir": "dist", + "rootDir": "src", + "target": "es2017", + "strict": true + }, + "include": [ + "src/**/*", + "../node_modules/@subql/types-core/dist/global.d.ts", + "../node_modules/@subql/types/dist/global.d.ts" + ] +} From fa8a4515b0c9cc489537fe693a4a746c70842c3d Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:39:45 -0500 Subject: [PATCH 4/8] move mainnet/staking one level down --- indexers/staking/.gitignore | 62 + indexers/staking/LICENSE | 21 + indexers/staking/README.md | 42 + indexers/staking/package.json | 55 + indexers/staking/project.ts | 255 ++++ indexers/staking/schema.graphql | 387 ++++++ indexers/staking/src/index.ts | 3 + indexers/staking/src/mappings/constants.ts | 1 + indexers/staking/src/mappings/db.ts | 566 +++++++++ .../staking/src/mappings/mappingHandlers.ts | 1114 +++++++++++++++++ indexers/staking/src/mappings/models.ts | 49 + indexers/staking/src/mappings/types.ts | 123 ++ indexers/staking/tsconfig.json | 20 + 13 files changed, 2698 insertions(+) create mode 100644 indexers/staking/.gitignore create mode 100644 indexers/staking/LICENSE create mode 100644 indexers/staking/README.md create mode 100644 indexers/staking/package.json create mode 100644 indexers/staking/project.ts create mode 100644 indexers/staking/schema.graphql create mode 100644 indexers/staking/src/index.ts create mode 100644 indexers/staking/src/mappings/constants.ts create mode 100644 indexers/staking/src/mappings/db.ts create mode 100644 indexers/staking/src/mappings/mappingHandlers.ts create mode 100644 indexers/staking/src/mappings/models.ts create mode 100644 indexers/staking/src/mappings/types.ts create mode 100644 indexers/staking/tsconfig.json diff --git a/indexers/staking/.gitignore b/indexers/staking/.gitignore new file mode 100644 index 000000000..36045d79b --- /dev/null +++ b/indexers/staking/.gitignore @@ -0,0 +1,62 @@ +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# lock files +yarn.lock +package-lock.json + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Generated files +target/ +dist/ +src/types +project.yaml + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +.data +.eslintcache + +# ENV local files +.env.local +.env.develop.local \ No newline at end of file diff --git a/indexers/staking/LICENSE b/indexers/staking/LICENSE new file mode 100644 index 000000000..f168fbe14 --- /dev/null +++ b/indexers/staking/LICENSE @@ -0,0 +1,21 @@ +MIT LICENSE + +Copyright 2020-2024 SubQuery Pte Ltd authors & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/indexers/staking/README.md b/indexers/staking/README.md new file mode 100644 index 000000000..d461450b4 --- /dev/null +++ b/indexers/staking/README.md @@ -0,0 +1,42 @@ +# Autonomys Astral Explorer Staking + +The Autonomys Astral Explorer Staking is a specialized SubQuery project that indexes all staking-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the staking functionality for the Astral Explorer, providing real-time data on user staking activities and rewards. + +## Overview + +This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: + +1. Indexing all staking events using the staking pallet +2. Capturing system remarks for additional staking actions +3. Calculating and updating user staking rewards and positions + +## Project Structure + +The project consists of the following key components: + +- `project.ts`: Defines the project configuration, including network endpoints and data sources. +- `schema.graphql`: Outlines the data structure for staking events, accounts, and reward entries. +- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. + +## Key Features + +- Real-time tracking of staking events +- Monitoring of system remarks for specific staking actions +- Staking reward calculation and updates +- Support for querying staking history and account statistics + +## Running the Project + +To run this project locally: + +1. Ensure you have Node.js and Docker installed on your system. +2. Clone the repository: `git clone https://github.com/autonomys/astral.git` +3. Navigate to the project directory: `cd astral/indexers/staking` +4. Install dependencies: `yarn install` +5. Start the project: `yarn dev` + +This will start the SubQuery node, PostgreSQL database, and GraphQL query service. + +## Querying the Data + +Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/staking/package.json b/indexers/staking/package.json new file mode 100644 index 000000000..e7fe6d134 --- /dev/null +++ b/indexers/staking/package.json @@ -0,0 +1,55 @@ +{ + "name": "staking", + "version": "1.0.0", + "description": "Autonomys Network - Staking", + "main": "dist/index.js", + "scripts": { + "build": "subql codegen && subql build", + "codegen": "subql codegen", + "start:docker": "docker-compose pull && docker-compose up --remove-orphans", + "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", + "prepack": "rm -rf dist && npm run build", + "test": "subql build && subql-node test", + "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" + }, + "homepage": "https://github.com/autonomys/astral", + "files": [ + "dist", + "schema.graphql", + "project.yaml" + ], + "repository": { + "type": "git", + "url": "https://github.com/autonomys/astral" + }, + "author": { + "name": "Autonomys", + "url": "https://www.autonomys.xyz" + }, + "bugs": { + "url": "https://github.com/autonomys/astral/issues" + }, + "license": "MIT", + "devDependencies": { + "@apollo/client": "^3.7.16", + "@polkadot/api": "^12.4.2", + "@polkadot/types": "^14.1.1", + "@polkadot/util": "^13.2.2", + "@polkadot/util-crypto": "^13.2.2", + "@subql/cli": "^5.4.0", + "@subql/common-substrate": "^4.3.5", + "@subql/node": "^5.6.0", + "@subql/types": "^3.11.4", + "@types/node": "^22.9.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "dotenv": "^16.4.5", + "graphql": "^16.9.0", + "prom-client": "^14.2.0", + "rxjs": "^7.8.1", + "typescript": "^5.2.2" + }, + "resolutions": { + "ipfs-unixfs": "6.0.6" + } +} diff --git a/indexers/staking/project.ts b/indexers/staking/project.ts new file mode 100644 index 000000000..9341b731b --- /dev/null +++ b/indexers/staking/project.ts @@ -0,0 +1,255 @@ +import { + SubstrateDatasourceKind, + SubstrateHandlerKind, + SubstrateProject, +} from "@subql/types"; +import * as dotenv from "dotenv"; +import path from "path"; + +// Load the appropriate .env file +const dotenvPath = path.resolve(__dirname, `../../../.env`); +dotenv.config({ path: dotenvPath }); + +// Can expand the Datasource processor types via the genreic param +const project: SubstrateProject = { + specVersion: "1.0.0", + version: "0.0.1", + name: "autonomys-staking", + description: "Autonomys Network - Staking", + runner: { + node: { + name: "@subql/node", + version: ">=5.2.9", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /* The genesis hash of the network (hash of block 0) */ + chainId: process.env.CHAIN_ID!, + /** + * These endpoint(s) should be public non-pruned archive node + * We recommend providing more than one endpoint for improved reliability, performance, and uptime + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters + * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited + */ + endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, + dictionary: process.env.DICTIONARY_URL!, + }, + dataSources: [ + { + kind: SubstrateDatasourceKind.Runtime, + startBlock: 1, + // startBlock: 310356, // DomainInstantiated + // startBlock: 316224, // RegisterOperator + // startBlock: 346630, // domains.DomainEpochCompleted + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: SubstrateHandlerKind.Event, + handler: "handleDomainInstantiatedEvent", + filter: { + module: "domains", + method: "DomainInstantiated", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleRegisterOperatorCall", + filter: { + module: "domains", + method: "registerOperator", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleNominateOperatorCall", + filter: { + module: "domains", + method: "NominateOperator", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleDeregisterOperatorCall", + filter: { + module: "domains", + method: "DeregisterOperator", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleWithdrawStakeCall", + filter: { + module: "domains", + method: "WithdrawStake", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleUnlockFundsCall", + filter: { + module: "domains", + method: "UnlockFunds", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleUnlockOperatorCall", + filter: { + module: "domains", + method: "UnlockOperator", + }, + }, + { + kind: SubstrateHandlerKind.Call, + handler: "handleUnlockNominatorCall", + filter: { + module: "domains", + method: "UnlockNominator", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleDomainEpochCompletedEvent", + filter: { + module: "domains", + method: "DomainEpochCompleted", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleForceDomainEpochTransitionEvent", + filter: { + module: "domains", + method: "ForceDomainEpochTransition", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorRegisteredEvent", + filter: { + module: "domains", + method: "OperatorRegistered", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorDeregisteredEvent", + filter: { + module: "domains", + method: "OperatorDeregistered", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorNominatedEvent", + filter: { + module: "domains", + method: "OperatorNominated", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleWithdrewStakeEvent", + filter: { + module: "domains", + method: "WithdrewStake", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleStorageFeeDepositedEvent", + filter: { + module: "domains", + method: "StorageFeeDeposited", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleBundleStoredEvent", + filter: { + module: "domains", + method: "BundleStored", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorUnlockedEvent", + filter: { + module: "domains", + method: "OperatorUnlocked", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleFundsUnlockedEvent", + filter: { + module: "domains", + method: "FundsUnlocked", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleNominatedStakedUnlockedEvent", + filter: { + module: "domains", + method: "NominatedStakedUnlocked", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleNominatorUnlockedEvent", + filter: { + module: "domains", + method: "NominatorUnlocked", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleStorageFeeUnlockedEvent", + filter: { + module: "domains", + method: "StorageFeeUnlocked", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorRewardedEvent", + filter: { + module: "domains", + method: "OperatorRewarded", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorSlashedEvent", + filter: { + module: "domains", + method: "OperatorSlashed", + }, + }, + { + kind: SubstrateHandlerKind.Event, + handler: "handleOperatorTaxCollectedEvent", + filter: { + module: "domains", + method: "OperatorTaxCollected", + }, + }, + ], + }, + }, + ], +}; + +// Must set default to the project instance +export default project; diff --git a/indexers/staking/schema.graphql b/indexers/staking/schema.graphql new file mode 100644 index 000000000..869923cbe --- /dev/null +++ b/indexers/staking/schema.graphql @@ -0,0 +1,387 @@ +# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by +# Add the `@index` or `@index(unique: true)` annotation after any non-key field +# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field + +type Domain @entity { + id: ID! + sortId: BigInt! @index + accountId: String! @index + name: String! @index + runtimeId: Int! @index + runtime: String! + runtimeInfo: String! + completedEpoch: BigInt! @index + lastDomainBlockNumber: BigInt! @index + totalDeposits: BigInt! + totalEstimatedWithdrawals: BigInt! + totalWithdrawals: BigInt! + totalTaxCollected: BigInt! + totalRewardsCollected: BigInt! + totalTransfersIn: BigInt! + transfersInCount: BigInt! + totalTransfersOut: BigInt! + transfersOutCount: BigInt! + totalRejectedTransfersClaimed: BigInt! + rejectedTransfersClaimedCount: BigInt! + totalTransfersRejected: BigInt! + transfersRejectedCount: BigInt! + totalVolume: BigInt! @index + totalConsensusStorageFee: BigInt! + totalDomainExecutionFee: BigInt! + totalBurnedBalance: BigInt! + currentTotalStake: BigInt! + currentStorageFeeDeposit: BigInt! + currentTotalShares: BigInt! + currentSharePrice: BigInt! + accumulatedEpochStake: BigInt! + accumulatedEpochStorageFeeDeposit: BigInt! + accumulatedEpochRewards: BigInt! + accumulatedEpochShares: BigInt! + bundleCount: BigInt! + currentEpochDuration: BigInt! + lastEpochDuration: BigInt! + last6EpochsDuration: BigInt! + last144EpochDuration: BigInt! + last1kEpochDuration: BigInt! + lastBundleAt: BigInt! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type Account @entity { + id: ID! + totalDeposits: BigInt! + totalEstimatedWithdrawals: BigInt! + totalWithdrawals: BigInt! + totalTaxCollected: BigInt! + currentTotalStake: BigInt! + currentStorageFeeDeposit: BigInt! + currentTotalShares: BigInt! + currentSharePrice: BigInt! + accumulatedEpochStake: BigInt! + accumulatedEpochStorageFeeDeposit: BigInt! + accumulatedEpochShares: BigInt! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type Operator @entity { + id: ID! + sortId: BigInt! @index + accountId: String! @index + domainId: String! @index + signingKey: String! @index + minimumNominatorStake: BigInt! + nominationTax: Int! + currentTotalStake: BigInt! + currentStorageFeeDeposit: BigInt! + currentEpochRewards: BigInt! + currentTotalShares: BigInt! + currentSharePrice: BigInt! + rawStatus: String! + totalDeposits: BigInt! + totalEstimatedWithdrawals: BigInt! + totalWithdrawals: BigInt! + totalTaxCollected: BigInt! + totalRewardsCollected: BigInt! + totalTransfersIn: BigInt! + transfersInCount: BigInt! + totalTransfersOut: BigInt! + transfersOutCount: BigInt! + totalRejectedTransfersClaimed: BigInt! + rejectedTransfersClaimedCount: BigInt! + totalTransfersRejected: BigInt! + transfersRejectedCount: BigInt! + totalVolume: BigInt! @index + totalConsensusStorageFee: BigInt! + totalDomainExecutionFee: BigInt! + totalBurnedBalance: BigInt! + accumulatedEpochStake: BigInt! + accumulatedEpochStorageFeeDeposit: BigInt! + accumulatedEpochRewards: BigInt! + accumulatedEpochShares: BigInt! + activeEpochCount: BigInt! + bundleCount: BigInt! + status: String! + pendingAction: String! + lastBundleAt: BigInt! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type OperatorProfile @entity { + id: ID! + operatorId: String! @index + accountId: String! @index + name: String! @index + description: String! + icon: String! + banner: String! + website: String! + websiteVerified: Boolean! + email: String! + emailVerified: Boolean! + discord: String! + github: String! + twitter: String! + proofMessage: String! + proofSignature: String! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type DomainBlock @entity { + id: ID! + domainId: String! @index + domainEpochId: String! @index + blockNumber: BigInt! @index + blockHash: String! @index + extrinsicRoot: String! + epoch: BigInt! @index + consensusBlockNumber: BigInt! @index + consensusBlockHash: String! @index + timestamp: Date! @index + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type DomainEpoch @entity { + id: ID! + epoch: BigInt! @index + domainId: String! @index + blockNumberStart: BigInt! @index + blockNumberEnd: BigInt! @index + blockCount: BigInt! + timestampStart: Date! @index + timestampEnd: Date! @index + epochDuration: BigInt! + consensusBlockNumberStart: BigInt! + consensusBlockNumberEnd: BigInt! + consensusBlockHashStart: String! + consensusBlockHashEnd: String! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type Bundle @entity { + id: ID! + domainId: String! @index + domainBlockId: String! @index + domainEpochId: String! @index + domainBlockNumber: BigInt! @index + domainBlockHash: String! + domainBlockExtrinsicRoot: String! + epoch: BigInt! @index + consensusBlockNumber: BigInt! @index + consensusBlockHash: String! @index + totalTransfersIn: BigInt! + transfersInCount: BigInt! + totalTransfersOut: BigInt! + transfersOutCount: BigInt! + totalRejectedTransfersClaimed: BigInt! + rejectedTransfersClaimedCount: BigInt! + totalTransfersRejected: BigInt! + transfersRejectedCount: BigInt! + totalVolume: BigInt! @index + consensusStorageFee: BigInt! + domainExecutionFee: BigInt! + burnedBalance: BigInt! +} + +type BundleAuthor @entity { + id: ID! + domainId: String! @index + accountId: String! @index + operatorId: String! @index + bundleId: String! @index + domainBlockId: String! @index + domainEpochId: String! @index + epoch: BigInt! @index +} + +type Nominator @entity { + id: ID! + accountId: String! @index + domainId: String! @index + operatorId: String! @index + knownShares: BigInt! + knownStorageFeeDeposit: BigInt! + pendingAmount: BigInt! + pendingStorageFeeDeposit: BigInt! + pendingEffectiveDomainEpoch: BigInt! + totalWithdrawalAmounts: BigInt! + totalStorageFeeRefund: BigInt! + unlockAtConfirmedDomainBlockNumber: [Int!]! + pendingShares: BigInt! + pendingStorageFeeRefund: BigInt! + totalDeposits: BigInt! + totalEstimatedWithdrawals: BigInt! + totalWithdrawals: BigInt! + totalDepositsCount: BigInt! + totalWithdrawalsCount: BigInt! + currentTotalStake: BigInt! + currentStorageFeeDeposit: BigInt! + currentTotalShares: BigInt! + currentSharePrice: BigInt! + accumulatedEpochStake: BigInt! + accumulatedEpochStorageFeeDeposit: BigInt! + accumulatedEpochShares: BigInt! + activeEpochCount: BigInt! + status: String! # NominatorStatus! + pendingAction: String! # NominatorPendingAction! + createdAt: BigInt! @index + updatedAt: BigInt! @index +} + +type Deposit @entity { + id: ID! + accountId: String! @index + domainId: String! @index + operatorId: String! @index + nominatorId: String! @index + amount: BigInt! + storageFeeDeposit: BigInt! + totalAmount: BigInt! + totalWithdrawn: BigInt! + status: String! + timestamp: Date! + extrinsicHash: String! + epochDepositedAt: BigInt! + domainBlockNumberDepositedAt: BigInt! + createdAt: BigInt! @index + stakedAt: BigInt! + updatedAt: BigInt! @index +} + +type Withdrawal @entity { + id: ID! + accountId: String! @index + domainId: String! @index + operatorId: String! @index + nominatorId: String! @index + shares: BigInt! + estimatedAmount: BigInt! + unlockedAmount: BigInt! + unlockedStorageFee: BigInt! + totalAmount: BigInt! + status: String! + timestamp: Date! + withdrawExtrinsicHash: String! + unlockExtrinsicHash: String! + epochWithdrawalRequestedAt: BigInt! + domainBlockNumberWithdrawalRequestedAt: BigInt! + createdAt: BigInt! @index + readyAt: BigInt! + unlockedAt: BigInt! + updatedAt: BigInt! +} + +type Reward @entity { + id: ID! + domainId: String! @index + operatorId: String! @index + amount: BigInt! + timestamp: Date! @index + blockNumber: BigInt! @index + extrinsicHash: String! @index +} + +type Stats @entity { + id: ID! + blockNumber: BigInt! @index + totalStaked: BigInt! + totalTaxCollected: BigInt! + totalRewardsCollected: BigInt! + totalDeposits: BigInt! + totalWithdrawals: BigInt! + totalShares: BigInt! + currentSharePrice: BigInt! + allTimeHighStaked: BigInt! + allTimeHighSharePrice: BigInt! + domainsCount: BigInt! + operatorsCount: BigInt! + activeOperatorsCount: BigInt! + slashedOperatorsCount: BigInt! + nominatorsCount: BigInt! + depositsCount: BigInt! + withdrawalsCount: BigInt! + timestamp: Date! @index +} + +type StatsPerDomain @entity { + id: ID! + domainId: String! @index + blockNumber: BigInt! @index + totalStaked: BigInt! + totalTaxCollected: BigInt! + totalRewardsCollected: BigInt! + totalDeposits: BigInt! + totalWithdrawals: BigInt! + totalShares: BigInt! + currentSharePrice: BigInt! + allTimeHighStaked: BigInt! + allTimeHighSharePrice: BigInt! + operatorsCount: BigInt! + activeOperatorsCount: BigInt! + slashedOperatorsCount: BigInt! + nominatorsCount: BigInt! + depositsCount: BigInt! + withdrawalsCount: BigInt! + timestamp: Date! @index +} + +type StatsPerOperator @entity { + id: ID! + domainId: String! @index + operatorId: String! @index + blockNumber: BigInt! @index + totalStaked: BigInt! + totalTaxCollected: BigInt! + totalRewardsCollected: BigInt! + totalDeposits: BigInt! + totalWithdrawals: BigInt! + totalShares: BigInt! + currentSharePrice: BigInt! + allTimeHighStaked: BigInt! + allTimeHighSharePrice: BigInt! + nominatorsCount: BigInt! + depositsCount: BigInt! + withdrawalsCount: BigInt! + timestamp: Date! @index +} + +type StatsPerNominator @entity { + id: ID! + domainId: String! @index + operatorId: String! @index + nominatorId: String! @index + blockNumber: BigInt! @index + totalStaked: BigInt! + totalDeposits: BigInt! + totalWithdrawals: BigInt! + totalShares: BigInt! + currentSharePrice: BigInt! + allTimeHighStaked: BigInt! + allTimeHighSharePrice: BigInt! + depositsCount: BigInt! + withdrawalsCount: BigInt! + timestamp: Date! @index +} + +type StatsPerAccount @entity { + id: ID! + accountId: String! @index + blockNumber: BigInt! @index + totalStaked: BigInt! + totalDeposits: BigInt! + totalWithdrawals: BigInt! + totalShares: BigInt! + currentSharePrice: BigInt! + allTimeHighStaked: BigInt! + allTimeHighSharePrice: BigInt! + operatorsCount: BigInt! + nominatorsCount: BigInt! + depositsCount: BigInt! + withdrawalsCount: BigInt! + timestamp: Date! @index +} diff --git a/indexers/staking/src/index.ts b/indexers/staking/src/index.ts new file mode 100644 index 000000000..509161575 --- /dev/null +++ b/indexers/staking/src/index.ts @@ -0,0 +1,3 @@ +//Exports all handler functions +export * from "./mappings/mappingHandlers"; +import "@polkadot/api-augment"; diff --git a/indexers/staking/src/mappings/constants.ts b/indexers/staking/src/mappings/constants.ts new file mode 100644 index 000000000..2931d8c74 --- /dev/null +++ b/indexers/staking/src/mappings/constants.ts @@ -0,0 +1 @@ +export const SHARES_CALCULATION_MULTIPLIER = BigInt(1000000000000); diff --git a/indexers/staking/src/mappings/db.ts b/indexers/staking/src/mappings/db.ts new file mode 100644 index 000000000..69a2af4b7 --- /dev/null +++ b/indexers/staking/src/mappings/db.ts @@ -0,0 +1,566 @@ +import { + Account, + Bundle, + BundleAuthor, + Deposit, + Domain, + DomainBlock, + DomainEpoch, + Nominator, + Operator, + Reward, + Stats, + StatsPerAccount, + StatsPerDomain, + StatsPerNominator, + StatsPerOperator, + Withdrawal, +} from "../types"; +import { + DepositStatus, + DomainRuntime, + NominatorPendingAction, + NominatorStatus, + OperatorPendingAction, + OperatorStatus, + WithdrawalStatus, +} from "./models"; + +// Helper for Domain +export async function checkAndGetDomain( + domainId: string, + blockNumber: bigint +): Promise { + const id = domainId.toLowerCase(); + let domain = await Domain.get(id); + if (!domain) { + domain = Domain.create({ + id, + sortId: BigInt(id), + accountId: "", + name: "", + runtimeId: 0, + runtime: DomainRuntime.EVM, + runtimeInfo: "", + completedEpoch: BigInt(0), + lastDomainBlockNumber: BigInt(0), + totalDeposits: BigInt(0), + totalEstimatedWithdrawals: BigInt(0), + totalWithdrawals: BigInt(0), + totalTaxCollected: BigInt(0), + totalRewardsCollected: BigInt(0), + totalTransfersIn: BigInt(0), + transfersInCount: BigInt(0), + totalTransfersOut: BigInt(0), + transfersOutCount: BigInt(0), + totalRejectedTransfersClaimed: BigInt(0), + rejectedTransfersClaimedCount: BigInt(0), + totalTransfersRejected: BigInt(0), + transfersRejectedCount: BigInt(0), + totalVolume: BigInt(0), + totalConsensusStorageFee: BigInt(0), + totalDomainExecutionFee: BigInt(0), + totalBurnedBalance: BigInt(0), + currentTotalStake: BigInt(0), + currentStorageFeeDeposit: BigInt(0), + currentTotalShares: BigInt(0), + currentSharePrice: BigInt(0), + accumulatedEpochStake: BigInt(0), + accumulatedEpochStorageFeeDeposit: BigInt(0), + accumulatedEpochRewards: BigInt(0), + accumulatedEpochShares: BigInt(0), + bundleCount: BigInt(0), + currentEpochDuration: BigInt(0), + lastEpochDuration: BigInt(0), + last6EpochsDuration: BigInt(0), + last144EpochDuration: BigInt(0), + last1kEpochDuration: BigInt(0), + lastBundleAt: BigInt(0), + createdAt: blockNumber, + updatedAt: blockNumber, + }); + } + return domain; +} + +// Helper for Account +export async function checkAndGetAccount( + id: string, + blockNumber: number +): Promise { + let account = await Account.get(id); + if (!account) { + account = Account.create({ + id, + totalDeposits: BigInt(0), + totalEstimatedWithdrawals: BigInt(0), + totalWithdrawals: BigInt(0), + totalTaxCollected: BigInt(0), + currentTotalStake: BigInt(0), + currentStorageFeeDeposit: BigInt(0), + currentTotalShares: BigInt(0), + currentSharePrice: BigInt(0), + accumulatedEpochStake: BigInt(0), + accumulatedEpochStorageFeeDeposit: BigInt(0), + accumulatedEpochShares: BigInt(0), + createdAt: BigInt(blockNumber), + updatedAt: BigInt(blockNumber), + }); + } + return account; +} + +// Helper for Operator +export async function checkAndGetOperator( + operatorId: string, + blockNumber: number +): Promise { + const id = operatorId.toLowerCase(); + let operator = await Operator.get(id); + if (!operator) { + operator = Operator.create({ + id, + sortId: BigInt(id), + accountId: "", + domainId: "", + signingKey: "", + minimumNominatorStake: BigInt(0), + nominationTax: 0, + currentTotalStake: BigInt(0), + currentStorageFeeDeposit: BigInt(0), + currentEpochRewards: BigInt(0), + currentTotalShares: BigInt(0), + currentSharePrice: BigInt(0), + rawStatus: "", + totalDeposits: BigInt(0), + totalEstimatedWithdrawals: BigInt(0), + totalWithdrawals: BigInt(0), + totalTaxCollected: BigInt(0), + totalRewardsCollected: BigInt(0), + totalTransfersIn: BigInt(0), + transfersInCount: BigInt(0), + totalTransfersOut: BigInt(0), + transfersOutCount: BigInt(0), + totalRejectedTransfersClaimed: BigInt(0), + rejectedTransfersClaimedCount: BigInt(0), + totalTransfersRejected: BigInt(0), + transfersRejectedCount: BigInt(0), + totalVolume: BigInt(0), + totalConsensusStorageFee: BigInt(0), + totalDomainExecutionFee: BigInt(0), + totalBurnedBalance: BigInt(0), + accumulatedEpochStake: BigInt(0), + accumulatedEpochStorageFeeDeposit: BigInt(0), + accumulatedEpochRewards: BigInt(0), + accumulatedEpochShares: BigInt(0), + activeEpochCount: BigInt(0), + bundleCount: BigInt(0), + status: OperatorStatus.PENDING, + pendingAction: OperatorPendingAction.NO_ACTION_REQUIRED, + lastBundleAt: BigInt(0), + createdAt: BigInt(blockNumber), + updatedAt: BigInt(blockNumber), + }); + } + return operator; +} + +// Helper for DomainBlock +export async function checkAndGetDomainBlock( + id: string, + blockNumber: number +): Promise { + let domainBlock = await DomainBlock.get(id.toLowerCase()); + if (!domainBlock) { + domainBlock = DomainBlock.create({ + id: id.toLowerCase(), + domainId: "", + domainEpochId: "", + blockNumber: BigInt(0), + blockHash: "", + extrinsicRoot: "", + epoch: BigInt(0), + consensusBlockNumber: BigInt(0), + consensusBlockHash: "", + timestamp: new Date(), + createdAt: BigInt(blockNumber), + updatedAt: BigInt(blockNumber), + }); + } + return domainBlock; +} + +// Helper for DomainEpoch +export async function checkAndGetDomainEpoch( + id: string, + blockNumber: number +): Promise { + let domainEpoch = await DomainEpoch.get(id.toLowerCase()); + if (!domainEpoch) { + domainEpoch = DomainEpoch.create({ + id: id.toLowerCase(), + epoch: BigInt(0), + domainId: "", + blockNumberStart: BigInt(0), + blockNumberEnd: BigInt(0), + blockCount: BigInt(0), + timestampStart: new Date(), + timestampEnd: new Date(), + epochDuration: BigInt(0), + consensusBlockNumberStart: BigInt(0), + consensusBlockNumberEnd: BigInt(0), + consensusBlockHashStart: "", + consensusBlockHashEnd: "", + createdAt: BigInt(blockNumber), + updatedAt: BigInt(blockNumber), + }); + } + return domainEpoch; +} + +// Helper for Bundle +export async function checkAndGetBundle( + id: string, + blockNumber: number +): Promise { + let bundle = await Bundle.get(id.toLowerCase()); + if (!bundle) { + bundle = Bundle.create({ + id: id.toLowerCase(), + domainId: "", + domainBlockId: "", + domainEpochId: "", + domainBlockNumber: BigInt(0), + domainBlockHash: "", + domainBlockExtrinsicRoot: "", + epoch: BigInt(0), + consensusBlockNumber: BigInt(0), + consensusBlockHash: "", + totalTransfersIn: BigInt(0), + transfersInCount: BigInt(0), + totalTransfersOut: BigInt(0), + transfersOutCount: BigInt(0), + totalRejectedTransfersClaimed: BigInt(0), + rejectedTransfersClaimedCount: BigInt(0), + totalTransfersRejected: BigInt(0), + transfersRejectedCount: BigInt(0), + totalVolume: BigInt(0), + consensusStorageFee: BigInt(0), + domainExecutionFee: BigInt(0), + burnedBalance: BigInt(0), + }); + } + return bundle; +} + +// Helper for BundleAuthor +export async function checkAndGetBundleAuthor( + id: string, + blockNumber: number +): Promise { + let bundleAuthor = await BundleAuthor.get(id.toLowerCase()); + if (!bundleAuthor) { + bundleAuthor = BundleAuthor.create({ + id: id.toLowerCase(), + domainId: "", + accountId: "", + operatorId: "", + bundleId: "", + domainBlockId: "", + domainEpochId: "", + epoch: BigInt(0), + }); + } + return bundleAuthor; +} + +// Helper for Nominator +export async function checkAndGetNominator( + accountId: string, + domainId: string, + operatorId: string, + blockNumber: number +): Promise { + const id = `${operatorId}-${accountId}`.toLowerCase(); + let nominator = await Nominator.get(id); + if (!nominator) { + nominator = Nominator.create({ + id, + accountId, + domainId, + operatorId, + knownShares: BigInt(0), + knownStorageFeeDeposit: BigInt(0), + pendingAmount: BigInt(0), + pendingStorageFeeDeposit: BigInt(0), + pendingEffectiveDomainEpoch: BigInt(0), + totalWithdrawalAmounts: BigInt(0), + totalStorageFeeRefund: BigInt(0), + unlockAtConfirmedDomainBlockNumber: [], + pendingShares: BigInt(0), + pendingStorageFeeRefund: BigInt(0), + totalDeposits: BigInt(0), + totalEstimatedWithdrawals: BigInt(0), + totalWithdrawals: BigInt(0), + totalDepositsCount: BigInt(0), + totalWithdrawalsCount: BigInt(0), + currentTotalStake: BigInt(0), + currentStorageFeeDeposit: BigInt(0), + currentTotalShares: BigInt(0), + currentSharePrice: BigInt(0), + accumulatedEpochStake: BigInt(0), + accumulatedEpochStorageFeeDeposit: BigInt(0), + accumulatedEpochShares: BigInt(0), + activeEpochCount: BigInt(0), + status: NominatorStatus.PENDING, + pendingAction: NominatorPendingAction.NO_ACTION_REQUIRED, + createdAt: BigInt(blockNumber), + updatedAt: BigInt(blockNumber), + }); + } + return nominator; +} + +// Helper for Deposit +export async function checkAndGetDeposit( + accountId: string, + domainId: string, + operatorId: string, + amount: bigint, + storageFeeDeposit: bigint, + blockNumber: number +): Promise { + const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); + const nominatorId = `${operatorId}-${accountId}`.toLowerCase(); + const totalAmount = amount + storageFeeDeposit; + let deposit = await Deposit.get(id); + if (!deposit) { + deposit = Deposit.create({ + id, + accountId, + domainId, + operatorId, + nominatorId, + amount, + storageFeeDeposit, + totalAmount, + totalWithdrawn: BigInt(0), + status: DepositStatus.PENDING, + timestamp: new Date(), + extrinsicHash: "", + epochDepositedAt: BigInt(0), + domainBlockNumberDepositedAt: BigInt(0), + createdAt: BigInt(blockNumber), + stakedAt: BigInt(0), + updatedAt: BigInt(blockNumber), + }); + } + return deposit; +} + +// Helper for Withdrawal +export async function checkAndGetWithdrawal( + accountId: string, + domainId: string, + operatorId: string, + nominatorId: string, + blockNumber: number +): Promise { + const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); + let withdrawal = await Withdrawal.get(id); + if (!withdrawal) { + withdrawal = Withdrawal.create({ + id, + accountId, + domainId, + operatorId, + nominatorId, + shares: BigInt(0), + estimatedAmount: BigInt(0), + unlockedAmount: BigInt(0), + unlockedStorageFee: BigInt(0), + totalAmount: BigInt(0), + status: WithdrawalStatus.PENDING_LOCK, + timestamp: new Date(), + withdrawExtrinsicHash: "", + unlockExtrinsicHash: "", + epochWithdrawalRequestedAt: BigInt(0), + domainBlockNumberWithdrawalRequestedAt: BigInt(0), + createdAt: BigInt(blockNumber), + readyAt: BigInt(0), + unlockedAt: BigInt(0), + updatedAt: BigInt(blockNumber), + }); + } + return withdrawal; +} + +// Helper for Reward +export async function checkAndGetReward( + id: string, + blockNumber: number +): Promise { + let reward = await Reward.get(id.toLowerCase()); + if (!reward) { + reward = Reward.create({ + id: id.toLowerCase(), + domainId: "", + operatorId: "", + amount: BigInt(0), + timestamp: new Date(), + blockNumber: BigInt(0), + extrinsicHash: "", + }); + } + return reward; +} + +// Helper for Stats +export async function checkAndGetStats( + id: string, + blockNumber: number +): Promise { + let stats = await Stats.get(id.toLowerCase()); + if (!stats) { + stats = Stats.create({ + id: id.toLowerCase(), + blockNumber: BigInt(0), + totalStaked: BigInt(0), + totalTaxCollected: BigInt(0), + totalRewardsCollected: BigInt(0), + totalDeposits: BigInt(0), + totalWithdrawals: BigInt(0), + totalShares: BigInt(0), + currentSharePrice: BigInt(0), + allTimeHighStaked: BigInt(0), + allTimeHighSharePrice: BigInt(0), + domainsCount: BigInt(0), + operatorsCount: BigInt(0), + activeOperatorsCount: BigInt(0), + slashedOperatorsCount: BigInt(0), + nominatorsCount: BigInt(0), + depositsCount: BigInt(0), + withdrawalsCount: BigInt(0), + timestamp: new Date(), + }); + } + return stats; +} + +// Helper for StatsPerDomain +export async function checkAndGetStatsPerDomain( + id: string, + blockNumber: number +): Promise { + let statsPerDomain = await StatsPerDomain.get(id.toLowerCase()); + if (!statsPerDomain) { + statsPerDomain = StatsPerDomain.create({ + id: id.toLowerCase(), + domainId: "", + blockNumber: BigInt(0), + totalStaked: BigInt(0), + totalTaxCollected: BigInt(0), + totalRewardsCollected: BigInt(0), + totalDeposits: BigInt(0), + totalWithdrawals: BigInt(0), + totalShares: BigInt(0), + currentSharePrice: BigInt(0), + allTimeHighStaked: BigInt(0), + allTimeHighSharePrice: BigInt(0), + operatorsCount: BigInt(0), + activeOperatorsCount: BigInt(0), + slashedOperatorsCount: BigInt(0), + nominatorsCount: BigInt(0), + depositsCount: BigInt(0), + withdrawalsCount: BigInt(0), + timestamp: new Date(), + }); + } + return statsPerDomain; +} + +// Helper for StatsPerOperator +export async function checkAndGetStatsPerOperator( + id: string, + blockNumber: number +): Promise { + let statsPerOperator = await StatsPerOperator.get(id.toLowerCase()); + if (!statsPerOperator) { + statsPerOperator = StatsPerOperator.create({ + id: id.toLowerCase(), + domainId: "", + operatorId: "", + blockNumber: BigInt(0), + totalStaked: BigInt(0), + totalTaxCollected: BigInt(0), + totalRewardsCollected: BigInt(0), + totalDeposits: BigInt(0), + totalWithdrawals: BigInt(0), + totalShares: BigInt(0), + currentSharePrice: BigInt(0), + allTimeHighStaked: BigInt(0), + allTimeHighSharePrice: BigInt(0), + nominatorsCount: BigInt(0), + depositsCount: BigInt(0), + withdrawalsCount: BigInt(0), + timestamp: new Date(), + }); + } + return statsPerOperator; +} + +// Helper for StatsPerNominator +export async function checkAndGetStatsPerNominator( + id: string, + blockNumber: number +): Promise { + let statsPerNominator = await StatsPerNominator.get(id.toLowerCase()); + if (!statsPerNominator) { + statsPerNominator = StatsPerNominator.create({ + id: id.toLowerCase(), + domainId: "", + operatorId: "", + nominatorId: "", + blockNumber: BigInt(0), + totalStaked: BigInt(0), + totalDeposits: BigInt(0), + totalWithdrawals: BigInt(0), + totalShares: BigInt(0), + currentSharePrice: BigInt(0), + allTimeHighStaked: BigInt(0), + allTimeHighSharePrice: BigInt(0), + depositsCount: BigInt(0), + withdrawalsCount: BigInt(0), + timestamp: new Date(), + }); + } + return statsPerNominator; +} + +// Helper for StatsPerAccount +export async function checkAndGetStatsPerAccount( + id: string, + blockNumber: number +): Promise { + let statsPerAccount = await StatsPerAccount.get(id.toLowerCase()); + if (!statsPerAccount) { + statsPerAccount = StatsPerAccount.create({ + id: id.toLowerCase(), + accountId: "", + blockNumber: BigInt(0), + totalStaked: BigInt(0), + totalDeposits: BigInt(0), + totalWithdrawals: BigInt(0), + totalShares: BigInt(0), + currentSharePrice: BigInt(0), + allTimeHighStaked: BigInt(0), + allTimeHighSharePrice: BigInt(0), + operatorsCount: BigInt(0), + nominatorsCount: BigInt(0), + depositsCount: BigInt(0), + withdrawalsCount: BigInt(0), + timestamp: new Date(), + }); + } + return statsPerAccount; +} diff --git a/indexers/staking/src/mappings/mappingHandlers.ts b/indexers/staking/src/mappings/mappingHandlers.ts new file mode 100644 index 000000000..97d86650b --- /dev/null +++ b/indexers/staking/src/mappings/mappingHandlers.ts @@ -0,0 +1,1114 @@ +import { capitalizeFirstLetter, stringify } from "@autonomys/auto-utils"; +import { SubstrateEvent, SubstrateExtrinsic } from "@subql/types"; +import assert from "assert"; +import { + Bundle, + BundleAuthor, + Deposit, + DomainBlock, + Nominator, + Withdrawal, +} from "../types"; +import { SHARES_CALCULATION_MULTIPLIER } from "./constants"; +import * as db from "./db"; +import { + DepositStatus, + DomainRuntime, + NominatorPendingAction, + NominatorStatus, + OperatorPendingAction, + OperatorStatus, + WithdrawalStatus, +} from "./models"; +import type { ExecutionReceipt, SealedBundleHeader, TBundle } from "./types"; + +const MAX_LIMIT = 10000; + +export async function handleDomainInstantiatedEvent( + event: SubstrateEvent +): Promise { + const { + extrinsic, + event: { + data: [_domainId, _completedEpochIndex], + }, + } = event; + if (extrinsic) { + const _extrinsic = extrinsic.extrinsic.method.args[0].toHuman() as any; + const accountId = extrinsic.extrinsic.signer.toString(); + const domainName = capitalizeFirstLetter( + _extrinsic.args.domain_config.domainName + ); + const domainId = _domainId.toString(); + const completedEpoch = Number(_completedEpochIndex?.toString() ?? 0); + const blockNumber = event.block.block.header.number.toNumber(); + + const domain = await db.checkAndGetDomain(domainId, BigInt(blockNumber)); + domain.accountId = accountId; + domain.name = domainName; + switch (domainName) { + case "Nova": + domain.runtime = DomainRuntime.EVM; + break; + case "Auto-id": + domain.runtime = DomainRuntime.AUTO_ID; + break; + default: + break; + } + domain.runtimeInfo = stringify(_extrinsic.args.domain_config); + domain.completedEpoch = BigInt(completedEpoch); + domain.updatedAt = BigInt(blockNumber); + + await domain.save(); + } +} + +export async function handleRegisterOperatorCall( + extrinsic: SubstrateExtrinsic +): Promise { + logger.info( + `New ${extrinsic.extrinsic.registry.toString()}.${ + extrinsic.extrinsic.method + } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` + ); + const { + block: { + block: { + header: { number }, + }, + }, + extrinsic: { + method: { args }, + signer, + }, + events, + } = extrinsic; + const _args = args.map((arg) => arg.toPrimitive()); + const domainId = String(args[0]); + const amount = BigInt(args[1].toString()); + const { signingKey, minimumNominatorStake, nominationTax } = + (args[2] as any) ?? {}; + + const opRegistered = events.find( + (e) => e.event.method.toString() === "OperatorRegistered" + ); + const storageFee = events.find( + (e) => e.event.method.toString() === "StorageFeeDeposited" + ); + if (!opRegistered || !storageFee) { + logger.info(`No operatorRegisteredEvent or storageFeeDepositedEvent found`); + return; + } + + const operatorId = String(opRegistered?.event.data[0]); + const domainId_storageFee = String(opRegistered.event.data[1]); + const operatorId_storageFee = String(storageFee.event.data[0]); + const nominatorId_storageFee = String(storageFee.event.data[1]); + const amount_storageFee = BigInt(storageFee.event.data[2].toString()); + + assert(domainId === domainId_storageFee, "domainId mismatch"); + assert(operatorId === operatorId_storageFee, "operatorId mismatch"); + assert(signer.toString() === nominatorId_storageFee, "signer mismatch"); + assert( + amount_storageFee === (BigInt(amount) * BigInt(20)) / BigInt(100), + `Storage fee (${amount_storageFee}) should be 20% of the amount (${amount})` + ); + + const domain = await db.checkAndGetDomain( + domainId, + BigInt(number.toString()) + ); + domain.totalDeposits += amount; + domain.updatedAt = BigInt(number.toString()); + + const account = await db.checkAndGetAccount( + signer.toString(), + number.toNumber() + ); + account.totalDeposits += amount; + account.updatedAt = BigInt(number.toString()); + + const operator = await db.checkAndGetOperator(operatorId, number.toNumber()); + operator.domainId = domain.id; + operator.accountId = account.id; + operator.signingKey = String(signingKey); + operator.minimumNominatorStake = BigInt(minimumNominatorStake); + operator.nominationTax = Number(nominationTax); + operator.totalDeposits += amount; + operator.pendingAction = OperatorPendingAction.PENDING_REGISTRATION; + operator.updatedAt = BigInt(number.toString()); + + const nominator = await db.checkAndGetNominator( + signer.toString(), + domain.id, + operator.id, + number.toNumber() + ); + nominator.totalDeposits += amount; + nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; + nominator.updatedAt = BigInt(number.toString()); + + const deposit = await db.checkAndGetDeposit( + signer.toString(), + domain.id, + operator.id, + amount - amount_storageFee, + amount_storageFee, + number.toNumber() + ); + deposit.epochDepositedAt = domain.completedEpoch ?? 0; + deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; + + await Promise.all([ + domain.save(), + account.save(), + operator.save(), + nominator.save(), + deposit.save(), + ]); +} + +export async function handleNominateOperatorCall( + extrinsic: SubstrateExtrinsic +): Promise { + const { + events, + extrinsic: { + method: { args }, + }, + } = extrinsic; + const operatorId = String(args[0]); + const amount = BigInt(args[1].toString()); + const blockNumber = extrinsic.block.block.header.number.toNumber(); + const signer = extrinsic.extrinsic.signer.toString(); + + const storageFeeDepositedEvent = events.find( + (e) => e.event.method.toString() === "StorageFeeDeposited" + ); + const operatorNominatedEvent = events.find( + (e) => e.event.method.toString() === "OperatorNominated" + ); + + const storageFeeDeposit = BigInt( + storageFeeDepositedEvent?.event.data[2].toString() ?? 0 + ); + const totalAmount = amount + storageFeeDeposit; + + const account = await db.checkAndGetAccount(signer, blockNumber); + const operator = await db.checkAndGetOperator(operatorId, blockNumber); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + + const nominator = await db.checkAndGetNominator( + signer, + domain.id, + operator.id, + blockNumber + ); + + const deposit = await db.checkAndGetDeposit( + signer, + domain.id, + operator.id, + amount, + storageFeeDeposit, + blockNumber + ); + deposit.epochDepositedAt = domain.completedEpoch ?? 0; + deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; + + operator.totalDeposits += totalAmount; + operator.updatedAt = BigInt(blockNumber); + + if (nominator.totalDepositsCount === BigInt(0)) { + nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; + } + nominator.totalDeposits += totalAmount; + nominator.totalDepositsCount++; + nominator.updatedAt = BigInt(blockNumber); + + domain.totalDeposits += totalAmount; + domain.updatedAt = BigInt(blockNumber); + + account.totalDeposits += totalAmount; + account.updatedAt = BigInt(blockNumber); + + await Promise.all([ + domain.save(), + account.save(), + operator.save(), + nominator.save(), + deposit.save(), + ]); +} + +export async function handleDeregisterOperatorCall( + extrinsic: SubstrateExtrinsic +): Promise { + logger.info( + `New ${extrinsic.extrinsic.registry.toString()}.${ + extrinsic.extrinsic.method + } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` + ); + const blockNumber = extrinsic.block.block.header.number.toNumber(); + const { + events, + extrinsic: { + method: { args }, + }, + } = extrinsic; + const operatorId = String(args[0]); + + const opDeregistered = events.find( + (e) => e.event.method.toString() === "OperatorDeregistered" + ); + if (!opDeregistered) { + logger.info(`No operatorDeregisteredEvent found`); + return; + } + + const operator = await db.checkAndGetOperator(operatorId, blockNumber); + operator.currentTotalStake = BigInt(0); + operator.currentStorageFeeDeposit = BigInt(0); + operator.status = OperatorStatus.DEREGISTERED; + operator.updatedAt = BigInt(blockNumber); + + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + const account = await db.checkAndGetAccount(operator.accountId, blockNumber); + + const nominators = await Nominator.getByOperatorId(operator.id, { + limit: MAX_LIMIT, + }); + const activeNominators = + nominators && + nominators.filter( + (n) => + n.status === NominatorStatus.STAKED || + n.status === NominatorStatus.PENDING + ); + if (activeNominators) { + activeNominators.forEach(async (n) => { + const estimatedAmount = + (operator.currentSharePrice * n.knownShares) / + SHARES_CALCULATION_MULTIPLIER; + const withdrawal = await db.checkAndGetWithdrawal( + account.id, + domain.id, + operator.id, + n.id, + blockNumber + ); + + n.status = NominatorStatus.PENDING; + n.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; + n.totalWithdrawalsCount++; + n.totalEstimatedWithdrawals += estimatedAmount; + n.updatedAt = BigInt(blockNumber); + + operator.totalEstimatedWithdrawals += estimatedAmount; + account.totalEstimatedWithdrawals += estimatedAmount; + domain.totalEstimatedWithdrawals += estimatedAmount; + + await Promise.all([n.save(), withdrawal.save()]); + }); + } + await Promise.all([operator.save(), domain.save(), account.save()]); +} + +export async function handleOperatorSlashedEvent( + event: SubstrateEvent +): Promise { + const blockNumber = event.block.block.header.number.toNumber(); + const operatorId = event.event.data[0].toString(); + + // Query operator details + const operator = await db.checkAndGetOperator(operatorId, blockNumber); + operator.currentTotalStake = BigInt(0); + operator.currentStorageFeeDeposit = BigInt(0); + operator.status = OperatorStatus.SLASHED; + operator.updatedAt = BigInt(blockNumber); + + // Fetch nominators associated with the operator + const nominators = await Nominator.getByOperatorId(operator.id, { + limit: MAX_LIMIT, + }); + if (nominators) { + nominators.forEach(async (nominator) => { + nominator.status = NominatorStatus.SLASHED; + nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; + nominator.updatedAt = BigInt(blockNumber); + await nominator.save(); + }); + } + + // Fetch withdrawals associated with the operator + const withdrawals = await Withdrawal.getByOperatorId(operator.id, { + limit: MAX_LIMIT, + }); + if (withdrawals) { + withdrawals.forEach(async (withdrawal) => { + if ( + withdrawal.status === WithdrawalStatus.PENDING_LOCK || + withdrawal.status === WithdrawalStatus.PENDING_OPERATOR || + withdrawal.status === WithdrawalStatus.READY + ) { + withdrawal.status = WithdrawalStatus.SLASHED; + withdrawal.updatedAt = BigInt(blockNumber); + await withdrawal.save(); + } + }); + } + + // Save operator changes + await operator.save(); +} + +export async function handleOperatorTaxCollectedEvent( + event: SubstrateEvent +): Promise { + const { + event: { + data: [operatorId, tax], + }, + block, + } = event; + const blockNumber = block.block.header.number.toNumber(); + const taxAmount = BigInt(tax.toString()); + + const operator = await db.checkAndGetOperator( + operatorId.toString(), + blockNumber + ); + const account = await db.checkAndGetAccount(operator.accountId, blockNumber); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + + operator.totalTaxCollected += taxAmount; + operator.updatedAt = BigInt(blockNumber); + + account.totalTaxCollected += taxAmount; + account.updatedAt = BigInt(blockNumber); + + domain.totalTaxCollected += taxAmount; + domain.updatedAt = BigInt(blockNumber); + + await Promise.all([operator.save(), account.save(), domain.save()]); +} + +export async function handleOperatorRewardedEvent( + event: SubstrateEvent +): Promise { + const { + event: { + data: [operatorId, reward], + }, + block, + } = event; + const amount = BigInt(reward.toString()); + + const operator = await db.checkAndGetOperator( + operatorId.toString(), + block.block.header.number.toNumber() + ); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(block.block.header.number.toString()) + ); + + operator.totalRewardsCollected += amount; + domain.totalRewardsCollected += amount; + + const rewardEvent = await db.checkAndGetReward( + `${operatorId}-${block.block.header.number.toNumber()}`, + block.block.header.number.toNumber() + ); + rewardEvent.amount = amount; + rewardEvent.domainId = operator.domainId; + rewardEvent.operatorId = operator.id; + rewardEvent.timestamp = new Date(block.timestamp ?? 0); + + await Promise.all([operator.save(), domain.save(), rewardEvent.save()]); +} + +export async function handleWithdrawStakeCall( + extrinsic: SubstrateExtrinsic +): Promise { + const { + extrinsic: { + method: { args }, + }, + } = extrinsic; + const operatorId = args[0].toString(); + const shares = args[1].toString(); + const address = extrinsic.extrinsic.signer.toString(); + const blockNumber = extrinsic.block.block.header.number.toNumber(); + const sharesBigInt = BigInt(shares.toString()); + + const account = await db.checkAndGetAccount(address, blockNumber); + const operator = await db.checkAndGetOperator( + operatorId.toString(), + blockNumber + ); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + const nominator = await db.checkAndGetNominator( + address, + domain.id, + operator.id, + blockNumber + ); + + const estimatedAmount = + (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; + const withdrawal = await db.checkAndGetWithdrawal( + account.id, + domain.id, + operator.id, + nominator.id, + blockNumber + ); + + withdrawal.domainId = domain.id; + withdrawal.accountId = account.id; + withdrawal.operatorId = operator.id; + withdrawal.nominatorId = nominator.id; + withdrawal.shares = sharesBigInt; + withdrawal.estimatedAmount = estimatedAmount; + withdrawal.epochWithdrawalRequestedAt = domain.completedEpoch ?? 0; + withdrawal.domainBlockNumberWithdrawalRequestedAt = + domain.lastDomainBlockNumber ?? 0; + withdrawal.status = WithdrawalStatus.PENDING_LOCK; + withdrawal.createdAt = BigInt(blockNumber); + withdrawal.updatedAt = BigInt(blockNumber); + + nominator.totalWithdrawalsCount++; + nominator.totalEstimatedWithdrawals += estimatedAmount; + nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; + nominator.updatedAt = BigInt(blockNumber); + + operator.totalEstimatedWithdrawals += estimatedAmount; + operator.updatedAt = BigInt(blockNumber); + + account.totalEstimatedWithdrawals += estimatedAmount; + account.updatedAt = BigInt(blockNumber); + + domain.totalEstimatedWithdrawals += estimatedAmount; + domain.updatedAt = BigInt(blockNumber); + + await Promise.all([ + withdrawal.save(), + nominator.save(), + operator.save(), + account.save(), + domain.save(), + ]); +} + +export async function handleUnlockFundsCall( + extrinsic: SubstrateExtrinsic +): Promise { + const blockNumber = extrinsic.block.block.header.number.toNumber(); + const signer = extrinsic.extrinsic.signer.toString(); + const [operatorId, shares] = extrinsic.extrinsic.method.args; + + // Query operator details + const operator = await db.checkAndGetOperator( + operatorId.toString(), + blockNumber + ); + + // Calculate estimated amount + const sharesBigInt = BigInt(shares.toString()); + const estimatedAmount = + (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; + + // Fetch or create Withdrawal entity + const withdrawal = await db.checkAndGetWithdrawal( + signer, + operator.domainId, + operator.id, + signer, + blockNumber + ); + + withdrawal.shares = sharesBigInt; + withdrawal.estimatedAmount = estimatedAmount; + withdrawal.status = WithdrawalStatus.PENDING_LOCK; + withdrawal.createdAt = BigInt(blockNumber); + withdrawal.updatedAt = BigInt(blockNumber); + + // Update related entities + const account = await db.checkAndGetAccount(signer, blockNumber); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + const nominator = await db.checkAndGetNominator( + signer, + domain.id, + operator.id, + blockNumber + ); + + nominator.totalWithdrawalsCount++; + nominator.totalEstimatedWithdrawals += estimatedAmount; + nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; + nominator.updatedAt = BigInt(blockNumber); + + operator.totalEstimatedWithdrawals += estimatedAmount; + operator.updatedAt = BigInt(blockNumber); + + account.totalEstimatedWithdrawals += estimatedAmount; + account.updatedAt = BigInt(blockNumber); + + domain.totalEstimatedWithdrawals += estimatedAmount; + domain.updatedAt = BigInt(blockNumber); + + // Save all changes + await Promise.all([ + withdrawal.save(), + nominator.save(), + operator.save(), + account.save(), + domain.save(), + ]); +} + +export async function handleUnlockOperatorCall( + extrinsic: SubstrateExtrinsic +): Promise { + // Implementation for handleUnlockOperatorCall +} + +export async function handleUnlockNominatorCall( + extrinsic: SubstrateExtrinsic +): Promise { + // Implementation for handleUnlockNominatorCall +} + +export async function handleDomainEpochCompletedEvent( + event: SubstrateEvent +): Promise { + logger.info( + `New ${event.event.section}.${ + event.event.method + } event found at block ${event.block.block.header.number.toString()}` + ); + const { + event: { + data: [domainId, epochIndex], + }, + } = event; + const blockNumber = event.block.block.header.number.toNumber(); + + // Querying additional state if necessary + const _domainEntry = await api.query.domains.domainRegistry(domainId); + const domainEntry = _domainEntry.toJSON() as any[0]; + + // Parse domain details + const parsedDomain = { + domainId: domainEntry?.domainId, + ownerAccountId: domainEntry?.ownerAccountId, + // Add other necessary fields + }; + + // Fetch or create Domain entity + const domain = await db.checkAndGetDomain( + domainId.toString(), + BigInt(blockNumber) + ); + domain.completedEpoch = BigInt(epochIndex.toString()); + domain.updatedAt = BigInt(blockNumber); + + // Update domain based on fetched data + if (parsedDomain.ownerAccountId) { + domain.accountId = parsedDomain.ownerAccountId; + // Update other domain fields as necessary + } + + await domain.save(); +} + +export async function handleForceDomainEpochTransitionEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleForceDomainEpochTransitionEvent +} + +export async function handleOperatorRegisteredEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleOperatorRegisteredEvent +} + +export async function handleOperatorDeregisteredEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleOperatorDeregisteredEvent +} + +export async function handleOperatorNominatedEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleOperatorNominatedEvent +} + +export async function handleWithdrewStakeEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleWithdrewStakeEvent +} + +export async function handleStorageFeeDepositedEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleStorageFeeDepositedEvent +} + +export async function handleBundleStoredEvent( + event: SubstrateEvent +): Promise { + const { + event: { + data: [domainId, bundleAuthor], + }, + block: { + block: { + header: { number, hash }, + }, + timestamp, + }, + extrinsic, + } = event; + const domainIdNum = BigInt(domainId.toString()); + const operatorId = BigInt(bundleAuthor.toString()); + if (!extrinsic) return; + + const _bundle = + extrinsic.extrinsic.method.args[0].toPrimitive() as unknown as TBundle; + const sealedHeader = _bundle.sealedHeader as SealedBundleHeader; + const domain = await db.checkAndGetDomain( + domainId.toString(), + BigInt(number.toString()) + ); + const operator = await db.checkAndGetOperator( + operatorId.toString(), + number.toNumber() + ); + const account = await db.checkAndGetAccount( + operator.accountId, + number.toNumber() + ); + + const receipt = sealedHeader.header.receipt as ExecutionReceipt; + const { transfers } = receipt; + + const totalTransfersIn = Array.isArray(transfers.transfersIn) + ? transfers.transfersIn.reduce( + (acc, [, amount]) => acc + BigInt(amount), + BigInt(0) + ) + : BigInt(0); + const transfersInCount = Array.isArray(transfers.transfersIn) + ? transfers.transfersIn.length + : 0; + + const totalTransfersOut = Array.isArray(transfers.transfersOut) + ? transfers.transfersOut.reduce( + (acc, [, amount]) => acc + BigInt(amount), + BigInt(0) + ) + : BigInt(0); + const transfersOutCount = Array.isArray(transfers.transfersOut) + ? transfers.transfersOut.length + : 0; + + const totalRejectedTransfersClaimed = Array.isArray( + transfers.rejectedTransfersClaimed + ) + ? transfers.rejectedTransfersClaimed.reduce( + (acc, [, amount]) => acc + BigInt(amount), + BigInt(0) + ) + : BigInt(0); + const rejectedTransfersClaimedCount = Array.isArray( + transfers.rejectedTransfersClaimed + ) + ? transfers.rejectedTransfersClaimed.length + : 0; + + const totalTransfersRejected = Array.isArray(transfers.transfersRejected) + ? transfers.transfersRejected.reduce( + (acc, [, amount]) => acc + BigInt(amount), + BigInt(0) + ) + : BigInt(0); + const transfersRejectedCount = Array.isArray(transfers.transfersRejected) + ? transfers.transfersRejected.length + : 0; + + const totalVolume = totalTransfersIn + totalTransfersOut; + + const { + domainBlockNumber, + domainBlockHash, + domainBlockExtrinsicRoot, + consensusBlockNumber, + consensusBlockHash, + blockFees, + } = receipt; + + const epoch = domain.completedEpoch; + const domainEpoch = await db.checkAndGetDomainEpoch( + `${domainId}-${epoch}`, + number.toNumber() + ); + domainEpoch.blockNumberEnd = BigInt(domainBlockNumber); + domainEpoch.timestampEnd = timestamp ?? new Date(0); + domainEpoch.consensusBlockNumberEnd = BigInt(consensusBlockNumber); + domainEpoch.consensusBlockHashEnd = hash.toString(); + domainEpoch.blockCount = + domainEpoch.blockNumberEnd - domainEpoch.blockNumberStart + BigInt(1); + domainEpoch.epochDuration = BigInt( + domainEpoch.timestampEnd.getTime() - domainEpoch.timestampStart.getTime() + ); + domainEpoch.updatedAt = BigInt(number.toNumber()); + + let domainBlock = await db.checkAndGetDomainBlock( + `${domainId}-${domainBlockNumber}`, + number.toNumber() + ); + if (!domainBlock) { + domainBlock = DomainBlock.create({ + id: `${domainId}-${domainBlockNumber}`, + domainId: domain.id, + domainEpochId: domainEpoch.id, + blockNumber: BigInt(domainBlockNumber), + blockHash: domainBlockHash.toString(), + extrinsicRoot: domainBlockExtrinsicRoot.toString(), + epoch: domain.completedEpoch, + consensusBlockNumber: BigInt(consensusBlockNumber), + consensusBlockHash: consensusBlockHash.toString(), + timestamp: timestamp ?? new Date(0), + createdAt: BigInt(number.toString()), + updatedAt: BigInt(number.toString()), + }); + } + + let bundle = await db.checkAndGetBundle( + `${domainId}-${domainBlockHash}-${number.toNumber()}`, + number.toNumber() + ); + if (!bundle) { + bundle = Bundle.create({ + id: `${domainId}-${domainBlockHash}-${number.toNumber()}`, + domainId: domain.id, + domainBlockId: domainBlock.id, + domainEpochId: domainEpoch.id, + domainBlockNumber: BigInt(domainBlockNumber), + domainBlockHash: domainBlockHash.toString(), + domainBlockExtrinsicRoot: domainBlockExtrinsicRoot.toString(), + epoch: domain.completedEpoch, + consensusBlockNumber: BigInt(consensusBlockNumber), + consensusBlockHash: consensusBlockHash.toString(), + totalTransfersIn, + transfersInCount: BigInt(transfersInCount), + totalTransfersOut, + transfersOutCount: BigInt(transfersOutCount), + totalRejectedTransfersClaimed, + rejectedTransfersClaimedCount: BigInt(rejectedTransfersClaimedCount), + totalTransfersRejected, + transfersRejectedCount: BigInt(transfersRejectedCount), + totalVolume, + consensusStorageFee: BigInt(blockFees.consensusStorageFee), + domainExecutionFee: BigInt(blockFees.domainExecutionFee), + burnedBalance: BigInt(blockFees.burnedBalance), + }); + } + + let bundleAuthorEntity = await db.checkAndGetBundleAuthor( + `${domainId}-${account.id}-${operator.id}-${bundle.id}`, + number.toNumber() + ); + if (!bundleAuthorEntity) { + bundleAuthorEntity = BundleAuthor.create({ + id: `${domainId}-${account.id}-${operator.id}-${bundle.id}`, + domainId: domain.id, + accountId: account.id, + operatorId: operator.id, + bundleId: bundle.id, + domainBlockId: domainBlock.id, + domainEpochId: domainEpoch.id, + epoch: domain.completedEpoch, + }); + } + + domain.lastDomainBlockNumber = BigInt(domainBlockNumber); + domain.totalTransfersIn += totalTransfersIn; + domain.transfersInCount += BigInt(transfersInCount); + domain.totalTransfersOut += totalTransfersOut; + domain.transfersOutCount += BigInt(transfersOutCount); + domain.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; + domain.rejectedTransfersClaimedCount += BigInt(rejectedTransfersClaimedCount); + domain.totalTransfersRejected += totalTransfersRejected; + domain.transfersRejectedCount += BigInt(transfersRejectedCount); + domain.totalVolume += totalVolume; + domain.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); + domain.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); + domain.totalBurnedBalance += BigInt(blockFees.burnedBalance); + domain.bundleCount++; + domain.currentEpochDuration = domainEpoch.epochDuration; + + if (epoch > 0) { + const lastEpoch = await db.checkAndGetDomainEpoch( + `${domainId}-${epoch - BigInt(1)}`, + number.toNumber() + ); + const lastEpochTimestampEnd = lastEpoch.timestampEnd.getTime(); + domain.lastEpochDuration = lastEpoch.epochDuration; + if (epoch > 6) { + domain.last6EpochsDuration = BigInt( + lastEpochTimestampEnd - + ( + await db.checkAndGetDomainEpoch( + `${domainId}-${epoch - BigInt(6)}`, + number.toNumber() + ) + ).timestampEnd.getTime() + ); + } + if (epoch > 144) { + domain.last144EpochDuration = BigInt( + lastEpochTimestampEnd - + ( + await db.checkAndGetDomainEpoch( + `${domainId}-${epoch - BigInt(144)}`, + number.toNumber() + ) + ).timestampEnd.getTime() + ); + } + if (epoch > 1000) { + domain.last1kEpochDuration = BigInt( + lastEpochTimestampEnd - + ( + await db.checkAndGetDomainEpoch( + `${domainId}-${epoch - BigInt(1000)}`, + number.toNumber() + ) + ).timestampEnd.getTime() + ); + } + } + domain.lastBundleAt = BigInt(number.toString()); + domain.updatedAt = BigInt(number.toString()); + + operator.totalTransfersIn += totalTransfersIn; + operator.transfersInCount += BigInt(transfersInCount); + operator.totalTransfersOut += totalTransfersOut; + operator.transfersOutCount += BigInt(transfersOutCount); + operator.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; + operator.rejectedTransfersClaimedCount += BigInt( + rejectedTransfersClaimedCount + ); + operator.totalTransfersRejected += totalTransfersRejected; + operator.transfersRejectedCount += BigInt(transfersRejectedCount); + operator.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); + operator.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); + operator.totalBurnedBalance += BigInt(blockFees.burnedBalance); + operator.totalVolume += totalVolume; + operator.bundleCount++; + operator.lastBundleAt = BigInt(number.toString()); + operator.updatedAt = BigInt(number.toString()); + + await Promise.all([ + domain.save(), + domainEpoch.save(), + domainBlock.save(), + bundle.save(), + bundleAuthorEntity.save(), + operator.save(), + ]); +} + +export async function handleOperatorUnlockedEvent( + event: SubstrateEvent +): Promise { + const { + event: { + data: [operatorId], + }, + block, + } = event; + const blockNumber = block.block.header.number.toNumber(); + const operator = await db.checkAndGetOperator( + operatorId.toString(), + blockNumber + ); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + const account = await db.checkAndGetAccount(operator.accountId, blockNumber); + + operator.pendingAction = OperatorPendingAction.NO_ACTION_REQUIRED; + operator.updatedAt = BigInt(blockNumber); + + const nominators = await Nominator.getByOperatorId(operator.id, { + limit: MAX_LIMIT, + }); + if (nominators) { + nominators.forEach(async (n) => { + if ( + n.status === NominatorStatus.PENDING || + n.status === NominatorStatus.STAKED + ) { + n.status = NominatorStatus.PENDING; + n.pendingAction = NominatorPendingAction.READY_TO_UNLOCK_ALL_FUNDS; + n.updatedAt = BigInt(blockNumber); + await n.save(); + } + }); + } + + const withdrawals = await Withdrawal.getByDomainId(domain.id, { + limit: MAX_LIMIT, + }); + if (withdrawals) { + withdrawals.forEach(async (w) => { + if (w.status === WithdrawalStatus.PENDING_OPERATOR) { + w.status = WithdrawalStatus.READY; + w.readyAt = BigInt(blockNumber); + w.updatedAt = BigInt(blockNumber); + await w.save(); + } + }); + } + + await Promise.all([operator.save(), domain.save(), account.save()]); +} + +export async function handleFundsUnlockedEvent( + event: SubstrateEvent +): Promise { + const { + event: { + data: [operatorId, nominatorId, amount], + }, + block, + } = event; + const blockNumber = block.block.header.number.toNumber(); + const amountBigInt = BigInt(amount.toString()); + + const operator = await db.checkAndGetOperator( + operatorId.toString(), + blockNumber + ); + const domain = await db.checkAndGetDomain( + operator.domainId, + BigInt(blockNumber) + ); + const account = await db.checkAndGetAccount( + nominatorId.toString(), + blockNumber + ); + const nominator = await db.checkAndGetNominator( + nominatorId.toString(), + domain.id, + operator.id, + blockNumber + ); + + const withdrawals = await Withdrawal.getByFields( + [ + ["operatorId", "=", operator.id], + ["accountId", "=", account.id], + ], + { limit: MAX_LIMIT } + ); + if (withdrawals) { + withdrawals.forEach(async (w) => { + if (w.status === WithdrawalStatus.PENDING_LOCK) { + w.status = WithdrawalStatus.WITHDRAW; + w.unlockedAmount = amountBigInt; + w.unlockedAt = BigInt(blockNumber); + w.updatedAt = BigInt(blockNumber); + await w.save(); + } + }); + } + + let amountToWithdraw = amountBigInt; + const deposits = await Deposit.getByFields( + [ + ["operatorId", "=", operator.id], + ["accountId", "=", account.id], + ], + { limit: MAX_LIMIT } + ); + if (deposits) { + deposits.forEach(async (d) => { + if (amountToWithdraw > 0) { + if (amountToWithdraw > d.totalAmount) { + amountToWithdraw -= d.totalAmount; + d.totalWithdrawn = d.totalAmount; + d.status = DepositStatus.WITHDRAWN; + } else { + d.totalWithdrawn = amountToWithdraw; + d.status = DepositStatus.PARTIALLY_WITHDRAWN; + amountToWithdraw = BigInt(0); + } + d.updatedAt = BigInt(blockNumber); + await d.save(); + } + }); + } + + domain.totalWithdrawals += amountBigInt; + domain.updatedAt = BigInt(blockNumber); + + account.totalWithdrawals += amountBigInt; + account.updatedAt = BigInt(blockNumber); + + operator.totalWithdrawals += amountBigInt; + operator.updatedAt = BigInt(blockNumber); + + nominator.totalWithdrawals += amountBigInt; + nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; + nominator.updatedAt = BigInt(blockNumber); + + await Promise.all([ + domain.save(), + account.save(), + operator.save(), + nominator.save(), + ]); +} + +export async function handleNominatedStakedUnlockedEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleNominatedStakedUnlockedEvent +} + +export async function handleNominatorUnlockedEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleNominatorUnlockedEvent +} + +export async function handleStorageFeeUnlockedEvent( + event: SubstrateEvent +): Promise { + // Implementation for handleStorageFeeUnlockedEvent +} diff --git a/indexers/staking/src/mappings/models.ts b/indexers/staking/src/mappings/models.ts new file mode 100644 index 000000000..6faa9de2d --- /dev/null +++ b/indexers/staking/src/mappings/models.ts @@ -0,0 +1,49 @@ +export enum DomainRuntime { + EVM = "EVM", + AUTO_ID = "AUTO_ID", +} + +export enum OperatorStatus { + PENDING = "PENDING", + REGISTERED = "REGISTERED", + DEREGISTERED = "DEREGISTERED", + SLASHED = "SLASHED", +} + +export enum OperatorPendingAction { + NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", + PENDING_REGISTRATION = "PENDING_REGISTRATION", + WAITING_TO_UNLOCK_NOMINATOR = "WAITING_TO_UNLOCK_NOMINATOR", + READY_FOR_UNLOCK_NOMINATOR = "READY_FOR_UNLOCK_NOMINATOR", + READY_FOR_UNLOCK_FUNDS = "READY_FOR_UNLOCK_FUNDS", +} + +export enum NominatorStatus { + PENDING = "PENDING", + STAKED = "STAKED", + SLASHED = "SLASHED", + WITHDRAW = "WITHDRAW", +} + +export enum NominatorPendingAction { + NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", + PENDING_EPOCH_CHANGE = "PENDING_EPOCH_CHANGE", + PENDING_LOCK_PERIOD = "PENDING_LOCK_PERIOD", + READY_TO_UNLOCK_ALL_FUNDS = "READY_TO_UNLOCK_ALL_FUNDS", +} + +export enum DepositStatus { + PENDING = "PENDING", + DEPOSITED = "DEPOSITED", + PARTIALLY_WITHDRAWN = "PARTIALLY_WITHDRAWN", + WITHDRAWN = "WITHDRAWN", + SLASHED = "SLASHED", +} + +export enum WithdrawalStatus { + PENDING_LOCK = "PENDING_LOCK", + PENDING_OPERATOR = "PENDING_OPERATOR", + READY = "READY", + WITHDRAW = "WITHDRAW", + SLASHED = "SLASHED", +} diff --git a/indexers/staking/src/mappings/types.ts b/indexers/staking/src/mappings/types.ts new file mode 100644 index 000000000..aeddf35fe --- /dev/null +++ b/indexers/staking/src/mappings/types.ts @@ -0,0 +1,123 @@ +export interface TBundle { + sealedHeader: SealedBundleHeader; + extrinsics: Uint8Array[]; +} + +export interface SealedBundleHeader { + header: BundleHeader; + signature: Uint8Array; +} + +interface BundleHeader { + proofOfElection: ProofOfElection; + receipt: ExecutionReceipt; + estimatedBundleWeight: Weight; + bundleExtrinsicsRoot: Uint8Array; +} + +interface ProofOfElection { + domainId: number; + slotNumber: bigint; + proofOfTime: Uint8Array; + vrfSignature: VrfSignature; + operatorId: bigint; + consensusBlockHash: Uint8Array; +} + +export interface ExecutionReceipt { + domainBlockNumber: number; + domainBlockHash: Uint8Array; + domainBlockExtrinsicRoot: Uint8Array; + parentDomainBlockReceiptHash: Uint8Array; + consensusBlockNumber: number; + consensusBlockHash: Uint8Array; + inboxedBundles: InboxedBundle[]; + finalStateRoot: Uint8Array; + executionTrace: Uint8Array[]; + executionTraceRoot: Uint8Array; + blockFees: BlockFees; + transfers: Transfers; +} + +interface VrfSignature { + preOutput: Uint8Array; + proof: Uint8Array; +} + +interface Weight { + refTime: bigint; + proofSize: bigint; +} + +interface InboxedBundle { + bundle: BundleValidity; + extrinsicsRoot: Uint8Array; +} + +interface Transfers { + transfersIn: [ChainId, bigint][]; + transfersOut: [ChainId, bigint][]; + rejectedTransfersClaimed: [ChainId, bigint][]; + transfersRejected: [ChainId, bigint][]; +} + +interface BlockFees { + consensusStorageFee: bigint; + domainExecutionFee: bigint; + burnedBalance: bigint; +} + +type BundleValidity = BundleValidity_Invalid | BundleValidity_Valid; + +interface BundleValidity_Invalid { + __kind: "Invalid"; + value: InvalidBundleType; +} + +interface BundleValidity_Valid { + __kind: "Valid"; + value: Uint8Array; +} + +type ChainId = ChainId_Consensus | ChainId_Domain; + +interface ChainId_Consensus { + __kind: "Consensus"; +} + +interface ChainId_Domain { + __kind: "Domain"; + value: number; +} + +type InvalidBundleType = + | InvalidBundleType_UndecodableTx + | InvalidBundleType_OutOfRangeTx + | InvalidBundleType_IllegalTx + | InvalidBundleType_InvalidXDM + | InvalidBundleType_InherentExtrinsic; + +interface InvalidBundleType_UndecodableTx { + __kind: "UndecodableTx"; + value: number; +} + +interface InvalidBundleType_OutOfRangeTx { + __kind: "OutOfRangeTx"; + value: number; +} + +interface InvalidBundleType_IllegalTx { + __kind: "IllegalTx"; + value: number; +} + +interface InvalidBundleType_InvalidXDM { + __kind: "InvalidXDM"; + value: number; +} + +interface InvalidBundleType_InherentExtrinsic { + __kind: "InherentExtrinsic"; + value: number; +} diff --git a/indexers/staking/tsconfig.json b/indexers/staking/tsconfig.json new file mode 100644 index 000000000..fe36b561c --- /dev/null +++ b/indexers/staking/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "declaration": true, + "importHelpers": true, + "resolveJsonModule": true, + "module": "commonjs", + "outDir": "dist", + "rootDir": "src", + "target": "es2017", + "strict": true + }, + "include": [ + "src/**/*", + "../node_modules/@subql/types-core/dist/global.d.ts", + "../node_modules/@subql/types/dist/global.d.ts" + ] +} From c90a38dbd70746877b13b98b14b00344e1802805 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:40:12 -0500 Subject: [PATCH 5/8] remove mainnet/* --- indexers/mainnet/README.md | 68 - indexers/mainnet/consensus/.gitignore | 62 - indexers/mainnet/consensus/LICENSE | 21 - indexers/mainnet/consensus/README.md | 42 - indexers/mainnet/consensus/package.json | 58 - indexers/mainnet/consensus/project.ts | 75 -- indexers/mainnet/consensus/schema.graphql | 115 -- indexers/mainnet/consensus/src/index.ts | 3 - indexers/mainnet/consensus/src/mappings/db.ts | 269 ---- .../mainnet/consensus/src/mappings/helper.ts | 71 -- .../consensus/src/mappings/mappingHandlers.ts | 397 ------ .../mainnet/consensus/src/mappings/types.ts | 17 - .../mainnet/consensus/src/mappings/utils.ts | 58 - indexers/mainnet/consensus/tsconfig.json | 20 - indexers/mainnet/files/.gitignore | 62 - indexers/mainnet/files/LICENSE | 21 - indexers/mainnet/files/README.md | 40 - indexers/mainnet/files/package.json | 57 - indexers/mainnet/files/project.ts | 95 -- indexers/mainnet/files/schema.graphql | 67 - indexers/mainnet/files/src/index.ts | 3 - indexers/mainnet/files/src/mappings/db.ts | 146 --- .../files/src/mappings/mappingHandlers.ts | 139 -- indexers/mainnet/files/src/mappings/types.ts | 9 - indexers/mainnet/files/tsconfig.json | 20 - indexers/mainnet/leaderboard/.gitignore | 62 - indexers/mainnet/leaderboard/LICENSE | 21 - indexers/mainnet/leaderboard/README.md | 42 - indexers/mainnet/leaderboard/package.json | 55 - indexers/mainnet/leaderboard/project.ts | 63 - indexers/mainnet/leaderboard/schema.graphql | 247 ---- indexers/mainnet/leaderboard/src/index.ts | 3 - .../mainnet/leaderboard/src/mappings/db.ts | 612 --------- .../src/mappings/mappingHandlers.ts | 423 ------- indexers/mainnet/leaderboard/tsconfig.json | 20 - indexers/mainnet/staking/.gitignore | 62 - indexers/mainnet/staking/LICENSE | 21 - indexers/mainnet/staking/README.md | 42 - indexers/mainnet/staking/package.json | 55 - indexers/mainnet/staking/project.ts | 255 ---- indexers/mainnet/staking/schema.graphql | 387 ------ indexers/mainnet/staking/src/index.ts | 3 - .../mainnet/staking/src/mappings/constants.ts | 1 - indexers/mainnet/staking/src/mappings/db.ts | 566 --------- .../staking/src/mappings/mappingHandlers.ts | 1114 ----------------- .../mainnet/staking/src/mappings/models.ts | 49 - .../mainnet/staking/src/mappings/types.ts | 123 -- indexers/mainnet/staking/tsconfig.json | 20 - indexers/mainnet/yarn.lock | 4 - 49 files changed, 6185 deletions(-) delete mode 100644 indexers/mainnet/README.md delete mode 100644 indexers/mainnet/consensus/.gitignore delete mode 100644 indexers/mainnet/consensus/LICENSE delete mode 100644 indexers/mainnet/consensus/README.md delete mode 100644 indexers/mainnet/consensus/package.json delete mode 100644 indexers/mainnet/consensus/project.ts delete mode 100644 indexers/mainnet/consensus/schema.graphql delete mode 100644 indexers/mainnet/consensus/src/index.ts delete mode 100644 indexers/mainnet/consensus/src/mappings/db.ts delete mode 100644 indexers/mainnet/consensus/src/mappings/helper.ts delete mode 100644 indexers/mainnet/consensus/src/mappings/mappingHandlers.ts delete mode 100644 indexers/mainnet/consensus/src/mappings/types.ts delete mode 100644 indexers/mainnet/consensus/src/mappings/utils.ts delete mode 100644 indexers/mainnet/consensus/tsconfig.json delete mode 100644 indexers/mainnet/files/.gitignore delete mode 100644 indexers/mainnet/files/LICENSE delete mode 100644 indexers/mainnet/files/README.md delete mode 100644 indexers/mainnet/files/package.json delete mode 100644 indexers/mainnet/files/project.ts delete mode 100644 indexers/mainnet/files/schema.graphql delete mode 100644 indexers/mainnet/files/src/index.ts delete mode 100644 indexers/mainnet/files/src/mappings/db.ts delete mode 100644 indexers/mainnet/files/src/mappings/mappingHandlers.ts delete mode 100644 indexers/mainnet/files/src/mappings/types.ts delete mode 100644 indexers/mainnet/files/tsconfig.json delete mode 100644 indexers/mainnet/leaderboard/.gitignore delete mode 100644 indexers/mainnet/leaderboard/LICENSE delete mode 100644 indexers/mainnet/leaderboard/README.md delete mode 100644 indexers/mainnet/leaderboard/package.json delete mode 100644 indexers/mainnet/leaderboard/project.ts delete mode 100644 indexers/mainnet/leaderboard/schema.graphql delete mode 100644 indexers/mainnet/leaderboard/src/index.ts delete mode 100644 indexers/mainnet/leaderboard/src/mappings/db.ts delete mode 100644 indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts delete mode 100644 indexers/mainnet/leaderboard/tsconfig.json delete mode 100644 indexers/mainnet/staking/.gitignore delete mode 100644 indexers/mainnet/staking/LICENSE delete mode 100644 indexers/mainnet/staking/README.md delete mode 100644 indexers/mainnet/staking/package.json delete mode 100644 indexers/mainnet/staking/project.ts delete mode 100644 indexers/mainnet/staking/schema.graphql delete mode 100644 indexers/mainnet/staking/src/index.ts delete mode 100644 indexers/mainnet/staking/src/mappings/constants.ts delete mode 100644 indexers/mainnet/staking/src/mappings/db.ts delete mode 100644 indexers/mainnet/staking/src/mappings/mappingHandlers.ts delete mode 100644 indexers/mainnet/staking/src/mappings/models.ts delete mode 100644 indexers/mainnet/staking/src/mappings/types.ts delete mode 100644 indexers/mainnet/staking/tsconfig.json delete mode 100644 indexers/mainnet/yarn.lock diff --git a/indexers/mainnet/README.md b/indexers/mainnet/README.md deleted file mode 100644 index e931fc4c3..000000000 --- a/indexers/mainnet/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# Mainnet Indexer - -## Overview - -The Gemini 3H Indexer is a powerful tool designed to index and manage blockchain data efficiently. It supports various functionalities including account management, consensus mechanisms, leaderboard tracking, and staking operations. - -## Features - -- **Accounts**: Manage user accounts and their associated data. -- **Consensus**: Implement and manage consensus algorithms. -- **Leaderboard**: Track and display rankings based on various metrics. -- **Staking**: Handle staking operations and rewards distribution. - -## Directory Structure - -- `consensus/`: Includes files related to consensus mechanisms. -- `leaderboard/`: Manages leaderboard data and display. -- `staking/`: Handles staking operations and reward calculations. - -## Getting Started - -To get started with the Gemini 3H Indexer, follow these steps: - -1. **Clone the repository**: - - ```sh - git clone https://github.com/autonomys/astral.git - cd indexers - ``` - -2. **Install dependencies**: - - ```sh - yarn install - ``` - -3. **Run the indexer**: - ```sh - yarn dev - ``` - -## Usage - -Detailed usage instructions for each module can be found in their respective directories. Below are some common commands: - -- **Start the indexer**: - - ```sh - yarn dev - ``` - -## Contributing - -We welcome contributions from the community. To contribute, please follow these steps: - -1. Fork the repository. -2. Create a new branch (`git checkout -b feature-branch`). -3. Make your changes and commit them (`git commit -m 'Add new feature'`). -4. Push to the branch (`git push origin feature-branch`). -5. Create a pull request. - -## License - -This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. - -## Contact - -For any questions or support, please open an issue or contact us at support@gemini3h.com. diff --git a/indexers/mainnet/consensus/.gitignore b/indexers/mainnet/consensus/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/mainnet/consensus/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/mainnet/consensus/LICENSE b/indexers/mainnet/consensus/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/mainnet/consensus/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/mainnet/consensus/README.md b/indexers/mainnet/consensus/README.md deleted file mode 100644 index c6294b978..000000000 --- a/indexers/mainnet/consensus/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Consensus - -The Autonomys Astral Explorer Consensus is a specialized SubQuery project that indexes all consensus-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the consensus tracking functionality for the Astral Explorer, providing real-time data on validator activities and network consensus. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all consensus-related events using the relevant pallets -2. Capturing system remarks for additional consensus actions -3. Tracking and updating validator performance and network consensus metrics - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of consensus events -- Monitoring of system remarks for specific consensus actions -- Validator performance calculation and updates -- Support for querying consensus history and network statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/consensus` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/mainnet/consensus/package.json b/indexers/mainnet/consensus/package.json deleted file mode 100644 index 7a7fa6c47..000000000 --- a/indexers/mainnet/consensus/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "consensus", - "version": "1.0.0", - "description": "Autonomys Network - Consensus", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@autonomys/auto-consensus": "^1.2.1", - "@autonomys/auto-dag-data": "^1.2.1", - "@autonomys/auto-utils": "^1.2.1", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/mainnet/consensus/project.ts b/indexers/mainnet/consensus/project.ts deleted file mode 100644 index 0fd4e4ad6..000000000 --- a/indexers/mainnet/consensus/project.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-consensus", - description: "Autonomys Network - Consensus", - repository: "https://github.com/autonomys/astral", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - // @ts-ignore - types: { - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Block, - handler: "handleBlock", - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/mainnet/consensus/schema.graphql b/indexers/mainnet/consensus/schema.graphql deleted file mode 100644 index a8ede486d..000000000 --- a/indexers/mainnet/consensus/schema.graphql +++ /dev/null @@ -1,115 +0,0 @@ -# Core Consensus Entities - -type Block @entity { - id: ID! - sortId: String! @index - height: BigInt! @index - hash: String! @index - timestamp: Date! @index - parentHash: String! - specId: String! - stateRoot: String! - extrinsicsRoot: String! - spacePledged: BigInt! - blockchainSize: BigInt! - extrinsicsCount: Int! - eventsCount: Int! - transfersCount: Int! - rewardsCount: Int! - blockRewardsCount: Int! - voteRewardsCount: Int! - transferValue: BigInt! - rewardValue: BigInt! - blockRewardValue: BigInt! - voteRewardValue: BigInt! - authorId: String! @index -} - -type Log @entity { - id: ID! - sortId: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - indexInBlock: Int! @index - kind: String! - value: String - timestamp: Date! @index -} - -type Extrinsic @entity { - id: ID! - sortId: String! @index - hash: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - section: String! @index - module: String! @index - name: String! - indexInBlock: Int! - success: Boolean! @index - timestamp: Date! @index - nonce: BigInt! - signer: String! @index - signature: String! - args: String! - error: String! - tip: BigInt! - fee: BigInt! - pos: Int! - cid: String @index -} - -type Event @entity { - id: ID! - sortId: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - section: String! @index - module: String! @index - name: String! - indexInBlock: BigInt! - timestamp: Date! @index - phase: String! - pos: Int! - args: String! - cid: String @index -} - -# Accounts Entities - -type AccountHistory @entity { - id: ID! - nonce: BigInt! - free: BigInt! - reserved: BigInt! - total: BigInt @index - createdAt: BigInt! @index -} - -type Transfer @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - eventId: String! @index - from: String! @index - to: String! @index - value: BigInt! - fee: BigInt! - success: Boolean! - timestamp: Date! @index -} - -type Reward @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - eventId: String! @index - accountId: String! @index - rewardType: String! @index - amount: BigInt! - timestamp: Date! @index -} diff --git a/indexers/mainnet/consensus/src/index.ts b/indexers/mainnet/consensus/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/mainnet/consensus/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/mainnet/consensus/src/mappings/db.ts b/indexers/mainnet/consensus/src/mappings/db.ts deleted file mode 100644 index 633e8575b..000000000 --- a/indexers/mainnet/consensus/src/mappings/db.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { - AccountHistory, - Block, - Event, - Extrinsic, - Log, - Reward, - Transfer, -} from "../types"; -import { dateEntry, getSortId, moduleName } from "./utils"; - -// Core Consensus DB Functions - -export async function createAndSaveBlock( - hash: string, - height: bigint, - timestamp: Date, - parentHash: string, - specId: string, - stateRoot: string, - extrinsicsRoot: string, - spacePledged: bigint, - blockchainSize: bigint, - extrinsicsCount: number, - eventsCount: number, - transfersCount: number, - rewardsCount: number, - blockRewardsCount: number, - voteRewardsCount: number, - transferValue: bigint, - rewardValue: bigint, - blockRewardValue: bigint, - voteRewardValue: bigint, - authorId: string -): Promise { - const id = height.toString(); - const sortId = getSortId(height); - const block = Block.create({ - id, - sortId, - height, - hash, - timestamp, - parentHash, - specId, - stateRoot, - extrinsicsRoot, - spacePledged, - blockchainSize, - extrinsicsCount, - eventsCount, - transfersCount, - rewardsCount, - blockRewardsCount, - voteRewardsCount, - transferValue, - rewardValue, - blockRewardValue, - voteRewardValue, - authorId, - }); - await block.save(); - return block; -} - -export async function createAndSaveLog( - blockHeight: bigint, - blockHash: string, - indexInBlock: number, - kind: string, - value: string, - timestamp: Date -): Promise { - const id = `${blockHeight}-${indexInBlock}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - const log = Log.create({ - id, - sortId, - blockHeight, - blockHash, - indexInBlock, - kind, - value, - timestamp, - }); - await log.save(); - return log; -} - -export async function saveLog(logs: Log[]): Promise { - await Promise.all(logs.map((log) => log.save())); -} - -export function createExtrinsic( - hash: string, - blockHeight: bigint, - blockHash: string, - indexInBlock: number, - section: string, - module: string, - success: boolean, - timestamp: Date, - nonce: bigint, - signer: string, - signature: string, - args: string, - error: string, - tip: bigint, - fee: bigint, - pos: number, - cid?: string -): Extrinsic { - const extrinsicId = `${blockHeight}-${indexInBlock}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - return Extrinsic.create({ - id: extrinsicId, - sortId, - hash, - blockHeight, - blockHash, - indexInBlock, - section, - module, - name: moduleName(section, module), - success, - timestamp, - nonce, - signer, - signature, - args, - error, - tip, - fee, - pos, - cid, - }); -} - -export async function saveExtrinsics(extrinsics: Extrinsic[]): Promise { - await Promise.all(extrinsics.map((extrinsic) => extrinsic.save())); -} - -export function createEvent( - blockHeight: bigint, - blockHash: string, - indexInBlock: bigint, - extrinsicId: string, - extrinsicHash: string, - section: string, - module: string, - timestamp: Date, - phase: string, - pos: number, - args: string, - cid?: string -): Event { - const id = `${blockHeight}-${indexInBlock.toString()}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - return Event.create({ - id, - sortId, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - section, - module, - name: moduleName(section, module), - timestamp, - phase, - pos, - args, - cid, - }); -} - -export async function saveEvents(events: Event[]): Promise { - await Promise.all(events.map((event) => event.save())); -} - -// Accounts DB Functions - -export function createAccountHistory( - id: string, - blockNumber: bigint, - nonce: bigint, - free: bigint, - reserved: bigint, - total: bigint -): AccountHistory { - const accountHistory = AccountHistory.create({ - id, - nonce, - free, - reserved, - total, - ...dateEntry(blockNumber), - }); - return accountHistory; -} - -export async function saveAccountHistories( - accountHistories: AccountHistory[] -): Promise { - await Promise.all( - accountHistories.map((accountHistory) => accountHistory.save()) - ); -} - -export function createTransfer( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - eventId: string, - from: string, - to: string, - value: bigint, - fee: bigint, - success: boolean, - timestamp: Date -): Transfer { - const id = extrinsicId + "-" + eventId; - return Transfer.create({ - id, - blockHeight, - blockHash, - extrinsicId, - eventId, - from, - to, - value, - fee, - success, - timestamp, - }); -} - -export async function saveTransfers(transfers: Transfer[]): Promise { - await Promise.all(transfers.map((transfer) => transfer.save())); -} - -export function createReward( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - eventId: string, - accountId: string, - rewardType: string, - amount: bigint, - timestamp: Date -): Reward { - const id = accountId + "-" + eventId; - return Reward.create({ - id, - blockHeight, - blockHash, - extrinsicId, - eventId, - accountId, - rewardType, - amount, - timestamp, - }); -} - -export async function saveRewards(rewards: Reward[]): Promise { - await Promise.all(rewards.map((reward) => reward.save())); -} diff --git a/indexers/mainnet/consensus/src/mappings/helper.ts b/indexers/mainnet/consensus/src/mappings/helper.ts deleted file mode 100644 index 03791e34f..000000000 --- a/indexers/mainnet/consensus/src/mappings/helper.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - cidOfNode, - cidToString, - decodeNode, - PBNode, -} from "@autonomys/auto-dag-data"; -import { stringify } from "@autonomys/auto-utils"; -import { Bytes } from "@polkadot/types"; -import { compactStripLength } from "@polkadot/util"; -import { SubstrateBlock } from "@subql/types"; -import { Cid, ModifiedArgs, ParsedArgs } from "./types"; -import { decodeLog, hexToUint8Array } from "./utils"; - -const DEFAULT_ACCOUNT_ID = "0x00"; - -export const getBlockAuthor = (block: SubstrateBlock): string => { - const { digest } = block.block.header; - const preRuntimeRaw = digest.logs.find((digestI) => digestI.isPreRuntime); - if (preRuntimeRaw) { - const value = decodeLog(preRuntimeRaw.asPreRuntime); - if (value) { - api.registry.register({ - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }); - const type = api.registry.createType("SubPreDigest", value.data); - const publicKey = (type.toPrimitive() as any).solution.public_key; - const rewardAddress = (type.toPrimitive() as any).solution.reward_address; - return rewardAddress; - } - } - return DEFAULT_ACCOUNT_ID; -}; - -export const parseDataToCid = (data: string): ParsedArgs => { - let cid: Cid = undefined; - let modifiedArgs: ModifiedArgs = undefined; - let node: PBNode | null = null; - try { - const hexString = data.startsWith("0x") ? data.slice(2) : data; - const buffer = Buffer.from(hexString, "hex"); - try { - const [length, bytes] = compactStripLength(buffer); - const isValidLength = length === bytes.length; - try { - const encoded = isValidLength - ? Bytes.from(buffer) - : hexToUint8Array(data); - node = decodeNode(encoded); - } catch (error) { - node = decodeNode(buffer); - } - cid = cidToString(cidOfNode(node)); - } catch (error) { - const encoded = Bytes.from(buffer); - const node = decodeNode(encoded); - cid = cidToString(cidOfNode(node)); - } - modifiedArgs = stringify({ cid }); - } catch (error) { - logger.error("Error decoding remark or seedHistory extrinsic"); - logger.error(error); - } - return { cid, modifiedArgs }; -}; diff --git a/indexers/mainnet/consensus/src/mappings/mappingHandlers.ts b/indexers/mainnet/consensus/src/mappings/mappingHandlers.ts deleted file mode 100644 index 4fa4f71ab..000000000 --- a/indexers/mainnet/consensus/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,397 +0,0 @@ -global.TextEncoder = require("util").TextEncoder; -global.TextDecoder = require("util").TextDecoder; -global.Buffer = require("buffer/").Buffer; - -import { - account, - blockchainSize, - spacePledge, -} from "@autonomys/auto-consensus"; -import type { ApiAtBlockHash } from "@autonomys/auto-utils"; -import { stringify } from "@autonomys/auto-utils"; -import { SubstrateBlock } from "@subql/types"; -import { Event, Extrinsic, Reward, Transfer } from "../types"; -import { - createAccountHistory, - createAndSaveBlock, - createAndSaveLog, - createEvent, - createExtrinsic, - createReward, - createTransfer, - saveAccountHistories, - saveEvents, - saveExtrinsics, - saveRewards, - saveTransfers, -} from "./db"; -import { getBlockAuthor, parseDataToCid } from "./helper"; -import { ExtrinsicPrimitive, LogValue } from "./types"; - -export async function handleBlock(_block: SubstrateBlock): Promise { - const { - block: { - header: { number, parentHash, stateRoot, extrinsicsRoot, digest }, - hash, - extrinsics, - }, - timestamp, - specVersion, - events, - } = _block; - const height = BigInt(number.toString()); - const blockHash = hash.toString(); - const blockTimestamp = timestamp ? timestamp : new Date(0); - const authorId = getBlockAuthor(_block); - const eventsCount = events.length; - const extrinsicsCount = extrinsics.length; - - const newExtrinsics: Extrinsic[] = []; - const newEvents: Event[] = []; - const newTransfers: Transfer[] = []; - const newRewards: Reward[] = []; - - const extrinsicMethodsToUpdate: [string, string][] = []; - const eventMethodsToUpdate: [string, string][] = []; - const logKindsToUpdate: string[] = []; - const addressToUpdate: string[] = []; - - let eventIndex = 0; - let totalBlockRewardsCount = 0; - let totalVoteRewardsCount = 0; - let totalTransferValue = BigInt(0); - let totalRewardValue = BigInt(0); - let totalBlockRewardValue = BigInt(0); - let totalVoteRewardValue = BigInt(0); - - // Calculate space pledged and blockchain size concurrently - const [_spacePledged, _blockchainSize] = await Promise.all([ - spacePledge(api as unknown as ApiAtBlockHash), - blockchainSize(api as unknown as ApiAtBlockHash), - ]); - - // Process extrinsics - extrinsics.forEach((extrinsic, extrinsicIdx) => { - const extrinsicMethodToPrimitive = - extrinsic.method.toPrimitive() as ExtrinsicPrimitive; - - const extrinsicEvents = events.filter( - (e) => - e.phase.isApplyExtrinsic && - e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx - ); - - const feeEvent = events.find( - (e) => - e.phase.isApplyExtrinsic && - e.event.section === "balances" && - e.event.method === "Withdraw" - ); - const fee = - feeEvent && feeEvent.event && feeEvent.event.data[1] - ? BigInt(feeEvent.event.data[1].toString()) - : BigInt(0); - - const errorEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicFailed" - ); - const successEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const error = errorEvent ? stringify(errorEvent.event.data) : ""; - - const pos = extrinsicEvents ? extrinsicIdx : 0; - const extrinsicSigner = extrinsic.signer.toString(); - - // Detect data storage extrinsics and parse args to cid - let cid: string | undefined = undefined; - let args: string = stringify(extrinsicMethodToPrimitive.args); - if ( - (extrinsic.method.section === "historySeeding" && - extrinsic.method.method === "seedHistory") || - (extrinsic.method.section === "system" && - (extrinsic.method.method === "remarkWithEvent" || - extrinsic.method.method === "remark")) - ) { - const parsedArgs = parseDataToCid(extrinsicMethodToPrimitive.args.remark); - cid = parsedArgs.cid; - // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db - args = parsedArgs.modifiedArgs ?? args; - } - - newExtrinsics.push( - createExtrinsic( - extrinsic.hash.toString(), - height, - blockHash, - extrinsicIdx, - extrinsic.method.section, - extrinsic.method.method, - successEvent ? true : false, - timestamp ? timestamp : new Date(0), - BigInt(extrinsic.nonce.toString()), - extrinsicSigner, - extrinsic.signature.toString(), - args, - error, - BigInt(extrinsic.tip.toString()), - fee, - pos, - cid - ) - ); - extrinsicMethodsToUpdate.push([ - extrinsic.method.section, - extrinsic.method.method, - ]); - addressToUpdate.push(extrinsicSigner); - - // Process extrinsic events - extrinsicEvents.forEach((event) => { - const extrinsicId = extrinsic - ? height + "-" + extrinsicIdx.toString() - : ""; - - // Detect data storage extrinsics and parse args to cid - let cid: string | undefined = undefined; - let args: string = stringify(event.event.data); - if ( - event.event.section === "system" && - event.event.method === "Remarked" - ) { - const parsedArgs = parseDataToCid(event.event.data[1].toString()); - cid = parsedArgs.cid; - // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db - args = parsedArgs.modifiedArgs ?? args; - } - - newEvents.push( - createEvent( - height, - blockHash, - BigInt(eventIndex), - extrinsicId, - extrinsic.hash.toString(), - event.event.section, - event.event.method, - timestamp ? timestamp : new Date(0), - event.phase.type, - pos, - args, - cid - ) - ); - eventMethodsToUpdate.push([event.event.section, event.event.method]); - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "balances.Transfer": { - const from = event.event.data[0].toString(); - const to = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - addressToUpdate.push(from, to); - - totalTransferValue += amount; - - const newTransfer = createTransfer( - height, - blockHash, - extrinsicId, - height + "-" + eventIndex, - from, - to, - amount, - fee, - successEvent ? true : false, - timestamp ? timestamp : new Date(0) - ); - newTransfers.push(newTransfer); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - - // Get finalization events - const finalizationEvents = events.filter((e) => e.phase.isFinalization); - - // Process finalization events - finalizationEvents.forEach(async (event) => { - newEvents.push( - createEvent( - height, - blockHash, - BigInt(eventIndex), - height + "-" + event.phase.type, - extrinsic.hash.toString(), - event.event.section, - event.event.method, - timestamp ? timestamp : new Date(0), - event.phase.type, - pos, - args, - cid - ) - ); - eventMethodsToUpdate.push([event.event.section, event.event.method]); - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "rewards.VoteReward": { - const voter = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - addressToUpdate.push(voter); - - totalVoteRewardsCount++; - totalRewardValue += reward; - totalVoteRewardValue += reward; - - const newReward = createReward( - height, - blockHash, - height + "-" + event.phase.type, - height + "-" + eventIndex, - voter, - "rewards.VoteReward", - reward, - timestamp ? timestamp : new Date(0) - ); - newRewards.push(newReward); - - break; - } - case "rewards.BlockReward": { - const blockAuthor = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - addressToUpdate.push(blockAuthor); - - totalBlockRewardsCount++; - totalRewardValue += reward; - totalBlockRewardValue += reward; - - const newReward = createReward( - height, - blockHash, - height + "-" + event.phase.type, - height + "-" + eventIndex, - blockAuthor, - "rewards.BlockReward", - reward, - timestamp ? timestamp : new Date(0) - ); - newRewards.push(newReward); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - }); - - // Create and save block logs - await Promise.all( - digest.logs.map((log, i) => { - const logData = log.toHuman(); - const logJson = log.toPrimitive(); - const kind = logData ? Object.keys(logData)[0] : ""; - const rawKind = logJson ? Object.keys(logJson)[0] : ""; - const _value = logJson ? logJson[rawKind as keyof typeof logJson] : ""; - const value: LogValue = - Array.isArray(_value) && _value.length === 2 - ? { data: _value[1], engine: _value[0] } - : { data: _value }; - - logKindsToUpdate.push(kind); - return createAndSaveLog( - height, - blockHash, - i, - kind, - stringify(value), - blockTimestamp - ); - }) - ); - - // Build sections - const allSections = [ - ...extrinsicMethodsToUpdate.map((method) => method[0]), - ...eventMethodsToUpdate.map((method) => method[0]), - ]; - - // Remove duplicate entry before updating entities - const uniqueAddresses = [...new Set(addressToUpdate)]; - const uniqueSections = [...new Set(allSections)]; - const uniqueExtrinsicMethods = [...new Set(extrinsicMethodsToUpdate)]; - const uniqueEventMethods = [...new Set(eventMethodsToUpdate)]; - const uniqueLogKinds = [...new Set(logKindsToUpdate)]; - - // Update accounts - const accounts = await Promise.all( - uniqueAddresses.map((address) => account(api as any, address)) - ); - // Create and save accounts - const accountHistories = await Promise.all( - accounts.map((account, i) => - createAccountHistory( - uniqueAddresses[i], - height, - BigInt(account.nonce.toString()), - account.data.free, - account.data.reserved, - account.data.free + account.data.reserved - ) - ) - ); - - // Save many entities in parallel - await Promise.all([ - // Save extrinsic and events - saveExtrinsics(newExtrinsics), - saveEvents(newEvents), - - // Save transfers and rewards - saveTransfers(newTransfers), - saveRewards(newRewards), - // Save account - saveAccountHistories(accountHistories), - ]); - - // Create block - await createAndSaveBlock( - blockHash, - height, - blockTimestamp, - parentHash.toString(), - specVersion.toString(), - stateRoot.toString(), - extrinsicsRoot.toString(), - _spacePledged, - _blockchainSize, - extrinsicsCount, - eventsCount, - newTransfers.length, - newRewards.length, - totalBlockRewardsCount, - totalVoteRewardsCount, - totalTransferValue, - totalRewardValue, - totalBlockRewardValue, - totalVoteRewardValue, - authorId - ); -} diff --git a/indexers/mainnet/consensus/src/mappings/types.ts b/indexers/mainnet/consensus/src/mappings/types.ts deleted file mode 100644 index d2fc41c3c..000000000 --- a/indexers/mainnet/consensus/src/mappings/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type ExtrinsicPrimitive = { - callIndex: string; - args: any; -}; - -export type LogValue = { - data: any; - engine?: string; -}; - -export type Cid = string | undefined; -export type ModifiedArgs = string | undefined; - -export type ParsedArgs = { - cid: Cid; - modifiedArgs: ModifiedArgs; -}; diff --git a/indexers/mainnet/consensus/src/mappings/utils.ts b/indexers/mainnet/consensus/src/mappings/utils.ts deleted file mode 100644 index bc0f31f62..000000000 --- a/indexers/mainnet/consensus/src/mappings/utils.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { capitalizeFirstLetter } from "@autonomys/auto-utils"; -import { SubstrateBlock } from "@subql/types"; - -export const dateEntry = (blockNumber: number | bigint) => { - if (typeof blockNumber === "number") { - blockNumber = BigInt(blockNumber); - } - return { - createdAt: blockNumber, - updatedAt: blockNumber, - }; -}; - -export const getBlockNumberFromBlock = (block: SubstrateBlock): number => { - try { - return block.block.header.number.toNumber(); - } catch (error) { - logger.error(`Error getting block number: ${error}`); - throw error; - } -}; - -export const decodeLog = (value: null | Uint8Array | Uint8Array[]) => { - if (!value) return null; - - if (Array.isArray(value)) { - return { - engine: value[0].toString(), - data: value[1], - }; - } - - return { data: value }; -}; - -export const moduleName = (section: string, method: string) => - `${capitalizeFirstLetter(section)}.${capitalizeFirstLetter(method)}`; - -export const getSortId = ( - blockHeight: bigint, - indexInBlock?: bigint -): string => { - const totalLength = 32; - const str1 = blockHeight.toString().padStart(totalLength, "0"); - - if (indexInBlock === undefined) return str1; - - const str2 = indexInBlock.toString().padStart(totalLength, "0"); - return `${str1}-${str2}`; -}; - -export const hexToUint8Array = (hex: string): Uint8Array => { - if (hex.length % 2 !== 0) - throw new Error("Hex string must have an even length"); - return new Uint8Array( - hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] - ); -}; diff --git a/indexers/mainnet/consensus/tsconfig.json b/indexers/mainnet/consensus/tsconfig.json deleted file mode 100644 index 08ea779b9..000000000 --- a/indexers/mainnet/consensus/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/mainnet/files/.gitignore b/indexers/mainnet/files/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/mainnet/files/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/mainnet/files/LICENSE b/indexers/mainnet/files/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/mainnet/files/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/mainnet/files/README.md b/indexers/mainnet/files/README.md deleted file mode 100644 index 5705e493f..000000000 --- a/indexers/mainnet/files/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Autonomys Astral Indexer - Files - -The Autonomys Astral Indexer - Files is a specialized SubQuery project that indexes all files on the Autonomys Mainnen. This project is designed to support the files tracking functionality for the Astral Explorer, providing real-time data on files. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all files and CIDs on the Autonomys Mainnet - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of consensus events -- Monitoring of system remarks for specific consensus actions -- Validator performance calculation and updates -- Support for querying consensus history and network statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/consensus` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/mainnet/files/package.json b/indexers/mainnet/files/package.json deleted file mode 100644 index 3f0e44fad..000000000 --- a/indexers/mainnet/files/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "files", - "version": "1.0.0", - "description": "Autonomys Network - Files", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@autonomys/auto-dag-data": "^1.2.1", - "@autonomys/auto-utils": "^1.2.1", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/mainnet/files/project.ts b/indexers/mainnet/files/project.ts deleted file mode 100644 index 489656158..000000000 --- a/indexers/mainnet/files/project.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-files", - description: "Autonomys Network - Files", - repository: "https://github.com/autonomys/astral", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - // @ts-ignore - types: { - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "historySeeding", - method: "seedHistory", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "system", - method: "remarkWithEvent", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "system", - method: "remark", - }, - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/mainnet/files/schema.graphql b/indexers/mainnet/files/schema.graphql deleted file mode 100644 index f0248cc0f..000000000 --- a/indexers/mainnet/files/schema.graphql +++ /dev/null @@ -1,67 +0,0 @@ -type Cid @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - indexInBlock: Int! @index - links: [String]! - timestamp: Date! @index -} - -type Chunk @entity { - id: ID! - type: String! @index - linkDepth: Int! @index - size: BigInt - name: String - data: String - uploadOptions: String -} - -type Metadata @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type MetadataCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type Folder @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type FolderCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type File @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type FileCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type Error @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - indexInBlock: Int! @index - error: String! - timestamp: Date! @index -} diff --git a/indexers/mainnet/files/src/index.ts b/indexers/mainnet/files/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/mainnet/files/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/mainnet/files/src/mappings/db.ts b/indexers/mainnet/files/src/mappings/db.ts deleted file mode 100644 index 344c6f10b..000000000 --- a/indexers/mainnet/files/src/mappings/db.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { - Chunk, - Cid, - Error, - File, - FileCid, - Folder, - FolderCid, - Metadata, - MetadataCid, -} from "../types"; - -export async function createAndSaveCid( - cid: string, - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - extrinsicHash: string, - indexInBlock: number, - links: string[], - timestamp: Date -): Promise { - const _cid = Cid.create({ - id: cid, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - links, - timestamp, - }); - await _cid.save(); - return _cid; -} - -export async function createAndSaveChunk( - cid: string, - type: string, - linkDepth: number, - size?: bigint, - name?: string, - data?: string, - uploadOptions?: string -): Promise { - const chunk = Chunk.create({ - id: cid, - type, - linkDepth, - size, - name, - data, - uploadOptions, - }); - await chunk.save(); - return chunk; -} - -const prepareRelation = (cid: string, link: string) => ({ - id: `${cid}:${link}`, - parentCid: cid, - childCid: link, -}); - -export async function createAndSaveMetadata( - cid: string, - links: string[], - name?: string -): Promise { - const metadata = Metadata.create({ - id: cid, - size: BigInt(0), - name, - }); - await metadata.save(); - if (links.length > 0) { - const relations = links.map((link) => - MetadataCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return metadata; -} - -export async function createAndSaveFolder( - cid: string, - links: string[], - name?: string -): Promise { - const folder = Folder.create({ - id: cid, - size: BigInt(0), - name, - }); - await folder.save(); - if (links.length > 0) { - const relations = links.map((link) => - FolderCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return folder; -} - -export async function createAndSaveFile( - cid: string, - links: string[], - name?: string -): Promise { - const file = File.create({ - id: cid, - size: BigInt(0), - name, - }); - await file.save(); - if (links.length > 0) { - const relations = links.map((link) => - FileCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return file; -} - -export async function createAndSaveError( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - extrinsicHash: string, - indexInBlock: number, - error: string, - timestamp: Date -): Promise { - const _error = Error.create({ - id: extrinsicId, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - error, - timestamp, - }); - await _error.save(); - return _error; -} diff --git a/indexers/mainnet/files/src/mappings/mappingHandlers.ts b/indexers/mainnet/files/src/mappings/mappingHandlers.ts deleted file mode 100644 index 17f13a9a8..000000000 --- a/indexers/mainnet/files/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,139 +0,0 @@ -global.TextEncoder = require("util").TextEncoder; -global.TextDecoder = require("util").TextDecoder; -global.Buffer = require("buffer/").Buffer; - -import { - cidOfNode, - cidToString, - decodeNode, - IPLDNodeData, - MetadataType, - PBNode, -} from "@autonomys/auto-dag-data"; -import { stringify } from "@autonomys/auto-utils"; -import { Bytes } from "@polkadot/types"; -import { compactStripLength } from "@polkadot/util"; -import { SubstrateExtrinsic } from "@subql/types"; -import { - createAndSaveChunk, - createAndSaveCid, - createAndSaveError, - createAndSaveFile, - createAndSaveFolder, - createAndSaveMetadata, -} from "./db"; -import { ExtrinsicPrimitive } from "./types"; - -const hexToUint8Array = (hex: string): Uint8Array => { - if (hex.length % 2 !== 0) - throw new Error("Hex string must have an even length"); - return new Uint8Array( - hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] - ); -}; - -export async function handleCall(_call: SubstrateExtrinsic): Promise { - const { - idx, - block: { - timestamp, - block: { - header: { number, hash: blockHash }, - }, - }, - extrinsic: { method, hash }, - success, - } = _call; - // Skip if extrinsic failed - if (!success) return; - - const methodToPrimitive = method.toPrimitive() as ExtrinsicPrimitive; - try { - const data = methodToPrimitive.args.remark; - const hexString = data.startsWith("0x") ? data.slice(2) : data; - const buffer = Buffer.from(hexString, "hex"); - const [length, bytes] = compactStripLength(buffer); - const isValidLength = length === bytes.length; - let node: PBNode | null = null; - - try { - const encoded = isValidLength - ? Bytes.from(buffer) - : hexToUint8Array(data); - node = decodeNode(encoded); - } catch (error) { - node = decodeNode(buffer); - } - const cid = cidToString(cidOfNode(node)); - const links = node.Links.map((l) => cidToString(l.Hash)); - if (cid) { - await createAndSaveCid( - cid, - BigInt(number.toString()), - blockHash.toString(), - `${number}-${idx}`, - hash.toString(), - idx, - links, - timestamp ? timestamp : new Date(0) - ); - - if (node.Data) { - const nodeData = IPLDNodeData.decode(node.Data); - let stringifyData = ""; - try { - const data = JSON.parse(stringify(nodeData.data)).data; - if (!data) throw new Error("Data is null"); - - const dataAsArrayBuffer = new Uint8Array(data); - stringifyData = stringify(dataAsArrayBuffer); - } catch { - stringifyData = stringify(nodeData.data); - } - await createAndSaveChunk( - cid, - nodeData.type, - nodeData.linkDepth, - nodeData.size, - nodeData.name, - stringifyData, - stringify(nodeData.uploadOptions) - ); - - switch (nodeData.type) { - case MetadataType.Metadata: - await createAndSaveMetadata(cid, links, nodeData.name); - break; - case MetadataType.Folder: - await createAndSaveFolder(cid, links, nodeData.name); - break; - case MetadataType.File: - await createAndSaveFile(cid, links, nodeData.name); - break; - // Skip inlinks and chunks as they are already saved in chunks table - case MetadataType.FileInlink: - case MetadataType.FileChunk: - case MetadataType.FolderInlink: - case MetadataType.MetadataInlink: - case MetadataType.MetadataChunk: - break; - default: - logger.warn(`Unknown node type: ${nodeData.type} for cid: ${cid}`); - break; - } - } - } - } catch (error: any) { - logger.error("Error decoding remark or seedHistory extrinsic"); - logger.error(error); - await createAndSaveError( - BigInt(number.toString()), - blockHash.toString(), - `${number}-${idx}`, - hash.toString(), - idx, - stringify(error), - timestamp ? timestamp : new Date(0) - ); - } -} diff --git a/indexers/mainnet/files/src/mappings/types.ts b/indexers/mainnet/files/src/mappings/types.ts deleted file mode 100644 index 85c656081..000000000 --- a/indexers/mainnet/files/src/mappings/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type ExtrinsicPrimitive = { - callIndex: string; - args: any; -}; - -export type ExtrinsicHuman = ExtrinsicPrimitive & { - method: string; - section: string; -}; diff --git a/indexers/mainnet/files/tsconfig.json b/indexers/mainnet/files/tsconfig.json deleted file mode 100644 index 08ea779b9..000000000 --- a/indexers/mainnet/files/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/mainnet/leaderboard/.gitignore b/indexers/mainnet/leaderboard/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/mainnet/leaderboard/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/mainnet/leaderboard/LICENSE b/indexers/mainnet/leaderboard/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/mainnet/leaderboard/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/mainnet/leaderboard/README.md b/indexers/mainnet/leaderboard/README.md deleted file mode 100644 index 19e680c4a..000000000 --- a/indexers/mainnet/leaderboard/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Leaderboard - -The Autonomys Astral Explorer Leaderboard is a specialized SubQuery project that indexes all asset transfers and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the leaderboard functionality for the Astral Explorer, providing real-time data on user activities and rankings. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all asset transfers using the balances pallet -2. Capturing system remarks for additional user actions -3. Calculating and updating user scores based on various activities - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for transfers, accounts, and leaderboard entries. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of asset transfers -- Monitoring of system remarks for specific user actions -- Leaderboard score calculation and updates -- Support for querying transfer history and account statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/leaderboard` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/mainnet/leaderboard/package.json b/indexers/mainnet/leaderboard/package.json deleted file mode 100644 index 945576a45..000000000 --- a/indexers/mainnet/leaderboard/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "leaderboard", - "version": "1.0.0", - "description": "Autonomys Network - Leaderboard", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/mainnet/leaderboard/project.ts b/indexers/mainnet/leaderboard/project.ts deleted file mode 100644 index a32a12c04..000000000 --- a/indexers/mainnet/leaderboard/project.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-leaderboard", - description: "Autonomys Network - Leaderboard", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - dictionary: process.env.DICTIONARY_URL!, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Block, - handler: "handleBlock", - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/mainnet/leaderboard/schema.graphql b/indexers/mainnet/leaderboard/schema.graphql deleted file mode 100644 index 41789f17d..000000000 --- a/indexers/mainnet/leaderboard/schema.graphql +++ /dev/null @@ -1,247 +0,0 @@ -# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by -# Add the `@index` or `@index(unique: true)` annotation after any non-key field -# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field - -# account -type AccountTransferSenderTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferSenderTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferReceiverTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferReceiverTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountRemarkCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicSuccessTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicFailedTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransactionFeePaidTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# farmer -type FarmerVoteTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerBlockTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerBlockTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteAndBlockTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteAndBlockTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# operator -type OperatorTotalRewardsCollectedHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorTotalTaxCollectedHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorBundleTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorDepositsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorDepositsTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorWithdrawalsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# nominator/account -type NominatorDepositsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type NominatorDepositsTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type NominatorWithdrawalsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} diff --git a/indexers/mainnet/leaderboard/src/index.ts b/indexers/mainnet/leaderboard/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/mainnet/leaderboard/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/mainnet/leaderboard/src/mappings/db.ts b/indexers/mainnet/leaderboard/src/mappings/db.ts deleted file mode 100644 index 4b81d2e8c..000000000 --- a/indexers/mainnet/leaderboard/src/mappings/db.ts +++ /dev/null @@ -1,612 +0,0 @@ -import { - AccountExtrinsicFailedTotalCountHistory, - AccountExtrinsicSuccessTotalCountHistory, - AccountExtrinsicTotalCountHistory, - AccountRemarkCountHistory, - AccountTransactionFeePaidTotalValueHistory, - AccountTransferReceiverTotalCountHistory, - AccountTransferReceiverTotalValueHistory, - AccountTransferSenderTotalCountHistory, - AccountTransferSenderTotalValueHistory, - FarmerBlockTotalCountHistory, - FarmerBlockTotalValueHistory, - FarmerVoteAndBlockTotalCountHistory, - FarmerVoteAndBlockTotalValueHistory, - FarmerVoteTotalCountHistory, - FarmerVoteTotalValueHistory, - NominatorDepositsTotalCountHistory, - NominatorDepositsTotalValueHistory, - NominatorWithdrawalsTotalCountHistory, - OperatorBundleTotalCountHistory, - OperatorDepositsTotalCountHistory, - OperatorDepositsTotalValueHistory, - OperatorTotalRewardsCollectedHistory, - OperatorTotalTaxCollectedHistory, - OperatorWithdrawalsTotalCountHistory, -} from "../types"; - -type Cache = { - accountExtrinsicFailedTotalCountHistory: AccountExtrinsicFailedTotalCountHistory[]; - accountExtrinsicSuccessTotalCountHistory: AccountExtrinsicSuccessTotalCountHistory[]; - accountExtrinsicTotalCountHistory: AccountExtrinsicTotalCountHistory[]; - accountRemarkCountHistory: AccountRemarkCountHistory[]; - accountTransactionFeePaidTotalValueHistory: AccountTransactionFeePaidTotalValueHistory[]; - accountTransferReceiverTotalCountHistory: AccountTransferReceiverTotalCountHistory[]; - accountTransferReceiverTotalValueHistory: AccountTransferReceiverTotalValueHistory[]; - accountTransferSenderTotalCountHistory: AccountTransferSenderTotalCountHistory[]; - accountTransferSenderTotalValueHistory: AccountTransferSenderTotalValueHistory[]; - farmerBlockTotalCountHistory: FarmerBlockTotalCountHistory[]; - farmerBlockTotalValueHistory: FarmerBlockTotalValueHistory[]; - farmerVoteAndBlockTotalCountHistory: FarmerVoteAndBlockTotalCountHistory[]; - farmerVoteAndBlockTotalValueHistory: FarmerVoteAndBlockTotalValueHistory[]; - farmerVoteTotalCountHistory: FarmerVoteTotalCountHistory[]; - farmerVoteTotalValueHistory: FarmerVoteTotalValueHistory[]; - nominatorDepositsTotalCountHistory: NominatorDepositsTotalCountHistory[]; - nominatorDepositsTotalValueHistory: NominatorDepositsTotalValueHistory[]; - nominatorWithdrawalsTotalCountHistory: NominatorWithdrawalsTotalCountHistory[]; - operatorBundleTotalCountHistory: OperatorBundleTotalCountHistory[]; - operatorDepositsTotalCountHistory: OperatorDepositsTotalCountHistory[]; - operatorDepositsTotalValueHistory: OperatorDepositsTotalValueHistory[]; - operatorTotalRewardsCollectedHistory: OperatorTotalRewardsCollectedHistory[]; - operatorTotalTaxCollectedHistory: OperatorTotalTaxCollectedHistory[]; - operatorWithdrawalsTotalCountHistory: OperatorWithdrawalsTotalCountHistory[]; -}; - -export const initializeCache = (): Cache => ({ - accountExtrinsicFailedTotalCountHistory: [], - accountExtrinsicSuccessTotalCountHistory: [], - accountExtrinsicTotalCountHistory: [], - accountRemarkCountHistory: [], - accountTransactionFeePaidTotalValueHistory: [], - accountTransferReceiverTotalCountHistory: [], - accountTransferReceiverTotalValueHistory: [], - accountTransferSenderTotalCountHistory: [], - accountTransferSenderTotalValueHistory: [], - farmerBlockTotalCountHistory: [], - farmerBlockTotalValueHistory: [], - farmerVoteAndBlockTotalCountHistory: [], - farmerVoteAndBlockTotalValueHistory: [], - farmerVoteTotalCountHistory: [], - farmerVoteTotalValueHistory: [], - nominatorDepositsTotalCountHistory: [], - nominatorDepositsTotalValueHistory: [], - nominatorWithdrawalsTotalCountHistory: [], - operatorBundleTotalCountHistory: [], - operatorDepositsTotalCountHistory: [], - operatorDepositsTotalValueHistory: [], - operatorTotalRewardsCollectedHistory: [], - operatorTotalTaxCollectedHistory: [], - operatorWithdrawalsTotalCountHistory: [], -}); - -export const saveCache = async (cache: Cache) => { - await Promise.all( - cache.accountTransferSenderTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferReceiverTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferSenderTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferReceiverTotalValueHistory.map((item) => item.save()) - ); - await Promise.all(cache.accountRemarkCountHistory.map((item) => item.save())); - await Promise.all( - cache.accountExtrinsicTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountExtrinsicSuccessTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountExtrinsicFailedTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransactionFeePaidTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerBlockTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerBlockTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteAndBlockTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteAndBlockTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorDepositsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorDepositsTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorWithdrawalsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorBundleTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorDepositsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorDepositsTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorTotalRewardsCollectedHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorTotalTaxCollectedHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorWithdrawalsTotalCountHistory.map((item) => item.save()) - ); -}; - -export function createAccountTransferSenderTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferSenderTotalCountHistory { - return AccountTransferSenderTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferSenderTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferSenderTotalValueHistory { - return AccountTransferSenderTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferReceiverTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferReceiverTotalCountHistory { - return AccountTransferReceiverTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferReceiverTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferReceiverTotalValueHistory { - return AccountTransferReceiverTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountRemarkCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountRemarkCountHistory { - return AccountRemarkCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicTotalCountHistory { - return AccountExtrinsicTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicSuccessTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicSuccessTotalCountHistory { - return AccountExtrinsicSuccessTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicFailedTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicFailedTotalCountHistory { - return AccountExtrinsicFailedTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransactionFeePaidTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransactionFeePaidTotalValueHistory { - return AccountTransactionFeePaidTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Farmer entities -export function createFarmerVoteTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteTotalCountHistory { - return FarmerVoteTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteTotalValueHistory { - return FarmerVoteTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerBlockTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerBlockTotalCountHistory { - return FarmerBlockTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerBlockTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerBlockTotalValueHistory { - return FarmerBlockTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteAndBlockTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteAndBlockTotalCountHistory { - return FarmerVoteAndBlockTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteAndBlockTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteAndBlockTotalValueHistory { - return FarmerVoteAndBlockTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Operator entities -export function createOperatorTotalRewardsCollected( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorTotalRewardsCollectedHistory { - return OperatorTotalRewardsCollectedHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorTotalTaxCollected( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorTotalTaxCollectedHistory { - return OperatorTotalTaxCollectedHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorBundleTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorBundleTotalCountHistory { - return OperatorBundleTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorDepositsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorDepositsTotalCountHistory { - return OperatorDepositsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorDepositsTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorDepositsTotalValueHistory { - return OperatorDepositsTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorWithdrawalsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorWithdrawalsTotalCountHistory { - return OperatorWithdrawalsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Nominator entities -export function createNominatorDepositsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorDepositsTotalCountHistory { - return NominatorDepositsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createNominatorDepositsTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorDepositsTotalValueHistory { - return NominatorDepositsTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createNominatorWithdrawalsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorWithdrawalsTotalCountHistory { - return NominatorWithdrawalsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} diff --git a/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts b/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts deleted file mode 100644 index 14d9b6f65..000000000 --- a/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,423 +0,0 @@ -import { SubstrateBlock } from "@subql/types"; -import * as db from "./db"; - -export async function handleBlock(_block: SubstrateBlock): Promise { - const { - block: { - header: { number }, - extrinsics, - }, - timestamp, - events, - } = _block; - const height = BigInt(number.toString()); - - let cache = db.initializeCache(); - let eventIndex = 0; - - // Process extrinsics - extrinsics.forEach((extrinsic, extrinsicIdx) => { - const extrinsicEvents = events.filter( - (e) => - e.phase.isApplyExtrinsic && - e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx - ); - const successEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const successEventId = events.findIndex( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const extrinsicId = extrinsic ? height + "-" + extrinsicIdx.toString() : ""; - const extrinsicSigner = extrinsic.signer.toString(); - - cache.accountExtrinsicTotalCountHistory.push( - db.createAccountExtrinsicTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - if (successEvent) { - cache.accountExtrinsicSuccessTotalCountHistory.push( - db.createAccountExtrinsicSuccessTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - - // Process specific extrinsic - switch (`${extrinsic.method.section}.${extrinsic.method.method}`) { - case "system.remark": - case "system.remarkWithEvent": { - cache.accountRemarkCountHistory.push( - db.createAccountRemarkCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - "", - timestamp - ) - ); - break; - } - } - - // Process extrinsic events - extrinsicEvents.forEach((event, eventIdx) => { - const eventId = height + "-" + eventIndex; - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "balances.Transfer": { - const from = event.event.data[0].toString(); - const to = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - cache.accountTransferSenderTotalCountHistory.push( - db.createAccountTransferSenderTotalCount( - from, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.accountTransferSenderTotalValueHistory.push( - db.createAccountTransferSenderTotalValue( - from, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.accountTransferReceiverTotalCountHistory.push( - db.createAccountTransferReceiverTotalCount( - to, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.accountTransferReceiverTotalValueHistory.push( - db.createAccountTransferReceiverTotalValue( - to, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "transactionPayment.TransactionFeePaid": { - const who = event.event.data[0].toString(); - const actualFee = BigInt(event.event.data[1].toString()); - const tip = BigInt(event.event.data[2].toString()); - - cache.accountTransactionFeePaidTotalValueHistory.push( - db.createAccountTransactionFeePaidTotalValue( - who, - actualFee + tip, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorRewarded": { - const operatorId = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - if (reward === BigInt(0)) break; - - cache.operatorTotalRewardsCollectedHistory.push( - db.createOperatorTotalRewardsCollected( - operatorId, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorTaxCollected": { - const operatorId = event.event.data[0].toString(); - const tax = BigInt(event.event.data[1].toString()); - - cache.operatorTotalTaxCollectedHistory.push( - db.createOperatorTotalTaxCollected( - operatorId, - tax, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - break; - } - case "domains.BundleStored": { - const bundleAuthor = event.event.data[0].toString(); - - cache.operatorBundleTotalCountHistory.push( - db.createOperatorBundleTotalCount( - bundleAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorRegistered": { - const operatorId = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.operatorTotalRewardsCollectedHistory.push( - db.createOperatorTotalRewardsCollected( - operatorId, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorNominated": { - const operatorId = event.event.data[0].toString(); - const nominatorId = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - cache.operatorDepositsTotalCountHistory.push( - db.createOperatorDepositsTotalCount( - operatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.operatorDepositsTotalValueHistory.push( - db.createOperatorDepositsTotalValue( - operatorId, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.nominatorDepositsTotalCountHistory.push( - db.createNominatorDepositsTotalCount( - nominatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.nominatorDepositsTotalValueHistory.push( - db.createNominatorDepositsTotalValue( - nominatorId, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.WithdrewStake": { - const operatorId = event.event.data[0].toString(); - const nominatorId = event.event.data[1].toString(); - - cache.operatorWithdrawalsTotalCountHistory.push( - db.createOperatorWithdrawalsTotalCount( - operatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.nominatorWithdrawalsTotalCountHistory.push( - db.createNominatorWithdrawalsTotalCount( - nominatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - } else { - // Process fail extrinsic - cache.accountExtrinsicFailedTotalCountHistory.push( - db.createAccountExtrinsicFailedTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - } - }); - - const finalizationEvents = events.filter((e) => e.phase.isFinalization); - - // Process finalization events - finalizationEvents.forEach((event) => { - const extrinsicId = height + "-" + event.phase.type; // AKA (blockHeight-Finalization) - const eventId = height + "-" + eventIndex; - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "rewards.VoteReward": { - const voter = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.farmerVoteTotalCountHistory.push( - db.createFarmerVoteTotalCount( - voter, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteTotalValueHistory.push( - db.createFarmerVoteTotalValue( - voter, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.farmerVoteAndBlockTotalCountHistory.push( - db.createFarmerVoteAndBlockTotalCount( - voter, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteAndBlockTotalValueHistory.push( - db.createFarmerVoteAndBlockTotalValue( - voter, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - break; - } - case "rewards.BlockReward": { - const blockAuthor = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.farmerBlockTotalCountHistory.push( - db.createFarmerBlockTotalCount( - blockAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerBlockTotalValueHistory.push( - db.createFarmerBlockTotalValue( - blockAuthor, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.farmerVoteAndBlockTotalCountHistory.push( - db.createFarmerVoteAndBlockTotalCount( - blockAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteAndBlockTotalValueHistory.push( - db.createFarmerVoteAndBlockTotalValue( - blockAuthor, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - - // Save cache - await db.saveCache(cache); -} diff --git a/indexers/mainnet/leaderboard/tsconfig.json b/indexers/mainnet/leaderboard/tsconfig.json deleted file mode 100644 index b827eae7e..000000000 --- a/indexers/mainnet/leaderboard/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/mainnet/staking/.gitignore b/indexers/mainnet/staking/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/mainnet/staking/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/mainnet/staking/LICENSE b/indexers/mainnet/staking/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/mainnet/staking/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/mainnet/staking/README.md b/indexers/mainnet/staking/README.md deleted file mode 100644 index d461450b4..000000000 --- a/indexers/mainnet/staking/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Staking - -The Autonomys Astral Explorer Staking is a specialized SubQuery project that indexes all staking-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the staking functionality for the Astral Explorer, providing real-time data on user staking activities and rewards. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all staking events using the staking pallet -2. Capturing system remarks for additional staking actions -3. Calculating and updating user staking rewards and positions - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for staking events, accounts, and reward entries. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of staking events -- Monitoring of system remarks for specific staking actions -- Staking reward calculation and updates -- Support for querying staking history and account statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/staking` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/mainnet/staking/package.json b/indexers/mainnet/staking/package.json deleted file mode 100644 index e7fe6d134..000000000 --- a/indexers/mainnet/staking/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "staking", - "version": "1.0.0", - "description": "Autonomys Network - Staking", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/mainnet/staking/project.ts b/indexers/mainnet/staking/project.ts deleted file mode 100644 index 9341b731b..000000000 --- a/indexers/mainnet/staking/project.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-staking", - description: "Autonomys Network - Staking", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - dictionary: process.env.DICTIONARY_URL!, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - // startBlock: 310356, // DomainInstantiated - // startBlock: 316224, // RegisterOperator - // startBlock: 346630, // domains.DomainEpochCompleted - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Event, - handler: "handleDomainInstantiatedEvent", - filter: { - module: "domains", - method: "DomainInstantiated", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleRegisterOperatorCall", - filter: { - module: "domains", - method: "registerOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleNominateOperatorCall", - filter: { - module: "domains", - method: "NominateOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleDeregisterOperatorCall", - filter: { - module: "domains", - method: "DeregisterOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleWithdrawStakeCall", - filter: { - module: "domains", - method: "WithdrawStake", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockFundsCall", - filter: { - module: "domains", - method: "UnlockFunds", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockOperatorCall", - filter: { - module: "domains", - method: "UnlockOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockNominatorCall", - filter: { - module: "domains", - method: "UnlockNominator", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleDomainEpochCompletedEvent", - filter: { - module: "domains", - method: "DomainEpochCompleted", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleForceDomainEpochTransitionEvent", - filter: { - module: "domains", - method: "ForceDomainEpochTransition", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorRegisteredEvent", - filter: { - module: "domains", - method: "OperatorRegistered", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorDeregisteredEvent", - filter: { - module: "domains", - method: "OperatorDeregistered", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorNominatedEvent", - filter: { - module: "domains", - method: "OperatorNominated", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleWithdrewStakeEvent", - filter: { - module: "domains", - method: "WithdrewStake", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleStorageFeeDepositedEvent", - filter: { - module: "domains", - method: "StorageFeeDeposited", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleBundleStoredEvent", - filter: { - module: "domains", - method: "BundleStored", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorUnlockedEvent", - filter: { - module: "domains", - method: "OperatorUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleFundsUnlockedEvent", - filter: { - module: "domains", - method: "FundsUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleNominatedStakedUnlockedEvent", - filter: { - module: "domains", - method: "NominatedStakedUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleNominatorUnlockedEvent", - filter: { - module: "domains", - method: "NominatorUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleStorageFeeUnlockedEvent", - filter: { - module: "domains", - method: "StorageFeeUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorRewardedEvent", - filter: { - module: "domains", - method: "OperatorRewarded", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorSlashedEvent", - filter: { - module: "domains", - method: "OperatorSlashed", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorTaxCollectedEvent", - filter: { - module: "domains", - method: "OperatorTaxCollected", - }, - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/mainnet/staking/schema.graphql b/indexers/mainnet/staking/schema.graphql deleted file mode 100644 index 869923cbe..000000000 --- a/indexers/mainnet/staking/schema.graphql +++ /dev/null @@ -1,387 +0,0 @@ -# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by -# Add the `@index` or `@index(unique: true)` annotation after any non-key field -# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field - -type Domain @entity { - id: ID! - sortId: BigInt! @index - accountId: String! @index - name: String! @index - runtimeId: Int! @index - runtime: String! - runtimeInfo: String! - completedEpoch: BigInt! @index - lastDomainBlockNumber: BigInt! @index - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - totalConsensusStorageFee: BigInt! - totalDomainExecutionFee: BigInt! - totalBurnedBalance: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochRewards: BigInt! - accumulatedEpochShares: BigInt! - bundleCount: BigInt! - currentEpochDuration: BigInt! - lastEpochDuration: BigInt! - last6EpochsDuration: BigInt! - last144EpochDuration: BigInt! - last1kEpochDuration: BigInt! - lastBundleAt: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Account @entity { - id: ID! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochShares: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Operator @entity { - id: ID! - sortId: BigInt! @index - accountId: String! @index - domainId: String! @index - signingKey: String! @index - minimumNominatorStake: BigInt! - nominationTax: Int! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentEpochRewards: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - rawStatus: String! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - totalConsensusStorageFee: BigInt! - totalDomainExecutionFee: BigInt! - totalBurnedBalance: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochRewards: BigInt! - accumulatedEpochShares: BigInt! - activeEpochCount: BigInt! - bundleCount: BigInt! - status: String! - pendingAction: String! - lastBundleAt: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type OperatorProfile @entity { - id: ID! - operatorId: String! @index - accountId: String! @index - name: String! @index - description: String! - icon: String! - banner: String! - website: String! - websiteVerified: Boolean! - email: String! - emailVerified: Boolean! - discord: String! - github: String! - twitter: String! - proofMessage: String! - proofSignature: String! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type DomainBlock @entity { - id: ID! - domainId: String! @index - domainEpochId: String! @index - blockNumber: BigInt! @index - blockHash: String! @index - extrinsicRoot: String! - epoch: BigInt! @index - consensusBlockNumber: BigInt! @index - consensusBlockHash: String! @index - timestamp: Date! @index - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type DomainEpoch @entity { - id: ID! - epoch: BigInt! @index - domainId: String! @index - blockNumberStart: BigInt! @index - blockNumberEnd: BigInt! @index - blockCount: BigInt! - timestampStart: Date! @index - timestampEnd: Date! @index - epochDuration: BigInt! - consensusBlockNumberStart: BigInt! - consensusBlockNumberEnd: BigInt! - consensusBlockHashStart: String! - consensusBlockHashEnd: String! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Bundle @entity { - id: ID! - domainId: String! @index - domainBlockId: String! @index - domainEpochId: String! @index - domainBlockNumber: BigInt! @index - domainBlockHash: String! - domainBlockExtrinsicRoot: String! - epoch: BigInt! @index - consensusBlockNumber: BigInt! @index - consensusBlockHash: String! @index - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - consensusStorageFee: BigInt! - domainExecutionFee: BigInt! - burnedBalance: BigInt! -} - -type BundleAuthor @entity { - id: ID! - domainId: String! @index - accountId: String! @index - operatorId: String! @index - bundleId: String! @index - domainBlockId: String! @index - domainEpochId: String! @index - epoch: BigInt! @index -} - -type Nominator @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - knownShares: BigInt! - knownStorageFeeDeposit: BigInt! - pendingAmount: BigInt! - pendingStorageFeeDeposit: BigInt! - pendingEffectiveDomainEpoch: BigInt! - totalWithdrawalAmounts: BigInt! - totalStorageFeeRefund: BigInt! - unlockAtConfirmedDomainBlockNumber: [Int!]! - pendingShares: BigInt! - pendingStorageFeeRefund: BigInt! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalDepositsCount: BigInt! - totalWithdrawalsCount: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochShares: BigInt! - activeEpochCount: BigInt! - status: String! # NominatorStatus! - pendingAction: String! # NominatorPendingAction! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Deposit @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - amount: BigInt! - storageFeeDeposit: BigInt! - totalAmount: BigInt! - totalWithdrawn: BigInt! - status: String! - timestamp: Date! - extrinsicHash: String! - epochDepositedAt: BigInt! - domainBlockNumberDepositedAt: BigInt! - createdAt: BigInt! @index - stakedAt: BigInt! - updatedAt: BigInt! @index -} - -type Withdrawal @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - shares: BigInt! - estimatedAmount: BigInt! - unlockedAmount: BigInt! - unlockedStorageFee: BigInt! - totalAmount: BigInt! - status: String! - timestamp: Date! - withdrawExtrinsicHash: String! - unlockExtrinsicHash: String! - epochWithdrawalRequestedAt: BigInt! - domainBlockNumberWithdrawalRequestedAt: BigInt! - createdAt: BigInt! @index - readyAt: BigInt! - unlockedAt: BigInt! - updatedAt: BigInt! -} - -type Reward @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - amount: BigInt! - timestamp: Date! @index - blockNumber: BigInt! @index - extrinsicHash: String! @index -} - -type Stats @entity { - id: ID! - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - domainsCount: BigInt! - operatorsCount: BigInt! - activeOperatorsCount: BigInt! - slashedOperatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerDomain @entity { - id: ID! - domainId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - operatorsCount: BigInt! - activeOperatorsCount: BigInt! - slashedOperatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerOperator @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerNominator @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerAccount @entity { - id: ID! - accountId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - operatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} diff --git a/indexers/mainnet/staking/src/index.ts b/indexers/mainnet/staking/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/mainnet/staking/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/mainnet/staking/src/mappings/constants.ts b/indexers/mainnet/staking/src/mappings/constants.ts deleted file mode 100644 index 2931d8c74..000000000 --- a/indexers/mainnet/staking/src/mappings/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const SHARES_CALCULATION_MULTIPLIER = BigInt(1000000000000); diff --git a/indexers/mainnet/staking/src/mappings/db.ts b/indexers/mainnet/staking/src/mappings/db.ts deleted file mode 100644 index 69a2af4b7..000000000 --- a/indexers/mainnet/staking/src/mappings/db.ts +++ /dev/null @@ -1,566 +0,0 @@ -import { - Account, - Bundle, - BundleAuthor, - Deposit, - Domain, - DomainBlock, - DomainEpoch, - Nominator, - Operator, - Reward, - Stats, - StatsPerAccount, - StatsPerDomain, - StatsPerNominator, - StatsPerOperator, - Withdrawal, -} from "../types"; -import { - DepositStatus, - DomainRuntime, - NominatorPendingAction, - NominatorStatus, - OperatorPendingAction, - OperatorStatus, - WithdrawalStatus, -} from "./models"; - -// Helper for Domain -export async function checkAndGetDomain( - domainId: string, - blockNumber: bigint -): Promise { - const id = domainId.toLowerCase(); - let domain = await Domain.get(id); - if (!domain) { - domain = Domain.create({ - id, - sortId: BigInt(id), - accountId: "", - name: "", - runtimeId: 0, - runtime: DomainRuntime.EVM, - runtimeInfo: "", - completedEpoch: BigInt(0), - lastDomainBlockNumber: BigInt(0), - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - totalConsensusStorageFee: BigInt(0), - totalDomainExecutionFee: BigInt(0), - totalBurnedBalance: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochRewards: BigInt(0), - accumulatedEpochShares: BigInt(0), - bundleCount: BigInt(0), - currentEpochDuration: BigInt(0), - lastEpochDuration: BigInt(0), - last6EpochsDuration: BigInt(0), - last144EpochDuration: BigInt(0), - last1kEpochDuration: BigInt(0), - lastBundleAt: BigInt(0), - createdAt: blockNumber, - updatedAt: blockNumber, - }); - } - return domain; -} - -// Helper for Account -export async function checkAndGetAccount( - id: string, - blockNumber: number -): Promise { - let account = await Account.get(id); - if (!account) { - account = Account.create({ - id, - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochShares: BigInt(0), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return account; -} - -// Helper for Operator -export async function checkAndGetOperator( - operatorId: string, - blockNumber: number -): Promise { - const id = operatorId.toLowerCase(); - let operator = await Operator.get(id); - if (!operator) { - operator = Operator.create({ - id, - sortId: BigInt(id), - accountId: "", - domainId: "", - signingKey: "", - minimumNominatorStake: BigInt(0), - nominationTax: 0, - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentEpochRewards: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - rawStatus: "", - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - totalConsensusStorageFee: BigInt(0), - totalDomainExecutionFee: BigInt(0), - totalBurnedBalance: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochRewards: BigInt(0), - accumulatedEpochShares: BigInt(0), - activeEpochCount: BigInt(0), - bundleCount: BigInt(0), - status: OperatorStatus.PENDING, - pendingAction: OperatorPendingAction.NO_ACTION_REQUIRED, - lastBundleAt: BigInt(0), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return operator; -} - -// Helper for DomainBlock -export async function checkAndGetDomainBlock( - id: string, - blockNumber: number -): Promise { - let domainBlock = await DomainBlock.get(id.toLowerCase()); - if (!domainBlock) { - domainBlock = DomainBlock.create({ - id: id.toLowerCase(), - domainId: "", - domainEpochId: "", - blockNumber: BigInt(0), - blockHash: "", - extrinsicRoot: "", - epoch: BigInt(0), - consensusBlockNumber: BigInt(0), - consensusBlockHash: "", - timestamp: new Date(), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return domainBlock; -} - -// Helper for DomainEpoch -export async function checkAndGetDomainEpoch( - id: string, - blockNumber: number -): Promise { - let domainEpoch = await DomainEpoch.get(id.toLowerCase()); - if (!domainEpoch) { - domainEpoch = DomainEpoch.create({ - id: id.toLowerCase(), - epoch: BigInt(0), - domainId: "", - blockNumberStart: BigInt(0), - blockNumberEnd: BigInt(0), - blockCount: BigInt(0), - timestampStart: new Date(), - timestampEnd: new Date(), - epochDuration: BigInt(0), - consensusBlockNumberStart: BigInt(0), - consensusBlockNumberEnd: BigInt(0), - consensusBlockHashStart: "", - consensusBlockHashEnd: "", - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return domainEpoch; -} - -// Helper for Bundle -export async function checkAndGetBundle( - id: string, - blockNumber: number -): Promise { - let bundle = await Bundle.get(id.toLowerCase()); - if (!bundle) { - bundle = Bundle.create({ - id: id.toLowerCase(), - domainId: "", - domainBlockId: "", - domainEpochId: "", - domainBlockNumber: BigInt(0), - domainBlockHash: "", - domainBlockExtrinsicRoot: "", - epoch: BigInt(0), - consensusBlockNumber: BigInt(0), - consensusBlockHash: "", - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - consensusStorageFee: BigInt(0), - domainExecutionFee: BigInt(0), - burnedBalance: BigInt(0), - }); - } - return bundle; -} - -// Helper for BundleAuthor -export async function checkAndGetBundleAuthor( - id: string, - blockNumber: number -): Promise { - let bundleAuthor = await BundleAuthor.get(id.toLowerCase()); - if (!bundleAuthor) { - bundleAuthor = BundleAuthor.create({ - id: id.toLowerCase(), - domainId: "", - accountId: "", - operatorId: "", - bundleId: "", - domainBlockId: "", - domainEpochId: "", - epoch: BigInt(0), - }); - } - return bundleAuthor; -} - -// Helper for Nominator -export async function checkAndGetNominator( - accountId: string, - domainId: string, - operatorId: string, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}`.toLowerCase(); - let nominator = await Nominator.get(id); - if (!nominator) { - nominator = Nominator.create({ - id, - accountId, - domainId, - operatorId, - knownShares: BigInt(0), - knownStorageFeeDeposit: BigInt(0), - pendingAmount: BigInt(0), - pendingStorageFeeDeposit: BigInt(0), - pendingEffectiveDomainEpoch: BigInt(0), - totalWithdrawalAmounts: BigInt(0), - totalStorageFeeRefund: BigInt(0), - unlockAtConfirmedDomainBlockNumber: [], - pendingShares: BigInt(0), - pendingStorageFeeRefund: BigInt(0), - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalDepositsCount: BigInt(0), - totalWithdrawalsCount: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochShares: BigInt(0), - activeEpochCount: BigInt(0), - status: NominatorStatus.PENDING, - pendingAction: NominatorPendingAction.NO_ACTION_REQUIRED, - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return nominator; -} - -// Helper for Deposit -export async function checkAndGetDeposit( - accountId: string, - domainId: string, - operatorId: string, - amount: bigint, - storageFeeDeposit: bigint, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); - const nominatorId = `${operatorId}-${accountId}`.toLowerCase(); - const totalAmount = amount + storageFeeDeposit; - let deposit = await Deposit.get(id); - if (!deposit) { - deposit = Deposit.create({ - id, - accountId, - domainId, - operatorId, - nominatorId, - amount, - storageFeeDeposit, - totalAmount, - totalWithdrawn: BigInt(0), - status: DepositStatus.PENDING, - timestamp: new Date(), - extrinsicHash: "", - epochDepositedAt: BigInt(0), - domainBlockNumberDepositedAt: BigInt(0), - createdAt: BigInt(blockNumber), - stakedAt: BigInt(0), - updatedAt: BigInt(blockNumber), - }); - } - return deposit; -} - -// Helper for Withdrawal -export async function checkAndGetWithdrawal( - accountId: string, - domainId: string, - operatorId: string, - nominatorId: string, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); - let withdrawal = await Withdrawal.get(id); - if (!withdrawal) { - withdrawal = Withdrawal.create({ - id, - accountId, - domainId, - operatorId, - nominatorId, - shares: BigInt(0), - estimatedAmount: BigInt(0), - unlockedAmount: BigInt(0), - unlockedStorageFee: BigInt(0), - totalAmount: BigInt(0), - status: WithdrawalStatus.PENDING_LOCK, - timestamp: new Date(), - withdrawExtrinsicHash: "", - unlockExtrinsicHash: "", - epochWithdrawalRequestedAt: BigInt(0), - domainBlockNumberWithdrawalRequestedAt: BigInt(0), - createdAt: BigInt(blockNumber), - readyAt: BigInt(0), - unlockedAt: BigInt(0), - updatedAt: BigInt(blockNumber), - }); - } - return withdrawal; -} - -// Helper for Reward -export async function checkAndGetReward( - id: string, - blockNumber: number -): Promise { - let reward = await Reward.get(id.toLowerCase()); - if (!reward) { - reward = Reward.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - amount: BigInt(0), - timestamp: new Date(), - blockNumber: BigInt(0), - extrinsicHash: "", - }); - } - return reward; -} - -// Helper for Stats -export async function checkAndGetStats( - id: string, - blockNumber: number -): Promise { - let stats = await Stats.get(id.toLowerCase()); - if (!stats) { - stats = Stats.create({ - id: id.toLowerCase(), - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - domainsCount: BigInt(0), - operatorsCount: BigInt(0), - activeOperatorsCount: BigInt(0), - slashedOperatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return stats; -} - -// Helper for StatsPerDomain -export async function checkAndGetStatsPerDomain( - id: string, - blockNumber: number -): Promise { - let statsPerDomain = await StatsPerDomain.get(id.toLowerCase()); - if (!statsPerDomain) { - statsPerDomain = StatsPerDomain.create({ - id: id.toLowerCase(), - domainId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - operatorsCount: BigInt(0), - activeOperatorsCount: BigInt(0), - slashedOperatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerDomain; -} - -// Helper for StatsPerOperator -export async function checkAndGetStatsPerOperator( - id: string, - blockNumber: number -): Promise { - let statsPerOperator = await StatsPerOperator.get(id.toLowerCase()); - if (!statsPerOperator) { - statsPerOperator = StatsPerOperator.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerOperator; -} - -// Helper for StatsPerNominator -export async function checkAndGetStatsPerNominator( - id: string, - blockNumber: number -): Promise { - let statsPerNominator = await StatsPerNominator.get(id.toLowerCase()); - if (!statsPerNominator) { - statsPerNominator = StatsPerNominator.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - nominatorId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerNominator; -} - -// Helper for StatsPerAccount -export async function checkAndGetStatsPerAccount( - id: string, - blockNumber: number -): Promise { - let statsPerAccount = await StatsPerAccount.get(id.toLowerCase()); - if (!statsPerAccount) { - statsPerAccount = StatsPerAccount.create({ - id: id.toLowerCase(), - accountId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - operatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerAccount; -} diff --git a/indexers/mainnet/staking/src/mappings/mappingHandlers.ts b/indexers/mainnet/staking/src/mappings/mappingHandlers.ts deleted file mode 100644 index 97d86650b..000000000 --- a/indexers/mainnet/staking/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,1114 +0,0 @@ -import { capitalizeFirstLetter, stringify } from "@autonomys/auto-utils"; -import { SubstrateEvent, SubstrateExtrinsic } from "@subql/types"; -import assert from "assert"; -import { - Bundle, - BundleAuthor, - Deposit, - DomainBlock, - Nominator, - Withdrawal, -} from "../types"; -import { SHARES_CALCULATION_MULTIPLIER } from "./constants"; -import * as db from "./db"; -import { - DepositStatus, - DomainRuntime, - NominatorPendingAction, - NominatorStatus, - OperatorPendingAction, - OperatorStatus, - WithdrawalStatus, -} from "./models"; -import type { ExecutionReceipt, SealedBundleHeader, TBundle } from "./types"; - -const MAX_LIMIT = 10000; - -export async function handleDomainInstantiatedEvent( - event: SubstrateEvent -): Promise { - const { - extrinsic, - event: { - data: [_domainId, _completedEpochIndex], - }, - } = event; - if (extrinsic) { - const _extrinsic = extrinsic.extrinsic.method.args[0].toHuman() as any; - const accountId = extrinsic.extrinsic.signer.toString(); - const domainName = capitalizeFirstLetter( - _extrinsic.args.domain_config.domainName - ); - const domainId = _domainId.toString(); - const completedEpoch = Number(_completedEpochIndex?.toString() ?? 0); - const blockNumber = event.block.block.header.number.toNumber(); - - const domain = await db.checkAndGetDomain(domainId, BigInt(blockNumber)); - domain.accountId = accountId; - domain.name = domainName; - switch (domainName) { - case "Nova": - domain.runtime = DomainRuntime.EVM; - break; - case "Auto-id": - domain.runtime = DomainRuntime.AUTO_ID; - break; - default: - break; - } - domain.runtimeInfo = stringify(_extrinsic.args.domain_config); - domain.completedEpoch = BigInt(completedEpoch); - domain.updatedAt = BigInt(blockNumber); - - await domain.save(); - } -} - -export async function handleRegisterOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - logger.info( - `New ${extrinsic.extrinsic.registry.toString()}.${ - extrinsic.extrinsic.method - } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` - ); - const { - block: { - block: { - header: { number }, - }, - }, - extrinsic: { - method: { args }, - signer, - }, - events, - } = extrinsic; - const _args = args.map((arg) => arg.toPrimitive()); - const domainId = String(args[0]); - const amount = BigInt(args[1].toString()); - const { signingKey, minimumNominatorStake, nominationTax } = - (args[2] as any) ?? {}; - - const opRegistered = events.find( - (e) => e.event.method.toString() === "OperatorRegistered" - ); - const storageFee = events.find( - (e) => e.event.method.toString() === "StorageFeeDeposited" - ); - if (!opRegistered || !storageFee) { - logger.info(`No operatorRegisteredEvent or storageFeeDepositedEvent found`); - return; - } - - const operatorId = String(opRegistered?.event.data[0]); - const domainId_storageFee = String(opRegistered.event.data[1]); - const operatorId_storageFee = String(storageFee.event.data[0]); - const nominatorId_storageFee = String(storageFee.event.data[1]); - const amount_storageFee = BigInt(storageFee.event.data[2].toString()); - - assert(domainId === domainId_storageFee, "domainId mismatch"); - assert(operatorId === operatorId_storageFee, "operatorId mismatch"); - assert(signer.toString() === nominatorId_storageFee, "signer mismatch"); - assert( - amount_storageFee === (BigInt(amount) * BigInt(20)) / BigInt(100), - `Storage fee (${amount_storageFee}) should be 20% of the amount (${amount})` - ); - - const domain = await db.checkAndGetDomain( - domainId, - BigInt(number.toString()) - ); - domain.totalDeposits += amount; - domain.updatedAt = BigInt(number.toString()); - - const account = await db.checkAndGetAccount( - signer.toString(), - number.toNumber() - ); - account.totalDeposits += amount; - account.updatedAt = BigInt(number.toString()); - - const operator = await db.checkAndGetOperator(operatorId, number.toNumber()); - operator.domainId = domain.id; - operator.accountId = account.id; - operator.signingKey = String(signingKey); - operator.minimumNominatorStake = BigInt(minimumNominatorStake); - operator.nominationTax = Number(nominationTax); - operator.totalDeposits += amount; - operator.pendingAction = OperatorPendingAction.PENDING_REGISTRATION; - operator.updatedAt = BigInt(number.toString()); - - const nominator = await db.checkAndGetNominator( - signer.toString(), - domain.id, - operator.id, - number.toNumber() - ); - nominator.totalDeposits += amount; - nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; - nominator.updatedAt = BigInt(number.toString()); - - const deposit = await db.checkAndGetDeposit( - signer.toString(), - domain.id, - operator.id, - amount - amount_storageFee, - amount_storageFee, - number.toNumber() - ); - deposit.epochDepositedAt = domain.completedEpoch ?? 0; - deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - deposit.save(), - ]); -} - -export async function handleNominateOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - const { - events, - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = String(args[0]); - const amount = BigInt(args[1].toString()); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const signer = extrinsic.extrinsic.signer.toString(); - - const storageFeeDepositedEvent = events.find( - (e) => e.event.method.toString() === "StorageFeeDeposited" - ); - const operatorNominatedEvent = events.find( - (e) => e.event.method.toString() === "OperatorNominated" - ); - - const storageFeeDeposit = BigInt( - storageFeeDepositedEvent?.event.data[2].toString() ?? 0 - ); - const totalAmount = amount + storageFeeDeposit; - - const account = await db.checkAndGetAccount(signer, blockNumber); - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - - const nominator = await db.checkAndGetNominator( - signer, - domain.id, - operator.id, - blockNumber - ); - - const deposit = await db.checkAndGetDeposit( - signer, - domain.id, - operator.id, - amount, - storageFeeDeposit, - blockNumber - ); - deposit.epochDepositedAt = domain.completedEpoch ?? 0; - deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; - - operator.totalDeposits += totalAmount; - operator.updatedAt = BigInt(blockNumber); - - if (nominator.totalDepositsCount === BigInt(0)) { - nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; - } - nominator.totalDeposits += totalAmount; - nominator.totalDepositsCount++; - nominator.updatedAt = BigInt(blockNumber); - - domain.totalDeposits += totalAmount; - domain.updatedAt = BigInt(blockNumber); - - account.totalDeposits += totalAmount; - account.updatedAt = BigInt(blockNumber); - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - deposit.save(), - ]); -} - -export async function handleDeregisterOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - logger.info( - `New ${extrinsic.extrinsic.registry.toString()}.${ - extrinsic.extrinsic.method - } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` - ); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const { - events, - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = String(args[0]); - - const opDeregistered = events.find( - (e) => e.event.method.toString() === "OperatorDeregistered" - ); - if (!opDeregistered) { - logger.info(`No operatorDeregisteredEvent found`); - return; - } - - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - operator.currentTotalStake = BigInt(0); - operator.currentStorageFeeDeposit = BigInt(0); - operator.status = OperatorStatus.DEREGISTERED; - operator.updatedAt = BigInt(blockNumber); - - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - const activeNominators = - nominators && - nominators.filter( - (n) => - n.status === NominatorStatus.STAKED || - n.status === NominatorStatus.PENDING - ); - if (activeNominators) { - activeNominators.forEach(async (n) => { - const estimatedAmount = - (operator.currentSharePrice * n.knownShares) / - SHARES_CALCULATION_MULTIPLIER; - const withdrawal = await db.checkAndGetWithdrawal( - account.id, - domain.id, - operator.id, - n.id, - blockNumber - ); - - n.status = NominatorStatus.PENDING; - n.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - n.totalWithdrawalsCount++; - n.totalEstimatedWithdrawals += estimatedAmount; - n.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - account.totalEstimatedWithdrawals += estimatedAmount; - domain.totalEstimatedWithdrawals += estimatedAmount; - - await Promise.all([n.save(), withdrawal.save()]); - }); - } - await Promise.all([operator.save(), domain.save(), account.save()]); -} - -export async function handleOperatorSlashedEvent( - event: SubstrateEvent -): Promise { - const blockNumber = event.block.block.header.number.toNumber(); - const operatorId = event.event.data[0].toString(); - - // Query operator details - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - operator.currentTotalStake = BigInt(0); - operator.currentStorageFeeDeposit = BigInt(0); - operator.status = OperatorStatus.SLASHED; - operator.updatedAt = BigInt(blockNumber); - - // Fetch nominators associated with the operator - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (nominators) { - nominators.forEach(async (nominator) => { - nominator.status = NominatorStatus.SLASHED; - nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; - nominator.updatedAt = BigInt(blockNumber); - await nominator.save(); - }); - } - - // Fetch withdrawals associated with the operator - const withdrawals = await Withdrawal.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (withdrawals) { - withdrawals.forEach(async (withdrawal) => { - if ( - withdrawal.status === WithdrawalStatus.PENDING_LOCK || - withdrawal.status === WithdrawalStatus.PENDING_OPERATOR || - withdrawal.status === WithdrawalStatus.READY - ) { - withdrawal.status = WithdrawalStatus.SLASHED; - withdrawal.updatedAt = BigInt(blockNumber); - await withdrawal.save(); - } - }); - } - - // Save operator changes - await operator.save(); -} - -export async function handleOperatorTaxCollectedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, tax], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const taxAmount = BigInt(tax.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - - operator.totalTaxCollected += taxAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalTaxCollected += taxAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalTaxCollected += taxAmount; - domain.updatedAt = BigInt(blockNumber); - - await Promise.all([operator.save(), account.save(), domain.save()]); -} - -export async function handleOperatorRewardedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, reward], - }, - block, - } = event; - const amount = BigInt(reward.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - block.block.header.number.toNumber() - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(block.block.header.number.toString()) - ); - - operator.totalRewardsCollected += amount; - domain.totalRewardsCollected += amount; - - const rewardEvent = await db.checkAndGetReward( - `${operatorId}-${block.block.header.number.toNumber()}`, - block.block.header.number.toNumber() - ); - rewardEvent.amount = amount; - rewardEvent.domainId = operator.domainId; - rewardEvent.operatorId = operator.id; - rewardEvent.timestamp = new Date(block.timestamp ?? 0); - - await Promise.all([operator.save(), domain.save(), rewardEvent.save()]); -} - -export async function handleWithdrawStakeCall( - extrinsic: SubstrateExtrinsic -): Promise { - const { - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = args[0].toString(); - const shares = args[1].toString(); - const address = extrinsic.extrinsic.signer.toString(); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const sharesBigInt = BigInt(shares.toString()); - - const account = await db.checkAndGetAccount(address, blockNumber); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const nominator = await db.checkAndGetNominator( - address, - domain.id, - operator.id, - blockNumber - ); - - const estimatedAmount = - (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; - const withdrawal = await db.checkAndGetWithdrawal( - account.id, - domain.id, - operator.id, - nominator.id, - blockNumber - ); - - withdrawal.domainId = domain.id; - withdrawal.accountId = account.id; - withdrawal.operatorId = operator.id; - withdrawal.nominatorId = nominator.id; - withdrawal.shares = sharesBigInt; - withdrawal.estimatedAmount = estimatedAmount; - withdrawal.epochWithdrawalRequestedAt = domain.completedEpoch ?? 0; - withdrawal.domainBlockNumberWithdrawalRequestedAt = - domain.lastDomainBlockNumber ?? 0; - withdrawal.status = WithdrawalStatus.PENDING_LOCK; - withdrawal.createdAt = BigInt(blockNumber); - withdrawal.updatedAt = BigInt(blockNumber); - - nominator.totalWithdrawalsCount++; - nominator.totalEstimatedWithdrawals += estimatedAmount; - nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - nominator.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalEstimatedWithdrawals += estimatedAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalEstimatedWithdrawals += estimatedAmount; - domain.updatedAt = BigInt(blockNumber); - - await Promise.all([ - withdrawal.save(), - nominator.save(), - operator.save(), - account.save(), - domain.save(), - ]); -} - -export async function handleUnlockFundsCall( - extrinsic: SubstrateExtrinsic -): Promise { - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const signer = extrinsic.extrinsic.signer.toString(); - const [operatorId, shares] = extrinsic.extrinsic.method.args; - - // Query operator details - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - - // Calculate estimated amount - const sharesBigInt = BigInt(shares.toString()); - const estimatedAmount = - (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; - - // Fetch or create Withdrawal entity - const withdrawal = await db.checkAndGetWithdrawal( - signer, - operator.domainId, - operator.id, - signer, - blockNumber - ); - - withdrawal.shares = sharesBigInt; - withdrawal.estimatedAmount = estimatedAmount; - withdrawal.status = WithdrawalStatus.PENDING_LOCK; - withdrawal.createdAt = BigInt(blockNumber); - withdrawal.updatedAt = BigInt(blockNumber); - - // Update related entities - const account = await db.checkAndGetAccount(signer, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const nominator = await db.checkAndGetNominator( - signer, - domain.id, - operator.id, - blockNumber - ); - - nominator.totalWithdrawalsCount++; - nominator.totalEstimatedWithdrawals += estimatedAmount; - nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - nominator.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalEstimatedWithdrawals += estimatedAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalEstimatedWithdrawals += estimatedAmount; - domain.updatedAt = BigInt(blockNumber); - - // Save all changes - await Promise.all([ - withdrawal.save(), - nominator.save(), - operator.save(), - account.save(), - domain.save(), - ]); -} - -export async function handleUnlockOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - // Implementation for handleUnlockOperatorCall -} - -export async function handleUnlockNominatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - // Implementation for handleUnlockNominatorCall -} - -export async function handleDomainEpochCompletedEvent( - event: SubstrateEvent -): Promise { - logger.info( - `New ${event.event.section}.${ - event.event.method - } event found at block ${event.block.block.header.number.toString()}` - ); - const { - event: { - data: [domainId, epochIndex], - }, - } = event; - const blockNumber = event.block.block.header.number.toNumber(); - - // Querying additional state if necessary - const _domainEntry = await api.query.domains.domainRegistry(domainId); - const domainEntry = _domainEntry.toJSON() as any[0]; - - // Parse domain details - const parsedDomain = { - domainId: domainEntry?.domainId, - ownerAccountId: domainEntry?.ownerAccountId, - // Add other necessary fields - }; - - // Fetch or create Domain entity - const domain = await db.checkAndGetDomain( - domainId.toString(), - BigInt(blockNumber) - ); - domain.completedEpoch = BigInt(epochIndex.toString()); - domain.updatedAt = BigInt(blockNumber); - - // Update domain based on fetched data - if (parsedDomain.ownerAccountId) { - domain.accountId = parsedDomain.ownerAccountId; - // Update other domain fields as necessary - } - - await domain.save(); -} - -export async function handleForceDomainEpochTransitionEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleForceDomainEpochTransitionEvent -} - -export async function handleOperatorRegisteredEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorRegisteredEvent -} - -export async function handleOperatorDeregisteredEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorDeregisteredEvent -} - -export async function handleOperatorNominatedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorNominatedEvent -} - -export async function handleWithdrewStakeEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleWithdrewStakeEvent -} - -export async function handleStorageFeeDepositedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleStorageFeeDepositedEvent -} - -export async function handleBundleStoredEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [domainId, bundleAuthor], - }, - block: { - block: { - header: { number, hash }, - }, - timestamp, - }, - extrinsic, - } = event; - const domainIdNum = BigInt(domainId.toString()); - const operatorId = BigInt(bundleAuthor.toString()); - if (!extrinsic) return; - - const _bundle = - extrinsic.extrinsic.method.args[0].toPrimitive() as unknown as TBundle; - const sealedHeader = _bundle.sealedHeader as SealedBundleHeader; - const domain = await db.checkAndGetDomain( - domainId.toString(), - BigInt(number.toString()) - ); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - number.toNumber() - ); - const account = await db.checkAndGetAccount( - operator.accountId, - number.toNumber() - ); - - const receipt = sealedHeader.header.receipt as ExecutionReceipt; - const { transfers } = receipt; - - const totalTransfersIn = Array.isArray(transfers.transfersIn) - ? transfers.transfersIn.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersInCount = Array.isArray(transfers.transfersIn) - ? transfers.transfersIn.length - : 0; - - const totalTransfersOut = Array.isArray(transfers.transfersOut) - ? transfers.transfersOut.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersOutCount = Array.isArray(transfers.transfersOut) - ? transfers.transfersOut.length - : 0; - - const totalRejectedTransfersClaimed = Array.isArray( - transfers.rejectedTransfersClaimed - ) - ? transfers.rejectedTransfersClaimed.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const rejectedTransfersClaimedCount = Array.isArray( - transfers.rejectedTransfersClaimed - ) - ? transfers.rejectedTransfersClaimed.length - : 0; - - const totalTransfersRejected = Array.isArray(transfers.transfersRejected) - ? transfers.transfersRejected.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersRejectedCount = Array.isArray(transfers.transfersRejected) - ? transfers.transfersRejected.length - : 0; - - const totalVolume = totalTransfersIn + totalTransfersOut; - - const { - domainBlockNumber, - domainBlockHash, - domainBlockExtrinsicRoot, - consensusBlockNumber, - consensusBlockHash, - blockFees, - } = receipt; - - const epoch = domain.completedEpoch; - const domainEpoch = await db.checkAndGetDomainEpoch( - `${domainId}-${epoch}`, - number.toNumber() - ); - domainEpoch.blockNumberEnd = BigInt(domainBlockNumber); - domainEpoch.timestampEnd = timestamp ?? new Date(0); - domainEpoch.consensusBlockNumberEnd = BigInt(consensusBlockNumber); - domainEpoch.consensusBlockHashEnd = hash.toString(); - domainEpoch.blockCount = - domainEpoch.blockNumberEnd - domainEpoch.blockNumberStart + BigInt(1); - domainEpoch.epochDuration = BigInt( - domainEpoch.timestampEnd.getTime() - domainEpoch.timestampStart.getTime() - ); - domainEpoch.updatedAt = BigInt(number.toNumber()); - - let domainBlock = await db.checkAndGetDomainBlock( - `${domainId}-${domainBlockNumber}`, - number.toNumber() - ); - if (!domainBlock) { - domainBlock = DomainBlock.create({ - id: `${domainId}-${domainBlockNumber}`, - domainId: domain.id, - domainEpochId: domainEpoch.id, - blockNumber: BigInt(domainBlockNumber), - blockHash: domainBlockHash.toString(), - extrinsicRoot: domainBlockExtrinsicRoot.toString(), - epoch: domain.completedEpoch, - consensusBlockNumber: BigInt(consensusBlockNumber), - consensusBlockHash: consensusBlockHash.toString(), - timestamp: timestamp ?? new Date(0), - createdAt: BigInt(number.toString()), - updatedAt: BigInt(number.toString()), - }); - } - - let bundle = await db.checkAndGetBundle( - `${domainId}-${domainBlockHash}-${number.toNumber()}`, - number.toNumber() - ); - if (!bundle) { - bundle = Bundle.create({ - id: `${domainId}-${domainBlockHash}-${number.toNumber()}`, - domainId: domain.id, - domainBlockId: domainBlock.id, - domainEpochId: domainEpoch.id, - domainBlockNumber: BigInt(domainBlockNumber), - domainBlockHash: domainBlockHash.toString(), - domainBlockExtrinsicRoot: domainBlockExtrinsicRoot.toString(), - epoch: domain.completedEpoch, - consensusBlockNumber: BigInt(consensusBlockNumber), - consensusBlockHash: consensusBlockHash.toString(), - totalTransfersIn, - transfersInCount: BigInt(transfersInCount), - totalTransfersOut, - transfersOutCount: BigInt(transfersOutCount), - totalRejectedTransfersClaimed, - rejectedTransfersClaimedCount: BigInt(rejectedTransfersClaimedCount), - totalTransfersRejected, - transfersRejectedCount: BigInt(transfersRejectedCount), - totalVolume, - consensusStorageFee: BigInt(blockFees.consensusStorageFee), - domainExecutionFee: BigInt(blockFees.domainExecutionFee), - burnedBalance: BigInt(blockFees.burnedBalance), - }); - } - - let bundleAuthorEntity = await db.checkAndGetBundleAuthor( - `${domainId}-${account.id}-${operator.id}-${bundle.id}`, - number.toNumber() - ); - if (!bundleAuthorEntity) { - bundleAuthorEntity = BundleAuthor.create({ - id: `${domainId}-${account.id}-${operator.id}-${bundle.id}`, - domainId: domain.id, - accountId: account.id, - operatorId: operator.id, - bundleId: bundle.id, - domainBlockId: domainBlock.id, - domainEpochId: domainEpoch.id, - epoch: domain.completedEpoch, - }); - } - - domain.lastDomainBlockNumber = BigInt(domainBlockNumber); - domain.totalTransfersIn += totalTransfersIn; - domain.transfersInCount += BigInt(transfersInCount); - domain.totalTransfersOut += totalTransfersOut; - domain.transfersOutCount += BigInt(transfersOutCount); - domain.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; - domain.rejectedTransfersClaimedCount += BigInt(rejectedTransfersClaimedCount); - domain.totalTransfersRejected += totalTransfersRejected; - domain.transfersRejectedCount += BigInt(transfersRejectedCount); - domain.totalVolume += totalVolume; - domain.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); - domain.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); - domain.totalBurnedBalance += BigInt(blockFees.burnedBalance); - domain.bundleCount++; - domain.currentEpochDuration = domainEpoch.epochDuration; - - if (epoch > 0) { - const lastEpoch = await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(1)}`, - number.toNumber() - ); - const lastEpochTimestampEnd = lastEpoch.timestampEnd.getTime(); - domain.lastEpochDuration = lastEpoch.epochDuration; - if (epoch > 6) { - domain.last6EpochsDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(6)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - if (epoch > 144) { - domain.last144EpochDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(144)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - if (epoch > 1000) { - domain.last1kEpochDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(1000)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - } - domain.lastBundleAt = BigInt(number.toString()); - domain.updatedAt = BigInt(number.toString()); - - operator.totalTransfersIn += totalTransfersIn; - operator.transfersInCount += BigInt(transfersInCount); - operator.totalTransfersOut += totalTransfersOut; - operator.transfersOutCount += BigInt(transfersOutCount); - operator.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; - operator.rejectedTransfersClaimedCount += BigInt( - rejectedTransfersClaimedCount - ); - operator.totalTransfersRejected += totalTransfersRejected; - operator.transfersRejectedCount += BigInt(transfersRejectedCount); - operator.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); - operator.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); - operator.totalBurnedBalance += BigInt(blockFees.burnedBalance); - operator.totalVolume += totalVolume; - operator.bundleCount++; - operator.lastBundleAt = BigInt(number.toString()); - operator.updatedAt = BigInt(number.toString()); - - await Promise.all([ - domain.save(), - domainEpoch.save(), - domainBlock.save(), - bundle.save(), - bundleAuthorEntity.save(), - operator.save(), - ]); -} - -export async function handleOperatorUnlockedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - - operator.pendingAction = OperatorPendingAction.NO_ACTION_REQUIRED; - operator.updatedAt = BigInt(blockNumber); - - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (nominators) { - nominators.forEach(async (n) => { - if ( - n.status === NominatorStatus.PENDING || - n.status === NominatorStatus.STAKED - ) { - n.status = NominatorStatus.PENDING; - n.pendingAction = NominatorPendingAction.READY_TO_UNLOCK_ALL_FUNDS; - n.updatedAt = BigInt(blockNumber); - await n.save(); - } - }); - } - - const withdrawals = await Withdrawal.getByDomainId(domain.id, { - limit: MAX_LIMIT, - }); - if (withdrawals) { - withdrawals.forEach(async (w) => { - if (w.status === WithdrawalStatus.PENDING_OPERATOR) { - w.status = WithdrawalStatus.READY; - w.readyAt = BigInt(blockNumber); - w.updatedAt = BigInt(blockNumber); - await w.save(); - } - }); - } - - await Promise.all([operator.save(), domain.save(), account.save()]); -} - -export async function handleFundsUnlockedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, nominatorId, amount], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const amountBigInt = BigInt(amount.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount( - nominatorId.toString(), - blockNumber - ); - const nominator = await db.checkAndGetNominator( - nominatorId.toString(), - domain.id, - operator.id, - blockNumber - ); - - const withdrawals = await Withdrawal.getByFields( - [ - ["operatorId", "=", operator.id], - ["accountId", "=", account.id], - ], - { limit: MAX_LIMIT } - ); - if (withdrawals) { - withdrawals.forEach(async (w) => { - if (w.status === WithdrawalStatus.PENDING_LOCK) { - w.status = WithdrawalStatus.WITHDRAW; - w.unlockedAmount = amountBigInt; - w.unlockedAt = BigInt(blockNumber); - w.updatedAt = BigInt(blockNumber); - await w.save(); - } - }); - } - - let amountToWithdraw = amountBigInt; - const deposits = await Deposit.getByFields( - [ - ["operatorId", "=", operator.id], - ["accountId", "=", account.id], - ], - { limit: MAX_LIMIT } - ); - if (deposits) { - deposits.forEach(async (d) => { - if (amountToWithdraw > 0) { - if (amountToWithdraw > d.totalAmount) { - amountToWithdraw -= d.totalAmount; - d.totalWithdrawn = d.totalAmount; - d.status = DepositStatus.WITHDRAWN; - } else { - d.totalWithdrawn = amountToWithdraw; - d.status = DepositStatus.PARTIALLY_WITHDRAWN; - amountToWithdraw = BigInt(0); - } - d.updatedAt = BigInt(blockNumber); - await d.save(); - } - }); - } - - domain.totalWithdrawals += amountBigInt; - domain.updatedAt = BigInt(blockNumber); - - account.totalWithdrawals += amountBigInt; - account.updatedAt = BigInt(blockNumber); - - operator.totalWithdrawals += amountBigInt; - operator.updatedAt = BigInt(blockNumber); - - nominator.totalWithdrawals += amountBigInt; - nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; - nominator.updatedAt = BigInt(blockNumber); - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - ]); -} - -export async function handleNominatedStakedUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleNominatedStakedUnlockedEvent -} - -export async function handleNominatorUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleNominatorUnlockedEvent -} - -export async function handleStorageFeeUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleStorageFeeUnlockedEvent -} diff --git a/indexers/mainnet/staking/src/mappings/models.ts b/indexers/mainnet/staking/src/mappings/models.ts deleted file mode 100644 index 6faa9de2d..000000000 --- a/indexers/mainnet/staking/src/mappings/models.ts +++ /dev/null @@ -1,49 +0,0 @@ -export enum DomainRuntime { - EVM = "EVM", - AUTO_ID = "AUTO_ID", -} - -export enum OperatorStatus { - PENDING = "PENDING", - REGISTERED = "REGISTERED", - DEREGISTERED = "DEREGISTERED", - SLASHED = "SLASHED", -} - -export enum OperatorPendingAction { - NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", - PENDING_REGISTRATION = "PENDING_REGISTRATION", - WAITING_TO_UNLOCK_NOMINATOR = "WAITING_TO_UNLOCK_NOMINATOR", - READY_FOR_UNLOCK_NOMINATOR = "READY_FOR_UNLOCK_NOMINATOR", - READY_FOR_UNLOCK_FUNDS = "READY_FOR_UNLOCK_FUNDS", -} - -export enum NominatorStatus { - PENDING = "PENDING", - STAKED = "STAKED", - SLASHED = "SLASHED", - WITHDRAW = "WITHDRAW", -} - -export enum NominatorPendingAction { - NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", - PENDING_EPOCH_CHANGE = "PENDING_EPOCH_CHANGE", - PENDING_LOCK_PERIOD = "PENDING_LOCK_PERIOD", - READY_TO_UNLOCK_ALL_FUNDS = "READY_TO_UNLOCK_ALL_FUNDS", -} - -export enum DepositStatus { - PENDING = "PENDING", - DEPOSITED = "DEPOSITED", - PARTIALLY_WITHDRAWN = "PARTIALLY_WITHDRAWN", - WITHDRAWN = "WITHDRAWN", - SLASHED = "SLASHED", -} - -export enum WithdrawalStatus { - PENDING_LOCK = "PENDING_LOCK", - PENDING_OPERATOR = "PENDING_OPERATOR", - READY = "READY", - WITHDRAW = "WITHDRAW", - SLASHED = "SLASHED", -} diff --git a/indexers/mainnet/staking/src/mappings/types.ts b/indexers/mainnet/staking/src/mappings/types.ts deleted file mode 100644 index aeddf35fe..000000000 --- a/indexers/mainnet/staking/src/mappings/types.ts +++ /dev/null @@ -1,123 +0,0 @@ -export interface TBundle { - sealedHeader: SealedBundleHeader; - extrinsics: Uint8Array[]; -} - -export interface SealedBundleHeader { - header: BundleHeader; - signature: Uint8Array; -} - -interface BundleHeader { - proofOfElection: ProofOfElection; - receipt: ExecutionReceipt; - estimatedBundleWeight: Weight; - bundleExtrinsicsRoot: Uint8Array; -} - -interface ProofOfElection { - domainId: number; - slotNumber: bigint; - proofOfTime: Uint8Array; - vrfSignature: VrfSignature; - operatorId: bigint; - consensusBlockHash: Uint8Array; -} - -export interface ExecutionReceipt { - domainBlockNumber: number; - domainBlockHash: Uint8Array; - domainBlockExtrinsicRoot: Uint8Array; - parentDomainBlockReceiptHash: Uint8Array; - consensusBlockNumber: number; - consensusBlockHash: Uint8Array; - inboxedBundles: InboxedBundle[]; - finalStateRoot: Uint8Array; - executionTrace: Uint8Array[]; - executionTraceRoot: Uint8Array; - blockFees: BlockFees; - transfers: Transfers; -} - -interface VrfSignature { - preOutput: Uint8Array; - proof: Uint8Array; -} - -interface Weight { - refTime: bigint; - proofSize: bigint; -} - -interface InboxedBundle { - bundle: BundleValidity; - extrinsicsRoot: Uint8Array; -} - -interface Transfers { - transfersIn: [ChainId, bigint][]; - transfersOut: [ChainId, bigint][]; - rejectedTransfersClaimed: [ChainId, bigint][]; - transfersRejected: [ChainId, bigint][]; -} - -interface BlockFees { - consensusStorageFee: bigint; - domainExecutionFee: bigint; - burnedBalance: bigint; -} - -type BundleValidity = BundleValidity_Invalid | BundleValidity_Valid; - -interface BundleValidity_Invalid { - __kind: "Invalid"; - value: InvalidBundleType; -} - -interface BundleValidity_Valid { - __kind: "Valid"; - value: Uint8Array; -} - -type ChainId = ChainId_Consensus | ChainId_Domain; - -interface ChainId_Consensus { - __kind: "Consensus"; -} - -interface ChainId_Domain { - __kind: "Domain"; - value: number; -} - -type InvalidBundleType = - | InvalidBundleType_UndecodableTx - | InvalidBundleType_OutOfRangeTx - | InvalidBundleType_IllegalTx - | InvalidBundleType_InvalidXDM - | InvalidBundleType_InherentExtrinsic; - -interface InvalidBundleType_UndecodableTx { - __kind: "UndecodableTx"; - value: number; -} - -interface InvalidBundleType_OutOfRangeTx { - __kind: "OutOfRangeTx"; - value: number; -} - -interface InvalidBundleType_IllegalTx { - __kind: "IllegalTx"; - value: number; -} - -interface InvalidBundleType_InvalidXDM { - __kind: "InvalidXDM"; - value: number; -} - -interface InvalidBundleType_InherentExtrinsic { - __kind: "InherentExtrinsic"; - value: number; -} diff --git a/indexers/mainnet/staking/tsconfig.json b/indexers/mainnet/staking/tsconfig.json deleted file mode 100644 index b827eae7e..000000000 --- a/indexers/mainnet/staking/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/mainnet/yarn.lock b/indexers/mainnet/yarn.lock deleted file mode 100644 index fb57ccd13..000000000 --- a/indexers/mainnet/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - From 965533c3e65bc56e13e0e2a6bbdc212cbf4167e4 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:40:29 -0500 Subject: [PATCH 6/8] remove taurus/* --- indexers/taurus/README.md | 68 - indexers/taurus/consensus/.gitignore | 62 - indexers/taurus/consensus/LICENSE | 21 - indexers/taurus/consensus/README.md | 42 - indexers/taurus/consensus/package.json | 58 - indexers/taurus/consensus/project.ts | 75 -- indexers/taurus/consensus/schema.graphql | 115 -- indexers/taurus/consensus/src/index.ts | 3 - indexers/taurus/consensus/src/mappings/db.ts | 269 ---- .../taurus/consensus/src/mappings/helper.ts | 71 -- .../consensus/src/mappings/mappingHandlers.ts | 397 ------ .../taurus/consensus/src/mappings/types.ts | 17 - .../taurus/consensus/src/mappings/utils.ts | 58 - indexers/taurus/consensus/tsconfig.json | 20 - indexers/taurus/files/.gitignore | 62 - indexers/taurus/files/LICENSE | 21 - indexers/taurus/files/README.md | 40 - indexers/taurus/files/package.json | 57 - indexers/taurus/files/project.ts | 95 -- indexers/taurus/files/schema.graphql | 67 - indexers/taurus/files/src/index.ts | 3 - indexers/taurus/files/src/mappings/db.ts | 146 --- .../files/src/mappings/mappingHandlers.ts | 139 -- indexers/taurus/files/src/mappings/types.ts | 9 - indexers/taurus/files/tsconfig.json | 20 - indexers/taurus/leaderboard/.gitignore | 62 - indexers/taurus/leaderboard/LICENSE | 21 - indexers/taurus/leaderboard/README.md | 42 - indexers/taurus/leaderboard/package.json | 55 - indexers/taurus/leaderboard/project.ts | 63 - indexers/taurus/leaderboard/schema.graphql | 247 ---- indexers/taurus/leaderboard/src/index.ts | 3 - .../taurus/leaderboard/src/mappings/db.ts | 612 --------- .../src/mappings/mappingHandlers.ts | 423 ------- indexers/taurus/leaderboard/tsconfig.json | 20 - indexers/taurus/staking/.gitignore | 62 - indexers/taurus/staking/LICENSE | 21 - indexers/taurus/staking/README.md | 42 - indexers/taurus/staking/package.json | 55 - indexers/taurus/staking/project.ts | 255 ---- indexers/taurus/staking/schema.graphql | 387 ------ indexers/taurus/staking/src/index.ts | 3 - .../taurus/staking/src/mappings/constants.ts | 1 - indexers/taurus/staking/src/mappings/db.ts | 566 --------- .../staking/src/mappings/mappingHandlers.ts | 1114 ----------------- .../taurus/staking/src/mappings/models.ts | 49 - indexers/taurus/staking/src/mappings/types.ts | 123 -- indexers/taurus/staking/tsconfig.json | 20 - indexers/taurus/yarn.lock | 4 - 49 files changed, 6185 deletions(-) delete mode 100644 indexers/taurus/README.md delete mode 100644 indexers/taurus/consensus/.gitignore delete mode 100644 indexers/taurus/consensus/LICENSE delete mode 100644 indexers/taurus/consensus/README.md delete mode 100644 indexers/taurus/consensus/package.json delete mode 100644 indexers/taurus/consensus/project.ts delete mode 100644 indexers/taurus/consensus/schema.graphql delete mode 100644 indexers/taurus/consensus/src/index.ts delete mode 100644 indexers/taurus/consensus/src/mappings/db.ts delete mode 100644 indexers/taurus/consensus/src/mappings/helper.ts delete mode 100644 indexers/taurus/consensus/src/mappings/mappingHandlers.ts delete mode 100644 indexers/taurus/consensus/src/mappings/types.ts delete mode 100644 indexers/taurus/consensus/src/mappings/utils.ts delete mode 100644 indexers/taurus/consensus/tsconfig.json delete mode 100644 indexers/taurus/files/.gitignore delete mode 100644 indexers/taurus/files/LICENSE delete mode 100644 indexers/taurus/files/README.md delete mode 100644 indexers/taurus/files/package.json delete mode 100644 indexers/taurus/files/project.ts delete mode 100644 indexers/taurus/files/schema.graphql delete mode 100644 indexers/taurus/files/src/index.ts delete mode 100644 indexers/taurus/files/src/mappings/db.ts delete mode 100644 indexers/taurus/files/src/mappings/mappingHandlers.ts delete mode 100644 indexers/taurus/files/src/mappings/types.ts delete mode 100644 indexers/taurus/files/tsconfig.json delete mode 100644 indexers/taurus/leaderboard/.gitignore delete mode 100644 indexers/taurus/leaderboard/LICENSE delete mode 100644 indexers/taurus/leaderboard/README.md delete mode 100644 indexers/taurus/leaderboard/package.json delete mode 100644 indexers/taurus/leaderboard/project.ts delete mode 100644 indexers/taurus/leaderboard/schema.graphql delete mode 100644 indexers/taurus/leaderboard/src/index.ts delete mode 100644 indexers/taurus/leaderboard/src/mappings/db.ts delete mode 100644 indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts delete mode 100644 indexers/taurus/leaderboard/tsconfig.json delete mode 100644 indexers/taurus/staking/.gitignore delete mode 100644 indexers/taurus/staking/LICENSE delete mode 100644 indexers/taurus/staking/README.md delete mode 100644 indexers/taurus/staking/package.json delete mode 100644 indexers/taurus/staking/project.ts delete mode 100644 indexers/taurus/staking/schema.graphql delete mode 100644 indexers/taurus/staking/src/index.ts delete mode 100644 indexers/taurus/staking/src/mappings/constants.ts delete mode 100644 indexers/taurus/staking/src/mappings/db.ts delete mode 100644 indexers/taurus/staking/src/mappings/mappingHandlers.ts delete mode 100644 indexers/taurus/staking/src/mappings/models.ts delete mode 100644 indexers/taurus/staking/src/mappings/types.ts delete mode 100644 indexers/taurus/staking/tsconfig.json delete mode 100644 indexers/taurus/yarn.lock diff --git a/indexers/taurus/README.md b/indexers/taurus/README.md deleted file mode 100644 index 1a39b55e4..000000000 --- a/indexers/taurus/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# Testnet Taurus Indexer - -## Overview - -The Gemini 3H Indexer is a powerful tool designed to index and manage blockchain data efficiently. It supports various functionalities including account management, consensus mechanisms, leaderboard tracking, and staking operations. - -## Features - -- **Accounts**: Manage user accounts and their associated data. -- **Consensus**: Implement and manage consensus algorithms. -- **Leaderboard**: Track and display rankings based on various metrics. -- **Staking**: Handle staking operations and rewards distribution. - -## Directory Structure - -- `consensus/`: Includes files related to consensus mechanisms. -- `leaderboard/`: Manages leaderboard data and display. -- `staking/`: Handles staking operations and reward calculations. - -## Getting Started - -To get started with the Gemini 3H Indexer, follow these steps: - -1. **Clone the repository**: - - ```sh - git clone https://github.com/autonomys/astral.git - cd indexers - ``` - -2. **Install dependencies**: - - ```sh - yarn install - ``` - -3. **Run the indexer**: - ```sh - yarn dev - ``` - -## Usage - -Detailed usage instructions for each module can be found in their respective directories. Below are some common commands: - -- **Start the indexer**: - - ```sh - yarn dev - ``` - -## Contributing - -We welcome contributions from the community. To contribute, please follow these steps: - -1. Fork the repository. -2. Create a new branch (`git checkout -b feature-branch`). -3. Make your changes and commit them (`git commit -m 'Add new feature'`). -4. Push to the branch (`git push origin feature-branch`). -5. Create a pull request. - -## License - -This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. - -## Contact - -For any questions or support, please open an issue or contact us at support@gemini3h.com. diff --git a/indexers/taurus/consensus/.gitignore b/indexers/taurus/consensus/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/taurus/consensus/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/taurus/consensus/LICENSE b/indexers/taurus/consensus/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/taurus/consensus/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/taurus/consensus/README.md b/indexers/taurus/consensus/README.md deleted file mode 100644 index c6294b978..000000000 --- a/indexers/taurus/consensus/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Consensus - -The Autonomys Astral Explorer Consensus is a specialized SubQuery project that indexes all consensus-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the consensus tracking functionality for the Astral Explorer, providing real-time data on validator activities and network consensus. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all consensus-related events using the relevant pallets -2. Capturing system remarks for additional consensus actions -3. Tracking and updating validator performance and network consensus metrics - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of consensus events -- Monitoring of system remarks for specific consensus actions -- Validator performance calculation and updates -- Support for querying consensus history and network statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/consensus` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/taurus/consensus/package.json b/indexers/taurus/consensus/package.json deleted file mode 100644 index bb47118cb..000000000 --- a/indexers/taurus/consensus/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "taurus_consensus", - "version": "1.0.0", - "description": "Autonomys Taurus Testnet - Consensus", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@autonomys/auto-consensus": "^1.2.1", - "@autonomys/auto-dag-data": "^1.2.1", - "@autonomys/auto-utils": "^1.2.1", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/taurus/consensus/project.ts b/indexers/taurus/consensus/project.ts deleted file mode 100644 index e60cb6a8a..000000000 --- a/indexers/taurus/consensus/project.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-taurus-consensus", - description: "Autonomys Taurus Testnet - Consensus", - repository: "https://github.com/autonomys/astral", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - // @ts-ignore - types: { - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Block, - handler: "handleBlock", - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/taurus/consensus/schema.graphql b/indexers/taurus/consensus/schema.graphql deleted file mode 100644 index a8ede486d..000000000 --- a/indexers/taurus/consensus/schema.graphql +++ /dev/null @@ -1,115 +0,0 @@ -# Core Consensus Entities - -type Block @entity { - id: ID! - sortId: String! @index - height: BigInt! @index - hash: String! @index - timestamp: Date! @index - parentHash: String! - specId: String! - stateRoot: String! - extrinsicsRoot: String! - spacePledged: BigInt! - blockchainSize: BigInt! - extrinsicsCount: Int! - eventsCount: Int! - transfersCount: Int! - rewardsCount: Int! - blockRewardsCount: Int! - voteRewardsCount: Int! - transferValue: BigInt! - rewardValue: BigInt! - blockRewardValue: BigInt! - voteRewardValue: BigInt! - authorId: String! @index -} - -type Log @entity { - id: ID! - sortId: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - indexInBlock: Int! @index - kind: String! - value: String - timestamp: Date! @index -} - -type Extrinsic @entity { - id: ID! - sortId: String! @index - hash: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - section: String! @index - module: String! @index - name: String! - indexInBlock: Int! - success: Boolean! @index - timestamp: Date! @index - nonce: BigInt! - signer: String! @index - signature: String! - args: String! - error: String! - tip: BigInt! - fee: BigInt! - pos: Int! - cid: String @index -} - -type Event @entity { - id: ID! - sortId: String! @index - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - section: String! @index - module: String! @index - name: String! - indexInBlock: BigInt! - timestamp: Date! @index - phase: String! - pos: Int! - args: String! - cid: String @index -} - -# Accounts Entities - -type AccountHistory @entity { - id: ID! - nonce: BigInt! - free: BigInt! - reserved: BigInt! - total: BigInt @index - createdAt: BigInt! @index -} - -type Transfer @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - eventId: String! @index - from: String! @index - to: String! @index - value: BigInt! - fee: BigInt! - success: Boolean! - timestamp: Date! @index -} - -type Reward @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - eventId: String! @index - accountId: String! @index - rewardType: String! @index - amount: BigInt! - timestamp: Date! @index -} diff --git a/indexers/taurus/consensus/src/index.ts b/indexers/taurus/consensus/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/taurus/consensus/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/taurus/consensus/src/mappings/db.ts b/indexers/taurus/consensus/src/mappings/db.ts deleted file mode 100644 index 633e8575b..000000000 --- a/indexers/taurus/consensus/src/mappings/db.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { - AccountHistory, - Block, - Event, - Extrinsic, - Log, - Reward, - Transfer, -} from "../types"; -import { dateEntry, getSortId, moduleName } from "./utils"; - -// Core Consensus DB Functions - -export async function createAndSaveBlock( - hash: string, - height: bigint, - timestamp: Date, - parentHash: string, - specId: string, - stateRoot: string, - extrinsicsRoot: string, - spacePledged: bigint, - blockchainSize: bigint, - extrinsicsCount: number, - eventsCount: number, - transfersCount: number, - rewardsCount: number, - blockRewardsCount: number, - voteRewardsCount: number, - transferValue: bigint, - rewardValue: bigint, - blockRewardValue: bigint, - voteRewardValue: bigint, - authorId: string -): Promise { - const id = height.toString(); - const sortId = getSortId(height); - const block = Block.create({ - id, - sortId, - height, - hash, - timestamp, - parentHash, - specId, - stateRoot, - extrinsicsRoot, - spacePledged, - blockchainSize, - extrinsicsCount, - eventsCount, - transfersCount, - rewardsCount, - blockRewardsCount, - voteRewardsCount, - transferValue, - rewardValue, - blockRewardValue, - voteRewardValue, - authorId, - }); - await block.save(); - return block; -} - -export async function createAndSaveLog( - blockHeight: bigint, - blockHash: string, - indexInBlock: number, - kind: string, - value: string, - timestamp: Date -): Promise { - const id = `${blockHeight}-${indexInBlock}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - const log = Log.create({ - id, - sortId, - blockHeight, - blockHash, - indexInBlock, - kind, - value, - timestamp, - }); - await log.save(); - return log; -} - -export async function saveLog(logs: Log[]): Promise { - await Promise.all(logs.map((log) => log.save())); -} - -export function createExtrinsic( - hash: string, - blockHeight: bigint, - blockHash: string, - indexInBlock: number, - section: string, - module: string, - success: boolean, - timestamp: Date, - nonce: bigint, - signer: string, - signature: string, - args: string, - error: string, - tip: bigint, - fee: bigint, - pos: number, - cid?: string -): Extrinsic { - const extrinsicId = `${blockHeight}-${indexInBlock}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - return Extrinsic.create({ - id: extrinsicId, - sortId, - hash, - blockHeight, - blockHash, - indexInBlock, - section, - module, - name: moduleName(section, module), - success, - timestamp, - nonce, - signer, - signature, - args, - error, - tip, - fee, - pos, - cid, - }); -} - -export async function saveExtrinsics(extrinsics: Extrinsic[]): Promise { - await Promise.all(extrinsics.map((extrinsic) => extrinsic.save())); -} - -export function createEvent( - blockHeight: bigint, - blockHash: string, - indexInBlock: bigint, - extrinsicId: string, - extrinsicHash: string, - section: string, - module: string, - timestamp: Date, - phase: string, - pos: number, - args: string, - cid?: string -): Event { - const id = `${blockHeight}-${indexInBlock.toString()}`; - const sortId = getSortId(blockHeight, BigInt(indexInBlock)); - return Event.create({ - id, - sortId, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - section, - module, - name: moduleName(section, module), - timestamp, - phase, - pos, - args, - cid, - }); -} - -export async function saveEvents(events: Event[]): Promise { - await Promise.all(events.map((event) => event.save())); -} - -// Accounts DB Functions - -export function createAccountHistory( - id: string, - blockNumber: bigint, - nonce: bigint, - free: bigint, - reserved: bigint, - total: bigint -): AccountHistory { - const accountHistory = AccountHistory.create({ - id, - nonce, - free, - reserved, - total, - ...dateEntry(blockNumber), - }); - return accountHistory; -} - -export async function saveAccountHistories( - accountHistories: AccountHistory[] -): Promise { - await Promise.all( - accountHistories.map((accountHistory) => accountHistory.save()) - ); -} - -export function createTransfer( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - eventId: string, - from: string, - to: string, - value: bigint, - fee: bigint, - success: boolean, - timestamp: Date -): Transfer { - const id = extrinsicId + "-" + eventId; - return Transfer.create({ - id, - blockHeight, - blockHash, - extrinsicId, - eventId, - from, - to, - value, - fee, - success, - timestamp, - }); -} - -export async function saveTransfers(transfers: Transfer[]): Promise { - await Promise.all(transfers.map((transfer) => transfer.save())); -} - -export function createReward( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - eventId: string, - accountId: string, - rewardType: string, - amount: bigint, - timestamp: Date -): Reward { - const id = accountId + "-" + eventId; - return Reward.create({ - id, - blockHeight, - blockHash, - extrinsicId, - eventId, - accountId, - rewardType, - amount, - timestamp, - }); -} - -export async function saveRewards(rewards: Reward[]): Promise { - await Promise.all(rewards.map((reward) => reward.save())); -} diff --git a/indexers/taurus/consensus/src/mappings/helper.ts b/indexers/taurus/consensus/src/mappings/helper.ts deleted file mode 100644 index 03791e34f..000000000 --- a/indexers/taurus/consensus/src/mappings/helper.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - cidOfNode, - cidToString, - decodeNode, - PBNode, -} from "@autonomys/auto-dag-data"; -import { stringify } from "@autonomys/auto-utils"; -import { Bytes } from "@polkadot/types"; -import { compactStripLength } from "@polkadot/util"; -import { SubstrateBlock } from "@subql/types"; -import { Cid, ModifiedArgs, ParsedArgs } from "./types"; -import { decodeLog, hexToUint8Array } from "./utils"; - -const DEFAULT_ACCOUNT_ID = "0x00"; - -export const getBlockAuthor = (block: SubstrateBlock): string => { - const { digest } = block.block.header; - const preRuntimeRaw = digest.logs.find((digestI) => digestI.isPreRuntime); - if (preRuntimeRaw) { - const value = decodeLog(preRuntimeRaw.asPreRuntime); - if (value) { - api.registry.register({ - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }); - const type = api.registry.createType("SubPreDigest", value.data); - const publicKey = (type.toPrimitive() as any).solution.public_key; - const rewardAddress = (type.toPrimitive() as any).solution.reward_address; - return rewardAddress; - } - } - return DEFAULT_ACCOUNT_ID; -}; - -export const parseDataToCid = (data: string): ParsedArgs => { - let cid: Cid = undefined; - let modifiedArgs: ModifiedArgs = undefined; - let node: PBNode | null = null; - try { - const hexString = data.startsWith("0x") ? data.slice(2) : data; - const buffer = Buffer.from(hexString, "hex"); - try { - const [length, bytes] = compactStripLength(buffer); - const isValidLength = length === bytes.length; - try { - const encoded = isValidLength - ? Bytes.from(buffer) - : hexToUint8Array(data); - node = decodeNode(encoded); - } catch (error) { - node = decodeNode(buffer); - } - cid = cidToString(cidOfNode(node)); - } catch (error) { - const encoded = Bytes.from(buffer); - const node = decodeNode(encoded); - cid = cidToString(cidOfNode(node)); - } - modifiedArgs = stringify({ cid }); - } catch (error) { - logger.error("Error decoding remark or seedHistory extrinsic"); - logger.error(error); - } - return { cid, modifiedArgs }; -}; diff --git a/indexers/taurus/consensus/src/mappings/mappingHandlers.ts b/indexers/taurus/consensus/src/mappings/mappingHandlers.ts deleted file mode 100644 index 4fa4f71ab..000000000 --- a/indexers/taurus/consensus/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,397 +0,0 @@ -global.TextEncoder = require("util").TextEncoder; -global.TextDecoder = require("util").TextDecoder; -global.Buffer = require("buffer/").Buffer; - -import { - account, - blockchainSize, - spacePledge, -} from "@autonomys/auto-consensus"; -import type { ApiAtBlockHash } from "@autonomys/auto-utils"; -import { stringify } from "@autonomys/auto-utils"; -import { SubstrateBlock } from "@subql/types"; -import { Event, Extrinsic, Reward, Transfer } from "../types"; -import { - createAccountHistory, - createAndSaveBlock, - createAndSaveLog, - createEvent, - createExtrinsic, - createReward, - createTransfer, - saveAccountHistories, - saveEvents, - saveExtrinsics, - saveRewards, - saveTransfers, -} from "./db"; -import { getBlockAuthor, parseDataToCid } from "./helper"; -import { ExtrinsicPrimitive, LogValue } from "./types"; - -export async function handleBlock(_block: SubstrateBlock): Promise { - const { - block: { - header: { number, parentHash, stateRoot, extrinsicsRoot, digest }, - hash, - extrinsics, - }, - timestamp, - specVersion, - events, - } = _block; - const height = BigInt(number.toString()); - const blockHash = hash.toString(); - const blockTimestamp = timestamp ? timestamp : new Date(0); - const authorId = getBlockAuthor(_block); - const eventsCount = events.length; - const extrinsicsCount = extrinsics.length; - - const newExtrinsics: Extrinsic[] = []; - const newEvents: Event[] = []; - const newTransfers: Transfer[] = []; - const newRewards: Reward[] = []; - - const extrinsicMethodsToUpdate: [string, string][] = []; - const eventMethodsToUpdate: [string, string][] = []; - const logKindsToUpdate: string[] = []; - const addressToUpdate: string[] = []; - - let eventIndex = 0; - let totalBlockRewardsCount = 0; - let totalVoteRewardsCount = 0; - let totalTransferValue = BigInt(0); - let totalRewardValue = BigInt(0); - let totalBlockRewardValue = BigInt(0); - let totalVoteRewardValue = BigInt(0); - - // Calculate space pledged and blockchain size concurrently - const [_spacePledged, _blockchainSize] = await Promise.all([ - spacePledge(api as unknown as ApiAtBlockHash), - blockchainSize(api as unknown as ApiAtBlockHash), - ]); - - // Process extrinsics - extrinsics.forEach((extrinsic, extrinsicIdx) => { - const extrinsicMethodToPrimitive = - extrinsic.method.toPrimitive() as ExtrinsicPrimitive; - - const extrinsicEvents = events.filter( - (e) => - e.phase.isApplyExtrinsic && - e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx - ); - - const feeEvent = events.find( - (e) => - e.phase.isApplyExtrinsic && - e.event.section === "balances" && - e.event.method === "Withdraw" - ); - const fee = - feeEvent && feeEvent.event && feeEvent.event.data[1] - ? BigInt(feeEvent.event.data[1].toString()) - : BigInt(0); - - const errorEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicFailed" - ); - const successEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const error = errorEvent ? stringify(errorEvent.event.data) : ""; - - const pos = extrinsicEvents ? extrinsicIdx : 0; - const extrinsicSigner = extrinsic.signer.toString(); - - // Detect data storage extrinsics and parse args to cid - let cid: string | undefined = undefined; - let args: string = stringify(extrinsicMethodToPrimitive.args); - if ( - (extrinsic.method.section === "historySeeding" && - extrinsic.method.method === "seedHistory") || - (extrinsic.method.section === "system" && - (extrinsic.method.method === "remarkWithEvent" || - extrinsic.method.method === "remark")) - ) { - const parsedArgs = parseDataToCid(extrinsicMethodToPrimitive.args.remark); - cid = parsedArgs.cid; - // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db - args = parsedArgs.modifiedArgs ?? args; - } - - newExtrinsics.push( - createExtrinsic( - extrinsic.hash.toString(), - height, - blockHash, - extrinsicIdx, - extrinsic.method.section, - extrinsic.method.method, - successEvent ? true : false, - timestamp ? timestamp : new Date(0), - BigInt(extrinsic.nonce.toString()), - extrinsicSigner, - extrinsic.signature.toString(), - args, - error, - BigInt(extrinsic.tip.toString()), - fee, - pos, - cid - ) - ); - extrinsicMethodsToUpdate.push([ - extrinsic.method.section, - extrinsic.method.method, - ]); - addressToUpdate.push(extrinsicSigner); - - // Process extrinsic events - extrinsicEvents.forEach((event) => { - const extrinsicId = extrinsic - ? height + "-" + extrinsicIdx.toString() - : ""; - - // Detect data storage extrinsics and parse args to cid - let cid: string | undefined = undefined; - let args: string = stringify(event.event.data); - if ( - event.event.section === "system" && - event.event.method === "Remarked" - ) { - const parsedArgs = parseDataToCid(event.event.data[1].toString()); - cid = parsedArgs.cid; - // The args parameter will be replaced by `{ "cid": "bafkr6i..." }` to minimize the size of the db - args = parsedArgs.modifiedArgs ?? args; - } - - newEvents.push( - createEvent( - height, - blockHash, - BigInt(eventIndex), - extrinsicId, - extrinsic.hash.toString(), - event.event.section, - event.event.method, - timestamp ? timestamp : new Date(0), - event.phase.type, - pos, - args, - cid - ) - ); - eventMethodsToUpdate.push([event.event.section, event.event.method]); - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "balances.Transfer": { - const from = event.event.data[0].toString(); - const to = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - addressToUpdate.push(from, to); - - totalTransferValue += amount; - - const newTransfer = createTransfer( - height, - blockHash, - extrinsicId, - height + "-" + eventIndex, - from, - to, - amount, - fee, - successEvent ? true : false, - timestamp ? timestamp : new Date(0) - ); - newTransfers.push(newTransfer); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - - // Get finalization events - const finalizationEvents = events.filter((e) => e.phase.isFinalization); - - // Process finalization events - finalizationEvents.forEach(async (event) => { - newEvents.push( - createEvent( - height, - blockHash, - BigInt(eventIndex), - height + "-" + event.phase.type, - extrinsic.hash.toString(), - event.event.section, - event.event.method, - timestamp ? timestamp : new Date(0), - event.phase.type, - pos, - args, - cid - ) - ); - eventMethodsToUpdate.push([event.event.section, event.event.method]); - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "rewards.VoteReward": { - const voter = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - addressToUpdate.push(voter); - - totalVoteRewardsCount++; - totalRewardValue += reward; - totalVoteRewardValue += reward; - - const newReward = createReward( - height, - blockHash, - height + "-" + event.phase.type, - height + "-" + eventIndex, - voter, - "rewards.VoteReward", - reward, - timestamp ? timestamp : new Date(0) - ); - newRewards.push(newReward); - - break; - } - case "rewards.BlockReward": { - const blockAuthor = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - addressToUpdate.push(blockAuthor); - - totalBlockRewardsCount++; - totalRewardValue += reward; - totalBlockRewardValue += reward; - - const newReward = createReward( - height, - blockHash, - height + "-" + event.phase.type, - height + "-" + eventIndex, - blockAuthor, - "rewards.BlockReward", - reward, - timestamp ? timestamp : new Date(0) - ); - newRewards.push(newReward); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - }); - - // Create and save block logs - await Promise.all( - digest.logs.map((log, i) => { - const logData = log.toHuman(); - const logJson = log.toPrimitive(); - const kind = logData ? Object.keys(logData)[0] : ""; - const rawKind = logJson ? Object.keys(logJson)[0] : ""; - const _value = logJson ? logJson[rawKind as keyof typeof logJson] : ""; - const value: LogValue = - Array.isArray(_value) && _value.length === 2 - ? { data: _value[1], engine: _value[0] } - : { data: _value }; - - logKindsToUpdate.push(kind); - return createAndSaveLog( - height, - blockHash, - i, - kind, - stringify(value), - blockTimestamp - ); - }) - ); - - // Build sections - const allSections = [ - ...extrinsicMethodsToUpdate.map((method) => method[0]), - ...eventMethodsToUpdate.map((method) => method[0]), - ]; - - // Remove duplicate entry before updating entities - const uniqueAddresses = [...new Set(addressToUpdate)]; - const uniqueSections = [...new Set(allSections)]; - const uniqueExtrinsicMethods = [...new Set(extrinsicMethodsToUpdate)]; - const uniqueEventMethods = [...new Set(eventMethodsToUpdate)]; - const uniqueLogKinds = [...new Set(logKindsToUpdate)]; - - // Update accounts - const accounts = await Promise.all( - uniqueAddresses.map((address) => account(api as any, address)) - ); - // Create and save accounts - const accountHistories = await Promise.all( - accounts.map((account, i) => - createAccountHistory( - uniqueAddresses[i], - height, - BigInt(account.nonce.toString()), - account.data.free, - account.data.reserved, - account.data.free + account.data.reserved - ) - ) - ); - - // Save many entities in parallel - await Promise.all([ - // Save extrinsic and events - saveExtrinsics(newExtrinsics), - saveEvents(newEvents), - - // Save transfers and rewards - saveTransfers(newTransfers), - saveRewards(newRewards), - // Save account - saveAccountHistories(accountHistories), - ]); - - // Create block - await createAndSaveBlock( - blockHash, - height, - blockTimestamp, - parentHash.toString(), - specVersion.toString(), - stateRoot.toString(), - extrinsicsRoot.toString(), - _spacePledged, - _blockchainSize, - extrinsicsCount, - eventsCount, - newTransfers.length, - newRewards.length, - totalBlockRewardsCount, - totalVoteRewardsCount, - totalTransferValue, - totalRewardValue, - totalBlockRewardValue, - totalVoteRewardValue, - authorId - ); -} diff --git a/indexers/taurus/consensus/src/mappings/types.ts b/indexers/taurus/consensus/src/mappings/types.ts deleted file mode 100644 index d2fc41c3c..000000000 --- a/indexers/taurus/consensus/src/mappings/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type ExtrinsicPrimitive = { - callIndex: string; - args: any; -}; - -export type LogValue = { - data: any; - engine?: string; -}; - -export type Cid = string | undefined; -export type ModifiedArgs = string | undefined; - -export type ParsedArgs = { - cid: Cid; - modifiedArgs: ModifiedArgs; -}; diff --git a/indexers/taurus/consensus/src/mappings/utils.ts b/indexers/taurus/consensus/src/mappings/utils.ts deleted file mode 100644 index bc0f31f62..000000000 --- a/indexers/taurus/consensus/src/mappings/utils.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { capitalizeFirstLetter } from "@autonomys/auto-utils"; -import { SubstrateBlock } from "@subql/types"; - -export const dateEntry = (blockNumber: number | bigint) => { - if (typeof blockNumber === "number") { - blockNumber = BigInt(blockNumber); - } - return { - createdAt: blockNumber, - updatedAt: blockNumber, - }; -}; - -export const getBlockNumberFromBlock = (block: SubstrateBlock): number => { - try { - return block.block.header.number.toNumber(); - } catch (error) { - logger.error(`Error getting block number: ${error}`); - throw error; - } -}; - -export const decodeLog = (value: null | Uint8Array | Uint8Array[]) => { - if (!value) return null; - - if (Array.isArray(value)) { - return { - engine: value[0].toString(), - data: value[1], - }; - } - - return { data: value }; -}; - -export const moduleName = (section: string, method: string) => - `${capitalizeFirstLetter(section)}.${capitalizeFirstLetter(method)}`; - -export const getSortId = ( - blockHeight: bigint, - indexInBlock?: bigint -): string => { - const totalLength = 32; - const str1 = blockHeight.toString().padStart(totalLength, "0"); - - if (indexInBlock === undefined) return str1; - - const str2 = indexInBlock.toString().padStart(totalLength, "0"); - return `${str1}-${str2}`; -}; - -export const hexToUint8Array = (hex: string): Uint8Array => { - if (hex.length % 2 !== 0) - throw new Error("Hex string must have an even length"); - return new Uint8Array( - hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] - ); -}; diff --git a/indexers/taurus/consensus/tsconfig.json b/indexers/taurus/consensus/tsconfig.json deleted file mode 100644 index 08ea779b9..000000000 --- a/indexers/taurus/consensus/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/taurus/files/.gitignore b/indexers/taurus/files/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/taurus/files/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/taurus/files/LICENSE b/indexers/taurus/files/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/taurus/files/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/taurus/files/README.md b/indexers/taurus/files/README.md deleted file mode 100644 index 5705e493f..000000000 --- a/indexers/taurus/files/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Autonomys Astral Indexer - Files - -The Autonomys Astral Indexer - Files is a specialized SubQuery project that indexes all files on the Autonomys Mainnen. This project is designed to support the files tracking functionality for the Astral Explorer, providing real-time data on files. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all files and CIDs on the Autonomys Mainnet - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for consensus events, validators, and network metrics. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of consensus events -- Monitoring of system remarks for specific consensus actions -- Validator performance calculation and updates -- Support for querying consensus history and network statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/consensus` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/taurus/files/package.json b/indexers/taurus/files/package.json deleted file mode 100644 index 35bd1f1af..000000000 --- a/indexers/taurus/files/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "taurus_files", - "version": "1.0.0", - "description": "Autonomys Network - Files", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@autonomys/auto-dag-data": "^1.2.1", - "@autonomys/auto-utils": "^1.2.1", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/taurus/files/project.ts b/indexers/taurus/files/project.ts deleted file mode 100644 index 0f13c79d4..000000000 --- a/indexers/taurus/files/project.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-taurus-files", - description: "Autonomys Taurus Testnet - Files", - repository: "https://github.com/autonomys/astral", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - // @ts-ignore - types: { - Solution: { - public_key: "AccountId32", - reward_address: "AccountId32", - }, - SubPreDigest: { - slot: "u64", - solution: "Solution", - }, - }, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "historySeeding", - method: "seedHistory", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "system", - method: "remarkWithEvent", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleCall", - filter: { - module: "system", - method: "remark", - }, - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/taurus/files/schema.graphql b/indexers/taurus/files/schema.graphql deleted file mode 100644 index f0248cc0f..000000000 --- a/indexers/taurus/files/schema.graphql +++ /dev/null @@ -1,67 +0,0 @@ -type Cid @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - indexInBlock: Int! @index - links: [String]! - timestamp: Date! @index -} - -type Chunk @entity { - id: ID! - type: String! @index - linkDepth: Int! @index - size: BigInt - name: String - data: String - uploadOptions: String -} - -type Metadata @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type MetadataCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type Folder @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type FolderCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type File @entity { - id: ID! - size: BigInt! @index - name: String @index -} - -type FileCid @entity { - id: ID! - parentCid: String! @index - childCid: String! @index -} - -type Error @entity { - id: ID! - blockHeight: BigInt! @index - blockHash: String! @index - extrinsicId: String! @index - extrinsicHash: String! @index - indexInBlock: Int! @index - error: String! - timestamp: Date! @index -} diff --git a/indexers/taurus/files/src/index.ts b/indexers/taurus/files/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/taurus/files/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/taurus/files/src/mappings/db.ts b/indexers/taurus/files/src/mappings/db.ts deleted file mode 100644 index 344c6f10b..000000000 --- a/indexers/taurus/files/src/mappings/db.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { - Chunk, - Cid, - Error, - File, - FileCid, - Folder, - FolderCid, - Metadata, - MetadataCid, -} from "../types"; - -export async function createAndSaveCid( - cid: string, - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - extrinsicHash: string, - indexInBlock: number, - links: string[], - timestamp: Date -): Promise { - const _cid = Cid.create({ - id: cid, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - links, - timestamp, - }); - await _cid.save(); - return _cid; -} - -export async function createAndSaveChunk( - cid: string, - type: string, - linkDepth: number, - size?: bigint, - name?: string, - data?: string, - uploadOptions?: string -): Promise { - const chunk = Chunk.create({ - id: cid, - type, - linkDepth, - size, - name, - data, - uploadOptions, - }); - await chunk.save(); - return chunk; -} - -const prepareRelation = (cid: string, link: string) => ({ - id: `${cid}:${link}`, - parentCid: cid, - childCid: link, -}); - -export async function createAndSaveMetadata( - cid: string, - links: string[], - name?: string -): Promise { - const metadata = Metadata.create({ - id: cid, - size: BigInt(0), - name, - }); - await metadata.save(); - if (links.length > 0) { - const relations = links.map((link) => - MetadataCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return metadata; -} - -export async function createAndSaveFolder( - cid: string, - links: string[], - name?: string -): Promise { - const folder = Folder.create({ - id: cid, - size: BigInt(0), - name, - }); - await folder.save(); - if (links.length > 0) { - const relations = links.map((link) => - FolderCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return folder; -} - -export async function createAndSaveFile( - cid: string, - links: string[], - name?: string -): Promise { - const file = File.create({ - id: cid, - size: BigInt(0), - name, - }); - await file.save(); - if (links.length > 0) { - const relations = links.map((link) => - FileCid.create(prepareRelation(cid, link)) - ); - await Promise.all(relations.map((relation) => relation.save())); - } - return file; -} - -export async function createAndSaveError( - blockHeight: bigint, - blockHash: string, - extrinsicId: string, - extrinsicHash: string, - indexInBlock: number, - error: string, - timestamp: Date -): Promise { - const _error = Error.create({ - id: extrinsicId, - blockHeight, - blockHash, - extrinsicId, - extrinsicHash, - indexInBlock, - error, - timestamp, - }); - await _error.save(); - return _error; -} diff --git a/indexers/taurus/files/src/mappings/mappingHandlers.ts b/indexers/taurus/files/src/mappings/mappingHandlers.ts deleted file mode 100644 index 17f13a9a8..000000000 --- a/indexers/taurus/files/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,139 +0,0 @@ -global.TextEncoder = require("util").TextEncoder; -global.TextDecoder = require("util").TextDecoder; -global.Buffer = require("buffer/").Buffer; - -import { - cidOfNode, - cidToString, - decodeNode, - IPLDNodeData, - MetadataType, - PBNode, -} from "@autonomys/auto-dag-data"; -import { stringify } from "@autonomys/auto-utils"; -import { Bytes } from "@polkadot/types"; -import { compactStripLength } from "@polkadot/util"; -import { SubstrateExtrinsic } from "@subql/types"; -import { - createAndSaveChunk, - createAndSaveCid, - createAndSaveError, - createAndSaveFile, - createAndSaveFolder, - createAndSaveMetadata, -} from "./db"; -import { ExtrinsicPrimitive } from "./types"; - -const hexToUint8Array = (hex: string): Uint8Array => { - if (hex.length % 2 !== 0) - throw new Error("Hex string must have an even length"); - return new Uint8Array( - hex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || [] - ); -}; - -export async function handleCall(_call: SubstrateExtrinsic): Promise { - const { - idx, - block: { - timestamp, - block: { - header: { number, hash: blockHash }, - }, - }, - extrinsic: { method, hash }, - success, - } = _call; - // Skip if extrinsic failed - if (!success) return; - - const methodToPrimitive = method.toPrimitive() as ExtrinsicPrimitive; - try { - const data = methodToPrimitive.args.remark; - const hexString = data.startsWith("0x") ? data.slice(2) : data; - const buffer = Buffer.from(hexString, "hex"); - const [length, bytes] = compactStripLength(buffer); - const isValidLength = length === bytes.length; - let node: PBNode | null = null; - - try { - const encoded = isValidLength - ? Bytes.from(buffer) - : hexToUint8Array(data); - node = decodeNode(encoded); - } catch (error) { - node = decodeNode(buffer); - } - const cid = cidToString(cidOfNode(node)); - const links = node.Links.map((l) => cidToString(l.Hash)); - if (cid) { - await createAndSaveCid( - cid, - BigInt(number.toString()), - blockHash.toString(), - `${number}-${idx}`, - hash.toString(), - idx, - links, - timestamp ? timestamp : new Date(0) - ); - - if (node.Data) { - const nodeData = IPLDNodeData.decode(node.Data); - let stringifyData = ""; - try { - const data = JSON.parse(stringify(nodeData.data)).data; - if (!data) throw new Error("Data is null"); - - const dataAsArrayBuffer = new Uint8Array(data); - stringifyData = stringify(dataAsArrayBuffer); - } catch { - stringifyData = stringify(nodeData.data); - } - await createAndSaveChunk( - cid, - nodeData.type, - nodeData.linkDepth, - nodeData.size, - nodeData.name, - stringifyData, - stringify(nodeData.uploadOptions) - ); - - switch (nodeData.type) { - case MetadataType.Metadata: - await createAndSaveMetadata(cid, links, nodeData.name); - break; - case MetadataType.Folder: - await createAndSaveFolder(cid, links, nodeData.name); - break; - case MetadataType.File: - await createAndSaveFile(cid, links, nodeData.name); - break; - // Skip inlinks and chunks as they are already saved in chunks table - case MetadataType.FileInlink: - case MetadataType.FileChunk: - case MetadataType.FolderInlink: - case MetadataType.MetadataInlink: - case MetadataType.MetadataChunk: - break; - default: - logger.warn(`Unknown node type: ${nodeData.type} for cid: ${cid}`); - break; - } - } - } - } catch (error: any) { - logger.error("Error decoding remark or seedHistory extrinsic"); - logger.error(error); - await createAndSaveError( - BigInt(number.toString()), - blockHash.toString(), - `${number}-${idx}`, - hash.toString(), - idx, - stringify(error), - timestamp ? timestamp : new Date(0) - ); - } -} diff --git a/indexers/taurus/files/src/mappings/types.ts b/indexers/taurus/files/src/mappings/types.ts deleted file mode 100644 index 85c656081..000000000 --- a/indexers/taurus/files/src/mappings/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type ExtrinsicPrimitive = { - callIndex: string; - args: any; -}; - -export type ExtrinsicHuman = ExtrinsicPrimitive & { - method: string; - section: string; -}; diff --git a/indexers/taurus/files/tsconfig.json b/indexers/taurus/files/tsconfig.json deleted file mode 100644 index 08ea779b9..000000000 --- a/indexers/taurus/files/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/taurus/leaderboard/.gitignore b/indexers/taurus/leaderboard/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/taurus/leaderboard/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/taurus/leaderboard/LICENSE b/indexers/taurus/leaderboard/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/taurus/leaderboard/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/taurus/leaderboard/README.md b/indexers/taurus/leaderboard/README.md deleted file mode 100644 index 19e680c4a..000000000 --- a/indexers/taurus/leaderboard/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Leaderboard - -The Autonomys Astral Explorer Leaderboard is a specialized SubQuery project that indexes all asset transfers and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the leaderboard functionality for the Astral Explorer, providing real-time data on user activities and rankings. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all asset transfers using the balances pallet -2. Capturing system remarks for additional user actions -3. Calculating and updating user scores based on various activities - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for transfers, accounts, and leaderboard entries. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of asset transfers -- Monitoring of system remarks for specific user actions -- Leaderboard score calculation and updates -- Support for querying transfer history and account statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/leaderboard` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/taurus/leaderboard/package.json b/indexers/taurus/leaderboard/package.json deleted file mode 100644 index aceac2853..000000000 --- a/indexers/taurus/leaderboard/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "taurus_leaderboard", - "version": "1.0.0", - "description": "Autonomys Taurus Testnet - Leaderboard", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/taurus/leaderboard/project.ts b/indexers/taurus/leaderboard/project.ts deleted file mode 100644 index b3f34b040..000000000 --- a/indexers/taurus/leaderboard/project.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-taurus-leaderboard", - description: "Autonomys Taurus Testnet - Leaderboard", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - dictionary: process.env.DICTIONARY_URL!, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Block, - handler: "handleBlock", - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/taurus/leaderboard/schema.graphql b/indexers/taurus/leaderboard/schema.graphql deleted file mode 100644 index 41789f17d..000000000 --- a/indexers/taurus/leaderboard/schema.graphql +++ /dev/null @@ -1,247 +0,0 @@ -# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by -# Add the `@index` or `@index(unique: true)` annotation after any non-key field -# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field - -# account -type AccountTransferSenderTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferSenderTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferReceiverTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransferReceiverTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountRemarkCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicSuccessTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountExtrinsicFailedTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type AccountTransactionFeePaidTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# farmer -type FarmerVoteTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerBlockTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerBlockTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteAndBlockTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type FarmerVoteAndBlockTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# operator -type OperatorTotalRewardsCollectedHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorTotalTaxCollectedHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorBundleTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorDepositsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorDepositsTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type OperatorWithdrawalsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -# nominator/account -type NominatorDepositsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type NominatorDepositsTotalValueHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} - -type NominatorWithdrawalsTotalCountHistory @entity { - id: ID! - accountId: String! @index - value: BigInt! @index - lastContributionAt: Date! - blockHeight: BigInt! @index - extrinsicId: String! - eventId: String! -} diff --git a/indexers/taurus/leaderboard/src/index.ts b/indexers/taurus/leaderboard/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/taurus/leaderboard/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/taurus/leaderboard/src/mappings/db.ts b/indexers/taurus/leaderboard/src/mappings/db.ts deleted file mode 100644 index 4b81d2e8c..000000000 --- a/indexers/taurus/leaderboard/src/mappings/db.ts +++ /dev/null @@ -1,612 +0,0 @@ -import { - AccountExtrinsicFailedTotalCountHistory, - AccountExtrinsicSuccessTotalCountHistory, - AccountExtrinsicTotalCountHistory, - AccountRemarkCountHistory, - AccountTransactionFeePaidTotalValueHistory, - AccountTransferReceiverTotalCountHistory, - AccountTransferReceiverTotalValueHistory, - AccountTransferSenderTotalCountHistory, - AccountTransferSenderTotalValueHistory, - FarmerBlockTotalCountHistory, - FarmerBlockTotalValueHistory, - FarmerVoteAndBlockTotalCountHistory, - FarmerVoteAndBlockTotalValueHistory, - FarmerVoteTotalCountHistory, - FarmerVoteTotalValueHistory, - NominatorDepositsTotalCountHistory, - NominatorDepositsTotalValueHistory, - NominatorWithdrawalsTotalCountHistory, - OperatorBundleTotalCountHistory, - OperatorDepositsTotalCountHistory, - OperatorDepositsTotalValueHistory, - OperatorTotalRewardsCollectedHistory, - OperatorTotalTaxCollectedHistory, - OperatorWithdrawalsTotalCountHistory, -} from "../types"; - -type Cache = { - accountExtrinsicFailedTotalCountHistory: AccountExtrinsicFailedTotalCountHistory[]; - accountExtrinsicSuccessTotalCountHistory: AccountExtrinsicSuccessTotalCountHistory[]; - accountExtrinsicTotalCountHistory: AccountExtrinsicTotalCountHistory[]; - accountRemarkCountHistory: AccountRemarkCountHistory[]; - accountTransactionFeePaidTotalValueHistory: AccountTransactionFeePaidTotalValueHistory[]; - accountTransferReceiverTotalCountHistory: AccountTransferReceiverTotalCountHistory[]; - accountTransferReceiverTotalValueHistory: AccountTransferReceiverTotalValueHistory[]; - accountTransferSenderTotalCountHistory: AccountTransferSenderTotalCountHistory[]; - accountTransferSenderTotalValueHistory: AccountTransferSenderTotalValueHistory[]; - farmerBlockTotalCountHistory: FarmerBlockTotalCountHistory[]; - farmerBlockTotalValueHistory: FarmerBlockTotalValueHistory[]; - farmerVoteAndBlockTotalCountHistory: FarmerVoteAndBlockTotalCountHistory[]; - farmerVoteAndBlockTotalValueHistory: FarmerVoteAndBlockTotalValueHistory[]; - farmerVoteTotalCountHistory: FarmerVoteTotalCountHistory[]; - farmerVoteTotalValueHistory: FarmerVoteTotalValueHistory[]; - nominatorDepositsTotalCountHistory: NominatorDepositsTotalCountHistory[]; - nominatorDepositsTotalValueHistory: NominatorDepositsTotalValueHistory[]; - nominatorWithdrawalsTotalCountHistory: NominatorWithdrawalsTotalCountHistory[]; - operatorBundleTotalCountHistory: OperatorBundleTotalCountHistory[]; - operatorDepositsTotalCountHistory: OperatorDepositsTotalCountHistory[]; - operatorDepositsTotalValueHistory: OperatorDepositsTotalValueHistory[]; - operatorTotalRewardsCollectedHistory: OperatorTotalRewardsCollectedHistory[]; - operatorTotalTaxCollectedHistory: OperatorTotalTaxCollectedHistory[]; - operatorWithdrawalsTotalCountHistory: OperatorWithdrawalsTotalCountHistory[]; -}; - -export const initializeCache = (): Cache => ({ - accountExtrinsicFailedTotalCountHistory: [], - accountExtrinsicSuccessTotalCountHistory: [], - accountExtrinsicTotalCountHistory: [], - accountRemarkCountHistory: [], - accountTransactionFeePaidTotalValueHistory: [], - accountTransferReceiverTotalCountHistory: [], - accountTransferReceiverTotalValueHistory: [], - accountTransferSenderTotalCountHistory: [], - accountTransferSenderTotalValueHistory: [], - farmerBlockTotalCountHistory: [], - farmerBlockTotalValueHistory: [], - farmerVoteAndBlockTotalCountHistory: [], - farmerVoteAndBlockTotalValueHistory: [], - farmerVoteTotalCountHistory: [], - farmerVoteTotalValueHistory: [], - nominatorDepositsTotalCountHistory: [], - nominatorDepositsTotalValueHistory: [], - nominatorWithdrawalsTotalCountHistory: [], - operatorBundleTotalCountHistory: [], - operatorDepositsTotalCountHistory: [], - operatorDepositsTotalValueHistory: [], - operatorTotalRewardsCollectedHistory: [], - operatorTotalTaxCollectedHistory: [], - operatorWithdrawalsTotalCountHistory: [], -}); - -export const saveCache = async (cache: Cache) => { - await Promise.all( - cache.accountTransferSenderTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferReceiverTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferSenderTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransferReceiverTotalValueHistory.map((item) => item.save()) - ); - await Promise.all(cache.accountRemarkCountHistory.map((item) => item.save())); - await Promise.all( - cache.accountExtrinsicTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountExtrinsicSuccessTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountExtrinsicFailedTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.accountTransactionFeePaidTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerBlockTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerBlockTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteAndBlockTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.farmerVoteAndBlockTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorDepositsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorDepositsTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.nominatorWithdrawalsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorBundleTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorDepositsTotalCountHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorDepositsTotalValueHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorTotalRewardsCollectedHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorTotalTaxCollectedHistory.map((item) => item.save()) - ); - await Promise.all( - cache.operatorWithdrawalsTotalCountHistory.map((item) => item.save()) - ); -}; - -export function createAccountTransferSenderTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferSenderTotalCountHistory { - return AccountTransferSenderTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferSenderTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferSenderTotalValueHistory { - return AccountTransferSenderTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferReceiverTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferReceiverTotalCountHistory { - return AccountTransferReceiverTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransferReceiverTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransferReceiverTotalValueHistory { - return AccountTransferReceiverTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountRemarkCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountRemarkCountHistory { - return AccountRemarkCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicTotalCountHistory { - return AccountExtrinsicTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicSuccessTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicSuccessTotalCountHistory { - return AccountExtrinsicSuccessTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountExtrinsicFailedTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountExtrinsicFailedTotalCountHistory { - return AccountExtrinsicFailedTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createAccountTransactionFeePaidTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): AccountTransactionFeePaidTotalValueHistory { - return AccountTransactionFeePaidTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Farmer entities -export function createFarmerVoteTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteTotalCountHistory { - return FarmerVoteTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteTotalValueHistory { - return FarmerVoteTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerBlockTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerBlockTotalCountHistory { - return FarmerBlockTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerBlockTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerBlockTotalValueHistory { - return FarmerBlockTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteAndBlockTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteAndBlockTotalCountHistory { - return FarmerVoteAndBlockTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createFarmerVoteAndBlockTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): FarmerVoteAndBlockTotalValueHistory { - return FarmerVoteAndBlockTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Operator entities -export function createOperatorTotalRewardsCollected( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorTotalRewardsCollectedHistory { - return OperatorTotalRewardsCollectedHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorTotalTaxCollected( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorTotalTaxCollectedHistory { - return OperatorTotalTaxCollectedHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorBundleTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorBundleTotalCountHistory { - return OperatorBundleTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorDepositsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorDepositsTotalCountHistory { - return OperatorDepositsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorDepositsTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorDepositsTotalValueHistory { - return OperatorDepositsTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createOperatorWithdrawalsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): OperatorWithdrawalsTotalCountHistory { - return OperatorWithdrawalsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -// Nominator entities -export function createNominatorDepositsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorDepositsTotalCountHistory { - return NominatorDepositsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createNominatorDepositsTotalValue( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorDepositsTotalValueHistory { - return NominatorDepositsTotalValueHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} - -export function createNominatorWithdrawalsTotalCount( - accountId: string, - value: bigint, - blockHeight: bigint, - extrinsicId: string, - eventId: string, - lastContributionAt: Date = new Date() -): NominatorWithdrawalsTotalCountHistory { - return NominatorWithdrawalsTotalCountHistory.create({ - id: `${accountId}-${extrinsicId}-${eventId}`, - accountId, - value, - lastContributionAt, - blockHeight, - extrinsicId, - eventId, - }); -} diff --git a/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts b/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts deleted file mode 100644 index 14d9b6f65..000000000 --- a/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,423 +0,0 @@ -import { SubstrateBlock } from "@subql/types"; -import * as db from "./db"; - -export async function handleBlock(_block: SubstrateBlock): Promise { - const { - block: { - header: { number }, - extrinsics, - }, - timestamp, - events, - } = _block; - const height = BigInt(number.toString()); - - let cache = db.initializeCache(); - let eventIndex = 0; - - // Process extrinsics - extrinsics.forEach((extrinsic, extrinsicIdx) => { - const extrinsicEvents = events.filter( - (e) => - e.phase.isApplyExtrinsic && - e.phase.asApplyExtrinsic.toNumber() === extrinsicIdx - ); - const successEvent = events.find( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const successEventId = events.findIndex( - (e) => - e.event.section === "system" && e.event.method === "ExtrinsicSuccess" - ); - const extrinsicId = extrinsic ? height + "-" + extrinsicIdx.toString() : ""; - const extrinsicSigner = extrinsic.signer.toString(); - - cache.accountExtrinsicTotalCountHistory.push( - db.createAccountExtrinsicTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - if (successEvent) { - cache.accountExtrinsicSuccessTotalCountHistory.push( - db.createAccountExtrinsicSuccessTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - - // Process specific extrinsic - switch (`${extrinsic.method.section}.${extrinsic.method.method}`) { - case "system.remark": - case "system.remarkWithEvent": { - cache.accountRemarkCountHistory.push( - db.createAccountRemarkCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - "", - timestamp - ) - ); - break; - } - } - - // Process extrinsic events - extrinsicEvents.forEach((event, eventIdx) => { - const eventId = height + "-" + eventIndex; - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "balances.Transfer": { - const from = event.event.data[0].toString(); - const to = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - cache.accountTransferSenderTotalCountHistory.push( - db.createAccountTransferSenderTotalCount( - from, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.accountTransferSenderTotalValueHistory.push( - db.createAccountTransferSenderTotalValue( - from, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.accountTransferReceiverTotalCountHistory.push( - db.createAccountTransferReceiverTotalCount( - to, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.accountTransferReceiverTotalValueHistory.push( - db.createAccountTransferReceiverTotalValue( - to, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "transactionPayment.TransactionFeePaid": { - const who = event.event.data[0].toString(); - const actualFee = BigInt(event.event.data[1].toString()); - const tip = BigInt(event.event.data[2].toString()); - - cache.accountTransactionFeePaidTotalValueHistory.push( - db.createAccountTransactionFeePaidTotalValue( - who, - actualFee + tip, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorRewarded": { - const operatorId = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - if (reward === BigInt(0)) break; - - cache.operatorTotalRewardsCollectedHistory.push( - db.createOperatorTotalRewardsCollected( - operatorId, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorTaxCollected": { - const operatorId = event.event.data[0].toString(); - const tax = BigInt(event.event.data[1].toString()); - - cache.operatorTotalTaxCollectedHistory.push( - db.createOperatorTotalTaxCollected( - operatorId, - tax, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - break; - } - case "domains.BundleStored": { - const bundleAuthor = event.event.data[0].toString(); - - cache.operatorBundleTotalCountHistory.push( - db.createOperatorBundleTotalCount( - bundleAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorRegistered": { - const operatorId = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.operatorTotalRewardsCollectedHistory.push( - db.createOperatorTotalRewardsCollected( - operatorId, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.OperatorNominated": { - const operatorId = event.event.data[0].toString(); - const nominatorId = event.event.data[1].toString(); - const amount = BigInt(event.event.data[2].toString()); - - cache.operatorDepositsTotalCountHistory.push( - db.createOperatorDepositsTotalCount( - operatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.operatorDepositsTotalValueHistory.push( - db.createOperatorDepositsTotalValue( - operatorId, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.nominatorDepositsTotalCountHistory.push( - db.createNominatorDepositsTotalCount( - nominatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.nominatorDepositsTotalValueHistory.push( - db.createNominatorDepositsTotalValue( - nominatorId, - amount, - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - case "domains.WithdrewStake": { - const operatorId = event.event.data[0].toString(); - const nominatorId = event.event.data[1].toString(); - - cache.operatorWithdrawalsTotalCountHistory.push( - db.createOperatorWithdrawalsTotalCount( - operatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.nominatorWithdrawalsTotalCountHistory.push( - db.createNominatorWithdrawalsTotalCount( - nominatorId, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - } else { - // Process fail extrinsic - cache.accountExtrinsicFailedTotalCountHistory.push( - db.createAccountExtrinsicFailedTotalCount( - extrinsicSigner, - BigInt(1), - height, - extrinsicId, - height + "-" + successEventId.toString(), - timestamp - ) - ); - } - }); - - const finalizationEvents = events.filter((e) => e.phase.isFinalization); - - // Process finalization events - finalizationEvents.forEach((event) => { - const extrinsicId = height + "-" + event.phase.type; // AKA (blockHeight-Finalization) - const eventId = height + "-" + eventIndex; - - // Process specific events - switch (`${event.event.section}.${event.event.method}`) { - case "rewards.VoteReward": { - const voter = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.farmerVoteTotalCountHistory.push( - db.createFarmerVoteTotalCount( - voter, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteTotalValueHistory.push( - db.createFarmerVoteTotalValue( - voter, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.farmerVoteAndBlockTotalCountHistory.push( - db.createFarmerVoteAndBlockTotalCount( - voter, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteAndBlockTotalValueHistory.push( - db.createFarmerVoteAndBlockTotalValue( - voter, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - break; - } - case "rewards.BlockReward": { - const blockAuthor = event.event.data[0].toString(); - const reward = BigInt(event.event.data[1].toString()); - - cache.farmerBlockTotalCountHistory.push( - db.createFarmerBlockTotalCount( - blockAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerBlockTotalValueHistory.push( - db.createFarmerBlockTotalValue( - blockAuthor, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - cache.farmerVoteAndBlockTotalCountHistory.push( - db.createFarmerVoteAndBlockTotalCount( - blockAuthor, - BigInt(1), - height, - extrinsicId, - eventId, - timestamp - ) - ); - cache.farmerVoteAndBlockTotalValueHistory.push( - db.createFarmerVoteAndBlockTotalValue( - blockAuthor, - reward, - height, - extrinsicId, - eventId, - timestamp - ) - ); - - break; - } - default: - break; - } - - // Increment event index - eventIndex++; - }); - - // Save cache - await db.saveCache(cache); -} diff --git a/indexers/taurus/leaderboard/tsconfig.json b/indexers/taurus/leaderboard/tsconfig.json deleted file mode 100644 index b827eae7e..000000000 --- a/indexers/taurus/leaderboard/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/taurus/staking/.gitignore b/indexers/taurus/staking/.gitignore deleted file mode 100644 index 36045d79b..000000000 --- a/indexers/taurus/staking/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# lock files -yarn.lock -package-lock.json - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Generated files -target/ -dist/ -src/types -project.yaml - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -.data -.eslintcache - -# ENV local files -.env.local -.env.develop.local \ No newline at end of file diff --git a/indexers/taurus/staking/LICENSE b/indexers/taurus/staking/LICENSE deleted file mode 100644 index f168fbe14..000000000 --- a/indexers/taurus/staking/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT LICENSE - -Copyright 2020-2024 SubQuery Pte Ltd authors & contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/indexers/taurus/staking/README.md b/indexers/taurus/staking/README.md deleted file mode 100644 index d461450b4..000000000 --- a/indexers/taurus/staking/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Autonomys Astral Explorer Staking - -The Autonomys Astral Explorer Staking is a specialized SubQuery project that indexes all staking-related events and system remarks on the Autonomys Gemini 3H Testnet. This project is designed to support the staking functionality for the Astral Explorer, providing real-time data on user staking activities and rewards. - -## Overview - -This SubQuery project is tailored specifically for the Autonomys Astral Explorer, focusing on: - -1. Indexing all staking events using the staking pallet -2. Capturing system remarks for additional staking actions -3. Calculating and updating user staking rewards and positions - -## Project Structure - -The project consists of the following key components: - -- `project.ts`: Defines the project configuration, including network endpoints and data sources. -- `schema.graphql`: Outlines the data structure for staking events, accounts, and reward entries. -- `src/mappings/`: Contains TypeScript functions that process blockchain events and update the database. - -## Key Features - -- Real-time tracking of staking events -- Monitoring of system remarks for specific staking actions -- Staking reward calculation and updates -- Support for querying staking history and account statistics - -## Running the Project - -To run this project locally: - -1. Ensure you have Node.js and Docker installed on your system. -2. Clone the repository: `git clone https://github.com/autonomys/astral.git` -3. Navigate to the project directory: `cd astral/indexers/staking` -4. Install dependencies: `yarn install` -5. Start the project: `yarn dev` - -This will start the SubQuery node, PostgreSQL database, and GraphQL query service. - -## Querying the Data - -Once the project is running, you can access the GraphQL playground at `http://localhost:3000`. Here's an example query to get you started: diff --git a/indexers/taurus/staking/package.json b/indexers/taurus/staking/package.json deleted file mode 100644 index 888b0b4c5..000000000 --- a/indexers/taurus/staking/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "taurus_staking", - "version": "1.0.0", - "description": "Autonomys Taurus Testnet - Staking", - "main": "dist/index.js", - "scripts": { - "build": "subql codegen && subql build", - "codegen": "subql codegen", - "start:docker": "docker-compose pull && docker-compose up --remove-orphans", - "dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans", - "prepack": "rm -rf dist && npm run build", - "test": "subql build && subql-node test", - "build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build" - }, - "homepage": "https://github.com/autonomys/astral", - "files": [ - "dist", - "schema.graphql", - "project.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/autonomys/astral" - }, - "author": { - "name": "Autonomys", - "url": "https://www.autonomys.xyz" - }, - "bugs": { - "url": "https://github.com/autonomys/astral/issues" - }, - "license": "MIT", - "devDependencies": { - "@apollo/client": "^3.7.16", - "@polkadot/api": "^12.4.2", - "@polkadot/types": "^14.1.1", - "@polkadot/util": "^13.2.2", - "@polkadot/util-crypto": "^13.2.2", - "@subql/cli": "^5.4.0", - "@subql/common-substrate": "^4.3.5", - "@subql/node": "^5.6.0", - "@subql/types": "^3.11.4", - "@types/node": "^22.9.0", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv": "^16.4.5", - "graphql": "^16.9.0", - "prom-client": "^14.2.0", - "rxjs": "^7.8.1", - "typescript": "^5.2.2" - }, - "resolutions": { - "ipfs-unixfs": "6.0.6" - } -} diff --git a/indexers/taurus/staking/project.ts b/indexers/taurus/staking/project.ts deleted file mode 100644 index 7269f0201..000000000 --- a/indexers/taurus/staking/project.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { - SubstrateDatasourceKind, - SubstrateHandlerKind, - SubstrateProject, -} from "@subql/types"; -import * as dotenv from "dotenv"; -import path from "path"; - -// Load the appropriate .env file -const dotenvPath = path.resolve(__dirname, `../../../.env`); -dotenv.config({ path: dotenvPath }); - -// Can expand the Datasource processor types via the genreic param -const project: SubstrateProject = { - specVersion: "1.0.0", - version: "0.0.1", - name: "autonomys-taurus-staking", - description: "Autonomys Taurus Testnet - Staking", - runner: { - node: { - name: "@subql/node", - version: ">=5.2.9", - }, - query: { - name: "@subql/query", - version: "*", - }, - }, - schema: { - file: "./schema.graphql", - }, - network: { - /* The genesis hash of the network (hash of block 0) */ - chainId: process.env.CHAIN_ID!, - /** - * These endpoint(s) should be public non-pruned archive node - * We recommend providing more than one endpoint for improved reliability, performance, and uptime - * Public nodes may be rate limited, which can affect indexing speed - * When developing your project we suggest getting a private API key - * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters - * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited - */ - endpoint: process.env.RPC_URLS!?.split(",") as string[] | string, - dictionary: process.env.DICTIONARY_URL!, - }, - dataSources: [ - { - kind: SubstrateDatasourceKind.Runtime, - startBlock: 1, - // startBlock: 310356, // DomainInstantiated - // startBlock: 316224, // RegisterOperator - // startBlock: 346630, // domains.DomainEpochCompleted - mapping: { - file: "./dist/index.js", - handlers: [ - { - kind: SubstrateHandlerKind.Event, - handler: "handleDomainInstantiatedEvent", - filter: { - module: "domains", - method: "DomainInstantiated", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleRegisterOperatorCall", - filter: { - module: "domains", - method: "registerOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleNominateOperatorCall", - filter: { - module: "domains", - method: "NominateOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleDeregisterOperatorCall", - filter: { - module: "domains", - method: "DeregisterOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleWithdrawStakeCall", - filter: { - module: "domains", - method: "WithdrawStake", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockFundsCall", - filter: { - module: "domains", - method: "UnlockFunds", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockOperatorCall", - filter: { - module: "domains", - method: "UnlockOperator", - }, - }, - { - kind: SubstrateHandlerKind.Call, - handler: "handleUnlockNominatorCall", - filter: { - module: "domains", - method: "UnlockNominator", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleDomainEpochCompletedEvent", - filter: { - module: "domains", - method: "DomainEpochCompleted", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleForceDomainEpochTransitionEvent", - filter: { - module: "domains", - method: "ForceDomainEpochTransition", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorRegisteredEvent", - filter: { - module: "domains", - method: "OperatorRegistered", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorDeregisteredEvent", - filter: { - module: "domains", - method: "OperatorDeregistered", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorNominatedEvent", - filter: { - module: "domains", - method: "OperatorNominated", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleWithdrewStakeEvent", - filter: { - module: "domains", - method: "WithdrewStake", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleStorageFeeDepositedEvent", - filter: { - module: "domains", - method: "StorageFeeDeposited", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleBundleStoredEvent", - filter: { - module: "domains", - method: "BundleStored", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorUnlockedEvent", - filter: { - module: "domains", - method: "OperatorUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleFundsUnlockedEvent", - filter: { - module: "domains", - method: "FundsUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleNominatedStakedUnlockedEvent", - filter: { - module: "domains", - method: "NominatedStakedUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleNominatorUnlockedEvent", - filter: { - module: "domains", - method: "NominatorUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleStorageFeeUnlockedEvent", - filter: { - module: "domains", - method: "StorageFeeUnlocked", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorRewardedEvent", - filter: { - module: "domains", - method: "OperatorRewarded", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorSlashedEvent", - filter: { - module: "domains", - method: "OperatorSlashed", - }, - }, - { - kind: SubstrateHandlerKind.Event, - handler: "handleOperatorTaxCollectedEvent", - filter: { - module: "domains", - method: "OperatorTaxCollected", - }, - }, - ], - }, - }, - ], -}; - -// Must set default to the project instance -export default project; diff --git a/indexers/taurus/staking/schema.graphql b/indexers/taurus/staking/schema.graphql deleted file mode 100644 index 869923cbe..000000000 --- a/indexers/taurus/staking/schema.graphql +++ /dev/null @@ -1,387 +0,0 @@ -# To improve query performance, we strongly suggest adding indexes to any field that you plan to filter or sort by -# Add the `@index` or `@index(unique: true)` annotation after any non-key field -# https://academy.subquery.network/build/graphql.html#indexing-by-non-primary-key-field - -type Domain @entity { - id: ID! - sortId: BigInt! @index - accountId: String! @index - name: String! @index - runtimeId: Int! @index - runtime: String! - runtimeInfo: String! - completedEpoch: BigInt! @index - lastDomainBlockNumber: BigInt! @index - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - totalConsensusStorageFee: BigInt! - totalDomainExecutionFee: BigInt! - totalBurnedBalance: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochRewards: BigInt! - accumulatedEpochShares: BigInt! - bundleCount: BigInt! - currentEpochDuration: BigInt! - lastEpochDuration: BigInt! - last6EpochsDuration: BigInt! - last144EpochDuration: BigInt! - last1kEpochDuration: BigInt! - lastBundleAt: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Account @entity { - id: ID! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochShares: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Operator @entity { - id: ID! - sortId: BigInt! @index - accountId: String! @index - domainId: String! @index - signingKey: String! @index - minimumNominatorStake: BigInt! - nominationTax: Int! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentEpochRewards: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - rawStatus: String! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - totalConsensusStorageFee: BigInt! - totalDomainExecutionFee: BigInt! - totalBurnedBalance: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochRewards: BigInt! - accumulatedEpochShares: BigInt! - activeEpochCount: BigInt! - bundleCount: BigInt! - status: String! - pendingAction: String! - lastBundleAt: BigInt! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type OperatorProfile @entity { - id: ID! - operatorId: String! @index - accountId: String! @index - name: String! @index - description: String! - icon: String! - banner: String! - website: String! - websiteVerified: Boolean! - email: String! - emailVerified: Boolean! - discord: String! - github: String! - twitter: String! - proofMessage: String! - proofSignature: String! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type DomainBlock @entity { - id: ID! - domainId: String! @index - domainEpochId: String! @index - blockNumber: BigInt! @index - blockHash: String! @index - extrinsicRoot: String! - epoch: BigInt! @index - consensusBlockNumber: BigInt! @index - consensusBlockHash: String! @index - timestamp: Date! @index - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type DomainEpoch @entity { - id: ID! - epoch: BigInt! @index - domainId: String! @index - blockNumberStart: BigInt! @index - blockNumberEnd: BigInt! @index - blockCount: BigInt! - timestampStart: Date! @index - timestampEnd: Date! @index - epochDuration: BigInt! - consensusBlockNumberStart: BigInt! - consensusBlockNumberEnd: BigInt! - consensusBlockHashStart: String! - consensusBlockHashEnd: String! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Bundle @entity { - id: ID! - domainId: String! @index - domainBlockId: String! @index - domainEpochId: String! @index - domainBlockNumber: BigInt! @index - domainBlockHash: String! - domainBlockExtrinsicRoot: String! - epoch: BigInt! @index - consensusBlockNumber: BigInt! @index - consensusBlockHash: String! @index - totalTransfersIn: BigInt! - transfersInCount: BigInt! - totalTransfersOut: BigInt! - transfersOutCount: BigInt! - totalRejectedTransfersClaimed: BigInt! - rejectedTransfersClaimedCount: BigInt! - totalTransfersRejected: BigInt! - transfersRejectedCount: BigInt! - totalVolume: BigInt! @index - consensusStorageFee: BigInt! - domainExecutionFee: BigInt! - burnedBalance: BigInt! -} - -type BundleAuthor @entity { - id: ID! - domainId: String! @index - accountId: String! @index - operatorId: String! @index - bundleId: String! @index - domainBlockId: String! @index - domainEpochId: String! @index - epoch: BigInt! @index -} - -type Nominator @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - knownShares: BigInt! - knownStorageFeeDeposit: BigInt! - pendingAmount: BigInt! - pendingStorageFeeDeposit: BigInt! - pendingEffectiveDomainEpoch: BigInt! - totalWithdrawalAmounts: BigInt! - totalStorageFeeRefund: BigInt! - unlockAtConfirmedDomainBlockNumber: [Int!]! - pendingShares: BigInt! - pendingStorageFeeRefund: BigInt! - totalDeposits: BigInt! - totalEstimatedWithdrawals: BigInt! - totalWithdrawals: BigInt! - totalDepositsCount: BigInt! - totalWithdrawalsCount: BigInt! - currentTotalStake: BigInt! - currentStorageFeeDeposit: BigInt! - currentTotalShares: BigInt! - currentSharePrice: BigInt! - accumulatedEpochStake: BigInt! - accumulatedEpochStorageFeeDeposit: BigInt! - accumulatedEpochShares: BigInt! - activeEpochCount: BigInt! - status: String! # NominatorStatus! - pendingAction: String! # NominatorPendingAction! - createdAt: BigInt! @index - updatedAt: BigInt! @index -} - -type Deposit @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - amount: BigInt! - storageFeeDeposit: BigInt! - totalAmount: BigInt! - totalWithdrawn: BigInt! - status: String! - timestamp: Date! - extrinsicHash: String! - epochDepositedAt: BigInt! - domainBlockNumberDepositedAt: BigInt! - createdAt: BigInt! @index - stakedAt: BigInt! - updatedAt: BigInt! @index -} - -type Withdrawal @entity { - id: ID! - accountId: String! @index - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - shares: BigInt! - estimatedAmount: BigInt! - unlockedAmount: BigInt! - unlockedStorageFee: BigInt! - totalAmount: BigInt! - status: String! - timestamp: Date! - withdrawExtrinsicHash: String! - unlockExtrinsicHash: String! - epochWithdrawalRequestedAt: BigInt! - domainBlockNumberWithdrawalRequestedAt: BigInt! - createdAt: BigInt! @index - readyAt: BigInt! - unlockedAt: BigInt! - updatedAt: BigInt! -} - -type Reward @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - amount: BigInt! - timestamp: Date! @index - blockNumber: BigInt! @index - extrinsicHash: String! @index -} - -type Stats @entity { - id: ID! - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - domainsCount: BigInt! - operatorsCount: BigInt! - activeOperatorsCount: BigInt! - slashedOperatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerDomain @entity { - id: ID! - domainId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - operatorsCount: BigInt! - activeOperatorsCount: BigInt! - slashedOperatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerOperator @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalTaxCollected: BigInt! - totalRewardsCollected: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerNominator @entity { - id: ID! - domainId: String! @index - operatorId: String! @index - nominatorId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} - -type StatsPerAccount @entity { - id: ID! - accountId: String! @index - blockNumber: BigInt! @index - totalStaked: BigInt! - totalDeposits: BigInt! - totalWithdrawals: BigInt! - totalShares: BigInt! - currentSharePrice: BigInt! - allTimeHighStaked: BigInt! - allTimeHighSharePrice: BigInt! - operatorsCount: BigInt! - nominatorsCount: BigInt! - depositsCount: BigInt! - withdrawalsCount: BigInt! - timestamp: Date! @index -} diff --git a/indexers/taurus/staking/src/index.ts b/indexers/taurus/staking/src/index.ts deleted file mode 100644 index 509161575..000000000 --- a/indexers/taurus/staking/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -//Exports all handler functions -export * from "./mappings/mappingHandlers"; -import "@polkadot/api-augment"; diff --git a/indexers/taurus/staking/src/mappings/constants.ts b/indexers/taurus/staking/src/mappings/constants.ts deleted file mode 100644 index 2931d8c74..000000000 --- a/indexers/taurus/staking/src/mappings/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const SHARES_CALCULATION_MULTIPLIER = BigInt(1000000000000); diff --git a/indexers/taurus/staking/src/mappings/db.ts b/indexers/taurus/staking/src/mappings/db.ts deleted file mode 100644 index 69a2af4b7..000000000 --- a/indexers/taurus/staking/src/mappings/db.ts +++ /dev/null @@ -1,566 +0,0 @@ -import { - Account, - Bundle, - BundleAuthor, - Deposit, - Domain, - DomainBlock, - DomainEpoch, - Nominator, - Operator, - Reward, - Stats, - StatsPerAccount, - StatsPerDomain, - StatsPerNominator, - StatsPerOperator, - Withdrawal, -} from "../types"; -import { - DepositStatus, - DomainRuntime, - NominatorPendingAction, - NominatorStatus, - OperatorPendingAction, - OperatorStatus, - WithdrawalStatus, -} from "./models"; - -// Helper for Domain -export async function checkAndGetDomain( - domainId: string, - blockNumber: bigint -): Promise { - const id = domainId.toLowerCase(); - let domain = await Domain.get(id); - if (!domain) { - domain = Domain.create({ - id, - sortId: BigInt(id), - accountId: "", - name: "", - runtimeId: 0, - runtime: DomainRuntime.EVM, - runtimeInfo: "", - completedEpoch: BigInt(0), - lastDomainBlockNumber: BigInt(0), - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - totalConsensusStorageFee: BigInt(0), - totalDomainExecutionFee: BigInt(0), - totalBurnedBalance: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochRewards: BigInt(0), - accumulatedEpochShares: BigInt(0), - bundleCount: BigInt(0), - currentEpochDuration: BigInt(0), - lastEpochDuration: BigInt(0), - last6EpochsDuration: BigInt(0), - last144EpochDuration: BigInt(0), - last1kEpochDuration: BigInt(0), - lastBundleAt: BigInt(0), - createdAt: blockNumber, - updatedAt: blockNumber, - }); - } - return domain; -} - -// Helper for Account -export async function checkAndGetAccount( - id: string, - blockNumber: number -): Promise { - let account = await Account.get(id); - if (!account) { - account = Account.create({ - id, - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochShares: BigInt(0), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return account; -} - -// Helper for Operator -export async function checkAndGetOperator( - operatorId: string, - blockNumber: number -): Promise { - const id = operatorId.toLowerCase(); - let operator = await Operator.get(id); - if (!operator) { - operator = Operator.create({ - id, - sortId: BigInt(id), - accountId: "", - domainId: "", - signingKey: "", - minimumNominatorStake: BigInt(0), - nominationTax: 0, - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentEpochRewards: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - rawStatus: "", - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - totalConsensusStorageFee: BigInt(0), - totalDomainExecutionFee: BigInt(0), - totalBurnedBalance: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochRewards: BigInt(0), - accumulatedEpochShares: BigInt(0), - activeEpochCount: BigInt(0), - bundleCount: BigInt(0), - status: OperatorStatus.PENDING, - pendingAction: OperatorPendingAction.NO_ACTION_REQUIRED, - lastBundleAt: BigInt(0), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return operator; -} - -// Helper for DomainBlock -export async function checkAndGetDomainBlock( - id: string, - blockNumber: number -): Promise { - let domainBlock = await DomainBlock.get(id.toLowerCase()); - if (!domainBlock) { - domainBlock = DomainBlock.create({ - id: id.toLowerCase(), - domainId: "", - domainEpochId: "", - blockNumber: BigInt(0), - blockHash: "", - extrinsicRoot: "", - epoch: BigInt(0), - consensusBlockNumber: BigInt(0), - consensusBlockHash: "", - timestamp: new Date(), - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return domainBlock; -} - -// Helper for DomainEpoch -export async function checkAndGetDomainEpoch( - id: string, - blockNumber: number -): Promise { - let domainEpoch = await DomainEpoch.get(id.toLowerCase()); - if (!domainEpoch) { - domainEpoch = DomainEpoch.create({ - id: id.toLowerCase(), - epoch: BigInt(0), - domainId: "", - blockNumberStart: BigInt(0), - blockNumberEnd: BigInt(0), - blockCount: BigInt(0), - timestampStart: new Date(), - timestampEnd: new Date(), - epochDuration: BigInt(0), - consensusBlockNumberStart: BigInt(0), - consensusBlockNumberEnd: BigInt(0), - consensusBlockHashStart: "", - consensusBlockHashEnd: "", - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return domainEpoch; -} - -// Helper for Bundle -export async function checkAndGetBundle( - id: string, - blockNumber: number -): Promise { - let bundle = await Bundle.get(id.toLowerCase()); - if (!bundle) { - bundle = Bundle.create({ - id: id.toLowerCase(), - domainId: "", - domainBlockId: "", - domainEpochId: "", - domainBlockNumber: BigInt(0), - domainBlockHash: "", - domainBlockExtrinsicRoot: "", - epoch: BigInt(0), - consensusBlockNumber: BigInt(0), - consensusBlockHash: "", - totalTransfersIn: BigInt(0), - transfersInCount: BigInt(0), - totalTransfersOut: BigInt(0), - transfersOutCount: BigInt(0), - totalRejectedTransfersClaimed: BigInt(0), - rejectedTransfersClaimedCount: BigInt(0), - totalTransfersRejected: BigInt(0), - transfersRejectedCount: BigInt(0), - totalVolume: BigInt(0), - consensusStorageFee: BigInt(0), - domainExecutionFee: BigInt(0), - burnedBalance: BigInt(0), - }); - } - return bundle; -} - -// Helper for BundleAuthor -export async function checkAndGetBundleAuthor( - id: string, - blockNumber: number -): Promise { - let bundleAuthor = await BundleAuthor.get(id.toLowerCase()); - if (!bundleAuthor) { - bundleAuthor = BundleAuthor.create({ - id: id.toLowerCase(), - domainId: "", - accountId: "", - operatorId: "", - bundleId: "", - domainBlockId: "", - domainEpochId: "", - epoch: BigInt(0), - }); - } - return bundleAuthor; -} - -// Helper for Nominator -export async function checkAndGetNominator( - accountId: string, - domainId: string, - operatorId: string, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}`.toLowerCase(); - let nominator = await Nominator.get(id); - if (!nominator) { - nominator = Nominator.create({ - id, - accountId, - domainId, - operatorId, - knownShares: BigInt(0), - knownStorageFeeDeposit: BigInt(0), - pendingAmount: BigInt(0), - pendingStorageFeeDeposit: BigInt(0), - pendingEffectiveDomainEpoch: BigInt(0), - totalWithdrawalAmounts: BigInt(0), - totalStorageFeeRefund: BigInt(0), - unlockAtConfirmedDomainBlockNumber: [], - pendingShares: BigInt(0), - pendingStorageFeeRefund: BigInt(0), - totalDeposits: BigInt(0), - totalEstimatedWithdrawals: BigInt(0), - totalWithdrawals: BigInt(0), - totalDepositsCount: BigInt(0), - totalWithdrawalsCount: BigInt(0), - currentTotalStake: BigInt(0), - currentStorageFeeDeposit: BigInt(0), - currentTotalShares: BigInt(0), - currentSharePrice: BigInt(0), - accumulatedEpochStake: BigInt(0), - accumulatedEpochStorageFeeDeposit: BigInt(0), - accumulatedEpochShares: BigInt(0), - activeEpochCount: BigInt(0), - status: NominatorStatus.PENDING, - pendingAction: NominatorPendingAction.NO_ACTION_REQUIRED, - createdAt: BigInt(blockNumber), - updatedAt: BigInt(blockNumber), - }); - } - return nominator; -} - -// Helper for Deposit -export async function checkAndGetDeposit( - accountId: string, - domainId: string, - operatorId: string, - amount: bigint, - storageFeeDeposit: bigint, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); - const nominatorId = `${operatorId}-${accountId}`.toLowerCase(); - const totalAmount = amount + storageFeeDeposit; - let deposit = await Deposit.get(id); - if (!deposit) { - deposit = Deposit.create({ - id, - accountId, - domainId, - operatorId, - nominatorId, - amount, - storageFeeDeposit, - totalAmount, - totalWithdrawn: BigInt(0), - status: DepositStatus.PENDING, - timestamp: new Date(), - extrinsicHash: "", - epochDepositedAt: BigInt(0), - domainBlockNumberDepositedAt: BigInt(0), - createdAt: BigInt(blockNumber), - stakedAt: BigInt(0), - updatedAt: BigInt(blockNumber), - }); - } - return deposit; -} - -// Helper for Withdrawal -export async function checkAndGetWithdrawal( - accountId: string, - domainId: string, - operatorId: string, - nominatorId: string, - blockNumber: number -): Promise { - const id = `${operatorId}-${accountId}-${blockNumber}`.toLowerCase(); - let withdrawal = await Withdrawal.get(id); - if (!withdrawal) { - withdrawal = Withdrawal.create({ - id, - accountId, - domainId, - operatorId, - nominatorId, - shares: BigInt(0), - estimatedAmount: BigInt(0), - unlockedAmount: BigInt(0), - unlockedStorageFee: BigInt(0), - totalAmount: BigInt(0), - status: WithdrawalStatus.PENDING_LOCK, - timestamp: new Date(), - withdrawExtrinsicHash: "", - unlockExtrinsicHash: "", - epochWithdrawalRequestedAt: BigInt(0), - domainBlockNumberWithdrawalRequestedAt: BigInt(0), - createdAt: BigInt(blockNumber), - readyAt: BigInt(0), - unlockedAt: BigInt(0), - updatedAt: BigInt(blockNumber), - }); - } - return withdrawal; -} - -// Helper for Reward -export async function checkAndGetReward( - id: string, - blockNumber: number -): Promise { - let reward = await Reward.get(id.toLowerCase()); - if (!reward) { - reward = Reward.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - amount: BigInt(0), - timestamp: new Date(), - blockNumber: BigInt(0), - extrinsicHash: "", - }); - } - return reward; -} - -// Helper for Stats -export async function checkAndGetStats( - id: string, - blockNumber: number -): Promise { - let stats = await Stats.get(id.toLowerCase()); - if (!stats) { - stats = Stats.create({ - id: id.toLowerCase(), - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - domainsCount: BigInt(0), - operatorsCount: BigInt(0), - activeOperatorsCount: BigInt(0), - slashedOperatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return stats; -} - -// Helper for StatsPerDomain -export async function checkAndGetStatsPerDomain( - id: string, - blockNumber: number -): Promise { - let statsPerDomain = await StatsPerDomain.get(id.toLowerCase()); - if (!statsPerDomain) { - statsPerDomain = StatsPerDomain.create({ - id: id.toLowerCase(), - domainId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - operatorsCount: BigInt(0), - activeOperatorsCount: BigInt(0), - slashedOperatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerDomain; -} - -// Helper for StatsPerOperator -export async function checkAndGetStatsPerOperator( - id: string, - blockNumber: number -): Promise { - let statsPerOperator = await StatsPerOperator.get(id.toLowerCase()); - if (!statsPerOperator) { - statsPerOperator = StatsPerOperator.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalTaxCollected: BigInt(0), - totalRewardsCollected: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerOperator; -} - -// Helper for StatsPerNominator -export async function checkAndGetStatsPerNominator( - id: string, - blockNumber: number -): Promise { - let statsPerNominator = await StatsPerNominator.get(id.toLowerCase()); - if (!statsPerNominator) { - statsPerNominator = StatsPerNominator.create({ - id: id.toLowerCase(), - domainId: "", - operatorId: "", - nominatorId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerNominator; -} - -// Helper for StatsPerAccount -export async function checkAndGetStatsPerAccount( - id: string, - blockNumber: number -): Promise { - let statsPerAccount = await StatsPerAccount.get(id.toLowerCase()); - if (!statsPerAccount) { - statsPerAccount = StatsPerAccount.create({ - id: id.toLowerCase(), - accountId: "", - blockNumber: BigInt(0), - totalStaked: BigInt(0), - totalDeposits: BigInt(0), - totalWithdrawals: BigInt(0), - totalShares: BigInt(0), - currentSharePrice: BigInt(0), - allTimeHighStaked: BigInt(0), - allTimeHighSharePrice: BigInt(0), - operatorsCount: BigInt(0), - nominatorsCount: BigInt(0), - depositsCount: BigInt(0), - withdrawalsCount: BigInt(0), - timestamp: new Date(), - }); - } - return statsPerAccount; -} diff --git a/indexers/taurus/staking/src/mappings/mappingHandlers.ts b/indexers/taurus/staking/src/mappings/mappingHandlers.ts deleted file mode 100644 index 97d86650b..000000000 --- a/indexers/taurus/staking/src/mappings/mappingHandlers.ts +++ /dev/null @@ -1,1114 +0,0 @@ -import { capitalizeFirstLetter, stringify } from "@autonomys/auto-utils"; -import { SubstrateEvent, SubstrateExtrinsic } from "@subql/types"; -import assert from "assert"; -import { - Bundle, - BundleAuthor, - Deposit, - DomainBlock, - Nominator, - Withdrawal, -} from "../types"; -import { SHARES_CALCULATION_MULTIPLIER } from "./constants"; -import * as db from "./db"; -import { - DepositStatus, - DomainRuntime, - NominatorPendingAction, - NominatorStatus, - OperatorPendingAction, - OperatorStatus, - WithdrawalStatus, -} from "./models"; -import type { ExecutionReceipt, SealedBundleHeader, TBundle } from "./types"; - -const MAX_LIMIT = 10000; - -export async function handleDomainInstantiatedEvent( - event: SubstrateEvent -): Promise { - const { - extrinsic, - event: { - data: [_domainId, _completedEpochIndex], - }, - } = event; - if (extrinsic) { - const _extrinsic = extrinsic.extrinsic.method.args[0].toHuman() as any; - const accountId = extrinsic.extrinsic.signer.toString(); - const domainName = capitalizeFirstLetter( - _extrinsic.args.domain_config.domainName - ); - const domainId = _domainId.toString(); - const completedEpoch = Number(_completedEpochIndex?.toString() ?? 0); - const blockNumber = event.block.block.header.number.toNumber(); - - const domain = await db.checkAndGetDomain(domainId, BigInt(blockNumber)); - domain.accountId = accountId; - domain.name = domainName; - switch (domainName) { - case "Nova": - domain.runtime = DomainRuntime.EVM; - break; - case "Auto-id": - domain.runtime = DomainRuntime.AUTO_ID; - break; - default: - break; - } - domain.runtimeInfo = stringify(_extrinsic.args.domain_config); - domain.completedEpoch = BigInt(completedEpoch); - domain.updatedAt = BigInt(blockNumber); - - await domain.save(); - } -} - -export async function handleRegisterOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - logger.info( - `New ${extrinsic.extrinsic.registry.toString()}.${ - extrinsic.extrinsic.method - } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` - ); - const { - block: { - block: { - header: { number }, - }, - }, - extrinsic: { - method: { args }, - signer, - }, - events, - } = extrinsic; - const _args = args.map((arg) => arg.toPrimitive()); - const domainId = String(args[0]); - const amount = BigInt(args[1].toString()); - const { signingKey, minimumNominatorStake, nominationTax } = - (args[2] as any) ?? {}; - - const opRegistered = events.find( - (e) => e.event.method.toString() === "OperatorRegistered" - ); - const storageFee = events.find( - (e) => e.event.method.toString() === "StorageFeeDeposited" - ); - if (!opRegistered || !storageFee) { - logger.info(`No operatorRegisteredEvent or storageFeeDepositedEvent found`); - return; - } - - const operatorId = String(opRegistered?.event.data[0]); - const domainId_storageFee = String(opRegistered.event.data[1]); - const operatorId_storageFee = String(storageFee.event.data[0]); - const nominatorId_storageFee = String(storageFee.event.data[1]); - const amount_storageFee = BigInt(storageFee.event.data[2].toString()); - - assert(domainId === domainId_storageFee, "domainId mismatch"); - assert(operatorId === operatorId_storageFee, "operatorId mismatch"); - assert(signer.toString() === nominatorId_storageFee, "signer mismatch"); - assert( - amount_storageFee === (BigInt(amount) * BigInt(20)) / BigInt(100), - `Storage fee (${amount_storageFee}) should be 20% of the amount (${amount})` - ); - - const domain = await db.checkAndGetDomain( - domainId, - BigInt(number.toString()) - ); - domain.totalDeposits += amount; - domain.updatedAt = BigInt(number.toString()); - - const account = await db.checkAndGetAccount( - signer.toString(), - number.toNumber() - ); - account.totalDeposits += amount; - account.updatedAt = BigInt(number.toString()); - - const operator = await db.checkAndGetOperator(operatorId, number.toNumber()); - operator.domainId = domain.id; - operator.accountId = account.id; - operator.signingKey = String(signingKey); - operator.minimumNominatorStake = BigInt(minimumNominatorStake); - operator.nominationTax = Number(nominationTax); - operator.totalDeposits += amount; - operator.pendingAction = OperatorPendingAction.PENDING_REGISTRATION; - operator.updatedAt = BigInt(number.toString()); - - const nominator = await db.checkAndGetNominator( - signer.toString(), - domain.id, - operator.id, - number.toNumber() - ); - nominator.totalDeposits += amount; - nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; - nominator.updatedAt = BigInt(number.toString()); - - const deposit = await db.checkAndGetDeposit( - signer.toString(), - domain.id, - operator.id, - amount - amount_storageFee, - amount_storageFee, - number.toNumber() - ); - deposit.epochDepositedAt = domain.completedEpoch ?? 0; - deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - deposit.save(), - ]); -} - -export async function handleNominateOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - const { - events, - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = String(args[0]); - const amount = BigInt(args[1].toString()); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const signer = extrinsic.extrinsic.signer.toString(); - - const storageFeeDepositedEvent = events.find( - (e) => e.event.method.toString() === "StorageFeeDeposited" - ); - const operatorNominatedEvent = events.find( - (e) => e.event.method.toString() === "OperatorNominated" - ); - - const storageFeeDeposit = BigInt( - storageFeeDepositedEvent?.event.data[2].toString() ?? 0 - ); - const totalAmount = amount + storageFeeDeposit; - - const account = await db.checkAndGetAccount(signer, blockNumber); - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - - const nominator = await db.checkAndGetNominator( - signer, - domain.id, - operator.id, - blockNumber - ); - - const deposit = await db.checkAndGetDeposit( - signer, - domain.id, - operator.id, - amount, - storageFeeDeposit, - blockNumber - ); - deposit.epochDepositedAt = domain.completedEpoch ?? 0; - deposit.domainBlockNumberDepositedAt = domain.lastDomainBlockNumber ?? 0; - - operator.totalDeposits += totalAmount; - operator.updatedAt = BigInt(blockNumber); - - if (nominator.totalDepositsCount === BigInt(0)) { - nominator.pendingAction = NominatorPendingAction.PENDING_EPOCH_CHANGE; - } - nominator.totalDeposits += totalAmount; - nominator.totalDepositsCount++; - nominator.updatedAt = BigInt(blockNumber); - - domain.totalDeposits += totalAmount; - domain.updatedAt = BigInt(blockNumber); - - account.totalDeposits += totalAmount; - account.updatedAt = BigInt(blockNumber); - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - deposit.save(), - ]); -} - -export async function handleDeregisterOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - logger.info( - `New ${extrinsic.extrinsic.registry.toString()}.${ - extrinsic.extrinsic.method - } extrinsic found at block ${extrinsic.block.block.header.number.toString()}` - ); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const { - events, - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = String(args[0]); - - const opDeregistered = events.find( - (e) => e.event.method.toString() === "OperatorDeregistered" - ); - if (!opDeregistered) { - logger.info(`No operatorDeregisteredEvent found`); - return; - } - - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - operator.currentTotalStake = BigInt(0); - operator.currentStorageFeeDeposit = BigInt(0); - operator.status = OperatorStatus.DEREGISTERED; - operator.updatedAt = BigInt(blockNumber); - - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - const activeNominators = - nominators && - nominators.filter( - (n) => - n.status === NominatorStatus.STAKED || - n.status === NominatorStatus.PENDING - ); - if (activeNominators) { - activeNominators.forEach(async (n) => { - const estimatedAmount = - (operator.currentSharePrice * n.knownShares) / - SHARES_CALCULATION_MULTIPLIER; - const withdrawal = await db.checkAndGetWithdrawal( - account.id, - domain.id, - operator.id, - n.id, - blockNumber - ); - - n.status = NominatorStatus.PENDING; - n.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - n.totalWithdrawalsCount++; - n.totalEstimatedWithdrawals += estimatedAmount; - n.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - account.totalEstimatedWithdrawals += estimatedAmount; - domain.totalEstimatedWithdrawals += estimatedAmount; - - await Promise.all([n.save(), withdrawal.save()]); - }); - } - await Promise.all([operator.save(), domain.save(), account.save()]); -} - -export async function handleOperatorSlashedEvent( - event: SubstrateEvent -): Promise { - const blockNumber = event.block.block.header.number.toNumber(); - const operatorId = event.event.data[0].toString(); - - // Query operator details - const operator = await db.checkAndGetOperator(operatorId, blockNumber); - operator.currentTotalStake = BigInt(0); - operator.currentStorageFeeDeposit = BigInt(0); - operator.status = OperatorStatus.SLASHED; - operator.updatedAt = BigInt(blockNumber); - - // Fetch nominators associated with the operator - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (nominators) { - nominators.forEach(async (nominator) => { - nominator.status = NominatorStatus.SLASHED; - nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; - nominator.updatedAt = BigInt(blockNumber); - await nominator.save(); - }); - } - - // Fetch withdrawals associated with the operator - const withdrawals = await Withdrawal.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (withdrawals) { - withdrawals.forEach(async (withdrawal) => { - if ( - withdrawal.status === WithdrawalStatus.PENDING_LOCK || - withdrawal.status === WithdrawalStatus.PENDING_OPERATOR || - withdrawal.status === WithdrawalStatus.READY - ) { - withdrawal.status = WithdrawalStatus.SLASHED; - withdrawal.updatedAt = BigInt(blockNumber); - await withdrawal.save(); - } - }); - } - - // Save operator changes - await operator.save(); -} - -export async function handleOperatorTaxCollectedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, tax], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const taxAmount = BigInt(tax.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - - operator.totalTaxCollected += taxAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalTaxCollected += taxAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalTaxCollected += taxAmount; - domain.updatedAt = BigInt(blockNumber); - - await Promise.all([operator.save(), account.save(), domain.save()]); -} - -export async function handleOperatorRewardedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, reward], - }, - block, - } = event; - const amount = BigInt(reward.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - block.block.header.number.toNumber() - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(block.block.header.number.toString()) - ); - - operator.totalRewardsCollected += amount; - domain.totalRewardsCollected += amount; - - const rewardEvent = await db.checkAndGetReward( - `${operatorId}-${block.block.header.number.toNumber()}`, - block.block.header.number.toNumber() - ); - rewardEvent.amount = amount; - rewardEvent.domainId = operator.domainId; - rewardEvent.operatorId = operator.id; - rewardEvent.timestamp = new Date(block.timestamp ?? 0); - - await Promise.all([operator.save(), domain.save(), rewardEvent.save()]); -} - -export async function handleWithdrawStakeCall( - extrinsic: SubstrateExtrinsic -): Promise { - const { - extrinsic: { - method: { args }, - }, - } = extrinsic; - const operatorId = args[0].toString(); - const shares = args[1].toString(); - const address = extrinsic.extrinsic.signer.toString(); - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const sharesBigInt = BigInt(shares.toString()); - - const account = await db.checkAndGetAccount(address, blockNumber); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const nominator = await db.checkAndGetNominator( - address, - domain.id, - operator.id, - blockNumber - ); - - const estimatedAmount = - (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; - const withdrawal = await db.checkAndGetWithdrawal( - account.id, - domain.id, - operator.id, - nominator.id, - blockNumber - ); - - withdrawal.domainId = domain.id; - withdrawal.accountId = account.id; - withdrawal.operatorId = operator.id; - withdrawal.nominatorId = nominator.id; - withdrawal.shares = sharesBigInt; - withdrawal.estimatedAmount = estimatedAmount; - withdrawal.epochWithdrawalRequestedAt = domain.completedEpoch ?? 0; - withdrawal.domainBlockNumberWithdrawalRequestedAt = - domain.lastDomainBlockNumber ?? 0; - withdrawal.status = WithdrawalStatus.PENDING_LOCK; - withdrawal.createdAt = BigInt(blockNumber); - withdrawal.updatedAt = BigInt(blockNumber); - - nominator.totalWithdrawalsCount++; - nominator.totalEstimatedWithdrawals += estimatedAmount; - nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - nominator.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalEstimatedWithdrawals += estimatedAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalEstimatedWithdrawals += estimatedAmount; - domain.updatedAt = BigInt(blockNumber); - - await Promise.all([ - withdrawal.save(), - nominator.save(), - operator.save(), - account.save(), - domain.save(), - ]); -} - -export async function handleUnlockFundsCall( - extrinsic: SubstrateExtrinsic -): Promise { - const blockNumber = extrinsic.block.block.header.number.toNumber(); - const signer = extrinsic.extrinsic.signer.toString(); - const [operatorId, shares] = extrinsic.extrinsic.method.args; - - // Query operator details - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - - // Calculate estimated amount - const sharesBigInt = BigInt(shares.toString()); - const estimatedAmount = - (operator.currentSharePrice * sharesBigInt) / SHARES_CALCULATION_MULTIPLIER; - - // Fetch or create Withdrawal entity - const withdrawal = await db.checkAndGetWithdrawal( - signer, - operator.domainId, - operator.id, - signer, - blockNumber - ); - - withdrawal.shares = sharesBigInt; - withdrawal.estimatedAmount = estimatedAmount; - withdrawal.status = WithdrawalStatus.PENDING_LOCK; - withdrawal.createdAt = BigInt(blockNumber); - withdrawal.updatedAt = BigInt(blockNumber); - - // Update related entities - const account = await db.checkAndGetAccount(signer, blockNumber); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const nominator = await db.checkAndGetNominator( - signer, - domain.id, - operator.id, - blockNumber - ); - - nominator.totalWithdrawalsCount++; - nominator.totalEstimatedWithdrawals += estimatedAmount; - nominator.pendingAction = NominatorPendingAction.PENDING_LOCK_PERIOD; - nominator.updatedAt = BigInt(blockNumber); - - operator.totalEstimatedWithdrawals += estimatedAmount; - operator.updatedAt = BigInt(blockNumber); - - account.totalEstimatedWithdrawals += estimatedAmount; - account.updatedAt = BigInt(blockNumber); - - domain.totalEstimatedWithdrawals += estimatedAmount; - domain.updatedAt = BigInt(blockNumber); - - // Save all changes - await Promise.all([ - withdrawal.save(), - nominator.save(), - operator.save(), - account.save(), - domain.save(), - ]); -} - -export async function handleUnlockOperatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - // Implementation for handleUnlockOperatorCall -} - -export async function handleUnlockNominatorCall( - extrinsic: SubstrateExtrinsic -): Promise { - // Implementation for handleUnlockNominatorCall -} - -export async function handleDomainEpochCompletedEvent( - event: SubstrateEvent -): Promise { - logger.info( - `New ${event.event.section}.${ - event.event.method - } event found at block ${event.block.block.header.number.toString()}` - ); - const { - event: { - data: [domainId, epochIndex], - }, - } = event; - const blockNumber = event.block.block.header.number.toNumber(); - - // Querying additional state if necessary - const _domainEntry = await api.query.domains.domainRegistry(domainId); - const domainEntry = _domainEntry.toJSON() as any[0]; - - // Parse domain details - const parsedDomain = { - domainId: domainEntry?.domainId, - ownerAccountId: domainEntry?.ownerAccountId, - // Add other necessary fields - }; - - // Fetch or create Domain entity - const domain = await db.checkAndGetDomain( - domainId.toString(), - BigInt(blockNumber) - ); - domain.completedEpoch = BigInt(epochIndex.toString()); - domain.updatedAt = BigInt(blockNumber); - - // Update domain based on fetched data - if (parsedDomain.ownerAccountId) { - domain.accountId = parsedDomain.ownerAccountId; - // Update other domain fields as necessary - } - - await domain.save(); -} - -export async function handleForceDomainEpochTransitionEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleForceDomainEpochTransitionEvent -} - -export async function handleOperatorRegisteredEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorRegisteredEvent -} - -export async function handleOperatorDeregisteredEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorDeregisteredEvent -} - -export async function handleOperatorNominatedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleOperatorNominatedEvent -} - -export async function handleWithdrewStakeEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleWithdrewStakeEvent -} - -export async function handleStorageFeeDepositedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleStorageFeeDepositedEvent -} - -export async function handleBundleStoredEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [domainId, bundleAuthor], - }, - block: { - block: { - header: { number, hash }, - }, - timestamp, - }, - extrinsic, - } = event; - const domainIdNum = BigInt(domainId.toString()); - const operatorId = BigInt(bundleAuthor.toString()); - if (!extrinsic) return; - - const _bundle = - extrinsic.extrinsic.method.args[0].toPrimitive() as unknown as TBundle; - const sealedHeader = _bundle.sealedHeader as SealedBundleHeader; - const domain = await db.checkAndGetDomain( - domainId.toString(), - BigInt(number.toString()) - ); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - number.toNumber() - ); - const account = await db.checkAndGetAccount( - operator.accountId, - number.toNumber() - ); - - const receipt = sealedHeader.header.receipt as ExecutionReceipt; - const { transfers } = receipt; - - const totalTransfersIn = Array.isArray(transfers.transfersIn) - ? transfers.transfersIn.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersInCount = Array.isArray(transfers.transfersIn) - ? transfers.transfersIn.length - : 0; - - const totalTransfersOut = Array.isArray(transfers.transfersOut) - ? transfers.transfersOut.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersOutCount = Array.isArray(transfers.transfersOut) - ? transfers.transfersOut.length - : 0; - - const totalRejectedTransfersClaimed = Array.isArray( - transfers.rejectedTransfersClaimed - ) - ? transfers.rejectedTransfersClaimed.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const rejectedTransfersClaimedCount = Array.isArray( - transfers.rejectedTransfersClaimed - ) - ? transfers.rejectedTransfersClaimed.length - : 0; - - const totalTransfersRejected = Array.isArray(transfers.transfersRejected) - ? transfers.transfersRejected.reduce( - (acc, [, amount]) => acc + BigInt(amount), - BigInt(0) - ) - : BigInt(0); - const transfersRejectedCount = Array.isArray(transfers.transfersRejected) - ? transfers.transfersRejected.length - : 0; - - const totalVolume = totalTransfersIn + totalTransfersOut; - - const { - domainBlockNumber, - domainBlockHash, - domainBlockExtrinsicRoot, - consensusBlockNumber, - consensusBlockHash, - blockFees, - } = receipt; - - const epoch = domain.completedEpoch; - const domainEpoch = await db.checkAndGetDomainEpoch( - `${domainId}-${epoch}`, - number.toNumber() - ); - domainEpoch.blockNumberEnd = BigInt(domainBlockNumber); - domainEpoch.timestampEnd = timestamp ?? new Date(0); - domainEpoch.consensusBlockNumberEnd = BigInt(consensusBlockNumber); - domainEpoch.consensusBlockHashEnd = hash.toString(); - domainEpoch.blockCount = - domainEpoch.blockNumberEnd - domainEpoch.blockNumberStart + BigInt(1); - domainEpoch.epochDuration = BigInt( - domainEpoch.timestampEnd.getTime() - domainEpoch.timestampStart.getTime() - ); - domainEpoch.updatedAt = BigInt(number.toNumber()); - - let domainBlock = await db.checkAndGetDomainBlock( - `${domainId}-${domainBlockNumber}`, - number.toNumber() - ); - if (!domainBlock) { - domainBlock = DomainBlock.create({ - id: `${domainId}-${domainBlockNumber}`, - domainId: domain.id, - domainEpochId: domainEpoch.id, - blockNumber: BigInt(domainBlockNumber), - blockHash: domainBlockHash.toString(), - extrinsicRoot: domainBlockExtrinsicRoot.toString(), - epoch: domain.completedEpoch, - consensusBlockNumber: BigInt(consensusBlockNumber), - consensusBlockHash: consensusBlockHash.toString(), - timestamp: timestamp ?? new Date(0), - createdAt: BigInt(number.toString()), - updatedAt: BigInt(number.toString()), - }); - } - - let bundle = await db.checkAndGetBundle( - `${domainId}-${domainBlockHash}-${number.toNumber()}`, - number.toNumber() - ); - if (!bundle) { - bundle = Bundle.create({ - id: `${domainId}-${domainBlockHash}-${number.toNumber()}`, - domainId: domain.id, - domainBlockId: domainBlock.id, - domainEpochId: domainEpoch.id, - domainBlockNumber: BigInt(domainBlockNumber), - domainBlockHash: domainBlockHash.toString(), - domainBlockExtrinsicRoot: domainBlockExtrinsicRoot.toString(), - epoch: domain.completedEpoch, - consensusBlockNumber: BigInt(consensusBlockNumber), - consensusBlockHash: consensusBlockHash.toString(), - totalTransfersIn, - transfersInCount: BigInt(transfersInCount), - totalTransfersOut, - transfersOutCount: BigInt(transfersOutCount), - totalRejectedTransfersClaimed, - rejectedTransfersClaimedCount: BigInt(rejectedTransfersClaimedCount), - totalTransfersRejected, - transfersRejectedCount: BigInt(transfersRejectedCount), - totalVolume, - consensusStorageFee: BigInt(blockFees.consensusStorageFee), - domainExecutionFee: BigInt(blockFees.domainExecutionFee), - burnedBalance: BigInt(blockFees.burnedBalance), - }); - } - - let bundleAuthorEntity = await db.checkAndGetBundleAuthor( - `${domainId}-${account.id}-${operator.id}-${bundle.id}`, - number.toNumber() - ); - if (!bundleAuthorEntity) { - bundleAuthorEntity = BundleAuthor.create({ - id: `${domainId}-${account.id}-${operator.id}-${bundle.id}`, - domainId: domain.id, - accountId: account.id, - operatorId: operator.id, - bundleId: bundle.id, - domainBlockId: domainBlock.id, - domainEpochId: domainEpoch.id, - epoch: domain.completedEpoch, - }); - } - - domain.lastDomainBlockNumber = BigInt(domainBlockNumber); - domain.totalTransfersIn += totalTransfersIn; - domain.transfersInCount += BigInt(transfersInCount); - domain.totalTransfersOut += totalTransfersOut; - domain.transfersOutCount += BigInt(transfersOutCount); - domain.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; - domain.rejectedTransfersClaimedCount += BigInt(rejectedTransfersClaimedCount); - domain.totalTransfersRejected += totalTransfersRejected; - domain.transfersRejectedCount += BigInt(transfersRejectedCount); - domain.totalVolume += totalVolume; - domain.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); - domain.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); - domain.totalBurnedBalance += BigInt(blockFees.burnedBalance); - domain.bundleCount++; - domain.currentEpochDuration = domainEpoch.epochDuration; - - if (epoch > 0) { - const lastEpoch = await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(1)}`, - number.toNumber() - ); - const lastEpochTimestampEnd = lastEpoch.timestampEnd.getTime(); - domain.lastEpochDuration = lastEpoch.epochDuration; - if (epoch > 6) { - domain.last6EpochsDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(6)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - if (epoch > 144) { - domain.last144EpochDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(144)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - if (epoch > 1000) { - domain.last1kEpochDuration = BigInt( - lastEpochTimestampEnd - - ( - await db.checkAndGetDomainEpoch( - `${domainId}-${epoch - BigInt(1000)}`, - number.toNumber() - ) - ).timestampEnd.getTime() - ); - } - } - domain.lastBundleAt = BigInt(number.toString()); - domain.updatedAt = BigInt(number.toString()); - - operator.totalTransfersIn += totalTransfersIn; - operator.transfersInCount += BigInt(transfersInCount); - operator.totalTransfersOut += totalTransfersOut; - operator.transfersOutCount += BigInt(transfersOutCount); - operator.totalRejectedTransfersClaimed += totalRejectedTransfersClaimed; - operator.rejectedTransfersClaimedCount += BigInt( - rejectedTransfersClaimedCount - ); - operator.totalTransfersRejected += totalTransfersRejected; - operator.transfersRejectedCount += BigInt(transfersRejectedCount); - operator.totalConsensusStorageFee += BigInt(blockFees.consensusStorageFee); - operator.totalDomainExecutionFee += BigInt(blockFees.domainExecutionFee); - operator.totalBurnedBalance += BigInt(blockFees.burnedBalance); - operator.totalVolume += totalVolume; - operator.bundleCount++; - operator.lastBundleAt = BigInt(number.toString()); - operator.updatedAt = BigInt(number.toString()); - - await Promise.all([ - domain.save(), - domainEpoch.save(), - domainBlock.save(), - bundle.save(), - bundleAuthorEntity.save(), - operator.save(), - ]); -} - -export async function handleOperatorUnlockedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount(operator.accountId, blockNumber); - - operator.pendingAction = OperatorPendingAction.NO_ACTION_REQUIRED; - operator.updatedAt = BigInt(blockNumber); - - const nominators = await Nominator.getByOperatorId(operator.id, { - limit: MAX_LIMIT, - }); - if (nominators) { - nominators.forEach(async (n) => { - if ( - n.status === NominatorStatus.PENDING || - n.status === NominatorStatus.STAKED - ) { - n.status = NominatorStatus.PENDING; - n.pendingAction = NominatorPendingAction.READY_TO_UNLOCK_ALL_FUNDS; - n.updatedAt = BigInt(blockNumber); - await n.save(); - } - }); - } - - const withdrawals = await Withdrawal.getByDomainId(domain.id, { - limit: MAX_LIMIT, - }); - if (withdrawals) { - withdrawals.forEach(async (w) => { - if (w.status === WithdrawalStatus.PENDING_OPERATOR) { - w.status = WithdrawalStatus.READY; - w.readyAt = BigInt(blockNumber); - w.updatedAt = BigInt(blockNumber); - await w.save(); - } - }); - } - - await Promise.all([operator.save(), domain.save(), account.save()]); -} - -export async function handleFundsUnlockedEvent( - event: SubstrateEvent -): Promise { - const { - event: { - data: [operatorId, nominatorId, amount], - }, - block, - } = event; - const blockNumber = block.block.header.number.toNumber(); - const amountBigInt = BigInt(amount.toString()); - - const operator = await db.checkAndGetOperator( - operatorId.toString(), - blockNumber - ); - const domain = await db.checkAndGetDomain( - operator.domainId, - BigInt(blockNumber) - ); - const account = await db.checkAndGetAccount( - nominatorId.toString(), - blockNumber - ); - const nominator = await db.checkAndGetNominator( - nominatorId.toString(), - domain.id, - operator.id, - blockNumber - ); - - const withdrawals = await Withdrawal.getByFields( - [ - ["operatorId", "=", operator.id], - ["accountId", "=", account.id], - ], - { limit: MAX_LIMIT } - ); - if (withdrawals) { - withdrawals.forEach(async (w) => { - if (w.status === WithdrawalStatus.PENDING_LOCK) { - w.status = WithdrawalStatus.WITHDRAW; - w.unlockedAmount = amountBigInt; - w.unlockedAt = BigInt(blockNumber); - w.updatedAt = BigInt(blockNumber); - await w.save(); - } - }); - } - - let amountToWithdraw = amountBigInt; - const deposits = await Deposit.getByFields( - [ - ["operatorId", "=", operator.id], - ["accountId", "=", account.id], - ], - { limit: MAX_LIMIT } - ); - if (deposits) { - deposits.forEach(async (d) => { - if (amountToWithdraw > 0) { - if (amountToWithdraw > d.totalAmount) { - amountToWithdraw -= d.totalAmount; - d.totalWithdrawn = d.totalAmount; - d.status = DepositStatus.WITHDRAWN; - } else { - d.totalWithdrawn = amountToWithdraw; - d.status = DepositStatus.PARTIALLY_WITHDRAWN; - amountToWithdraw = BigInt(0); - } - d.updatedAt = BigInt(blockNumber); - await d.save(); - } - }); - } - - domain.totalWithdrawals += amountBigInt; - domain.updatedAt = BigInt(blockNumber); - - account.totalWithdrawals += amountBigInt; - account.updatedAt = BigInt(blockNumber); - - operator.totalWithdrawals += amountBigInt; - operator.updatedAt = BigInt(blockNumber); - - nominator.totalWithdrawals += amountBigInt; - nominator.pendingAction = NominatorPendingAction.NO_ACTION_REQUIRED; - nominator.updatedAt = BigInt(blockNumber); - - await Promise.all([ - domain.save(), - account.save(), - operator.save(), - nominator.save(), - ]); -} - -export async function handleNominatedStakedUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleNominatedStakedUnlockedEvent -} - -export async function handleNominatorUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleNominatorUnlockedEvent -} - -export async function handleStorageFeeUnlockedEvent( - event: SubstrateEvent -): Promise { - // Implementation for handleStorageFeeUnlockedEvent -} diff --git a/indexers/taurus/staking/src/mappings/models.ts b/indexers/taurus/staking/src/mappings/models.ts deleted file mode 100644 index 6faa9de2d..000000000 --- a/indexers/taurus/staking/src/mappings/models.ts +++ /dev/null @@ -1,49 +0,0 @@ -export enum DomainRuntime { - EVM = "EVM", - AUTO_ID = "AUTO_ID", -} - -export enum OperatorStatus { - PENDING = "PENDING", - REGISTERED = "REGISTERED", - DEREGISTERED = "DEREGISTERED", - SLASHED = "SLASHED", -} - -export enum OperatorPendingAction { - NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", - PENDING_REGISTRATION = "PENDING_REGISTRATION", - WAITING_TO_UNLOCK_NOMINATOR = "WAITING_TO_UNLOCK_NOMINATOR", - READY_FOR_UNLOCK_NOMINATOR = "READY_FOR_UNLOCK_NOMINATOR", - READY_FOR_UNLOCK_FUNDS = "READY_FOR_UNLOCK_FUNDS", -} - -export enum NominatorStatus { - PENDING = "PENDING", - STAKED = "STAKED", - SLASHED = "SLASHED", - WITHDRAW = "WITHDRAW", -} - -export enum NominatorPendingAction { - NO_ACTION_REQUIRED = "NO_ACTION_REQUIRED", - PENDING_EPOCH_CHANGE = "PENDING_EPOCH_CHANGE", - PENDING_LOCK_PERIOD = "PENDING_LOCK_PERIOD", - READY_TO_UNLOCK_ALL_FUNDS = "READY_TO_UNLOCK_ALL_FUNDS", -} - -export enum DepositStatus { - PENDING = "PENDING", - DEPOSITED = "DEPOSITED", - PARTIALLY_WITHDRAWN = "PARTIALLY_WITHDRAWN", - WITHDRAWN = "WITHDRAWN", - SLASHED = "SLASHED", -} - -export enum WithdrawalStatus { - PENDING_LOCK = "PENDING_LOCK", - PENDING_OPERATOR = "PENDING_OPERATOR", - READY = "READY", - WITHDRAW = "WITHDRAW", - SLASHED = "SLASHED", -} diff --git a/indexers/taurus/staking/src/mappings/types.ts b/indexers/taurus/staking/src/mappings/types.ts deleted file mode 100644 index aeddf35fe..000000000 --- a/indexers/taurus/staking/src/mappings/types.ts +++ /dev/null @@ -1,123 +0,0 @@ -export interface TBundle { - sealedHeader: SealedBundleHeader; - extrinsics: Uint8Array[]; -} - -export interface SealedBundleHeader { - header: BundleHeader; - signature: Uint8Array; -} - -interface BundleHeader { - proofOfElection: ProofOfElection; - receipt: ExecutionReceipt; - estimatedBundleWeight: Weight; - bundleExtrinsicsRoot: Uint8Array; -} - -interface ProofOfElection { - domainId: number; - slotNumber: bigint; - proofOfTime: Uint8Array; - vrfSignature: VrfSignature; - operatorId: bigint; - consensusBlockHash: Uint8Array; -} - -export interface ExecutionReceipt { - domainBlockNumber: number; - domainBlockHash: Uint8Array; - domainBlockExtrinsicRoot: Uint8Array; - parentDomainBlockReceiptHash: Uint8Array; - consensusBlockNumber: number; - consensusBlockHash: Uint8Array; - inboxedBundles: InboxedBundle[]; - finalStateRoot: Uint8Array; - executionTrace: Uint8Array[]; - executionTraceRoot: Uint8Array; - blockFees: BlockFees; - transfers: Transfers; -} - -interface VrfSignature { - preOutput: Uint8Array; - proof: Uint8Array; -} - -interface Weight { - refTime: bigint; - proofSize: bigint; -} - -interface InboxedBundle { - bundle: BundleValidity; - extrinsicsRoot: Uint8Array; -} - -interface Transfers { - transfersIn: [ChainId, bigint][]; - transfersOut: [ChainId, bigint][]; - rejectedTransfersClaimed: [ChainId, bigint][]; - transfersRejected: [ChainId, bigint][]; -} - -interface BlockFees { - consensusStorageFee: bigint; - domainExecutionFee: bigint; - burnedBalance: bigint; -} - -type BundleValidity = BundleValidity_Invalid | BundleValidity_Valid; - -interface BundleValidity_Invalid { - __kind: "Invalid"; - value: InvalidBundleType; -} - -interface BundleValidity_Valid { - __kind: "Valid"; - value: Uint8Array; -} - -type ChainId = ChainId_Consensus | ChainId_Domain; - -interface ChainId_Consensus { - __kind: "Consensus"; -} - -interface ChainId_Domain { - __kind: "Domain"; - value: number; -} - -type InvalidBundleType = - | InvalidBundleType_UndecodableTx - | InvalidBundleType_OutOfRangeTx - | InvalidBundleType_IllegalTx - | InvalidBundleType_InvalidXDM - | InvalidBundleType_InherentExtrinsic; - -interface InvalidBundleType_UndecodableTx { - __kind: "UndecodableTx"; - value: number; -} - -interface InvalidBundleType_OutOfRangeTx { - __kind: "OutOfRangeTx"; - value: number; -} - -interface InvalidBundleType_IllegalTx { - __kind: "IllegalTx"; - value: number; -} - -interface InvalidBundleType_InvalidXDM { - __kind: "InvalidXDM"; - value: number; -} - -interface InvalidBundleType_InherentExtrinsic { - __kind: "InherentExtrinsic"; - value: number; -} diff --git a/indexers/taurus/staking/tsconfig.json b/indexers/taurus/staking/tsconfig.json deleted file mode 100644 index b827eae7e..000000000 --- a/indexers/taurus/staking/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "declaration": true, - "importHelpers": true, - "resolveJsonModule": true, - "module": "commonjs", - "outDir": "dist", - "rootDir": "src", - "target": "es2017", - "strict": true - }, - "include": [ - "src/**/*", - "../../node_modules/@subql/types-core/dist/global.d.ts", - "../../node_modules/@subql/types/dist/global.d.ts" - ] -} diff --git a/indexers/taurus/yarn.lock b/indexers/taurus/yarn.lock deleted file mode 100644 index fb57ccd13..000000000 --- a/indexers/taurus/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - From 7c0475205fab9460a90097e46bbe904d76e536ac Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:41:14 -0500 Subject: [PATCH 7/8] simplify indexers setup to not use duplicate indexers (separated by network) --- .vscode/astral.code-workspace | 20 +- docker-compose.yml | 16 +- indexers/lerna.json | 2 +- indexers/package.json | 7 +- indexers/yarn.lock | 2665 +++++++++++++++++++++++++++++++-- 5 files changed, 2602 insertions(+), 108 deletions(-) diff --git a/.vscode/astral.code-workspace b/.vscode/astral.code-workspace index 62f351e96..b1865cf97 100644 --- a/.vscode/astral.code-workspace +++ b/.vscode/astral.code-workspace @@ -13,12 +13,24 @@ "path": "../indexers" }, { - "name": "Indexer - Mainnet", - "path": "../indexers/mainnet" + "name": "Indexer - Consensus", + "path": "../indexers/consensus" }, { - "name": "Indexer - Testnet Taurus", - "path": "../indexers/taurus" + "name": "Indexer - Leaderboard", + "path": "../indexers/leaderboard" + }, + { + "name": "Indexer - Files", + "path": "../indexers/files" + }, + { + "name": "Indexer - Staking", + "path": "../indexers/staking" + }, + { + "name": "Indexer - API", + "path": "../indexers/api" }, { "name": "Indexer - Taskboard", diff --git a/docker-compose.yml b/docker-compose.yml index 2345c4a39..ffab63bc3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -218,10 +218,10 @@ services: DB_HOST: ${DB_HOST} DB_PORT: ${DB_PORT} volumes: - - ./indexers/${NETWORK_ID}/consensus:/${NETWORK_ID}/consensus + - ./indexers/consensus:/consensus command: - ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests - - -f=/${NETWORK_ID}/consensus + - -f=/consensus - --db-schema=consensus - --workers=4 - --unsafe @@ -257,10 +257,10 @@ services: DB_HOST: ${DB_HOST} DB_PORT: ${DB_PORT} volumes: - - ./indexers/${NETWORK_ID}/leaderboard:/${NETWORK_ID}/leaderboard + - ./indexers/leaderboard:/leaderboard command: - ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests - - -f=/${NETWORK_ID}/leaderboard + - -f=/leaderboard - --db-schema=leaderboard - --workers=1 - --batch-size=100 @@ -295,10 +295,10 @@ services: DB_HOST: ${DB_HOST} DB_PORT: ${DB_PORT} volumes: - - ./indexers/${NETWORK_ID}/staking:/${NETWORK_ID}/staking + - ./indexers/staking:/staking command: - ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests - - -f=/${NETWORK_ID}/staking + - -f=/staking - --db-schema=staking - --workers=1 - --unsafe @@ -330,10 +330,10 @@ services: DB_HOST: ${DB_HOST} DB_PORT: ${DB_PORT} volumes: - - ./indexers/${NETWORK_ID}/files:/${NETWORK_ID}/files + - ./indexers/files:/files command: - ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests - - -f=/${NETWORK_ID}/files + - -f=/files - --db-schema=files - --workers=1 - --unsafe diff --git a/indexers/lerna.json b/indexers/lerna.json index 4df932267..e5da290e4 100644 --- a/indexers/lerna.json +++ b/indexers/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "version": "0.0.0", - "packages": ["mainnet/*", "taurus/*", "db", "taskboard"], + "packages": ["*"], "npmClient": "yarn" } diff --git a/indexers/package.json b/indexers/package.json index 31da39d0c..4f8615db8 100644 --- a/indexers/package.json +++ b/indexers/package.json @@ -4,12 +4,7 @@ "private": true, "main": "index.js", "license": "MIT", - "workspaces": [ - "mainnet/*", - "taurus/*", - "db", - "taskboard" - ], + "workspaces": ["*"], "scripts": { "postinstall": "git submodule update --init --recursive", "bootstrap": "lerna run bootstrap", diff --git a/indexers/yarn.lock b/indexers/yarn.lock index 9194e26c0..e205d41f0 100644 --- a/indexers/yarn.lock +++ b/indexers/yarn.lock @@ -2,6 +2,49 @@ # yarn lockfile v1 +"@ampproject/remapping@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@angular-devkit/core@17.3.11": + version "17.3.11" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-17.3.11.tgz#a74b042ec06cf626d5a2f6a3971b156c6759fe09" + integrity sha512-vTNDYNsLIWpYk2I969LMQFH29GTsLzxNk/0cLw5q56ARF0v5sIWfHYwGTS88jdDqIpuuettcSczbxeA7EuAmqQ== + dependencies: + ajv "8.12.0" + ajv-formats "2.1.1" + jsonc-parser "3.2.1" + picomatch "4.0.1" + rxjs "7.8.1" + source-map "0.7.4" + +"@angular-devkit/schematics-cli@17.3.11": + version "17.3.11" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics-cli/-/schematics-cli-17.3.11.tgz#dd1963d592ae7d2555ddbbac8406ba03bcddf4fe" + integrity sha512-kcOMqp+PHAKkqRad7Zd7PbpqJ0LqLaNZdY1+k66lLWmkEBozgq8v4ASn/puPWf9Bo0HpCiK+EzLf0VHE8Z/y6Q== + dependencies: + "@angular-devkit/core" "17.3.11" + "@angular-devkit/schematics" "17.3.11" + ansi-colors "4.1.3" + inquirer "9.2.15" + symbol-observable "4.0.0" + yargs-parser "21.1.1" + +"@angular-devkit/schematics@17.3.11": + version "17.3.11" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-17.3.11.tgz#37095fb08b0ab0343c7c0dde57ca81115178714f" + integrity sha512-I5wviiIqiFwar9Pdk30Lujk8FczEEc18i22A5c6Z9lbmhPQdTroDnEQdsfXjy404wPe8H62s0I15o4pmMGfTYQ== + dependencies: + "@angular-devkit/core" "17.3.11" + jsonc-parser "3.2.1" + magic-string "0.30.8" + ora "5.4.1" + rxjs "7.8.1" + "@apollo/client@^3.11.2", "@apollo/client@^3.7.16": version "3.12.2" resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.12.2.tgz#28cf4a0c07c42ace566dc17e2647ff011424ece8" @@ -54,7 +97,7 @@ "@polkadot/extension-dapp" "^0.56.2" fs "^0.0.1-security" -"@babel/code-frame@^7.0.0": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0", "@babel/code-frame@^7.26.2": version "7.26.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== @@ -63,6 +106,76 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@babel/compat-data@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.5.tgz#df93ac37f4417854130e21d72c66ff3d4b897fc7" + integrity sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" + integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.26.0" + "@babel/generator" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-module-transforms" "^7.26.0" + "@babel/helpers" "^7.26.0" + "@babel/parser" "^7.26.0" + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.26.0" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.26.0", "@babel/generator@^7.26.5", "@babel/generator@^7.7.2": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.5.tgz#e44d4ab3176bbcaf78a5725da5f1dc28802a9458" + integrity sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw== + dependencies: + "@babel/parser" "^7.26.5" + "@babel/types" "^7.26.5" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + +"@babel/helper-compilation-targets@^7.25.9": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8" + integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA== + dependencies: + "@babel/compat-data" "^7.26.5" + "@babel/helper-validator-option" "^7.25.9" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-module-imports@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" + integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-transforms@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" + integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.8.0": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" + integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== + "@babel/helper-string-parser@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" @@ -73,6 +186,26 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== +"@babel/helper-validator-option@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" + integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== + +"@babel/helpers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" + integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== + dependencies: + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.5.tgz#6fec9aebddef25ca57a935c86dbb915ae2da3e1f" + integrity sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw== + dependencies: + "@babel/types" "^7.26.5" + "@babel/parser@^7.20.15": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.3.tgz#8c51c5db6ddf08134af1ddbacf16aaab48bac234" @@ -80,6 +213,155 @@ dependencies: "@babel/types" "^7.26.3" +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-class-static-block@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-import-attributes@^7.24.7": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz#3b1412847699eea739b4f2602c74ce36f6b0b0f7" + integrity sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-import-meta@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" + integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-private-property-in-object@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-top-level-await@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" + integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/template@^7.25.9", "@babel/template@^7.3.3": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/traverse@^7.25.9": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.5.tgz#6d0be3e772ff786456c1a37538208286f6e79021" + integrity sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ== + dependencies: + "@babel/code-frame" "^7.26.2" + "@babel/generator" "^7.26.5" + "@babel/parser" "^7.26.5" + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.5" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.5", "@babel/types@^7.3.3": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.5.tgz#7a1e1c01d28e26d1fe7f8ec9567b3b92b9d07747" + integrity sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/types@^7.26.3": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0" @@ -88,6 +370,11 @@ "@babel/helper-string-parser" "^7.25.9" "@babel/helper-validator-identifier" "^7.25.9" +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + "@bull-board/api@5.23.0", "@bull-board/api@^5.23.0": version "5.23.0" resolved "https://registry.yarnpkg.com/@bull-board/api/-/api-5.23.0.tgz#42a742e68bcfc4f547bee417e4b91745adfa40ea" @@ -112,6 +399,11 @@ dependencies: "@bull-board/api" "5.23.0" +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -141,11 +433,62 @@ dependencies: tslib "^2.4.0" +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" + integrity sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA== + dependencies: + eslint-visitor-keys "^3.4.3" + +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== + 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" + +"@eslint/js@8.57.1": + version "8.57.1" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2" + integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q== + "@graphql-typed-document-node/core@^3.1.1": version "3.2.0" resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== +"@humanwhocodes/config-array@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" + integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== + dependencies: + "@humanwhocodes/object-schema" "^2.0.3" + debug "^4.3.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== + "@hutson/parse-repository-url@^3.0.0": version "3.0.2" resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" @@ -332,6 +675,145 @@ resolved "https://registry.yarnpkg.com/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz#291c227e93fd407a96ecd59879a35809120e432b" integrity sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ== +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== + dependencies: + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== + dependencies: + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" + +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" @@ -339,6 +821,68 @@ dependencies: "@sinclair/typebox" "^0.27.8" +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + callsites "^3.0.0" + graceful-fs "^4.2.9" + +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== + dependencies: + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== + dependencies: + "@jest/test-result" "^29.7.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + slash "^3.0.0" + +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + "@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" @@ -366,7 +910,7 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": version "1.5.0" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== @@ -379,7 +923,7 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -483,11 +1027,23 @@ yargs "17.7.2" yargs-parser "21.1.1" +"@ljharb/through@^2.3.12": + version "2.3.13" + resolved "https://registry.yarnpkg.com/@ljharb/through/-/through-2.3.13.tgz#b7e4766e0b65aa82e529be945ab078de79874edc" + integrity sha512-/gKJun8NNiWGZJkGzI/Ragc53cOdcLNdzjLaIa+GEjguQs0ulsurx8WN0jijdK9yPqDvziX995sMRLyLt1uZMQ== + dependencies: + call-bind "^1.0.7" + "@lukeed/csprng@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@lukeed/csprng/-/csprng-1.1.0.tgz#1e3e4bd05c1cc7a0b2ddbd8a03f39f6e4b5e6cfe" integrity sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA== +"@microsoft/tsdoc@^0.15.0": + version "0.15.1" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.15.1.tgz#d4f6937353bc4568292654efb0a0e0532adbcba2" + integrity sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw== + "@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3": version "3.0.3" resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz#9edec61b22c3082018a79f6d1c30289ddf3d9d11" @@ -527,6 +1083,40 @@ "@emnapi/runtime" "^1.1.0" "@tybys/wasm-util" "^0.9.0" +"@nestjs/cli@^10.0.0": + version "10.4.9" + resolved "https://registry.yarnpkg.com/@nestjs/cli/-/cli-10.4.9.tgz#ac3a23096a4725465360d8d60810f3e857f4a803" + integrity sha512-s8qYd97bggqeK7Op3iD49X2MpFtW4LVNLAwXFkfbRxKME6IYT7X0muNTJ2+QfI8hpbNx9isWkrLWIp+g5FOhiA== + dependencies: + "@angular-devkit/core" "17.3.11" + "@angular-devkit/schematics" "17.3.11" + "@angular-devkit/schematics-cli" "17.3.11" + "@nestjs/schematics" "^10.0.1" + chalk "4.1.2" + chokidar "3.6.0" + cli-table3 "0.6.5" + commander "4.1.1" + fork-ts-checker-webpack-plugin "9.0.2" + glob "10.4.5" + inquirer "8.2.6" + node-emoji "1.11.0" + ora "5.4.1" + tree-kill "1.2.2" + tsconfig-paths "4.2.0" + tsconfig-paths-webpack-plugin "4.2.0" + typescript "5.7.2" + webpack "5.97.1" + webpack-node-externals "3.0.0" + +"@nestjs/common@^10.0.0": + version "10.4.15" + resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-10.4.15.tgz#27c291466d9100eb86fdbe6f7bbb4d1a6ad55f70" + integrity sha512-vaLg1ZgwhG29BuLDxPA9OAcIlgqzp9/N8iG0wGapyUNTf4IY4O6zAHgN6QalwLhFxq7nOI021vdRojR1oF3bqg== + dependencies: + uid "2.0.2" + iterare "1.2.1" + tslib "2.8.1" + "@nestjs/common@^9.4.0": version "9.4.3" resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-9.4.3.tgz#f907c5315b4273f7675864a05c4dda7056632b87" @@ -536,6 +1126,27 @@ iterare "1.2.1" tslib "2.5.3" +"@nestjs/config@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@nestjs/config/-/config-3.3.0.tgz#ddc520ba26a8453ee5e690e18fb7b35e9bac7974" + integrity sha512-pdGTp8m9d0ZCrjTpjkUbZx6gyf2IKf+7zlkrPNMsJzYZ4bFRRTpXrnj+556/5uiI6AfL5mMrJc2u7dB6bvM+VA== + dependencies: + dotenv "16.4.5" + dotenv-expand "10.0.0" + lodash "4.17.21" + +"@nestjs/core@^10.0.0": + version "10.4.15" + resolved "https://registry.yarnpkg.com/@nestjs/core/-/core-10.4.15.tgz#1343a3395d5c54e9b792608cb75eef39053806d5" + integrity sha512-UBejmdiYwaH6fTsz2QFBlC1cJHM+3UDeLZN+CiP9I1fRv2KlBZsmozGLbV5eS1JAVWJB4T5N5yQ0gjN8ZvcS2w== + dependencies: + uid "2.0.2" + "@nuxtjs/opencollective" "0.3.2" + fast-safe-stringify "2.1.1" + iterare "1.2.1" + path-to-regexp "3.3.0" + tslib "2.8.1" + "@nestjs/core@^9.4.0": version "9.4.3" resolved "https://registry.yarnpkg.com/@nestjs/core/-/core-9.4.3.tgz#7d6d3417e18c0a598684b87c955e4caac4f56dd4" @@ -555,6 +1166,27 @@ dependencies: eventemitter2 "6.4.9" +"@nestjs/mapped-types@2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@nestjs/mapped-types/-/mapped-types-2.0.6.tgz#d2d8523709fd5d872a9b9e0c38162746e2a7f44e" + integrity sha512-84ze+CPfp1OWdpRi1/lOu59hOhTz38eVzJvRKrg9ykRFwDz+XleKfMsG0gUqNZYFa6v53XYzeD+xItt8uDW7NQ== + +"@nestjs/passport@^10.0.3": + version "10.0.3" + resolved "https://registry.yarnpkg.com/@nestjs/passport/-/passport-10.0.3.tgz#26ec5b2167d364e04962c115fcef80d10e185367" + integrity sha512-znJ9Y4S8ZDVY+j4doWAJ8EuuVO7SkQN3yOBmzxbGaXbvcSwFDAdGJ+OMCg52NdzIO4tQoN4pYKx8W6M0ArfFRQ== + +"@nestjs/platform-express@^10.0.0": + version "10.4.15" + resolved "https://registry.yarnpkg.com/@nestjs/platform-express/-/platform-express-10.4.15.tgz#117fe7470c2b93e4ac07687b7fa604a17ca240c5" + integrity sha512-63ZZPkXHjoDyO7ahGOVcybZCRa7/Scp6mObQKjcX/fTEq1YJeU75ELvMsuQgc8U2opMGOBD7GVuc4DV0oeDHoA== + dependencies: + body-parser "1.20.3" + cors "2.8.5" + express "4.21.2" + multer "1.4.4-lts.1" + tslib "2.8.1" + "@nestjs/platform-express@^9.4.0": version "9.4.3" resolved "https://registry.yarnpkg.com/@nestjs/platform-express/-/platform-express-9.4.3.tgz#f61b75686bdfce566be3b54fa7bb20a4d87ed619" @@ -574,6 +1206,43 @@ cron "2.4.3" uuid "9.0.1" +"@nestjs/schematics@^10.0.0", "@nestjs/schematics@^10.0.1": + version "10.2.3" + resolved "https://registry.yarnpkg.com/@nestjs/schematics/-/schematics-10.2.3.tgz#6053f43c5065b9e825cd08c4db1bf6bcbc9a6a62" + integrity sha512-4e8gxaCk7DhBxVUly2PjYL4xC2ifDFexCqq1/u4TtivLGXotVk0wHdYuPYe1tHTHuR1lsOkRbfOCpkdTnigLVg== + dependencies: + "@angular-devkit/core" "17.3.11" + "@angular-devkit/schematics" "17.3.11" + comment-json "4.2.5" + jsonc-parser "3.3.1" + pluralize "8.0.0" + +"@nestjs/swagger@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@nestjs/swagger/-/swagger-8.1.1.tgz#18d61a995b6b17759bca361474904d69c4406093" + integrity sha512-5Mda7H1DKnhKtlsb0C7PYshcvILv8UFyUotHzxmWh0G65Z21R3LZH/J8wmpnlzL4bmXIfr42YwbEwRxgzpJ5sQ== + dependencies: + "@microsoft/tsdoc" "^0.15.0" + "@nestjs/mapped-types" "2.0.6" + js-yaml "4.1.0" + lodash "4.17.21" + path-to-regexp "3.3.0" + swagger-ui-dist "5.18.2" + +"@nestjs/testing@^10.0.0": + version "10.4.15" + resolved "https://registry.yarnpkg.com/@nestjs/testing/-/testing-10.4.15.tgz#4c9fe17bf026c0142040cbe3db464c526f89d36a" + integrity sha512-eGlWESkACMKti+iZk1hs6FUY/UqObmMaa8HAN9JLnaYkoLf1Jeh+EuHlGnfqo/Rq77oznNLIyaA3PFjrFDlNUg== + dependencies: + tslib "2.8.1" + +"@nestjs/typeorm@^10.0.2": + version "10.0.2" + resolved "https://registry.yarnpkg.com/@nestjs/typeorm/-/typeorm-10.0.2.tgz#25e3ec3c9a127b085c06fd7ea25f8690dba145c2" + integrity sha512-H738bJyydK4SQkRCTeh1aFBxoO1E9xdL/HaLGThwrqN95os5mEyAtK7BLADOS+vldP4jDZ2VQPLj4epWwRqCeQ== + dependencies: + uuid "9.0.1" + "@noble/curves@^1.3.0": version "1.7.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.7.0.tgz#0512360622439256df892f21d25b388f52505e45" @@ -604,7 +1273,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -1042,6 +1711,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@polkadot-api/json-rpc-provider-proxy@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz#6e191f28e7d0fbbe8b540fc51d12a0adaeba297e" @@ -1661,6 +2335,11 @@ resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== +"@scarf/scarf@=1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@scarf/scarf/-/scarf-1.4.0.tgz#3bbb984085dbd6d982494538b523be1ce6562972" + integrity sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ== + "@scure/base@^1.1.1", "@scure/base@^1.1.7": version "1.2.1" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.1.tgz#dd0b2a533063ca612c17aa9ad26424a2ff5aa865" @@ -1722,6 +2401,25 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== +"@sinonjs/commons@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== + dependencies: + "@sinonjs/commons" "^3.0.0" + +"@sqltools/formatter@^1.2.5": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.5.tgz#3abc203c79b8c3e90fd6c156a0c62d5403520e12" + integrity sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw== + "@subql/cli@^5.4.0": version "5.4.0" resolved "https://registry.yarnpkg.com/@subql/cli/-/cli-5.4.0.tgz#8974ff915a909c76f9cf05160a5ba27c2dbd00dd" @@ -1971,6 +2669,39 @@ dependencies: tslib "^2.4.0" +"@types/babel__core@^7.1.14": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== + dependencies: + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.8" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" + integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== + dependencies: + "@babel/types" "^7.20.7" + "@types/bn.js@^5.1.6": version "5.1.6" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.6.tgz#9ba818eec0c85e4d3c679518428afdf611d03203" @@ -2007,6 +2738,11 @@ dependencies: "@types/node" "*" +"@types/cookiejar@^2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@types/cookiejar/-/cookiejar-2.1.5.tgz#14a3e83fa641beb169a2dd8422d91c3c345a9a78" + integrity sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q== + "@types/debug@^4.1.7": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" @@ -2062,11 +2798,45 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/graceful-fs@^4.1.3": + version "4.1.9" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" + integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== + dependencies: + "@types/node" "*" + "@types/http-errors@*": version "2.0.4" resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^29.5.2": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + "@types/json-schema@*", "@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -2095,6 +2865,11 @@ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd" integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg== +"@types/methods@^1.1.4": + version "1.1.4" + resolved "https://registry.yarnpkg.com/@types/methods/-/methods-1.1.4.tgz#d3b7ac30ac47c91054ea951ce9eed07b1051e547" + integrity sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ== + "@types/mime@^1": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" @@ -2129,6 +2904,13 @@ dependencies: undici-types "~6.20.0" +"@types/node@^20.3.1": + version "20.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.13.tgz#26a7d3e72724ed73bc2fd39a66a2ab17e6e19a00" + integrity sha512-RNf+4dEeV69PIvyp++4IKM2vnLXtmp/JovfeQm5P5+qpKb6wHoH7INywLdZ7z+gVX46kgBP/fwJJvZYaHxtdyw== + dependencies: + undici-types "~6.19.2" + "@types/normalize-package-data@^2.4.0": version "2.4.4" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" @@ -2161,6 +2943,11 @@ "@types/node" "*" "@types/send" "*" +"@types/stack-utils@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== + "@types/strip-bom@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2" @@ -2171,6 +2958,24 @@ resolved "https://registry.yarnpkg.com/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz#9aa30c04db212a9a0649d6ae6fd50accc40748a1" integrity sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ== +"@types/superagent@^8.1.0": + version "8.1.9" + resolved "https://registry.yarnpkg.com/@types/superagent/-/superagent-8.1.9.tgz#28bfe4658e469838ed0bf66d898354bcab21f49f" + integrity sha512-pTVjI73witn+9ILmoJdajHGW2jkSaOzhiFYF1Rd3EQ94kymLqB9PjD9ISg7WaALC7+dCHT0FGe9T2LktLq/3GQ== + dependencies: + "@types/cookiejar" "^2.1.5" + "@types/methods" "^1.1.4" + "@types/node" "*" + form-data "^4.0.0" + +"@types/supertest@^6.0.0": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@types/supertest/-/supertest-6.0.2.tgz#2af1c466456aaf82c7c6106c6b5cbd73a5e86588" + integrity sha512-137ypx2lk/wTQbW6An6safu9hXmajAifU/s7szAHLN/FeIm5w7yR0Wkl9fdJMRSHwOn4HLAI0DaB2TOORuhPDg== + dependencies: + "@types/methods" "^1.1.4" + "@types/superagent" "^8.1.0" + "@types/tough-cookie@^4.0.0": version "4.0.5" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" @@ -2186,11 +2991,109 @@ resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd" integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g== -"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" - integrity sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ== - dependencies: +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.8": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/eslint-plugin@^8.0.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.20.0.tgz#b47a398e0e551cb008c60190b804394e6852c863" + integrity sha512-naduuphVw5StFfqp4Gq4WhIBE2gN1GEmMUExpJYknZJdRnc+2gDzB8Z3+5+/Kv33hPQRDGzQO/0opHE72lZZ6A== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "8.20.0" + "@typescript-eslint/type-utils" "8.20.0" + "@typescript-eslint/utils" "8.20.0" + "@typescript-eslint/visitor-keys" "8.20.0" + graphemer "^1.4.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + ts-api-utils "^2.0.0" + +"@typescript-eslint/parser@^8.0.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.20.0.tgz#5caf2230a37094dc0e671cf836b96dd39b587ced" + integrity sha512-gKXG7A5HMyjDIedBi6bUrDcun8GIjnI8qOwVLiY3rx6T/sHP/19XLJOnIq/FgQvWLHja5JN/LSE7eklNBr612g== + dependencies: + "@typescript-eslint/scope-manager" "8.20.0" + "@typescript-eslint/types" "8.20.0" + "@typescript-eslint/typescript-estree" "8.20.0" + "@typescript-eslint/visitor-keys" "8.20.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.20.0.tgz#aaf4198b509fb87a6527c02cfbfaf8901179e75c" + integrity sha512-J7+VkpeGzhOt3FeG1+SzhiMj9NzGD/M6KoGn9f4dbz3YzK9hvbhVTmLj/HiTp9DazIzJ8B4XcM80LrR9Dm1rJw== + dependencies: + "@typescript-eslint/types" "8.20.0" + "@typescript-eslint/visitor-keys" "8.20.0" + +"@typescript-eslint/type-utils@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.20.0.tgz#958171d86b213a3f32b5b16b91db267968a4ef19" + integrity sha512-bPC+j71GGvA7rVNAHAtOjbVXbLN5PkwqMvy1cwGeaxUoRQXVuKCebRoLzm+IPW/NtFFpstn1ummSIasD5t60GA== + dependencies: + "@typescript-eslint/typescript-estree" "8.20.0" + "@typescript-eslint/utils" "8.20.0" + debug "^4.3.4" + ts-api-utils "^2.0.0" + +"@typescript-eslint/types@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.20.0.tgz#487de5314b5415dee075e95568b87a75a3e730cf" + integrity sha512-cqaMiY72CkP+2xZRrFt3ExRBu0WmVitN/rYPZErA80mHjHx/Svgp8yfbzkJmDoQ/whcytOPO9/IZXnOc+wigRA== + +"@typescript-eslint/typescript-estree@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.20.0.tgz#658cea07b7e5981f19bce5cf1662cb70ad59f26b" + integrity sha512-Y7ncuy78bJqHI35NwzWol8E0X7XkRVS4K4P4TCyzWkOJih5NDvtoRDW4Ba9YJJoB2igm9yXDdYI/+fkiiAxPzA== + dependencies: + "@typescript-eslint/types" "8.20.0" + "@typescript-eslint/visitor-keys" "8.20.0" + debug "^4.3.4" + fast-glob "^3.3.2" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^2.0.0" + +"@typescript-eslint/utils@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.20.0.tgz#53127ecd314b3b08836b4498b71cdb86f4ef3aa2" + integrity sha512-dq70RUw6UK9ei7vxc4KQtBRk7qkHZv447OUZ6RPQMQl71I3NZxQJX/f32Smr+iqWrB02pHKn2yAdHBb0KNrRMA== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "8.20.0" + "@typescript-eslint/types" "8.20.0" + "@typescript-eslint/typescript-estree" "8.20.0" + +"@typescript-eslint/visitor-keys@8.20.0": + version "8.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.20.0.tgz#2df6e24bc69084b81f06aaaa48d198b10d382bed" + integrity sha512-v/BpkeeYAsPkKCkR8BDwcno0llhzWVqPOamQrAEMdpZav2Y9OVjd9dwJyBLJWwf335B5DmlifECIkZRJCaGaHA== + dependencies: + "@typescript-eslint/types" "8.20.0" + eslint-visitor-keys "^4.2.0" + +"@ungap/structured-clone@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.1.tgz#28fa185f67daaf7b7a1a8c1d445132c5d979f8bd" + integrity sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA== + +"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" + integrity sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ== + dependencies: "@webassemblyjs/helper-numbers" "1.13.2" "@webassemblyjs/helper-wasm-bytecode" "1.13.2" @@ -2446,12 +3349,29 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ajv-formats@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv@^6.12.5: +ajv@8.12.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2461,6 +3381,16 @@ ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.0: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + dependencies: + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + already@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/already/-/already-2.2.1.tgz#98c257baa0d3fe62d85163ff288235ba11e3f188" @@ -2473,7 +3403,7 @@ ansi-align@^3.0.0: dependencies: string-width "^4.1.0" -ansi-colors@^4.1.1: +ansi-colors@4.1.3, ansi-colors@^4.1.1: version "4.1.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== @@ -2517,7 +3447,12 @@ ansicolors@~0.3.2: resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== -anymatch@~3.1.2: +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + +anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== @@ -2525,6 +3460,11 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +app-root-path@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.1.0.tgz#5971a2fc12ba170369a7a1ef018c71e6e47c2e86" + integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA== + append-field@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56" @@ -2567,6 +3507,11 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng== +array-timsort@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-timsort/-/array-timsort-1.0.3.tgz#3c9e4199e54fb2b9c3fe5976396a21614ef0d926" + integrity sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -2582,6 +3527,11 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== +asap@^2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + asn1js@^3.0.5: version "3.0.5" resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" @@ -2636,6 +3586,69 @@ axios@^1.6.0, axios@^1.7.4: form-data "^4.0.0" proxy-from-env "^1.1.0" +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== + dependencies: + "@jest/transform" "^29.7.0" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^29.6.3" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.1.14" + "@types/babel__traverse" "^7.0.6" + +babel-preset-current-node-syntax@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" + integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== + dependencies: + babel-plugin-jest-hoist "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -2795,6 +3808,20 @@ browserslist@^4.24.0: node-releases "^2.0.18" update-browserslist-db "^1.1.1" +bs-logger@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -2808,6 +3835,14 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + bufferutil@^4.0.1: version "4.0.8" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea" @@ -2891,7 +3926,7 @@ cacheable-request@^6.0.0: normalize-url "^4.1.0" responselike "^1.0.2" -call-bind-apply-helpers@^1.0.0: +call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz#32e5892e6361b29b0b545ba6f7763378daca2840" integrity sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g== @@ -2909,6 +3944,14 @@ call-bind@^1.0.7: get-intrinsic "^1.2.4" set-function-length "^1.2.2" +call-bound@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.3.tgz#41cfd032b593e39176a71533ab4f384aa04fd681" + integrity sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA== + dependencies: + call-bind-apply-helpers "^1.0.1" + get-intrinsic "^1.2.6" + callguard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/callguard/-/callguard-2.0.0.tgz#32f98348ff82cb1dfcf7d1b198108cf4f5b64c1f" @@ -2973,7 +4016,7 @@ chalk@4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^4, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: +chalk@4.1.2, chalk@^4, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -2986,12 +4029,22 @@ chalk@^5.2.0: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== +chalk@^5.3.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.4.1.tgz#1b48bf0963ec158dce2aacf69c093ae2dd2092d8" + integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@^3.5.1: +chokidar@3.6.0, chokidar@^3.5.1, chokidar@^3.5.3: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -3036,6 +4089,11 @@ ci-info@^4.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.1.0.tgz#92319d2fa29d2620180ea5afed31f589bc98cf83" integrity sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A== +cjs-module-lexer@^1.0.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" + integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== + class-transformer@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/class-transformer/-/class-transformer-0.5.1.tgz#24147d5dffd2a6cea930a3250a677addf96ab336" @@ -3074,6 +4132,18 @@ cli-cursor@3.1.0, cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" +cli-highlight@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" + integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== + dependencies: + chalk "^4.0.0" + highlight.js "^10.7.1" + mz "^2.4.0" + parse5 "^5.1.1" + parse5-htmlparser2-tree-adapter "^6.0.0" + yargs "^16.0.0" + cli-progress@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.12.0.tgz#807ee14b66bcc086258e444ad0f19e7d42577942" @@ -3091,6 +4161,15 @@ cli-spinners@^2.5.0: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== +cli-table3@0.6.5: + version "0.6.5" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.5.tgz#013b91351762739c16a9567c21a04632e449bf2f" + integrity sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + cli-width@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" @@ -3150,6 +4229,16 @@ cmd-shim@6.0.3, cmd-shim@^6.0.0: resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-6.0.3.tgz#c491e9656594ba17ac83c4bd931590a9d6e26033" integrity sha512-FMabTRlc5t5zjdenF6mS0MBeFZm0XqHqeOkcskKFb/LYCcRQ5fVgLOHVc4Lq9CqABd9zhjwPjMBCJvMCziSVtA== +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +collect-v8-coverage@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" + integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== + color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -3182,11 +4271,27 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +comment-json@4.2.5: + version "4.2.5" + resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.2.5.tgz#482e085f759c2704b60bc6f97f55b8c01bc41e70" + integrity sha512-bKw/r35jR3HGt5PEPm1ljsQQGyCrR8sFGNiN5L+ykDHdpO8Smxkrkla9Yi6NkQyUrb8V54PGhfMs6NrIwtxtdw== + dependencies: + array-timsort "^1.0.3" + core-util-is "^1.0.3" + esprima "^4.0.1" + has-own-prop "^2.0.0" + repeat-string "^1.6.1" + common-ancestor-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" @@ -3200,6 +4305,11 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" +component-emitter@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.1.tgz#ef1d5796f7d93f135ee6fb684340b26403c97d17" + integrity sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -3337,6 +4447,11 @@ conventional-recommended-bump@7.0.1: git-semver-tags "^5.0.0" meow "^8.1.2" +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" @@ -3362,7 +4477,12 @@ cookie@0.7.2: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== -core-util-is@~1.0.0: +cookiejar@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" + integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== + +core-util-is@^1.0.3, core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== @@ -3385,6 +4505,29 @@ cosmiconfig@9.0.0: js-yaml "^4.1.0" parse-json "^5.2.0" +cosmiconfig@^8.2.0: + version "8.3.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" + integrity sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA== + dependencies: + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + path-type "^4.0.0" + +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -3419,7 +4562,7 @@ cross-fetch@^3.1.6: dependencies: node-fetch "^2.6.12" -cross-spawn@^7.0.0, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -3466,7 +4609,7 @@ dateformat@^3.0.3: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -dayjs@^1.11.12: +dayjs@^1.11.12, dayjs@^1.11.9: version "1.11.13" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c" integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== @@ -3478,7 +4621,7 @@ debug@2.6.9, debug@^2.2.0: dependencies: ms "2.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5: version "4.4.0" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== @@ -3505,7 +4648,7 @@ decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" -dedent@1.5.3: +dedent@1.5.3, dedent@^1.0.0: version "1.5.3" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== @@ -3515,11 +4658,16 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +deepmerge@^4.2.2: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + defaults@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" @@ -3581,6 +4729,11 @@ detect-libc@^2.0.1: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + detect-port@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-1.6.1.tgz#45e4073997c5f292b957cb678fb0bb8ed4250a67" @@ -3589,6 +4742,14 @@ detect-port@^1.6.1: address "^1.0.1" debug "4" +dezalgo@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.4.tgz#751235260469084c132157dfa857f386d4c33d81" + integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig== + dependencies: + asap "^2.0.0" + wrappy "1" + diff-sequences@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" @@ -3606,6 +4767,13 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dot-prop@^5.1.0, dot-prop@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" @@ -3613,6 +4781,11 @@ dot-prop@^5.1.0, dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" +dotenv-expand@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37" + integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A== + dotenv-expand@~11.0.6: version "11.0.7" resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-11.0.7.tgz#af695aea007d6fdc84c86cd8d0ad7beb40a0bd08" @@ -3620,7 +4793,12 @@ dotenv-expand@~11.0.6: dependencies: dotenv "^16.4.5" -dotenv@^16.4.5, dotenv@~16.4.5: +dotenv@16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + +dotenv@^16.0.3, dotenv@^16.4.5, dotenv@~16.4.5: version "16.4.7" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26" integrity sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ== @@ -3639,6 +4817,15 @@ dunder-proto@^1.0.0: es-errors "^1.3.0" gopd "^1.2.0" +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" + duplexer3@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e" @@ -3678,6 +4865,11 @@ electron-to-chromium@^1.5.41: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.71.tgz#d8b5dba1e55b320f2f4e9b1ca80738f53fcfec2b" integrity sha512-dB68l59BI75W1BUGVTAEJy45CEVuEGy9qPVVQ8pnHyHMn36PLPPoE1mjLH+lo9rKulO3HC2OhbACI/8tCqJBcA== +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -3725,6 +4917,14 @@ enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: graceful-fs "^4.2.4" tapable "^2.2.0" +enhanced-resolve@^5.7.0: + version "5.18.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.0.tgz#91eb1db193896b9801251eeff1c6980278b1e404" + integrity sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + enquirer@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -3774,6 +4974,13 @@ es-module-lexer@^1.2.1: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== +es-object-atoms@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" + integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + dependencies: + es-errors "^1.3.0" + es5-ext@^0.10.35, es5-ext@^0.10.62, es5-ext@^0.10.63, es5-ext@^0.10.64, es5-ext@~0.10.14: version "0.10.64" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" @@ -3816,7 +5023,7 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== -escape-string-regexp@4.0.0: +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -3843,6 +5050,19 @@ escodegen@^1.13.0: optionalDependencies: source-map "~0.6.1" +eslint-config-prettier@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + +eslint-plugin-prettier@^5.0.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.2.tgz#d1f068f65dc8490f102eda21d1f4cd150c205211" + integrity sha512-1yI3/hf35wmlq66C8yOyrujQnel+v5l1Vop5Cl2I6ylyNTT1JbuUUnV3/41PzwTzcyDp/oF0jWE3HXvcH5AQOQ== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" + eslint-scope@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -3851,11 +5071,68 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-visitor-keys@^3.4.1: +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== +eslint-visitor-keys@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" + integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== + +eslint@^8.0.0: + version "8.57.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" + integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.1" + "@humanwhocodes/config-array" "^0.13.0" + "@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" + esniff@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" @@ -3866,7 +5143,7 @@ esniff@^2.0.1: event-emitter "^0.3.5" type "^2.7.2" -espree@^9.0.0: +espree@^9.0.0, espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== @@ -3880,6 +5157,13 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esquery@^1.4.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== + dependencies: + estraverse "^5.1.0" + esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" @@ -3950,6 +5234,37 @@ execa@5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expect@^29.0.0, expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + exponential-backoff@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.1.tgz#64ac7526fe341ab18a39016cd22c787d01e00bf6" @@ -4006,7 +5321,7 @@ express@4.18.2: utils-merge "1.0.1" vary "~1.1.2" -express@^4.19.2, express@^4.21.0: +express@4.21.2, express@^4.19.2, express@^4.21.0: version "4.21.2" resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== @@ -4059,11 +5374,16 @@ external-editor@^3.0.3, external-editor@^3.1.0: iconv-lite "^0.4.24" tmp "^0.0.33" -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.2.9: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -4075,12 +5395,23 @@ fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@^2.0.0: +fast-glob@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818" + integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg== + 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.8" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== @@ -4090,11 +5421,16 @@ fast-redact@^3.0.0: resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.5.0.tgz#e9ea02f7e57d0cd8438180083e93077e496285e4" integrity sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A== -fast-safe-stringify@2.1.1, fast-safe-stringify@^2.0.8: +fast-safe-stringify@2.1.1, fast-safe-stringify@^2.0.8, fast-safe-stringify@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== +fast-uri@^3.0.1: + version "3.0.5" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.5.tgz#19f5f9691d0dab9b85861a7bb5d98fca961da9cd" + integrity sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q== + fastq@^1.6.0: version "1.17.1" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" @@ -4102,6 +5438,13 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" +fb-watchman@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + fetch-blob@^3.1.2, fetch-blob@^3.1.4: version "3.2.0" resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" @@ -4128,13 +5471,20 @@ fflate@^0.8.2: resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea" integrity sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A== -figures@3.2.0, figures@^3.0.0: +figures@3.2.0, figures@^3.0.0, figures@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== dependencies: escape-string-regexp "^1.0.5" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + filelist@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" @@ -4190,6 +5540,23 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" + flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -4200,7 +5567,7 @@ flatstr@^1.0.12: resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931" integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw== -flatted@^3.3.1: +flatted@^3.2.9, flatted@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.2.tgz#adba1448a9841bec72b42c532ea23dbbedef1a27" integrity sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA== @@ -4218,6 +5585,24 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +fork-ts-checker-webpack-plugin@9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-9.0.2.tgz#c12c590957837eb02b02916902dcf3e675fd2b1e" + integrity sha512-Uochze2R8peoN1XqlSi/rGUkDQpRogtLFocP9+PGu68zk1BDAKXfdeCdyVZpgTk8V8WFVQXdEz426VKjXLO1Gg== + dependencies: + "@babel/code-frame" "^7.16.7" + chalk "^4.1.2" + chokidar "^3.5.3" + cosmiconfig "^8.2.0" + deepmerge "^4.2.2" + fs-extra "^10.0.0" + memfs "^3.4.1" + minimatch "^3.0.4" + node-abort-controller "^3.0.1" + schema-utils "^3.1.1" + semver "^7.3.5" + tapable "^2.2.1" + form-data@^4.0.0, form-data@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" @@ -4234,6 +5619,15 @@ formdata-polyfill@^4.0.10: dependencies: fetch-blob "^3.1.2" +formidable@^3.5.1: + version "3.5.2" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-3.5.2.tgz#207c33fecdecb22044c82ba59d0c63a12fb81d77" + integrity sha512-Jqc1btCy3QzRbJaICGwKcBfGWuLADRerLzDqi2NwSt/UkXLsHJw2TVResiaoBufHVHy9aSgClOHCeJsSsFLTbg== + dependencies: + dezalgo "^1.0.4" + hexoid "^2.0.0" + once "^1.4.0" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -4256,6 +5650,15 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== +fs-extra@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^11.2.0: version "11.2.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" @@ -4279,6 +5682,11 @@ fs-minipass@^3.0.0: dependencies: minipass "^7.0.3" +fs-monkey@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.6.tgz#8ead082953e88d992cf3ff844faa907b26756da2" + integrity sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -4289,7 +5697,7 @@ fs@^0.0.1-security: resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4" integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w== -fsevents@~2.3.2: +fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -4304,6 +5712,11 @@ fuzzy@^0.1.3: resolved "https://registry.yarnpkg.com/fuzzy/-/fuzzy-0.1.3.tgz#4c76ec2ff0ac1a36a9dccf9a00df8623078d4ed8" integrity sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w== +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -4323,6 +5736,22 @@ get-intrinsic@^1.2.4: has-symbols "^1.1.0" hasown "^2.0.2" +get-intrinsic@^1.2.5, get-intrinsic@^1.2.6: + version "1.2.7" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.7.tgz#dcfcb33d3272e15f445d15124bc0a216189b9044" + integrity sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + function-bind "^1.1.2" + get-proto "^1.0.0" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -4343,6 +5772,14 @@ get-port@5.1.1, get-port@^5.1.1: resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== +get-proto@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== + dependencies: + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" + get-stream@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.0.tgz#3e0012cb6827319da2706e601a1583e8629a6718" @@ -4414,7 +5851,7 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" -glob-parent@6.0.2: +glob-parent@6.0.2, glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== @@ -4433,7 +5870,7 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^10.2.2, glob@^10.3.10, glob@^10.3.7, glob@^10.4: +glob@10.4.5, glob@^10.2.2, glob@^10.3.10, glob@^10.3.7, glob@^10.4: version "10.4.5" resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== @@ -4445,7 +5882,7 @@ glob@^10.2.2, glob@^10.3.10, glob@^10.3.7, glob@^10.4: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^7.1.3: +glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -4485,6 +5922,18 @@ global-dirs@^3.0.0: dependencies: ini "2.0.0" +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^13.19.0: + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== + dependencies: + type-fest "^0.20.2" + globby@11.1.0, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" @@ -4519,11 +5968,16 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6: +graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + graphql-tag@^2.12.6: version "2.12.6" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" @@ -4563,6 +6017,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-own-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" + integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== + has-property-descriptors@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" @@ -4600,6 +6059,16 @@ hasura-cli@2.36.2: axios "^1.6.0" chalk-template "^1.1.0" +hexoid@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-2.0.0.tgz#fb36c740ebbf364403fa1ec0c7efd268460ec5b9" + integrity sha512-qlspKUK7IlSQv2o+5I7yhUd7TxlOG2Vr5LTa3ve2XSNVKAL/n/u/7KLvKmFNimomDIKvZFXWHv0T12mv7rT8Aw== + +highlight.js@^10.7.1: + version "10.7.3" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" + integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== + hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" @@ -4626,6 +6095,11 @@ hosted-git-info@^7.0.0, hosted-git-info@^7.0.2: dependencies: lru-cache "^10.0.1" +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" @@ -4682,7 +6156,7 @@ iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -4694,12 +6168,12 @@ ignore-walk@^6.0.4: dependencies: minimatch "^9.0.0" -ignore@^5.0.4, ignore@^5.2.0: +ignore@^5.0.4, ignore@^5.2.0, ignore@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== -import-fresh@^3.3.0: +import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -4720,6 +6194,14 @@ import-local@3.1.0: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" +import-local@^3.0.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -4743,7 +6225,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -4776,7 +6258,7 @@ init-package-json@6.0.3: validate-npm-package-license "^3.0.4" validate-npm-package-name "^5.0.0" -inquirer@^8.2.4: +inquirer@8.2.6, inquirer@^8.2.4: version "8.2.6" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.6.tgz#733b74888195d8d400a67ac332011b5fae5ea562" integrity sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg== @@ -4797,6 +6279,27 @@ inquirer@^8.2.4: through "^2.3.6" wrap-ansi "^6.0.1" +inquirer@9.2.15: + version "9.2.15" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.15.tgz#2135a36190a6e5c92f5d205e0af1fea36b9d3492" + integrity sha512-vI2w4zl/mDluHt9YEQ/543VTCwPKWiHzKtm9dM2V0NdFcqEexDAjUHzO1oA60HRNaVifGXXM1tRRNluLVHa0Kg== + dependencies: + "@ljharb/through" "^2.3.12" + ansi-escapes "^4.3.2" + chalk "^5.3.0" + cli-cursor "^3.1.0" + cli-width "^4.1.0" + external-editor "^3.1.0" + figures "^3.2.0" + lodash "^4.17.21" + mute-stream "1.0.0" + ora "^5.4.1" + run-async "^3.0.0" + rxjs "^7.8.1" + string-width "^4.2.3" + strip-ansi "^6.0.1" + wrap-ansi "^6.2.0" + ioredis@^5.3.2, ioredis@^5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" @@ -4858,6 +6361,13 @@ is-core-module@^2.13.0, is-core-module@^2.5.0: dependencies: hasown "^2.0.2" +is-core-module@^2.16.0: + version "2.16.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" + integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== + dependencies: + hasown "^2.0.2" + is-docker@^2.0.0, is-docker@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" @@ -4873,7 +6383,12 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -4913,7 +6428,7 @@ is-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== -is-path-inside@^3.0.2: +is-path-inside@^3.0.2, is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== @@ -5001,6 +6516,59 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + +istanbul-lib-instrument@^5.0.4: + version "5.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + iterare@1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/iterare/-/iterare-1.2.1.tgz#139c400ff7363690e33abffa33cbba8920f00042" @@ -5030,20 +6598,343 @@ javascript-stringify@^2.0.1: resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79" integrity sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg== -"jest-diff@>=29.4.3 < 30", jest-diff@^29.4.1: +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== + dependencies: + execa "^5.0.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^1.0.0" + is-generator-fn "^2.0.0" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== + dependencies: + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + chalk "^4.0.0" + create-jest "^29.7.0" + exit "^0.1.2" + import-local "^3.0.2" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +"jest-diff@>=29.4.3 < 30", jest-diff@^29.4.1, jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== + dependencies: + detect-newline "^3.0.0" + +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== + dependencies: + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + +jest-pnp-resolver@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== + dependencies: + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" + +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-pnp-resolver "^1.2.2" + jest-util "^29.7.0" + jest-validate "^29.7.0" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== + dependencies: + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + +jest-util@^29.0.0, jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" - integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: + "@jest/types" "^29.6.3" + camelcase "^6.2.0" chalk "^4.0.0" - diff-sequences "^29.6.3" jest-get-type "^29.6.3" + leven "^3.1.0" pretty-format "^29.7.0" -jest-get-type@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" - integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== + dependencies: + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.7.0" + string-length "^4.0.1" jest-worker@^27.4.5: version "27.5.1" @@ -5054,6 +6945,26 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^29.5.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== + dependencies: + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" + import-local "^3.0.2" + jest-cli "^29.7.0" + js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" @@ -5112,11 +7023,21 @@ jsdoc@^4.0.0: strip-json-comments "^3.1.0" underscore "~1.13.2" +jsesc@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" + integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== + json-buffer@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" integrity sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ== +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -5137,6 +7058,16 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json-stringify-nice@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz#2c937962b80181d3f317dd39aa323e14f5a60a67" @@ -5157,6 +7088,16 @@ jsonc-parser@3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== +jsonc-parser@3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" + integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== + +jsonc-parser@3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" + integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" @@ -5188,6 +7129,13 @@ keyv@^3.0.0: dependencies: json-buffer "3.0.0" +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" @@ -5200,6 +7148,11 @@ klaw@^3.0.0: dependencies: graceful-fs "^4.1.9" +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + latest-version@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-5.1.0.tgz#119dfe908fe38d15dfa43ecd13fa12ec8832face" @@ -5294,6 +7247,19 @@ lerna@^8.1.8: yargs "17.7.2" yargs-parser "21.1.1" +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -5395,6 +7361,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.defaults@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" @@ -5410,7 +7383,17 @@ lodash.ismatch@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g== -lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21: +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash@4.17.21, lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -5455,6 +7438,13 @@ lru-cache@^10.0.1, lru-cache@^10.2.0, lru-cache@^10.2.2: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -5472,7 +7462,14 @@ luxon@~3.3.0: resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.3.0.tgz#d73ab5b5d2b49a461c47cedbc7e73309b4805b48" integrity sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg== -make-dir@4.0.0: +magic-string@0.30.8: + version "0.30.8" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.8.tgz#14e8624246d2bedba70d5462aa99ac9681844613" + integrity sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ== + dependencies: + "@jridgewell/sourcemap-codec" "^1.4.15" + +make-dir@4.0.0, make-dir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== @@ -5494,7 +7491,7 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" -make-error@^1.1.1: +make-error@^1.1.1, make-error@^1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -5517,6 +7514,13 @@ make-fetch-happen@^13.0.0, make-fetch-happen@^13.0.1: promise-retry "^2.0.1" ssri "^10.0.0" +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + map-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" @@ -5549,6 +7553,11 @@ marked@^4.0.10: resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== + mdurl@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0" @@ -5559,6 +7568,13 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== +memfs@^3.4.1: + version "3.6.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" + integrity sha512-EGowvkkgbMcIChjMTMkESFDbZeSh8xZ7kNSF0hAiAN4Jh6jgHCRS0Ga/+C8y6Au+oqpezRHCfPsmJ2+DwAgiwQ== + dependencies: + fs-monkey "^1.0.4" + meow@^13.1.0: version "13.2.0" resolved "https://registry.yarnpkg.com/meow/-/meow-13.2.0.tgz#6b7d63f913f984063b3cc261b6e8800c4cd3474f" @@ -5608,12 +7624,12 @@ merkle-tools@^1.4.1: dependencies: js-sha3 "^0.8.0" -methods@~1.1.2: +methods@^1.1.2, methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== -micromatch@^4.0.0, micromatch@^4.0.4: +micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== @@ -5638,6 +7654,11 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== +mime@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" + integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -5667,7 +7688,7 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -5798,6 +7819,11 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mkdirp@^2.1.3: + version "2.1.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" + integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== + mkdirp@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" @@ -5890,11 +7916,25 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mute-stream@^1.0.0: +mute-stream@1.0.0, mute-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e" integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA== +mz@^2.4.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + natural-orderby@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/natural-orderby/-/natural-orderby-2.0.3.tgz#8623bc518ba162f8ff1cdb8941d74deb0fdcc016" @@ -5929,7 +7969,7 @@ nock@^13.5.4, nock@^13.5.5: json-stringify-safe "^5.0.1" propagate "^2.0.0" -node-abort-controller@^3.1.1: +node-abort-controller@^3.0.1, node-abort-controller@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== @@ -5939,6 +7979,13 @@ node-domexception@^1.0.0: resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== +node-emoji@1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" + integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== + dependencies: + lodash "^4.17.21" + node-fetch@2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -5990,6 +8037,11 @@ node-gyp@^10.0.0: tar "^6.2.1" which "^4.0.0" +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + node-machine-id@1.1.12: version "1.1.12" resolved "https://registry.yarnpkg.com/node-machine-id/-/node-machine-id-1.1.12.tgz#37904eee1e59b320bb9c5d6c0a59f3b469cb6267" @@ -6173,12 +8225,12 @@ npm-run-path@^4.0.1: "@nx/nx-win32-arm64-msvc" "20.2.1" "@nx/nx-win32-x64-msvc" "20.2.1" -object-assign@^4, object-assign@^4.1.1: +object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -object-inspect@^1.13.1: +object-inspect@^1.13.1, object-inspect@^1.13.3: version "1.13.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.3.tgz#f14c183de51130243d6d18ae149375ff50ea488a" integrity sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA== @@ -6245,6 +8297,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.5" + ora@5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/ora/-/ora-5.3.0.tgz#fb832899d3a1372fe71c8b2c534bbfe74961bb6f" @@ -6259,7 +8323,7 @@ ora@5.3.0: strip-ansi "^6.0.0" wcwidth "^1.0.1" -ora@^5.4.1: +ora@5.4.1, ora@^5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== @@ -6303,6 +8367,13 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" +p-limit@^3.0.2, p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -6317,6 +8388,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-map-series@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-2.1.0.tgz#7560d4c452d9da0c07e692fdbfe6e2c81a2a91f2" @@ -6457,11 +8535,36 @@ parse-url@^8.1.0: dependencies: parse-path "^7.0.0" +parse5-htmlparser2-tree-adapter@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + +parse5@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" + integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== + +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== +passport-headerapikey@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/passport-headerapikey/-/passport-headerapikey-1.2.2.tgz#b71960523999c9864151b8535c919e3ff5ba75ce" + integrity sha512-4BvVJRrWsNJPrd3UoZfcnnl4zvUWYKEtfYkoDsaOKBsrWHYmzTApCjs7qUbncOLexE9ul0IRiYBFfBG0y9IVQA== + dependencies: + lodash "^4.17.15" + passport-strategy "^1.0.0" + passport-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/passport-local/-/passport-local-1.0.0.tgz#1fe63268c92e75606626437e3b906662c15ba6ee" @@ -6469,7 +8572,7 @@ passport-local@^1.0.0: dependencies: passport-strategy "1.x.x" -passport-strategy@1.x.x: +passport-strategy@1.x.x, passport-strategy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/passport-strategy/-/passport-strategy-1.0.0.tgz#b5539aa8fc225a3d1ad179476ddf236b440f52e4" integrity sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA== @@ -6483,6 +8586,15 @@ passport@^0.6.0: pause "0.0.1" utils-merge "^1.0.1" +passport@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/passport/-/passport-0.7.0.tgz#3688415a59a48cf8068417a8a8092d4492ca3a05" + integrity sha512-cPLl+qZpSc+ireUvt+IzqbED1cHHkDoVYMo30jbJIdOOjQ1MQYZBPiNvmi8UM6lJuOpTPXJGZQk0DtC4y61MYQ== + dependencies: + passport-strategy "1.x.x" + pause "0.0.1" + utils-merge "^1.0.1" + password-prompt@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/password-prompt/-/password-prompt-1.1.3.tgz#05e539f4e7ca4d6c865d479313f10eb9db63ee5f" @@ -6539,6 +8651,11 @@ path-to-regexp@3.2.0: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.2.0.tgz#fa7877ecbc495c601907562222453c43cc204a5f" integrity sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA== +path-to-regexp@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.3.0.tgz#f7f31d32e8518c2660862b644414b6d5c63a611b" + integrity sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw== + path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -6592,7 +8709,7 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^8.12.0, pg@^8.13.0: +pg@^8.12.0, pg@^8.13.0, pg@^8.13.1: version "8.13.1" resolved "https://registry.yarnpkg.com/pg/-/pg-8.13.1.tgz#6498d8b0a87ff76c2df7a32160309d3168c0c080" integrity sha512-OUir1A0rPNZlX//c7ksiu7crsGZTKSOXJPgtNiHGIlC9H0lO+NC6ZDYksSgBYY/thSWhnSRBv8w1lieNNGATNQ== @@ -6617,7 +8734,12 @@ picocolors@^1.0.0, picocolors@^1.1.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: +picomatch@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.1.tgz#68c26c8837399e5819edce48590412ea07f17a07" + integrity sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -6660,6 +8782,11 @@ pino@^6.13.3: quick-format-unescaped "^4.0.3" sonic-boom "^1.0.2" +pirates@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -6667,6 +8794,11 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +pluralize@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + postcss-selector-parser@^6.0.10: version "6.1.2" resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz#27ecb41fb0e3b6ba7a1ec84fff347f734c7929de" @@ -6697,6 +8829,11 @@ postgres-interval@^1.1.0: dependencies: xtend "^4.0.0" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -6707,7 +8844,19 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA== -pretty-format@^29.7.0: +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^3.0.0: + version "3.4.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f" + integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ== + +pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -6774,6 +8923,14 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" +prompts@^2.0.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + promzard@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/promzard/-/promzard-1.0.2.tgz#2226e7c6508b1da3471008ae17066a7c3251e660" @@ -6897,6 +9054,11 @@ pupa@^2.1.1: dependencies: escape-goat "^2.0.0" +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== + pvtsutils@^1.3.2, pvtsutils@^1.3.5: version "1.3.6" resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.6.tgz#ec46e34db7422b9e4fdc5490578c1883657d6001" @@ -6923,6 +9085,13 @@ qs@6.13.0: dependencies: side-channel "^1.0.6" +qs@^6.11.0: + version "6.14.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.0.tgz#c63fa40680d2c5c941412a0e899c89af60c0a930" + integrity sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w== + dependencies: + side-channel "^1.1.0" + querystringify@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" @@ -7124,6 +9293,11 @@ reflect-metadata@^0.1.14: resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.14.tgz#24cf721fe60677146bb77eeb0e1f9dece3d65859" integrity sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A== +reflect-metadata@^0.2.0, reflect-metadata@^0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.2.2.tgz#400c845b6cba87a21f2c65c4aeb158f4fa4d9c5b" + integrity sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q== + registry-auth-token@^4.0.0: version "4.2.2" resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.2.2.tgz#f02d49c3668884612ca031419491a13539e21fac" @@ -7143,11 +9317,21 @@ rehackt@^0.1.0: resolved "https://registry.yarnpkg.com/rehackt/-/rehackt-0.1.0.tgz#a7c5e289c87345f70da8728a7eb878e5d03c696b" integrity sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw== +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -7177,6 +9361,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve.exports@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" + integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== + resolve@^1.0.0, resolve@^1.10.0: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" @@ -7186,6 +9375,15 @@ resolve@^1.0.0, resolve@^1.10.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@^1.20.0: + version "1.22.10" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" + integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + dependencies: + is-core-module "^2.16.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + response-iterator@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" @@ -7228,6 +9426,13 @@ rimraf@^2.6.1: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + rimraf@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-4.4.1.tgz#bd33364f67021c5b79e93d7f4fa0568c7c21b755" @@ -7252,6 +9457,11 @@ run-async@^2.4.0: resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== +run-async@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-3.0.0.tgz#42a432f6d76c689522058984384df28be379daad" + integrity sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -7259,14 +9469,14 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^7.5.5, rxjs@^7.8.1: +rxjs@7.8.1, rxjs@^7.5.5, rxjs@^7.8.1: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== dependencies: tslib "^2.1.0" -safe-buffer@5.2.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: +safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -7307,12 +9517,12 @@ semver-diff@^3.1.1: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3: +semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -7409,6 +9619,14 @@ setprototypeof@1.2.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== +sha.js@^2.4.11: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -7428,6 +9646,35 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +side-channel-list@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" + integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + +side-channel-map@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" + integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + +side-channel-weakmap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" + integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + side-channel-map "^1.0.1" + side-channel@^1.0.4, side-channel@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" @@ -7438,7 +9685,18 @@ side-channel@^1.0.4, side-channel@^1.0.6: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3: +side-channel@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" + integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + side-channel-list "^1.0.0" + side-channel-map "^1.0.1" + side-channel-weakmap "^1.0.2" + +signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -7469,6 +9727,11 @@ simple-git@^3.25.0: "@kwsites/promise-deferred" "^1.1.1" debug "^4.3.5" +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + slash@3.0.0, slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -7527,7 +9790,15 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" -source-map-support@^0.5.12, source-map-support@~0.5.20: +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-support@^0.5.12, source-map-support@^0.5.21, source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== @@ -7535,16 +9806,16 @@ source-map-support@^0.5.12, source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" +source-map@0.7.4, source-map@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" - integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== - spdx-correct@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" @@ -7607,6 +9878,13 @@ ssri@^10.0.0, ssri@^10.0.6: dependencies: minipass "^7.0.3" +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + standard-as-callback@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" @@ -7622,6 +9900,14 @@ streamsearch@^1.1.0: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + "string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -7711,7 +9997,7 @@ strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -strip-json-comments@^3.1.0: +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -7725,6 +10011,29 @@ strong-log-transformer@2.1.0: minimist "^1.2.0" through "^2.3.4" +superagent@^9.0.1: + version "9.0.2" + resolved "https://registry.yarnpkg.com/superagent/-/superagent-9.0.2.tgz#a18799473fc57557289d6b63960610e358bdebc1" + integrity sha512-xuW7dzkUpcJq7QnhOsnNUgtYp3xRwpt2F7abdRYIpCsAt0hhUqia0EdxyXZQQpNmGtsCzYHryaKSV3q3GJnq7w== + dependencies: + component-emitter "^1.3.0" + cookiejar "^2.1.4" + debug "^4.3.4" + fast-safe-stringify "^2.1.1" + form-data "^4.0.0" + formidable "^3.5.1" + methods "^1.1.2" + mime "2.6.0" + qs "^6.11.0" + +supertest@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/supertest/-/supertest-7.0.0.tgz#cac53b3d6872a0b317980b2b0cfa820f09cd7634" + integrity sha512-qlsr7fIC0lSddmA3tzojvzubYxvlGtzumcdHgPwbFWMISQwL22MhM2Y3LNt+6w9Yyx7559VW5ab70dgphm8qQA== + dependencies: + methods "^1.1.2" + superagent "^9.0.1" + supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -7752,12 +10061,34 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -symbol-observable@^4.0.0: +swagger-ui-dist@5.18.2, swagger-ui-dist@>=5.0.0: + version "5.18.2" + resolved "https://registry.yarnpkg.com/swagger-ui-dist/-/swagger-ui-dist-5.18.2.tgz#62013074374d272c04ed3030704b88db5aa8c0b7" + integrity sha512-J+y4mCw/zXh1FOj5wGJvnAajq6XgHOyywsa9yITmwxIlJbMqITq3gYRZHaeqLVH/eV/HOPphE6NjF+nbSNC5Zw== + dependencies: + "@scarf/scarf" "=1.4.0" + +swagger-ui-express@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz#fb8c1b781d2793a6bd2f8a205a3f4bd6fa020dd8" + integrity sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA== + dependencies: + swagger-ui-dist ">=5.0.0" + +symbol-observable@4.0.0, symbol-observable@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== -tapable@^2.1.1, tapable@^2.2.0: +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + +tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== @@ -7830,11 +10161,39 @@ terser@^5.26.0: commander "^2.20.0" source-map-support "~0.5.20" +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + text-extensions@^1.0.0: version "1.9.0" resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -7867,6 +10226,11 @@ tmp@^0.2.1, tmp@~0.2.1: resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w== +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + to-arraybuffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" @@ -7909,7 +10273,7 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -tree-kill@^1.2.2: +tree-kill@1.2.2, tree-kill@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== @@ -7924,6 +10288,11 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== +ts-api-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.0.0.tgz#b9d7d5f7ec9f736f4d0f09758b8607979044a900" + integrity sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ== + ts-invariant@^0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" @@ -7931,6 +10300,32 @@ ts-invariant@^0.10.3: dependencies: tslib "^2.1.0" +ts-jest@^29.1.0: + version "29.2.5" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.2.5.tgz#591a3c108e1f5ebd013d3152142cb5472b399d63" + integrity sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA== + dependencies: + bs-logger "^0.2.6" + ejs "^3.1.10" + fast-json-stable-stringify "^2.1.0" + jest-util "^29.0.0" + json5 "^2.2.3" + lodash.memoize "^4.1.2" + make-error "^1.3.6" + semver "^7.6.3" + yargs-parser "^21.1.1" + +ts-loader@^9.4.3: + version "9.5.2" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.2.tgz#1f3d7f4bb709b487aaa260e8f19b301635d08020" + integrity sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.0.0" + micromatch "^4.0.0" + semver "^7.3.4" + source-map "^0.7.4" + ts-loader@^9.5.1: version "9.5.1" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.1.tgz#63d5912a86312f1fbe32cef0859fb8b2193d9b89" @@ -7977,7 +10372,17 @@ ts-node@^10.4.0, ts-node@^10.9.1, ts-node@^10.9.2: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -tsconfig-paths@^4.1.2: +tsconfig-paths-webpack-plugin@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.2.0.tgz#f7459a8ed1dd4cf66ad787aefc3d37fff3cf07fc" + integrity sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.7.0" + tapable "^2.2.1" + tsconfig-paths "^4.1.2" + +tsconfig-paths@4.2.0, tsconfig-paths@^4.1.2, tsconfig-paths@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c" integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg== @@ -8001,7 +10406,7 @@ tslib@2.5.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.3.tgz#24944ba2d990940e6e982c4bea147aba80209913" integrity sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w== -tslib@^2.0.0, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.2, tslib@^2.6.3, tslib@^2.7.0, tslib@^2.8.0, tslib@^2.8.1: +tslib@2.8.1, tslib@^2.0.0, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.2, tslib@^2.6.3, tslib@^2.7.0, tslib@^2.8.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -8015,6 +10420,13 @@ tuf-js@^2.2.1: debug "^4.3.4" make-fetch-happen "^13.0.1" +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -8022,6 +10434,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + type-fest@^0.18.0: version "0.18.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" @@ -8077,11 +10494,37 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -"typescript@>=3 < 6", typescript@^5.2.2, typescript@^5.5.4: +typeorm@^0.3.20: + version "0.3.20" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.20.tgz#4b61d737c6fed4e9f63006f88d58a5e54816b7ab" + integrity sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q== + dependencies: + "@sqltools/formatter" "^1.2.5" + app-root-path "^3.1.0" + buffer "^6.0.3" + chalk "^4.1.2" + cli-highlight "^2.1.11" + dayjs "^1.11.9" + debug "^4.3.4" + dotenv "^16.0.3" + glob "^10.3.10" + mkdirp "^2.1.3" + reflect-metadata "^0.2.1" + sha.js "^2.4.11" + tslib "^2.5.0" + uuid "^9.0.0" + yargs "^17.6.2" + +typescript@5.7.2, "typescript@>=3 < 6", typescript@^5.2.2, typescript@^5.5.4: version "5.7.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.2.tgz#3169cf8c4c8a828cde53ba9ecb3d2b1d5dd67be6" integrity sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg== +typescript@^5.1.3: + version "5.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" + integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== + uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee" @@ -8133,6 +10576,11 @@ underscore@~1.13.2: resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10" integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g== +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + undici-types@~6.20.0: version "6.20.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" @@ -8271,6 +10719,15 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" + validate-npm-package-license@3.0.4, validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -8307,6 +10764,13 @@ walk-up-path@^3.0.1: resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-3.0.1.tgz#c8d78d5375b4966c717eb17ada73dbd41490e886" integrity sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA== +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + watchpack@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" @@ -8352,12 +10816,17 @@ webpack-merge@^6.0.1: flat "^5.0.2" wildcard "^2.0.1" +webpack-node-externals@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz#1a3407c158d547a9feb4229a9e3385b7b60c9917" + integrity sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ== + webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.94.0: +webpack@5.97.1, webpack@^5.94.0: version "5.97.1" resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.97.1.tgz#972a8320a438b56ff0f1d94ade9e82eac155fa58" integrity sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg== @@ -8446,7 +10915,7 @@ wkx@^0.5.0: dependencies: "@types/node" "*" -word-wrap@~1.2.3: +word-wrap@^1.2.5, word-wrap@~1.2.3: version "1.2.5" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== @@ -8524,6 +10993,14 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + write-json-file@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" @@ -8575,6 +11052,11 @@ yaeti@^0.0.6: resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" @@ -8609,7 +11091,7 @@ yargs-parser@^20.2.2, yargs-parser@^20.2.3: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs@17.7.2, yargs@^17.6.2: +yargs@17.7.2, yargs@^17.3.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -8622,7 +11104,7 @@ yargs@17.7.2, yargs@^17.6.2: y18n "^5.0.5" yargs-parser "^21.1.1" -yargs@^16.2.0: +yargs@^16.0.0, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== @@ -8640,6 +11122,11 @@ yn@3.1.1: resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + yoctocolors-cjs@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz#f4b905a840a37506813a7acaa28febe97767a242" From b357d8a166f3b9eadd283003e0a8d27d5c4b5eec Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:41:25 -0500 Subject: [PATCH 8/8] remove patch script not used anymore --- indexers/patch.sh | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 indexers/patch.sh diff --git a/indexers/patch.sh b/indexers/patch.sh deleted file mode 100644 index 6f788fbfd..000000000 --- a/indexers/patch.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Define the environment variable -ENVIRONMENT=prod # Change this to 'prod' or 'dev' as needed - -# Important, this first assume you already applied the patch as per this PR to your host fetch.service.js -# https://github.com/subquery/subql/pull/2594 - - -docker pause ${ENVIRONMENT}-astral-indexers-node-1 - -docker cp ./node_modules/@subql/node-core/dist/indexer/fetch.service.js ${ENVIRONMENT}-astral-indexers-consensus_subquery_node-1:/node_modules/@subql/node-core/dist/indexer/fetch.service.js - -docker cp ./node_modules/@subql/node-core/dist/indexer/fetch.service.js ${ENVIRONMENT}-astral-indexers-leaderboard_subquery_node-1:/node_modules/@subql/node-core/dist/indexer/fetch.service.js - -docker cp ./node_modules/@subql/node-core/dist/indexer/fetch.service.js ${ENVIRONMENT}-astral-indexers-staking_subquery_node-1:/node_modules/@subql/node-core/dist/indexer/fetch.service.js - -docker cp ./node_modules/@subql/node-core/dist/indexer/fetch.service.js ${ENVIRONMENT}-astral-indexers-files_subquery_node-1:/node_modules/@subql/node-core/dist/indexer/fetch.service.js - -docker unpause ${ENVIRONMENT}-astral-indexers-node-1 \ No newline at end of file