@esseyonsui/sui-mcp-v3 0.1.2 → 0.1.3
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 +25 -12
- package/dist/client.d.ts +3 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +17 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/fund.d.ts +21 -0
- package/dist/fund.d.ts.map +1 -0
- package/dist/fund.js +44 -0
- package/dist/io.d.ts +1 -1
- package/dist/main.js +10 -6
- package/dist/tools-more.d.ts +3 -0
- package/dist/tools-more.d.ts.map +1 -0
- package/dist/tools-more.js +227 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,11 +22,14 @@ The server speaks the same hand-written stdio subset as `packages/mcp`: `initial
|
|
|
22
22
|
|
|
23
23
|
`ESSEY_NOTE_KEY_FILE` and `ESSEY_AGENT_KEY_FILE` are mode-600 paths. The note file is 32 raw bytes or 64 hex
|
|
24
24
|
digits; the server passes it to `Essey.connect` and does not put it on the tool context. The agent key file holds
|
|
25
|
-
the `suiprivkey` text `essey-sui-mcp-v3-init` writes
|
|
26
|
-
|
|
27
|
-
the fresh sender the SDK derives from the note key, which then opens
|
|
28
|
-
(`src/agent.ts`)
|
|
29
|
-
|
|
25
|
+
the `suiprivkey` text `essey-sui-mcp-v3-init` writes (or 64 hex digits, as 0.1.x wallets hold); the server loads
|
|
26
|
+
it at startup (`src/keys.ts`) and signs two kinds of transaction with it. Inside `essey_sale_open`, a transfer of
|
|
27
|
+
the item being sold from the agent address to the fresh sender the SDK derives from the note key, which then opens
|
|
28
|
+
the room while the relayer pays (`src/agent.ts`); no tool argument names the recipient. Inside
|
|
29
|
+
`essey_notes_deposit`, `0x2::coin::send_funds` of each deposit piece's value from the agent's own wallet to that
|
|
30
|
+
piece's fresh deposit sender (`src/fund.ts`), which reads the file again for each piece and returns a fixed error
|
|
31
|
+
with no key text when funding fails. The agent address pays the gas of both, so fund it with the coin and some SUI
|
|
32
|
+
before depositing. Every other loan, note and sale call goes through the SDK's relayer. No tool argument is a key,
|
|
30
33
|
a seed, or the invite. `ESSEY_INVITE`, when set, is the
|
|
31
34
|
invite gate for `essey_credential_obtain`. Results drop secret names (`borrowerSk`, `loanKey`, `salt`, and the same words inside a larger name), raw bytes,
|
|
32
35
|
`suiprivkey` text, bare 64-hex seeds, and the invite. An SDK failure returns its error code and a fixed hint,
|
|
@@ -38,15 +41,27 @@ not the SDK's message; a service refusal adds the service's own all-capitals cod
|
|
|
38
41
|
Credential: `essey_credential_obtain`, `essey_credential_status`, `essey_credential_renew`.
|
|
39
42
|
|
|
40
43
|
Notes: `essey_faucet`, `essey_notes_deposit`, `essey_notes_balance` (scan; balance and note count only),
|
|
41
|
-
`essey_notes_withdraw`, `essey_notes_receive_address`, `essey_notes_transfer
|
|
42
|
-
|
|
44
|
+
`essey_notes_withdraw`, `essey_notes_receive_address`, `essey_notes_transfer`, `essey_notes_exit` (every note
|
|
45
|
+
of a coin, at most two, less fees), `essey_notes_recover` (retries a deposit that stopped before it landed).
|
|
46
|
+
`essey_notes_deposit` is paid from the agent wallet (see Keys).
|
|
43
47
|
|
|
44
48
|
Borrower: `essey_loan_open` (collateral coin and amount, loan coin, principal, max rate, term, offer window),
|
|
45
49
|
`essey_loan_settle`, `essey_loan_repay`, `essey_loan_release`, `essey_loan_cancel`, `essey_loan_reclaim_coll`,
|
|
46
|
-
`essey_loan_heartbeat`, `essey_loan_topup`, `essey_loan_collect_surplus
|
|
50
|
+
`essey_loan_heartbeat`, `essey_loan_topup`, `essey_loan_collect_surplus`, `essey_loan_slash` (an offer whose
|
|
51
|
+
sealed copy does not open its commit), `essey_loan_liquidate` and `essey_loan_seize_default` (from this server's
|
|
52
|
+
own terms).
|
|
53
|
+
|
|
54
|
+
Refinance: the borrower calls `essey_loan_refi_open` (new principal, max rate, term, offer window); lenders use
|
|
55
|
+
`essey_loan_request` and `essey_loan_offer`; after the window the borrower calls `essey_loan_refi_settle`, or
|
|
56
|
+
`essey_loan_refi_cancel` to keep the current terms. The old lender takes its payoff with `essey_loan_collect`.
|
|
47
57
|
|
|
48
58
|
Lender: `essey_loan_list`, `essey_loan_request`, `essey_loan_offer` (loan id, rate), `essey_loan_collect`,
|
|
49
|
-
`essey_loan_reclaim`, `essey_loan_collect_seized
|
|
59
|
+
`essey_loan_reclaim`, `essey_loan_collect_seized`, `essey_loan_fault_liquidate` (a loan a keeper marked FAULT).
|
|
60
|
+
|
|
61
|
+
Keeper (a credential from `essey_credential_obtain` with role `keeper`): `essey_keeper_judge` (liquidate, fault
|
|
62
|
+
or skip, sending nothing), `essey_keeper_liquidate`, `essey_keeper_fault`, `essey_keeper_mint_badge`,
|
|
63
|
+
`essey_keeper_badge`. The judge, liquidate and fault tools take `via: "badge"` to use the minted badge instead
|
|
64
|
+
of the keeper pass.
|
|
50
65
|
|
|
51
66
|
Each loan tool calls the SDK's own planner, so the server builds every proof with the circuits `/v3/config`
|
|
52
67
|
pins, reads the chain over Sui GraphQL and seals with the deployment's Seal set (`src/io.ts`). What a later step
|
|
@@ -72,8 +87,6 @@ its public `demo::mint` and transfer to the agent address.
|
|
|
72
87
|
`essey_loan_status` reads one loan's public fields from chain. `essey_loan_view` runs the SDK's `localHealth`
|
|
73
88
|
and `covered` on the public fields in its arguments and reads nothing.
|
|
74
89
|
|
|
75
|
-
There is no refinance tool.
|
|
76
|
-
|
|
77
90
|
Amounts are whole-number strings in the coin's smallest unit.
|
|
78
91
|
|
|
79
92
|
## Configuration
|
|
@@ -84,7 +97,7 @@ Amounts are whole-number strings in the coin's smallest unit.
|
|
|
84
97
|
| `ESSEY_V3_CONFIG` | `https` URL of `GET /v3/config`, or `http` on localhost, or a path to that JSON (required). A URL is what lets the SDK name the v3api. A file has no API origin. |
|
|
85
98
|
| `ESSEY_STATE_FILE` | mode-600 state path the SDK keeps the credential in (required) |
|
|
86
99
|
| `ESSEY_NOTE_KEY_FILE` | mode-600 note seed (required) |
|
|
87
|
-
| `ESSEY_AGENT_KEY_FILE` | mode-600 agent key file (required; signs only the sale item hand-over, see Keys)
|
|
100
|
+
| `ESSEY_AGENT_KEY_FILE` | mode-600 agent key file (required; signs only the sale item hand-over and deposit funding, see Keys) |
|
|
88
101
|
| `ESSEY_INVITE` | optional invite token, 1..256 characters without whitespace |
|
|
89
102
|
| `ESSEY_RELAYER` | `clear` (default) or `onion` |
|
|
90
103
|
| `ESSEY_GRAPHQL` | Sui GraphQL URL, `https` or `http` on localhost (default `https://graphql.testnet.sui.io/graphql`) |
|
package/dist/client.d.ts
CHANGED
|
@@ -11,14 +11,15 @@ export type OpenParams = Extract<Parameters<Loans["open"]>[0], {
|
|
|
11
11
|
*/
|
|
12
12
|
export type DemoClient = {
|
|
13
13
|
credential: Essey["credential"];
|
|
14
|
-
notes: Pick<Essey["notes"], "faucet" | "deposit" | "scan" | "withdraw" | "transfer" | "receiveAddress">;
|
|
15
|
-
loans: Pick<Loans, "request" | "lend" | "accept" | "payBack" | "release" | "collect" | "cancelOwn" | "reclaimCollateral" | "reclaimOffer" | "collectSeized" | "collectSurplus" | "heartbeat" | "topup" | "list" | "view"> & {
|
|
14
|
+
notes: Pick<Essey["notes"], "faucet" | "deposit" | "scan" | "withdraw" | "transfer" | "receiveAddress" | "exit" | "recoverStranded">;
|
|
15
|
+
loans: Pick<Loans, "request" | "lend" | "accept" | "payBack" | "release" | "collect" | "cancelOwn" | "reclaimCollateral" | "reclaimOffer" | "collectSeized" | "collectSurplus" | "heartbeat" | "topup" | "list" | "view" | "openRefi" | "settleRefi" | "cancelRefi" | "slash" | "fault" | "liquidate" | "seizeDefault" | "faultLiquidate" | "keeperLiquidate"> & {
|
|
16
16
|
open(p: OpenParams): Promise<{
|
|
17
17
|
id: string;
|
|
18
18
|
} & Landed>;
|
|
19
19
|
health(loan: PublicLoan): Promise<LoanStatus>;
|
|
20
20
|
};
|
|
21
21
|
sales: Essey["sales"] & SaleChain;
|
|
22
|
+
keeper: Pick<Essey["keeper"], "mintBadge" | "badge" | "judge">;
|
|
22
23
|
};
|
|
23
24
|
/** The agent key's public address and the vault lookup; the key itself stays in `agent.ts`. */
|
|
24
25
|
export type SaleChain = {
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG7D,KAAK,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5B,KAAK,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,KAAK,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG7D,KAAK,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5B,KAAK,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,KAAK,EAAE,IAAI,CACT,KAAK,CAAC,OAAO,CAAC,EACd,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,CACxG,CAAC;IACF,KAAK,EAAE,IAAI,CACT,KAAK,EACH,SAAS,GACT,MAAM,GACN,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,mBAAmB,GACnB,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,WAAW,GACX,OAAO,GACP,MAAM,GACN,MAAM,GACN,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,OAAO,GACP,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,iBAAiB,CACpB,GAAG;QACF,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,GAAG,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;KAC/C,CAAC;IACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;CAChE,CAAC;AAEF,+FAA+F;AAC/F,MAAM,MAAM,SAAS,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AASzF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,SAAS,EAChB,MAAM,GAAE,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,CAA6C,GAChF,UAAU,CA+DZ;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CAShF"}
|
package/dist/client.js
CHANGED
|
@@ -7,7 +7,7 @@ async function openPlanned(essey, p) {
|
|
|
7
7
|
return r;
|
|
8
8
|
}
|
|
9
9
|
export function clientOf(essey, chain, health = (loan) => Promise.resolve(statusOf(loan))) {
|
|
10
|
-
const { loans, notes, sales } = essey;
|
|
10
|
+
const { keeper, loans, notes, sales } = essey;
|
|
11
11
|
return {
|
|
12
12
|
credential: essey.credential,
|
|
13
13
|
notes: {
|
|
@@ -17,6 +17,8 @@ export function clientOf(essey, chain, health = (loan) => Promise.resolve(status
|
|
|
17
17
|
withdraw: (coin, amount, to) => notes.withdraw(coin, amount, to),
|
|
18
18
|
transfer: (coin, amount, to) => notes.transfer(coin, amount, to),
|
|
19
19
|
receiveAddress: () => notes.receiveAddress(),
|
|
20
|
+
exit: (coin, to) => notes.exit(coin, to),
|
|
21
|
+
recoverStranded: () => notes.recoverStranded(),
|
|
20
22
|
},
|
|
21
23
|
loans: {
|
|
22
24
|
open: (p) => openPlanned(essey, p),
|
|
@@ -35,6 +37,15 @@ export function clientOf(essey, chain, health = (loan) => Promise.resolve(status
|
|
|
35
37
|
topup: (p) => loans.topup(p),
|
|
36
38
|
list: () => loans.list(),
|
|
37
39
|
view: (id) => loans.view(id),
|
|
40
|
+
openRefi: (p) => loans.openRefi(p),
|
|
41
|
+
settleRefi: (p) => loans.settleRefi(p),
|
|
42
|
+
cancelRefi: (id) => loans.cancelRefi(id),
|
|
43
|
+
slash: (p) => loans.slash(p),
|
|
44
|
+
fault: (p) => loans.fault(p),
|
|
45
|
+
liquidate: (p) => loans.liquidate(p),
|
|
46
|
+
seizeDefault: (p) => loans.seizeDefault(p),
|
|
47
|
+
faultLiquidate: (p) => loans.faultLiquidate(p),
|
|
48
|
+
keeperLiquidate: (p) => loans.keeperLiquidate(p),
|
|
38
49
|
health,
|
|
39
50
|
},
|
|
40
51
|
sales: {
|
|
@@ -52,6 +63,11 @@ export function clientOf(essey, chain, health = (loan) => Promise.resolve(status
|
|
|
52
63
|
agentAddress: chain.agentAddress,
|
|
53
64
|
vaultOf: (room) => chain.vaultOf(room),
|
|
54
65
|
},
|
|
66
|
+
keeper: {
|
|
67
|
+
mintBadge: () => keeper.mintBadge(),
|
|
68
|
+
badge: () => keeper.badge(),
|
|
69
|
+
judge: (p) => keeper.judge(p),
|
|
70
|
+
},
|
|
55
71
|
};
|
|
56
72
|
}
|
|
57
73
|
/** The invite stays in the server process. Tool arguments cannot replace it or read it back. */
|
package/dist/config.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type McpConfig = {
|
|
|
14
14
|
graphql: string;
|
|
15
15
|
/** Mode-600 note seed. The server passes it to the SDK and does not keep a copy on the tool context. */
|
|
16
16
|
noteKeyFile: string;
|
|
17
|
-
/** Mode-600 agent key file. Signs
|
|
17
|
+
/** Mode-600 agent key file. Signs the sale item hand-over (`agent.ts`) and a deposit's funding transfer (`fund.ts`); never a tool argument. */
|
|
18
18
|
agentKeyFile: string;
|
|
19
19
|
/** Invite gate token. Unset: credential obtain uses the proof-of-work challenge. Never a tool argument. */
|
|
20
20
|
invite: string | null;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,SAAS,CAAC;IACnB,4EAA4E;IAC5E,MAAM,EAAE;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,iHAAiH;IACjH,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,WAAW,EAAE,MAAM,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,SAAS,CAAC;IACnB,4EAA4E;IAC5E,MAAM,EAAE;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,iHAAiH;IACjH,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,WAAW,EAAE,MAAM,CAAC;IACpB,+IAA+I;IAC/I,YAAY,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAA2C,CAAC;AAaxE,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,oBAAoB;CAClC;AAWD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CA0B7D"}
|
package/dist/fund.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
2
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
3
|
+
import type { CoinKey, EsseyIo } from "@esseyonsui/sui-sdk-v3";
|
|
4
|
+
/** Fixed text: whatever the signing or the chain threw is dropped, so no failure can carry the key file. */
|
|
5
|
+
export declare const FUND_FAILED = "the agent wallet did not fund the deposit";
|
|
6
|
+
/** Executes the signed transaction and resolves once it is final. Tests replace it. */
|
|
7
|
+
export type Send = (tx: Transaction, signer: Ed25519Keypair) => Promise<void>;
|
|
8
|
+
export declare function chainSend(url: string): Send;
|
|
9
|
+
/**
|
|
10
|
+
* The only transaction the agent key signs: `0x2::coin::send_funds` of one deposit piece to its fresh sender, as
|
|
11
|
+
* `scripts/v3/live/io.ts` depositFunder does from the sui CLI payer. The key is read for each piece and not kept.
|
|
12
|
+
*/
|
|
13
|
+
export declare function agentFunder(keyFile: string, coinType: (coin: CoinKey) => string | undefined, send: Send): NonNullable<EsseyIo["fundDeposit"]>;
|
|
14
|
+
export declare function agentDepositIo(raw: unknown, keyFile: string, url: string, send?: Send): {
|
|
15
|
+
fundDeposit: (p: {
|
|
16
|
+
coin: CoinKey;
|
|
17
|
+
value: bigint;
|
|
18
|
+
sender: string;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=fund.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fund.d.ts","sourceRoot":"","sources":["../src/fund.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAI/D,4GAA4G;AAC5G,eAAO,MAAM,WAAW,8CAA8C,CAAC;AAEvE,uFAAuF;AACvF,MAAM,MAAM,IAAI,GAAG,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAO3C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,EAC/C,IAAI,EAAE,IAAI,GACT,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAmBrC;AAID,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,IAAqB;;;;;;EAGrG"}
|
package/dist/fund.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
2
|
+
import { coinWithBalance, Transaction } from "@mysten/sui/transactions";
|
|
3
|
+
import { loadAgentKey } from "./keys.js";
|
|
4
|
+
/** Fixed text: whatever the signing or the chain threw is dropped, so no failure can carry the key file. */
|
|
5
|
+
export const FUND_FAILED = "the agent wallet did not fund the deposit";
|
|
6
|
+
export function chainSend(url) {
|
|
7
|
+
const client = new SuiGraphQLClient({ url, network: "testnet" });
|
|
8
|
+
return async (transaction, signer) => {
|
|
9
|
+
const r = await client.signAndExecuteTransaction({ transaction, signer });
|
|
10
|
+
if (r.$kind !== "Transaction")
|
|
11
|
+
throw new Error("failed");
|
|
12
|
+
await client.waitForTransaction({ result: r });
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The only transaction the agent key signs: `0x2::coin::send_funds` of one deposit piece to its fresh sender, as
|
|
17
|
+
* `scripts/v3/live/io.ts` depositFunder does from the sui CLI payer. The key is read for each piece and not kept.
|
|
18
|
+
*/
|
|
19
|
+
export function agentFunder(keyFile, coinType, send) {
|
|
20
|
+
return async ({ coin, value, sender }) => {
|
|
21
|
+
try {
|
|
22
|
+
const type = coinType(coin);
|
|
23
|
+
if (!type)
|
|
24
|
+
throw new Error("coin");
|
|
25
|
+
const signer = loadAgentKey(keyFile);
|
|
26
|
+
const tx = new Transaction();
|
|
27
|
+
tx.setSender(signer.toSuiAddress());
|
|
28
|
+
const funds = tx.add(coinWithBalance({ type, balance: value }));
|
|
29
|
+
tx.moveCall({
|
|
30
|
+
target: "0x2::coin::send_funds",
|
|
31
|
+
typeArguments: [type],
|
|
32
|
+
arguments: [funds, tx.pure.address(sender)],
|
|
33
|
+
});
|
|
34
|
+
await send(tx, signer);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
throw new Error(FUND_FAILED);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function agentDepositIo(raw, keyFile, url, send = chainSend(url)) {
|
|
42
|
+
const coins = raw.coins ?? {};
|
|
43
|
+
return { fundDeposit: agentFunder(keyFile, (coin) => coins[coin]?.type, send) };
|
|
44
|
+
}
|
package/dist/io.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
|
54
54
|
publishS: bigint;
|
|
55
55
|
}>;
|
|
56
56
|
readSeizure: (loanId: string) => Promise<{
|
|
57
|
-
readonly mode: "default" | "
|
|
57
|
+
readonly mode: "default" | "fault" | "liquidate";
|
|
58
58
|
readonly pSpot: bigint;
|
|
59
59
|
}>;
|
|
60
60
|
readSettleTime: (loanId: string) => Promise<bigint>;
|
package/dist/main.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ESSEY_ERROR_CODES, Essey, isEsseyError, parseConfig as parseDeployment,
|
|
|
5
5
|
import { graphqlExecute, itemHandOver } from "./agent.js";
|
|
6
6
|
import { clientOf, withInvite } from "./client.js";
|
|
7
7
|
import { ConfigError, parseConfig } from "./config.js";
|
|
8
|
+
import { agentDepositIo } from "./fund.js";
|
|
8
9
|
import { chainIo } from "./io.js";
|
|
9
10
|
import { loadAgentKey, loadNoteSeed } from "./keys.js";
|
|
10
11
|
import { serve } from "./protocol.js";
|
|
@@ -17,11 +18,14 @@ const INSTRUCTIONS = "Essey V3 private testnet tools. Note and agent keys are fi
|
|
|
17
18
|
"strings in the coin's smallest unit. The server builds every proof itself and keeps loan terms, offer, seller " +
|
|
18
19
|
"and bid records in its own files; no tool returns them. Borrow: essey_loan_open, wait for the window, " +
|
|
19
20
|
"essey_loan_settle, essey_loan_repay, essey_loan_release. Lend: essey_loan_list, essey_loan_request, " +
|
|
20
|
-
"essey_loan_offer, then essey_loan_collect after repay or essey_loan_reclaim if the offer lost.
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
21
|
+
"essey_loan_offer, then essey_loan_collect after repay or essey_loan_reclaim if the offer lost. Refinance: " +
|
|
22
|
+
"essey_loan_refi_open, lenders offer, essey_loan_refi_settle; the old lender calls essey_loan_collect. Keeper: " +
|
|
23
|
+
"essey_keeper_judge, then essey_keeper_liquidate or essey_keeper_fault, after which the lender calls " +
|
|
24
|
+
"essey_loan_fault_liquidate. essey_notes_deposit is paid from the agent wallet. Sell: put the item at " +
|
|
25
|
+
"essey_agent_address, essey_sale_open, after close essey_sale_finish (essey_sale_slash each bid it names " +
|
|
26
|
+
"first); or essey_sale_cancel before any bid, or essey_sale_expire after the finish window, then " +
|
|
27
|
+
"essey_sale_claim as seller. Buy: essey_sale_list, essey_sale_bid, and once the room ended essey_sale_claim as " +
|
|
28
|
+
"bidder if won and essey_sale_reclaim (residual if won, else the deposit).";
|
|
25
29
|
/**
|
|
26
30
|
* `source` is what `Essey.connect` takes: the URL, which names the v3api, or the parsed file. The io reads the
|
|
27
31
|
* same record as JSON (Seal set, pools, circuit pins).
|
|
@@ -78,7 +82,7 @@ async function start() {
|
|
|
78
82
|
execute: graphqlExecute(cfg.graphql, agent),
|
|
79
83
|
readObjectRef: io.readObjectRef,
|
|
80
84
|
});
|
|
81
|
-
const essey = await Essey.connect({ network: "testnet", statePath: cfg.stateFile, config: source, seed, relayer: cfg.relayer }, { ...io, deliverSaleItem });
|
|
85
|
+
const essey = await Essey.connect({ network: "testnet", statePath: cfg.stateFile, config: source, seed, relayer: cfg.relayer }, { ...io, ...agentDepositIo(raw, cfg.agentKeyFile, cfg.graphql), deliverSaleItem });
|
|
82
86
|
const sale = { agentAddress: agent.toSuiAddress(), vaultOf: io.readVaultOf };
|
|
83
87
|
const client = withInvite(clientOf(essey, sale), cfg.invite);
|
|
84
88
|
const tools = bind({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-more.d.ts","sourceRoot":"","sources":["../src/tools-more.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AAkQpD,eAAO,MAAM,IAAI,EAAE,IAAI,EAA6C,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { COINS } from "@esseyonsui/sui-sdk-v3";
|
|
2
|
+
import { LOAN_SCHEMA, OPEN_SCHEMA, int, parseAmount, parseCoin, parseLoanId, parsePayee } from "./args.js";
|
|
3
|
+
import { isSdkCode, ToolRefusal } from "./failure.js";
|
|
4
|
+
/** `move/v3/loan/sources/loan.move:40` MAX_OFFERS = 16. */
|
|
5
|
+
const MAX_SEQ = 15;
|
|
6
|
+
const MAX_MS = Number.MAX_SAFE_INTEGER;
|
|
7
|
+
const REQUEST = OPEN_SCHEMA.properties;
|
|
8
|
+
const LOAN = LOAN_SCHEMA.properties.loan;
|
|
9
|
+
const obj = (properties = {}, required = []) => ({
|
|
10
|
+
type: "object",
|
|
11
|
+
properties,
|
|
12
|
+
required,
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
});
|
|
15
|
+
const KEEPER_SCHEMA = obj({
|
|
16
|
+
loan: LOAN,
|
|
17
|
+
via: {
|
|
18
|
+
type: "string",
|
|
19
|
+
enum: ["pass", "badge"],
|
|
20
|
+
description: "Seal read approved by the keeper credential (pass, default) or by essey_keeper_mint_badge's badge",
|
|
21
|
+
},
|
|
22
|
+
}, ["loan"]);
|
|
23
|
+
function bad(msg) {
|
|
24
|
+
throw new ToolRefusal(msg);
|
|
25
|
+
}
|
|
26
|
+
function landed(row) {
|
|
27
|
+
return { ok: true, digest: row.digest, ticket: row.ticket };
|
|
28
|
+
}
|
|
29
|
+
function keeperArgs(args) {
|
|
30
|
+
const loan = parseLoanId(args);
|
|
31
|
+
if (args.via === undefined)
|
|
32
|
+
return { loan };
|
|
33
|
+
if (args.via !== "pass" && args.via !== "badge")
|
|
34
|
+
bad("via must be pass or badge");
|
|
35
|
+
return { loan, via: args.via };
|
|
36
|
+
}
|
|
37
|
+
function own(ctx, loan) {
|
|
38
|
+
const r = ctx.records.loan(loan);
|
|
39
|
+
if (!r.terms || r.borrowerPk === undefined)
|
|
40
|
+
bad("this loan has not settled from this server: call essey_loan_settle first");
|
|
41
|
+
return { loan, terms: r.terms, borrowerPk: r.borrowerPk, collAmt: r.collAmt };
|
|
42
|
+
}
|
|
43
|
+
function recovered(row) {
|
|
44
|
+
const out = { coin: row.coin, value: row.value, outcome: row.outcome };
|
|
45
|
+
if ("digest" in row)
|
|
46
|
+
out.digest = row.digest;
|
|
47
|
+
if ("atMs" in row && row.atMs !== undefined)
|
|
48
|
+
out.atMs = row.atMs;
|
|
49
|
+
if ("error" in row)
|
|
50
|
+
out.error = isSdkCode(row.error) ? row.error.code : "UNEXPECTED";
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
const REFI = [
|
|
54
|
+
{
|
|
55
|
+
name: "essey_loan_refi_open",
|
|
56
|
+
kind: "call",
|
|
57
|
+
description: "Borrower of an active loan settled from this server: open a refinance round for a new principal that pays the " +
|
|
58
|
+
"current lender what is owed. Lenders offer with essey_loan_request and essey_loan_offer as on a new loan. " +
|
|
59
|
+
"Returns the digest, ticket, round and when offers close.",
|
|
60
|
+
inputSchema: obj({
|
|
61
|
+
loan: LOAN,
|
|
62
|
+
principal: { ...REQUEST.principal, description: "new principal; it must cover what is owed now" },
|
|
63
|
+
maxRateBps: REQUEST.maxRateBps,
|
|
64
|
+
termMs: REQUEST.termMs,
|
|
65
|
+
offerWindowMs: REQUEST.offerWindowMs,
|
|
66
|
+
}, ["loan", "principal", "maxRateBps", "termMs", "offerWindowMs"]),
|
|
67
|
+
run: async (ctx, args) => {
|
|
68
|
+
const { loan, borrowerPk, collAmt } = own(ctx, parseLoanId(args));
|
|
69
|
+
const r = await ctx.client.loans.openRefi({
|
|
70
|
+
loan,
|
|
71
|
+
borrowerPk,
|
|
72
|
+
collAmt,
|
|
73
|
+
principal: parseAmount(args, "principal"),
|
|
74
|
+
maxRateBps: int(args, "maxRateBps", 0, 10_000),
|
|
75
|
+
termMs: int(args, "termMs", 1, MAX_MS),
|
|
76
|
+
offerWindowMs: int(args, "offerWindowMs", 1, MAX_MS),
|
|
77
|
+
});
|
|
78
|
+
return { ...landed(r), round: r.round, closeMs: r.closeMs };
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "essey_loan_refi_settle",
|
|
83
|
+
kind: "call",
|
|
84
|
+
description: "Borrower, after the refinance window: take the lowest eligible offer. The old lender is paid and collects with " +
|
|
85
|
+
"essey_loan_collect; this server keeps the new terms. Returns the digest, ticket, rate, amount owed and maturity.",
|
|
86
|
+
inputSchema: LOAN_SCHEMA,
|
|
87
|
+
run: async (ctx, args) => {
|
|
88
|
+
const settled = own(ctx, parseLoanId(args));
|
|
89
|
+
const r = await ctx.client.loans.settleRefi(settled);
|
|
90
|
+
const { loan, collAmt, borrowerPk } = settled;
|
|
91
|
+
ctx.records.saveLoan(loan, { collAmt, terms: r.terms, borrowerPk });
|
|
92
|
+
return { ...landed(r), rateBps: r.rateBps, owed: r.terms.owed, maturityS: r.terms.maturityS };
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "essey_loan_refi_cancel",
|
|
97
|
+
kind: "call",
|
|
98
|
+
description: "Borrower: close an own open refinance round. The loan stays active on its current terms.",
|
|
99
|
+
inputSchema: LOAN_SCHEMA,
|
|
100
|
+
run: async (ctx, args) => landed(await ctx.client.loans.cancelRefi(parseLoanId(args))),
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
const SEIZE = [
|
|
104
|
+
{
|
|
105
|
+
name: "essey_loan_slash",
|
|
106
|
+
kind: "call",
|
|
107
|
+
description: "Borrower, after the offer window closed: mark offer seq inactive when its sealed offer does not open its " +
|
|
108
|
+
"commit. The chain refuses an honest offer. The slashed lender reclaims its lock once the round resolves.",
|
|
109
|
+
inputSchema: obj({
|
|
110
|
+
loan: LOAN,
|
|
111
|
+
seq: { type: "integer", minimum: 0, maximum: MAX_SEQ, description: "offer slot in the round" },
|
|
112
|
+
}, ["loan", "seq"]),
|
|
113
|
+
run: async (ctx, args) => landed(await ctx.client.loans.slash({ loan: parseLoanId(args), seq: int(args, "seq", 0, MAX_SEQ) })),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "essey_loan_liquidate",
|
|
117
|
+
kind: "call",
|
|
118
|
+
description: "Borrower of a loan settled from this server: seize it while it is underwater, from this server's own terms. " +
|
|
119
|
+
"The lender takes its share with essey_loan_collect_seized, the borrower the rest with essey_loan_collect_surplus.",
|
|
120
|
+
inputSchema: LOAN_SCHEMA,
|
|
121
|
+
run: async (ctx, args) => landed(await ctx.client.loans.liquidate(own(ctx, parseLoanId(args)))),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "essey_loan_seize_default",
|
|
125
|
+
kind: "call",
|
|
126
|
+
description: "Borrower of a loan settled from this server: seize it once it is past maturity plus grace, from this server's " +
|
|
127
|
+
"own terms. Then essey_loan_collect_seized (lender) and essey_loan_collect_surplus (borrower).",
|
|
128
|
+
inputSchema: LOAN_SCHEMA,
|
|
129
|
+
run: async (ctx, args) => landed(await ctx.client.loans.seizeDefault(own(ctx, parseLoanId(args)))),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "essey_loan_fault_liquidate",
|
|
133
|
+
kind: "call",
|
|
134
|
+
description: "Lender, from the offer this server made, of a loan a keeper marked FAULT with essey_keeper_fault: seize it. " +
|
|
135
|
+
"Then essey_loan_collect_seized.",
|
|
136
|
+
inputSchema: LOAN_SCHEMA,
|
|
137
|
+
run: async (ctx, args) => {
|
|
138
|
+
const loan = parseLoanId(args);
|
|
139
|
+
return landed(await ctx.client.loans.faultLiquidate({ loan, offer: ctx.records.offer(loan) }));
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
const KEEPER = [
|
|
144
|
+
{
|
|
145
|
+
name: "essey_keeper_mint_badge",
|
|
146
|
+
kind: "call",
|
|
147
|
+
description: "Keeper (essey_credential_obtain with role keeper): mint a keeper badge, sponsored by the relayer, for via " +
|
|
148
|
+
"badge. Returns the digest, badge id, holder address and expiry.",
|
|
149
|
+
inputSchema: obj(),
|
|
150
|
+
run: async (ctx) => {
|
|
151
|
+
const r = await ctx.client.keeper.mintBadge();
|
|
152
|
+
return {
|
|
153
|
+
ok: true,
|
|
154
|
+
digest: r.digest,
|
|
155
|
+
badge: r.badge,
|
|
156
|
+
holder: r.holder,
|
|
157
|
+
expiresMs: r.expiresMs,
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "essey_keeper_badge",
|
|
163
|
+
kind: "read",
|
|
164
|
+
description: "The keeper badge this server holds: badge id, holder address and expiry, or badge null.",
|
|
165
|
+
inputSchema: obj(),
|
|
166
|
+
run: async (ctx) => {
|
|
167
|
+
const held = ctx.client.keeper.badge();
|
|
168
|
+
if (!held)
|
|
169
|
+
return { ok: true, badge: null };
|
|
170
|
+
return { ok: true, badge: held.badge, holder: held.holder, expiresMs: held.expiresMs };
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "essey_keeper_judge",
|
|
175
|
+
kind: "read",
|
|
176
|
+
description: "Keeper: read an active loan's keeper ciphertext through Seal and say what to do, sending nothing. action " +
|
|
177
|
+
"liquidate (essey_keeper_liquidate), fault (essey_keeper_fault), or skip with reason healthy or third-party-ct.",
|
|
178
|
+
inputSchema: KEEPER_SCHEMA,
|
|
179
|
+
run: async (ctx, args) => {
|
|
180
|
+
const v = await ctx.client.keeper.judge(keeperArgs(args));
|
|
181
|
+
if (v.action === "skip")
|
|
182
|
+
return { ok: true, action: v.action, reason: v.reason };
|
|
183
|
+
return { ok: true, action: v.action };
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "essey_keeper_fault",
|
|
188
|
+
kind: "call",
|
|
189
|
+
description: "Keeper: mark an active loan FAULT when its retained borrower keeper ciphertext does not open its lock. The " +
|
|
190
|
+
"chain refuses an honest ciphertext. The lender then calls essey_loan_fault_liquidate.",
|
|
191
|
+
inputSchema: KEEPER_SCHEMA,
|
|
192
|
+
run: async (ctx, args) => landed(await ctx.client.loans.fault(keeperArgs(args))),
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "essey_keeper_liquidate",
|
|
196
|
+
kind: "call",
|
|
197
|
+
description: "Keeper: seize an underwater loan from its Seal read of the keeper ciphertext. The keeper fee arrives as an own " +
|
|
198
|
+
"note; the lender and borrower collect with essey_loan_collect_seized and essey_loan_collect_surplus.",
|
|
199
|
+
inputSchema: KEEPER_SCHEMA,
|
|
200
|
+
run: async (ctx, args) => landed(await ctx.client.loans.keeperLiquidate(keeperArgs(args))),
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
const NOTES = [
|
|
204
|
+
{
|
|
205
|
+
name: "essey_notes_exit",
|
|
206
|
+
kind: "call",
|
|
207
|
+
description: "Withdraw every note of a coin, at most two, less fees, to a 0x address of 64 hex digits. Returns the digest " +
|
|
208
|
+
"and ticket.",
|
|
209
|
+
inputSchema: obj({
|
|
210
|
+
coin: { type: "string", enum: [...COINS] },
|
|
211
|
+
to: { type: "string", pattern: "^0x[0-9a-fA-F]{64}$", description: "recipient address" },
|
|
212
|
+
}, ["coin", "to"]),
|
|
213
|
+
run: async (ctx, args) => landed(await ctx.client.notes.exit(parseCoin(args), parsePayee(args))),
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "essey_notes_recover",
|
|
217
|
+
kind: "call",
|
|
218
|
+
description: "Retry every deposit this server started that has not landed. One row per record: coin, value and outcome " +
|
|
219
|
+
"(landed, unconfirmed, already landed, record gone, unfunded, retry_after with atMs, failed with an error code).",
|
|
220
|
+
inputSchema: obj(),
|
|
221
|
+
run: async (ctx) => ({
|
|
222
|
+
ok: true,
|
|
223
|
+
recovered: (await ctx.client.notes.recoverStranded()).map(recovered),
|
|
224
|
+
}),
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
export const MORE = [...REFI, ...SEIZE, ...KEEPER, ...NOTES];
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAM5C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,gGAAgG;IAChG,OAAO,EAAE,OAAO,CAAC;IACjB,8FAA8F;IAC9F,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,yFAAyF;IACzF,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACpC,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD,CAAC;AA2ZF,eAAO,MAAM,KAAK,EAAE,IAAI,EASvB,CAAC;AAUF,+GAA+G;AAC/G,wBAAgB,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,GAAE,IAAI,EAAU,GAAG,OAAO,EAAE,CAmBvE"}
|
package/dist/tools.js
CHANGED
|
@@ -3,6 +3,7 @@ import { HEARTBEAT_SCHEMA, LIST_SCHEMA, LOAN_SCHEMA, OFFER_SCHEMA, OPEN_SCHEMA,
|
|
|
3
3
|
import { assertNoSecrets, failureOf, ToolRefusal } from "./failure.js";
|
|
4
4
|
import { redact } from "./redact.js";
|
|
5
5
|
import { BADGE_TOOLS } from "./tools-badge.js";
|
|
6
|
+
import { MORE } from "./tools-more.js";
|
|
6
7
|
import { SALE_TOOLS } from "./tools-sales.js";
|
|
7
8
|
const UNITS = "whole-number string in the coin's smallest unit";
|
|
8
9
|
const BIDDING = v3.LOAN_LIFECYCLE.indexOf("bidding");
|
|
@@ -84,7 +85,7 @@ const NOTES = [
|
|
|
84
85
|
name: "essey_notes_deposit",
|
|
85
86
|
kind: "call",
|
|
86
87
|
description: `Deposit ${UNITS} into shielded notes. denominations splits the amount the way the deployment lists; ` +
|
|
87
|
-
"omit it to let the SDK decide.
|
|
88
|
+
"omit it to let the SDK decide. The agent wallet (ESSEY_AGENT_KEY_FILE) pays it in; essey_notes_recover retries one that stopped.",
|
|
88
89
|
inputSchema: obj({
|
|
89
90
|
coin: { type: "string", enum: [...COINS] },
|
|
90
91
|
amount: { type: "string", pattern: "^[1-9][0-9]*$", description: UNITS },
|
|
@@ -378,6 +379,7 @@ export const TOOLS = [
|
|
|
378
379
|
...VIEWS,
|
|
379
380
|
...SALE_TOOLS,
|
|
380
381
|
...BADGE_TOOLS,
|
|
382
|
+
...MORE,
|
|
381
383
|
];
|
|
382
384
|
function assertKnownArgs(tool, args) {
|
|
383
385
|
const schema = tool.inputSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esseyonsui/sui-mcp-v3",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@esseyonsui/sui-sdk-v3": "0.1.
|
|
32
|
+
"@esseyonsui/sui-sdk-v3": "0.1.3",
|
|
33
33
|
"@mysten/seal": "1.5.1",
|
|
34
34
|
"@mysten/sui": "2.37.0",
|
|
35
35
|
"snarkjs": "0.7.6"
|