@cloak.dev/sdk 0.2.1 → 0.2.2-staging.0f03668
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 +17 -11
- package/dist/index.cjs +378 -31
- package/dist/index.d.cts +160 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +372 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ per-mint pool, send privately inside the pool, withdraw to any address, or swap
|
|
|
5
5
|
USDC/USDT with the output landing in a public token account. Groth16 proofs are generated
|
|
6
6
|
client-side (snarkjs) and verified on-chain by the Cloak program.
|
|
7
7
|
|
|
8
|
-
Version 0.2.
|
|
8
|
+
Version 0.2.2 targets the mainnet program deployed on 2026-08-24 and the ceremony-frozen
|
|
9
9
|
`cloak-transaction-0.2.0` circuit bundle. See [Version and compatibility](#version-and-compatibility).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install @cloak.dev/sdk@^0.2.
|
|
14
|
+
npm install @cloak.dev/sdk@^0.2.2 @solana/web3.js
|
|
15
15
|
# swaps and SPL pools also need:
|
|
16
16
|
npm install @solana/spl-token
|
|
17
17
|
```
|
|
@@ -376,8 +376,11 @@ await transact(
|
|
|
376
376
|
```
|
|
377
377
|
|
|
378
378
|
Minimum SPL deposit is 1.00 token. SOL deposits fit in a single v0 packet with the production
|
|
379
|
-
lookup table; SPL deposits
|
|
380
|
-
(about 0.0056 SOL rent, reclaimable by the depositor).
|
|
379
|
+
lookup table; SPL deposits by default create a small depositor-signed supplemental lookup table
|
|
380
|
+
(about 0.0056 SOL rent, reclaimable by the depositor), which costs a second wallet signature. Set
|
|
381
|
+
`relaySupplementalAlt: true` in `TransactOptions` to ask the relay to extend its own shared lookup
|
|
382
|
+
table instead, cutting an SPL deposit to one signature; off by default, and any relay-side failure
|
|
383
|
+
falls back automatically to the depositor-signed path above with no caller action needed.
|
|
381
384
|
|
|
382
385
|
### Shielded swap (SOL to USDC/USDT)
|
|
383
386
|
|
|
@@ -565,7 +568,7 @@ Deposits and private sends carry no protocol fee.
|
|
|
565
568
|
A withdrawal or swap must exceed its fee or the program rejects it; deposits below the minimum are
|
|
566
569
|
rejected with `DepositTooSmall`.
|
|
567
570
|
|
|
568
|
-
`shared/fees.ts` mirrors the SOL pool for estimates in the UI:
|
|
571
|
+
`src/shared/fees.ts` mirrors the SOL pool for estimates in the UI:
|
|
569
572
|
|
|
570
573
|
```ts
|
|
571
574
|
import { calculateFeeBigint, getDistributableAmount, isWithdrawAmountSufficient } from "@cloak.dev/sdk";
|
|
@@ -577,7 +580,8 @@ isWithdrawAmountSufficient(6_000_000n); // true: 0.006 SOL covers the 0.005018
|
|
|
577
580
|
|
|
578
581
|
For USDC/USDT compute `450_000n + amount * 3n / 1000n`. Treat these as estimates: the deployed
|
|
579
582
|
`PoolConfig` is the source of truth. Solana transaction fees and, for SPL deposits, the supplemental
|
|
580
|
-
lookup-table rent are separate
|
|
583
|
+
lookup-table rent are separate (see `relaySupplementalAlt` under [SPL pools](#spl-pools-usdc-usdt)
|
|
584
|
+
for cutting that rent's signature cost).
|
|
581
585
|
|
|
582
586
|
## Circuit artifacts
|
|
583
587
|
|
|
@@ -623,12 +627,15 @@ relay endpoint and the localhost-RPC check.
|
|
|
623
627
|
|
|
624
628
|
## Version and compatibility
|
|
625
629
|
|
|
626
|
-
- SDK 0.2.
|
|
627
|
-
(deployed 2026-08-24) and the 0.2.0 circuit bundle
|
|
630
|
+
- SDK 0.2.2 pairs with the mainnet program at `zh1eLd6rSphLejbFfJEneUwzHRfMKxgzrgkfwA6qRkW`
|
|
631
|
+
(deployed 2026-08-24) and the 0.2.0 circuit bundle — the program and circuit bundle are unchanged
|
|
632
|
+
since 0.2.0; only the SDK package version has moved. All flows in this README were exercised on
|
|
628
633
|
mainnet on 2026-08-25: deposit, private send and withdraw on SOL, USDC and USDT; swaps SOL to
|
|
629
634
|
USDC and USDT; viewing-key discovery followed by a spend; keypair-only deposit recovery.
|
|
635
|
+
- 0.2.2 adds the opt-in `TransactOptions.relaySupplementalAlt` (see [SPL pools](#spl-pools-usdc-usdt)):
|
|
636
|
+
off by default, and existing behavior is unchanged when it is left unset.
|
|
630
637
|
- Proofs generated with the 0.1.x circuits are rejected by the mainnet program. SDK 0.1.x builds
|
|
631
|
-
(which ship the 0.1.0 bundle) are not usable against it; upgrade to 0.2.
|
|
638
|
+
(which ship the 0.1.0 bundle) are not usable against it; upgrade to 0.2.x.
|
|
632
639
|
- The note-based `CloakSDK` class is removed in 0.2.0. It targeted the pre-0.2.0 instruction layout
|
|
633
640
|
and the unpublished 0.1.0 `withdraw_*` circuits, so it could not work against the current program.
|
|
634
641
|
Use the UTXO API above: `transact`, `transfer`, `partialWithdraw`, `fullWithdraw`, `swapUtxo`.
|
|
@@ -712,8 +719,7 @@ npm run test:examples # dry-run the examples
|
|
|
712
719
|
```
|
|
713
720
|
|
|
714
721
|
Notes: `docs/DEPOSIT-SIZE-NOTES.md` (deposit transaction size, confirmed-tree reads,
|
|
715
|
-
supplemental lookup tables), `docs/transact-split.md` (how `flows/transact.ts` is split)
|
|
716
|
-
`docs/cleanup-plan.md` (the root/scripts/examples cleanup this repo is executing).
|
|
722
|
+
supplemental lookup tables), `docs/transact-split.md` (how `flows/transact.ts` is split).
|
|
717
723
|
|
|
718
724
|
## Links
|
|
719
725
|
|