@esseyonsui/sui-sdk-v3 0.3.3 → 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/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/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/essey.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { type KeeperActions, type KeeperIo, type KeeperSection, type KeeperVia }
|
|
|
4
4
|
import { type Fetch } from "./network.ts";
|
|
5
5
|
import { type Role } from "./v3/credential/issue.ts";
|
|
6
6
|
import { type RelayBody } from "./v3/bodies.ts";
|
|
7
|
-
import { open as openLoan, type CancelBody, type ClaimDefaultBody, type
|
|
8
|
-
import { type
|
|
7
|
+
import { open as openLoan, type CancelBody, type ClaimDefaultBody, type OpenBody, type ReclaimBody, type ReclaimCollBody, type RepayBody, type SettleBody } from "./v3/loans/bodies.ts";
|
|
8
|
+
import { type RequestMemo, type SettleMemo } from "./v3/memo.ts";
|
|
9
9
|
import { type KeeperTerms } from "./v3/keeper-payload.ts";
|
|
10
10
|
import { type FeeCommitInput, type FeeLane } from "./v3/fees.ts";
|
|
11
11
|
import { type MarketFields, type MarketRates } from "./v3/market.ts";
|
|
@@ -16,12 +16,19 @@ import { type NoteSummary, type PoolEvents } from "./v3/notes/scan.ts";
|
|
|
16
16
|
import { type Pause } from "./v3/pace.ts";
|
|
17
17
|
import type { Prover } from "./v3/prover.ts";
|
|
18
18
|
import { type Landed, type Queued, type RelayerInfo, type TicketState } from "./v3/relay/client.ts";
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The first heartbeat after a settle; a failed one leaves the landed settle standing. `stored` sends none: the
|
|
21
|
+
* settle's own expiry already reaches maturity plus grace.
|
|
22
|
+
*/
|
|
20
23
|
export type Cover = {
|
|
21
24
|
ok: true;
|
|
22
25
|
digest: string;
|
|
23
26
|
ticket: string;
|
|
24
27
|
expiryMs: bigint;
|
|
28
|
+
} | {
|
|
29
|
+
ok: true;
|
|
30
|
+
stored: true;
|
|
31
|
+
expiryMs: bigint;
|
|
25
32
|
} | {
|
|
26
33
|
ok: false;
|
|
27
34
|
code: string;
|
|
@@ -87,20 +94,17 @@ export type EsseyIo = {
|
|
|
87
94
|
data: Uint8Array;
|
|
88
95
|
aad?: Uint8Array;
|
|
89
96
|
pkg?: SealPackage;
|
|
90
|
-
origin?: string;
|
|
91
97
|
}) => Promise<Uint8Array>;
|
|
92
98
|
/**
|
|
93
99
|
* Opens `sealed` with a session key the io holds. `approve` takes that session's address and returns the
|
|
94
100
|
* `seal_approve*` call the key servers dry-run; the SDK proves the pass inside it. With `signer`, the session
|
|
95
|
-
* key must be made by it: a badge approve passes only for its holder (`keeper.move:172`).
|
|
96
|
-
* call, is a retired generation's package original id: the object's key ids live under it, not the current one.
|
|
101
|
+
* key must be made by it: a badge approve passes only for its holder (`keeper.move:172`).
|
|
97
102
|
*/
|
|
98
103
|
sealDecrypt?: (p: {
|
|
99
104
|
sealed: Uint8Array;
|
|
100
105
|
approve: (viewer: string) => Promise<SealApprove>;
|
|
101
106
|
pkg?: SealPackage;
|
|
102
107
|
signer?: Signer;
|
|
103
|
-
origin?: string;
|
|
104
108
|
}) => Promise<Uint8Array>;
|
|
105
109
|
/** Seal's derived keys for `id` under `approve`, by key server object id (48-byte G1 each), threshold many at least. */
|
|
106
110
|
sealDerivedKeys?: (p: {
|
|
@@ -108,7 +112,6 @@ export type EsseyIo = {
|
|
|
108
112
|
approve: (viewer: string) => Promise<SealApprove>;
|
|
109
113
|
pkg?: SealPackage;
|
|
110
114
|
signer?: Signer;
|
|
111
|
-
origin?: string;
|
|
112
115
|
}) => Promise<Map<string, Uint8Array>>;
|
|
113
116
|
/** One page of every `keeper::Badge`, each with its Move fields as JSON. */
|
|
114
117
|
readBadges?: (cursor: string | null) => Promise<{
|
|
@@ -121,7 +124,7 @@ export type EsseyIo = {
|
|
|
121
124
|
/** `round` is the current `Round` dynamic field. The loan JSON does not inline it. */
|
|
122
125
|
/**
|
|
123
126
|
* The loan and round `round` of its `rounds` table, the current round when `round` is omitted. `type` is the
|
|
124
|
-
* object's Move type: a loan of the record's `previous
|
|
127
|
+
* object's Move type: a loan of the record's `previous` or `previous2` `packageOrigins.loan` only takes ending kinds.
|
|
125
128
|
*/
|
|
126
129
|
readLoan?: (id: string, round?: bigint) => Promise<{
|
|
127
130
|
json: unknown;
|
|
@@ -159,8 +162,8 @@ export type EsseyIo = {
|
|
|
159
162
|
next?: string | null;
|
|
160
163
|
}>;
|
|
161
164
|
/**
|
|
162
|
-
* The `SaleRoom` fields;
|
|
163
|
-
*
|
|
165
|
+
* The `SaleRoom` fields; the `listing` is EncryptedObject bytes and the `memo` raw bytes, each in base64. `type`
|
|
166
|
+
* is the room's Move type: a room of `previous` or `previous2` `packageOrigins.sale` only takes ending kinds.
|
|
164
167
|
*/
|
|
165
168
|
readRoom?: (id: string) => Promise<{
|
|
166
169
|
json: unknown;
|
|
@@ -170,11 +173,6 @@ export type EsseyIo = {
|
|
|
170
173
|
readVault?: (id: string) => Promise<{
|
|
171
174
|
json: unknown;
|
|
172
175
|
} | null>;
|
|
173
|
-
roomBounds?: (id: string) => Promise<{
|
|
174
|
-
lo: bigint;
|
|
175
|
-
hi: bigint;
|
|
176
|
-
salt: bigint;
|
|
177
|
-
} | null>;
|
|
178
176
|
/** Signs and pays `membership::from_proof` then `sale_room::open` as the item's owner; this SDK does not sign. */
|
|
179
177
|
submitSaleOpen?: (tx: SaleOpenTx) => Promise<{
|
|
180
178
|
digest: string;
|
|
@@ -205,16 +203,14 @@ export type SaleOpenTx = {
|
|
|
205
203
|
saleKey: bigint;
|
|
206
204
|
sellerCommit: bigint;
|
|
207
205
|
sellerItemFallback: bigint;
|
|
208
|
-
|
|
209
|
-
/** PRV-24 A: `Poseidon3(DOM_BID, price, s*)`, the commit every bid must carry (44_035). */
|
|
206
|
+
/** PRV-24 A: `Poseidon3(DOM_BID, price, s*)`, the price SaleSettle charges. */
|
|
210
207
|
postedCommit: bigint;
|
|
211
|
-
/** The sealed listing (price
|
|
208
|
+
/** The sealed listing (price, `s*` and the bid key), the room's `listing`. */
|
|
212
209
|
listing: Uint8Array;
|
|
213
210
|
/** PRV-36 (c): the seller's 384-byte record memo. */
|
|
214
211
|
memo: Uint8Array;
|
|
215
212
|
closeMs: bigint;
|
|
216
213
|
finishByMs: bigint;
|
|
217
|
-
maxBids: number;
|
|
218
214
|
/** `membership::from_proof` at nonce 0 in the SPEND domain: `room` is `id_of_key(saleKey)`, `n0` the open action. */
|
|
219
215
|
pass: {
|
|
220
216
|
tag: bigint;
|
|
@@ -224,7 +220,10 @@ export type SaleOpenTx = {
|
|
|
224
220
|
n0: bigint;
|
|
225
221
|
};
|
|
226
222
|
};
|
|
227
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* What a bidder keeps from `sales.bid`: the bid's keys derive from the note key at `noteIndex`, and `amount - v` is
|
|
225
|
+
* the change a won bid gets back. The lock itself also comes back from the seed alone (`loans.recoverRecords`).
|
|
226
|
+
*/
|
|
228
227
|
export type BidRecord = {
|
|
229
228
|
room: string;
|
|
230
229
|
noteIndex: number;
|
|
@@ -236,16 +235,11 @@ export type SellerKeys = {
|
|
|
236
235
|
sellerSk: bigint;
|
|
237
236
|
sellerSecret: bigint;
|
|
238
237
|
};
|
|
239
|
-
/** What a seller keeps from `sales.open`: the keys and
|
|
238
|
+
/** What a seller keeps from `sales.open`: the keys and the bid key derive from the note key at `noteIndex`. */
|
|
240
239
|
export type SaleRecord = {
|
|
241
240
|
room: string;
|
|
242
241
|
noteIndex: number;
|
|
243
242
|
seller: SellerKeys;
|
|
244
|
-
bounds: {
|
|
245
|
-
lo: bigint;
|
|
246
|
-
hi: bigint;
|
|
247
|
-
salt: bigint;
|
|
248
|
-
};
|
|
249
243
|
};
|
|
250
244
|
/** The package whose original id names a Seal key id: `loan` (default) or `sale`, whose `pin_bid` checks it. */
|
|
251
245
|
export type SealPackage = "loan" | "sale";
|
|
@@ -269,25 +263,34 @@ export type OfferRecord = {
|
|
|
269
263
|
termMs: bigint;
|
|
270
264
|
borrowerPk?: bigint;
|
|
271
265
|
};
|
|
272
|
-
/**
|
|
266
|
+
/** An offer or bid lock this seed made: what `reclaimLock` and `collect` take, and all a recovered seed has. */
|
|
267
|
+
export type LockRef = {
|
|
268
|
+
coin: CoinKey;
|
|
269
|
+
noteIndex: number;
|
|
270
|
+
};
|
|
271
|
+
/** A refi round's posted request, as `openRefi` returns it and that round's request memo holds. */
|
|
272
|
+
export type RefiRequest = {
|
|
273
|
+
principal: bigint;
|
|
274
|
+
maxRateBps: bigint;
|
|
275
|
+
termMs: bigint;
|
|
276
|
+
};
|
|
277
|
+
export type OwnLock = LockRef & {
|
|
278
|
+
amount: bigint;
|
|
279
|
+
unlockS: bigint;
|
|
280
|
+
};
|
|
281
|
+
/** `loans.recoverRecords`: the borrower record of each own loan, and each own offer or bid lock from the seed. */
|
|
273
282
|
export type RecoveredRecords = {
|
|
274
283
|
loans: {
|
|
275
284
|
loan: string;
|
|
276
285
|
record: RequestMemo | SettleMemo;
|
|
277
286
|
}[];
|
|
278
|
-
|
|
279
|
-
loan: string;
|
|
280
|
-
round: bigint;
|
|
281
|
-
seq: number;
|
|
282
|
-
record: OfferMemo;
|
|
283
|
-
}[];
|
|
287
|
+
locks: OwnLock[];
|
|
284
288
|
};
|
|
285
289
|
/** A bidding loan's request as its sealed copy opens, checked against the loan's commits. */
|
|
286
290
|
export type LoanRequest = {
|
|
287
291
|
loan: string;
|
|
288
292
|
loanKey: bigint;
|
|
289
293
|
round: bigint;
|
|
290
|
-
seq: bigint;
|
|
291
294
|
pair: [CoinKey, CoinKey];
|
|
292
295
|
poolL: string;
|
|
293
296
|
principal: bigint;
|
|
@@ -297,6 +300,9 @@ export type LoanRequest = {
|
|
|
297
300
|
collNote: bigint;
|
|
298
301
|
salt: bigint;
|
|
299
302
|
closeMs: bigint;
|
|
303
|
+
settleByMs: bigint;
|
|
304
|
+
/** Z1 freeze §6.3: the key offers are sealed to; null on a request written before layout version 2. */
|
|
305
|
+
offerEncPub: Uint8Array | null;
|
|
300
306
|
};
|
|
301
307
|
/** Nothing has reached the relayer until `submit` is called. */
|
|
302
308
|
export type OpenQuote = {
|
|
@@ -450,19 +456,28 @@ export declare class Essey {
|
|
|
450
456
|
open(p: LoanCall<OpenBody> | LoanOpenParams): Promise<Landed | ({
|
|
451
457
|
id: string;
|
|
452
458
|
} & Landed)>;
|
|
453
|
-
|
|
454
|
-
|
|
459
|
+
/**
|
|
460
|
+
* A-D7: a member's read of a bidding loan's sealed request, checked against its commits. PRV-22 (a): the read
|
|
461
|
+
* proves an own note of the loan coin of at least `10 * F`.
|
|
462
|
+
*/
|
|
455
463
|
request(id: string): Promise<LoanRequest>;
|
|
456
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* PRV-28 B+C: offers the requested principal at the posted rate as a plain transfer into a lock only this
|
|
466
|
+
* request's borrower can find. Keep the record; the lock also comes back from the seed alone.
|
|
467
|
+
*/
|
|
457
468
|
lend(p: {
|
|
458
469
|
loan: string;
|
|
459
470
|
}): Promise<Landed & {
|
|
460
471
|
offer: OfferRecord;
|
|
472
|
+
lock: OwnLock;
|
|
461
473
|
}>;
|
|
462
|
-
/**
|
|
474
|
+
/**
|
|
475
|
+
* The lender, after repay or a refi payoff: holds the repaid note, which no ciphertext names, as an own note.
|
|
476
|
+
* `lock` alone suffices (a seed-recovered one too); `offer` only skips the search for the posted terms.
|
|
477
|
+
*/
|
|
463
478
|
collect(p: {
|
|
464
|
-
|
|
465
|
-
offer
|
|
479
|
+
lock: LockRef;
|
|
480
|
+
offer?: OfferRecord;
|
|
466
481
|
sweep?: boolean;
|
|
467
482
|
}): Promise<Collected>;
|
|
468
483
|
/** The lender, after LIQUIDATE or DEFAULT: holds its share of the seized collateral as an own note. */
|
|
@@ -480,9 +495,9 @@ export declare class Essey {
|
|
|
480
495
|
sweep?: boolean;
|
|
481
496
|
}): Promise<Collected>;
|
|
482
497
|
/**
|
|
483
|
-
* The borrower, after close:
|
|
484
|
-
*
|
|
485
|
-
*
|
|
498
|
+
* The borrower, after close: scans the loan pool for the offers sealed to its request, checks each opening, and
|
|
499
|
+
* settles on one. The terms are what `payBack` needs; keep them private. `cover` is the first heartbeat, sent as
|
|
500
|
+
* soon as the settle lands.
|
|
486
501
|
*/
|
|
487
502
|
accept(p: {
|
|
488
503
|
loan: string;
|
|
@@ -495,12 +510,13 @@ export declare class Essey {
|
|
|
495
510
|
collAmt: bigint;
|
|
496
511
|
cover: Cover;
|
|
497
512
|
}>;
|
|
498
|
-
/**
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
513
|
+
/**
|
|
514
|
+
* The one reclaim for an offer or bid lock, through the pool alone: whole once its `unlock_s` passed, less the
|
|
515
|
+
* bond F before. Refused when a settle or finish already spent it.
|
|
516
|
+
*/
|
|
517
|
+
reclaimLock(p: LockRef): Promise<Landed & {
|
|
518
|
+
value: bigint;
|
|
519
|
+
}>;
|
|
504
520
|
/** Seizes an underwater loan; the caller holds the opening and terms, as a keeper does after its Seal read. */
|
|
505
521
|
liquidate(p: {
|
|
506
522
|
loan: string;
|
|
@@ -557,6 +573,7 @@ export declare class Essey {
|
|
|
557
573
|
}): Promise<Landed & {
|
|
558
574
|
round: bigint;
|
|
559
575
|
closeMs: bigint;
|
|
576
|
+
request: RefiRequest;
|
|
560
577
|
}>;
|
|
561
578
|
/**
|
|
562
579
|
* The borrower takes the pick of its open refi round, as `accept` does: the old lender is paid `terms.owed`. The
|
|
@@ -567,6 +584,8 @@ export declare class Essey {
|
|
|
567
584
|
terms: KeeperTerms;
|
|
568
585
|
borrowerPk: bigint;
|
|
569
586
|
collAmt: bigint;
|
|
587
|
+
/** What `openRefi` returned. Left out, the round's request is read from its request memo; no Seal key is read. */
|
|
588
|
+
request?: RefiRequest;
|
|
570
589
|
}): Promise<Landed & {
|
|
571
590
|
rateBps: bigint;
|
|
572
591
|
terms: KeeperTerms;
|
|
@@ -576,11 +595,6 @@ export declare class Essey {
|
|
|
576
595
|
cancelRefi(id: string): Promise<Landed>;
|
|
577
596
|
/** The borrower cancels its bidding loan (borrower pass over `request::cancel`). */
|
|
578
597
|
cancelOwn(id: string): Promise<Landed>;
|
|
579
|
-
/** The borrower, after close: marks offer `seq` inactive when its sealed plaintext does not open its commit. */
|
|
580
|
-
slash(p: {
|
|
581
|
-
loan: string;
|
|
582
|
-
seq: number;
|
|
583
|
-
}): Promise<Landed>;
|
|
584
598
|
/** A keeper: marks a loan whose retained borrower keeper ciphertext does not open its lock (`keeper::prove_ct_fault`). */
|
|
585
599
|
fault(p: {
|
|
586
600
|
loan: string;
|
|
@@ -603,8 +617,8 @@ export declare class Essey {
|
|
|
603
617
|
}>;
|
|
604
618
|
/**
|
|
605
619
|
* PRV-36 (c): every borrower and lender record of this seed, rebuilt from the loans' memos alone (SCOPE-R1-MEMO
|
|
606
|
-
* D6). A borrower record carries terms once settled. Not rebuilt: a refi round's request, which
|
|
607
|
-
* a top-up after the last settle, which no memo records.
|
|
620
|
+
* D6). A borrower record carries terms once settled. Not rebuilt: a refi round's request, which `settleRefi` reads
|
|
621
|
+
* from that round's memo itself, and a top-up after the last settle, which no memo records.
|
|
608
622
|
*/
|
|
609
623
|
recoverRecords(): Promise<RecoveredRecords>;
|
|
610
624
|
/** The borrower, after repay: the whole collateral back to its own key, and the loan closes. */
|
|
@@ -685,8 +699,9 @@ export declare class Essey {
|
|
|
685
699
|
list(): Promise<OpenSale[]>;
|
|
686
700
|
view(id: string): Promise<MySaleView>;
|
|
687
701
|
/**
|
|
688
|
-
* PRV-24 A: reads the room's sealed listing and bids its posted price,
|
|
689
|
-
*
|
|
702
|
+
* PRV-24 A, PRV-28 B+C: reads the room's sealed listing (with a funds proof, PRV-22 a) and bids its posted price,
|
|
703
|
+
* refused when that is above `maxPrice`, as a plain transfer of `amount` (default the price) into a lock only the
|
|
704
|
+
* seller can find. Keep the record.
|
|
690
705
|
*/
|
|
691
706
|
bid(p: {
|
|
692
707
|
room: string;
|
|
@@ -694,35 +709,31 @@ export declare class Essey {
|
|
|
694
709
|
amount?: bigint;
|
|
695
710
|
}): Promise<Landed & {
|
|
696
711
|
bid: BidRecord;
|
|
712
|
+
lock: OwnLock;
|
|
697
713
|
}>;
|
|
698
|
-
/**
|
|
714
|
+
/**
|
|
715
|
+
* The seller, after close: scans the sale pool for the bids sealed to its listing, checks each opening, and
|
|
716
|
+
* settles on one at the posted price. A room with no usable bid ends through `expire`.
|
|
717
|
+
*/
|
|
699
718
|
finish(p: {
|
|
700
719
|
room: string;
|
|
701
720
|
vault: string;
|
|
702
721
|
seller: SellerKeys;
|
|
703
|
-
bounds: {
|
|
704
|
-
lo: bigint;
|
|
705
|
-
hi: bigint;
|
|
706
|
-
salt: bigint;
|
|
707
|
-
};
|
|
708
|
-
}): Promise<Landed>;
|
|
709
|
-
/** The seller, after close: marks the room's pick inactive when its sealed plaintext does not open its commit and lock. */
|
|
710
|
-
slash(p: {
|
|
711
|
-
room: string;
|
|
712
722
|
}): Promise<Landed>;
|
|
713
723
|
/** Anyone, once the finish window passed unsettled: the item returns to the seller's fallback claim. */
|
|
714
724
|
expire(p: {
|
|
715
725
|
room: string;
|
|
716
726
|
vault: string;
|
|
717
727
|
}): Promise<Landed>;
|
|
718
|
-
/**
|
|
719
|
-
|
|
720
|
-
|
|
728
|
+
/**
|
|
729
|
+
* A bidder takes back its bid's lock through the pool alone (the one reclaim of offers and bids): whole once its
|
|
730
|
+
* `unlock_s` passed, less the bond F before. Refused when a finish already spent it.
|
|
731
|
+
*/
|
|
732
|
+
/** The winner, after finish: holds its change (`amount - v`), a note under its bid key, as an own note. */
|
|
733
|
+
collectChange(p: {
|
|
721
734
|
bid: BidRecord;
|
|
722
|
-
|
|
723
|
-
}): Promise<
|
|
724
|
-
value: bigint;
|
|
725
|
-
}>;
|
|
735
|
+
sweep?: boolean;
|
|
736
|
+
}): Promise<Collected>;
|
|
726
737
|
/** The winner (its bid record) or the seller (its keys) sends the vault's item to `recipient`, or to `itemAddress()`. */
|
|
727
738
|
claim(p: {
|
|
728
739
|
vault: string;
|
|
@@ -734,7 +745,7 @@ export declare class Essey {
|
|
|
734
745
|
}>;
|
|
735
746
|
/** PRV-35: a fresh single-use address of this seed; an item there opens a sale from it with no hand-over. */
|
|
736
747
|
itemAddress(): string;
|
|
737
|
-
/** The seller,
|
|
748
|
+
/** The seller, while open: its pass over the room's next "cancel" action. Bids come back at their `unlock_s`. */
|
|
738
749
|
cancel(p: {
|
|
739
750
|
room: string;
|
|
740
751
|
vault: string;
|
|
@@ -754,6 +765,7 @@ export declare class Essey {
|
|
|
754
765
|
private readonly feeOpenings;
|
|
755
766
|
/** Loan snapshot openings by `coin:commit`, apart from `feeOpenings`, which follows the config as it stands. */
|
|
756
767
|
private readonly snapshotOpenings;
|
|
768
|
+
private readonly feeLanes;
|
|
757
769
|
private constructor();
|
|
758
770
|
static connect(o: ConnectOptions, io?: EsseyIo): Promise<Essey>;
|
|
759
771
|
private paced;
|
|
@@ -838,7 +850,7 @@ export declare class Essey {
|
|
|
838
850
|
private reserve;
|
|
839
851
|
private member;
|
|
840
852
|
private prover;
|
|
841
|
-
/** Pins in the config still need a prover. An empty `
|
|
853
|
+
/** Pins in the config still need a prover. An empty `circuitsZ1` object is the pre-bring-up record. */
|
|
842
854
|
private missingProver;
|
|
843
855
|
private faucet;
|
|
844
856
|
private badgeGrant;
|
|
@@ -939,51 +951,47 @@ export declare class Essey {
|
|
|
939
951
|
*/
|
|
940
952
|
private planOpen;
|
|
941
953
|
private saleGate;
|
|
942
|
-
/**
|
|
954
|
+
/** DECISION-R1-MIGRATION A: a loan whose type names a `previous` or `previous2` loan origin is draining. */
|
|
943
955
|
private retired;
|
|
944
|
-
/** An R1 loan under the Z1 record: R1's keeper policy and Seal namespace, and the shapes of a current loan. */
|
|
945
|
-
private drainedLoan;
|
|
946
|
-
private sealOrigin;
|
|
947
956
|
/**
|
|
948
957
|
* A draining loan takes no opening kind (request read, offer, refi open) and none whose call changed shape in R1
|
|
949
958
|
* (pick, settle, refi settle); it still cancels, repays, releases, reclaims, collects, tops up and heartbeats.
|
|
950
959
|
*/
|
|
951
960
|
private refuseRetired;
|
|
961
|
+
/** Erik ruling 3 (A): this SDK proves with `circuitsZ1` keys only, so a draining loan's proof is 0.3.x's to make. */
|
|
962
|
+
private refuseRetiredLoanProof;
|
|
952
963
|
/** PRV-27 (b): past a step boundary nearer than the landing margin first, then the close `loan::check_close` takes. */
|
|
953
964
|
private loanClose;
|
|
954
965
|
/** The coins of the market a loan names, as `C/L` in the deployment record. */
|
|
955
966
|
private pairOf;
|
|
956
967
|
private readRequest;
|
|
957
968
|
/**
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* The lender's `loan_offer`: the principal locked to the round from up to two own notes, its sealed terms pinned.
|
|
964
|
-
* PRV-23 A, SCOPE-R1-MOVE-BATCH D10: the rate is the posted one, so offers differ in nothing the winner draw weighs.
|
|
969
|
+
* The borrower's own request, rebuilt with no Seal read and so no funds proof: round 0 from its request memo, which
|
|
970
|
+
* this seed's memo key opens; a refi round from `refi` when given, else from that round's request memo
|
|
971
|
+
* (`refi::open_refi`). The salt derives from the loan key's note index, the offer key from `offerRecvKey`. It must
|
|
972
|
+
* open `req_commit`.
|
|
965
973
|
*/
|
|
966
|
-
private
|
|
967
|
-
/** `seal_policy::seal_approve_offer` for offer `seq`: the borrower's SEAL pass over `seal_offer` bound to the viewer. */
|
|
968
|
-
private offerApprove;
|
|
974
|
+
private ownRequest;
|
|
969
975
|
/**
|
|
970
|
-
*
|
|
971
|
-
* the
|
|
972
|
-
* with them. An honest offer aborts 42_013, after the keys are public, so it is refused here before they are asked
|
|
973
|
-
* for. No penalty: the lock is reclaimed once the round resolves.
|
|
976
|
+
* PRV-22 (a), freeze D24: the funds proof a request or listing read needs, from the largest own note of `coin` at
|
|
977
|
+
* the floor `10 * F` of `fee`. A member with none is refused before any proof or network call.
|
|
974
978
|
*/
|
|
975
|
-
private
|
|
979
|
+
private fundsWitness;
|
|
976
980
|
/**
|
|
977
|
-
* PRV-
|
|
978
|
-
*
|
|
979
|
-
*
|
|
981
|
+
* PRV-28 B+C: an offer is a plain `pool::transfer` whose first output is a Lock5 leaf under the round's field, with
|
|
982
|
+
* fresh keys from a reserved note index (Erik's condition 2), the payload sealed to the request's offer key in slots
|
|
983
|
+
* 0 and 2, and the recovery record sealed to this seed in slot 3 (condition 3). `unlock_s` is the first grid second
|
|
984
|
+
* after the round's settle deadline (condition 4).
|
|
980
985
|
*/
|
|
981
|
-
private
|
|
986
|
+
private lend;
|
|
987
|
+
/** An offer or a bid: `spend` with the lock as out0, through the transfer path a payment takes (freeze §6.2). */
|
|
988
|
+
private lockTransfer;
|
|
982
989
|
/**
|
|
983
|
-
* The
|
|
984
|
-
*
|
|
990
|
+
* The borrower's offer scan (PRV-28 B+C, freeze §6.1): every lock of the loan pool sealed to this round's offer key
|
|
991
|
+
* that rebuilds to its slot-0 leaf under the round's field at the principal, binds its enc point (ruling R5), unlocks
|
|
992
|
+
* after the settle deadline (Erik's condition 4) and is unspent, with the tree a settle proves it in.
|
|
985
993
|
*/
|
|
986
|
-
private
|
|
994
|
+
private receivedOffers;
|
|
987
995
|
/** Threshold many derived keys, each with its server's slot in `config.seal.servers` (`seal_servers::public_keys` order). */
|
|
988
996
|
private pinnedKeys;
|
|
989
997
|
/**
|
|
@@ -998,10 +1006,7 @@ export declare class Essey {
|
|
|
998
1006
|
*/
|
|
999
1007
|
private retainedOpens;
|
|
1000
1008
|
private activeLoan;
|
|
1001
|
-
/**
|
|
1002
|
-
* Either policy entry for key id `id`; the badge one carries the signer its Seal session must be made by. An R1 loan
|
|
1003
|
-
* under the Z1 record is read through R1's own keeper policy and registry, and a badge is of the current registry.
|
|
1004
|
-
*/
|
|
1009
|
+
/** Either policy entry for key id `id`; the badge one carries the signer its Seal session must be made by. */
|
|
1005
1010
|
private keeperApproval;
|
|
1006
1011
|
private heldBadge;
|
|
1007
1012
|
/**
|
|
@@ -1020,7 +1025,9 @@ export declare class Essey {
|
|
|
1020
1025
|
* market in the deployment stands in for the argument.
|
|
1021
1026
|
*/
|
|
1022
1027
|
private keeperFeed;
|
|
1023
|
-
/** The
|
|
1028
|
+
/** The market's price inputs a settle proves its LTV line at (PRV-03 B): `refi::settle_refi`'s rows. */
|
|
1029
|
+
private settlePrice;
|
|
1030
|
+
/** The borrower's `loan_settle` on round 0: one offer from its scan, keeper ciphertext v1 carries its terms. */
|
|
1024
1031
|
private planSettle;
|
|
1025
1032
|
private settleMemo;
|
|
1026
1033
|
/** The borrower's `loan_repay`: `owed` to the lender's note by ECDH on its enc key, change back to own key. */
|
|
@@ -1028,9 +1035,16 @@ export declare class Essey {
|
|
|
1028
1035
|
/**
|
|
1029
1036
|
* The repaid note is `Poseidon(owed, lenderPk, H(DOM_LBLIND, S.x))` with `S = encSk · repay_eph`
|
|
1030
1037
|
* (`loan_repay.circom`), and a refi payoff the same over a `payoff_eph` pair (`loan_refi.circom`); either ciphertext
|
|
1031
|
-
* is filler, so the scan never sees it; `owned` finds it through the state file's `held` list.
|
|
1038
|
+
* is filler, so the scan never sees it; `owned` finds it through the state file's `held` list. Erik's PRV-28
|
|
1039
|
+
* condition 3: the seed alone suffices. The slot-3 record gives the principal and the lock's field, the field names
|
|
1040
|
+
* the loan and round, and `owed` is found among the posted terms a request can carry (rate 0..10000 bps, a term
|
|
1041
|
+
* on `TERM_STEPS`); an OfferRecord's rate and term only skip that search.
|
|
1032
1042
|
*/
|
|
1033
1043
|
private collect;
|
|
1044
|
+
/** Every `owed` a request for `principal` can post: rate 0..10000 bps by `TERM_STEPS` terms, lowest rate first. */
|
|
1045
|
+
private postedOwed;
|
|
1046
|
+
/** The listed loan one of whose rounds has lock field `field` (`loan::lock_field`), as `readLoan` serves it. */
|
|
1047
|
+
private loanOfLock;
|
|
1034
1048
|
/** Refuses a spent note. `sweep` moves it to the receive address now; otherwise it is held for the next spend. */
|
|
1035
1049
|
private take;
|
|
1036
1050
|
/** Spends a note no ciphertext names, found by its commitment, to the receive address. */
|
|
@@ -1043,7 +1057,7 @@ export declare class Essey {
|
|
|
1043
1057
|
private collectSurplus;
|
|
1044
1058
|
/**
|
|
1045
1059
|
* A seizure leaves the lock's nonce one past the one it folded and `coll_note` as it was. `out` 0 pays
|
|
1046
|
-
* `seize -
|
|
1060
|
+
* `seize - kf` to the lender (seizures pay no protocol fee), 1 pays `avail - seize` to the borrower, each at `outputBlind(blind, out, nonce)`.
|
|
1047
1061
|
* The split is recomputed from the `p_spot` the seizing call claimed (`io.readSeizure`).
|
|
1048
1062
|
*/
|
|
1049
1063
|
private collectFromSeizure;
|
|
@@ -1060,12 +1074,13 @@ export declare class Essey {
|
|
|
1060
1074
|
/** The borrower's pass over `kind` and its args, at the loan's next action nonce. */
|
|
1061
1075
|
private borrowerPass;
|
|
1062
1076
|
/**
|
|
1063
|
-
* `refi::open_refi`: the request of round r+1 over the lock as it stands, sealed under the loan's request key
|
|
1064
|
-
* derives from the lock's note index and the
|
|
1077
|
+
* `refi::open_refi`: the request of round r+1 over the lock as it stands, sealed under the loan's request key, and
|
|
1078
|
+
* its request memo for round r+1 under this seed's memo key. The salt derives from the lock's note index and the
|
|
1079
|
+
* round, so the seed alone reopens it.
|
|
1065
1080
|
*/
|
|
1066
1081
|
private openRefi;
|
|
1067
1082
|
/**
|
|
1068
|
-
* `refi::settle_refi`: the round's offers
|
|
1083
|
+
* `refi::settle_refi`: the round's offers found as `planSettle` finds them, the borrower's own refi request, the
|
|
1069
1084
|
* payoff to the old lender's enc key, and a pass bound to the exact reading the market's oracle builds.
|
|
1070
1085
|
*/
|
|
1071
1086
|
private settleRefiOwn;
|
|
@@ -1083,8 +1098,14 @@ export declare class Essey {
|
|
|
1083
1098
|
* round and slot, so a memo sealed for another seed, or copied into another loan, does not open.
|
|
1084
1099
|
*/
|
|
1085
1100
|
private recoverRecords;
|
|
1086
|
-
/**
|
|
1087
|
-
private
|
|
1101
|
+
/** Every offer and bid lock this seed made, from the slot-3 recovery records of each pool (freeze §6.4). */
|
|
1102
|
+
private ownLocks;
|
|
1103
|
+
/**
|
|
1104
|
+
* PRV-28 C, freeze D21: the one reclaim for offer and bid locks, naming the pool and its fee config only. The lock
|
|
1105
|
+
* comes back from the seed: note index `noteIndex`'s slot-3 recovery record gives its amount, field and `unlock_s`
|
|
1106
|
+
* (Erik's condition 3). Before `unlock_s` the circuit charges the bond F (condition 4).
|
|
1107
|
+
*/
|
|
1108
|
+
private reclaimOwnLock;
|
|
1088
1109
|
/**
|
|
1089
1110
|
* The lock as it stands: the open blinding at nonce 1, rolled one re-lock per heartbeat (`rollTo` refuses an opening
|
|
1090
1111
|
* that does not reach the stored `coll_note`).
|
|
@@ -1094,6 +1115,8 @@ export declare class Essey {
|
|
|
1094
1115
|
/**
|
|
1095
1116
|
* PRV-15: until a loan's first heartbeat every keeper may read its terms (`keeper.move:204`), so this follows the
|
|
1096
1117
|
* settle at once and unpaced. A heartbeat may follow a settle at once: `hb_at_ms` is 0 (`liquidation.move:199`).
|
|
1118
|
+
* A short term whose settle-stored expiry (`collateral.move:244`) already reaches maturity plus grace needs none:
|
|
1119
|
+
* no heartbeat may cover past that (`health.circom:301`), and keepers read only once it lapses (`keeper.move:212`).
|
|
1097
1120
|
*/
|
|
1098
1121
|
private firstCover;
|
|
1099
1122
|
/** The loan reader is an indexer that may trail the landed settle. */
|
|
@@ -1138,8 +1161,10 @@ export declare class Essey {
|
|
|
1138
1161
|
private listLoans;
|
|
1139
1162
|
/** D-SPEC §6.2:589. */
|
|
1140
1163
|
private viewLoan;
|
|
1141
|
-
/**
|
|
1142
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* D-SPEC §6.2:599. The seller pass over `sale_room::open_args`, at action nonce 0; the relayer or the callback pays.
|
|
1166
|
+
* The seller keys, the posted salt and the bid key derive from one reserved note index, so the seed reopens them.
|
|
1167
|
+
*/
|
|
1143
1168
|
private openSale;
|
|
1144
1169
|
/** PRV-27 (b), `sale_room::check_grid` (44_041): the close and finish a sale opening about now must carry. */
|
|
1145
1170
|
private saleWindow;
|
|
@@ -1158,34 +1183,35 @@ export declare class Essey {
|
|
|
1158
1183
|
private viewSale;
|
|
1159
1184
|
/**
|
|
1160
1185
|
* The room, refused for `kind` when its type names a retired sale package that does not take it
|
|
1161
|
-
* (DECISION-R1-MIGRATION A, `sales/package-gate.ts`).
|
|
1186
|
+
* (DECISION-R1-MIGRATION A, `sales/package-gate.ts`).
|
|
1162
1187
|
*/
|
|
1163
1188
|
private saleRoom;
|
|
1164
1189
|
private bidSecrets;
|
|
1165
1190
|
private nowMs;
|
|
1166
1191
|
private assertBeforeClose;
|
|
1167
1192
|
/**
|
|
1168
|
-
* `sale_room::seal_approve_listing
|
|
1169
|
-
*
|
|
1193
|
+
* `sale_room::seal_approve_listing` (freeze D24): a SEAL pass under a fresh non-zero nonce, bound to the viewer, so
|
|
1194
|
+
* two reads show two tags, and a funds proof of an own sale-coin note of at least `10 * F` of the accepted hidden
|
|
1195
|
+
* fee opening, bound to that pass's Seal bind and nonce (PRV-22 a).
|
|
1170
1196
|
*/
|
|
1171
1197
|
private readRoomListing;
|
|
1172
1198
|
private placeBid;
|
|
1173
|
-
/**
|
|
1174
|
-
private bidApprove;
|
|
1175
|
-
/** `seal_approve_bid` releases keys from close until `finish_by_ms`, for an active bid (`sale_room.move:337-341`). */
|
|
1199
|
+
/** Finish runs from close until `finish_by_ms` (`sale_room::check_finish`). */
|
|
1176
1200
|
private closedRoom;
|
|
1177
|
-
/** PRV-24 A: only the room's pick is slashed (44_039); a slash clears it, so `finish` draws again. */
|
|
1178
|
-
private slashBid;
|
|
1179
|
-
private finishSale;
|
|
1180
1201
|
/**
|
|
1181
|
-
* PRV-
|
|
1182
|
-
*
|
|
1202
|
+
* The seller's scan (PRV-28 B+C): every lock of the sale pool sealed to this listing's bid key that rebuilds to its
|
|
1203
|
+
* slot-0 leaf under `sale_key`, covers the price, unlocks after `finish_by_ms` and is unspent; one is settled on.
|
|
1204
|
+
* The price comes back from the seller's memo and must open `posted_commit` (checked in `sales/auctioneer.ts`).
|
|
1183
1205
|
*/
|
|
1184
|
-
private
|
|
1206
|
+
private finishSale;
|
|
1185
1207
|
private indexOfSellerKey;
|
|
1186
1208
|
private expireSale;
|
|
1187
1209
|
private cancelSale;
|
|
1188
|
-
|
|
1210
|
+
/**
|
|
1211
|
+
* Freeze §3.5: a won bid's change is `Note(amount - v, ownerPk_w, Poseidon2(DOM_RBLIND, ns_w))`, a note under the
|
|
1212
|
+
* bid's own key that no ciphertext names. It is found by its commitment and held (or swept) as an own note.
|
|
1213
|
+
*/
|
|
1214
|
+
private collectBidChange;
|
|
1189
1215
|
private claimItem;
|
|
1190
1216
|
private prepareOpen;
|
|
1191
1217
|
}
|