# @eco-incorp/sauce-sdk 中文文档

规范地址：https://npmcn.com/package/%40eco-incorp/sauce-sdk/

版本：0\.13\.1
npm 元数据更新时间：2026-10-30T14:07:55.492Z
中文译文更新时间：2026-11-13T05:49:33.310Z
软件包许可：未声明

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40eco-incorp/sauce-sdk
原文对照：https://npmcn.com/package/%40eco-incorp/sauce-sdk/?lang=original
项目主页：https://github.com/eco-incorp/sauce#readme
源码仓库：https://github.com/eco-incorp/sauce

弃用说明：Package no longer supported\. Contact Support at https://www\.npmjs\.com/support for more info\.

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：7.4 MB，4398 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=22
- 运行依赖：10 个
- 首次发布：2026-06-04T16:54:02.766Z
- 最新版本发布：2026-09-15T15:38:12.470Z
- 近 30 天下载量：3681（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：28（近 12 个月 28 个）

## 中文简介

Sauce协议工具:SDK,动作原始,以及局部的dev环境.

## 安装

```sh
npm install @eco-incorp/sauce-sdk
```

也可以使用：`pnpm add @eco-incorp/sauce-sdk`、`yarn add @eco-incorp/sauce-sdk`、`bun add @eco-incorp/sauce-sdk`

## README

# 酱油

**酱油** 构建、编译和验证Sauce程序:其程序执行方式为 生态布特上的字节代码. 一个用于EVM和SVM的TypeScript包. 发表于 `@eco-incorp/sauce`。 。 。 .

```sh
npm install @eco-incorp/sauce
```

> 运行时间 **引擎** (链上解释器 这些程序执行) 生活在单独的 `eco-incorp/v12` 复发. 这回电.. `eco-incorp/sauce` - 是开发者制作的Sauce软件包 _目标_ 这个.

**只有节点.** 编译器通过 `createRequire` (数量) `node` 构建为普通JS读取a 兄长 `.wasm` )和路径路径导入 `node:fs`编号 :`node:path`因此,快速启动 建造者和 `/compiler` 都需要节点运行时间。 注册和解码子路径导入否 节点构建和工作在任何地方: `/verify`, (中文(简体) ), `/chains`, (中文(简体) ), `/deployments`, (中文(简体) ), `/protocols/*`, (中文(简体) ), `/evm/engine` 财务报告和审定财务报表 `/svm/engine`编辑 编译器包确实运送了浏览器的构建,但是这个包并没有暴露出来.

SauceScript编译器作为依赖性随而来. 没有可选的同龄人.

## 快速启动

在目的地链上打开一条路由,SDK编译程序并组装意图:

```ts
import { routes } from "@eco-incorp/sauce";

// Both deadlines are ABSOLUTE unix timestamps, not durations: the chain compares
// `block.timestamp > route.deadline`. And rewardDeadline must be >= deadline — a solver may fulfil
// right up to the route deadline, so an earlier reward deadline is already refundable by then.
// pot, portal, sourcePortal, creator and prover are addresses for YOUR deployment; the package
// ships no defaults for those. Token addresses it does ship — see the registry note below.
const now = BigInt(Math.floor(Date.now() / 1000));

const built = routes
  .openRoute("base", "function main() { return 1n; }", {
    source: "ethereum", // the SOURCE chain — where the reward is posted
    pot, // the Pot on the destination chain, which runs the program
    portal, // the DESTINATION Portal — lands in route.portal
    sourcePortal, // the SOURCE Portal — where the intent is published
    creator,
    prover,
    deadline: now + 3600n,
    rewardDeadline: now + 7200n,
  })
  .reward([{ token: usdc, amount: 1_000_000n }]);

built.compiled.bytecode[0]; // the program
built.intent; // the assembled Intent
built.publishCalldata(); // calldata for sourcePortal — omit sourcePortal above and this throws
```

常见的代号地址已经存在 : `routes.TOKEN_REGISTRY` 携带探测器 `USDC` 财务报告和审定财务报表 `WETH` 以任何符号包裹的原生生物 它实际上报告(polygon's `WPOL`),以及 `USDT` 只有乐观和乐观. `USDT` 缺席 在别处,因为一行只登记在已部署合同本身的计数器下 `symbol()` 字符串等同它: 带宽多边形和弧度部署返回 `USDT0`编号 :`USD₮0` 财务报告和审定财务报表 炸掉那道门 基地从未被探测过 所以,缺一行的意思是"不是来源 核实在下面 滴答,不是"没有部署" `tokenDefines` 无论如何,如果想要任何密钥, 都会覆盖它. 询问 `routes.knownTokenSymbols(requireChain('polygon'))` 连锁店到底装了什么 看一个 与 `routes.registryTokenAddress(requireChain('base'), 'USDC')` (单位:千美元)`requireChain` 是根导出 -- 见 [书记官处](https://npmcn.com/package/%40eco-incorp/sauce-sdk/#readme-registries)返回 a **`bigint`**,或 `undefined` 当链子没有 带有符号 -- -- 不是 `0x` 字符串,如果需要,请自行格式化: `'0x' + address.toString(16).padStart(40, '0')` 给出基础 USDC 为 `0x833589fcd6edb6e08f4c7c32d4f71b54bda02913`。 。 。 . `openRoute` 并把它们折成 环境定义, 这样路由体可以写 `USDC.transfer(to, amount)` 完全没有配置.

`routes.openRoute(destination, …)` 是链条全球前进,所以 `Base(sauce, options).reward(…)` 同一个电话。 这些全局器安装在 `globalThis` 作为 导入软件包的副作用——它们是 **没有** 出口,所以 `import { Base }` 失败。 通过设置选择退出 `globalThis.__ECO_ROUTES_NO_GLOBALS__ = true` **在第一次导入之前** - 没错 在模块评价中读取,所以事后设定为为时已晚,默默无所事事. 之后 事实上, `uninstallRouteGlobals()` 就是那个能起作用的 或只是使用 `routes.openRoute` 忽略 他们.

`.reward()` 如上,取一个符号-挂载数组。 A 类 **赤裸的宽度** 是一种自然的回报 `.reward(1_000_000n)` (原始内容存档于2013-10-12). posts 1e6 wei of the source chain's gas sorder, not 1 USDC.

> **路由体是无附加说明的 SauceScript.** SDK运行源头重写在身体上之前 以及那些简单的联署材料 `function main(): Uint256 { … }` 被拒绝。 附加说明 直接拨打编译器(下方)时,SauceScript是好的,只是没有经过一条路由.

## 不写入 SauceScript 构建程序

这个 `token`, (中文(简体) ), `swap` 财务报告和审定财务报表 `deposit` 命名空间为您发送 SauceScript . `token` 返回源代码 及其基底; `swap` 财务报告和审定财务报表 `deposit` 返回一个空字符串, 以底盘为分离 常数 :

```ts
import { routes, token } from "@eco-incorp/sauce";

// toSauceScript returns the baseDirs the program's own imports need, alongside the source
const { source, baseDirs } = token.Token.transfer({
  token: usdc,
  to: recipient,
  amount: 1_000_000n,
}).toSauceScript("evm");

const built = routes
  .openRoute("base", source, { ...options, compile: { baseDirs: [...baseDirs] } })
  .reward(reward);
```

这个 `baseDirs` 物质: 已发射的程序 `import { IERC20 } from "./artifacts/IERC20.json"`, (中文(简体) ), 和一条路由提供符号底盘 只有在它自己的 `USDC.transfer(…)` 重写 火灾——不是已经排放的建造者的来源。 没有它们,编译失败 那个进口。 展开它们: `toSauceScript`阵列是 `readonly`,选择不是.

`.source(target)` 如果你有补给,就只给你来源 `baseDirs` 你自己来.

`swap` 财务报告和审定财务报表 `deposit` 没有 `toSauceScript`。它们直接返回源头,所以每个对齐它的 自己的常数 :

```ts
import { routes, swap, deposit } from "@eco-incorp/sauce";

routes
  .openRoute("base", swap.swapSource(spec), {
    ...options,
    compile: { baseDirs: [...swap.SWAP_BASE_DIRS] },
  })
  .reward(reward);

routes
  .openRoute("base", deposit.depositSource(spec), {
    ...options,
    compile: { baseDirs: [...deposit.DEPOSIT_BASE_DIRS] },
  })
  .reward(reward);
```

`routes.compileSauceRoute` 是下面的下层, 如果您想要编译的调用没有 意图——它返回 `{ calls, compiled, source }` 没有 `.reward()`。 。 。 .

**在SVM目标上,这条路由路径不起作用.** `toSauceScript('svm')` 发射 `main` 键入 账户参数——该参数列表 _实值_ (a) 账户清单,因此不能删除 路由运行一个基于橡树的存取器重写拒绝注释. `compile: { accessors: false }` 绕过剖面,但路径仍然需要 `execution.code` 命名一个已经设置的代码账户, 因此, 除非您已经设置了一个代码账户, 编译 直接的源头.

## 编译器

`/compiler` 重新导出已出版的 Rust/wasm SauceScript 编译器 :

```ts
import { compile } from "@eco-incorp/sauce/compiler";

const { bytecode } = compile({
  target: "evm", // or 'svm'
  entry: "main.js",
  resolve: (path) => bytesFor(path), // module BYTES (Uint8Array), or undefined
});
```

`main` 可能需要参数。 他们以32字节的大字尾的字作为运行时间到达的 程序,打开 **两者** 因此,一个程序为许多参数集服务——编译时间替代是 `defines` 换句话说.

这适用于 **直接 `compile`**路径槽 `compiled.bytecode[0]` 作为厨师 成分和附件无参数尾巴,所以参数化 `main` 在路由中读取过尾端 拥有自己的成分。 使用 `defines` 对于路线,参数 程序你组装自己.

A 类 `bytes` 参数不添加——它占用了固定的编译时间长度,所以尾部不是 统一32字节单词,一旦出现.

两个调用都返回了参数布局,所以调用者自己建立尾巴. 当心 `CompileResult` 你们有两种不同的形状:

|  | 形状 | 从 |
| --- | --- | --- |
| 编译器 | `{ bytecode: Uint8Array; manifest? }` | 一个直接 `compile` |
| sDK的车 | `{ bytecode: Uint8Array[]; warnings: string[] }` | `built.compiled`, (中文(简体) ), `compileSauceRoute` |

SDK的车 `bytecode` 是一个组件列表,所以 `compiled.bytecode[0]` 是第一部分,不是 第一字节。 打开 **特别志愿人员** a 一个 `Account`\- 类型参数根本不是一个有效载荷参数:它成为 显示于COMPILER的账户 `CompileResult.manifest` ——路由接合使其脱落 (单位:千美元)`rs-compile.ts`),这样 `built.compiled.manifest` 实值 `undefined` 没有错误。 一个 SVM 呼叫器 需要通过 `svm/` 直接说.

A 类 `main` 从尾部掉下来的 没有它自己的返回类型, 一个生的 `compile` 拒绝它 (单位:千美元)`` `main` does not return on every path ``) (中文(简体) ). 制作的程式每经过一次都会击中它 - 多数人这样做,但不是全部,是落后的 `Token.balanceOf` 输出 a `return`,并注明 一个 `: void` 会打破它。 要么自己记下来`function main(): void { … }`)或经历 `routes.compileSauceRoute`为你做了笔记 注意,一个需要 `(destination, sauce, execution, options)`: 需要执行连接, 和一个 SVM 目的地 需要一个已经安装的缓冲器, 因此它是路由路径, 而不是一个赤裸的编译帮助 .

## 书记官处

129个协议和39个有包裹的克恩链船——38个EVM+索拉纳:

```ts
import { listProtocols, getProtocol, requireChain } from "@eco-incorp/sauce";

listProtocols().length; // 129
getProtocol("uniswap-v3"); // metadata: category, per-chain deployments, audit status
// (ABIs live on the subpath: '@eco-incorp/sauce/protocols/uniswap-v3')
```

`requireChain` 财务报告和审定财务报表 `getChain` 读取不同的登记册: `CANONICAL_CHAINS` 拥有全部39个,而 `chains` 出口额为38个EVM中的33个 `unichain`, (中文(简体) ), `sonic`, (中文(简体) ), `ronin`, (中文(简体) ), `plasma` 财务报告和审定财务报表 `ink` 为: 胆小但没参加 所以 `getChain(130)` 实值 `undefined` 地点 `requireChain('unichain')` 决定.

```ts
requireChain("base").id; // 8453 — reads CANONICAL_CHAINS (all 39)
```

## 子路径

| 子路径 | 这是什么 |
| --- | --- |
| `.` | dSL路线, `token`编号 :`swap`编号 :`deposit` 链式+协议登记册的构建者 |
| `/compiler` | 酱油脚本编译器 |
| `/actions` | 路由-有意降低(`actionsToSauce`),AMM/桥梁动作原始人 |
| `/protocols/*` | 一个协议的ABIs和元数据,例如. `/protocols/uniswap-v3` |
| `/chains`, (中文(简体) ), `/deployments` | 警犬链清单;已部署的合同地址 |
| `/recipes` | 已运出的程序( 套接字、 CCTP 分拆传输) 及其来源 |
| `/svm`, (中文(简体) ), `/svm/engine`, (中文(简体) ), `/svm/verify` | SVM 客户端、 账户解析、 引擎控制、 结算验证 |
| `/recipes/settle.sauce.ts`, (中文(简体) ), `/svm/recipes/settle.sauce.ts` | 为复制字节的合作伙伴提供和解程序源 |
| `/evm/engine` | EVM 引擎辅助器 |
| `/verify` | 解码 **遗留 v1- 语法** 和解程序. `viem`\-只有浏览器安全 |
| `/skills` | 每个协议的AI技能文件 |

`/verify` 用于已连载的程序: 它读取已退休的 TypeScript 的 v1 预设 已发射编译器 。 这个SDK今天建立的程序不是v1-语法,所以会拒绝.

校验您所构建的程序意味着从同一来源重编并比较字节. `/svm/verify` 对 SVM 和解程序进行精确的处理; 软件包中没有 EVM 对应程序 今天,一个EVM呼叫器 应用了技术本身.

## 发展

```sh
pnpm install
pnpm build       # sdk + actions
pnpm typecheck
pnpm test
```

## 出版

标记驱动,通过 [`.github/workflows/publish.yml`](https://npmcn.com/package/%40eco-incorp/sauce-sdk/.github/workflows/publish.yml)数字 :

```sh
git tag v1.2.3 && git push origin v1.2.3
```

工作流程在运行者内部的标签上刻出版本(`npm version --no-git-tag-version`(中文(简体) ) 并出版给 **仅限 npmjs.com**编辑 `version` 内 `package.json` 因此,这并非造成 真理和会读出比最新版本更古老的——这是预期的.

## 常见问题

### @eco-incorp/sauce-sdk 是什么？

Sauce协议工具:SDK,动作原始,以及局部的dev环境\.注意：该包已被作者标记为弃用——Package no longer supported\. Contact Support at https://www\.npmjs\.com/support for more info\.

### 如何安装 @eco-incorp/sauce-sdk？

在项目目录运行 npm install @eco-incorp/sauce-sdk，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 sauce-dev-tools，可以用 npx sauce-dev-tools 直接运行。

### @eco-incorp/sauce-sdk 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @eco-incorp/sauce-sdk 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @eco-incorp/sauce-sdk 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @eco-incorp/sauce-sdk 可以商用吗？

@eco-incorp/sauce-sdk 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @eco-incorp/sauce-sdk 的下载量有多少？

根据 npm 官方下载统计，@eco-incorp/sauce-sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,681 次，日均约 123 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @eco-incorp/sauce-sdk 还在维护吗？

最新版本 0\.13\.1 发布于 2026/09/15（1 个月前）；至今共发布 28 个版本，其中过去 12 个月发布了 28 个；首次发布于 2026/06/05。作者已将其标记为弃用，新项目建议寻找替代方案。

