@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.
- package/lib/CliSetup.js +468 -568
- package/lib/CliUtils.js +18 -33
- package/lib/__tests__/CliSetupTest.js +4 -27
- package/lib/commands/ValidateCommand.js +15 -40
- package/lib/commands/create/CreateCliApp.js +18 -30
- package/lib/commands/create/CreateCliRelease.js +16 -26
- package/lib/commands/create/index.js +0 -1
- package/lib/commands/publish/PublishCliRemove.js +11 -19
- package/lib/commands/publish/PublishCliSubmit.js +11 -19
- package/lib/commands/publish/PublishCliSupport.js +11 -19
- package/lib/commands/publish/PublishCliUpdate.js +11 -19
- package/lib/commands/utils.js +6 -14
- package/lib/config/PublishDetails.js +125 -257
- package/lib/generated/config_obj.json +1 -1
- package/lib/generated/config_schema.json +1 -1
- package/lib/index.js +6 -14
- package/lib/package.json +2 -2
- package/lib/prebuild_schema/publishing_source.yaml +0 -4
- package/lib/upload/CachedStorageDriver.js +13 -19
- package/package.json +2 -2
- package/src/CliSetup.ts +5 -54
- package/src/CliUtils.ts +5 -11
- package/src/__tests__/CliSetupTest.ts +8 -43
- package/src/commands/ValidateCommand.ts +0 -20
- package/src/commands/create/CreateCliApp.ts +1 -8
- package/src/commands/create/index.ts +0 -1
- package/src/commands/publish/PublishCliRemove.ts +1 -2
- package/src/commands/publish/PublishCliSubmit.ts +1 -2
- package/src/commands/publish/PublishCliSupport.ts +1 -2
- package/src/commands/publish/PublishCliUpdate.ts +1 -2
- package/src/config/PublishDetails.ts +4 -57
- package/src/prebuild_schema/publishing_source.yaml +0 -4
- package/lib/commands/create/CreateCliPublisher.js +0 -237
- package/src/commands/create/CreateCliPublisher.ts +0 -87
package/lib/CliUtils.js
CHANGED
|
@@ -46,7 +46,7 @@ function _define_property(obj, key, value) {
|
|
|
46
46
|
return obj;
|
|
47
47
|
}
|
|
48
48
|
function _ts_generator(thisArg, body) {
|
|
49
|
-
var f, y, t,
|
|
49
|
+
var f, y, t, _ = {
|
|
50
50
|
label: 0,
|
|
51
51
|
sent: function() {
|
|
52
52
|
if (t[0] & 1) throw t[1];
|
|
@@ -54,12 +54,8 @@ function _ts_generator(thisArg, body) {
|
|
|
54
54
|
},
|
|
55
55
|
trys: [],
|
|
56
56
|
ops: []
|
|
57
|
-
};
|
|
58
|
-
return g = {
|
|
59
|
-
next: verb(0),
|
|
60
|
-
"throw": verb(1),
|
|
61
|
-
"return": verb(2)
|
|
62
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
57
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
58
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
63
59
|
return this;
|
|
64
60
|
}), g;
|
|
65
61
|
function verb(n) {
|
|
@@ -72,7 +68,7 @@ function _ts_generator(thisArg, body) {
|
|
|
72
68
|
}
|
|
73
69
|
function step(op) {
|
|
74
70
|
if (f) throw new TypeError("Generator is already executing.");
|
|
75
|
-
while(_)try {
|
|
71
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
76
72
|
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;
|
|
77
73
|
if (y = 0, t) op = [
|
|
78
74
|
op[0] & 2,
|
|
@@ -158,7 +154,7 @@ export var Constants = function Constants() {
|
|
|
158
154
|
"use strict";
|
|
159
155
|
_class_call_check(this, Constants);
|
|
160
156
|
};
|
|
161
|
-
_define_property(Constants, "CLI_VERSION", "0.
|
|
157
|
+
_define_property(Constants, "CLI_VERSION", "0.11.0");
|
|
162
158
|
_define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
|
|
163
159
|
_define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
|
|
164
160
|
_define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
|
|
@@ -166,8 +162,8 @@ _define_property(Constants, "getConfigFilePath", function() {
|
|
|
166
162
|
return "".concat(process.cwd(), "/").concat(Constants.CONFIG_FILE_NAME);
|
|
167
163
|
});
|
|
168
164
|
export var debug = debugModule("CLI");
|
|
169
|
-
export var checkForSelfUpdate =
|
|
170
|
-
|
|
165
|
+
export var checkForSelfUpdate = function() {
|
|
166
|
+
return _async_to_generator(function() {
|
|
171
167
|
var notifier, updateInfo, latestVer, currentVer;
|
|
172
168
|
return _ts_generator(this, function(_state) {
|
|
173
169
|
switch(_state.label){
|
|
@@ -191,14 +187,11 @@ export var checkForSelfUpdate = /*#__PURE__*/ function() {
|
|
|
191
187
|
];
|
|
192
188
|
}
|
|
193
189
|
});
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
export var checkMintedStatus = /*#__PURE__*/ function() {
|
|
200
|
-
var _ref = _async_to_generator(function(conn, pubAddr, appAddr, releaseAddr) {
|
|
201
|
-
var i, _results_, _results_1, _results_2, results, isPublisherMinted, isAppMinted, isReleaseMinted, errorMessage;
|
|
190
|
+
})();
|
|
191
|
+
};
|
|
192
|
+
export var checkMintedStatus = function(conn, appAddr, releaseAddr) {
|
|
193
|
+
return _async_to_generator(function() {
|
|
194
|
+
var i, _results_, _results_1, results, isAppMinted, isReleaseMinted, errorMessage;
|
|
202
195
|
return _ts_generator(this, function(_state) {
|
|
203
196
|
switch(_state.label){
|
|
204
197
|
case 0:
|
|
@@ -212,25 +205,20 @@ export var checkMintedStatus = /*#__PURE__*/ function() {
|
|
|
212
205
|
return [
|
|
213
206
|
4,
|
|
214
207
|
conn.getMultipleAccountsInfo([
|
|
215
|
-
new PublicKey(pubAddr),
|
|
216
208
|
new PublicKey(appAddr),
|
|
217
209
|
new PublicKey(releaseAddr)
|
|
218
210
|
])
|
|
219
211
|
];
|
|
220
212
|
case 2:
|
|
221
213
|
results = _state.sent();
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (isPublisherMinted && isAppMinted && isReleaseMinted) {
|
|
214
|
+
isAppMinted = results[0] != undefined && ((_results_ = results[0]) === null || _results_ === void 0 ? void 0 : _results_.lamports) > 0;
|
|
215
|
+
isReleaseMinted = results[1] != undefined && ((_results_1 = results[1]) === null || _results_1 === void 0 ? void 0 : _results_1.lamports) > 0;
|
|
216
|
+
if (isAppMinted && isReleaseMinted) {
|
|
226
217
|
return [
|
|
227
218
|
2
|
|
228
219
|
];
|
|
229
220
|
} else {
|
|
230
221
|
errorMessage = "";
|
|
231
|
-
if (!isPublisherMinted) {
|
|
232
|
-
errorMessage = errorMessage + "Publisher NFT fetch at address ".concat(pubAddr, " failed.\n");
|
|
233
|
-
}
|
|
234
222
|
if (!isAppMinted) {
|
|
235
223
|
errorMessage = errorMessage + "App NFT fetch at address ".concat(appAddr, " failed.\n");
|
|
236
224
|
}
|
|
@@ -238,7 +226,7 @@ export var checkMintedStatus = /*#__PURE__*/ function() {
|
|
|
238
226
|
errorMessage = errorMessage + "Release NFT fetch at address ".concat(releaseAddr, " failed.\n");
|
|
239
227
|
}
|
|
240
228
|
if (i == 4) {
|
|
241
|
-
throw new Error("Expected
|
|
229
|
+
throw new Error("Expected 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
230
|
} else {
|
|
243
231
|
sleep(2000);
|
|
244
232
|
}
|
|
@@ -256,11 +244,8 @@ export var checkMintedStatus = /*#__PURE__*/ function() {
|
|
|
256
244
|
];
|
|
257
245
|
}
|
|
258
246
|
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
return _ref.apply(this, arguments);
|
|
262
|
-
};
|
|
263
|
-
}();
|
|
247
|
+
})();
|
|
248
|
+
};
|
|
264
249
|
export var sleep = function(ms) {
|
|
265
250
|
return new Promise(function(resolve) {
|
|
266
251
|
return setTimeout(resolve, ms);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeEach, expect } from "@jest/globals";
|
|
2
|
-
import { createAppCliCmd, createCliCmd,
|
|
2
|
+
import { createAppCliCmd, createCliCmd, createReleaseCliCmd, initCliCmd, mainCli } from "../CliSetup";
|
|
3
3
|
import { Constants } from "../CliUtils";
|
|
4
4
|
describe("Cli Setup & Execution", function() {
|
|
5
5
|
var outputHelpReference = "(outputHelp)";
|
|
@@ -63,28 +63,6 @@ describe("Cli Setup & Execution", function() {
|
|
|
63
63
|
}).toThrow(outputHelpReference);
|
|
64
64
|
expect(errorOutput).toEqual(createHelp);
|
|
65
65
|
});
|
|
66
|
-
test("Calling create publisher command with no arguments warns about required argument", function() {
|
|
67
|
-
createPublisherCliCmd.exitOverride();
|
|
68
|
-
expect(function() {
|
|
69
|
-
createPublisherCliCmd.parse([
|
|
70
|
-
"dapp-store",
|
|
71
|
-
"create",
|
|
72
|
-
"publisher"
|
|
73
|
-
]);
|
|
74
|
-
}).toThrow(keyPairArgHelp);
|
|
75
|
-
});
|
|
76
|
-
test("Calling create publisher command with help flag shows contextual help", function() {
|
|
77
|
-
createPublisherCliCmd.exitOverride();
|
|
78
|
-
expect(function() {
|
|
79
|
-
createPublisherCliCmd.parse([
|
|
80
|
-
"dapp-store",
|
|
81
|
-
"create",
|
|
82
|
-
"publisher",
|
|
83
|
-
"-h"
|
|
84
|
-
]);
|
|
85
|
-
}).toThrow(outputHelpReference);
|
|
86
|
-
expect(otherOutput).toEqual(createPublisherHelp);
|
|
87
|
-
});
|
|
88
66
|
test("Calling create app command with no arguments warns about required argument", function() {
|
|
89
67
|
createAppCliCmd.exitOverride();
|
|
90
68
|
expect(function() {
|
|
@@ -130,11 +108,10 @@ describe("Cli Setup & Execution", function() {
|
|
|
130
108
|
expect(otherOutput).toEqual(createReleaseHelp);
|
|
131
109
|
});
|
|
132
110
|
//--------------------------------------------------
|
|
133
|
-
var generalHelp = "Usage: dapp-store [options] [command]\n\nCLI to assist with publishing to the Saga Dapp Store\n\nOptions:\n -V, --version output the version number\n -h, --help display help for command\n\nCommands:\n init First-time initialization of tooling configuration\n create Create a `
|
|
111
|
+
var generalHelp = "Usage: dapp-store [options] [command]\n\nCLI to assist with publishing to the Saga Dapp Store\n\nOptions:\n -V, --version output the version number\n -h, --help display help for command\n\nCommands:\n init First-time initialization of tooling configuration\n create Create a `app`, or `release`\n validate [options] Validates details prior to publishing\n publish Submit a publishing request (`submit`, `update`, `remove`, or `support`) to the Solana Mobile dApp publisher portal\n help [command] display help for command\n";
|
|
134
112
|
var initHelp = "Usage: dapp-store init [options]\n\nFirst-time initialization of tooling configuration\n\nOptions:\n -h, --help display help for command\n";
|
|
135
113
|
var keyPairArgHelp = "error: required option '-k, --keypair <path-to-keypair-file>' not specified";
|
|
136
|
-
var createHelp = "Usage: dapp-store create [options] [command]\n\nCreate a `
|
|
137
|
-
var
|
|
138
|
-
var createAppHelp = 'Usage: dapp-store create app [options]\n\nCreate a app\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -p, --publisher-mint-address <publisher-mint-address> The mint address of the publisher NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
|
|
114
|
+
var createHelp = "Usage: dapp-store create [options] [command]\n\nCreate a `app`, or `release`\n\nOptions:\n -h, --help display help for command\n\nCommands:\n app [options] Create a app\n release [options] Create a release\n help [command] display help for command\n";
|
|
115
|
+
var createAppHelp = 'Usage: dapp-store create app [options]\n\nCreate a app\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
|
|
139
116
|
var createReleaseHelp = 'Usage: dapp-store create release [options]\n\nCreate a release\n\nOptions:\n -k, --keypair <path-to-keypair-file> Path to keypair file\n -a, --app-mint-address <app-mint-address> The mint address of the app NFT\n -u, --url <url> RPC URL (default: "https://api.devnet.solana.com")\n -d, --dry-run Flag for dry run. Doesn\'t mint an NFT\n -b, --build-tools-path <build-tools-path> Path to Android build tools which contains AAPT2\n -s, --storage-config <storage-config> Provide alternative storage configuration details\n -p, --priority-fee-lamports <priority-fee-lamports> Priority Fee lamports\n -h, --help display help for command\n';
|
|
140
117
|
});
|
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t,
|
|
31
|
+
var f, y, t, _ = {
|
|
32
32
|
label: 0,
|
|
33
33
|
sent: function() {
|
|
34
34
|
if (t[0] & 1) throw t[1];
|
|
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
|
|
|
36
36
|
},
|
|
37
37
|
trys: [],
|
|
38
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() {
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
41
|
return this;
|
|
46
42
|
}), g;
|
|
47
43
|
function verb(n) {
|
|
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
|
|
|
54
50
|
}
|
|
55
51
|
function step(op) {
|
|
56
52
|
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
58
54
|
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
55
|
if (y = 0, t) op = [
|
|
60
56
|
op[0] & 2,
|
|
@@ -122,16 +118,16 @@ function _ts_generator(thisArg, body) {
|
|
|
122
118
|
};
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
|
-
import { createAppJson,
|
|
121
|
+
import { createAppJson, createReleaseJson, validateApp, validateRelease, metaplexFileReplacer } from "@solana-mobile/dapp-store-publishing-tools";
|
|
126
122
|
import { debug, showMessage } from "../CliUtils.js";
|
|
127
123
|
import { loadPublishDetailsWithChecks } from "../config/PublishDetails.js";
|
|
128
|
-
export var validateCommand =
|
|
129
|
-
var
|
|
130
|
-
|
|
124
|
+
export var validateCommand = function(param) {
|
|
125
|
+
var signer = param.signer, buildToolsPath = param.buildToolsPath;
|
|
126
|
+
return _async_to_generator(function() {
|
|
127
|
+
var _ref, publisherDetails, appDetails, releaseDetails, appJson, _appJson_image, _e_message, errorMsg, releaseJson, objStringified, _e_message1, errorMsg1;
|
|
131
128
|
return _ts_generator(this, function(_state) {
|
|
132
129
|
switch(_state.label){
|
|
133
130
|
case 0:
|
|
134
|
-
signer = param.signer, buildToolsPath = param.buildToolsPath;
|
|
135
131
|
return [
|
|
136
132
|
4,
|
|
137
133
|
loadPublishDetailsWithChecks(buildToolsPath)
|
|
@@ -143,24 +139,6 @@ export var validateCommand = /*#__PURE__*/ function() {
|
|
|
143
139
|
appDetails: appDetails,
|
|
144
140
|
releaseDetails: releaseDetails
|
|
145
141
|
});
|
|
146
|
-
publisherJson = createPublisherJson(publisherDetails);
|
|
147
|
-
if (typeof publisherJson.image !== "string") {
|
|
148
|
-
;
|
|
149
|
-
publisherJson.image = (_publisherJson_image = publisherJson.image) === null || _publisherJson_image === void 0 ? void 0 : _publisherJson_image.fileName;
|
|
150
|
-
}
|
|
151
|
-
debug("publisherJson=", JSON.stringify({
|
|
152
|
-
publisherJson: publisherJson
|
|
153
|
-
}, metaplexFileReplacer, 2));
|
|
154
|
-
try {
|
|
155
|
-
validatePublisher(publisherJson);
|
|
156
|
-
} catch (e) {
|
|
157
|
-
;
|
|
158
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
159
|
-
showMessage("Publisher JSON invalid", errorMsg, "error");
|
|
160
|
-
return [
|
|
161
|
-
2
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
142
|
appJson = createAppJson(appDetails, signer.publicKey);
|
|
165
143
|
if (typeof appJson.image !== "string") {
|
|
166
144
|
;
|
|
@@ -173,8 +151,8 @@ export var validateCommand = /*#__PURE__*/ function() {
|
|
|
173
151
|
validateApp(appJson);
|
|
174
152
|
} catch (e) {
|
|
175
153
|
;
|
|
176
|
-
|
|
177
|
-
showMessage("App JSON invalid",
|
|
154
|
+
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
155
|
+
showMessage("App JSON invalid", errorMsg, "error");
|
|
178
156
|
return [
|
|
179
157
|
2
|
|
180
158
|
];
|
|
@@ -201,8 +179,8 @@ export var validateCommand = /*#__PURE__*/ function() {
|
|
|
201
179
|
validateRelease(JSON.parse(objStringified));
|
|
202
180
|
} catch (e) {
|
|
203
181
|
;
|
|
204
|
-
|
|
205
|
-
showMessage("Release JSON invalid",
|
|
182
|
+
errorMsg1 = (_e_message1 = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message1 !== void 0 ? _e_message1 : "";
|
|
183
|
+
showMessage("Release JSON invalid", errorMsg1, "error");
|
|
206
184
|
return [
|
|
207
185
|
2
|
|
208
186
|
];
|
|
@@ -213,8 +191,5 @@ export var validateCommand = /*#__PURE__*/ function() {
|
|
|
213
191
|
];
|
|
214
192
|
}
|
|
215
193
|
});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
return _ref.apply(this, arguments);
|
|
219
|
-
};
|
|
220
|
-
}();
|
|
194
|
+
})();
|
|
195
|
+
};
|
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t,
|
|
31
|
+
var f, y, t, _ = {
|
|
32
32
|
label: 0,
|
|
33
33
|
sent: function() {
|
|
34
34
|
if (t[0] & 1) throw t[1];
|
|
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
|
|
|
36
36
|
},
|
|
37
37
|
trys: [],
|
|
38
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() {
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
41
|
return this;
|
|
46
42
|
}), g;
|
|
47
43
|
function verb(n) {
|
|
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
|
|
|
54
50
|
}
|
|
55
51
|
function step(op) {
|
|
56
52
|
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
58
54
|
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
55
|
if (y = 0, t) op = [
|
|
60
56
|
op[0] & 2,
|
|
@@ -123,24 +119,23 @@ function _ts_generator(thisArg, body) {
|
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
121
|
import { createApp } from "@solana-mobile/dapp-store-publishing-tools";
|
|
126
|
-
import { Connection, Keypair
|
|
122
|
+
import { Connection, Keypair } from "@solana/web3.js";
|
|
127
123
|
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
128
124
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
129
125
|
import { sendAndConfirmTransaction } from "../utils.js";
|
|
130
|
-
var createAppNft =
|
|
131
|
-
var
|
|
132
|
-
|
|
126
|
+
var createAppNft = function(param) {
|
|
127
|
+
var appDetails = param.appDetails, connection = param.connection, publisher = param.publisher, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
|
|
128
|
+
return _async_to_generator(function() {
|
|
129
|
+
var mintAddress, metaplex, txBuilder, response;
|
|
133
130
|
return _ts_generator(this, function(_state) {
|
|
134
131
|
switch(_state.label){
|
|
135
132
|
case 0:
|
|
136
|
-
appDetails = param.appDetails, connection = param.connection, publisherMintAddress = param.publisherMintAddress, publisher = param.publisher, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
|
|
137
133
|
console.info("Creating App NFT");
|
|
138
134
|
mintAddress = Keypair.generate();
|
|
139
135
|
metaplex = getMetaplexInstance(connection, publisher, storageParams);
|
|
140
136
|
return [
|
|
141
137
|
4,
|
|
142
138
|
createApp({
|
|
143
|
-
publisherMintAddress: new PublicKey(publisherMintAddress),
|
|
144
139
|
mintAddress: mintAddress,
|
|
145
140
|
appDetails: appDetails,
|
|
146
141
|
priorityFeeLamports: priorityFeeLamports
|
|
@@ -167,18 +162,15 @@ var createAppNft = /*#__PURE__*/ function() {
|
|
|
167
162
|
];
|
|
168
163
|
}
|
|
169
164
|
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var _ref = _async_to_generator(function(param) {
|
|
177
|
-
var signer, url, dryRun, publisherMintAddress, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, _ref, appDetails, publisherDetails, _publisherDetails_address, _ref1, appAddress, transactionSignature;
|
|
165
|
+
})();
|
|
166
|
+
};
|
|
167
|
+
export var createAppCommand = function(param) {
|
|
168
|
+
var 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;
|
|
169
|
+
return _async_to_generator(function() {
|
|
170
|
+
var connection, _ref, appDetails, _ref1, appAddress, transactionSignature;
|
|
178
171
|
return _ts_generator(this, function(_state) {
|
|
179
172
|
switch(_state.label){
|
|
180
173
|
case 0:
|
|
181
|
-
signer = param.signer, url = param.url, dryRun = param.dryRun, publisherMintAddress = param.publisherMintAddress, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
182
174
|
connection = new Connection(url, {
|
|
183
175
|
commitment: "confirmed"
|
|
184
176
|
});
|
|
@@ -187,7 +179,7 @@ export var createAppCommand = /*#__PURE__*/ function() {
|
|
|
187
179
|
loadPublishDetailsWithChecks()
|
|
188
180
|
];
|
|
189
181
|
case 1:
|
|
190
|
-
_ref = _state.sent(), appDetails = _ref.app
|
|
182
|
+
_ref = _state.sent(), appDetails = _ref.app;
|
|
191
183
|
if (!!dryRun) return [
|
|
192
184
|
3,
|
|
193
185
|
4
|
|
@@ -197,7 +189,6 @@ export var createAppCommand = /*#__PURE__*/ function() {
|
|
|
197
189
|
createAppNft({
|
|
198
190
|
connection: connection,
|
|
199
191
|
publisher: signer,
|
|
200
|
-
publisherMintAddress: (_publisherDetails_address = publisherDetails.address) !== null && _publisherDetails_address !== void 0 ? _publisherDetails_address : publisherMintAddress,
|
|
201
192
|
appDetails: appDetails,
|
|
202
193
|
storageParams: storageParams,
|
|
203
194
|
priorityFeeLamports: priorityFeeLamports
|
|
@@ -228,8 +219,5 @@ export var createAppCommand = /*#__PURE__*/ function() {
|
|
|
228
219
|
];
|
|
229
220
|
}
|
|
230
221
|
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
return _ref.apply(this, arguments);
|
|
234
|
-
};
|
|
235
|
-
}();
|
|
222
|
+
})();
|
|
223
|
+
};
|
|
@@ -56,7 +56,7 @@ function _object_spread(target) {
|
|
|
56
56
|
return target;
|
|
57
57
|
}
|
|
58
58
|
function _ts_generator(thisArg, body) {
|
|
59
|
-
var f, y, t,
|
|
59
|
+
var f, y, t, _ = {
|
|
60
60
|
label: 0,
|
|
61
61
|
sent: function() {
|
|
62
62
|
if (t[0] & 1) throw t[1];
|
|
@@ -64,12 +64,8 @@ function _ts_generator(thisArg, body) {
|
|
|
64
64
|
},
|
|
65
65
|
trys: [],
|
|
66
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() {
|
|
67
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
68
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
69
|
return this;
|
|
74
70
|
}), g;
|
|
75
71
|
function verb(n) {
|
|
@@ -82,7 +78,7 @@ function _ts_generator(thisArg, body) {
|
|
|
82
78
|
}
|
|
83
79
|
function step(op) {
|
|
84
80
|
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
-
while(_)try {
|
|
81
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
86
82
|
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
83
|
if (y = 0, t) op = [
|
|
88
84
|
op[0] & 2,
|
|
@@ -157,13 +153,13 @@ import { createHash } from "crypto";
|
|
|
157
153
|
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
158
154
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
159
155
|
import { sendAndConfirmTransaction } from "../utils.js";
|
|
160
|
-
var createReleaseNft =
|
|
161
|
-
var
|
|
162
|
-
|
|
156
|
+
var createReleaseNft = function(param) {
|
|
157
|
+
var appMintAddress = param.appMintAddress, releaseDetails = param.releaseDetails, appDetails = param.appDetails, publisherDetails = param.publisherDetails, connection = param.connection, publisher = param.publisher, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
|
|
158
|
+
return _async_to_generator(function() {
|
|
159
|
+
var releaseMintAddress, metaplex, txBuilder, response;
|
|
163
160
|
return _ts_generator(this, function(_state) {
|
|
164
161
|
switch(_state.label){
|
|
165
162
|
case 0:
|
|
166
|
-
appMintAddress = param.appMintAddress, releaseDetails = param.releaseDetails, appDetails = param.appDetails, publisherDetails = param.publisherDetails, connection = param.connection, publisher = param.publisher, storageParams = param.storageParams, priorityFeeLamports = param.priorityFeeLamports;
|
|
167
163
|
console.info("Creating Release NFT");
|
|
168
164
|
releaseMintAddress = Keypair.generate();
|
|
169
165
|
metaplex = getMetaplexInstance(connection, publisher, storageParams);
|
|
@@ -199,18 +195,15 @@ var createReleaseNft = /*#__PURE__*/ function() {
|
|
|
199
195
|
];
|
|
200
196
|
}
|
|
201
197
|
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
var _ref = _async_to_generator(function(param) {
|
|
209
|
-
var appMintAddress, buildToolsPath, signer, url, _param_dryRun, dryRun, storageParams, _param_priorityFeeLamports, priorityFeeLamports, connection, config, apkEntry, mediaBuffer, hash, _config_app_address, _ref, releaseAddress, transactionSignature;
|
|
198
|
+
})();
|
|
199
|
+
};
|
|
200
|
+
export var createReleaseCommand = function(param) {
|
|
201
|
+
var 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, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
202
|
+
return _async_to_generator(function() {
|
|
203
|
+
var connection, config, apkEntry, mediaBuffer, hash, _config_app_address, _ref, releaseAddress, transactionSignature;
|
|
210
204
|
return _ts_generator(this, function(_state) {
|
|
211
205
|
switch(_state.label){
|
|
212
206
|
case 0:
|
|
213
|
-
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, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
214
207
|
connection = new Connection(url, {
|
|
215
208
|
commitment: "confirmed"
|
|
216
209
|
});
|
|
@@ -286,8 +279,5 @@ export var createReleaseCommand = /*#__PURE__*/ function() {
|
|
|
286
279
|
];
|
|
287
280
|
}
|
|
288
281
|
});
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
return _ref.apply(this, arguments);
|
|
292
|
-
};
|
|
293
|
-
}();
|
|
282
|
+
})();
|
|
283
|
+
};
|
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t,
|
|
31
|
+
var f, y, t, _ = {
|
|
32
32
|
label: 0,
|
|
33
33
|
sent: function() {
|
|
34
34
|
if (t[0] & 1) throw t[1];
|
|
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
|
|
|
36
36
|
},
|
|
37
37
|
trys: [],
|
|
38
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() {
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
41
|
return this;
|
|
46
42
|
}), g;
|
|
47
43
|
function verb(n) {
|
|
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
|
|
|
54
50
|
}
|
|
55
51
|
function step(op) {
|
|
56
52
|
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
58
54
|
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
55
|
if (y = 0, t) op = [
|
|
60
56
|
op[0] & 2,
|
|
@@ -127,13 +123,13 @@ import { publishRemove } from "@solana-mobile/dapp-store-publishing-tools";
|
|
|
127
123
|
import { checkMintedStatus } from "../../CliUtils.js";
|
|
128
124
|
import nacl from "tweetnacl";
|
|
129
125
|
import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
|
|
130
|
-
export var publishRemoveCommand =
|
|
131
|
-
var
|
|
132
|
-
|
|
126
|
+
export var publishRemoveCommand = function(param) {
|
|
127
|
+
var 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;
|
|
128
|
+
return _async_to_generator(function() {
|
|
129
|
+
var connection, _ref, publisherDetails, appDetails, releaseDetails, sign, appAddr, releaseAddr;
|
|
133
130
|
return _ts_generator(this, function(_state) {
|
|
134
131
|
switch(_state.label){
|
|
135
132
|
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
133
|
if (!requestorIsAuthorized) {
|
|
138
134
|
console.error("ERROR: Cannot submit a request for which the requestor does not attest they are authorized to do so");
|
|
139
135
|
return [
|
|
@@ -152,12 +148,11 @@ export var publishRemoveCommand = /*#__PURE__*/ function() {
|
|
|
152
148
|
sign = function(buf) {
|
|
153
149
|
return nacl.sign(buf, signer.secretKey);
|
|
154
150
|
};
|
|
155
|
-
pubAddr = publisherDetails.address;
|
|
156
151
|
appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
|
|
157
152
|
releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
|
|
158
153
|
return [
|
|
159
154
|
4,
|
|
160
|
-
checkMintedStatus(connection,
|
|
155
|
+
checkMintedStatus(connection, appAddr, releaseAddr)
|
|
161
156
|
];
|
|
162
157
|
case 2:
|
|
163
158
|
_state.sent();
|
|
@@ -181,8 +176,5 @@ export var publishRemoveCommand = /*#__PURE__*/ function() {
|
|
|
181
176
|
];
|
|
182
177
|
}
|
|
183
178
|
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
return _ref.apply(this, arguments);
|
|
187
|
-
};
|
|
188
|
-
}();
|
|
179
|
+
})();
|
|
180
|
+
};
|