@solana-mobile/dapp-store-cli 0.10.0 → 0.11.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.
Files changed (34) hide show
  1. package/lib/CliSetup.js +468 -568
  2. package/lib/CliUtils.js +18 -33
  3. package/lib/__tests__/CliSetupTest.js +4 -27
  4. package/lib/commands/ValidateCommand.js +15 -40
  5. package/lib/commands/create/CreateCliApp.js +18 -30
  6. package/lib/commands/create/CreateCliRelease.js +16 -26
  7. package/lib/commands/create/index.js +0 -1
  8. package/lib/commands/publish/PublishCliRemove.js +11 -19
  9. package/lib/commands/publish/PublishCliSubmit.js +11 -19
  10. package/lib/commands/publish/PublishCliSupport.js +11 -19
  11. package/lib/commands/publish/PublishCliUpdate.js +11 -19
  12. package/lib/commands/utils.js +6 -14
  13. package/lib/config/PublishDetails.js +125 -257
  14. package/lib/generated/config_obj.json +1 -1
  15. package/lib/generated/config_schema.json +1 -1
  16. package/lib/index.js +6 -14
  17. package/lib/package.json +2 -2
  18. package/lib/prebuild_schema/publishing_source.yaml +0 -4
  19. package/lib/upload/CachedStorageDriver.js +13 -19
  20. package/package.json +2 -2
  21. package/src/CliSetup.ts +5 -54
  22. package/src/CliUtils.ts +5 -11
  23. package/src/__tests__/CliSetupTest.ts +8 -43
  24. package/src/commands/ValidateCommand.ts +0 -20
  25. package/src/commands/create/CreateCliApp.ts +1 -8
  26. package/src/commands/create/index.ts +0 -1
  27. package/src/commands/publish/PublishCliRemove.ts +1 -2
  28. package/src/commands/publish/PublishCliSubmit.ts +1 -2
  29. package/src/commands/publish/PublishCliSupport.ts +1 -2
  30. package/src/commands/publish/PublishCliUpdate.ts +1 -2
  31. package/src/config/PublishDetails.ts +4 -57
  32. package/src/prebuild_schema/publishing_source.yaml +0 -4
  33. package/lib/commands/create/CreateCliPublisher.js +0 -237
  34. package/src/commands/create/CreateCliPublisher.ts +0 -87
@@ -90,18 +90,6 @@ export const loadPublishDetailsWithChecks = async (
90
90
  );
91
91
  }
92
92
 
93
- const publisherIcon = config.publisher.media?.find(
94
- (asset: any) => asset.purpose === "icon"
95
- )?.uri;
96
-
97
- if (publisherIcon) {
98
- const iconPath = path.join(process.cwd(), publisherIcon);
99
- await checkIconCompatibility(iconPath, "Publisher");
100
-
101
- const iconBuffer = await fs.promises.readFile(iconPath);
102
- config.publisher.icon = toMetaplexFile(iconBuffer, publisherIcon);
103
- }
104
-
105
93
  const appIcon = config.app.media?.find(
106
94
  (asset: any) => asset.purpose === "icon"
107
95
  )?.uri;
@@ -134,6 +122,8 @@ export const loadPublishDetailsWithChecks = async (
134
122
  if (banner) {
135
123
  const bannerPath = path.join(process.cwd(), banner);
136
124
  await checkBannerCompatibility(bannerPath);
125
+ } else {
126
+ throw new Error("Please specify banner image of size 1200x600 in your configuration file");
137
127
  }
138
128
 
139
129
  const featureGraphic = config.release.media?.find(
@@ -373,7 +363,7 @@ const getAndroidDetails = async (
373
363
  );
374
364
  }
375
365
 
376
- if (permissions.includes("com.solanamobile.seedvault.ACCESS_SEED_VAULT")) {
366
+ if (permissions.includes("com.solanamobile.seedvault.ACCESS_SEED_VAULT") || permissions.includes("com.solanamobile.seedvault.ACCESS_SEED_VAULT_PRIVILEGED")) {
377
367
  showMessage(
378
368
  "App requests Seed Vault permission",
379
369
  "If this is not a wallet application, your app maybe rejected from listing on Solana dApp Store.",
@@ -381,19 +371,6 @@ const getAndroidDetails = async (
381
371
  );
382
372
  }
383
373
 
384
- if (localeArray.length >= 60) {
385
- showMessage(
386
- "The bundle apk claims supports for following locales",
387
- "Claim for supported locales::\n" +
388
- localeArray +
389
- "\nIf this release does not support all these locales the release may be rejected" +
390
- "\nSee details at https://developer.android.com/guide/topics/resources/multilingual-support#design for configuring the supported locales",
391
- "warning"
392
- );
393
- }
394
-
395
- checkAbis(apkPath);
396
-
397
374
  return {
398
375
  android_package: appPackage?.[1] ?? "",
399
376
  min_sdk: parseInt(minSdk?.[1] ?? "0", 10),
@@ -412,35 +389,6 @@ const getAndroidDetails = async (
412
389
  }
413
390
  };
414
391
 
415
- const checkAbis = async (apkPath: string) => {
416
- try {
417
- const { stdout } = await runExec(`zipinfo -s ${apkPath} | grep \.so$`);
418
- const amV7libs = [...stdout.matchAll(/lib\/armeabi-v7a\/(.*)/g)].flatMap(permission => permission[1]);
419
- const x86libs = [...stdout.matchAll(/lib\/x86\/(.*)/g)].flatMap(permission => permission[1]);
420
- const x8664libs = [...stdout.matchAll(/lib\/x86_64\/(.*)/g)].flatMap(permission => permission[1]);
421
- if (amV7libs.length > 0 || x86libs.length > 0 || x8664libs.length > 0) {
422
-
423
- const messages = [
424
- `Solana dApp Store only supports arm64-v8a abi.`,
425
- `Your apk file contains following unsupported abis`,
426
- ... amV7libs.length > 0 ? [`\narmeabi-v7a:\n` + amV7libs] : [],
427
- ... x86libs.length > 0 ? [`\nx86:\n` + x86libs] : [],
428
- ... x8664libs.length > 0 ? [`\nx86_64:\n` + x8664libs] : [],
429
- `\n\nAlthough your app works fine on Saga, these library files are unused and increase the size of apk file making the download and update time longer for your app.`,
430
- `\n\nSee https://developer.android.com/games/optimize/64-bit#build-with-64-bit for how to optimize your app.`,
431
- ].join('\n')
432
-
433
- showMessage(
434
- `Unsupported files found in apk`,
435
- messages,
436
- `warning`
437
- )
438
- }
439
- } catch (e) {
440
- // Ignore this error.
441
- }
442
- }
443
-
444
392
  export const extractCertFingerprint = async (aaptDir: string, apkPath: string): Promise<string> => {
445
393
  const { stdout } = await runExec(`${aaptDir}/apksigner verify --print-certs -v "${apkPath}"`);
446
394
 
@@ -454,7 +402,7 @@ export const extractCertFingerprint = async (aaptDir: string, apkPath: string):
454
402
  }
455
403
  }
456
404
 
457
- export const writeToPublishDetails = async ({ publisher, app, release, lastSubmittedVersionOnChain, lastUpdatedVersionOnStore }: SaveToConfigArgs) => {
405
+ export const writeToPublishDetails = async ({ app, release, lastSubmittedVersionOnChain, lastUpdatedVersionOnStore }: SaveToConfigArgs) => {
458
406
  const currentConfig = await loadPublishDetailsWithChecks();
459
407
 
460
408
  delete currentConfig.publisher.icon;
@@ -463,7 +411,6 @@ export const writeToPublishDetails = async ({ publisher, app, release, lastSubmi
463
411
  const newConfig: PublishDetails = {
464
412
  publisher: {
465
413
  ...currentConfig.publisher,
466
- address: publisher?.address ?? currentConfig.publisher.address
467
414
  },
468
415
  app: {
469
416
  ...currentConfig.app,
@@ -1,11 +1,7 @@
1
1
  publisher:
2
2
  name: <<YOUR_PUBLISHER_NAME>>
3
- address: ""
4
3
  website: <<URL_OF_PUBLISHER_WEBSITE>>
5
4
  email: <<EMAIL_ADDRESS_TO_CONTACT_PUBLISHER>>
6
- media:
7
- - purpose: icon
8
- uri: <<RELATIVE_PATH_TO_PUBLISHER_ICON>>
9
5
  app:
10
6
  name: <<APP_NAME>>
11
7
  address: ""
@@ -1,237 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _ts_generator(thisArg, body) {
31
- var f, y, t, g, _ = {
32
- label: 0,
33
- sent: function() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- };
40
- return g = {
41
- next: verb(0),
42
- "throw": verb(1),
43
- "return": verb(2)
44
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
- return this;
46
- }), g;
47
- function verb(n) {
48
- return function(v) {
49
- return step([
50
- n,
51
- v
52
- ]);
53
- };
54
- }
55
- function step(op) {
56
- if (f) throw new TypeError("Generator is already executing.");
57
- while(_)try {
58
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59
- if (y = 0, t) op = [
60
- op[0] & 2,
61
- t.value
62
- ];
63
- switch(op[0]){
64
- case 0:
65
- case 1:
66
- t = op;
67
- break;
68
- case 4:
69
- _.label++;
70
- return {
71
- value: op[1],
72
- done: false
73
- };
74
- case 5:
75
- _.label++;
76
- y = op[1];
77
- op = [
78
- 0
79
- ];
80
- continue;
81
- case 7:
82
- op = _.ops.pop();
83
- _.trys.pop();
84
- continue;
85
- default:
86
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
- _ = 0;
88
- continue;
89
- }
90
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
- _.label = op[1];
92
- break;
93
- }
94
- if (op[0] === 6 && _.label < t[1]) {
95
- _.label = t[1];
96
- t = op;
97
- break;
98
- }
99
- if (t && _.label < t[2]) {
100
- _.label = t[2];
101
- _.ops.push(op);
102
- break;
103
- }
104
- if (t[2]) _.ops.pop();
105
- _.trys.pop();
106
- continue;
107
- }
108
- op = body.call(thisArg, _);
109
- } catch (e) {
110
- op = [
111
- 6,
112
- e
113
- ];
114
- y = 0;
115
- } finally{
116
- f = t = 0;
117
- }
118
- if (op[0] & 5) throw op[1];
119
- return {
120
- value: op[0] ? op[1] : void 0,
121
- done: true
122
- };
123
- }
124
- }
125
- import { createPublisher } from "@solana-mobile/dapp-store-publishing-tools";
126
- import { Connection, Keypair } from "@solana/web3.js";
127
- import { Constants, getMetaplexInstance } from "../../CliUtils.js";
128
- import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
129
- import { sendAndConfirmTransaction } from "../utils.js";
130
- var createPublisherNft = /*#__PURE__*/ function() {
131
- var _ref = _async_to_generator(function(param) {
132
- var connection, publisher, publisherDetails, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder, response;
133
- return _ts_generator(this, function(_state) {
134
- switch(_state.label){
135
- case 0:
136
- connection = param.connection, publisher = param.publisher, publisherDetails = param.publisherDetails, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
137
- console.info("Creating Publisher NFT");
138
- mintAddress = Keypair.generate();
139
- metaplex = getMetaplexInstance(connection, publisher, storageParams);
140
- return [
141
- 4,
142
- createPublisher({
143
- mintAddress: mintAddress,
144
- publisherDetails: publisherDetails,
145
- priorityFeeLamports: priorityFeeLamports
146
- }, {
147
- metaplex: metaplex,
148
- publisher: publisher
149
- })
150
- ];
151
- case 1:
152
- txBuilder = _state.sent();
153
- console.info("Publisher NFT data upload complete\nSigning transaction now");
154
- return [
155
- 4,
156
- sendAndConfirmTransaction(metaplex, txBuilder)
157
- ];
158
- case 2:
159
- response = _state.sent().response;
160
- return [
161
- 2,
162
- {
163
- publisherAddress: mintAddress.publicKey.toBase58(),
164
- transactionSignature: response.signature
165
- }
166
- ];
167
- }
168
- });
169
- });
170
- return function createPublisherNft(_) {
171
- return _ref.apply(this, arguments);
172
- };
173
- }();
174
- export var createPublisherCommand = /*#__PURE__*/ function() {
175
- var _ref = _async_to_generator(function(param) {
176
- var signer, url, dryRun, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, _ref, publisherDetails, _ref1, publisherAddress, transactionSignature;
177
- return _ts_generator(this, function(_state) {
178
- switch(_state.label){
179
- case 0:
180
- signer = param.signer, url = param.url, dryRun = param.dryRun, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
181
- connection = new Connection(url, {
182
- commitment: "confirmed"
183
- });
184
- return [
185
- 4,
186
- loadPublishDetailsWithChecks()
187
- ];
188
- case 1:
189
- _ref = _state.sent(), publisherDetails = _ref.publisher;
190
- if (!!dryRun) return [
191
- 3,
192
- 4
193
- ];
194
- return [
195
- 4,
196
- createPublisherNft({
197
- connection: connection,
198
- publisher: signer,
199
- publisherDetails: publisherDetails,
200
- storageParams: storageParams,
201
- priorityFeeLamports: priorityFeeLamports
202
- })
203
- ];
204
- case 2:
205
- _ref1 = _state.sent(), publisherAddress = _ref1.publisherAddress, transactionSignature = _ref1.transactionSignature;
206
- return [
207
- 4,
208
- writeToPublishDetails({
209
- publisher: {
210
- address: publisherAddress
211
- }
212
- })
213
- ];
214
- case 3:
215
- _state.sent();
216
- return [
217
- 2,
218
- {
219
- publisherAddress: publisherAddress,
220
- transactionSignature: transactionSignature
221
- }
222
- ];
223
- case 4:
224
- return [
225
- 2,
226
- {
227
- publisherAddress: "",
228
- transactionSignature: ""
229
- }
230
- ];
231
- }
232
- });
233
- });
234
- return function createPublisherCommand(_) {
235
- return _ref.apply(this, arguments);
236
- };
237
- }();
@@ -1,87 +0,0 @@
1
- import type { Publisher } from "@solana-mobile/dapp-store-publishing-tools";
2
- import { createPublisher } from "@solana-mobile/dapp-store-publishing-tools";
3
- import {
4
- Connection,
5
- Keypair,
6
- } from "@solana/web3.js";
7
-
8
- import {
9
- Constants,
10
- getMetaplexInstance,
11
- } from "../../CliUtils.js";
12
- import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
13
- import { sendAndConfirmTransaction } from "../utils.js";
14
-
15
- const createPublisherNft = async (
16
- {
17
- connection,
18
- publisher,
19
- publisherDetails,
20
- storageParams,
21
- priorityFeeLamports,
22
- }: {
23
- connection: Connection;
24
- publisher: Keypair;
25
- publisherDetails: Publisher;
26
- storageParams: string;
27
- priorityFeeLamports: number;
28
- },
29
- ) => {
30
- console.info(`Creating Publisher NFT`);
31
- const mintAddress = Keypair.generate();
32
- const metaplex = getMetaplexInstance(connection, publisher, storageParams);
33
- const txBuilder = await createPublisher(
34
- { mintAddress, publisherDetails, priorityFeeLamports },
35
- { metaplex, publisher }
36
- );
37
-
38
- console.info(`Publisher NFT data upload complete\nSigning transaction now`);
39
-
40
- const { response } = await sendAndConfirmTransaction(metaplex, txBuilder);
41
-
42
- return {
43
- publisherAddress: mintAddress.publicKey.toBase58(),
44
- transactionSignature: response.signature,
45
- };
46
- };
47
-
48
- export const createPublisherCommand = async ({
49
- signer,
50
- url,
51
- dryRun,
52
- storageParams,
53
- priorityFeeLamports = Constants.DEFAULT_PRIORITY_FEE,
54
- }: {
55
- signer: Keypair;
56
- url: string;
57
- dryRun: boolean;
58
- storageParams: string;
59
- priorityFeeLamports: number;
60
- }) => {
61
- const connection = new Connection(
62
- url,
63
- {
64
- commitment: "confirmed",
65
- }
66
- );
67
-
68
- const { publisher: publisherDetails } = await loadPublishDetailsWithChecks();
69
-
70
- if (!dryRun) {
71
- const { publisherAddress, transactionSignature } = await createPublisherNft(
72
- {
73
- connection,
74
- publisher: signer,
75
- publisherDetails,
76
- storageParams: storageParams,
77
- priorityFeeLamports: priorityFeeLamports,
78
- },
79
- );
80
-
81
- await writeToPublishDetails({ publisher: { address: publisherAddress } });
82
-
83
- return { publisherAddress, transactionSignature };
84
- }
85
-
86
- return { publisherAddress: "", transactionSignature: "" };
87
- };