From 9189201dafd95e60bae21bbb382296a0e99f11cf Mon Sep 17 00:00:00 2001 From: Ankur Jain Date: Tue, 25 Jun 2024 10:15:56 -0700 Subject: [PATCH] be explicit about which address fetch failed. (#285) --- packages/cli/src/CliUtils.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/CliUtils.ts b/packages/cli/src/CliUtils.ts index 685c958..8ad9530 100644 --- a/packages/cli/src/CliUtils.ts +++ b/packages/cli/src/CliUtils.ts @@ -60,13 +60,28 @@ export const checkMintedStatus = async ( new PublicKey(releaseAddr), ]); - const rentAccounts = results.filter( - (item) => !(item == undefined) && item?.lamports > 0 - ); - if (rentAccounts?.length != 3) { + const isPublisherMinted = results[0] != undefined && results[0]?.lamports > 0 + const isAppMinted = results[1] != undefined && results[1]?.lamports > 0 + const isReleaseMinted = results[2] != undefined && results[2]?.lamports > 0 + + if (!isPublisherMinted || !isAppMinted || !isReleaseMinted) { + let errorMessage = `` + + if (!isPublisherMinted) { + errorMessage = errorMessage + `Publisher NFT fetch at address ${pubAddr} failed.\n` + } + if (!isAppMinted) { + errorMessage = errorMessage + `App NFT fetch at address ${appAddr} failed.\n` + } + if (!isReleaseMinted) { + errorMessage = errorMessage + `Release NFT fetch at address ${releaseAddr} failed.\n` + } + throw new Error( - "Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal." - ); + `Expected Publisher :: ${pubAddr}, App :: ${appAddr} and Release :: ${releaseAddr} to be minted before submission.\n + but ${errorMessage}\n + Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.` + ); } };