@solana-mobile/dapp-store-cli 0.4.2 → 0.4.3
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 +1 -1
- package/lib/CliSetup.js +730 -0
- package/lib/CliUtils.js +309 -0
- package/lib/__tests__/CliSetupTest.js +140 -0
- package/lib/commands/ValidateCommand.js +201 -0
- package/lib/commands/create/CreateCliApp.js +240 -0
- package/lib/commands/create/CreateCliPublisher.js +238 -0
- package/lib/commands/create/CreateCliRelease.js +270 -0
- package/lib/commands/create/index.js +41 -0
- package/lib/{esm/commands → commands}/index.js +0 -1
- package/lib/commands/publish/PublishCliRemove.js +186 -0
- package/lib/commands/publish/PublishCliSubmit.js +192 -0
- package/lib/commands/publish/PublishCliSupport.js +186 -0
- package/lib/commands/publish/PublishCliUpdate.js +193 -0
- package/lib/commands/publish/index.js +22 -0
- package/lib/{esm/commands → commands}/scaffolding/ScaffoldInit.js +7 -6
- package/lib/{esm/commands → commands}/scaffolding/index.js +0 -1
- package/lib/config/EnvVariables.js +59 -0
- package/lib/config/PublishDetails.js +555 -0
- package/lib/config/S3StorageManager.js +93 -0
- package/lib/config/index.js +2 -0
- package/lib/generated/config_obj.json +1 -0
- package/lib/generated/config_schema.json +1 -0
- package/lib/index.js +148 -0
- package/lib/package.json +74 -0
- package/lib/prebuild_schema/publishing_source.yaml +46 -0
- package/lib/prebuild_schema/schemagen.js +20 -0
- package/lib/upload/CachedStorageDriver.js +307 -0
- package/lib/{esm/upload → upload}/index.js +0 -1
- package/package.json +21 -7
- package/src/CliSetup.ts +512 -0
- package/src/CliUtils.ts +64 -19
- package/src/__tests__/CliSetupTest.ts +212 -0
- package/src/commands/create/CreateCliApp.ts +6 -1
- package/src/commands/create/CreateCliPublisher.ts +6 -1
- package/src/commands/create/CreateCliRelease.ts +6 -1
- package/src/config/EnvVariables.ts +39 -0
- package/src/config/PublishDetails.ts +2 -2
- package/src/config/S3StorageManager.ts +47 -0
- package/src/config/index.ts +2 -0
- package/src/index.ts +3 -510
- package/lib/esm/CliUtils.js +0 -108
- package/lib/esm/CliUtils.js.map +0 -1
- package/lib/esm/commands/ValidateCommand.js +0 -42
- package/lib/esm/commands/ValidateCommand.js.map +0 -1
- package/lib/esm/commands/create/CreateCliApp.js +0 -41
- package/lib/esm/commands/create/CreateCliApp.js.map +0 -1
- package/lib/esm/commands/create/CreateCliPublisher.js +0 -36
- package/lib/esm/commands/create/CreateCliPublisher.js.map +0 -1
- package/lib/esm/commands/create/CreateCliRelease.js +0 -50
- package/lib/esm/commands/create/CreateCliRelease.js.map +0 -1
- package/lib/esm/commands/create/index.js +0 -44
- package/lib/esm/commands/create/index.js.map +0 -1
- package/lib/esm/commands/index.js.map +0 -1
- package/lib/esm/commands/publish/PublishCliRemove.js +0 -26
- package/lib/esm/commands/publish/PublishCliRemove.js.map +0 -1
- package/lib/esm/commands/publish/PublishCliSubmit.js +0 -31
- package/lib/esm/commands/publish/PublishCliSubmit.js.map +0 -1
- package/lib/esm/commands/publish/PublishCliSupport.js +0 -26
- package/lib/esm/commands/publish/PublishCliSupport.js.map +0 -1
- package/lib/esm/commands/publish/PublishCliUpdate.js +0 -32
- package/lib/esm/commands/publish/PublishCliUpdate.js.map +0 -1
- package/lib/esm/commands/publish/index.js +0 -25
- package/lib/esm/commands/publish/index.js.map +0 -1
- package/lib/esm/commands/scaffolding/ScaffoldInit.js.map +0 -1
- package/lib/esm/commands/scaffolding/index.js.map +0 -1
- package/lib/esm/config/PublishDetails.js +0 -177
- package/lib/esm/config/PublishDetails.js.map +0 -1
- package/lib/esm/generated/config_obj.json +0 -1
- package/lib/esm/generated/config_schema.json +0 -1
- package/lib/esm/index.js +0 -307
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/package.json +0 -60
- package/lib/esm/upload/CachedStorageDriver.js +0 -66
- package/lib/esm/upload/CachedStorageDriver.js.map +0 -1
- package/lib/esm/upload/index.js.map +0 -1
- package/lib/types/CliUtils.d.ts +0 -21
- package/lib/types/CliUtils.d.ts.map +0 -1
- package/lib/types/commands/ValidateCommand.d.ts +0 -6
- package/lib/types/commands/ValidateCommand.d.ts.map +0 -1
- package/lib/types/commands/create/CreateCliApp.d.ts +0 -12
- package/lib/types/commands/create/CreateCliApp.d.ts.map +0 -1
- package/lib/types/commands/create/CreateCliPublisher.d.ts +0 -9
- package/lib/types/commands/create/CreateCliPublisher.d.ts.map +0 -1
- package/lib/types/commands/create/CreateCliRelease.d.ts +0 -13
- package/lib/types/commands/create/CreateCliRelease.d.ts.map +0 -1
- package/lib/types/commands/create/index.d.ts +0 -4
- package/lib/types/commands/create/index.d.ts.map +0 -1
- package/lib/types/commands/index.d.ts +0 -4
- package/lib/types/commands/index.d.ts.map +0 -1
- package/lib/types/commands/publish/PublishCliRemove.d.ts +0 -13
- package/lib/types/commands/publish/PublishCliRemove.d.ts.map +0 -1
- package/lib/types/commands/publish/PublishCliSubmit.d.ts +0 -13
- package/lib/types/commands/publish/PublishCliSubmit.d.ts.map +0 -1
- package/lib/types/commands/publish/PublishCliSupport.d.ts +0 -13
- package/lib/types/commands/publish/PublishCliSupport.d.ts.map +0 -1
- package/lib/types/commands/publish/PublishCliUpdate.d.ts +0 -14
- package/lib/types/commands/publish/PublishCliUpdate.d.ts.map +0 -1
- package/lib/types/commands/publish/index.d.ts +0 -5
- package/lib/types/commands/publish/index.d.ts.map +0 -1
- package/lib/types/commands/scaffolding/ScaffoldInit.d.ts +0 -2
- package/lib/types/commands/scaffolding/ScaffoldInit.d.ts.map +0 -1
- package/lib/types/commands/scaffolding/index.d.ts +0 -2
- package/lib/types/commands/scaffolding/index.d.ts.map +0 -1
- package/lib/types/config/PublishDetails.d.ts +0 -17
- package/lib/types/config/PublishDetails.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/upload/CachedStorageDriver.d.ts +0 -30
- package/lib/types/upload/CachedStorageDriver.d.ts.map +0 -1
- package/lib/types/upload/index.d.ts +0 -2
- package/lib/types/upload/index.d.ts.map +0 -1
package/lib/CliSetup.js
ADDED
|
@@ -0,0 +1,730 @@
|
|
|
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 { Command } from "commander";
|
|
126
|
+
import { validateCommand } from "./commands/index.js";
|
|
127
|
+
import { createAppCommand, createPublisherCommand, createReleaseCommand } from "./commands/create/index.js";
|
|
128
|
+
import { publishRemoveCommand, publishSubmitCommand, publishSupportCommand, publishUpdateCommand } from "./commands/publish/index.js";
|
|
129
|
+
import { checkForSelfUpdate, checkSubmissionNetwork, Constants, generateNetworkSuffix, parseKeypair, showMessage } from "./CliUtils.js";
|
|
130
|
+
import * as dotenv from "dotenv";
|
|
131
|
+
import { initScaffold } from "./commands/scaffolding/index.js";
|
|
132
|
+
import { loadPublishDetails, loadPublishDetailsWithChecks } from "./config/PublishDetails.js";
|
|
133
|
+
dotenv.config();
|
|
134
|
+
var hasAddressInConfig = function(param) {
|
|
135
|
+
var address = param.address;
|
|
136
|
+
return !!address;
|
|
137
|
+
};
|
|
138
|
+
export var mainCli = new Command();
|
|
139
|
+
function resolveBuildToolsPath(buildToolsPath) {
|
|
140
|
+
// If a path was specified on the command line, use that
|
|
141
|
+
if (buildToolsPath !== undefined) {
|
|
142
|
+
return buildToolsPath;
|
|
143
|
+
}
|
|
144
|
+
// If a path is specified in a .env file, use that
|
|
145
|
+
if (process.env.ANDROID_TOOLS_DIR !== undefined) {
|
|
146
|
+
return process.env.ANDROID_TOOLS_DIR;
|
|
147
|
+
}
|
|
148
|
+
// No path was specified
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* This method should be updated with each new release of the CLI, and just do nothing when there isn't anything to report
|
|
153
|
+
*/ function latestReleaseMessage() {
|
|
154
|
+
showMessage("Publishing Tools Version ".concat(Constants.CLI_VERSION), "- S3 bucket-based storage support added \n" + "- short_description value reduced to 30 character limit", "warning");
|
|
155
|
+
}
|
|
156
|
+
function tryWithErrorMessage(block) {
|
|
157
|
+
return _tryWithErrorMessage.apply(this, arguments);
|
|
158
|
+
}
|
|
159
|
+
function _tryWithErrorMessage() {
|
|
160
|
+
_tryWithErrorMessage = _async_to_generator(function(block) {
|
|
161
|
+
var e, _e_message, errorMsg;
|
|
162
|
+
return _ts_generator(this, function(_state) {
|
|
163
|
+
switch(_state.label){
|
|
164
|
+
case 0:
|
|
165
|
+
_state.trys.push([
|
|
166
|
+
0,
|
|
167
|
+
2,
|
|
168
|
+
,
|
|
169
|
+
3
|
|
170
|
+
]);
|
|
171
|
+
return [
|
|
172
|
+
4,
|
|
173
|
+
block()
|
|
174
|
+
];
|
|
175
|
+
case 1:
|
|
176
|
+
_state.sent();
|
|
177
|
+
return [
|
|
178
|
+
3,
|
|
179
|
+
3
|
|
180
|
+
];
|
|
181
|
+
case 2:
|
|
182
|
+
e = _state.sent();
|
|
183
|
+
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
184
|
+
showMessage("Error", errorMsg, "error");
|
|
185
|
+
return [
|
|
186
|
+
3,
|
|
187
|
+
3
|
|
188
|
+
];
|
|
189
|
+
case 3:
|
|
190
|
+
return [
|
|
191
|
+
2
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
return _tryWithErrorMessage.apply(this, arguments);
|
|
197
|
+
}
|
|
198
|
+
mainCli.name("dapp-store").version(Constants.CLI_VERSION).description("CLI to assist with publishing to the Saga Dapp Store");
|
|
199
|
+
export var initCliCmd = mainCli.command("init").description("First-time initialization of tooling configuration").action(/*#__PURE__*/ _async_to_generator(function() {
|
|
200
|
+
return _ts_generator(this, function(_state) {
|
|
201
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
202
|
+
var msg;
|
|
203
|
+
return _ts_generator(this, function(_state) {
|
|
204
|
+
msg = initScaffold();
|
|
205
|
+
showMessage("Initialized", msg);
|
|
206
|
+
return [
|
|
207
|
+
2
|
|
208
|
+
];
|
|
209
|
+
});
|
|
210
|
+
}));
|
|
211
|
+
return [
|
|
212
|
+
2
|
|
213
|
+
];
|
|
214
|
+
});
|
|
215
|
+
}));
|
|
216
|
+
export var createCliCmd = mainCli.command("create").description("Create a `publisher`, `app`, or `release`");
|
|
217
|
+
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() {
|
|
218
|
+
var _ref = _async_to_generator(function(param) {
|
|
219
|
+
var keypair, url, dryRun, storageConfig;
|
|
220
|
+
return _ts_generator(this, function(_state) {
|
|
221
|
+
keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig;
|
|
222
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
223
|
+
var signer, result, displayUrl, resultText;
|
|
224
|
+
return _ts_generator(this, function(_state) {
|
|
225
|
+
switch(_state.label){
|
|
226
|
+
case 0:
|
|
227
|
+
latestReleaseMessage();
|
|
228
|
+
return [
|
|
229
|
+
4,
|
|
230
|
+
checkForSelfUpdate()
|
|
231
|
+
];
|
|
232
|
+
case 1:
|
|
233
|
+
_state.sent();
|
|
234
|
+
signer = parseKeypair(keypair);
|
|
235
|
+
if (!signer) return [
|
|
236
|
+
3,
|
|
237
|
+
3
|
|
238
|
+
];
|
|
239
|
+
return [
|
|
240
|
+
4,
|
|
241
|
+
createPublisherCommand({
|
|
242
|
+
signer: signer,
|
|
243
|
+
url: url,
|
|
244
|
+
dryRun: dryRun,
|
|
245
|
+
storageParams: storageConfig
|
|
246
|
+
})
|
|
247
|
+
];
|
|
248
|
+
case 2:
|
|
249
|
+
result = _state.sent();
|
|
250
|
+
displayUrl = "https://solscan.io/token/".concat(result.publisherAddress).concat(generateNetworkSuffix(url));
|
|
251
|
+
resultText = "Publisher NFT successfully minted:\n".concat(displayUrl);
|
|
252
|
+
showMessage("Success", resultText);
|
|
253
|
+
_state.label = 3;
|
|
254
|
+
case 3:
|
|
255
|
+
return [
|
|
256
|
+
2
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}));
|
|
261
|
+
return [
|
|
262
|
+
2
|
|
263
|
+
];
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
return function(_) {
|
|
267
|
+
return _ref.apply(this, arguments);
|
|
268
|
+
};
|
|
269
|
+
}());
|
|
270
|
+
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() {
|
|
271
|
+
var _ref = _async_to_generator(function(param) {
|
|
272
|
+
var publisherMintAddress, keypair, url, dryRun, storageConfig;
|
|
273
|
+
return _ts_generator(this, function(_state) {
|
|
274
|
+
publisherMintAddress = param.publisherMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, storageConfig = param.storageConfig;
|
|
275
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
276
|
+
var config, signer, result, displayUrl, resultText;
|
|
277
|
+
return _ts_generator(this, function(_state) {
|
|
278
|
+
switch(_state.label){
|
|
279
|
+
case 0:
|
|
280
|
+
latestReleaseMessage();
|
|
281
|
+
return [
|
|
282
|
+
4,
|
|
283
|
+
checkForSelfUpdate()
|
|
284
|
+
];
|
|
285
|
+
case 1:
|
|
286
|
+
_state.sent();
|
|
287
|
+
return [
|
|
288
|
+
4,
|
|
289
|
+
loadPublishDetailsWithChecks()
|
|
290
|
+
];
|
|
291
|
+
case 2:
|
|
292
|
+
config = _state.sent();
|
|
293
|
+
if (!hasAddressInConfig(config.publisher) && !publisherMintAddress) {
|
|
294
|
+
throw new Error("Either specify a publisher mint address in the config file or specify as a CLI argument to this command.");
|
|
295
|
+
}
|
|
296
|
+
signer = parseKeypair(keypair);
|
|
297
|
+
if (!signer) return [
|
|
298
|
+
3,
|
|
299
|
+
4
|
|
300
|
+
];
|
|
301
|
+
return [
|
|
302
|
+
4,
|
|
303
|
+
createAppCommand({
|
|
304
|
+
publisherMintAddress: publisherMintAddress,
|
|
305
|
+
signer: signer,
|
|
306
|
+
url: url,
|
|
307
|
+
dryRun: dryRun,
|
|
308
|
+
storageParams: storageConfig
|
|
309
|
+
})
|
|
310
|
+
];
|
|
311
|
+
case 3:
|
|
312
|
+
result = _state.sent();
|
|
313
|
+
displayUrl = "https://solscan.io/token/".concat(result.appAddress).concat(generateNetworkSuffix(url));
|
|
314
|
+
resultText = "App NFT successfully minted:\n".concat(displayUrl);
|
|
315
|
+
showMessage("Success", resultText);
|
|
316
|
+
_state.label = 4;
|
|
317
|
+
case 4:
|
|
318
|
+
return [
|
|
319
|
+
2
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}));
|
|
324
|
+
return [
|
|
325
|
+
2
|
|
326
|
+
];
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
return function(_) {
|
|
330
|
+
return _ref.apply(this, arguments);
|
|
331
|
+
};
|
|
332
|
+
}());
|
|
333
|
+
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() {
|
|
334
|
+
var _ref = _async_to_generator(function(param) {
|
|
335
|
+
var appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig;
|
|
336
|
+
return _ts_generator(this, function(_state) {
|
|
337
|
+
appMintAddress = param.appMintAddress, keypair = param.keypair, url = param.url, dryRun = param.dryRun, buildToolsPath = param.buildToolsPath, storageConfig = param.storageConfig;
|
|
338
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
339
|
+
var resolvedBuildToolsPath, config, signer, result, displayUrl, resultText;
|
|
340
|
+
return _ts_generator(this, function(_state) {
|
|
341
|
+
switch(_state.label){
|
|
342
|
+
case 0:
|
|
343
|
+
latestReleaseMessage();
|
|
344
|
+
return [
|
|
345
|
+
4,
|
|
346
|
+
checkForSelfUpdate()
|
|
347
|
+
];
|
|
348
|
+
case 1:
|
|
349
|
+
_state.sent();
|
|
350
|
+
resolvedBuildToolsPath = resolveBuildToolsPath(buildToolsPath);
|
|
351
|
+
if (resolvedBuildToolsPath === undefined) {
|
|
352
|
+
throw new Error("Please specify an Android build tools directory in the .env file or via the command line argument.");
|
|
353
|
+
}
|
|
354
|
+
return [
|
|
355
|
+
4,
|
|
356
|
+
loadPublishDetailsWithChecks()
|
|
357
|
+
];
|
|
358
|
+
case 2:
|
|
359
|
+
config = _state.sent();
|
|
360
|
+
if (!hasAddressInConfig(config.app) && !appMintAddress) {
|
|
361
|
+
throw new Error("Either specify an app mint address in the config file or specify as a CLI argument to this command");
|
|
362
|
+
}
|
|
363
|
+
signer = parseKeypair(keypair);
|
|
364
|
+
if (!signer) return [
|
|
365
|
+
3,
|
|
366
|
+
4
|
|
367
|
+
];
|
|
368
|
+
return [
|
|
369
|
+
4,
|
|
370
|
+
createReleaseCommand({
|
|
371
|
+
appMintAddress: appMintAddress,
|
|
372
|
+
buildToolsPath: resolvedBuildToolsPath,
|
|
373
|
+
signer: signer,
|
|
374
|
+
url: url,
|
|
375
|
+
dryRun: dryRun,
|
|
376
|
+
storageParams: storageConfig
|
|
377
|
+
})
|
|
378
|
+
];
|
|
379
|
+
case 3:
|
|
380
|
+
result = _state.sent();
|
|
381
|
+
displayUrl = "https://solscan.io/token/".concat(result === null || result === void 0 ? void 0 : result.releaseAddress).concat(generateNetworkSuffix(url));
|
|
382
|
+
resultText = "Release NFT successfully minted:\n".concat(displayUrl);
|
|
383
|
+
showMessage("Success", resultText);
|
|
384
|
+
_state.label = 4;
|
|
385
|
+
case 4:
|
|
386
|
+
return [
|
|
387
|
+
2
|
|
388
|
+
];
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}));
|
|
392
|
+
return [
|
|
393
|
+
2
|
|
394
|
+
];
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
return function(_) {
|
|
398
|
+
return _ref.apply(this, arguments);
|
|
399
|
+
};
|
|
400
|
+
}());
|
|
401
|
+
mainCli.command("validate").description("Validates details prior to publishing").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").option("-b, --build-tools-path <build-tools-path>", "Path to Android build tools which contains AAPT2").action(function() {
|
|
402
|
+
var _ref = _async_to_generator(function(param) {
|
|
403
|
+
var keypair, buildToolsPath;
|
|
404
|
+
return _ts_generator(this, function(_state) {
|
|
405
|
+
keypair = param.keypair, buildToolsPath = param.buildToolsPath;
|
|
406
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
407
|
+
var resolvedBuildToolsPath, signer;
|
|
408
|
+
return _ts_generator(this, function(_state) {
|
|
409
|
+
switch(_state.label){
|
|
410
|
+
case 0:
|
|
411
|
+
latestReleaseMessage();
|
|
412
|
+
return [
|
|
413
|
+
4,
|
|
414
|
+
checkForSelfUpdate()
|
|
415
|
+
];
|
|
416
|
+
case 1:
|
|
417
|
+
_state.sent();
|
|
418
|
+
resolvedBuildToolsPath = resolveBuildToolsPath(buildToolsPath);
|
|
419
|
+
if (resolvedBuildToolsPath === undefined) {
|
|
420
|
+
throw new Error("Please specify an Android build tools directory in the .env file or via the command line argument.");
|
|
421
|
+
}
|
|
422
|
+
signer = parseKeypair(keypair);
|
|
423
|
+
if (!signer) return [
|
|
424
|
+
3,
|
|
425
|
+
3
|
|
426
|
+
];
|
|
427
|
+
return [
|
|
428
|
+
4,
|
|
429
|
+
validateCommand({
|
|
430
|
+
signer: signer,
|
|
431
|
+
buildToolsPath: resolvedBuildToolsPath
|
|
432
|
+
})
|
|
433
|
+
];
|
|
434
|
+
case 2:
|
|
435
|
+
_state.sent();
|
|
436
|
+
_state.label = 3;
|
|
437
|
+
case 3:
|
|
438
|
+
return [
|
|
439
|
+
2
|
|
440
|
+
];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}));
|
|
444
|
+
return [
|
|
445
|
+
2
|
|
446
|
+
];
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
return function(_) {
|
|
450
|
+
return _ref.apply(this, arguments);
|
|
451
|
+
};
|
|
452
|
+
}());
|
|
453
|
+
var publishCommand = mainCli.command("publish").description("Submit a publishing request (`submit`, `update`, `remove`, or `support`) to the Solana Mobile dApp publisher portal");
|
|
454
|
+
publishCommand.command("submit").description("Submit a new app to the Solana Mobile dApp publisher portal").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").requiredOption("--complies-with-solana-dapp-store-policies", "An attestation that the app complies with the Solana dApp Store policies").requiredOption("--requestor-is-authorized", "An attestation that the party making this Solana dApp publisher portal request is authorized to do so").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT. If not specified, the value from your config file will be used.").option("-r, --release-mint-address <release-mint-address>", "The mint address of the release NFT. If not specified, the value from your config file will be used.").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't submit the request to the publisher portal.").action(function() {
|
|
455
|
+
var _ref = _async_to_generator(function(param) {
|
|
456
|
+
var appMintAddress, releaseMintAddress, keypair, url, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, dryRun;
|
|
457
|
+
return _ts_generator(this, function(_state) {
|
|
458
|
+
appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, keypair = param.keypair, url = param.url, compliesWithSolanaDappStorePolicies = param.compliesWithSolanaDappStorePolicies, requestorIsAuthorized = param.requestorIsAuthorized, dryRun = param.dryRun;
|
|
459
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
460
|
+
var config, signer, resultText;
|
|
461
|
+
return _ts_generator(this, function(_state) {
|
|
462
|
+
switch(_state.label){
|
|
463
|
+
case 0:
|
|
464
|
+
return [
|
|
465
|
+
4,
|
|
466
|
+
checkForSelfUpdate()
|
|
467
|
+
];
|
|
468
|
+
case 1:
|
|
469
|
+
_state.sent();
|
|
470
|
+
return [
|
|
471
|
+
4,
|
|
472
|
+
checkSubmissionNetwork(url)
|
|
473
|
+
];
|
|
474
|
+
case 2:
|
|
475
|
+
_state.sent();
|
|
476
|
+
return [
|
|
477
|
+
4,
|
|
478
|
+
loadPublishDetails(Constants.getConfigFilePath())
|
|
479
|
+
];
|
|
480
|
+
case 3:
|
|
481
|
+
config = _state.sent();
|
|
482
|
+
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
483
|
+
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
|
|
484
|
+
}
|
|
485
|
+
signer = parseKeypair(keypair);
|
|
486
|
+
if (!signer) return [
|
|
487
|
+
3,
|
|
488
|
+
5
|
|
489
|
+
];
|
|
490
|
+
return [
|
|
491
|
+
4,
|
|
492
|
+
publishSubmitCommand({
|
|
493
|
+
appMintAddress: appMintAddress,
|
|
494
|
+
releaseMintAddress: releaseMintAddress,
|
|
495
|
+
signer: signer,
|
|
496
|
+
url: url,
|
|
497
|
+
dryRun: dryRun,
|
|
498
|
+
compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
|
|
499
|
+
requestorIsAuthorized: requestorIsAuthorized
|
|
500
|
+
})
|
|
501
|
+
];
|
|
502
|
+
case 4:
|
|
503
|
+
_state.sent();
|
|
504
|
+
resultText = "Successfully submitted to the Solana Mobile dApp publisher portal";
|
|
505
|
+
showMessage("Success", resultText);
|
|
506
|
+
_state.label = 5;
|
|
507
|
+
case 5:
|
|
508
|
+
return [
|
|
509
|
+
2
|
|
510
|
+
];
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}));
|
|
514
|
+
return [
|
|
515
|
+
2
|
|
516
|
+
];
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
return function(_) {
|
|
520
|
+
return _ref.apply(this, arguments);
|
|
521
|
+
};
|
|
522
|
+
}());
|
|
523
|
+
publishCommand.command("update").description("Update an existing app on the Solana Mobile dApp publisher portal").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").requiredOption("--complies-with-solana-dapp-store-policies", "An attestation that the app complies with the Solana dApp Store policies").requiredOption("--requestor-is-authorized", "An attestation that the party making this Solana dApp publisher portal request is authorized to do so").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT. If not specified, the value from your config file will be used.").option("-r, --release-mint-address <release-mint-address>", "The mint address of the release NFT. If not specified, the value from your config file will be used.").option("-c, --critical", "Flag for a critical app update request").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't submit the request to the publisher portal.").action(function() {
|
|
524
|
+
var _ref = _async_to_generator(function(param) {
|
|
525
|
+
var appMintAddress, releaseMintAddress, keypair, url, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, critical, dryRun;
|
|
526
|
+
return _ts_generator(this, function(_state) {
|
|
527
|
+
appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, keypair = param.keypair, url = param.url, compliesWithSolanaDappStorePolicies = param.compliesWithSolanaDappStorePolicies, requestorIsAuthorized = param.requestorIsAuthorized, critical = param.critical, dryRun = param.dryRun;
|
|
528
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
529
|
+
var config, signer, resultText;
|
|
530
|
+
return _ts_generator(this, function(_state) {
|
|
531
|
+
switch(_state.label){
|
|
532
|
+
case 0:
|
|
533
|
+
return [
|
|
534
|
+
4,
|
|
535
|
+
checkForSelfUpdate()
|
|
536
|
+
];
|
|
537
|
+
case 1:
|
|
538
|
+
_state.sent();
|
|
539
|
+
return [
|
|
540
|
+
4,
|
|
541
|
+
checkSubmissionNetwork(url)
|
|
542
|
+
];
|
|
543
|
+
case 2:
|
|
544
|
+
_state.sent();
|
|
545
|
+
return [
|
|
546
|
+
4,
|
|
547
|
+
loadPublishDetails(Constants.getConfigFilePath())
|
|
548
|
+
];
|
|
549
|
+
case 3:
|
|
550
|
+
config = _state.sent();
|
|
551
|
+
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
552
|
+
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
|
|
553
|
+
}
|
|
554
|
+
signer = parseKeypair(keypair);
|
|
555
|
+
if (!signer) return [
|
|
556
|
+
3,
|
|
557
|
+
5
|
|
558
|
+
];
|
|
559
|
+
return [
|
|
560
|
+
4,
|
|
561
|
+
publishUpdateCommand({
|
|
562
|
+
appMintAddress: appMintAddress,
|
|
563
|
+
releaseMintAddress: releaseMintAddress,
|
|
564
|
+
signer: signer,
|
|
565
|
+
url: url,
|
|
566
|
+
dryRun: dryRun,
|
|
567
|
+
compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
|
|
568
|
+
requestorIsAuthorized: requestorIsAuthorized,
|
|
569
|
+
critical: critical
|
|
570
|
+
})
|
|
571
|
+
];
|
|
572
|
+
case 4:
|
|
573
|
+
_state.sent();
|
|
574
|
+
resultText = "dApp successfully updated on the publisher portal";
|
|
575
|
+
showMessage("Success", resultText);
|
|
576
|
+
_state.label = 5;
|
|
577
|
+
case 5:
|
|
578
|
+
return [
|
|
579
|
+
2
|
|
580
|
+
];
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}));
|
|
584
|
+
return [
|
|
585
|
+
2
|
|
586
|
+
];
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
return function(_) {
|
|
590
|
+
return _ref.apply(this, arguments);
|
|
591
|
+
};
|
|
592
|
+
}());
|
|
593
|
+
publishCommand.command("remove").description("Remove an existing app from the Solana Mobile dApp publisher portal").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").requiredOption("--requestor-is-authorized", "An attestation that the party making this Solana dApp publisher portal request is authorized to do so").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT. If not specified, the value from your config file will be used.").option("-r, --release-mint-address <release-mint-address>", "The mint address of the release NFT. If not specified, the value from your config file will be used.").option("-c, --critical", "Flag for a critical app removal request").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't submit the request to the publisher portal.").action(function() {
|
|
594
|
+
var _ref = _async_to_generator(function(param) {
|
|
595
|
+
var appMintAddress, releaseMintAddress, keypair, url, requestorIsAuthorized, critical, dryRun;
|
|
596
|
+
return _ts_generator(this, function(_state) {
|
|
597
|
+
appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, keypair = param.keypair, url = param.url, requestorIsAuthorized = param.requestorIsAuthorized, critical = param.critical, dryRun = param.dryRun;
|
|
598
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
599
|
+
var config, signer, resultText;
|
|
600
|
+
return _ts_generator(this, function(_state) {
|
|
601
|
+
switch(_state.label){
|
|
602
|
+
case 0:
|
|
603
|
+
return [
|
|
604
|
+
4,
|
|
605
|
+
checkForSelfUpdate()
|
|
606
|
+
];
|
|
607
|
+
case 1:
|
|
608
|
+
_state.sent();
|
|
609
|
+
return [
|
|
610
|
+
4,
|
|
611
|
+
checkSubmissionNetwork(url)
|
|
612
|
+
];
|
|
613
|
+
case 2:
|
|
614
|
+
_state.sent();
|
|
615
|
+
return [
|
|
616
|
+
4,
|
|
617
|
+
loadPublishDetails(Constants.getConfigFilePath())
|
|
618
|
+
];
|
|
619
|
+
case 3:
|
|
620
|
+
config = _state.sent();
|
|
621
|
+
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
622
|
+
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
|
|
623
|
+
}
|
|
624
|
+
signer = parseKeypair(keypair);
|
|
625
|
+
if (!signer) return [
|
|
626
|
+
3,
|
|
627
|
+
5
|
|
628
|
+
];
|
|
629
|
+
return [
|
|
630
|
+
4,
|
|
631
|
+
publishRemoveCommand({
|
|
632
|
+
appMintAddress: appMintAddress,
|
|
633
|
+
releaseMintAddress: releaseMintAddress,
|
|
634
|
+
signer: signer,
|
|
635
|
+
url: url,
|
|
636
|
+
dryRun: dryRun,
|
|
637
|
+
requestorIsAuthorized: requestorIsAuthorized,
|
|
638
|
+
critical: critical
|
|
639
|
+
})
|
|
640
|
+
];
|
|
641
|
+
case 4:
|
|
642
|
+
_state.sent();
|
|
643
|
+
resultText = "dApp successfully removed from the publisher portal";
|
|
644
|
+
showMessage("Success", resultText);
|
|
645
|
+
_state.label = 5;
|
|
646
|
+
case 5:
|
|
647
|
+
return [
|
|
648
|
+
2
|
|
649
|
+
];
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
}));
|
|
653
|
+
return [
|
|
654
|
+
2
|
|
655
|
+
];
|
|
656
|
+
});
|
|
657
|
+
});
|
|
658
|
+
return function(_) {
|
|
659
|
+
return _ref.apply(this, arguments);
|
|
660
|
+
};
|
|
661
|
+
}());
|
|
662
|
+
publishCommand.command("support <request_details>").description("Submit a support request for an existing app on the Solana Mobile dApp publisher portal").requiredOption("-k, --keypair <path-to-keypair-file>", "Path to keypair file").requiredOption("--requestor-is-authorized", "An attestation that the party making this Solana dApp publisher portal request is authorized to do so").option("-a, --app-mint-address <app-mint-address>", "The mint address of the app NFT. If not specified, the value from your config file will be used.").option("-r, --release-mint-address <release-mint-address>", "The mint address of the release NFT. If not specified, the value from your config file will be used.").option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET).option("-d, --dry-run", "Flag for dry run. Doesn't submit the request to the publisher portal.").action(function() {
|
|
663
|
+
var _ref = _async_to_generator(function(requestDetails, param) {
|
|
664
|
+
var appMintAddress, releaseMintAddress, keypair, url, requestorIsAuthorized, dryRun;
|
|
665
|
+
return _ts_generator(this, function(_state) {
|
|
666
|
+
appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, keypair = param.keypair, url = param.url, requestorIsAuthorized = param.requestorIsAuthorized, dryRun = param.dryRun;
|
|
667
|
+
tryWithErrorMessage(/*#__PURE__*/ _async_to_generator(function() {
|
|
668
|
+
var config, signer, resultText;
|
|
669
|
+
return _ts_generator(this, function(_state) {
|
|
670
|
+
switch(_state.label){
|
|
671
|
+
case 0:
|
|
672
|
+
return [
|
|
673
|
+
4,
|
|
674
|
+
checkForSelfUpdate()
|
|
675
|
+
];
|
|
676
|
+
case 1:
|
|
677
|
+
_state.sent();
|
|
678
|
+
return [
|
|
679
|
+
4,
|
|
680
|
+
checkSubmissionNetwork(url)
|
|
681
|
+
];
|
|
682
|
+
case 2:
|
|
683
|
+
_state.sent();
|
|
684
|
+
return [
|
|
685
|
+
4,
|
|
686
|
+
loadPublishDetails(Constants.getConfigFilePath())
|
|
687
|
+
];
|
|
688
|
+
case 3:
|
|
689
|
+
config = _state.sent();
|
|
690
|
+
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
691
|
+
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.");
|
|
692
|
+
}
|
|
693
|
+
signer = parseKeypair(keypair);
|
|
694
|
+
if (!signer) return [
|
|
695
|
+
3,
|
|
696
|
+
5
|
|
697
|
+
];
|
|
698
|
+
return [
|
|
699
|
+
4,
|
|
700
|
+
publishSupportCommand({
|
|
701
|
+
appMintAddress: appMintAddress,
|
|
702
|
+
releaseMintAddress: releaseMintAddress,
|
|
703
|
+
signer: signer,
|
|
704
|
+
url: url,
|
|
705
|
+
dryRun: dryRun,
|
|
706
|
+
requestorIsAuthorized: requestorIsAuthorized,
|
|
707
|
+
requestDetails: requestDetails
|
|
708
|
+
})
|
|
709
|
+
];
|
|
710
|
+
case 4:
|
|
711
|
+
_state.sent();
|
|
712
|
+
resultText = "Support request sent successfully";
|
|
713
|
+
showMessage("Success", resultText);
|
|
714
|
+
_state.label = 5;
|
|
715
|
+
case 5:
|
|
716
|
+
return [
|
|
717
|
+
2
|
|
718
|
+
];
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}));
|
|
722
|
+
return [
|
|
723
|
+
2
|
|
724
|
+
];
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
return function(requestDetails, _) {
|
|
728
|
+
return _ref.apply(this, arguments);
|
|
729
|
+
};
|
|
730
|
+
}());
|