git.delta.rocks / unique-network / refs/commits / e4d5f147c3c0

difftreelog

doc: clarifications to primitives and rpcs

Farhad Hakimov2022-07-15parent: #6fe077c.patch.diff
in: master

3 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 account45 /// Get tokens owned by account.
46 #[method(name = "unique_accountTokens")]46 #[method(name = "unique_accountTokens")]
47 fn account_tokens(47 fn account_tokens(
48 &self,48 &self,
51 at: Option<BlockHash>,51 at: Option<BlockHash>,
52 ) -> Result<Vec<TokenId>>;52 ) -> Result<Vec<TokenId>>;
5353
54 /// Get tokens contained in collection54 /// Get tokens contained within a collection.
55 #[method(name = "unique_collectionTokens")]55 #[method(name = "unique_collectionTokens")]
56 fn collection_tokens(56 fn collection_tokens(
57 &self,57 &self,
58 collection: CollectionId,58 collection: CollectionId,
59 at: Option<BlockHash>,59 at: Option<BlockHash>,
60 ) -> Result<Vec<TokenId>>;60 ) -> Result<Vec<TokenId>>;
6161
62 /// Check if token exists62 /// Check if the token exists.
63 #[method(name = "unique_tokenExists")]63 #[method(name = "unique_tokenExists")]
64 fn token_exists(64 fn token_exists(
65 &self,65 &self,
68 at: Option<BlockHash>,68 at: Option<BlockHash>,
69 ) -> Result<bool>;69 ) -> Result<bool>;
7070
71 /// Get token owner71 /// Get the token owner.
72 #[method(name = "unique_tokenOwner")]72 #[method(name = "unique_tokenOwner")]
73 fn token_owner(73 fn token_owner(
74 &self,74 &self,
77 at: Option<BlockHash>,77 at: Option<BlockHash>,
78 ) -> Result<Option<CrossAccountId>>;78 ) -> Result<Option<CrossAccountId>>;
7979
80 /// Get token owner, in case of nested token - find the parent recursively80 /// Get the topmost token owner in the hierarchy of a possibly nested token.
81 #[method(name = "unique_topmostTokenOwner")]81 #[method(name = "unique_topmostTokenOwner")]
82 fn topmost_token_owner(82 fn topmost_token_owner(
83 &self,83 &self,
86 at: Option<BlockHash>,86 at: Option<BlockHash>,
87 ) -> Result<Option<CrossAccountId>>;87 ) -> Result<Option<CrossAccountId>>;
8888
89 /// Get tokens nested directly into the token89 /// Get tokens nested directly into the token.
90 #[method(name = "unique_tokenChildren")]90 #[method(name = "unique_tokenChildren")]
91 fn token_children(91 fn token_children(
92 &self,92 &self,
95 at: Option<BlockHash>,95 at: Option<BlockHash>,
96 ) -> Result<Vec<TokenChild>>;96 ) -> Result<Vec<TokenChild>>;
9797
98 /// Get collection properties98 /// Get collection properties, optionally limited to the provided keys.
99 #[method(name = "unique_collectionProperties")]99 #[method(name = "unique_collectionProperties")]
100 fn collection_properties(100 fn collection_properties(
101 &self,101 &self,
104 at: Option<BlockHash>,104 at: Option<BlockHash>,
105 ) -> Result<Vec<Property>>;105 ) -> Result<Vec<Property>>;
106106
107 /// Get token properties107 /// Get token properties, optionally limited to the provided keys.
108 #[method(name = "unique_tokenProperties")]108 #[method(name = "unique_tokenProperties")]
109 fn token_properties(109 fn token_properties(
110 &self,110 &self,
114 at: Option<BlockHash>,114 at: Option<BlockHash>,
115 ) -> Result<Vec<Property>>;115 ) -> Result<Vec<Property>>;
116116
117 /// Get property permissions117 /// Get property permissions, optionally limited to the provided keys.
118 #[method(name = "unique_propertyPermissions")]118 #[method(name = "unique_propertyPermissions")]
119 fn property_permissions(119 fn property_permissions(
120 &self,120 &self,
123 at: Option<BlockHash>,123 at: Option<BlockHash>,
124 ) -> Result<Vec<PropertyKeyPermission>>;124 ) -> Result<Vec<PropertyKeyPermission>>;
125125
126 /// Get token data126 /// Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT.
127 #[method(name = "unique_tokenData")]127 #[method(name = "unique_tokenData")]
128 fn token_data(128 fn token_data(
129 &self,129 &self,
133 at: Option<BlockHash>,133 at: Option<BlockHash>,
134 ) -> Result<TokenData<CrossAccountId>>;134 ) -> Result<TokenData<CrossAccountId>>;
135135
136 /// Get amount of unique collection tokens136 /// Get the amount of distinctive tokens present in a collection.
137 #[method(name = "unique_totalSupply")]137 #[method(name = "unique_totalSupply")]
138 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;138 fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;
139139
140 /// Get owned amount of any user tokens140 /// Get the amount of any user tokens owned by an account.
141 #[method(name = "unique_accountBalance")]141 #[method(name = "unique_accountBalance")]
142 fn account_balance(142 fn account_balance(
143 &self,143 &self,
146 at: Option<BlockHash>,146 at: Option<BlockHash>,
147 ) -> Result<u32>;147 ) -> Result<u32>;
148148
149 /// Get owned amount of specific account token149 /// Get the amount of a specific token owned by an account.
150 #[method(name = "unique_balance")]150 #[method(name = "unique_balance")]
151 fn balance(151 fn balance(
152 &self,152 &self,
156 at: Option<BlockHash>,156 at: Option<BlockHash>,
157 ) -> Result<String>;157 ) -> Result<String>;
158158
159 /// Get allowed amount159 /// Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor.
160 #[method(name = "unique_allowance")]160 #[method(name = "unique_allowance")]
161 fn allowance(161 fn allowance(
162 &self,162 &self,
167 at: Option<BlockHash>,167 at: Option<BlockHash>,
168 ) -> Result<String>;168 ) -> Result<String>;
169169
170 /// Get admin list170 /// Get the list of admin accounts of a collection.
171 #[method(name = "unique_adminlist")]171 #[method(name = "unique_adminlist")]
172 fn adminlist(172 fn adminlist(
173 &self,173 &self,
174 collection: CollectionId,174 collection: CollectionId,
175 at: Option<BlockHash>,175 at: Option<BlockHash>,
176 ) -> Result<Vec<CrossAccountId>>;176 ) -> Result<Vec<CrossAccountId>>;
177177
178 /// Get allowlist178 /// Get the list of accounts allowed to operate within a collection.
179 #[method(name = "unique_allowlist")]179 #[method(name = "unique_allowlist")]
180 fn allowlist(180 fn allowlist(
181 &self,181 &self,
182 collection: CollectionId,182 collection: CollectionId,
183 at: Option<BlockHash>,183 at: Option<BlockHash>,
184 ) -> Result<Vec<CrossAccountId>>;184 ) -> Result<Vec<CrossAccountId>>;
185185
186 /// Check if user is allowed to use collection186 /// Check if a user is allowed to operate within a collection.
187 #[method(name = "unique_allowed")]187 #[method(name = "unique_allowed")]
188 fn allowed(188 fn allowed(
189 &self,189 &self,
192 at: Option<BlockHash>,192 at: Option<BlockHash>,
193 ) -> Result<bool>;193 ) -> Result<bool>;
194194
195 /// Get last token ID created in a collection195 /// Get the last token ID created in a collection.
196 #[method(name = "unique_lastTokenId")]196 #[method(name = "unique_lastTokenId")]
197 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;197 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
198198
199 /// Get collection by specified ID199 /// Get collection info by the specified ID.
200 #[method(name = "unique_collectionById")]200 #[method(name = "unique_collectionById")]
201 fn collection_by_id(201 fn collection_by_id(
202 &self,202 &self,
203 collection: CollectionId,203 collection: CollectionId,
204 at: Option<BlockHash>,204 at: Option<BlockHash>,
205 ) -> Result<Option<RpcCollection<AccountId>>>;205 ) -> Result<Option<RpcCollection<AccountId>>>;
206206
207 /// Get collection stats207 /// Get chain stats about collections.
208 #[method(name = "unique_collectionStats")]208 #[method(name = "unique_collectionStats")]
209 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;209 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
210210
211 /// Get number of blocks when sponsored transaction is available211 /// Get the number of blocks until sponsoring a transaction is available.
212 #[method(name = "unique_nextSponsored")]212 #[method(name = "unique_nextSponsored")]
213 fn next_sponsored(213 fn next_sponsored(
214 &self,214 &self,
218 at: Option<BlockHash>,218 at: Option<BlockHash>,
219 ) -> Result<Option<u64>>;219 ) -> Result<Option<u64>>;
220220
221 /// Get effective collection limits221 /// Get effective collection limits. If not explicitly set, get the chain defaults.
222 #[method(name = "unique_effectiveCollectionLimits")]222 #[method(name = "unique_effectiveCollectionLimits")]
223 fn effective_collection_limits(223 fn effective_collection_limits(
224 &self,224 &self,
225 collection_id: CollectionId,225 collection_id: CollectionId,
226 at: Option<BlockHash>,226 at: Option<BlockHash>,
227 ) -> Result<Option<CollectionLimits>>;227 ) -> Result<Option<CollectionLimits>>;
228228
229 /// Get total pieces of token229 /// Get the total amount of pieces of an RFT.
230 #[method(name = "unique_totalPieces")]230 #[method(name = "unique_totalPieces")]
231 fn total_pieces(231 fn total_pieces(
232 &self,232 &self,
253 Theme,253 Theme,
254 >254 >
255 {255 {
256 /// Get the latest created collection ID.
256 #[method(name = "rmrk_lastCollectionIdx")]257 #[method(name = "rmrk_lastCollectionIdx")]
257 /// Get the latest created collection id
258 fn last_collection_idx(&self, at: Option<BlockHash>) -> Result<RmrkCollectionId>;258 fn last_collection_idx(&self, at: Option<BlockHash>) -> Result<RmrkCollectionId>;
259259
260 /// Get collection info by ID.
260 #[method(name = "rmrk_collectionById")]261 #[method(name = "rmrk_collectionById")]
261 /// Get collection by id
262 fn collection_by_id(262 fn collection_by_id(
263 &self,263 &self,
264 id: RmrkCollectionId,264 id: RmrkCollectionId,
265 at: Option<BlockHash>,265 at: Option<BlockHash>,
266 ) -> Result<Option<CollectionInfo>>;266 ) -> Result<Option<CollectionInfo>>;
267267
268 /// Get NFT info by collection and NFT IDs.
268 #[method(name = "rmrk_nftById")]269 #[method(name = "rmrk_nftById")]
269 /// Get NFT by collection id and NFT id
270 fn nft_by_id(270 fn nft_by_id(
271 &self,271 &self,
272 collection_id: RmrkCollectionId,272 collection_id: RmrkCollectionId,
273 nft_id: RmrkNftId,273 nft_id: RmrkNftId,
274 at: Option<BlockHash>,274 at: Option<BlockHash>,
275 ) -> Result<Option<NftInfo>>;275 ) -> Result<Option<NftInfo>>;
276276
277 /// Get tokens owned by an account in a collection.
277 #[method(name = "rmrk_accountTokens")]278 #[method(name = "rmrk_accountTokens")]
278 /// Get tokens owned by an account in a collection
279 fn account_tokens(279 fn account_tokens(
280 &self,280 &self,
281 account_id: AccountId,281 account_id: AccountId,
282 collection_id: RmrkCollectionId,282 collection_id: RmrkCollectionId,
283 at: Option<BlockHash>,283 at: Option<BlockHash>,
284 ) -> Result<Vec<RmrkNftId>>;284 ) -> Result<Vec<RmrkNftId>>;
285285
286 /// Get tokens nested in an NFT - its direct children (not the children's children).
286 #[method(name = "rmrk_nftChildren")]287 #[method(name = "rmrk_nftChildren")]
287 /// Get NFT children
288 fn nft_children(288 fn nft_children(
289 &self,289 &self,
290 collection_id: RmrkCollectionId,290 collection_id: RmrkCollectionId,
291 nft_id: RmrkNftId,291 nft_id: RmrkNftId,
292 at: Option<BlockHash>,292 at: Option<BlockHash>,
293 ) -> Result<Vec<RmrkNftChild>>;293 ) -> Result<Vec<RmrkNftChild>>;
294294
295 /// Get collection properties, created by the user - not the proxy-specific properties.
295 #[method(name = "rmrk_collectionProperties")]296 #[method(name = "rmrk_collectionProperties")]
296 /// Get collection properties
297 fn collection_properties(297 fn collection_properties(
298 &self,298 &self,
299 collection_id: RmrkCollectionId,299 collection_id: RmrkCollectionId,
300 filter_keys: Option<Vec<String>>,300 filter_keys: Option<Vec<String>>,
301 at: Option<BlockHash>,301 at: Option<BlockHash>,
302 ) -> Result<Vec<PropertyInfo>>;302 ) -> Result<Vec<PropertyInfo>>;
303303
304 /// Get NFT properties, created by the user - not the proxy-specific properties.
304 #[method(name = "rmrk_nftProperties")]305 #[method(name = "rmrk_nftProperties")]
305 /// Get NFT properties
306 fn nft_properties(306 fn nft_properties(
307 &self,307 &self,
308 collection_id: RmrkCollectionId,308 collection_id: RmrkCollectionId,
311 at: Option<BlockHash>,311 at: Option<BlockHash>,
312 ) -> Result<Vec<PropertyInfo>>;312 ) -> Result<Vec<PropertyInfo>>;
313313
314 /// Get data of resources of an NFT.
314 #[method(name = "rmrk_nftResources")]315 #[method(name = "rmrk_nftResources")]
315 /// Get NFT resources
316 fn nft_resources(316 fn nft_resources(
317 &self,317 &self,
318 collection_id: RmrkCollectionId,318 collection_id: RmrkCollectionId,
319 nft_id: RmrkNftId,319 nft_id: RmrkNftId,
320 at: Option<BlockHash>,320 at: Option<BlockHash>,
321 ) -> Result<Vec<ResourceInfo>>;321 ) -> Result<Vec<ResourceInfo>>;
322322
323 /// Get the priority of a resource in an NFT.
323 #[method(name = "rmrk_nftResourcePriority")]324 #[method(name = "rmrk_nftResourcePriority")]
324 /// Get NFT resource priority
325 fn nft_resource_priority(325 fn nft_resource_priority(
326 &self,326 &self,
327 collection_id: RmrkCollectionId,327 collection_id: RmrkCollectionId,
330 at: Option<BlockHash>,330 at: Option<BlockHash>,
331 ) -> Result<Option<u32>>;331 ) -> Result<Option<u32>>;
332332
333 /// Get base info by its ID.
333 #[method(name = "rmrk_base")]334 #[method(name = "rmrk_base")]
334 /// Get base info
335 fn base(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Option<BaseInfo>>;335 fn base(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Option<BaseInfo>>;
336336
337 /// Get all parts of a base.
337 #[method(name = "rmrk_baseParts")]338 #[method(name = "rmrk_baseParts")]
338 /// Get all Base's parts
339 fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;339 fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;
340340
341 /// Get the theme names belonging to a base.
341 #[method(name = "rmrk_themeNames")]342 #[method(name = "rmrk_themeNames")]
342 /// Get Base's theme names
343 fn theme_names(343 fn theme_names(
344 &self,344 &self,
345 base_id: RmrkBaseId,345 base_id: RmrkBaseId,
346 at: Option<BlockHash>,346 at: Option<BlockHash>,
347 ) -> Result<Vec<RmrkThemeName>>;347 ) -> Result<Vec<RmrkThemeName>>;
348348
349 /// Get theme info, including properties, optionally limited to the provided keys.
349 #[method(name = "rmrk_themes")]350 #[method(name = "rmrk_themes")]
350 /// Get Theme info -- name, properties, and inherit flag
351 fn theme(351 fn theme(
352 &self,352 &self,
353 base_id: RmrkBaseId,353 base_id: RmrkBaseId,
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
367367
368/// Limits and restrictions of a collection.368/// Limits and restrictions of a collection.
369/// All fields are wrapped in `Option`s, where None means chain default.369/// All fields are wrapped in `Option`s, where None means chain default.
370///
371/// todo:doc links to chain defaults
370// When adding/removing fields from this struct - don't forget to also update clamp_limits372// IMPORTANT: When adding/removing fields from this struct - don't forget to also
373// update clamp_limits() in pallet-common.
371#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]374#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
372#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]375#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
373pub struct CollectionLimits {376pub struct CollectionLimits {
374 /// Maximum number of owned tokens per account377 /// Maximum number of owned tokens per account. Chain default: [`ACCOUNT_TOKEN_OWNERSHIP_LIMIT`]
375 pub account_token_ownership_limit: Option<u32>,378 pub account_token_ownership_limit: Option<u32>,
376 /// Maximum size of data of a sponsored transaction379 /// Maximum size of data in bytes of a sponsored transaction. Chain default: [`CUSTOM_DATA_LIMIT`]
377 pub sponsored_data_size: Option<u32>,380 pub sponsored_data_size: Option<u32>,
378381
379 /// FIXME should we delete this or repurpose it?382 /// FIXME should we delete this or repurpose it?
380 /// None - setVariableMetadata is not sponsored383 /// None - setVariableMetadata is not sponsored
381 /// Some(v) - setVariableMetadata is sponsored384 /// Some(v) - setVariableMetadata is sponsored
382 /// if there is v block between txs385 /// if there is v block between txs
386 ///
387 /// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
383 pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,388 pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,
384 /// Maximum amount of tokens inside the collection389 /// Maximum amount of tokens inside the collection. Chain default: [`COLLECTION_TOKEN_LIMIT`]
385 pub token_limit: Option<u32>,390 pub token_limit: Option<u32>,
386391
387 /// Timeout for sponsoring a token transfer in passed blocks392 /// Timeout for sponsoring a token transfer in passed blocks. Chain default: [`MAX_SPONSOR_TIMEOUT`]
388 pub sponsor_transfer_timeout: Option<u32>,393 pub sponsor_transfer_timeout: Option<u32>,
389 /// Timeout for sponsoring an approval in passed blocks394 /// Timeout for sponsoring an approval in passed blocks. Chain default: [`SPONSOR_APPROVE_TIMEOUT`]
390 pub sponsor_approve_timeout: Option<u32>,395 pub sponsor_approve_timeout: Option<u32>,
391 /// Can a token be transferred by the owner396 /// Can a token be transferred by the owner. Chain default: `false`
392 pub owner_can_transfer: Option<bool>,397 pub owner_can_transfer: Option<bool>,
393 /// Can a token be burned by the owner398 /// Can a token be burned by the owner. Chain default: `true`
394 pub owner_can_destroy: Option<bool>,399 pub owner_can_destroy: Option<bool>,
395 /// Can a token be transferred at all400 /// Can a token be transferred at all. Chain default: `true`
396 pub transfers_enabled: Option<bool>,401 pub transfers_enabled: Option<bool>,
397}402}
398403
445 }450 }
446}451}
447452
448// When adding/removing fields from this struct - don't forget to also update clamp_limits453/// Permissions on certain operations within a collection.
454/// All fields are wrapped in `Option`s, where None means chain default.
455// IMPORTANT: When adding/removing fields from this struct - don't forget to also
456// update clamp_limits() in pallet-common.
449#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]457#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
450#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]458#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
451pub struct CollectionPermissions {459pub struct CollectionPermissions {
500 }508 }
501}509}
502510
511/// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.
503#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]512#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]
504#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]513#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
505#[derivative(Debug)]514#[derivative(Debug)]
516 pub permissive: bool,525 pub permissive: bool,
517}526}
518527
528/// Enum denominating how often can sponsoring occur if it is enabled.
519#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]529#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]
520#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]530#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
521pub enum SponsoringRateLimit {531pub enum SponsoringRateLimit {
532 /// Sponsoring is disabled, and the collection sponsor will not pay for transactions
522 SponsoringDisabled,533 SponsoringDisabled,
523 /// Once per how many blocks can sponsorship of a transaction type occur534 /// Once per how many blocks can sponsorship of a transaction type occur
524 Blocks(u32),535 Blocks(u32),
525}536}
526537
538/// Data used to describe an NFT at creation.
527#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]539#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
528#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]540#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
529#[derivative(Debug)]541#[derivative(Debug)]
534 pub properties: CollectionPropertiesVec,546 pub properties: CollectionPropertiesVec,
535}547}
536548
549/// Data used to describe a Fungible token at creation.
537#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]550#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]
538#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]551#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
539pub struct CreateFungibleData {552pub struct CreateFungibleData {
540 /// Number of fungible tokens minted553 /// Number of fungible coins minted
541 pub value: u128,554 pub value: u128,
542}555}
543556
557/// Data used to describe a Refungible token at creation.
544#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]558#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
545#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]559#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
546#[derivative(Debug)]560#[derivative(Debug)]
547pub struct CreateReFungibleData {561pub struct CreateReFungibleData {
562 /// Immutable metadata of the token
548 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]563 #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
549 #[derivative(Debug(format_with = "bounded::vec_debug"))]564 #[derivative(Debug(format_with = "bounded::vec_debug"))]
550 pub const_data: BoundedVec<u8, CustomDataLimit>,565 pub const_data: BoundedVec<u8, CustomDataLimit>,
560 None,575 None,
561}576}
562577
578/// Enum holding data used for creation of all three item types.
563#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]579#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
564#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]580#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
565pub enum CreateItemData {581pub enum CreateItemData {
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
37export default {37export default {
38 types: {},38 types: {},
39 rpc: {39 rpc: {
40 adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
41 allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
42
43 accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),40 accountTokens: fun(
41 'Get tokens owned by an account in a collection',
42 [collectionParam, crossAccountParam()],
43 'Vec<u32>',
44 ),
44 collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),45 collectionTokens: fun(
4546 'Get tokens contained within a collection',
47 [collectionParam],
48 'Vec<u32>',
49 ),
46 lastTokenId: fun('Get last token ID created in a collection', [collectionParam], 'u32'),50 tokenExists: fun(
51 'Check if the token exists',
52 [collectionParam, tokenParam],
53 'bool',
54 ),
55
47 totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),56 tokenOwner: fun(
57 'Get the token owner',
58 [collectionParam, tokenParam],
59 `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
60 ),
48 accountBalance: fun('Get owned amount of any user tokens', [collectionParam, crossAccountParam()], 'u32'),61 topmostTokenOwner: fun(
62 'Get the topmost token owner in the hierarchy of a possibly nested token',
63 [collectionParam, tokenParam],
64 `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
65 ),
49 balance: fun('Get owned amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),66 tokenChildren: fun(
67 'Get tokens nested directly into the token',
68 [collectionParam, tokenParam],
69 'Vec<UpDataStructsTokenChild>',
70 ),
71
50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),72 collectionProperties: fun(
73 'Get collection properties, optionally limited to the provided keys',
74 [collectionParam, propertyKeysParam],
75 'Vec<UpDataStructsProperty>',
76 ),
51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),77 tokenProperties: fun(
78 'Get token properties, optionally limited to the provided keys',
79 [collectionParam, tokenParam, propertyKeysParam],
80 'Vec<UpDataStructsProperty>',
81 ),
52 topmostTokenOwner: fun('Get token owner, in case of nested token - find the parent recursively', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),82 propertyPermissions: fun(
83 'Get property permissions, optionally limited to the provided keys',
84 [collectionParam, propertyKeysParam],
85 'Vec<UpDataStructsPropertyKeyPermission>',
86 ),
87
53 tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),88 tokenData: fun(
89 'Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT',
90 [collectionParam, tokenParam, propertyKeysParam],
91 'UpDataStructsTokenData',
92 ),
54 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),93 totalSupply: fun(
94 'Get the amount of distinctive tokens present in a collection',
95 [collectionParam],
96 'u32',
97 ),
98
55 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),99 accountBalance: fun(
100 'Get the amount of any user tokens owned by an account',
101 [collectionParam, crossAccountParam()],
102 'u32',
103 ),
56 collectionProperties: fun(104 balance: fun(
57 'Get collection properties',105 'Get the amount of a specific token owned by an account',
58 [collectionParam, propertyKeysParam],106 [collectionParam, crossAccountParam(), tokenParam],
59 'Vec<UpDataStructsProperty>',107 'u128',
60 ),108 ),
61 tokenProperties: fun(109 allowance: fun(
62 'Get token properties',110 'Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor',
63 [collectionParam, tokenParam, propertyKeysParam],111 [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam],
64 'Vec<UpDataStructsProperty>',112 'u128',
65 ),113 ),
114
66 propertyPermissions: fun(115 adminlist: fun(
67 'Get property permissions',116 'Get the list of admin accounts of a collection',
68 [collectionParam, propertyKeysParam],117 [collectionParam],
69 'Vec<UpDataStructsPropertyKeyPermission>',118 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
70 ),119 ),
71 tokenData: fun(120 allowlist: fun(
72 'Get token data',121 'Get the list of accounts allowed to operate within a collection',
73 [collectionParam, tokenParam, propertyKeysParam],122 [collectionParam],
74 'UpDataStructsTokenData',123 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
75 ),124 ),
76 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),125 allowed: fun(
126 'Check if a user is allowed to operate within a collection',
127 [collectionParam, crossAccountParam()],
128 'bool',
129 ),
130
77 collectionById: fun('Get collection by specified ID', [collectionParam], 'Option<UpDataStructsRpcCollection>'),131 lastTokenId: fun('Get the last token ID created in a collection', [collectionParam], 'u32'),
78 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),132 collectionById: fun(
133 'Get a collection by the specified ID',
134 [collectionParam],
135 'Option<UpDataStructsRpcCollection>',
136 ),
79 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),137 collectionStats: fun(
138 'Get chain stats about collections',
139 [],
140 'UpDataStructsCollectionStats',
141 ),
142
80 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),143 nextSponsored: fun(
144 'Get the number of blocks until sponsoring a transaction is available',
145 [collectionParam, crossAccountParam(), tokenParam],
146 'Option<u64>',
147 ),
81 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),148 effectiveCollectionLimits: fun(
149 'Get effective collection limits',
150 [collectionParam],
151 'Option<UpDataStructsCollectionLimits>',
152 ),
82 totalPieces: fun('Get total pieces of token', [collectionParam, tokenParam], 'Option<u128>'),153 totalPieces: fun(
154 'Get the total amount of pieces of an RFT',
155 [collectionParam, tokenParam],
156 'Option<u128>',
157 ),
83 },158 },
84};159};