@solana-mobile/dapp-store-cli 0.4.1 → 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 +68 -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 +4 -6
- 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 -105
- 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 -178
- 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 -20
- 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/src/index.ts
CHANGED
|
@@ -1,514 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { validateCommand } from "./commands/index.js";
|
|
3
|
-
import { createAppCommand, createPublisherCommand, createReleaseCommand } from "./commands/create/index.js";
|
|
4
|
-
import {
|
|
5
|
-
publishRemoveCommand,
|
|
6
|
-
publishSubmitCommand,
|
|
7
|
-
publishSupportCommand,
|
|
8
|
-
publishUpdateCommand
|
|
9
|
-
} from "./commands/publish/index.js";
|
|
10
|
-
import {
|
|
11
|
-
checkForSelfUpdate,
|
|
12
|
-
checkSubmissionNetwork,
|
|
13
|
-
Constants,
|
|
14
|
-
generateNetworkSuffix,
|
|
15
|
-
parseKeypair,
|
|
16
|
-
showMessage
|
|
17
|
-
} from "./CliUtils.js";
|
|
18
|
-
import terminalLink from "terminal-link";
|
|
19
|
-
import boxen from "boxen";
|
|
20
|
-
|
|
21
|
-
import * as dotenv from "dotenv";
|
|
22
|
-
import { initScaffold } from "./commands/scaffolding/index.js";
|
|
23
|
-
import { loadPublishDetailsWithChecks } from "./config/PublishDetails.js";
|
|
24
|
-
|
|
25
|
-
dotenv.config();
|
|
26
|
-
|
|
27
|
-
const hasAddressInConfig = ({ address }: { address: string }) => {
|
|
28
|
-
return !!address;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const program = new Command();
|
|
32
|
-
|
|
33
|
-
function resolveBuildToolsPath(buildToolsPath: string | undefined) {
|
|
34
|
-
// If a path was specified on the command line, use that
|
|
35
|
-
if (buildToolsPath !== undefined) {
|
|
36
|
-
return buildToolsPath;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// If a path is specified in a .env file, use that
|
|
40
|
-
if (process.env.ANDROID_TOOLS_DIR !== undefined) {
|
|
41
|
-
return process.env.ANDROID_TOOLS_DIR;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// No path was specified
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* This method should be updated with each new release of the CLI, and just do nothing when there isn't anything to report
|
|
50
|
-
*/
|
|
51
|
-
function latestReleaseMessage() {
|
|
52
|
-
showMessage(
|
|
53
|
-
`Publishing Tools Version ${ Constants.CLI_VERSION }`,
|
|
54
|
-
"- NOTE: In a future release, the maximum length for `short_description` will be reduced from 50 to 30 characters. We recommend updating all localized instances now.",
|
|
55
|
-
"warning"
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function tryWithErrorMessage(block: () => Promise<any>) {
|
|
60
|
-
try {
|
|
61
|
-
await block()
|
|
62
|
-
} catch (e) {
|
|
63
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
64
|
-
|
|
65
|
-
showMessage("Error", errorMsg, "error");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
import { mainCli } from "./CliSetup.js";
|
|
68
2
|
|
|
69
3
|
async function main() {
|
|
70
|
-
|
|
71
|
-
.name("dapp-store")
|
|
72
|
-
.version(Constants.CLI_VERSION)
|
|
73
|
-
.description("CLI to assist with publishing to the Saga Dapp Store")
|
|
74
|
-
|
|
75
|
-
const initCommand = program
|
|
76
|
-
.command("init")
|
|
77
|
-
.description("First-time initialization of tooling configuration")
|
|
78
|
-
.action(async () => {
|
|
79
|
-
tryWithErrorMessage(async () => {
|
|
80
|
-
const msg = initScaffold();
|
|
81
|
-
|
|
82
|
-
showMessage("Initialized", msg);
|
|
83
|
-
})
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const createCommand = program
|
|
87
|
-
.command("create")
|
|
88
|
-
.description("Create a `publisher`, `app`, or `release`")
|
|
89
|
-
|
|
90
|
-
createCommand
|
|
91
|
-
.command("publisher")
|
|
92
|
-
.description("Create a publisher")
|
|
93
|
-
.requiredOption(
|
|
94
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
95
|
-
"Path to keypair file"
|
|
96
|
-
)
|
|
97
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
98
|
-
.option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT")
|
|
99
|
-
.action(async ({ keypair, url, dryRun }) => {
|
|
100
|
-
tryWithErrorMessage(async () => {
|
|
101
|
-
latestReleaseMessage();
|
|
102
|
-
await checkForSelfUpdate();
|
|
103
|
-
|
|
104
|
-
const signer = parseKeypair(keypair);
|
|
105
|
-
if (signer) {
|
|
106
|
-
const result: { publisherAddress: string } = await createPublisherCommand({ signer, url, dryRun });
|
|
107
|
-
|
|
108
|
-
const displayUrl = `https://solscan.io/token/${result.publisherAddress}${generateNetworkSuffix(url)}`;
|
|
109
|
-
const resultText = `Publisher NFT successfully minted:\n${displayUrl}`;
|
|
110
|
-
|
|
111
|
-
showMessage("Success", resultText);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
createCommand
|
|
117
|
-
.command("app")
|
|
118
|
-
.description("Create a app")
|
|
119
|
-
.requiredOption(
|
|
120
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
121
|
-
"Path to keypair file"
|
|
122
|
-
)
|
|
123
|
-
.option(
|
|
124
|
-
"-p, --publisher-mint-address <publisher-mint-address>",
|
|
125
|
-
"The mint address of the publisher NFT"
|
|
126
|
-
)
|
|
127
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
128
|
-
.option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT")
|
|
129
|
-
.action(async ({ publisherMintAddress, keypair, url, dryRun }) => {
|
|
130
|
-
tryWithErrorMessage(async () => {
|
|
131
|
-
latestReleaseMessage();
|
|
132
|
-
await checkForSelfUpdate();
|
|
133
|
-
|
|
134
|
-
const config = await loadPublishDetailsWithChecks();
|
|
135
|
-
|
|
136
|
-
if (!hasAddressInConfig(config.publisher) && !publisherMintAddress) {
|
|
137
|
-
throw new Error("Either specify a publisher mint address in the config file or specify as a CLI argument to this command.")
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const signer = parseKeypair(keypair);
|
|
141
|
-
if (signer) {
|
|
142
|
-
const result = await createAppCommand({
|
|
143
|
-
publisherMintAddress: publisherMintAddress,
|
|
144
|
-
signer,
|
|
145
|
-
url,
|
|
146
|
-
dryRun,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const displayUrl = `https://solscan.io/token/${result.appAddress}${generateNetworkSuffix(url)}`;
|
|
150
|
-
const resultText = `App NFT successfully minted:\n${displayUrl}`;
|
|
151
|
-
|
|
152
|
-
showMessage("Success", resultText);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
createCommand
|
|
158
|
-
.command("release")
|
|
159
|
-
.description("Create a release")
|
|
160
|
-
.requiredOption(
|
|
161
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
162
|
-
"Path to keypair file"
|
|
163
|
-
)
|
|
164
|
-
.option(
|
|
165
|
-
"-a, --app-mint-address <app-mint-address>",
|
|
166
|
-
"The mint address of the app NFT"
|
|
167
|
-
)
|
|
168
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
169
|
-
.option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT")
|
|
170
|
-
.option(
|
|
171
|
-
"-b, --build-tools-path <build-tools-path>",
|
|
172
|
-
"Path to Android build tools which contains AAPT2"
|
|
173
|
-
)
|
|
174
|
-
.action(async ({ appMintAddress, keypair, url, dryRun, buildToolsPath }) => {
|
|
175
|
-
tryWithErrorMessage(async () => {
|
|
176
|
-
latestReleaseMessage();
|
|
177
|
-
await checkForSelfUpdate();
|
|
178
|
-
|
|
179
|
-
const resolvedBuildToolsPath = resolveBuildToolsPath(buildToolsPath);
|
|
180
|
-
if (resolvedBuildToolsPath === undefined) {
|
|
181
|
-
throw new Error("Please specify an Android build tools directory in the .env file or via the command line argument.")
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const config = await loadPublishDetailsWithChecks();
|
|
185
|
-
if (!hasAddressInConfig(config.app) && !appMintAddress) {
|
|
186
|
-
throw new Error("Either specify an app mint address in the config file or specify as a CLI argument to this command")
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const signer = parseKeypair(keypair);
|
|
190
|
-
if (signer) {
|
|
191
|
-
const result = await createReleaseCommand({
|
|
192
|
-
appMintAddress: appMintAddress,
|
|
193
|
-
buildToolsPath: resolvedBuildToolsPath,
|
|
194
|
-
signer,
|
|
195
|
-
url,
|
|
196
|
-
dryRun,
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const displayUrl = `https://solscan.io/token/${result?.releaseAddress}${generateNetworkSuffix(url)}`;
|
|
200
|
-
const resultText = `Release NFT successfully minted:\n${displayUrl}`;
|
|
201
|
-
|
|
202
|
-
showMessage("Success", resultText);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
program
|
|
209
|
-
.command("validate")
|
|
210
|
-
.description("Validates details prior to publishing")
|
|
211
|
-
.requiredOption(
|
|
212
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
213
|
-
"Path to keypair file"
|
|
214
|
-
)
|
|
215
|
-
.option(
|
|
216
|
-
"-b, --build-tools-path <build-tools-path>",
|
|
217
|
-
"Path to Android build tools which contains AAPT2"
|
|
218
|
-
)
|
|
219
|
-
.action(async ({ keypair, buildToolsPath }) => {
|
|
220
|
-
tryWithErrorMessage(async () => {
|
|
221
|
-
latestReleaseMessage();
|
|
222
|
-
await checkForSelfUpdate();
|
|
223
|
-
|
|
224
|
-
const resolvedBuildToolsPath = resolveBuildToolsPath(buildToolsPath);
|
|
225
|
-
if (resolvedBuildToolsPath === undefined) {
|
|
226
|
-
throw new Error("Please specify an Android build tools directory in the .env file or via the command line argument.")
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const signer = parseKeypair(keypair);
|
|
230
|
-
if (signer) {
|
|
231
|
-
await validateCommand({
|
|
232
|
-
signer,
|
|
233
|
-
buildToolsPath: resolvedBuildToolsPath,
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
//TODO: Add pretty formatting here, but will require more work than other sections
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const publishCommand = program
|
|
242
|
-
.command("publish")
|
|
243
|
-
.description(
|
|
244
|
-
"Submit a publishing request (`submit`, `update`, `remove`, or `support`) to the Solana Mobile dApp publisher portal"
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
publishCommand
|
|
248
|
-
.command("submit")
|
|
249
|
-
.description("Submit a new app to the Solana Mobile dApp publisher portal")
|
|
250
|
-
.requiredOption(
|
|
251
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
252
|
-
"Path to keypair file"
|
|
253
|
-
)
|
|
254
|
-
.requiredOption(
|
|
255
|
-
"--complies-with-solana-dapp-store-policies",
|
|
256
|
-
"An attestation that the app complies with the Solana dApp Store policies"
|
|
257
|
-
)
|
|
258
|
-
.requiredOption(
|
|
259
|
-
"--requestor-is-authorized",
|
|
260
|
-
"An attestation that the party making this Solana dApp publisher portal request is authorized to do so"
|
|
261
|
-
)
|
|
262
|
-
.option(
|
|
263
|
-
"-a, --app-mint-address <app-mint-address>",
|
|
264
|
-
"The mint address of the app NFT. If not specified, the value from your config file will be used."
|
|
265
|
-
)
|
|
266
|
-
.option(
|
|
267
|
-
"-r, --release-mint-address <release-mint-address>",
|
|
268
|
-
"The mint address of the release NFT. If not specified, the value from your config file will be used."
|
|
269
|
-
)
|
|
270
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
271
|
-
.option(
|
|
272
|
-
"-d, --dry-run",
|
|
273
|
-
"Flag for dry run. Doesn't submit the request to the publisher portal."
|
|
274
|
-
)
|
|
275
|
-
.action(
|
|
276
|
-
async ({
|
|
277
|
-
appMintAddress,
|
|
278
|
-
releaseMintAddress,
|
|
279
|
-
keypair,
|
|
280
|
-
url,
|
|
281
|
-
compliesWithSolanaDappStorePolicies,
|
|
282
|
-
requestorIsAuthorized,
|
|
283
|
-
dryRun,
|
|
284
|
-
}) => {
|
|
285
|
-
tryWithErrorMessage(async () => {
|
|
286
|
-
await checkForSelfUpdate();
|
|
287
|
-
await checkSubmissionNetwork(url);
|
|
288
|
-
|
|
289
|
-
const config = await loadPublishDetailsWithChecks();
|
|
290
|
-
|
|
291
|
-
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
292
|
-
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.")
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const signer = parseKeypair(keypair);
|
|
296
|
-
if (signer) {
|
|
297
|
-
await publishSubmitCommand({
|
|
298
|
-
appMintAddress,
|
|
299
|
-
releaseMintAddress,
|
|
300
|
-
signer,
|
|
301
|
-
url,
|
|
302
|
-
dryRun,
|
|
303
|
-
compliesWithSolanaDappStorePolicies,
|
|
304
|
-
requestorIsAuthorized,
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
const resultText = "Successfully submitted to the Solana Mobile dApp publisher portal";
|
|
308
|
-
showMessage("Success", resultText);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
publishCommand
|
|
315
|
-
.command("update")
|
|
316
|
-
.description(
|
|
317
|
-
"Update an existing app on the Solana Mobile dApp publisher portal"
|
|
318
|
-
)
|
|
319
|
-
.requiredOption(
|
|
320
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
321
|
-
"Path to keypair file"
|
|
322
|
-
)
|
|
323
|
-
.requiredOption(
|
|
324
|
-
"--complies-with-solana-dapp-store-policies",
|
|
325
|
-
"An attestation that the app complies with the Solana dApp Store policies"
|
|
326
|
-
)
|
|
327
|
-
.requiredOption(
|
|
328
|
-
"--requestor-is-authorized",
|
|
329
|
-
"An attestation that the party making this Solana dApp publisher portal request is authorized to do so"
|
|
330
|
-
)
|
|
331
|
-
.option(
|
|
332
|
-
"-a, --app-mint-address <app-mint-address>",
|
|
333
|
-
"The mint address of the app NFT. If not specified, the value from your config file will be used."
|
|
334
|
-
)
|
|
335
|
-
.option(
|
|
336
|
-
"-r, --release-mint-address <release-mint-address>",
|
|
337
|
-
"The mint address of the release NFT. If not specified, the value from your config file will be used."
|
|
338
|
-
)
|
|
339
|
-
.option("-c, --critical", "Flag for a critical app update request")
|
|
340
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
341
|
-
.option(
|
|
342
|
-
"-d, --dry-run",
|
|
343
|
-
"Flag for dry run. Doesn't submit the request to the publisher portal."
|
|
344
|
-
)
|
|
345
|
-
.action(
|
|
346
|
-
async ({
|
|
347
|
-
appMintAddress,
|
|
348
|
-
releaseMintAddress,
|
|
349
|
-
keypair,
|
|
350
|
-
url,
|
|
351
|
-
compliesWithSolanaDappStorePolicies,
|
|
352
|
-
requestorIsAuthorized,
|
|
353
|
-
critical,
|
|
354
|
-
dryRun,
|
|
355
|
-
}) => {
|
|
356
|
-
tryWithErrorMessage(async () => {
|
|
357
|
-
await checkForSelfUpdate();
|
|
358
|
-
await checkSubmissionNetwork(url);
|
|
359
|
-
|
|
360
|
-
const config = await loadPublishDetailsWithChecks();
|
|
361
|
-
|
|
362
|
-
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
363
|
-
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.")
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
const signer = parseKeypair(keypair);
|
|
367
|
-
if (signer) {
|
|
368
|
-
await publishUpdateCommand({
|
|
369
|
-
appMintAddress,
|
|
370
|
-
releaseMintAddress,
|
|
371
|
-
signer,
|
|
372
|
-
url,
|
|
373
|
-
dryRun,
|
|
374
|
-
compliesWithSolanaDappStorePolicies,
|
|
375
|
-
requestorIsAuthorized,
|
|
376
|
-
critical,
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
const resultText = "dApp successfully updated on the publisher portal";
|
|
380
|
-
showMessage("Success", resultText);
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
publishCommand
|
|
387
|
-
.command("remove")
|
|
388
|
-
.description(
|
|
389
|
-
"Remove an existing app from the Solana Mobile dApp publisher portal"
|
|
390
|
-
)
|
|
391
|
-
.requiredOption(
|
|
392
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
393
|
-
"Path to keypair file"
|
|
394
|
-
)
|
|
395
|
-
.requiredOption(
|
|
396
|
-
"--requestor-is-authorized",
|
|
397
|
-
"An attestation that the party making this Solana dApp publisher portal request is authorized to do so"
|
|
398
|
-
)
|
|
399
|
-
.option(
|
|
400
|
-
"-a, --app-mint-address <app-mint-address>",
|
|
401
|
-
"The mint address of the app NFT. If not specified, the value from your config file will be used."
|
|
402
|
-
)
|
|
403
|
-
.option(
|
|
404
|
-
"-r, --release-mint-address <release-mint-address>",
|
|
405
|
-
"The mint address of the release NFT. If not specified, the value from your config file will be used."
|
|
406
|
-
)
|
|
407
|
-
.option("-c, --critical", "Flag for a critical app removal request")
|
|
408
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
409
|
-
.option(
|
|
410
|
-
"-d, --dry-run",
|
|
411
|
-
"Flag for dry run. Doesn't submit the request to the publisher portal."
|
|
412
|
-
)
|
|
413
|
-
.action(
|
|
414
|
-
async ({
|
|
415
|
-
appMintAddress,
|
|
416
|
-
releaseMintAddress,
|
|
417
|
-
keypair,
|
|
418
|
-
url,
|
|
419
|
-
requestorIsAuthorized,
|
|
420
|
-
critical,
|
|
421
|
-
dryRun,
|
|
422
|
-
}) => {
|
|
423
|
-
tryWithErrorMessage(async () => {
|
|
424
|
-
await checkForSelfUpdate();
|
|
425
|
-
await checkSubmissionNetwork(url);
|
|
426
|
-
|
|
427
|
-
const config = await loadPublishDetailsWithChecks();
|
|
428
|
-
|
|
429
|
-
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
430
|
-
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.")
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
const signer = parseKeypair(keypair);
|
|
434
|
-
if (signer) {
|
|
435
|
-
await publishRemoveCommand({
|
|
436
|
-
appMintAddress,
|
|
437
|
-
releaseMintAddress,
|
|
438
|
-
signer,
|
|
439
|
-
url,
|
|
440
|
-
dryRun,
|
|
441
|
-
requestorIsAuthorized,
|
|
442
|
-
critical,
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
const resultText = "dApp successfully removed from the publisher portal";
|
|
446
|
-
showMessage("Success", resultText);
|
|
447
|
-
}
|
|
448
|
-
})
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
|
|
452
|
-
publishCommand
|
|
453
|
-
.command("support <request_details>")
|
|
454
|
-
.description(
|
|
455
|
-
"Submit a support request for an existing app on the Solana Mobile dApp publisher portal"
|
|
456
|
-
)
|
|
457
|
-
.requiredOption(
|
|
458
|
-
"-k, --keypair <path-to-keypair-file>",
|
|
459
|
-
"Path to keypair file"
|
|
460
|
-
)
|
|
461
|
-
.requiredOption(
|
|
462
|
-
"--requestor-is-authorized",
|
|
463
|
-
"An attestation that the party making this Solana dApp publisher portal request is authorized to do so"
|
|
464
|
-
)
|
|
465
|
-
.option(
|
|
466
|
-
"-a, --app-mint-address <app-mint-address>",
|
|
467
|
-
"The mint address of the app NFT. If not specified, the value from your config file will be used."
|
|
468
|
-
)
|
|
469
|
-
.option(
|
|
470
|
-
"-r, --release-mint-address <release-mint-address>",
|
|
471
|
-
"The mint address of the release NFT. If not specified, the value from your config file will be used."
|
|
472
|
-
)
|
|
473
|
-
.option("-u, --url <url>", "RPC URL", Constants.DEFAULT_RPC_DEVNET)
|
|
474
|
-
.option(
|
|
475
|
-
"-d, --dry-run",
|
|
476
|
-
"Flag for dry run. Doesn't submit the request to the publisher portal."
|
|
477
|
-
)
|
|
478
|
-
.action(
|
|
479
|
-
async (
|
|
480
|
-
requestDetails,
|
|
481
|
-
{ appMintAddress, releaseMintAddress, keypair, url, requestorIsAuthorized, dryRun }
|
|
482
|
-
) => {
|
|
483
|
-
tryWithErrorMessage(async () => {
|
|
484
|
-
await checkForSelfUpdate();
|
|
485
|
-
await checkSubmissionNetwork(url);
|
|
486
|
-
|
|
487
|
-
const config = await loadPublishDetailsWithChecks();
|
|
488
|
-
|
|
489
|
-
if (!hasAddressInConfig(config.release) && !releaseMintAddress) {
|
|
490
|
-
throw new Error("Either specify a release mint address in the config file or specify as a CLI argument to this command.")
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
const signer = parseKeypair(keypair);
|
|
494
|
-
if (signer) {
|
|
495
|
-
await publishSupportCommand({
|
|
496
|
-
appMintAddress,
|
|
497
|
-
releaseMintAddress,
|
|
498
|
-
signer,
|
|
499
|
-
url,
|
|
500
|
-
dryRun,
|
|
501
|
-
requestorIsAuthorized,
|
|
502
|
-
requestDetails,
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
const resultText = "Support request sent successfully";
|
|
506
|
-
showMessage("Success", resultText);
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
);
|
|
511
|
-
|
|
512
|
-
await program.parseAsync(process.argv);
|
|
4
|
+
await mainCli.parseAsync(process.argv);
|
|
513
5
|
}
|
|
6
|
+
|
|
514
7
|
main();
|
package/lib/esm/CliUtils.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
3
|
-
import debugModule from "debug";
|
|
4
|
-
import { BundlrStorageDriver, keypairIdentity, Metaplex } from "@metaplex-foundation/js";
|
|
5
|
-
import updateNotifier from "update-notifier";
|
|
6
|
-
import cliPackage from "./package.json" assert { type: "json" };
|
|
7
|
-
import boxen from "boxen";
|
|
8
|
-
import ver from "semver";
|
|
9
|
-
import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
|
|
10
|
-
export class Constants {
|
|
11
|
-
}
|
|
12
|
-
Constants.CLI_VERSION = "0.4.1";
|
|
13
|
-
Constants.CONFIG_FILE_NAME = "config.yaml";
|
|
14
|
-
Constants.DEFAULT_RPC_DEVNET = "https://api.devnet.solana.com";
|
|
15
|
-
export const debug = debugModule("CLI");
|
|
16
|
-
export const checkForSelfUpdate = async () => {
|
|
17
|
-
const notifier = updateNotifier({ pkg: cliPackage });
|
|
18
|
-
const updateInfo = await notifier.fetchInfo();
|
|
19
|
-
const latestVer = new ver.SemVer(updateInfo.latest);
|
|
20
|
-
const currentVer = new ver.SemVer(updateInfo.current);
|
|
21
|
-
if (latestVer.major > currentVer.major || latestVer.minor > currentVer.minor) {
|
|
22
|
-
throw new Error("Please update to the latest version of the dApp Store CLI before proceeding.");
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export const checkMintedStatus = async (conn, pubAddr, appAddr, releaseAddr) => {
|
|
26
|
-
const results = await conn.getMultipleAccountsInfo([
|
|
27
|
-
new PublicKey(pubAddr),
|
|
28
|
-
new PublicKey(appAddr),
|
|
29
|
-
new PublicKey(releaseAddr),
|
|
30
|
-
]);
|
|
31
|
-
const rentAccounts = results.filter((item) => !(item == undefined) && item?.lamports > 0);
|
|
32
|
-
if (rentAccounts?.length != 3) {
|
|
33
|
-
throw new Error("Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export const parseKeypair = (pathToKeypairFile) => {
|
|
37
|
-
try {
|
|
38
|
-
const keypairFile = fs.readFileSync(pathToKeypairFile, "utf-8");
|
|
39
|
-
return Keypair.fromSecretKey(Buffer.from(JSON.parse(keypairFile)));
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
showMessage("KeyPair Error", "Something went wrong when attempting to retrieve the keypair at " + pathToKeypairFile, "error");
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
export const isDevnet = (rpcUrl) => {
|
|
46
|
-
return rpcUrl.indexOf("devnet") != -1;
|
|
47
|
-
};
|
|
48
|
-
export const isTestnet = (rpcUrl) => {
|
|
49
|
-
return rpcUrl.indexOf("testnet") != -1;
|
|
50
|
-
};
|
|
51
|
-
export const checkSubmissionNetwork = (rpcUrl) => {
|
|
52
|
-
if (isDevnet(rpcUrl) || isTestnet(rpcUrl)) {
|
|
53
|
-
throw new Error("It looks like you are attempting to submit a request with a devnet or testnet RPC endpoint. Please ensure that your NFTs are minted on mainnet beta, and re-run with a mainnet beta RPC endpoint.");
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
export const generateNetworkSuffix = (rpcUrl) => {
|
|
57
|
-
let suffix = "";
|
|
58
|
-
if (isDevnet(rpcUrl)) {
|
|
59
|
-
suffix = "?cluster=devnet";
|
|
60
|
-
}
|
|
61
|
-
else if (isTestnet(rpcUrl)) {
|
|
62
|
-
suffix = "?cluster=testnet";
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
suffix = "?cluster=mainnet";
|
|
66
|
-
}
|
|
67
|
-
return suffix;
|
|
68
|
-
};
|
|
69
|
-
export const showMessage = (titleMessage = "", contentMessage = "", type = "standard") => {
|
|
70
|
-
let color = "cyan";
|
|
71
|
-
if (type == "error") {
|
|
72
|
-
color = "redBright";
|
|
73
|
-
}
|
|
74
|
-
else if (type == "warning") {
|
|
75
|
-
color = "yellow";
|
|
76
|
-
}
|
|
77
|
-
const msg = boxen(contentMessage, {
|
|
78
|
-
title: titleMessage,
|
|
79
|
-
padding: 1,
|
|
80
|
-
margin: 1,
|
|
81
|
-
borderStyle: 'single',
|
|
82
|
-
borderColor: color,
|
|
83
|
-
textAlignment: "left",
|
|
84
|
-
titleAlignment: "center",
|
|
85
|
-
});
|
|
86
|
-
console.log(msg);
|
|
87
|
-
return msg;
|
|
88
|
-
};
|
|
89
|
-
export const getMetaplexInstance = (connection, keypair) => {
|
|
90
|
-
const metaplex = Metaplex.make(connection).use(keypairIdentity(keypair));
|
|
91
|
-
const isDevnet = connection.rpcEndpoint.includes("devnet");
|
|
92
|
-
const bundlrStorageDriver = isDevnet
|
|
93
|
-
? new BundlrStorageDriver(metaplex, {
|
|
94
|
-
address: "https://devnet.bundlr.network",
|
|
95
|
-
providerUrl: Constants.DEFAULT_RPC_DEVNET,
|
|
96
|
-
})
|
|
97
|
-
: new BundlrStorageDriver(metaplex);
|
|
98
|
-
metaplex.storage().setDriver(new CachedStorageDriver(bundlrStorageDriver, {
|
|
99
|
-
assetManifestPath: isDevnet
|
|
100
|
-
? "./.asset-manifest-devnet.json"
|
|
101
|
-
: "./.asset-manifest.json",
|
|
102
|
-
}));
|
|
103
|
-
return metaplex;
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=CliUtils.js.map
|
package/lib/esm/CliUtils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CliUtils.js","sourceRoot":"","sources":["../../src/CliUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,UAAU,MAAM,gBAAgB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,OAAO,SAAS;;AACb,qBAAW,GAAG,OAAO,CAAC;AACtB,0BAAgB,GAAG,aAAa,C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AE;QAC3C,iBAAiB,EAAE,QAAQ;YACzB,CAAC,CAAC,+BAA+B;YACjC,CAAC,CAAC,wBAAwB;KAC7B,CAAC,CACH,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createAppJson, createPublisherJson, createReleaseJson, validateApp, validatePublisher, validateRelease, metaplexFileReplacer, } from "@solana-mobile/dapp-store-publishing-tools";
|
|
2
|
-
import { debug } from "../CliUtils.js";
|
|
3
|
-
import { loadPublishDetailsWithChecks } from "../config/PublishDetails.js";
|
|
4
|
-
export const validateCommand = async ({ signer, buildToolsPath, }) => {
|
|
5
|
-
const { publisher: publisherDetails, app: appDetails, release: releaseDetails, } = await loadPublishDetailsWithChecks(buildToolsPath);
|
|
6
|
-
debug({ publisherDetails, appDetails, releaseDetails });
|
|
7
|
-
const publisherJson = createPublisherJson(publisherDetails);
|
|
8
|
-
if (typeof publisherJson.image !== "string") {
|
|
9
|
-
publisherJson.image = publisherJson.image?.fileName;
|
|
10
|
-
}
|
|
11
|
-
debug("publisherJson=", JSON.stringify({ publisherJson }, metaplexFileReplacer, 2));
|
|
12
|
-
try {
|
|
13
|
-
validatePublisher(publisherJson);
|
|
14
|
-
console.info(`Publisher JSON valid!`);
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
console.error(e);
|
|
18
|
-
}
|
|
19
|
-
const appJson = createAppJson(appDetails, signer.publicKey);
|
|
20
|
-
if (typeof appJson.image !== "string") {
|
|
21
|
-
appJson.image = appJson.image?.fileName;
|
|
22
|
-
}
|
|
23
|
-
debug("appJson=", JSON.stringify({ appJson }, metaplexFileReplacer, 2));
|
|
24
|
-
try {
|
|
25
|
-
validateApp(appJson);
|
|
26
|
-
console.info(`App JSON valid!`);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
console.error(e);
|
|
30
|
-
}
|
|
31
|
-
const releaseJson = await createReleaseJson({ releaseDetails, appDetails, publisherDetails }, signer.publicKey);
|
|
32
|
-
const objStringified = JSON.stringify(releaseJson, metaplexFileReplacer, 2);
|
|
33
|
-
debug("releaseJson=", objStringified);
|
|
34
|
-
try {
|
|
35
|
-
validateRelease(JSON.parse(objStringified));
|
|
36
|
-
console.info(`Release JSON valid!`);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
console.error(e);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=ValidateCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValidateCommand.js","sourceRoot":"","sources":["../../../src/commands/ValidateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE3E,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,MAAM,EACN,cAAc,GAIf,EAAE,EAAE;IACH,MAAM,EACJ,SAAS,EAAE,gBAAgB,EAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,cAAc,GACxB,GAAG,MAAM,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAEvD,KAAK,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IAAI,OAAO,aAAa,CAAC,KAAK,KAAK,QAAQ,EAAE;QAC3C,aAAa,CAAC,KAAK,GAAI,aAAa,CAAC,KAAsB,EAAE,QAAQ,CAAC;KACvE;IACD,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,EA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