Skip to content

Commit 2d2a945

Browse files
committed
fix: consumedSpace fallback
1 parent 351fb31 commit 2d2a945

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/src/util/playgrounds/unique.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3119,9 +3119,9 @@ export class UniqueNFTCollection extends UniqueBaseCollection {
31193119

31203120
async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
31213121
const api = this.helper.getApi();
3122-
const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON();
3122+
const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
31233123

3124-
return (props != null) ? (props as any).consumedSpace : 0;
3124+
return props?.consumedSpace ?? 0;
31253125
}
31263126

31273127
async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {
@@ -3224,9 +3224,9 @@ export class UniqueRFTCollection extends UniqueBaseCollection {
32243224

32253225
async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
32263226
const api = this.helper.getApi();
3227-
const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON();
3227+
const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
32283228

3229-
return (props != null) ? (props as any).consumedSpace : 0;
3229+
return props?.consumedSpace ?? 0;
32303230
}
32313231

32323232
async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {

0 commit comments

Comments
 (0)