@solana-mobile/dapp-store-cli 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/CliSetup.js CHANGED
@@ -126,7 +126,7 @@ import { Command } from "commander";
126
126
  import { validateCommand } from "./commands/index.js";
127
127
  import { createAppCommand, createPublisherCommand, createReleaseCommand } from "./commands/create/index.js";
128
128
  import { publishRemoveCommand, publishSubmitCommand, publishSupportCommand, publishUpdateCommand } from "./commands/publish/index.js";
129
- import { checkForSelfUpdate, checkSubmissionNetwork, Constants, dryRunSuccessMessage, generateNetworkSuffix, parseKeypair, showMessage } from "./CliUtils.js";
129
+ import { checkForSelfUpdate, checkSubmissionNetwork, Constants, dryRunSuccessMessage, generateNetworkSuffix, parseKeypair, showMessage, showNetworkWarningIfApplicable } from "./CliUtils.js";
130
130
  import { LAMPORTS_PER_SOL } from "@solana/web3.js";
131
131
  import * as dotenv from "dotenv";
132
132
  import { initScaffold } from "./commands/scaffolding/index.js";
@@ -153,6 +153,7 @@ function resolveBuildToolsPath(buildToolsPath) {
153
153
  * This method should be updated with each new release of the CLI, and just do nothing when there isn't anything to report
154
154
  */ function latestReleaseMessage() {
155
155
  var messages = [
156
+ "- App details page now supports video files. (mp4 file format only and minimum resolution 720p)",
156
157
  "- priority fee has been updated to ".concat(Constants.DEFAULT_PRIORITY_FEE, " lamports = ").concat(Constants.DEFAULT_PRIORITY_FEE / LAMPORTS_PER_SOL, ' SOL. To adjust this value use param "-p" or "--priority-fee-lamports"'),
157
158
  "- At least 4 screenshots are now required to update or release a new app",
158
159
  "- App icons should be exactly 512x512."
@@ -243,6 +244,7 @@ export var createPublisherCliCmd = createCliCmd.command("publisher").description
243
244
  return _ts_generator(this, function(_state) {
244
245
  switch(_state.label){
245
246
  case 0:
247
+ showNetworkWarningIfApplicable(url);
246
248
  latestReleaseMessage();
247
249
  return [
248
250
  4,
@@ -310,6 +312,7 @@ export var createAppCliCmd = createCliCmd.command("app").description("Create a a
310
312
  return _ts_generator(this, function(_state) {
311
313
  switch(_state.label){
312
314
  case 0:
315
+ showNetworkWarningIfApplicable(url);
313
316
  latestReleaseMessage();
314
317
  return [
315
318
  4,
@@ -387,6 +390,7 @@ export var createReleaseCliCmd = createCliCmd.command("release").description("Cr
387
390
  return _ts_generator(this, function(_state) {
388
391
  switch(_state.label){
389
392
  case 0:
393
+ showNetworkWarningIfApplicable(url);
390
394
  latestReleaseMessage();
391
395
  return [
392
396
  4,
@@ -536,17 +540,12 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
536
540
  ];
537
541
  case 1:
538
542
  _state.sent();
539
- return [
540
- 4,
541
- checkSubmissionNetwork(url)
542
- ];
543
- case 2:
544
- _state.sent();
543
+ checkSubmissionNetwork(url);
545
544
  return [
546
545
  4,
547
546
  loadPublishDetails(Constants.getConfigFilePath())
548
547
  ];
549
- case 3:
548
+ case 2:
550
549
  config = _state.sent();
551
550
  if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
552
551
  throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
@@ -554,8 +553,32 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
554
553
  signer = parseKeypair(keypair);
555
554
  if (!signer) return [
556
555
  3,
557
- 5
556
+ 7
557
+ ];
558
+ if (!(config.lastUpdatedVersionOnStore != null && config.lastSubmittedVersionOnChain.address != null)) return [
559
+ 3,
560
+ 4
558
561
  ];
562
+ return [
563
+ 4,
564
+ publishUpdateCommand({
565
+ appMintAddress: appMintAddress,
566
+ releaseMintAddress: releaseMintAddress,
567
+ signer: signer,
568
+ url: url,
569
+ dryRun: dryRun,
570
+ compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
571
+ requestorIsAuthorized: requestorIsAuthorized,
572
+ critical: false
573
+ })
574
+ ];
575
+ case 3:
576
+ _state.sent();
577
+ return [
578
+ 3,
579
+ 6
580
+ ];
581
+ case 4:
559
582
  return [
560
583
  4,
561
584
  publishSubmitCommand({
@@ -568,15 +591,17 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
568
591
  requestorIsAuthorized: requestorIsAuthorized
569
592
  })
570
593
  ];
571
- case 4:
594
+ case 5:
572
595
  _state.sent();
596
+ _state.label = 6;
597
+ case 6:
573
598
  if (dryRun) {
574
599
  dryRunSuccessMessage();
575
600
  } else {
576
601
  showMessage("Success", "Successfully submitted to the Solana Mobile dApp publisher portal");
577
602
  }
578
- _state.label = 5;
579
- case 5:
603
+ _state.label = 7;
604
+ case 7:
580
605
  return [
581
606
  2
582
607
  ];
@@ -616,17 +641,12 @@ publishCommand.command("update").description("Update an existing app on the Sola
616
641
  ];
617
642
  case 1:
618
643
  _state.sent();
619
- return [
620
- 4,
621
- checkSubmissionNetwork(url)
622
- ];
623
- case 2:
624
- _state.sent();
644
+ checkSubmissionNetwork(url);
625
645
  return [
626
646
  4,
627
647
  loadPublishDetails(Constants.getConfigFilePath())
628
648
  ];
629
- case 3:
649
+ case 2:
630
650
  config = _state.sent();
631
651
  if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
632
652
  throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
@@ -634,7 +654,7 @@ publishCommand.command("update").description("Update an existing app on the Sola
634
654
  signer = parseKeypair(keypair);
635
655
  if (!signer) return [
636
656
  3,
637
- 5
657
+ 4
638
658
  ];
639
659
  return [
640
660
  4,
@@ -649,15 +669,15 @@ publishCommand.command("update").description("Update an existing app on the Sola
649
669
  critical: critical
650
670
  })
651
671
  ];
652
- case 4:
672
+ case 3:
653
673
  _state.sent();
654
674
  if (dryRun) {
655
675
  dryRunSuccessMessage();
656
676
  } else {
657
677
  showMessage("Success", "dApp successfully updated on the publisher portal");
658
678
  }
659
- _state.label = 5;
660
- case 5:
679
+ _state.label = 4;
680
+ case 4:
661
681
  return [
662
682
  2
663
683
  ];
@@ -697,17 +717,12 @@ publishCommand.command("remove").description("Remove an existing app from the So
697
717
  ];
698
718
  case 1:
699
719
  _state.sent();
700
- return [
701
- 4,
702
- checkSubmissionNetwork(url)
703
- ];
704
- case 2:
705
- _state.sent();
720
+ checkSubmissionNetwork(url);
706
721
  return [
707
722
  4,
708
723
  loadPublishDetails(Constants.getConfigFilePath())
709
724
  ];
710
- case 3:
725
+ case 2:
711
726
  config = _state.sent();
712
727
  if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
713
728
  throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
@@ -715,7 +730,7 @@ publishCommand.command("remove").description("Remove an existing app from the So
715
730
  signer = parseKeypair(keypair);
716
731
  if (!signer) return [
717
732
  3,
718
- 5
733
+ 4
719
734
  ];
720
735
  return [
721
736
  4,
@@ -729,15 +744,15 @@ publishCommand.command("remove").description("Remove an existing app from the So
729
744
  critical: critical
730
745
  })
731
746
  ];
732
- case 4:
747
+ case 3:
733
748
  _state.sent();
734
749
  if (dryRun) {
735
750
  dryRunSuccessMessage();
736
751
  } else {
737
752
  showMessage("Success", "dApp successfully removed from the publisher portal");
738
753
  }
739
- _state.label = 5;
740
- case 5:
754
+ _state.label = 4;
755
+ case 4:
741
756
  return [
742
757
  2
743
758
  ];
@@ -777,17 +792,12 @@ publishCommand.command("support <request_details>").description("Submit a suppor
777
792
  ];
778
793
  case 1:
779
794
  _state.sent();
780
- return [
781
- 4,
782
- checkSubmissionNetwork(url)
783
- ];
784
- case 2:
785
- _state.sent();
795
+ checkSubmissionNetwork(url);
786
796
  return [
787
797
  4,
788
798
  loadPublishDetails(Constants.getConfigFilePath())
789
799
  ];
790
- case 3:
800
+ case 2:
791
801
  config = _state.sent();
792
802
  if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
793
803
  throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
@@ -795,7 +805,7 @@ publishCommand.command("support <request_details>").description("Submit a suppor
795
805
  signer = parseKeypair(keypair);
796
806
  if (!signer) return [
797
807
  3,
798
- 5
808
+ 4
799
809
  ];
800
810
  return [
801
811
  4,
@@ -809,15 +819,15 @@ publishCommand.command("support <request_details>").description("Submit a suppor
809
819
  requestDetails: requestDetails
810
820
  })
811
821
  ];
812
- case 4:
822
+ case 3:
813
823
  _state.sent();
814
824
  if (dryRun) {
815
825
  dryRunSuccessMessage();
816
826
  } else {
817
827
  showMessage("Success", "Support request sent successfully");
818
828
  }
819
- _state.label = 5;
820
- case 5:
829
+ _state.label = 4;
830
+ case 4:
821
831
  return [
822
832
  2
823
833
  ];
package/lib/CliUtils.js CHANGED
@@ -143,7 +143,7 @@ function _ts_generator(thisArg, body) {
143
143
  import fs from "fs";
144
144
  import { Keypair, PublicKey } from "@solana/web3.js";
145
145
  import debugModule from "debug";
146
- import { BundlrStorageDriver, keypairIdentity, Metaplex } from "@metaplex-foundation/js";
146
+ import { IrysStorageDriver, keypairIdentity, Metaplex } from "@metaplex-foundation/js";
147
147
  import updateNotifier from "update-notifier";
148
148
  import cliPackage from "./package.json" assert {
149
149
  type: "json"
@@ -159,7 +159,7 @@ export var Constants = function Constants() {
159
159
  "use strict";
160
160
  _class_call_check(this, Constants);
161
161
  };
162
- _define_property(Constants, "CLI_VERSION", "0.8.1");
162
+ _define_property(Constants, "CLI_VERSION", "0.9.0");
163
163
  _define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
164
164
  _define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
165
165
  _define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
@@ -185,7 +185,7 @@ export var checkForSelfUpdate = function() {
185
185
  latestVer = new ver.SemVer(updateInfo.latest);
186
186
  currentVer = new ver.SemVer(updateInfo.current);
187
187
  if (latestVer.major > currentVer.major || latestVer.minor > currentVer.minor) {
188
- throw new Error("Please update to the latest version of the dApp Store CLI before proceeding.");
188
+ throw new Error("Please update to the latest version of the dApp Store CLI before proceeding.\nCurrent version is ".concat(currentVer.raw, "\nLatest version is ").concat(latestVer.raw));
189
189
  }
190
190
  return [
191
191
  2
@@ -262,6 +262,13 @@ export var generateNetworkSuffix = function(rpcUrl) {
262
262
  export var dryRunSuccessMessage = function() {
263
263
  showMessage("Dry run", "Dry run was successful", "standard");
264
264
  };
265
+ export var showNetworkWarningIfApplicable = function(rpcUrl) {
266
+ if (isDevnet(rpcUrl)) {
267
+ showMessage("Devnet Mode", "Running on Devnet", "warning");
268
+ } else if (isTestnet(rpcUrl)) {
269
+ showMessage("Testnet Mode", "Running on Testnet", "warning");
270
+ }
271
+ };
265
272
  export var showMessage = function() {
266
273
  var titleMessage = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", contentMessage = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "standard";
267
274
  var color = "cyan";
@@ -300,13 +307,13 @@ export var getMetaplexInstance = function(connection, keypair) {
300
307
  var bucketPlugin = awsStorage(awsClient, s3Mgr.s3Config.bucketName);
301
308
  metaplex.use(bucketPlugin);
302
309
  } else {
303
- var bundlrStorageDriver = isDevnet ? new BundlrStorageDriver(metaplex, {
310
+ var irysStorageDriver = isDevnet ? new IrysStorageDriver(metaplex, {
304
311
  address: "https://turbo.ardrive.dev",
305
312
  providerUrl: Constants.DEFAULT_RPC_DEVNET
306
- }) : new BundlrStorageDriver(metaplex, {
313
+ }) : new IrysStorageDriver(metaplex, {
307
314
  address: "https://turbo.ardrive.io"
308
315
  });
309
- metaplex.storage().setDriver(bundlrStorageDriver);
316
+ metaplex.storage().setDriver(irysStorageDriver);
310
317
  }
311
318
  metaplex.storage().setDriver(new CachedStorageDriver(metaplex.storage().driver(), {
312
319
  assetManifestPath: isDevnet ? "./.asset-manifest-devnet.json" : "./.asset-manifest.json"
@@ -153,7 +153,6 @@ export var validateCommand = function() {
153
153
  }, metaplexFileReplacer, 2));
154
154
  try {
155
155
  validatePublisher(publisherJson);
156
- console.info("Publisher JSON valid!");
157
156
  } catch (e) {
158
157
  ;
159
158
  errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
@@ -172,7 +171,6 @@ export var validateCommand = function() {
172
171
  }, metaplexFileReplacer, 2));
173
172
  try {
174
173
  validateApp(appJson);
175
- console.info("App JSON valid!");
176
174
  } catch (e) {
177
175
  ;
178
176
  errorMsg1 = (_e_message1 = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message1 !== void 0 ? _e_message1 : "";
@@ -201,7 +199,6 @@ export var validateCommand = function() {
201
199
  debug("releaseJson=", objStringified);
202
200
  try {
203
201
  validateRelease(JSON.parse(objStringified));
204
- console.info("Release JSON valid!");
205
202
  } catch (e) {
206
203
  ;
207
204
  errorMsg2 = (_e_message2 = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message2 !== void 0 ? _e_message2 : "";
@@ -214,9 +214,7 @@ var createAppNft = function() {
214
214
  2
215
215
  ];
216
216
  case 8:
217
- return [
218
- 2
219
- ];
217
+ throw new Error("Unable to mint app NFT");
220
218
  }
221
219
  });
222
220
  });
@@ -213,9 +213,7 @@ var createPublisherNft = function() {
213
213
  2
214
214
  ];
215
215
  case 8:
216
- return [
217
- 2
218
- ];
216
+ throw new Error("Unable to mint publisher NFT");
219
217
  }
220
218
  });
221
219
  });
@@ -272,7 +270,11 @@ export var createPublisherCommand = function() {
272
270
  ];
273
271
  case 4:
274
272
  return [
275
- 2
273
+ 2,
274
+ {
275
+ publisherAddress: "",
276
+ transactionSignature: ""
277
+ }
276
278
  ];
277
279
  }
278
280
  });
@@ -152,6 +152,8 @@ function _ts_generator(thisArg, body) {
152
152
  }
153
153
  import { createRelease } from "@solana-mobile/dapp-store-publishing-tools";
154
154
  import { Connection, Keypair, PublicKey, sendAndConfirmTransaction } from "@solana/web3.js";
155
+ import fs from "fs";
156
+ import { createHash } from "crypto";
155
157
  import { Constants, getMetaplexInstance, showMessage } from "../../CliUtils.js";
156
158
  import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
157
159
  var createReleaseNft = function() {
@@ -244,9 +246,7 @@ var createReleaseNft = function() {
244
246
  2
245
247
  ];
246
248
  case 8:
247
- return [
248
- 2
249
- ];
249
+ throw new Error("Unable to mint release NFT");
250
250
  }
251
251
  });
252
252
  });
@@ -256,7 +256,7 @@ var createReleaseNft = function() {
256
256
  }();
257
257
  export var createReleaseCommand = function() {
258
258
  var _ref = _async_to_generator(function(param) {
259
- var appMintAddress, buildToolsPath, signer, url, _param_dryRun, dryRun, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, _ref, release, app, publisher, _app_address, _ref1, releaseAddress, transactionSignature;
259
+ var appMintAddress, buildToolsPath, signer, url, _param_dryRun, dryRun, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, config, apkEntry, mediaBuffer, hash, _config_app_address, _ref, releaseAddress, transactionSignature;
260
260
  return _ts_generator(this, function(_state) {
261
261
  switch(_state.label){
262
262
  case 0:
@@ -267,38 +267,59 @@ export var createReleaseCommand = function() {
267
267
  loadPublishDetailsWithChecks(buildToolsPath)
268
268
  ];
269
269
  case 1:
270
- _ref = _state.sent(), release = _ref.release, app = _ref.app, publisher = _ref.publisher;
271
- if (app.android_package != release.android_details.android_package) {
272
- throw new Error("App package name and release package name do not match.\nApp release specifies " + app.android_package + " while release specifies " + release.android_details.android_package);
270
+ config = _state.sent();
271
+ apkEntry = config.release.files.find(function(asset) {
272
+ return asset.purpose === "install";
273
+ });
274
+ return [
275
+ 4,
276
+ fs.promises.readFile(apkEntry.uri)
277
+ ];
278
+ case 2:
279
+ mediaBuffer = _state.sent();
280
+ hash = createHash("sha256").update(mediaBuffer).digest("base64");
281
+ if (config.lastSubmittedVersionOnChain != null && hash === config.lastSubmittedVersionOnChain.apk_hash) {
282
+ throw new Error("The last created release used the same apk file.");
283
+ }
284
+ if (config.lastSubmittedVersionOnChain != null && config.release.android_details.version_code <= config.lastSubmittedVersionOnChain.version_code) {
285
+ throw new Error("Each release NFT should have higher version code than previous minted release NFT.\nLast released version code is ".concat(config.lastSubmittedVersionOnChain.version_code, ".\nCurrent version code from apk file is ").concat(config.release.android_details.version_code));
286
+ }
287
+ if (config.app.android_package != config.release.android_details.android_package) {
288
+ throw new Error("App package name and release package name do not match.\nApp release specifies " + config.app.android_package + " while release specifies " + config.release.android_details.android_package);
273
289
  }
274
290
  if (!!dryRun) return [
275
291
  3,
276
- 4
292
+ 5
277
293
  ];
278
294
  return [
279
295
  4,
280
296
  createReleaseNft({
281
- appMintAddress: (_app_address = app.address) !== null && _app_address !== void 0 ? _app_address : appMintAddress,
297
+ appMintAddress: (_config_app_address = config.app.address) !== null && _config_app_address !== void 0 ? _config_app_address : appMintAddress,
282
298
  connection: connection,
283
299
  publisher: signer,
284
- releaseDetails: _object_spread({}, release),
285
- appDetails: app,
286
- publisherDetails: publisher,
300
+ releaseDetails: _object_spread({}, config.release),
301
+ appDetails: config.app,
302
+ publisherDetails: config.publisher,
287
303
  storageParams: storageParams,
288
304
  priorityFeeLamports: priorityFeeLamports
289
305
  })
290
306
  ];
291
- case 2:
292
- _ref1 = _state.sent(), releaseAddress = _ref1.releaseAddress, transactionSignature = _ref1.transactionSignature;
307
+ case 3:
308
+ _ref = _state.sent(), releaseAddress = _ref.releaseAddress, transactionSignature = _ref.transactionSignature;
293
309
  return [
294
310
  4,
295
311
  writeToPublishDetails({
296
312
  release: {
297
313
  address: releaseAddress
314
+ },
315
+ lastSubmittedVersionOnChain: {
316
+ address: releaseAddress,
317
+ version_code: config.release.android_details.version_code,
318
+ apk_hash: hash
298
319
  }
299
320
  })
300
321
  ];
301
- case 3:
322
+ case 4:
302
323
  _state.sent();
303
324
  return [
304
325
  2,
@@ -307,7 +328,7 @@ export var createReleaseCommand = function() {
307
328
  transactionSignature: transactionSignature
308
329
  }
309
330
  ];
310
- case 4:
331
+ case 5:
311
332
  return [
312
333
  2
313
334
  ];
@@ -126,10 +126,10 @@ import { Connection } from "@solana/web3.js";
126
126
  import { publishSubmit } from "@solana-mobile/dapp-store-publishing-tools";
127
127
  import nacl from "tweetnacl";
128
128
  import { checkMintedStatus, showMessage } from "../../CliUtils.js";
129
- import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
129
+ import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
130
130
  export var publishSubmitCommand = function() {
131
131
  var _ref = _async_to_generator(function(param) {
132
- var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized, requestorIsAuthorized, connection, _ref, publisherDetails, appDetails, releaseDetails, solanaMobileDappPublisherPortalDetails, sign, pubAddr, appAddr, releaseAddr;
132
+ var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized, requestorIsAuthorized, connection, _ref, publisherDetails, appDetails, releaseDetails, solanaMobileDappPublisherPortalDetails, lastUpdatedVersionOnStore, sign, pubAddr, appAddr, releaseAddr;
133
133
  return _ts_generator(this, function(_state) {
134
134
  switch(_state.label){
135
135
  case 0:
@@ -152,13 +152,16 @@ export var publishSubmitCommand = function() {
152
152
  loadPublishDetailsWithChecks()
153
153
  ];
154
154
  case 1:
155
- _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release, solanaMobileDappPublisherPortalDetails = _ref.solana_mobile_dapp_publisher_portal;
155
+ _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release, solanaMobileDappPublisherPortalDetails = _ref.solana_mobile_dapp_publisher_portal, lastUpdatedVersionOnStore = _ref.lastUpdatedVersionOnStore;
156
156
  sign = function(buf) {
157
157
  return nacl.sign(buf, signer.secretKey);
158
158
  };
159
159
  pubAddr = publisherDetails.address;
160
160
  appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
161
161
  releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
162
+ if (lastUpdatedVersionOnStore != null && releaseAddr === lastUpdatedVersionOnStore.address) {
163
+ throw new Error("You've already submitted this version for review.");
164
+ }
162
165
  return [
163
166
  4,
164
167
  checkMintedStatus(connection, pubAddr, appAddr, releaseAddr)
@@ -180,6 +183,16 @@ export var publishSubmitCommand = function() {
180
183
  }, dryRun)
181
184
  ];
182
185
  case 3:
186
+ _state.sent();
187
+ return [
188
+ 4,
189
+ writeToPublishDetails({
190
+ lastUpdatedVersionOnStore: {
191
+ address: releaseAddr
192
+ }
193
+ })
194
+ ];
195
+ case 4:
183
196
  _state.sent();
184
197
  return [
185
198
  2
@@ -126,10 +126,10 @@ import { Connection } from "@solana/web3.js";
126
126
  import { publishUpdate } from "@solana-mobile/dapp-store-publishing-tools";
127
127
  import { checkMintedStatus, showMessage } from "../../CliUtils.js";
128
128
  import nacl from "tweetnacl";
129
- import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
129
+ import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
130
130
  export var publishUpdateCommand = function() {
131
131
  var _ref = _async_to_generator(function(param) {
132
- var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized, requestorIsAuthorized, _param_critical, critical, connection, _ref, publisherDetails, appDetails, releaseDetails, solanaMobileDappPublisherPortalDetails, sign, pubAddr, appAddr, releaseAddr;
132
+ var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized, requestorIsAuthorized, _param_critical, critical, connection, _ref, publisherDetails, appDetails, releaseDetails, solanaMobileDappPublisherPortalDetails, lastUpdatedVersionOnStore, sign, pubAddr, appAddr, releaseAddr;
133
133
  return _ts_generator(this, function(_state) {
134
134
  switch(_state.label){
135
135
  case 0:
@@ -152,13 +152,16 @@ export var publishUpdateCommand = function() {
152
152
  loadPublishDetailsWithChecks()
153
153
  ];
154
154
  case 1:
155
- _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release, solanaMobileDappPublisherPortalDetails = _ref.solana_mobile_dapp_publisher_portal;
155
+ _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release, solanaMobileDappPublisherPortalDetails = _ref.solana_mobile_dapp_publisher_portal, lastUpdatedVersionOnStore = _ref.lastUpdatedVersionOnStore;
156
156
  sign = function(buf) {
157
157
  return nacl.sign(buf, signer.secretKey);
158
158
  };
159
159
  pubAddr = publisherDetails.address;
160
160
  appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
161
161
  releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
162
+ if (lastUpdatedVersionOnStore != null && releaseAddr === lastUpdatedVersionOnStore.address) {
163
+ throw new Error("You've already submitted this version for review.");
164
+ }
162
165
  return [
163
166
  4,
164
167
  checkMintedStatus(connection, pubAddr, appAddr, releaseAddr)
@@ -181,6 +184,16 @@ export var publishUpdateCommand = function() {
181
184
  }, dryRun)
182
185
  ];
183
186
  case 3:
187
+ _state.sent();
188
+ return [
189
+ 4,
190
+ writeToPublishDetails({
191
+ lastUpdatedVersionOnStore: {
192
+ address: releaseAddr
193
+ }
194
+ })
195
+ ];
196
+ case 4:
184
197
  _state.sent();
185
198
  return [
186
199
  2