@solana-mobile/dapp-store-cli 0.16.0 → 0.16.1
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 +3 -1
- package/lib/CliSetup.js +304 -505
- package/lib/CliUtils.js +6 -376
- package/lib/__tests__/CliSetupTest.js +484 -74
- package/lib/cli/__tests__/parseErrors.test.js +25 -0
- package/lib/cli/__tests__/signer.test.js +436 -0
- package/lib/cli/constants.js +23 -0
- package/lib/cli/messages.js +21 -0
- package/lib/cli/parseErrors.js +41 -0
- package/lib/{commands/publish/PublishCliSupport.js → cli/selfUpdate.js} +72 -38
- package/lib/{commands/publish/PublishCliRemove.js → cli/signer.js} +35 -56
- package/lib/index.js +96 -5
- package/lib/package.json +5 -24
- package/lib/portal/__tests__/releaseMetadata.test.js +647 -0
- package/lib/portal/__tests__/translators.test.js +76 -0
- package/lib/portal/__tests__/workflowClient.test.js +457 -0
- package/lib/portal/attestationClient.js +143 -0
- package/lib/portal/files.js +64 -0
- package/lib/portal/http.js +364 -0
- package/lib/portal/records.js +64 -0
- package/lib/portal/releaseMetadata.js +748 -0
- package/lib/portal/translators.js +460 -0
- package/lib/portal/types.js +1 -0
- package/lib/portal/workflowClient.js +704 -0
- package/lib/publication/PublicationProgressReporter.js +1051 -0
- package/lib/publication/__tests__/PublicationProgressReporter.test.js +174 -0
- package/lib/{commands/ValidateCommand.js → publication/__tests__/fundingPreflight.test.js} +90 -66
- package/lib/publication/__tests__/publicationSummary.test.js +26 -0
- package/lib/publication/cliValidation.js +482 -0
- package/lib/publication/fundingPreflight.js +246 -0
- package/lib/publication/publicationSummary.js +99 -0
- package/lib/{commands/utils.js → publication/runPublicationWorkflow.js} +16 -46
- package/package.json +5 -24
- package/src/CliSetup.ts +370 -505
- package/src/CliUtils.ts +9 -233
- package/src/__tests__/CliSetupTest.ts +272 -120
- package/src/cli/__tests__/parseErrors.test.ts +34 -0
- package/src/cli/__tests__/signer.test.ts +359 -0
- package/src/cli/constants.ts +3 -0
- package/src/cli/messages.ts +27 -0
- package/src/cli/parseErrors.ts +62 -0
- package/src/cli/selfUpdate.ts +59 -0
- package/src/cli/signer.ts +38 -0
- package/src/index.ts +31 -4
- package/src/portal/__tests__/releaseMetadata.test.ts +508 -0
- package/src/portal/__tests__/translators.test.ts +82 -0
- package/src/portal/__tests__/workflowClient.test.ts +278 -0
- package/src/portal/attestationClient.ts +19 -0
- package/src/portal/files.ts +73 -0
- package/src/portal/http.ts +170 -0
- package/src/portal/records.ts +38 -0
- package/src/portal/releaseMetadata.ts +489 -0
- package/src/portal/translators.ts +750 -0
- package/src/portal/types.ts +27 -0
- package/src/portal/workflowClient.ts +575 -0
- package/src/publication/PublicationProgressReporter.ts +1026 -0
- package/src/publication/__tests__/PublicationProgressReporter.test.ts +210 -0
- package/src/publication/__tests__/fundingPreflight.test.ts +78 -0
- package/src/publication/__tests__/publicationSummary.test.ts +30 -0
- package/src/publication/cliValidation.ts +264 -0
- package/src/publication/fundingPreflight.ts +123 -0
- package/src/publication/publicationSummary.ts +26 -0
- package/src/publication/runPublicationWorkflow.ts +46 -0
- package/lib/commands/create/CreateCliApp.js +0 -223
- package/lib/commands/create/CreateCliRelease.js +0 -290
- package/lib/commands/create/index.js +0 -40
- package/lib/commands/index.js +0 -3
- package/lib/commands/publish/PublishCliSubmit.js +0 -208
- package/lib/commands/publish/PublishCliUpdate.js +0 -211
- package/lib/commands/publish/index.js +0 -22
- package/lib/commands/scaffolding/ScaffoldInit.js +0 -15
- package/lib/commands/scaffolding/index.js +0 -1
- package/lib/config/EnvVariables.js +0 -59
- package/lib/config/PublishDetails.js +0 -915
- package/lib/config/S3StorageManager.js +0 -93
- package/lib/config/index.js +0 -2
- package/lib/generated/config_obj.json +0 -1
- package/lib/generated/config_schema.json +0 -1
- package/lib/prebuild_schema/publishing_source.yaml +0 -64
- package/lib/prebuild_schema/schemagen.js +0 -25
- package/lib/upload/CachedStorageDriver.js +0 -458
- package/lib/upload/TurboStorageDriver.js +0 -718
- package/lib/upload/__tests__/CachedStorageDriver.test.js +0 -437
- package/lib/upload/__tests__/TurboStorageDriver.test.js +0 -17
- package/lib/upload/__tests__/contentGateway.test.js +0 -17
- package/lib/upload/contentGateway.js +0 -23
- package/lib/upload/index.js +0 -2
- package/src/commands/ValidateCommand.ts +0 -82
- package/src/commands/create/CreateCliApp.ts +0 -93
- package/src/commands/create/CreateCliRelease.ts +0 -149
- package/src/commands/create/index.ts +0 -47
- package/src/commands/index.ts +0 -3
- package/src/commands/publish/PublishCliRemove.ts +0 -66
- package/src/commands/publish/PublishCliSubmit.ts +0 -93
- package/src/commands/publish/PublishCliSupport.ts +0 -66
- package/src/commands/publish/PublishCliUpdate.ts +0 -101
- package/src/commands/publish/index.ts +0 -29
- package/src/commands/scaffolding/ScaffoldInit.ts +0 -20
- package/src/commands/scaffolding/index.ts +0 -1
- package/src/commands/utils.ts +0 -33
- package/src/config/EnvVariables.ts +0 -39
- package/src/config/PublishDetails.ts +0 -456
- package/src/config/S3StorageManager.ts +0 -47
- package/src/config/index.ts +0 -2
- package/src/prebuild_schema/publishing_source.yaml +0 -64
- package/src/prebuild_schema/schemagen.js +0 -31
- package/src/upload/CachedStorageDriver.ts +0 -179
- package/src/upload/TurboStorageDriver.ts +0 -283
- package/src/upload/__tests__/CachedStorageDriver.test.ts +0 -246
- package/src/upload/__tests__/TurboStorageDriver.test.ts +0 -15
- package/src/upload/__tests__/contentGateway.test.ts +0 -31
- package/src/upload/contentGateway.ts +0 -37
- package/src/upload/index.ts +0 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
2
|
+
return typeof value === 'object' && value !== null;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function extractPublicationSummaryLines(result: unknown): string[] {
|
|
6
|
+
const lines = ['This app is now in review.'];
|
|
7
|
+
|
|
8
|
+
if (!isRecord(result)) {
|
|
9
|
+
return lines;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const keys = [
|
|
13
|
+
['releaseMintAddress', 'Release mint address'],
|
|
14
|
+
['collectionMintAddress', 'Collection mint address'],
|
|
15
|
+
['hubspotTicketId', 'Ticket ID'],
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
for (const [key, label] of keys) {
|
|
19
|
+
const value = result[key];
|
|
20
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
21
|
+
lines.push(`${label}: ${value}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return lines;
|
|
26
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPublicationWorkflow,
|
|
3
|
+
type PublicationAttestationClient,
|
|
4
|
+
type PublicationResumeInput,
|
|
5
|
+
type PublicationWorkflowClient,
|
|
6
|
+
type PublicationWorkflowInput,
|
|
7
|
+
type PublicationWorkflowOptions,
|
|
8
|
+
type PublicationWorkflowResult,
|
|
9
|
+
} from '@solana-mobile/dapp-store-publishing-tools';
|
|
10
|
+
|
|
11
|
+
export type PublicationMode = 'new-version' | 'resume';
|
|
12
|
+
|
|
13
|
+
export type PublicationWorkflowRequest =
|
|
14
|
+
| {
|
|
15
|
+
mode: 'new-version';
|
|
16
|
+
client: PublicationWorkflowClient;
|
|
17
|
+
input: PublicationWorkflowInput;
|
|
18
|
+
options?: PublicationWorkflowOptions;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
mode: 'resume';
|
|
22
|
+
client: PublicationWorkflowClient;
|
|
23
|
+
input: PublicationResumeInput;
|
|
24
|
+
options?: PublicationWorkflowOptions;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export async function runPublicationWorkflow(
|
|
28
|
+
request: PublicationWorkflowRequest,
|
|
29
|
+
): Promise<PublicationWorkflowResult> {
|
|
30
|
+
const workflow = createPublicationWorkflow(request.client, request.options);
|
|
31
|
+
|
|
32
|
+
if (request.mode === 'new-version') {
|
|
33
|
+
return await workflow.startPublication(request.input);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return await workflow.resumePublication(request.input);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type {
|
|
40
|
+
PublicationAttestationClient,
|
|
41
|
+
PublicationResumeInput,
|
|
42
|
+
PublicationWorkflowClient,
|
|
43
|
+
PublicationWorkflowInput,
|
|
44
|
+
PublicationWorkflowOptions,
|
|
45
|
+
PublicationWorkflowResult,
|
|
46
|
+
};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _async_to_generator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _ts_generator(thisArg, body) {
|
|
31
|
-
var f, y, t, _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function() {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
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() {
|
|
41
|
-
return this;
|
|
42
|
-
}), g;
|
|
43
|
-
function verb(n) {
|
|
44
|
-
return function(v) {
|
|
45
|
-
return step([
|
|
46
|
-
n,
|
|
47
|
-
v
|
|
48
|
-
]);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function step(op) {
|
|
52
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
53
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
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;
|
|
55
|
-
if (y = 0, t) op = [
|
|
56
|
-
op[0] & 2,
|
|
57
|
-
t.value
|
|
58
|
-
];
|
|
59
|
-
switch(op[0]){
|
|
60
|
-
case 0:
|
|
61
|
-
case 1:
|
|
62
|
-
t = op;
|
|
63
|
-
break;
|
|
64
|
-
case 4:
|
|
65
|
-
_.label++;
|
|
66
|
-
return {
|
|
67
|
-
value: op[1],
|
|
68
|
-
done: false
|
|
69
|
-
};
|
|
70
|
-
case 5:
|
|
71
|
-
_.label++;
|
|
72
|
-
y = op[1];
|
|
73
|
-
op = [
|
|
74
|
-
0
|
|
75
|
-
];
|
|
76
|
-
continue;
|
|
77
|
-
case 7:
|
|
78
|
-
op = _.ops.pop();
|
|
79
|
-
_.trys.pop();
|
|
80
|
-
continue;
|
|
81
|
-
default:
|
|
82
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
-
_ = 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
-
_.label = op[1];
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
-
_.label = t[1];
|
|
92
|
-
t = op;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (t && _.label < t[2]) {
|
|
96
|
-
_.label = t[2];
|
|
97
|
-
_.ops.push(op);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (t[2]) _.ops.pop();
|
|
101
|
-
_.trys.pop();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
op = body.call(thisArg, _);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
op = [
|
|
107
|
-
6,
|
|
108
|
-
e
|
|
109
|
-
];
|
|
110
|
-
y = 0;
|
|
111
|
-
} finally{
|
|
112
|
-
f = t = 0;
|
|
113
|
-
}
|
|
114
|
-
if (op[0] & 5) throw op[1];
|
|
115
|
-
return {
|
|
116
|
-
value: op[0] ? op[1] : void 0,
|
|
117
|
-
done: true
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
import { createApp } from "@solana-mobile/dapp-store-publishing-tools";
|
|
122
|
-
import { Connection, Keypair } from "@solana/web3.js";
|
|
123
|
-
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
124
|
-
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
125
|
-
import { sendAndConfirmTransaction } from "../utils.js";
|
|
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;
|
|
130
|
-
return _ts_generator(this, function(_state) {
|
|
131
|
-
switch(_state.label){
|
|
132
|
-
case 0:
|
|
133
|
-
console.info("Creating App NFT");
|
|
134
|
-
mintAddress = Keypair.generate();
|
|
135
|
-
metaplex = getMetaplexInstance(connection, publisher, storageParams);
|
|
136
|
-
return [
|
|
137
|
-
4,
|
|
138
|
-
createApp({
|
|
139
|
-
mintAddress: mintAddress,
|
|
140
|
-
appDetails: appDetails,
|
|
141
|
-
priorityFeeLamports: priorityFeeLamports
|
|
142
|
-
}, {
|
|
143
|
-
metaplex: metaplex,
|
|
144
|
-
publisher: publisher
|
|
145
|
-
})
|
|
146
|
-
];
|
|
147
|
-
case 1:
|
|
148
|
-
txBuilder = _state.sent();
|
|
149
|
-
console.info("App NFT data upload complete\nSigning transaction now");
|
|
150
|
-
return [
|
|
151
|
-
4,
|
|
152
|
-
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
153
|
-
];
|
|
154
|
-
case 2:
|
|
155
|
-
response = _state.sent().response;
|
|
156
|
-
return [
|
|
157
|
-
2,
|
|
158
|
-
{
|
|
159
|
-
appAddress: mintAddress.publicKey.toBase58(),
|
|
160
|
-
transactionSignature: response.signature
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
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;
|
|
171
|
-
return _ts_generator(this, function(_state) {
|
|
172
|
-
switch(_state.label){
|
|
173
|
-
case 0:
|
|
174
|
-
connection = new Connection(url, {
|
|
175
|
-
commitment: "confirmed"
|
|
176
|
-
});
|
|
177
|
-
return [
|
|
178
|
-
4,
|
|
179
|
-
loadPublishDetailsWithChecks()
|
|
180
|
-
];
|
|
181
|
-
case 1:
|
|
182
|
-
_ref = _state.sent(), appDetails = _ref.app;
|
|
183
|
-
if (!!dryRun) return [
|
|
184
|
-
3,
|
|
185
|
-
4
|
|
186
|
-
];
|
|
187
|
-
return [
|
|
188
|
-
4,
|
|
189
|
-
createAppNft({
|
|
190
|
-
connection: connection,
|
|
191
|
-
publisher: signer,
|
|
192
|
-
appDetails: appDetails,
|
|
193
|
-
storageParams: storageParams,
|
|
194
|
-
priorityFeeLamports: priorityFeeLamports
|
|
195
|
-
})
|
|
196
|
-
];
|
|
197
|
-
case 2:
|
|
198
|
-
_ref1 = _state.sent(), appAddress = _ref1.appAddress, transactionSignature = _ref1.transactionSignature;
|
|
199
|
-
return [
|
|
200
|
-
4,
|
|
201
|
-
writeToPublishDetails({
|
|
202
|
-
app: {
|
|
203
|
-
address: appAddress
|
|
204
|
-
}
|
|
205
|
-
})
|
|
206
|
-
];
|
|
207
|
-
case 3:
|
|
208
|
-
_state.sent();
|
|
209
|
-
return [
|
|
210
|
-
2,
|
|
211
|
-
{
|
|
212
|
-
appAddress: appAddress,
|
|
213
|
-
transactionSignature: transactionSignature
|
|
214
|
-
}
|
|
215
|
-
];
|
|
216
|
-
case 4:
|
|
217
|
-
return [
|
|
218
|
-
2
|
|
219
|
-
];
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
})();
|
|
223
|
-
};
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _async_to_generator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _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, _ = {
|
|
60
|
-
label: 0,
|
|
61
|
-
sent: function() {
|
|
62
|
-
if (t[0] & 1) throw t[1];
|
|
63
|
-
return t[1];
|
|
64
|
-
},
|
|
65
|
-
trys: [],
|
|
66
|
-
ops: []
|
|
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() {
|
|
69
|
-
return this;
|
|
70
|
-
}), g;
|
|
71
|
-
function verb(n) {
|
|
72
|
-
return function(v) {
|
|
73
|
-
return step([
|
|
74
|
-
n,
|
|
75
|
-
v
|
|
76
|
-
]);
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function step(op) {
|
|
80
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
81
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
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;
|
|
83
|
-
if (y = 0, t) op = [
|
|
84
|
-
op[0] & 2,
|
|
85
|
-
t.value
|
|
86
|
-
];
|
|
87
|
-
switch(op[0]){
|
|
88
|
-
case 0:
|
|
89
|
-
case 1:
|
|
90
|
-
t = op;
|
|
91
|
-
break;
|
|
92
|
-
case 4:
|
|
93
|
-
_.label++;
|
|
94
|
-
return {
|
|
95
|
-
value: op[1],
|
|
96
|
-
done: false
|
|
97
|
-
};
|
|
98
|
-
case 5:
|
|
99
|
-
_.label++;
|
|
100
|
-
y = op[1];
|
|
101
|
-
op = [
|
|
102
|
-
0
|
|
103
|
-
];
|
|
104
|
-
continue;
|
|
105
|
-
case 7:
|
|
106
|
-
op = _.ops.pop();
|
|
107
|
-
_.trys.pop();
|
|
108
|
-
continue;
|
|
109
|
-
default:
|
|
110
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
111
|
-
_ = 0;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
115
|
-
_.label = op[1];
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
119
|
-
_.label = t[1];
|
|
120
|
-
t = op;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
if (t && _.label < t[2]) {
|
|
124
|
-
_.label = t[2];
|
|
125
|
-
_.ops.push(op);
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
if (t[2]) _.ops.pop();
|
|
129
|
-
_.trys.pop();
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
op = body.call(thisArg, _);
|
|
133
|
-
} catch (e) {
|
|
134
|
-
op = [
|
|
135
|
-
6,
|
|
136
|
-
e
|
|
137
|
-
];
|
|
138
|
-
y = 0;
|
|
139
|
-
} finally{
|
|
140
|
-
f = t = 0;
|
|
141
|
-
}
|
|
142
|
-
if (op[0] & 5) throw op[1];
|
|
143
|
-
return {
|
|
144
|
-
value: op[0] ? op[1] : void 0,
|
|
145
|
-
done: true
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
import { createRelease } from "@solana-mobile/dapp-store-publishing-tools";
|
|
150
|
-
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
151
|
-
import fs from "fs";
|
|
152
|
-
import { createHash } from "crypto";
|
|
153
|
-
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
154
|
-
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
155
|
-
import { sendAndConfirmTransaction } from "../utils.js";
|
|
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;
|
|
160
|
-
return _ts_generator(this, function(_state) {
|
|
161
|
-
switch(_state.label){
|
|
162
|
-
case 0:
|
|
163
|
-
console.info("Creating Release NFT");
|
|
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
|
-
priorityFeeLamports: priorityFeeLamports
|
|
175
|
-
}, {
|
|
176
|
-
metaplex: metaplex,
|
|
177
|
-
publisher: publisher
|
|
178
|
-
})
|
|
179
|
-
];
|
|
180
|
-
case 1:
|
|
181
|
-
txBuilder = _state.sent().txBuilder;
|
|
182
|
-
console.info("Release NFT data upload complete\nSigning transaction now");
|
|
183
|
-
return [
|
|
184
|
-
4,
|
|
185
|
-
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
186
|
-
];
|
|
187
|
-
case 2:
|
|
188
|
-
response = _state.sent().response;
|
|
189
|
-
return [
|
|
190
|
-
2,
|
|
191
|
-
{
|
|
192
|
-
releaseAddress: releaseMintAddress.publicKey.toBase58(),
|
|
193
|
-
transactionSignature: response.signature
|
|
194
|
-
}
|
|
195
|
-
];
|
|
196
|
-
}
|
|
197
|
-
});
|
|
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;
|
|
204
|
-
return _ts_generator(this, function(_state) {
|
|
205
|
-
switch(_state.label){
|
|
206
|
-
case 0:
|
|
207
|
-
connection = new Connection(url, {
|
|
208
|
-
commitment: "confirmed"
|
|
209
|
-
});
|
|
210
|
-
return [
|
|
211
|
-
4,
|
|
212
|
-
loadPublishDetailsWithChecks(buildToolsPath)
|
|
213
|
-
];
|
|
214
|
-
case 1:
|
|
215
|
-
config = _state.sent();
|
|
216
|
-
apkEntry = config.release.files.find(function(asset) {
|
|
217
|
-
return asset.purpose === "install";
|
|
218
|
-
});
|
|
219
|
-
return [
|
|
220
|
-
4,
|
|
221
|
-
fs.promises.readFile(apkEntry.uri)
|
|
222
|
-
];
|
|
223
|
-
case 2:
|
|
224
|
-
mediaBuffer = _state.sent();
|
|
225
|
-
hash = createHash("sha256").update(mediaBuffer).digest("base64");
|
|
226
|
-
if (config.lastSubmittedVersionOnChain != null && hash === config.lastSubmittedVersionOnChain.apk_hash) {
|
|
227
|
-
throw new Error("The last created release used the same apk file.");
|
|
228
|
-
}
|
|
229
|
-
if (config.lastSubmittedVersionOnChain != null && config.release.android_details.version_code <= config.lastSubmittedVersionOnChain.version_code) {
|
|
230
|
-
throw new Error("Each release NFT should have higher version code than previous minted release NFT.\nLast released version code is ".concat(config.lastSubmittedVersionOnChain.version_code, ".\nCurrent version code from apk file is ").concat(config.release.android_details.version_code));
|
|
231
|
-
}
|
|
232
|
-
if (config.app.android_package != config.release.android_details.android_package) {
|
|
233
|
-
throw new Error("App package name and release package name do not match.\nApp release specifies " + config.app.android_package + " while release specifies " + config.release.android_details.android_package);
|
|
234
|
-
}
|
|
235
|
-
if (!!dryRun) return [
|
|
236
|
-
3,
|
|
237
|
-
5
|
|
238
|
-
];
|
|
239
|
-
return [
|
|
240
|
-
4,
|
|
241
|
-
createReleaseNft({
|
|
242
|
-
appMintAddress: (_config_app_address = config.app.address) !== null && _config_app_address !== void 0 ? _config_app_address : appMintAddress,
|
|
243
|
-
connection: connection,
|
|
244
|
-
publisher: signer,
|
|
245
|
-
releaseDetails: _object_spread({}, config.release),
|
|
246
|
-
appDetails: config.app,
|
|
247
|
-
publisherDetails: config.publisher,
|
|
248
|
-
storageParams: storageParams,
|
|
249
|
-
priorityFeeLamports: priorityFeeLamports
|
|
250
|
-
})
|
|
251
|
-
];
|
|
252
|
-
case 3:
|
|
253
|
-
_ref = _state.sent(), releaseAddress = _ref.releaseAddress, transactionSignature = _ref.transactionSignature;
|
|
254
|
-
return [
|
|
255
|
-
4,
|
|
256
|
-
writeToPublishDetails({
|
|
257
|
-
release: {
|
|
258
|
-
address: releaseAddress,
|
|
259
|
-
android_details: {
|
|
260
|
-
cert_fingerprint: config.release.android_details.cert_fingerprint,
|
|
261
|
-
min_sdk: config.release.android_details.min_sdk,
|
|
262
|
-
version: config.release.android_details.version,
|
|
263
|
-
version_code: config.release.android_details.version_code,
|
|
264
|
-
locales: config.release.android_details.locales
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
lastSubmittedVersionOnChain: {
|
|
268
|
-
address: releaseAddress,
|
|
269
|
-
version_code: config.release.android_details.version_code,
|
|
270
|
-
apk_hash: hash
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
];
|
|
274
|
-
case 4:
|
|
275
|
-
_state.sent();
|
|
276
|
-
return [
|
|
277
|
-
2,
|
|
278
|
-
{
|
|
279
|
-
releaseAddress: releaseAddress,
|
|
280
|
-
transactionSignature: transactionSignature
|
|
281
|
-
}
|
|
282
|
-
];
|
|
283
|
-
case 5:
|
|
284
|
-
return [
|
|
285
|
-
2
|
|
286
|
-
];
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
})();
|
|
290
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export * from "./CreateCliApp.js";
|
|
2
|
-
export * from "./CreateCliRelease.js"; /*
|
|
3
|
-
* Module responsible for creating publishers, apps, and releases (in that order)
|
|
4
|
-
* Anything that is out-of-order will be prompted back into order
|
|
5
|
-
* And steps that happen more than once will do their best to remember as much information as possible.
|
|
6
|
-
* We will ask questions and do our best to answer anything that's already been configured, and prompt for anything that's not
|
|
7
|
-
*/ // We'll never ask for private keys or seed phrases
|
|
8
|
-
// You can use a burner signer to publish; all NFTs require verification from the publisher signer
|
|
9
|
-
// You can use a multisig or Ledger for that purpose
|
|
10
|
-
// Publisher
|
|
11
|
-
// Public key attached to a publisher must also verify applications and releases
|
|
12
|
-
// Most information here can be be edited after the fact
|
|
13
|
-
// Only required fields are name, address, publisher website, and contact email
|
|
14
|
-
// Optional fields are: description, image_url (need dimensions!)
|
|
15
|
-
// App
|
|
16
|
-
// Publisher creator key required
|
|
17
|
-
// Most information can be edited after the fact
|
|
18
|
-
// Required: name, description, `android_package`
|
|
19
|
-
// Optional: Any additional creator keys
|
|
20
|
-
// TODO(jon): Probably okay to capture more information here like:
|
|
21
|
-
// - `license_url`
|
|
22
|
-
// - `copyright_url`
|
|
23
|
-
// - `privacy_policy_url`
|
|
24
|
-
// Release
|
|
25
|
-
// Publisher creator key required
|
|
26
|
-
// Immutable; information cannot be edited after publishing.
|
|
27
|
-
// Change based on the review process must result in a new release
|
|
28
|
-
// Required:
|
|
29
|
-
// - version (automatically prompt with semver + 1)
|
|
30
|
-
// - release notes (description)
|
|
31
|
-
// - publisher creator key
|
|
32
|
-
// - path to the APK
|
|
33
|
-
// Optional:
|
|
34
|
-
// - Media related to the release
|
|
35
|
-
// - New permissions (prompted)
|
|
36
|
-
// - New languages (prompted)
|
|
37
|
-
// Handles uploads of all files, sha'ing them
|
|
38
|
-
// Handles i18n (later)
|
|
39
|
-
// We'll attempt to read as much as possible from a provided `.yml` file
|
|
40
|
-
// If there are provided folders that are well-structured, we'll opt to use that too.
|
package/lib/commands/index.js
DELETED