@opcat-labs/cli-opcat 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/apply_asm.cjs +130 -0
- package/assets/templates/.gitkeep +0 -0
- package/assets/templates/counter.tar.gz +0 -0
- package/assets/templates/demo-contract.tar.gz +0 -0
- package/assets/templates/demo-lib.tar.gz +0 -0
- package/assets/tsconfig.json +22 -0
- package/bin/main.js +4 -0
- package/dist/app.module.d.ts +3 -0
- package/dist/app.module.d.ts.map +1 -0
- package/dist/app.module.js +26 -0
- package/dist/app.module.js.map +1 -0
- package/dist/commands/compile.command.d.ts +13 -0
- package/dist/commands/compile.command.d.ts.map +1 -0
- package/dist/commands/compile.command.js +103 -0
- package/dist/commands/compile.command.js.map +1 -0
- package/dist/commands/compile.d.ts +10 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +251 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/deploy.command.d.ts +11 -0
- package/dist/commands/deploy.command.d.ts.map +1 -0
- package/dist/commands/deploy.command.js +79 -0
- package/dist/commands/deploy.command.js.map +1 -0
- package/dist/commands/project.command.d.ts +11 -0
- package/dist/commands/project.command.d.ts.map +1 -0
- package/dist/commands/project.command.js +94 -0
- package/dist/commands/project.command.js.map +1 -0
- package/dist/commands/project.d.ts +24 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +217 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/system.command.d.ts +6 -0
- package/dist/commands/system.command.d.ts.map +1 -0
- package/dist/commands/system.command.js +41 -0
- package/dist/commands/system.command.js.map +1 -0
- package/dist/commands/version.command.d.ts +6 -0
- package/dist/commands/version.command.d.ts.map +1 -0
- package/dist/commands/version.command.js +32 -0
- package/dist/commands/version.command.js.map +1 -0
- package/dist/common/utils.d.ts +68 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/common/utils.js +263 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +18 -0
- package/dist/main.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function replaceFuncBodyAsm(scryptFile, funcName, asm) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
// Buffer to store the characters
|
|
7
|
+
let buffer = '';
|
|
8
|
+
|
|
9
|
+
let pattern = 'function ' + funcName;
|
|
10
|
+
let patternHits = 0;
|
|
11
|
+
let matchActive = false;
|
|
12
|
+
let curlyBraceLevel = 0;
|
|
13
|
+
|
|
14
|
+
// Open the file in read-only mode
|
|
15
|
+
const fileStream = fs.createReadStream(scryptFile, {
|
|
16
|
+
encoding: 'utf8',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Listen for the data event
|
|
20
|
+
fileStream.on('data', (chunk) => {
|
|
21
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
22
|
+
let c = chunk[i];
|
|
23
|
+
|
|
24
|
+
if (matchActive) {
|
|
25
|
+
if (curlyBraceLevel == 0) {
|
|
26
|
+
// Function args
|
|
27
|
+
buffer += c;
|
|
28
|
+
}
|
|
29
|
+
if (c == '{') {
|
|
30
|
+
curlyBraceLevel += 1;
|
|
31
|
+
if (curlyBraceLevel == 1) {
|
|
32
|
+
// First opening curly brace
|
|
33
|
+
// Add ASM here
|
|
34
|
+
buffer += ' asm { ';
|
|
35
|
+
buffer += asm;
|
|
36
|
+
buffer += '}';
|
|
37
|
+
}
|
|
38
|
+
} else if (c == '}') {
|
|
39
|
+
if (curlyBraceLevel == 1) {
|
|
40
|
+
// Closing function curly brace
|
|
41
|
+
buffer += c;
|
|
42
|
+
matchActive = false;
|
|
43
|
+
} else {
|
|
44
|
+
curlyBraceLevel -= 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} else if (c == pattern[patternHits]) {
|
|
48
|
+
patternHits += 1;
|
|
49
|
+
buffer += c;
|
|
50
|
+
|
|
51
|
+
// Check if full pattern match
|
|
52
|
+
if (patternHits == pattern.length) {
|
|
53
|
+
matchActive = true;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
patternHits = 0;
|
|
57
|
+
buffer += c;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Listen for the end event
|
|
63
|
+
fileStream.on('end', () => {
|
|
64
|
+
fs.writeFileSync(scryptFile, buffer);
|
|
65
|
+
resolve();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
fileStream.on('error', (error) => {
|
|
69
|
+
reject(error);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getOutDir() {
|
|
75
|
+
let outDir = './artifacts';
|
|
76
|
+
return outDir;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function findFilesWithExtension(directory, extension) {
|
|
80
|
+
const files = fs.readdirSync(directory);
|
|
81
|
+
let foundFiles = [];
|
|
82
|
+
|
|
83
|
+
files.forEach((file) => {
|
|
84
|
+
const filePath = path.join(directory, file);
|
|
85
|
+
const stats = fs.statSync(filePath);
|
|
86
|
+
|
|
87
|
+
if (stats.isDirectory()) {
|
|
88
|
+
const subdirectoryFiles = findFilesWithExtension(filePath, extension);
|
|
89
|
+
foundFiles = foundFiles.concat(subdirectoryFiles);
|
|
90
|
+
} else if (stats.isFile() && file.endsWith(extension)) {
|
|
91
|
+
foundFiles.push(filePath);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return foundFiles;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function fileContainsLineStartingWith(filePath, regexPattern) {
|
|
99
|
+
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
100
|
+
const lines = fileContent.split('\n');
|
|
101
|
+
|
|
102
|
+
const regex = new RegExp(`^(${regexPattern})`);
|
|
103
|
+
return lines.some((line) => regex.test(line.trim()));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function main() {
|
|
107
|
+
const asmFile = JSON.parse(fs.readFileSync('.asm/asm.json', 'utf-8'));
|
|
108
|
+
|
|
109
|
+
const outDir = getOutDir();
|
|
110
|
+
const scryptFiles = findFilesWithExtension(outDir, '.scrypt');
|
|
111
|
+
|
|
112
|
+
for (const contractName of Object.keys(asmFile)) {
|
|
113
|
+
let found = false;
|
|
114
|
+
for (const scryptFile of scryptFiles) {
|
|
115
|
+
if (fileContainsLineStartingWith(scryptFile, `(contract|library) ${contractName}`)) {
|
|
116
|
+
found = true;
|
|
117
|
+
for (const func of Object.keys(asmFile[contractName])) {
|
|
118
|
+
const asm = asmFile[contractName][func];
|
|
119
|
+
await replaceFuncBodyAsm(scryptFile, func, asm);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!found) {
|
|
125
|
+
throw new Error(`Contract ".scrypt" file not found for "${contractName}".`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main();
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "ES2020"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"module": "commonjs",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"plugins": []
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/contracts/**/*.ts"],
|
|
21
|
+
"exclude": []
|
|
22
|
+
}
|
package/bin/main.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.module.d.ts","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":"AAOA,qBAKa,SAAS;CAAG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AppModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const version_command_1 = require("./commands/version.command");
|
|
12
|
+
const system_command_1 = require("./commands/system.command");
|
|
13
|
+
const project_command_1 = require("./commands/project.command");
|
|
14
|
+
const compile_command_1 = require("./commands/compile.command");
|
|
15
|
+
const deploy_command_1 = require("./commands/deploy.command");
|
|
16
|
+
let AppModule = class AppModule {
|
|
17
|
+
};
|
|
18
|
+
exports.AppModule = AppModule;
|
|
19
|
+
exports.AppModule = AppModule = __decorate([
|
|
20
|
+
(0, common_1.Module)({
|
|
21
|
+
imports: [],
|
|
22
|
+
controllers: [],
|
|
23
|
+
providers: [version_command_1.VersionCommand, system_command_1.SystemCommand, project_command_1.ProjectCommand, compile_command_1.CompileCommand, deploy_command_1.DeployCommand],
|
|
24
|
+
})
|
|
25
|
+
], AppModule);
|
|
26
|
+
//# sourceMappingURL=app.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,gEAA4D;AAC5D,8DAA0D;AAC1D,gEAA4D;AAC5D,gEAA4D;AAC5D,8DAA0D;AAOnD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IALrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,gCAAc,EAAE,8BAAa,EAAE,gCAAc,EAAE,gCAAc,EAAE,8BAAa,CAAC;KAC1F,CAAC;GACW,SAAS,CAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
import { CompileCommandOptions } from './compile';
|
|
3
|
+
export declare class CompileCommand extends CommandRunner {
|
|
4
|
+
constructor();
|
|
5
|
+
run(_passedParams: string[], options?: CompileCommandOptions): Promise<void>;
|
|
6
|
+
parseInclude(val: string): string;
|
|
7
|
+
parseExclude(val: string): string;
|
|
8
|
+
parseTsconfig(val: string): string;
|
|
9
|
+
parseWatch(): boolean;
|
|
10
|
+
parseNoArtifact(): boolean;
|
|
11
|
+
parseAsm(): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=compile.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.command.d.ts","sourceRoot":"","sources":["../../src/commands/compile.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAW,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE3D,qBAIa,cAAe,SAAQ,aAAa;;IAKzC,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IASlF,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IASjC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQjC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQlC,UAAU,IAAI,OAAO;IAQrB,eAAe,IAAI,OAAO;IAQ1B,QAAQ,IAAI,OAAO;CAGpB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CompileCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const compile_1 = require("./compile");
|
|
15
|
+
let CompileCommand = class CompileCommand extends nest_commander_1.CommandRunner {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
}
|
|
19
|
+
async run(_passedParams, options) {
|
|
20
|
+
return (0, compile_1.compile)(options);
|
|
21
|
+
}
|
|
22
|
+
parseInclude(val) {
|
|
23
|
+
return val;
|
|
24
|
+
}
|
|
25
|
+
parseExclude(val) {
|
|
26
|
+
return val;
|
|
27
|
+
}
|
|
28
|
+
parseTsconfig(val) {
|
|
29
|
+
return val;
|
|
30
|
+
}
|
|
31
|
+
parseWatch() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
parseNoArtifact() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
parseAsm() {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.CompileCommand = CompileCommand;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, nest_commander_1.Option)({
|
|
44
|
+
flags: '-i, --include [include]',
|
|
45
|
+
description: 'Specifies an array of filenames or patterns to include when compling. Defaults "src/contracts/**/*.ts".',
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Function),
|
|
48
|
+
__metadata("design:paramtypes", [String]),
|
|
49
|
+
__metadata("design:returntype", String)
|
|
50
|
+
], CompileCommand.prototype, "parseInclude", null);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, nest_commander_1.Option)({
|
|
53
|
+
flags: '-e, --exclude [exclude]',
|
|
54
|
+
description: 'Specifies an array of filenames or patterns that should be skipped when resolving include. Defaults none.',
|
|
55
|
+
}),
|
|
56
|
+
__metadata("design:type", Function),
|
|
57
|
+
__metadata("design:paramtypes", [String]),
|
|
58
|
+
__metadata("design:returntype", String)
|
|
59
|
+
], CompileCommand.prototype, "parseExclude", null);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, nest_commander_1.Option)({
|
|
62
|
+
flags: '-t, --tsconfig [tsconfig]',
|
|
63
|
+
description: 'Specify a tsconfig to override the default tsconfig.',
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Function),
|
|
66
|
+
__metadata("design:paramtypes", [String]),
|
|
67
|
+
__metadata("design:returntype", String)
|
|
68
|
+
], CompileCommand.prototype, "parseTsconfig", null);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, nest_commander_1.Option)({
|
|
71
|
+
flags: '-w, --watch [watch]',
|
|
72
|
+
description: 'Watch input files.',
|
|
73
|
+
}),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", []),
|
|
76
|
+
__metadata("design:returntype", Boolean)
|
|
77
|
+
], CompileCommand.prototype, "parseWatch", null);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, nest_commander_1.Option)({
|
|
80
|
+
flags: '--noArtifact [noArtifact]',
|
|
81
|
+
description: 'Disable emitting artifact file from a compilation.',
|
|
82
|
+
}),
|
|
83
|
+
__metadata("design:type", Function),
|
|
84
|
+
__metadata("design:paramtypes", []),
|
|
85
|
+
__metadata("design:returntype", Boolean)
|
|
86
|
+
], CompileCommand.prototype, "parseNoArtifact", null);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, nest_commander_1.Option)({
|
|
89
|
+
flags: '-a, --asm [asm]',
|
|
90
|
+
description: 'Apply asm optimization before compiling scrypt file.',
|
|
91
|
+
}),
|
|
92
|
+
__metadata("design:type", Function),
|
|
93
|
+
__metadata("design:paramtypes", []),
|
|
94
|
+
__metadata("design:returntype", Boolean)
|
|
95
|
+
], CompileCommand.prototype, "parseAsm", null);
|
|
96
|
+
exports.CompileCommand = CompileCommand = __decorate([
|
|
97
|
+
(0, nest_commander_1.Command)({
|
|
98
|
+
name: 'compile',
|
|
99
|
+
description: 'Compile smart contracts in current project',
|
|
100
|
+
}),
|
|
101
|
+
__metadata("design:paramtypes", [])
|
|
102
|
+
], CompileCommand);
|
|
103
|
+
//# sourceMappingURL=compile.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.command.js","sourceRoot":"","sources":["../../src/commands/compile.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgE;AAChE,uCAA2D;AAMpD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,8BAAa;IAC/C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,KAAK,C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1
|
+
export interface CompileCommandOptions {
|
|
2
|
+
include?: string;
|
|
3
|
+
exclude?: string;
|
|
4
|
+
tsconfig?: string;
|
|
5
|
+
watch?: boolean;
|
|
6
|
+
noArtifact?: boolean;
|
|
7
|
+
asm?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function compile({ include, exclude, tsconfig, watch, noArtifact, asm, }: CompileCommandOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAgBD,wBAAsB,OAAO,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,UAAU,EACV,GAAG,GACJ,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuPvC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.compile = void 0;
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const process_1 = require("process");
|
|
33
|
+
const chalk_1 = require("chalk");
|
|
34
|
+
const utils_1 = require("../common/utils");
|
|
35
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
36
|
+
const scrypt_ts_transpiler_opcat_1 = require("@opcat-labs/scrypt-ts-transpiler-opcat");
|
|
37
|
+
const scrypt_ts_opcat_1 = require("@opcat-labs/scrypt-ts-opcat");
|
|
38
|
+
function containsDeprecatedOptions(options) {
|
|
39
|
+
return ('out' in options ||
|
|
40
|
+
'noImplicitUseStrict' in options ||
|
|
41
|
+
'keyofStringsOnly' in options ||
|
|
42
|
+
'suppressExcessPropertyErrors' in options ||
|
|
43
|
+
'suppressImplicitAnyIndexErrors' in options ||
|
|
44
|
+
'noStrictGenericChecks' in options ||
|
|
45
|
+
'charset' in options ||
|
|
46
|
+
'importsNotUsedAsValues' in options ||
|
|
47
|
+
'preserveValueImports' in options);
|
|
48
|
+
}
|
|
49
|
+
async function compile({ include, exclude, tsconfig, watch, noArtifact, asm, }) {
|
|
50
|
+
const scryptcPath = (0, scrypt_ts_transpiler_opcat_1.findCompiler)();
|
|
51
|
+
if (!scryptcPath || (0, scrypt_ts_transpiler_opcat_1.safeCompilerVersion)(scryptcPath) === '0.0.0') {
|
|
52
|
+
// no scryptc found, auto download scryptc
|
|
53
|
+
await (0, scrypt_ts_transpiler_opcat_1.getBinary)();
|
|
54
|
+
}
|
|
55
|
+
const tsconfigScryptTSPath = path_1.default.resolve(tsconfig ? tsconfig : 'tsconfig-scryptTS.json');
|
|
56
|
+
const tsconfigPath = path_1.default.resolve('tsconfig.json');
|
|
57
|
+
if (!fs.existsSync(tsconfigScryptTSPath)) {
|
|
58
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
59
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, (0, utils_1.readAsset)('tsconfig.json'));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
const parsedCommandLine = typescript_1.default.getParsedCommandLineOfConfigFile(tsconfigPath, {}, typescript_1.default.sys);
|
|
64
|
+
if (!parsedCommandLine) {
|
|
65
|
+
console.log((0, chalk_1.red)(`ERROR: invalid tsconfig.json`));
|
|
66
|
+
(0, process_1.exit)(-1);
|
|
67
|
+
}
|
|
68
|
+
if (parsedCommandLine.errors[0]) {
|
|
69
|
+
console.log((0, chalk_1.red)(`ERROR: invalid tsconfig.json`));
|
|
70
|
+
(0, process_1.exit)(-1);
|
|
71
|
+
}
|
|
72
|
+
const override = containsDeprecatedOptions(parsedCommandLine.options)
|
|
73
|
+
? {
|
|
74
|
+
noEmit: true,
|
|
75
|
+
experimentalDecorators: true,
|
|
76
|
+
target: 'ESNext',
|
|
77
|
+
esModuleInterop: true,
|
|
78
|
+
ignoreDeprecations: '5.0',
|
|
79
|
+
}
|
|
80
|
+
: {
|
|
81
|
+
noEmit: true,
|
|
82
|
+
experimentalDecorators: true,
|
|
83
|
+
target: 'ESNext',
|
|
84
|
+
esModuleInterop: true,
|
|
85
|
+
};
|
|
86
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, {
|
|
87
|
+
extends: './tsconfig.json',
|
|
88
|
+
include: ['src/contracts/**/*.ts'],
|
|
89
|
+
compilerOptions: override,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Check TS config
|
|
94
|
+
const outDir = 'artifacts';
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
|
+
const config = (0, utils_1.readfile)(tsconfigScryptTSPath, true);
|
|
97
|
+
if (include) {
|
|
98
|
+
config.include = include.split(',');
|
|
99
|
+
}
|
|
100
|
+
if (exclude) {
|
|
101
|
+
config.exclude = exclude.split(',');
|
|
102
|
+
}
|
|
103
|
+
let clonedConfig = (0, scrypt_ts_opcat_1.cloneDeep)(config);
|
|
104
|
+
Object.assign(config.compilerOptions, {
|
|
105
|
+
plugins: [],
|
|
106
|
+
});
|
|
107
|
+
config.compilerOptions.plugins.push({
|
|
108
|
+
transform: require.resolve('@opcat-labs/scrypt-ts-transpiler-opcat'),
|
|
109
|
+
transformProgram: true,
|
|
110
|
+
outDir,
|
|
111
|
+
});
|
|
112
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, JSON.stringify(config, null, 2));
|
|
113
|
+
process.on('exit', () => {
|
|
114
|
+
if (clonedConfig !== null) {
|
|
115
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, JSON.stringify(clonedConfig, null, 2));
|
|
116
|
+
clonedConfig = null;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
process.on('SIGINT', function () {
|
|
120
|
+
if (clonedConfig !== null) {
|
|
121
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, JSON.stringify(clonedConfig, null, 2));
|
|
122
|
+
clonedConfig = null;
|
|
123
|
+
}
|
|
124
|
+
process.exit();
|
|
125
|
+
});
|
|
126
|
+
let ts_patch_path = require.resolve('typescript').split(path_1.default.sep);
|
|
127
|
+
ts_patch_path = ts_patch_path.slice(0, ts_patch_path.length - 2);
|
|
128
|
+
ts_patch_path.push('bin');
|
|
129
|
+
ts_patch_path.push('tsc');
|
|
130
|
+
const tsc = ts_patch_path.join(path_1.default.sep);
|
|
131
|
+
// Run tsc which in turn also transpiles to sCrypt
|
|
132
|
+
if (watch) {
|
|
133
|
+
await (0, utils_1.shExec)(`node "${tsc}" --watch --p "${tsconfigScryptTSPath}"`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const result = await (0, utils_1.stepCmd)('Building TS', `node "${tsc}" --p "${tsconfigScryptTSPath}"`, false);
|
|
137
|
+
if (result instanceof Error) {
|
|
138
|
+
console.log((0, chalk_1.red)(`ERROR: Building TS failed!`));
|
|
139
|
+
console.log(`Please modify your code or \`tsconfig-scryptTS.json\` according to the error message output during BUILDING.`);
|
|
140
|
+
try {
|
|
141
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, JSON.stringify(clonedConfig, null, 2));
|
|
142
|
+
clonedConfig = null;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.log((0, chalk_1.red)(`ERROR: save \`tsconfig-scryptTS.json\` failed!`), error);
|
|
146
|
+
(0, process_1.exit)(-1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
(0, utils_1.writefile)(tsconfigScryptTSPath, JSON.stringify(clonedConfig, null, 2));
|
|
152
|
+
clonedConfig = null;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.log((0, chalk_1.red)(`ERROR: save \`tsconfig-scryptTS.json\` failed!`), error);
|
|
156
|
+
(0, process_1.exit)(-1);
|
|
157
|
+
}
|
|
158
|
+
if (!fs.existsSync(outDir)) {
|
|
159
|
+
console.log((0, chalk_1.red)(`ERROR: outDir '${outDir}' not exists`));
|
|
160
|
+
(0, process_1.exit)(-1);
|
|
161
|
+
}
|
|
162
|
+
if (asm) {
|
|
163
|
+
if (!fs.existsSync('.asm/apply_asm.cjs')) {
|
|
164
|
+
console.log((0, chalk_1.red)(`ERROR: no ".asm/apply_asm.cjs" found`));
|
|
165
|
+
process.exit(-1);
|
|
166
|
+
}
|
|
167
|
+
await (0, utils_1.stepCmd)('Applying ASM optimizations', `node .asm/apply_asm.cjs`);
|
|
168
|
+
}
|
|
169
|
+
let successCount = 0;
|
|
170
|
+
let failedCount = 0;
|
|
171
|
+
if (!noArtifact) {
|
|
172
|
+
// Compile only what was transpiled using TSC
|
|
173
|
+
const include = (0, utils_1.extractBaseNames)((0, utils_1.resolvePaths)(Array.isArray(config.include) ? config.include : []));
|
|
174
|
+
const exclude = (0, utils_1.extractBaseNames)((0, utils_1.resolvePaths)(Array.isArray(config.exclude) ? config.exclude : []));
|
|
175
|
+
const toCompile = include.filter((el) => !exclude.includes(el));
|
|
176
|
+
const files = [];
|
|
177
|
+
const distFiles = await (0, utils_1.readdirRecursive)(outDir);
|
|
178
|
+
for (const f of distFiles) {
|
|
179
|
+
const relativePath = path_1.default.relative(outDir, f);
|
|
180
|
+
if (!relativePath.startsWith('.templates' + path_1.default.sep)) {
|
|
181
|
+
// Ignore transformer files not in templates directory
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const fAbs = path_1.default.resolve(f);
|
|
185
|
+
if (fAbs.endsWith('.transformer.json')) {
|
|
186
|
+
try {
|
|
187
|
+
const name = path_1.default.basename(fAbs, '.transformer.json');
|
|
188
|
+
if (!toCompile.includes(name)) {
|
|
189
|
+
// Ignore files not included
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
193
|
+
const transformerResult = (0, utils_1.readfile)(fAbs, true);
|
|
194
|
+
const { scryptfile, success } = transformerResult;
|
|
195
|
+
// find the corresponding scrypt file in the outDir for the transformer file in the templates directory
|
|
196
|
+
const scrTemplateFilePath = path_1.default.resolve(outDir, path_1.default.relative(path_1.default.join(outDir, '.templates'), path_1.default.join(path_1.default.dirname(fAbs), path_1.default.basename(scryptfile, '.tpl'))));
|
|
197
|
+
if (success) {
|
|
198
|
+
if (fs.existsSync(scrTemplateFilePath)) {
|
|
199
|
+
files.push(scrTemplateFilePath);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
failedCount++;
|
|
203
|
+
const resStr = `\nTranslation succeeded but scrypt file not found! ${fAbs}\n`;
|
|
204
|
+
console.log((0, chalk_1.red)(resStr));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (success === false) {
|
|
208
|
+
failedCount++;
|
|
209
|
+
const resStr = `\nTranslation failed! See errors in: ${fAbs}\n`;
|
|
210
|
+
console.log((0, chalk_1.red)(resStr));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
failedCount++;
|
|
215
|
+
console.log((0, chalk_1.red)(`ERROR: ${error.message}, transformer file: ${fAbs}`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
for (const f of files) {
|
|
220
|
+
try {
|
|
221
|
+
const outDir = path_1.default.dirname(f);
|
|
222
|
+
const result = (0, scrypt_ts_transpiler_opcat_1.compileContract)(f, {
|
|
223
|
+
out: outDir,
|
|
224
|
+
artifact: true,
|
|
225
|
+
optimize: true,
|
|
226
|
+
});
|
|
227
|
+
if (result.errors.length > 0) {
|
|
228
|
+
failedCount++;
|
|
229
|
+
console.log((0, chalk_1.red)(`Failed to compile ${f}, ERROR: ${result.errors[0].message}`));
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
successCount++;
|
|
233
|
+
const artifactPath = path_1.default.join(outDir, `${path_1.default.basename(f, '.scrypt')}.json`);
|
|
234
|
+
console.log((0, chalk_1.green)(`Compiled successfully, artifact file: ${artifactPath}`));
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
const resStr = `\nCompilation failed.\n`;
|
|
238
|
+
console.log((0, chalk_1.red)(resStr));
|
|
239
|
+
console.log((0, chalk_1.red)(`ERROR: ${e.message}`));
|
|
240
|
+
(0, process_1.exit)(-1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const resStr = `\nProject compilation completed!`;
|
|
245
|
+
console.log((0, chalk_1.green)(resStr));
|
|
246
|
+
console.log((0, chalk_1.green)(`\n${successCount} passing`));
|
|
247
|
+
console.log((0, chalk_1.red)(`\n${failedCount} failing`));
|
|
248
|
+
(0, process_1.exit)(0);
|
|
249
|
+
}
|
|
250
|
+
exports.compile = compile;
|
|
251
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AACxB,qCAA+B;AAC/B,iCAAmC;AACnC,2CASyB;AACzB,4DAA4B;AAC5B,uFAKgD;AAEhD,iEAAwD;AAWxD,SAAS,yBAAyB,CAAC,OAA2B;IAC5D,OAAO,CACL,KAAK,IAAI,OAAO;QAChB,qBAAqB,IAAI,OAAO;QAChC,kBAAkB,IAAI,OAAO;QAC7B,8BAA8B,IAAI,OAAO;QACzC,gCAAgC,IAAI,OAAO;QAC3C,uBAAuB,IAAI,OAAO;QAClC,SAAS,IAAI,OAAO;QACpB,wBAAwB,IAAI,OAAO;QACnC,sBAAsB,IAAI,OAAO,CAClC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,OAAO,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,UAAU,EACV,GAAG,GACmB;IACtB,MAAM,WAAW,GAAG,IAAA,yCAAY,GAAE,CAAC;IACnC,IAAI,CAAC,WAAW,IAAI,IAAA,gDAAmB,EAAC,WAAW,CAAC,KAAK,OAAO,EAAE,CAA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CAAC,CAAC;YACX,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,kCAAkC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,IAAA,aAAK,EAAC,MAAM,CAAC,CAAC,CAAC;IAE3B,OAAO,CAAC,GAAG,CAAC,IAAA,aAAK,EAAC,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC;IAEhD,OAAO,CAAC,GAAG,CAAC,IAAA,WAAG,EAAC,KAAK,WAAW,UAAU,CAAC,CAAC,CAAC;IAE7C,IAAA,cAAI,EAAC,CAAC,CAAC,CAAC;AACV,CAAC;AA9PD,0BA8PC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
export interface DeployCommandOptions {
|
|
3
|
+
file?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class DeployCommand extends CommandRunner {
|
|
6
|
+
constructor();
|
|
7
|
+
run(_passedParams: string[], options?: DeployCommandOptions): Promise<void>;
|
|
8
|
+
parseFile(val: string): string;
|
|
9
|
+
deploy(options: DeployCommandOptions): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=deploy.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.command.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAMhE,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAIa,aAAc,SAAQ,aAAa;;IAKxC,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IASjF,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIxB,MAAM,CAAC,OAAO,EAAE,oBAAoB;CAsC3C"}
|