# @cloakely/sdk 中文文档

规范地址：https://npmcn.com/package/%40cloakely/sdk/

版本：0\.9\.2
npm 元数据更新时间：2026-11-08T04:46:26.737Z
中文译文更新时间：2026-11-10T02:06:19.733Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40cloakely/sdk
原文对照：https://npmcn.com/package/%40cloakely/sdk/?lang=original
项目主页：https://cloak.boblabs.tech/sdk
源码仓库：https://github.com/NECOKIZZ/Cloak

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

- 包体积（解压后）：2.8 MB，49 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=18
- 运行依赖：6 个
- peer 依赖：viem \>=2\.21\.0 \<3
- 首次发布：2026-10-27T15:16:51.778Z
- 最新版本发布：2026-11-08T04:46:26.405Z
- 近 30 天下载量：4211（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：23（近 12 个月 23 个）

## 中文简介

Elysium上的克克克:被封装-投标代币发射,被封装的NFT滴和WL即时销售,以及私人交易(屏蔽余额,私人互换,分批拍卖,私人寄出),并带有被封装的零知识证明.

## 安装

```sh
npm install @cloakely/sdk
```

也可以使用：`pnpm add @cloakely/sdk`、`yarn add @cloakely/sdk`、`bun add @cloakely/sdk`

## README

# @ cloakely/ sdk (英语)

类型脚本 SDK [衣着](https://cloak.boblabs.tech/)公平发射 以及基内迪克的私人交易 **极乐**。 。 。 .

**发射**

-   密封-有价信使的发射,Bots不能前跑.
-   每个人都要付一个清场价.
-   发射池以那个价格播种.

**私营贸易**

-   盾牌余额:买入,卖出,发出并批量交易发射信使,不出现钱包.
-   零知识证明是在用户设备上作出的.
-   中继器提交交易,但无法更改.

在极乐测试网(链)上直播 `99801`) (中文(简体) ). 建造在 [维姆](https://viem.sh/)。 。 。 .

```bash
npm install @cloakely/sdk viem
```

## 发射

```ts
import { createPublicClient, createWalletClient, custom, http, parseEther } from "viem";
import { Cloak, deploymentFor, elysiumTestnet, legacyFactories } from "@cloakely/sdk";

const d = deploymentFor(elysiumTestnet.id);
const publicClient = createPublicClient({ chain: elysiumTestnet, transport: http() });
const walletClient = createWalletClient({ chain: elysiumTestnet, transport: custom(window.ethereum) });
// earlier factories too, so every launch lists, settles and pays out
const cloak = new Cloak(publicClient, walletClient, d.factory, legacyFactories(d));

// a project or launchpad: a sealed-bid launch. At settlement it opens a Uniswap V2 pool (token / WHYPE) at the
// clearing price, with the LP burned ("burn") or locked until a date
const now = Math.floor(Date.now() / 1000);
const { auction } = await cloak.createLaunch({
  name: "Shade", symbol: "SHADE",
  saleSupply: 1_000_000n * 10n ** 18n,
  minPrice: 10n ** 12n, tickSize: 10n ** 12n, numTicks: 100,
  commitEnd: now + 3600, revealEnd: now + 3600 + 600,
  lpBps: 5000, lpLockUntil: "burn",
});

// a bidder: hashed, timelock-encrypted to the drand round when bidding ends, deposit rounded up to a bucket
await cloak.bid(auction, { maxPrice: parseEther("0.00002"), quantity: parseEther("10000") });

// anyone (usually the hosted keeper)
await cloak.revealAll(auction);
await cloak.settle(auction);
await cloak.claimAll(auction);
await cloak.payOut(auction); // the creator's proceeds, and the launch fee to the treasury

const s = await cloak.getAuction(auction);
s.uniPair; // the Uniswap V2 pool, tradable and trackable anywhere (zero for launches before Nov 2, which use a CloakPair)
s.pair;    // the market Cloak's private router and batcher trade: a CloakV2Market in front of that pool
```

## 私营贸易

```ts
import { CloakPrivate, deploymentFor, elysiumTestnet, loadProver, relayerSubmitter } from "@cloakely/sdk";

const d = deploymentFor(elysiumTestnet.id);
const keys = await CloakPrivate.keysFromWallet(walletClient, { chainId: d.chainId, verify: true });
const priv = new CloakPrivate(
  publicClient, d.router, keys,
  () => loadProver(d.circuitsUrl),     // 12 MB of circuit files, fetched once and hash-checked
  relayerSubmitter(d.relayerUrl),      // the relayer submits, so the wallet never appears
  d.vaultsBlock!, d.batcher, d.migrator, // notes are scanned from the permanent vaults' first block
);
await priv.loadMarkets();

await priv.shieldHype(walletClient, parseEther("1"));     // the one public step
await priv.buy(token, parseEther("0.25"));                // private buy through the launch's Uniswap pool
await priv.batch(token, "buy", parseEther("0.37"));       // batch round: trade size hidden too
await priv.send(token, "cloak:…", parseEther("100"));     // private transfer: amount hidden
await priv.unshieldHype(freshAddress, parseEther("0.5")); // back to any wallet
console.log(await priv.balance(priv.hypeMarket.pool));    // only this account can see it
```

二等兵USDC住在自己的金库里 从部署中注册,然后屏蔽, 发送和撤退像任何标志:

```ts
const usdc = priv.addAsset(d.assets![0]);                                // { symbol: "USDC", decimals: 6, … }
await priv.shieldToken(walletClient, usdc.token, parseUnits("50", 6));   // approve + deposit (public, once)
await priv.send(usdc.token, "cloak:…", parseUnits("20", 6));             // amount hidden
await priv.unshieldToken(usdc.token, freshAddress, parseUnits("10", 6)); // 0.25% fee kept
```

从11月2日的发射, 将私人余额保存在一个共享的发射库(测试网实验)中。 有一个 私人发送甚至没有显示移动了哪个令牌:其中继器在同一交易中由您的私人 HYPE 支付.

```ts
const shared = new SharedVaultClient(
  priv, d.shared!, d.sharedRouter!,
  () => loadSharedProver(d.circuitsUrl),  // its own circuit (the token is inside each note), hash-checked
  sharedRelayerSubmitter(d.relayerUrl), d.sharedBlock,
);
await shared.buy(token, parseEther("0.25"));          // private HYPE → private token, through the Uniswap pool
await shared.send(token, parseEther("100"), "cloak:…"); // amount, parties and the token itself hidden
await shared.sell(token, parseEther("50"));           // back to private HYPE
await shared.unshield(token, parseEther("10"), freshAddress);
console.log(await shared.balances());                 // every token this account holds there
```

私人账户来自一个仅与链条相连的EIP-712签名(绝不是合同),所以它和 `cloak:` 地址永远不变。 同一个钱包总是可以恢复它,服务器上没有存储任何东西. 在节点,你自己读回路文件,然后传给 `createProver(wasm, zkey)`。 。 。 .

## NFT投放和WL即时销售

```ts
import { CloakDrops, CloakSpots, deploymentFor, elysiumTestnet, parseEther } from "@cloakely/sdk";
const dep = deploymentFor(elysiumTestnet.id);
const drops = new CloakDrops(publicClient, walletClient, dep.dropFactory!, dep.dropFactoryBlock);

const { drop } = await drops.create({ name: "Moonfoxes", symbol: "MOON", baseURI: "", supply: 1000, floor: parseEther("0.5"),
  gtd: { list: [{ wallet: "0x…", spots: 2 }], price: parseEther("0.4"), durationSecs: 86400 },
  wl: { list: ["0x…"], boostBps: 2000 }, biddingSecs: 86400 });
await drops.bid(drop, { price: parseEther("0.7"), quantity: 1 });   // sealed to a drand round; WL wallets pass wl: true
await drops.claim(drop, bidId);                                      // or claimTo(drop, bidId, freshWallet)

// sell a partner collection's WL spots: winners name the wallet to whitelist
const spots = new CloakSpots(drops, dep.spotBook!);
const sale = await spots.create({ name: "Moonfoxes WL spots", symbol: "MOONWL", supply: 5, floor: parseEther("0.5"), biddingSecs: 86400, partner: "Moonfoxes" });
await spots.setWallets(sale.drop, bidId, ["0x…"]);                   // one per spot won, until the deadline
const csv = CloakSpots.csv(await spots.winners(sale.drop));          // the list for the partner
```

创作者的价格是地板. 投标按价格排名(WL投标按价格×(1+助推)),每个中标者支付一笔结算费 价格(WL赢家付1分加1分加1分加1分加1分加1分加1分加1分加1分加1分加1分加1分) 一旦开标就马上解决 每一出价都必须包括一个NFT在会场上;一个出价仍然被封在最后 显示窗口损失10%.

## 收费(测试网β)

| 行动 | 收费 |
| --- | --- |
| 存款和私人汇款 | 免费 |
| 退款、私人互换和批发订单 | 0.25% 妇女 |
| 成功发射 | 1.5%的加薪 |
| 更新 | 中继器的气体加一个比值,在证明内支付 |

规则存在于链上 `CloakConfig`,而任何Cloak合同中的功能都不能移动用户资金. Testnet仍在设置中,因此所有者可以一次性地(在1%和3%的硬上限内)更改收费和上限;一旦设置结束,在主网之前,提高收费或上限等公众3天的延迟. 每一个规则的号码: [文档/RULES.md](https://github.com/NECOKIZZ/Cloak/blob/main/docs/RULES.md)。 。 。 .

## 出口

| 导出 | 这是什么 |
| --- | --- |
| `Cloak` | 发射: `createLaunch`, (中文(简体) ), `bid`, (中文(简体) ), `revealAll`, (中文(简体) ), `settle`, (中文(简体) ), `claimAll`, (中文(简体) ), `payOut`, (中文(简体) ), `getAuction`, (中文(简体) ), `listLaunches` |
| `CloakPrivate` | 私人结余: `shieldHype`, (中文(简体) ), `shieldToken`, (中文(简体) ), `buy`, (中文(简体) ), `sell`, (中文(简体) ), `batch`, (中文(简体) ), `send`, (中文(简体) ), `unshieldHype`, (中文(简体) ), `unshieldToken`, (中文(简体) ), `addAsset`, (中文(简体) ), `balance`, (中文(简体) ), `maxSpendable`, (中文(简体) ), `migrateFrom` |
| `CloakDrops` | 密封的 NFT 滴出 : `create`, (中文(简体) ), `get`, (中文(简体) ), `details`, (中文(简体) ), `listed`, (中文(简体) ), `gtdMint`, (中文(简体) ), `bid`, (中文(简体) ), `bids`, (中文(简体) ), `revealAll`, (中文(简体) ), `settle`, (中文(简体) ), `claim`, (中文(简体) ), `claimTo`, (中文(简体) ), `claimAll`, (中文(简体) ), `withdrawRefund`, (中文(简体) ), `payOut`, (中文(简体) ), `mintUnsold` |
| `CloakSpots` | WL现货销售: `create`, (中文(简体) ), `open`, (中文(简体) ), `sale`, (中文(简体) ), `sales`, (中文(简体) ), `winners`, (中文(简体) ), `setWallets`, (中文(简体) ), `CloakSpots.csv` |
| `relayerSubmitter`, (中文(简体) ), `walletSubmitter` | 如何通过中继器(私人)或钱包(测试)提交私人电话 |
| `loadProver`, (中文(简体) ), `createProver` | 在设备上运行的 Groth16 验证器 |
| `deployments`, (中文(简体) ), `deploymentFor` | 每个链条的地址、启动块、中继器和线路 URL |
| `elysiumTestnet` | 连锁店 |
| `*Abi`, (中文(简体) ), `@cloakely/sdk/bytecode` | 合同 ABIs 和字节代码 |

文档 : [外衣. boblabs.tech/docs](https://cloak.boblabs.tech/docs)来源和合同: [github.com/NECOKIZZ/cloak (韩语)](https://github.com/NECOKIZZ/cloak)未审计的测试网软件。 麻省理工学院有执照.

## 常见问题

### @cloakely/sdk 是什么？

Elysium上的克克克:被封装-投标代币发射,被封装的NFT滴和WL即时销售,以及私人交易\(屏蔽余额,私人互换,分批拍卖,私人寄出\),并带有被封装的零知识证明\.

### 如何安装 @cloakely/sdk？

在项目目录运行 npm install @cloakely/sdk，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：viem（\>=2\.21\.0 \<3）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @cloakely/sdk 支持 TypeScript 吗？

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

### @cloakely/sdk 支持 ESM 还是 CommonJS？

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

### @cloakely/sdk 需要什么版本的 Node\.js？

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

### @cloakely/sdk 可以商用吗？

@cloakely/sdk 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @cloakely/sdk 的下载量有多少？

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

### @cloakely/sdk 还在维护吗？

最新版本 0\.9\.2 发布于 2026/11/08（1 天前）；至今共发布 23 个版本，其中过去 12 个月发布了 23 个；首次发布于 2026/10/27。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

