@cloakely/sdk 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bob Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # @cloakely/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript SDK for [Cloak](https://cloak.boblabs.tech), fair launches and private trading on Kinetiq's **Elysium**.
4
+
5
+ **Launches**
6
+ - Sealed-bid token launches that bots can't front-run.
7
+ - Everyone pays one clearing price.
8
+ - The launch's pool is seeded at that price.
9
+
10
+ **Private trading**
11
+ - Shielded balances: buy, sell, send and batch-trade launch tokens without your wallet appearing.
12
+ - Zero-knowledge proofs are made on the user's device.
13
+ - A relayer submits the transaction, but it can't change it.
14
+
15
+ Live on Elysium testnet (chain `99801`). Built on [viem](https://viem.sh).
16
+
17
+ ```bash
18
+ npm install @cloakely/sdk viem
19
+ ```
20
+
21
+ ## Launches
22
+
23
+ ```ts
24
+ import { createPublicClient, createWalletClient, custom, http, parseEther } from "viem";
25
+ import { Cloak, deploymentFor, elysiumTestnet } from "@cloakely/sdk";
26
+
27
+ const d = deploymentFor(elysiumTestnet.id);
28
+ const publicClient = createPublicClient({ chain: elysiumTestnet, transport: http() });
29
+ const walletClient = createWalletClient({ chain: elysiumTestnet, transport: custom(window.ethereum) });
30
+ const cloak = new Cloak(publicClient, walletClient, d.factory, d.legacy?.factory);
31
+
32
+ // a project or launchpad: a sealed-bid launch, with liquidity seeded at the clearing price
33
+ const now = Math.floor(Date.now() / 1000);
34
+ const { auction } = await cloak.createLaunch({
35
+ name: "Shade", symbol: "SHADE",
36
+ saleSupply: 1_000_000n * 10n ** 18n,
37
+ minPrice: 10n ** 12n, tickSize: 10n ** 12n, numTicks: 100,
38
+ commitEnd: now + 3600, revealEnd: now + 3600 + 600,
39
+ lpBps: 5000, lpLockUntil: "burn",
40
+ });
41
+
42
+ // a bidder: hashed, timelock-encrypted to the drand round when bidding ends, deposit rounded up to a bucket
43
+ await cloak.bid(auction, { maxPrice: parseEther("0.00002"), quantity: parseEther("10000") });
44
+
45
+ // anyone (usually the hosted keeper)
46
+ await cloak.revealAll(auction);
47
+ await cloak.settle(auction);
48
+ await cloak.claimAll(auction);
49
+ await cloak.payOut(auction); // the creator's proceeds, and the launch fee to the treasury
50
+ ```
51
+
52
+ ## Private trading
53
+
54
+ ```ts
55
+ import { CloakPrivate, deploymentFor, elysiumTestnet, loadProver, relayerSubmitter } from "@cloakely/sdk";
56
+
57
+ const d = deploymentFor(elysiumTestnet.id);
58
+ const keys = await CloakPrivate.keysFromWallet(walletClient, { chainId: d.chainId, router: d.router, verify: true });
59
+ const priv = new CloakPrivate(
60
+ publicClient, d.router, keys,
61
+ () => loadProver(d.circuitsUrl), // 12 MB of circuit files, fetched once and hash-checked
62
+ relayerSubmitter(d.relayerUrl), // the relayer submits, so the wallet never appears
63
+ d.routerBlock, d.batcher, d.migrator,
64
+ );
65
+ await priv.loadMarkets();
66
+
67
+ await priv.shieldHype(walletClient, parseEther("1")); // the one public step
68
+ await priv.buy(token, parseEther("0.25")); // private buy through the launch's pool
69
+ await priv.batch(token, "buy", parseEther("0.37")); // batch round: trade size hidden too
70
+ await priv.send(token, "cloak:…", parseEther("100")); // private transfer: amount hidden
71
+ await priv.unshieldHype(freshAddress, parseEther("0.5")); // back to any wallet
72
+ console.log(await priv.balance(priv.hypeMarket.pool)); // only this account can see it
73
+ ```
74
+
75
+ The private account comes from one EIP-712 signature bound to the chain and the router. The same wallet always restores it, and nothing is stored on a server. In Node, read the circuit files yourself and pass them to `createProver(wasm, zkey)`.
76
+
77
+ ## Fees (testnet beta)
78
+
79
+ | Action | Fee |
80
+ |---|---|
81
+ | Deposits and private sends | free |
82
+ | Withdrawals, private swaps and batch orders | 0.25% |
83
+ | Successful launch | 1.5% of the raise |
84
+ | Relayer | the relayer's gas plus a margin, paid inside the proof |
85
+
86
+ Rules live in the on-chain `CloakConfig`. Raising a fee or a cap waits a public 3-day delay, and no function in any Cloak contract can move user funds.
87
+
88
+ ## Exports
89
+
90
+ | Export | What it is |
91
+ |---|---|
92
+ | `Cloak` | Launches: `createLaunch`, `bid`, `revealAll`, `settle`, `claimAll`, `payOut`, `getAuction`, `listLaunches` |
93
+ | `CloakPrivate` | Private balances: `shieldHype`, `buy`, `sell`, `batch`, `send`, `unshieldHype`, `unshieldToken`, `balance`, `maxSpendable`, `migrateFrom` |
94
+ | `relayerSubmitter`, `walletSubmitter` | How private calls are submitted: through a relayer (private), or from a wallet (for tests) |
95
+ | `loadProver`, `createProver` | The Groth16 prover, running on the device |
96
+ | `deployments`, `deploymentFor` | Addresses, start blocks, relayer and circuit URLs per chain |
97
+ | `elysiumTestnet` | The viem chain |
98
+ | `*Abi`, `@cloakely/sdk/bytecode` | Contract ABIs and bytecode |
99
+
100
+ Docs: [cloak.boblabs.tech/docs](https://cloak.boblabs.tech/docs). Source and contracts: [github.com/NECOKIZZ/cloak](https://github.com/NECOKIZZ/cloak). Unaudited testnet software. MIT licensed.