difftreelog
Fix PR
in: master
3 files changed
primitives/data-structs/src/lib.rsdiffbeforeafterboth181pub 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}186186187pub struct OverflowError;187pub struct OverflowError;runtime/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)
tests/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>'),
},
};