@cloakely/sdk 0.4.0 → 0.6.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/README.md CHANGED
@@ -22,14 +22,16 @@ npm install @cloakely/sdk viem
22
22
 
23
23
  ```ts
24
24
  import { createPublicClient, createWalletClient, custom, http, parseEther } from "viem";
25
- import { Cloak, deploymentFor, elysiumTestnet } from "@cloakely/sdk";
25
+ import { Cloak, deploymentFor, elysiumTestnet, legacyFactories } from "@cloakely/sdk";
26
26
 
27
27
  const d = deploymentFor(elysiumTestnet.id);
28
28
  const publicClient = createPublicClient({ chain: elysiumTestnet, transport: http() });
29
29
  const walletClient = createWalletClient({ chain: elysiumTestnet, transport: custom(window.ethereum) });
30
- const cloak = new Cloak(publicClient, walletClient, d.factory, d.legacy?.factory);
30
+ // earlier factories too, so every launch lists, settles and pays out
31
+ const cloak = new Cloak(publicClient, walletClient, d.factory, legacyFactories(d));
31
32
 
32
- // a project or launchpad: a sealed-bid launch, with liquidity seeded at the clearing price
33
+ // a project or launchpad: a sealed-bid launch. At settlement it opens a Uniswap V2 pool (token / WHYPE) at the
34
+ // clearing price, with the LP burned ("burn") or locked until a date
33
35
  const now = Math.floor(Date.now() / 1000);
34
36
  const { auction } = await cloak.createLaunch({
35
37
  name: "Shade", symbol: "SHADE",
@@ -47,6 +49,10 @@ await cloak.revealAll(auction);
47
49
  await cloak.settle(auction);
48
50
  await cloak.claimAll(auction);
49
51
  await cloak.payOut(auction); // the creator's proceeds, and the launch fee to the treasury
52
+
53
+ const s = await cloak.getAuction(auction);
54
+ s.uniPair; // the Uniswap V2 pool, tradable and trackable anywhere (zero for launches before Nov 2, which use a CloakPair)
55
+ s.pair; // the market Cloak's private router and batcher trade: a CloakV2Market in front of that pool
50
56
  ```
51
57
 
52
58
  ## Private trading
@@ -55,17 +61,17 @@ await cloak.payOut(auction); // the creator's proceeds, and the launch fee to th
55
61
  import { CloakPrivate, deploymentFor, elysiumTestnet, loadProver, relayerSubmitter } from "@cloakely/sdk";
56
62
 
57
63
  const d = deploymentFor(elysiumTestnet.id);
58
- const keys = await CloakPrivate.keysFromWallet(walletClient, { chainId: d.chainId, router: d.router, verify: true });
64
+ const keys = await CloakPrivate.keysFromWallet(walletClient, { chainId: d.chainId, verify: true });
59
65
  const priv = new CloakPrivate(
60
66
  publicClient, d.router, keys,
61
67
  () => loadProver(d.circuitsUrl), // 12 MB of circuit files, fetched once and hash-checked
62
68
  relayerSubmitter(d.relayerUrl), // the relayer submits, so the wallet never appears
63
- d.routerBlock, d.batcher, d.migrator,
69
+ d.vaultsBlock!, d.batcher, d.migrator, // notes are scanned from the permanent vaults' first block
64
70
  );
65
71
  await priv.loadMarkets();
66
72
 
67
73
  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
74
+ await priv.buy(token, parseEther("0.25")); // private buy through the launch's Uniswap pool
69
75
  await priv.batch(token, "buy", parseEther("0.37")); // batch round: trade size hidden too
70
76
  await priv.send(token, "cloak:…", parseEther("100")); // private transfer: amount hidden
71
77
  await priv.unshieldHype(freshAddress, parseEther("0.5")); // back to any wallet
@@ -81,7 +87,7 @@ await priv.send(usdc.token, "cloak:…", parseUnits("20", 6)); // am
81
87
  await priv.unshieldToken(usdc.token, freshAddress, parseUnits("10", 6)); // 0.25% fee kept
82
88
  ```
83
89
 
84
- 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)`.
90
+ The private account comes from one EIP-712 signature bound to the chain only (never to a contract), so it and the `cloak:` address never change. 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)`.
85
91
 
86
92
  ## Fees (testnet beta)
87
93
 
@@ -92,7 +98,7 @@ The private account comes from one EIP-712 signature bound to the chain and the
92
98
  | Successful launch | 1.5% of the raise |
93
99
  | Relayer | the relayer's gas plus a margin, paid inside the proof |
94
100
 
95
- 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.
101
+ Rules live in the on-chain `CloakConfig`, and no function in any Cloak contract can move user funds. Testnet is still in setup, so the owner can change fees and caps at once (within hard ceilings of 1% and 3%); once setup ends, before mainnet, raising a fee or a cap waits a public 3-day delay. Every rule with its number: [docs/RULES.md](https://github.com/NECOKIZZ/Cloak/blob/main/docs/RULES.md).
96
102
 
97
103
  ## Exports
98
104