@solana-mobile/dapp-store-cli 0.9.2 → 0.9.4

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/bin/dapp-store.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node --experimental-json-modules
1
+ #!/usr/bin/env node
2
2
 
3
3
  import "../lib/index.js";
package/lib/CliUtils.js CHANGED
@@ -145,9 +145,8 @@ import { Keypair, PublicKey } from "@solana/web3.js";
145
145
  import debugModule from "debug";
146
146
  import { IrysStorageDriver, keypairIdentity, Metaplex } from "@metaplex-foundation/js";
147
147
  import updateNotifier from "update-notifier";
148
- import cliPackage from "./package.json" assert {
149
- type: "json"
150
- };
148
+ import { readFile } from "fs/promises";
149
+ var cliPackage = JSON.parse((await readFile(new URL("./package.json", import.meta.url))).toString());
151
150
  import boxen from "boxen";
152
151
  import ver from "semver";
153
152
  import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
@@ -159,7 +158,7 @@ export var Constants = function Constants() {
159
158
  "use strict";
160
159
  _class_call_check(this, Constants);
161
160
  };
162
- _define_property(Constants, "CLI_VERSION", "0.9.2");
161
+ _define_property(Constants, "CLI_VERSION", "0.9.4");
163
162
  _define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
164
163
  _define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
165
164
  _define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
@@ -199,10 +198,17 @@ export var checkForSelfUpdate = function() {
199
198
  }();
200
199
  export var checkMintedStatus = function() {
201
200
  var _ref = _async_to_generator(function(conn, pubAddr, appAddr, releaseAddr) {
202
- var results, rentAccounts;
201
+ var i, _results_, _results_1, _results_2, results, isPublisherMinted, isAppMinted, isReleaseMinted, errorMessage;
203
202
  return _ts_generator(this, function(_state) {
204
203
  switch(_state.label){
205
204
  case 0:
205
+ i = 0;
206
+ _state.label = 1;
207
+ case 1:
208
+ if (!(i < 5)) return [
209
+ 3,
210
+ 4
211
+ ];
206
212
  return [
207
213
  4,
208
214
  conn.getMultipleAccountsInfo([
@@ -211,14 +217,40 @@ export var checkMintedStatus = function() {
211
217
  new PublicKey(releaseAddr)
212
218
  ])
213
219
  ];
214
- case 1:
220
+ case 2:
215
221
  results = _state.sent();
216
- rentAccounts = results.filter(function(item) {
217
- return !(item == undefined) && (item === null || item === void 0 ? void 0 : item.lamports) > 0;
218
- });
219
- if ((rentAccounts === null || rentAccounts === void 0 ? void 0 : rentAccounts.length) != 3) {
220
- throw new Error("Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.");
222
+ isPublisherMinted = results[0] != undefined && ((_results_ = results[0]) === null || _results_ === void 0 ? void 0 : _results_.lamports) > 0;
223
+ isAppMinted = results[1] != undefined && ((_results_1 = results[1]) === null || _results_1 === void 0 ? void 0 : _results_1.lamports) > 0;
224
+ isReleaseMinted = results[2] != undefined && ((_results_2 = results[2]) === null || _results_2 === void 0 ? void 0 : _results_2.lamports) > 0;
225
+ if (isPublisherMinted && isAppMinted && isReleaseMinted) {
226
+ return [
227
+ 2
228
+ ];
229
+ } else {
230
+ errorMessage = "";
231
+ if (!isPublisherMinted) {
232
+ errorMessage = errorMessage + "Publisher NFT fetch at address ".concat(pubAddr, " failed.\n");
233
+ }
234
+ if (!isAppMinted) {
235
+ errorMessage = errorMessage + "App NFT fetch at address ".concat(appAddr, " failed.\n");
236
+ }
237
+ if (!isReleaseMinted) {
238
+ errorMessage = errorMessage + "Release NFT fetch at address ".concat(releaseAddr, " failed.\n");
239
+ }
240
+ if (i == 4) {
241
+ throw new Error("Expected Publisher :: ".concat(pubAddr, ", App :: ").concat(appAddr, " and Release :: ").concat(releaseAddr, " to be minted before submission.\n\n but ").concat(errorMessage, "\n\n Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal."));
242
+ } else {
243
+ sleep(2000);
244
+ }
221
245
  }
246
+ _state.label = 3;
247
+ case 3:
248
+ i++;
249
+ return [
250
+ 3,
251
+ 1
252
+ ];
253
+ case 4:
222
254
  return [
223
255
  2
224
256
  ];
@@ -229,6 +261,11 @@ export var checkMintedStatus = function() {
229
261
  return _ref.apply(this, arguments);
230
262
  };
231
263
  }();
264
+ export var sleep = function(ms) {
265
+ return new Promise(function(resolve) {
266
+ return setTimeout(resolve, ms);
267
+ });
268
+ };
232
269
  export var parseKeypair = function(pathToKeypairFile) {
233
270
  try {
234
271
  var keypairFile = fs.readFileSync(pathToKeypairFile, "utf-8");
@@ -140,7 +140,9 @@ export var publishRemoveCommand = function() {
140
140
  2
141
141
  ];
142
142
  }
143
- connection = new Connection(url);
143
+ connection = new Connection(url, {
144
+ commitment: "confirmed"
145
+ });
144
146
  return [
145
147
  4,
146
148
  loadPublishDetailsWithChecks()
@@ -140,7 +140,9 @@ export var publishSupportCommand = function() {
140
140
  2
141
141
  ];
142
142
  }
143
- connection = new Connection(url);
143
+ connection = new Connection(url, {
144
+ commitment: "confirmed"
145
+ });
144
146
  return [
145
147
  4,
146
148
  loadPublishDetailsWithChecks()
@@ -146,7 +146,9 @@ export var publishUpdateCommand = function() {
146
146
  2
147
147
  ];
148
148
  }
149
- connection = new Connection(url);
149
+ connection = new Connection(url, {
150
+ commitment: "confirmed"
151
+ });
150
152
  return [
151
153
  4,
152
154
  loadPublishDetailsWithChecks()
@@ -1,8 +1,6 @@
1
1
  import { dump } from "js-yaml";
2
- // eslint-disable-next-line require-extensions/require-extensions
3
- import releaseSchema from "../../generated/config_obj.json" assert {
4
- type: "json"
5
- };
2
+ import { readFile } from "fs/promises";
3
+ var releaseSchema = JSON.parse((await readFile(new URL("../../generated/config_obj.json", import.meta.url))).toString());
6
4
  import fs from "fs";
7
5
  import { Constants } from "../../CliUtils.js";
8
6
  export var initScaffold = function() {
@@ -209,9 +209,8 @@ function _ts_generator(thisArg, body) {
209
209
  import { dump, load } from "js-yaml";
210
210
  import Ajv from "ajv";
211
211
  // eslint-disable-next-line require-extensions/require-extensions
212
- import schemaJson from "../generated/config_schema.json" assert {
213
- type: "json"
214
- };
212
+ import { readFile } from "fs/promises";
213
+ var schemaJson = JSON.parse((await readFile(new URL("../generated/config_schema.json", import.meta.url))).toString());
215
214
  import fs from "fs";
216
215
  import path from "path";
217
216
  import { toMetaplexFile } from "@metaplex-foundation/js";
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-cli",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@aws-sdk/client-s3": "^3.321.1",
55
55
  "@metaplex-foundation/js-plugin-aws": "^0.20.0",
56
- "@solana-mobile/dapp-store-publishing-tools": "workspace:0.9.2",
56
+ "@solana-mobile/dapp-store-publishing-tools": "workspace:0.9.4",
57
57
  "@solana/web3.js": "1.92.1",
58
58
  "@types/semver": "^7.3.13",
59
59
  "ajv": "^8.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-cli",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@aws-sdk/client-s3": "^3.321.1",
48
48
  "@metaplex-foundation/js-plugin-aws": "^0.20.0",
49
- "@solana-mobile/dapp-store-publishing-tools": "0.9.2",
49
+ "@solana-mobile/dapp-store-publishing-tools": "0.9.4",
50
50
  "@solana/web3.js": "1.92.1",
51
51
  "@types/semver": "^7.3.13",
52
52
  "ajv": "^8.11.0",
package/src/CliUtils.ts CHANGED
@@ -8,7 +8,8 @@ import {
8
8
  Metaplex,
9
9
  } from "@metaplex-foundation/js";
10
10
  import updateNotifier from "update-notifier";
11
- import cliPackage from "./package.json" assert { type: "json" };
11
+ import { readFile } from 'fs/promises';
12
+ const cliPackage = JSON.parse((await readFile(new URL("./package.json", import.meta.url))).toString());
12
13
  import boxen from "boxen";
13
14
  import ver from "semver";
14
15
  import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
@@ -18,7 +19,7 @@ import { awsStorage } from "@metaplex-foundation/js-plugin-aws";
18
19
  import { S3StorageManager } from "./config/index.js";
19
20
 
20
21
  export class Constants {
21
- static CLI_VERSION = "0.9.2";
22
+ static CLI_VERSION = "0.9.4";
22
23
  static CONFIG_FILE_NAME = "config.yaml";
23
24
  static DEFAULT_RPC_DEVNET = "https://api.devnet.solana.com";
24
25
  static DEFAULT_PRIORITY_FEE = 500000;
@@ -53,22 +54,47 @@ export const checkMintedStatus = async (
53
54
  appAddr: string,
54
55
  releaseAddr: string
55
56
  ) => {
56
- const results = await conn.getMultipleAccountsInfo([
57
- new PublicKey(pubAddr),
58
- new PublicKey(appAddr),
59
- new PublicKey(releaseAddr),
60
- ]);
61
-
62
- const rentAccounts = results.filter(
63
- (item) => !(item == undefined) && item?.lamports > 0
64
- );
65
- if (rentAccounts?.length != 3) {
66
- throw new Error(
67
- "Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal."
68
- );
57
+ for (let i = 0; i < 5; i++) {
58
+ const results = await conn.getMultipleAccountsInfo([
59
+ new PublicKey(pubAddr),
60
+ new PublicKey(appAddr),
61
+ new PublicKey(releaseAddr),
62
+ ]);
63
+
64
+ const isPublisherMinted = results[0] != undefined && results[0]?.lamports > 0
65
+ const isAppMinted = results[1] != undefined && results[1]?.lamports > 0
66
+ const isReleaseMinted = results[2] != undefined && results[2]?.lamports > 0
67
+
68
+ if (isPublisherMinted && isAppMinted && isReleaseMinted) {
69
+ return
70
+ } else {
71
+ let errorMessage = ``
72
+ if (!isPublisherMinted) {
73
+ errorMessage = errorMessage + `Publisher NFT fetch at address ${pubAddr} failed.\n`
74
+ }
75
+ if (!isAppMinted) {
76
+ errorMessage = errorMessage + `App NFT fetch at address ${appAddr} failed.\n`
77
+ }
78
+ if (!isReleaseMinted) {
79
+ errorMessage = errorMessage + `Release NFT fetch at address ${releaseAddr} failed.\n`
80
+ }
81
+ if (i == 4) {
82
+ throw new Error(
83
+ `Expected Publisher :: ${pubAddr}, App :: ${appAddr} and Release :: ${releaseAddr} to be minted before submission.\n
84
+ but ${errorMessage}\n
85
+ Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.`
86
+ );
87
+ } else {
88
+ sleep(2000)
89
+ }
90
+ }
69
91
  }
70
92
  };
71
93
 
94
+ export const sleep = (ms: number):Promise<void> => {
95
+ return new Promise(resolve => setTimeout(resolve, ms));
96
+ }
97
+
72
98
  export const parseKeypair = (pathToKeypairFile: string) => {
73
99
  try {
74
100
  const keypairFile = fs.readFileSync(pathToKeypairFile, "utf-8");
@@ -77,7 +103,7 @@ export const parseKeypair = (pathToKeypairFile: string) => {
77
103
  showMessage(
78
104
  "KeyPair Error",
79
105
  "Something went wrong when attempting to retrieve the keypair at " +
80
- pathToKeypairFile,
106
+ pathToKeypairFile,
81
107
  "error"
82
108
  );
83
109
  }
@@ -31,7 +31,13 @@ export const publishRemoveCommand = async ({
31
31
  return;
32
32
  }
33
33
 
34
- const connection = new Connection(url);
34
+ const connection = new Connection(
35
+ url,
36
+ {
37
+ commitment: "confirmed",
38
+ }
39
+ );
40
+
35
41
  const {
36
42
  publisher: publisherDetails,
37
43
  app: appDetails,
@@ -31,7 +31,13 @@ export const publishSupportCommand = async ({
31
31
  return;
32
32
  }
33
33
 
34
- const connection = new Connection(url);
34
+ const connection = new Connection(
35
+ url,
36
+ {
37
+ commitment: "confirmed",
38
+ }
39
+ );
40
+
35
41
  const {
36
42
  publisher: publisherDetails,
37
43
  app: appDetails,
@@ -45,7 +45,13 @@ export const publishUpdateCommand = async ({
45
45
  return;
46
46
  }
47
47
 
48
- const connection = new Connection(url);
48
+ const connection = new Connection(
49
+ url,
50
+ {
51
+ commitment: "confirmed",
52
+ }
53
+ );
54
+
49
55
  const {
50
56
  publisher: publisherDetails,
51
57
  app: appDetails,
@@ -1,7 +1,7 @@
1
1
  import yaml, { dump } from "js-yaml";
2
2
 
3
- // eslint-disable-next-line require-extensions/require-extensions
4
- import releaseSchema from "../../generated/config_obj.json" assert { type: "json" };
3
+ import { readFile } from 'fs/promises';
4
+ const releaseSchema = JSON.parse((await readFile(new URL("../../generated/config_obj.json", import.meta.url))).toString());
5
5
  import fs from "fs";
6
6
  import { Constants } from "../../CliUtils.js";
7
7
 
@@ -10,7 +10,8 @@ import type {
10
10
  import { dump, load } from "js-yaml";
11
11
  import Ajv from "ajv";
12
12
  // eslint-disable-next-line require-extensions/require-extensions
13
- import schemaJson from "../generated/config_schema.json" assert { type: "json" };
13
+ import { readFile } from 'fs/promises';
14
+ const schemaJson = JSON.parse((await readFile(new URL("../generated/config_schema.json", import.meta.url))).toString());
14
15
  import fs from "fs";
15
16
  import path from "path";
16
17
  import { toMetaplexFile } from "@metaplex-foundation/js";