@cloakely/sdk

中文文档
0.9.2发布于 2026/11/08MITTypeScriptES Module构建来源已验证近 30 天下载 4211

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

中文使用文档
文档目录5 节
  1. 发射
  2. 私营贸易
  3. NFT投放和WL即时销售
  4. 收费(测试网β)
  5. 出口

@ cloakely/ sdk (英语)

类型脚本 SDK 衣着公平发射 以及基内迪克的私人交易 极乐。 。 。 .

发射

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

私营贸易

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

在极乐测试网(链)上直播 99801) (中文(简体) ). 建造在 维姆。 。 。 .

npm install @cloakely/sdk viem

发射

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

私营贸易

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住在自己的金库里 从部署中注册,然后屏蔽, 发送和撤退像任何标志:

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 支付.

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即时销售

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。 。 。 .

出口

导出这是什么
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
CloakSpotsWL现货销售: 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来源和合同: github.com/NECOKIZZ/cloak (韩语)未审计的测试网软件。 麻省理工学院有执照.

版本与发布记录

@cloakely/sdk 共发布 23 个版本,首次发布于 2026/10/27;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.2latest2026/11/081 天前
0.9.12026/11/072 天前
0.9.02026/11/072 天前
0.8.52026/11/073 天前
0.8.42026/11/063 天前
0.8.32026/11/046 天前

关于 @cloakely/sdk 的常见问题

@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 和提交记录判断。