@dcl/sdk-commands 7.3.2-5591112140.commit-507247c → 7.3.2-5600732702.commit-64a25b9
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/dist/commands/deploy/index.js +64 -34
- package/dist/commands/deploy/index.js.map +1 -1
- package/dist/commands/deploy/linker-dapp/api.d.ts +3 -3
- package/dist/commands/deploy/linker-dapp/api.js +5 -14
- package/dist/commands/deploy/linker-dapp/api.js.map +1 -1
- package/dist/commands/deploy/linker-dapp/routes.d.ts +2 -2
- package/dist/commands/deploy/linker-dapp/routes.js +30 -29
- package/dist/commands/deploy/linker-dapp/routes.js.map +1 -1
- package/dist/commands/deploy/utils.d.ts +2 -2
- package/dist/commands/deploy/utils.js +7 -4
- package/dist/commands/deploy/utils.js.map +1 -1
- package/package.json +5 -5
@@ -1,4 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.main = exports.help = exports.args = void 0;
|
4
7
|
const path_1 = require("path");
|
@@ -8,11 +11,13 @@ const dcl_catalyst_client_1 = require("dcl-catalyst-client");
|
|
8
11
|
const schemas_2 = require("dcl-catalyst-client/node_modules/@dcl/schemas");
|
9
12
|
const scene_validations_1 = require("../../logic/scene-validations");
|
10
13
|
const args_1 = require("../../logic/args");
|
11
|
-
const project_validations_1 = require("../../logic/project-validations");
|
12
14
|
const error_1 = require("../../logic/error");
|
13
15
|
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
14
16
|
const project_files_1 = require("../../logic/project-files");
|
15
17
|
const utils_1 = require("./utils");
|
18
|
+
const build_1 = require("../build");
|
19
|
+
const workspace_validations_1 = require("../../logic/workspace-validations");
|
20
|
+
const fp_future_1 = __importDefault(require("fp-future"));
|
16
21
|
exports.args = (0, args_1.declareArgs)({
|
17
22
|
'--dir': String,
|
18
23
|
'--help': Boolean,
|
@@ -55,9 +60,17 @@ function help(options) {
|
|
55
60
|
exports.help = help;
|
56
61
|
async function main(options) {
|
57
62
|
const projectRoot = (0, path_1.resolve)(process.cwd(), options.args['--dir'] || '.');
|
63
|
+
const workspace = await (0, workspace_validations_1.getValidWorkspace)(options.components, projectRoot);
|
64
|
+
const project = workspace.projects[0];
|
58
65
|
const openBrowser = !options.args['--no-browser'];
|
59
66
|
const skipBuild = options.args['--skip-build'];
|
60
67
|
const linkerPort = options.args['--port'];
|
68
|
+
if (workspace.projects.length !== 1) {
|
69
|
+
throw new error_1.CliError('Workspace is not supported for deploy command.');
|
70
|
+
}
|
71
|
+
if (project.kind !== 'scene') {
|
72
|
+
throw new error_1.CliError('You can only deploy scenes.');
|
73
|
+
}
|
61
74
|
if (options.args['--target'] && options.args['--target-content']) {
|
62
75
|
throw new error_1.CliError(`You can't set both the 'target' and 'target-content' arguments.`);
|
63
76
|
}
|
@@ -73,7 +86,7 @@ async function main(options) {
|
|
73
86
|
const dependencies = Array.from(new Set([...Object.keys(packageJson.dependencies || {}), ...Object.keys(packageJson.devDependencies || {})]));
|
74
87
|
options.components.analytics.track('Scene deploy started', trackProps);
|
75
88
|
if (!skipBuild) {
|
76
|
-
await (0,
|
89
|
+
await (0, build_1.buildScene)({ ...options, args: { '--dir': projectRoot, '--watch': false, '--production': true, _: [] } }, project);
|
77
90
|
}
|
78
91
|
// Obtain list of files to deploy
|
79
92
|
const files = await (0, scene_validations_1.getFiles)(options.components, projectRoot);
|
@@ -87,46 +100,63 @@ async function main(options) {
|
|
87
100
|
});
|
88
101
|
// Signing message
|
89
102
|
const messageToSign = entityId;
|
90
|
-
|
103
|
+
// Start the linker dapp and wait for the user to sign in (linker response).
|
104
|
+
// And then close the program
|
105
|
+
const awaitResponse = (0, fp_future_1.default)();
|
106
|
+
const { program } = await (0, utils_1.getAddressAndSignature)(options.components, awaitResponse, messageToSign, sceneJson, files, {
|
91
107
|
openBrowser,
|
92
108
|
linkerPort,
|
93
109
|
isHttps: !!options.args['--https'],
|
94
110
|
skipValidations: !!options.args['--skip-validations'] || !!options.args['--target'] || !!options.args['--target-content']
|
95
|
-
});
|
96
|
-
const { address, signature, chainId } = await linkerResponse;
|
97
|
-
const authChain = crypto_1.Authenticator.createSimpleAuthChain(entityId, address, signature);
|
98
|
-
// Uploading data
|
99
|
-
const catalyst = await (0, utils_1.getCatalyst)(options.args['--target'], options.args['--target-content']);
|
100
|
-
(0, beautiful_logs_1.printProgressInfo)(options.components.logger, `Uploading data to: ${catalyst.getContentUrl()}...`);
|
101
|
-
const deployData = { entityId, files: entityFiles, authChain };
|
102
|
-
const position = sceneJson.scene.base;
|
103
|
-
const network = chainId === schemas_1.ChainId.ETHEREUM_GOERLI ? 'goerli' : 'mainnet';
|
104
|
-
const sceneUrl = `https://play.decentraland.org/?NETWORK=${network}&position=${position}`;
|
111
|
+
}, deployEntity);
|
105
112
|
try {
|
106
|
-
|
107
|
-
|
108
|
-
}));
|
109
|
-
if (response.message) {
|
110
|
-
(0, beautiful_logs_1.printProgressInfo)(options.components.logger, response.message);
|
111
|
-
}
|
112
|
-
(0, beautiful_logs_1.printSuccess)(options.components.logger, 'Content uploaded', sceneUrl);
|
113
|
-
}
|
114
|
-
catch (e) {
|
115
|
-
options.components.logger.error('Could not upload content:');
|
116
|
-
options.components.logger.error(e);
|
117
|
-
options.components.analytics.track('Scene deploy failure', { ...trackProps, error: e.message ?? '' });
|
113
|
+
// Keep the CLI live till the user signs the payload
|
114
|
+
await awaitResponse;
|
118
115
|
}
|
119
116
|
finally {
|
120
|
-
|
117
|
+
void program?.stop();
|
118
|
+
}
|
119
|
+
async function deployEntity(linkerResponse) {
|
120
|
+
const { address, signature, chainId } = linkerResponse;
|
121
|
+
const authChain = crypto_1.Authenticator.createSimpleAuthChain(entityId, address, signature);
|
122
|
+
// Uploading data
|
123
|
+
const catalyst = await (0, utils_1.getCatalyst)(options.args['--target'], options.args['--target-content']);
|
124
|
+
(0, beautiful_logs_1.printProgressInfo)(options.components.logger, `Uploading data to: ${catalyst.getContentUrl()}...`);
|
125
|
+
const deployData = { entityId, files: entityFiles, authChain };
|
126
|
+
const position = sceneJson.scene.base;
|
127
|
+
const network = chainId === schemas_1.ChainId.ETHEREUM_GOERLI ? 'goerli' : 'mainnet';
|
128
|
+
const worldRealm = isWorld && `realm=${sceneJson.worldConfiguration?.name}`;
|
129
|
+
const sceneUrl = `https://play.decentraland.org/?NETWORK=${network}&position=${position}&${worldRealm}`;
|
130
|
+
try {
|
131
|
+
options.components.logger.info(`Address: ${linkerResponse.address}`);
|
132
|
+
options.components.logger.info(`Signature: ${linkerResponse.signature}`);
|
133
|
+
options.components.logger.info(`Network: ${(0, schemas_1.getChainName)(linkerResponse.chainId)}`);
|
134
|
+
const response = (await catalyst.deploy(deployData, {
|
135
|
+
timeout: '10m'
|
136
|
+
}));
|
137
|
+
if (response.message) {
|
138
|
+
(0, beautiful_logs_1.printProgressInfo)(options.components.logger, response.message);
|
139
|
+
}
|
140
|
+
(0, beautiful_logs_1.printSuccess)(options.components.logger, 'Content uploaded successfully', sceneUrl);
|
141
|
+
options.components.analytics.track('Scene deploy success', {
|
142
|
+
...trackProps,
|
143
|
+
sceneId: entityId,
|
144
|
+
targetContentServer: catalyst.getContentUrl(),
|
145
|
+
worldName: sceneJson.worldConfiguration?.name,
|
146
|
+
isPortableExperience: !!sceneJson.isPortableExperience,
|
147
|
+
dependencies
|
148
|
+
});
|
149
|
+
if (!isWorld) {
|
150
|
+
options.components.logger.info('You can close the terminal now');
|
151
|
+
}
|
152
|
+
}
|
153
|
+
catch (e) {
|
154
|
+
options.components.logger.error('Could not upload content:');
|
155
|
+
options.components.logger.error(e.message);
|
156
|
+
options.components.analytics.track('Scene deploy failure', { ...trackProps, error: e.message ?? '' });
|
157
|
+
throw e;
|
158
|
+
}
|
121
159
|
}
|
122
|
-
options.components.analytics.track('Scene deploy success', {
|
123
|
-
...trackProps,
|
124
|
-
sceneId: entityId,
|
125
|
-
targetContentServer: catalyst.getContentUrl(),
|
126
|
-
worldName: sceneJson.worldConfiguration?.name,
|
127
|
-
isPortableExperience: !!sceneJson.isPortableExperience,
|
128
|
-
dependencies
|
129
|
-
});
|
130
160
|
}
|
131
161
|
exports.main = main;
|
132
162
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/deploy/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/deploy/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA8B;AAC9B,0CAAoD;AACpD,wCAA2C;AAC3C,6DAAuD;AACvD,2EAA0E;AAG1E,qEAA8G;AAC9G,2CAA8C;AAC9C,6CAA4C;AAC5C,+DAA4E;AAC5E,6DAA8E;AAG9E,mCAA+E;AAC/E,oCAAqC;AACrC,6EAAqE;AAErE,0DAA8B;AAOjB,QAAA,IAAI,GAAG,IAAA,kBAAW,EAAC;IAC9B,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,UAAU;IAChB,kBAAkB,EAAE,MAAM;IAC1B,KAAK,EAAE,kBAAkB;IACzB,oBAAoB,EAAE,OAAO;IAC7B,uBAAuB,EAAE,OAAO;IAChC,cAAc,EAAE,OAAO;IACvB,SAAS,EAAE,OAAO;IAClB,gBAAgB,EAAE,OAAO;IACzB,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE,OAAO;IACvB,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,QAAQ;CACf,CAAC,CAAA;AAEF,SAAgB,IAAI,CAAC,OAAgB;IACnC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;CAiB/B,CAAC,CAAA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AAS,EAAE,SAAS,CAAC,kBAAkB,EAAE,IAAI;gBAC7C,oBAAoB,EAAE,CAAC,CAAC,SAAS,CAAC,oBAAoB;gBACtD,YAAY;aACb,CAAC,CAAA;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;aACjE;SACF;QAAC,OAAO,CAAM,EAAE;YACf,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC5D,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YAC1C,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAA;YACrG,MAAM,CAAC,CAAA;SACR;IACH,CAAC;AACH,CAAC;AAlID,oBAkIC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Lifecycle } from '@well-known-components/interfaces';
|
2
2
|
import { ChainId, Scene } from '@dcl/schemas';
|
3
|
+
import { IFuture } from 'fp-future';
|
3
4
|
import { IFile } from '../../../logic/scene-validations';
|
4
5
|
import { CliComponents } from '../../../components';
|
5
6
|
export interface LinkerResponse {
|
@@ -20,11 +21,11 @@ export interface SceneInfo {
|
|
20
21
|
isPortableExperience: boolean;
|
21
22
|
isWorld: boolean;
|
22
23
|
}
|
23
|
-
export declare function runLinkerApp(cliComponents: Pick<CliComponents, 'fs' | 'logger' | 'fetch' | 'config'>, scene: Scene, files: IFile[], port: number, rootCID: string, { isHttps, skipValidations, openBrowser }: {
|
24
|
+
export declare function runLinkerApp(cliComponents: Pick<CliComponents, 'fs' | 'logger' | 'fetch' | 'config'>, awaitResponse: IFuture<void>, scene: Scene, files: IFile[], port: number, rootCID: string, { isHttps, skipValidations, openBrowser }: {
|
24
25
|
isHttps: boolean;
|
25
26
|
skipValidations: boolean;
|
26
27
|
openBrowser: boolean;
|
27
|
-
}): Promise<{
|
28
|
+
}, deployCallback: (linkerResponse: LinkerResponse) => Promise<void>): Promise<{
|
28
29
|
program: Lifecycle.ComponentBasedProgram<{
|
29
30
|
config: import("@well-known-components/interfaces").IConfigComponent;
|
30
31
|
logs: import("@well-known-components/interfaces").ILoggerComponent;
|
@@ -33,5 +34,4 @@ export declare function runLinkerApp(cliComponents: Pick<CliComponents, 'fs' | '
|
|
33
34
|
fetch: import("../../../components/fetch").IFetchComponent;
|
34
35
|
logger: import("@well-known-components/interfaces").ILoggerComponent.ILogger;
|
35
36
|
}>;
|
36
|
-
linkerResponse: import("fp-future").IFuture<LinkerResponse>;
|
37
37
|
}>;
|
@@ -9,22 +9,18 @@ const interfaces_1 = require("@well-known-components/interfaces");
|
|
9
9
|
const env_config_provider_1 = require("@well-known-components/env-config-provider");
|
10
10
|
const logger_1 = require("@well-known-components/logger");
|
11
11
|
const path_1 = require("path");
|
12
|
-
const schemas_1 = require("@dcl/schemas");
|
13
12
|
const querystring_1 = __importDefault(require("querystring"));
|
14
13
|
const open_1 = __importDefault(require("open"));
|
15
|
-
const fp_future_1 = __importDefault(require("fp-future"));
|
16
14
|
const get_free_port_1 = require("../../../logic/get-free-port");
|
17
|
-
const beautiful_logs_1 = require("../../../logic/beautiful-logs");
|
18
15
|
const routes_1 = require("./routes");
|
19
16
|
const config_1 = require("../../../logic/config");
|
20
17
|
const utils_1 = require("../utils");
|
21
|
-
async function runLinkerApp(cliComponents, scene, files, port, rootCID, { isHttps, skipValidations, openBrowser }) {
|
18
|
+
async function runLinkerApp(cliComponents, awaitResponse, scene, files, port, rootCID, { isHttps, skipValidations, openBrowser }, deployCallback) {
|
22
19
|
const resolvedPort = await (0, get_free_port_1.getPort)(port);
|
23
20
|
const sceneInfo = await getSceneInfo(cliComponents, scene, rootCID, skipValidations);
|
24
21
|
const protocol = isHttps ? 'https' : 'http';
|
25
22
|
const queryParams = querystring_1.default.stringify(sceneInfo);
|
26
23
|
const url = `${protocol}://localhost:${resolvedPort}`;
|
27
|
-
const futureResponse = (0, fp_future_1.default)();
|
28
24
|
const program = await interfaces_1.Lifecycle.run({
|
29
25
|
async initComponents() {
|
30
26
|
const config = (0, env_config_provider_1.createRecordConfigComponent)({
|
@@ -37,23 +33,18 @@ async function runLinkerApp(cliComponents, scene, files, port, rootCID, { isHttp
|
|
37
33
|
const server = await (0, http_server_1.createServerComponent)({ ...cliComponents, config, logs }, { https, cors: {} });
|
38
34
|
return { ...cliComponents, config, logs, server };
|
39
35
|
},
|
40
|
-
async main(
|
41
|
-
const {
|
36
|
+
async main(program) {
|
37
|
+
const { components, startComponents } = program;
|
38
|
+
const { router } = (0, routes_1.setRoutes)(components, awaitResponse, files, sceneInfo, deployCallback);
|
42
39
|
components.server.setContext(components);
|
43
40
|
components.server.use(router.allowedMethods());
|
44
41
|
components.server.use(router.middleware());
|
45
42
|
await startComponents();
|
46
43
|
if (openBrowser)
|
47
44
|
await browse(components, url, queryParams);
|
48
|
-
const value = await futureSignature;
|
49
|
-
(0, beautiful_logs_1.printSuccess)(components.logger, `\nContent successfully signed.`, '');
|
50
|
-
components.logger.info(`Address: ${value.address}`);
|
51
|
-
components.logger.info(`Signature: ${value.signature}`);
|
52
|
-
components.logger.info(`Network: ${(0, schemas_1.getChainName)(value.chainId)}`);
|
53
|
-
futureResponse.resolve(value);
|
54
45
|
}
|
55
46
|
});
|
56
|
-
return { program
|
47
|
+
return { program };
|
57
48
|
}
|
58
49
|
exports.runLinkerApp = runLinkerApp;
|
59
50
|
async function browse({ logger }, url, params) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/commands/deploy/linker-dapp/api.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA0E;AAC1E,kEAA6D;AAC7D,oFAAwF;AACxF,0DAAyE;AACzE,+BAA8B;
|
1
|
+
{"version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G;IACH,CAAC,EAAE,IAAI,CAAC,CAAA;IAER,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,MAAM,EAAE,CAAC,CAAA;AACtD,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,EAAE,EAAE,EAAwC;IACxE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAA,cAAO,EAAC,SAAS,EAAE,8BAA8B,CAAC,EAAE,OAAO,CAAC,CAAA;IACjG,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAA,cAAO,EAAC,SAAS,EAAE,8BAA8B,CAAC,EAAE,OAAO,CAAC,CAAA;IAClG,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AAC/C,CAAC;AAED,KAAK,UAAU,YAAY,CACzB,UAAyC,EACzC,KAAY,EACZ,OAAe,EACf,eAAwB;IAExB,MAAM,EACJ,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EACxB,OAAO,EACP,oBAAoB,EACrB,GAAG,KAAK,CAAA;IAET,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,OAAO;QACP,OAAO;QACP,YAAY,EAAE,MAAM,IAAA,wBAAe,EAAC,UAAU,CAAC;QAC/C,cAAc,EAAE,MAAM,IAAA,0BAAiB,EAAC,UAAU,CAAC;QACnD,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK;QAC1B,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,WAAW,EAAE,OAAO,EAAE,WAAW;QACjC,eAAe;QACf,oBAAoB,EAAE,CAAC,CAAC,oBAAoB;QAC5C,OAAO,EAAE,IAAA,wBAAgB,EAAC,KAAK,CAAC;KACjC,CAAA;AACH,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Router } from '@well-known-components/http-server';
|
2
|
+
import { IFuture } from 'fp-future';
|
2
3
|
import { CliComponents } from '../../../components';
|
3
4
|
import { IFile } from '../../../logic/scene-validations';
|
4
5
|
import { LinkerResponse, SceneInfo } from './api';
|
5
|
-
export declare function setRoutes(components: Pick<CliComponents, 'fs' | 'logger' | 'fetch' | 'config'>, files: IFile[], sceneInfo: SceneInfo): {
|
6
|
+
export declare function setRoutes(components: Pick<CliComponents, 'fs' | 'logger' | 'fetch' | 'config'>, awaitResponse: IFuture<void>, files: IFile[], sceneInfo: SceneInfo, linkerCallback: (value: LinkerResponse) => Promise<void>): {
|
6
7
|
router: Router<{}>;
|
7
|
-
futureSignature: import("fp-future").IFuture<LinkerResponse>;
|
8
8
|
};
|
@@ -1,14 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.setRoutes = void 0;
|
7
4
|
const path_1 = require("path");
|
8
|
-
const url_1 = __importDefault(require("url"));
|
9
5
|
const http_server_1 = require("@well-known-components/http-server");
|
10
6
|
const schemas_1 = require("@dcl/schemas");
|
11
|
-
const fp_future_1 = __importDefault(require("fp-future"));
|
12
7
|
const catalyst_requests_1 = require("../../../logic/catalyst-requests");
|
13
8
|
const coordinates_1 = require("../../../logic/coordinates");
|
14
9
|
function getContentType(type) {
|
@@ -22,12 +17,13 @@ function getContentType(type) {
|
|
22
17
|
return 'text/plain';
|
23
18
|
}
|
24
19
|
}
|
25
|
-
function setRoutes(components, files, sceneInfo) {
|
26
|
-
|
20
|
+
function setRoutes(components, awaitResponse, files, sceneInfo, linkerCallback) {
|
21
|
+
// We need to wait so the linker-dapp can receive the response and show a nice message.
|
22
|
+
const resolveLinkerPromise = () => setTimeout(() => awaitResponse.resolve(), 100);
|
27
23
|
const { fs, logger } = components;
|
28
24
|
const router = new http_server_1.Router();
|
29
25
|
const linkerDapp = (0, path_1.dirname)(require.resolve('@dcl/linker-dapp/package.json'));
|
30
|
-
let
|
26
|
+
let linkerResponse;
|
31
27
|
router.get('/', async () => ({
|
32
28
|
headers: { 'Content-Type': 'text/html' },
|
33
29
|
body: fs.createReadStream((0, path_1.resolve)(linkerDapp, 'index.html'))
|
@@ -55,38 +51,43 @@ function setRoutes(components, files, sceneInfo) {
|
|
55
51
|
router.get('/api/catalyst-pointers', async () => {
|
56
52
|
const { x, y } = (0, coordinates_1.getObject)(sceneInfo.baseParcel);
|
57
53
|
const pointer = `${x},${y}`;
|
58
|
-
const chainId =
|
54
|
+
const chainId = linkerResponse?.chainId || 1;
|
59
55
|
const network = chainId === schemas_1.ChainId.ETHEREUM_MAINNET ? 'mainnet' : 'goerli';
|
60
56
|
const value = await (0, catalyst_requests_1.getPointers)(components, pointer, network);
|
57
|
+
const deployedToAll = new Set(value.map((c) => c.entityId)).size === 1;
|
58
|
+
// Deployed to every catalyst, close the linker dapp and
|
59
|
+
// exit the command automatically so the user dont have to.
|
60
|
+
if (deployedToAll)
|
61
|
+
resolveLinkerPromise();
|
61
62
|
return {
|
62
|
-
body: {
|
63
|
-
catalysts: value,
|
64
|
-
status: deployInfo.status ?? ''
|
65
|
-
}
|
63
|
+
body: { catalysts: value }
|
66
64
|
};
|
67
65
|
});
|
68
|
-
router.get('/api/close', async (ctx) => {
|
69
|
-
const { ok, reason } = url_1.default.parse(ctx.url.toString(), true).query;
|
70
|
-
if (ok === 'true') {
|
71
|
-
const value = JSON.parse(reason?.toString() || '{}');
|
72
|
-
deployInfo = { ...deployInfo, linkerResponse: value };
|
73
|
-
futureSignature.resolve(value);
|
74
|
-
return {};
|
75
|
-
}
|
76
|
-
futureSignature.reject(new Error(`Failed to link: ${reason}`));
|
77
|
-
return {};
|
78
|
-
});
|
79
66
|
router.post('/api/deploy', async (ctx) => {
|
80
67
|
const value = (await ctx.request.json());
|
81
68
|
if (!value.address || !value.signature || !value.chainId) {
|
82
|
-
|
69
|
+
const errorMessage = `Invalid payload: ${Object.keys(value).join(' - ')}`;
|
70
|
+
logger.error(errorMessage);
|
71
|
+
resolveLinkerPromise();
|
72
|
+
return { status: 400, body: { message: errorMessage } };
|
73
|
+
}
|
74
|
+
// Store the chainId so we can use it on the catalyst pointers.
|
75
|
+
linkerResponse = value;
|
76
|
+
try {
|
77
|
+
await linkerCallback(value);
|
78
|
+
// If its a world we dont wait for the catalyst pointers.
|
79
|
+
// Close the program.
|
80
|
+
if (sceneInfo.isWorld) {
|
81
|
+
resolveLinkerPromise();
|
82
|
+
}
|
83
83
|
return {};
|
84
84
|
}
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
catch (e) {
|
86
|
+
resolveLinkerPromise();
|
87
|
+
return { status: 400, body: { message: e.message } };
|
88
|
+
}
|
88
89
|
});
|
89
|
-
return { router
|
90
|
+
return { router };
|
90
91
|
}
|
91
92
|
exports.setRoutes = setRoutes;
|
92
93
|
//# sourceMappingURL=routes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/deploy/linker-dapp/routes.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/deploy/linker-dapp/routes.ts"],"names":[],"mappings":";;;AAAA,+BAAuC;AACvC,oEAA2D;AAC3D,0CAAsC;AAGtC,wEAA8D;AAC9D,4DAAsD;AAKtD,SAAS,cAAc,CAAC,IAAY;IAClC,QAAQ,IAAI,EAAE;QACZ,KAAK,KAAK;YACR,OAAO,UAAU,CAAA;QACnB,KAAK,IAAI;YACP,OAAO,gBAAgB,CAAA;QACzB,KAAK,OAAO,CAAC;QACb;YACE,OAAO,YAAY,CAAA;KACtB;AACH,CAAC;AAED,SAAgB,SAAS,CACvB,UAAqE,EACrE,aAA4B,EAC5B,KAAc,EACd,SAAoB,EACpB,cAAwD;IAExD,uFAAuF;IACvF,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,OA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AC,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAmB,CAAA;QAE1D,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YACxD,MAAM,YAAY,GAAG,oBAAoB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;YACzE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC1B,oBAAoB,EAAE,CAAA;YACtB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,CAAA;SACxD;QAED,+DAA+D;QAC/D,cAAc,GAAG,KAAK,CAAA;QAEtB,IAAI;YACF,MAAM,cAAc,CAAC,KAAK,CAAC,CAAA;YAC3B,yDAAyD;YACzD,qBAAqB;YACrB,IAAI,SAAS,CAAC,OAAO,EAAE;gBACrB,oBAAoB,EAAE,CAAA;aACvB;YACD,OAAO,EAAE,CAAA;SACV;QAAC,OAAO,CAAC,EAAE;YACV,oBAAoB,EAAE,CAAA;YACtB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAG,CAAW,CAAC,OAAO,EAAE,EAAE,CAAA;SAChE;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,MAAM,EAAE,CAAA;AACnB,CAAC;AAxFD,8BAwFC"}
|
@@ -4,6 +4,7 @@ import { CatalystClient, ContentClient } from 'dcl-catalyst-client';
|
|
4
4
|
import { CliComponents } from '../../components';
|
5
5
|
import { IFile } from '../../logic/scene-validations';
|
6
6
|
import { LinkerResponse } from './linker-dapp/api';
|
7
|
+
import { IFuture } from 'fp-future';
|
7
8
|
export declare function getCatalyst(target?: string, targetContent?: string): Promise<CatalystClient | ContentClient>;
|
8
9
|
interface LinkOptions {
|
9
10
|
openBrowser: boolean;
|
@@ -11,8 +12,7 @@ interface LinkOptions {
|
|
11
12
|
isHttps: boolean;
|
12
13
|
skipValidations: boolean;
|
13
14
|
}
|
14
|
-
export declare function getAddressAndSignature(components: CliComponents, messageToSign: string, scene: Scene, files: IFile[], linkOptions: LinkOptions): Promise<{
|
15
|
-
linkerResponse: Promise<LinkerResponse>;
|
15
|
+
export declare function getAddressAndSignature(components: CliComponents, awaitResponse: IFuture<void>, messageToSign: string, scene: Scene, files: IFile[], linkOptions: LinkOptions, deployCallback: (response: LinkerResponse) => Promise<void>): Promise<{
|
16
16
|
program?: Lifecycle.ComponentBasedProgram<unknown>;
|
17
17
|
}>;
|
18
18
|
export declare function sceneHasWorldCfg(scene: Scene): boolean;
|
@@ -16,15 +16,18 @@ async function getCatalyst(target, targetContent) {
|
|
16
16
|
return dcl_catalyst_client_1.CatalystClient.connectedToCatalystIn({ network: 'mainnet' });
|
17
17
|
}
|
18
18
|
exports.getCatalyst = getCatalyst;
|
19
|
-
async function getAddressAndSignature(components, messageToSign, scene, files, linkOptions) {
|
19
|
+
async function getAddressAndSignature(components, awaitResponse, messageToSign, scene, files, linkOptions, deployCallback) {
|
20
20
|
if (process.env.DCL_PRIVATE_KEY) {
|
21
21
|
const wallet = (0, account_1.createWallet)(process.env.DCL_PRIVATE_KEY);
|
22
22
|
const signature = (0, crypto_1.ethSign)((0, eth_connect_1.hexToBytes)(wallet.privateKey), messageToSign);
|
23
|
-
const linkerResponse =
|
24
|
-
|
23
|
+
const linkerResponse = { signature, address: wallet.address };
|
24
|
+
await deployCallback(linkerResponse);
|
25
|
+
awaitResponse.resolve();
|
26
|
+
return {};
|
25
27
|
}
|
26
28
|
const { linkerPort, ...opts } = linkOptions;
|
27
|
-
|
29
|
+
const { program } = await (0, api_1.runLinkerApp)(components, awaitResponse, scene, files, linkerPort, messageToSign, opts, deployCallback);
|
30
|
+
return { program };
|
28
31
|
}
|
29
32
|
exports.getAddressAndSignature = getAddressAndSignature;
|
30
33
|
function sceneHasWorldCfg(scene) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/deploy/utils.ts"],"names":[],"mappings":";;;AAEA,6DAAmE;AACnE,6CAAwC;AACxC,oDAAiD;AAIjD,2CAAgE;AAChE,iDAAkD;
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/deploy/utils.ts"],"names":[],"mappings":";;;AAEA,6DAAmE;AACnE,6CAAwC;AACxC,oDAAiD;AAIjD,2CAAgE;AAChE,iDAAkD;AAG3C,KAAK,UAAU,WAAW,CAAC,MAAe,EAAE,aAAsB;IACvE,IAAI,MAAM,EAAE;QACV,OAAO,IAAI,oCAAc,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;KAChG;IAED,IAAI,aAAa,EAAE;QACjB,OAAO,IAAI,mCAAa,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAA;KACxD;IAED,OAAO,oCAAc,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;AACrE,CAAC;AAVD,kCAUC;AASM,KAAK,UAAU,sBAAsB,CAC1C,UAAyB,EACzB,aAA4B,EAC5B,aAAqB,EACrB,KAAY,EACZ,KAAc,EACd,WAAwB,EACxB,cAA2D;IAE3D,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE;QAC/B,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QACxD,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,IAAA,wBAAU,EAAC,MAAM,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,CAAA;QACvE,MAAM,cAAc,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAA;QAC7D,MAAM,cAAc,CAAC,cAAc,CAAC,CAAA;QACpC,aAAa,CAAC,OAAO,EAAE,CAAA;QACvB,OAAO,EAAE,CAAA;KACV;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAA;IAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,kBAAY,EACpC,UAAU,EACV,aAAa,EACb,KAAK,EACL,KAAK,EACL,UAAW,EACX,aAAa,EACb,IAAI,EACJ,cAAc,CACf,CAAA;IACD,OAAO,EAAE,OAAO,EAAE,CAAA;AACpB,CAAC;AA9BD,wDA8BC;AAED,SAAgB,gBAAgB,CAAC,KAAY;IAC3C,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAA;AAC7D,CAAC;AAFD,4CAEC"}
|
package/package.json
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk-commands",
|
3
3
|
"description": "",
|
4
|
-
"version": "7.3.2-
|
4
|
+
"version": "7.3.2-5600732702.commit-64a25b9",
|
5
5
|
"author": "Decentraland",
|
6
6
|
"bin": {
|
7
7
|
"sdk-commands": "./dist/index.js"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
|
-
"@dcl/ecs": "7.3.2-
|
10
|
+
"@dcl/ecs": "7.3.2-5600732702.commit-64a25b9",
|
11
11
|
"@dcl/hashing": "1.1.3",
|
12
|
-
"@dcl/inspector": "7.3.2-
|
13
|
-
"@dcl/linker-dapp": "0.
|
12
|
+
"@dcl/inspector": "7.3.2-5600732702.commit-64a25b9",
|
13
|
+
"@dcl/linker-dapp": "^0.8.2-5593724862.commit-1a537ac",
|
14
14
|
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
|
15
15
|
"@dcl/protocol": "1.0.0-5555484353.commit-63c469d",
|
16
16
|
"@dcl/rpc": "^1.1.1",
|
@@ -65,5 +65,5 @@
|
|
65
65
|
"displayName": "SDK",
|
66
66
|
"tsconfig": "./tsconfig.json"
|
67
67
|
},
|
68
|
-
"commit": "
|
68
|
+
"commit": "64a25b929287539e93be3a40a4ebca7f028a73bd"
|
69
69
|
}
|