@esseyonsui/sui-sdk-v3 0.3.2 → 0.4.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/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +5 -0
- package/dist/essey.d.ts +157 -131
- package/dist/essey.d.ts.map +1 -1
- package/dist/essey.js +641 -823
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/network.d.ts +2 -0
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +17 -3
- package/dist/v3/collateral/bodies.d.ts +23 -14
- package/dist/v3/collateral/bodies.d.ts.map +1 -1
- package/dist/v3/collateral/bodies.js +42 -35
- package/dist/v3/collateral/ext.d.ts +18 -13
- package/dist/v3/collateral/ext.d.ts.map +1 -1
- package/dist/v3/collateral/ext.js +5 -6
- package/dist/v3/collateral/health.d.ts +16 -10
- package/dist/v3/collateral/health.d.ts.map +1 -1
- package/dist/v3/collateral/health.js +55 -30
- package/dist/v3/collateral/math.d.ts +0 -2
- package/dist/v3/collateral/math.d.ts.map +1 -1
- package/dist/v3/collateral/math.js +0 -5
- package/dist/v3/collateral/openings.d.ts +5 -1
- package/dist/v3/collateral/openings.d.ts.map +1 -1
- package/dist/v3/collateral/openings.js +7 -12
- package/dist/v3/credential/membership.d.ts +16 -2
- package/dist/v3/credential/membership.d.ts.map +1 -1
- package/dist/v3/credential/membership.js +36 -3
- package/dist/v3/domains.d.ts +9 -0
- package/dist/v3/domains.d.ts.map +1 -1
- package/dist/v3/domains.js +5 -0
- package/dist/v3/fees.d.ts +13 -1
- package/dist/v3/fees.d.ts.map +1 -1
- package/dist/v3/fees.js +32 -2
- package/dist/v3/funds.d.ts +34 -0
- package/dist/v3/funds.d.ts.map +1 -0
- package/dist/v3/funds.js +60 -0
- package/dist/v3/keeper-payload.d.ts +29 -7
- package/dist/v3/keeper-payload.d.ts.map +1 -1
- package/dist/v3/keeper-payload.js +33 -22
- package/dist/v3/kinds.d.ts +6 -6
- package/dist/v3/kinds.d.ts.map +1 -1
- package/dist/v3/kinds.js +5 -13
- package/dist/v3/loans/bodies.d.ts +40 -68
- package/dist/v3/loans/bodies.d.ts.map +1 -1
- package/dist/v3/loans/bodies.js +50 -73
- package/dist/v3/loans/offer-payload.d.ts +109 -0
- package/dist/v3/loans/offer-payload.d.ts.map +1 -0
- package/dist/v3/loans/offer-payload.js +207 -0
- package/dist/v3/loans/offer-plan.d.ts +8 -60
- package/dist/v3/loans/offer-plan.d.ts.map +1 -1
- package/dist/v3/loans/offer-plan.js +19 -95
- package/dist/v3/loans/open-plan.d.ts +15 -5
- package/dist/v3/loans/open-plan.d.ts.map +1 -1
- package/dist/v3/loans/open-plan.js +18 -7
- package/dist/v3/loans/reclaim-plan.d.ts +31 -15
- package/dist/v3/loans/reclaim-plan.d.ts.map +1 -1
- package/dist/v3/loans/reclaim-plan.js +63 -32
- package/dist/v3/loans/refi-plan.d.ts +8 -34
- package/dist/v3/loans/refi-plan.d.ts.map +1 -1
- package/dist/v3/loans/refi-plan.js +30 -111
- package/dist/v3/loans/repay-plan.d.ts.map +1 -1
- package/dist/v3/loans/repay-plan.js +2 -2
- package/dist/v3/loans/settle-plan.d.ts +88 -53
- package/dist/v3/loans/settle-plan.d.ts.map +1 -1
- package/dist/v3/loans/settle-plan.js +141 -150
- package/dist/v3/locks.d.ts +21 -0
- package/dist/v3/locks.d.ts.map +1 -0
- package/dist/v3/locks.js +15 -0
- package/dist/v3/memo.d.ts +14 -4
- package/dist/v3/memo.d.ts.map +1 -1
- package/dist/v3/memo.js +14 -7
- package/dist/v3/notes/derive.d.ts +5 -0
- package/dist/v3/notes/derive.d.ts.map +1 -1
- package/dist/v3/notes/derive.js +5 -0
- package/dist/v3/pace.d.ts +0 -1
- package/dist/v3/pace.d.ts.map +1 -1
- package/dist/v3/pace.js +0 -1
- package/dist/v3/pads.d.ts +15 -0
- package/dist/v3/pads.d.ts.map +1 -0
- package/dist/v3/pads.js +25 -0
- package/dist/v3/prover.d.ts +1 -1
- package/dist/v3/prover.d.ts.map +1 -1
- package/dist/v3/prover.js +1 -0
- package/dist/v3/relay/client.d.ts.map +1 -1
- package/dist/v3/relay/client.js +2 -2
- package/dist/v3/sales/auctioneer.d.ts +32 -27
- package/dist/v3/sales/auctioneer.d.ts.map +1 -1
- package/dist/v3/sales/auctioneer.js +67 -108
- package/dist/v3/sales/bid.d.ts +20 -49
- package/dist/v3/sales/bid.d.ts.map +1 -1
- package/dist/v3/sales/bid.js +28 -83
- package/dist/v3/sales/bodies.d.ts +4 -54
- package/dist/v3/sales/bodies.d.ts.map +1 -1
- package/dist/v3/sales/bodies.js +10 -52
- package/dist/v3/sales/claim.d.ts +0 -2
- package/dist/v3/sales/claim.d.ts.map +1 -1
- package/dist/v3/sales/claim.js +6 -8
- package/dist/v3/sales/index.d.ts +0 -1
- package/dist/v3/sales/index.d.ts.map +1 -1
- package/dist/v3/sales/index.js +0 -1
- package/dist/v3/sales/listing.d.ts +8 -6
- package/dist/v3/sales/listing.d.ts.map +1 -1
- package/dist/v3/sales/listing.js +27 -9
- package/dist/v3/sales/open-kind.d.ts +1 -3
- package/dist/v3/sales/open-kind.d.ts.map +1 -1
- package/dist/v3/sales/open-kind.js +2 -3
- package/dist/v3/sales/outcome.d.ts +5 -8
- package/dist/v3/sales/outcome.d.ts.map +1 -1
- package/dist/v3/sales/outcome.js +5 -9
- package/dist/v3/sales/package-gate.d.ts +3 -4
- package/dist/v3/sales/package-gate.d.ts.map +1 -1
- package/dist/v3/sales/package-gate.js +9 -7
- package/dist/v3/sales/rows.d.ts +9 -49
- package/dist/v3/sales/rows.d.ts.map +1 -1
- package/dist/v3/sales/rows.js +17 -91
- package/dist/v3/sales/seller.d.ts +2 -6
- package/dist/v3/sales/seller.d.ts.map +1 -1
- package/dist/v3/sales/seller.js +4 -11
- package/dist/v3/stage1.d.ts +8 -21
- package/dist/v3/stage1.d.ts.map +1 -1
- package/dist/v3/stage1.js +8 -76
- package/package.json +1 -1
- package/dist/v3/loans/lock-round.d.ts +0 -22
- package/dist/v3/loans/lock-round.d.ts.map +0 -1
- package/dist/v3/loans/lock-round.js +0 -20
- package/dist/v3/sales/reclaim.d.ts +0 -46
- package/dist/v3/sales/reclaim.d.ts.map +0 -1
- package/dist/v3/sales/reclaim.js +0 -57
package/dist/v3/prover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover.d.ts","sourceRoot":"","sources":["../../src/v3/prover.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAE/D,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACrF,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAEtF,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,WAAqD,CAAC;AAEjG,iFAAiF;AACjF,wBAAsB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAch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,IAAI,EAAE,cAAc,CAAA;CAAE,CAIhD;AAED,2EAA2E;AAC3E,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,GACjD,MAAM,CAcR"}
|
package/dist/v3/prover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v3/relay/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v3/relay/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAA6C,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACxD,MAAM,MAAM,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACvD,qHAAqH;AACrH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EA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client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EsseyError } from "../../errors.js";
|
|
2
|
-
import { getJson, postJson, serviceUrl } from "../../network.js";
|
|
2
|
+
import { getJson, postJson, serviceUrl, submitJson } from "../../network.js";
|
|
3
3
|
const TICKET = /^t_[0-9a-f]{32}$/;
|
|
4
4
|
const STATES = new Set(["queued", "landed", "failed", "expired"]);
|
|
5
5
|
const abortOf = (abort) => abort && typeof abort === "object" ? abort : undefined;
|
|
@@ -37,7 +37,7 @@ export class RelayClient {
|
|
|
37
37
|
}
|
|
38
38
|
/** 200 is a landed transaction, 202 a queued one whose ticket `status` follows. */
|
|
39
39
|
async submit(body) {
|
|
40
|
-
const reply = await
|
|
40
|
+
const reply = await submitJson(this.fetch, `${this.base}/v3/relay`, body);
|
|
41
41
|
const { ok, digest, ticket, etaMs } = reply.body;
|
|
42
42
|
if (ok !== true || typeof ticket !== "string" || !TICKET.test(ticket))
|
|
43
43
|
throw refusal(reply);
|
|
@@ -1,58 +1,63 @@
|
|
|
1
1
|
import { type FeeCommitInput } from "../fees.ts";
|
|
2
2
|
import type { CircuitInput } from "../inputs.ts";
|
|
3
3
|
export type PlanParams = {
|
|
4
|
-
/** `SaleRoom` as read from chain
|
|
4
|
+
/** `SaleRoom` as read from chain. */
|
|
5
5
|
room: {
|
|
6
6
|
saleKey: bigint;
|
|
7
|
-
|
|
7
|
+
postedCommit: bigint;
|
|
8
8
|
sellerCommit: bigint;
|
|
9
|
-
bids: {
|
|
10
|
-
commit: bigint;
|
|
11
|
-
lock: bigint;
|
|
12
|
-
active: boolean;
|
|
13
|
-
}[];
|
|
14
|
-
/**
|
|
15
|
-
* `SaleRoom.pick`: `finish` opens that slot alone (`sale_room.move:712-716`). `null` with no active bid is the
|
|
16
|
-
* no-winner finish. `"legacy"` is a room of a previous sale package, whose `finish` opens every active bid.
|
|
17
|
-
*/
|
|
18
|
-
pick: number | null | "legacy";
|
|
19
9
|
};
|
|
20
|
-
/** The
|
|
21
|
-
|
|
10
|
+
/** The posted price and its salt `s*`, which open `posted_commit`. */
|
|
11
|
+
price: bigint;
|
|
12
|
+
postSalt: bigint;
|
|
22
13
|
seller: {
|
|
23
14
|
sellerSk: bigint;
|
|
24
15
|
sellerSecret: bigint;
|
|
25
16
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
/** One bid lock the seller's scan opened (`offer-payload.ts` scanLocks with `bidOpen`). */
|
|
18
|
+
bid: {
|
|
19
|
+
ownerPk: bigint;
|
|
20
|
+
ns: bigint;
|
|
21
|
+
b: bigint;
|
|
22
|
+
amount: bigint;
|
|
23
|
+
unlockS: bigint;
|
|
30
24
|
};
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
lock: {
|
|
26
|
+
root: bigint;
|
|
27
|
+
index: bigint;
|
|
28
|
+
path: bigint[];
|
|
29
|
+
};
|
|
30
|
+
pad: {
|
|
31
|
+
pk: bigint;
|
|
32
|
+
blinding: bigint;
|
|
33
|
+
};
|
|
34
|
+
dummySeed: bigint;
|
|
35
|
+
/** `[seller note, fee note, change, pad]`, the order `finish` hands `room_apply`. */
|
|
36
|
+
encs: Uint8Array[];
|
|
33
37
|
fee: FeeCommitInput;
|
|
34
38
|
eph: bigint;
|
|
35
39
|
};
|
|
36
40
|
/** The `u256` arguments of `sale_room::finish`, under Move's own names and in its order. */
|
|
37
41
|
export type SettleStatement = {
|
|
42
|
+
root: bigint;
|
|
43
|
+
n_lock: bigint;
|
|
44
|
+
n_dummy: bigint;
|
|
38
45
|
seller_out: bigint;
|
|
39
46
|
fee_out: bigint;
|
|
40
|
-
|
|
47
|
+
change: bigint;
|
|
41
48
|
item_claim: bigint;
|
|
42
|
-
|
|
49
|
+
pad: bigint;
|
|
43
50
|
eph_x: bigint;
|
|
44
51
|
eph_y: bigint;
|
|
45
52
|
fee_ct: bigint;
|
|
46
53
|
fee_commit: bigint;
|
|
47
54
|
};
|
|
48
55
|
/**
|
|
49
|
-
* Witness for `circuits/v3/sale_settle/sale_settle.circom
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* hCtx carries relayer `NO_ADDRESS` and fee 0, the only pair `sale_room::finish` rebuilds.
|
|
56
|
+
* Witness for `circuits/v3/sale_settle/sale_settle.circom` (Z1 freeze §3.5). Public signals, in order: root, nLock,
|
|
57
|
+
* nDummy, hCtx, hOut. hCtx carries relayer `NO_ADDRESS` and fee 0, the only pair `sale_room::finish` rebuilds. The
|
|
58
|
+
* buyer's change is a note under its bid key with a blind only its `ns` opens, so the seller cannot spend it.
|
|
53
59
|
*/
|
|
54
60
|
export declare function plan(p: PlanParams): Promise<{
|
|
55
|
-
slash: number[];
|
|
56
61
|
input: CircuitInput;
|
|
57
62
|
publics: bigint[];
|
|
58
63
|
statement: SettleStatement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctioneer.d.ts","sourceRoot":"","sources":["../../../src/v3/sales/auctioneer.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"auctioneer.d.ts","sourceRoot":"","sources":["../../../src/v3/sales/auctioneer.ts"],"names":[],"mappings":"AAMA,OAAO,EAA8B,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAajD,MAAM,MAAM,UAAU,GAAG;IACvB,qCAAqC;IACrC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,2FAA2F;IAC3F,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC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 @@
|
|
|
1
1
|
import { poseidonHash } from "@mysten/sui/zklogin";
|
|
2
2
|
import { addrField } from "../addr-field.js";
|
|
3
|
-
import {
|
|
3
|
+
import { DOM_RBLIND, DOM_SBLIND, DOM_SELLER } from "../domains.js";
|
|
4
4
|
import { NO_ADDRESS } from "../ext.js";
|
|
5
5
|
import { feeWitness } from "../fee-witness.js";
|
|
6
|
-
import {
|
|
6
|
+
import { flatFeeLane, minHiddenBase } from "../fees.js";
|
|
7
|
+
import { lock5 } from "../locks.js";
|
|
7
8
|
import { noteCommitment, notePk } from "../notes/keys.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (winner < 0 || o.v > opened[winner].v)
|
|
20
|
-
winner = i;
|
|
21
|
-
});
|
|
22
|
-
return winner;
|
|
23
|
-
}
|
|
24
|
-
function winnerBranch(roomField, won) {
|
|
25
|
-
return {
|
|
26
|
-
residual: residualLock(roomField, won.ownerPk, won.ns, won.amount - won.v).lock,
|
|
27
|
-
item_claim: itemClaimCommit(won.ownerPk, winnerSalt(won.ns)),
|
|
28
|
-
win_null: lock4(roomField, won.ownerPk, won.ns, won.amount, won.b).nullifier,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/** C §4.4, §4.6: with no winner the residual is a zero lock and the item claim is the seller's. */
|
|
32
|
-
function dummyBranch(roomField, sellerPk, sellerSecret) {
|
|
33
|
-
const ns = poseidonHash([DOM_DUMMY, sellerSecret]);
|
|
34
|
-
const b = poseidonHash([DOM_DUMMY, poseidonHash([sellerSecret, roomField])]);
|
|
35
|
-
return {
|
|
36
|
-
residual: lock4(roomField, sellerPk, ns, 0n, b).lock,
|
|
37
|
-
item_claim: itemClaimCommit(sellerPk, noWinnerSalt(sellerSecret, roomField)),
|
|
38
|
-
win_null: poseidonHash([DOM_LNULL, poseidonHash([DOM_DUMMY, sellerSecret, roomField])]),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/** The slots `finish` opens; refuses what `sale_room::settle_mask` would abort on. */
|
|
42
|
-
function readable(room) {
|
|
43
|
-
const { bids, pick } = room;
|
|
44
|
-
if (pick === "legacy")
|
|
45
|
-
return (i) => bids[i].active;
|
|
46
|
-
if (pick === null) {
|
|
47
|
-
if (bids.some((b) => b.active))
|
|
48
|
-
throw new Error("refused: draw the pick first (finish aborts 44_040)");
|
|
49
|
-
return () => false;
|
|
50
|
-
}
|
|
51
|
-
if (!Number.isInteger(pick) || !bids[pick]?.active)
|
|
52
|
-
throw new Error("the pick is not an active bid");
|
|
53
|
-
return (i) => i === pick;
|
|
54
|
-
}
|
|
9
|
+
import { dummyNull } from "../pads.js";
|
|
10
|
+
import { itemClaimCommit, winnerSalt } from "./claim.js";
|
|
11
|
+
import { postedCommit } from "./listing.js";
|
|
12
|
+
import { encHash } from "./rows.js";
|
|
13
|
+
/** `sale_settle.circom` VERSION (4 since Z1), the constant `rows::fold_settle_ctx` folds. */
|
|
14
|
+
const VERSION = 4n;
|
|
15
|
+
const LEVELS = 20;
|
|
16
|
+
const rootOf = (leaf, index, path) => path.reduce((node, sib, k) => ((index >> BigInt(k)) & 1n ? poseidonHash([sib, node]) : poseidonHash([node, sib])), leaf);
|
|
17
|
+
const refuse = (why) => {
|
|
18
|
+
throw new Error(`refused: ${why}`);
|
|
19
|
+
};
|
|
55
20
|
/**
|
|
56
|
-
* Witness for `circuits/v3/sale_settle/sale_settle.circom
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* hCtx carries relayer `NO_ADDRESS` and fee 0, the only pair `sale_room::finish` rebuilds.
|
|
21
|
+
* Witness for `circuits/v3/sale_settle/sale_settle.circom` (Z1 freeze §3.5). Public signals, in order: root, nLock,
|
|
22
|
+
* nDummy, hCtx, hOut. hCtx carries relayer `NO_ADDRESS` and fee 0, the only pair `sale_room::finish` rebuilds. The
|
|
23
|
+
* buyer's change is a note under its bid key with a blind only its `ns` opens, so the seller cannot spend it.
|
|
60
24
|
*/
|
|
61
25
|
export async function plan(p) {
|
|
62
|
-
const { room,
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
26
|
+
const { room, bid, seller } = p;
|
|
27
|
+
const sellerPk = notePk(seller.sellerSk);
|
|
28
|
+
if (postedCommit({ price: p.price, salt: p.postSalt }) !== room.postedCommit)
|
|
29
|
+
refuse("the price does not open this room's posted commit");
|
|
30
|
+
if (poseidonHash([DOM_SELLER, sellerPk, poseidonHash([seller.sellerSecret])]) !== room.sellerCommit)
|
|
31
|
+
refuse("the seller keys do not open this room");
|
|
32
|
+
if (p.price < minHiddenBase(p.fee))
|
|
33
|
+
refuse("the price is under 10 x the flat fee (no witness)");
|
|
34
|
+
if (bid.amount < p.price)
|
|
35
|
+
refuse("the bid does not cover the price");
|
|
36
|
+
if (p.lock.path.length !== LEVELS)
|
|
37
|
+
refuse("a lock path is 20 levels");
|
|
38
|
+
if (p.encs.length !== 4)
|
|
39
|
+
refuse("finish carries 4 ciphertexts");
|
|
40
|
+
const w = lock5({ field: room.saleKey, ...bid });
|
|
41
|
+
if (rootOf(w.lock, p.lock.index, p.lock.path) !== p.lock.root)
|
|
42
|
+
refuse("the bid lock is not under root");
|
|
43
|
+
const lane = await flatFeeLane({ ...p.fee, base: p.price, eph: p.eph });
|
|
44
|
+
const sBlind = poseidonHash([DOM_SBLIND, seller.sellerSecret, room.saleKey]);
|
|
45
|
+
const relayerField = addrField(NO_ADDRESS);
|
|
46
|
+
const enc = encHash(p.encs);
|
|
83
47
|
const statement = {
|
|
84
|
-
|
|
48
|
+
root: p.lock.root,
|
|
49
|
+
n_lock: w.nullifier,
|
|
50
|
+
n_dummy: dummyNull(p.dummySeed),
|
|
51
|
+
seller_out: noteCommitment(p.price - lane.fee, sellerPk, sBlind),
|
|
85
52
|
fee_out: lane.fee_note,
|
|
86
|
-
|
|
53
|
+
change: noteCommitment(bid.amount - p.price, bid.ownerPk, poseidonHash([DOM_RBLIND, bid.ns])),
|
|
54
|
+
item_claim: itemClaimCommit(bid.ownerPk, winnerSalt(bid.ns)),
|
|
55
|
+
pad: noteCommitment(0n, p.pad.pk, p.pad.blinding),
|
|
87
56
|
eph_x: lane.ephX,
|
|
88
57
|
eph_y: lane.ephY,
|
|
89
58
|
fee_ct: lane.fee_ct,
|
|
90
59
|
fee_commit: lane.fee_commit,
|
|
91
60
|
};
|
|
92
|
-
const n = BigInt(room.bids.length);
|
|
93
|
-
const relayerField = addrField(NO_ADDRESS);
|
|
94
|
-
const enc = encHash(p.encs);
|
|
95
61
|
const s = statement;
|
|
96
62
|
const hCtx = poseidonHash([
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
room.boundsCommit,
|
|
63
|
+
VERSION,
|
|
64
|
+
room.postedCommit,
|
|
100
65
|
room.sellerCommit,
|
|
101
66
|
lane.fee_commit,
|
|
102
|
-
RULE_HIGHEST,
|
|
103
67
|
room.saleKey,
|
|
104
|
-
VERSION,
|
|
105
68
|
relayerField,
|
|
106
69
|
0n,
|
|
107
70
|
enc,
|
|
@@ -109,39 +72,35 @@ export async function plan(p) {
|
|
|
109
72
|
const hOut = poseidonHash([
|
|
110
73
|
s.seller_out,
|
|
111
74
|
s.fee_out,
|
|
112
|
-
s.
|
|
75
|
+
s.change,
|
|
113
76
|
s.item_claim,
|
|
114
|
-
s.
|
|
77
|
+
s.pad,
|
|
115
78
|
s.eph_x,
|
|
116
79
|
s.eph_y,
|
|
117
80
|
s.fee_ct,
|
|
118
81
|
]);
|
|
119
82
|
const input = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
values: padSlots(opened.map((o) => o?.v ?? 0n)).map(String),
|
|
123
|
-
salts: padSlots(opened.map((o) => o?.s ?? 0n)).map(String),
|
|
124
|
-
n: n.toString(),
|
|
125
|
-
activeMask: activeMask.toString(),
|
|
126
|
-
lo: bounds.lo.toString(),
|
|
127
|
-
hi: bounds.hi.toString(),
|
|
128
|
-
boundsSalt: bounds.salt.toString(),
|
|
129
|
-
hasWinner: won ? "1" : "0",
|
|
130
|
-
winner: won ? w.toString() : "0",
|
|
131
|
-
price: price.toString(),
|
|
132
|
-
amount_w: (won?.amount ?? 0n).toString(),
|
|
133
|
-
ownerPk_w: (won?.ownerPk ?? 0n).toString(),
|
|
134
|
-
ns_w: (won?.ns ?? 0n).toString(),
|
|
135
|
-
b_w: (won?.b ?? 0n).toString(),
|
|
136
|
-
sellerPk: sellerPk.toString(),
|
|
137
|
-
sellerSecret: sellerSecret.toString(),
|
|
83
|
+
price: p.price.toString(),
|
|
84
|
+
postSalt: p.postSalt.toString(),
|
|
138
85
|
roomField: room.saleKey.toString(),
|
|
139
|
-
|
|
86
|
+
sellerPk: sellerPk.toString(),
|
|
87
|
+
sellerSecret: seller.sellerSecret.toString(),
|
|
88
|
+
amount_w: bid.amount.toString(),
|
|
89
|
+
ownerPk_w: bid.ownerPk.toString(),
|
|
90
|
+
ns_w: bid.ns.toString(),
|
|
91
|
+
b_w: bid.b.toString(),
|
|
92
|
+
unlock_w: bid.unlockS.toString(),
|
|
93
|
+
lockIndex: p.lock.index.toString(),
|
|
94
|
+
lockPath: p.lock.path.map(String),
|
|
95
|
+
root: p.lock.root.toString(),
|
|
96
|
+
padPk: p.pad.pk.toString(),
|
|
97
|
+
padBlind: p.pad.blinding.toString(),
|
|
98
|
+
dummySeed: p.dummySeed.toString(),
|
|
140
99
|
relayerField: relayerField.toString(),
|
|
141
100
|
relayer_fee: "0",
|
|
142
101
|
encHash: enc.toString(),
|
|
102
|
+
...feeWitness(p.fee, p.price, p.eph, lane),
|
|
143
103
|
};
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
return { slash, input, publics, statement, sellerNote };
|
|
104
|
+
const publics = [p.lock.root, s.n_lock, s.n_dummy, hCtx, hOut];
|
|
105
|
+
return { input, publics, statement, sellerNote: { value: p.price - lane.fee, blinding: sBlind } };
|
|
147
106
|
}
|
package/dist/v3/sales/bid.d.ts
CHANGED
|
@@ -1,54 +1,25 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type CircuitInput, type SpendNote } from "../inputs.ts";
|
|
1
|
+
import { type Payload, type Recovery } from "../loans/offer-payload.ts";
|
|
3
2
|
import { type BidSecrets } from "./rows.ts";
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
saleKey: bigint;
|
|
11
|
-
seq: number;
|
|
12
|
-
postedCommit: bigint;
|
|
13
|
-
};
|
|
14
|
-
bid: BidSecrets;
|
|
15
|
-
/** The amount of the change note is what conserves value; it is computed, never passed. */
|
|
16
|
-
change: {
|
|
17
|
-
pk: bigint;
|
|
18
|
-
blinding: bigint;
|
|
19
|
-
};
|
|
20
|
-
relayer: string;
|
|
21
|
-
relayerFee: bigint;
|
|
22
|
-
/** The Seal object `sale_room::bid` pins. The proof binds its blake2b256. */
|
|
23
|
-
sealed: Uint8Array;
|
|
24
|
-
/** The proof binds it with `sealed` (`sale_room::ext_hash`). */
|
|
25
|
-
memo: Uint8Array;
|
|
26
|
-
/** `[enc_change, enc_fee]`. */
|
|
27
|
-
encs: [Uint8Array, Uint8Array];
|
|
28
|
-
fee: FeeCommitInput;
|
|
29
|
-
eph: bigint;
|
|
30
|
-
};
|
|
31
|
-
/** Everything `sale_room::bid` takes besides the pass, the proof, `sealed`, the relayer and the ciphertexts. */
|
|
32
|
-
export type LockBidStatement = {
|
|
33
|
-
root: bigint;
|
|
34
|
-
n0: bigint;
|
|
35
|
-
n1: bigint;
|
|
36
|
-
lock: bigint;
|
|
37
|
-
change: bigint;
|
|
38
|
-
feeNote: bigint;
|
|
39
|
-
commit: bigint;
|
|
40
|
-
ephX: bigint;
|
|
41
|
-
ephY: bigint;
|
|
42
|
-
feeCt: bigint;
|
|
43
|
-
feeCommit: bigint;
|
|
3
|
+
export type BidLock = {
|
|
4
|
+
pk: bigint;
|
|
5
|
+
blinding: bigint;
|
|
6
|
+
payload: Payload;
|
|
7
|
+
recovery: Recovery;
|
|
8
|
+
secrets: BidSecrets;
|
|
44
9
|
};
|
|
45
10
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
11
|
+
* PRV-28 B+C: a bid is a plain transfer into a Lock5 leaf under the room's `sale_key`, with keys from the reserved
|
|
12
|
+
* note index (Erik's condition 2). aux carries `amount_w`; `unlock_s` is the first grid second after `finish_by_ms`,
|
|
13
|
+
* so an on-time reclaim cannot race a finish (condition 4).
|
|
48
14
|
*/
|
|
49
|
-
export declare function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
15
|
+
export declare function bidLock(p: {
|
|
16
|
+
saleKey: bigint;
|
|
17
|
+
own: {
|
|
18
|
+
sk: bigint;
|
|
19
|
+
blinding: bigint;
|
|
20
|
+
};
|
|
21
|
+
noteIndex: number;
|
|
22
|
+
amount: bigint;
|
|
23
|
+
finishByMs: bigint;
|
|
24
|
+
}): BidLock;
|
|
54
25
|
//# sourceMappingURL=bid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bid.d.ts","sourceRoot":"","sources":["../../../src/v3/sales/bid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bid.d.ts","sourceRoot":"","sources":["../../../src/v3/sales/bid.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIjG,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAqBV"}
|
package/dist/v3/sales/bid.js
CHANGED
|
@@ -1,88 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { noteCommitment, noteNullifier, notePk } from "../notes/keys.js";
|
|
7
|
-
import { SLOTS, bidCommit, bidExt, lock4 } from "./rows.js";
|
|
1
|
+
import { assertU64 } from "../fees.js";
|
|
2
|
+
import { packAmount, unlockAfter } from "../loans/offer-payload.js";
|
|
3
|
+
import { lock5 } from "../locks.js";
|
|
4
|
+
import { notePk } from "../notes/keys.js";
|
|
5
|
+
import { bidSecrets } from "./rows.js";
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* PRV-28 B+C: a bid is a plain transfer into a Lock5 leaf under the room's `sale_key`, with keys from the reserved
|
|
8
|
+
* note index (Erik's condition 2). aux carries `amount_w`; `unlock_s` is the first grid second after `finish_by_ms`,
|
|
9
|
+
* so an on-time reclaim cannot race a finish (condition 4).
|
|
11
10
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
throw new Error("
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const lane = await feeLane({ ...p.fee, base: 0n, eph: p.eph });
|
|
27
|
-
const chg = p.ins[0].amount + p.ins[1].amount - p.relayerFee - bid.amount;
|
|
28
|
-
if (chg < 0n)
|
|
29
|
-
throw new Error("inputs do not cover the deposit");
|
|
30
|
-
const commitments = p.ins.map((n) => noteCommitment(n.amount, notePk(n.sk), n.blinding));
|
|
31
|
-
const [n0, n1] = p.ins.map((n, i) => noteNullifier(commitments[i], n.sk, n.pathIndex));
|
|
32
|
-
const ownerPk = notePk(bid.ownerSk);
|
|
33
|
-
const commit = bidCommit(bid.v, bid.s);
|
|
34
|
-
if (commit !== room.postedCommit)
|
|
35
|
-
throw new Error("the bid is not the room's posted price (bid aborts 44_035)");
|
|
36
|
-
const ext = bidExt({
|
|
37
|
-
room: room.id,
|
|
38
|
-
seq: room.seq,
|
|
39
|
-
relayer: p.relayer,
|
|
40
|
-
relayerFee: p.relayerFee,
|
|
41
|
-
commit,
|
|
42
|
-
sealed: p.sealed,
|
|
43
|
-
memo: p.memo,
|
|
44
|
-
encs: p.encs,
|
|
11
|
+
export function bidLock(p) {
|
|
12
|
+
assertU64("amount", p.amount);
|
|
13
|
+
if (p.amount === 0n)
|
|
14
|
+
throw new Error("the bid amount must be above 0");
|
|
15
|
+
const secrets = bidSecrets(p.own);
|
|
16
|
+
const ownerPk = notePk(secrets.ownerSk);
|
|
17
|
+
const unlockS = unlockAfter(p.finishByMs);
|
|
18
|
+
const { lockPk } = lock5({
|
|
19
|
+
field: p.saleKey,
|
|
20
|
+
ownerPk,
|
|
21
|
+
ns: secrets.ns,
|
|
22
|
+
amount: p.amount,
|
|
23
|
+
b: secrets.b,
|
|
24
|
+
unlockS,
|
|
45
25
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
feeNote: lane.fee_note,
|
|
53
|
-
commit,
|
|
54
|
-
ephX: lane.ephX,
|
|
55
|
-
ephY: lane.ephY,
|
|
56
|
-
feeCt: lane.fee_ct,
|
|
57
|
-
feeCommit: lane.fee_commit,
|
|
26
|
+
return {
|
|
27
|
+
pk: lockPk,
|
|
28
|
+
blinding: secrets.b,
|
|
29
|
+
payload: { ownerPk, ns: secrets.ns, aux: packAmount(p.amount), unlockS },
|
|
30
|
+
recovery: { amount: p.amount, field: p.saleKey, unlockS, index: BigInt(p.noteIndex) },
|
|
31
|
+
secrets,
|
|
58
32
|
};
|
|
59
|
-
const s = statement;
|
|
60
|
-
const hOuts = poseidonHash([s.lock, s.change, s.feeNote, commit, s.ephX, s.ephY, s.feeCt]);
|
|
61
|
-
const hCtx = poseidonHash([room.saleKey, lane.fee_commit, p.relayerFee]);
|
|
62
|
-
const publicAmount = p.relayerFee === 0n ? 0n : R - p.relayerFee;
|
|
63
|
-
const input = {
|
|
64
|
-
root: p.root.toString(),
|
|
65
|
-
publicAmount: publicAmount.toString(),
|
|
66
|
-
extHash: ext.toString(),
|
|
67
|
-
n0: n0.toString(),
|
|
68
|
-
n1: n1.toString(),
|
|
69
|
-
inAmount: p.ins.map((n) => n.amount.toString()),
|
|
70
|
-
inPrivateKey: p.ins.map((n) => n.sk.toString()),
|
|
71
|
-
inBlinding: p.ins.map((n) => n.blinding.toString()),
|
|
72
|
-
inPathIndices: p.ins.map((n) => n.pathIndex.toString()),
|
|
73
|
-
inPathElements: p.ins.map((n) => n.pathElements.map(String)),
|
|
74
|
-
amount: bid.amount.toString(),
|
|
75
|
-
ownerPk: ownerPk.toString(),
|
|
76
|
-
ns: bid.ns.toString(),
|
|
77
|
-
b: bid.b.toString(),
|
|
78
|
-
roomField: room.saleKey.toString(),
|
|
79
|
-
v: bid.v.toString(),
|
|
80
|
-
s: bid.s.toString(),
|
|
81
|
-
chg: chg.toString(),
|
|
82
|
-
pkC: p.change.pk.toString(),
|
|
83
|
-
bC: p.change.blinding.toString(),
|
|
84
|
-
relayer_fee: p.relayerFee.toString(),
|
|
85
|
-
...feeWitness(p.fee, 0n, p.eph, lane),
|
|
86
|
-
};
|
|
87
|
-
return { input, publics: [hOuts, hCtx, p.root, publicAmount, ext, n0, n1], statement };
|
|
88
33
|
}
|