@solana-mobile/dapp-store-cli 0.4.2 → 0.5.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 (112) hide show
  1. package/bin/dapp-store.js +1 -1
  2. package/lib/CliSetup.js +730 -0
  3. package/lib/CliUtils.js +309 -0
  4. package/lib/__tests__/CliSetupTest.js +140 -0
  5. package/lib/commands/ValidateCommand.js +201 -0
  6. package/lib/commands/create/CreateCliApp.js +240 -0
  7. package/lib/commands/create/CreateCliPublisher.js +238 -0
  8. package/lib/commands/create/CreateCliRelease.js +270 -0
  9. package/lib/commands/create/index.js +41 -0
  10. package/lib/{esm/commands → commands}/index.js +0 -1
  11. package/lib/commands/publish/PublishCliRemove.js +186 -0
  12. package/lib/commands/publish/PublishCliSubmit.js +192 -0
  13. package/lib/commands/publish/PublishCliSupport.js +186 -0
  14. package/lib/commands/publish/PublishCliUpdate.js +193 -0
  15. package/lib/commands/publish/index.js +22 -0
  16. package/lib/{esm/commands → commands}/scaffolding/ScaffoldInit.js +7 -6
  17. package/lib/{esm/commands → commands}/scaffolding/index.js +0 -1
  18. package/lib/config/EnvVariables.js +59 -0
  19. package/lib/config/PublishDetails.js +591 -0
  20. package/lib/config/S3StorageManager.js +93 -0
  21. package/lib/config/index.js +2 -0
  22. package/lib/generated/config_obj.json +1 -0
  23. package/lib/generated/config_schema.json +1 -0
  24. package/lib/index.js +148 -0
  25. package/lib/package.json +74 -0
  26. package/lib/prebuild_schema/publishing_source.yaml +46 -0
  27. package/lib/prebuild_schema/schemagen.js +20 -0
  28. package/lib/upload/CachedStorageDriver.js +307 -0
  29. package/lib/{esm/upload → upload}/index.js +0 -1
  30. package/package.json +21 -7
  31. package/src/CliSetup.ts +511 -0
  32. package/src/CliUtils.ts +64 -19
  33. package/src/__tests__/CliSetupTest.ts +212 -0
  34. package/src/commands/create/CreateCliApp.ts +6 -1
  35. package/src/commands/create/CreateCliPublisher.ts +6 -1
  36. package/src/commands/create/CreateCliRelease.ts +6 -1
  37. package/src/config/EnvVariables.ts +39 -0
  38. package/src/config/PublishDetails.ts +16 -2
  39. package/src/config/S3StorageManager.ts +47 -0
  40. package/src/config/index.ts +2 -0
  41. package/src/index.ts +3 -510
  42. package/lib/esm/CliUtils.js +0 -108
  43. package/lib/esm/CliUtils.js.map +0 -1
  44. package/lib/esm/commands/ValidateCommand.js +0 -42
  45. package/lib/esm/commands/ValidateCommand.js.map +0 -1
  46. package/lib/esm/commands/create/CreateCliApp.js +0 -41
  47. package/lib/esm/commands/create/CreateCliApp.js.map +0 -1
  48. package/lib/esm/commands/create/CreateCliPublisher.js +0 -36
  49. package/lib/esm/commands/create/CreateCliPublisher.js.map +0 -1
  50. package/lib/esm/commands/create/CreateCliRelease.js +0 -50
  51. package/lib/esm/commands/create/CreateCliRelease.js.map +0 -1
  52. package/lib/esm/commands/create/index.js +0 -44
  53. package/lib/esm/commands/create/index.js.map +0 -1
  54. package/lib/esm/commands/index.js.map +0 -1
  55. package/lib/esm/commands/publish/PublishCliRemove.js +0 -26
  56. package/lib/esm/commands/publish/PublishCliRemove.js.map +0 -1
  57. package/lib/esm/commands/publish/PublishCliSubmit.js +0 -31
  58. package/lib/esm/commands/publish/PublishCliSubmit.js.map +0 -1
  59. package/lib/esm/commands/publish/PublishCliSupport.js +0 -26
  60. package/lib/esm/commands/publish/PublishCliSupport.js.map +0 -1
  61. package/lib/esm/commands/publish/PublishCliUpdate.js +0 -32
  62. package/lib/esm/commands/publish/PublishCliUpdate.js.map +0 -1
  63. package/lib/esm/commands/publish/index.js +0 -25
  64. package/lib/esm/commands/publish/index.js.map +0 -1
  65. package/lib/esm/commands/scaffolding/ScaffoldInit.js.map +0 -1
  66. package/lib/esm/commands/scaffolding/index.js.map +0 -1
  67. package/lib/esm/config/PublishDetails.js +0 -177
  68. package/lib/esm/config/PublishDetails.js.map +0 -1
  69. package/lib/esm/generated/config_obj.json +0 -1
  70. package/lib/esm/generated/config_schema.json +0 -1
  71. package/lib/esm/index.js +0 -307
  72. package/lib/esm/index.js.map +0 -1
  73. package/lib/esm/package.json +0 -60
  74. package/lib/esm/upload/CachedStorageDriver.js +0 -66
  75. package/lib/esm/upload/CachedStorageDriver.js.map +0 -1
  76. package/lib/esm/upload/index.js.map +0 -1
  77. package/lib/types/CliUtils.d.ts +0 -21
  78. package/lib/types/CliUtils.d.ts.map +0 -1
  79. package/lib/types/commands/ValidateCommand.d.ts +0 -6
  80. package/lib/types/commands/ValidateCommand.d.ts.map +0 -1
  81. package/lib/types/commands/create/CreateCliApp.d.ts +0 -12
  82. package/lib/types/commands/create/CreateCliApp.d.ts.map +0 -1
  83. package/lib/types/commands/create/CreateCliPublisher.d.ts +0 -9
  84. package/lib/types/commands/create/CreateCliPublisher.d.ts.map +0 -1
  85. package/lib/types/commands/create/CreateCliRelease.d.ts +0 -13
  86. package/lib/types/commands/create/CreateCliRelease.d.ts.map +0 -1
  87. package/lib/types/commands/create/index.d.ts +0 -4
  88. package/lib/types/commands/create/index.d.ts.map +0 -1
  89. package/lib/types/commands/index.d.ts +0 -4
  90. package/lib/types/commands/index.d.ts.map +0 -1
  91. package/lib/types/commands/publish/PublishCliRemove.d.ts +0 -13
  92. package/lib/types/commands/publish/PublishCliRemove.d.ts.map +0 -1
  93. package/lib/types/commands/publish/PublishCliSubmit.d.ts +0 -13
  94. package/lib/types/commands/publish/PublishCliSubmit.d.ts.map +0 -1
  95. package/lib/types/commands/publish/PublishCliSupport.d.ts +0 -13
  96. package/lib/types/commands/publish/PublishCliSupport.d.ts.map +0 -1
  97. package/lib/types/commands/publish/PublishCliUpdate.d.ts +0 -14
  98. package/lib/types/commands/publish/PublishCliUpdate.d.ts.map +0 -1
  99. package/lib/types/commands/publish/index.d.ts +0 -5
  100. package/lib/types/commands/publish/index.d.ts.map +0 -1
  101. package/lib/types/commands/scaffolding/ScaffoldInit.d.ts +0 -2
  102. package/lib/types/commands/scaffolding/ScaffoldInit.d.ts.map +0 -1
  103. package/lib/types/commands/scaffolding/index.d.ts +0 -2
  104. package/lib/types/commands/scaffolding/index.d.ts.map +0 -1
  105. package/lib/types/config/PublishDetails.d.ts +0 -17
  106. package/lib/types/config/PublishDetails.d.ts.map +0 -1
  107. package/lib/types/index.d.ts +0 -2
  108. package/lib/types/index.d.ts.map +0 -1
  109. package/lib/types/upload/CachedStorageDriver.d.ts +0 -30
  110. package/lib/types/upload/CachedStorageDriver.d.ts.map +0 -1
  111. package/lib/types/upload/index.d.ts +0 -2
  112. package/lib/types/upload/index.d.ts.map +0 -1
@@ -0,0 +1,270 @@
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 _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ function _object_spread(target) {
44
+ for(var i = 1; i < arguments.length; i++){
45
+ var source = arguments[i] != null ? arguments[i] : {};
46
+ var ownKeys = Object.keys(source);
47
+ if (typeof Object.getOwnPropertySymbols === "function") {
48
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
+ }));
51
+ }
52
+ ownKeys.forEach(function(key) {
53
+ _define_property(target, key, source[key]);
54
+ });
55
+ }
56
+ return target;
57
+ }
58
+ function _ts_generator(thisArg, body) {
59
+ var f, y, t, g, _ = {
60
+ label: 0,
61
+ sent: function() {
62
+ if (t[0] & 1) throw t[1];
63
+ return t[1];
64
+ },
65
+ trys: [],
66
+ ops: []
67
+ };
68
+ return(g = {
69
+ next: verb(0),
70
+ "throw": verb(1),
71
+ "return": verb(2)
72
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
73
+ return this;
74
+ }), g);
75
+ function verb(n) {
76
+ return function(v) {
77
+ return step([
78
+ n,
79
+ v
80
+ ]);
81
+ };
82
+ }
83
+ function step(op) {
84
+ if (f) throw new TypeError("Generator is already executing.");
85
+ while(_)try {
86
+ 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;
87
+ if (y = 0, t) op = [
88
+ op[0] & 2,
89
+ t.value
90
+ ];
91
+ switch(op[0]){
92
+ case 0:
93
+ case 1:
94
+ t = op;
95
+ break;
96
+ case 4:
97
+ _.label++;
98
+ return {
99
+ value: op[1],
100
+ done: false
101
+ };
102
+ case 5:
103
+ _.label++;
104
+ y = op[1];
105
+ op = [
106
+ 0
107
+ ];
108
+ continue;
109
+ case 7:
110
+ op = _.ops.pop();
111
+ _.trys.pop();
112
+ continue;
113
+ default:
114
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
115
+ _ = 0;
116
+ continue;
117
+ }
118
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
119
+ _.label = op[1];
120
+ break;
121
+ }
122
+ if (op[0] === 6 && _.label < t[1]) {
123
+ _.label = t[1];
124
+ t = op;
125
+ break;
126
+ }
127
+ if (t && _.label < t[2]) {
128
+ _.label = t[2];
129
+ _.ops.push(op);
130
+ break;
131
+ }
132
+ if (t[2]) _.ops.pop();
133
+ _.trys.pop();
134
+ continue;
135
+ }
136
+ op = body.call(thisArg, _);
137
+ } catch (e) {
138
+ op = [
139
+ 6,
140
+ e
141
+ ];
142
+ y = 0;
143
+ } finally{
144
+ f = t = 0;
145
+ }
146
+ if (op[0] & 5) throw op[1];
147
+ return {
148
+ value: op[0] ? op[1] : void 0,
149
+ done: true
150
+ };
151
+ }
152
+ }
153
+ import { createRelease } from "@solana-mobile/dapp-store-publishing-tools";
154
+ import { Connection, Keypair, PublicKey, sendAndConfirmTransaction } from "@solana/web3.js";
155
+ import { getMetaplexInstance } from "../../CliUtils.js";
156
+ import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
157
+ var createReleaseNft = function() {
158
+ var _ref = _async_to_generator(function(param) {
159
+ var appMintAddress, releaseDetails, appDetails, publisherDetails, connection, publisher, storageParams, releaseMintAddress, metaplex, txBuilder, blockhash, tx, txSig;
160
+ return _ts_generator(this, function(_state) {
161
+ switch(_state.label){
162
+ case 0:
163
+ appMintAddress = param.appMintAddress, releaseDetails = param.releaseDetails, appDetails = param.appDetails, publisherDetails = param.publisherDetails, connection = param.connection, publisher = param.publisher, storageParams = param.storageParams;
164
+ releaseMintAddress = Keypair.generate();
165
+ metaplex = getMetaplexInstance(connection, publisher, storageParams);
166
+ return [
167
+ 4,
168
+ createRelease({
169
+ appMintAddress: new PublicKey(appMintAddress),
170
+ releaseMintAddress: releaseMintAddress,
171
+ releaseDetails: releaseDetails,
172
+ appDetails: appDetails,
173
+ publisherDetails: publisherDetails
174
+ }, {
175
+ metaplex: metaplex,
176
+ publisher: publisher
177
+ })
178
+ ];
179
+ case 1:
180
+ txBuilder = _state.sent().txBuilder;
181
+ return [
182
+ 4,
183
+ connection.getLatestBlockhashAndContext()
184
+ ];
185
+ case 2:
186
+ blockhash = _state.sent();
187
+ tx = txBuilder.toTransaction(blockhash.value);
188
+ tx.sign(releaseMintAddress, publisher);
189
+ return [
190
+ 4,
191
+ sendAndConfirmTransaction(connection, tx, [
192
+ publisher,
193
+ releaseMintAddress
194
+ ], {
195
+ minContextSlot: blockhash.context.slot
196
+ })
197
+ ];
198
+ case 3:
199
+ txSig = _state.sent();
200
+ console.info({
201
+ txSig: txSig,
202
+ releaseMintAddress: releaseMintAddress.publicKey.toBase58()
203
+ });
204
+ return [
205
+ 2,
206
+ {
207
+ releaseAddress: releaseMintAddress.publicKey.toBase58()
208
+ }
209
+ ];
210
+ }
211
+ });
212
+ });
213
+ return function createReleaseNft(_) {
214
+ return _ref.apply(this, arguments);
215
+ };
216
+ }();
217
+ export var createReleaseCommand = function() {
218
+ var _ref = _async_to_generator(function(param) {
219
+ var appMintAddress, buildToolsPath, signer, url, _param_dryRun, dryRun, storageParams, connection, _ref, release, app, publisher, _app_address, releaseAddress;
220
+ return _ts_generator(this, function(_state) {
221
+ switch(_state.label){
222
+ case 0:
223
+ appMintAddress = param.appMintAddress, buildToolsPath = param.buildToolsPath, signer = param.signer, url = param.url, _param_dryRun = param.dryRun, dryRun = _param_dryRun === void 0 ? false : _param_dryRun, storageParams = param.storageParams;
224
+ connection = new Connection(url);
225
+ return [
226
+ 4,
227
+ loadPublishDetailsWithChecks(buildToolsPath)
228
+ ];
229
+ case 1:
230
+ _ref = _state.sent(), release = _ref.release, app = _ref.app, publisher = _ref.publisher;
231
+ if (!!dryRun) return [
232
+ 3,
233
+ 3
234
+ ];
235
+ return [
236
+ 4,
237
+ createReleaseNft({
238
+ appMintAddress: (_app_address = app.address) !== null && _app_address !== void 0 ? _app_address : appMintAddress,
239
+ connection: connection,
240
+ publisher: signer,
241
+ releaseDetails: _object_spread({}, release),
242
+ appDetails: app,
243
+ publisherDetails: publisher,
244
+ storageParams: storageParams
245
+ })
246
+ ];
247
+ case 2:
248
+ releaseAddress = _state.sent().releaseAddress;
249
+ writeToPublishDetails({
250
+ release: {
251
+ address: releaseAddress
252
+ }
253
+ });
254
+ return [
255
+ 2,
256
+ {
257
+ releaseAddress: releaseAddress
258
+ }
259
+ ];
260
+ case 3:
261
+ return [
262
+ 2
263
+ ];
264
+ }
265
+ });
266
+ });
267
+ return function createReleaseCommand(_) {
268
+ return _ref.apply(this, arguments);
269
+ };
270
+ }();
@@ -0,0 +1,41 @@
1
+ export * from "./CreateCliPublisher.js";
2
+ export * from "./CreateCliApp.js";
3
+ export * from "./CreateCliRelease.js"; /*
4
+ * Module responsible for creating publishers, apps, and releases (in that order)
5
+ * Anything that is out-of-order will be prompted back into order
6
+ * And steps that happen more than once will do their best to remember as much information as possible.
7
+ * We will ask questions and do our best to answer anything that's already been configured, and prompt for anything that's not
8
+ */ // We'll never ask for private keys or seed phrases
9
+ // You can use a burner signer to publish; all NFTs require verification from the publisher signer
10
+ // You can use a multisig or Ledger for that purpose
11
+ // Publisher
12
+ // Public key attached to a publisher must also verify applications and releases
13
+ // Most information here can be be edited after the fact
14
+ // Only required fields are name, address, publisher website, and contact
15
+ // Optional fields are: description, image_url (need dimensions!)
16
+ // App
17
+ // Publisher creator key required
18
+ // Most information can be edited after the fact
19
+ // Required: name, description, `android_package`
20
+ // Optional: Any additional creator keys
21
+ // TODO(jon): Probably okay to capture more information here like:
22
+ // - `license_url`
23
+ // - `copyright_url`
24
+ // - `privacy_policy_url`
25
+ // Release
26
+ // Publisher creator key required
27
+ // Immutable; information cannot be edited after publishing.
28
+ // Change based on the review process must result in a new release
29
+ // Required:
30
+ // - version (automatically prompt with semver + 1)
31
+ // - release notes (description)
32
+ // - publisher creator key
33
+ // - path to the APK
34
+ // Optional:
35
+ // - Media related to the release
36
+ // - New permissions (prompted)
37
+ // - New languages (prompted)
38
+ // Handles uploads of all files, sha'ing them
39
+ // Handles i18n (later)
40
+ // We'll attempt to read as much as possible from a provided `.yml` file
41
+ // If there are provided folders that are well-structured, we'll opt to use that too.
@@ -1,4 +1,3 @@
1
1
  export * from "./create/index.js";
2
2
  export * from "./publish/index.js";
3
3
  export * from "./ValidateCommand.js";
4
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,186 @@
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 { Connection } from "@solana/web3.js";
126
+ import { publishRemove } from "@solana-mobile/dapp-store-publishing-tools";
127
+ import { checkMintedStatus } from "../../CliUtils.js";
128
+ import nacl from "tweetnacl";
129
+ import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
130
+ export var publishRemoveCommand = function() {
131
+ var _ref = _async_to_generator(function(param) {
132
+ var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_requestorIsAuthorized, requestorIsAuthorized, _param_critical, critical, connection, _ref, publisherDetails, appDetails, releaseDetails, sign, pubAddr, appAddr, releaseAddr;
133
+ return _ts_generator(this, function(_state) {
134
+ switch(_state.label){
135
+ case 0:
136
+ appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, signer = param.signer, url = param.url, _param_dryRun = param.dryRun, dryRun = _param_dryRun === void 0 ? false : _param_dryRun, _param_requestorIsAuthorized = param.requestorIsAuthorized, requestorIsAuthorized = _param_requestorIsAuthorized === void 0 ? false : _param_requestorIsAuthorized, _param_critical = param.critical, critical = _param_critical === void 0 ? false : _param_critical;
137
+ if (!requestorIsAuthorized) {
138
+ console.error("ERROR: Cannot submit a request for which the requestor does not attest they are authorized to do so");
139
+ return [
140
+ 2
141
+ ];
142
+ }
143
+ connection = new Connection(url);
144
+ return [
145
+ 4,
146
+ loadPublishDetailsWithChecks()
147
+ ];
148
+ case 1:
149
+ _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release;
150
+ sign = function(buf) {
151
+ return nacl.sign(buf, signer.secretKey);
152
+ };
153
+ pubAddr = publisherDetails.address;
154
+ appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
155
+ releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
156
+ return [
157
+ 4,
158
+ checkMintedStatus(connection, pubAddr, appAddr, releaseAddr)
159
+ ];
160
+ case 2:
161
+ _state.sent();
162
+ return [
163
+ 4,
164
+ publishRemove({
165
+ connection: connection,
166
+ sign: sign
167
+ }, {
168
+ appMintAddress: appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address,
169
+ releaseMintAddress: releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address,
170
+ publisherDetails: publisherDetails,
171
+ requestorIsAuthorized: requestorIsAuthorized,
172
+ criticalUpdate: critical
173
+ }, dryRun)
174
+ ];
175
+ case 3:
176
+ _state.sent();
177
+ return [
178
+ 2
179
+ ];
180
+ }
181
+ });
182
+ });
183
+ return function publishRemoveCommand(_) {
184
+ return _ref.apply(this, arguments);
185
+ };
186
+ }();
@@ -0,0 +1,192 @@
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 { Connection } from "@solana/web3.js";
126
+ import { publishSubmit } from "@solana-mobile/dapp-store-publishing-tools";
127
+ import nacl from "tweetnacl";
128
+ import { checkMintedStatus } from "../../CliUtils.js";
129
+ import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
130
+ export var publishSubmitCommand = function() {
131
+ var _ref = _async_to_generator(function(param) {
132
+ var appMintAddress, releaseMintAddress, signer, url, _param_dryRun, dryRun, _param_compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized, requestorIsAuthorized, connection, _ref, publisherDetails, appDetails, releaseDetails, solanaMobileDappPublisherPortalDetails, sign, pubAddr, appAddr, releaseAddr;
133
+ return _ts_generator(this, function(_state) {
134
+ switch(_state.label){
135
+ case 0:
136
+ appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, signer = param.signer, url = param.url, _param_dryRun = param.dryRun, dryRun = _param_dryRun === void 0 ? false : _param_dryRun, _param_compliesWithSolanaDappStorePolicies = param.compliesWithSolanaDappStorePolicies, compliesWithSolanaDappStorePolicies = _param_compliesWithSolanaDappStorePolicies === void 0 ? false : _param_compliesWithSolanaDappStorePolicies, _param_requestorIsAuthorized = param.requestorIsAuthorized, requestorIsAuthorized = _param_requestorIsAuthorized === void 0 ? false : _param_requestorIsAuthorized;
137
+ if (!compliesWithSolanaDappStorePolicies) {
138
+ console.error("ERROR: Cannot submit a request for which the requestor does not attest that it complies with Solana dApp Store policies");
139
+ return [
140
+ 2
141
+ ];
142
+ } else if (!requestorIsAuthorized) {
143
+ console.error("ERROR: Cannot submit a request for which the requestor does not attest they are authorized to do so");
144
+ return [
145
+ 2
146
+ ];
147
+ }
148
+ connection = new Connection(url);
149
+ return [
150
+ 4,
151
+ loadPublishDetailsWithChecks()
152
+ ];
153
+ case 1:
154
+ _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release, solanaMobileDappPublisherPortalDetails = _ref.solana_mobile_dapp_publisher_portal;
155
+ sign = function(buf) {
156
+ return nacl.sign(buf, signer.secretKey);
157
+ };
158
+ pubAddr = publisherDetails.address;
159
+ appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
160
+ releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
161
+ return [
162
+ 4,
163
+ checkMintedStatus(connection, pubAddr, appAddr, releaseAddr)
164
+ ];
165
+ case 2:
166
+ _state.sent();
167
+ return [
168
+ 4,
169
+ publishSubmit({
170
+ connection: connection,
171
+ sign: sign
172
+ }, {
173
+ appMintAddress: appAddr,
174
+ releaseMintAddress: releaseAddr,
175
+ publisherDetails: publisherDetails,
176
+ solanaMobileDappPublisherPortalDetails: solanaMobileDappPublisherPortalDetails,
177
+ compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
178
+ requestorIsAuthorized: requestorIsAuthorized
179
+ }, dryRun)
180
+ ];
181
+ case 3:
182
+ _state.sent();
183
+ return [
184
+ 2
185
+ ];
186
+ }
187
+ });
188
+ });
189
+ return function publishSubmitCommand(_) {
190
+ return _ref.apply(this, arguments);
191
+ };
192
+ }();