跳转到内容

Programmatic API

您可以在节点和浏览器环境中从代码中调用 Tact 编译器。

在浏览器中运行编译器

import { run } from "@tact-lang/compiler";
// Virtual FS
const fs = {
["main.tact"]: Buffer.from("...").toString("base64"),
};
const config = {
projects: [
{
name: "Sample",
path: "main.tact",
output: "./output",
},
],
};
// Run compiler
let successful = await run({ config, fs });
// NOTE: Output from is written to the same fs object.

合约验证

您可以使用 verify 函数验证编译后的软件包。

import { verify } from "@tact-lang/compiler";
const pkg: string = '...';
const res = await verify(pkg);