difftreelog
Merge pull request #932 from UniqueNetwork/fix/support_for_old_versions_in_collection_by_id_method
in: master
5 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3712,6 +3712,12 @@
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
[[package]]
+name = "hex-literal"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
+
+[[package]]
name = "hkdf"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4282,7 +4288,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.3.4",
"kusama-runtime-constants",
"log",
"pallet-authority-discovery",
@@ -5730,7 +5736,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.4.1",
"impl-trait-for-tuples",
"log",
"num_enum",
@@ -8446,7 +8452,7 @@
source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.41#e203bfb396ed949f102720debf32fb98166787af"
dependencies = [
"bitvec",
- "hex-literal",
+ "hex-literal 0.3.4",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain",
@@ -8512,7 +8518,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.3.4",
"log",
"pallet-authority-discovery",
"pallet-authorship",
@@ -8714,7 +8720,7 @@
"frame-support",
"frame-system-rpc-runtime-api",
"futures",
- "hex-literal",
+ "hex-literal 0.3.4",
"kusama-runtime",
"kvdb",
"kvdb-rocksdb",
@@ -9169,7 +9175,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.4.1",
"impl-trait-for-tuples",
"log",
"num_enum",
@@ -9637,7 +9643,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.3.4",
"log",
"pallet-authority-discovery",
"pallet-authorship",
@@ -13327,6 +13333,7 @@
"anyhow",
"app-promotion-rpc",
"frame-benchmarking",
+ "hex-literal 0.4.1",
"jsonrpsee",
"opal-runtime",
"pallet-evm",
@@ -13537,7 +13544,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.4.1",
"impl-trait-for-tuples",
"log",
"num_enum",
@@ -14437,7 +14444,7 @@
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
- "hex-literal",
+ "hex-literal 0.3.4",
"log",
"pallet-authority-discovery",
"pallet-authorship",
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -187,7 +187,7 @@
derivative = { version = "2.2.0", features = ["use_core"] }
ethereum = { version = "0.14.0", default-features = false }
evm-core = { default-features = false, version = "0.37.0" }
-hex-literal = "0.3.4"
+hex-literal = "0.4.1"
impl-trait-for-tuples = "0.2.2"
jsonrpsee = { version = "0.16.2", features = ["macros", "server"] }
log = { version = "0.4.16", default-features = false }
client/rpc/Cargo.tomldiffbeforeafterboth--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -40,6 +40,9 @@
quartz-runtime = { workspace = true, optional = true }
unique-runtime = { workspace = true, optional = true }
+[dev-dependencies]
+hex-literal = { workspace = true }
+
[features]
default = ['opal-runtime']
all-runtimes = [
client/rpc/src/lib.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original License18use std::sync::Arc;1920use codec::Decode;21use jsonrpsee::{22 core::{RpcResult as Result},23 proc_macros::rpc,24};25use anyhow::anyhow;26use sp_runtime::traits::{AtLeast32BitUnsigned, Member};27use up_data_structs::{28 RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId, Property,29 PropertyKeyPermission, TokenData, TokenChild,30};31use sp_api::{BlockT, ProvideRuntimeApi, ApiExt};32use sp_blockchain::HeaderBackend;33use up_rpc::UniqueApi as UniqueRuntimeApi;34use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;3536pub use app_promotion_unique_rpc::AppPromotionApiServer;3738#[cfg(feature = "pov-estimate")]39pub mod pov_estimate;4041#[rpc(server)]42#[async_trait]43pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {44 /// Get tokens owned by account.45 #[method(name = "unique_accountTokens")]46 fn account_tokens(47 &self,48 collection: CollectionId,49 account: CrossAccountId,50 at: Option<BlockHash>,51 ) -> Result<Vec<TokenId>>;5253 /// Get tokens contained within a collection.54 #[method(name = "unique_collectionTokens")]55 fn collection_tokens(56 &self,57 collection: CollectionId,58 at: Option<BlockHash>,59 ) -> Result<Vec<TokenId>>;6061 /// Check if the token exists.62 #[method(name = "unique_tokenExists")]63 fn token_exists(64 &self,65 collection: CollectionId,66 token: TokenId,67 at: Option<BlockHash>,68 ) -> Result<bool>;6970 /// Get the token owner.71 #[method(name = "unique_tokenOwner")]72 fn token_owner(73 &self,74 collection: CollectionId,75 token: TokenId,76 at: Option<BlockHash>,77 ) -> Result<Option<CrossAccountId>>;7879 /// Returns 10 tokens owners in no particular order.80 #[method(name = "unique_tokenOwners")]81 fn token_owners(82 &self,83 collection: CollectionId,84 token: TokenId,85 at: Option<BlockHash>,86 ) -> Result<Vec<CrossAccountId>>;8788 /// Get the topmost token owner in the hierarchy of a possibly nested token.89 #[method(name = "unique_topmostTokenOwner")]90 fn topmost_token_owner(91 &self,92 collection: CollectionId,93 token: TokenId,94 at: Option<BlockHash>,95 ) -> Result<Option<CrossAccountId>>;9697 /// Get tokens nested directly into the token.98 #[method(name = "unique_tokenChildren")]99 fn token_children(100 &self,101 collection: CollectionId,102 token: TokenId,103 at: Option<BlockHash>,104 ) -> Result<Vec<TokenChild>>;105106 /// Get collection properties, optionally limited to the provided keys.107 #[method(name = "unique_collectionProperties")]108 fn collection_properties(109 &self,110 collection: CollectionId,111 keys: Option<Vec<String>>,112 at: Option<BlockHash>,113 ) -> Result<Vec<Property>>;114115 /// Get token properties, optionally limited to the provided keys.116 #[method(name = "unique_tokenProperties")]117 fn token_properties(118 &self,119 collection: CollectionId,120 token_id: TokenId,121 keys: Option<Vec<String>>,122 at: Option<BlockHash>,123 ) -> Result<Vec<Property>>;124125 /// Get property permissions, optionally limited to the provided keys.126 #[method(name = "unique_propertyPermissions")]127 fn property_permissions(128 &self,129 collection: CollectionId,130 keys: Option<Vec<String>>,131 at: Option<BlockHash>,132 ) -> Result<Vec<PropertyKeyPermission>>;133134 /// Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT.135 #[method(name = "unique_tokenData")]136 fn token_data(137 &self,138 collection: CollectionId,139 token_id: TokenId,140 keys: Option<Vec<String>>,141 at: Option<BlockHash>,142 ) -> Result<TokenData<CrossAccountId>>;143144 /// Get the amount of distinctive tokens present in a collection.145 #[method(name = "unique_totalSupply")]146 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;147148 /// Get the amount of any user tokens owned by an account.149 #[method(name = "unique_accountBalance")]150 fn account_balance(151 &self,152 collection: CollectionId,153 account: CrossAccountId,154 at: Option<BlockHash>,155 ) -> Result<u32>;156157 /// Get the amount of a specific token owned by an account.158 #[method(name = "unique_balance")]159 fn balance(160 &self,161 collection: CollectionId,162 account: CrossAccountId,163 token: TokenId,164 at: Option<BlockHash>,165 ) -> Result<String>;166167 /// Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor.168 #[method(name = "unique_allowance")]169 fn allowance(170 &self,171 collection: CollectionId,172 sender: CrossAccountId,173 spender: CrossAccountId,174 token: TokenId,175 at: Option<BlockHash>,176 ) -> Result<String>;177178 /// Get the list of admin accounts of a collection.179 #[method(name = "unique_adminlist")]180 fn adminlist(181 &self,182 collection: CollectionId,183 at: Option<BlockHash>,184 ) -> Result<Vec<CrossAccountId>>;185186 /// Get the list of accounts allowed to operate within a collection.187 #[method(name = "unique_allowlist")]188 fn allowlist(189 &self,190 collection: CollectionId,191 at: Option<BlockHash>,192 ) -> Result<Vec<CrossAccountId>>;193194 /// Check if a user is allowed to operate within a collection.195 #[method(name = "unique_allowed")]196 fn allowed(197 &self,198 collection: CollectionId,199 user: CrossAccountId,200 at: Option<BlockHash>,201 ) -> Result<bool>;202203 /// Get the last token ID created in a collection.204 #[method(name = "unique_lastTokenId")]205 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;206207 /// Get collection info by the specified ID.208 #[method(name = "unique_collectionById")]209 fn collection_by_id(210 &self,211 collection: CollectionId,212 at: Option<BlockHash>,213 ) -> Result<Option<RpcCollection<AccountId>>>;214215 /// Get chain stats about collections.216 #[method(name = "unique_collectionStats")]217 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;218219 /// Get the number of blocks until sponsoring a transaction is available.220 #[method(name = "unique_nextSponsored")]221 fn next_sponsored(222 &self,223 collection: CollectionId,224 account: CrossAccountId,225 token: TokenId,226 at: Option<BlockHash>,227 ) -> Result<Option<u64>>;228229 /// Get effective collection limits. If not explicitly set, get the chain defaults.230 #[method(name = "unique_effectiveCollectionLimits")]231 fn effective_collection_limits(232 &self,233 collection_id: CollectionId,234 at: Option<BlockHash>,235 ) -> Result<Option<CollectionLimits>>;236237 /// Get the total amount of pieces of an RFT.238 #[method(name = "unique_totalPieces")]239 fn total_pieces(240 &self,241 collection_id: CollectionId,242 token_id: TokenId,243 at: Option<BlockHash>,244 ) -> Result<Option<String>>;245246 /// Get whether an operator is approved by a given owner.247 #[method(name = "unique_allowanceForAll")]248 fn allowance_for_all(249 &self,250 collection: CollectionId,251 owner: CrossAccountId,252 operator: CrossAccountId,253 at: Option<BlockHash>,254 ) -> Result<bool>;255}256257mod app_promotion_unique_rpc {258 use super::*;259260 #[rpc(server)]261 #[async_trait]262 pub trait AppPromotionApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {263 /// Returns the total amount of staked tokens.264 #[method(name = "appPromotion_totalStaked")]265 fn total_staked(266 &self,267 staker: Option<CrossAccountId>,268 at: Option<BlockHash>,269 ) -> Result<String>;270271 ///Returns the total amount of staked tokens per block when staked.272 #[method(name = "appPromotion_totalStakedPerBlock")]273 fn total_staked_per_block(274 &self,275 staker: CrossAccountId,276 at: Option<BlockHash>,277 ) -> Result<Vec<(BlockNumber, String)>>;278279 /// Returns the total amount of tokens pending withdrawal from staking.280 #[method(name = "appPromotion_pendingUnstake")]281 fn pending_unstake(282 &self,283 staker: Option<CrossAccountId>,284 at: Option<BlockHash>,285 ) -> Result<String>;286287 /// Returns the total amount of tokens pending withdrawal from staking per block.288 #[method(name = "appPromotion_pendingUnstakePerBlock")]289 fn pending_unstake_per_block(290 &self,291 staker: CrossAccountId,292 at: Option<BlockHash>,293 ) -> Result<Vec<(BlockNumber, String)>>;294 }295}296297#[macro_export]298macro_rules! define_struct_for_server_api {299 ($name:ident { $($arg:ident: $arg_ty:ty),+ $(,)? }) => {300 pub struct $name<Client, Block: BlockT> {301 $($arg: $arg_ty),+,302 _marker: std::marker::PhantomData<Block>,303 }304305 impl<Client, Block: BlockT> $name<Client, Block> {306 pub fn new($($arg: $arg_ty),+) -> Self {307 Self {308 $($arg),+,309 _marker: Default::default(),310 }311 }312 }313 };314}315316define_struct_for_server_api! {317 Unique {318 client: Arc<Client>319 }320}321322define_struct_for_server_api! {323 AppPromotion {324 client: Arc<Client>325 }326}327328macro_rules! pass_method {329 (330 $method_name:ident(331 $($(#[map(|$map_arg:ident| $map:expr)])? $name:ident: $ty:ty),* $(,)?332 ) -> $result:ty $(=> $mapper:expr)?,333 //$runtime_name:ident $(<$($lt: tt),+>)*334 $runtime_api_macro:ident335 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*336 ) => {337 fn $method_name(338 &self,339 $(340 $name: $ty,341 )*342 at: Option<<Block as BlockT>::Hash>,343 ) -> Result<$result> {344 let api = self.client.runtime_api();345 let at = at.unwrap_or_else(|| self.client.info().best_hash);346 let _api_version = if let Ok(Some(api_version)) =347 api.api_version::<$runtime_api_macro!()>(at)348 {349 api_version350 } else {351 // unreachable for our runtime352 return Err(anyhow!("api is not available").into())353 };354355 let result = $(if _api_version < $ver {356 api.$changed_method_name(at, $($changed_name),*).map(|r| r.and_then($fixer))357 } else)*358 { api.$method_name(at, $($((|$map_arg: $ty| $map))? ($name)),*) };359360 Ok(result361 .map_err(|e| anyhow!("unable to query: {e}"))?362 .map_err(|e| anyhow!("runtime error: {e:?}"))$(.map($mapper))??)363 }364 };365}366367macro_rules! unique_api {368 () => {369 dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>370 };371}372373macro_rules! app_promotion_api {374 () => {375 dyn AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>376 };377}378379#[allow(deprecated)]380impl<C, Block, CrossAccountId, AccountId>381 UniqueApiServer<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>382where383 Block: BlockT,384 AccountId: Decode,385 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,386 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,387 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,388{389 pass_method!(390 account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>, unique_api391 );392 pass_method!(393 collection_tokens(collection: CollectionId) -> Vec<TokenId>, unique_api394 );395 pass_method!(396 token_exists(collection: CollectionId, token: TokenId) -> bool, unique_api397 );398 pass_method!(399 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api400 );401 pass_method!(402 topmost_token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api403 );404 pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec<TokenChild>, unique_api);405 pass_method!(total_supply(collection: CollectionId) -> u32, unique_api);406 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32, unique_api);407 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string(), unique_api);408 pass_method!(409 allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string(),410 unique_api411 );412413 pass_method!(collection_properties(414 collection: CollectionId,415416 #[map(|keys| string_keys_to_bytes_keys(keys))]417 keys: Option<Vec<String>>418 ) -> Vec<Property>, unique_api);419420 pass_method!(token_properties(421 collection: CollectionId,422 token_id: TokenId,423424 #[map(|keys| string_keys_to_bytes_keys(keys))]425 keys: Option<Vec<String>>426 ) -> Vec<Property>, unique_api);427428 pass_method!(property_permissions(429 collection: CollectionId,430431 #[map(|keys| string_keys_to_bytes_keys(keys))]432 keys: Option<Vec<String>>433 ) -> Vec<PropertyKeyPermission>, unique_api);434435 pass_method!(436 token_data(437 collection: CollectionId,438 token_id: TokenId,439440 #[map(|keys| string_keys_to_bytes_keys(keys))]441 keys: Option<Vec<String>>,442 ) -> TokenData<CrossAccountId>, unique_api;443 changed_in 3, token_data_before_version_3(collection, token_id, string_keys_to_bytes_keys(keys)) => |value| Ok(value.into())444 );445446 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);447 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);448 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool, unique_api);449 pass_method!(last_token_id(collection: CollectionId) -> TokenId, unique_api);450 pass_method!(451 collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>, unique_api;452 changed_in 3, collection_by_id_before_version_3(collection) => |value| {453 use codec::IoReader;454 use up_data_structs::RpcCollectionVersion1;455 use up_data_structs::CollectionVersion1;456 use sp_runtime::DispatchError;457458 if let Some(bytes) = value {459 let mut reader = IoReader(bytes.as_slice());460 Ok(Some(RpcCollection::<AccountId>::decode(&mut reader)461 .or_else(|_| RpcCollectionVersion1::<AccountId>::decode(&mut reader).map(|col| col.into()))462 .or_else(|_| CollectionVersion1::<AccountId>::decode(&mut reader).map(|col| col.into()))463 .map_err(|_| DispatchError::Other("API Error: UniqueApi_collection_by_id"))?))464 } else {465 Ok(None)466 }467 }468 );469 pass_method!(collection_stats() -> CollectionStats, unique_api);470 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);471 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);472 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);473 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);474 pass_method!(allowance_for_all(collection: CollectionId, owner: CrossAccountId, operator: CrossAccountId) -> bool, unique_api);475}476477impl<C, Block, BlockNumber, CrossAccountId, AccountId>478 app_promotion_unique_rpc::AppPromotionApiServer<479 <Block as BlockT>::Hash,480 BlockNumber,481 CrossAccountId,482 AccountId,483 > for AppPromotion<C, Block>484where485 Block: BlockT,486 BlockNumber: Decode + Member + AtLeast32BitUnsigned,487 AccountId: Decode,488 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,489 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,490 C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,491{492 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);493 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>494 |v| v495 .into_iter()496 .map(|(b, a)| (b, a.to_string()))497 .collect::<Vec<_>>(), app_promotion_api);498 pass_method!(pending_unstake(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);499 pass_method!(pending_unstake_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>500 |v| v501 .into_iter()502 .map(|(b, a)| (b, a.to_string()))503 .collect::<Vec<_>>(), app_promotion_api);504}505506fn string_keys_to_bytes_keys(keys: Option<Vec<String>>) -> Option<Vec<Vec<u8>>> {507 keys.map(|keys| keys.into_iter().map(|key| key.into_bytes()).collect())508}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original License18use std::sync::Arc;1920use codec::Decode;21use jsonrpsee::{22 core::{RpcResult as Result},23 proc_macros::rpc,24};25use anyhow::anyhow;26use sp_runtime::traits::{AtLeast32BitUnsigned, Member};27use up_data_structs::{28 RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId, Property,29 PropertyKeyPermission, TokenData, TokenChild,30};31use sp_api::{BlockT, ProvideRuntimeApi, ApiExt};32use sp_blockchain::HeaderBackend;33use up_rpc::UniqueApi as UniqueRuntimeApi;34use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;3536pub use app_promotion_unique_rpc::AppPromotionApiServer;3738#[cfg(feature = "pov-estimate")]39pub mod pov_estimate;4041#[rpc(server)]42#[async_trait]43pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {44 /// Get tokens owned by account.45 #[method(name = "unique_accountTokens")]46 fn account_tokens(47 &self,48 collection: CollectionId,49 account: CrossAccountId,50 at: Option<BlockHash>,51 ) -> Result<Vec<TokenId>>;5253 /// Get tokens contained within a collection.54 #[method(name = "unique_collectionTokens")]55 fn collection_tokens(56 &self,57 collection: CollectionId,58 at: Option<BlockHash>,59 ) -> Result<Vec<TokenId>>;6061 /// Check if the token exists.62 #[method(name = "unique_tokenExists")]63 fn token_exists(64 &self,65 collection: CollectionId,66 token: TokenId,67 at: Option<BlockHash>,68 ) -> Result<bool>;6970 /// Get the token owner.71 #[method(name = "unique_tokenOwner")]72 fn token_owner(73 &self,74 collection: CollectionId,75 token: TokenId,76 at: Option<BlockHash>,77 ) -> Result<Option<CrossAccountId>>;7879 /// Returns 10 tokens owners in no particular order.80 #[method(name = "unique_tokenOwners")]81 fn token_owners(82 &self,83 collection: CollectionId,84 token: TokenId,85 at: Option<BlockHash>,86 ) -> Result<Vec<CrossAccountId>>;8788 /// Get the topmost token owner in the hierarchy of a possibly nested token.89 #[method(name = "unique_topmostTokenOwner")]90 fn topmost_token_owner(91 &self,92 collection: CollectionId,93 token: TokenId,94 at: Option<BlockHash>,95 ) -> Result<Option<CrossAccountId>>;9697 /// Get tokens nested directly into the token.98 #[method(name = "unique_tokenChildren")]99 fn token_children(100 &self,101 collection: CollectionId,102 token: TokenId,103 at: Option<BlockHash>,104 ) -> Result<Vec<TokenChild>>;105106 /// Get collection properties, optionally limited to the provided keys.107 #[method(name = "unique_collectionProperties")]108 fn collection_properties(109 &self,110 collection: CollectionId,111 keys: Option<Vec<String>>,112 at: Option<BlockHash>,113 ) -> Result<Vec<Property>>;114115 /// Get token properties, optionally limited to the provided keys.116 #[method(name = "unique_tokenProperties")]117 fn token_properties(118 &self,119 collection: CollectionId,120 token_id: TokenId,121 keys: Option<Vec<String>>,122 at: Option<BlockHash>,123 ) -> Result<Vec<Property>>;124125 /// Get property permissions, optionally limited to the provided keys.126 #[method(name = "unique_propertyPermissions")]127 fn property_permissions(128 &self,129 collection: CollectionId,130 keys: Option<Vec<String>>,131 at: Option<BlockHash>,132 ) -> Result<Vec<PropertyKeyPermission>>;133134 /// Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT.135 #[method(name = "unique_tokenData")]136 fn token_data(137 &self,138 collection: CollectionId,139 token_id: TokenId,140 keys: Option<Vec<String>>,141 at: Option<BlockHash>,142 ) -> Result<TokenData<CrossAccountId>>;143144 /// Get the amount of distinctive tokens present in a collection.145 #[method(name = "unique_totalSupply")]146 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;147148 /// Get the amount of any user tokens owned by an account.149 #[method(name = "unique_accountBalance")]150 fn account_balance(151 &self,152 collection: CollectionId,153 account: CrossAccountId,154 at: Option<BlockHash>,155 ) -> Result<u32>;156157 /// Get the amount of a specific token owned by an account.158 #[method(name = "unique_balance")]159 fn balance(160 &self,161 collection: CollectionId,162 account: CrossAccountId,163 token: TokenId,164 at: Option<BlockHash>,165 ) -> Result<String>;166167 /// Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor.168 #[method(name = "unique_allowance")]169 fn allowance(170 &self,171 collection: CollectionId,172 sender: CrossAccountId,173 spender: CrossAccountId,174 token: TokenId,175 at: Option<BlockHash>,176 ) -> Result<String>;177178 /// Get the list of admin accounts of a collection.179 #[method(name = "unique_adminlist")]180 fn adminlist(181 &self,182 collection: CollectionId,183 at: Option<BlockHash>,184 ) -> Result<Vec<CrossAccountId>>;185186 /// Get the list of accounts allowed to operate within a collection.187 #[method(name = "unique_allowlist")]188 fn allowlist(189 &self,190 collection: CollectionId,191 at: Option<BlockHash>,192 ) -> Result<Vec<CrossAccountId>>;193194 /// Check if a user is allowed to operate within a collection.195 #[method(name = "unique_allowed")]196 fn allowed(197 &self,198 collection: CollectionId,199 user: CrossAccountId,200 at: Option<BlockHash>,201 ) -> Result<bool>;202203 /// Get the last token ID created in a collection.204 #[method(name = "unique_lastTokenId")]205 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;206207 /// Get collection info by the specified ID.208 #[method(name = "unique_collectionById")]209 fn collection_by_id(210 &self,211 collection: CollectionId,212 at: Option<BlockHash>,213 ) -> Result<Option<RpcCollection<AccountId>>>;214215 /// Get chain stats about collections.216 #[method(name = "unique_collectionStats")]217 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;218219 /// Get the number of blocks until sponsoring a transaction is available.220 #[method(name = "unique_nextSponsored")]221 fn next_sponsored(222 &self,223 collection: CollectionId,224 account: CrossAccountId,225 token: TokenId,226 at: Option<BlockHash>,227 ) -> Result<Option<u64>>;228229 /// Get effective collection limits. If not explicitly set, get the chain defaults.230 #[method(name = "unique_effectiveCollectionLimits")]231 fn effective_collection_limits(232 &self,233 collection_id: CollectionId,234 at: Option<BlockHash>,235 ) -> Result<Option<CollectionLimits>>;236237 /// Get the total amount of pieces of an RFT.238 #[method(name = "unique_totalPieces")]239 fn total_pieces(240 &self,241 collection_id: CollectionId,242 token_id: TokenId,243 at: Option<BlockHash>,244 ) -> Result<Option<String>>;245246 /// Get whether an operator is approved by a given owner.247 #[method(name = "unique_allowanceForAll")]248 fn allowance_for_all(249 &self,250 collection: CollectionId,251 owner: CrossAccountId,252 operator: CrossAccountId,253 at: Option<BlockHash>,254 ) -> Result<bool>;255}256257mod app_promotion_unique_rpc {258 use super::*;259260 #[rpc(server)]261 #[async_trait]262 pub trait AppPromotionApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {263 /// Returns the total amount of staked tokens.264 #[method(name = "appPromotion_totalStaked")]265 fn total_staked(266 &self,267 staker: Option<CrossAccountId>,268 at: Option<BlockHash>,269 ) -> Result<String>;270271 ///Returns the total amount of staked tokens per block when staked.272 #[method(name = "appPromotion_totalStakedPerBlock")]273 fn total_staked_per_block(274 &self,275 staker: CrossAccountId,276 at: Option<BlockHash>,277 ) -> Result<Vec<(BlockNumber, String)>>;278279 /// Returns the total amount of tokens pending withdrawal from staking.280 #[method(name = "appPromotion_pendingUnstake")]281 fn pending_unstake(282 &self,283 staker: Option<CrossAccountId>,284 at: Option<BlockHash>,285 ) -> Result<String>;286287 /// Returns the total amount of tokens pending withdrawal from staking per block.288 #[method(name = "appPromotion_pendingUnstakePerBlock")]289 fn pending_unstake_per_block(290 &self,291 staker: CrossAccountId,292 at: Option<BlockHash>,293 ) -> Result<Vec<(BlockNumber, String)>>;294 }295}296297#[macro_export]298macro_rules! define_struct_for_server_api {299 ($name:ident { $($arg:ident: $arg_ty:ty),+ $(,)? }) => {300 pub struct $name<Client, Block: BlockT> {301 $($arg: $arg_ty),+,302 _marker: std::marker::PhantomData<Block>,303 }304305 impl<Client, Block: BlockT> $name<Client, Block> {306 pub fn new($($arg: $arg_ty),+) -> Self {307 Self {308 $($arg),+,309 _marker: Default::default(),310 }311 }312 }313 };314}315316define_struct_for_server_api! {317 Unique {318 client: Arc<Client>319 }320}321322define_struct_for_server_api! {323 AppPromotion {324 client: Arc<Client>325 }326}327328macro_rules! pass_method {329 (330 $method_name:ident(331 $($(#[map(|$map_arg:ident| $map:expr)])? $name:ident: $ty:ty),* $(,)?332 ) -> $result:ty $(=> $mapper:expr)?,333 //$runtime_name:ident $(<$($lt: tt),+>)*334 $runtime_api_macro:ident335 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*336 ) => {337 fn $method_name(338 &self,339 $(340 $name: $ty,341 )*342 at: Option<<Block as BlockT>::Hash>,343 ) -> Result<$result> {344 let api = self.client.runtime_api();345 let at = at.unwrap_or_else(|| self.client.info().best_hash);346 let _api_version = if let Ok(Some(api_version)) =347 api.api_version::<$runtime_api_macro!()>(at)348 {349 api_version350 } else {351 // unreachable for our runtime352 return Err(anyhow!("api is not available").into())353 };354355 let result = $(if _api_version < $ver {356 api.$changed_method_name(at, $($changed_name),*).map(|r| r.and_then($fixer))357 } else)*358 { api.$method_name(at, $($((|$map_arg: $ty| $map))? ($name)),*) };359360 Ok(result361 .map_err(|e| anyhow!("unable to query: {e}"))?362 .map_err(|e| anyhow!("runtime error: {e:?}"))$(.map($mapper))??)363 }364 };365}366367macro_rules! unique_api {368 () => {369 dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>370 };371}372373macro_rules! app_promotion_api {374 () => {375 dyn AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>376 };377}378379#[allow(deprecated)]380impl<C, Block, CrossAccountId, AccountId>381 UniqueApiServer<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>382where383 Block: BlockT,384 AccountId: Decode,385 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,386 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,387 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,388{389 pass_method!(390 account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>, unique_api391 );392 pass_method!(393 collection_tokens(collection: CollectionId) -> Vec<TokenId>, unique_api394 );395 pass_method!(396 token_exists(collection: CollectionId, token: TokenId) -> bool, unique_api397 );398 pass_method!(399 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api400 );401 pass_method!(402 topmost_token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api403 );404 pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec<TokenChild>, unique_api);405 pass_method!(total_supply(collection: CollectionId) -> u32, unique_api);406 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32, unique_api);407 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string(), unique_api);408 pass_method!(409 allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string(),410 unique_api411 );412413 pass_method!(collection_properties(414 collection: CollectionId,415416 #[map(|keys| string_keys_to_bytes_keys(keys))]417 keys: Option<Vec<String>>418 ) -> Vec<Property>, unique_api);419420 pass_method!(token_properties(421 collection: CollectionId,422 token_id: TokenId,423424 #[map(|keys| string_keys_to_bytes_keys(keys))]425 keys: Option<Vec<String>>426 ) -> Vec<Property>, unique_api);427428 pass_method!(property_permissions(429 collection: CollectionId,430431 #[map(|keys| string_keys_to_bytes_keys(keys))]432 keys: Option<Vec<String>>433 ) -> Vec<PropertyKeyPermission>, unique_api);434435 pass_method!(436 token_data(437 collection: CollectionId,438 token_id: TokenId,439440 #[map(|keys| string_keys_to_bytes_keys(keys))]441 keys: Option<Vec<String>>,442 ) -> TokenData<CrossAccountId>, unique_api;443 changed_in 3, token_data_before_version_3(collection, token_id, string_keys_to_bytes_keys(keys)) => |value| Ok(value.into())444 );445446 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);447 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);448 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool, unique_api);449 pass_method!(last_token_id(collection: CollectionId) -> TokenId, unique_api);450 pass_method!(451 collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>, unique_api;452 changed_in 3, collection_by_id_before_version_3(collection) => |value| {453 use sp_runtime::DispatchError;454455 if let Some(bytes) = value {456 Ok(Some(detect_type_and_decode_collection(bytes.as_slice())457 .map_err(|_| DispatchError::Other("API Error: UniqueApi_collection_by_id"))?))458 } else {459 Ok(None)460 }461 }462 );463 pass_method!(collection_stats() -> CollectionStats, unique_api);464 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);465 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);466 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);467 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);468 pass_method!(allowance_for_all(collection: CollectionId, owner: CrossAccountId, operator: CrossAccountId) -> bool, unique_api);469}470471impl<C, Block, BlockNumber, CrossAccountId, AccountId>472 app_promotion_unique_rpc::AppPromotionApiServer<473 <Block as BlockT>::Hash,474 BlockNumber,475 CrossAccountId,476 AccountId,477 > for AppPromotion<C, Block>478where479 Block: BlockT,480 BlockNumber: Decode + Member + AtLeast32BitUnsigned,481 AccountId: Decode,482 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,483 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,484 C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,485{486 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);487 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>488 |v| v489 .into_iter()490 .map(|(b, a)| (b, a.to_string()))491 .collect::<Vec<_>>(), app_promotion_api);492 pass_method!(pending_unstake(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);493 pass_method!(pending_unstake_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>494 |v| v495 .into_iter()496 .map(|(b, a)| (b, a.to_string()))497 .collect::<Vec<_>>(), app_promotion_api);498}499500fn string_keys_to_bytes_keys(keys: Option<Vec<String>>) -> Option<Vec<Vec<u8>>> {501 keys.map(|keys| keys.into_iter().map(|key| key.into_bytes()).collect())502}503504fn decode_collection_from_bytes<T: codec::Decode>(505 bytes: &[u8],506) -> core::result::Result<T, codec::Error> {507 let mut reader = codec::IoReader(bytes);508 T::decode(&mut reader)509}510511fn detect_type_and_decode_collection<AccountId: Decode>(512 bytes: &[u8],513) -> core::result::Result<RpcCollection<AccountId>, codec::Error> {514 use up_data_structs::{CollectionVersion1, RpcCollectionVersion1};515516 decode_collection_from_bytes::<RpcCollection<AccountId>>(bytes)517 .or_else(|_| {518 decode_collection_from_bytes::<RpcCollectionVersion1<AccountId>>(bytes)519 .map(|col| col.into())520 })521 .or_else(|_| {522 decode_collection_from_bytes::<CollectionVersion1<AccountId>>(bytes)523 .map(|col| col.into())524 })525}526527#[cfg(test)]528mod tests {529 use super::*;530 use codec::IoReader;531 use hex_literal::hex;532 use up_data_structs::{CollectionVersion1, RawEncoded};533534 const ENCODED_COLLECTION_V1: [u8; 180] = hex!("aab94a1ee784bc17f68d76d4d48d736916ca6ff6315b8c1fa1175726c8345a390000285000720069006d00610020004c00690076006500d04500730065006d00700069006f00200064006900200063007200650061007a0069006f006e006500200064006900200075006e00610020006e0075006f0076006100200063006f006c006c0065007a0069006f006e00650020006400690020004e004600540021000c464e5400000000000000000000000000000000");535 const ENCODED_RPC_COLLECTION_V2: [u8; 618] = hex!("d00dcc24bf66750d3809aa26884b930ec8a3094d6f6f19fdc62020b2fbec013400604d0069006e007400460065007300740020002d002000460075006e006e007900200061006e0069006d0061006c0073008c430072006f00730073006f0076006500720020006200650074007700650065006e00200061006e0069006d0061006c00730020002d00200066006f0072002000660075006e00104d46464100000000000000000000010001000100000004385f6f6c645f636f6e7374446174610001000c5c5f6f6c645f636f6e73744f6e436861696e536368656d6139047b226e6573746564223a7b226f6e436861696e4d65746144617461223a7b226e6573746564223a7b224e46544d657461223a7b226669656c6473223a7b22697066734a736f6e223a7b226964223a312c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c2248656164223a7b226964223a322c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c22426f6479223a7b226964223a332c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c225461696c223a7b226964223a342c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d7d7d7d7d7d7d485f6f6c645f736368656d6156657273696f6e18556e69717565685f6f6c645f7661726961626c654f6e436861696e536368656d6111017b22636f6c6c656374696f6e436f766572223a22516d53557a7139354c357a556777795a584d3731576a3762786b36557048515468633162536965347766706e5435227d000000");536537 #[test]538 fn decoding_collection_v1() {539 decode_collection_from_bytes::<CollectionVersion1<[u8; 32]>>(540 ENCODED_COLLECTION_V1.as_slice(),541 )542 .unwrap();543 }544545 #[test]546 fn detecting_and_decoding_collection_v1() {547 detect_type_and_decode_collection::<[u8; 32]>(ENCODED_COLLECTION_V1.as_slice()).unwrap();548 }549550 #[test]551 fn decoding_rpc_collection_v2() {552 decode_collection_from_bytes::<RpcCollection<[u8; 32]>>(553 ENCODED_RPC_COLLECTION_V2.as_slice(),554 )555 .unwrap();556 }557558 #[test]559 fn detecting_decoding_rpc_collection_v2() {560 detect_type_and_decode_collection::<[u8; 32]>(ENCODED_RPC_COLLECTION_V2.as_slice())561 .unwrap();562 }563564 #[test]565 fn rpc_collection_supports_decoding_through_vec() {566 let mut bytes = IoReader(ENCODED_RPC_COLLECTION_V2.as_slice());567 let vec = RawEncoded::decode(&mut bytes).unwrap();568 println!("{:?}", vec.len());569 let mut bytes = IoReader(vec.as_slice());570 RpcCollection::<[u8; 32]>::decode(&mut bytes).unwrap();571 }572}primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -1437,243 +1437,3 @@
pub type CollectionProperties = Properties<MAX_COLLECTION_PROPERTIES_SIZE>;
pub type TokenProperties = Properties<MAX_TOKEN_PROPERTIES_SIZE>;
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use codec::IoReader;
-
- #[test]
- fn rpc_collection_supports_decoding_old_versions() {
- let encoded_rpc_collection: [u8; 1013] = [
- 0, 1, 250, 241, 137, 120, 188, 29, 94, 210, 193, 237, 186, 22, 203, 241, 52, 248, 167,
- 235, 241, 211, 236, 28, 138, 156, 59, 160, 156, 105, 39, 247, 207, 101, 0, 0, 48, 65,
- 0, 73, 0, 32, 0, 67, 0, 114, 0, 101, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 115, 0,
- 252, 65, 0, 32, 0, 112, 0, 105, 0, 101, 0, 99, 0, 101, 0, 32, 0, 111, 0, 102, 0, 32, 0,
- 97, 0, 32, 0, 109, 0, 97, 0, 99, 0, 104, 0, 105, 0, 110, 0, 101, 0, 32, 0, 109, 0, 105,
- 0, 110, 0, 100, 0, 46, 0, 32, 0, 69, 0, 118, 0, 101, 0, 114, 0, 121, 0, 32, 0, 78, 0,
- 70, 0, 84, 0, 32, 0, 105, 0, 115, 0, 32, 0, 109, 0, 97, 0, 100, 0, 101, 0, 32, 0, 101,
- 0, 120, 0, 99, 0, 108, 0, 117, 0, 115, 0, 105, 0, 118, 0, 101, 0, 108, 0, 121, 0, 32,
- 0, 98, 0, 121, 0, 32, 0, 65, 0, 73, 0, 46, 0, 12, 65, 73, 67, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 17, 1, 123, 34, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 67, 111,
- 118, 101, 114, 34, 58, 34, 81, 109, 98, 52, 104, 122, 76, 101, 51, 49, 102, 98, 71, 74,
- 77, 89, 68, 82, 88, 84, 115, 107, 56, 49, 76, 103, 76, 97, 88, 76, 69, 112, 121, 97,
- 122, 102, 66, 85, 103, 111, 110, 118, 49, 118, 84, 85, 34, 125, 125, 11, 123, 34, 110,
- 101, 115, 116, 101, 100, 34, 58, 123, 34, 111, 110, 67, 104, 97, 105, 110, 77, 101,
- 116, 97, 68, 97, 116, 97, 34, 58, 123, 34, 110, 101, 115, 116, 101, 100, 34, 58, 123,
- 34, 78, 70, 84, 77, 101, 116, 97, 34, 58, 123, 34, 102, 105, 101, 108, 100, 115, 34,
- 58, 123, 34, 105, 112, 102, 115, 74, 115, 111, 110, 34, 58, 123, 34, 105, 100, 34, 58,
- 49, 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34,
- 44, 34, 116, 121, 112, 101, 34, 58, 34, 115, 116, 114, 105, 110, 103, 34, 125, 44, 34,
- 67, 111, 108, 111, 114, 34, 58, 123, 34, 105, 100, 34, 58, 50, 44, 34, 114, 117, 108,
- 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44, 34, 116, 121, 112,
- 101, 34, 58, 34, 67, 111, 108, 111, 114, 34, 125, 44, 34, 73, 110, 116, 101, 110, 115,
- 105, 111, 110, 115, 34, 58, 123, 34, 105, 100, 34, 58, 51, 44, 34, 114, 117, 108, 101,
- 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44, 34, 116, 121, 112, 101, 34,
- 58, 34, 73, 110, 116, 101, 110, 115, 105, 111, 110, 115, 34, 125, 44, 34, 77, 111, 111,
- 100, 34, 58, 123, 34, 105, 100, 34, 58, 52, 44, 34, 114, 117, 108, 101, 34, 58, 34,
- 114, 101, 113, 117, 105, 114, 101, 100, 34, 44, 34, 116, 121, 112, 101, 34, 58, 34, 77,
- 111, 111, 100, 34, 125, 125, 125, 44, 34, 67, 111, 108, 111, 114, 34, 58, 123, 34, 111,
- 112, 116, 105, 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34,
- 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 67, 111, 108, 111, 114, 101, 100, 92, 34,
- 125, 34, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92,
- 34, 58, 92, 34, 66, 108, 97, 99, 107, 38, 87, 104, 105, 116, 101, 92, 34, 125, 34, 125,
- 44, 34, 118, 97, 108, 117, 101, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34,
- 58, 48, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 49, 125, 125, 44, 34, 73, 110,
- 116, 101, 110, 115, 105, 111, 110, 115, 34, 58, 123, 34, 111, 112, 116, 105, 111, 110,
- 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92, 34, 101, 110,
- 92, 34, 58, 92, 34, 101, 118, 105, 108, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108,
- 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 103, 111, 111, 100, 92,
- 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 34, 123, 92, 34, 101, 110,
- 92, 34, 58, 92, 34, 110, 101, 117, 116, 114, 97, 108, 92, 34, 125, 34, 125, 44, 34,
- 118, 97, 108, 117, 101, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 48,
- 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 49, 44, 34, 102, 105, 101, 108, 100, 51,
- 34, 58, 50, 125, 125, 44, 34, 77, 111, 111, 100, 34, 58, 123, 34, 111, 112, 116, 105,
- 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92, 34,
- 101, 110, 92, 34, 58, 92, 34, 65, 98, 115, 116, 114, 97, 99, 116, 92, 34, 125, 34, 44,
- 34, 102, 105, 101, 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34,
- 85, 110, 99, 97, 110, 110, 101, 121, 32, 118, 97, 108, 108, 101, 121, 92, 34, 125, 34,
- 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92,
- 34, 83, 117, 114, 114, 101, 97, 108, 105, 115, 116, 92, 34, 125, 34, 125, 44, 34, 118,
- 97, 108, 117, 101, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 48, 44,
- 34, 102, 105, 101, 108, 100, 50, 34, 58, 49, 44, 34, 102, 105, 101, 108, 100, 51, 34,
- 58, 50, 125, 125, 125, 125, 125, 125, 0,
- ];
- let mut bytes = IoReader(encoded_rpc_collection.as_slice());
- CollectionVersion1::<[u8; 34]>::decode(&mut bytes).unwrap();
- }
-
- #[test]
- fn rpc_collection_supports_decoding_new_versions() {
- let encoded_rpc_collection: [u8; 1576] = [
- 0, 1, 238, 236, 179, 149, 150, 47, 71, 194, 69, 174, 250, 116, 251, 148, 90, 15, 56,
- 220, 91, 79, 49, 79, 45, 197, 171, 98, 14, 171, 80, 23, 58, 92, 0, 96, 77, 0, 105, 0,
- 110, 0, 116, 0, 70, 0, 101, 0, 115, 0, 116, 0, 32, 0, 83, 0, 121, 0, 109, 0, 109, 0,
- 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 66, 0, 114, 0, 101, 0, 97, 0, 99, 0, 104, 0,
- 113, 3, 83, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 104, 0,
- 97, 0, 115, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101, 0, 116, 0, 104, 0, 105, 0, 110, 0,
- 103, 0, 32, 0, 105, 0, 110, 0, 116, 0, 111, 0, 120, 0, 105, 0, 99, 0, 97, 0, 116, 0,
- 105, 0, 110, 0, 103, 0, 32, 0, 116, 0, 104, 0, 97, 0, 116, 0, 32, 0, 100, 0, 114, 0,
- 97, 0, 119, 0, 115, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, 0, 105, 0, 110, 0, 46, 0, 10,
- 0, 73, 0, 110, 0, 115, 0, 112, 0, 105, 0, 114, 0, 101, 0, 100, 0, 32, 0, 98, 0, 121, 0,
- 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 112, 0, 101, 0, 114, 0, 102, 0, 101, 0, 99, 0,
- 116, 0, 105, 0, 111, 0, 110, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 104, 0, 101, 0,
- 32, 0, 115, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 44, 0, 32, 0,
- 73, 0, 32, 0, 104, 0, 97, 0, 118, 0, 101, 0, 32, 0, 99, 0, 114, 0, 101, 0, 97, 0, 116,
- 0, 101, 0, 100, 0, 32, 0, 115, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 105,
- 0, 99, 0, 97, 0, 108, 0, 32, 0, 105, 0, 109, 0, 97, 0, 103, 0, 101, 0, 115, 0, 32, 0,
- 111, 0, 102, 0, 32, 0, 115, 0, 101, 0, 118, 0, 101, 0, 114, 0, 97, 0, 108, 0, 32, 0,
- 118, 0, 101, 0, 114, 0, 116, 0, 105, 0, 99, 0, 101, 0, 115, 0, 44, 0, 32, 0, 98, 0,
- 117, 0, 116, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101, 0, 32, 0, 115, 0, 121, 0, 109, 0,
- 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 98, 0, 114, 0, 101, 0, 97, 0, 99, 0,
- 104, 0, 101, 0, 115, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 99, 0, 111, 0, 108, 0,
- 111, 0, 114, 0, 115, 0, 32, 0, 116, 0, 104, 0, 97, 0, 116, 0, 32, 0, 109, 0, 97, 0,
- 107, 0, 101, 0, 32, 0, 101, 0, 97, 0, 99, 0, 104, 0, 32, 0, 105, 0, 109, 0, 97, 0, 103,
- 0, 101, 0, 32, 0, 85, 0, 78, 0, 73, 0, 81, 0, 85, 0, 69, 0, 46, 0, 12, 83, 121, 66, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 4, 56, 95, 111, 108, 100, 95, 99,
- 111, 110, 115, 116, 68, 97, 116, 97, 0, 1, 0, 12, 92, 95, 111, 108, 100, 95, 99, 111,
- 110, 115, 116, 79, 110, 67, 104, 97, 105, 110, 83, 99, 104, 101, 109, 97, 97, 13, 123,
- 34, 110, 101, 115, 116, 101, 100, 34, 58, 123, 34, 111, 110, 67, 104, 97, 105, 110, 77,
- 101, 116, 97, 68, 97, 116, 97, 34, 58, 123, 34, 110, 101, 115, 116, 101, 100, 34, 58,
- 123, 34, 78, 70, 84, 77, 101, 116, 97, 34, 58, 123, 34, 102, 105, 101, 108, 100, 115,
- 34, 58, 123, 34, 105, 112, 102, 115, 74, 115, 111, 110, 34, 58, 123, 34, 105, 100, 34,
- 58, 49, 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100,
- 34, 44, 34, 116, 121, 112, 101, 34, 58, 34, 115, 116, 114, 105, 110, 103, 34, 125, 44,
- 34, 67, 111, 108, 111, 114, 34, 58, 123, 34, 105, 100, 34, 58, 50, 44, 34, 114, 117,
- 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44, 34, 116, 121,
- 112, 101, 34, 58, 34, 67, 111, 108, 111, 114, 34, 125, 44, 34, 83, 121, 109, 109, 101,
- 116, 114, 121, 32, 66, 114, 101, 97, 99, 104, 34, 58, 123, 34, 105, 100, 34, 58, 51,
- 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44,
- 34, 116, 121, 112, 101, 34, 58, 34, 83, 121, 109, 109, 101, 116, 114, 121, 32, 66, 114,
- 101, 97, 99, 104, 34, 125, 44, 34, 86, 101, 114, 116, 105, 99, 101, 34, 58, 123, 34,
- 105, 100, 34, 58, 52, 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105,
- 114, 101, 100, 34, 44, 34, 116, 121, 112, 101, 34, 58, 34, 86, 101, 114, 116, 105, 99,
- 101, 34, 125, 125, 125, 44, 34, 67, 111, 108, 111, 114, 34, 58, 123, 34, 111, 112, 116,
- 105, 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92,
- 34, 101, 110, 92, 34, 58, 92, 34, 49, 32, 32, 32, 92, 34, 125, 34, 44, 34, 102, 105,
- 101, 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 50, 32, 92,
- 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 34, 123, 92, 34, 101, 110,
- 92, 34, 58, 92, 34, 51, 92, 34, 125, 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34,
- 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100,
- 50, 34, 58, 49, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 50, 125, 125, 44, 34, 83,
- 121, 109, 109, 101, 116, 114, 121, 32, 66, 114, 101, 97, 99, 104, 34, 58, 123, 34, 111,
- 112, 116, 105, 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34,
- 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 49, 92, 34, 125, 34, 44, 34, 102, 105, 101,
- 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 50, 92, 34, 125,
- 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100,
- 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 49, 125, 125, 44, 34, 86,
- 101, 114, 116, 105, 99, 101, 34, 58, 123, 34, 111, 112, 116, 105, 111, 110, 115, 34,
- 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34,
- 58, 92, 34, 54, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 34, 123,
- 92, 34, 101, 110, 92, 34, 58, 92, 34, 55, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108,
- 100, 51, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 56, 92, 34, 125, 34,
- 44, 34, 102, 105, 101, 108, 100, 52, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92,
- 34, 57, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 53, 34, 58, 34, 123, 92, 34,
- 101, 110, 92, 34, 58, 92, 34, 49, 48, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100,
- 54, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 49, 49, 92, 34, 125, 34, 44,
- 34, 102, 105, 101, 108, 100, 55, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34,
- 49, 50, 92, 34, 125, 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34, 58, 123, 34,
- 102, 105, 101, 108, 100, 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58,
- 49, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 50, 44, 34, 102, 105, 101, 108, 100,
- 52, 34, 58, 51, 44, 34, 102, 105, 101, 108, 100, 53, 34, 58, 52, 44, 34, 102, 105, 101,
- 108, 100, 54, 34, 58, 53, 44, 34, 102, 105, 101, 108, 100, 55, 34, 58, 54, 125, 125,
- 125, 125, 125, 125, 72, 95, 111, 108, 100, 95, 115, 99, 104, 101, 109, 97, 86, 101,
- 114, 115, 105, 111, 110, 24, 85, 110, 105, 113, 117, 101, 104, 95, 111, 108, 100, 95,
- 118, 97, 114, 105, 97, 98, 108, 101, 79, 110, 67, 104, 97, 105, 110, 83, 99, 104, 101,
- 109, 97, 17, 1, 123, 34, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 67, 111, 118,
- 101, 114, 34, 58, 34, 81, 109, 82, 67, 77, 84, 109, 57, 118, 81, 107, 76, 89, 86, 65,
- 54, 54, 87, 80, 49, 75, 72, 57, 55, 106, 84, 76, 76, 115, 56, 74, 78, 86, 65, 114, 80,
- 66, 52, 56, 98, 106, 87, 84, 75, 74, 110, 34, 125, 0, 0, 0,
- ];
- let mut bytes = IoReader(encoded_rpc_collection.as_slice());
- RpcCollection::<[u8; 34]>::decode(&mut bytes).unwrap();
- }
-
- #[test]
- fn rpc_collection_supports_decoding_through_vec() {
- let encoded_rpc_collection: [u8; 1576] = [
- 0, 1, 238, 236, 179, 149, 150, 47, 71, 194, 69, 174, 250, 116, 251, 148, 90, 15, 56,
- 220, 91, 79, 49, 79, 45, 197, 171, 98, 14, 171, 80, 23, 58, 92, 0, 96, 77, 0, 105, 0,
- 110, 0, 116, 0, 70, 0, 101, 0, 115, 0, 116, 0, 32, 0, 83, 0, 121, 0, 109, 0, 109, 0,
- 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 66, 0, 114, 0, 101, 0, 97, 0, 99, 0, 104, 0,
- 113, 3, 83, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 104, 0,
- 97, 0, 115, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101, 0, 116, 0, 104, 0, 105, 0, 110, 0,
- 103, 0, 32, 0, 105, 0, 110, 0, 116, 0, 111, 0, 120, 0, 105, 0, 99, 0, 97, 0, 116, 0,
- 105, 0, 110, 0, 103, 0, 32, 0, 116, 0, 104, 0, 97, 0, 116, 0, 32, 0, 100, 0, 114, 0,
- 97, 0, 119, 0, 115, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, 0, 105, 0, 110, 0, 46, 0, 10,
- 0, 73, 0, 110, 0, 115, 0, 112, 0, 105, 0, 114, 0, 101, 0, 100, 0, 32, 0, 98, 0, 121, 0,
- 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 112, 0, 101, 0, 114, 0, 102, 0, 101, 0, 99, 0,
- 116, 0, 105, 0, 111, 0, 110, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 104, 0, 101, 0,
- 32, 0, 115, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 44, 0, 32, 0,
- 73, 0, 32, 0, 104, 0, 97, 0, 118, 0, 101, 0, 32, 0, 99, 0, 114, 0, 101, 0, 97, 0, 116,
- 0, 101, 0, 100, 0, 32, 0, 115, 0, 121, 0, 109, 0, 109, 0, 101, 0, 116, 0, 114, 0, 105,
- 0, 99, 0, 97, 0, 108, 0, 32, 0, 105, 0, 109, 0, 97, 0, 103, 0, 101, 0, 115, 0, 32, 0,
- 111, 0, 102, 0, 32, 0, 115, 0, 101, 0, 118, 0, 101, 0, 114, 0, 97, 0, 108, 0, 32, 0,
- 118, 0, 101, 0, 114, 0, 116, 0, 105, 0, 99, 0, 101, 0, 115, 0, 44, 0, 32, 0, 98, 0,
- 117, 0, 116, 0, 32, 0, 115, 0, 111, 0, 109, 0, 101, 0, 32, 0, 115, 0, 121, 0, 109, 0,
- 109, 0, 101, 0, 116, 0, 114, 0, 121, 0, 32, 0, 98, 0, 114, 0, 101, 0, 97, 0, 99, 0,
- 104, 0, 101, 0, 115, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 99, 0, 111, 0, 108, 0,
- 111, 0, 114, 0, 115, 0, 32, 0, 116, 0, 104, 0, 97, 0, 116, 0, 32, 0, 109, 0, 97, 0,
- 107, 0, 101, 0, 32, 0, 101, 0, 97, 0, 99, 0, 104, 0, 32, 0, 105, 0, 109, 0, 97, 0, 103,
- 0, 101, 0, 32, 0, 85, 0, 78, 0, 73, 0, 81, 0, 85, 0, 69, 0, 46, 0, 12, 83, 121, 66, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 4, 56, 95, 111, 108, 100, 95, 99,
- 111, 110, 115, 116, 68, 97, 116, 97, 0, 1, 0, 12, 92, 95, 111, 108, 100, 95, 99, 111,
- 110, 115, 116, 79, 110, 67, 104, 97, 105, 110, 83, 99, 104, 101, 109, 97, 97, 13, 123,
- 34, 110, 101, 115, 116, 101, 100, 34, 58, 123, 34, 111, 110, 67, 104, 97, 105, 110, 77,
- 101, 116, 97, 68, 97, 116, 97, 34, 58, 123, 34, 110, 101, 115, 116, 101, 100, 34, 58,
- 123, 34, 78, 70, 84, 77, 101, 116, 97, 34, 58, 123, 34, 102, 105, 101, 108, 100, 115,
- 34, 58, 123, 34, 105, 112, 102, 115, 74, 115, 111, 110, 34, 58, 123, 34, 105, 100, 34,
- 58, 49, 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100,
- 34, 44, 34, 116, 121, 112, 101, 34, 58, 34, 115, 116, 114, 105, 110, 103, 34, 125, 44,
- 34, 67, 111, 108, 111, 114, 34, 58, 123, 34, 105, 100, 34, 58, 50, 44, 34, 114, 117,
- 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44, 34, 116, 121,
- 112, 101, 34, 58, 34, 67, 111, 108, 111, 114, 34, 125, 44, 34, 83, 121, 109, 109, 101,
- 116, 114, 121, 32, 66, 114, 101, 97, 99, 104, 34, 58, 123, 34, 105, 100, 34, 58, 51,
- 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105, 114, 101, 100, 34, 44,
- 34, 116, 121, 112, 101, 34, 58, 34, 83, 121, 109, 109, 101, 116, 114, 121, 32, 66, 114,
- 101, 97, 99, 104, 34, 125, 44, 34, 86, 101, 114, 116, 105, 99, 101, 34, 58, 123, 34,
- 105, 100, 34, 58, 52, 44, 34, 114, 117, 108, 101, 34, 58, 34, 114, 101, 113, 117, 105,
- 114, 101, 100, 34, 44, 34, 116, 121, 112, 101, 34, 58, 34, 86, 101, 114, 116, 105, 99,
- 101, 34, 125, 125, 125, 44, 34, 67, 111, 108, 111, 114, 34, 58, 123, 34, 111, 112, 116,
- 105, 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92,
- 34, 101, 110, 92, 34, 58, 92, 34, 49, 32, 32, 32, 92, 34, 125, 34, 44, 34, 102, 105,
- 101, 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 50, 32, 92,
- 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 34, 123, 92, 34, 101, 110,
- 92, 34, 58, 92, 34, 51, 92, 34, 125, 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34,
- 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100,
- 50, 34, 58, 49, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 50, 125, 125, 44, 34, 83,
- 121, 109, 109, 101, 116, 114, 121, 32, 66, 114, 101, 97, 99, 104, 34, 58, 123, 34, 111,
- 112, 116, 105, 111, 110, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34,
- 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 49, 92, 34, 125, 34, 44, 34, 102, 105, 101,
- 108, 100, 50, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 50, 92, 34, 125,
- 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34, 58, 123, 34, 102, 105, 101, 108, 100,
- 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 49, 125, 125, 44, 34, 86,
- 101, 114, 116, 105, 99, 101, 34, 58, 123, 34, 111, 112, 116, 105, 111, 110, 115, 34,
- 58, 123, 34, 102, 105, 101, 108, 100, 49, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34,
- 58, 92, 34, 54, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58, 34, 123,
- 92, 34, 101, 110, 92, 34, 58, 92, 34, 55, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108,
- 100, 51, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 56, 92, 34, 125, 34,
- 44, 34, 102, 105, 101, 108, 100, 52, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92,
- 34, 57, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100, 53, 34, 58, 34, 123, 92, 34,
- 101, 110, 92, 34, 58, 92, 34, 49, 48, 92, 34, 125, 34, 44, 34, 102, 105, 101, 108, 100,
- 54, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34, 49, 49, 92, 34, 125, 34, 44,
- 34, 102, 105, 101, 108, 100, 55, 34, 58, 34, 123, 92, 34, 101, 110, 92, 34, 58, 92, 34,
- 49, 50, 92, 34, 125, 34, 125, 44, 34, 118, 97, 108, 117, 101, 115, 34, 58, 123, 34,
- 102, 105, 101, 108, 100, 49, 34, 58, 48, 44, 34, 102, 105, 101, 108, 100, 50, 34, 58,
- 49, 44, 34, 102, 105, 101, 108, 100, 51, 34, 58, 50, 44, 34, 102, 105, 101, 108, 100,
- 52, 34, 58, 51, 44, 34, 102, 105, 101, 108, 100, 53, 34, 58, 52, 44, 34, 102, 105, 101,
- 108, 100, 54, 34, 58, 53, 44, 34, 102, 105, 101, 108, 100, 55, 34, 58, 54, 125, 125,
- 125, 125, 125, 125, 72, 95, 111, 108, 100, 95, 115, 99, 104, 101, 109, 97, 86, 101,
- 114, 115, 105, 111, 110, 24, 85, 110, 105, 113, 117, 101, 104, 95, 111, 108, 100, 95,
- 118, 97, 114, 105, 97, 98, 108, 101, 79, 110, 67, 104, 97, 105, 110, 83, 99, 104, 101,
- 109, 97, 17, 1, 123, 34, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 67, 111, 118,
- 101, 114, 34, 58, 34, 81, 109, 82, 67, 77, 84, 109, 57, 118, 81, 107, 76, 89, 86, 65,
- 54, 54, 87, 80, 49, 75, 72, 57, 55, 106, 84, 76, 76, 115, 56, 74, 78, 86, 65, 114, 80,
- 66, 52, 56, 98, 106, 87, 84, 75, 74, 110, 34, 125, 0, 0, 0,
- ];
- let mut bytes = IoReader(encoded_rpc_collection.as_slice());
- let vec = RawEncoded::decode(&mut bytes).unwrap();
- let mut bytes = IoReader(vec.as_slice());
- RpcCollection::<[u8; 34]>::decode(&mut bytes).unwrap();
- }
-}