From 32852901c8d1d6509e3e578ad9a55e8b9beeef76 Mon Sep 17 00:00:00 2001 From: kenobijon Date: Mon, 26 May 2025 20:45:02 -0500 Subject: [PATCH 1/8] alpha precompiles --- Cargo.lock | 1 + pallets/admin-utils/src/lib.rs | 2 + precompiles/Cargo.toml | 2 +- precompiles/src/alpha.rs | 126 +++++++++++++++ precompiles/src/lib.rs | 8 +- precompiles/src/solidity/alpha.abi | 247 +++++++++++++++++++++++++++++ precompiles/src/solidity/alpha.sol | 70 ++++++++ 7 files changed, 454 insertions(+), 2 deletions(-) create mode 100644 precompiles/src/alpha.rs create mode 100644 precompiles/src/solidity/alpha.abi create mode 100644 precompiles/src/solidity/alpha.sol diff --git a/Cargo.lock b/Cargo.lock index b0c56ffb2e..1fb1812260 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11079,6 +11079,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2409-7)", + "substrate-fixed", "subtensor-runtime-common", ] diff --git a/pallets/admin-utils/src/lib.rs b/pallets/admin-utils/src/lib.rs index 2b41539816..d3fcc4d671 100644 --- a/pallets/admin-utils/src/lib.rs +++ b/pallets/admin-utils/src/lib.rs @@ -113,6 +113,8 @@ pub mod pallet { Neuron, /// Enum for UID lookup precompile UidLookup, + /// Enum for alpha precompile + Alpha, } #[pallet::type_value] diff --git a/precompiles/Cargo.toml b/precompiles/Cargo.toml index ec46e6aee2..c1455d2781 100644 --- a/precompiles/Cargo.toml +++ b/precompiles/Cargo.toml @@ -27,7 +27,7 @@ sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } subtensor-runtime-common = { workspace = true } - +substrate-fixed = { workspace = true } pallet-subtensor = { workspace = true } pallet-admin-utils = { workspace = true } diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs new file mode 100644 index 0000000000..ca21ffa842 --- /dev/null +++ b/precompiles/src/alpha.rs @@ -0,0 +1,126 @@ +use core::marker::PhantomData; + +use pallet_evm::PrecompileHandle; +use precompile_utils::EvmResult; +use sp_core::U256; +use substrate_fixed::types::U96F32; + +use crate::PrecompileExt; + +pub struct AlphaPrecompile(PhantomData); + +impl PrecompileExt for AlphaPrecompile +where + R: frame_system::Config + pallet_subtensor::Config, + R::AccountId: From<[u8; 32]>, +{ + const INDEX: u64 = 2054; +} + +#[precompile_utils::precompile] +impl AlphaPrecompile +where + R: frame_system::Config + pallet_subtensor::Config, +{ + #[precompile::public("getAlphaPrice(uint16)")] + #[precompile::view] + fn get_alpha_price(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + let price: U96F32 = pallet_subtensor::Pallet::::get_alpha_price(netuid); + Ok(U256::from(price.saturating_to_num::())) + } + + #[precompile::public("getMovingAlphaPrice(uint16)")] + #[precompile::view] + fn get_moving_alpha_price(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + let price: U96F32 = pallet_subtensor::Pallet::::get_moving_alpha_price(netuid); + Ok(U256::from(price.saturating_to_num::())) + } + + #[precompile::public("getTaoInPool(uint16)")] + #[precompile::view] + fn get_tao_in_pool(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(pallet_subtensor::SubnetTAO::::get(netuid)) + } + + #[precompile::public("getAlphaInPool(uint16)")] + #[precompile::view] + fn get_alpha_in_pool(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(pallet_subtensor::SubnetAlphaIn::::get(netuid)) + } + + #[precompile::public("getAlphaOutPool(uint16)")] + #[precompile::view] + fn get_alpha_out_pool(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(pallet_subtensor::SubnetAlphaOut::::get(netuid)) + } + + #[precompile::public("getAlphaIssuance(uint16)")] + #[precompile::view] + fn get_alpha_issuance(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(pallet_subtensor::Pallet::::get_alpha_issuance(netuid)) + } + + #[precompile::public("getTaoWeight()")] + #[precompile::view] + fn get_tao_weight(_handle: &mut impl PrecompileHandle) -> EvmResult { + let weight: U96F32 = pallet_subtensor::Pallet::::get_tao_weight(); + Ok(U256::from(weight.saturating_to_num::())) + } + + #[precompile::public("simSwapTaoForAlpha(uint16,uint64)")] + #[precompile::view] + fn sim_swap_tao_for_alpha( + _handle: &mut impl PrecompileHandle, + netuid: u16, + tao: u64, + ) -> EvmResult { + let alpha_option = pallet_subtensor::Pallet::::sim_swap_tao_for_alpha(netuid, tao); + let result = match alpha_option { + Some(alpha) => alpha, + None => 0, + }; + Ok(U256::from(result)) + } + + #[precompile::public("simSwapAlphaForTao(uint16,uint64)")] + #[precompile::view] + fn sim_swap_alpha_for_tao( + _handle: &mut impl PrecompileHandle, + netuid: u16, + alpha: u64, + ) -> EvmResult { + let tao_option = pallet_subtensor::Pallet::::sim_swap_alpha_for_tao(netuid, alpha); + let result = match tao_option { + Some(tao) => tao, + None => 0, + }; + Ok(U256::from(result)) + } + + #[precompile::public("getSubnetMechanism(uint16)")] + #[precompile::view] + fn get_subnet_mechanism(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(pallet_subtensor::SubnetMechanism::::get(netuid)) + } + + #[precompile::public("getRootNetuid()")] + #[precompile::view] + fn get_root_netuid(_handle: &mut impl PrecompileHandle) -> EvmResult { + Ok(pallet_subtensor::Pallet::::get_root_netuid()) + } + + #[precompile::public("getEMAPriceHalvingBlocks(uint16)")] + #[precompile::view] + fn get_ema_price_halving_blocks( + _handle: &mut impl PrecompileHandle, + netuid: u16, + ) -> EvmResult { + Ok(pallet_subtensor::EMAPriceHalvingBlocks::::get(netuid)) + } + + #[precompile::public("getSubnetVolume(uint16)")] + #[precompile::view] + fn get_subnet_volume(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { + Ok(U256::from(pallet_subtensor::SubnetVolume::::get(netuid))) + } +} diff --git a/precompiles/src/lib.rs b/precompiles/src/lib.rs index 4c6824e07b..4153f76b6d 100644 --- a/precompiles/src/lib.rs +++ b/precompiles/src/lib.rs @@ -19,6 +19,7 @@ use subtensor_runtime_common::ProxyType; use pallet_admin_utils::PrecompileEnum; +use crate::alpha::*; use crate::balance_transfer::*; use crate::ed25519::*; use crate::extensions::*; @@ -28,6 +29,7 @@ use crate::staking::*; use crate::subnet::*; use crate::uid_lookup::*; +mod alpha; mod balance_transfer; mod ed25519; mod extensions; @@ -86,7 +88,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 15] { + pub fn used_addresses() -> [H160; 16] { [ hash(1), hash(2), @@ -103,6 +105,7 @@ where hash(NeuronPrecompile::::INDEX), hash(StakingPrecompileV2::::INDEX), hash(UidLookupPrecompile::::INDEX), + hash(AlphaPrecompile::::INDEX), ] } } @@ -164,6 +167,9 @@ where a if a == hash(UidLookupPrecompile::::INDEX) => { UidLookupPrecompile::::try_execute::(handle, PrecompileEnum::UidLookup) } + a if a == hash(AlphaPrecompile::::INDEX) => { + AlphaPrecompile::::try_execute::(handle, PrecompileEnum::Alpha) + } _ => None, } } diff --git a/precompiles/src/solidity/alpha.abi b/precompiles/src/solidity/alpha.abi new file mode 100644 index 0000000000..feb2b518af --- /dev/null +++ b/precompiles/src/solidity/alpha.abi @@ -0,0 +1,247 @@ +[ + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getMovingAlphaPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getTaoInPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaInPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaOutPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaIssuance", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTaoWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + }, + { + "internalType": "uint64", + "name": "tao", + "type": "uint64" + } + ], + "name": "simSwapTaoForAlpha", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + }, + { + "internalType": "uint64", + "name": "alpha", + "type": "uint64" + } + ], + "name": "simSwapAlphaForTao", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getSubnetMechanism", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRootNetuid", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getEMAPriceHalvingBlocks", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getSubnetVolume", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/precompiles/src/solidity/alpha.sol b/precompiles/src/solidity/alpha.sol new file mode 100644 index 0000000000..622757df78 --- /dev/null +++ b/precompiles/src/solidity/alpha.sol @@ -0,0 +1,70 @@ +pragma solidity ^0.8.0; + +address constant IALPHA_ADDRESS = 0x0000000000000000000000000000000000000806; + +interface IAlpha { + /// @dev Returns the current alpha price for a subnet. + /// @param netuid The subnet identifier. + /// @return The alpha price in RAO per alpha. + function getAlphaPrice(uint16 netuid) external view returns (uint256); + + /// @dev Returns the moving (EMA) alpha price for a subnet. + /// @param netuid The subnet identifier. + /// @return The moving alpha price in RAO per alpha. + function getMovingAlphaPrice(uint16 netuid) external view returns (uint256); + + /// @dev Returns the amount of TAO in the pool for a subnet. + /// @param netuid The subnet identifier. + /// @return The TAO amount in the pool. + function getTaoInPool(uint16 netuid) external view returns (uint64); + + /// @dev Returns the amount of alpha in the pool for a subnet. + /// @param netuid The subnet identifier. + /// @return The alpha amount in the pool. + function getAlphaInPool(uint16 netuid) external view returns (uint64); + + /// @dev Returns the amount of alpha outside the pool for a subnet. + /// @param netuid The subnet identifier. + /// @return The alpha amount outside the pool. + function getAlphaOutPool(uint16 netuid) external view returns (uint64); + + /// @dev Returns the total alpha issuance for a subnet. + /// @param netuid The subnet identifier. + /// @return The total alpha issuance. + function getAlphaIssuance(uint16 netuid) external view returns (uint64); + + /// @dev Returns the global TAO weight. + /// @return The TAO weight value. + function getTaoWeight() external view returns (uint256); + + /// @dev Simulates swapping TAO for alpha. + /// @param netuid The subnet identifier. + /// @param tao The amount of TAO to swap. + /// @return The amount of alpha that would be received. + function simSwapTaoForAlpha(uint16 netuid, uint64 tao) external view returns (uint256); + + /// @dev Simulates swapping alpha for TAO. + /// @param netuid The subnet identifier. + /// @param alpha The amount of alpha to swap. + /// @return The amount of TAO that would be received. + function simSwapAlphaForTao(uint16 netuid, uint64 alpha) external view returns (uint256); + + /// @dev Returns the mechanism type for a subnet (0 for Stable, 1 for Dynamic). + /// @param netuid The subnet identifier. + /// @return The subnet mechanism type. + function getSubnetMechanism(uint16 netuid) external view returns (uint16); + + /// @dev Returns the root subnet unique identifier. + /// @return The root subnet ID. + function getRootNetuid() external view returns (uint16); + + /// @dev Returns the EMA price halving blocks parameter for a subnet. + /// @param netuid The subnet identifier. + /// @return The number of blocks for EMA price halving. + function getEMAPriceHalvingBlocks(uint16 netuid) external view returns (uint64); + + /// @dev Returns the transaction volume for a subnet. + /// @param netuid The subnet identifier. + /// @return The subnet volume. + function getSubnetVolume(uint16 netuid) external view returns (uint256); +} \ No newline at end of file From dbd845e13a730900eef74ed01d816f6189081142 Mon Sep 17 00:00:00 2001 From: kenobijon Date: Mon, 26 May 2025 22:01:22 -0500 Subject: [PATCH 2/8] Fixes linting errors and feature propagation for substrate-fixed --- precompiles/Cargo.toml | 1 + precompiles/src/alpha.rs | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/precompiles/Cargo.toml b/precompiles/Cargo.toml index c1455d2781..5bc8a094d6 100644 --- a/precompiles/Cargo.toml +++ b/precompiles/Cargo.toml @@ -54,5 +54,6 @@ std = [ "sp-core/std", "sp-runtime/std", "sp-std/std", + "substrate-fixed/std", "subtensor-runtime-common/std", ] diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs index ca21ffa842..1f01883d40 100644 --- a/precompiles/src/alpha.rs +++ b/precompiles/src/alpha.rs @@ -75,10 +75,7 @@ where tao: u64, ) -> EvmResult { let alpha_option = pallet_subtensor::Pallet::::sim_swap_tao_for_alpha(netuid, tao); - let result = match alpha_option { - Some(alpha) => alpha, - None => 0, - }; + let result = alpha_option.unwrap_or(0); Ok(U256::from(result)) } @@ -90,10 +87,7 @@ where alpha: u64, ) -> EvmResult { let tao_option = pallet_subtensor::Pallet::::sim_swap_alpha_for_tao(netuid, alpha); - let result = match tao_option { - Some(tao) => tao, - None => 0, - }; + let result = tao_option.unwrap_or(0); Ok(U256::from(result)) } From d9cdec0de082bd7d504a9fa7df5659f341caac96 Mon Sep 17 00:00:00 2001 From: kenobijon Date: Tue, 27 May 2025 01:13:18 -0500 Subject: [PATCH 3/8] basic unit functions --- evm-tests/package-lock.json | 546 ++++++++++++++---------- evm-tests/package.json | 4 +- evm-tests/src/contracts/alpha.ts | 249 +++++++++++ evm-tests/test/alpha.precompile.test.ts | 428 +++++++++++++++++++ precompiles/src/alpha.rs | 2 +- precompiles/src/solidity/alpha.sol | 4 +- 6 files changed, 1007 insertions(+), 226 deletions(-) create mode 100644 evm-tests/src/contracts/alpha.ts create mode 100644 evm-tests/test/alpha.precompile.test.ts diff --git a/evm-tests/package-lock.json b/evm-tests/package-lock.json index ce2766fb4e..9e318e9a24 100644 --- a/evm-tests/package-lock.json +++ b/evm-tests/package-lock.json @@ -6,6 +6,7 @@ "": { "license": "ISC", "dependencies": { + "@polkadot-api/descriptors": "file:.papi/descriptors", "@polkadot-labs/hdkd": "^0.0.10", "@polkadot-labs/hdkd-helpers": "^0.0.11", "@polkadot/api": "15.1.1", @@ -16,7 +17,8 @@ "mocha": "^11.1.0", "polkadot-api": "^1.9.5", "scale-ts": "^1.6.1", - "viem": "2.23.4" + "viem": "2.23.4", + "ws": "^8.18.2" }, "devDependencies": { "@types/bun": "^1.1.13", @@ -31,10 +33,9 @@ }, ".papi/descriptors": { "name": "@polkadot-api/descriptors", - "version": "0.1.0-autogenerated.7914363913476982777", - "extraneous": true, + "version": "0.1.0-autogenerated.3055518094912556806", "peerDependencies": { - "polkadot-api": "*" + "polkadot-api": ">=1.11.2" } }, "node_modules/@adraffy/ens-normalize": { @@ -44,23 +45,23 @@ "license": "MIT" }, "node_modules/@babel/code-frame": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", - "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", + "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" + "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", - "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", "license": "MIT", "engines": { "node": ">=6.9.0" @@ -89,9 +90,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz", - "integrity": "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", "cpu": [ "ppc64" ], @@ -105,9 +106,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.2.tgz", - "integrity": "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", "cpu": [ "arm" ], @@ -121,9 +122,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.2.tgz", - "integrity": "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", "cpu": [ "arm64" ], @@ -137,9 +138,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.2.tgz", - "integrity": "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", "cpu": [ "x64" ], @@ -153,9 +154,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.2.tgz", - "integrity": "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", "cpu": [ "arm64" ], @@ -169,9 +170,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.2.tgz", - "integrity": "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", "cpu": [ "x64" ], @@ -185,9 +186,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.2.tgz", - "integrity": "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", "cpu": [ "arm64" ], @@ -201,9 +202,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.2.tgz", - "integrity": "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", "cpu": [ "x64" ], @@ -217,9 +218,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.2.tgz", - "integrity": "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", "cpu": [ "arm" ], @@ -233,9 +234,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.2.tgz", - "integrity": "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", "cpu": [ "arm64" ], @@ -249,9 +250,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.2.tgz", - "integrity": "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", "cpu": [ "ia32" ], @@ -265,9 +266,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.2.tgz", - "integrity": "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", "cpu": [ "loong64" ], @@ -281,9 +282,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.2.tgz", - "integrity": "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", "cpu": [ "mips64el" ], @@ -297,9 +298,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.2.tgz", - "integrity": "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", "cpu": [ "ppc64" ], @@ -313,9 +314,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.2.tgz", - "integrity": "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", "cpu": [ "riscv64" ], @@ -329,9 +330,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.2.tgz", - "integrity": "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", "cpu": [ "s390x" ], @@ -345,9 +346,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.2.tgz", - "integrity": "sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", "cpu": [ "x64" ], @@ -361,9 +362,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.2.tgz", - "integrity": "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", "cpu": [ "arm64" ], @@ -377,9 +378,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.2.tgz", - "integrity": "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", "cpu": [ "x64" ], @@ -393,9 +394,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.2.tgz", - "integrity": "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", "cpu": [ "arm64" ], @@ -409,9 +410,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.2.tgz", - "integrity": "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", "cpu": [ "x64" ], @@ -425,9 +426,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.2.tgz", - "integrity": "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", "cpu": [ "x64" ], @@ -441,9 +442,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.2.tgz", - "integrity": "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", "cpu": [ "arm64" ], @@ -457,9 +458,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.2.tgz", - "integrity": "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", "cpu": [ "ia32" ], @@ -473,9 +474,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.2.tgz", - "integrity": "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", "cpu": [ "x64" ], @@ -681,29 +682,29 @@ } }, "node_modules/@polkadot-api/cli": { - "version": "0.11.9", - "resolved": "https://registry.npmjs.org/@polkadot-api/cli/-/cli-0.11.9.tgz", - "integrity": "sha512-5Qt+YRf/kOCZGiFoWzgyxoZYA9OpN28AFE4jQ4nZI33lty8oH4FR62IF2iLF+KdafhgF9k9l1Kj24zuBFH3Vrw==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/cli/-/cli-0.13.0.tgz", + "integrity": "sha512-uumqacO1+YxuhHYOr75czxvV0KmRxm3DaZtRKzxIf2zpICnj/QnBTpJwlxU56g+pQDU5P/hTR0Thh0vrnUTNVw==", "license": "MIT", "dependencies": { "@commander-js/extra-typings": "^13.1.0", - "@polkadot-api/codegen": "0.13.3", - "@polkadot-api/ink-contracts": "0.2.6", + "@polkadot-api/codegen": "0.16.0", + "@polkadot-api/ink-contracts": "0.3.2", "@polkadot-api/json-rpc-provider": "0.0.4", - "@polkadot-api/known-chains": "0.7.3", - "@polkadot-api/metadata-compatibility": "0.2.0", - "@polkadot-api/observable-client": "0.8.6", + "@polkadot-api/known-chains": "0.7.6", + "@polkadot-api/metadata-compatibility": "0.2.3", + "@polkadot-api/observable-client": "0.11.0", "@polkadot-api/polkadot-sdk-compat": "2.3.2", "@polkadot-api/sm-provider": "0.1.7", "@polkadot-api/smoldot": "0.3.8", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/substrate-client": "0.3.0", "@polkadot-api/utils": "0.1.2", "@polkadot-api/wasm-executor": "^0.1.2", "@polkadot-api/ws-provider": "0.4.0", - "@types/node": "^22.14.0", + "@types/node": "^22.15.18", "commander": "^13.1.0", - "execa": "^9.5.2", + "execa": "^9.5.3", "fs.promises.exists": "^1.1.4", "ora": "^8.2.0", "read-pkg": "^9.0.1", @@ -719,26 +720,30 @@ } }, "node_modules/@polkadot-api/codegen": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/@polkadot-api/codegen/-/codegen-0.13.3.tgz", - "integrity": "sha512-+8mp9k5L9myFSLv6Ad5r63JSIeq80/tKbk67rczDq6Co0PlJHqxult+wZHohHuyJSdtu8dHW9JQktTtM2RZT1w==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/codegen/-/codegen-0.16.0.tgz", + "integrity": "sha512-2Sq/fkB7a9Oi3t7nGc0EbTt1Nd8Pb8XGiKKS9i/wwFAdCLN2oXd33DxmRQTX0Hm2/nrBzXYh1zBuyxRUb9+Sdw==", "license": "MIT", "dependencies": { - "@polkadot-api/ink-contracts": "0.2.6", - "@polkadot-api/metadata-builders": "0.10.2", - "@polkadot-api/metadata-compatibility": "0.2.0", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/ink-contracts": "0.3.2", + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/metadata-compatibility": "0.2.3", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, + "node_modules/@polkadot-api/descriptors": { + "resolved": ".papi/descriptors", + "link": true + }, "node_modules/@polkadot-api/ink-contracts": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@polkadot-api/ink-contracts/-/ink-contracts-0.2.6.tgz", - "integrity": "sha512-76oHO/rKRa48w1i4DEmB/9e/FmxKuhMJq7l1OhdnX6mbVO+bAif7FkRUHLfIgsWqCdhCdfLe5J474HRudKhU/A==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@polkadot-api/ink-contracts/-/ink-contracts-0.3.2.tgz", + "integrity": "sha512-ipWuClaySrPI7XHIomiswXhIZfU4q/EmHmLFIwLdn9iNhLd7YLuUtGF6kacSQu76YtWd3tkLe2rGx4cRRaLjOA==", "license": "MIT", "dependencies": { - "@polkadot-api/metadata-builders": "0.10.2", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, @@ -755,9 +760,9 @@ "license": "MIT" }, "node_modules/@polkadot-api/known-chains": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@polkadot-api/known-chains/-/known-chains-0.7.3.tgz", - "integrity": "sha512-yBRVbOLn0e36+EGWE2/hX8mhTKvfdZtbk2VCgTM9djkz28eDFfiDjEl6biQA8Q0Kd7t3iRzoNbBzpzyBwTMXUg==", + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/@polkadot-api/known-chains/-/known-chains-0.7.6.tgz", + "integrity": "sha512-em+p9AVfTYulC4U10I+nO42wdczN9ZSAEyb5ppQsxxsKAxaJVPVe4xsDkWzlhheheEN6OBojNHnoYNBVG6X2bg==", "license": "MIT" }, "node_modules/@polkadot-api/logs-provider": { @@ -769,34 +774,45 @@ "@polkadot-api/json-rpc-provider": "0.0.4" } }, + "node_modules/@polkadot-api/merkleize-metadata": { + "version": "1.1.17", + "resolved": "https://registry.npmjs.org/@polkadot-api/merkleize-metadata/-/merkleize-metadata-1.1.17.tgz", + "integrity": "sha512-3wlLrYjpBluN5l8M1H9zgXlFHfJhqIXYvSVXTvkBYcEVKxZt0PO0f43Zgskeabg29Lx83OiPINcEHFWF8ndAzg==", + "license": "MIT", + "dependencies": { + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/substrate-bindings": "0.13.0", + "@polkadot-api/utils": "0.1.2" + } + }, "node_modules/@polkadot-api/metadata-builders": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.10.2.tgz", - "integrity": "sha512-rtdihBFd25oT9/71Q+EOR9q6E6mCl1pPe/2He/LtlY0TyHiYqO2KpMZNXkoGcw1RHvrV+CAtDFMvK1j3n8aW8w==", + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.12.1.tgz", + "integrity": "sha512-heGt+WgcxrS1CqMm9XwD2DC+fI6azMKJf2ToMP+H12yw6FAy++nijASDZ3MlV/0ZpA/QGZpuZmgQmxKh6jbxVg==", "license": "MIT", "dependencies": { - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, "node_modules/@polkadot-api/metadata-compatibility": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-compatibility/-/metadata-compatibility-0.2.0.tgz", - "integrity": "sha512-ZvHj4KDQy/JFqV51UN6Gk5xnG0qt/BUS4kjYosLWT9y6p5bHg/4ge7QF5lMloInQqV3Rul9NQo4cKUz3SlSQMQ==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@polkadot-api/metadata-compatibility/-/metadata-compatibility-0.2.3.tgz", + "integrity": "sha512-rtym491RA2yl8qGdEDJVujiCya+DK0CW5AwB6InSo85Um04/WWMq7oboRiXQZmspwLkfm2vYBusl/Q9k4Rxshw==", "license": "MIT", "dependencies": { - "@polkadot-api/metadata-builders": "0.10.2", - "@polkadot-api/substrate-bindings": "0.11.1" + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/substrate-bindings": "0.13.0" } }, "node_modules/@polkadot-api/observable-client": { - "version": "0.8.6", - "resolved": "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.8.6.tgz", - "integrity": "sha512-ci5HC8TYjGxoTG/QM+LLuGrfIsn+dtR7BBQz483c/ML8K/Hxl9v+evgZzPi9xNMwZ25mytn9lhA5dovYSEauSA==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.11.0.tgz", + "integrity": "sha512-cyXyih+RI73vPcUQ6GxyMelm1Z3bGDvBIow8W3MqBdpUy4mZ87QGQXGpyBC0Op/qnIxrUFP1cLyT38fUe0i6KQ==", "license": "MIT", "dependencies": { - "@polkadot-api/metadata-builders": "0.10.2", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" }, "peerDependencies": { @@ -805,15 +821,15 @@ } }, "node_modules/@polkadot-api/pjs-signer": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@polkadot-api/pjs-signer/-/pjs-signer-0.6.5.tgz", - "integrity": "sha512-RQJtvuX8jNR77h9PFTNQPjC4ii0g0uGrfyu5cbTujojg2QboU/6ny26Ty45rzkSOL0GaBLsS7Uf+/7Vf9hCxig==", + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@polkadot-api/pjs-signer/-/pjs-signer-0.6.8.tgz", + "integrity": "sha512-YBp+uF2mPZFH4VjT5xgIU462EXbdLrFz09D6vY4SgoS2FRbPV7ktnqiNK2BykKJPGV4TiqpEjNB4OtX6ZLzafg==", "license": "MIT", "dependencies": { - "@polkadot-api/metadata-builders": "0.10.2", + "@polkadot-api/metadata-builders": "0.12.1", "@polkadot-api/polkadot-signer": "0.1.6", - "@polkadot-api/signers-common": "0.1.6", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/signers-common": "0.1.9", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, @@ -833,27 +849,40 @@ "license": "MIT" }, "node_modules/@polkadot-api/signer": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/@polkadot-api/signer/-/signer-0.1.15.tgz", - "integrity": "sha512-FUFlHrICB4dGlFa6FeFju/ySr8kTAkhTE/aSmfSxW0rl/cTeDO2fbUS9WmIl8wLB0jsI14I2r5J/p13FvIe1BA==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@polkadot-api/signer/-/signer-0.2.1.tgz", + "integrity": "sha512-z3BPDIglLh/hghQExQVVHR3xgIijjEVcIA2P+xLan5vO4cglGm4U6vIBXgKBuU2oxKlG494ixH8BkXSv5F79zw==", "license": "MIT", "dependencies": { - "@noble/hashes": "^1.7.1", + "@noble/hashes": "^1.8.0", + "@polkadot-api/merkleize-metadata": "1.1.17", "@polkadot-api/polkadot-signer": "0.1.6", - "@polkadot-api/signers-common": "0.1.6", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/signers-common": "0.1.9", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, + "node_modules/@polkadot-api/signer/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@polkadot-api/signers-common": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@polkadot-api/signers-common/-/signers-common-0.1.6.tgz", - "integrity": "sha512-OEzqpu/AlZIHbvpvwQJ7dhoRIRTXI2D7wYEoT5j0COpAvt3A1L53smECb3xWzkzlb82gINuqpUW5dfhhJ5tQFQ==", + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/@polkadot-api/signers-common/-/signers-common-0.1.9.tgz", + "integrity": "sha512-eOAPfnNpa0kJrtM/OPHOt+jlFP97c4CWZmzfcPzOqfrLUgyyLzVCFzgBipffpzPXNPQsToM6FM+7DQEgQmoDuA==", "license": "MIT", "dependencies": { - "@polkadot-api/metadata-builders": "0.10.2", + "@polkadot-api/metadata-builders": "0.12.1", "@polkadot-api/polkadot-signer": "0.1.6", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/utils": "0.1.2" } }, @@ -890,17 +919,29 @@ } }, "node_modules/@polkadot-api/substrate-bindings": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.11.1.tgz", - "integrity": "sha512-+oqAZB7y18KrP/DqKmU2P3nNmRzjCY7edtW7tyA1g1jPouF7HhRr/Q13lJseDX9sdE2FZGrKZtivzsw8XeXBng==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.13.0.tgz", + "integrity": "sha512-M/60lXtHr4flwx4K7L4xv2jLk44EhD8UB4jvah+jbZM195I89nZGXKo2JOkgyR5DHoLj//TAoBkLedZmaaAiaQ==", "license": "MIT", "dependencies": { - "@noble/hashes": "^1.7.1", + "@noble/hashes": "^1.8.0", "@polkadot-api/utils": "0.1.2", - "@scure/base": "^1.2.4", + "@scure/base": "^1.2.5", "scale-ts": "^1.6.1" } }, + "node_modules/@polkadot-api/substrate-bindings/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@polkadot-api/substrate-client": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@polkadot-api/substrate-client/-/substrate-client-0.3.0.tgz", @@ -1513,9 +1554,9 @@ } }, "node_modules/@scure/base": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.4.tgz", - "integrity": "sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.5.tgz", + "integrity": "sha512-9rE6EOVeIQzt5TSu4v+K523F8u6DhBsoZWPGKlnCshhlDhy0kJzUX4V+tr2dWmzF1GdekvThABoEQBGBQI7xZw==", "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" @@ -1767,9 +1808,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.14.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", - "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "version": "22.15.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.21.tgz", + "integrity": "sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ==", "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -1816,7 +1857,6 @@ "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -2228,6 +2268,12 @@ "node": ">=18" } }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "license": "MIT" + }, "node_modules/consola": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", @@ -2449,9 +2495,9 @@ } }, "node_modules/esbuild": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.2.tgz", - "integrity": "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==", + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2461,31 +2507,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.2", - "@esbuild/android-arm": "0.25.2", - "@esbuild/android-arm64": "0.25.2", - "@esbuild/android-x64": "0.25.2", - "@esbuild/darwin-arm64": "0.25.2", - "@esbuild/darwin-x64": "0.25.2", - "@esbuild/freebsd-arm64": "0.25.2", - "@esbuild/freebsd-x64": "0.25.2", - "@esbuild/linux-arm": "0.25.2", - "@esbuild/linux-arm64": "0.25.2", - "@esbuild/linux-ia32": "0.25.2", - "@esbuild/linux-loong64": "0.25.2", - "@esbuild/linux-mips64el": "0.25.2", - "@esbuild/linux-ppc64": "0.25.2", - "@esbuild/linux-riscv64": "0.25.2", - "@esbuild/linux-s390x": "0.25.2", - "@esbuild/linux-x64": "0.25.2", - "@esbuild/netbsd-arm64": "0.25.2", - "@esbuild/netbsd-x64": "0.25.2", - "@esbuild/openbsd-arm64": "0.25.2", - "@esbuild/openbsd-x64": "0.25.2", - "@esbuild/sunos-x64": "0.25.2", - "@esbuild/win32-arm64": "0.25.2", - "@esbuild/win32-ia32": "0.25.2", - "@esbuild/win32-x64": "0.25.2" + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" } }, "node_modules/escalade": { @@ -2610,23 +2656,23 @@ "license": "MIT" }, "node_modules/execa": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/execa/-/execa-9.5.2.tgz", - "integrity": "sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz", + "integrity": "sha512-jpWzZ1ZhwUmeWRhS7Qv3mhpOhLfwI+uAX4e5fOcXqwMR7EcJ0pj2kV1CVzHVMX/LphnKWD3LObjZCoJ71lKpHw==", "license": "MIT", "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", - "cross-spawn": "^7.0.3", + "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", - "human-signals": "^8.0.0", + "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", - "pretty-ms": "^9.0.0", + "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", - "yoctocolors": "^2.0.0" + "yoctocolors": "^2.1.1" }, "engines": { "node": "^18.19.0 || >=20.5.0" @@ -2701,6 +2747,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -3417,6 +3474,15 @@ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "license": "ISC" }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -3519,6 +3585,18 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, "node_modules/mocha": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz", @@ -4017,6 +4095,12 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, "node_modules/pathval": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", @@ -4054,27 +4138,38 @@ "node": ">= 6" } }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, "node_modules/polkadot-api": { - "version": "1.9.12", - "resolved": "https://registry.npmjs.org/polkadot-api/-/polkadot-api-1.9.12.tgz", - "integrity": "sha512-gYhpef5YnLEPZ3Uxeha5sHIIejINONSGBXTgFyEWsYi4y2DEUlv2ISlNZ9/0AGG6b6ZFDd56mLop/Fohl8vA4Q==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/polkadot-api/-/polkadot-api-1.12.0.tgz", + "integrity": "sha512-CstKp0ySE3JRVnG4nzl6hDhYLf4Qs/XpVk1xJrypYMqVbTu8FwjBK3l3j4pHhEttVudlEjK2hoVzQ1MdxMLeEg==", "license": "MIT", "dependencies": { - "@polkadot-api/cli": "0.11.9", - "@polkadot-api/ink-contracts": "0.2.6", + "@polkadot-api/cli": "0.13.0", + "@polkadot-api/ink-contracts": "0.3.2", "@polkadot-api/json-rpc-provider": "0.0.4", - "@polkadot-api/known-chains": "0.7.3", + "@polkadot-api/known-chains": "0.7.6", "@polkadot-api/logs-provider": "0.0.6", - "@polkadot-api/metadata-builders": "0.10.2", - "@polkadot-api/metadata-compatibility": "0.2.0", - "@polkadot-api/observable-client": "0.8.6", - "@polkadot-api/pjs-signer": "0.6.5", + "@polkadot-api/metadata-builders": "0.12.1", + "@polkadot-api/metadata-compatibility": "0.2.3", + "@polkadot-api/observable-client": "0.11.0", + "@polkadot-api/pjs-signer": "0.6.8", "@polkadot-api/polkadot-sdk-compat": "2.3.2", "@polkadot-api/polkadot-signer": "0.1.6", - "@polkadot-api/signer": "0.1.15", + "@polkadot-api/signer": "0.2.1", "@polkadot-api/sm-provider": "0.1.7", "@polkadot-api/smoldot": "0.3.8", - "@polkadot-api/substrate-bindings": "0.11.1", + "@polkadot-api/substrate-bindings": "0.13.0", "@polkadot-api/substrate-client": "0.3.0", "@polkadot-api/utils": "0.1.2", "@polkadot-api/ws-provider": "0.4.0", @@ -4396,9 +4491,9 @@ "license": "MIT" }, "node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4710,12 +4805,12 @@ "license": "MIT" }, "node_modules/tinyglobby": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", - "integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", "license": "MIT", "dependencies": { - "fdir": "^6.4.3", + "fdir": "^6.4.4", "picomatch": "^4.0.2" }, "engines": { @@ -4726,9 +4821,9 @@ } }, "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", - "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", "license": "MIT", "peerDependencies": { "picomatch": "^3 || ^4" @@ -4850,9 +4945,9 @@ "license": "0BSD" }, "node_modules/tsup": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.4.0.tgz", - "integrity": "sha512-b+eZbPCjz10fRryaAA7C8xlIHnf8VnsaRqydheLIqwG/Mcpfk8Z5zp3HayX7GaTygkigHl5cBUs+IhcySiIexQ==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.0.tgz", + "integrity": "sha512-VmBp77lWNQq6PfuMqCHD3xWl22vEoWsKajkF8t+yMBawlUS8JzEI+vOVMeuNZIuMML8qXRizFKi9oD5glKQVcQ==", "license": "MIT", "dependencies": { "bundle-require": "^5.1.0", @@ -4861,6 +4956,7 @@ "consola": "^3.4.0", "debug": "^4.4.0", "esbuild": "^0.25.0", + "fix-dts-default-cjs-exports": "^1.0.0", "joycon": "^3.1.1", "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", @@ -4929,9 +5025,9 @@ } }, "node_modules/type-fest": { - "version": "4.40.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.40.0.tgz", - "integrity": "sha512-ABHZ2/tS2JkvH1PEjxFDTUWC8dB5OsIGZP4IFLhR293GqT5Y5qB1WwL2kMPYhQW9DVgVD8Hd7I8gjwPIf5GFkw==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=16" @@ -4953,6 +5049,12 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "license": "MIT" + }, "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", @@ -5697,9 +5799,9 @@ } }, "node_modules/ws": { - "version": "8.18.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", - "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", "license": "MIT", "engines": { "node": ">=10.0.0" diff --git a/evm-tests/package.json b/evm-tests/package.json index 0e90cdb976..9970967a88 100644 --- a/evm-tests/package.json +++ b/evm-tests/package.json @@ -6,6 +6,7 @@ "author": "", "license": "ISC", "dependencies": { + "@polkadot-api/descriptors": "file:.papi/descriptors", "@polkadot-labs/hdkd": "^0.0.10", "@polkadot-labs/hdkd-helpers": "^0.0.11", "@polkadot/api": "15.1.1", @@ -16,7 +17,8 @@ "mocha": "^11.1.0", "polkadot-api": "^1.9.5", "scale-ts": "^1.6.1", - "viem": "2.23.4" + "viem": "2.23.4", + "ws": "^8.18.2" }, "devDependencies": { "@types/bun": "^1.1.13", diff --git a/evm-tests/src/contracts/alpha.ts b/evm-tests/src/contracts/alpha.ts new file mode 100644 index 0000000000..7dfb19be6c --- /dev/null +++ b/evm-tests/src/contracts/alpha.ts @@ -0,0 +1,249 @@ +export const IALPHA_ADDRESS = "0x0000000000000000000000000000000000000807"; + +export const IAlphaABI = [ + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getMovingAlphaPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getTaoInPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaInPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaOutPool", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getAlphaIssuance", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTaoWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + }, + { + "internalType": "uint64", + "name": "tao", + "type": "uint64" + } + ], + "name": "simSwapTaoForAlpha", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + }, + { + "internalType": "uint64", + "name": "alpha", + "type": "uint64" + } + ], + "name": "simSwapAlphaForTao", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getSubnetMechanism", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRootNetuid", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getEMAPriceHalvingBlocks", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "netuid", + "type": "uint16" + } + ], + "name": "getSubnetVolume", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/evm-tests/test/alpha.precompile.test.ts b/evm-tests/test/alpha.precompile.test.ts new file mode 100644 index 0000000000..85161aae92 --- /dev/null +++ b/evm-tests/test/alpha.precompile.test.ts @@ -0,0 +1,428 @@ +import * as assert from "assert"; + +import { getAliceSigner, getDevnetApi, waitForTransactionCompletion, convertPublicKeyToMultiAddress, getRandomSubstrateKeypair, getSignerFromKeypair } from "../src/substrate" +import { getPublicClient } from "../src/utils"; +import { ETH_LOCAL_URL, SUB_LOCAL_URL } from "../src/config"; +import { devnet } from "@polkadot-api/descriptors" +import { PublicClient } from "viem"; +import { PolkadotSigner, TypedApi } from "polkadot-api"; +import { toViemAddress, convertPublicKeyToSs58 } from "../src/address-utils" +import { IAlphaABI, IALPHA_ADDRESS } from "../src/contracts/alpha" + +describe("Test Alpha Precompile", () => { + // init substrate part + const hotkey = getRandomSubstrateKeypair(); + const coldkey = getRandomSubstrateKeypair(); + let publicClient: PublicClient; + + let api: TypedApi; + + // sudo account alice as signer + let alice: PolkadotSigner; + + // init other variable + let subnetId = 0; + + before(async () => { + // init variables got from await and async + publicClient = await getPublicClient(ETH_LOCAL_URL) + api = await getDevnetApi() + alice = await getAliceSigner(); + + // Fund the hotkey account + { + const multiAddress = convertPublicKeyToMultiAddress(hotkey.publicKey) + const internalCall = api.tx.Balances.force_set_balance({ who: multiAddress, new_free: BigInt(1e12) }) + const tx = api.tx.Sudo.sudo({ call: internalCall.decodedCall }) + + await waitForTransactionCompletion(api, tx, alice) + .then(() => { }) + .catch((error) => { console.log(`transaction error ${error}`) }); + } + + // Fund the coldkey account + { + const multiAddress = convertPublicKeyToMultiAddress(coldkey.publicKey) + const internalCall = api.tx.Balances.force_set_balance({ who: multiAddress, new_free: BigInt(1e12) }) + const tx = api.tx.Sudo.sudo({ call: internalCall.decodedCall }) + + await waitForTransactionCompletion(api, tx, alice) + .then(() => { }) + .catch((error) => { console.log(`transaction error ${error}`) }); + } + + // Register a new subnet + const signer = getSignerFromKeypair(coldkey) + const registerNetworkTx = api.tx.SubtensorModule.register_network({ hotkey: convertPublicKeyToSs58(hotkey.publicKey) }) + await waitForTransactionCompletion(api, registerNetworkTx, signer) + .then(() => { }) + .catch((error) => { console.log(`transaction error ${error}`) }); + + // Get the newly created subnet ID + let totalNetworks = await api.query.SubtensorModule.TotalNetworks.getValue() + assert.ok(totalNetworks > 1) + subnetId = totalNetworks - 1 + + // Register a neuron on the subnet if needed + let uid_count = await api.query.SubtensorModule.SubnetworkN.getValue(subnetId) + if (uid_count === 0) { + const tx = api.tx.SubtensorModule.burned_register({ hotkey: convertPublicKeyToSs58(hotkey.publicKey), netuid: subnetId }) + await waitForTransactionCompletion(api, tx, signer) + .then(() => { }) + .catch((error) => { console.log(`transaction error ${error}`) }); + } + }) + + describe("Alpha Price Functions", () => { + it("getAlphaPrice returns valid price for subnet", async () => { + const alphaPrice = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaPrice", + args: [subnetId] + }) + + assert.ok(alphaPrice !== undefined, "Alpha price should be defined"); + assert.ok(typeof alphaPrice === 'bigint', "Alpha price should be a bigint"); + assert.ok(alphaPrice >= BigInt(0), "Alpha price should be non-negative"); + }); + + it("getMovingAlphaPrice returns valid moving price for subnet", async () => { + const movingAlphaPrice = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getMovingAlphaPrice", + args: [subnetId] + }) + + assert.ok(movingAlphaPrice !== undefined, "Moving alpha price should be defined"); + assert.ok(typeof movingAlphaPrice === 'bigint', "Moving alpha price should be a bigint"); + assert.ok(movingAlphaPrice >= BigInt(0), "Moving alpha price should be non-negative"); + }); + + it("alpha prices are consistent for same subnet", async () => { + const alphaPrice = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaPrice", + args: [subnetId] + }) + + const movingAlphaPrice = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getMovingAlphaPrice", + args: [subnetId] + }) + + // Both should be defined and valid + assert.ok(alphaPrice !== undefined && movingAlphaPrice !== undefined); + }); + }); + + describe("Pool Data Functions", () => { + it("getTaoInPool returns valid TAO amount", async () => { + const taoInPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getTaoInPool", + args: [subnetId] + }) + + assert.ok(taoInPool !== undefined, "TAO in pool should be defined"); + assert.ok(typeof taoInPool === 'bigint', "TAO in pool should be a bigint"); + assert.ok(taoInPool >= BigInt(0), "TAO in pool should be non-negative"); + }); + + it("getAlphaInPool returns valid Alpha amount", async () => { + const alphaInPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaInPool", + args: [subnetId] + }) + + assert.ok(alphaInPool !== undefined, "Alpha in pool should be defined"); + assert.ok(typeof alphaInPool === 'bigint', "Alpha in pool should be a bigint"); + assert.ok(alphaInPool >= BigInt(0), "Alpha in pool should be non-negative"); + }); + + it("getAlphaOutPool returns valid Alpha out amount", async () => { + const alphaOutPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaOutPool", + args: [subnetId] + }) + + assert.ok(alphaOutPool !== undefined, "Alpha out pool should be defined"); + assert.ok(typeof alphaOutPool === 'bigint', "Alpha out pool should be a bigint"); + assert.ok(alphaOutPool >= BigInt(0), "Alpha out pool should be non-negative"); + }); + + it("getAlphaIssuance returns valid issuance amount", async () => { + const alphaIssuance = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaIssuance", + args: [subnetId] + }) + + assert.ok(alphaIssuance !== undefined, "Alpha issuance should be defined"); + assert.ok(typeof alphaIssuance === 'bigint', "Alpha issuance should be a bigint"); + assert.ok(alphaIssuance >= BigInt(0), "Alpha issuance should be non-negative"); + }); + }); + + describe("Global Functions", () => { + it("getTaoWeight returns valid TAO weight", async () => { + const taoWeight = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getTaoWeight", + args: [] + }) + + assert.ok(taoWeight !== undefined, "TAO weight should be defined"); + assert.ok(typeof taoWeight === 'bigint', "TAO weight should be a bigint"); + assert.ok(taoWeight >= BigInt(0), "TAO weight should be non-negative"); + }); + + it("getRootNetuid returns correct root netuid", async () => { + const rootNetuid = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getRootNetuid", + args: [] + }) + + assert.ok(rootNetuid !== undefined, "Root netuid should be defined"); + assert.ok(typeof rootNetuid === 'number', "Root netuid should be a number"); + assert.strictEqual(rootNetuid, 0, "Root netuid should be 0"); + }); + }); + + describe("Swap Simulation Functions", () => { + it("simSwapTaoForAlpha returns valid simulation", async () => { + const taoAmount = BigInt(1000000000); // 1 TAO in RAO + const simulatedAlpha = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapTaoForAlpha", + args: [subnetId, taoAmount] + }) + + assert.ok(simulatedAlpha !== undefined, "Simulated alpha should be defined"); + assert.ok(typeof simulatedAlpha === 'bigint', "Simulated alpha should be a bigint"); + assert.ok(simulatedAlpha >= BigInt(0), "Simulated alpha should be non-negative"); + }); + + it("simSwapAlphaForTao returns valid simulation", async () => { + const alphaAmount = BigInt(1000000000); // 1 Alpha + const simulatedTao = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapAlphaForTao", + args: [subnetId, alphaAmount] + }) + + assert.ok(simulatedTao !== undefined, "Simulated tao should be defined"); + assert.ok(typeof simulatedTao === 'bigint', "Simulated tao should be a bigint"); + assert.ok(simulatedTao >= BigInt(0), "Simulated tao should be non-negative"); + }); + + it("swap simulations handle zero amounts", async () => { + const zeroTaoForAlpha = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapTaoForAlpha", + args: [subnetId, BigInt(0)] + }) + + const zeroAlphaForTao = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapAlphaForTao", + args: [subnetId, BigInt(0)] + }) + + assert.strictEqual(zeroTaoForAlpha, BigInt(0), "Zero TAO should result in zero Alpha"); + assert.strictEqual(zeroAlphaForTao, BigInt(0), "Zero Alpha should result in zero TAO"); + }); + + it("swap simulations are internally consistent", async () => { + const taoAmount = BigInt(1000000000); // 1 TAO + + // Simulate TAO -> Alpha + const simulatedAlpha = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapTaoForAlpha", + args: [subnetId, taoAmount] + }) + + // If we got alpha, simulate Alpha -> TAO + if ((simulatedAlpha as bigint) > BigInt(0)) { + const simulatedTao = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapAlphaForTao", + args: [subnetId, simulatedAlpha] + }) + + // Check if simulated values are reasonably close (allowing for rounding/fees) + if ((simulatedTao as bigint) > BigInt(0)) { + const ratio = Number(taoAmount) / Number(simulatedTao); + assert.ok(ratio >= 0.5 && ratio <= 2.0, "Swap simulation should be within reasonable bounds"); + } + } + }); + }); + + describe("Subnet Configuration Functions", () => { + it("getSubnetMechanism returns valid mechanism", async () => { + const mechanism = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getSubnetMechanism", + args: [subnetId] + }) + + assert.ok(mechanism !== undefined, "Subnet mechanism should be defined"); + assert.ok(typeof mechanism === 'number', "Subnet mechanism should be a number"); + assert.ok(mechanism >= 0, "Subnet mechanism should be non-negative"); + }); + + it("getEMAPriceHalvingBlocks returns valid halving period", async () => { + const halvingBlocks = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getEMAPriceHalvingBlocks", + args: [subnetId] + }) + + assert.ok(halvingBlocks !== undefined, "EMA price halving blocks should be defined"); + assert.ok(typeof halvingBlocks === 'bigint', "EMA halving blocks should be a bigint"); + assert.ok(halvingBlocks >= BigInt(0), "EMA halving blocks should be non-negative"); + }); + + it("getSubnetVolume returns valid volume data", async () => { + const subnetVolume = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getSubnetVolume", + args: [subnetId] + }) + + assert.ok(subnetVolume !== undefined, "Subnet volume should be defined"); + assert.ok(typeof subnetVolume === 'bigint', "Subnet volume should be a bigint"); + assert.ok(subnetVolume >= BigInt(0), "Subnet volume should be non-negative"); + }); + }); + + describe("Data Consistency with Pallet", () => { + it("precompile data matches pallet values", async () => { + // Get TAO in pool from precompile + const taoInPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getTaoInPool", + args: [subnetId] + }) + + // Get TAO in pool directly from the pallet + const taoInPoolFromPallet = await api.query.SubtensorModule.SubnetTAO.getValue(subnetId); + + // Compare values + assert.strictEqual(taoInPool as bigint, taoInPoolFromPallet, "TAO in pool values should match"); + + // Get Alpha in pool from precompile + const alphaInPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaInPool", + args: [subnetId] + }) + + // Get Alpha in pool directly from the pallet + const alphaInPoolFromPallet = await api.query.SubtensorModule.SubnetAlphaIn.getValue(subnetId); + + // Compare values + assert.strictEqual(alphaInPool as bigint, alphaInPoolFromPallet, "Alpha in pool values should match"); + + // Get Alpha out pool from precompile + const alphaOutPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaOutPool", + args: [subnetId] + }) + + // Get Alpha out pool directly from the pallet + const alphaOutPoolFromPallet = await api.query.SubtensorModule.SubnetAlphaOut.getValue(subnetId); + + // Compare values + assert.strictEqual(alphaOutPool as bigint, alphaOutPoolFromPallet, "Alpha out pool values should match"); + }); + + it("subnet volume data is consistent", async () => { + const subnetVolume = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getSubnetVolume", + args: [subnetId] + }) + + const subnetVolumeFromPallet = await api.query.SubtensorModule.SubnetVolume.getValue(subnetId); + + assert.strictEqual(subnetVolume as bigint, subnetVolumeFromPallet, "Subnet volume values should match"); + }); + }); + + describe("Edge Cases and Error Handling", () => { + it("handles non-existent subnet gracefully", async () => { + const nonExistentSubnet = 9999; + + // These should not throw but return default values + const alphaPrice = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getAlphaPrice", + args: [nonExistentSubnet] + }) + + const taoInPool = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getTaoInPool", + args: [nonExistentSubnet] + }) + + // Should return default values, not throw + assert.ok(alphaPrice !== undefined, "Should handle non-existent subnet gracefully"); + assert.ok(taoInPool !== undefined, "Should handle non-existent subnet gracefully"); + }); + + it("simulation functions handle large amounts", async () => { + const largeAmount = BigInt("1000000000000000000"); // Very large amount + + const simulatedAlpha = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapTaoForAlpha", + args: [subnetId, largeAmount] + }) + + const simulatedTao = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "simSwapAlphaForTao", + args: [subnetId, largeAmount] + }) + + // Should handle large amounts without throwing + assert.ok(simulatedAlpha !== undefined, "Should handle large TAO amounts"); + assert.ok(simulatedTao !== undefined, "Should handle large Alpha amounts"); + }); + }); +}); diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs index 1f01883d40..a806f9f07b 100644 --- a/precompiles/src/alpha.rs +++ b/precompiles/src/alpha.rs @@ -14,7 +14,7 @@ where R: frame_system::Config + pallet_subtensor::Config, R::AccountId: From<[u8; 32]>, { - const INDEX: u64 = 2054; + const INDEX: u64 = 2055; } #[precompile_utils::precompile] diff --git a/precompiles/src/solidity/alpha.sol b/precompiles/src/solidity/alpha.sol index 622757df78..cafbaa10cb 100644 --- a/precompiles/src/solidity/alpha.sol +++ b/precompiles/src/solidity/alpha.sol @@ -1,6 +1,6 @@ pragma solidity ^0.8.0; -address constant IALPHA_ADDRESS = 0x0000000000000000000000000000000000000806; +address constant IALPHA_ADDRESS = 0x0000000000000000000000000000000000000807; interface IAlpha { /// @dev Returns the current alpha price for a subnet. @@ -67,4 +67,4 @@ interface IAlpha { /// @param netuid The subnet identifier. /// @return The subnet volume. function getSubnetVolume(uint16 netuid) external view returns (uint256); -} \ No newline at end of file +} From 90ba97893d1a21f984c50670793b96a32d9b945b Mon Sep 17 00:00:00 2001 From: kenobijon Date: Tue, 27 May 2025 19:45:36 -0500 Subject: [PATCH 4/8] remove descriptions from package.json --- evm-tests/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/evm-tests/package.json b/evm-tests/package.json index 9970967a88..4834ef4e99 100644 --- a/evm-tests/package.json +++ b/evm-tests/package.json @@ -6,7 +6,6 @@ "author": "", "license": "ISC", "dependencies": { - "@polkadot-api/descriptors": "file:.papi/descriptors", "@polkadot-labs/hdkd": "^0.0.10", "@polkadot-labs/hdkd-helpers": "^0.0.11", "@polkadot/api": "15.1.1", From f133f989dfb3d4c39dfdbc49193514fbd6d770e9 Mon Sep 17 00:00:00 2001 From: kenobijon Date: Tue, 27 May 2025 20:58:46 -0500 Subject: [PATCH 5/8] bumping runtime spec_version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 95b032f9e6..5e099d1ce2 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -209,7 +209,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 272, + spec_version: 273, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 82c10e4e7a3f94c2d4002fe539ffcc4085c8cfe7 Mon Sep 17 00:00:00 2001 From: Ken Jon Date: Wed, 4 Jun 2025 12:02:10 +0100 Subject: [PATCH 6/8] updated spec version to 275 --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 73b99914fb..b5be536ac5 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -209,7 +209,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 274, + spec_version: 275, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 3f187890d41cb724e693bc8d4158b341da1fb34e Mon Sep 17 00:00:00 2001 From: Ken Jon Date: Thu, 5 Jun 2025 14:22:55 +0100 Subject: [PATCH 7/8] updated alpha precompile index --- precompiles/src/alpha.rs | 2 +- precompiles/src/solidity/alpha.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs index a806f9f07b..45aab10bf7 100644 --- a/precompiles/src/alpha.rs +++ b/precompiles/src/alpha.rs @@ -14,7 +14,7 @@ where R: frame_system::Config + pallet_subtensor::Config, R::AccountId: From<[u8; 32]>, { - const INDEX: u64 = 2055; + const INDEX: u64 = 2056; } #[precompile_utils::precompile] diff --git a/precompiles/src/solidity/alpha.sol b/precompiles/src/solidity/alpha.sol index cafbaa10cb..7bb529f684 100644 --- a/precompiles/src/solidity/alpha.sol +++ b/precompiles/src/solidity/alpha.sol @@ -1,6 +1,6 @@ pragma solidity ^0.8.0; -address constant IALPHA_ADDRESS = 0x0000000000000000000000000000000000000807; +address constant IALPHA_ADDRESS = 0x0000000000000000000000000000000000000808; interface IAlpha { /// @dev Returns the current alpha price for a subnet. From 855e0ba0f15f5edde6280c6cb40738413b11a547 Mon Sep 17 00:00:00 2001 From: Ken Jon Date: Thu, 5 Jun 2025 16:49:15 +0100 Subject: [PATCH 8/8] updating alpha test address --- evm-tests/src/contracts/alpha.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evm-tests/src/contracts/alpha.ts b/evm-tests/src/contracts/alpha.ts index 7dfb19be6c..35baf83129 100644 --- a/evm-tests/src/contracts/alpha.ts +++ b/evm-tests/src/contracts/alpha.ts @@ -1,4 +1,4 @@ -export const IALPHA_ADDRESS = "0x0000000000000000000000000000000000000807"; +export const IALPHA_ADDRESS = "0x0000000000000000000000000000000000000808"; export const IAlphaABI = [ {