@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.
Files changed (134) hide show
  1. package/dist/config.d.ts +3 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/errors.d.ts +3 -1
  5. package/dist/errors.d.ts.map +1 -1
  6. package/dist/errors.js +5 -0
  7. package/dist/essey.d.ts +157 -131
  8. package/dist/essey.d.ts.map +1 -1
  9. package/dist/essey.js +641 -823
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/network.d.ts +2 -0
  14. package/dist/network.d.ts.map +1 -1
  15. package/dist/network.js +17 -3
  16. package/dist/v3/collateral/bodies.d.ts +23 -14
  17. package/dist/v3/collateral/bodies.d.ts.map +1 -1
  18. package/dist/v3/collateral/bodies.js +42 -35
  19. package/dist/v3/collateral/ext.d.ts +18 -13
  20. package/dist/v3/collateral/ext.d.ts.map +1 -1
  21. package/dist/v3/collateral/ext.js +5 -6
  22. package/dist/v3/collateral/health.d.ts +16 -10
  23. package/dist/v3/collateral/health.d.ts.map +1 -1
  24. package/dist/v3/collateral/health.js +55 -30
  25. package/dist/v3/collateral/math.d.ts +0 -2
  26. package/dist/v3/collateral/math.d.ts.map +1 -1
  27. package/dist/v3/collateral/math.js +0 -5
  28. package/dist/v3/collateral/openings.d.ts +5 -1
  29. package/dist/v3/collateral/openings.d.ts.map +1 -1
  30. package/dist/v3/collateral/openings.js +7 -12
  31. package/dist/v3/credential/membership.d.ts +16 -2
  32. package/dist/v3/credential/membership.d.ts.map +1 -1
  33. package/dist/v3/credential/membership.js +36 -3
  34. package/dist/v3/domains.d.ts +9 -0
  35. package/dist/v3/domains.d.ts.map +1 -1
  36. package/dist/v3/domains.js +5 -0
  37. package/dist/v3/fees.d.ts +13 -1
  38. package/dist/v3/fees.d.ts.map +1 -1
  39. package/dist/v3/fees.js +32 -2
  40. package/dist/v3/funds.d.ts +34 -0
  41. package/dist/v3/funds.d.ts.map +1 -0
  42. package/dist/v3/funds.js +60 -0
  43. package/dist/v3/keeper-payload.d.ts +29 -7
  44. package/dist/v3/keeper-payload.d.ts.map +1 -1
  45. package/dist/v3/keeper-payload.js +33 -22
  46. package/dist/v3/kinds.d.ts +6 -6
  47. package/dist/v3/kinds.d.ts.map +1 -1
  48. package/dist/v3/kinds.js +5 -13
  49. package/dist/v3/loans/bodies.d.ts +40 -68
  50. package/dist/v3/loans/bodies.d.ts.map +1 -1
  51. package/dist/v3/loans/bodies.js +50 -73
  52. package/dist/v3/loans/offer-payload.d.ts +109 -0
  53. package/dist/v3/loans/offer-payload.d.ts.map +1 -0
  54. package/dist/v3/loans/offer-payload.js +207 -0
  55. package/dist/v3/loans/offer-plan.d.ts +8 -60
  56. package/dist/v3/loans/offer-plan.d.ts.map +1 -1
  57. package/dist/v3/loans/offer-plan.js +19 -95
  58. package/dist/v3/loans/open-plan.d.ts +15 -5
  59. package/dist/v3/loans/open-plan.d.ts.map +1 -1
  60. package/dist/v3/loans/open-plan.js +18 -7
  61. package/dist/v3/loans/reclaim-plan.d.ts +31 -15
  62. package/dist/v3/loans/reclaim-plan.d.ts.map +1 -1
  63. package/dist/v3/loans/reclaim-plan.js +63 -32
  64. package/dist/v3/loans/refi-plan.d.ts +8 -34
  65. package/dist/v3/loans/refi-plan.d.ts.map +1 -1
  66. package/dist/v3/loans/refi-plan.js +30 -111
  67. package/dist/v3/loans/repay-plan.d.ts.map +1 -1
  68. package/dist/v3/loans/repay-plan.js +2 -2
  69. package/dist/v3/loans/settle-plan.d.ts +88 -53
  70. package/dist/v3/loans/settle-plan.d.ts.map +1 -1
  71. package/dist/v3/loans/settle-plan.js +141 -150
  72. package/dist/v3/locks.d.ts +21 -0
  73. package/dist/v3/locks.d.ts.map +1 -0
  74. package/dist/v3/locks.js +15 -0
  75. package/dist/v3/memo.d.ts +14 -4
  76. package/dist/v3/memo.d.ts.map +1 -1
  77. package/dist/v3/memo.js +14 -7
  78. package/dist/v3/notes/derive.d.ts +5 -0
  79. package/dist/v3/notes/derive.d.ts.map +1 -1
  80. package/dist/v3/notes/derive.js +5 -0
  81. package/dist/v3/pace.d.ts +0 -1
  82. package/dist/v3/pace.d.ts.map +1 -1
  83. package/dist/v3/pace.js +0 -1
  84. package/dist/v3/pads.d.ts +15 -0
  85. package/dist/v3/pads.d.ts.map +1 -0
  86. package/dist/v3/pads.js +25 -0
  87. package/dist/v3/prover.d.ts +1 -1
  88. package/dist/v3/prover.d.ts.map +1 -1
  89. package/dist/v3/prover.js +1 -0
  90. package/dist/v3/relay/client.d.ts.map +1 -1
  91. package/dist/v3/relay/client.js +2 -2
  92. package/dist/v3/sales/auctioneer.d.ts +32 -27
  93. package/dist/v3/sales/auctioneer.d.ts.map +1 -1
  94. package/dist/v3/sales/auctioneer.js +67 -108
  95. package/dist/v3/sales/bid.d.ts +20 -49
  96. package/dist/v3/sales/bid.d.ts.map +1 -1
  97. package/dist/v3/sales/bid.js +28 -83
  98. package/dist/v3/sales/bodies.d.ts +4 -54
  99. package/dist/v3/sales/bodies.d.ts.map +1 -1
  100. package/dist/v3/sales/bodies.js +10 -52
  101. package/dist/v3/sales/claim.d.ts +0 -2
  102. package/dist/v3/sales/claim.d.ts.map +1 -1
  103. package/dist/v3/sales/claim.js +6 -8
  104. package/dist/v3/sales/index.d.ts +0 -1
  105. package/dist/v3/sales/index.d.ts.map +1 -1
  106. package/dist/v3/sales/index.js +0 -1
  107. package/dist/v3/sales/listing.d.ts +8 -6
  108. package/dist/v3/sales/listing.d.ts.map +1 -1
  109. package/dist/v3/sales/listing.js +27 -9
  110. package/dist/v3/sales/open-kind.d.ts +1 -3
  111. package/dist/v3/sales/open-kind.d.ts.map +1 -1
  112. package/dist/v3/sales/open-kind.js +2 -3
  113. package/dist/v3/sales/outcome.d.ts +5 -8
  114. package/dist/v3/sales/outcome.d.ts.map +1 -1
  115. package/dist/v3/sales/outcome.js +5 -9
  116. package/dist/v3/sales/package-gate.d.ts +3 -4
  117. package/dist/v3/sales/package-gate.d.ts.map +1 -1
  118. package/dist/v3/sales/package-gate.js +9 -7
  119. package/dist/v3/sales/rows.d.ts +9 -49
  120. package/dist/v3/sales/rows.d.ts.map +1 -1
  121. package/dist/v3/sales/rows.js +17 -91
  122. package/dist/v3/sales/seller.d.ts +2 -6
  123. package/dist/v3/sales/seller.d.ts.map +1 -1
  124. package/dist/v3/sales/seller.js +4 -11
  125. package/dist/v3/stage1.d.ts +8 -21
  126. package/dist/v3/stage1.d.ts.map +1 -1
  127. package/dist/v3/stage1.js +8 -76
  128. package/package.json +1 -1
  129. package/dist/v3/loans/lock-round.d.ts +0 -22
  130. package/dist/v3/loans/lock-round.d.ts.map +0 -1
  131. package/dist/v3/loans/lock-round.js +0 -20
  132. package/dist/v3/sales/reclaim.d.ts +0 -46
  133. package/dist/v3/sales/reclaim.d.ts.map +0 -1
  134. package/dist/v3/sales/reclaim.js +0 -57
@@ -1,118 +1,42 @@
1
1
  import { poseidonHash } from "@mysten/sui/zklogin";
2
2
  import { EsseyError } from "../../errors.js";
3
- import { valueAt } from "../collateral/math.js";
4
3
  import { termsCommit as termsCommitOf } from "../collateral/openings.js";
5
- import { DOM_A6, DOM_A6D, DOM_A6O, DOM_A6P, DOM_LBLIND, DOM_LNULL, DOM_PRICE, DOM_TSALT, R, } from "../domains.js";
6
- import { feeWitness } from "../fee-witness.js";
7
- import { ecdhBlind, feeLane, fieldAdd } from "../fees.js";
4
+ import { DOM_A6, DOM_A6D, DOM_A6O, DOM_A6P, DOM_LBLIND, R } from "../domains.js";
5
+ import { ecdhBlind } from "../fees.js";
6
+ import { lockField } from "../locks.js";
8
7
  import { noteCommitment } from "../notes/keys.js";
9
- import { lock4, lockField, offerCommit } from "./offer-plan.js";
10
- import { SETTLE_SLOTS, interest, pickedSlot } from "./settle-plan.js";
8
+ import { dummyNull } from "../pads.js";
9
+ import { lockedTerms } from "./settle-plan.js";
11
10
  export const LOAN_REFI_KIND = 15;
12
- /** Witness and Move arguments of `circuits/v3/loan_refi/loan_refi.circom` (`ref.mjs` loanRefiCase). */
11
+ /** Witness and Move arguments of `circuits/v3/loan_refi/loan_refi.circom` (freeze §3.2). */
13
12
  export async function loanRefi(p) {
14
- const { request: q, slots, old, price } = p;
15
- if (slots.length > SETTLE_SLOTS)
16
- throw new Error("more than 16 offers");
17
- const w = pickedSlot(slots, q.maxRateBps);
18
- const win = slots[w].open;
13
+ const { request: q, old } = p;
14
+ if (p.round === 0n)
15
+ throw new EsseyError("INVALID_ARGUMENT", "refused: round 0 is not a refinance");
19
16
  const field = lockField(p.loanKey, p.round);
20
- for (const s of slots) {
21
- if (!s.active || !s.open)
22
- continue;
23
- const o = s.open;
24
- if (offerCommit(o.rateBps, o.salt, o.lenderPk, o.encX, o.encY) !== s.commit)
25
- throw new Error("an offer does not open its commit");
26
- if (lock4(field, o.lenderPk, o.ns, o.amount, o.b) !== s.lock)
27
- throw new Error("an offer does not open its lock");
28
- }
29
- const pad = (pick, zero) => Array.from({ length: SETTLE_SLOTS }, (_, i) => (slots[i] ? pick(slots[i]) : zero));
30
- const opened = (pick) => pad((s) => (s.open ? pick(s.open) : 0n), 0n);
31
- const commits = pad((s) => (s.active ? s.commit : 0n), 0n);
32
- const locks = pad((s) => s.lock, 0n);
33
- const actMask = slots.reduce((m, s, i) => (s.active ? m | (1n << BigInt(i)) : m), 0n);
34
- const term = interest(q.principal, win.rateBps, q.termMs);
35
- const terms = {
36
- principal: q.principal,
37
- rateBps: win.rateBps,
38
- owed: term.owed,
39
- maturityS: p.nowS + term.qTerm,
40
- lenderPk: win.lenderPk,
41
- lenderEncX: win.encX,
42
- lenderEncY: win.encY,
43
- salt: poseidonHash([DOM_TSALT, field, win.ns]),
44
- };
45
- const termsCommit = termsCommitOf(terms, q.borrowerPk);
46
- const value = valueAt(q.collAmt, price.pClaim, { cDec: price.cDec, lDec: price.lDec, expo: price.expo });
47
- if (term.owed * 10000n > value.q * price.ltvBps)
48
- throw new EsseyError("INVALID_ARGUMENT", "refused: the new debt is over the ltv bound");
49
- const lane = await feeLane({ ...p.fee, base: q.principal, eph: p.eph });
17
+ const t = await lockedTerms(p, field);
18
+ const { lane } = t;
50
19
  const rest = q.principal - old.owed - lane.fee;
51
20
  if (rest < 0n)
52
21
  throw new EsseyError("INVALID_ARGUMENT", "refused: the new principal does not pay what the loan owes now plus the fee");
53
22
  const borrowerNote = noteCommitment(rest, p.borrowerNote.pk, p.borrowerNote.blinding);
54
23
  const kP = await ecdhBlind(old.lenderEncX, old.lenderEncY, p.eP);
55
24
  const payoffNote = noteCommitment(old.owed, old.lenderPk, poseidonHash([DOM_LBLIND, kP.sx]));
56
- const padNote = noteCommitment(0n, p.pad.pk, p.pad.blinding);
57
- const winNull = poseidonHash([DOM_LNULL, win.ns, slots[w].lock]);
58
- const k = await ecdhBlind(win.encX, win.encY, p.e);
59
- const d = [
60
- k.ephX,
61
- k.ephY,
62
- fieldAdd(q.collAmt, poseidonHash([k.sx, 1n])),
63
- fieldAdd(q.collBlind, poseidonHash([k.sx, 2n])),
64
- ];
25
+ const pad = noteCommitment(0n, p.pad.pk, p.pad.blinding);
26
+ const nDummy = dummyNull(p.dummySeed);
65
27
  const ephP = [kP.ephX, kP.ephY];
66
- const reqCommit = poseidonHash([q.principal, q.maxRateBps, q.termMs, q.borrowerPk, q.collNote, q.salt]);
67
- const priceDigest = poseidonHash([
68
- DOM_PRICE,
69
- price.pClaim,
70
- price.expo,
71
- price.cDec,
72
- price.lDec,
73
- price.ltvBps,
74
- ]);
75
28
  const publics = [
76
- poseidonHash(commits),
77
- poseidonHash(locks),
78
- poseidonHash([DOM_A6, reqCommit, field, actMask, p.nowS, lane.fee_commit, p.fee.version, p.extHash, 0n]),
79
- poseidonHash([DOM_A6O, termsCommit, borrowerNote, lane.fee_note, winNull, payoffNote, padNote]),
80
- poseidonHash([DOM_A6D, ...d, lane.ephX, lane.ephY, lane.fee_ct, ...ephP]),
81
- poseidonHash([DOM_A6P, termsCommitOf(old, q.borrowerPk), q.collNote, priceDigest]),
29
+ p.lock.root,
30
+ t.nLock,
31
+ nDummy,
32
+ poseidonHash([DOM_A6, t.reqCommit, field, p.nowS, lane.fee_commit, p.fee.version, p.extHash, 0n]),
33
+ poseidonHash([DOM_A6O, t.termsCommit, borrowerNote, lane.fee_note, payoffNote, pad]),
34
+ poseidonHash([DOM_A6D, ...t.d, lane.ephX, lane.ephY, lane.fee_ct, ...ephP]),
35
+ poseidonHash([DOM_A6P, termsCommitOf(old, q.borrowerPk), q.collNote, t.priceDigest]),
82
36
  ];
83
- const s = (xs) => xs.map(String);
84
37
  const input = {
85
- commits: s(commits),
86
- locks: s(locks),
87
- rate: s(opened((o) => o.rateBps)),
88
- salt: s(opened((o) => o.salt)),
89
- lenderPk: s(opened((o) => o.lenderPk)),
90
- encX: s(opened((o) => o.encX)),
91
- encY: s(opened((o) => o.encY)),
92
- actMask: actMask.toString(),
93
- winner: String(w),
94
- winRate: win.rateBps.toString(),
38
+ ...t.input,
95
39
  round: p.round.toString(),
96
- ns_w: win.ns.toString(),
97
- b_w: win.b.toString(),
98
- q_term: term.qTerm.toString(),
99
- r_term: term.rTerm.toString(),
100
- q_intr: term.qIntr.toString(),
101
- r_intr: term.rIntr.toString(),
102
- principal: q.principal.toString(),
103
- max_rate_bps: q.maxRateBps.toString(),
104
- term_ms: q.termMs.toString(),
105
- borrowerPk: q.borrowerPk.toString(),
106
- collAmt: q.collAmt.toString(),
107
- collBlind: q.collBlind.toString(),
108
- salt_req: q.salt.toString(),
109
- loanKey: p.loanKey.toString(),
110
- pkB: p.borrowerNote.pk.toString(),
111
- blindB: p.borrowerNote.blinding.toString(),
112
- e: p.e.toString(),
113
- now_s: p.nowS.toString(),
114
- extHash: p.extHash.toString(),
115
- relayer_fee: "0",
116
40
  principalOld: old.principal.toString(),
117
41
  rateOld: old.rateBps.toString(),
118
42
  owedOld: old.owed.toString(),
@@ -122,35 +46,30 @@ export async function loanRefi(p) {
122
46
  encYOld: old.lenderEncY.toString(),
123
47
  saltOld: old.salt.toString(),
124
48
  eP: p.eP.toString(),
125
- pClaim: price.pClaim.toString(),
126
- expo: price.expo.toString(),
127
- c_dec: price.cDec.toString(),
128
- l_dec: price.lDec.toString(),
129
- ltv_bps: price.ltvBps.toString(),
130
- q_v: value.q.toString(),
131
- r_v: value.r.toString(),
132
49
  padPk: p.pad.pk.toString(),
133
50
  padBlind: p.pad.blinding.toString(),
134
- ...feeWitness(p.fee, q.principal, p.eph, lane),
51
+ dummySeed: p.dummySeed.toString(),
135
52
  };
136
53
  if (publics.some((x) => x >= R))
137
54
  throw new Error("a public signal is not a field element");
138
55
  return {
139
56
  input,
140
57
  publics,
141
- winner: w,
142
- terms,
143
- termsCommit,
58
+ terms: t.terms,
59
+ hRest: t.hRest,
60
+ termsCommit: t.termsCommit,
144
61
  borrowerNote,
145
62
  borrowerValue: rest,
146
63
  feeNote: lane.fee_note,
147
- winNull,
148
- d,
64
+ nLock: t.nLock,
65
+ nDummy,
66
+ d: t.d,
149
67
  ephX: lane.ephX,
150
68
  ephY: lane.ephY,
151
69
  feeCt: lane.fee_ct,
152
70
  payoffNote,
153
- pad: padNote,
71
+ pad,
154
72
  ephP,
73
+ priceDigest: t.priceDigest,
155
74
  };
156
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repay-plan.d.ts","sourceRoot":"","sources":["../../../src/v3/loans/repay-plan.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,S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;KAAE,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,yJAAyJ;AACzJ,wBAAsB,SAAS,CAAC,CAAC,EAAE,eAAe;;;;;;;;;UA6DpB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;GAM7C"}
@@ -2,13 +2,13 @@ import { poseidonHash } from "@mysten/sui/zklogin";
2
2
  import { termsCommit } from "../collateral/openings.js";
3
3
  import { DOM_A3, DOM_LBLIND } from "../domains.js";
4
4
  import { feeWitness } from "../fee-witness.js";
5
- import { ecdhBlind, feeLane } from "../fees.js";
5
+ import { ecdhBlind, flatFeeLane } from "../fees.js";
6
6
  import { noteCommitment, noteNullifier, notePk } from "../notes/keys.js";
7
7
  export const LOAN_REPAY_KIND = 14;
8
8
  /** Witness for `circuits/v3/loan_repay/loan_repay.circom` (`ref.mjs` loanRepayCase). Publics: lender_note, change, fee_note, pad, hCtx, root, n0, n1. */
9
9
  export async function loanRepay(p) {
10
10
  const t = p.terms;
11
- const lane = await feeLane({ ...p.fee, base: t.owed, eph: p.eph });
11
+ const lane = await flatFeeLane({ ...p.fee, base: t.owed, eph: p.eph });
12
12
  const changeAmount = p.ins[0].amount + p.ins[1].amount - t.owed - lane.fee - p.relayerFee;
13
13
  if (changeAmount < 0n)
14
14
  throw new Error("inputs do not cover what is owed and its fee");
@@ -1,12 +1,8 @@
1
1
  import { type FeeCommitInput } from "../fees.ts";
2
2
  import type { CircuitInput } from "../inputs.ts";
3
- import { type OfferPlain } from "./offer-plan.ts";
4
- export declare const SETTLE_SLOTS = 16;
3
+ import type { KeeperTerms } from "../keeper-payload.ts";
5
4
  export declare const LOAN_SETTLE_KIND = 13;
6
- /** The 208-byte offer plaintext `offerPlaintext` writes. */
7
- export declare function decodeOffer(plain: Uint8Array): OfferPlain;
8
- /** `loan::opens`: an honest offer plaintext, the one `offer::slash` aborts 42_013 on. */
9
- export declare function offerOpens(plain: Uint8Array, field: bigint, commit: bigint, lock: bigint): boolean;
5
+ export declare const LOCK_LEVELS = 20;
10
6
  /** `crypto.mjs` interest: whole seconds of the term, and interest rounded up over 365 days of 10_000 bps. */
11
7
  export declare function interest(principal: bigint, rateBps: bigint, termMs: bigint): {
12
8
  qTerm: bigint;
@@ -15,94 +11,133 @@ export declare function interest(principal: bigint, rateBps: bigint, termMs: big
15
11
  rIntr: bigint;
16
12
  owed: bigint;
17
13
  };
18
- /** One stored offer slot: its commit and lock as the round holds them, and its opening when active. */
19
- export type SettleSlot = {
20
- commit: bigint;
21
- lock: bigint;
22
- active: boolean;
23
- open?: OfferPlain;
14
+ export type SettleRequest = {
15
+ principal: bigint;
16
+ maxRateBps: bigint;
17
+ termMs: bigint;
18
+ borrowerPk: bigint;
19
+ collAmt: bigint;
20
+ collBlind: bigint;
21
+ collNote: bigint;
22
+ salt: bigint;
23
+ };
24
+ /** The offer's lock opening from its payload (freeze §6.1): the lender's keys, `ns`, the blind and `unlock_s`. */
25
+ export type OfferOpening = {
26
+ lenderPk: bigint;
27
+ ns: bigint;
28
+ b: bigint;
29
+ unlockS: bigint;
30
+ encX: bigint;
31
+ encY: bigint;
32
+ };
33
+ /** The offer's leaf in the loan pool's tree: its index and depth-20 path to `root`. */
34
+ export type LockPath = {
35
+ root: bigint;
36
+ index: bigint;
37
+ path: bigint[];
38
+ };
39
+ export type SettlePrice = {
40
+ pClaim: bigint;
41
+ expo: bigint;
42
+ cDec: bigint;
43
+ lDec: bigint;
44
+ ltvBps: bigint;
45
+ };
46
+ type Keyed = {
47
+ pk: bigint;
48
+ blinding: bigint;
24
49
  };
25
50
  export type LoanSettleParams = {
26
- slots: SettleSlot[];
27
- request: {
28
- principal: bigint;
29
- maxRateBps: bigint;
30
- termMs: bigint;
31
- borrowerPk: bigint;
32
- collAmt: bigint;
33
- collBlind: bigint;
34
- collNote: bigint;
35
- salt: bigint;
36
- };
51
+ request: SettleRequest;
37
52
  loanKey: bigint;
38
- borrowerNote: {
39
- pk: bigint;
40
- blinding: bigint;
41
- };
53
+ offer: OfferOpening;
54
+ lock: LockPath;
55
+ borrowerNote: Keyed;
56
+ pads: [Keyed, Keyed];
57
+ dummySeed: bigint;
42
58
  e: bigint;
43
59
  nowS: bigint;
44
60
  extHash: bigint;
45
61
  fee: FeeCommitInput;
46
62
  eph: bigint;
63
+ price: SettlePrice;
47
64
  };
65
+ /** What settle and refinance both read. */
66
+ export type LockedParams = Omit<LoanSettleParams, "pads" | "dummySeed">;
67
+ /** `lib/merkle.circom`: bit k of the index puts path[k] on the left. */
68
+ export declare function lockRoot(leaf: bigint, index: bigint, path: bigint[]): bigint;
48
69
  /**
49
- * PRV-23 A: the winner is the round's pick, the one active slot. `loan::settle_rows` (`loan.move:507-513`) folds the
50
- * pick's commit alone with `actMask = 1 << pick`, so a witness with any other active slot fails the proof.
70
+ * What settle and refinance share (freeze §3.1, §3.2): the lock opened under `field` at the posted principal and
71
+ * found at `root`, the posted-rate terms, the LTV line on `owed`, the flat fee and the collateral delivery.
72
+ * Each refusal is one the circuit has no witness for, so it is said before a proof is spent.
51
73
  */
52
- export declare function pickedSlot(slots: SettleSlot[], maxRate: bigint): number;
53
- /** Witness and Move arguments of `circuits/v3/loan_settle/loan_settle.circom` (`ref.mjs` loanSettleCase, round 0). */
74
+ export declare function lockedTerms(p: LockedParams, field: bigint): Promise<{
75
+ input: CircuitInput;
76
+ terms: KeeperTerms;
77
+ hRest: bigint;
78
+ termsCommit: bigint;
79
+ lane: import("../fees.ts").FeeLaneResult;
80
+ d: [bigint, bigint, bigint, bigint];
81
+ nLock: bigint;
82
+ reqCommit: bigint;
83
+ priceDigest: bigint;
84
+ }>;
85
+ /** Witness and Move arguments of `circuits/v3/loan_settle/loan_settle.circom` (freeze §3.1), round 0. */
54
86
  export declare function loanSettle(p: LoanSettleParams): Promise<{
55
87
  input: CircuitInput;
56
88
  publics: bigint[];
57
- winner: number;
58
- terms: {
59
- principal: bigint;
60
- rateBps: bigint;
61
- owed: bigint;
62
- maturityS: bigint;
63
- lenderPk: bigint;
64
- lenderEncX: bigint;
65
- lenderEncY: bigint;
66
- salt: bigint;
67
- };
89
+ terms: KeeperTerms;
90
+ hRest: bigint;
68
91
  termsCommit: bigint;
69
92
  principalNote: bigint;
70
93
  principalValue: bigint;
71
- winNull: bigint;
94
+ nLock: bigint;
95
+ nDummy: bigint;
96
+ pads: [bigint, bigint];
72
97
  d: [bigint, bigint, bigint, bigint];
73
98
  feeNote: bigint;
74
99
  ephX: bigint;
75
100
  ephY: bigint;
76
101
  feeCt: bigint;
102
+ priceDigest: bigint;
77
103
  }>;
78
104
  /** `loan::action_hash`: blake2b256("ess3/act/" ‖ kind ‖ "/" ‖ bcs(loan_key) ‖ bcs(nonce) ‖ args) mod R. */
79
105
  export declare function actionHash(blake: (b: Uint8Array) => Uint8Array, loanKey: bigint, nonce: bigint, kind: string, args: Uint8Array): bigint;
80
- /** `settle::settle_args`: every argument in declaration order, shared objects by id, vectors and the proof as bcs. */
106
+ /**
107
+ * `settle::settle_args` (Z1): every argument in declaration order, shared objects by id, the reading as the bcs of
108
+ * the struct (`readingBytes`), vectors and the proof as bcs; the pass and the clock left out.
109
+ */
81
110
  export declare function settleArgs(a: {
82
111
  loan: string;
83
112
  poolL: string;
113
+ market: string;
114
+ reading: Uint8Array;
84
115
  proof: Uint8Array;
116
+ root: bigint;
117
+ nLock: bigint;
118
+ nDummy: bigint;
85
119
  termsCommit: bigint;
86
120
  principalNote: bigint;
87
121
  feeNote: bigint;
88
- winNull: bigint;
122
+ pad0: bigint;
123
+ pad1: bigint;
89
124
  d: bigint[];
90
125
  ephX: bigint;
91
126
  ephY: bigint;
92
127
  feeCt: bigint;
128
+ pClaim: bigint;
93
129
  keeperCt: Uint8Array;
94
130
  encs: Uint8Array[];
95
131
  nowS: bigint;
96
132
  memo: Uint8Array;
97
133
  }): Uint8Array;
98
- /** `membership::seal_offer(room, round, seq, viewer).bind`. */
99
- export declare const sealOfferBind: (blake: (b: Uint8Array) => Uint8Array, room: string, round: bigint, seq: bigint, viewer: string) => Uint8Array<ArrayBufferLike>;
100
- /** `refi::open_refi_args`: the loan and pool by id, `req_commit`, the sealed request as bcs, `close_ms`. */
134
+ /** `refi::open_refi_args`: the loan and pool by id, `req_commit`, the sealed request and memo as bcs, `close_ms`. */
101
135
  export declare const openRefiArgs: (a: {
102
136
  loan: string;
103
137
  poolL: string;
104
138
  reqCommit: bigint;
105
139
  reqSealed: Uint8Array;
140
+ memo: Uint8Array;
106
141
  closeMs: bigint;
107
142
  }) => Uint8Array;
108
143
  /** `liquidation::topup_args`: every `topup_by_borrower` argument after the pass, in order, by `settle_args`' rule. */
@@ -112,8 +147,6 @@ export declare function topupArgs(a: {
112
147
  market: string;
113
148
  lockProof: Uint8Array;
114
149
  fields: bigint[];
115
- encChange: Uint8Array;
116
- encFee: Uint8Array;
117
150
  keeperCt: Uint8Array;
118
151
  proof: Uint8Array;
119
152
  outs: bigint[];
@@ -122,17 +155,19 @@ export declare function topupArgs(a: {
122
155
  }): Uint8Array;
123
156
  /** `refi::cancel_refi_args`: the loan and pool by id. */
124
157
  export declare const cancelRefiArgs: (loan: string, poolL: string) => Uint8Array;
125
- /** `refi::settle_refi_args`: `settle_args`' rule with the market, the reading's bcs, the payoff pair and `p_claim`. */
158
+ /** `refi::settle_refi_args` (Z1): `settle_args`' rule with the payoff pair, the pad and one `encs` of 4. */
126
159
  export declare function settleRefiArgs(a: {
127
160
  loan: string;
128
161
  poolL: string;
129
162
  market: string;
130
163
  reading: Uint8Array;
131
164
  proof: Uint8Array;
165
+ root: bigint;
166
+ nLock: bigint;
167
+ nDummy: bigint;
132
168
  termsCommit: bigint;
133
169
  borrowerNote: bigint;
134
170
  feeNote: bigint;
135
- winNull: bigint;
136
171
  d: bigint[];
137
172
  ephX: bigint;
138
173
  ephY: bigint;
@@ -143,7 +178,6 @@ export declare function settleRefiArgs(a: {
143
178
  pClaim: bigint;
144
179
  keeperCt: Uint8Array;
145
180
  encs: Uint8Array[];
146
- encsP: Uint8Array[];
147
181
  nowS: bigint;
148
182
  memo: Uint8Array;
149
183
  }): Uint8Array;
@@ -156,4 +190,5 @@ export declare const readingBytes: (r: {
156
190
  expo: bigint;
157
191
  publishS: bigint;
158
192
  }) => Uint8Array;
193
+ export {};
159
194
  //# sourceMappingURL=settle-plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settle-plan.d.ts","sourceRoot":"","sources":["../../../src/v3/loans/settle-plan.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjF,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,gBAAgB,KAAK,CAAC;AASnC,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAYzD;AAaD,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CASlG;AAED,6GAA6G;AAC7G,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;EAU1E;AAED,uGAAuG;AACvG,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAE9F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,OAAO,EAAE;QACP,SAAS,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