git.delta.rocks / unique-network / refs/commits / 1a56db748b0a

difftreelog

doc: architectural changes

Farhad Hakimov2022-07-11parent: #12c8c8f.patch.diff
in: master

10 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
42#[rpc(server)]42#[rpc(server)]
43#[async_trait]43#[async_trait]
44pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {44pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {
45 /// Get tokens owned by account
45 #[method(name = "unique_accountTokens")]46 #[method(name = "unique_accountTokens")]
46 fn account_tokens(47 fn account_tokens(
47 &self,48 &self,
48 collection: CollectionId,49 collection: CollectionId,
49 account: CrossAccountId,50 account: CrossAccountId,
50 at: Option<BlockHash>,51 at: Option<BlockHash>,
51 ) -> Result<Vec<TokenId>>;52 ) -> Result<Vec<TokenId>>;
53 /// Get tokens contained in collection
52 #[method(name = "unique_collectionTokens")]54 #[method(name = "unique_collectionTokens")]
53 fn collection_tokens(55 fn collection_tokens(
54 &self,56 &self,
55 collection: CollectionId,57 collection: CollectionId,
56 at: Option<BlockHash>,58 at: Option<BlockHash>,
57 ) -> Result<Vec<TokenId>>;59 ) -> Result<Vec<TokenId>>;
60 /// Check if token exists
58 #[method(name = "unique_tokenExists")]61 #[method(name = "unique_tokenExists")]
59 fn token_exists(62 fn token_exists(
60 &self,63 &self,
61 collection: CollectionId,64 collection: CollectionId,
62 token: TokenId,65 token: TokenId,
63 at: Option<BlockHash>,66 at: Option<BlockHash>,
64 ) -> Result<bool>;67 ) -> Result<bool>;
6568 /// Get token owner
66 #[method(name = "unique_tokenOwner")]69 #[method(name = "unique_tokenOwner")]
67 fn token_owner(70 fn token_owner(
68 &self,71 &self,
69 collection: CollectionId,72 collection: CollectionId,
70 token: TokenId,73 token: TokenId,
71 at: Option<BlockHash>,74 at: Option<BlockHash>,
72 ) -> Result<Option<CrossAccountId>>;75 ) -> Result<Option<CrossAccountId>>;
76 /// Get token owner, in case of nested token - find the parent recursively
73 #[method(name = "unique_topmostTokenOwner")]77 #[method(name = "unique_topmostTokenOwner")]
74 fn topmost_token_owner(78 fn topmost_token_owner(
75 &self,79 &self,
76 collection: CollectionId,80 collection: CollectionId,
77 token: TokenId,81 token: TokenId,
78 at: Option<BlockHash>,82 at: Option<BlockHash>,
79 ) -> Result<Option<CrossAccountId>>;83 ) -> Result<Option<CrossAccountId>>;
84 /// Get tokens nested directly into the token
80 #[method(name = "unique_tokenChildren")]85 #[method(name = "unique_tokenChildren")]
81 fn token_children(86 fn token_children(
82 &self,87 &self,
83 collection: CollectionId,88 collection: CollectionId,
84 token: TokenId,89 token: TokenId,
85 at: Option<BlockHash>,90 at: Option<BlockHash>,
86 ) -> Result<Vec<TokenChild>>;91 ) -> Result<Vec<TokenChild>>;
8792 /// Get collection properties
88 #[method(name = "unique_collectionProperties")]93 #[method(name = "unique_collectionProperties")]
89 fn collection_properties(94 fn collection_properties(
90 &self,95 &self,
91 collection: CollectionId,96 collection: CollectionId,
92 keys: Option<Vec<String>>,97 keys: Option<Vec<String>>,
93 at: Option<BlockHash>,98 at: Option<BlockHash>,
94 ) -> Result<Vec<Property>>;99 ) -> Result<Vec<Property>>;
95100 /// Get token properties
96 #[method(name = "unique_tokenProperties")]101 #[method(name = "unique_tokenProperties")]
97 fn token_properties(102 fn token_properties(
98 &self,103 &self,
101 keys: Option<Vec<String>>,106 keys: Option<Vec<String>>,
102 at: Option<BlockHash>,107 at: Option<BlockHash>,
103 ) -> Result<Vec<Property>>;108 ) -> Result<Vec<Property>>;
104109 /// Get property permissions
105 #[method(name = "unique_propertyPermissions")]110 #[method(name = "unique_propertyPermissions")]
106 fn property_permissions(111 fn property_permissions(
107 &self,112 &self,
108 collection: CollectionId,113 collection: CollectionId,
109 keys: Option<Vec<String>>,114 keys: Option<Vec<String>>,
110 at: Option<BlockHash>,115 at: Option<BlockHash>,
111 ) -> Result<Vec<PropertyKeyPermission>>;116 ) -> Result<Vec<PropertyKeyPermission>>;
112117 /// Get token data
113 #[method(name = "unique_tokenData")]118 #[method(name = "unique_tokenData")]
114 fn token_data(119 fn token_data(
115 &self,120 &self,
118 keys: Option<Vec<String>>,123 keys: Option<Vec<String>>,
119 at: Option<BlockHash>,124 at: Option<BlockHash>,
120 ) -> Result<TokenData<CrossAccountId>>;125 ) -> Result<TokenData<CrossAccountId>>;
121126 /// Get amount of unique collection tokens
122 #[method(name = "unique_totalSupply")]127 #[method(name = "unique_totalSupply")]
123 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;128 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;
129 /// Get owned amount of any user tokens
124 #[method(name = "unique_accountBalance")]130 #[method(name = "unique_accountBalance")]
125 fn account_balance(131 fn account_balance(
126 &self,132 &self,
127 collection: CollectionId,133 collection: CollectionId,
128 account: CrossAccountId,134 account: CrossAccountId,
129 at: Option<BlockHash>,135 at: Option<BlockHash>,
130 ) -> Result<u32>;136 ) -> Result<u32>;
137 /// Get owned amount of specific account token
131 #[method(name = "unique_balance")]138 #[method(name = "unique_balance")]
132 fn balance(139 fn balance(
133 &self,140 &self,
136 token: TokenId,143 token: TokenId,
137 at: Option<BlockHash>,144 at: Option<BlockHash>,
138 ) -> Result<String>;145 ) -> Result<String>;
146 /// Get allowed amount
139 #[method(name = "unique_allowance")]147 #[method(name = "unique_allowance")]
140 fn allowance(148 fn allowance(
141 &self,149 &self,
145 token: TokenId,153 token: TokenId,
146 at: Option<BlockHash>,154 at: Option<BlockHash>,
147 ) -> Result<String>;155 ) -> Result<String>;
148156 /// Get admin list
149 #[method(name = "unique_adminlist")]157 #[method(name = "unique_adminlist")]
150 fn adminlist(158 fn adminlist(
151 &self,159 &self,
152 collection: CollectionId,160 collection: CollectionId,
153 at: Option<BlockHash>,161 at: Option<BlockHash>,
154 ) -> Result<Vec<CrossAccountId>>;162 ) -> Result<Vec<CrossAccountId>>;
163 /// Get allowlist
155 #[method(name = "unique_allowlist")]164 #[method(name = "unique_allowlist")]
156 fn allowlist(165 fn allowlist(
157 &self,166 &self,
158 collection: CollectionId,167 collection: CollectionId,
159 at: Option<BlockHash>,168 at: Option<BlockHash>,
160 ) -> Result<Vec<CrossAccountId>>;169 ) -> Result<Vec<CrossAccountId>>;
170 /// Check if user is allowed to use collection
161 #[method(name = "unique_allowed")]171 #[method(name = "unique_allowed")]
162 fn allowed(172 fn allowed(
163 &self,173 &self,
164 collection: CollectionId,174 collection: CollectionId,
165 user: CrossAccountId,175 user: CrossAccountId,
166 at: Option<BlockHash>,176 at: Option<BlockHash>,
167 ) -> Result<bool>;177 ) -> Result<bool>;
178 /// Get last token ID created in a collection
168 #[method(name = "unique_lastTokenId")]179 #[method(name = "unique_lastTokenId")]
169 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;180 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
181 /// Get collection by specified ID
170 #[method(name = "unique_collectionById")]182 #[method(name = "unique_collectionById")]
171 fn collection_by_id(183 fn collection_by_id(
172 &self,184 &self,
173 collection: CollectionId,185 collection: CollectionId,
174 at: Option<BlockHash>,186 at: Option<BlockHash>,
175 ) -> Result<Option<RpcCollection<AccountId>>>;187 ) -> Result<Option<RpcCollection<AccountId>>>;
188 /// Get collection stats
176 #[method(name = "unique_collectionStats")]189 #[method(name = "unique_collectionStats")]
177 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;190 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
178191 /// Get number of blocks when sponsored transaction is available
179 #[method(name = "unique_nextSponsored")]192 #[method(name = "unique_nextSponsored")]
180 fn next_sponsored(193 fn next_sponsored(
181 &self,194 &self,
184 token: TokenId,197 token: TokenId,
185 at: Option<BlockHash>,198 at: Option<BlockHash>,
186 ) -> Result<Option<u64>>;199 ) -> Result<Option<u64>>;
187200 /// Get effective collection limits
188 #[method(name = "unique_effectiveCollectionLimits")]201 #[method(name = "unique_effectiveCollectionLimits")]
189 fn effective_collection_limits(202 fn effective_collection_limits(
190 &self,203 &self,
191 collection_id: CollectionId,204 collection_id: CollectionId,
192 at: Option<BlockHash>,205 at: Option<BlockHash>,
193 ) -> Result<Option<CollectionLimits>>;206 ) -> Result<Option<CollectionLimits>>;
194207 /// Get total pieces of token
195 #[method(name = "unique_totalPieces")]208 #[method(name = "unique_totalPieces")]
196 fn total_pieces(209 fn total_pieces(
197 &self,210 &self,
304 fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;317 fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;
305318
306 #[method(name = "rmrk_themeNames")]319 #[method(name = "rmrk_themeNames")]
320 /// Get Base's theme names
307 fn theme_names(321 fn theme_names(
308 &self,322 &self,
309 base_id: RmrkBaseId,323 base_id: RmrkBaseId,
310 at: Option<BlockHash>,324 at: Option<BlockHash>,
311 ) -> Result<Vec<RmrkThemeName>>;325 ) -> Result<Vec<RmrkThemeName>>;
312326
313 #[method(name = "rmrk_themes")]327 #[method(name = "rmrk_themes")]
328 /// Get Theme info -- name, properties, and inherit flag
314 fn theme(329 fn theme(
315 &self,330 &self,
316 base_id: RmrkBaseId,331 base_id: RmrkBaseId,
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
299 ///299 ///
300 /// # Arguments300 /// # Arguments
301 ///301 ///
302 /// * collection_id: Globally unique identifier of collection.302 /// * collection_id: Globally unique identifier of collection that has been destroyed.
303 CollectionDestroyed(CollectionId),303 CollectionDestroyed(CollectionId),
304304
305 /// New item was created.305 /// New item was created.
306 ///306 ///
307 /// # Arguments307 /// # Arguments
308 ///308 ///
309 /// * collection_id: Id of the collection where item was created.309 /// * collection_id: ID of the collection where the item was created.
310 ///310 ///
311 /// * item_id: Id of an item. Unique within the collection.311 /// * item_id: ID of the item. Unique within the collection.
312 ///312 ///
313 /// * recipient: Owner of newly created item313 /// * recipient: Owner of the newly created item.
314 ///314 ///
315 /// * amount: Always 1 for NFT315 /// * amount: The amount of tokens that were created (always 1 for NFT).
316 ItemCreated(CollectionId, TokenId, T::CrossAccountId, u128),316 ItemCreated(CollectionId, TokenId, T::CrossAccountId, u128),
317317
318 /// Collection item was burned.318 /// Collection item was burned.
319 ///319 ///
320 /// # Arguments320 /// # Arguments
321 ///321 ///
322 /// * collection_id.322 /// * collection_id: Identifier of the collection to which the burned NFT belonged.
323 ///323 ///
324 /// * item_id: Identifier of burned NFT.324 /// * item_id: Identifier of burned NFT.
325 ///325 ///
326 /// * owner: which user has destroyed its tokens326 /// * owner: Which user has destroyed their tokens.
327 ///327 ///
328 /// * amount: Always 1 for NFT328 /// * amount: The amount of tokens that were destroyed (always 1 for NFT).
329 ItemDestroyed(CollectionId, TokenId, T::CrossAccountId, u128),329 ItemDestroyed(CollectionId, TokenId, T::CrossAccountId, u128),
330330
331 /// Item was transferred331 /// Item was transferred.
332 ///
333 /// # Arguments
332 ///334 ///
333 /// * collection_id: Id of collection to which item is belong335 /// * collection_id: ID of the collection to which the item belongs.
334 ///336 ///
335 /// * item_id: Id of an item337 /// * item_id: ID of the item trasnferred.
336 ///338 ///
337 /// * sender: Original owner of item339 /// * sender: Original owner of the item.
338 ///340 ///
339 /// * recipient: New owner of item341 /// * recipient: New owner of the item.
340 ///342 ///
341 /// * amount: Always 1 for NFT343 /// * amount: The amount of tokens that were transferred (always 1 for NFT).
342 Transfer(344 Transfer(
343 CollectionId,345 CollectionId,
344 TokenId,346 TokenId,
347 u128,349 u128,
348 ),350 ),
349351
352 /// Sponsoring allowance was approved.
353 ///
354 /// # Arguments
355 ///
350 /// * collection_id356 /// * collection_id
351 ///357 ///
352 /// * item_id358 /// * item_id
364 u128,370 u128,
365 ),371 ),
366372
373 /// Collection property was added or edited.
374 ///
375 /// # Arguments
376 ///
377 /// * collection_id: ID of the collection, whose property was just set.
378 ///
379 /// * property_key: Key of the property that was just set.
367 CollectionPropertySet(CollectionId, PropertyKey),380 CollectionPropertySet(CollectionId, PropertyKey),
368381
382 /// Collection property was deleted.
383 ///
384 /// # Arguments
385 ///
386 /// * collection_id: ID of the collection, whose property was just deleted.
387 ///
388 /// * property_key: Key of the property that was just deleted.
369 CollectionPropertyDeleted(CollectionId, PropertyKey),389 CollectionPropertyDeleted(CollectionId, PropertyKey),
370390
391 /// Item property was added or edited.
392 ///
393 /// # Arguments
394 ///
395 /// * collection_id: ID of the collection, whose token's property was just set.
396 ///
397 /// * item_id: ID of the item, whose property was just set.
398 ///
399 /// * property_key: Key of the property that was just set.
371 TokenPropertySet(CollectionId, TokenId, PropertyKey),400 TokenPropertySet(CollectionId, TokenId, PropertyKey),
372401
402 /// Item property was deleted.
403 ///
404 /// # Arguments
405 ///
406 /// * collection_id: ID of the collection, whose token's property was just deleted.
407 ///
408 /// * item_id: ID of the item, whose property was just deleted.
409 ///
410 /// * property_key: Key of the property that was just deleted.
373 TokenPropertyDeleted(CollectionId, TokenId, PropertyKey),411 TokenPropertyDeleted(CollectionId, TokenId, PropertyKey),
374412
413 /// Token property permission was added or updated for a collection.
414 ///
415 /// # Arguments
416 ///
417 /// * collection_id: ID of the collection, whose permissions were just set/updated.
418 ///
419 /// * property_key: Key of the property of the set/updated permission.
375 PropertyPermissionSet(CollectionId, PropertyKey),420 PropertyPermissionSet(CollectionId, PropertyKey),
376 }421 }
377422
413 /// Metadata flag frozen458 /// Metadata flag frozen
414 MetadataFlagFrozen,459 MetadataFlagFrozen,
415460
416 /// Item not exists.461 /// Item does not exist
417 TokenNotFound,462 TokenNotFound,
418 /// Item balance not enough.463 /// Item is balance not enough
419 TokenValueTooLow,464 TokenValueTooLow,
420 /// Requested value more than approved.465 /// Requested value is more than the approved
421 ApprovedValueTooLow,466 ApprovedValueTooLow,
422 /// Tried to approve more than owned467 /// Tried to approve more than owned
423 CantApproveMoreThanOwned,468 CantApproveMoreThanOwned,
424469
425 /// Can't transfer tokens to ethereum zero address470 /// Can't transfer tokens to ethereum zero address
426 AddressIsZero,471 AddressIsZero,
427 /// Target collection doesn't supports this operation472 /// Target collection doesn't support this operation
428 UnsupportedOperation,473 UnsupportedOperation,
429474
430 /// Not sufficient funds to perform action475 /// Insufficient funds to perform an action
431 NotSufficientFounds,476 NotSufficientFounds,
432477
433 /// User not passed nesting rule478 /// User does not satisfy the nesting rule
434 UserIsNotAllowedToNest,479 UserIsNotAllowedToNest,
435 /// Only tokens from specific collections may nest tokens under this480 /// Only tokens from specific collections may nest tokens under this one
436 SourceCollectionIsNotAllowedToNest,481 SourceCollectionIsNotAllowedToNest,
437482
438 /// Tried to store more data than allowed in collection field483 /// Tried to store more data than allowed in collection field
447 /// Property key is too long492 /// Property key is too long
448 PropertyKeyIsTooLong,493 PropertyKeyIsTooLong,
449494
450 /// Only ASCII letters, digits, and '_', '-' are allowed495 /// Only ASCII letters, digits, and symbols '_', '-', and '.' are allowed
451 InvalidCharacterInPropertyKey,496 InvalidCharacterInPropertyKey,
452497
453 /// Empty property keys are forbidden498 /// Empty property keys are forbidden
460 CollectionIsInternal,505 CollectionIsInternal,
461 }506 }
462507
508 /// The number of created collections. Essentially contains the last collection ID.
463 #[pallet::storage]509 #[pallet::storage]
464 pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;510 pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;
511
512 /// The number of destroyed collections
465 #[pallet::storage]513 #[pallet::storage]
466 pub type DestroyedCollectionCount<T> =514 pub type DestroyedCollectionCount<T> =
467 StorageValue<Value = CollectionId, QueryKind = ValueQuery>;515 StorageValue<Value = CollectionId, QueryKind = ValueQuery>;
486 OnEmpty = up_data_structs::CollectionProperties,534 OnEmpty = up_data_structs::CollectionProperties,
487 >;535 >;
488536
537 /// Token permissions of a collection
489 #[pallet::storage]538 #[pallet::storage]
490 #[pallet::getter(fn property_permissions)]539 #[pallet::getter(fn property_permissions)]
491 pub type CollectionPropertyPermissions<T> = StorageMap<540 pub type CollectionPropertyPermissions<T> = StorageMap<
495 QueryKind = ValueQuery,544 QueryKind = ValueQuery,
496 >;545 >;
497546
547 /// Amount of collection admins
498 #[pallet::storage]548 #[pallet::storage]
499 pub type AdminAmount<T> = StorageMap<549 pub type AdminAmount<T> = StorageMap<
500 Hasher = Blake2_128Concat,550 Hasher = Blake2_128Concat,
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
44pub mod erc;44pub mod erc;
45pub mod weights;45pub mod weights;
4646
47/// todo:doc?
47pub type CreateItemData<T> = (<T as pallet_evm::account::Config>::CrossAccountId, u128);48pub type CreateItemData<T> = (<T as pallet_evm::account::Config>::CrossAccountId, u128);
48pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;49pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
4950
78 #[pallet::generate_store(pub(super) trait Store)]79 #[pallet::generate_store(pub(super) trait Store)]
79 pub struct Pallet<T>(_);80 pub struct Pallet<T>(_);
8081
82 /// Total amount of fungible tokens inside a collection.
81 #[pallet::storage]83 #[pallet::storage]
82 pub type TotalSupply<T: Config> =84 pub type TotalSupply<T: Config> =
83 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u128, QueryKind = ValueQuery>;85 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u128, QueryKind = ValueQuery>;
8486
87 /// Amount of tokens owned by an account inside a collection.
85 #[pallet::storage]88 #[pallet::storage]
86 pub type Balance<T: Config> = StorageNMap<89 pub type Balance<T: Config> = StorageNMap<
87 Key = (90 Key = (
92 QueryKind = ValueQuery,95 QueryKind = ValueQuery,
93 >;96 >;
9497
98 /// todo:doc
95 #[pallet::storage]99 #[pallet::storage]
96 pub type Allowance<T: Config> = StorageNMap<100 pub type Allowance<T: Config> = StorageNMap<
97 Key = (101 Key = (
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
56pub type CreateItemData<T> = CreateNftExData<<T as pallet_evm::account::Config>::CrossAccountId>;56pub type CreateItemData<T> = CreateNftExData<<T as pallet_evm::account::Config>::CrossAccountId>;
57pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;57pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
5858
59/// Token data, stored independently from other data used to describe it.
60/// Notably contains the owner account address.
59#[struct_versioning::versioned(version = 2, upper)]61#[struct_versioning::versioned(version = 2, upper)]
60#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]62#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]
61pub struct ItemData<CrossAccountId> {63pub struct ItemData<CrossAccountId> {
102 #[pallet::generate_store(pub(super) trait Store)]104 #[pallet::generate_store(pub(super) trait Store)]
103 pub struct Pallet<T>(_);105 pub struct Pallet<T>(_);
104106
107 /// Total amount of minted tokens in a collection.
105 #[pallet::storage]108 #[pallet::storage]
106 pub type TokensMinted<T: Config> =109 pub type TokensMinted<T: Config> =
107 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;110 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
111
112 /// Amount of burnt tokens in a collection.
108 #[pallet::storage]113 #[pallet::storage]
109 pub type TokensBurnt<T: Config> =114 pub type TokensBurnt<T: Config> =
110 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;115 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
111116
117 /// Token data, used to partially describe a token.
112 #[pallet::storage]118 #[pallet::storage]
113 pub type TokenData<T: Config> = StorageNMap<119 pub type TokenData<T: Config> = StorageNMap<
114 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),120 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
115 Value = ItemData<T::CrossAccountId>,121 Value = ItemData<T::CrossAccountId>,
116 QueryKind = OptionQuery,122 QueryKind = OptionQuery,
117 >;123 >;
118124
125 /// Key-value pairs, describing the metadata of a token.
119 #[pallet::storage]126 #[pallet::storage]
120 #[pallet::getter(fn token_properties)]127 #[pallet::getter(fn token_properties)]
121 pub type TokenProperties<T: Config> = StorageNMap<128 pub type TokenProperties<T: Config> = StorageNMap<
125 OnEmpty = up_data_structs::TokenProperties,132 OnEmpty = up_data_structs::TokenProperties,
126 >;133 >;
127134
135 /// Scoped, auxiliary properties of a token, primarily used for on-chain operations.
128 #[pallet::storage]136 #[pallet::storage]
129 #[pallet::getter(fn token_aux_property)]137 #[pallet::getter(fn token_aux_property)]
130 pub type TokenAuxProperties<T: Config> = StorageNMap<138 pub type TokenAuxProperties<T: Config> = StorageNMap<
138 QueryKind = OptionQuery,146 QueryKind = OptionQuery,
139 >;147 >;
140148
141 /// Used to enumerate tokens owned by account149 /// Used to enumerate tokens owned by account.
142 #[pallet::storage]150 #[pallet::storage]
143 pub type Owned<T: Config> = StorageNMap<151 pub type Owned<T: Config> = StorageNMap<
144 Key = (152 Key = (
150 QueryKind = ValueQuery,158 QueryKind = ValueQuery,
151 >;159 >;
152160
153 /// Used to enumerate token's children161 /// Used to enumerate token's children.
154 #[pallet::storage]162 #[pallet::storage]
155 #[pallet::getter(fn token_children)]163 #[pallet::getter(fn token_children)]
156 pub type TokenChildren<T: Config> = StorageNMap<164 pub type TokenChildren<T: Config> = StorageNMap<
163 QueryKind = ValueQuery,171 QueryKind = ValueQuery,
164 >;172 >;
165173
174 /// Amount of tokens owned in a collection.s
166 #[pallet::storage]175 #[pallet::storage]
167 pub type AccountBalance<T: Config> = StorageNMap<176 pub type AccountBalance<T: Config> = StorageNMap<
168 Key = (177 Key = (
173 QueryKind = ValueQuery,182 QueryKind = ValueQuery,
174 >;183 >;
175184
185 /// todo doc
176 #[pallet::storage]186 #[pallet::storage]
177 pub type Allowance<T: Config> = StorageNMap<187 pub type Allowance<T: Config> = StorageNMap<
178 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),188 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
179 Value = T::CrossAccountId,189 Value = T::CrossAccountId,
180 QueryKind = OptionQuery,190 QueryKind = OptionQuery,
181 >;191 >;
182192
193 /// Upgrade from the old schema to properties.
183 #[pallet::hooks]194 #[pallet::hooks]
184 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {195 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
185 fn on_runtime_upgrade() -> Weight {196 fn on_runtime_upgrade() -> Weight {
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
38pub mod weights;38pub mod weights;
39pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;39pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
4040
41/// Token data, stored independently from other data used to describe it.
42/// Notably contains the token metadata.
41#[struct_versioning::versioned(version = 2, upper)]43#[struct_versioning::versioned(version = 2, upper)]
42#[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]44#[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]
43pub struct ItemData {45pub struct ItemData {
86 #[pallet::generate_store(pub(super) trait Store)]88 #[pallet::generate_store(pub(super) trait Store)]
87 pub struct Pallet<T>(_);89 pub struct Pallet<T>(_);
8890
91 /// Total amount of minted tokens in a collection.
89 #[pallet::storage]92 #[pallet::storage]
90 pub type TokensMinted<T: Config> =93 pub type TokensMinted<T: Config> =
91 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;94 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
95
96 /// Amount of tokens burnt in a collection.
92 #[pallet::storage]97 #[pallet::storage]
93 pub type TokensBurnt<T: Config> =98 pub type TokensBurnt<T: Config> =
94 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;99 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
95100
101 /// Token data, used to partially describe a token.
96 #[pallet::storage]102 #[pallet::storage]
97 pub type TokenData<T: Config> = StorageNMap<103 pub type TokenData<T: Config> = StorageNMap<
98 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),104 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
99 Value = ItemData,105 Value = ItemData,
100 QueryKind = ValueQuery,106 QueryKind = ValueQuery,
101 >;107 >;
102108
109 /// Amount of pieces a refungible token is split into.
103 #[pallet::storage]110 #[pallet::storage]
104 pub type TotalSupply<T: Config> = StorageNMap<111 pub type TotalSupply<T: Config> = StorageNMap<
105 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),112 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
106 Value = u128,113 Value = u128,
107 QueryKind = ValueQuery,114 QueryKind = ValueQuery,
108 >;115 >;
109116
110 /// Used to enumerate tokens owned by account117 /// Used to enumerate tokens owned by account.
111 #[pallet::storage]118 #[pallet::storage]
112 pub type Owned<T: Config> = StorageNMap<119 pub type Owned<T: Config> = StorageNMap<
113 Key = (120 Key = (
119 QueryKind = ValueQuery,126 QueryKind = ValueQuery,
120 >;127 >;
121128
129 /// Amount of tokens (not pieces) partially owned by an account within a collection.
122 #[pallet::storage]130 #[pallet::storage]
123 pub type AccountBalance<T: Config> = StorageNMap<131 pub type AccountBalance<T: Config> = StorageNMap<
124 Key = (132 Key = (
130 QueryKind = ValueQuery,138 QueryKind = ValueQuery,
131 >;139 >;
132140
141 /// Amount of pieces of a token owned by an account.
133 #[pallet::storage]142 #[pallet::storage]
134 pub type Balance<T: Config> = StorageNMap<143 pub type Balance<T: Config> = StorageNMap<
135 Key = (144 Key = (
142 QueryKind = ValueQuery,151 QueryKind = ValueQuery,
143 >;152 >;
144153
154 /// todo:doc
145 #[pallet::storage]155 #[pallet::storage]
146 pub type Allowance<T: Config> = StorageNMap<156 pub type Allowance<T: Config> = StorageNMap<
147 Key = (157 Key = (
595 Ok(())605 Ok(())
596 }606 }
597607
608 /// todo:doc oh look, a precedent. not pub, too. but it has an unclear use-case.
598 /// Returns allowance, which should be set after transaction609 /// Returns allowance, which should be set after transaction
599 fn check_allowed(610 fn check_allowed(
600 collection: &RefungibleHandle<T>,611 collection: &RefungibleHandle<T>,
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
258258
259 /// A Scheduler-Runtime interface for finer payment handling.259 /// A Scheduler-Runtime interface for finer payment handling.
260 pub trait DispatchCall<T: frame_system::Config + Config, SelfContainedSignedInfo> {260 pub trait DispatchCall<T: frame_system::Config + Config, SelfContainedSignedInfo> {
261 /// Reserve the maximum spendings on a call.
261 fn reserve_balance(262 fn reserve_balance(
262 id: ScheduledId,263 id: ScheduledId,
263 sponsor: <T as frame_system::Config>::AccountId,264 sponsor: <T as frame_system::Config>::AccountId,
264 call: <T as Config>::Call,265 call: <T as Config>::Call,
265 count: u32,266 count: u32,
266 ) -> Result<(), DispatchError>;267 ) -> Result<(), DispatchError>;
267268
269 /// Pay for call dispatch (un-reserve) from the reserved funds, returning the change.
268 fn pay_for_call(270 fn pay_for_call(
269 id: ScheduledId,271 id: ScheduledId,
270 sponsor: <T as frame_system::Config>::AccountId,272 sponsor: <T as frame_system::Config>::AccountId,
280 TransactionValidityError,282 TransactionValidityError,
281 >;283 >;
282284
285 /// Release reserved funds.
283 fn cancel_reserve(286 fn cancel_reserve(
284 id: ScheduledId,287 id: ScheduledId,
285 sponsor: <T as frame_system::Config>::AccountId,288 sponsor: <T as frame_system::Config>::AccountId,
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
2525
26 #[pallet::error]26 #[pallet::error]
27 pub enum Error<T> {27 pub enum Error<T> {
28 /// While searched for owner, got already checked account28 /// While searching for the owner, encountered an already checked account, detecting a loop.
29 OuroborosDetected,29 OuroborosDetected,
30 /// While searched for owner, encountered depth limit30 /// While searching for the owner, reached the depth limit.
31 DepthLimit,31 DepthLimit,
32 /// While iterating over children, encountered breadth limit32 /// While iterating over children, reached the breadth limit.
33 BreadthLimit,33 BreadthLimit,
34 /// While searched for owner, found token owner by not-yet-existing token34 /// Couldn't find the token owner that is a token. Perhaps, it does not yet exist. todo:doc? rephrase?
35 TokenNotFound,35 TokenNotFound,
36 }36 }
3737
38 #[pallet::event]38 #[pallet::event]
39 pub enum Event<T> {39 pub enum Event<T> {
40 /// Executed call on behalf of token40 /// Executed call on behalf of the token.
41 Executed(DispatchResult),41 Executed(DispatchResult),
42 }42 }
4343
7373
74#[derive(PartialEq)]74#[derive(PartialEq)]
75pub enum Parent<CrossAccountId> {75pub enum Parent<CrossAccountId> {
76 /// Token owned by normal account76 /// Token owned by a normal account.
77 User(CrossAccountId),77 User(CrossAccountId),
78 /// Passed token not found78 /// Could not find the token provided as the owner.
79 TokenNotFound,79 TokenNotFound,
80 /// Token owner is another token (target token still may not exist)80 /// Token owner is another token (still, the target token may not exist).
81 Token(CollectionId, TokenId),81 Token(CollectionId, TokenId),
82}82}
8383
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
101 /// * admin: Admin address.101 /// * admin: Admin address.
102 CollectionAdminAdded(CollectionId, CrossAccountId),102 CollectionAdminAdded(CollectionId, CrossAccountId),
103103
104 /// Collection owned was change104 /// Collection owned was changed
105 ///105 ///
106 /// # Arguments106 /// # Arguments
107 ///107 ///
137 /// * admin: Admin address.137 /// * admin: Admin address.
138 CollectionAdminRemoved(CollectionId, CrossAccountId),138 CollectionAdminRemoved(CollectionId, CrossAccountId),
139139
140 /// Address was remove from allow list140 /// Address was removed from the allow list
141 ///141 ///
142 /// # Arguments142 /// # Arguments
143 ///143 ///
146 /// * user: Address.146 /// * user: Address.
147 AllowListAddressRemoved(CollectionId, CrossAccountId),147 AllowListAddressRemoved(CollectionId, CrossAccountId),
148148
149 /// Address was add to allow list149 /// Address was added to the allow list
150 ///150 ///
151 /// # Arguments151 /// # Arguments
152 ///152 ///
155 /// * user: Address.155 /// * user: Address.
156 AllowListAddressAdded(CollectionId, CrossAccountId),156 AllowListAddressAdded(CollectionId, CrossAccountId),
157157
158 /// Collection limits was set158 /// Collection limits were set
159 ///159 ///
160 /// # Arguments160 /// # Arguments
161 ///161 ///
162 /// * collection_id: Globally unique collection identifier.162 /// * collection_id: Globally unique collection identifier.
163 CollectionLimitSet(CollectionId),163 CollectionLimitSet(CollectionId),
164164
165 /// Collection permissions were set
166 ///
167 /// # Arguments
168 ///
169 /// * collection_id: Globally unique collection identifier.
165 CollectionPermissionSet(CollectionId),170 CollectionPermissionSet(CollectionId),
166 }171 }
167}172}
198 ChainVersion: u64;203 ChainVersion: u64;
199 //#endregion204 //#endregion
200205
201 //#region Tokens transfer rate limit baskets206 //#region Tokens transfer sponosoring rate limit baskets
202 /// (Collection id (controlled?2), who created (real))207 /// (Collection id (controlled?2), who created (real))
203 /// TODO: Off chain worker should remove from this map when collection gets removed208 /// TODO: Off chain worker should remove from this map when collection gets removed
204 pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => Option<T::BlockNumber>;209 pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => Option<T::BlockNumber>;
214 /// Collection id (controlled?2), token id (controlled?2)219 /// Collection id (controlled?2), token id (controlled?2)
215 #[deprecated]220 #[deprecated]
216 pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;221 pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
222 /// Last sponsoring of token property setting // todo:doc rephrase this and the following
217 pub TokenPropertyBasket get(fn token_property_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;223 pub TokenPropertyBasket get(fn token_property_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
218224
219 /// Approval sponsoring225 /// Last sponsoring of NFT approval in a collection
220 pub NftApproveBasket get(fn nft_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;226 pub NftApproveBasket get(fn nft_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
227 /// Last sponsoring of fungible tokens approval in a collection
221 pub FungibleApproveBasket get(fn fungible_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;228 pub FungibleApproveBasket get(fn fungible_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;
229 /// Last sponsoring of RFT approval in a collection
222 pub RefungibleApproveBasket get(fn refungible_approve_basket): nmap hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;230 pub RefungibleApproveBasket get(fn refungible_approve_basket): nmap hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;
223 }231 }
224}232}
278 Self::create_collection_ex(origin, data)286 Self::create_collection_ex(origin, data)
279 }287 }
280288
281 /// This method creates a collection289 /// Create a collection with explicit parameters.
290 /// Prefer it to the deprecated [`created_collection`] method.
282 ///291 ///
283 /// Prefer it to deprecated [`created_collection`] method292 /// # Permissions
293 ///
294 /// * Anyone.
295 ///
296 /// # Arguments
297 ///
298 /// * data: explicit create-collection data.
284 #[weight = <SelfWeightOf<T>>::create_collection()]299 #[weight = <SelfWeightOf<T>>::create_collection()]
285 #[transactional]300 #[transactional]
286 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {301 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {
293 Ok(())308 Ok(())
294 }309 }
295310
296 /// Destroys collection if no tokens within this collection311 /// Destroy the collection if no tokens exist within.
297 ///312 ///
298 /// # Permissions313 /// # Permissions
299 ///314 ///
300 /// * Collection Owner.315 /// * Collection Owner
301 ///316 ///
302 /// # Arguments317 /// # Arguments
303 ///318 ///
398 ///413 ///
399 /// # Permissions414 /// # Permissions
400 ///415 ///
401 /// * Collection Owner.416 /// * Collection Owner
402 ///417 ///
403 /// # Arguments418 /// # Arguments
404 ///419 ///
424 target_collection.save()439 target_collection.save()
425 }440 }
426441
427 /// Adds an admin of the Collection.442 /// Adds an admin of the collection.
428 /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.443 /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
429 ///444 ///
430 /// # Permissions445 /// # Permissions
431 ///446 ///
432 /// * Collection Owner.447 /// * Collection Owner
433 /// * Collection Admin.448 /// * Collection Admin
434 ///449 ///
435 /// # Arguments450 /// # Arguments
436 ///451 ///
437 /// * collection_id: ID of the Collection to add admin for.452 /// * collection_id: ID of the Collection to add admin for.
438 ///453 ///
439 /// * new_admin_id: Address of new admin to add.454 /// * new_admin: Address of new admin to add.
440 #[weight = <SelfWeightOf<T>>::add_collection_admin()]455 #[weight = <SelfWeightOf<T>>::add_collection_admin()]
441 #[transactional]456 #[transactional]
442 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {457 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin: T::CrossAccountId) -> DispatchResult {
443 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);458 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
444 let collection = <CollectionHandle<T>>::try_get(collection_id)?;459 let collection = <CollectionHandle<T>>::try_get(collection_id)?;
445 collection.check_is_internal()?;460 collection.check_is_internal()?;
446461
447 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(462 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(
448 collection_id,463 collection_id,
449 new_admin_id.clone()464 new_admin.clone()
450 ));465 ));
451466
452 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)467 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin, true)
453 }468 }
454469
455 /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.470 /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
456 ///471 ///
457 /// # Permissions472 /// # Permissions
458 ///473 ///
459 /// * Collection Owner.474 /// * Collection Owner
460 /// * Collection Admin.475 /// * Collection Admin
461 ///476 ///
462 /// # Arguments477 /// # Arguments
463 ///478 ///
479 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)494 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)
480 }495 }
481496
497 /// Set (invite) a new collection sponsor. If successful, confirmation from the sponsor-to-be will be pending.
498 ///
482 /// # Permissions499 /// # Permissions
483 ///500 ///
484 /// * Collection Owner501 /// * Collection Owner
502 /// * Collection Admin
485 ///503 ///
486 /// # Arguments504 /// # Arguments
487 ///505 ///
507 target_collection.save()525 target_collection.save()
508 }526 }
509527
528 /// Confirm own sponsorship of a collection.
529 ///
510 /// # Permissions530 /// # Permissions
511 ///531 ///
512 /// * Sponsor.532 /// * The sponsor to-be
513 ///533 ///
514 /// # Arguments534 /// # Arguments
515 ///535 ///
538 ///558 ///
539 /// # Permissions559 /// # Permissions
540 ///560 ///
541 /// * Collection owner.561 /// * Collection Owner
542 ///562 ///
543 /// # Arguments563 /// # Arguments
544 ///564 ///
560 target_collection.save()580 target_collection.save()
561 }581 }
562582
563 /// This method creates a concrete instance of NFT Collection created with CreateCollection method.583 /// Create a concrete instance of NFT Collection created with CreateCollection method.
564 ///584 ///
565 /// # Permissions585 /// # Permissions
566 ///586 ///
567 /// * Collection Owner.587 /// * Collection Owner
568 /// * Collection Admin.588 /// * Collection Admin
569 /// * Anyone if589 /// * Anyone if
570 /// * Allow List is enabled, and590 /// * Allow List is enabled, and
571 /// * Address is added to allow list, and591 /// * Address is added to allow list, and
587 dispatch_tx::<T, _>(collection_id, |d| d.create_item(sender, owner, data, &budget))607 dispatch_tx::<T, _>(collection_id, |d| d.create_item(sender, owner, data, &budget))
588 }608 }
589609
590 /// This method creates multiple items in a collection created with CreateCollection method.610 /// Create multiple items in a collection created with CreateCollection method.
591 ///611 ///
592 /// # Permissions612 /// # Permissions
593 ///613 ///
594 /// * Collection Owner.614 /// * Collection Owner
595 /// * Collection Admin.615 /// * Collection Admin
596 /// * Anyone if616 /// * Anyone if
597 /// * Allow List is enabled, and617 /// * Allow List is enabled, and
598 /// * Address is added to allow list, and618 /// * Address is added to allow list, and
615 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))635 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))
616 }636 }
617637
638 /// Add or change collection properties.
639 ///
640 /// # Permissions
641 ///
642 /// * Collection Owner
643 /// * Collection Admin
644 ///
645 /// # Arguments
646 ///
647 /// * collection_id.
648 ///
649 /// * properties: a vector of key-value pairs stored as the collection's metadata. Keys support Latin letters, '-', '_', and '.' as symbols.
618 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]650 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]
619 #[transactional]651 #[transactional]
620 pub fn set_collection_properties(652 pub fn set_collection_properties(
629 dispatch_tx::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))661 dispatch_tx::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))
630 }662 }
631663
664 /// Delete specified collection properties.
665 ///
666 /// # Permissions
667 ///
668 /// * Collection Owner
669 /// * Collection Admin
670 ///
671 /// # Arguments
672 ///
673 /// * collection_id.
674 ///
675 /// * property_keys: a vector of keys of the properties to be deleted.
632 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]676 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
633 #[transactional]677 #[transactional]
634 pub fn delete_collection_properties(678 pub fn delete_collection_properties(
643 dispatch_tx::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))687 dispatch_tx::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))
644 }688 }
645689
690 /// Add or change token properties according to collection's permissions.
691 ///
692 /// # Permissions
693 ///
694 /// * Depends on collection's token property permissions and specified property mutability:
695 /// * Collection Owner
696 /// * Collection Admin
697 /// * Token Owner
698 ///
699 /// # Arguments
700 ///
701 /// * collection_id.
702 ///
703 /// * token_id.
704 ///
705 /// * properties: a vector of key-value pairs stored as the token's metadata. Keys support Latin letters, '-', '_', and '.' as symbols.
646 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]706 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
647 #[transactional]707 #[transactional]
648 pub fn set_token_properties(708 pub fn set_token_properties(
659 dispatch_tx::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties, &budget))719 dispatch_tx::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties, &budget))
660 }720 }
661721
722 /// Delete specified token properties.
723 ///
724 /// # Permissions
725 ///
726 /// * Depends on collection's token property permissions and specified property mutability:
727 /// * Collection Owner
728 /// * Collection Admin
729 /// * Token Owner
730 ///
731 /// # Arguments
732 ///
733 /// * collection_id.
734 ///
735 /// * token_id.
736 ///
737 /// * property_keys: a vector of keys of the properties to be deleted.
662 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]738 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
663 #[transactional]739 #[transactional]
664 pub fn delete_token_properties(740 pub fn delete_token_properties(
675 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys, &budget))751 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys, &budget))
676 }752 }
677753
754 /// Add or change token property permissions of a collection.
755 ///
756 /// # Permissions
757 ///
758 /// * Collection Owner
759 /// * Collection Admin
760 ///
761 /// # Arguments
762 ///
763 /// * collection_id.
764 ///
765 /// * property_permissions: a vector of permissions for property keys. Keys support Latin letters, '-', '_', and '.' as symbols.
678 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]766 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
679 #[transactional]767 #[transactional]
680 pub fn set_token_property_permissions(768 pub fn set_token_property_permissions(
689 dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))777 dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))
690 }778 }
691779
780 /// Create multiple items inside a collection with explicitly specified initial parameters.
781 ///
782 /// # Permissions
783 ///
784 /// * Collection Owner
785 /// * Collection Admin
786 /// * Anyone if
787 /// * Allow List is enabled, and
788 /// * Address is added to allow list, and
789 /// * MintPermission is enabled (see SetMintPermission method)
790 ///
791 /// # Arguments
792 ///
793 /// * collection_id: ID of the collection.
794 ///
795 /// * data: explicit item creation data.
692 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]796 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
693 #[transactional]797 #[transactional]
694 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {798 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
698 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items_ex(sender, data, &budget))802 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items_ex(sender, data, &budget))
699 }803 }
700804
701 /// Set transfers_enabled value for particular collection805 /// Set transfers_enabled value for particular collection.
702 ///806 ///
703 /// # Permissions807 /// # Permissions
704 ///808 ///
705 /// * Collection Owner.809 /// * Collection Owner
706 ///810 ///
707 /// # Arguments811 /// # Arguments
708 ///812 ///
723 target_collection.save()827 target_collection.save()
724 }828 }
725829
726 /// Destroys a concrete instance of NFT.830 /// Destroy a concrete instance of NFT.
727 ///831 ///
728 /// # Permissions832 /// # Permissions
729 ///833 ///
730 /// * Collection Owner.834 /// * Collection Owner
731 /// * Collection Admin.835 /// * Collection Admin
732 /// * Current NFT Owner.836 /// * Current NFT Owner
733 ///837 ///
734 /// # Arguments838 /// # Arguments
735 ///839 ///
752 Ok(post_info)856 Ok(post_info)
753 }857 }
754858
755 /// Destroys a concrete instance of NFT on behalf of the owner859 /// Destroy a concrete instance of NFT on behalf of the owner.
756 /// See also: [`approve`]860 /// See also: [`approve`]
757 ///861 ///
758 /// # Permissions862 /// # Permissions
835 /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.939 /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
836 ///940 ///
837 /// # Permissions941 /// # Permissions
942 ///
838 /// * Collection Owner943 /// * Collection Owner
839 /// * Collection Admin944 /// * Collection Admin
840 /// * Current NFT owner945 /// * Current NFT owner
860 dispatch_tx::<T, _>(collection_id, |d| d.transfer_from(sender, from, recipient, item_id, value, &budget))965 dispatch_tx::<T, _>(collection_id, |d| d.transfer_from(sender, from, recipient, item_id, value, &budget))
861 }966 }
862967
968 /// Set specific limits of a collection. Empty, or None fields mean chain default.
969 ///.
970 /// # Permissions
971 ///
972 /// * Collection Owner
973 /// * Collection Admin
974 ///
975 /// # Arguments
976 ///
977 /// * collection_id.
978 ///
979 /// * new_limit: The new limits of the collection. They will overwrite the current ones.
863 #[weight = <SelfWeightOf<T>>::set_collection_limits()]980 #[weight = <SelfWeightOf<T>>::set_collection_limits()]
864 #[transactional]981 #[transactional]
865 pub fn set_collection_limits(982 pub fn set_collection_limits(
882 target_collection.save()999 target_collection.save()
883 }1000 }
8841001
1002 /// Set specific permissions of a collection. Empty, or None fields mean chain default.
1003 ///
1004 /// # Permissions
1005 ///
1006 /// * Collection Owner
1007 /// * Collection Admin
1008 ///
1009 /// # Arguments
1010 ///
1011 /// * collection_id.
1012 ///
1013 /// * new_permission: The new permissions of the collection. They will overwrite the current ones.
885 #[weight = <SelfWeightOf<T>>::set_collection_limits()]1014 #[weight = <SelfWeightOf<T>>::set_collection_limits()]
886 #[transactional]1015 #[transactional]
887 pub fn set_collection_permissions(1016 pub fn set_collection_permissions(
888 origin,1017 origin,
889 collection_id: CollectionId,1018 collection_id: CollectionId,
890 new_limit: CollectionPermissions,1019 new_permission: CollectionPermissions,
891 ) -> DispatchResult {1020 ) -> DispatchResult {
892 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1021 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
893 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1022 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
894 target_collection.check_is_internal()?;1023 target_collection.check_is_internal()?;
895 target_collection.check_is_owner_or_admin(&sender)?;1024 target_collection.check_is_owner_or_admin(&sender)?;
896 let old_limit = &target_collection.permissions;1025 let old_limit = &target_collection.permissions;
8971026
898 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_limit)?;1027 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_permission)?;
8991028
900 <Pallet<T>>::deposit_event(Event::<T>::CollectionPermissionSet(1029 <Pallet<T>>::deposit_event(Event::<T>::CollectionPermissionSet(
901 collection_id1030 collection_id
904 target_collection.save()1033 target_collection.save()
905 }1034 }
9061035
1036 /// Re-partition a refungible token, while owning all of its parts.
1037 ///
1038 /// # Permissions
1039 ///
1040 /// * Token Owner (must own every part)
1041 ///
1042 /// # Arguments
1043 ///
1044 /// * collection_id.
1045 ///
1046 /// * token: the ID of the RFT.
1047 ///
1048 /// * amount: The new number of parts into which the token shall be partitioned.
907 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]1049 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]
908 #[transactional]1050 #[transactional]
909 pub fn repartition(1051 pub fn repartition(
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
197#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]197#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
198pub enum CollectionMode {198pub enum CollectionMode {
199 NFT,199 NFT,
200 // decimal points
201 Fungible(DecimalPoints),200 Fungible(DecimalPoints),
202 ReFungible,201 ReFungible,
203}202}
252pub enum SponsorshipState<AccountId> {251pub enum SponsorshipState<AccountId> {
253 /// The fees are applied to the transaction sender252 /// The fees are applied to the transaction sender
254 Disabled,253 Disabled,
254 /// Pending confirmation from a sponsor-to-be
255 Unconfirmed(AccountId),255 Unconfirmed(AccountId),
256 /// Transactions are sponsored by specified account256 /// Transactions are sponsored by specified account
257 Confirmed(AccountId),257 Confirmed(AccountId),
258}258}
259259
260impl<AccountId> SponsorshipState<AccountId> {260impl<AccountId> SponsorshipState<AccountId> {
261 /// Get the acting sponsor account, if present
261 pub fn sponsor(&self) -> Option<&AccountId> {262 pub fn sponsor(&self) -> Option<&AccountId> {
262 match self {263 match self {
263 Self::Confirmed(sponsor) => Some(sponsor),264 Self::Confirmed(sponsor) => Some(sponsor),
264 _ => None,265 _ => None,
265 }266 }
266 }267 }
267268
269 /// Get the sponsor account currently pending confirmation, if present
268 pub fn pending_sponsor(&self) -> Option<&AccountId> {270 pub fn pending_sponsor(&self) -> Option<&AccountId> {
269 match self {271 match self {
270 Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),272 Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),
271 _ => None,273 _ => None,
272 }274 }
273 }275 }
274276
277 /// Is sponsorship set and acting
275 pub fn confirmed(&self) -> bool {278 pub fn confirmed(&self) -> bool {
276 matches!(self, Self::Confirmed(_))279 matches!(self, Self::Confirmed(_))
277 }280 }
283 }286 }
284}287}
285288
286/// Used in storage289/// Collection parameters, used in storage (see [`RpcCollection`] for the RPC version)
287#[struct_versioning::versioned(version = 2, upper)]290#[struct_versioning::versioned(version = 2, upper)]
288#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]291#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
289pub struct Collection<AccountId> {292pub struct Collection<AccountId> {
324 pub meta_update_permission: MetaUpdatePermission,327 pub meta_update_permission: MetaUpdatePermission,
325}328}
326329
327/// Used in RPC calls330/// Collection parameters, used in RPC calls (see [`Collection`] for the storage version)
328#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]331#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]
329#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]332#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
330pub struct RpcCollection<AccountId> {333pub struct RpcCollection<AccountId> {
362365
363pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;366pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
364367
368/// Limits and restrictions of a collection.
365/// All fields are wrapped in `Option`s, where None means chain default369/// All fields are wrapped in `Option`s, where None means chain default.
366// When adding/removing fields from this struct - don't forget to also update clamp_limits370// When adding/removing fields from this struct - don't forget to also update clamp_limits
367#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]371#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
368#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]372#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
369pub struct CollectionLimits {373pub struct CollectionLimits {
374 /// Maximum number of owned tokens per account
370 pub account_token_ownership_limit: Option<u32>,375 pub account_token_ownership_limit: Option<u32>,
376 /// Maximum size of data of a sponsored transaction
371 pub sponsored_data_size: Option<u32>,377 pub sponsored_data_size: Option<u32>,
372378
373 /// FIXME should we delete this or repurpose it?379 /// FIXME should we delete this or repurpose it?
374 /// None - setVariableMetadata is not sponsored380 /// None - setVariableMetadata is not sponsored
375 /// Some(v) - setVariableMetadata is sponsored381 /// Some(v) - setVariableMetadata is sponsored
376 /// if there is v block between txs382 /// if there is v block between txs
377 pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,383 pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,
384 /// Maximum amount of tokens inside the collection
378 pub token_limit: Option<u32>,385 pub token_limit: Option<u32>,
379386
380 // Timeouts for item types in passed blocks387 /// Timeout for sponsoring a token transfer in passed blocks
381 pub sponsor_transfer_timeout: Option<u32>,388 pub sponsor_transfer_timeout: Option<u32>,
389 /// Timeout for sponsoring an approval in passed blocks
382 pub sponsor_approve_timeout: Option<u32>,390 pub sponsor_approve_timeout: Option<u32>,
391 /// Can a token be transferred by the owner
383 pub owner_can_transfer: Option<bool>,392 pub owner_can_transfer: Option<bool>,
393 /// Can a token be burned by the owner
384 pub owner_can_destroy: Option<bool>,394 pub owner_can_destroy: Option<bool>,
395 /// Can a token be transferred at all
385 pub transfers_enabled: Option<bool>,396 pub transfers_enabled: Option<bool>,
386}397}
387398
509#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]520#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
510pub enum SponsoringRateLimit {521pub enum SponsoringRateLimit {
511 SponsoringDisabled,522 SponsoringDisabled,
523 /// Once per how many blocks can sponsorship of a transaction type occur
512 Blocks(u32),524 Blocks(u32),
513}525}
514526
515#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]527#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
516#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]528#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
517#[derivative(Debug)]529#[derivative(Debug)]
518pub struct CreateNftData {530pub struct CreateNftData {
531 /// Key-value pairs used to describe the token as metadata
519 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]532 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
520 #[derivative(Debug(format_with = "bounded::vec_debug"))]533 #[derivative(Debug(format_with = "bounded::vec_debug"))]
521 pub properties: CollectionPropertiesVec,534 pub properties: CollectionPropertiesVec,
524#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]537#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]
525#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]538#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
526pub struct CreateFungibleData {539pub struct CreateFungibleData {
540 /// Number of fungible tokens minted
527 pub value: u128,541 pub value: u128,
528}542}
529543
534 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]548 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
535 #[derivative(Debug(format_with = "bounded::vec_debug"))]549 #[derivative(Debug(format_with = "bounded::vec_debug"))]
536 pub const_data: BoundedVec<u8, CustomDataLimit>,550 pub const_data: BoundedVec<u8, CustomDataLimit>,
551 /// Number of pieces the RFT is split into
537 pub pieces: u128,552 pub pieces: u128,
538}553}
539554
553 ReFungible(CreateReFungibleData),568 ReFungible(CreateReFungibleData),
554}569}
555570
571/// Explicit NFT creation data with meta parameters
556#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]572#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
557#[derivative(Debug)]573#[derivative(Debug)]
558pub struct CreateNftExData<CrossAccountId> {574pub struct CreateNftExData<CrossAccountId> {
561 pub owner: CrossAccountId,577 pub owner: CrossAccountId,
562}578}
563579
580/// Explicit RFT creation data with meta parameters
564#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]581#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
565#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]582#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]
566pub struct CreateRefungibleExData<CrossAccountId> {583pub struct CreateRefungibleExData<CrossAccountId> {
570 pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,587 pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,
571}588}
572589
590/// Explicit item creation data with meta parameters, namely the owner
573#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]591#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
574#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]592#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]
575pub enum CreateItemExData<CrossAccountId> {593pub enum CreateItemExData<CrossAccountId> {
617 }635 }
618}636}
619637
638/// Token's address, dictated by its collection and token IDs
620#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]639#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
621#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]640#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
622// todo possibly rename to be used generally as an address pair641// todo possibly rename to be used generally as an address pair
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
43 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),43 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),
44 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),44 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),
4545
46 lastTokenId: fun('Get last token id', [collectionParam], 'u32'),46 lastTokenId: fun('Get last token ID created in a collection', [collectionParam], 'u32'),
47 totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),47 totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),
48 accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),48 accountBalance: fun('Get owned amount of any user tokens', [collectionParam, crossAccountParam()], 'u32'),
49 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),49 balance: fun('Get owned amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),
50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
52 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),52 topmostTokenOwner: fun('Get token owner, in case of nested token - find the parent recursively', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
53 tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),53 tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),
54 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),54 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
55 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),55 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
74 'UpDataStructsTokenData',74 'UpDataStructsTokenData',
75 ),75 ),
76 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),76 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
77 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),77 collectionById: fun('Get collection by specified ID', [collectionParam], 'Option<UpDataStructsRpcCollection>'),
78 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),78 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),
79 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),79 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
80 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),80 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),