diff --git a/BlockchainSdk/Blockchains/Polkadot/PolkadotTransactionBuilder.swift b/BlockchainSdk/Blockchains/Polkadot/PolkadotTransactionBuilder.swift index 5e85f6de4..9698574a7 100644 --- a/BlockchainSdk/Blockchains/Polkadot/PolkadotTransactionBuilder.swift +++ b/BlockchainSdk/Blockchains/Polkadot/PolkadotTransactionBuilder.swift @@ -31,15 +31,19 @@ class PolkadotTransactionBuilder { https://github.com/paritytech/polkadot/blob/3b68869e14f84b043aa65bd83f9fe44359e4d626/runtime/kusama/src/lib.rs#L1375 Westend: https://github.com/paritytech/polkadot/blob/3b68869e14f84b043aa65bd83f9fe44359e4d626/runtime/westend/src/lib.rs#L982 + + For other chains use experimentally obtained values, or try running the script in the PolkaParachainMetadataParser folder */ private var balanceTransferCallIndex: Data { switch network { - case .polkadot, .azero, .joystream, .bittensor, .energyWebX: // TODO: [Energy Web X] Questionable + case .polkadot, .azero, .joystream, .bittensor: return Data(hexString: "0x0500") case .kusama: return Data(hexString: "0x0400") case .westend: return Data(hexString: "0x0400") + case .energyWebX: + return Data(hexString: "0x0a07") } } @@ -120,13 +124,14 @@ class PolkadotTransactionBuilder { return call } + // Use experimentally obtained values private func encodingRawAddress(specVersion: UInt32) -> Bool { switch network { case .polkadot: return specVersion < 28 case .kusama: return specVersion < 2028 - case .westend, .azero, .bittensor, .energyWebX: // TODO: [Energy Web X] Questionable + case .westend, .azero, .bittensor, .energyWebX: return false case .joystream: // specVersion at the moment of initial implementation is '2003' diff --git a/BlockchainSdk/Blockchains/Polkadot/SubstrateRuntimeVersionProvider.swift b/BlockchainSdk/Blockchains/Polkadot/SubstrateRuntimeVersionProvider.swift index 74f9e5f9d..871d2df16 100644 --- a/BlockchainSdk/Blockchains/Polkadot/SubstrateRuntimeVersionProvider.swift +++ b/BlockchainSdk/Blockchains/Polkadot/SubstrateRuntimeVersionProvider.swift @@ -15,6 +15,7 @@ struct SubstrateRuntimeVersionProvider { self.network = network } + // Use experimentally obtained values, or try running the script in the PolkaParachainMetadataParser folder. func runtimeVersion(for meta: PolkadotBlockchainMeta) -> SubstrateRuntimeVersion { switch network { case .polkadot, @@ -27,7 +28,7 @@ struct SubstrateRuntimeVersionProvider { return meta.specVersion >= 198 ? .v15 : .v14 case .azero, .joystream, - .energyWebX: // TODO: [Energy Web X] Questionable + .energyWebX: return .v14 } } diff --git a/BlockchainSdk/Common/Blockchain.swift b/BlockchainSdk/Common/Blockchain.swift index bbe469147..34adf5a70 100644 --- a/BlockchainSdk/Common/Blockchain.swift +++ b/BlockchainSdk/Common/Blockchain.swift @@ -289,6 +289,7 @@ public indirect enum Blockchain: Equatable, Hashable { .blast, .filecoin, .energyWebEVM, + .energyWebX, .core: return 18 case .cardano, @@ -302,7 +303,7 @@ public indirect enum Blockchain: Equatable, Hashable { return 6 case .stellar: return 7 - case .solana, .ton, .bittensor, .sui, .energyWebX: + case .solana, .ton, .bittensor, .sui: return 9 case .polkadot(_, let testnet): return testnet ? 12 : 10 diff --git a/BlockchainSdkExample/BlockchainSdkExampleViewModel.swift b/BlockchainSdkExample/BlockchainSdkExampleViewModel.swift index b7de62213..f30d8bbce 100644 --- a/BlockchainSdkExample/BlockchainSdkExampleViewModel.swift +++ b/BlockchainSdkExample/BlockchainSdkExampleViewModel.swift @@ -15,8 +15,8 @@ import TangemSdk class BlockchainSdkExampleViewModel: ObservableObject { @Published var cardWallets: [Card.Wallet] = [] - @Published var destination: String = "" - @Published var amountToSend: String = "" + @Published var destination: String = "5F92xKdkVC6qVxWS4QiHN5SrphiAnCv2eeuBQRWs7izPHJ7V" + @Published var amountToSend: String = "1" @Published var feeDescriptions: [String] = [] @Published var transactionResult: String = "--" @Published var blockchains: [(String, String)] = [] diff --git a/PolkaParachainMetadataParser/.gitignore b/PolkaParachainMetadataParser/.gitignore new file mode 100644 index 000000000..b512c09d4 --- /dev/null +++ b/PolkaParachainMetadataParser/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/PolkaParachainMetadataParser/README.md b/PolkaParachainMetadataParser/README.md new file mode 100644 index 000000000..fd4df1add --- /dev/null +++ b/PolkaParachainMetadataParser/README.md @@ -0,0 +1,32 @@ +# WebSocket Chain Metadata Fetcher + +This script connects to a blockchain WebSocket endpoint (e.g., Energy Web X) using the Polkadot API and fetches metadata information, including details about the `Balances` pallet and its `transfer` call. + +## Prerequisites + +- **Node.js**: You need to have Node.js installed on your system. If Node.js is not installed, you can install it using Homebrew: + + ```bash + brew install node + ``` + +## Usage + +1. Make the wrapper script executable: + + ```bash + chmod +x parse + ``` + +2. Run the script with the WebSocket URL as an argument: + + ```bash + ./parse + ``` + +### Example + +To fetch metadata from the Energy Web X network, run the script like this: + +```bash +./parse wss://wnp-rpc.mainnet.energywebx.com diff --git a/PolkaParachainMetadataParser/package-lock.json b/PolkaParachainMetadataParser/package-lock.json new file mode 100644 index 000000000..5ab5cfe3c --- /dev/null +++ b/PolkaParachainMetadataParser/package-lock.json @@ -0,0 +1,921 @@ +{ + "name": "PolkaParachainMetadataParser", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@polkadot/api": "^14.0.1" + } + }, + "node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=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==", + "license": "MIT", + "optional": true + }, + "node_modules/@polkadot-api/json-rpc-provider-proxy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz", + "integrity": "sha512-8GSFE5+EF73MCuLQm8tjrbCqlgclcHBSRaswvXziJ0ZW7iw3UEMsKkkKvELayWyBuOPa2T5i1nj6gFOeIsqvrg==", + "license": "MIT", + "optional": true + }, + "node_modules/@polkadot-api/metadata-builders": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.3.2.tgz", + "integrity": "sha512-TKpfoT6vTb+513KDzMBTfCb/ORdgRnsS3TDFpOhAhZ08ikvK+hjHMt5plPiAX/OWkm1Wc9I3+K6W0hX5Ab7MVg==", + "license": "MIT", + "optional": true, + "dependencies": { + "@polkadot-api/substrate-bindings": "0.6.0", + "@polkadot-api/utils": "0.1.0" + } + }, + "node_modules/@polkadot-api/observable-client": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.3.2.tgz", + "integrity": "sha512-HGgqWgEutVyOBXoGOPp4+IAq6CNdK/3MfQJmhCJb8YaJiaK4W6aRGrdQuQSTPHfERHCARt9BrOmEvTXAT257Ug==", + "license": "MIT", + "optional": true, + "dependencies": { + "@polkadot-api/metadata-builders": "0.3.2", + "@polkadot-api/substrate-bindings": "0.6.0", + "@polkadot-api/utils": "0.1.0" + }, + "peerDependencies": { + "@polkadot-api/substrate-client": "0.1.4", + "rxjs": ">=7.8.0" + } + }, + "node_modules/@polkadot-api/substrate-bindings": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.6.0.tgz", + "integrity": "sha512-lGuhE74NA1/PqdN7fKFdE5C1gNYX357j1tWzdlPXI0kQ7h3kN0zfxNOpPUN7dIrPcOFZ6C0tRRVrBylXkI6xPw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@noble/hashes": "^1.3.1", + "@polkadot-api/utils": "0.1.0", + "@scure/base": "^1.1.1", + "scale-ts": "^1.6.0" + } + }, + "node_modules/@polkadot-api/substrate-client": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-client/-/substrate-client-0.1.4.tgz", + "integrity": "sha512-MljrPobN0ZWTpn++da9vOvt+Ex+NlqTlr/XT7zi9sqPtDJiQcYl+d29hFAgpaeTqbeQKZwz3WDE9xcEfLE8c5A==", + "license": "MIT", + "optional": true, + "dependencies": { + "@polkadot-api/json-rpc-provider": "0.0.1", + "@polkadot-api/utils": "0.1.0" + } + }, + "node_modules/@polkadot-api/utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/utils/-/utils-0.1.0.tgz", + "integrity": "sha512-MXzWZeuGxKizPx2Xf/47wx9sr/uxKw39bVJUptTJdsaQn/TGq+z310mHzf1RCGvC1diHM8f593KrnDgc9oNbJA==", + "license": "MIT", + "optional": true + }, + "node_modules/@polkadot/api": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-14.0.1.tgz", + "integrity": "sha512-CDSaUiJpXu9aE6MaTg14K+9Trf8K2PBHcD3Xl5m5KOvJperWgYFxoCqV3rXLIBWt69LgHhMYlq5JSPRHxejIsw==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api-augment": "14.0.1", + "@polkadot/api-base": "14.0.1", + "@polkadot/api-derive": "14.0.1", + "@polkadot/keyring": "^13.1.1", + "@polkadot/rpc-augment": "14.0.1", + "@polkadot/rpc-core": "14.0.1", + "@polkadot/rpc-provider": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-augment": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/types-create": "14.0.1", + "@polkadot/types-known": "14.0.1", + "@polkadot/util": "^13.1.1", + "@polkadot/util-crypto": "^13.1.1", + "eventemitter3": "^5.0.1", + "rxjs": "^7.8.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-augment": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-14.0.1.tgz", + "integrity": "sha512-+ZHq3JaQZ/3Q45r6/YQBeLfoP8S5ibgkOvLKnKA9cJeF7oP5Qgi6pAEnGW0accfnT9PyCEco9fD/ZOLR9Yka7w==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api-base": "14.0.1", + "@polkadot/rpc-augment": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-augment": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-base": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-14.0.1.tgz", + "integrity": "sha512-OVnDiztKx/1ktae9eCzO1q8lmKEfnQ71fipo8JkDJOMIN4vT1IqL9KQo4e/Xz8UtOfTJ0H8kZ6evaLqdA3ZYOA==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/rpc-core": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/util": "^13.1.1", + "rxjs": "^7.8.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/api-derive": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-14.0.1.tgz", + "integrity": "sha512-ADQMre3DRRW/0rhJqxOVhQ1vqtyafP2dSZJ0qEAsto12q2WMSF8CZWo7pXe4DxiniDkZx3zVq4z5lqw2aBRLfg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/api": "14.0.1", + "@polkadot/api-augment": "14.0.1", + "@polkadot/api-base": "14.0.1", + "@polkadot/rpc-core": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/util": "^13.1.1", + "@polkadot/util-crypto": "^13.1.1", + "rxjs": "^7.8.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/keyring": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-13.1.1.tgz", + "integrity": "sha512-Wm+9gn946GIPjGzvueObLGBBS9s541HE6mvKdWGEmPFMzH93ESN931RZlOd67my5MWryiSP05h5SHTp7bSaQTA==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/util": "13.1.1", + "@polkadot/util-crypto": "13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "13.1.1", + "@polkadot/util-crypto": "13.1.1" + } + }, + "node_modules/@polkadot/networks": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-13.1.1.tgz", + "integrity": "sha512-eEQ4+Mfl1xFtApeU5PdXZ2XBhxNSvUz9yW+YQVGUCkXRjWFbqNRsTOYWGd9uFbiAOXiiiXbtqfZpxSDzIm4XOg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/util": "13.1.1", + "@substrate/ss58-registry": "^1.50.0", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-augment": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-14.0.1.tgz", + "integrity": "sha512-M0CbN/IScqiedYI2TmoQ+SoeEdJHfxGeQD1qJf9uYv9LILK+x1/5fyr5DrZ3uCGVmLuObWAJLnHTs0BzJcSHTQ==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/rpc-core": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-core": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-14.0.1.tgz", + "integrity": "sha512-SfgC6WU7RxaFFgm/GUpsqTywyaDeb7+r5GU3GlwC+QR148h3a7UcQ3sssOpB0MiZ2gIXngJuyIcIQm/3GfHnJw==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/rpc-augment": "14.0.1", + "@polkadot/rpc-provider": "14.0.1", + "@polkadot/types": "14.0.1", + "@polkadot/util": "^13.1.1", + "rxjs": "^7.8.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/rpc-provider": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-14.0.1.tgz", + "integrity": "sha512-mNfaKZUHPXGSY7TwgOfV05RN3Men21Dw7YXrSZDFkJYsZ55yOAYdmLg9anPZGHW100YnNWrXj+3uhQOw8JgqkA==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/keyring": "^13.1.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-support": "14.0.1", + "@polkadot/util": "^13.1.1", + "@polkadot/util-crypto": "^13.1.1", + "@polkadot/x-fetch": "^13.1.1", + "@polkadot/x-global": "^13.1.1", + "@polkadot/x-ws": "^13.1.1", + "eventemitter3": "^5.0.1", + "mock-socket": "^9.3.1", + "nock": "^13.5.4", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@substrate/connect": "0.8.11" + } + }, + "node_modules/@polkadot/types": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-14.0.1.tgz", + "integrity": "sha512-DOMzHsyVbCa12FT2Fng8iGiQJhHW2ONpv5oieU+Z2o0gFQqwNmIDXWncScG5mAUBNcDMXLuvWIKLKtUDOq8msg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/keyring": "^13.1.1", + "@polkadot/types-augment": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/types-create": "14.0.1", + "@polkadot/util": "^13.1.1", + "@polkadot/util-crypto": "^13.1.1", + "rxjs": "^7.8.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-augment": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-14.0.1.tgz", + "integrity": "sha512-PGo81444J5tGJxP3tu060Jx1kkeuo8SmBIt9S/w626Se49x4RLM5a7Pa5fguYVsg4TsJa9cgVPMuu6Y0F/2aCQ==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/types": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-codec": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-14.0.1.tgz", + "integrity": "sha512-IyUlkrRZ6uppbHVlMJL+btKP7dfgW65K06ggQxH7Y/IyRAQVDNjXecAZrCUMB/gtjUXNPyTHEIfPGDlg8E6rig==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/util": "^13.1.1", + "@polkadot/x-bigint": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-create": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-14.0.1.tgz", + "integrity": "sha512-R9/ac3CHKrFhvPKVUdpjnCDFSaGjfrNwtuY+AzvExAMIq7pM9dxo2N8UfnLbyFaG/n1hfYPXDIS3hLHvOZsLbw==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/types-codec": "14.0.1", + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-known": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-14.0.1.tgz", + "integrity": "sha512-oGypUOQNxZ6bq10czpVadZYeDM2NBB2kX3VFHLKLEpjaRbnVYtKXL6pl8B0uHR8GK/2Z8AmPOj6kuRjaC86qXg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/networks": "^13.1.1", + "@polkadot/types": "14.0.1", + "@polkadot/types-codec": "14.0.1", + "@polkadot/types-create": "14.0.1", + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/types-support": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-14.0.1.tgz", + "integrity": "sha512-lcZEyOf5e3WLLtrFlLTvFfUpO0Vx/Gh5lhLLjdx1W9Xs0KJUlOxSAKxvjVieJJj6HifL0Jh6tDYOUeEc4TOrvA==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/util": "^13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-13.1.1.tgz", + "integrity": "sha512-M4iQ5Um8tFdDmD7a96nPzfrEt+kxyWOqQDPqXyaax4QBnq/WCbq0jo8IO61uz55mdMQnGZvq8jd8uge4V6JzzQ==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-bigint": "13.1.1", + "@polkadot/x-global": "13.1.1", + "@polkadot/x-textdecoder": "13.1.1", + "@polkadot/x-textencoder": "13.1.1", + "@types/bn.js": "^5.1.5", + "bn.js": "^5.2.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/util-crypto": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-13.1.1.tgz", + "integrity": "sha512-FG68rrLPdfLcscEyH10vnGkakM4O2lqr71S3GDhgc9WXaS8y9jisLgMPg8jbMHiQBJ3iKYkmtPKiLBowRslj2w==", + "license": "Apache-2.0", + "dependencies": { + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", + "@polkadot/networks": "13.1.1", + "@polkadot/util": "13.1.1", + "@polkadot/wasm-crypto": "^7.3.2", + "@polkadot/wasm-util": "^7.3.2", + "@polkadot/x-bigint": "13.1.1", + "@polkadot/x-randomvalues": "13.1.1", + "@scure/base": "^1.1.7", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "13.1.1" + } + }, + "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==", + "license": "Apache-2.0", + "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==", + "license": "Apache-2.0", + "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==", + "license": "Apache-2.0", + "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==", + "license": "Apache-2.0", + "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==", + "license": "Apache-2.0", + "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==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/x-bigint": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-13.1.1.tgz", + "integrity": "sha512-Cq4Y6fd9UWtRBZz8RX2tWEBL1IFwUtY6cL8p6HC9yhZtUR6OPjKZe6RIZQa9gSOoIuqZWd6PmtvSNGVH32yfkQ==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-fetch": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-13.1.1.tgz", + "integrity": "sha512-qA6mIUUebJbS+oWzq/EagZflmaoa9b25WvsxSFn7mCvzKngXzr+GYCY4XiDwKY/S+/pr/kvSCKZ1ia8BDqPBYQ==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "node-fetch": "^3.3.2", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-global": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-13.1.1.tgz", + "integrity": "sha512-DViIMmmEs29Qlsp058VTg2Mn7e3/CpGazNnKJrsBa0o1Ptxl13/4Z0fjqCpNi2GB+kaOsnREzxUORrHcU+PqcQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-randomvalues": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-13.1.1.tgz", + "integrity": "sha512-cXj4omwbgzQQSiBtV1ZBw+XhJUU3iz/DS6ghUnGllSZEK+fGqiyaNgeFQzDY0tKjm6kYaDpvtOHR3mHsbzDuTg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@polkadot/util": "13.1.1", + "@polkadot/wasm-util": "*" + } + }, + "node_modules/@polkadot/x-textdecoder": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-13.1.1.tgz", + "integrity": "sha512-LpZ9KYc6HdBH+i86bCmun4g4GWMiWN/1Pzs0hNdanlQMfqp3UGzl1Dqp0nozMvjWAlvyG7ip235VgNMd8HEbqg==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-textencoder": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-13.1.1.tgz", + "integrity": "sha512-w1mT15B9ptN5CJNgN/A0CmBqD5y9OePjBdU6gmAd8KRhwXCF0MTBKcEZk1dHhXiXtX+28ULJWLrfefC5gxy69Q==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "tslib": "^2.7.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@polkadot/x-ws": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-13.1.1.tgz", + "integrity": "sha512-E/xFmJTiFzu+IK5M3/8W/9fnvNJFelcnunPv/IgO6UST94SDaTsN/Gbeb6SqPb6CsrTHRl3WD+AZ3ErGGwQfEA==", + "license": "Apache-2.0", + "dependencies": { + "@polkadot/x-global": "13.1.1", + "tslib": "^2.7.0", + "ws": "^8.16.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@substrate/connect": { + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.8.11.tgz", + "integrity": "sha512-ofLs1PAO9AtDdPbdyTYj217Pe+lBfTLltdHDs3ds8no0BseoLeAGxpz1mHfi7zB4IxI3YyAiLjH6U8cw4pj4Nw==", + "deprecated": "versions below 1.x are no longer maintained", + "license": "GPL-3.0-only", + "optional": true, + "dependencies": { + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.5", + "@substrate/light-client-extension-helpers": "^1.0.0", + "smoldot": "2.0.26" + } + }, + "node_modules/@substrate/connect-extension-protocol": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.2.0.tgz", + "integrity": "sha512-8b5bN/jo6qD4vcnoWr3T+Nn2u1XLRkJTsEt8b9iGvPPZ1cFcPCVQVpn3lP3U3WqbuSLiVkh0CjX5TW+aCUAi3g==", + "license": "GPL-3.0-only", + "optional": true + }, + "node_modules/@substrate/connect-known-chains": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@substrate/connect-known-chains/-/connect-known-chains-1.5.0.tgz", + "integrity": "sha512-ND6wiO6JuMH8/fU5dfuUwdHCgxN+kWTA9m5w5yIxkwtVF90oNRR5OW3ZilVk/QVuwKwxcG5jL7ijfQaB7XcR0w==", + "license": "GPL-3.0-only", + "optional": true + }, + "node_modules/@substrate/light-client-extension-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-1.0.0.tgz", + "integrity": "sha512-TdKlni1mBBZptOaeVrKnusMg/UBpWUORNDv5fdCaJklP4RJiFOzBCrzC+CyVI5kQzsXBisZ+2pXm+rIjS38kHg==", + "license": "MIT", + "optional": true, + "dependencies": { + "@polkadot-api/json-rpc-provider": "^0.0.1", + "@polkadot-api/json-rpc-provider-proxy": "^0.1.0", + "@polkadot-api/observable-client": "^0.3.0", + "@polkadot-api/substrate-client": "^0.1.2", + "@substrate/connect-extension-protocol": "^2.0.0", + "@substrate/connect-known-chains": "^1.1.5", + "rxjs": "^7.8.1" + }, + "peerDependencies": { + "smoldot": "2.x" + } + }, + "node_modules/@substrate/ss58-registry": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.51.0.tgz", + "integrity": "sha512-TWDurLiPxndFgKjVavCniytBIw+t4ViOi7TYp9h/D0NMmkEc9klFTo+827eyEJ0lELpqO207Ey7uGxUa+BS1jQ==", + "license": "Apache-2.0" + }, + "node_modules/@types/bn.js": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.6.tgz", + "integrity": "sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "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==", + "license": "MIT" + }, + "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==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "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==", + "license": "MIT" + }, + "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" + } + ], + "license": "MIT", + "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==", + "license": "MIT", + "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==", + "license": "ISC" + }, + "node_modules/mock-socket": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz", + "integrity": "sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nock": { + "version": "13.5.5", + "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.5.tgz", + "integrity": "sha512-XKYnqUrCwXC8DGG1xX4YH5yNIrlh9c065uaMZZHUoeUUINTOyt+x/G+ezYk0Ft6ExSREVIs+qBJDK503viTfFA==", + "license": "MIT", + "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" + } + ], + "license": "MIT", + "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==", + "license": "MIT", + "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==", + "license": "MIT", + "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==", + "license": "Apache-2.0", + "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==", + "license": "MIT", + "optional": true + }, + "node_modules/smoldot": { + "version": "2.0.26", + "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.26.tgz", + "integrity": "sha512-F+qYmH4z2s2FK+CxGj8moYcd1ekSIKH8ywkdqlOz88Dat35iB1DIYL11aILN46YSGMzQW/lbJNS307zBSDN5Ig==", + "license": "GPL-3.0-or-later WITH Classpath-exception-2.0", + "optional": true, + "dependencies": { + "ws": "^8.8.1" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "license": "0BSD" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "license": "MIT" + }, + "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==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", + "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/PolkaParachainMetadataParser/package.json b/PolkaParachainMetadataParser/package.json new file mode 100644 index 000000000..8d65782ce --- /dev/null +++ b/PolkaParachainMetadataParser/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@polkadot/api": "^14.0.1" + } +} diff --git a/PolkaParachainMetadataParser/parse b/PolkaParachainMetadataParser/parse new file mode 100755 index 000000000..5be0e27dd --- /dev/null +++ b/PolkaParachainMetadataParser/parse @@ -0,0 +1,39 @@ +#!/bin/bash + +# Set the JavaScript file path +JS_FILE="script.js" + +# Check if Node.js is installed +if ! command -v node &> /dev/null +then + echo "Node.js is not installed. Please install it first." + exit 1 +fi + +# Check if npm is installed +if ! command -v npm &> /dev/null +then + echo "npm is not installed. Please install it first." + exit 1 +fi + +# Check if node_modules directory exists, and install dependencies if not +if [ ! -d "node_modules" ]; then + echo "Installing npm dependencies..." + npm install +fi + +# Check if the script file exists +if [ ! -f "$JS_FILE" ]; then + echo "JavaScript file '$JS_FILE' not found!" + exit 1 +fi + +# Check if URL argument is provided +if [ -z "$1" ]; then + echo "Please provide a WebSocket URL as an argument." + exit 1 +fi + +# Run the JavaScript file with the provided URL argument +node "$JS_FILE" "$1" \ No newline at end of file diff --git a/PolkaParachainMetadataParser/script.js b/PolkaParachainMetadataParser/script.js new file mode 100644 index 000000000..979f11447 --- /dev/null +++ b/PolkaParachainMetadataParser/script.js @@ -0,0 +1,65 @@ +const { ApiPromise, WsProvider, HttpProvider } = require('@polkadot/api'); + +async function main() { + // Get the WebSocket or HTTP/HTTPS URL from command-line arguments + const url = process.argv[2]; + + if (!url) { + console.error("Please provide a WebSocket or HTTP/HTTPS URL as an argument."); + process.exit(1); + } + + let provider; + + // Check if the URL starts with ws:// or wss:// for WebSocket, or http:// or https:// for HTTP + if (url.startsWith('ws://') || url.startsWith('wss://')) { + console.log("WebSocket URL detected. Using WsProvider..."); + provider = new WsProvider(url); + } else if (url.startsWith('http://') || url.startsWith('https://')) { + console.log("HTTP/HTTPS URL detected. Using HttpProvider..."); + provider = new HttpProvider(url); + } else { + console.error("Invalid URL schema. Please provide a valid WebSocket (ws://, wss://) or HTTP/HTTPS (http://, https://) URL."); + process.exit(1); + } + + // Connect to the chain using the appropriate provider + const api = await ApiPromise.create({ provider }); + + // Fetch runtime version + const metadata = await api.rpc.state.getMetadata(); + const pallets = metadata.asLatest.pallets; + const lookup = metadata.asLatest.lookup; + + console.log(`Metadata Version: ${metadata.version}`); + + // Find the 'balances' pallet + const balancesPallet = pallets.find(pallet => pallet.name.toString() === 'Balances'); + if (balancesPallet) { + const palletIndex = balancesPallet.index.toNumber(); + + if (balancesPallet.calls.isSome) { + const callTypeId = balancesPallet.calls.unwrap().type; + const callType = lookup.getSiType(callTypeId); + + // Find the 'transfer' call + const transferCall = callType.def.asVariant.variants.find(call => call.name.toString() === 'transfer'); + + if (transferCall) { + const callIndex = callType.def.asVariant.variants.indexOf(transferCall); + const fullCallIndex = `${palletIndex.toString(16).padStart(2, '0')}${callIndex.toString(16).padStart(2, '0')}`; + + console.log(`Transfer Call Index: 0x${fullCallIndex}`); + } + } else { + console.log("The balances pallet has no calls."); + } + } else { + console.log("Balances pallet not found."); + } + + // Disconnect from the API + await api.disconnect(); +} + +main().catch(console.error); \ No newline at end of file