git.delta.rocks / unique-network / refs/commits / 83275847f907

difftreelog

Fix PR

Trubnikov Sergey2022-07-01parent: #63e242d.patch.diff
in: master

3 files changed

modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
181pub struct TokenData<CrossAccountId> {181pub struct TokenData<CrossAccountId> {
182 pub properties: Vec<Property>,182 pub properties: Vec<Property>,
183 pub owner: Option<CrossAccountId>,183 pub owner: Option<CrossAccountId>,
184 pub pieces: Option<u128>,184 pub pieces: u128,
185}185}
186186
187pub struct OverflowError;187pub struct OverflowError;
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -90,7 +90,7 @@
                     let token_data = TokenData {
                         properties: Self::token_properties(collection, token_id, keys)?,
                         owner: Self::token_owner(collection, token_id)?,
-                        pieces: Self::total_pieces(collection, token_id)?
+                        pieces: Self::total_pieces(collection, token_id)?.expect("Token pieces always must have some value"),
                     };
 
                     Ok(token_data)
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -79,5 +79,6 @@
     allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
     nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),
     effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),
+    totalPieces: fun('Get total pieces of token', [collectionParam, tokenParam], 'Option<u128>'),
   },
 };