difftreelog
Merge commit '2074c933e3ff90b7ea5fc778111ead850fd4a5ea' into release-v922000
in: master
20 files changed
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -25,7 +25,7 @@
use anyhow::anyhow;
use up_data_structs::{
RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId, Property,
- PropertyKeyPermission, TokenData,
+ PropertyKeyPermission, TokenData, TokenChild,
};
use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};
use sp_blockchain::HeaderBackend;
@@ -77,6 +77,13 @@
token: TokenId,
at: Option<BlockHash>,
) -> Result<Option<CrossAccountId>>;
+ #[method(name = "unique_tokenChildren")]
+ fn token_children(
+ &self,
+ collection: CollectionId,
+ token: TokenId,
+ at: Option<BlockHash>,
+ ) -> Result<Vec<TokenChild>>;
#[method(name = "unique_collectionProperties")]
fn collection_properties(
@@ -394,6 +401,7 @@
pass_method!(
topmost_token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api
);
+ pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec<TokenChild>, unique_api);
pass_method!(total_supply(collection: CollectionId) -> u32, unique_api);
pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32, unique_api);
pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string(), unique_api);
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -40,6 +40,7 @@
MAX_TOKEN_PREFIX_LENGTH,
COLLECTION_ADMINS_LIMIT,
TokenId,
+ TokenChild,
CollectionStats,
MAX_TOKEN_OWNERSHIP,
CollectionMode,
@@ -502,6 +503,7 @@
CollectionStats,
CollectionId,
TokenId,
+ TokenChild,
PhantomType<(
TokenData<T::CrossAccountId>,
RpcCollection<T::AccountId>,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -22,7 +22,7 @@
use up_data_structs::{
AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
- PropertyKey, PropertyKeyPermission, Properties, PropertyScope, TrySetProperty,
+ PropertyKey, PropertyKeyPermission, Properties, PropertyScope, TrySetProperty, TokenChild,
};
use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
use pallet_common::{
@@ -604,7 +604,7 @@
// =========
- <PalletStructure<T>>::unnest_if_nested(from, collection.id, token);
+ <PalletStructure<T>>::unnest_if_nested(&token_data.owner, collection.id, token);
<TokenData<T>>::insert(
(collection.id, token),
@@ -988,6 +988,15 @@
.is_some()
}
+ pub fn token_children_ids(collection_id: CollectionId, token_id: TokenId) -> Vec<TokenChild> {
+ <TokenChildren<T>>::iter_prefix((collection_id, token_id))
+ .map(|((child_collection_id, child_id), _)| TokenChild {
+ collection: child_collection_id,
+ token: child_id,
+ })
+ .collect()
+ }
+
/// Delegated to `create_multiple_items`
pub fn create_item(
collection: &NonfungibleHandle<T>,
pallets/structure/src/lib.rsdiffbeforeafterboth--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -191,8 +191,8 @@
token_id: TokenId,
nesting_budget: &dyn Budget,
) -> DispatchResult {
- Self::try_exec_if_owner_is_valid_nft(under, |d, parent_id| {
- d.check_nesting(from, (collection_id, token_id), parent_id, nesting_budget)
+ Self::try_exec_if_owner_is_valid_nft(under, |collection, parent_id| {
+ collection.check_nesting(from, (collection_id, token_id), parent_id, nesting_budget)
})
}
@@ -203,10 +203,10 @@
token_id: TokenId,
nesting_budget: &dyn Budget,
) -> DispatchResult {
- Self::try_exec_if_owner_is_valid_nft(under, |d, parent_id| {
- d.check_nesting(from, (collection_id, token_id), parent_id, nesting_budget)?;
+ Self::try_exec_if_owner_is_valid_nft(under, |collection, parent_id| {
+ collection.check_nesting(from, (collection_id, token_id), parent_id, nesting_budget)?;
- d.nest(parent_id, (collection_id, token_id));
+ collection.nest(parent_id, (collection_id, token_id));
Ok(())
})
@@ -217,8 +217,8 @@
collection_id: CollectionId,
token_id: TokenId,
) {
- Self::exec_if_owner_is_valid_nft(owner, |d, parent_id| {
- d.nest(parent_id, (collection_id, token_id))
+ Self::exec_if_owner_is_valid_nft(owner, |collection, parent_id| {
+ collection.nest(parent_id, (collection_id, token_id))
});
}
@@ -227,8 +227,8 @@
collection_id: CollectionId,
token_id: TokenId,
) {
- Self::exec_if_owner_is_valid_nft(owner, |d, parent_id| {
- d.unnest(parent_id, (collection_id, token_id))
+ Self::exec_if_owner_is_valid_nft(owner, |collection, parent_id| {
+ collection.unnest(parent_id, (collection_id, token_id))
});
}
@@ -236,8 +236,8 @@
account: &T::CrossAccountId,
action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId),
) {
- Self::try_exec_if_owner_is_valid_nft(account, |d, id| {
- action(d, id);
+ Self::try_exec_if_owner_is_valid_nft(account, |collection, id| {
+ action(collection, id);
Ok(())
})
.unwrap();
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -585,6 +585,14 @@
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+// todo possibly rename to be used generally as an address pair
+pub struct TokenChild {
+ pub token: TokenId,
+ pub collection: CollectionId,
+}
+
+#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
+#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct CollectionStats {
pub created: u32,
pub destroyed: u32,
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -18,7 +18,7 @@
use up_data_structs::{
CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits, Property,
- PropertyKeyPermission, TokenData,
+ PropertyKeyPermission, TokenData, TokenChild,
};
use sp_std::vec::Vec;
use codec::Decode;
@@ -41,6 +41,7 @@
fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>>;
fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>>;
+ fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>>;
fn collection_properties(collection: CollectionId, properties: Option<Vec<Vec<u8>>>) -> Result<Vec<Property>>;
runtime/common/src/runtime_apis.rsdiffbeforeafterboth1#[macro_export]2macro_rules! impl_common_runtime_apis {3 (4 $(5 #![custom_apis]67 $($custom_apis:tt)+8 )?9 ) => {10 impl_runtime_apis! {11 $($($custom_apis)+)?1213 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15 dispatch_unique_runtime!(collection.account_tokens(account))16 }17 fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18 dispatch_unique_runtime!(collection.collection_tokens())19 }20 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21 dispatch_unique_runtime!(collection.token_exists(token))22 }2324 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25 dispatch_unique_runtime!(collection.token_owner(token))26 }27 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28 let budget = up_data_structs::budget::Value::new(10);2930 Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31 }3233 fn collection_properties(34 collection: CollectionId,35 keys: Option<Vec<Vec<u8>>>36 ) -> Result<Vec<Property>, DispatchError> {37 let keys = keys.map(38 |keys| Common::bytes_keys_to_property_keys(keys)39 ).transpose()?;4041 Common::filter_collection_properties(collection, keys)42 }4344 fn token_properties(45 collection: CollectionId,46 token_id: TokenId,47 keys: Option<Vec<Vec<u8>>>48 ) -> Result<Vec<Property>, DispatchError> {49 let keys = keys.map(50 |keys| Common::bytes_keys_to_property_keys(keys)51 ).transpose()?;5253 dispatch_unique_runtime!(collection.token_properties(token_id, keys))54 }5556 fn property_permissions(57 collection: CollectionId,58 keys: Option<Vec<Vec<u8>>>59 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {60 let keys = keys.map(61 |keys| Common::bytes_keys_to_property_keys(keys)62 ).transpose()?;6364 Common::filter_property_permissions(collection, keys)65 }6667 fn token_data(68 collection: CollectionId,69 token_id: TokenId,70 keys: Option<Vec<Vec<u8>>>71 ) -> Result<TokenData<CrossAccountId>, DispatchError> {72 let token_data = TokenData {73 properties: Self::token_properties(collection, token_id, keys)?,74 owner: Self::token_owner(collection, token_id)?75 };7677 Ok(token_data)78 }7980 fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {81 dispatch_unique_runtime!(collection.total_supply())82 }83 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {84 dispatch_unique_runtime!(collection.account_balance(account))85 }86 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {87 dispatch_unique_runtime!(collection.balance(account, token))88 }89 fn allowance(90 collection: CollectionId,91 sender: CrossAccountId,92 spender: CrossAccountId,93 token: TokenId,94 ) -> Result<u128, DispatchError> {95 dispatch_unique_runtime!(collection.allowance(sender, spender, token))96 }9798 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {99 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))100 }101 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {102 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))103 }104 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {105 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))106 }107 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {108 dispatch_unique_runtime!(collection.last_token_id())109 }110 fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {111 Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))112 }113 fn collection_stats() -> Result<CollectionStats, DispatchError> {114 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())115 }116 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {117 Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as118 $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(119 collection,120 account,121 token))122 }123124 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {125 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))126 }127 }128129 /*130 TODO free RMRK!131 impl rmrk_rpc::RmrkApi<132 Block,133 AccountId,134 RmrkCollectionInfo<AccountId>,135 RmrkInstanceInfo<AccountId>,136 RmrkResourceInfo,137 RmrkPropertyInfo,138 RmrkBaseInfo<AccountId>,139 RmrkPartType,140 RmrkTheme141 > for Runtime {142 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {143 Ok(RmrkCore::last_collection_idx())144 }145146 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {147 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};148149 let collection_id = CollectionId(collection_id);150 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {151 Ok(c) => c,152 Err(_) => return Ok(None),153 };154155 let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;156157 Ok(Some(RmrkCollectionInfo {158 issuer: collection.owner.clone(),159 metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),160 max: collection.limits.token_limit,161 symbol: collection.token_prefix.rebind(),162 nfts_count163 }))164 }165166 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {167 use up_data_structs::mapping::TokenAddressMapping;168 use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};169170 let collection_id = CollectionId(collection_id);171 let nft_id = TokenId(nft_by_id);172 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }173174 let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {175 Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {176 Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),177 None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())178 },179 None => return Ok(None)180 };181182 let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));183184 Ok(Some(RmrkInstanceInfo {185 owner: owner,186 royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),187 metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),188 equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),189 pending: allowance.is_some(),190 }))191 }192193 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {194 use pallet_proxy_rmrk_core::misc::CollectionType;195196 let cross_account_id = CrossAccountId::from_sub(account_id);197 let collection_id = CollectionId(collection_id);198 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }199200 Ok(201 dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?202 .into_iter()203 .map(|token| token.0)204 .collect()205 )206 }207208 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {209 let collection_id = CollectionId(collection_id);210 let nft_id = TokenId(nft_id);211 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }212213 Ok(214 pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))215 .filter_map(|(child_id, is_child)|216 match is_child {217 true => Some(RmrkNftChild {218 collection_id: child_id.0.0,219 nft_id: child_id.1.0,220 }),221 false => None,222 }223 ).collect()224 )225 }226227 fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {228 use pallet_proxy_rmrk_core::misc::CollectionType;229230 let collection_id = CollectionId(collection_id);231 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {232 return Ok(Vec::new());233 }234235 let properties = RmrkCore::filter_user_properties(236 collection_id,237 /* token_id = */ None,238 filter_keys,239 |key, value| RmrkPropertyInfo {240 key,241 value242 }243 )?;244245 Ok(properties)246 }247248 fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {249 use pallet_proxy_rmrk_core::misc::NftType;250251 let collection_id = CollectionId(collection_id);252 let token_id = TokenId(nft_id);253254 if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {255 return Ok(Vec::new());256 }257258 let properties = RmrkCore::filter_user_properties(259 collection_id,260 Some(token_id),261 filter_keys,262 |key, value| RmrkPropertyInfo {263 key,264 value265 }266 )?;267268 Ok(properties)269 }270271 fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {272 use frame_support::BoundedVec;273 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};274275 let collection_id = CollectionId(collection_id);276 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter277278 let nft_id = TokenId(nft_id);279 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }280281 let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)282 .unwrap()283 .decode_or_default();284 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }285286 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))287 .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {288 id: BoundedVec::default(), // todo ResourceId property289 pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),290 pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),291 resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {292 RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {293 src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),294 metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),295 license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),296 thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),297 },*///BasicResource<BoundedString>)298 _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),299 //RmrkResourceTypes::Slot(SlotResource<BoundedString>),300 },*/301 }))302 .collect();303304 Ok(resources)305 }306307 fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {308 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};309310 let collection_id = CollectionId(collection_id);311 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter312313 let nft_id = TokenId(nft_id);314 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }315316 /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)317 .unwrap()318 .decode_or_default();319 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }320321 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))322 .filter_map(|(resource_id, properties)| Some((323 resource_id, // ResourceId property324 RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),325 )))326 .collect()327 .sort_by_key(|(_, index)| *index)328 .into_iter().map(|(resource_id, _)| resource_id)*/329 let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();330331 Ok(priorities)332 }333334 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {335 use pallet_proxy_rmrk_core::{336 RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},337 };338339 let collection_id = CollectionId(base_id);340 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {341 Ok(c) => c,342 Err(_) => return Ok(None),343 };344345 Ok(Some(RmrkBaseInfo {346 issuer: collection.owner.clone(),347 base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),348 symbol: collection.token_prefix.rebind(),349 }))350 }351352 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {353 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};354355 let collection_id = CollectionId(base_id);356 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }357358 let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?359 .into_iter()360 .filter_map(|token_id| {361 let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;362363 match nft_type {364 NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {365 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),366 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),367 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),368 })),369 NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {370 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),371 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),372 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),373 equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),374 })),375 _ => None376 }377 })378 .collect();379380 Ok(parts)381 }382383 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {384 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};385386 let collection_id = CollectionId(base_id);387 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {388 return Ok(Vec::new());389 }390391 let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?392 .iter()393 .filter_map(|token_id| {394 let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();395396 match nft_type {397 Theme => Some(398 RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()399 ),400 _ => None401 }402 })403 .collect();404405 Ok(theme_names)406 }407408 fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {409 use pallet_proxy_rmrk_core::{410 RmrkProperty,411 misc::{CollectionType, NftType, RmrkDecode}412 };413414 let collection_id = CollectionId(base_id);415 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {416 return Ok(None);417 }418419 let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?420 .into_iter()421 .find_map(|token_id| {422 RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;423424 let name: RmrkString = RmrkCore::get_nft_property(425 collection_id, token_id, RmrkProperty::ThemeName426 ).ok()?.decode_or_default();427428 if name == theme_name {429 Some((name, token_id))430 } else {431 None432 }433 });434435 let (name, theme_id) = match theme_info {436 Some((name, theme_id)) => (name, theme_id),437 None => return Ok(None)438 };439440 let properties = RmrkCore::filter_user_properties(441 collection_id,442 Some(theme_id),443 filter_keys,444 |key, value| RmrkThemeProperty {445 key,446 value447 }448 )?;449450 let inherit = RmrkCore::get_nft_property(451 collection_id,452 theme_id,453 RmrkProperty::ThemeInherit454 )?.decode_or_default();455456 let theme = RmrkTheme {457 name,458 properties,459 inherit,460 };461462 Ok(Some(theme))463 }464 }*/465466 impl sp_api::Core<Block> for Runtime {467 fn version() -> RuntimeVersion {468 VERSION469 }470471 fn execute_block(block: Block) {472 Executive::execute_block(block)473 }474475 fn initialize_block(header: &<Block as BlockT>::Header) {476 Executive::initialize_block(header)477 }478 }479480 impl sp_api::Metadata<Block> for Runtime {481 fn metadata() -> OpaqueMetadata {482 OpaqueMetadata::new(Runtime::metadata().into())483 }484 }485486 impl sp_block_builder::BlockBuilder<Block> for Runtime {487 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {488 Executive::apply_extrinsic(extrinsic)489 }490491 fn finalize_block() -> <Block as BlockT>::Header {492 Executive::finalize_block()493 }494495 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {496 data.create_extrinsics()497 }498499 fn check_inherents(500 block: Block,501 data: sp_inherents::InherentData,502 ) -> sp_inherents::CheckInherentsResult {503 data.check_extrinsics(&block)504 }505506 // fn random_seed() -> <Block as BlockT>::Hash {507 // RandomnessCollectiveFlip::random_seed().0508 // }509 }510511 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {512 fn validate_transaction(513 source: TransactionSource,514 tx: <Block as BlockT>::Extrinsic,515 hash: <Block as BlockT>::Hash,516 ) -> TransactionValidity {517 Executive::validate_transaction(source, tx, hash)518 }519 }520521 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {522 fn offchain_worker(header: &<Block as BlockT>::Header) {523 Executive::offchain_worker(header)524 }525 }526527 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {528 fn chain_id() -> u64 {529 <Runtime as pallet_evm::Config>::ChainId::get()530 }531532 fn account_basic(address: H160) -> EVMAccount {533 let (account, _) = EVM::account_basic(&address);534 account535 }536537 fn gas_price() -> U256 {538 let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();539 price540 }541542 fn account_code_at(address: H160) -> Vec<u8> {543 EVM::account_codes(address)544 }545546 fn author() -> H160 {547 <pallet_evm::Pallet<Runtime>>::find_author()548 }549550 fn storage_at(address: H160, index: U256) -> H256 {551 let mut tmp = [0u8; 32];552 index.to_big_endian(&mut tmp);553 EVM::account_storages(address, H256::from_slice(&tmp[..]))554 }555556 #[allow(clippy::redundant_closure)]557 fn call(558 from: H160,559 to: H160,560 data: Vec<u8>,561 value: U256,562 gas_limit: U256,563 max_fee_per_gas: Option<U256>,564 max_priority_fee_per_gas: Option<U256>,565 nonce: Option<U256>,566 estimate: bool,567 access_list: Option<Vec<(H160, Vec<H256>)>>,568 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {569 let config = if estimate {570 let mut config = <Runtime as pallet_evm::Config>::config().clone();571 config.estimate = true;572 Some(config)573 } else {574 None575 };576577 let is_transactional = false;578 <Runtime as pallet_evm::Config>::Runner::call(579 CrossAccountId::from_eth(from),580 to,581 data,582 value,583 gas_limit.low_u64(),584 max_fee_per_gas,585 max_priority_fee_per_gas,586 nonce,587 access_list.unwrap_or_default(),588 is_transactional,589 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),590 ).map_err(|err| err.error.into())591 }592593 #[allow(clippy::redundant_closure)]594 fn create(595 from: H160,596 data: Vec<u8>,597 value: U256,598 gas_limit: U256,599 max_fee_per_gas: Option<U256>,600 max_priority_fee_per_gas: Option<U256>,601 nonce: Option<U256>,602 estimate: bool,603 access_list: Option<Vec<(H160, Vec<H256>)>>,604 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {605 let config = if estimate {606 let mut config = <Runtime as pallet_evm::Config>::config().clone();607 config.estimate = true;608 Some(config)609 } else {610 None611 };612613 let is_transactional = false;614 <Runtime as pallet_evm::Config>::Runner::create(615 CrossAccountId::from_eth(from),616 data,617 value,618 gas_limit.low_u64(),619 max_fee_per_gas,620 max_priority_fee_per_gas,621 nonce,622 access_list.unwrap_or_default(),623 is_transactional,624 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),625 ).map_err(|err| err.error.into())626 }627628 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {629 Ethereum::current_transaction_statuses()630 }631632 fn current_block() -> Option<pallet_ethereum::Block> {633 Ethereum::current_block()634 }635636 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {637 Ethereum::current_receipts()638 }639640 fn current_all() -> (641 Option<pallet_ethereum::Block>,642 Option<Vec<pallet_ethereum::Receipt>>,643 Option<Vec<TransactionStatus>>644 ) {645 (646 Ethereum::current_block(),647 Ethereum::current_receipts(),648 Ethereum::current_transaction_statuses()649 )650 }651652 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {653 xts.into_iter().filter_map(|xt| match xt.0.function {654 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),655 _ => None656 }).collect()657 }658659 fn elasticity() -> Option<Permill> {660 None661 }662 }663664 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {665 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {666 UncheckedExtrinsic::new_unsigned(667 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),668 )669 }670 }671672 impl sp_session::SessionKeys<Block> for Runtime {673 fn decode_session_keys(674 encoded: Vec<u8>,675 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {676 SessionKeys::decode_into_raw_public_keys(&encoded)677 }678679 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {680 SessionKeys::generate(seed)681 }682 }683684 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {685 fn slot_duration() -> sp_consensus_aura::SlotDuration {686 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())687 }688689 fn authorities() -> Vec<AuraId> {690 Aura::authorities().to_vec()691 }692 }693694 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {695 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {696 ParachainSystem::collect_collation_info(header)697 }698 }699700 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {701 fn account_nonce(account: AccountId) -> Index {702 System::account_nonce(account)703 }704 }705706 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {707 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {708 TransactionPayment::query_info(uxt, len)709 }710 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {711 TransactionPayment::query_fee_details(uxt, len)712 }713 }714715 /*716 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>717 for Runtime718 {719 fn call(720 origin: AccountId,721 dest: AccountId,722 value: Balance,723 gas_limit: u64,724 input_data: Vec<u8>,725 ) -> pallet_contracts_primitives::ContractExecResult {726 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)727 }728729 fn instantiate(730 origin: AccountId,731 endowment: Balance,732 gas_limit: u64,733 code: pallet_contracts_primitives::Code<Hash>,734 data: Vec<u8>,735 salt: Vec<u8>,736 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>737 {738 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)739 }740741 fn get_storage(742 address: AccountId,743 key: [u8; 32],744 ) -> pallet_contracts_primitives::GetStorageResult {745 Contracts::get_storage(address, key)746 }747748 fn rent_projection(749 address: AccountId,750 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {751 Contracts::rent_projection(address)752 }753 }754 */755756 #[cfg(feature = "runtime-benchmarks")]757 impl frame_benchmarking::Benchmark<Block> for Runtime {758 fn benchmark_metadata(extra: bool) -> (759 Vec<frame_benchmarking::BenchmarkList>,760 Vec<frame_support::traits::StorageInfo>,761 ) {762 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};763 use frame_support::traits::StorageInfoTrait;764765 let mut list = Vec::<BenchmarkList>::new();766767 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);768 list_benchmark!(list, extra, pallet_common, Common);769 list_benchmark!(list, extra, pallet_unique, Unique);770 list_benchmark!(list, extra, pallet_structure, Structure);771 list_benchmark!(list, extra, pallet_inflation, Inflation);772 list_benchmark!(list, extra, pallet_fungible, Fungible);773 list_benchmark!(list, extra, pallet_refungible, Refungible);774 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);775 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);776777 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();778779 return (list, storage_info)780 }781782 fn dispatch_benchmark(783 config: frame_benchmarking::BenchmarkConfig784 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {785 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};786787 let allowlist: Vec<TrackedStorageKey> = vec![788 // Total Issuance789 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),790791 // Block Number792 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),793 // Execution Phase794 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),795 // Event Count796 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),797 // System Events798 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),799800 // Evm CurrentLogs801 hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),802803 // Transactional depth804 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),805 ];806807 let mut batches = Vec::<BenchmarkBatch>::new();808 let params = (&config, &allowlist);809810 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);811 add_benchmark!(params, batches, pallet_common, Common);812 add_benchmark!(params, batches, pallet_unique, Unique);813 add_benchmark!(params, batches, pallet_structure, Structure);814 add_benchmark!(params, batches, pallet_inflation, Inflation);815 add_benchmark!(params, batches, pallet_fungible, Fungible);816 add_benchmark!(params, batches, pallet_refungible, Refungible);817 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);818 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);819820 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }821 Ok(batches)822 }823 }824825 #[cfg(feature = "try-runtime")]826 impl frame_try_runtime::TryRuntime<Block> for Runtime {827 fn on_runtime_upgrade() -> (Weight, Weight) {828 log::info!("try-runtime::on_runtime_upgrade unique-chain.");829 let weight = Executive::try_runtime_upgrade().unwrap();830 (weight, RuntimeBlockWeights::get().max_block)831 }832833 fn execute_block_no_check(block: Block) -> Weight {834 Executive::execute_block_no_check(block)835 }836 }837 }838 }839}1#[macro_export]2macro_rules! impl_common_runtime_apis {3 (4 $(5 #![custom_apis]67 $($custom_apis:tt)+8 )?9 ) => {10 impl_runtime_apis! {11 $($($custom_apis)+)?1213 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15 dispatch_unique_runtime!(collection.account_tokens(account))16 }17 fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18 dispatch_unique_runtime!(collection.collection_tokens())19 }20 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21 dispatch_unique_runtime!(collection.token_exists(token))22 }2324 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25 dispatch_unique_runtime!(collection.token_owner(token))26 }27 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28 let budget = up_data_structs::budget::Value::new(10);2930 Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31 }32 fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {33 Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))34 }35 fn collection_properties(36 collection: CollectionId,37 keys: Option<Vec<Vec<u8>>>38 ) -> Result<Vec<Property>, DispatchError> {39 let keys = keys.map(40 |keys| Common::bytes_keys_to_property_keys(keys)41 ).transpose()?;4243 Common::filter_collection_properties(collection, keys)44 }4546 fn token_properties(47 collection: CollectionId,48 token_id: TokenId,49 keys: Option<Vec<Vec<u8>>>50 ) -> Result<Vec<Property>, DispatchError> {51 let keys = keys.map(52 |keys| Common::bytes_keys_to_property_keys(keys)53 ).transpose()?;5455 dispatch_unique_runtime!(collection.token_properties(token_id, keys))56 }5758 fn property_permissions(59 collection: CollectionId,60 keys: Option<Vec<Vec<u8>>>61 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {62 let keys = keys.map(63 |keys| Common::bytes_keys_to_property_keys(keys)64 ).transpose()?;6566 Common::filter_property_permissions(collection, keys)67 }6869 fn token_data(70 collection: CollectionId,71 token_id: TokenId,72 keys: Option<Vec<Vec<u8>>>73 ) -> Result<TokenData<CrossAccountId>, DispatchError> {74 let token_data = TokenData {75 properties: Self::token_properties(collection, token_id, keys)?,76 owner: Self::token_owner(collection, token_id)?77 };7879 Ok(token_data)80 }8182 fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {83 dispatch_unique_runtime!(collection.total_supply())84 }85 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {86 dispatch_unique_runtime!(collection.account_balance(account))87 }88 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {89 dispatch_unique_runtime!(collection.balance(account, token))90 }91 fn allowance(92 collection: CollectionId,93 sender: CrossAccountId,94 spender: CrossAccountId,95 token: TokenId,96 ) -> Result<u128, DispatchError> {97 dispatch_unique_runtime!(collection.allowance(sender, spender, token))98 }99100 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {101 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))102 }103 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {104 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))105 }106 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {107 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))108 }109 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {110 dispatch_unique_runtime!(collection.last_token_id())111 }112 fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {113 Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))114 }115 fn collection_stats() -> Result<CollectionStats, DispatchError> {116 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())117 }118 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {119 Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as120 $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(121 collection,122 account,123 token))124 }125126 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {127 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))128 }129 }130131 /*132 TODO free RMRK!133 impl rmrk_rpc::RmrkApi<134 Block,135 AccountId,136 RmrkCollectionInfo<AccountId>,137 RmrkInstanceInfo<AccountId>,138 RmrkResourceInfo,139 RmrkPropertyInfo,140 RmrkBaseInfo<AccountId>,141 RmrkPartType,142 RmrkTheme143 > for Runtime {144 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145 Ok(RmrkCore::last_collection_idx())146 }147148 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {149 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};150151 let collection_id = CollectionId(collection_id);152 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {153 Ok(c) => c,154 Err(_) => return Ok(None),155 };156157 let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;158159 Ok(Some(RmrkCollectionInfo {160 issuer: collection.owner.clone(),161 metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),162 max: collection.limits.token_limit,163 symbol: collection.token_prefix.rebind(),164 nfts_count165 }))166 }167168 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {169 use up_data_structs::mapping::TokenAddressMapping;170 use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};171172 let collection_id = CollectionId(collection_id);173 let nft_id = TokenId(nft_by_id);174 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }175176 let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {177 Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {178 Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),179 None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())180 },181 None => return Ok(None)182 };183184 let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));185186 Ok(Some(RmrkInstanceInfo {187 owner: owner,188 royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),189 metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),190 equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),191 pending: allowance.is_some(),192 }))193 }194195 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {196 use pallet_proxy_rmrk_core::misc::CollectionType;197198 let cross_account_id = CrossAccountId::from_sub(account_id);199 let collection_id = CollectionId(collection_id);200 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }201202 Ok(203 dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?204 .into_iter()205 .map(|token| token.0)206 .collect()207 )208 }209210 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {211 let collection_id = CollectionId(collection_id);212 let nft_id = TokenId(nft_id);213 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }214215 Ok(216 pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))217 .filter_map(|(child_id, is_child)|218 match is_child {219 true => Some(RmrkNftChild {220 collection_id: child_id.0.0,221 nft_id: child_id.1.0,222 }),223 false => None,224 }225 ).collect()226 )227 }228229 fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {230 use pallet_proxy_rmrk_core::misc::CollectionType;231232 let collection_id = CollectionId(collection_id);233 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {234 return Ok(Vec::new());235 }236237 let properties = RmrkCore::filter_user_properties(238 collection_id,239 /* token_id = */ None,240 filter_keys,241 |key, value| RmrkPropertyInfo {242 key,243 value244 }245 )?;246247 Ok(properties)248 }249250 fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {251 use pallet_proxy_rmrk_core::misc::NftType;252253 let collection_id = CollectionId(collection_id);254 let token_id = TokenId(nft_id);255256 if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {257 return Ok(Vec::new());258 }259260 let properties = RmrkCore::filter_user_properties(261 collection_id,262 Some(token_id),263 filter_keys,264 |key, value| RmrkPropertyInfo {265 key,266 value267 }268 )?;269270 Ok(properties)271 }272273 fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {274 use frame_support::BoundedVec;275 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};276277 let collection_id = CollectionId(collection_id);278 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter279280 let nft_id = TokenId(nft_id);281 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }282283 let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)284 .unwrap()285 .decode_or_default();286 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }287288 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))289 .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {290 id: BoundedVec::default(), // todo ResourceId property291 pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),292 pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),293 resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {294 RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {295 src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),296 metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),297 license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),298 thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),299 },*///BasicResource<BoundedString>)300 _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),301 //RmrkResourceTypes::Slot(SlotResource<BoundedString>),302 },*/303 }))304 .collect();305306 Ok(resources)307 }308309 fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {310 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};311312 let collection_id = CollectionId(collection_id);313 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter314315 let nft_id = TokenId(nft_id);316 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }317318 /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)319 .unwrap()320 .decode_or_default();321 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }322323 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))324 .filter_map(|(resource_id, properties)| Some((325 resource_id, // ResourceId property326 RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),327 )))328 .collect()329 .sort_by_key(|(_, index)| *index)330 .into_iter().map(|(resource_id, _)| resource_id)*/331 let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();332333 Ok(priorities)334 }335336 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {337 use pallet_proxy_rmrk_core::{338 RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},339 };340341 let collection_id = CollectionId(base_id);342 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {343 Ok(c) => c,344 Err(_) => return Ok(None),345 };346347 Ok(Some(RmrkBaseInfo {348 issuer: collection.owner.clone(),349 base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),350 symbol: collection.token_prefix.rebind(),351 }))352 }353354 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {355 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};356357 let collection_id = CollectionId(base_id);358 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }359360 let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?361 .into_iter()362 .filter_map(|token_id| {363 let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;364365 match nft_type {366 NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {367 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),368 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),369 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),370 })),371 NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {372 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),373 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),374 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),375 equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),376 })),377 _ => None378 }379 })380 .collect();381382 Ok(parts)383 }384385 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {386 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};387388 let collection_id = CollectionId(base_id);389 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {390 return Ok(Vec::new());391 }392393 let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?394 .iter()395 .filter_map(|token_id| {396 let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();397398 match nft_type {399 Theme => Some(400 RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()401 ),402 _ => None403 }404 })405 .collect();406407 Ok(theme_names)408 }409410 fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {411 use pallet_proxy_rmrk_core::{412 RmrkProperty,413 misc::{CollectionType, NftType, RmrkDecode}414 };415416 let collection_id = CollectionId(base_id);417 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {418 return Ok(None);419 }420421 let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?422 .into_iter()423 .find_map(|token_id| {424 RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;425426 let name: RmrkString = RmrkCore::get_nft_property(427 collection_id, token_id, RmrkProperty::ThemeName428 ).ok()?.decode_or_default();429430 if name == theme_name {431 Some((name, token_id))432 } else {433 None434 }435 });436437 let (name, theme_id) = match theme_info {438 Some((name, theme_id)) => (name, theme_id),439 None => return Ok(None)440 };441442 let properties = RmrkCore::filter_user_properties(443 collection_id,444 Some(theme_id),445 filter_keys,446 |key, value| RmrkThemeProperty {447 key,448 value449 }450 )?;451452 let inherit = RmrkCore::get_nft_property(453 collection_id,454 theme_id,455 RmrkProperty::ThemeInherit456 )?.decode_or_default();457458 let theme = RmrkTheme {459 name,460 properties,461 inherit,462 };463464 Ok(Some(theme))465 }466 }*/467468 impl sp_api::Core<Block> for Runtime {469 fn version() -> RuntimeVersion {470 VERSION471 }472473 fn execute_block(block: Block) {474 Executive::execute_block(block)475 }476477 fn initialize_block(header: &<Block as BlockT>::Header) {478 Executive::initialize_block(header)479 }480 }481482 impl sp_api::Metadata<Block> for Runtime {483 fn metadata() -> OpaqueMetadata {484 OpaqueMetadata::new(Runtime::metadata().into())485 }486 }487488 impl sp_block_builder::BlockBuilder<Block> for Runtime {489 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {490 Executive::apply_extrinsic(extrinsic)491 }492493 fn finalize_block() -> <Block as BlockT>::Header {494 Executive::finalize_block()495 }496497 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {498 data.create_extrinsics()499 }500501 fn check_inherents(502 block: Block,503 data: sp_inherents::InherentData,504 ) -> sp_inherents::CheckInherentsResult {505 data.check_extrinsics(&block)506 }507508 // fn random_seed() -> <Block as BlockT>::Hash {509 // RandomnessCollectiveFlip::random_seed().0510 // }511 }512513 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {514 fn validate_transaction(515 source: TransactionSource,516 tx: <Block as BlockT>::Extrinsic,517 hash: <Block as BlockT>::Hash,518 ) -> TransactionValidity {519 Executive::validate_transaction(source, tx, hash)520 }521 }522523 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {524 fn offchain_worker(header: &<Block as BlockT>::Header) {525 Executive::offchain_worker(header)526 }527 }528529 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {530 fn chain_id() -> u64 {531 <Runtime as pallet_evm::Config>::ChainId::get()532 }533534 fn account_basic(address: H160) -> EVMAccount {535 let (account, _) = EVM::account_basic(&address);536 account537 }538539 fn gas_price() -> U256 {540 let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();541 price542 }543544 fn account_code_at(address: H160) -> Vec<u8> {545 EVM::account_codes(address)546 }547548 fn author() -> H160 {549 <pallet_evm::Pallet<Runtime>>::find_author()550 }551552 fn storage_at(address: H160, index: U256) -> H256 {553 let mut tmp = [0u8; 32];554 index.to_big_endian(&mut tmp);555 EVM::account_storages(address, H256::from_slice(&tmp[..]))556 }557558 #[allow(clippy::redundant_closure)]559 fn call(560 from: H160,561 to: H160,562 data: Vec<u8>,563 value: U256,564 gas_limit: U256,565 max_fee_per_gas: Option<U256>,566 max_priority_fee_per_gas: Option<U256>,567 nonce: Option<U256>,568 estimate: bool,569 access_list: Option<Vec<(H160, Vec<H256>)>>,570 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {571 let config = if estimate {572 let mut config = <Runtime as pallet_evm::Config>::config().clone();573 config.estimate = true;574 Some(config)575 } else {576 None577 };578579 let is_transactional = false;580 <Runtime as pallet_evm::Config>::Runner::call(581 CrossAccountId::from_eth(from),582 to,583 data,584 value,585 gas_limit.low_u64(),586 max_fee_per_gas,587 max_priority_fee_per_gas,588 nonce,589 access_list.unwrap_or_default(),590 is_transactional,591 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),592 ).map_err(|err| err.error.into())593 }594595 #[allow(clippy::redundant_closure)]596 fn create(597 from: H160,598 data: Vec<u8>,599 value: U256,600 gas_limit: U256,601 max_fee_per_gas: Option<U256>,602 max_priority_fee_per_gas: Option<U256>,603 nonce: Option<U256>,604 estimate: bool,605 access_list: Option<Vec<(H160, Vec<H256>)>>,606 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {607 let config = if estimate {608 let mut config = <Runtime as pallet_evm::Config>::config().clone();609 config.estimate = true;610 Some(config)611 } else {612 None613 };614615 let is_transactional = false;616 <Runtime as pallet_evm::Config>::Runner::create(617 CrossAccountId::from_eth(from),618 data,619 value,620 gas_limit.low_u64(),621 max_fee_per_gas,622 max_priority_fee_per_gas,623 nonce,624 access_list.unwrap_or_default(),625 is_transactional,626 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),627 ).map_err(|err| err.error.into())628 }629630 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {631 Ethereum::current_transaction_statuses()632 }633634 fn current_block() -> Option<pallet_ethereum::Block> {635 Ethereum::current_block()636 }637638 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {639 Ethereum::current_receipts()640 }641642 fn current_all() -> (643 Option<pallet_ethereum::Block>,644 Option<Vec<pallet_ethereum::Receipt>>,645 Option<Vec<TransactionStatus>>646 ) {647 (648 Ethereum::current_block(),649 Ethereum::current_receipts(),650 Ethereum::current_transaction_statuses()651 )652 }653654 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {655 xts.into_iter().filter_map(|xt| match xt.0.function {656 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),657 _ => None658 }).collect()659 }660661 fn elasticity() -> Option<Permill> {662 None663 }664 }665666 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {667 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {668 UncheckedExtrinsic::new_unsigned(669 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),670 )671 }672 }673674 impl sp_session::SessionKeys<Block> for Runtime {675 fn decode_session_keys(676 encoded: Vec<u8>,677 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {678 SessionKeys::decode_into_raw_public_keys(&encoded)679 }680681 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {682 SessionKeys::generate(seed)683 }684 }685686 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {687 fn slot_duration() -> sp_consensus_aura::SlotDuration {688 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())689 }690691 fn authorities() -> Vec<AuraId> {692 Aura::authorities().to_vec()693 }694 }695696 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {697 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {698 ParachainSystem::collect_collation_info(header)699 }700 }701702 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {703 fn account_nonce(account: AccountId) -> Index {704 System::account_nonce(account)705 }706 }707708 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {709 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {710 TransactionPayment::query_info(uxt, len)711 }712 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {713 TransactionPayment::query_fee_details(uxt, len)714 }715 }716717 /*718 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>719 for Runtime720 {721 fn call(722 origin: AccountId,723 dest: AccountId,724 value: Balance,725 gas_limit: u64,726 input_data: Vec<u8>,727 ) -> pallet_contracts_primitives::ContractExecResult {728 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)729 }730731 fn instantiate(732 origin: AccountId,733 endowment: Balance,734 gas_limit: u64,735 code: pallet_contracts_primitives::Code<Hash>,736 data: Vec<u8>,737 salt: Vec<u8>,738 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>739 {740 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)741 }742743 fn get_storage(744 address: AccountId,745 key: [u8; 32],746 ) -> pallet_contracts_primitives::GetStorageResult {747 Contracts::get_storage(address, key)748 }749750 fn rent_projection(751 address: AccountId,752 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {753 Contracts::rent_projection(address)754 }755 }756 */757758 #[cfg(feature = "runtime-benchmarks")]759 impl frame_benchmarking::Benchmark<Block> for Runtime {760 fn benchmark_metadata(extra: bool) -> (761 Vec<frame_benchmarking::BenchmarkList>,762 Vec<frame_support::traits::StorageInfo>,763 ) {764 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};765 use frame_support::traits::StorageInfoTrait;766767 let mut list = Vec::<BenchmarkList>::new();768769 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);770 list_benchmark!(list, extra, pallet_common, Common);771 list_benchmark!(list, extra, pallet_unique, Unique);772 list_benchmark!(list, extra, pallet_structure, Structure);773 list_benchmark!(list, extra, pallet_inflation, Inflation);774 list_benchmark!(list, extra, pallet_fungible, Fungible);775 list_benchmark!(list, extra, pallet_refungible, Refungible);776 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);777 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);778779 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();780781 return (list, storage_info)782 }783784 fn dispatch_benchmark(785 config: frame_benchmarking::BenchmarkConfig786 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {787 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};788789 let allowlist: Vec<TrackedStorageKey> = vec![790 // Total Issuance791 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),792793 // Block Number794 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),795 // Execution Phase796 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),797 // Event Count798 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),799 // System Events800 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),801802 // Evm CurrentLogs803 hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),804805 // Transactional depth806 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),807 ];808809 let mut batches = Vec::<BenchmarkBatch>::new();810 let params = (&config, &allowlist);811812 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);813 add_benchmark!(params, batches, pallet_common, Common);814 add_benchmark!(params, batches, pallet_unique, Unique);815 add_benchmark!(params, batches, pallet_structure, Structure);816 add_benchmark!(params, batches, pallet_inflation, Inflation);817 add_benchmark!(params, batches, pallet_fungible, Fungible);818 add_benchmark!(params, batches, pallet_refungible, Refungible);819 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);820 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);821822 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }823 Ok(batches)824 }825 }826827 #[cfg(feature = "try-runtime")]828 impl frame_try_runtime::TryRuntime<Block> for Runtime {829 fn on_runtime_upgrade() -> (Weight, Weight) {830 log::info!("try-runtime::on_runtime_upgrade unique-chain.");831 let weight = Executive::try_runtime_upgrade().unwrap();832 (weight, RuntimeBlockWeights::get().max_block)833 }834835 fn execute_block_no_check(block: Block) -> Weight {836 Executive::execute_block_no_check(block)837 }838 }839 }840 }841}runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -73,6 +73,7 @@
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
+ TokenChild,
};
// use pallet_contracts::weights::WeightInfo;
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -72,7 +72,8 @@
use up_data_structs::{
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
- mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping}
+ mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
+ TokenChild,
};
// use pallet_contracts::weights::WeightInfo;
runtime/tests/src/tests.rsdiffbeforeafterboth--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -21,7 +21,7 @@
CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,
MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,
PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,
- CollectionPropertiesPermissionsVec,
+ CollectionPropertiesPermissionsVec, TokenChild,
};
use frame_support::{assert_noop, assert_ok, assert_err};
use sp_std::convert::TryInto;
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -5,7 +5,7 @@
import type { BTreeMap, Bytes, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
-import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, EthereumBlock, EthereumLog, EthereumReceiptReceiptV3, EthereumTransactionTransactionV2, FpRpcTransactionStatus, FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmContractHelpersSponsoringModeT, PalletNonfungibleItemData, PalletRefungibleItemData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PhantomTypeUpDataStructs, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, UpDataStructsCollection, UpDataStructsCollectionStats, UpDataStructsProperties, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsPropertyPermission } from '@polkadot/types/lookup';
+import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, EthereumBlock, EthereumLog, EthereumReceiptReceiptV3, EthereumTransactionTransactionV2, FpRpcTransactionStatus, FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmContractHelpersSponsoringModeT, PalletNonfungibleItemData, PalletRefungibleItemData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PhantomTypeUpDataStructs, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, UpDataStructsCollection, UpDataStructsCollectionStats, UpDataStructsProperties, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsPropertyPermission, UpDataStructsTokenChild } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/storage' {
@@ -88,7 +88,7 @@
/**
* Not used by code, exists only to provide some types to metadata
**/
- dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;
+ dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, UpDataStructsTokenChild, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* List of collection admins
**/
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
-import type { PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCollectionLimits, UpDataStructsCollectionStats, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsRpcCollection, UpDataStructsTokenData } from './default';
+import type { PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCollectionLimits, UpDataStructsCollectionStats, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsRpcCollection, UpDataStructsTokenChild, UpDataStructsTokenData } from './default';
import type { AugmentedRpc } from '@polkadot/rpc-core/types';
import type { Metadata, StorageKey } from '@polkadot/types';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types-codec';
@@ -639,6 +639,10 @@
**/
propertyPermissions: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsPropertyKeyPermission>>>;
/**
+ * Get tokens nested directly into the token
+ **/
+ tokenChildren: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsTokenChild>>>;
+ /**
* Get token data
**/
tokenData: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<UpDataStructsTokenData>>;
tests/src/interfaces/augment-types.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-types.ts
+++ b/tests/src/interfaces/augment-types.ts
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
-import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsNestingRule, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsRmrkAccountIdOrCollectionNftTuple, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkBasicResource, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkComposableResource, UpDataStructsRmrkEquippableList, UpDataStructsRmrkFixedPart, UpDataStructsRmrkNftChild, UpDataStructsRmrkNftInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkResourceTypes, UpDataStructsRmrkRoyaltyInfo, UpDataStructsRmrkSlotPart, UpDataStructsRmrkSlotResource, UpDataStructsRmrkTheme, UpDataStructsRmrkThemeProperty, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './default';
+import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsNestingRule, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsRmrkAccountIdOrCollectionNftTuple, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkBasicResource, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkComposableResource, UpDataStructsRmrkEquippableList, UpDataStructsRmrkFixedPart, UpDataStructsRmrkNftChild, UpDataStructsRmrkNftInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkResourceTypes, UpDataStructsRmrkRoyaltyInfo, UpDataStructsRmrkSlotPart, UpDataStructsRmrkSlotResource, UpDataStructsRmrkTheme, UpDataStructsRmrkThemeProperty, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './default';
import type { Data, StorageKey } from '@polkadot/types';
import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
@@ -1210,6 +1210,7 @@
UpDataStructsRpcCollection: UpDataStructsRpcCollection;
UpDataStructsSponsoringRateLimit: UpDataStructsSponsoringRateLimit;
UpDataStructsSponsorshipState: UpDataStructsSponsorshipState;
+ UpDataStructsTokenChild: UpDataStructsTokenChild;
UpDataStructsTokenData: UpDataStructsTokenData;
UpgradeGoAhead: UpgradeGoAhead;
UpgradeRestriction: UpgradeRestriction;
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1588,7 +1588,7 @@
}
/** @name PhantomTypeUpDataStructs */
-export interface PhantomTypeUpDataStructs extends Vec<ITuple<[UpDataStructsTokenData, UpDataStructsRpcCollection, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkNftInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkTheme, UpDataStructsRmrkNftChild]>> {}
+export interface PhantomTypeUpDataStructs extends Vec<ITuple<[UpDataStructsTokenData, UpDataStructsRpcCollection, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkNftInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkTheme, UpDataStructsRmrkNftChild]>> {}
/** @name PolkadotCorePrimitivesInboundDownwardMessage */
export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct {
@@ -1861,7 +1861,6 @@
/** @name UpDataStructsCreateNftData */
export interface UpDataStructsCreateNftData extends Struct {
- readonly constData: Bytes;
readonly properties: Vec<UpDataStructsProperty>;
}
@@ -2101,6 +2100,12 @@
readonly type: 'Disabled' | 'Unconfirmed' | 'Confirmed';
}
+/** @name UpDataStructsTokenChild */
+export interface UpDataStructsTokenChild extends Struct {
+ readonly token: u32;
+ readonly collection: u32;
+}
+
/** @name UpDataStructsTokenData */
export interface UpDataStructsTokenData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1479,17 +1479,16 @@
* Lookup186: up_data_structs::CreateNftData
**/
UpDataStructsCreateNftData: {
- constData: 'Bytes',
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup188: up_data_structs::CreateFungibleData
+ * Lookup187: up_data_structs::CreateFungibleData
**/
UpDataStructsCreateFungibleData: {
value: 'u128'
},
/**
- * Lookup189: up_data_structs::CreateReFungibleData
+ * Lookup188: up_data_structs::CreateReFungibleData
**/
UpDataStructsCreateReFungibleData: {
constData: 'Bytes',
@@ -2282,18 +2281,25 @@
alive: 'u32'
},
/**
- * Lookup323: PhantomType::up_data_structs<T>
+ * Lookup323: up_data_structs::TokenChild
**/
- PhantomTypeUpDataStructs: '[(UpDataStructsTokenData,UpDataStructsRpcCollection,PalletEvmAccountBasicCrossAccountIdRepr,UpDataStructsRmrkCollectionInfo,UpDataStructsRmrkNftInfo,UpDataStructsRmrkResourceInfo,UpDataStructsRmrkPropertyInfo,UpDataStructsRmrkBaseInfo,UpDataStructsRmrkPartType,UpDataStructsRmrkTheme,UpDataStructsRmrkNftChild);0]',
+ UpDataStructsTokenChild: {
+ token: 'u32',
+ collection: 'u32'
+ },
+ /**
+ * Lookup324: PhantomType::up_data_structs<T>
+ **/
+ PhantomTypeUpDataStructs: '[(UpDataStructsTokenData,UpDataStructsRpcCollection,UpDataStructsRmrkCollectionInfo,UpDataStructsRmrkNftInfo,UpDataStructsRmrkResourceInfo,UpDataStructsRmrkPropertyInfo,UpDataStructsRmrkBaseInfo,UpDataStructsRmrkPartType,UpDataStructsRmrkTheme,UpDataStructsRmrkNftChild);0]',
/**
- * Lookup325: up_data_structs::TokenData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup326: up_data_structs::TokenData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsTokenData: {
properties: 'Vec<UpDataStructsProperty>',
owner: 'Option<PalletEvmAccountBasicCrossAccountIdRepr>'
},
/**
- * Lookup327: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>
+ * Lookup328: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>
**/
UpDataStructsRpcCollection: {
owner: 'AccountId32',
@@ -2308,7 +2314,7 @@
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup328: up_data_structs::rmrk::CollectionInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>, sp_core::crypto::AccountId32>
+ * Lookup329: up_data_structs::rmrk::CollectionInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>, sp_core::crypto::AccountId32>
**/
UpDataStructsRmrkCollectionInfo: {
issuer: 'AccountId32',
@@ -2318,7 +2324,7 @@
nftsCount: 'u32'
},
/**
- * Lookup331: up_data_structs::rmrk::NftInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup332: up_data_structs::rmrk::NftInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkNftInfo: {
owner: 'UpDataStructsRmrkAccountIdOrCollectionNftTuple',
@@ -2328,7 +2334,7 @@
pending: 'bool'
},
/**
- * Lookup332: up_data_structs::rmrk::AccountIdOrCollectionNftTuple<sp_core::crypto::AccountId32>
+ * Lookup333: up_data_structs::rmrk::AccountIdOrCollectionNftTuple<sp_core::crypto::AccountId32>
**/
UpDataStructsRmrkAccountIdOrCollectionNftTuple: {
_enum: {
@@ -2337,14 +2343,14 @@
}
},
/**
- * Lookup334: up_data_structs::rmrk::RoyaltyInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill>
+ * Lookup335: up_data_structs::rmrk::RoyaltyInfo<sp_core::crypto::AccountId32, sp_arithmetic::per_things::Permill>
**/
UpDataStructsRmrkRoyaltyInfo: {
recipient: 'AccountId32',
amount: 'Permill'
},
/**
- * Lookup335: up_data_structs::rmrk::ResourceInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup336: up_data_structs::rmrk::ResourceInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkResourceInfo: {
id: 'Bytes',
@@ -2353,7 +2359,7 @@
pendingRemoval: 'bool'
},
/**
- * Lookup338: up_data_structs::rmrk::ResourceTypes<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup339: up_data_structs::rmrk::ResourceTypes<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkResourceTypes: {
_enum: {
@@ -2363,7 +2369,7 @@
}
},
/**
- * Lookup339: up_data_structs::rmrk::BasicResource<frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup340: up_data_structs::rmrk::BasicResource<frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkBasicResource: {
src: 'Option<Bytes>',
@@ -2372,7 +2378,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup341: up_data_structs::rmrk::ComposableResource<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup342: up_data_structs::rmrk::ComposableResource<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkComposableResource: {
parts: 'Vec<u32>',
@@ -2383,7 +2389,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup342: up_data_structs::rmrk::SlotResource<frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup343: up_data_structs::rmrk::SlotResource<frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkSlotResource: {
base: 'u32',
@@ -2394,14 +2400,14 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup343: up_data_structs::rmrk::PropertyInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup344: up_data_structs::rmrk::PropertyInfo<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkPropertyInfo: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup346: up_data_structs::rmrk::BaseInfo<sp_core::crypto::AccountId32, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup347: up_data_structs::rmrk::BaseInfo<sp_core::crypto::AccountId32, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkBaseInfo: {
issuer: 'AccountId32',
@@ -2409,7 +2415,7 @@
symbol: 'Bytes'
},
/**
- * Lookup347: up_data_structs::rmrk::PartType<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup348: up_data_structs::rmrk::PartType<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkPartType: {
_enum: {
@@ -2418,7 +2424,7 @@
}
},
/**
- * Lookup349: up_data_structs::rmrk::FixedPart<frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup350: up_data_structs::rmrk::FixedPart<frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkFixedPart: {
id: 'u32',
@@ -2426,7 +2432,7 @@
src: 'Bytes'
},
/**
- * Lookup350: up_data_structs::rmrk::SlotPart<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup351: up_data_structs::rmrk::SlotPart<frame_support::storage::bounded_vec::BoundedVec<T, S>, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkSlotPart: {
id: 'u32',
@@ -2435,7 +2441,7 @@
z: 'u32'
},
/**
- * Lookup351: up_data_structs::rmrk::EquippableList<frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup352: up_data_structs::rmrk::EquippableList<frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkEquippableList: {
_enum: {
@@ -2445,7 +2451,7 @@
}
},
/**
- * Lookup352: up_data_structs::rmrk::Theme<frame_support::storage::bounded_vec::BoundedVec<T, S>, PropertyList>
+ * Lookup353: up_data_structs::rmrk::Theme<frame_support::storage::bounded_vec::BoundedVec<T, S>, PropertyList>
**/
UpDataStructsRmrkTheme: {
name: 'Bytes',
@@ -2453,69 +2459,69 @@
inherit: 'bool'
},
/**
- * Lookup354: up_data_structs::rmrk::ThemeProperty<frame_support::storage::bounded_vec::BoundedVec<T, S>>
+ * Lookup355: up_data_structs::rmrk::ThemeProperty<frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
UpDataStructsRmrkThemeProperty: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup355: up_data_structs::rmrk::NftChild
+ * Lookup356: up_data_structs::rmrk::NftChild
**/
UpDataStructsRmrkNftChild: {
collectionId: 'u32',
nftId: 'u32'
},
/**
- * Lookup357: pallet_common::pallet::Error<T>
+ * Lookup358: pallet_common::pallet::Error<T>
**/
PalletCommonError: {
_enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'NestingIsDisabled', 'OnlyOwnerAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey']
},
/**
- * Lookup359: pallet_fungible::pallet::Error<T>
+ * Lookup360: pallet_fungible::pallet::Error<T>
**/
PalletFungibleError: {
_enum: ['NotFungibleDataUsedToMintFungibleCollectionToken', 'FungibleItemsHaveNoId', 'FungibleItemsDontHaveData', 'FungibleDisallowsNesting', 'SettingPropertiesNotAllowed']
},
/**
- * Lookup360: pallet_refungible::ItemData
+ * Lookup361: pallet_refungible::ItemData
**/
PalletRefungibleItemData: {
constData: 'Bytes'
},
/**
- * Lookup364: pallet_refungible::pallet::Error<T>
+ * Lookup365: pallet_refungible::pallet::Error<T>
**/
PalletRefungibleError: {
_enum: ['NotRefungibleDataUsedToMintFungibleCollectionToken', 'WrongRefungiblePieces', 'RefungibleDisallowsNesting', 'SettingPropertiesNotAllowed']
},
/**
- * Lookup365: pallet_nonfungible::ItemData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup366: pallet_nonfungible::ItemData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
PalletNonfungibleItemData: {
owner: 'PalletEvmAccountBasicCrossAccountIdRepr'
},
/**
- * Lookup367: pallet_nonfungible::pallet::Error<T>
+ * Lookup368: pallet_nonfungible::pallet::Error<T>
**/
PalletNonfungibleError: {
_enum: ['NotNonfungibleDataUsedToMintFungibleCollectionToken', 'NonfungibleItemsHaveNoAmount', 'CantBurnNftWithChildren']
},
/**
- * Lookup368: pallet_structure::pallet::Error<T>
+ * Lookup369: pallet_structure::pallet::Error<T>
**/
PalletStructureError: {
_enum: ['OuroborosDetected', 'DepthLimit', 'TokenNotFound']
},
/**
- * Lookup371: pallet_evm::pallet::Error<T>
+ * Lookup372: pallet_evm::pallet::Error<T>
**/
PalletEvmError: {
_enum: ['BalanceLow', 'FeeOverflow', 'PaymentOverflow', 'WithdrawFailed', 'GasPriceTooLow', 'InvalidNonce']
},
/**
- * Lookup374: fp_rpc::TransactionStatus
+ * Lookup375: fp_rpc::TransactionStatus
**/
FpRpcTransactionStatus: {
transactionHash: 'H256',
@@ -2527,11 +2533,11 @@
logsBloom: 'EthbloomBloom'
},
/**
- * Lookup376: ethbloom::Bloom
+ * Lookup377: ethbloom::Bloom
**/
EthbloomBloom: '[u8;256]',
/**
- * Lookup378: ethereum::receipt::ReceiptV3
+ * Lookup379: ethereum::receipt::ReceiptV3
**/
EthereumReceiptReceiptV3: {
_enum: {
@@ -2541,7 +2547,7 @@
}
},
/**
- * Lookup379: ethereum::receipt::EIP658ReceiptData
+ * Lookup380: ethereum::receipt::EIP658ReceiptData
**/
EthereumReceiptEip658ReceiptData: {
statusCode: 'u8',
@@ -2550,7 +2556,7 @@
logs: 'Vec<EthereumLog>'
},
/**
- * Lookup380: ethereum::block::Block<ethereum::transaction::TransactionV2>
+ * Lookup381: ethereum::block::Block<ethereum::transaction::TransactionV2>
**/
EthereumBlock: {
header: 'EthereumHeader',
@@ -2558,7 +2564,7 @@
ommers: 'Vec<EthereumHeader>'
},
/**
- * Lookup381: ethereum::header::Header
+ * Lookup382: ethereum::header::Header
**/
EthereumHeader: {
parentHash: 'H256',
@@ -2578,41 +2584,41 @@
nonce: 'EthereumTypesHashH64'
},
/**
- * Lookup382: ethereum_types::hash::H64
+ * Lookup383: ethereum_types::hash::H64
**/
EthereumTypesHashH64: '[u8;8]',
/**
- * Lookup387: pallet_ethereum::pallet::Error<T>
+ * Lookup388: pallet_ethereum::pallet::Error<T>
**/
PalletEthereumError: {
_enum: ['InvalidSignature', 'PreLogExists']
},
/**
- * Lookup388: pallet_evm_coder_substrate::pallet::Error<T>
+ * Lookup389: pallet_evm_coder_substrate::pallet::Error<T>
**/
PalletEvmCoderSubstrateError: {
_enum: ['OutOfGas', 'OutOfFund']
},
/**
- * Lookup389: pallet_evm_contract_helpers::SponsoringModeT
+ * Lookup390: pallet_evm_contract_helpers::SponsoringModeT
**/
PalletEvmContractHelpersSponsoringModeT: {
_enum: ['Disabled', 'Allowlisted', 'Generous']
},
/**
- * Lookup391: pallet_evm_contract_helpers::pallet::Error<T>
+ * Lookup392: pallet_evm_contract_helpers::pallet::Error<T>
**/
PalletEvmContractHelpersError: {
_enum: ['NoPermission']
},
/**
- * Lookup392: pallet_evm_migration::pallet::Error<T>
+ * Lookup393: pallet_evm_migration::pallet::Error<T>
**/
PalletEvmMigrationError: {
_enum: ['AccountNotEmpty', 'AccountIsNotMigrating']
},
/**
- * Lookup394: sp_runtime::MultiSignature
+ * Lookup395: sp_runtime::MultiSignature
**/
SpRuntimeMultiSignature: {
_enum: {
@@ -2622,43 +2628,43 @@
}
},
/**
- * Lookup395: sp_core::ed25519::Signature
+ * Lookup396: sp_core::ed25519::Signature
**/
SpCoreEd25519Signature: '[u8;64]',
/**
- * Lookup397: sp_core::sr25519::Signature
+ * Lookup398: sp_core::sr25519::Signature
**/
SpCoreSr25519Signature: '[u8;64]',
/**
- * Lookup398: sp_core::ecdsa::Signature
+ * Lookup399: sp_core::ecdsa::Signature
**/
SpCoreEcdsaSignature: '[u8;65]',
/**
- * Lookup401: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
+ * Lookup402: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
**/
FrameSystemExtensionsCheckSpecVersion: 'Null',
/**
- * Lookup402: frame_system::extensions::check_genesis::CheckGenesis<T>
+ * Lookup403: frame_system::extensions::check_genesis::CheckGenesis<T>
**/
FrameSystemExtensionsCheckGenesis: 'Null',
/**
- * Lookup405: frame_system::extensions::check_nonce::CheckNonce<T>
+ * Lookup406: frame_system::extensions::check_nonce::CheckNonce<T>
**/
FrameSystemExtensionsCheckNonce: 'Compact<u32>',
/**
- * Lookup406: frame_system::extensions::check_weight::CheckWeight<T>
+ * Lookup407: frame_system::extensions::check_weight::CheckWeight<T>
**/
FrameSystemExtensionsCheckWeight: 'Null',
/**
- * Lookup407: pallet_template_transaction_payment::ChargeTransactionPayment<opal_runtime::Runtime>
+ * Lookup408: pallet_template_transaction_payment::ChargeTransactionPayment<opal_runtime::Runtime>
**/
PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
/**
- * Lookup408: opal_runtime::Runtime
+ * Lookup409: opal_runtime::Runtime
**/
OpalRuntimeRuntime: 'Null',
/**
- * Lookup409: pallet_ethereum::FakeTransactionFinalizer<opal_runtime::Runtime>
+ * Lookup410: pallet_ethereum::FakeTransactionFinalizer<opal_runtime::Runtime>
**/
PalletEthereumFakeTransactionFinalizer: 'Null'
};
tests/src/interfaces/registry.tsdiffbeforeafterboth--- a/tests/src/interfaces/registry.ts
+++ b/tests/src/interfaces/registry.ts
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
-import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsNestingRule, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsRmrkAccountIdOrCollectionNftTuple, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkBasicResource, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkComposableResource, UpDataStructsRmrkEquippableList, UpDataStructsRmrkFixedPart, UpDataStructsRmrkNftChild, UpDataStructsRmrkNftInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkResourceTypes, UpDataStructsRmrkRoyaltyInfo, UpDataStructsRmrkSlotPart, UpDataStructsRmrkSlotResource, UpDataStructsRmrkTheme, UpDataStructsRmrkThemeProperty, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
+import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumFakeTransactionFinalizer, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletStructureCall, PalletStructureError, PalletStructureEvent, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PhantomTypeUpDataStructs, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2AbridgedHrmpChannel, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsNestingRule, UpDataStructsProperties, UpDataStructsPropertiesMapBoundedVec, UpDataStructsPropertiesMapPropertyPermission, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, UpDataStructsPropertyPermission, UpDataStructsRmrkAccountIdOrCollectionNftTuple, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkBasicResource, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkComposableResource, UpDataStructsRmrkEquippableList, UpDataStructsRmrkFixedPart, UpDataStructsRmrkNftChild, UpDataStructsRmrkNftInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkResourceTypes, UpDataStructsRmrkRoyaltyInfo, UpDataStructsRmrkSlotPart, UpDataStructsRmrkSlotResource, UpDataStructsRmrkTheme, UpDataStructsRmrkThemeProperty, UpDataStructsRpcCollection, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, UpDataStructsTokenChild, UpDataStructsTokenData, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
declare module '@polkadot/types/types/registry' {
export interface InterfaceTypes {
@@ -188,6 +188,7 @@
UpDataStructsRpcCollection: UpDataStructsRpcCollection;
UpDataStructsSponsoringRateLimit: UpDataStructsSponsoringRateLimit;
UpDataStructsSponsorshipState: UpDataStructsSponsorshipState;
+ UpDataStructsTokenChild: UpDataStructsTokenChild;
UpDataStructsTokenData: UpDataStructsTokenData;
XcmDoubleEncoded: XcmDoubleEncoded;
XcmV0Junction: XcmV0Junction;
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -1604,16 +1604,15 @@
/** @name UpDataStructsCreateNftData (186) */
export interface UpDataStructsCreateNftData extends Struct {
- readonly constData: Bytes;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateFungibleData (188) */
+ /** @name UpDataStructsCreateFungibleData (187) */
export interface UpDataStructsCreateFungibleData extends Struct {
readonly value: u128;
}
- /** @name UpDataStructsCreateReFungibleData (189) */
+ /** @name UpDataStructsCreateReFungibleData (188) */
export interface UpDataStructsCreateReFungibleData extends Struct {
readonly constData: Bytes;
readonly pieces: u128;
@@ -2469,16 +2468,22 @@
readonly alive: u32;
}
- /** @name PhantomTypeUpDataStructs (323) */
- export interface PhantomTypeUpDataStructs extends Vec<ITuple<[UpDataStructsTokenData, UpDataStructsRpcCollection, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkNftInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkTheme, UpDataStructsRmrkNftChild]>> {}
+ /** @name UpDataStructsTokenChild (323) */
+ export interface UpDataStructsTokenChild extends Struct {
+ readonly token: u32;
+ readonly collection: u32;
+ }
+
+ /** @name PhantomTypeUpDataStructs (324) */
+ export interface PhantomTypeUpDataStructs extends Vec<ITuple<[UpDataStructsTokenData, UpDataStructsRpcCollection, UpDataStructsRmrkCollectionInfo, UpDataStructsRmrkNftInfo, UpDataStructsRmrkResourceInfo, UpDataStructsRmrkPropertyInfo, UpDataStructsRmrkBaseInfo, UpDataStructsRmrkPartType, UpDataStructsRmrkTheme, UpDataStructsRmrkNftChild]>> {}
- /** @name UpDataStructsTokenData (325) */
+ /** @name UpDataStructsTokenData (326) */
export interface UpDataStructsTokenData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: Option<PalletEvmAccountBasicCrossAccountIdRepr>;
}
- /** @name UpDataStructsRpcCollection (327) */
+ /** @name UpDataStructsRpcCollection (328) */
export interface UpDataStructsRpcCollection extends Struct {
readonly owner: AccountId32;
readonly mode: UpDataStructsCollectionMode;
@@ -2492,7 +2497,7 @@
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsRmrkCollectionInfo (328) */
+ /** @name UpDataStructsRmrkCollectionInfo (329) */
export interface UpDataStructsRmrkCollectionInfo extends Struct {
readonly issuer: AccountId32;
readonly metadata: Bytes;
@@ -2501,7 +2506,7 @@
readonly nftsCount: u32;
}
- /** @name UpDataStructsRmrkNftInfo (331) */
+ /** @name UpDataStructsRmrkNftInfo (332) */
export interface UpDataStructsRmrkNftInfo extends Struct {
readonly owner: UpDataStructsRmrkAccountIdOrCollectionNftTuple;
readonly royalty: Option<UpDataStructsRmrkRoyaltyInfo>;
@@ -2510,7 +2515,7 @@
readonly pending: bool;
}
- /** @name UpDataStructsRmrkAccountIdOrCollectionNftTuple (332) */
+ /** @name UpDataStructsRmrkAccountIdOrCollectionNftTuple (333) */
export interface UpDataStructsRmrkAccountIdOrCollectionNftTuple extends Enum {
readonly isAccountId: boolean;
readonly asAccountId: AccountId32;
@@ -2519,13 +2524,13 @@
readonly type: 'AccountId' | 'CollectionAndNftTuple';
}
- /** @name UpDataStructsRmrkRoyaltyInfo (334) */
+ /** @name UpDataStructsRmrkRoyaltyInfo (335) */
export interface UpDataStructsRmrkRoyaltyInfo extends Struct {
readonly recipient: AccountId32;
readonly amount: Permill;
}
- /** @name UpDataStructsRmrkResourceInfo (335) */
+ /** @name UpDataStructsRmrkResourceInfo (336) */
export interface UpDataStructsRmrkResourceInfo extends Struct {
readonly id: Bytes;
readonly resource: UpDataStructsRmrkResourceTypes;
@@ -2533,7 +2538,7 @@
readonly pendingRemoval: bool;
}
- /** @name UpDataStructsRmrkResourceTypes (338) */
+ /** @name UpDataStructsRmrkResourceTypes (339) */
export interface UpDataStructsRmrkResourceTypes extends Enum {
readonly isBasic: boolean;
readonly asBasic: UpDataStructsRmrkBasicResource;
@@ -2544,7 +2549,7 @@
readonly type: 'Basic' | 'Composable' | 'Slot';
}
- /** @name UpDataStructsRmrkBasicResource (339) */
+ /** @name UpDataStructsRmrkBasicResource (340) */
export interface UpDataStructsRmrkBasicResource extends Struct {
readonly src: Option<Bytes>;
readonly metadata: Option<Bytes>;
@@ -2552,7 +2557,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name UpDataStructsRmrkComposableResource (341) */
+ /** @name UpDataStructsRmrkComposableResource (342) */
export interface UpDataStructsRmrkComposableResource extends Struct {
readonly parts: Vec<u32>;
readonly base: u32;
@@ -2562,7 +2567,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name UpDataStructsRmrkSlotResource (342) */
+ /** @name UpDataStructsRmrkSlotResource (343) */
export interface UpDataStructsRmrkSlotResource extends Struct {
readonly base: u32;
readonly src: Option<Bytes>;
@@ -2572,20 +2577,20 @@
readonly thumb: Option<Bytes>;
}
- /** @name UpDataStructsRmrkPropertyInfo (343) */
+ /** @name UpDataStructsRmrkPropertyInfo (344) */
export interface UpDataStructsRmrkPropertyInfo extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name UpDataStructsRmrkBaseInfo (346) */
+ /** @name UpDataStructsRmrkBaseInfo (347) */
export interface UpDataStructsRmrkBaseInfo extends Struct {
readonly issuer: AccountId32;
readonly baseType: Bytes;
readonly symbol: Bytes;
}
- /** @name UpDataStructsRmrkPartType (347) */
+ /** @name UpDataStructsRmrkPartType (348) */
export interface UpDataStructsRmrkPartType extends Enum {
readonly isFixedPart: boolean;
readonly asFixedPart: UpDataStructsRmrkFixedPart;
@@ -2594,14 +2599,14 @@
readonly type: 'FixedPart' | 'SlotPart';
}
- /** @name UpDataStructsRmrkFixedPart (349) */
+ /** @name UpDataStructsRmrkFixedPart (350) */
export interface UpDataStructsRmrkFixedPart extends Struct {
readonly id: u32;
readonly z: u32;
readonly src: Bytes;
}
- /** @name UpDataStructsRmrkSlotPart (350) */
+ /** @name UpDataStructsRmrkSlotPart (351) */
export interface UpDataStructsRmrkSlotPart extends Struct {
readonly id: u32;
readonly equippable: UpDataStructsRmrkEquippableList;
@@ -2609,7 +2614,7 @@
readonly z: u32;
}
- /** @name UpDataStructsRmrkEquippableList (351) */
+ /** @name UpDataStructsRmrkEquippableList (352) */
export interface UpDataStructsRmrkEquippableList extends Enum {
readonly isAll: boolean;
readonly isEmpty: boolean;
@@ -2618,26 +2623,26 @@
readonly type: 'All' | 'Empty' | 'Custom';
}
- /** @name UpDataStructsRmrkTheme (352) */
+ /** @name UpDataStructsRmrkTheme (353) */
export interface UpDataStructsRmrkTheme extends Struct {
readonly name: Bytes;
readonly properties: Vec<UpDataStructsRmrkThemeProperty>;
readonly inherit: bool;
}
- /** @name UpDataStructsRmrkThemeProperty (354) */
+ /** @name UpDataStructsRmrkThemeProperty (355) */
export interface UpDataStructsRmrkThemeProperty extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name UpDataStructsRmrkNftChild (355) */
+ /** @name UpDataStructsRmrkNftChild (356) */
export interface UpDataStructsRmrkNftChild extends Struct {
readonly collectionId: u32;
readonly nftId: u32;
}
- /** @name PalletCommonError (357) */
+ /** @name PalletCommonError (358) */
export interface PalletCommonError extends Enum {
readonly isCollectionNotFound: boolean;
readonly isMustBeTokenOwner: boolean;
@@ -2675,7 +2680,7 @@
readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'NestingIsDisabled' | 'OnlyOwnerAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey';
}
- /** @name PalletFungibleError (359) */
+ /** @name PalletFungibleError (360) */
export interface PalletFungibleError extends Enum {
readonly isNotFungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isFungibleItemsHaveNoId: boolean;
@@ -2685,12 +2690,12 @@
readonly type: 'NotFungibleDataUsedToMintFungibleCollectionToken' | 'FungibleItemsHaveNoId' | 'FungibleItemsDontHaveData' | 'FungibleDisallowsNesting' | 'SettingPropertiesNotAllowed';
}
- /** @name PalletRefungibleItemData (360) */
+ /** @name PalletRefungibleItemData (361) */
export interface PalletRefungibleItemData extends Struct {
readonly constData: Bytes;
}
- /** @name PalletRefungibleError (364) */
+ /** @name PalletRefungibleError (365) */
export interface PalletRefungibleError extends Enum {
readonly isNotRefungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isWrongRefungiblePieces: boolean;
@@ -2699,12 +2704,12 @@
readonly type: 'NotRefungibleDataUsedToMintFungibleCollectionToken' | 'WrongRefungiblePieces' | 'RefungibleDisallowsNesting' | 'SettingPropertiesNotAllowed';
}
- /** @name PalletNonfungibleItemData (365) */
+ /** @name PalletNonfungibleItemData (366) */
export interface PalletNonfungibleItemData extends Struct {
readonly owner: PalletEvmAccountBasicCrossAccountIdRepr;
}
- /** @name PalletNonfungibleError (367) */
+ /** @name PalletNonfungibleError (368) */
export interface PalletNonfungibleError extends Enum {
readonly isNotNonfungibleDataUsedToMintFungibleCollectionToken: boolean;
readonly isNonfungibleItemsHaveNoAmount: boolean;
@@ -2712,7 +2717,7 @@
readonly type: 'NotNonfungibleDataUsedToMintFungibleCollectionToken' | 'NonfungibleItemsHaveNoAmount' | 'CantBurnNftWithChildren';
}
- /** @name PalletStructureError (368) */
+ /** @name PalletStructureError (369) */
export interface PalletStructureError extends Enum {
readonly isOuroborosDetected: boolean;
readonly isDepthLimit: boolean;
@@ -2720,7 +2725,7 @@
readonly type: 'OuroborosDetected' | 'DepthLimit' | 'TokenNotFound';
}
- /** @name PalletEvmError (371) */
+ /** @name PalletEvmError (372) */
export interface PalletEvmError extends Enum {
readonly isBalanceLow: boolean;
readonly isFeeOverflow: boolean;
@@ -2731,7 +2736,7 @@
readonly type: 'BalanceLow' | 'FeeOverflow' | 'PaymentOverflow' | 'WithdrawFailed' | 'GasPriceTooLow' | 'InvalidNonce';
}
- /** @name FpRpcTransactionStatus (374) */
+ /** @name FpRpcTransactionStatus (375) */
export interface FpRpcTransactionStatus extends Struct {
readonly transactionHash: H256;
readonly transactionIndex: u32;
@@ -2742,10 +2747,10 @@
readonly logsBloom: EthbloomBloom;
}
- /** @name EthbloomBloom (376) */
+ /** @name EthbloomBloom (377) */
export interface EthbloomBloom extends U8aFixed {}
- /** @name EthereumReceiptReceiptV3 (378) */
+ /** @name EthereumReceiptReceiptV3 (379) */
export interface EthereumReceiptReceiptV3 extends Enum {
readonly isLegacy: boolean;
readonly asLegacy: EthereumReceiptEip658ReceiptData;
@@ -2756,7 +2761,7 @@
readonly type: 'Legacy' | 'Eip2930' | 'Eip1559';
}
- /** @name EthereumReceiptEip658ReceiptData (379) */
+ /** @name EthereumReceiptEip658ReceiptData (380) */
export interface EthereumReceiptEip658ReceiptData extends Struct {
readonly statusCode: u8;
readonly usedGas: U256;
@@ -2764,14 +2769,14 @@
readonly logs: Vec<EthereumLog>;
}
- /** @name EthereumBlock (380) */
+ /** @name EthereumBlock (381) */
export interface EthereumBlock extends Struct {
readonly header: EthereumHeader;
readonly transactions: Vec<EthereumTransactionTransactionV2>;
readonly ommers: Vec<EthereumHeader>;
}
- /** @name EthereumHeader (381) */
+ /** @name EthereumHeader (382) */
export interface EthereumHeader extends Struct {
readonly parentHash: H256;
readonly ommersHash: H256;
@@ -2790,24 +2795,24 @@
readonly nonce: EthereumTypesHashH64;
}
- /** @name EthereumTypesHashH64 (382) */
+ /** @name EthereumTypesHashH64 (383) */
export interface EthereumTypesHashH64 extends U8aFixed {}
- /** @name PalletEthereumError (387) */
+ /** @name PalletEthereumError (388) */
export interface PalletEthereumError extends Enum {
readonly isInvalidSignature: boolean;
readonly isPreLogExists: boolean;
readonly type: 'InvalidSignature' | 'PreLogExists';
}
- /** @name PalletEvmCoderSubstrateError (388) */
+ /** @name PalletEvmCoderSubstrateError (389) */
export interface PalletEvmCoderSubstrateError extends Enum {
readonly isOutOfGas: boolean;
readonly isOutOfFund: boolean;
readonly type: 'OutOfGas' | 'OutOfFund';
}
- /** @name PalletEvmContractHelpersSponsoringModeT (389) */
+ /** @name PalletEvmContractHelpersSponsoringModeT (390) */
export interface PalletEvmContractHelpersSponsoringModeT extends Enum {
readonly isDisabled: boolean;
readonly isAllowlisted: boolean;
@@ -2815,20 +2820,20 @@
readonly type: 'Disabled' | 'Allowlisted' | 'Generous';
}
- /** @name PalletEvmContractHelpersError (391) */
+ /** @name PalletEvmContractHelpersError (392) */
export interface PalletEvmContractHelpersError extends Enum {
readonly isNoPermission: boolean;
readonly type: 'NoPermission';
}
- /** @name PalletEvmMigrationError (392) */
+ /** @name PalletEvmMigrationError (393) */
export interface PalletEvmMigrationError extends Enum {
readonly isAccountNotEmpty: boolean;
readonly isAccountIsNotMigrating: boolean;
readonly type: 'AccountNotEmpty' | 'AccountIsNotMigrating';
}
- /** @name SpRuntimeMultiSignature (394) */
+ /** @name SpRuntimeMultiSignature (395) */
export interface SpRuntimeMultiSignature extends Enum {
readonly isEd25519: boolean;
readonly asEd25519: SpCoreEd25519Signature;
@@ -2839,34 +2844,34 @@
readonly type: 'Ed25519' | 'Sr25519' | 'Ecdsa';
}
- /** @name SpCoreEd25519Signature (395) */
+ /** @name SpCoreEd25519Signature (396) */
export interface SpCoreEd25519Signature extends U8aFixed {}
- /** @name SpCoreSr25519Signature (397) */
+ /** @name SpCoreSr25519Signature (398) */
export interface SpCoreSr25519Signature extends U8aFixed {}
- /** @name SpCoreEcdsaSignature (398) */
+ /** @name SpCoreEcdsaSignature (399) */
export interface SpCoreEcdsaSignature extends U8aFixed {}
- /** @name FrameSystemExtensionsCheckSpecVersion (401) */
+ /** @name FrameSystemExtensionsCheckSpecVersion (402) */
export type FrameSystemExtensionsCheckSpecVersion = Null;
- /** @name FrameSystemExtensionsCheckGenesis (402) */
+ /** @name FrameSystemExtensionsCheckGenesis (403) */
export type FrameSystemExtensionsCheckGenesis = Null;
- /** @name FrameSystemExtensionsCheckNonce (405) */
+ /** @name FrameSystemExtensionsCheckNonce (406) */
export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
- /** @name FrameSystemExtensionsCheckWeight (406) */
+ /** @name FrameSystemExtensionsCheckWeight (407) */
export type FrameSystemExtensionsCheckWeight = Null;
- /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (407) */
+ /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (408) */
export interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
- /** @name OpalRuntimeRuntime (408) */
+ /** @name OpalRuntimeRuntime (409) */
export type OpalRuntimeRuntime = Null;
- /** @name PalletEthereumFakeTransactionFinalizer (409) */
+ /** @name PalletEthereumFakeTransactionFinalizer (410) */
export type PalletEthereumFakeTransactionFinalizer = Null;
} // declare module
tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -50,6 +50,7 @@
allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
+ tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),
constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
collectionProperties: fun(
tests/src/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -7,6 +7,7 @@
createItemExpectSuccess,
enableAllowListExpectSuccess,
enablePublicMintingExpectSuccess,
+ getTokenChildren,
getTokenOwner,
getTopmostTokenOwner,
normalizeAccountId,
@@ -76,8 +77,8 @@
api,
alice,
api.tx.unique.transferFrom(
- normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenA)}),
- normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenB)}),
+ normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenA)}),
+ normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenB)}),
collection,
tokenC,
1,
@@ -88,6 +89,63 @@
});
});
+ it('Checks token children', async () => {
+ await usingApi(async api => {
+ const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+ await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: 'Owner'});
+ const collectionB = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+
+ const targetToken = await createItemExpectSuccess(alice, collectionA, 'NFT');
+ const targetAddress = {Ethereum: tokenIdToAddress(collectionA, targetToken)};
+ let children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(0, 'Children length check at creation');
+
+ // Create a nested NFT token
+ const tokenA = await createItemExpectSuccess(alice, collectionA, 'NFT', targetAddress);
+ children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(1, 'Children length check at nesting #1');
+ expect(children).to.have.deep.members([
+ {token: tokenA, collection: collectionA},
+ ], 'Children contents check at nesting #1');
+
+ // Create then nest
+ const tokenB = await createItemExpectSuccess(alice, collectionA, 'NFT');
+ await transferExpectSuccess(collectionA, tokenB, alice, targetAddress);
+ children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(2, 'Children length check at nesting #2');
+ expect(children).to.have.deep.members([
+ {token: tokenA, collection: collectionA},
+ {token: tokenB, collection: collectionA},
+ ], 'Children contents check at nesting #2');
+
+ // Move token B to a different user outside the nesting tree
+ await transferExpectSuccess(collectionA, tokenB, alice, bob);
+ children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(1, 'Children length check at unnesting');
+ expect(children).to.be.have.deep.members([
+ {token: tokenA, collection: collectionA},
+ ], 'Children contents check at unnesting');
+
+ // Create a fungible token in another collection and then nest
+ const tokenC = await createItemExpectSuccess(alice, collectionB, 'Fungible');
+ await transferExpectSuccess(collectionB, tokenC, alice, targetAddress, 1, 'Fungible');
+ children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(2, 'Children length check at nesting #3 (from another collection)');
+ expect(children).to.be.have.deep.members([
+ {token: tokenA, collection: collectionA},
+ {token: tokenC, collection: collectionB},
+ ], 'Children contents check at nesting #3 (from another collection)');
+
+ // Move the fungible token inside token A deeper in the nesting tree
+ await transferFromExpectSuccess(collectionB, tokenC, alice, targetAddress, {Ethereum: tokenIdToAddress(collectionA, tokenA)}, 1, 'Fungible');
+ children = await getTokenChildren(api, collectionA, targetToken);
+ expect(children.length).to.be.equal(1, 'Children length check at deeper nesting');
+ expect(children).to.be.have.deep.members([
+ {token: tokenA, collection: collectionA},
+ ], 'Children contents check at deeper nesting');
+ });
+ });
+
// ---------- Non-Fungible ----------
it('NFT: allows an Owner to nest/unnest their token', async () => {
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -27,6 +27,7 @@
import {default as usingApi, executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from '../substrate/substrate-api';
import {hexToStr, strToUTF16, utf16ToStr} from './util';
import {UpDataStructsRpcCollection, UpDataStructsCreateItemData, UpDataStructsProperty} from '@polkadot/types/lookup';
+import {UpDataStructsTokenChild} from '../interfaces';
chai.use(chaiAsPromised);
const expect = chai.expect;
@@ -1165,6 +1166,13 @@
if (owner == null) throw new Error('owner == null');
return normalizeAccountId(owner);
}
+export async function getTokenChildren(
+ api: ApiPromise,
+ collectionId: number,
+ tokenId: number,
+): Promise<UpDataStructsTokenChild[]> {
+ return (await api.rpc.unique.tokenChildren(collectionId, tokenId)).toJSON() as any;
+}
export async function isTokenExists(
api: ApiPromise,
collectionId: number,