difftreelog
fix export RpcCollection to metadata
in: master
4 files changed
pallets/common/src/lib.rsdiffbeforeafterboth33 COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, TokenId, CollectionStats, MAX_TOKEN_OWNERSHIP,33 COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, TokenId, CollectionStats, MAX_TOKEN_OWNERSHIP,34 CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,34 CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,35 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, CUSTOM_DATA_LIMIT, CollectionLimits,35 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, CUSTOM_DATA_LIMIT, CollectionLimits,36 CustomDataLimit, CreateCollectionData, SponsorshipState, CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField,36 CustomDataLimit, CreateCollectionData, SponsorshipState, CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField, PhantomType,37};37};38pub use pallet::*;38pub use pallet::*;39use sp_core::H160;39use sp_core::H160;415415416 /// Not used by code, exists only to provide some types to metadata416 /// Not used by code, exists only to provide some types to metadata417 #[pallet::storage]417 #[pallet::storage]418 pub type DummyStorageValue<T> =418 pub type DummyStorageValue<T: Config> =419 StorageValue<Value = (CollectionStats, CollectionId, TokenId), QueryKind = OptionQuery>;419 StorageValue<Value = (CollectionStats, CollectionId, TokenId, PhantomType<RpcCollection<T::AccountId>>), QueryKind = OptionQuery>;420420421 #[pallet::hooks]421 #[pallet::hooks]422 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {422 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -583,3 +583,24 @@
pub destroyed: u32,
pub alive: u32,
}
+
+#[derive(Encode, Decode, PartialEq, Clone, Debug)]
+pub struct PhantomType<T>(core::marker::PhantomData<T>);
+
+impl<T: TypeInfo + 'static> TypeInfo for PhantomType<T> {
+ type Identity = PhantomType<T>;
+
+ fn type_info() -> scale_info::Type {
+ use scale_info::{Type, Path, build::{FieldsBuilder, UnnamedFields}};
+ Type::builder()
+ .path(Path::new("up_data_structs", "PhantomType"))
+ .composite(<FieldsBuilder<UnnamedFields>>::default().field(|b|
+ b.ty::<[T ;0]>()
+ ))
+ }
+}
+impl<T> MaxEncodedLen for PhantomType<T> {
+ fn max_encoded_len() -> usize {
+ 0
+ }
+}
\ No newline at end of file
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -67,7 +67,7 @@
},
};
use up_data_structs::mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping};
-use up_data_structs::{CollectionId, TokenId, CollectionStats, Collection, RpcCollection};
+use up_data_structs::{CollectionId, TokenId, CollectionStats, RpcCollection};
// use pallet_contracts::weights::WeightInfo;
// #[cfg(any(feature = "std", test))]
use frame_system::{
tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -52,7 +52,7 @@
constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
- collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),
+ collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),
collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),
allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),