Skip to content

Commit

Permalink
better wording and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Jun 3, 2021
1 parent ac11b00 commit 29948b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 9 additions & 2 deletions core/tests/ts-tests/tests/mint-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,15 @@ Tester.prototype.testGetNFT = async function (wallet: Wallet, feeToken: TokenLik
this.runningFee = this.runningFee.add(fee);
const state = await wallet.getAccountState();
const nft = Object.values(state.committed.nfts)[0];
const nft1 = await wallet.provider.getNFT(nft.id);
expect(nft1).eq(null, 'NFT does not exist yet');

let wasException = false;
try {
await wallet.provider.getNFT(nft.id);
} catch {
wasException = true;
}
expect(wasException).to.eq(true, 'NFT does not exist yet');

await handle.awaitVerifyReceipt();
const nft2 = await wallet.provider.getNFT(nft.id);
expect(nft2.id).eq(nft.id);
Expand Down
7 changes: 2 additions & 5 deletions sdk/zksync.js/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,8 @@ export class Provider {
const nft = await this.transport.request('get_nft', [id]);

// If the NFT does not exist, throw an exception
if (!nft) {
throw new Error(
'Requested NFT not found. Tip: mintNFT operation must be verified ' +
'before the token can be transfered.'
);
if (nft == null) {
throw new Error(`Requested NFT doesn't exist or the corresponding mintNFT operation is not verified yet`);
}

return nft;
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15093,7 +15093,7 @@ yocto-queue@^0.1.0:
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

"zksync@link:sdk/zksync.js":
version "0.11.0-beta.0"
version "0.11.0-beta.6"
dependencies:
axios "^0.21.1"
websocket "^1.0.30"
Expand Down

0 comments on commit 29948b9

Please sign in to comment.