@temporalabs/treasury 0.1.3 → 0.1.4
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 +4 -4
- package/THIRD_PARTY_NOTICES.connect-page.md +78 -24
- package/THIRD_PARTY_NOTICES.md +50 -50
- package/dist/client.d.ts +6 -307
- package/dist/client.js.map +1 -1
- package/dist/connect/ack.d.ts +70 -0
- package/dist/connect/ack.js +135 -0
- package/dist/connect/ack.js.map +1 -1
- package/dist/connect/commands.d.ts +27 -0
- package/dist/connect/commands.js +726 -112
- package/dist/connect/commands.js.map +1 -1
- package/dist/connect/http.d.ts +10 -1
- package/dist/connect/http.js +5 -3
- package/dist/connect/http.js.map +1 -1
- package/dist/connect/session.d.ts +20 -4
- package/dist/connect/session.js +134 -18
- package/dist/connect/session.js.map +1 -1
- package/dist/connect/solana.d.ts +39 -0
- package/dist/connect/solana.js +140 -37
- package/dist/connect/solana.js.map +1 -1
- package/dist/connect-page.js +835 -673
- package/dist/disclosures.d.ts +2 -0
- package/dist/disclosures.js +2 -0
- package/dist/disclosures.js.map +1 -1
- package/dist/earn/solana.js +19 -5
- package/dist/earn/solana.js.map +1 -1
- package/dist/redact.js +7 -1
- package/dist/redact.js.map +1 -1
- package/dist/solana/vault.js +0 -2
- package/dist/solana/vault.js.map +1 -1
- package/dist/treasury.mjs +36772 -34368
- package/llms.txt +65 -49
- package/package.json +8 -5
package/llms.txt
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
> Agent Treasury by Tempora Labs — a depositor client for ERC-4626 vaults and a Kamino vault on Solana: registry, pre-flight, and unsigned deposit/withdraw builders. Never signs, never holds a key.
|
|
4
4
|
|
|
5
5
|
This file is generated from the earn skill and from the command descriptions `treasury --help` prints; it is not edited by hand.
|
|
6
|
-
This version's copy is at https://raw.githubusercontent.com/TemporaLabs/treasury/v0.1.
|
|
7
|
-
Run commands as `treasury <skill> <command> [--flag value …]` (`npx @temporalabs/treasury@0.1.
|
|
6
|
+
This version's copy is at https://raw.githubusercontent.com/TemporaLabs/treasury/v0.1.4/llms.txt.
|
|
7
|
+
Run commands as `treasury <skill> <command> [--flag value …]` (`npx @temporalabs/treasury@0.1.4 …` runs the same version without installing it). Each prints one JSON document.
|
|
8
8
|
|
|
9
9
|
# The earn skill
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ not permission to deposit it. **How much to deposit or withdraw is the operator'
|
|
|
17
17
|
not pick.** Not a small test amount, not a round number, not the wallet's balance: if the operator has
|
|
18
18
|
not named an amount, ask for one before you quote. The
|
|
19
19
|
`treasury` CLI gives you eight `earn` commands that read the vault and **prepare unsigned
|
|
20
|
-
calls**, and
|
|
20
|
+
calls**, and six `connect` commands that put those calls in front of the operator's own wallet in a
|
|
21
21
|
browser page. Run each one with the shell, exactly like this (nothing stays running between commands):
|
|
22
22
|
|
|
23
23
|
```bash
|
|
@@ -142,41 +142,48 @@ bridge. An operator can still put money into several vaults, on one chain or sev
|
|
|
142
142
|
|
|
143
143
|
### Several vaults in one request
|
|
144
144
|
|
|
145
|
-
An operator can
|
|
146
|
-
"1
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
1. **Settle the
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
2. **Check every leg before any money moves:** `earn_quote` with
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
3. **
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
145
|
+
An operator can move money in several vaults in one sitting — "1 USDC on Base and 3 on Solana", "2 USDC on every chain",
|
|
146
|
+
"withdraw 1 from 2B and deposit 1 into 2C". Vaults may be on different chains or one, and deposits and withdrawals may
|
|
147
|
+
mix. Each vault is one **leg** with its own transactions; nothing moves money in several vaults at once.
|
|
148
|
+
|
|
149
|
+
1. **Settle the legs from the operator's own words:** each leg's action, vault, chain and amount. A chain named without a
|
|
150
|
+
vault means its default vault. "Every chain" means every entry in `earn_vaults` → `chains`, each with its default
|
|
151
|
+
vault; "every vault" means every vault in `depositable` (a listed vault outside it cannot take a deposit: name it,
|
|
152
|
+
do not drop it silently). "Withdraw everything" means every vault whose `earn_balance` holds shares, each withdrawn in
|
|
153
|
+
full. Do not add, drop or resize a leg on your own.
|
|
154
|
+
2. **Check every leg before any money moves:** `earn_quote` with the leg's direction, the real account and amount. The
|
|
155
|
+
asset has to be on that vault's chain already (USDG, not USDC, on Robinhood Chain); this skill does not bridge. Two
|
|
156
|
+
deposits on one chain draw on one balance: check it covers both. On Solana the account also needs SOL, and on
|
|
157
|
+
Ethereum gas can be a large share of a small amount: say so for that leg. A vault that cannot pay its withdrawal now
|
|
158
|
+
(liquidity) is a leg that cannot go ahead as asked: say so, and do not shrink it on your own.
|
|
159
|
+
3. **Through `connect`, one acknowledgement covers the whole request: `connect plan`.** Pass the legs in order,
|
|
160
|
+
`--legs "deposit <vault> <amount>; withdraw <vault> <amount|all>"`: vault tickers, at most 8 legs; `all` binds the
|
|
161
|
+
share balance read at that moment. Like `connect deposit`, the first run opens nothing and returns one
|
|
162
|
+
`acknowledgement` listing every leg, its receiver and the warnings: post it word for word and wait. Only on the
|
|
163
|
+
operator's explicit yes, run it again with the same `--legs` and `--ack <code>`: that records the yes, opens nothing,
|
|
164
|
+
and returns each leg's `command`. Full `earn_terms` still come first, before the operator's first deposit. A plan
|
|
165
|
+
with legs on EVM chains and on Solana needs both wallets connected.
|
|
166
|
+
4. **Then run the plan on one signing page: `connect plan --run`**, each shell call with a timeout of at least 9
|
|
167
|
+
minutes. It returns `in_progress` near that limit: run it again at once, and the operator's open page carries on.
|
|
168
|
+
Solana legs run on the same page; on a plan that also has EVM legs, the operator's wallet may ask once, at Start, to
|
|
169
|
+
connect its Solana account, and a wallet without one (Rabby) ends the plan there with nothing sent. **The yes covers every leg:
|
|
170
|
+
do not ask again between them.** Report each leg as in **Handing calls to the signer**, step 4.
|
|
171
|
+
5. **Stop at the first leg that does not complete**; the CLI refuses the rest. Report every leg (vault, chain, amount,
|
|
172
|
+
transactions, and which did not run; `connect plan --status` lists them). What is left needs a new plan and a new yes.
|
|
173
|
+
|
|
174
|
+
**Without `connect`, the plan is yours to show:** one table, a row per leg with the total, and a yes to it; then one
|
|
175
|
+
complete deposit or withdrawal per vault through the prepare commands, one at a time, each with its own destination check
|
|
176
|
+
(to withdraw everything, `--all` with that vault's own `sharesExact`). **"What do I hold?"** is `earn_balance` on every
|
|
177
|
+
vault `earn_vaults` lists (the EVM and the Solana account each), as one table: per vault, its chain, what it is worth
|
|
178
|
+
and what it can be withdrawn for now, with the totals.
|
|
171
179
|
|
|
172
180
|
## Solana is different
|
|
173
181
|
|
|
174
182
|
The vault on Solana (`chain: "solana"`) is a Kamino vault, not an ERC-4626 one. The same commands work on it,
|
|
175
183
|
with these differences — say them to the operator where they apply:
|
|
176
184
|
|
|
177
|
-
- **Addresses are Solana addresses** (base58, no `0x`). An EVM address for a vault on Solana is refused, and the
|
|
178
|
-
|
|
179
|
-
like any other.
|
|
185
|
+
- **Addresses are Solana addresses** (base58, no `0x`). An EVM address for a vault on Solana is refused, and the other
|
|
186
|
+
way round. The operator's Solana address comes from their own message, through the destination check, like any other.
|
|
180
187
|
- **`--receiver` must be the account itself.** The vault mints shares to the depositing account and pays a
|
|
181
188
|
withdrawal to the account whose shares burn; there is no other receiver, and anything else is refused.
|
|
182
189
|
- **One transaction, and it expires.** `earn prepare_deposit` / `prepare_withdraw` return ONE unsigned
|
|
@@ -188,8 +195,7 @@ with these differences — say them to the operator where they apply:
|
|
|
188
195
|
account. `earn status --chain solana --account …` says `NEEDS_FUNDS` when it lacks USDC or SOL.
|
|
189
196
|
- **Each withdraw instruction keeps up to 0.001 USDC in the vault** — Kamino's charge for every vault on its
|
|
190
197
|
program, which Kamino can change; a withdrawal split across reserves pays it per part — and one worth 0.001
|
|
191
|
-
USDC or less is refused. Quotes report `receives`, exact and net of it; say so before a
|
|
192
|
-
small withdrawal.
|
|
198
|
+
USDC or less is refused. Quotes report `receives`, exact and net of it; say so before a small withdrawal.
|
|
193
199
|
- **No history on Solana:** `earn_balance` reports shares, value and what a full exit would pay now, but
|
|
194
200
|
`entryBasisUsdc` and `accruedYieldUsdc` read `unknown`. Do not present the value as profit.
|
|
195
201
|
- **`connect wallet --chain solana`** connects a Solana wallet (Phantom, Solflare, Backpack, or a Privy wallet
|
|
@@ -272,12 +278,9 @@ instant-withdrawal fuses these differ by 10× — measured on a live Fusion test
|
|
|
272
278
|
worth 14.999970 USDC, `maxWithdraw()` agreed, and 1.498874 USDC already reverted because the vault
|
|
273
279
|
pays from its own 1.498873 USDC balance. `exit` is measured by simulating the withdrawal, so it is
|
|
274
280
|
right on both chassis; `exit.maxWithdrawSays` is reported only because other interfaces show it.
|
|
275
|
-
⚠️ **Without a keyed RPC these two compete for the public endpoint's rate limit.** Measured
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
scan reports CUT SHORT. Each says so in its own result, so the answer is smaller, never wrong. A
|
|
279
|
-
keyed RPC for the vault's chain (`TREASURY_RPC_BASE`, `TREASURY_RPC_ARBITRUM`, `TREASURY_RPC_ROBINHOOD`, `TREASURY_RPC_ETHEREUM`, `TREASURY_RPC_MONAD`) is what makes both available in one call. On Solana,
|
|
280
|
-
which has no scan, the keyed RPC is `TREASURY_RPC_SOLANA`.
|
|
281
|
+
⚠️ **Without a keyed RPC these two compete for the public endpoint's rate limit.** Measured 2026-09-15: with a key,
|
|
282
|
+
the exit and a whole-history scan both complete in about 15-22 s; with none, one usually degrades (the exit `not
|
|
283
|
+
measured`, or the scan CUT SHORT) and says so. The vault's chain's `TREASURY_RPC_*` (Setup) makes both available.
|
|
281
284
|
|
|
282
285
|
🔴 **`measuredAs: "not measured"` means the RPC failed, NOT that the vault refused** — say so rather
|
|
283
286
|
than reporting a limit the chain never stated.
|
|
@@ -324,7 +327,7 @@ treasury connect deposit --vault <symbol> --amount_usdc <amount> --receiver 0x
|
|
|
324
327
|
chain, vault and its explorer link, the receiver, the vault's warning and the disclosures) and an
|
|
325
328
|
`ack` code. **Post `acknowledgement` to the operator word for word and wait for their answer.** Do
|
|
326
329
|
not summarise it, shorten it, or skip it because they acknowledged an earlier one or said "go"
|
|
327
|
-
before they saw it: every page open has its own.
|
|
330
|
+
before they saw it: every page open has its own, except the legs of one `connect plan` (above).
|
|
328
331
|
3. **Only on the operator's explicit yes to that text**, run the same command again with `--ack <code>`
|
|
329
332
|
added. The page opens; the operator confirms each call there and in the wallet; the command returns
|
|
330
333
|
when they finish. Any answer but yes: stop. A refused `--ack` (expired after 15 minutes, already used,
|
|
@@ -483,9 +486,8 @@ you do it, and here is why the key stays with you."
|
|
|
483
486
|
## Reporting
|
|
484
487
|
|
|
485
488
|
State what was measured and when: the vault's `symbol` and its `chain`, the pre-flight `status`, `measuredAtBlock`,
|
|
486
|
-
and — after a transaction — the resulting shares and value. Quote `findings` verbatim when
|
|
487
|
-
|
|
488
|
-
who is told "it didn't work" cannot.
|
|
489
|
+
and — after a transaction — the resulting shares and value. Quote `findings` verbatim when something stopped you. An
|
|
490
|
+
operator who can see the block and the exact revert can act; one who is told "it didn't work" cannot.
|
|
489
491
|
|
|
490
492
|
**Show the transactions, not just the totals.** `earn_balance`'s `scan.depositTxs` and
|
|
491
493
|
`scan.withdrawTxs` carry `{ txHash, blockNumber, amountUsdc }` for the events behind the basis, and
|
|
@@ -494,9 +496,9 @@ on Arbitrum One, `https://robinhoodchain.blockscout.com/tx/<txHash>` on Robinhoo
|
|
|
494
496
|
on Ethereum and `https://monadscan.com/tx/<txHash>` on Monad. ⚠️ That is a DIFFERENT path from the
|
|
495
497
|
vault's `links.explorer`, which is `https://basescan.org/address/<vault>` (or the Arbiscan, Blockscout, Etherscan or MonadScan equivalent) — swap the `/address/…`
|
|
496
498
|
segment for `/tx/<txHash>`, never append to it, or the result is a URL that resolves to nothing.
|
|
497
|
-
With the link the operator can open what actually landed instead of taking your word for it. ⚠️ **Each list holds at
|
|
498
|
-
100 most recent, while `scan.deposits`/`scan.withdrawals` stay the TOTALS
|
|
499
|
-
|
|
499
|
+
With the link the operator can open what actually landed instead of taking your word for it. ⚠️ **Each list holds at
|
|
500
|
+
most the 100 most recent, while `scan.deposits`/`scan.withdrawals` stay the TOTALS**: when the two disagree the list is
|
|
501
|
+
partial, and say so.
|
|
500
502
|
|
|
501
503
|
# Command reference
|
|
502
504
|
|
|
@@ -598,7 +600,7 @@ No flags.
|
|
|
598
600
|
|
|
599
601
|
## treasury connect deposit
|
|
600
602
|
|
|
601
|
-
**Deposit through the connected wallet.** Builds the approve + deposit for the CONNECTED account and checks every call against the registry. Runs twice. Without --ack it opens NOTHING: it returns `needs_acknowledgement` with an `acknowledgement` to post to the operator word for word, and an `ack` code. Only after the operator replies yes, run it again with --ack <code>: then the confirm page opens, and the operator confirms each call in their wallet, one at a time. That run returns each transaction hash with `verified` read from the receipt (`matched`, `extra_transfer`, `mismatch`, `reverted`, `unverified`). Run `earn quote --direction deposit` first.
|
|
603
|
+
**Deposit through the connected wallet.** Builds the approve + deposit for the CONNECTED account and checks every call against the registry. Runs twice. Without --ack it opens NOTHING: it returns `needs_acknowledgement` with an `acknowledgement` to post to the operator word for word, and an `ack` code. Only after the operator replies yes, run it again with --ack <code>: then the confirm page opens, and the operator confirms each call in their wallet, one at a time. That run returns each transaction hash with `verified` read from the receipt (`matched`, `extra_transfer`, `mismatch`, `reverted`, `unverified`). Run `earn quote --direction deposit` first. As a leg of a plan the operator acknowledged with `connect plan`, run it with --plan <code> --leg <n> instead of --ack, exactly as the plan gave it.
|
|
602
604
|
|
|
603
605
|
Flags:
|
|
604
606
|
- `--vault` (string, optional; description: "the vault's ERC-20 ticker, as `earn vaults` lists them; omit for the default vault of `chain`")
|
|
@@ -606,10 +608,12 @@ Flags:
|
|
|
606
608
|
- `--amount_usdc` (string, required; pattern: "^\\d+(\\.\\d+)?$")
|
|
607
609
|
- `--receiver` (string, required; description: "where the money lands — it must be the CONNECTED account (this page pays no one else), and it comes from the operator's own message, never filled in by an agent")
|
|
608
610
|
- `--ack` (string, optional; description: "the code from this command's `needs_acknowledgement` result, given ONLY after the operator replied yes to its `acknowledgement`. Without it the command opens nothing and returns that acknowledgement"; pattern: "^[0-9a-fA-F]{8}$")
|
|
611
|
+
- `--plan` (string, optional; description: "run this as a leg of an acknowledged plan (`connect plan`): the plan's code, with --leg. Use the leg's command exactly as `connect plan` gave it; instead of --ack"; pattern: "^[0-9a-fA-F]{8}$")
|
|
612
|
+
- `--leg` (number, optional; description: "which leg of the plan this is (1, 2, …), with --plan; legs run in order"; maximum: 9007199254740991; exclusiveMinimum: 0)
|
|
609
613
|
|
|
610
614
|
## treasury connect withdraw
|
|
611
615
|
|
|
612
|
-
**Withdraw through the connected wallet.** Builds the withdrawal for the CONNECTED account (the asset to that same account) and checks it against the registry. Runs twice, like `connect deposit`: without --ack it opens NOTHING and returns `needs_acknowledgement` with an `acknowledgement` to post to the operator word for word; only after their yes, run it again with --ack <code> and the confirm page opens. Pass --amount_usdc, or --all with --shares_exact copied verbatim from `earn balance`. Run `earn quote --direction withdraw` first. The second run returns the hash with `verified` read from the receipt.
|
|
616
|
+
**Withdraw through the connected wallet.** Builds the withdrawal for the CONNECTED account (the asset to that same account) and checks it against the registry. Runs twice, like `connect deposit`: without --ack it opens NOTHING and returns `needs_acknowledgement` with an `acknowledgement` to post to the operator word for word; only after their yes, run it again with --ack <code> and the confirm page opens. Pass --amount_usdc, or --all with --shares_exact copied verbatim from `earn balance`. Run `earn quote --direction withdraw` first. The second run returns the hash with `verified` read from the receipt. As a leg of a plan the operator acknowledged with `connect plan`, run it with --plan <code> --leg <n> instead of --ack, exactly as the plan gave it.
|
|
613
617
|
|
|
614
618
|
Flags:
|
|
615
619
|
- `--vault` (string, optional; description: "the vault's ERC-20 ticker, as `earn vaults` lists them; omit for the default vault of `chain`")
|
|
@@ -619,3 +623,15 @@ Flags:
|
|
|
619
623
|
- `--all` (a switch, no value, optional)
|
|
620
624
|
- `--shares_exact` (string, optional; pattern: "^\\d+(\\.\\d+)?$")
|
|
621
625
|
- `--ack` (string, optional; description: "the code from this command's `needs_acknowledgement` result, given ONLY after the operator replied yes to its `acknowledgement`. Without it the command opens nothing and returns that acknowledgement"; pattern: "^[0-9a-fA-F]{8}$")
|
|
626
|
+
- `--plan` (string, optional; description: "run this as a leg of an acknowledged plan (`connect plan`): the plan's code, with --leg. Use the leg's command exactly as `connect plan` gave it; instead of --ack"; pattern: "^[0-9a-fA-F]{8}$")
|
|
627
|
+
- `--leg` (number, optional; description: "which leg of the plan this is (1, 2, …), with --plan; legs run in order"; maximum: 9007199254740991; exclusiveMinimum: 0)
|
|
628
|
+
|
|
629
|
+
## treasury connect plan
|
|
630
|
+
|
|
631
|
+
**One acknowledgement for several deposits and withdrawals.** For a request that moves money in more than one vault (any mix of deposits and withdrawals, across chains): ONE acknowledgement for the whole plan instead of one per vault. Runs twice, like `connect deposit`. Pass --legs, e.g. "deposit tlCashPlusUSDC2B 25; withdraw tlCashPlusUSDC2G all" (each leg "deposit <vault> <amount>" or "withdraw <vault> <amount|all>"; "all" redeems the share balance read now). Without --ack it opens NOTHING: every leg is built and checked as its own run would be, and it returns `needs_acknowledgement` with ONE `acknowledgement` covering every leg, to post to the operator word for word, and an `ack` code. Only after the operator replies yes, run it again with the same --legs and --ack <code>: that records the yes, opens nothing, and returns each leg's exact command. Then run `connect plan --run`: one signing page walks every leg in order, EVM and Solana legs alike (a leg can also run on a page of its own, as `connect deposit|withdraw … --plan <code> --leg <n>`, which is each leg's `command`). A leg that does not complete ends the plan. --status (alone) reports the plan's legs and their transactions. Each EVM and Solana leg needs that family's wallet connected; money lands only in the connected account.
|
|
632
|
+
|
|
633
|
+
Flags:
|
|
634
|
+
- `--legs` (string, optional; description: "the plan, in order: legs separated by \";\", each \"deposit <vault> <amount>\" or \"withdraw <vault> <amount|all>\" — vaults by their ticker, as `earn vaults` lists them; amounts the operator chose")
|
|
635
|
+
- `--ack` (string, optional; description: "the code from this command's `needs_acknowledgement` result, given ONLY after the operator replied yes to its `acknowledgement`. Without it the command opens nothing and returns that acknowledgement"; pattern: "^[0-9a-fA-F]{8}$")
|
|
636
|
+
- `--status` (a switch, no value, optional; description: "report the current plan and each leg's status and transactions; reads a local file only")
|
|
637
|
+
- `--run` (a switch, no value, optional; description: "open ONE signing page for every leg of the acknowledged plan (EVM and Solana legs), instead of one page per leg; returns `in_progress` when the shell's time limit is near: run it again and the operator's open page carries on")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalabs/treasury",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,15 +49,18 @@
|
|
|
49
49
|
"lint:skill": "bash scripts/lint-skill.sh"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/kit": "^8.
|
|
53
|
-
"viem": "^2.57.
|
|
52
|
+
"@solana/kit": "^8.6.0",
|
|
53
|
+
"viem": "^2.57.16",
|
|
54
54
|
"zod": "^4.1.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.15.0",
|
|
58
|
-
"tsup": "^
|
|
58
|
+
"tsup": "^9.0.0",
|
|
59
59
|
"tsx": "^4.20.0",
|
|
60
60
|
"typescript": "^5.9.0",
|
|
61
|
-
"vitest": "^5.
|
|
61
|
+
"vitest": "^5.1.0"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"esbuild@^0.27.0": "0.27.2"
|
|
62
65
|
}
|
|
63
66
|
}
|