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

difftreelog

fix consumedSpace fallback

Daniel Shiposha2023-10-12parent: #5464b28.patch.diff
in: master

1 file changed

modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
31193119
3120 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3120 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
3121 const api = this.helper.getApi();3121 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;
3125 }3125 }
31263126
3127 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {3127 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {
32243224
3225 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3225 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
3226 const api = this.helper.getApi();3226 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;
3230 }3230 }
32313231
3232 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {3232 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {