diff --git a/CHAIN_INTEGRATION.md b/CHAIN_INTEGRATION.md new file mode 100644 index 000000000..d0bb5adf0 --- /dev/null +++ b/CHAIN_INTEGRATION.md @@ -0,0 +1,77 @@ +# Substrate Api Sidecar chain integration guide + +This guide aims to help chain builders integrate their Substrate FRAME based chain with Substrate API Sidecar. + +## Table of contents + +- [Polkadot-js API type definition support](#polkadot-js-API-type-definition-support) +- [Controller configuration](controller-configuration) + +## Polkadot-js API type definition support + +In order decode the SCALE encoded data from a substrate based node, polkadot-js needs to have a registry of type definitions. Sidecar pulls in chain type definitions from the [@polkadot/apps-config package hosted on NPM](https://www.npmjs.com/package/@polkadot/apps-config). + +If the chain's type definitions do not already exist in [@polkadot/apps-config](https://github.com/polkadot-js/apps/tree/master/packages/apps-config) they will need to be added via PR to polkadot-js/apps by following their [instructions for API config](https://github.com/polkadot-js/apps/tree/master/packages/apps-config#api). + +Before taking any other steps to integrate a chain with Sidecar, a chain's up-to-date type definitions must be included in a published version of @polkadot/apps-config. + +## Controller configuration + +Sidecar offers the ability to configure which controllers to mount. Sidecar uses a chain's spec name to determine which controller config to use, and if no config is linked to a spec name, then the [default config](/src/chains-config/defaultControllers.ts) is used. + +A chain builder can follow the steps below and submit a chain's controller config via PR, where it will be reviewed and merged once deemed ready by the maintainers. + +#### 1) Create a controller config + + Create a controller config for your chain. The shape of the controller config is specified [here](/src/chains-config/ControllerConfig.ts). The `controller` property has keys from the [controller export](/src/controllers/index.ts), which is an exhaustive collection of the available controller classes. In order to see the path(s) associated with a controller one must look in the controller source code. + + The easiest way to start creating a controller config would be to copy [defaultControllers.ts](/src/chains-config/ControllerConfig.ts) and name the file and export `{specName}Controllers`. Then change the boolean values to indicate wether or not to mount a controller and its paths. Ensure to export the controller config from `chains-config` by adding `export * from './{specName}Controllers.ts'` in [/src/chains-config/index.ts](/src/chains-config/index.ts). + + To determine what controllers to include, one must consider the runtime logic, specifically what pallets the chain uses. It is important to keep in mind the assumptions the service's logic makes and what exact pallets the service queries. + +An example is in order. If we want to use [`PalletsStakingProgressController`](/src/controllers/pallets/PalletsStakingProgressController.ts), first check [`PalletsStakingProgressService.ts`](/src/services/pallets/PalletsStakingProgressService.ts); here we see it queries `staking`, `sessions`, `babe` pallets and makes certain assumptions about how the pallets are used together in the runtime. If we determine that both have all storage items queried, and the assumptions made about the staking system are correct, we can then declare in `{specName}Controllers` (the controller config object) that we want to mount the controller by giving `PalletsStakingProgressController` property `true` as the value (`{ PalletsStakingProgressController: true }`). Finally, we can test it out by starting up Sidecar against our chain and accessing the `pallets/staking/progress` endpoint, verifying that the information returned is correct. + +In some circumstances, a chain may need a new path, modify a path or alter business logic for a path. Path changes that help a chain support wallets will be given priority. Breaking changes to paths are usually rejected. + +##### Basic balance transfer support + +In order to support traditional balance transfers the chain's Sidecar endpoints should support account balance lookup, transaction submission, transaction material retrieval, and block queries. + +To support these features the following endpoints are necessary: + +| Path | Controller | Description | +|:----------------------------------------:|:-----------------------------:|:--------------------------------------------------------------------------:| +| GET `/transaction/material` | TransactionMaterialController | Get all the network information needed to construct a transaction offline. | +| POST `/transaction` | TransactionSubmitController | Submit a transaction to the node's transaction pool. | +| GET `/blocks/head` & `/blocks/{number}` | BlocksController | Get a block. | +| GET `accounts/{accountId}/balance-info` | AccountsBalanceInfoController | Get balance information for an account. | + +#### 2) Update `specToControllerMap` + +In order for Sidecar to use your controller config, the `specToControllerMap` in [/src/chains-config/index.ts](/src/chains-config/index.ts) must be updated with the chain's `specName` and controller config by adding them as a property to `specToControllerMap`: + +```javascript +const specToControllerMap = { + kulupu: kulupuControllers, + mandala: mandalaControllers, + {specName}: {specName}Controllers, +}; +``` + +#### 3) Test + +Run it against a node running your chain in archive mode: + +- Ensure all the expected paths work, including the root path, preferably with tests +- Exercise each query param of every path +- Make sure transaction submission works +- Try out historic queries across runtimes where types might change + +#### 4) Submit your PR + +Make sure it passes lint with `yarn lint --fix` and tests with `yarn test`. Then submit a PR for review. + +#### 5) Maintenance + +- Keep types up-to-date in `@polkadot/apps-config` +- If the business logic or storage of a chain's pallet queried by a Sidecar endpoint is changed, ensure that the corresponding service logic is updated in Sidecar as well diff --git a/README.md b/README.md index 990803470..9ee047a18 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ This service requires Node version 12 or higher. - [Configuration](#configuration) - [Debugging fee and payout calculations](#debugging-fee-and-payout-calculations) - [Available endpoints](https://paritytech.github.io/substrate-api-sidecar/dist/) -- [Chain compatibility](#chain-compatibility) +- [Chain integration guide](/CHAIN_INTEGRATION.md) - [Docker](#docker) - [Note for maintainers](#note-for-maintainers) - [Roadmap](#roadmap) @@ -200,15 +200,9 @@ CALC_DEBUG=1 yarn [Click here for full endpoint docs.](https://paritytech.github.io/substrate-api-sidecar/dist/) -## Chain compatibility +## Chain integration guide -Sidecar should be compatible with any [Substrate](https://substrate.dev/) based chain, given -constraints: - -- The chain ought to use FRAME and the `balances` pallet. -- The chain is being finalized (by running `grandpa`). -- If the chain is running on custom Node binaries, the JSON-RPC API should be backwards compatible - with the default Substrate Node. +[Click here for chain integration guide.](/CHAIN_INTEGRATION.md) ## Docker diff --git a/docs/src/openapi-v1.yaml b/docs/src/openapi-v1.yaml index 8ea7515e9..2b0c1afc3 100755 --- a/docs/src/openapi-v1.yaml +++ b/docs/src/openapi-v1.yaml @@ -45,6 +45,15 @@ paths: description: Block height (as a non-negative integer) or hash (as a hex string). format: unsignedInteger or $hex + - name: token + in: query + description: 'Token to query the balance of. If not specified it will query + the chains native token (e.g. DOT for Polkadot). Note: this is only relevant + for chains that support multiple tokens through the ORML tokens pallet.' + required: false + schema: + type: string + description: Token symbol responses: "200": description: successful operation @@ -717,6 +726,10 @@ components: type: string description: Account nonce. format: unsignedInteger + tokenSymbol: + type: string + description: Token symbol of the balances displayed in this response. + format: unsignedInteger free: type: string description: Free balance of the account. Not equivalent to _spendable_ diff --git a/package.json b/package.json index 83b7580a4..d335fd39d 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "test": "jest --silent" }, "dependencies": { - "@polkadot/api": "^2.9.1", + "@polkadot/api": "^2.10.1", + "@polkadot/apps-config": "^0.70.1", "@polkadot/util-crypto": "^4.2.1", "@substrate/calc": "^0.1.2", "confmgr": "^1.0.6", @@ -52,11 +53,11 @@ "@types/jest": "^26.0.16", "@types/morgan": "^1.9.2", "@types/triple-beam": "^1.3.2", - "@typescript-eslint/eslint-plugin": "4.9.0", - "@typescript-eslint/parser": "4.9.0", - "eslint": "^7.14.0", - "eslint-config-prettier": "^6.15.0", - "eslint-plugin-prettier": "^3.1.4", + "@typescript-eslint/eslint-plugin": "4.9.1", + "@typescript-eslint/parser": "4.9.1", + "eslint": "^7.15.0", + "eslint-config-prettier": "^7.0.0", + "eslint-plugin-prettier": "^3.2.0", "eslint-plugin-simple-import-sort": "^6.0.1", "jest": "^26.6.3", "prettier": "^2.2.1", diff --git a/src/App.ts b/src/App.ts index a6b3d97d2..9633fac4b 100644 --- a/src/App.ts +++ b/src/App.ts @@ -83,6 +83,9 @@ export default class App { listen(): void { this.app.listen(this.port, this.host, () => { console.log(`Listening on http://${this.host}:${this.port}/`); + console.log( + `Check the root endpoint (http://${this.host}:${this.port}/) to see the available endpoints for the current node` + ); }); } diff --git a/src/Config.ts b/src/SidecarConfig.ts similarity index 94% rename from src/Config.ts rename to src/SidecarConfig.ts index b541e1948..fc057bb15 100644 --- a/src/Config.ts +++ b/src/SidecarConfig.ts @@ -2,7 +2,7 @@ import { ConfigManager } from 'confmgr'; import * as configTypes from '../config/types.json'; import { Specs } from './Specs'; -import { CONFIG, ISidecarConfig, MODULES } from './types/config'; +import { CONFIG, ISidecarConfig, MODULES } from './types/sidecar-config'; function hr(): string { return Array(80).fill('━').join(''); @@ -11,7 +11,7 @@ function hr(): string { /** * Access a singleton config object that will be intialized on first use. */ -export class Config { +export class SidecarConfig { private static _config: ISidecarConfig | undefined; /** * Gather env vars for config and make sure they are valid. diff --git a/src/Specs.ts b/src/Specs.ts index 496bc62ef..8a42b8ac8 100644 --- a/src/Specs.ts +++ b/src/Specs.ts @@ -1,6 +1,6 @@ import { ConfigSpecs, SpecsFactory } from 'confmgr'; -import { CONFIG, MODULES } from './types/config'; +import { CONFIG, MODULES } from './types/sidecar-config'; /** * Access a singleton specification for config enviroment variables that will diff --git a/src/chains-config/defaultControllers.ts b/src/chains-config/defaultControllers.ts new file mode 100644 index 000000000..7ff0dd198 --- /dev/null +++ b/src/chains-config/defaultControllers.ts @@ -0,0 +1,30 @@ +import { ControllerConfig } from '../types/chains-config'; + +/** + * Controllers that Sidecar will always default to. This will always be + * the optimal controller selection for Polkadot and Kusama. + */ +export const defaultControllers: ControllerConfig = { + controllers: { + Blocks: true, + AccountsStakingPayouts: true, + AccountsBalanceInfo: true, + AccountsStakingInfo: true, + AccountsVestingInfo: true, + NodeNetwork: true, + NodeVersion: true, + NodeTransactionPool: true, + RuntimeCode: true, + RuntimeSpec: true, + RuntimeMetadata: true, + TransactionDryRun: true, + TransactionMaterial: true, + TransactionFeeEstimate: true, + TransactionSubmit: true, + PalletsStakingProgress: true, + PalletsStorage: true, + }, + options: { + finalizes: true, + }, +}; diff --git a/src/chains-config/index.ts b/src/chains-config/index.ts new file mode 100644 index 000000000..5fb9934f0 --- /dev/null +++ b/src/chains-config/index.ts @@ -0,0 +1,56 @@ +import { ApiPromise } from '@polkadot/api'; +import AbstractController from 'src/controllers/AbstractController'; +import { AbstractService } from 'src/services/AbstractService'; + +import { controllers } from '../controllers'; +import { ControllerConfig } from '../types/chains-config'; +import { defaultControllers } from './defaultControllers'; +import { kulupuControllers } from './kulupuControllers'; +import { mandalaControllers } from './mandalaControllers'; + +const specToControllerMap = { + kulupu: kulupuControllers, + mandala: mandalaControllers, +}; + +/** + * Return an array of instantiated controller instances based off of a `specName`. + * + * @param api ApiPromise to inject into controllers + * @param implName + */ +export function getControllersForSpec( + api: ApiPromise, + specName: string +): AbstractController[] { + if (specToControllerMap[specName]) { + return getControllersFromConfig(api, specToControllerMap[specName]); + } + + // If we don't have the specName in the specToControllerMap we use the default + // contoller config + return getControllersFromConfig(api, defaultControllers); +} + +/** + * Return an array of instantiated controller instances based off of a + * `ControllerConfig`. + * + * @param api ApiPromise to inject into controllers + * @param config controller mount configuration object + */ +function getControllersFromConfig(api: ApiPromise, config: ControllerConfig) { + // If we don't typecast here, tsc thinks its just [string, any][] + const controllersToInclude = Object.entries(config.controllers) as [ + keyof typeof controllers, + boolean + ][]; + + return controllersToInclude.reduce((acc, [controllerName, shouldMount]) => { + if (shouldMount) { + acc.push(new controllers[controllerName](api, config.options)); + } + + return acc; + }, [] as AbstractController[]); +} diff --git a/src/chains-config/kulupuControllers.ts b/src/chains-config/kulupuControllers.ts new file mode 100644 index 000000000..b6000ae4a --- /dev/null +++ b/src/chains-config/kulupuControllers.ts @@ -0,0 +1,26 @@ +import { ControllerConfig } from '../types/chains-config'; + +export const kulupuControllers: ControllerConfig = { + controllers: { + Blocks: true, + AccountsStakingPayouts: false, + AccountsBalanceInfo: true, + AccountsStakingInfo: false, + AccountsVestingInfo: false, + NodeNetwork: true, + NodeVersion: true, + NodeTransactionPool: true, + RuntimeCode: true, + RuntimeSpec: true, + RuntimeMetadata: true, + TransactionDryRun: true, + TransactionMaterial: true, + TransactionFeeEstimate: true, + TransactionSubmit: true, + PalletsStakingProgress: false, + PalletsStorage: true, + }, + options: { + finalizes: false, + }, +}; diff --git a/src/chains-config/mandalaControllers.ts b/src/chains-config/mandalaControllers.ts new file mode 100644 index 000000000..3ec234baf --- /dev/null +++ b/src/chains-config/mandalaControllers.ts @@ -0,0 +1,29 @@ +import { ControllerConfig } from '../types/chains-config'; + +/** + * Controllers for mandala, acala's test network. + */ +export const mandalaControllers: ControllerConfig = { + controllers: { + Blocks: true, + AccountsStakingPayouts: true, + AccountsBalanceInfo: true, + AccountsStakingInfo: true, + AccountsVestingInfo: true, + NodeNetwork: true, + NodeVersion: true, + NodeTransactionPool: true, + RuntimeCode: true, + RuntimeSpec: true, + RuntimeMetadata: true, + TransactionDryRun: true, + TransactionMaterial: true, + TransactionFeeEstimate: true, + TransactionSubmit: true, + PalletsStakingProgress: true, + PalletsStorage: true, + }, + options: { + finalizes: true, + }, +}; diff --git a/src/controllers/accounts/AccountsBalanceInfoController.ts b/src/controllers/accounts/AccountsBalanceInfoController.ts index 355f4daa6..17c1ab637 100644 --- a/src/controllers/accounts/AccountsBalanceInfoController.ts +++ b/src/controllers/accounts/AccountsBalanceInfoController.ts @@ -62,14 +62,19 @@ export default class AccountsBalanceController extends AbstractController = async ( - { params: { address }, query: { at } }, + { params: { address }, query: { at, token } }, res ): Promise => { + const tokenArg = + typeof token === 'string' + ? token.toUpperCase() + : this.api.registry.chainToken; + const hash = await this.getHashFromAt(at); AccountsBalanceController.sanitizedSend( res, - await this.service.fetchAccountBalanceInfo(hash, address) + await this.service.fetchAccountBalanceInfo(hash, address, tokenArg) ); }; } diff --git a/src/controllers/blocks/BlocksController.ts b/src/controllers/blocks/BlocksController.ts index f007611dd..ca95a9ba2 100644 --- a/src/controllers/blocks/BlocksController.ts +++ b/src/controllers/blocks/BlocksController.ts @@ -5,6 +5,10 @@ import { BlocksService } from '../../services'; import { INumberParam } from '../../types/requests'; import AbstractController from '../AbstractController'; +interface ControllerOptions { + finalizes: boolean; +} + /** * GET a block. * @@ -65,7 +69,7 @@ import AbstractController from '../AbstractController'; * - `OnFinalize`: https://crates.parity.io/frame_support/traits/trait.OnFinalize.html */ export default class BlocksController extends AbstractController { - constructor(api: ApiPromise) { + constructor(api: ApiPromise, private readonly options: ControllerOptions) { super(api, '/blocks', new BlocksService(api)); this.initRoutes(); } @@ -91,7 +95,7 @@ export default class BlocksController extends AbstractController const extrsinsicDocsArg = extrinsicDocs === 'true'; const hash = - finalized === 'false' + finalized === 'false' || !this.options.finalizes ? (await this.api.rpc.chain.getHeader()).hash : await this.api.rpc.chain.getFinalizedHead(); diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 6ae6c08bf..d0def0400 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -1,6 +1,39 @@ -export * from './accounts'; -export * from './blocks'; -export * from './node'; -export * from './pallets'; -export * from './runtime'; -export * from './transaction'; +import { + AccountsBalanceInfo, + AccountsStakingInfo, + AccountsStakingPayouts, + AccountsVestingInfo, +} from './accounts'; +import { Blocks } from './blocks'; +import { NodeNetwork, NodeTransactionPool, NodeVersion } from './node'; +import { PalletsStakingProgress, PalletsStorage } from './pallets'; +import { RuntimeCode, RuntimeMetadata, RuntimeSpec } from './runtime'; +import { + TransactionDryRun, + TransactionFeeEstimate, + TransactionMaterial, + TransactionSubmit, +} from './transaction'; + +/** + * Object containing every controller class definition. + */ +export const controllers = { + Blocks, + AccountsBalanceInfo, + AccountsStakingInfo, + AccountsVestingInfo, + AccountsStakingPayouts, + PalletsStakingProgress, + PalletsStorage, + NodeNetwork, + NodeTransactionPool, + NodeVersion, + RuntimeCode, + RuntimeMetadata, + RuntimeSpec, + TransactionDryRun, + TransactionFeeEstimate, + TransactionMaterial, + TransactionSubmit, +}; diff --git a/src/controllers/pallets/index.ts b/src/controllers/pallets/index.ts index 07c219591..a9e4dd10c 100644 --- a/src/controllers/pallets/index.ts +++ b/src/controllers/pallets/index.ts @@ -1,2 +1,2 @@ -export { default as palletsStakingProgress } from './PalletsStakingProgressController'; -export { default as palletsStorageItem } from './PalletsStorageController'; +export { default as PalletsStakingProgress } from './PalletsStakingProgressController'; +export { default as PalletsStorage } from './PalletsStorageController'; diff --git a/src/logging/transports/consoleTransport.ts b/src/logging/transports/consoleTransport.ts index 1e60e211b..48142795c 100644 --- a/src/logging/transports/consoleTransport.ts +++ b/src/logging/transports/consoleTransport.ts @@ -1,7 +1,7 @@ import { TransformableInfo } from 'logform'; import { format, transports } from 'winston'; -import { Config } from '../../Config'; +import { SidecarConfig } from '../../SidecarConfig'; import { filterApiRpc, nodeUtilFormat, @@ -12,7 +12,7 @@ import { const { config: { LOG }, -} = Config; +} = SidecarConfig; /** * Console transport for winston logger. diff --git a/src/main.ts b/src/main.ts index 37914a60e..4a822db9e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,21 +16,87 @@ // along with this program. If not, see . import { ApiPromise } from '@polkadot/api'; +import { + typesBundle, + typesChain, + typesRpc, + typesSpec, +} from '@polkadot/apps-config/api'; import { WsProvider } from '@polkadot/rpc-provider'; import { json } from 'express'; import App from './App'; -import { Config } from './Config'; -import * as controllers from './controllers'; +import { getControllersForSpec } from './chains-config'; import { consoleOverride } from './logging/consoleOverride'; import { Log } from './logging/Log'; import * as middleware from './middleware'; +import { SidecarConfig } from './SidecarConfig'; + +const { logger } = Log; +const { config } = SidecarConfig; async function main() { - const { config } = Config; + // Overide console.{log, error, warn, etc} + consoleOverride(logger); + + // Instantiate a web socket connection to the node for basic polkadot-js use + const api = await ApiPromise.create({ + provider: new WsProvider(config.SUBSTRATE.WS_URL), + rpc: typesRpc, + typesBundle, + typesChain, + typesSpec, + types: { + ...config.SUBSTRATE.CUSTOM_TYPES, + }, + }); - const { logger } = Log; + // Gather some basic details about the node so we can display a nice message + const [chainName, { implName, specName }] = await Promise.all([ + api.rpc.system.chain(), + api.rpc.state.getRuntimeVersion(), + ]); + + startUpPrompt( + config.SUBSTRATE.WS_URL, + chainName.toString(), + implName.toString() + ); + + // Create our App + const app = new App({ + preMiddleware: [json(), middleware.httpLoggerCreate(logger)], + controllers: getControllersForSpec(api, specName.toString()), + postMiddleware: [ + middleware.txError, + middleware.httpError, + middleware.error, + middleware.legacyError, + middleware.internalError, + ], + port: config.EXPRESS.PORT, + host: config.EXPRESS.HOST, + }); + + // Start the server + app.listen(); +} + +process.on('SIGINT', function () { + console.log('Caught interrupt signal, exiting...'); + process.exit(0); +}); +main().catch(console.log); +/** + * Prompt the user with some basic info about the node and the network they have + * connected Sidecar to. + * + * @param wsUrl websocket url of the node Sidecar is connected to + * @param chainName chain name of the network Sidecar is connected to + * @param implName implementation name of the node Sidecar is connected to + */ +function startUpPrompt(wsUrl: string, chainName: string, implName: string) { /** * Best effort list of known public nodes that do not encourage high traffic * sidecar installations connecting to them for non - testing / development purposes. @@ -51,92 +117,29 @@ async function main() { 'wss://rpc.subsocial.network', ]; - // Overide console.{log, error, warn, etc} - consoleOverride(logger); - - // Instantiate a web socket connection to the node for basic polkadot-js use - const api = await ApiPromise.create({ - provider: new WsProvider(config.SUBSTRATE.WS_URL), - types: { - ...config.SUBSTRATE.CUSTOM_TYPES, - }, - }); - - // Gather some basic details about the node so we can display a nice message - const [chainName, { implName }] = await Promise.all([ - api.rpc.system.chain(), - api.rpc.state.getRuntimeVersion(), - ]); - logger.info( - `Connected to chain ${chainName.toString()} on the ${implName.toString()} client at ${ - config.SUBSTRATE.WS_URL - }` + `Connected to chain ${chainName} on the ${implName} client at ${config.SUBSTRATE.WS_URL}` ); - const isPublicUrl: boolean = publicWsUrls.includes(config.SUBSTRATE.WS_URL); + const isPublicUrl: boolean = publicWsUrls.includes(wsUrl); if (isPublicUrl) { logger.info( - `${config.SUBSTRATE.WS_URL} is a public node. Too many users will overload this public endpoint. Switch to a privately hosted node when possible.` + `${wsUrl} is a public node. Too many users will overload this public endpoint. Switch to a privately hosted node when possible.` ); } // Split the Url to check for 2 things. Secure connection, and if its a local IP. - const splitUrl: string[] = config.SUBSTRATE.WS_URL.split(':'); + const splitUrl: string[] = wsUrl.split(':'); // If its 'ws' its not a secure connection. const isSecure: boolean = splitUrl[0] === 'wss'; // Check if its a local IP. const isLocal: boolean = - splitUrl[1] === '//0.0.0.0' || - splitUrl[1] === '//127.0.0.1' || - splitUrl[1] === '//localhost'; + splitUrl[1] === '//127.0.0.1' || splitUrl[1] === '//localhost'; if (!isSecure && !isLocal) { logger.warn( - `Using unencrypted connection to a public node (${config.SUBSTRATE.WS_URL}); All traffic is sent over the internet in cleartext.` + `Using unencrypted connection to a public node (${wsUrl}); All traffic is sent over the internet in cleartext.` ); } - - // Create our App - const app = new App({ - preMiddleware: [json(), middleware.httpLoggerCreate(logger)], - controllers: [ - new controllers.Blocks(api), - new controllers.AccountsStakingPayouts(api), - new controllers.AccountsBalanceInfo(api), - new controllers.AccountsStakingInfo(api), - new controllers.AccountsVestingInfo(api), - new controllers.NodeNetwork(api), - new controllers.NodeVersion(api), - new controllers.NodeTransactionPool(api), - new controllers.RuntimeCode(api), - new controllers.RuntimeSpec(api), - new controllers.RuntimeMetadata(api), - new controllers.TransactionDryRun(api), - new controllers.TransactionMaterial(api), - new controllers.TransactionFeeEstimate(api), - new controllers.TransactionSubmit(api), - new controllers.palletsStakingProgress(api), - new controllers.palletsStorageItem(api), - ], - postMiddleware: [ - middleware.txError, - middleware.httpError, - middleware.error, - middleware.legacyError, - middleware.internalError, - ], - port: config.EXPRESS.PORT, - host: config.EXPRESS.HOST, - }); - - // Start the server - app.listen(); } - -process.on('SIGINT', function () { - console.log('Caught interrupt signal, exiting...'); - process.exit(0); -}); -main().catch(console.log); diff --git a/src/services/accounts/AccountsBalanceInfoService.spec.ts b/src/services/accounts/AccountsBalanceInfoService.spec.ts index 97e3f17ed..ba136c0da 100644 --- a/src/services/accounts/AccountsBalanceInfoService.spec.ts +++ b/src/services/accounts/AccountsBalanceInfoService.spec.ts @@ -12,7 +12,8 @@ describe('AccountsBalanceInfoService', () => { sanitizeNumbers( await accountsBalanceInfoService.fetchAccountBalanceInfo( blockHash789629, - testAddress + testAddress, + 'DOT' ) ) ).toStrictEqual(accountsBalanceInfo789629); diff --git a/src/services/accounts/AccountsBalanceInfoService.ts b/src/services/accounts/AccountsBalanceInfoService.ts index 477b26551..ad9f526c6 100644 --- a/src/services/accounts/AccountsBalanceInfoService.ts +++ b/src/services/accounts/AccountsBalanceInfoService.ts @@ -1,4 +1,9 @@ -import { BlockHash } from '@polkadot/types/interfaces'; +import { Vec } from '@polkadot/types'; +import { + AccountData, + BalanceLock, + BlockHash, +} from '@polkadot/types/interfaces'; import { BadRequest } from 'http-errors'; import { IAccountBalanceInfo } from 'src/types/responses'; @@ -7,39 +12,73 @@ import { AbstractService } from '../AbstractService'; export class AccountsBalanceInfoService extends AbstractService { /** * Fetch balance information for an account at a given block. + * N.B. assumes all non native tokens are from ORML tokens pallet. * - * @param hash `BlockHash` to make call at - * @param address address of the account to get the balance info of + * @param hash `BlockHash` to make call at. + * @param address Address of the account to get the balance info of. + * @param token Token to get the balance info of. */ async fetchAccountBalanceInfo( hash: BlockHash, - address: string + address: string, + token: string ): Promise { const { api } = this; - const [header, locks, sysAccount] = await Promise.all([ - api.rpc.chain.getHeader(hash), - api.query.balances.locks.at(hash, address), - api.query.system.account.at(hash, address), - ]); + let locks, header, accountInfo, accountData; + if (token === api.registry.chainToken) { + [header, locks, accountInfo] = await Promise.all([ + api.rpc.chain.getHeader(hash), + api.query.balances.locks.at(hash, address), + api.query.system.account.at(hash, address), + ]); - const account = - sysAccount.data != null - ? sysAccount.data - : await api.query.balances.account.at(hash, address); + accountData = + accountInfo.data != null + ? accountInfo.data + : await api.query.balances.account.at(hash, address); + } else { + // Assume we are using ORML token pallet + let locksAny, accountDataAny; + try { + [ + header, + locksAny, + accountDataAny, + accountInfo, + ] = await Promise.all([ + api.rpc.chain.getHeader(hash), + api.query.tokens.locks.at(hash, address, { Token: token }), + api.query.tokens.accounts.at(hash, address, { + Token: token, + }), + api.query.system.account.at(hash, address), + ]); + } catch { + throw new BadRequest( + 'An error occured while attempting to query for a non-native token; ' + + 'the token specified is likely invalid.' + ); + } + + // Coerce the ORML query results from polkadot-js generic Codec to exact type + locks = locksAny as Vec; + accountData = accountDataAny as AccountData; + } const at = { hash, - height: header.number.unwrap().toString(10), + height: header.number.toNumber().toString(10), }; - if (account && locks && sysAccount) { - const { free, reserved, miscFrozen, feeFrozen } = account; - const { nonce } = sysAccount; + if (accountData && locks && accountInfo) { + const { free, reserved, miscFrozen, feeFrozen } = accountData; + const { nonce } = accountInfo; return { at, nonce, + tokenSymbol: token, free, reserved, miscFrozen, diff --git a/src/services/blocks/BlocksService.spec.ts b/src/services/blocks/BlocksService.spec.ts index f392c208a..0695d3304 100644 --- a/src/services/blocks/BlocksService.spec.ts +++ b/src/services/blocks/BlocksService.spec.ts @@ -53,7 +53,7 @@ describe('BlocksService', () => { (undefined as unknown) as GenericExtrinsic ); - mockApi.rpc.chain.getBlock = (() => + mockApi.derive.chain.getBlock = (() => Promise.resolve().then(() => { return { block: mockBlock789629BadExt, @@ -68,7 +68,7 @@ describe('BlocksService', () => { ) ); - mockApi.rpc.chain.getBlock = (getBlock as unknown) as GetBlock; + mockApi.derive.chain.getBlock = (getBlock as unknown) as GetBlock; }); }); diff --git a/src/services/blocks/BlocksService.ts b/src/services/blocks/BlocksService.ts index 507277dea..e476df475 100644 --- a/src/services/blocks/BlocksService.ts +++ b/src/services/blocks/BlocksService.ts @@ -1,10 +1,9 @@ import { ApiPromise } from '@polkadot/api'; +import { SignedBlockExtended } from '@polkadot/api-derive/type'; import { GenericCall, Struct } from '@polkadot/types'; import { - AccountId, Block, BlockHash, - Digest, DispatchInfo, EventRecord, Hash, @@ -45,11 +44,24 @@ export class BlocksService extends AbstractService { ): Promise { const { api } = this; - const [{ block }, events, validators] = await Promise.all([ - api.rpc.chain.getBlock(hash), - this.fetchEvents(api, hash), - api.query.session.validators.at(hash), - ]); + let block; + let events; + let author; + if (typeof api.query.session?.validators?.at === 'function') { + // `api.derive.chain.getBlock` requires that `api.query.session?.validators?.at` + // is a function in order to query the validator set to pull out the author + // see: https://github.com/polkadot-js/api/blob/master/packages/api-derive/src/chain/getBlock.ts#L31 + [{ author, block }, events] = await Promise.all([ + api.derive.chain.getBlock(hash) as Promise, + this.fetchEvents(api, hash), + ]); + } else { + [{ block }, events] = await Promise.all([ + api.rpc.chain.getBlock(hash), + this.fetchEvents(api, hash), + ]); + } + const authorId = author; const { parentHash, @@ -59,8 +71,6 @@ export class BlocksService extends AbstractService { digest, } = block.header; - const authorId = this.extractAuthor(validators, digest); - const logs = digest.logs.map((log) => { const { type, index, value } = log; @@ -316,7 +326,7 @@ export class BlocksService extends AbstractService { } /** - * Create calcFee from params. + * Create calcFee from params or return `null` if calcFee cannot be created. * * @param api ApiPromise * @param parentHash Hash of the parent block @@ -327,46 +337,71 @@ export class BlocksService extends AbstractService { parentHash: Hash, block: Block ) { - let parentParentHash: Hash; - if (block.header.number.toNumber() > 1) { - parentParentHash = (await api.rpc.chain.getHeader(parentHash)) - .parentHash; + const perByte = api.consts.transactionPayment?.transactionByteFee; + const extrinsicBaseWeight = api.consts.system?.extrinsicBaseWeight; + + let calcFee, specName, specVersion; + if ( + perByte === undefined || + extrinsicBaseWeight === undefined || + typeof api.query.transactionPayment?.nextFeeMultiplier?.at !== + 'function' + ) { + // We do not have the neccesary materials to build calcFee, so we just give a dummy function + // that aligns with the expected API of calcFee. + calcFee = { calc_fee: () => null }; + + const version = await api.rpc.state.getRuntimeVersion(parentHash); + [specVersion, specName] = [ + version.specName.toString(), + version.specVersion.toNumber(), + ]; } else { - parentParentHash = parentHash; - } + const coefficients = api.consts.transactionPayment.weightToFee.map( + (c) => { + return { + coeffInteger: c.coeffInteger.toString(), + coeffFrac: c.coeffFrac, + degree: c.degree, + negative: c.negative, + }; + } + ); - const perByte = api.consts.transactionPayment.transactionByteFee; - const extrinsicBaseWeight = api.consts.system.extrinsicBaseWeight; - const multiplier = await api.query.transactionPayment.nextFeeMultiplier.at( - parentHash - ); - // The block where the runtime is deployed falsely proclaims it would - // be already using the new runtime. This workaround therefore uses the - // parent of the parent in order to determine the correct runtime under which - // this block was produced. - const version = await api.rpc.state.getRuntimeVersion(parentParentHash); - const specName = version.specName.toString(); - const specVersion = version.specVersion.toNumber(); - const coefficients = api.consts.transactionPayment.weightToFee.map( - (c) => { - return { - coeffInteger: c.coeffInteger.toString(), - coeffFrac: c.coeffFrac, - degree: c.degree, - negative: c.negative, - }; + // The block where the runtime is deployed falsely proclaims it would + // be already using the new runtime. This workaround therefore uses the + // parent of the parent in order to determine the correct runtime under which + // this block was produced. + let parentParentHash: Hash; + if (block.header.number.toNumber() > 1) { + parentParentHash = (await api.rpc.chain.getHeader(parentHash)) + .parentHash; + } else { + parentParentHash = parentHash; } - ); - return { - calcFee: CalcFee.from_params( + const [version, multiplier] = await Promise.all([ + api.rpc.state.getRuntimeVersion(parentParentHash), + api.query.transactionPayment.nextFeeMultiplier.at(parentHash), + ]); + + [specName, specVersion] = [ + version.specName.toString(), + version.specVersion.toNumber(), + ]; + + calcFee = CalcFee.from_params( coefficients, BigInt(extrinsicBaseWeight.toString()), multiplier.toString(), perByte.toString(), specName, specVersion - ), + ); + } + + return { + calcFee, specName, specVersion, }; @@ -474,33 +509,4 @@ export class BlocksService extends AbstractService { args: newArgs, }; } - - // Almost exact mimic of https://github.com/polkadot-js/api/blob/master/packages/api-derive/src/chain/getHeader.ts#L27 - // but we save a call to `getHeader` by hardcoding the logic here and using the digest from the blocks header. - private extractAuthor( - sessionValidators: AccountId[], - digest: Digest - ): AccountId | undefined { - const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime'); - - // extract from the substrate 2.0 PreRuntime digest - if (pitem) { - const [engine, data] = pitem.asPreRuntime; - - return engine.extractAuthor(data, sessionValidators); - } else { - const [citem] = digest.logs.filter( - ({ type }) => type === 'Consensus' - ); - - // extract author from the consensus (substrate 1.0, digest) - if (citem) { - const [engine, data] = citem.asConsensus; - - return engine.extractAuthor(data, sessionValidators); - } - } - - return undefined; - } } diff --git a/src/services/test-helpers/mock/mockApi.ts b/src/services/test-helpers/mock/mockApi.ts index 2f521f5c1..7235f833c 100644 --- a/src/services/test-helpers/mock/mockApi.ts +++ b/src/services/test-helpers/mock/mockApi.ts @@ -37,7 +37,22 @@ const chain = () => export const getBlock = (_hash: Hash): Promise<{ block: Block }> => Promise.resolve().then(() => { - return { block: mockBlock789629 }; + return { + block: mockBlock789629, + }; + }); + +export const deriveGetBlock = ( + _hash: Hash +): Promise<{ block: Block; author: AccountId }> => + Promise.resolve().then(() => { + return { + author: polkadotRegistry.createType( + 'AccountId', + '1zugcajGg5yDD9TEqKKzGx7iKuGWZMkRbYcyaFnaUaEkwMK' + ), + block: mockBlock789629, + }; }); const getHeader = (_hash: Hash) => @@ -363,6 +378,7 @@ export const mockApi = ({ derive: { chain: { getHeader: deriveGetHeader, + getBlock: deriveGetBlock, }, }, } as unknown) as ApiPromise; diff --git a/src/services/test-helpers/responses/accounts/balanceInfo789629.json b/src/services/test-helpers/responses/accounts/balanceInfo789629.json index 830742aa1..4e6aaa522 100644 --- a/src/services/test-helpers/responses/accounts/balanceInfo789629.json +++ b/src/services/test-helpers/responses/accounts/balanceInfo789629.json @@ -4,6 +4,7 @@ "height": "789629" }, "nonce": "6", + "tokenSymbol": "DOT", "free": "501090793179", "reserved": "0", "miscFrozen": "100000000000", diff --git a/src/types/chains-config/ControllerConfig.ts b/src/types/chains-config/ControllerConfig.ts new file mode 100644 index 000000000..92954226b --- /dev/null +++ b/src/types/chains-config/ControllerConfig.ts @@ -0,0 +1,27 @@ +import { controllers } from '../../controllers'; + +/** + * Controller mounting configuration as an object where the keys are the + * controller class names and the values are booleans indicating whether or not + * to include the controller. + * + * There is an additional `finalizes` field that is used to indicate wether or + * not a chain has finalized blocks. Practically, this only affects if + * `BlocksController` defaults to getFinalizedHead (in the case it finalizes) or + * getHeader (in the case it does not finalize) + */ +export interface ControllerConfig { + /** + * Controller class names and wether or not to include them + */ + controllers: Record; + /** + * Options relating to how the controllers are configured. + */ + options: { + /** + * Wether or not the chain finalizes blocks + */ + finalizes: boolean; + }; +} diff --git a/src/types/chains-config/index.ts b/src/types/chains-config/index.ts new file mode 100644 index 000000000..3b0112e5c --- /dev/null +++ b/src/types/chains-config/index.ts @@ -0,0 +1 @@ +export * from './ControllerConfig'; diff --git a/src/types/responses/AccountBalanceInfo.ts b/src/types/responses/AccountBalanceInfo.ts index ab66b5884..4bcfcdb78 100644 --- a/src/types/responses/AccountBalanceInfo.ts +++ b/src/types/responses/AccountBalanceInfo.ts @@ -5,6 +5,7 @@ import { IAt } from '.'; export interface IAccountBalanceInfo { at: IAt; + tokenSymbol: string; nonce: Index; free: Balance; reserved: Balance; diff --git a/src/types/config/CONFIG.ts b/src/types/sidecar-config/CONFIG.ts similarity index 100% rename from src/types/config/CONFIG.ts rename to src/types/sidecar-config/CONFIG.ts diff --git a/src/types/config/MODULES.ts b/src/types/sidecar-config/MODULES.ts similarity index 100% rename from src/types/config/MODULES.ts rename to src/types/sidecar-config/MODULES.ts diff --git a/src/types/config/SidecarConfig.ts b/src/types/sidecar-config/SidecarConfig.ts similarity index 100% rename from src/types/config/SidecarConfig.ts rename to src/types/sidecar-config/SidecarConfig.ts diff --git a/src/types/config/index.ts b/src/types/sidecar-config/index.ts similarity index 100% rename from src/types/config/index.ts rename to src/types/sidecar-config/index.ts diff --git a/tsconfig.json b/tsconfig.json index ef5f4b9ad..ba3f3496d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,7 +20,8 @@ "sourceMap": true, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, - "target": "es2017" + "target": "es2017", + "skipLibCheck": true }, "typeRoots": [ "./node_modules/@types" diff --git a/yarn.lock b/yarn.lock index 86d138bc0..7b7288a17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@acala-network/type-definitions@^0.4.0-beta.33": + version "0.4.0-beta.34" + resolved "https://registry.yarnpkg.com/@acala-network/type-definitions/-/type-definitions-0.4.0-beta.34.tgz#7e58d4990be76b6d0b6da5d15985e0cace06d479" + integrity sha512-NWUOm0cINP0FYWdOoQ64FFLDPzb1etwFuJnRQqcG7F4p6fCvxczuxWdmYx6adJKeiPO4UQaPEuZo2Y/jBetQig== + dependencies: + "@open-web3/orml-type-definitions" "^0.6.0-beta.26" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -302,10 +309,15 @@ enabled "2.0.x" kuler "^2.0.0" -"@eslint/eslintrc@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.1.tgz#f72069c330461a06684d119384435e12a5d76e3c" - integrity sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA== +"@edgeware/node-types@^3.0.10": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@edgeware/node-types/-/node-types-3.0.10.tgz#1b44af24dd0fdf48c1eedf90a90cda62e8f946aa" + integrity sha512-fQgXhlnNPfRv+xUB/HRqbwt22c+BeofMDQzQ22GwOU8NQBXERhwgA2Hi0z1K3IKMqCtSIQlu1uepuFOQIIqrZQ== + +"@eslint/eslintrc@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.2.tgz#d01fc791e2fc33e88a29d6f3dc7e93d0cd784b76" + integrity sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -505,6 +517,13 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@laminar/type-definitions@^0.2.0-beta.141": + version "0.2.0-beta.143" + resolved "https://registry.yarnpkg.com/@laminar/type-definitions/-/type-definitions-0.2.0-beta.143.tgz#a4dd18ac34addfeb451dbd3aea789d0976c34c27" + integrity sha512-9CanpyDiQC+XFpc6K70T7pN5qS2uclIUImuNKDgWdV/dbviQnFz5PgZurYsdSCSvOGStjsoRY84SU/S8eCmTLg== + dependencies: + "@open-web3/orml-type-definitions" "^0.6.0-beta.26" + "@nodelib/fs.scandir@2.1.3": version "2.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" @@ -526,40 +545,58 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@polkadot/api-derive@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-2.9.1.tgz#e7f496d1b26f82471b649851e6d913769752ae2a" - integrity sha512-AIdWHbRcqXhymRDNrdR+WQHpDK131doFkOgR+7ZjoiI6PVMW79nqFCzlf/mBpdHGP2oBpx5Fc/YEIz5JyYm1hw== +"@open-web3/orml-type-definitions@^0.6.0-beta.26": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@open-web3/orml-type-definitions/-/orml-type-definitions-0.6.1.tgz#eb7fadf598f24f5024f5d2a1fd39ccc97c801104" + integrity sha512-6asf2W/sluGQ6LNiGSdCg/Xop54mq/Q2FcV2Z9cBxys6QC4qXfo4JwUL6kJsRh/vcIIbUxoyGgKUrU/6Xdm7wA== + +"@polkadot/api-derive@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-2.10.1.tgz#6dc6c0030e036e8a38d44b7e06fd884e9c1b32fb" + integrity sha512-cMbXrOyHWJ/uLxNiAjmRa6a8WM/FEDMansWbQGJtN7ebHrJD3t1SE53aM4zgD+AgaEJgPAUfI5RuOrEzxDDTdw== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/api" "2.9.1" - "@polkadot/rpc-core" "2.9.1" - "@polkadot/types" "2.9.1" + "@polkadot/api" "2.10.1" + "@polkadot/rpc-core" "2.10.1" + "@polkadot/types" "2.10.1" "@polkadot/util" "^4.2.1" "@polkadot/util-crypto" "^4.2.1" bn.js "^4.11.9" memoizee "^0.4.14" rxjs "^6.6.3" -"@polkadot/api@2.9.1", "@polkadot/api@^2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-2.9.1.tgz#ed594b7da3421230408250d2bb5564a45a4917fc" - integrity sha512-4yVLFiU9L8uawFJYGmkN4IcwtkXaw4exaXDP1qVzcFoLqKnn0bKsBNXdeB6Va1uM6bZwfLW6kkIsn3i7lHMgpg== +"@polkadot/api@2.10.1", "@polkadot/api@^2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-2.10.1.tgz#750987bccbf8e607c3690a7bdfed818bfc2c7571" + integrity sha512-C/vd5eGK3SDpPBWfs6tbNJM6uKpThE9GiTs5Lb5yR83J2ssvnZnn4qGOoEZnpPH+2iW7hVS4GR5sE9YcZxUXTg== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/api-derive" "2.9.1" + "@polkadot/api-derive" "2.10.1" "@polkadot/keyring" "^4.2.1" - "@polkadot/metadata" "2.9.1" - "@polkadot/rpc-core" "2.9.1" - "@polkadot/rpc-provider" "2.9.1" - "@polkadot/types" "2.9.1" - "@polkadot/types-known" "2.9.1" + "@polkadot/metadata" "2.10.1" + "@polkadot/rpc-core" "2.10.1" + "@polkadot/rpc-provider" "2.10.1" + "@polkadot/types" "2.10.1" + "@polkadot/types-known" "2.10.1" "@polkadot/util" "^4.2.1" "@polkadot/util-crypto" "^4.2.1" bn.js "^4.11.9" eventemitter3 "^4.0.7" rxjs "^6.6.3" +"@polkadot/apps-config@^0.70.1": + version "0.70.1" + resolved "https://registry.yarnpkg.com/@polkadot/apps-config/-/apps-config-0.70.1.tgz#f0a18c807b83966bb5fe37ded42ee7d0c45e13e7" + integrity sha512-T8BLYXnSqiGvVuYPV4rZk8ZtXae+j9OMEOe4+ubXZEUIR0gF69CYbEh3B+bLHGjaSx5AFPG64SHNAZCSJkN8hA== + dependencies: + "@acala-network/type-definitions" "^0.4.0-beta.33" + "@babel/runtime" "^7.12.5" + "@edgeware/node-types" "^3.0.10" + "@laminar/type-definitions" "^0.2.0-beta.141" + "@polkadot/networks" "^4.2.1" + "@sora-substrate/type-definitions" "^0.1.7" + "@subsocial/types" "^0.4.23" + "@polkadot/keyring@^4.2.1": version "4.2.1" resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-4.2.1.tgz#34bf18ae8cb5822f2ea522c8db62dd0086725ffa" @@ -569,45 +606,45 @@ "@polkadot/util" "4.2.1" "@polkadot/util-crypto" "4.2.1" -"@polkadot/metadata@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-2.9.1.tgz#2028a0e7fe1060057f9e606cea2b29bf93ec3fd9" - integrity sha512-CV5ux4zsRMhPT6cGezqCSNToFASr+JftVgCrIGo05N8KmSds0vy2TaL4c1jPc6c0ZZ6DLLPefnGitPlEdZh6EQ== +"@polkadot/metadata@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-2.10.1.tgz#bea4696c8773af4214c071ab5017bef215d978c1" + integrity sha512-ilB81k4ZDFVLHYo8mhxs9VFpL7Vi/Q0tqTSuQ+ziD3U7fYh0QV5si+1nqo5EBzvIKws6hsC7B4bTPQLJHHTC9w== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/types" "2.9.1" - "@polkadot/types-known" "2.9.1" + "@polkadot/types" "2.10.1" + "@polkadot/types-known" "2.10.1" "@polkadot/util" "^4.2.1" "@polkadot/util-crypto" "^4.2.1" bn.js "^4.11.9" -"@polkadot/networks@4.2.1": +"@polkadot/networks@4.2.1", "@polkadot/networks@^4.2.1": version "4.2.1" resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-4.2.1.tgz#b0ca69807ed60189f1c958bb27cfeb3cb1c6b12b" integrity sha512-T1tg0V0uG09Vdce2O4KfEcWO3/fZh4VYt0bmJ6iPwC+x6yv939X2BKvuFTDDVNT3fqBpGzWQlwiTXYQ15o9bGA== dependencies: "@babel/runtime" "^7.12.5" -"@polkadot/rpc-core@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-2.9.1.tgz#4048e0fc4561609fb660c065435c13e3b96cf7e4" - integrity sha512-Pjqw6QepG1ctfDKOKVfDyDUU4KWshls5LI95N8mRFolkp2wTnCJPp897+4iDtTKUA6S5Dl4pUFypzuo8Ok/wVQ== +"@polkadot/rpc-core@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-2.10.1.tgz#6d9cca349dc03324dbf9c3bfe2a9db555808a664" + integrity sha512-oyEEhSwlKW3FNO5v7MJYSoiF5kIxcJKMKVJSIpLHp6G2oHhgKRZtsGlX4n6QJYxIBWb0EueewpkuEMCGAv3R7g== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/metadata" "2.9.1" - "@polkadot/rpc-provider" "2.9.1" - "@polkadot/types" "2.9.1" + "@polkadot/metadata" "2.10.1" + "@polkadot/rpc-provider" "2.10.1" + "@polkadot/types" "2.10.1" "@polkadot/util" "^4.2.1" memoizee "^0.4.14" rxjs "^6.6.3" -"@polkadot/rpc-provider@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-2.9.1.tgz#833d737e42c14b24449535093171bc693b67c4b8" - integrity sha512-LLweHTOnpbX7tBhrt5DVAYb0UUXsKosMFlpCQfyoyIQ1ACRT0cnd+AKF8eKf04Ayytg+q/USD8tGGDbH+XElOg== +"@polkadot/rpc-provider@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-2.10.1.tgz#7929b5aa8899033ba127984b4411baef92a1232d" + integrity sha512-VvrFedxIbPrcm3CadZLdVwm3eWyyaZV1Sh0BSGZ2u9Pi2JkONshWrg7mf32SbKhckXWt/BNwUnpCQfIUjnKaDw== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/types" "2.9.1" + "@polkadot/types" "2.10.1" "@polkadot/util" "^4.2.1" "@polkadot/util-crypto" "^4.2.1" "@polkadot/x-fetch" "^4.2.1" @@ -615,23 +652,23 @@ bn.js "^4.11.9" eventemitter3 "^4.0.7" -"@polkadot/types-known@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-2.9.1.tgz#8af3a81b09e7e4d6b82d4453240e7e5ab3bb06cd" - integrity sha512-veSPubDFQd7Ql8Lxly+pE4fCN+rei7O2j0yGkoCHi06yFxkATqM3aj6DI1Z3g7Uk9kLJTTIb4db3aQbaVFXpNQ== +"@polkadot/types-known@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-2.10.1.tgz#37bc032aae7db12e9a4480caf5aa65f619cffac9" + integrity sha512-RmnRPMoypxodfXRRqO+t4ogeaHTEC1S968+Djo8SYeSSmeUrlo9LdoJ5DZBXd0dTOUJbo0wXl9DOjL5qVnRy6A== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/types" "2.9.1" + "@polkadot/types" "2.10.1" "@polkadot/util" "^4.2.1" bn.js "^4.11.9" -"@polkadot/types@2.9.1": - version "2.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-2.9.1.tgz#2e113d30759d69928202b83e67c2caafe632201b" - integrity sha512-CaDFaeHgf3RYI7soiXK2V7UghEVwystp+o4LCMeT6UUgxS0I0kOkpNYcjLD5P02gUtHhQYxcWqUnGi8X8R3kOg== +"@polkadot/types@2.10.1": + version "2.10.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-2.10.1.tgz#84189d508c28d375ec562a049aaf58aa34256a74" + integrity sha512-wRs9X7uiSRNQBFxcuCDv++FU+HgFml55U73zsqxDgBb7+bor4QGLPpki8rV+xQOpqhfPjKHN1gosK99sFcC3Aw== dependencies: "@babel/runtime" "^7.12.5" - "@polkadot/metadata" "2.9.1" + "@polkadot/metadata" "2.10.1" "@polkadot/util" "^4.2.1" "@polkadot/util-crypto" "^4.2.1" "@types/bn.js" "^4.11.6" @@ -731,6 +768,34 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@sora-substrate/type-definitions@^0.1.7": + version "0.1.8" + resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-0.1.8.tgz#64eb12744f4cca28b4dff993d5017b626ff8387f" + integrity sha512-b1mSS21PWkXMf54sVmWlkR9CxB64u+2z+loD+DSxFuYGbv5/Bae1stdiwyx1UkXjjWEk2aosux31YH1QMvbWeQ== + dependencies: + "@open-web3/orml-type-definitions" "^0.6.0-beta.26" + +"@subsocial/types@^0.4.23": + version "0.4.26" + resolved "https://registry.yarnpkg.com/@subsocial/types/-/types-0.4.26.tgz#5dae4939971a5b4acf10e90ebfa2672a2caca95d" + integrity sha512-jBYVsBowkx+yEtxQ4hZLT6mpkBy36MP31zIAUUDVQWdEp1esnr5ASRiU9SCwIDBEiZcZkv+tz+bRnuSZCr23Ag== + dependencies: + "@subsocial/utils" "^0.4.25" + cids "^0.7.1" + +"@subsocial/utils@^0.4.25": + version "0.4.25" + resolved "https://registry.yarnpkg.com/@subsocial/utils/-/utils-0.4.25.tgz#11aa5524979f9bd38ff26b9c00f794a8dc70fc61" + integrity sha512-YpAwLmY5XP3Md1ogi8lWKCqressHeMNiCUO9Bg8b5mNajfDvfjX5ujUz2p6aF3dzh3lJDqZ1CeTCm8+rFankkA== + dependencies: + bn.js "^5.1.1" + chalk "^3.0.0" + dotenv "^8.0.0" + lodash.isempty "^4.4.0" + lodash.truncate "^4.4.2" + loglevel "^1.7.0" + loglevel-plugin-prefix "^0.8.4" + "@substrate/calc@^0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@substrate/calc/-/calc-0.1.2.tgz#7004563c04a268ecacebcba2be78a55fd44e42fa" @@ -942,67 +1007,67 @@ integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== "@types/yargs@^15.0.0": - version "15.0.10" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.10.tgz#0fe3c8173a0d5c3e780b389050140c3f5ea6ea74" - integrity sha512-z8PNtlhrj7eJNLmrAivM7rjBESG6JwC5xP3RVk12i/8HVP7Xnx/sEmERnRImyEuUaJfO942X0qMOYsoupaJbZQ== + version "15.0.11" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.11.tgz#361d7579ecdac1527687bcebf9946621c12ab78c" + integrity sha512-jfcNBxHFYJ4nPIacsi3woz1+kvUO6s1CyeEhtnDHBjHUMNj5UlW2GynmnSgiJJEdNg9yW5C8lfoNRZrHGv5EqA== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.9.0.tgz#8fde15743413661fdc086c9f1f5d74a80b856113" - integrity sha512-WrVzGMzzCrgrpnQMQm4Tnf+dk+wdl/YbgIgd5hKGa2P+lnJ2MON+nQnbwgbxtN9QDLi8HO+JAq0/krMnjQK6Cw== +"@typescript-eslint/eslint-plugin@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.9.1.tgz#66758cbe129b965fe9c63b04b405d0cf5280868b" + integrity sha512-QRLDSvIPeI1pz5tVuurD+cStNR4sle4avtHhxA+2uyixWGFjKzJ+EaFVRW6dA/jOgjV5DTAjOxboQkRDE8cRlQ== dependencies: - "@typescript-eslint/experimental-utils" "4.9.0" - "@typescript-eslint/scope-manager" "4.9.0" + "@typescript-eslint/experimental-utils" "4.9.1" + "@typescript-eslint/scope-manager" "4.9.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.9.0.tgz#23a296b85d243afba24e75a43fd55aceda5141f0" - integrity sha512-0p8GnDWB3R2oGhmRXlEnCvYOtaBCijtA5uBfH5GxQKsukdSQyI4opC4NGTUb88CagsoNQ4rb/hId2JuMbzWKFQ== +"@typescript-eslint/experimental-utils@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.9.1.tgz#86633e8395191d65786a808dc3df030a55267ae2" + integrity sha512-c3k/xJqk0exLFs+cWSJxIjqLYwdHCuLWhnpnikmPQD2+NGAx9KjLYlBDcSI81EArh9FDYSL6dslAUSwILeWOxg== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.9.0" - "@typescript-eslint/types" "4.9.0" - "@typescript-eslint/typescript-estree" "4.9.0" + "@typescript-eslint/scope-manager" "4.9.1" + "@typescript-eslint/types" "4.9.1" + "@typescript-eslint/typescript-estree" "4.9.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.9.0.tgz#bb65f1214b5e221604996db53ef77c9d62b09249" - integrity sha512-QRSDAV8tGZoQye/ogp28ypb8qpsZPV6FOLD+tbN4ohKUWHD2n/u0Q2tIBnCsGwQCiD94RdtLkcqpdK4vKcLCCw== +"@typescript-eslint/parser@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.9.1.tgz#2d74c4db5dd5117379a9659081a4d1ec02629055" + integrity sha512-Gv2VpqiomvQ2v4UL+dXlQcZ8zCX4eTkoIW+1aGVWT6yTO+6jbxsw7yQl2z2pPl/4B9qa5JXeIbhJpONKjXIy3g== dependencies: - "@typescript-eslint/scope-manager" "4.9.0" - "@typescript-eslint/types" "4.9.0" - "@typescript-eslint/typescript-estree" "4.9.0" + "@typescript-eslint/scope-manager" "4.9.1" + "@typescript-eslint/types" "4.9.1" + "@typescript-eslint/typescript-estree" "4.9.1" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.9.0.tgz#5eefe305d6b71d1c85af6587b048426bfd4d3708" - integrity sha512-q/81jtmcDtMRE+nfFt5pWqO0R41k46gpVLnuefqVOXl4QV1GdQoBWfk5REcipoJNQH9+F5l+dwa9Li5fbALjzg== +"@typescript-eslint/scope-manager@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.9.1.tgz#cc2fde310b3f3deafe8436a924e784eaab265103" + integrity sha512-sa4L9yUfD/1sg9Kl8OxPxvpUcqxKXRjBeZxBuZSSV1v13hjfEJkn84n0An2hN8oLQ1PmEl2uA6FkI07idXeFgQ== dependencies: - "@typescript-eslint/types" "4.9.0" - "@typescript-eslint/visitor-keys" "4.9.0" + "@typescript-eslint/types" "4.9.1" + "@typescript-eslint/visitor-keys" "4.9.1" -"@typescript-eslint/types@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.9.0.tgz#3fe8c3632abd07095c7458f7451bd14c85d0033c" - integrity sha512-luzLKmowfiM/IoJL/rus1K9iZpSJK6GlOS/1ezKplb7MkORt2dDcfi8g9B0bsF6JoRGhqn0D3Va55b+vredFHA== +"@typescript-eslint/types@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.9.1.tgz#a1a7dd80e4e5ac2c593bc458d75dd1edaf77faa2" + integrity sha512-fjkT+tXR13ks6Le7JiEdagnwEFc49IkOyys7ueWQ4O8k4quKPwPJudrwlVOJCUQhXo45PrfIvIarcrEjFTNwUA== -"@typescript-eslint/typescript-estree@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.9.0.tgz#38a98df6ee281cfd6164d6f9d91795b37d9e508c" - integrity sha512-rmDR++PGrIyQzAtt3pPcmKWLr7MA+u/Cmq9b/rON3//t5WofNR4m/Ybft2vOLj0WtUzjn018ekHjTsnIyBsQug== +"@typescript-eslint/typescript-estree@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.9.1.tgz#6e5b86ff5a5f66809e1f347469fadeec69ac50bf" + integrity sha512-bzP8vqwX6Vgmvs81bPtCkLtM/Skh36NE6unu6tsDeU/ZFoYthlTXbBmpIrvosgiDKlWTfb2ZpPELHH89aQjeQw== dependencies: - "@typescript-eslint/types" "4.9.0" - "@typescript-eslint/visitor-keys" "4.9.0" + "@typescript-eslint/types" "4.9.1" + "@typescript-eslint/visitor-keys" "4.9.1" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -1010,12 +1075,12 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.9.0.tgz#f284e9fac43f2d6d35094ce137473ee321f266c8" - integrity sha512-sV45zfdRqQo1A97pOSx3fsjR+3blmwtdCt8LDrXgCX36v4Vmz4KHrhpV6Fo2cRdXmyumxx11AHw0pNJqCNpDyg== +"@typescript-eslint/visitor-keys@4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.9.1.tgz#d76374a58c4ead9e92b454d186fea63487b25ae1" + integrity sha512-9gspzc6UqLQHd7lXQS7oWs+hrYggspv/rk6zzEMhCbYwPE/sF7oxo7GAjkS35Tdlt7wguIG+ViWCPtVZHz/ybQ== dependencies: - "@typescript-eslint/types" "4.9.0" + "@typescript-eslint/types" "4.9.1" eslint-visitor-keys "^2.0.0" JSONStream@^1.0.4: @@ -1047,7 +1112,7 @@ acorn-globals@^6.0.0: acorn "^7.1.1" acorn-walk "^7.1.1" -acorn-jsx@^5.2.0: +acorn-jsx@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== @@ -1301,6 +1366,11 @@ base-x@^3.0.8: dependencies: safe-buffer "^5.0.1" +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" @@ -1331,6 +1401,11 @@ bn.js@^4.11.9, bn.js@^4.4.0: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== +bn.js@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" + integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== + body-parser@1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" @@ -1407,6 +1482,14 @@ buffer-from@1.x, buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== +buffer@^5.5.0, buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + bufferutil@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.2.tgz#79f68631910f6b993d870fc77dc0a2894eb96cd5" @@ -1514,6 +1597,14 @@ chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -1524,6 +1615,17 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== +cids@^0.7.1: + version "0.7.5" + resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" + integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== + dependencies: + buffer "^5.5.0" + class-is "^1.1.0" + multibase "~0.6.0" + multicodec "^1.0.0" + multihashes "~0.4.15" + cipher-base@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" @@ -1537,6 +1639,11 @@ cjs-module-lexer@^0.6.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f" integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw== +class-is@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" + integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== + class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -2125,7 +2232,7 @@ dot-prop@^5.1.0: dependencies: is-obj "^2.0.0" -dotenv@8.2.0: +dotenv@8.2.0, dotenv@^8.0.0: version "8.2.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== @@ -2278,17 +2385,15 @@ escodegen@^1.14.1: optionalDependencies: source-map "~0.6.1" -eslint-config-prettier@^6.15.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" - integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== - dependencies: - get-stdin "^6.0.0" +eslint-config-prettier@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz#c1ae4106f74e6c0357f44adb076771d032ac0e97" + integrity sha512-8Y8lGLVPPZdaNA7JXqnvETVC7IiVRgAP6afQu9gOQRn90YY3otMNh+x7Vr2vMePQntF+5erdSUBqSzCmU/AxaQ== -eslint-plugin-prettier@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" - integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== +eslint-plugin-prettier@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.2.0.tgz#af391b2226fa0e15c96f36c733f6e9035dbd952c" + integrity sha512-kOUSJnFjAUFKwVxuzy6sA5yyMx6+o9ino4gCdShzBNx4eyFRudWRYKCFolKjoM40PEiuU6Cn7wBLfq3WsGg7qg== dependencies: prettier-linter-helpers "^1.0.0" @@ -2322,13 +2427,13 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@^7.14.0: - version "7.14.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.14.0.tgz#2d2cac1d28174c510a97b377f122a5507958e344" - integrity sha512-5YubdnPXrlrYAFCKybPuHIAH++PINe1pmKNc5wQRB9HSbqIK1ywAnntE3Wwua4giKu0bjligf1gLF6qxMGOYRA== +eslint@^7.15.0: + version "7.15.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.15.0.tgz#eb155fb8ed0865fcf5d903f76be2e5b6cd7e0bc7" + integrity sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA== dependencies: "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.2.1" + "@eslint/eslintrc" "^0.2.2" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -2338,10 +2443,10 @@ eslint@^7.14.0: eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" - espree "^7.3.0" + espree "^7.3.1" esquery "^1.2.0" esutils "^2.0.2" - file-entry-cache "^5.0.1" + file-entry-cache "^6.0.0" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" globals "^12.1.0" @@ -2365,13 +2470,13 @@ eslint@^7.14.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" - integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw== +espree@^7.3.0, espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: acorn "^7.4.0" - acorn-jsx "^5.2.0" + acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" esprima@^4.0.0, esprima@^4.0.1: @@ -2660,12 +2765,12 @@ figures@^3.1.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== +file-entry-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a" + integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== dependencies: - flat-cache "^2.0.1" + flat-cache "^3.0.4" fill-range@^4.0.0: version "4.0.0" @@ -2727,19 +2832,18 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" + flatted "^3.1.0" + rimraf "^3.0.2" -flatted@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" - integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +flatted@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.0.tgz#a5d06b4a8b01e3a63771daa5cb7a1903e2e57067" + integrity sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA== fn.name@1.x.x: version "1.1.0" @@ -2854,11 +2958,6 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -3161,6 +3260,11 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -3906,9 +4010,9 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -4116,6 +4220,11 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.isempty@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" + integrity sha1-b4bL7di+TsmHvpqvM8loTbGzHn4= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -4146,6 +4255,11 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" @@ -4162,6 +4276,16 @@ logform@^2.2.0: ms "^2.1.1" triple-beam "^1.3.0" +loglevel-plugin-prefix@^0.8.4: + version "0.8.4" + resolved "https://registry.yarnpkg.com/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz#2fe0e05f1a820317d98d8c123e634c1bd84ff644" + integrity sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g== + +loglevel@^1.7.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" + integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw== + loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" @@ -4454,13 +4578,6 @@ mkdirp@1.x: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mkdirp@^0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -4481,6 +4598,39 @@ ms@2.1.2, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +multibase@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" + integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multibase@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" + integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multicodec@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" + integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== + dependencies: + buffer "^5.6.0" + varint "^5.0.0" + +multihashes@~0.4.15: + version "0.4.21" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" + integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== + dependencies: + buffer "^5.5.0" + multibase "^0.7.0" + varint "^5.0.0" + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -5317,13 +5467,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -6312,6 +6455,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +varint@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" + integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -6466,17 +6614,10 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - ws@^7.2.3: - version "7.4.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.0.tgz#a5dd76a24197940d4a8bb9e0e152bb4503764da7" - integrity sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ== + version "7.4.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.1.tgz#a333be02696bd0e54cea0434e21dcc8a9ac294bb" + integrity sha512-pTsP8UAfhy3sk1lSk/O/s4tjD0CRwvMnzvwr4OKGX7ZvqZtUyx4KIJB5JWbkykPoc55tixMGgTNoh3k4FkNGFQ== xml-name-validator@^3.0.0: version "3.0.0"