@esseyonsui/sui-sdk-v3 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/errors.d.ts +5 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -0
- package/dist/essey.d.ts +61 -9
- package/dist/essey.d.ts.map +1 -1
- package/dist/essey.js +266 -56
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/v3/collateral/local-health.d.ts +3 -2
- package/dist/v3/collateral/local-health.d.ts.map +1 -1
- package/dist/v3/collateral/local-health.js +2 -6
- package/dist/v3/index.d.ts +1 -0
- package/dist/v3/index.d.ts.map +1 -1
- package/dist/v3/index.js +1 -0
- package/dist/v3/keeper-badge.d.ts +3 -1
- package/dist/v3/keeper-badge.d.ts.map +1 -1
- package/dist/v3/keeper-badge.js +2 -2
- package/dist/v3/notes/denominations.d.ts +4 -0
- package/dist/v3/notes/denominations.d.ts.map +1 -1
- package/dist/v3/notes/denominations.js +23 -7
- package/dist/v3/notes/withdraw.d.ts +7 -0
- package/dist/v3/notes/withdraw.d.ts.map +1 -1
- package/dist/v3/notes/withdraw.js +47 -0
- package/dist/v3/pace.d.ts +43 -0
- package/dist/v3/pace.d.ts.map +1 -0
- package/dist/v3/pace.js +42 -0
- package/dist/v3/relay/client.d.ts +0 -8
- package/dist/v3/relay/client.d.ts.map +1 -1
- package/dist/v3/relay/client.js +0 -17
- package/dist/v3/stage1.d.ts +2 -2
- package/dist/v3/stage1.d.ts.map +1 -1
- package/dist/v3/stage1.js +4 -4
- package/package.json +1 -1
|
@@ -16,11 +16,13 @@ export type BadgeApproveParams = {
|
|
|
16
16
|
loan: string;
|
|
17
17
|
market: string;
|
|
18
18
|
price: string;
|
|
19
|
+
/** The market reads the TEST-ONLY stand-in feed: the `_standin` entry, whose price is a stand-in object. */
|
|
20
|
+
standin: boolean;
|
|
19
21
|
badge: string;
|
|
20
22
|
passKey: string;
|
|
21
23
|
registry: string;
|
|
22
24
|
};
|
|
23
|
-
/** `keeper::seal_approve_keeper` (`keeper.move:113-123`) in its argument order. */
|
|
25
|
+
/** `keeper::seal_approve_keeper` (`keeper.move:113-123`), or its `_standin` twin, in its argument order. */
|
|
24
26
|
export declare function badgeApprove(p: BadgeApproveParams): {
|
|
25
27
|
target: string;
|
|
26
28
|
typeArguments: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keeper-badge.d.ts","sourceRoot":"","sources":["../../src/v3/keeper-badge.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,kJAAkJ;AAClJ,wBAAsB,aAAa,CAAC,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAc3E;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,EAAE,EAAE,UAAU,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"keeper-badge.d.ts","sourceRoot":"","sources":["../../src/v3/keeper-badge.ts"],"names":[],"m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({ onlyTransactionKind: true }));
|
|
22
22
|
}
|
|
23
|
-
/** `keeper::seal_approve_keeper` (`keeper.move:113-123`) in its argument order. */
|
|
23
|
+
/** `keeper::seal_approve_keeper` (`keeper.move:113-123`), or its `_standin` twin, in its argument order. */
|
|
24
24
|
export function badgeApprove(p) {
|
|
25
25
|
return {
|
|
26
|
-
target: `${p.pkg}::keeper::seal_approve_keeper`,
|
|
26
|
+
target: `${p.pkg}::keeper::seal_approve_keeper${p.standin ? "_standin" : ""}`,
|
|
27
27
|
typeArguments: p.typeArguments,
|
|
28
28
|
args: [
|
|
29
29
|
{ pure: "vector<u8>", value: `0x${Buffer.from(p.id).toString("hex")}` },
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* its execute is already funded: `recoverStranded` lands it.
|
|
6
6
|
*/
|
|
7
7
|
export declare const MAX_SPLIT_PIECES = 29;
|
|
8
|
+
/** The greedy sum at or below `amount`: the largest there is when each denomination divides the next larger. */
|
|
9
|
+
export declare function denominationFloor(amount: bigint, list: string[]): bigint;
|
|
10
|
+
/** How many pieces the greedy split of `amount` has, its remainder aside. */
|
|
11
|
+
export declare function pieceCount(amount: bigint, list: string[]): bigint;
|
|
8
12
|
/**
|
|
9
13
|
* D-SPEC:76: fixed edge amounts. Greedy, largest first; an amount the list cannot sum to exactly is refused.
|
|
10
14
|
* Counted before a piece is built, so no amount allocates past the cap.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"denominations.d.ts","sourceRoot":"","sources":["../../../src/v3/notes/denominations.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"denominations.d.ts","sourceRoot":"","sources":["../../../src/v3/notes/denominations.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAkBnC,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAExE;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAW3E"}
|
|
@@ -10,22 +10,38 @@ const refuse = (what) => {
|
|
|
10
10
|
* its execute is already funded: `recoverStranded` lands it.
|
|
11
11
|
*/
|
|
12
12
|
export const MAX_SPLIT_PIECES = 29;
|
|
13
|
-
|
|
14
|
-
* D-SPEC:76: fixed edge amounts. Greedy, largest first; an amount the list cannot sum to exactly is refused.
|
|
15
|
-
* Counted before a piece is built, so no amount allocates past the cap.
|
|
16
|
-
*/
|
|
17
|
-
export function splitDenominations(amount, list) {
|
|
18
|
-
if (amount <= 0n)
|
|
19
|
-
refuse("amount must be above 0");
|
|
13
|
+
function sizesOf(list) {
|
|
20
14
|
const sizes = list.map((d) => decimal(d, "denomination")).sort((a, b) => (a > b ? -1 : a < b ? 1 : 0));
|
|
21
15
|
if (sizes.length === 0 || sizes.some((d) => d === 0n))
|
|
22
16
|
refuse("the coin has no usable denominations");
|
|
17
|
+
return sizes;
|
|
18
|
+
}
|
|
19
|
+
function greedy(amount, sizes) {
|
|
23
20
|
let left = amount;
|
|
24
21
|
const counts = sizes.map((size) => {
|
|
25
22
|
const count = left / size;
|
|
26
23
|
left -= count * size;
|
|
27
24
|
return count;
|
|
28
25
|
});
|
|
26
|
+
return { counts, left };
|
|
27
|
+
}
|
|
28
|
+
/** The greedy sum at or below `amount`: the largest there is when each denomination divides the next larger. */
|
|
29
|
+
export function denominationFloor(amount, list) {
|
|
30
|
+
return amount - greedy(amount, sizesOf(list)).left;
|
|
31
|
+
}
|
|
32
|
+
/** How many pieces the greedy split of `amount` has, its remainder aside. */
|
|
33
|
+
export function pieceCount(amount, list) {
|
|
34
|
+
return greedy(amount, sizesOf(list)).counts.reduce((sum, count) => sum + count, 0n);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* D-SPEC:76: fixed edge amounts. Greedy, largest first; an amount the list cannot sum to exactly is refused.
|
|
38
|
+
* Counted before a piece is built, so no amount allocates past the cap.
|
|
39
|
+
*/
|
|
40
|
+
export function splitDenominations(amount, list) {
|
|
41
|
+
if (amount <= 0n)
|
|
42
|
+
refuse("amount must be above 0");
|
|
43
|
+
const sizes = sizesOf(list);
|
|
44
|
+
const { counts, left } = greedy(amount, sizes);
|
|
29
45
|
if (left !== 0n)
|
|
30
46
|
refuse("amount is not a sum of the coin's denominations");
|
|
31
47
|
const total = counts.reduce((sum, count) => sum + count, 0n);
|
|
@@ -18,4 +18,11 @@ export declare const transferValue: (total: bigint, relayerFee: bigint) => bigin
|
|
|
18
18
|
export declare function exitValue(total: bigint, rates: FeeRates, relayerFee: bigint): bigint;
|
|
19
19
|
/** js4 spends two notes. One note that covers `need` is preferred; otherwise the two largest. */
|
|
20
20
|
export declare function pickInputs(owned: OwnNote[], need: bigint): OwnNote[];
|
|
21
|
+
export declare function withdrawPieces(amount: bigint, list: string[]): bigint[];
|
|
22
|
+
/** Each piece pays its own fees, so fewer, larger pieces can fit where a larger sum of smaller ones does not. */
|
|
23
|
+
export declare function exitPieces(total: bigint, list: string[], rates: FeeRates, relayerFee: bigint): bigint[];
|
|
24
|
+
export declare const exitKept: (total: bigint, pieces: bigint[], rates: FeeRates, relayerFee: bigint) => bigint;
|
|
25
|
+
export declare function piecePayees(pieces: number, to: string[]): string[];
|
|
26
|
+
/** Each piece is its own js4 of at most two notes into one change note (`pickInputs`), so all are planned first. */
|
|
27
|
+
export declare function refuseUncovered(owned: OwnNote[], pieces: bigint[], rates: FeeRates, relayerFee: bigint): void;
|
|
21
28
|
//# sourceMappingURL=withdraw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../../src/v3/notes/withdraw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../../src/v3/notes/withdraw.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,EAAE,OAAO,QAAQ,EAAE,YAAY,MAAM,WACvB,CAAC;AAgBtD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAMpF;AAED,+GAA+G;AAC/G,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EAAE,EAChB,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,MAAM,GACjB,IAAI,CAWN;AAED,2HAA2H;AAC3H,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,YAAY,MAAM,WACjB,CAAC;AAE/C,0GAA0G;AAC1G,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CASpF;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAOpE;AAkBD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAQvE;AAKD,iHAAiH;AACjH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAYvG;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,EAAE,OAAO,QAAQ,EAAE,YAAY,MAAM,WAClD,CAAC;AAE5C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAQlE;AAED,oHAAoH;AACpH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,MAAM,GACjB,IAAI,CAQN"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EsseyError } from "../../errors.js";
|
|
2
2
|
import { feeOf } from "../fees.js";
|
|
3
|
+
import { denominationFloor, MAX_SPLIT_PIECES, pieceCount, splitDenominations } from "./denominations.js";
|
|
3
4
|
export const withdrawCost = (wd, rates, relayerFee) => wd + feeOf({ base: wd, ...rates }).fee + relayerFee;
|
|
4
5
|
const U64 = (1n << 64n) - 1n;
|
|
5
6
|
/** The smallest d in [from, to] where `ok` holds, or to + 1; `ok` stays true once true. */
|
|
@@ -63,3 +64,49 @@ export function pickInputs(owned, need) {
|
|
|
63
64
|
return two;
|
|
64
65
|
throw new EsseyError("INVALID_ARGUMENT", "refused: two notes do not cover the amount and its fees");
|
|
65
66
|
}
|
|
67
|
+
const refuse = (what) => {
|
|
68
|
+
throw new EsseyError("INVALID_ARGUMENT", what);
|
|
69
|
+
};
|
|
70
|
+
/** The MCP server withholds a message with seven digits in a row (`packages/mcp-v3/src/failure.ts:48`). */
|
|
71
|
+
const grouped = (n) => n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
|
72
|
+
function cappedSplit(amount, list) {
|
|
73
|
+
const count = pieceCount(amount, list);
|
|
74
|
+
if (count > BigInt(MAX_SPLIT_PIECES))
|
|
75
|
+
refuse(`refused: ${count} pieces is more than the ${MAX_SPLIT_PIECES} one call pays out; nothing was sent`);
|
|
76
|
+
return splitDenominations(amount, list);
|
|
77
|
+
}
|
|
78
|
+
export function withdrawPieces(amount, list) {
|
|
79
|
+
const floor = denominationFloor(amount, list);
|
|
80
|
+
if (floor !== amount)
|
|
81
|
+
refuse(`refused: ${grouped(amount)} is not a sum of the coin's denominations; the largest below it is ${grouped(floor)}. ` +
|
|
82
|
+
"retry with that, or pass force: true for one exact withdraw to one address; nothing was sent");
|
|
83
|
+
return cappedSplit(amount, list);
|
|
84
|
+
}
|
|
85
|
+
const costOf = (pieces, rates, relayerFee) => pieces.reduce((sum, piece) => sum + withdrawCost(piece, rates, relayerFee), 0n);
|
|
86
|
+
/** Each piece pays its own fees, so fewer, larger pieces can fit where a larger sum of smaller ones does not. */
|
|
87
|
+
export function exitPieces(total, list, rates, relayerFee) {
|
|
88
|
+
for (let target = denominationFloor(exitValue(total, rates, relayerFee), list); target > 0n; target = denominationFloor(target - 1n, list)) {
|
|
89
|
+
const pieces = cappedSplit(target, list);
|
|
90
|
+
if (costOf(pieces, rates, relayerFee) <= total)
|
|
91
|
+
return pieces;
|
|
92
|
+
}
|
|
93
|
+
return refuse("refused: the notes do not cover the smallest denomination and its fees; pass force: true to exit them exactly");
|
|
94
|
+
}
|
|
95
|
+
export const exitKept = (total, pieces, rates, relayerFee) => total - costOf(pieces, rates, relayerFee);
|
|
96
|
+
export function piecePayees(pieces, to) {
|
|
97
|
+
if (new Set(to).size !== to.length)
|
|
98
|
+
refuse("refused: to lists an address twice; each piece goes to a different address; nothing was sent");
|
|
99
|
+
if (to.length < pieces)
|
|
100
|
+
refuse(`refused: ${pieces} pieces need ${pieces} different to addresses, one each; ${to.length} given; nothing was sent`);
|
|
101
|
+
return to.slice(0, pieces);
|
|
102
|
+
}
|
|
103
|
+
/** Each piece is its own js4 of at most two notes into one change note (`pickInputs`), so all are planned first. */
|
|
104
|
+
export function refuseUncovered(owned, pieces, rates, relayerFee) {
|
|
105
|
+
let notes = owned;
|
|
106
|
+
for (const piece of pieces) {
|
|
107
|
+
const cost = withdrawCost(piece, rates, relayerFee);
|
|
108
|
+
const used = pickInputs(notes, cost);
|
|
109
|
+
const change = used.reduce((sum, n) => sum + n.value, 0n) - cost;
|
|
110
|
+
notes = [...notes.filter((n) => !used.includes(n)), { ...used[0], value: change }];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type PaceClass = "long" | "medium" | "short";
|
|
2
|
+
export declare const PACED: {
|
|
3
|
+
readonly transfer: "long";
|
|
4
|
+
readonly withdraw: "long";
|
|
5
|
+
readonly exit: "long";
|
|
6
|
+
readonly collect: "long";
|
|
7
|
+
readonly collect_seized: "long";
|
|
8
|
+
readonly collect_surplus: "long";
|
|
9
|
+
readonly reclaim_offer: "long";
|
|
10
|
+
readonly reclaim_collateral: "long";
|
|
11
|
+
readonly sale_reclaim: "long";
|
|
12
|
+
readonly repay: "medium";
|
|
13
|
+
readonly release: "medium";
|
|
14
|
+
readonly offer: "medium";
|
|
15
|
+
readonly bid: "medium";
|
|
16
|
+
readonly settle: "medium";
|
|
17
|
+
readonly heartbeat: "short";
|
|
18
|
+
readonly topup: "short";
|
|
19
|
+
readonly liquidate: "short";
|
|
20
|
+
readonly fault: "short";
|
|
21
|
+
readonly withdraw_piece: "short";
|
|
22
|
+
};
|
|
23
|
+
export type PacedAction = keyof typeof PACED;
|
|
24
|
+
export declare const PACE_RANGES_MS: Record<PaceClass, readonly [number, number]>;
|
|
25
|
+
/**
|
|
26
|
+
* `atMs` is when the action must have landed. A `soft` one is a deadline the chain does not enforce (a default
|
|
27
|
+
* may be claimed after it), so missing it shortens the wait to 0 instead of refusing.
|
|
28
|
+
*/
|
|
29
|
+
export type Deadline = {
|
|
30
|
+
atMs: number;
|
|
31
|
+
soft?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** One drawn wait, before any chain read a proof binds. `subject` names what it is for: a loan, room or coin. */
|
|
34
|
+
export type Pause = {
|
|
35
|
+
action: PacedAction;
|
|
36
|
+
subject: string;
|
|
37
|
+
delayMs: number;
|
|
38
|
+
notBeforeMs: number;
|
|
39
|
+
};
|
|
40
|
+
export declare const drawUniform: (min: number, max: number) => number;
|
|
41
|
+
/** The class's range, capped so the action still has `marginMs` to prove and land before its deadline. */
|
|
42
|
+
export declare function paceDelay(action: PacedAction, nowMs: number, deadline: Deadline | null, marginMs: number, draw?: (min: number, max: number) => number): number;
|
|
43
|
+
//# sourceMappingURL=pace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pace.d.ts","sourceRoot":"","sources":["../../src/v3/pace.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;CAoB4B,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,KAAK,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAIvE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAExD,iHAAiH;AACjH,MAAM,MAAM,KAAK,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnG,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,WAA4B,CAAC;AAEjF,0GAA0G;AAC1G,wBAAgB,SAAS,CACvB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAoB,GACvD,MAAM,CAYR"}
|
package/dist/v3/pace.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { randomInt } from "node:crypto";
|
|
2
|
+
import { EsseyError } from "../errors.js";
|
|
3
|
+
export const PACED = {
|
|
4
|
+
transfer: "long",
|
|
5
|
+
withdraw: "long",
|
|
6
|
+
exit: "long",
|
|
7
|
+
collect: "long",
|
|
8
|
+
collect_seized: "long",
|
|
9
|
+
collect_surplus: "long",
|
|
10
|
+
reclaim_offer: "long",
|
|
11
|
+
reclaim_collateral: "long",
|
|
12
|
+
sale_reclaim: "long",
|
|
13
|
+
repay: "medium",
|
|
14
|
+
release: "medium",
|
|
15
|
+
offer: "medium",
|
|
16
|
+
bid: "medium",
|
|
17
|
+
settle: "medium",
|
|
18
|
+
heartbeat: "short",
|
|
19
|
+
topup: "short",
|
|
20
|
+
liquidate: "short",
|
|
21
|
+
fault: "short",
|
|
22
|
+
withdraw_piece: "short",
|
|
23
|
+
};
|
|
24
|
+
export const PACE_RANGES_MS = {
|
|
25
|
+
long: [120_000, 1_800_000],
|
|
26
|
+
medium: [20_000, 180_000],
|
|
27
|
+
short: [0, 30_000],
|
|
28
|
+
};
|
|
29
|
+
export const drawUniform = (min, max) => randomInt(min, max + 1);
|
|
30
|
+
/** The class's range, capped so the action still has `marginMs` to prove and land before its deadline. */
|
|
31
|
+
export function paceDelay(action, nowMs, deadline, marginMs, draw = drawUniform) {
|
|
32
|
+
const [min, max] = PACE_RANGES_MS[PACED[action]];
|
|
33
|
+
if (deadline === null)
|
|
34
|
+
return draw(min, max);
|
|
35
|
+
const room = deadline.atMs - marginMs - nowMs;
|
|
36
|
+
if (room < 0 && deadline.soft)
|
|
37
|
+
return 0;
|
|
38
|
+
if (room < 0)
|
|
39
|
+
throw new EsseyError("INVALID_ARGUMENT", `refused: the ${action} deadline leaves too little time to prove and land; nothing was sent`);
|
|
40
|
+
const cap = Math.min(max, room);
|
|
41
|
+
return draw(Math.min(min, cap), cap);
|
|
42
|
+
}
|
|
@@ -35,11 +35,6 @@ export type RelayerInfo = {
|
|
|
35
35
|
export type RelayClientOptions = {
|
|
36
36
|
url: string;
|
|
37
37
|
fetch: Fetch;
|
|
38
|
-
/** D §4.4: a uniform random wait in `[min, max]` ms before each submit. */
|
|
39
|
-
submitDelayMs?: [number, number];
|
|
40
|
-
sleep?: (ms: number) => Promise<void>;
|
|
41
|
-
/** Uniform integer in `[min, max]`. */
|
|
42
|
-
random?: (min: number, max: number) => number;
|
|
43
38
|
};
|
|
44
39
|
/** The error a relayer's reply or failed ticket stands for; `unnamed` labels one that carries no `error`. */
|
|
45
40
|
export declare function failure(detail: ServiceDetail, unnamed?: string): EsseyError;
|
|
@@ -47,9 +42,6 @@ export declare const refusal: (reply: JsonReply) => EsseyError;
|
|
|
47
42
|
export declare class RelayClient {
|
|
48
43
|
private readonly base;
|
|
49
44
|
private readonly fetch;
|
|
50
|
-
private readonly delay;
|
|
51
|
-
private readonly sleep;
|
|
52
|
-
private readonly random;
|
|
53
45
|
constructor(o: RelayClientOptions);
|
|
54
46
|
info(): Promise<RelayerInfo>;
|
|
55
47
|
/** 200 is a landed transaction, 202 a queued one whose ticket `status` follows. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v3/relay/client.ts"],"names":[],"mappings":"
|
|
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,EAAiC,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;A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AW1F;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,KAAG,UAAsC,CAAC;AAElF,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAElB,CAAC,EAAE,kBAAkB;IAK3B,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IAOlC,mFAAmF;IAC7E,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IASjD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAenD"}
|
package/dist/v3/relay/client.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomInt } from "node:crypto";
|
|
2
1
|
import { EsseyError } from "../../errors.js";
|
|
3
2
|
import { getJson, postJson, serviceUrl } from "../../network.js";
|
|
4
3
|
const TICKET = /^t_[0-9a-f]{32}$/;
|
|
@@ -23,26 +22,12 @@ export function failure(detail, unnamed = String(detail.status)) {
|
|
|
23
22
|
return new EsseyError("RELAY_REFUSED", `relayer refused: ${label}`, detail);
|
|
24
23
|
}
|
|
25
24
|
export const refusal = (reply) => failure(detailOf(reply));
|
|
26
|
-
function delayRange(range) {
|
|
27
|
-
if (range === undefined)
|
|
28
|
-
return undefined;
|
|
29
|
-
const [min, max] = range;
|
|
30
|
-
if (!Number.isInteger(min) || !Number.isInteger(max) || min < 0 || max < min)
|
|
31
|
-
throw new EsseyError("INVALID_ARGUMENT", "submitDelayMs must be [min, max] in whole milliseconds");
|
|
32
|
-
return [min, max];
|
|
33
|
-
}
|
|
34
25
|
export class RelayClient {
|
|
35
26
|
base;
|
|
36
27
|
fetch;
|
|
37
|
-
delay;
|
|
38
|
-
sleep;
|
|
39
|
-
random;
|
|
40
28
|
constructor(o) {
|
|
41
29
|
this.base = serviceUrl(o.url, "relayer url").origin;
|
|
42
30
|
this.fetch = o.fetch;
|
|
43
|
-
this.delay = delayRange(o.submitDelayMs);
|
|
44
|
-
this.sleep = o.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
45
|
-
this.random = o.random ?? ((min, max) => randomInt(min, max + 1));
|
|
46
31
|
}
|
|
47
32
|
async info() {
|
|
48
33
|
const reply = await getJson(this.fetch, `${this.base}/v3/relayer`);
|
|
@@ -52,8 +37,6 @@ export class RelayClient {
|
|
|
52
37
|
}
|
|
53
38
|
/** 200 is a landed transaction, 202 a queued one whose ticket `status` follows. */
|
|
54
39
|
async submit(body) {
|
|
55
|
-
if (this.delay)
|
|
56
|
-
await this.sleep(this.random(...this.delay));
|
|
57
40
|
const reply = await postJson(this.fetch, `${this.base}/v3/relay`, body);
|
|
58
41
|
const { ok, digest, ticket, etaMs } = reply.body;
|
|
59
42
|
if (ok !== true || typeof ticket !== "string" || !TICKET.test(ticket))
|
package/dist/v3/stage1.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export type MyLoanView = OpenRequest & {
|
|
|
53
53
|
/** Null when this view did not open an amount. A missing opening is not a healthy loan. */
|
|
54
54
|
underwater: boolean | null;
|
|
55
55
|
liquidationPrice: bigint | null;
|
|
56
|
-
|
|
56
|
+
coveredAtDefaultK: boolean | null;
|
|
57
57
|
request: {
|
|
58
58
|
principal: bigint;
|
|
59
59
|
maxRateBps: bigint;
|
|
@@ -139,7 +139,7 @@ export type PublicLoanStatus = {
|
|
|
139
139
|
ltvBps: string | null;
|
|
140
140
|
underwater: boolean;
|
|
141
141
|
liquidationPrice: string | null;
|
|
142
|
-
|
|
142
|
+
coveredAtDefaultK: boolean;
|
|
143
143
|
};
|
|
144
144
|
export declare function assertCoin(coin: unknown): asserts coin is CoinKey;
|
|
145
145
|
/** The deployment record's pool id for `coin`. Null until setup fills it (`deployments/essey-v3.testnet.json`). */
|
package/dist/v3/stage1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage1.d.ts","sourceRoot":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;AACzF,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CAkBhE;AAmBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,EAChB,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GACjC,IAAI,CAUN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CA6BvE"}
|
package/dist/v3/stage1.js
CHANGED
|
@@ -338,7 +338,7 @@ export function viewLoanObject(config, row, o) {
|
|
|
338
338
|
ltvBps: null,
|
|
339
339
|
underwater: null,
|
|
340
340
|
liquidationPrice: null,
|
|
341
|
-
|
|
341
|
+
coveredAtDefaultK: null,
|
|
342
342
|
request: null,
|
|
343
343
|
terms: null,
|
|
344
344
|
};
|
|
@@ -377,7 +377,7 @@ export function viewLoanObject(config, row, o) {
|
|
|
377
377
|
ltvBps: null,
|
|
378
378
|
underwater: null,
|
|
379
379
|
liquidationPrice: null,
|
|
380
|
-
|
|
380
|
+
coveredAtDefaultK: null,
|
|
381
381
|
request,
|
|
382
382
|
terms: null,
|
|
383
383
|
};
|
|
@@ -408,7 +408,7 @@ export function viewLoanObject(config, row, o) {
|
|
|
408
408
|
ltvBps: health.ltvBps,
|
|
409
409
|
underwater: health.underwater,
|
|
410
410
|
liquidationPrice: health.liquidationPrice,
|
|
411
|
-
|
|
411
|
+
coveredAtDefaultK: health.coveredAtDefaultK,
|
|
412
412
|
request,
|
|
413
413
|
terms: {
|
|
414
414
|
principal: terms.principal,
|
|
@@ -570,6 +570,6 @@ export function publicLoanStatus(loan) {
|
|
|
570
570
|
ltvBps: health.ltvBps === null ? null : health.ltvBps.toString(),
|
|
571
571
|
underwater: health.underwater,
|
|
572
572
|
liquidationPrice: health.liquidationPrice === null ? null : health.liquidationPrice.toString(),
|
|
573
|
-
|
|
573
|
+
coveredAtDefaultK: health.coveredAtDefaultK,
|
|
574
574
|
};
|
|
575
575
|
}
|