@solana-mobile/dapp-store-cli 0.7.2 → 0.8.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,8 @@ 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, generateNetworkSuffix, parseKeypair, showMessage } from "./CliUtils.js";
129
+ import { checkForSelfUpdate, checkSubmissionNetwork, Constants, dryRunSuccessMessage, generateNetworkSuffix, parseKeypair, showMessage } from "./CliUtils.js";
130
+ import { LAMPORTS_PER_SOL } from "@solana/web3.js";
130
131
  import * as dotenv from "dotenv";
131
132
  import { initScaffold } from "./commands/scaffolding/index.js";
132
133
  import { loadPublishDetails, loadPublishDetailsWithChecks } from "./config/PublishDetails.js";
@@ -151,7 +152,12 @@ function resolveBuildToolsPath(buildToolsPath) {
151
152
  /**
152
153
  * This method should be updated with each new release of the CLI, and just do nothing when there isn't anything to report
153
154
  */ function latestReleaseMessage() {
154
- showMessage("Publishing Tools Version ".concat(Constants.CLI_VERSION), "- priority fee has been updated to handle network congestion\n- short_description value reduced to 30 character limit", "warning");
155
+ var messages = [
156
+ "- 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
+ "- At least 4 screenshots are now required to update or release a new app",
158
+ "- App icons should be exactly 512x512."
159
+ ].join("\n\n");
160
+ showMessage("Publishing Tools Version ".concat(Constants.CLI_VERSION), messages, "warning");
155
161
  }
156
162
  function tryWithErrorMessage(block) {
157
163
  return _tryWithErrorMessage.apply(this, arguments);
@@ -223,17 +229,17 @@ export var initCliCmd = mainCli.command("init").description("First-time initiali
223
229
  });
224
230
  }));
225
231
  export var createCliCmd = mainCli.command("create").description("Create a `publisher`, `app`, or `release`");
226
- export var createPublisherCliCmd = createCliCmd.command("publisher").description("Create a publisher").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").action(function() {
232
+ export var createPublisherCliCmd = createCliCmd.command("publisher").description("Create a publisher").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").option("-p, --priority-fee-lamports <priority-fee-lamports>", "Priority Fee lamports").action(function() {
227
233
  var _ref = _async_to_generator(function(param) {
228
- var keypair, url, dryRun, storageConfig;
234
+ var keypair, url, dryRun, storageConfig, priorityFeeLamports;
229
235
  return _ts_generator(this, function(_state) {
230
236
  switch(_state.label){
231
237
  case 0:
232
- keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig;
238
+ keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig, priorityFeeLamports = param.priorityFeeLamports;
233
239
  return [
234
240
  4,
235
241
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
236
- var signer, result, displayUrl, resultText;
242
+ var signer, result, displayUrl, transactionUrl, resultText;
237
243
  return _ts_generator(this, function(_state) {
238
244
  switch(_state.label){
239
245
  case 0:
@@ -255,17 +261,22 @@ export var createPublisherCliCmd = createCliCmd.command("publisher").description
255
261
  signer: signer,
256
262
  url: url,
257
263
  dryRun: dryRun,
258
- storageParams: storageConfig
264
+ storageParams: storageConfig,
265
+ priorityFeeLamports: priorityFeeLamports
259
266
  })
260
267
  ];
261
268
  case 2:
262
269
  result = _state.sent();
263
- displayUrl = "https://solscan.io/token/".concat(result.publisherAddress).concat(generateNetworkSuffix(url));
264
- resultText = "Publisher NFT successfully minted:\n".concat(displayUrl);
265
- showMessage("Success", resultText);
270
+ if (dryRun) {
271
+ dryRunSuccessMessage();
272
+ } else {
273
+ displayUrl = "https://explorer.solana.com/address/".concat(result.publisherAddress).concat(generateNetworkSuffix(url));
274
+ transactionUrl = "https://explorer.solana.com/tx/".concat(result.transactionSignature).concat(generateNetworkSuffix(url));
275
+ resultText = "Publisher NFT successfully minted successfully:\n".concat(displayUrl, "\n").concat(transactionUrl);
276
+ showMessage("Success", resultText);
277
+ }
266
278
  _state.label = 3;
267
279
  case 3:
268
- process.exit();
269
280
  return [
270
281
  2
271
282
  ];
@@ -285,17 +296,17 @@ export var createPublisherCliCmd = createCliCmd.command("publisher").description
285
296
  return _ref.apply(this, arguments);
286
297
  };
287
298
  }());
288
- export var createAppCliCmd = createCliCmd.command("app").description("Create a app").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-p, --publisher-mint-address <publisher-mint-address>", "The mint address of the publisher NFT").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").action(function() {
299
+ export var createAppCliCmd = createCliCmd.command("app").description("Create a app").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-p, --publisher-mint-address <publisher-mint-address>", "The mint address of the publisher NFT").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").option("-p, --priority-fee-lamports <priority-fee-lamports>", "Priority Fee lamports").action(function() {
289
300
  var _ref = _async_to_generator(function(param) {
290
- var publisherMintAddress, keypair, url, dryRun, storageConfig;
301
+ var publisherMintAddress, keypair, url, dryRun, storageConfig, priorityFeeLamports;
291
302
  return _ts_generator(this, function(_state) {
292
303
  switch(_state.label){
293
304
  case 0:
294
- publisherMintAddress = param.publisherMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig;
305
+ publisherMintAddress = param.publisherMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig, priorityFeeLamports = param.priorityFeeLamports;
295
306
  return [
296
307
  4,
297
308
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
298
- var config, signer, result, displayUrl, resultText;
309
+ var config, signer, result, displayUrl, transactionUrl, resultText;
299
310
  return _ts_generator(this, function(_state) {
300
311
  switch(_state.label){
301
312
  case 0:
@@ -327,17 +338,22 @@ export var createAppCliCmd = createCliCmd.command("app").description("Create a a
327
338
  signer: signer,
328
339
  url: url,
329
340
  dryRun: dryRun,
330
- storageParams: storageConfig
341
+ storageParams: storageConfig,
342
+ priorityFeeLamports: priorityFeeLamports
331
343
  })
332
344
  ];
333
345
  case 3:
334
346
  result = _state.sent();
335
- displayUrl = "https://solscan.io/token/".concat(result.appAddress).concat(generateNetworkSuffix(url));
336
- resultText = "App NFT successfully minted:\n".concat(displayUrl);
337
- showMessage("Success", resultText);
347
+ if (dryRun) {
348
+ dryRunSuccessMessage();
349
+ } else {
350
+ displayUrl = "https://explorer.solana.com/address/".concat(result.appAddress).concat(generateNetworkSuffix(url));
351
+ transactionUrl = "https://explorer.solana.com/tx/".concat(result.transactionSignature).concat(generateNetworkSuffix(url));
352
+ resultText = "App NFT successfully minted:\n".concat(displayUrl, "\n").concat(transactionUrl);
353
+ showMessage("Success", resultText);
354
+ }
338
355
  _state.label = 4;
339
356
  case 4:
340
- process.exit();
341
357
  return [
342
358
  2
343
359
  ];
@@ -357,17 +373,17 @@ export var createAppCliCmd = createCliCmd.command("app").description("Create a a
357
373
  return _ref.apply(this, arguments);
358
374
  };
359
375
  }());
360
- export var createReleaseCliCmd = createCliCmd.command("release").description("Create a release").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-b, --build-tools-path <build-tools-path>", "Path to Android build tools which contains AAPT2").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").action(function() {
376
+ export var createReleaseCliCmd = createCliCmd.command("release").description("Create a release").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT").option("-b, --build-tools-path <build-tools-path>", "Path to Android build tools which contains AAPT2").option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details").option("-p, --priority-fee-lamports <priority-fee-lamports>", "Priority Fee lamports").action(function() {
361
377
  var _ref = _async_to_generator(function(param) {
362
- var appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig;
378
+ var appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig, priorityFeeLamports;
363
379
  return _ts_generator(this, function(_state) {
364
380
  switch(_state.label){
365
381
  case 0:
366
- appMintAddress = param.appMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, buildToolsPath = param.buildToolsPath, storageConfig = param.storageConfig;
382
+ appMintAddress = param.appMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, buildToolsPath = param.buildToolsPath, storageConfig = param.storageConfig, priorityFeeLamports = param.priorityFeeLamports;
367
383
  return [
368
384
  4,
369
385
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
370
- var resolvedBuildToolsPath, config, signer, result, displayUrl, resultText;
386
+ var resolvedBuildToolsPath, config, signer, result, displayUrl, transactionUrl, resultText;
371
387
  return _ts_generator(this, function(_state) {
372
388
  switch(_state.label){
373
389
  case 0:
@@ -404,17 +420,22 @@ export var createReleaseCliCmd = createCliCmd.command("release").description("Cr
404
420
  signer: signer,
405
421
  url: url,
406
422
  dryRun: dryRun,
407
- storageParams: storageConfig
423
+ storageParams: storageConfig,
424
+ priorityFeeLamports: priorityFeeLamports
408
425
  })
409
426
  ];
410
427
  case 3:
411
428
  result = _state.sent();
412
- displayUrl = "https://solscan.io/token/".concat(result === null || result === void 0 ? void 0 : result.releaseAddress).concat(generateNetworkSuffix(url));
413
- resultText = "Release NFT successfully minted:\n".concat(displayUrl);
414
- showMessage("Success", resultText);
429
+ if (dryRun) {
430
+ dryRunSuccessMessage();
431
+ } else {
432
+ displayUrl = "https://explorer.solana.com/address/".concat(result === null || result === void 0 ? void 0 : result.releaseAddress).concat(generateNetworkSuffix(url));
433
+ transactionUrl = "https://explorer.solana.com/tx/".concat(result.transactionSignature).concat(generateNetworkSuffix(url));
434
+ resultText = "Release NFT successfully minted:\n".concat(displayUrl, "\n").concat(transactionUrl);
435
+ showMessage("Success", resultText);
436
+ }
415
437
  _state.label = 4;
416
438
  case 4:
417
- process.exit();
418
439
  return [
419
440
  2
420
441
  ];
@@ -475,7 +496,6 @@ mainCli.command("validate").description("Validates details prior to publishing")
475
496
  _state.sent();
476
497
  _state.label = 3;
477
498
  case 3:
478
- process.exit();
479
499
  return [
480
500
  2
481
501
  ];
@@ -506,7 +526,7 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
506
526
  return [
507
527
  4,
508
528
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
509
- var config, signer, resultText;
529
+ var config, signer;
510
530
  return _ts_generator(this, function(_state) {
511
531
  switch(_state.label){
512
532
  case 0:
@@ -550,11 +570,13 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
550
570
  ];
551
571
  case 4:
552
572
  _state.sent();
553
- resultText = "Successfully submitted to the Solana Mobile dApp publisher portal";
554
- showMessage("Success", resultText);
573
+ if (dryRun) {
574
+ dryRunSuccessMessage();
575
+ } else {
576
+ showMessage("Success", "Successfully submitted to the Solana Mobile dApp publisher portal");
577
+ }
555
578
  _state.label = 5;
556
579
  case 5:
557
- process.exit();
558
580
  return [
559
581
  2
560
582
  ];
@@ -584,7 +606,7 @@ publishCommand.command("update").description("Update an existing app on the Sola
584
606
  return [
585
607
  4,
586
608
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
587
- var config, signer, resultText;
609
+ var config, signer;
588
610
  return _ts_generator(this, function(_state) {
589
611
  switch(_state.label){
590
612
  case 0:
@@ -629,8 +651,11 @@ publishCommand.command("update").description("Update an existing app on the Sola
629
651
  ];
630
652
  case 4:
631
653
  _state.sent();
632
- resultText = "dApp successfully updated on the publisher portal";
633
- showMessage("Success", resultText);
654
+ if (dryRun) {
655
+ dryRunSuccessMessage();
656
+ } else {
657
+ showMessage("Success", "dApp successfully updated on the publisher portal");
658
+ }
634
659
  _state.label = 5;
635
660
  case 5:
636
661
  return [
@@ -642,7 +667,6 @@ publishCommand.command("update").description("Update an existing app on the Sola
642
667
  ];
643
668
  case 1:
644
669
  _state.sent();
645
- process.exit();
646
670
  return [
647
671
  2
648
672
  ];
@@ -663,7 +687,7 @@ publishCommand.command("remove").description("Remove an existing app from the So
663
687
  return [
664
688
  4,
665
689
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
666
- var config, signer, resultText;
690
+ var config, signer;
667
691
  return _ts_generator(this, function(_state) {
668
692
  switch(_state.label){
669
693
  case 0:
@@ -707,11 +731,13 @@ publishCommand.command("remove").description("Remove an existing app from the So
707
731
  ];
708
732
  case 4:
709
733
  _state.sent();
710
- resultText = "dApp successfully removed from the publisher portal";
711
- showMessage("Success", resultText);
734
+ if (dryRun) {
735
+ dryRunSuccessMessage();
736
+ } else {
737
+ showMessage("Success", "dApp successfully removed from the publisher portal");
738
+ }
712
739
  _state.label = 5;
713
740
  case 5:
714
- process.exit();
715
741
  return [
716
742
  2
717
743
  ];
@@ -741,7 +767,7 @@ publishCommand.command("support <request_details>").description("Submit a suppor
741
767
  return [
742
768
  4,
743
769
  tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
744
- var config, signer, resultText;
770
+ var config, signer;
745
771
  return _ts_generator(this, function(_state) {
746
772
  switch(_state.label){
747
773
  case 0:
@@ -785,11 +811,13 @@ publishCommand.command("support <request_details>").description("Submit a suppor
785
811
  ];
786
812
  case 4:
787
813
  _state.sent();
788
- resultText = "Support request sent successfully";
789
- showMessage("Success", resultText);
814
+ if (dryRun) {
815
+ dryRunSuccessMessage();
816
+ } else {
817
+ showMessage("Success", "Support request sent successfully");
818
+ }
790
819
  _state.label = 5;
791
820
  case 5:
792
- process.exit();
793
821
  return [
794
822
  2
795
823
  ];
package/lib/CliUtils.js CHANGED
@@ -159,9 +159,10 @@ 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.7.1");
162
+ _define_property(Constants, "CLI_VERSION", "0.7.3");
163
163
  _define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
164
164
  _define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
165
+ _define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
165
166
  _define_property(Constants, "getConfigFilePath", function() {
166
167
  return "".concat(process.cwd(), "/").concat(Constants.CONFIG_FILE_NAME);
167
168
  });
@@ -258,6 +259,9 @@ export var generateNetworkSuffix = function(rpcUrl) {
258
259
  }
259
260
  return suffix;
260
261
  };
262
+ export var dryRunSuccessMessage = function() {
263
+ showMessage("Dry run", "Dry run was successful", "standard");
264
+ };
261
265
  export var showMessage = function() {
262
266
  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";
263
267
  var color = "cyan";
@@ -134,7 +134,7 @@ describe("Cli Setup & Execution", function() {
134
134
  var initHelp = "Usage: dapp-store init [options]\n\nFirst-time initialization of tooling configuration\n\nOptions:\n -h, --help display help for command\n";
135
135
  var keyPairArgHelp = "error: required option '-k, --keypair <path-to-keypair-file>' not specified";
136
136
  var createHelp = "Usage: dapp-store create [options] [command]\n\nCreate a `publisher`, `app`, or `release`\n\nOptions:\n -h, --help display help for command\n\nCommands:\n publisher [options] Create a publisher\n app [options] Create a app\n release [options] Create a release\n help [command] display help for command\n";
137
- var createPublisherHelp = 'Usage: dapp-store create publisher [options]\n\nCreate a publisher\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -h, --help display help for command\n';
138
- var createAppHelp = 'Usage: dapp-store create app [options]\n\nCreate a app\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -p, --publisher-mint-address <publisher-mint-address> The mint address of the publisher NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -h, --help display help for command\n';
139
- var createReleaseHelp = 'Usage: dapp-store create release [options]\n\nCreate a release\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -a, --app-mint-address <app-mint-address> The mint address of the app NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -b, --build-tools-path <build-tools-path> Path to Android build tools which contains AAPT2\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -h, --help display help for command\n';
137
+ var createPublisherHelp = 'Usage: dapp-store create publisher [options]\n\nCreate a publisher\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
138
+ var createAppHelp = 'Usage: dapp-store create app [options]\n\nCreate a app\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -p, --publisher-mint-address <publisher-mint-address> The mint address of the publisher NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
139
+ var createReleaseHelp = 'Usage: dapp-store create release [options]\n\nCreate a release\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -a, --app-mint-address <app-mint-address> The mint address of the app NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -b, --build-tools-path <build-tools-path> Path to Android build tools which contains AAPT2\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
140
140
  });
@@ -123,11 +123,11 @@ function _ts_generator(thisArg, body) {
123
123
  }
124
124
  }
125
125
  import { createAppJson, createPublisherJson, createReleaseJson, validateApp, validatePublisher, validateRelease, metaplexFileReplacer } from "@solana-mobile/dapp-store-publishing-tools";
126
- import { debug } from "../CliUtils.js";
126
+ import { debug, showMessage } from "../CliUtils.js";
127
127
  import { loadPublishDetailsWithChecks } from "../config/PublishDetails.js";
128
128
  export var validateCommand = function() {
129
129
  var _ref = _async_to_generator(function(param) {
130
- var signer, buildToolsPath, _ref, publisherDetails, appDetails, releaseDetails, publisherJson, _publisherJson_image, appJson, _appJson_image, releaseJson, objStringified;
130
+ var signer, buildToolsPath, _ref, publisherDetails, appDetails, releaseDetails, publisherJson, _publisherJson_image, _e_message, errorMsg, appJson, _appJson_image, _e_message1, errorMsg1, releaseJson, objStringified, _e_message2, errorMsg2;
131
131
  return _ts_generator(this, function(_state) {
132
132
  switch(_state.label){
133
133
  case 0:
@@ -155,7 +155,12 @@ export var validateCommand = function() {
155
155
  validatePublisher(publisherJson);
156
156
  console.info("Publisher JSON valid!");
157
157
  } catch (e) {
158
- console.error(e);
158
+ ;
159
+ errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
160
+ showMessage("Publisher JSON invalid", errorMsg, "error");
161
+ return [
162
+ 2
163
+ ];
159
164
  }
160
165
  appJson = createAppJson(appDetails, signer.publicKey);
161
166
  if (typeof appJson.image !== "string") {
@@ -169,7 +174,12 @@ export var validateCommand = function() {
169
174
  validateApp(appJson);
170
175
  console.info("App JSON valid!");
171
176
  } catch (e) {
172
- console.error(e);
177
+ ;
178
+ errorMsg1 = (_e_message1 = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message1 !== void 0 ? _e_message1 : "";
179
+ showMessage("App JSON invalid", errorMsg1, "error");
180
+ return [
181
+ 2
182
+ ];
173
183
  }
174
184
  return [
175
185
  4,
@@ -181,14 +191,26 @@ export var validateCommand = function() {
181
191
  ];
182
192
  case 2:
183
193
  releaseJson = _state.sent();
194
+ if (appDetails.android_package != releaseDetails.android_details.android_package) {
195
+ showMessage("App package name and release package name do not match", "App release specifies " + appDetails.android_package + " while release specifies " + releaseDetails.android_details.android_package, "error");
196
+ return [
197
+ 2
198
+ ];
199
+ }
184
200
  objStringified = JSON.stringify(releaseJson, metaplexFileReplacer, 2);
185
201
  debug("releaseJson=", objStringified);
186
202
  try {
187
203
  validateRelease(JSON.parse(objStringified));
188
204
  console.info("Release JSON valid!");
189
205
  } catch (e) {
190
- console.error(e);
206
+ ;
207
+ errorMsg2 = (_e_message2 = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message2 !== void 0 ? _e_message2 : "";
208
+ showMessage("Release JSON invalid", errorMsg2, "error");
209
+ return [
210
+ 2
211
+ ];
191
212
  }
213
+ showMessage("Json is Valid", "Input data is valid", "standard");
192
214
  return [
193
215
  2
194
216
  ];
@@ -124,15 +124,16 @@ function _ts_generator(thisArg, body) {
124
124
  }
125
125
  import { createApp } from "@solana-mobile/dapp-store-publishing-tools";
126
126
  import { Connection, Keypair, PublicKey, sendAndConfirmTransaction } from "@solana/web3.js";
127
- import { getMetaplexInstance } from "../../CliUtils.js";
127
+ import { Constants, getMetaplexInstance, showMessage } from "../../CliUtils.js";
128
128
  import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
129
129
  var createAppNft = function() {
130
- var _ref = _async_to_generator(function(param, param1) {
131
- var appDetails, connection, publisherMintAddress, publisher, storageParams, dryRun, mintAddress, metaplex, txBuilder, blockhash, tx, txSig;
130
+ var _ref = _async_to_generator(function(param) {
131
+ var appDetails, connection, publisherMintAddress, publisher, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder, maxTries, i, blockhash, tx, txSig, e, _e_message, errorMsg, retryMsg;
132
132
  return _ts_generator(this, function(_state) {
133
133
  switch(_state.label){
134
134
  case 0:
135
- appDetails = param.appDetails, connection = param.connection, publisherMintAddress = param.publisherMintAddress, publisher = param.publisher, storageParams = param.storageParams, dryRun = param1.dryRun;
135
+ appDetails = param.appDetails, connection = param.connection, publisherMintAddress = param.publisherMintAddress, publisher = param.publisher, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
136
+ console.info("Creating App NFT");
136
137
  mintAddress = Keypair.generate();
137
138
  metaplex = getMetaplexInstance(connection, publisher, storageParams);
138
139
  return [
@@ -140,7 +141,8 @@ var createAppNft = function() {
140
141
  createApp({
141
142
  publisherMintAddress: new PublicKey(publisherMintAddress),
142
143
  mintAddress: mintAddress,
143
- appDetails: appDetails
144
+ appDetails: appDetails,
145
+ priorityFeeLamports: priorityFeeLamports
144
146
  }, {
145
147
  metaplex: metaplex,
146
148
  publisher: publisher
@@ -148,18 +150,31 @@ var createAppNft = function() {
148
150
  ];
149
151
  case 1:
150
152
  txBuilder = _state.sent();
153
+ console.info("App NFT data upload complete\nSigning transaction now");
154
+ maxTries = 8;
155
+ i = 1;
156
+ _state.label = 2;
157
+ case 2:
158
+ if (!(i <= maxTries)) return [
159
+ 3,
160
+ 8
161
+ ];
162
+ _state.label = 3;
163
+ case 3:
164
+ _state.trys.push([
165
+ 3,
166
+ 6,
167
+ ,
168
+ 7
169
+ ]);
151
170
  return [
152
171
  4,
153
172
  connection.getLatestBlockhashAndContext()
154
173
  ];
155
- case 2:
174
+ case 4:
156
175
  blockhash = _state.sent();
157
176
  tx = txBuilder.toTransaction(blockhash.value);
158
177
  tx.sign(mintAddress, publisher);
159
- if (!!dryRun) return [
160
- 3,
161
- 4
162
- ];
163
178
  return [
164
179
  4,
165
180
  sendAndConfirmTransaction(connection, tx, [
@@ -169,34 +184,53 @@ var createAppNft = function() {
169
184
  minContextSlot: blockhash.context.slot
170
185
  })
171
186
  ];
172
- case 3:
187
+ case 5:
173
188
  txSig = _state.sent();
174
- console.info({
175
- txSig: txSig,
176
- mintAddress: mintAddress.publicKey.toBase58()
177
- });
178
- _state.label = 4;
179
- case 4:
180
189
  return [
181
190
  2,
182
191
  {
183
- appAddress: mintAddress.publicKey.toBase58()
192
+ appAddress: mintAddress.publicKey.toBase58(),
193
+ transactionSignature: txSig
184
194
  }
185
195
  ];
196
+ case 6:
197
+ e = _state.sent();
198
+ errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
199
+ if (i == maxTries) {
200
+ showMessage("Transaction Failure", errorMsg, "error");
201
+ process.exit(-1);
202
+ } else {
203
+ retryMsg = errorMsg + "\nWill Retry minting app NFT.";
204
+ showMessage("Transaction Failure", retryMsg, "standard");
205
+ }
206
+ return [
207
+ 3,
208
+ 7
209
+ ];
210
+ case 7:
211
+ i++;
212
+ return [
213
+ 3,
214
+ 2
215
+ ];
216
+ case 8:
217
+ return [
218
+ 2
219
+ ];
186
220
  }
187
221
  });
188
222
  });
189
- return function createAppNft(_, _1) {
223
+ return function createAppNft(_) {
190
224
  return _ref.apply(this, arguments);
191
225
  };
192
226
  }();
193
227
  export var createAppCommand = function() {
194
228
  var _ref = _async_to_generator(function(param) {
195
- var signer, url, dryRun, publisherMintAddress, storageParams, connection, _ref, appDetails, publisherDetails, _publisherDetails_address, appAddress;
229
+ var signer, url, dryRun, publisherMintAddress, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, _ref, appDetails, publisherDetails, _publisherDetails_address, _ref1, appAddress, transactionSignature;
196
230
  return _ts_generator(this, function(_state) {
197
231
  switch(_state.label){
198
232
  case 0:
199
- signer = param.signer, url = param.url, dryRun = param.dryRun, publisherMintAddress = param.publisherMintAddress, storageParams = param.storageParams;
233
+ signer = param.signer, url = param.url, dryRun = param.dryRun, publisherMintAddress = param.publisherMintAddress, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
200
234
  connection = new Connection(url);
201
235
  return [
202
236
  4,
@@ -204,6 +238,10 @@ export var createAppCommand = function() {
204
238
  ];
205
239
  case 1:
206
240
  _ref = _state.sent(), appDetails = _ref.app, publisherDetails = _ref.publisher;
241
+ if (!!dryRun) return [
242
+ 3,
243
+ 4
244
+ ];
207
245
  return [
208
246
  4,
209
247
  createAppNft({
@@ -211,17 +249,12 @@ export var createAppCommand = function() {
211
249
  publisher: signer,
212
250
  publisherMintAddress: (_publisherDetails_address = publisherDetails.address) !== null && _publisherDetails_address !== void 0 ? _publisherDetails_address : publisherMintAddress,
213
251
  appDetails: appDetails,
214
- storageParams: storageParams
215
- }, {
216
- dryRun: dryRun
252
+ storageParams: storageParams,
253
+ priorityFeeLamports: priorityFeeLamports
217
254
  })
218
255
  ];
219
256
  case 2:
220
- appAddress = _state.sent().appAddress;
221
- if (!!dryRun) return [
222
- 3,
223
- 4
224
- ];
257
+ _ref1 = _state.sent(), appAddress = _ref1.appAddress, transactionSignature = _ref1.transactionSignature;
225
258
  return [
226
259
  4,
227
260
  writeToPublishDetails({
@@ -232,14 +265,17 @@ export var createAppCommand = function() {
232
265
  ];
233
266
  case 3:
234
267
  _state.sent();
235
- _state.label = 4;
236
- case 4:
237
268
  return [
238
269
  2,
239
270
  {
240
- appAddress: appAddress
271
+ appAddress: appAddress,
272
+ transactionSignature: transactionSignature
241
273
  }
242
274
  ];
275
+ case 4:
276
+ return [
277
+ 2
278
+ ];
243
279
  }
244
280
  });
245
281
  });