--- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -24,7 +24,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; @@ -76,6 +76,13 @@ token: TokenId, at: Option, ) -> Result>; + #[rpc(name = "unique_tokenChildren")] + fn token_children( + &self, + collection: CollectionId, + token: TokenId, + at: Option, + ) -> Result>; #[method(name = "unique_collectionProperties")] fn collection_properties( @@ -393,6 +400,7 @@ pass_method!( topmost_token_owner(collection: CollectionId, token: TokenId) -> Option, unique_api ); + pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec, 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); --- 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, RpcCollection, --- 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 @@ // ========= - >::unnest_if_nested(from, collection.id, token); + >::unnest_if_nested(&token_data.owner, collection.id, token); >::insert( (collection.id, token), @@ -988,6 +988,15 @@ .is_some() } + pub fn token_children_ids(collection_id: CollectionId, token_id: TokenId) -> Vec { + >::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, --- 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, 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(); --- 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, --- 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>; fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result>; + fn token_children(collection: CollectionId, token: TokenId) -> Result>; fn collection_properties(collection: CollectionId, properties: Option>>) -> Result>; --- a/runtime/common/src/runtime_apis.rs +++ b/runtime/common/src/runtime_apis.rs @@ -29,7 +29,9 @@ Ok(Some(>::find_topmost_owner(collection, token, &budget)?)) } - + fn token_children(collection: CollectionId, token: TokenId) -> Result, DispatchError> { + Ok(>::token_children_ids(collection, token)) + } fn collection_properties( collection: CollectionId, keys: Option>> --- 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 Observable>>, []> & QueryableStorageEntry; + dummyStorageValue: AugmentedQuery Observable>>, []> & QueryableStorageEntry; /** * List of collection admins **/ --- 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 | string)[], at?: Hash | string | Uint8Array) => Observable>>; /** + * Get tokens nested directly into the token + **/ + tokenChildren: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable>>; + /** * Get token data **/ tokenData: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec | (Text | string)[], at?: Hash | string | Uint8Array) => Observable>; --- 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; --- 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> {} +export interface PhantomTypeUpDataStructs extends Vec> {} /** @name PolkadotCorePrimitivesInboundDownwardMessage */ export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct { @@ -1861,7 +1861,6 @@ /** @name UpDataStructsCreateNftData */ export interface UpDataStructsCreateNftData extends Struct { - readonly constData: Bytes; readonly properties: Vec; } @@ -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; --- 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' }, /** - * 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 + * 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 + **/ + PhantomTypeUpDataStructs: '[(UpDataStructsTokenData,UpDataStructsRpcCollection,UpDataStructsRmrkCollectionInfo,UpDataStructsRmrkNftInfo,UpDataStructsRmrkResourceInfo,UpDataStructsRmrkPropertyInfo,UpDataStructsRmrkBaseInfo,UpDataStructsRmrkPartType,UpDataStructsRmrkTheme,UpDataStructsRmrkNftChild);0]', /** - * Lookup325: up_data_structs::TokenData> + * Lookup326: up_data_structs::TokenData> **/ UpDataStructsTokenData: { properties: 'Vec', owner: 'Option' }, /** - * Lookup327: up_data_structs::RpcCollection + * Lookup328: up_data_structs::RpcCollection **/ UpDataStructsRpcCollection: { owner: 'AccountId32', @@ -2308,7 +2314,7 @@ properties: 'Vec' }, /** - * Lookup328: up_data_structs::rmrk::CollectionInfo, frame_support::storage::bounded_vec::BoundedVec, sp_core::crypto::AccountId32> + * Lookup329: up_data_structs::rmrk::CollectionInfo, frame_support::storage::bounded_vec::BoundedVec, sp_core::crypto::AccountId32> **/ UpDataStructsRmrkCollectionInfo: { issuer: 'AccountId32', @@ -2318,7 +2324,7 @@ nftsCount: 'u32' }, /** - * Lookup331: up_data_structs::rmrk::NftInfo> + * Lookup332: up_data_structs::rmrk::NftInfo> **/ UpDataStructsRmrkNftInfo: { owner: 'UpDataStructsRmrkAccountIdOrCollectionNftTuple', @@ -2328,7 +2334,7 @@ pending: 'bool' }, /** - * Lookup332: up_data_structs::rmrk::AccountIdOrCollectionNftTuple + * Lookup333: up_data_structs::rmrk::AccountIdOrCollectionNftTuple **/ UpDataStructsRmrkAccountIdOrCollectionNftTuple: { _enum: { @@ -2337,14 +2343,14 @@ } }, /** - * Lookup334: up_data_structs::rmrk::RoyaltyInfo + * Lookup335: up_data_structs::rmrk::RoyaltyInfo **/ UpDataStructsRmrkRoyaltyInfo: { recipient: 'AccountId32', amount: 'Permill' }, /** - * Lookup335: up_data_structs::rmrk::ResourceInfo, frame_support::storage::bounded_vec::BoundedVec, frame_support::storage::bounded_vec::BoundedVec> + * Lookup336: up_data_structs::rmrk::ResourceInfo, frame_support::storage::bounded_vec::BoundedVec, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkResourceInfo: { id: 'Bytes', @@ -2353,7 +2359,7 @@ pendingRemoval: 'bool' }, /** - * Lookup338: up_data_structs::rmrk::ResourceTypes, frame_support::storage::bounded_vec::BoundedVec> + * Lookup339: up_data_structs::rmrk::ResourceTypes, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkResourceTypes: { _enum: { @@ -2363,7 +2369,7 @@ } }, /** - * Lookup339: up_data_structs::rmrk::BasicResource> + * Lookup340: up_data_structs::rmrk::BasicResource> **/ UpDataStructsRmrkBasicResource: { src: 'Option', @@ -2372,7 +2378,7 @@ thumb: 'Option' }, /** - * Lookup341: up_data_structs::rmrk::ComposableResource, frame_support::storage::bounded_vec::BoundedVec> + * Lookup342: up_data_structs::rmrk::ComposableResource, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkComposableResource: { parts: 'Vec', @@ -2383,7 +2389,7 @@ thumb: 'Option' }, /** - * Lookup342: up_data_structs::rmrk::SlotResource> + * Lookup343: up_data_structs::rmrk::SlotResource> **/ UpDataStructsRmrkSlotResource: { base: 'u32', @@ -2394,14 +2400,14 @@ thumb: 'Option' }, /** - * Lookup343: up_data_structs::rmrk::PropertyInfo, frame_support::storage::bounded_vec::BoundedVec> + * Lookup344: up_data_structs::rmrk::PropertyInfo, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkPropertyInfo: { key: 'Bytes', value: 'Bytes' }, /** - * Lookup346: up_data_structs::rmrk::BaseInfo> + * Lookup347: up_data_structs::rmrk::BaseInfo> **/ UpDataStructsRmrkBaseInfo: { issuer: 'AccountId32', @@ -2409,7 +2415,7 @@ symbol: 'Bytes' }, /** - * Lookup347: up_data_structs::rmrk::PartType, frame_support::storage::bounded_vec::BoundedVec> + * Lookup348: up_data_structs::rmrk::PartType, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkPartType: { _enum: { @@ -2418,7 +2424,7 @@ } }, /** - * Lookup349: up_data_structs::rmrk::FixedPart> + * Lookup350: up_data_structs::rmrk::FixedPart> **/ UpDataStructsRmrkFixedPart: { id: 'u32', @@ -2426,7 +2432,7 @@ src: 'Bytes' }, /** - * Lookup350: up_data_structs::rmrk::SlotPart, frame_support::storage::bounded_vec::BoundedVec> + * Lookup351: up_data_structs::rmrk::SlotPart, frame_support::storage::bounded_vec::BoundedVec> **/ UpDataStructsRmrkSlotPart: { id: 'u32', @@ -2435,7 +2441,7 @@ z: 'u32' }, /** - * Lookup351: up_data_structs::rmrk::EquippableList> + * Lookup352: up_data_structs::rmrk::EquippableList> **/ UpDataStructsRmrkEquippableList: { _enum: { @@ -2445,7 +2451,7 @@ } }, /** - * Lookup352: up_data_structs::rmrk::Theme, PropertyList> + * Lookup353: up_data_structs::rmrk::Theme, PropertyList> **/ UpDataStructsRmrkTheme: { name: 'Bytes', @@ -2453,69 +2459,69 @@ inherit: 'bool' }, /** - * Lookup354: up_data_structs::rmrk::ThemeProperty> + * Lookup355: up_data_structs::rmrk::ThemeProperty> **/ 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 + * Lookup358: pallet_common::pallet::Error **/ 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 + * Lookup360: pallet_fungible::pallet::Error **/ PalletFungibleError: { _enum: ['NotFungibleDataUsedToMintFungibleCollectionToken', 'FungibleItemsHaveNoId', 'FungibleItemsDontHaveData', 'FungibleDisallowsNesting', 'SettingPropertiesNotAllowed'] }, /** - * Lookup360: pallet_refungible::ItemData + * Lookup361: pallet_refungible::ItemData **/ PalletRefungibleItemData: { constData: 'Bytes' }, /** - * Lookup364: pallet_refungible::pallet::Error + * Lookup365: pallet_refungible::pallet::Error **/ PalletRefungibleError: { _enum: ['NotRefungibleDataUsedToMintFungibleCollectionToken', 'WrongRefungiblePieces', 'RefungibleDisallowsNesting', 'SettingPropertiesNotAllowed'] }, /** - * Lookup365: pallet_nonfungible::ItemData> + * Lookup366: pallet_nonfungible::ItemData> **/ PalletNonfungibleItemData: { owner: 'PalletEvmAccountBasicCrossAccountIdRepr' }, /** - * Lookup367: pallet_nonfungible::pallet::Error + * Lookup368: pallet_nonfungible::pallet::Error **/ PalletNonfungibleError: { _enum: ['NotNonfungibleDataUsedToMintFungibleCollectionToken', 'NonfungibleItemsHaveNoAmount', 'CantBurnNftWithChildren'] }, /** - * Lookup368: pallet_structure::pallet::Error + * Lookup369: pallet_structure::pallet::Error **/ PalletStructureError: { _enum: ['OuroborosDetected', 'DepthLimit', 'TokenNotFound'] }, /** - * Lookup371: pallet_evm::pallet::Error + * Lookup372: pallet_evm::pallet::Error **/ 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' }, /** - * Lookup380: ethereum::block::Block + * Lookup381: ethereum::block::Block **/ EthereumBlock: { header: 'EthereumHeader', @@ -2558,7 +2564,7 @@ ommers: 'Vec' }, /** - * 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 + * Lookup388: pallet_ethereum::pallet::Error **/ PalletEthereumError: { _enum: ['InvalidSignature', 'PreLogExists'] }, /** - * Lookup388: pallet_evm_coder_substrate::pallet::Error + * Lookup389: pallet_evm_coder_substrate::pallet::Error **/ 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 + * Lookup392: pallet_evm_contract_helpers::pallet::Error **/ PalletEvmContractHelpersError: { _enum: ['NoPermission'] }, /** - * Lookup392: pallet_evm_migration::pallet::Error + * Lookup393: pallet_evm_migration::pallet::Error **/ 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 + * Lookup402: frame_system::extensions::check_spec_version::CheckSpecVersion **/ FrameSystemExtensionsCheckSpecVersion: 'Null', /** - * Lookup402: frame_system::extensions::check_genesis::CheckGenesis + * Lookup403: frame_system::extensions::check_genesis::CheckGenesis **/ FrameSystemExtensionsCheckGenesis: 'Null', /** - * Lookup405: frame_system::extensions::check_nonce::CheckNonce + * Lookup406: frame_system::extensions::check_nonce::CheckNonce **/ FrameSystemExtensionsCheckNonce: 'Compact', /** - * Lookup406: frame_system::extensions::check_weight::CheckWeight + * Lookup407: frame_system::extensions::check_weight::CheckWeight **/ FrameSystemExtensionsCheckWeight: 'Null', /** - * Lookup407: pallet_template_transaction_payment::ChargeTransactionPayment + * Lookup408: pallet_template_transaction_payment::ChargeTransactionPayment **/ PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact', /** - * Lookup408: opal_runtime::Runtime + * Lookup409: opal_runtime::Runtime **/ OpalRuntimeRuntime: 'Null', /** - * Lookup409: pallet_ethereum::FakeTransactionFinalizer + * Lookup410: pallet_ethereum::FakeTransactionFinalizer **/ PalletEthereumFakeTransactionFinalizer: 'Null' }; --- 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; --- 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; } - /** @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> {} + /** @name UpDataStructsTokenChild (323) */ + export interface UpDataStructsTokenChild extends Struct { + readonly token: u32; + readonly collection: u32; + } + + /** @name PhantomTypeUpDataStructs (324) */ + export interface PhantomTypeUpDataStructs extends Vec> {} - /** @name UpDataStructsTokenData (325) */ + /** @name UpDataStructsTokenData (326) */ export interface UpDataStructsTokenData extends Struct { readonly properties: Vec; readonly owner: Option; } - /** @name UpDataStructsRpcCollection (327) */ + /** @name UpDataStructsRpcCollection (328) */ export interface UpDataStructsRpcCollection extends Struct { readonly owner: AccountId32; readonly mode: UpDataStructsCollectionMode; @@ -2492,7 +2497,7 @@ readonly properties: Vec; } - /** @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; @@ -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; readonly metadata: Option; @@ -2552,7 +2557,7 @@ readonly thumb: Option; } - /** @name UpDataStructsRmrkComposableResource (341) */ + /** @name UpDataStructsRmrkComposableResource (342) */ export interface UpDataStructsRmrkComposableResource extends Struct { readonly parts: Vec; readonly base: u32; @@ -2562,7 +2567,7 @@ readonly thumb: Option; } - /** @name UpDataStructsRmrkSlotResource (342) */ + /** @name UpDataStructsRmrkSlotResource (343) */ export interface UpDataStructsRmrkSlotResource extends Struct { readonly base: u32; readonly src: Option; @@ -2572,20 +2577,20 @@ readonly thumb: Option; } - /** @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; 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; } - /** @name EthereumBlock (380) */ + /** @name EthereumBlock (381) */ export interface EthereumBlock extends Struct { readonly header: EthereumHeader; readonly transactions: Vec; readonly ommers: Vec; } - /** @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 {} - /** @name FrameSystemExtensionsCheckWeight (406) */ + /** @name FrameSystemExtensionsCheckWeight (407) */ export type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (407) */ + /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (408) */ export interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name OpalRuntimeRuntime (408) */ + /** @name OpalRuntimeRuntime (409) */ export type OpalRuntimeRuntime = Null; - /** @name PalletEthereumFakeTransactionFinalizer (409) */ + /** @name PalletEthereumFakeTransactionFinalizer (410) */ export type PalletEthereumFakeTransactionFinalizer = Null; } // declare module --- 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'), constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec'), variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec'), collectionProperties: fun( --- 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 () => { --- 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 { + return (await api.rpc.unique.tokenChildren(collectionId, tokenId)).toJSON() as any; +} export async function isTokenExists( api: ApiPromise, collectionId: number,