@cloakely/sdk 0.5.0 → 0.7.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 +30 -8
- package/dist/abis.d.ts +1565 -0
- package/dist/abis.js +2023 -0
- package/dist/bytecode.d.ts +9 -4
- package/dist/bytecode.js +1 -1
- package/dist/cloak.d.ts +82 -2
- package/dist/cloak.js +42 -4
- package/dist/deployments.d.ts +10 -0
- package/dist/deployments.js +14 -4
- package/dist/private/client.d.ts +55 -3
- package/dist/private/client.js +132 -2
- package/dist/private/crypto.d.ts +8 -0
- package/dist/private/crypto.js +9 -1
- package/dist/private/index.d.ts +1 -0
- package/dist/private/index.js +1 -0
- package/dist/private/prover.d.ts +19 -0
- package/dist/private/prover.js +48 -0
- package/dist/private/shared.d.ts +127 -0
- package/dist/private/shared.js +459 -0
- package/dist/private/tx.d.ts +5 -0
- package/dist/private/tx.js +8 -2
- package/dist/registry.d.ts +5 -0
- package/dist/registry.js +3 -0
- package/package.json +1 -1
package/dist/private/tx.js
CHANGED
|
@@ -84,6 +84,11 @@ export async function buildTransaction(p) {
|
|
|
84
84
|
const privKey = randomField();
|
|
85
85
|
ins.push({ amount: 0n, privKey, pubKey: await poseidon([privKey]), blinding: randomField(), leafIndex: 0 });
|
|
86
86
|
}
|
|
87
|
+
const shared = p.asset !== undefined;
|
|
88
|
+
if (shared && p.inputs.some((n) => n.asset !== p.asset))
|
|
89
|
+
throw new Error("every input must hold the same token");
|
|
90
|
+
if (shared && (extAmount !== 0n || fee !== 0n) && p.publicAsset !== p.asset)
|
|
91
|
+
throw new Error("moving tokens in or out must name the token");
|
|
87
92
|
const outs = p.outputs.map((o) => ({ ...o, blinding: o.blinding ?? randomField() }));
|
|
88
93
|
while (outs.length < 2)
|
|
89
94
|
outs.push({ amount: 0n, pubKey: p.dummyPubKey, blinding: randomField(), memo: p.dummyMemo });
|
|
@@ -119,8 +124,9 @@ export async function buildTransaction(p) {
|
|
|
119
124
|
root,
|
|
120
125
|
publicAmount: fieldMod(extAmount - fee),
|
|
121
126
|
extDataHash: hashExtData(extData),
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
...(shared ? { publicAsset: p.publicAsset ?? 0n, asset: p.asset } : {}),
|
|
128
|
+
inputNullifier: await Promise.all(ins.map((n) => nullifierOf({ ...n, asset: p.asset }, n.leafIndex, n.privKey))),
|
|
129
|
+
outputCommitment: await Promise.all(outs.map((o) => noteCommitment({ ...o, asset: p.asset }))),
|
|
124
130
|
inAmount: ins.map((n) => n.amount),
|
|
125
131
|
inPrivateKey: ins.map((n) => n.privKey),
|
|
126
132
|
inBlinding: ins.map((n) => n.blinding),
|
package/dist/registry.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ export interface CloakRegistry {
|
|
|
37
37
|
batcher?: Address;
|
|
38
38
|
batcherBlock?: bigint;
|
|
39
39
|
migrator?: Address;
|
|
40
|
+
/** SharedVault: one private vault for every new Uniswap launch token (testnet experiment). */
|
|
41
|
+
shared?: Address;
|
|
42
|
+
sharedBlock?: bigint;
|
|
43
|
+
/** SharedRouter: private buys, sells and hidden sends for the shared vault. */
|
|
44
|
+
sharedRouter?: Address;
|
|
40
45
|
factory: Address;
|
|
41
46
|
factoryBlock: bigint;
|
|
42
47
|
/** Earlier factories of the current version (a factory added next to the first), newest first. */
|
package/dist/registry.js
CHANGED
|
@@ -32,6 +32,9 @@ export async function readRegistry(publicClient, config) {
|
|
|
32
32
|
batcher: batcher?.addr,
|
|
33
33
|
batcherBlock: batcher?.startBlock,
|
|
34
34
|
migrator: newest("migrator", router.version)?.addr,
|
|
35
|
+
shared: newest("shared")?.addr,
|
|
36
|
+
sharedBlock: newest("shared")?.startBlock,
|
|
37
|
+
sharedRouter: newest("sharedRouter")?.addr,
|
|
35
38
|
factory: factory.addr,
|
|
36
39
|
factoryBlock: factory.startBlock,
|
|
37
40
|
earlierFactories: entries.filter((e) => e.kind === "factory" && e.version === factory.version && e.addr !== factory.addr).reverse().map((e) => e.addr),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloakely/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Cloak on Elysium: sealed-bid token launches and private trading (shielded balances, private swaps, batch auctions, private sends) with on-device zero-knowledge proofs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloak",
|