@solana-mobile/dapp-store-cli 0.7.3 → 0.8.1
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 +74 -38
- package/lib/CliUtils.js +5 -1
- package/lib/__tests__/CliSetupTest.js +3 -3
- package/lib/commands/ValidateCommand.js +27 -5
- package/lib/commands/create/CreateCliApp.js +68 -32
- package/lib/commands/create/CreateCliPublisher.js +68 -28
- package/lib/commands/create/CreateCliRelease.js +20 -15
- package/lib/config/PublishDetails.js +9 -3
- package/lib/package.json +2 -2
- package/lib/upload/CachedStorageDriver.js +1 -10
- package/package.json +2 -2
- package/src/CliSetup.ts +62 -24
- package/src/CliUtils.ts +6 -1
- package/src/__tests__/CliSetupTest.ts +15 -12
- package/src/commands/ValidateCommand.ts +38 -4
- package/src/commands/create/CreateCliApp.ts +46 -27
- package/src/commands/create/CreateCliPublisher.ts +45 -30
- package/src/commands/create/CreateCliRelease.ts +19 -8
- package/src/config/PublishDetails.ts +18 -6
- package/src/upload/CachedStorageDriver.ts +1 -10
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
|
-
|
|
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,14 +261,20 @@ 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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
280
|
return [
|
|
@@ -284,17 +296,17 @@ export var createPublisherCliCmd = createCliCmd.command("publisher").description
|
|
|
284
296
|
return _ref.apply(this, arguments);
|
|
285
297
|
};
|
|
286
298
|
}());
|
|
287
|
-
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() {
|
|
288
300
|
var _ref = _async_to_generator(function(param) {
|
|
289
|
-
var publisherMintAddress, keypair, url, dryRun, storageConfig;
|
|
301
|
+
var publisherMintAddress, keypair, url, dryRun, storageConfig, priorityFeeLamports;
|
|
290
302
|
return _ts_generator(this, function(_state) {
|
|
291
303
|
switch(_state.label){
|
|
292
304
|
case 0:
|
|
293
|
-
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;
|
|
294
306
|
return [
|
|
295
307
|
4,
|
|
296
308
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
297
|
-
var config, signer, result, displayUrl, resultText;
|
|
309
|
+
var config, signer, result, displayUrl, transactionUrl, resultText;
|
|
298
310
|
return _ts_generator(this, function(_state) {
|
|
299
311
|
switch(_state.label){
|
|
300
312
|
case 0:
|
|
@@ -326,14 +338,20 @@ export var createAppCliCmd = createCliCmd.command("app").description("Create a a
|
|
|
326
338
|
signer: signer,
|
|
327
339
|
url: url,
|
|
328
340
|
dryRun: dryRun,
|
|
329
|
-
storageParams: storageConfig
|
|
341
|
+
storageParams: storageConfig,
|
|
342
|
+
priorityFeeLamports: priorityFeeLamports
|
|
330
343
|
})
|
|
331
344
|
];
|
|
332
345
|
case 3:
|
|
333
346
|
result = _state.sent();
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
+
}
|
|
337
355
|
_state.label = 4;
|
|
338
356
|
case 4:
|
|
339
357
|
return [
|
|
@@ -355,17 +373,17 @@ export var createAppCliCmd = createCliCmd.command("app").description("Create a a
|
|
|
355
373
|
return _ref.apply(this, arguments);
|
|
356
374
|
};
|
|
357
375
|
}());
|
|
358
|
-
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() {
|
|
359
377
|
var _ref = _async_to_generator(function(param) {
|
|
360
|
-
var appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig;
|
|
378
|
+
var appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig, priorityFeeLamports;
|
|
361
379
|
return _ts_generator(this, function(_state) {
|
|
362
380
|
switch(_state.label){
|
|
363
381
|
case 0:
|
|
364
|
-
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;
|
|
365
383
|
return [
|
|
366
384
|
4,
|
|
367
385
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
368
|
-
var resolvedBuildToolsPath, config, signer, result, displayUrl, resultText;
|
|
386
|
+
var resolvedBuildToolsPath, config, signer, result, displayUrl, transactionUrl, resultText;
|
|
369
387
|
return _ts_generator(this, function(_state) {
|
|
370
388
|
switch(_state.label){
|
|
371
389
|
case 0:
|
|
@@ -402,14 +420,20 @@ export var createReleaseCliCmd = createCliCmd.command("release").description("Cr
|
|
|
402
420
|
signer: signer,
|
|
403
421
|
url: url,
|
|
404
422
|
dryRun: dryRun,
|
|
405
|
-
storageParams: storageConfig
|
|
423
|
+
storageParams: storageConfig,
|
|
424
|
+
priorityFeeLamports: priorityFeeLamports
|
|
406
425
|
})
|
|
407
426
|
];
|
|
408
427
|
case 3:
|
|
409
428
|
result = _state.sent();
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
+
}
|
|
413
437
|
_state.label = 4;
|
|
414
438
|
case 4:
|
|
415
439
|
return [
|
|
@@ -502,7 +526,7 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
|
|
|
502
526
|
return [
|
|
503
527
|
4,
|
|
504
528
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
505
|
-
var config, signer
|
|
529
|
+
var config, signer;
|
|
506
530
|
return _ts_generator(this, function(_state) {
|
|
507
531
|
switch(_state.label){
|
|
508
532
|
case 0:
|
|
@@ -546,8 +570,11 @@ publishCommand.command("submit").description("Submit a new app to the Solana Mob
|
|
|
546
570
|
];
|
|
547
571
|
case 4:
|
|
548
572
|
_state.sent();
|
|
549
|
-
|
|
550
|
-
|
|
573
|
+
if (dryRun) {
|
|
574
|
+
dryRunSuccessMessage();
|
|
575
|
+
} else {
|
|
576
|
+
showMessage("Success", "Successfully submitted to the Solana Mobile dApp publisher portal");
|
|
577
|
+
}
|
|
551
578
|
_state.label = 5;
|
|
552
579
|
case 5:
|
|
553
580
|
return [
|
|
@@ -579,7 +606,7 @@ publishCommand.command("update").description("Update an existing app on the Sola
|
|
|
579
606
|
return [
|
|
580
607
|
4,
|
|
581
608
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
582
|
-
var config, signer
|
|
609
|
+
var config, signer;
|
|
583
610
|
return _ts_generator(this, function(_state) {
|
|
584
611
|
switch(_state.label){
|
|
585
612
|
case 0:
|
|
@@ -624,8 +651,11 @@ publishCommand.command("update").description("Update an existing app on the Sola
|
|
|
624
651
|
];
|
|
625
652
|
case 4:
|
|
626
653
|
_state.sent();
|
|
627
|
-
|
|
628
|
-
|
|
654
|
+
if (dryRun) {
|
|
655
|
+
dryRunSuccessMessage();
|
|
656
|
+
} else {
|
|
657
|
+
showMessage("Success", "dApp successfully updated on the publisher portal");
|
|
658
|
+
}
|
|
629
659
|
_state.label = 5;
|
|
630
660
|
case 5:
|
|
631
661
|
return [
|
|
@@ -657,7 +687,7 @@ publishCommand.command("remove").description("Remove an existing app from the So
|
|
|
657
687
|
return [
|
|
658
688
|
4,
|
|
659
689
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
660
|
-
var config, signer
|
|
690
|
+
var config, signer;
|
|
661
691
|
return _ts_generator(this, function(_state) {
|
|
662
692
|
switch(_state.label){
|
|
663
693
|
case 0:
|
|
@@ -701,8 +731,11 @@ publishCommand.command("remove").description("Remove an existing app from the So
|
|
|
701
731
|
];
|
|
702
732
|
case 4:
|
|
703
733
|
_state.sent();
|
|
704
|
-
|
|
705
|
-
|
|
734
|
+
if (dryRun) {
|
|
735
|
+
dryRunSuccessMessage();
|
|
736
|
+
} else {
|
|
737
|
+
showMessage("Success", "dApp successfully removed from the publisher portal");
|
|
738
|
+
}
|
|
706
739
|
_state.label = 5;
|
|
707
740
|
case 5:
|
|
708
741
|
return [
|
|
@@ -734,7 +767,7 @@ publishCommand.command("support <request_details>").description("Submit a suppor
|
|
|
734
767
|
return [
|
|
735
768
|
4,
|
|
736
769
|
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
737
|
-
var config, signer
|
|
770
|
+
var config, signer;
|
|
738
771
|
return _ts_generator(this, function(_state) {
|
|
739
772
|
switch(_state.label){
|
|
740
773
|
case 0:
|
|
@@ -778,8 +811,11 @@ publishCommand.command("support <request_details>").description("Submit a suppor
|
|
|
778
811
|
];
|
|
779
812
|
case 4:
|
|
780
813
|
_state.sent();
|
|
781
|
-
|
|
782
|
-
|
|
814
|
+
if (dryRun) {
|
|
815
|
+
dryRunSuccessMessage();
|
|
816
|
+
} else {
|
|
817
|
+
showMessage("Success", "Support request sent successfully");
|
|
818
|
+
}
|
|
783
819
|
_state.label = 5;
|
|
784
820
|
case 5:
|
|
785
821
|
return [
|
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.
|
|
162
|
+
_define_property(Constants, "CLI_VERSION", "0.8.1");
|
|
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>
|
|
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>
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
131
|
-
var appDetails, connection, publisherMintAddress, publisher, storageParams,
|
|
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,
|
|
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
|
|
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
|
|
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(_
|
|
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
|
-
|
|
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
|
});
|