From c8b60fba421ceca797834ee6dde3fac7e924055a Mon Sep 17 00:00:00 2001 From: Wil Wade Date: Thu, 11 Jul 2024 17:49:38 -0400 Subject: [PATCH] Development Genesis Config has Mainnet Schemas (#2057) # Goal The goal of this PR is to add the Schemas in at Genesis from Mainnet when on a development chain Closes #2041 # Discussion - Adds a tool `tools/genesis-schemas` that downloads the schemas from mainnet and stuffs them into a json file - GenesisConfig for Schemas Pallet that loads from a json file schemas to start with at genesis ## How to Test - You can test the pulling yourself with: - `cd tools/genesis-data && npm i && npm run schemas` or use `make genesis-schemas` - Otherwise just run `make start` and see that it has the same schemas as mainnet with the same names. # Checklist - [x] Tests added --- .github/workflows/release.yml | 6 +- .github/workflows/verify-pr-commit.yml | 8 - Cargo.lock | 1 + Makefile | 6 + README.md | 13 +- common/primitives/src/handles.rs | 1 + common/primitives/src/schema.rs | 46 +- docker/instant-seal-node.dockerfile | 56 -- docker/instant-seal-node.overview.md | 64 -- node/cli/src/cli.rs | 8 - node/cli/src/run_as_localchain.rs | 12 - node/service/src/chain_spec/frequency_dev.rs | 10 +- pallets/passkey/src/types.rs | 2 +- pallets/schemas/Cargo.toml | 1 + pallets/schemas/src/lib.rs | 42 +- pallets/schemas/src/tests/mock.rs | 2 +- pallets/schemas/src/tests/other_tests.rs | 30 +- pallets/schemas/src/types.rs | 18 +- resources/genesis-schemas.json | 75 ++ tools/genesis-data/getSchema.mjs | 89 ++ tools/genesis-data/package-lock.json | 851 ++++++++++++++++++ tools/genesis-data/package.json | 13 + tools/genesis-data/schemas.mjs | 17 + tools/state-copy/copy.mjs | 73 ++ tools/state-copy/package-lock.json | 852 +++++++++++++++++++ tools/state-copy/package.json | 14 + tools/state-copy/schemas.mjs | 23 + 27 files changed, 2161 insertions(+), 172 deletions(-) delete mode 100644 docker/instant-seal-node.dockerfile delete mode 100644 docker/instant-seal-node.overview.md create mode 100644 resources/genesis-schemas.json create mode 100644 tools/genesis-data/getSchema.mjs create mode 100644 tools/genesis-data/package-lock.json create mode 100644 tools/genesis-data/package.json create mode 100644 tools/genesis-data/schemas.mjs create mode 100644 tools/state-copy/copy.mjs create mode 100644 tools/state-copy/package-lock.json create mode 100644 tools/state-copy/package.json create mode 100644 tools/state-copy/schemas.mjs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6446b7b98f..66f363af9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -891,16 +891,12 @@ jobs: fail-fast: true matrix: arch: [amd64] - node: [collator-node-local, instant-seal-node, standalone-node] + node: [collator-node-local, standalone-node] include: - node: collator-node-local network: local build-profile: release release-file-name-prefix: frequency-local - - node: instant-seal-node - network: dev - build-profile: release - release-file-name-prefix: frequency-dev - node: standalone-node network: dev build-profile: release diff --git a/.github/workflows/verify-pr-commit.yml b/.github/workflows/verify-pr-commit.yml index 8d0cd7d60e..571c640c3f 100644 --- a/.github/workflows/verify-pr-commit.yml +++ b/.github/workflows/verify-pr-commit.yml @@ -475,14 +475,6 @@ jobs: platforms: "amd64" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build collator image in instant seal mode - env: - IMAGE_NAME: instant-seal-node - uses: docker/build-push-action@v5 - with: - context: . - push: false - file: ./docker/${{env.IMAGE_NAME}}.dockerfile - name: Build collator standalone env: IMAGE_NAME: standalone-node diff --git a/Cargo.lock b/Cargo.lock index ccb1dbfbe6..47e084049e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7368,6 +7368,7 @@ dependencies = [ "pallet-collective", "parity-scale-codec", "scale-info", + "serde", "serde_json", "serial_test", "smallvec", diff --git a/Makefile b/Makefile index 20ca1bd09f..cb9e185349 100644 --- a/Makefile +++ b/Makefile @@ -345,3 +345,9 @@ endif .PHONY: version-reset version-reset: find ./ -type f -name 'Cargo.toml' -exec sed -i '' 's/^version = \".*+polkadot.*\"/version = \"0.0.0\"/g' {} \; + +.PHONY: genesis-schemas +genesis-schemas: + cd tools/genesis-data && \ + npm i && \ + npm run --silent schemas > ../../resources/genesis-schemas.json diff --git a/README.md b/README.md index 88208b363b..5e26a365b3 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,9 @@ _Note, Running Frequency via following options does not require binary to be bui This option runs just one collator node without the need for a relay chain. +This preloads into genesis all the schemas from mainnet. +Use `make genesis-schemas` if the genesis is out of date. + ### Manual Sealing a. Blocks can be triggered by calling the `engine_createBlock` RPC @@ -187,17 +190,17 @@ Great for most testing. make start ``` -Also available as a Docker image: [`frequencychain/instant-seal-node`](https://hub.docker.com/r/frequencychain/instant-seal-node) +Also available as a Docker image: [`frequencychain/standalone-node`](https://hub.docker.com/r/frequencychain/standalone-node) ```sh -docker run --rm -p 9944:9944 -p 30333:30333 frequencychain/instant-seal-node +docker run --rm -p 9944:9944 frequencychain/standalone-node ``` To stop running chain hit [Ctrl+C] in terminal where the chain was started. -| **Node** | **Ports** | **Explorer URL** | -| ----------------------- | :----------------------------: | ----------------------------------------------------------------------------------------- | -| Frequency Collator Node | ws and rpc:`9944`, p2p:`30333` | [127.0.0.1:9944](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer) | +| **Node** | **Ports** | **Explorer URL** | +| ----------------------- | :---------------: | ----------------------------------------------------------------------------------------- | +| Frequency Collator Node | ws and rpc:`9944` | [127.0.0.1:9944](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer) | ### Interval Sealing diff --git a/common/primitives/src/handles.rs b/common/primitives/src/handles.rs index b20aa011c7..fa2361d34c 100644 --- a/common/primitives/src/handles.rs +++ b/common/primitives/src/handles.rs @@ -4,6 +4,7 @@ use crate::utils::*; use frame_support::BoundedVec; use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; +#[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::ConstU32; use sp_std::vec::Vec; diff --git a/common/primitives/src/schema.rs b/common/primitives/src/schema.rs index 676be361ce..9f1c0553bb 100644 --- a/common/primitives/src/schema.rs +++ b/common/primitives/src/schema.rs @@ -4,7 +4,6 @@ use crate::utils; use enumflags2::{bitflags, BitFlags}; use parity_scale_codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter}; -#[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_runtime::RuntimeDebug; use sp_std::prelude::*; @@ -18,8 +17,19 @@ pub type SchemaId = u16; pub type SchemaVersion = u8; /// Types of modeling in which a message payload may be defined -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, Encode, Decode, PartialEq, Debug, TypeInfo, Eq, MaxEncodedLen)] +#[derive( + Copy, + Clone, + Encode, + Decode, + PartialEq, + Debug, + TypeInfo, + Eq, + MaxEncodedLen, + Serialize, + Deserialize, +)] pub enum ModelType { /// Message payload modeled with Apache Avro: AvroBinary, @@ -28,8 +38,19 @@ pub enum ModelType { } /// Types of payload locations -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, Encode, Decode, PartialEq, Debug, TypeInfo, Eq, MaxEncodedLen)] +#[derive( + Copy, + Clone, + Encode, + Decode, + PartialEq, + Debug, + TypeInfo, + Eq, + MaxEncodedLen, + Serialize, + Deserialize, +)] pub enum PayloadLocation { /// Message payload is located on chain OnChain, @@ -44,8 +65,19 @@ pub enum PayloadLocation { /// Support for up to 16 user-enabled features on a collection. #[bitflags] #[repr(u16)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, RuntimeDebug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo)] +#[derive( + Copy, + Clone, + RuntimeDebug, + PartialEq, + Eq, + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + Serialize, + Deserialize, +)] pub enum SchemaSetting { /// Schema setting to enforce append-only behavior on payload. /// Applied to schemas of type `PayloadLocation::Itemized`. diff --git a/docker/instant-seal-node.dockerfile b/docker/instant-seal-node.dockerfile deleted file mode 100644 index 9ab008f60d..0000000000 --- a/docker/instant-seal-node.dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# Docker image for running Frequency parachain node container (with collating) -# locally in instant seal mode. Requires to run from repository root and to copy -# the binary in the build folder. -# This is the build stage for Polkadot. Here we create the binary in a temporary image. -FROM --platform=linux/amd64 ubuntu:22.04 AS base - -LABEL maintainer="Frequency" -LABEL description="Frequency collator node in instant seal mode" - -RUN apt-get update && apt-get install -y ca-certificates jq curl && update-ca-certificates - -# This is the 2nd stage: a very small image where we copy the Frequency binary -FROM --platform=linux/amd64 ubuntu:22.04 - -# We want jq and curl in the final image, but we don't need the support files -RUN apt-get update && \ - apt-get install -y jq curl && \ - apt-get clean && \ - rm -rf /usr/share/doc /usr/share/man /usr/share/zsh - -RUN useradd -m -u 1000 -U -s /bin/sh -d /frequency frequency && \ - mkdir -p /data /frequency/.local/share && \ - chown -R frequency:frequency /data && \ - ln -s /data /frequency/.local/share/frequency - -USER frequency - -COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -# For local testing only -# COPY --chown=frequency target/release/frequency.amd64 ./frequency/frequency -COPY --chown=frequency target/release/frequency ./frequency/ -RUN chmod +x ./frequency/frequency - -# 9944 for RPC call -# 30333 for p2p -# 9615 for Telemetry (prometheus) -EXPOSE 9944 30333 9615 - -VOLUME ["/data"] - -ENTRYPOINT ["/frequency/frequency", \ - # Required params for starting the chain - "--dev", \ - "-lruntime=debug", \ - "--no-telemetry", \ - "--no-prometheus", \ - "--port=30333", \ - "--rpc-port=9944", \ - "--rpc-external", \ - "--rpc-cors=all", \ - "--rpc-methods=Unsafe", \ - "--base-path=/data" \ - ] - -# Params which can be overriden from CLI -CMD ["--sealing=instant"] diff --git a/docker/instant-seal-node.overview.md b/docker/instant-seal-node.overview.md deleted file mode 100644 index 2b77a413c6..0000000000 --- a/docker/instant-seal-node.overview.md +++ /dev/null @@ -1,64 +0,0 @@ -# Frequency Collator Node in Local Only Sealing Mode - -## Deprecation Note - -This image has been deprecated and will be removed in a future Frequency release. The new image, [frequencychain/standalone-node](./standalone-node.overview.md), replaces it. Current usage patterns for this image are fully supported by the new image, as well as additional enhancements. -## - -### Description - -Runs just one collator node that will not connect to any other nodes. -Defaults to running in instant sealing mode where a block will be triggered when a transaction enters the validated transaction pool. -A "collator node" is a Frequency parachain node that is actively collating (aka forming blocks to submit to the relay chain, although in this case without a relay chain). - -### Quick Run - -```sh -docker run --rm -p 9944:9944 -p 30333:30333 frequencychain/instant-seal-node: -``` - - -## Trigger Block Manually - -If running in manual sealing mode or to form empty blocks in instant sealing mode, the `engine_createBlock` RPC can be used: - -```sh -curl http://localhost:9944 -H "Content-Type:application/json;charset=utf-8" -d '{ \ - "jsonrpc":"2.0", \ - "id":1, \ - "method":"engine_createBlock", \ - "params": [true, true] \ - }' -``` - - -## Default Arguments - -| Argument | Description | -| --- | --- | -| `--sealing=instant` | Manual sealing + automatically form a block each time a transaction enters the validated transaction pool | - -### Run - -Note: Docker `--rm` removes the volume when stopped. - -```sh -docker run --rm -p 9944:9944 -p 30333:30333 frequencychain/instant-seal-node: -``` - -## Overriding Arguments - -| Argument | Description | -| --- | --- | -| `--sealing=manual` | Only form a block when `engine_createBlock` RPC is called | -| `--help` | See all the options possible | - -### Run - -```sh -docker run --rm -p 9944:9944 -p 30333:30333 frequencychain/instant-seal-node: -- --manual-seal -``` - -| **Node** | **Ports** | **Explorer URL** | -| ----------------------- | :-------------------------------: | ----------------------------------------------------------------------------------------- | -| Frequency Local-Only Node | ws and rpc :`9944`, p2p:`3033` | [127.0.0.1:9944](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer) | diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 43b0d081d8..34f1bb91b6 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -81,14 +81,6 @@ pub struct Cli { #[clap(raw = true)] pub relay_chain_args: Vec, - #[cfg(feature = "frequency-no-relay")] - #[clap(long = "instant-sealing", help = "Deprecated. Use --sealing=instant instead.")] - pub instant_sealing: bool, - - #[cfg(feature = "frequency-no-relay")] - #[clap(long = "manual-sealing", help = "Deprecated. Use --sealing=manual instead.")] - pub manual_sealing: bool, - /// Instant block sealing /// Blocks are triggered to be formed each time a transaction hits the validated transaction pool /// Empty blocks can also be formed using the `engine_createBlock` RPC diff --git a/node/cli/src/run_as_localchain.rs b/node/cli/src/run_as_localchain.rs index 1a770edfc2..bb1febd350 100644 --- a/node/cli/src/run_as_localchain.rs +++ b/node/cli/src/run_as_localchain.rs @@ -1,23 +1,11 @@ use crate::cli::Cli; use frequency_service::block_sealing::frequency_dev_sealing; use sc_cli::SubstrateCli; -use std::process; pub fn run_as_localchain(cli: Cli) -> sc_service::Result<(), sc_cli::Error> { let runner = cli.create_runner(&cli.run.normalize())?; runner.run_node_until_exit(|config| async move { - if cli.instant_sealing { - log::error!( - "The --instant-sealing option is deprecated. Use --sealing=instant instead." - ); - process::exit(1); - } else if cli.manual_sealing { - log::error!( - "The --manual-sealing option is deprecated. Use --sealing=manual instead." - ); - process::exit(1); - } frequency_dev_sealing( config, cli.sealing, diff --git a/node/service/src/chain_spec/frequency_dev.rs b/node/service/src/chain_spec/frequency_dev.rs index fb3388265f..70bd2d3bca 100644 --- a/node/service/src/chain_spec/frequency_dev.rs +++ b/node/service/src/chain_spec/frequency_dev.rs @@ -86,6 +86,11 @@ fn template_session_keys(keys: AuraId) -> frequency_runtime::SessionKeys { frequency_runtime::SessionKeys { aura: keys } } +#[allow(clippy::unwrap_used)] +fn load_genesis_schemas() -> Vec { + serde_json::from_slice(include_bytes!("../../../../resources/genesis-schemas.json")).unwrap() +} + #[allow(clippy::unwrap_used)] fn development_genesis( invulnerables: Vec<(AccountId, AuraId)>, @@ -131,7 +136,10 @@ fn development_genesis( // Assign network admin rights. key: root_key, }, - schemas: Default::default(), + schemas: frequency_runtime::pallet_schemas::GenesisConfig { + initial_schemas: load_genesis_schemas(), + ..Default::default() + }, time_release: Default::default(), democracy: Default::default(), treasury: Default::default(), diff --git a/pallets/passkey/src/types.rs b/pallets/passkey/src/types.rs index d668b9f087..5b5bfa720c 100644 --- a/pallets/passkey/src/types.rs +++ b/pallets/passkey/src/types.rs @@ -19,7 +19,7 @@ pub type PasskeyAuthenticatorData = BoundedVec>; /// Passkey ClientDataJson type /// Note: The `challenge` field inside this json MUST be replaced with `CHALLENGE_PLACEHOLDER` /// before submission to the chain -/// https://w3c.github.io/webauthn/#dictdef-collectedclientdata +/// pub type PasskeyClientDataJson = BoundedVec>; /// PassKey Public Key type in compressed encoded point format /// the first byte is the tag indicating compressed format diff --git a/pallets/schemas/Cargo.toml b/pallets/schemas/Cargo.toml index e80a08722d..b9e88e7b60 100644 --- a/pallets/schemas/Cargo.toml +++ b/pallets/schemas/Cargo.toml @@ -21,6 +21,7 @@ frame-support = { workspace = true } frame-system = { workspace = true } numtoa = { workspace = true, optional = true } scale-info = { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["alloc"] } smallvec = { workspace = true } sp-core = { workspace = true } diff --git a/pallets/schemas/src/lib.rs b/pallets/schemas/src/lib.rs index a6d7b51ef0..577c825982 100644 --- a/pallets/schemas/src/lib.rs +++ b/pallets/schemas/src/lib.rs @@ -239,6 +239,8 @@ pub mod pallet { pub struct GenesisConfig { /// Maximum schema size in bytes at genesis pub initial_max_schema_model_size: u32, + /// Genesis Schemas to load for development + pub initial_schemas: Vec, /// Phantom type #[serde(skip)] pub _config: PhantomData, @@ -246,13 +248,49 @@ pub mod pallet { impl sp_std::default::Default for GenesisConfig { fn default() -> Self { - Self { initial_max_schema_model_size: 1024, _config: Default::default() } + Self { + initial_max_schema_model_size: 1024, + initial_schemas: Default::default(), + _config: Default::default(), + } } } #[pallet::genesis_build] impl BuildGenesisConfig for GenesisConfig { fn build(&self) { GovernanceSchemaModelMaxBytes::::put(self.initial_max_schema_model_size); + + // Load in the Genesis Schemas + for schema in self.initial_schemas.iter() { + let model: BoundedVec = + BoundedVec::try_from(schema.model.clone().into_bytes()).expect( + "Genesis Schema Model larger than SchemaModelMaxBytesBoundedVecLimit", + ); + let name_payload: SchemaNamePayload = + BoundedVec::try_from(schema.name.clone().into_bytes()) + .expect("Genesis Schema Name larger than SCHEMA_NAME_BYTES_MAX"); + let parsed_name: Option = if name_payload.len() > 0 { + Some( + SchemaName::try_parse::(name_payload, true) + .expect("Bad Genesis Schema Name"), + ) + } else { + None + }; + let settings: BoundedVec = + BoundedVec::try_from(schema.settings.clone()).expect( + "Bad Genesis Schema Settings. Perhaps larger than MaxSchemaSettingsPerSchema" + ); + + let _ = Pallet::::add_schema( + model, + schema.model_type, + schema.payload_location, + settings, + parsed_name, + ) + .expect("Failed to set Schema in Genesis!"); + } } } @@ -732,7 +770,7 @@ pub mod pallet { payload_location: schema_info.payload_location, settings, }; - return Some(response) + return Some(response); } None } diff --git a/pallets/schemas/src/tests/mock.rs b/pallets/schemas/src/tests/mock.rs index 5c61b53d45..aa13c69abc 100644 --- a/pallets/schemas/src/tests/mock.rs +++ b/pallets/schemas/src/tests/mock.rs @@ -117,7 +117,7 @@ impl pallet_schemas::Config for Test { // is actually allowed. type SchemaModelMaxBytesBoundedVecLimit = SchemaModelMaxBytesBoundedVecLimit; type MaxSchemaRegistrations = MaxSchemaRegistrations; - type MaxSchemaSettingsPerSchema = ConstU32<1>; + type MaxSchemaSettingsPerSchema = ConstU32<2>; // The proposal type type Proposal = RuntimeCall; // The Council proposal provider interface diff --git a/pallets/schemas/src/tests/other_tests.rs b/pallets/schemas/src/tests/other_tests.rs index 69d3163629..5fc7d314b9 100644 --- a/pallets/schemas/src/tests/other_tests.rs +++ b/pallets/schemas/src/tests/other_tests.rs @@ -16,7 +16,7 @@ use frame_support::{ }; use parity_scale_codec::Encode; use serial_test::serial; -use sp_runtime::DispatchError::BadOrigin; +use sp_runtime::{BuildStorage, DispatchError::BadOrigin}; use crate::{ Error, Event as AnnouncementEvent, SchemaDescriptor, SchemaName, SchemaNamePayload, @@ -1050,3 +1050,31 @@ fn propose_to_create_schema_name_happy_path() { ); }) } + +#[test] +fn genesis_config_build_genesis_schemas() { + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + crate::GenesisConfig:: { + initial_schemas: serde_json::from_slice(include_bytes!( + "../../../../resources/genesis-schemas.json" + )) + .unwrap(), + ..Default::default() + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext: sp_io::TestExternalities = t.into(); + + ext.execute_with(|| { + System::set_block_number(1); + let res = SchemasPallet::get_current_schema_identifier_maximum(); + + // We should have at least 10 + assert!(res >= 10); + + // Check that the first schema exists + let res = SchemasPallet::get_schema_by_id(1); + assert!(res.is_some()); + }); +} diff --git a/pallets/schemas/src/types.rs b/pallets/schemas/src/types.rs index 5cdddfdcd1..7eb4e12b9b 100644 --- a/pallets/schemas/src/types.rs +++ b/pallets/schemas/src/types.rs @@ -1,7 +1,8 @@ //! Types for the Schema Pallet use crate::{Config, Error}; use common_primitives::schema::{ - ModelType, PayloadLocation, SchemaId, SchemaSettings, SchemaVersion, SchemaVersionResponse, + ModelType, PayloadLocation, SchemaId, SchemaSetting, SchemaSettings, SchemaVersion, + SchemaVersionResponse, }; use frame_support::{ensure, pallet_prelude::ConstU32, traits::StorageVersion, BoundedVec}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; @@ -38,6 +39,21 @@ pub const SEPARATOR_CHAR: char = '.'; /// -1 is to avoid overflow when converting the (index + 1) to `SchemaVersion` in `SchemaVersionId` pub const MAX_NUMBER_OF_VERSIONS: u32 = SchemaVersion::MAX as u32 - 1; +#[derive(Debug, serde::Serialize, serde::Deserialize)] +/// Genesis Schemas need a way to load up and this is it! +pub struct GenesisSchema { + /// The type of model (AvroBinary, Parquet, etc.) + pub model_type: ModelType, + /// The payload location + pub payload_location: PayloadLocation, + /// The Payload Model + pub model: String, + /// Schema Full Name: {Namespace}.{Descriptor} + pub name: String, + /// Settings + pub settings: Vec, +} + #[derive(Clone, Encode, Decode, PartialEq, Debug, TypeInfo, Eq, MaxEncodedLen)] /// A structure defining a Schema information (excluding the payload) pub struct SchemaInfo { diff --git a/resources/genesis-schemas.json b/resources/genesis-schemas.json new file mode 100644 index 0000000000..d2b1a8edd3 --- /dev/null +++ b/resources/genesis-schemas.json @@ -0,0 +1,75 @@ +[ + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"targetAnnouncementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"targetContentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true}]", + "name": "dsnp.tombstone" + }, + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"contentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"url\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":false}]", + "name": "dsnp.broadcast" + }, + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"contentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"inReplyTo\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"url\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":false}]", + "name": "dsnp.reply" + }, + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"emoji\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"apply\",\"column_type\":{\"INTEGER\":{\"bit_width\":8,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"inReplyTo\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":true}]", + "name": "dsnp.reaction" + }, + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"contentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"url\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"targetAnnouncementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"targetContentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true}]", + "name": "dsnp.profile" + }, + { + "model_type": "Parquet", + "payload_location": "IPFS", + "settings": [], + "model": "[{\"name\":\"announcementType\",\"column_type\":{\"INTEGER\":{\"bit_width\":32,\"sign\":true}},\"compression\":\"GZIP\",\"bloom_filter\":false},{\"name\":\"contentHash\",\"column_type\":\"BYTE_ARRAY\",\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"fromId\",\"column_type\":{\"INTEGER\":{\"bit_width\":64,\"sign\":false}},\"compression\":\"GZIP\",\"bloom_filter\":true},{\"name\":\"url\",\"column_type\":\"STRING\",\"compression\":\"GZIP\",\"bloom_filter\":false}]", + "name": "dsnp.update" + }, + { + "model_type": "AvroBinary", + "payload_location": "Itemized", + "settings": [ + "AppendOnly", + "SignatureRequired" + ], + "model": "{\"type\":\"record\",\"name\":\"PublicKey\",\"namespace\":\"org.dsnp\",\"fields\":[{\"name\":\"publicKey\",\"doc\":\"Multicodec public key\",\"type\":\"bytes\"}]}", + "name": "" + }, + { + "model_type": "AvroBinary", + "payload_location": "Paginated", + "settings": [], + "model": "{\"type\":\"record\",\"name\":\"UserPublicFollowsChunk\",\"namespace\":\"org.dsnp\",\"fields\":[{\"name\":\"compressedPublicGraph\",\"type\":\"bytes\"}],\"types\":[{\"type\":\"array\",\"name\":\"PublicGraph\",\"namespace\":\"org.dsnp\",\"items\":{\"type\":\"record\",\"name\":\"GraphEdge\",\"fields\":[{\"name\":\"userId\",\"type\":\"long\",\"doc\":\"DSNP User Id of object of relationship\"},{\"name\":\"since\",\"type\":\"long\",\"doc\":\"Unix epoch in seconds when this relationship was originally established rounded to the nearest 1000\"}]}}]}", + "name": "" + }, + { + "model_type": "AvroBinary", + "payload_location": "Paginated", + "settings": [], + "model": "{\"type\":\"record\",\"name\":\"UserPrivateFollowsChunk\",\"namespace\":\"org.dsnp\",\"fields\":[{\"name\":\"keyId\",\"type\":\"long\",\"doc\":\"User-Assigned Key Identifier\"},{\"doc\":\"lib_sodium sealed box\",\"name\":\"encryptedCompressedPrivateGraph\",\"type\":\"bytes\"}],\"types\":[{\"type\":\"array\",\"name\":\"PrivateGraph\",\"namespace\":\"org.dsnp\",\"items\":{\"type\":\"record\",\"name\":\"GraphEdge\",\"fields\":[{\"name\":\"userId\",\"type\":\"long\",\"doc\":\"DSNP User Id of object of relationship\"},{\"name\":\"since\",\"type\":\"long\",\"doc\":\"Unix epoch in seconds when this relationship was originally established rounded to the nearest 1000\"}]}}]}", + "name": "" + }, + { + "model_type": "AvroBinary", + "payload_location": "Paginated", + "settings": [], + "model": "{\"type\":\"record\",\"name\":\"UserPrivateConnectionsChunk\",\"namespace\":\"org.dsnp\",\"fields\":[{\"name\":\"keyId\",\"type\":\"long\",\"doc\":\"User-Assigned Key Identifier\"},{\"name\":\"pridList\",\"type\":{\"type\":\"array\",\"items\":{\"name\":\"prid\",\"type\":\"fixed\",\"size\":8,\"doc\":\"Pseudonymous Relationship Identifier\"}}},{\"doc\":\"lib_sodium sealed box\",\"name\":\"encryptedCompressedPrivateGraph\",\"type\":\"bytes\"}],\"types\":[{\"type\":\"array\",\"name\":\"PrivateGraph\",\"namespace\":\"org.dsnp\",\"items\":{\"type\":\"record\",\"name\":\"GraphEdge\",\"fields\":[{\"name\":\"userId\",\"type\":\"long\",\"doc\":\"DSNP User Id of object of relationship\"},{\"name\":\"since\",\"type\":\"long\",\"doc\":\"Unix epoch in seconds when this relationship was originally established rounded to the nearest 1000\"}]}}]}", + "name": "" + } +] diff --git a/tools/genesis-data/getSchema.mjs b/tools/genesis-data/getSchema.mjs new file mode 100644 index 0000000000..01f9e57318 --- /dev/null +++ b/tools/genesis-data/getSchema.mjs @@ -0,0 +1,89 @@ +// Only way to silence PolkadotJS API warnings we don't want +console.warn = () => {}; + +import { ApiPromise, WsProvider } from "@polkadot/api"; + +const options = { + rpc: { + schemas: { + getBySchemaId: { + description: "Get a Schema by Id", + params: [ + { + name: "schema_id", + type: "SchemaId", + }, + ], + type: "Option", + }, + }, + }, + types: { + SchemaId: "u16", + SchemaModel: "Vec", + SchemaResponse: { + schema_id: "SchemaId", + model: "SchemaModel", + model_type: "ModelType", + payload_location: "PayloadLocation", + settings: "Vec", + }, + ModelType: { + _enum: ["AvroBinary", "Parquet"], + }, + PayloadLocation: { + _enum: ["OnChain", "IPFS", "Itemized", "Paginated"], + }, + SchemaSetting: { + _enum: ["AppendOnly", "SignatureRequired"], + }, + }, +}; + +export async function getSchemas(sourceUrl) { + // Connect to the state source + const sourceProvider = new WsProvider(sourceUrl); + const sourceApi = await ApiPromise.create({ provider: sourceProvider, ...options }); + + const genesisSchemasList = []; + // Schema Genesis Format + // { + // "model": "{}", + // "model_type": "AvroBinary", + // "name": "dsnp.thing", + // "payload_location": "Itemized", + // "settings": ["AppendOnly", "SignatureRequired"] + // } + + // Get the max schema id + const maxSchemaId = (await sourceApi.query.schemas.currentSchemaIdentifierMaximum()).toNumber(); + + // Get all schemas + for (let id = 1; id <= maxSchemaId; id++) { + const schemaOption = await sourceApi.rpc.schemas.getBySchemaId(id); + if (!schemaOption.isSome) throw new Error(`Unable to get Schema Id ${id}!`); + const schema = schemaOption.unwrap(); + genesisSchemasList[id - 1] = { + model_type: schema.model_type.toString(), + payload_location: schema.payload_location.toString(), + settings: schema.settings.toJSON(), + model: new TextDecoder().decode(schema.model), + name: "", + }; + } + + // Get all the schema names TODO: Switch to entriesPaged at some point + const names = await sourceApi.query.schemas.schemaNameToIds.entries(); + + for (const storageName of names) { + const name = storageName[0].toHuman(); + for (const idBig of storageName[1].ids) { + const id = idBig.toNumber(); + if (genesisSchemasList[id - 1]) { + genesisSchemasList[id - 1].name = name.join("."); + } + } + } + + process.stdout.write(JSON.stringify(genesisSchemasList, null, 2) + "\n"); +} diff --git a/tools/genesis-data/package-lock.json b/tools/genesis-data/package-lock.json new file mode 100644 index 0000000000..f60fe94f85 --- /dev/null +++ b/tools/genesis-data/package-lock.json @@ -0,0 +1,851 @@ +{ + "name": "genesis-data", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "genesis-data", + "version": "1.0.0", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api": "^12.1.1" + } + }, + "node_modules/@noble/curves": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz", + "integrity": "sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==", + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@polkadot-api/json-rpc-provider": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz", + "integrity": "sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA==", + "optional": true + }, + "node_modules/@polkadot-api/json-rpc-provider-proxy": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.0.1.tgz", + "integrity": "sha512-gmVDUP8LpCH0BXewbzqXF2sdHddq1H1q+XrAW2of+KZj4woQkIGBRGTJHeBEVHe30EB+UejR1N2dT4PO/RvDdg==", + "optional": true + }, + "node_modules/@polkadot-api/metadata-builders": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.0.1.tgz", + "integrity": "sha512-GCI78BHDzXAF/L2pZD6Aod/yl82adqQ7ftNmKg51ixRL02JpWUA+SpUKTJE5MY1p8kiJJIo09P2um24SiJHxNA==", + "optional": true, + "dependencies": { + "@polkadot-api/substrate-bindings": "0.0.1", + "@polkadot-api/utils": "0.0.1" + } + }, + "node_modules/@polkadot-api/observable-client": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.1.0.tgz", + "integrity": "sha512-GBCGDRztKorTLna/unjl/9SWZcRmvV58o9jwU2Y038VuPXZcr01jcw/1O3x+yeAuwyGzbucI/mLTDa1QoEml3A==", + "optional": true, + "dependencies": { + "@polkadot-api/metadata-builders": "0.0.1", + "@polkadot-api/substrate-bindings": "0.0.1", + "@polkadot-api/substrate-client": "0.0.1", + "@polkadot-api/utils": "0.0.1" + }, + "peerDependencies": { + "rxjs": ">=7.8.0" + } + }, + "node_modules/@polkadot-api/substrate-bindings": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.0.1.tgz", + "integrity": "sha512-bAe7a5bOPnuFVmpv7y4BBMRpNTnMmE0jtTqRUw/+D8ZlEHNVEJQGr4wu3QQCl7k1GnSV1wfv3mzIbYjErEBocg==", + "optional": true, + "dependencies": { + "@noble/hashes": "^1.3.1", + "@polkadot-api/utils": "0.0.1", + "@scure/base": "^1.1.1", + "scale-ts": "^1.6.0" + } + }, + "node_modules/@polkadot-api/substrate-client": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-client/-/substrate-client-0.0.1.tgz", + "integrity": "sha512-9Bg9SGc3AwE+wXONQoW8GC00N3v6lCZLW74HQzqB6ROdcm5VAHM4CB/xRzWSUF9CXL78ugiwtHx3wBcpx4H4Wg==", + "optional": true + }, + "node_modules/@polkadot-api/utils": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/utils/-/utils-0.0.1.tgz", + "integrity": "sha512-3j+pRmlF9SgiYDabSdZsBSsN5XHbpXOAce1lWj56IEEaFZVjsiCaxDOA7C9nCcgfVXuvnbxqqEGQvnY+QfBAUw==", + "optional": true + }, + "node_modules/@polkadot/api": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-12.1.1.tgz", + "integrity": "sha512-XvX1gRUsnHDkEARBS1TAFCXncp6YABf/NCtOBt8FohokSzvB6Kxrcb6zurMbUm2piOdjgW5xsG3TCDRw6vACLA==", + "dependencies": { + "@polkadot/api-augment": "12.1.1", + "@polkadot/api-base": "12.1.1", + "@polkadot/api-derive": "12.1.1", + "@polkadot/keyring": "^12.6.2", + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/rpc-core": "12.1.1", + "@polkadot/rpc-provider": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/types-known": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "eventemitter3": "^5.0.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-12.1.1.tgz", + "integrity": "sha512-x2cI4mt4y2DZ8b8BoxchlkkpdmvhmOqCLr7IHPcQGaHsA/oLYSgZk8YSvUFb6+W3WjnIZiNMzv/+UB9jQuGQ2Q==", + "dependencies": { + "@polkadot/api-base": "12.1.1", + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-base": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-12.1.1.tgz", + "integrity": "sha512-/zLnekv5uFnjzYWhjUf6m0WOJorA0Qm/CWg7z6V+INnacDmVD+WIgYW+XLka90KXpW92sN5ycZEdcQGKBxSJOg==", + "dependencies": { + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/util": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-derive": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-12.1.1.tgz", + "integrity": "sha512-VMwHcQY8gU/fhwgRICs9/EwTZVMSWW9Gf1ktwsWQmNM1RnrR6oN4/hvzsQor4Be/mC93w2f8bX/71QVmOgL5NA==", + "dependencies": { + "@polkadot/api": "12.1.1", + "@polkadot/api-augment": "12.1.1", + "@polkadot/api-base": "12.1.1", + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/keyring": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", + "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", + "dependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/util-crypto": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/util-crypto": "12.6.2" + } + }, + "node_modules/@polkadot/networks": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.2.tgz", + "integrity": "sha512-1oWtZm1IvPWqvMrldVH6NI2gBoCndl5GEwx7lAuQWGr7eNL+6Bdc5K3Z9T0MzFvDGoi2/CBqjX9dRKo39pDC/w==", + "dependencies": { + "@polkadot/util": "12.6.2", + "@substrate/ss58-registry": "^1.44.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-12.1.1.tgz", + "integrity": "sha512-oDPn070l94pppXbuVk75BVsYgupdV8ndmslnUKWpPlfOeAU5SaBu4jMkj3eAi3VH0ersUpmlp1UuYN612//h8w==", + "dependencies": { + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-core": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-12.1.1.tgz", + "integrity": "sha512-NB4BZo9RdAZPBfZ11NoujB8+SDkDgvlrSiiv9FPMhfvTJo0Sr5FAq0Wd2aSC4D/6qbt5e89CHOW+0gBEm9d6dw==", + "dependencies": { + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/rpc-provider": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/util": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-provider": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-12.1.1.tgz", + "integrity": "sha512-nDr0Qb5sIzTTx6qmgr9ibNcQs/VDoPzZ+49kcltf0A6BdSytGy532Yhf2A158aD41324V9YPAzxVRLxZyJzhkw==", + "dependencies": { + "@polkadot/keyring": "^12.6.2", + "@polkadot/types": "12.1.1", + "@polkadot/types-support": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "@polkadot/x-fetch": "^12.6.2", + "@polkadot/x-global": "^12.6.2", + "@polkadot/x-ws": "^12.6.2", + "eventemitter3": "^5.0.1", + "mock-socket": "^9.3.1", + "nock": "^13.5.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@substrate/connect": "0.8.10" + } + }, + "node_modules/@polkadot/types": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-12.1.1.tgz", + "integrity": "sha512-+b8v7ORjL20r6VvdWL/fPTHmDXtfAfqkQQxBB6exxOhqrnJfnhAYQjJomKcyj1VMTQiyyR9FBAc7vVvTEFX2ew==", + "dependencies": { + "@polkadot/keyring": "^12.6.2", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-12.1.1.tgz", + "integrity": "sha512-HdzjaXapcmNAdT6TWJOuv124PTKbAf5+5JldQ7oPZFaCEhaOTazZYiZ27nqLaj0l4rG7wWzFMiGqjbHwAvtmlg==", + "dependencies": { + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-codec": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-12.1.1.tgz", + "integrity": "sha512-Ob3nFptHT4dDvGc/3l4dBXmvsI3wDWS2oCOxACA+hYWufnlTIQ4M4sHI4kSBQvDoEmaFt8P2Be4SmtyT0VSd1w==", + "dependencies": { + "@polkadot/util": "^12.6.2", + "@polkadot/x-bigint": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-create": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-12.1.1.tgz", + "integrity": "sha512-K/I4vCnmI7IbtQeURiRMONDqesIVcZp16KEduBcbJm/RWDj0D3mr71066Yr8OhrhteLvULJpViy7EK4ynPvmSw==", + "dependencies": { + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-known": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-12.1.1.tgz", + "integrity": "sha512-4YxY7tB+BVX6k3ubrToYKyh2Jb4QvoLvzwNSGSjyj0RGwiQCu8anFGIzYdaUJ2iQlhLFb6P4AZWykVvhrXGmqg==", + "dependencies": { + "@polkadot/networks": "^12.6.2", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-support": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-12.1.1.tgz", + "integrity": "sha512-mLXrbj0maKFWqV1+4QRzaNnZyV/rAQW0XSrIzfIZn//zSRSIUaXaVAZ62uzgdmzXXFH2qD3hpNlmvmjcEMm2Qg==", + "dependencies": { + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", + "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", + "dependencies": { + "@polkadot/x-bigint": "12.6.2", + "@polkadot/x-global": "12.6.2", + "@polkadot/x-textdecoder": "12.6.2", + "@polkadot/x-textencoder": "12.6.2", + "@types/bn.js": "^5.1.5", + "bn.js": "^5.2.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util-crypto": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", + "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", + "dependencies": { + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", + "@polkadot/networks": "12.6.2", + "@polkadot/util": "12.6.2", + "@polkadot/wasm-crypto": "^7.3.2", + "@polkadot/wasm-util": "^7.3.2", + "@polkadot/x-bigint": "12.6.2", + "@polkadot/x-randomvalues": "12.6.2", + "@scure/base": "^1.1.5", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2" + } + }, + "node_modules/@polkadot/wasm-bridge": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz", + "integrity": "sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g==", + "dependencies": { + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz", + "integrity": "sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw==", + "dependencies": { + "@polkadot/wasm-bridge": "7.3.2", + "@polkadot/wasm-crypto-asmjs": "7.3.2", + "@polkadot/wasm-crypto-init": "7.3.2", + "@polkadot/wasm-crypto-wasm": "7.3.2", + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-asmjs": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz", + "integrity": "sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-init": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz", + "integrity": "sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g==", + "dependencies": { + "@polkadot/wasm-bridge": "7.3.2", + "@polkadot/wasm-crypto-asmjs": "7.3.2", + "@polkadot/wasm-crypto-wasm": "7.3.2", + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-wasm": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz", + "integrity": "sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw==", + "dependencies": { + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/wasm-util": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz", + "integrity": "sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/x-bigint": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.2.tgz", + "integrity": "sha512-HSIk60uFPX4GOFZSnIF7VYJz7WZA7tpFJsne7SzxOooRwMTWEtw3fUpFy5cYYOeLh17/kHH1Y7SVcuxzVLc74Q==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-fetch": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.2.tgz", + "integrity": "sha512-8wM/Z9JJPWN1pzSpU7XxTI1ldj/AfC8hKioBlUahZ8gUiJaOF7K9XEFCrCDLis/A1BoOu7Ne6WMx/vsJJIbDWw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "node-fetch": "^3.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-global": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.2.tgz", + "integrity": "sha512-a8d6m+PW98jmsYDtAWp88qS4dl8DyqUBsd0S+WgyfSMtpEXu6v9nXDgPZgwF5xdDvXhm+P0ZfVkVTnIGrScb5g==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-randomvalues": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", + "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/wasm-util": "*" + } + }, + "node_modules/@polkadot/x-textdecoder": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", + "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-textencoder": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", + "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-ws": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.2.tgz", + "integrity": "sha512-cGZWo7K5eRRQCRl2LrcyCYsrc3lRbTlixZh3AzgU8uX4wASVGRlNWi/Hf4TtHNe1ExCDmxabJzdIsABIfrr7xw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2", + "ws": "^8.15.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@scure/base": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", + "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@substrate/connect": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.8.10.tgz", + "integrity": "sha512-DIyQ13DDlXqVFnLV+S6/JDgiGowVRRrh18kahieJxhgvzcWicw5eLc6jpfQ0moVVLBYkO7rctB5Wreldwpva8w==", + "deprecated": "versions below 1.x are no longer maintained", + "optional": true, + "dependencies": { + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.4", + "@substrate/light-client-extension-helpers": "^0.0.6", + "smoldot": "2.0.22" + } + }, + "node_modules/@substrate/connect-extension-protocol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.0.0.tgz", + "integrity": "sha512-nKu8pDrE3LNCEgJjZe1iGXzaD6OSIDD4Xzz/yo4KO9mQ6LBvf49BVrt4qxBFGL6++NneLiWUZGoh+VSd4PyVIg==", + "optional": true + }, + "node_modules/@substrate/connect-known-chains": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@substrate/connect-known-chains/-/connect-known-chains-1.1.8.tgz", + "integrity": "sha512-W0Cpnk//LoMTu5BGDCRRg5NHFR2aZ9OJtLGSgRyq1RP39dQGpoVZIgNC6z+SWRzlmOz3gIgkUCwGvOKVt2BabA==", + "optional": true + }, + "node_modules/@substrate/light-client-extension-helpers": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-0.0.6.tgz", + "integrity": "sha512-girltEuxQ1BvkJWmc8JJlk4ZxnlGXc/wkLcNguhY+UoDEMBK0LsdtfzQKIfrIehi4QdeSBlFEFBoI4RqPmsZzA==", + "optional": true, + "dependencies": { + "@polkadot-api/json-rpc-provider": "0.0.1", + "@polkadot-api/json-rpc-provider-proxy": "0.0.1", + "@polkadot-api/observable-client": "0.1.0", + "@polkadot-api/substrate-client": "0.0.1", + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.4", + "rxjs": "^7.8.1" + }, + "peerDependencies": { + "smoldot": "2.x" + } + }, + "node_modules/@substrate/ss58-registry": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.49.0.tgz", + "integrity": "sha512-leW6Ix4LD7XgvxT7+aobPWSw+WvPcN2Rxof1rmd0mNC5t2n99k1N7UNEvz7YEFSOUeHWmKIY7F5q8KeIqYoHfA==" + }, + "node_modules/@types/bn.js": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz", + "integrity": "sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.14.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz", + "integrity": "sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/mock-socket": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz", + "integrity": "sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nock": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz", + "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==", + "dependencies": { + "debug": "^4.1.0", + "json-stringify-safe": "^5.0.1", + "propagate": "^2.0.0" + }, + "engines": { + "node": ">= 10.13" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/propagate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", + "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/scale-ts": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/scale-ts/-/scale-ts-1.6.0.tgz", + "integrity": "sha512-Ja5VCjNZR8TGKhUumy9clVVxcDpM+YFjAnkMuwQy68Hixio3VRRvWdE3g8T/yC+HXA0ZDQl2TGyUmtmbcVl40Q==", + "optional": true + }, + "node_modules/smoldot": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.22.tgz", + "integrity": "sha512-B50vRgTY6v3baYH6uCgL15tfaag5tcS2o/P5q1OiXcKGv1axZDfz2dzzMuIkVpyMR2ug11F6EAtQlmYBQd292g==", + "optional": true, + "dependencies": { + "ws": "^8.8.1" + } + }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/tools/genesis-data/package.json b/tools/genesis-data/package.json new file mode 100644 index 0000000000..b8603d8ce4 --- /dev/null +++ b/tools/genesis-data/package.json @@ -0,0 +1,13 @@ +{ + "name": "genesis-data", + "version": "1.0.0", + "description": "Gets data from mainnet and outputs them in formats for use with local genesis", + "scripts": { + "schemas": "node schemas.mjs" + }, + "author": "", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api": "^12.1.1" + } +} diff --git a/tools/genesis-data/schemas.mjs b/tools/genesis-data/schemas.mjs new file mode 100644 index 0000000000..a7f9e05e90 --- /dev/null +++ b/tools/genesis-data/schemas.mjs @@ -0,0 +1,17 @@ +// This small nodejs script will pull the schemas from mainnet and then output them in Genesis Schema format + +import { getSchemas } from "./getSchema.mjs"; + +const SOURCE_URL = "wss://1.rpc.frequency.xyz"; + +async function main() { + try { + await getSchemas(SOURCE_URL); + process.exit(0); + } catch (error) { + console.error("Error:", error); + process.exit(1); + } +} + +main(); diff --git a/tools/state-copy/copy.mjs b/tools/state-copy/copy.mjs new file mode 100644 index 0000000000..66d2e74ab9 --- /dev/null +++ b/tools/state-copy/copy.mjs @@ -0,0 +1,73 @@ +import { ApiPromise, WsProvider } from "@polkadot/api"; +import { Keyring } from "@polkadot/keyring"; + +const keyring = new Keyring({ type: "sr25519" }); + +async function getKeys(api, storageKey) { + const pageSize = 500; + const result = []; + let startKey = ""; + while (true) { + const page = await api.rpc.state.getKeysPaged(storageKey, pageSize, startKey); + result.push(...page.map((x) => x.toString())); + if (page.length === 0) { + break; + } + + startKey = page[page.length - 1].toString(); + } + return result; +} + +export async function copy(sourceUrl, destUrl, storageKey, filterKeys = []) { + // Connect to the state source + const sourceProvider = new WsProvider(sourceUrl); + const sourceApi = await ApiPromise.create({ provider: sourceProvider }); + + // Connect to destination source + const destProvider = new WsProvider(destUrl); + const destApi = await ApiPromise.create({ provider: destProvider }); + + console.log("Connected to both networks"); + + // Get all keys from the specified pallet + const keys = (await getKeys(sourceApi, storageKey)).filter((k) => !filterKeys.includes(k)); + console.log(`Found ${keys.length} keys under ${storageKey}...`); + + // Fetch values for all keys + const storageKV = await Promise.all( + keys.map(async (key) => { + const value = await sourceApi.rpc.state.getStorage(key); + return [key, value.toHex()]; + }), + ); + + console.log("Fetched all values", storageKV); + + // Set up sudo account (assumes //Alice has sudo access) + const sudoAccount = keyring.createFromUri("//Alice"); + + // Prepare and send sudo.sudo(system.setStorage()) call + const sudoCall = destApi.tx.sudo.sudo(destApi.tx.system.setStorage(storageKV)); + + console.log("Submitting sudo call to set storage..."); + await new Promise(async (resolve, reject) => { + const unsub = await sudoCall.signAndSend(sudoAccount, ({ status, events }) => { + if (status.isInBlock || status.isFinalized) { + console.log( + `Block hash: ${(status.isInBlock && status.asInBlock) || (status.isFinalized && status.asFinalized)}`, + ); + const success = events.find((x) => destApi.events.system.ExtrinsicSuccess.is(x.event)); + const failure = events.find((x) => destApi.events.system.ExtrinsicFailed.is(x.event)); + unsub(); + if (success && !failure) { + console.log("State copy successful"); + resolve(); + } else { + console.error("State copy FAILED!"); + reject(); + } + } + }); + }); +} diff --git a/tools/state-copy/package-lock.json b/tools/state-copy/package-lock.json new file mode 100644 index 0000000000..bc52d0eed8 --- /dev/null +++ b/tools/state-copy/package-lock.json @@ -0,0 +1,852 @@ +{ + "name": "state-copy", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "state-copy", + "version": "1.0.0", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api": "^12.1.1", + "@polkadot/keyring": "^12.6.2" + } + }, + "node_modules/@noble/curves": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz", + "integrity": "sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==", + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@polkadot-api/json-rpc-provider": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz", + "integrity": "sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA==", + "optional": true + }, + "node_modules/@polkadot-api/json-rpc-provider-proxy": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.0.1.tgz", + "integrity": "sha512-gmVDUP8LpCH0BXewbzqXF2sdHddq1H1q+XrAW2of+KZj4woQkIGBRGTJHeBEVHe30EB+UejR1N2dT4PO/RvDdg==", + "optional": true + }, + "node_modules/@polkadot-api/metadata-builders": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.0.1.tgz", + "integrity": "sha512-GCI78BHDzXAF/L2pZD6Aod/yl82adqQ7ftNmKg51ixRL02JpWUA+SpUKTJE5MY1p8kiJJIo09P2um24SiJHxNA==", + "optional": true, + "dependencies": { + "@polkadot-api/substrate-bindings": "0.0.1", + "@polkadot-api/utils": "0.0.1" + } + }, + "node_modules/@polkadot-api/observable-client": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.1.0.tgz", + "integrity": "sha512-GBCGDRztKorTLna/unjl/9SWZcRmvV58o9jwU2Y038VuPXZcr01jcw/1O3x+yeAuwyGzbucI/mLTDa1QoEml3A==", + "optional": true, + "dependencies": { + "@polkadot-api/metadata-builders": "0.0.1", + "@polkadot-api/substrate-bindings": "0.0.1", + "@polkadot-api/substrate-client": "0.0.1", + "@polkadot-api/utils": "0.0.1" + }, + "peerDependencies": { + "rxjs": ">=7.8.0" + } + }, + "node_modules/@polkadot-api/substrate-bindings": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.0.1.tgz", + "integrity": "sha512-bAe7a5bOPnuFVmpv7y4BBMRpNTnMmE0jtTqRUw/+D8ZlEHNVEJQGr4wu3QQCl7k1GnSV1wfv3mzIbYjErEBocg==", + "optional": true, + "dependencies": { + "@noble/hashes": "^1.3.1", + "@polkadot-api/utils": "0.0.1", + "@scure/base": "^1.1.1", + "scale-ts": "^1.6.0" + } + }, + "node_modules/@polkadot-api/substrate-client": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-client/-/substrate-client-0.0.1.tgz", + "integrity": "sha512-9Bg9SGc3AwE+wXONQoW8GC00N3v6lCZLW74HQzqB6ROdcm5VAHM4CB/xRzWSUF9CXL78ugiwtHx3wBcpx4H4Wg==", + "optional": true + }, + "node_modules/@polkadot-api/utils": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/utils/-/utils-0.0.1.tgz", + "integrity": "sha512-3j+pRmlF9SgiYDabSdZsBSsN5XHbpXOAce1lWj56IEEaFZVjsiCaxDOA7C9nCcgfVXuvnbxqqEGQvnY+QfBAUw==", + "optional": true + }, + "node_modules/@polkadot/api": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-12.1.1.tgz", + "integrity": "sha512-XvX1gRUsnHDkEARBS1TAFCXncp6YABf/NCtOBt8FohokSzvB6Kxrcb6zurMbUm2piOdjgW5xsG3TCDRw6vACLA==", + "dependencies": { + "@polkadot/api-augment": "12.1.1", + "@polkadot/api-base": "12.1.1", + "@polkadot/api-derive": "12.1.1", + "@polkadot/keyring": "^12.6.2", + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/rpc-core": "12.1.1", + "@polkadot/rpc-provider": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/types-known": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "eventemitter3": "^5.0.1", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-12.1.1.tgz", + "integrity": "sha512-x2cI4mt4y2DZ8b8BoxchlkkpdmvhmOqCLr7IHPcQGaHsA/oLYSgZk8YSvUFb6+W3WjnIZiNMzv/+UB9jQuGQ2Q==", + "dependencies": { + "@polkadot/api-base": "12.1.1", + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-base": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-12.1.1.tgz", + "integrity": "sha512-/zLnekv5uFnjzYWhjUf6m0WOJorA0Qm/CWg7z6V+INnacDmVD+WIgYW+XLka90KXpW92sN5ycZEdcQGKBxSJOg==", + "dependencies": { + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/util": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-derive": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-12.1.1.tgz", + "integrity": "sha512-VMwHcQY8gU/fhwgRICs9/EwTZVMSWW9Gf1ktwsWQmNM1RnrR6oN4/hvzsQor4Be/mC93w2f8bX/71QVmOgL5NA==", + "dependencies": { + "@polkadot/api": "12.1.1", + "@polkadot/api-augment": "12.1.1", + "@polkadot/api-base": "12.1.1", + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/keyring": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", + "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", + "dependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/util-crypto": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/util-crypto": "12.6.2" + } + }, + "node_modules/@polkadot/networks": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.2.tgz", + "integrity": "sha512-1oWtZm1IvPWqvMrldVH6NI2gBoCndl5GEwx7lAuQWGr7eNL+6Bdc5K3Z9T0MzFvDGoi2/CBqjX9dRKo39pDC/w==", + "dependencies": { + "@polkadot/util": "12.6.2", + "@substrate/ss58-registry": "^1.44.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-12.1.1.tgz", + "integrity": "sha512-oDPn070l94pppXbuVk75BVsYgupdV8ndmslnUKWpPlfOeAU5SaBu4jMkj3eAi3VH0ersUpmlp1UuYN612//h8w==", + "dependencies": { + "@polkadot/rpc-core": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-core": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-12.1.1.tgz", + "integrity": "sha512-NB4BZo9RdAZPBfZ11NoujB8+SDkDgvlrSiiv9FPMhfvTJo0Sr5FAq0Wd2aSC4D/6qbt5e89CHOW+0gBEm9d6dw==", + "dependencies": { + "@polkadot/rpc-augment": "12.1.1", + "@polkadot/rpc-provider": "12.1.1", + "@polkadot/types": "12.1.1", + "@polkadot/util": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-provider": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-12.1.1.tgz", + "integrity": "sha512-nDr0Qb5sIzTTx6qmgr9ibNcQs/VDoPzZ+49kcltf0A6BdSytGy532Yhf2A158aD41324V9YPAzxVRLxZyJzhkw==", + "dependencies": { + "@polkadot/keyring": "^12.6.2", + "@polkadot/types": "12.1.1", + "@polkadot/types-support": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "@polkadot/x-fetch": "^12.6.2", + "@polkadot/x-global": "^12.6.2", + "@polkadot/x-ws": "^12.6.2", + "eventemitter3": "^5.0.1", + "mock-socket": "^9.3.1", + "nock": "^13.5.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@substrate/connect": "0.8.10" + } + }, + "node_modules/@polkadot/types": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-12.1.1.tgz", + "integrity": "sha512-+b8v7ORjL20r6VvdWL/fPTHmDXtfAfqkQQxBB6exxOhqrnJfnhAYQjJomKcyj1VMTQiyyR9FBAc7vVvTEFX2ew==", + "dependencies": { + "@polkadot/keyring": "^12.6.2", + "@polkadot/types-augment": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/util": "^12.6.2", + "@polkadot/util-crypto": "^12.6.2", + "rxjs": "^7.8.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-augment": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-12.1.1.tgz", + "integrity": "sha512-HdzjaXapcmNAdT6TWJOuv124PTKbAf5+5JldQ7oPZFaCEhaOTazZYiZ27nqLaj0l4rG7wWzFMiGqjbHwAvtmlg==", + "dependencies": { + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-codec": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-12.1.1.tgz", + "integrity": "sha512-Ob3nFptHT4dDvGc/3l4dBXmvsI3wDWS2oCOxACA+hYWufnlTIQ4M4sHI4kSBQvDoEmaFt8P2Be4SmtyT0VSd1w==", + "dependencies": { + "@polkadot/util": "^12.6.2", + "@polkadot/x-bigint": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-create": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-12.1.1.tgz", + "integrity": "sha512-K/I4vCnmI7IbtQeURiRMONDqesIVcZp16KEduBcbJm/RWDj0D3mr71066Yr8OhrhteLvULJpViy7EK4ynPvmSw==", + "dependencies": { + "@polkadot/types-codec": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-known": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-12.1.1.tgz", + "integrity": "sha512-4YxY7tB+BVX6k3ubrToYKyh2Jb4QvoLvzwNSGSjyj0RGwiQCu8anFGIzYdaUJ2iQlhLFb6P4AZWykVvhrXGmqg==", + "dependencies": { + "@polkadot/networks": "^12.6.2", + "@polkadot/types": "12.1.1", + "@polkadot/types-codec": "12.1.1", + "@polkadot/types-create": "12.1.1", + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-support": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-12.1.1.tgz", + "integrity": "sha512-mLXrbj0maKFWqV1+4QRzaNnZyV/rAQW0XSrIzfIZn//zSRSIUaXaVAZ62uzgdmzXXFH2qD3hpNlmvmjcEMm2Qg==", + "dependencies": { + "@polkadot/util": "^12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", + "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", + "dependencies": { + "@polkadot/x-bigint": "12.6.2", + "@polkadot/x-global": "12.6.2", + "@polkadot/x-textdecoder": "12.6.2", + "@polkadot/x-textencoder": "12.6.2", + "@types/bn.js": "^5.1.5", + "bn.js": "^5.2.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util-crypto": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", + "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", + "dependencies": { + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", + "@polkadot/networks": "12.6.2", + "@polkadot/util": "12.6.2", + "@polkadot/wasm-crypto": "^7.3.2", + "@polkadot/wasm-util": "^7.3.2", + "@polkadot/x-bigint": "12.6.2", + "@polkadot/x-randomvalues": "12.6.2", + "@scure/base": "^1.1.5", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2" + } + }, + "node_modules/@polkadot/wasm-bridge": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz", + "integrity": "sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g==", + "dependencies": { + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz", + "integrity": "sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw==", + "dependencies": { + "@polkadot/wasm-bridge": "7.3.2", + "@polkadot/wasm-crypto-asmjs": "7.3.2", + "@polkadot/wasm-crypto-init": "7.3.2", + "@polkadot/wasm-crypto-wasm": "7.3.2", + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-asmjs": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz", + "integrity": "sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-init": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz", + "integrity": "sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g==", + "dependencies": { + "@polkadot/wasm-bridge": "7.3.2", + "@polkadot/wasm-crypto-asmjs": "7.3.2", + "@polkadot/wasm-crypto-wasm": "7.3.2", + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-wasm": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz", + "integrity": "sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw==", + "dependencies": { + "@polkadot/wasm-util": "7.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/wasm-util": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz", + "integrity": "sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/x-bigint": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.2.tgz", + "integrity": "sha512-HSIk60uFPX4GOFZSnIF7VYJz7WZA7tpFJsne7SzxOooRwMTWEtw3fUpFy5cYYOeLh17/kHH1Y7SVcuxzVLc74Q==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-fetch": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.2.tgz", + "integrity": "sha512-8wM/Z9JJPWN1pzSpU7XxTI1ldj/AfC8hKioBlUahZ8gUiJaOF7K9XEFCrCDLis/A1BoOu7Ne6WMx/vsJJIbDWw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "node-fetch": "^3.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-global": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.2.tgz", + "integrity": "sha512-a8d6m+PW98jmsYDtAWp88qS4dl8DyqUBsd0S+WgyfSMtpEXu6v9nXDgPZgwF5xdDvXhm+P0ZfVkVTnIGrScb5g==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-randomvalues": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", + "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "12.6.2", + "@polkadot/wasm-util": "*" + } + }, + "node_modules/@polkadot/x-textdecoder": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", + "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-textencoder": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", + "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-ws": { + "version": "12.6.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.2.tgz", + "integrity": "sha512-cGZWo7K5eRRQCRl2LrcyCYsrc3lRbTlixZh3AzgU8uX4wASVGRlNWi/Hf4TtHNe1ExCDmxabJzdIsABIfrr7xw==", + "dependencies": { + "@polkadot/x-global": "12.6.2", + "tslib": "^2.6.2", + "ws": "^8.15.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@scure/base": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", + "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@substrate/connect": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.8.10.tgz", + "integrity": "sha512-DIyQ13DDlXqVFnLV+S6/JDgiGowVRRrh18kahieJxhgvzcWicw5eLc6jpfQ0moVVLBYkO7rctB5Wreldwpva8w==", + "deprecated": "versions below 1.x are no longer maintained", + "optional": true, + "dependencies": { + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.4", + "@substrate/light-client-extension-helpers": "^0.0.6", + "smoldot": "2.0.22" + } + }, + "node_modules/@substrate/connect-extension-protocol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.0.0.tgz", + "integrity": "sha512-nKu8pDrE3LNCEgJjZe1iGXzaD6OSIDD4Xzz/yo4KO9mQ6LBvf49BVrt4qxBFGL6++NneLiWUZGoh+VSd4PyVIg==", + "optional": true + }, + "node_modules/@substrate/connect-known-chains": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@substrate/connect-known-chains/-/connect-known-chains-1.1.8.tgz", + "integrity": "sha512-W0Cpnk//LoMTu5BGDCRRg5NHFR2aZ9OJtLGSgRyq1RP39dQGpoVZIgNC6z+SWRzlmOz3gIgkUCwGvOKVt2BabA==", + "optional": true + }, + "node_modules/@substrate/light-client-extension-helpers": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-0.0.6.tgz", + "integrity": "sha512-girltEuxQ1BvkJWmc8JJlk4ZxnlGXc/wkLcNguhY+UoDEMBK0LsdtfzQKIfrIehi4QdeSBlFEFBoI4RqPmsZzA==", + "optional": true, + "dependencies": { + "@polkadot-api/json-rpc-provider": "0.0.1", + "@polkadot-api/json-rpc-provider-proxy": "0.0.1", + "@polkadot-api/observable-client": "0.1.0", + "@polkadot-api/substrate-client": "0.0.1", + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.4", + "rxjs": "^7.8.1" + }, + "peerDependencies": { + "smoldot": "2.x" + } + }, + "node_modules/@substrate/ss58-registry": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.49.0.tgz", + "integrity": "sha512-leW6Ix4LD7XgvxT7+aobPWSw+WvPcN2Rxof1rmd0mNC5t2n99k1N7UNEvz7YEFSOUeHWmKIY7F5q8KeIqYoHfA==" + }, + "node_modules/@types/bn.js": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz", + "integrity": "sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.14.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz", + "integrity": "sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/mock-socket": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz", + "integrity": "sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nock": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz", + "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==", + "dependencies": { + "debug": "^4.1.0", + "json-stringify-safe": "^5.0.1", + "propagate": "^2.0.0" + }, + "engines": { + "node": ">= 10.13" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/propagate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", + "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/scale-ts": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/scale-ts/-/scale-ts-1.6.0.tgz", + "integrity": "sha512-Ja5VCjNZR8TGKhUumy9clVVxcDpM+YFjAnkMuwQy68Hixio3VRRvWdE3g8T/yC+HXA0ZDQl2TGyUmtmbcVl40Q==", + "optional": true + }, + "node_modules/smoldot": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.22.tgz", + "integrity": "sha512-B50vRgTY6v3baYH6uCgL15tfaag5tcS2o/P5q1OiXcKGv1axZDfz2dzzMuIkVpyMR2ug11F6EAtQlmYBQd292g==", + "optional": true, + "dependencies": { + "ws": "^8.8.1" + } + }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/tools/state-copy/package.json b/tools/state-copy/package.json new file mode 100644 index 0000000000..6e22c3b701 --- /dev/null +++ b/tools/state-copy/package.json @@ -0,0 +1,14 @@ +{ + "name": "state-copy", + "version": "1.0.0", + "description": "Copies state from one chain and sudo sets it on another", + "scripts": { + "schemas": "node schemas.mjs" + }, + "author": "", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api": "^12.1.1", + "@polkadot/keyring": "^12.6.2" + } +} diff --git a/tools/state-copy/schemas.mjs b/tools/state-copy/schemas.mjs new file mode 100644 index 0000000000..8a853c14c2 --- /dev/null +++ b/tools/state-copy/schemas.mjs @@ -0,0 +1,23 @@ +// This small nodejs script will pull the schemas from mainnet and then load them onto local + +import { copy } from "./copy.mjs"; + +const SOURCE_URL = "wss://1.rpc.frequency.xyz"; +const DEST_URL = "ws://127.0.0.1:9944"; +const STORAGE_KEY = "0xeec6f3c13d26ae2507c99b6751e19e76"; +const FILTER_OUT = [ + "0xeec6f3c13d26ae2507c99b6751e19e76d5d9c370c6c8aee1116ee09d6811b0d5", // governanceSchemaModelMaxBytes + "0xeec6f3c13d26ae2507c99b6751e19e764e7b9012096b41c4eb3aaf947f6ea429", // palletVersion +]; + +async function main() { + try { + await copy(SOURCE_URL, DEST_URL, STORAGE_KEY, FILTER_OUT); + process.exit(0); + } catch (error) { + console.error("Error:", error); + process.exit(1); + } +} + +main();