@temporalabs/treasury 0.1.2 → 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 +45 -13
- package/THIRD_PARTY_NOTICES.connect-page.md +494 -24
- package/THIRD_PARTY_NOTICES.md +579 -6
- package/dist/cli.js +28 -5
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +50 -209
- package/dist/client.js +66 -11
- package/dist/client.js.map +1 -1
- package/dist/config/earn.d.ts +16 -1
- package/dist/config/earn.js +16 -1
- package/dist/config/earn.js.map +1 -1
- package/dist/connect/ack.d.ts +88 -1
- package/dist/connect/ack.js +177 -6
- package/dist/connect/ack.js.map +1 -1
- package/dist/connect/commands.d.ts +30 -0
- package/dist/connect/commands.js +846 -88
- package/dist/connect/commands.js.map +1 -1
- package/dist/connect/config.d.ts +7 -5
- package/dist/connect/config.js +8 -6
- package/dist/connect/config.js.map +1 -1
- package/dist/connect/gate-solana.d.ts +8 -0
- package/dist/connect/gate-solana.js +147 -0
- package/dist/connect/gate-solana.js.map +1 -0
- package/dist/connect/http.d.ts +17 -2
- package/dist/connect/http.js +45 -13
- package/dist/connect/http.js.map +1 -1
- package/dist/connect/page.d.ts +1 -1
- package/dist/connect/page.js +2 -2
- package/dist/connect/page.js.map +1 -1
- package/dist/connect/session.d.ts +40 -1
- package/dist/connect/session.js +243 -2
- package/dist/connect/session.js.map +1 -1
- package/dist/connect/solana.d.ts +112 -0
- package/dist/connect/solana.js +370 -0
- package/dist/connect/solana.js.map +1 -0
- package/dist/connect-page.js +835 -671
- package/dist/disclosures.d.ts +7 -4
- package/dist/disclosures.js +7 -4
- package/dist/disclosures.js.map +1 -1
- package/dist/earn/commands.js +127 -54
- package/dist/earn/commands.js.map +1 -1
- package/dist/earn/solana.d.ts +278 -0
- package/dist/earn/solana.js +316 -0
- package/dist/earn/solana.js.map +1 -0
- package/dist/guide.d.ts +15 -0
- package/dist/guide.js +50 -0
- package/dist/guide.js.map +1 -0
- package/dist/links.js +2 -0
- package/dist/links.js.map +1 -1
- package/dist/position.d.ts +3 -2
- package/dist/position.js +6 -3
- package/dist/position.js.map +1 -1
- package/dist/quote.js +2 -2
- package/dist/quote.js.map +1 -1
- package/dist/redact.js +7 -1
- package/dist/redact.js.map +1 -1
- package/dist/registry-schema.d.ts +79 -2
- package/dist/registry-schema.js +77 -1
- package/dist/registry-schema.js.map +1 -1
- package/dist/registry.d.ts +21 -1
- package/dist/registry.js +48 -10
- package/dist/registry.js.map +1 -1
- package/dist/solana/constants.d.ts +49 -0
- package/dist/solana/constants.js +50 -0
- package/dist/solana/constants.js.map +1 -0
- package/dist/solana/kvault.d.ts +99 -0
- package/dist/solana/kvault.js +192 -0
- package/dist/solana/kvault.js.map +1 -0
- package/dist/solana/layout.d.ts +143 -0
- package/dist/solana/layout.js +209 -0
- package/dist/solana/layout.js.map +1 -0
- package/dist/solana/rpc.d.ts +24 -0
- package/dist/solana/rpc.js +66 -0
- package/dist/solana/rpc.js.map +1 -0
- package/dist/solana/vault.d.ts +153 -0
- package/dist/solana/vault.js +322 -0
- package/dist/solana/vault.js.map +1 -0
- package/dist/treasury.mjs +37410 -27965
- package/dist/version.js +5 -10
- package/dist/version.js.map +1 -1
- package/llms.txt +637 -0
- package/package.json +14 -8
- package/registry/vaults.json +113 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `treasury connect` on Solana: the sign-in and the confirm flow for a vault on Solana. The counterparts of
|
|
3
|
+
* `runConnect` and `runConfirm` in `commands.ts`, on the same one-shot local page and the same rules:
|
|
4
|
+
*
|
|
5
|
+
* - Sign-in: the operator's Solana wallet (a browser wallet, or a Privy wallet from an email or social login)
|
|
6
|
+
* signs a free sign-in message whose nonce is this flow's secret; the signature is checked here (ed25519).
|
|
7
|
+
* - Confirm: the page asks this process for the transaction when the operator presses Confirm — a Solana
|
|
8
|
+
* transaction names a blockhash and lands only within about a minute, so it is built then, not when the
|
|
9
|
+
* page opened — and every transaction built is held to the acknowledged intent by the gate
|
|
10
|
+
* (`gate-solana.ts`) and simulated before the page receives it. The wallet signs and sends it; this process
|
|
11
|
+
* then reads the signature's status and the account's token balances.
|
|
12
|
+
*
|
|
13
|
+
* Nothing here signs or sends.
|
|
14
|
+
*/
|
|
15
|
+
import { getBase58Encoder, getBase64Encoder, getPublicKeyFromAddress, isAddress as isSolanaAddress, verifySignature } from "@solana/kit";
|
|
16
|
+
import { solanaRpcUrlFromEnv } from "../client.js";
|
|
17
|
+
import { redactEndpoints } from "../redact.js";
|
|
18
|
+
import { formatAmount } from "../units.js";
|
|
19
|
+
import { associatedTokenAccount } from "../solana/kvault.js";
|
|
20
|
+
import { makeSolanaRpc } from "../solana/rpc.js";
|
|
21
|
+
import { compileUnsigned, depositInstructions, describeSimulation, freshLifetime, isWithdrawInstruction, partialWithdrawal, readVault, simulate, simulateWithdrawal, tokenBalance, withdrawInstructions } from "../solana/vault.js";
|
|
22
|
+
import { admitSolana } from "./gate-solana.js";
|
|
23
|
+
import { serveOnce } from "./http.js";
|
|
24
|
+
export function solanaSignInMessage(a) {
|
|
25
|
+
return [
|
|
26
|
+
`${new URL(a.origin).host} wants you to sign in with your Solana account:`,
|
|
27
|
+
a.address,
|
|
28
|
+
"",
|
|
29
|
+
"Connect this wallet to Open Agent Treasury. This signature costs no fee and authorizes no transaction.",
|
|
30
|
+
"",
|
|
31
|
+
`URI: ${a.origin}`,
|
|
32
|
+
"Version: 1",
|
|
33
|
+
"Chain ID: mainnet",
|
|
34
|
+
`Nonce: ${a.nonce}`,
|
|
35
|
+
`Issued At: ${a.issuedAt}`,
|
|
36
|
+
].join("\n");
|
|
37
|
+
}
|
|
38
|
+
/** Checks an ed25519 signature (base64) over `message` against the Solana address that claims it. */
|
|
39
|
+
export async function verifySolanaSignIn(address, message, signatureBase64) {
|
|
40
|
+
try {
|
|
41
|
+
const sig = getBase64Encoder().encode(signatureBase64);
|
|
42
|
+
if (sig.length !== 64)
|
|
43
|
+
return false;
|
|
44
|
+
const key = await getPublicKeyFromAddress(address);
|
|
45
|
+
return await verifySignature(key, sig, new TextEncoder().encode(message));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export async function runConnectSolana(deps) {
|
|
52
|
+
const handle = await serveOnce({
|
|
53
|
+
mode: "connect",
|
|
54
|
+
ttlMs: deps.ttlMs,
|
|
55
|
+
html: (s) => deps.html(s, "Connect to Open Agent Treasury"),
|
|
56
|
+
csp: deps.csp,
|
|
57
|
+
assets: deps.assets,
|
|
58
|
+
ports: deps.ports,
|
|
59
|
+
info: () => ({ mode: "connect", chain: "solana", appId: deps.appId }),
|
|
60
|
+
challengeAddress: (a) => (typeof a === "string" && isSolanaAddress(a) ? a : undefined),
|
|
61
|
+
challenge: (address, origin, nonce) => solanaSignInMessage({ address, origin, nonce, issuedAt: new Date().toISOString() }),
|
|
62
|
+
accept: async (body, ctx) => {
|
|
63
|
+
const address = body["address"];
|
|
64
|
+
if (typeof address !== "string" || !isSolanaAddress(address))
|
|
65
|
+
return { ok: false, reason: "not a Solana address" };
|
|
66
|
+
if (!ctx.message || ctx.challengedAddress !== address)
|
|
67
|
+
return { ok: false, reason: "no sign-in message was issued for this address" };
|
|
68
|
+
const sig = body["signature"];
|
|
69
|
+
if (typeof sig !== "string" || !/^[A-Za-z0-9+/]+={0,2}$/.test(sig))
|
|
70
|
+
return { ok: false, reason: "malformed signature" };
|
|
71
|
+
const walletType = body["walletType"] === "embedded" ? "embedded" : "external";
|
|
72
|
+
if (!(await verifySolanaSignIn(address, ctx.message, sig)))
|
|
73
|
+
return { ok: false, reason: "the signature does not match the address" };
|
|
74
|
+
return { ok: true, final: true, value: { account: address, walletType, connectedAtIso: new Date().toISOString() } };
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
const opened = deps.open(handle.url);
|
|
78
|
+
return { result: await handle.done, url: handle.url, opened };
|
|
79
|
+
}
|
|
80
|
+
const wellFormedSignature = (s) => typeof s === "string" && /^[1-9A-HJ-NP-Za-km-z]{86,88}$/.test(s) && getBase58Encoder().encode(s).length === 64;
|
|
81
|
+
/** The account's balance of `mint` before and after the transaction, from its own token-balance records. */
|
|
82
|
+
function tokenDelta(meta, owner, mint) {
|
|
83
|
+
const pick = (list) => BigInt(list?.find((b) => b.owner === owner && b.mint === mint)?.uiTokenAmount.amount ?? "0");
|
|
84
|
+
return pick(meta.postTokenBalances) - pick(meta.preTokenBalances);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Every token account of `mint` the transaction touched, from its token-balance records: the account's own net
|
|
88
|
+
* change, and each OTHER owner whose balance rose (money the transaction sent there). `net` is the sum over all
|
|
89
|
+
* of them, 0 when the transaction only moved the asset around. A string says why the records cannot answer.
|
|
90
|
+
*/
|
|
91
|
+
function assetFlows(meta, owner, mint) {
|
|
92
|
+
const pre = (meta.preTokenBalances ?? []).filter((b) => b.mint === mint);
|
|
93
|
+
const post = (meta.postTokenBalances ?? []).filter((b) => b.mint === mint);
|
|
94
|
+
const byIndex = new Map();
|
|
95
|
+
for (const b of pre) {
|
|
96
|
+
if (b.accountIndex === undefined)
|
|
97
|
+
return "the transaction's token-balance records do not name their accounts";
|
|
98
|
+
byIndex.set(b.accountIndex, { owner: b.owner, before: BigInt(b.uiTokenAmount.amount) });
|
|
99
|
+
}
|
|
100
|
+
for (const b of post) {
|
|
101
|
+
if (b.accountIndex === undefined)
|
|
102
|
+
return "the transaction's token-balance records do not name their accounts";
|
|
103
|
+
const row = byIndex.get(b.accountIndex);
|
|
104
|
+
byIndex.set(b.accountIndex, { owner: b.owner ?? row?.owner, before: row?.before ?? 0n, after: BigInt(b.uiTokenAmount.amount) });
|
|
105
|
+
}
|
|
106
|
+
let own = 0n;
|
|
107
|
+
let net = 0n;
|
|
108
|
+
const rose = [];
|
|
109
|
+
for (const row of byIndex.values()) {
|
|
110
|
+
if (row.owner === undefined)
|
|
111
|
+
return "the transaction's token-balance records do not name the owner of every account they list";
|
|
112
|
+
// No record after: the account was closed, which the token program allows only at a balance of 0. One that
|
|
113
|
+
// held the asset before and has no record after is a record missing, not a balance that fell to 0.
|
|
114
|
+
if (row.after === undefined) {
|
|
115
|
+
if (row.before !== 0n)
|
|
116
|
+
return `the transaction's token-balance records hold no balance after it for an account of ${row.owner} that held ${row.before} base units before`;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const delta = row.after - row.before;
|
|
120
|
+
net += delta;
|
|
121
|
+
if (row.owner === owner)
|
|
122
|
+
own += delta;
|
|
123
|
+
else if (delta > 0n)
|
|
124
|
+
rose.push({ to: row.owner, amountRaw: delta });
|
|
125
|
+
}
|
|
126
|
+
return { own, rose, net };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Did the transaction land, and do the account's own balances say it did what was acknowledged? Read from the
|
|
130
|
+
* signature's status and the transaction's token-balance records — not from the wallet's word, and not from
|
|
131
|
+
* a blockhash-expiry wait: a wallet can report "block height exceeded" for a transaction that in fact landed.
|
|
132
|
+
*/
|
|
133
|
+
export async function verifySolanaLanded(rpc, signature, intent, account, opts) {
|
|
134
|
+
const sig = signature;
|
|
135
|
+
for (let i = 0; i < (opts.attempts ?? 45) && Date.now() < opts.deadline; i++) {
|
|
136
|
+
const st = (await rpc.getSignatureStatuses([sig], { searchTransactionHistory: true }).send()).value[0];
|
|
137
|
+
if (st && st.err)
|
|
138
|
+
return { verified: "reverted", detail: `the transaction failed on chain: ${JSON.stringify(st.err, (_k, x) => (typeof x === "bigint" ? x.toString() : x))}` };
|
|
139
|
+
if (st && (st.confirmationStatus === "confirmed" || st.confirmationStatus === "finalized")) {
|
|
140
|
+
const tx = await rpc.getTransaction(sig, { commitment: "confirmed", maxSupportedTransactionVersion: 0, encoding: "json" }).send();
|
|
141
|
+
if (!tx || !tx.meta)
|
|
142
|
+
return { verified: "unverified", detail: "the signature is confirmed but its transaction could not be read; look it up before retrying anything" };
|
|
143
|
+
const meta = tx.meta;
|
|
144
|
+
if (meta.err)
|
|
145
|
+
return { verified: "reverted", detail: `the transaction failed on chain: ${JSON.stringify(meta.err)}` };
|
|
146
|
+
if (!meta.preTokenBalances || !meta.postTokenBalances)
|
|
147
|
+
return { verified: "unverified", detail: "the transaction landed, but this RPC returned no token-balance records for it, so what it moved cannot be checked; look it up before retrying anything" };
|
|
148
|
+
// Bound to what this flow built: the page is handed a transaction with a fresh blockhash, recorded in
|
|
149
|
+
// `built`. A signature for any other transaction — an older one of the same shape, or a share transfer
|
|
150
|
+
// — names another blockhash, and its balances say nothing about this deposit or withdrawal.
|
|
151
|
+
const message = tx.transaction?.message;
|
|
152
|
+
if (!message?.recentBlockhash || !opts.built.has(message.recentBlockhash)) {
|
|
153
|
+
return { verified: "mismatch", detail: `${signature} is not the transaction this page built (its blockhash is not one handed to the page); check \`earn balance --chain solana\` before retrying anything` };
|
|
154
|
+
}
|
|
155
|
+
if (message.accountKeys?.[0] !== account) {
|
|
156
|
+
return { verified: "mismatch", detail: `${signature} was paid for by ${message.accountKeys?.[0] ?? "an unknown account"}, not the connected account` };
|
|
157
|
+
}
|
|
158
|
+
const shares = tokenDelta(meta, account, intent.vault.sharesMint);
|
|
159
|
+
const asset = tokenDelta(meta, account, intent.vault.asset.address);
|
|
160
|
+
const a = intent.vault.asset;
|
|
161
|
+
if (intent.kind === "deposit") {
|
|
162
|
+
if (shares <= 0n)
|
|
163
|
+
return { verified: "mismatch", detail: `the transaction landed but the account received no ${intent.vault.symbol} shares` };
|
|
164
|
+
// The program mints whole share units and takes only the asset that backs them, so it can take less than
|
|
165
|
+
// asked by up to one share unit's worth (measured: 1,999,999 of 2,000,000). Short by more is not this deposit.
|
|
166
|
+
const taken = -asset;
|
|
167
|
+
if (taken < intent.raw && (intent.raw - taken) * shares >= taken + shares) {
|
|
168
|
+
return { verified: "mismatch", detail: `the transaction landed, but the account's ${a.symbol} fell by ${formatAmount(-asset > 0n ? -asset : 0n, a.decimals)} ${a.symbol}, not the ${formatAmount(intent.raw, a.decimals)} ${a.symbol} acknowledged` };
|
|
169
|
+
}
|
|
170
|
+
if (-asset > intent.raw) {
|
|
171
|
+
return { verified: "extra_transfer", detail: `the deposit landed, and the account's ${a.symbol} fell by ${formatAmount(-asset, a.decimals)}, more than the ${formatAmount(intent.raw, a.decimals)} deposited. Tell the operator.`, alsoMoved: [{ to: "unknown", amountRaw: (-asset - intent.raw).toString() }] };
|
|
172
|
+
}
|
|
173
|
+
return { verified: "matched", detail: `received ${formatAmount(shares, intent.vault.shareDecimals)} ${intent.vault.symbol}` };
|
|
174
|
+
}
|
|
175
|
+
// The program pays what a leg can and leaves the rest of the shares with the account, without an error. Up to
|
|
176
|
+
// one share unit per withdraw instruction is rounding, the same allowance the simulation before sending makes.
|
|
177
|
+
const keys = message.accountKeys ?? [];
|
|
178
|
+
const legs = (message.instructions ?? []).filter((ix) => isWithdrawInstruction(keys[ix.programIdIndex] ?? "", getBase58Encoder().encode(ix.data))).length;
|
|
179
|
+
if (-shares > intent.raw || -shares + BigInt(legs) < intent.raw) {
|
|
180
|
+
return { verified: "mismatch", detail: `a PARTIAL withdrawal: it burned ${formatAmount(-shares, intent.vault.shareDecimals)} of the ${formatAmount(intent.raw, intent.vault.shareDecimals)} shares acknowledged and paid ${formatAmount(asset > 0n ? asset : 0n, intent.vault.asset.decimals)} ${intent.vault.asset.symbol}; the rest of the shares are still in the account. Check \`earn balance --chain solana\` before withdrawing again.` };
|
|
181
|
+
}
|
|
182
|
+
// What the vault paid out, from every account of the asset: the account's own rise plus anything the same
|
|
183
|
+
// transaction sent on to another owner. Each such owner is reported, as an outgoing transfer is on EVM.
|
|
184
|
+
const flows = assetFlows(meta, account, a.address);
|
|
185
|
+
if (typeof flows === "string")
|
|
186
|
+
return { verified: "unverified", detail: `${flows}; look the transaction up before retrying anything` };
|
|
187
|
+
if (flows.net !== 0n) {
|
|
188
|
+
return { verified: "mismatch", detail: `the ${a.symbol} balances in this transaction do not add up: they ${flows.net > 0n ? "rose" : "fell"} by ${formatAmount(flows.net > 0n ? flows.net : -flows.net, a.decimals)} ${a.symbol} in total, which a withdrawal cannot do` };
|
|
189
|
+
}
|
|
190
|
+
const alsoMoved = flows.rose.map((r) => ({ to: r.to, amountRaw: r.amountRaw.toString() }));
|
|
191
|
+
const paid = flows.own + flows.rose.reduce((sum, r) => sum + r.amountRaw, 0n);
|
|
192
|
+
if (paid <= 0n)
|
|
193
|
+
return { verified: "mismatch", detail: `the shares burned but the account's ${a.symbol} did not rise`, ...(alsoMoved.length ? { alsoMoved } : {}) };
|
|
194
|
+
// A withdrawal by amount pays what was acknowledged, less what Kamino keeps of each withdraw instruction
|
|
195
|
+
// (up to 0.001 of the asset, as the acknowledgement says). The shares were rounded up, so it can pay more.
|
|
196
|
+
const keptPerLeg = 10n ** BigInt(Math.max(a.decimals - 3, 0));
|
|
197
|
+
if (intent.assets !== undefined && paid + keptPerLeg * BigInt(legs) < intent.assets) {
|
|
198
|
+
return { verified: "mismatch", detail: `the withdrawal paid ${formatAmount(paid, a.decimals)} ${a.symbol}, less than the ${formatAmount(intent.assets, a.decimals)} ${a.symbol} acknowledged, by more than the up to ${formatAmount(keptPerLeg, a.decimals)} ${a.symbol} Kamino keeps per withdraw instruction. Tell the operator.`, ...(alsoMoved.length ? { alsoMoved } : {}) };
|
|
199
|
+
}
|
|
200
|
+
// The simulation of exactly this transaction, before it was handed to the wallet. A share's value only accrues
|
|
201
|
+
// between the two, so paying less (beyond rounding) means the vault lost value or the transaction differs.
|
|
202
|
+
const simulated = opts.simulated?.get(message.recentBlockhash);
|
|
203
|
+
if (simulated !== undefined && paid + BigInt(legs) < simulated) {
|
|
204
|
+
return { verified: "mismatch", detail: `the withdrawal paid ${formatAmount(paid, a.decimals)} ${a.symbol}, less than the ${formatAmount(simulated, a.decimals)} ${a.symbol} its simulation before sending paid. Tell the operator.`, ...(alsoMoved.length ? { alsoMoved } : {}) };
|
|
205
|
+
}
|
|
206
|
+
if (alsoMoved.length) {
|
|
207
|
+
return { verified: "extra_transfer", detail: `the withdrawal landed and paid ${formatAmount(paid, a.decimals)} ${a.symbol}, and in the same transaction ${formatAmount(paid - flows.own, a.decimals)} ${a.symbol} of it went to another owner (alsoMoved). That was not part of the withdrawal. Tell the operator. (SOL the transaction moved is not checked, as on EVM.)`, alsoMoved };
|
|
208
|
+
}
|
|
209
|
+
return { verified: "matched", detail: `received ${formatAmount(paid, a.decimals)} ${a.symbol} (SOL the transaction moved is not checked, as on EVM)` };
|
|
210
|
+
}
|
|
211
|
+
await new Promise((r) => setTimeout(r, opts.delayMs ?? 2_000));
|
|
212
|
+
}
|
|
213
|
+
return { verified: "unverified", detail: "no confirmation within the wait; look the signature up before retrying anything" };
|
|
214
|
+
}
|
|
215
|
+
/** Builds the intent's transaction now, holds it to the intent through the gate, and simulates it. */
|
|
216
|
+
export async function buildForIntent(rpc, intent, account) {
|
|
217
|
+
const v = await readVault(rpc, intent.vault);
|
|
218
|
+
const ixs = intent.kind === "deposit" ? await depositInstructions(v, account, intent.raw) : await withdrawInstructions(v, account, intent.raw);
|
|
219
|
+
const life = await freshLifetime(rpc);
|
|
220
|
+
const wire = compileUnsigned(ixs, account, life).base64;
|
|
221
|
+
const admitted = await admitSolana(wire, account);
|
|
222
|
+
if (admitted.kind !== intent.kind || admitted.vault.address !== intent.vault.address || admitted.amount !== intent.raw) {
|
|
223
|
+
throw new Error(`refused: the transaction built (${admitted.kind} ${admitted.amount} on ${admitted.vault.symbol}) is not the one acknowledged (${intent.kind} ${intent.raw} on ${intent.vault.symbol})`);
|
|
224
|
+
}
|
|
225
|
+
if (intent.kind === "deposit") {
|
|
226
|
+
const sim = await simulate(rpc, ixs, account, []);
|
|
227
|
+
if (!sim.ok)
|
|
228
|
+
throw new Error(`the simulated deposit fails at slot ${sim.slot}: ${describeSimulation(sim)}`);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// A leg the program caps would land as a partial withdrawal with no error, so the shares it burns are
|
|
232
|
+
// checked here, before the page opens, rather than only after it lands.
|
|
233
|
+
const { sim, burned, legs, received } = await simulateWithdrawal(rpc, v, account, ixs);
|
|
234
|
+
if (burned === undefined)
|
|
235
|
+
throw new Error(`the simulated withdraw fails at slot ${sim.slot}: ${describeSimulation(sim)}`);
|
|
236
|
+
const partial = partialWithdrawal(intent.raw, burned, legs, intent.vault.shareDecimals, sim.slot);
|
|
237
|
+
if (partial)
|
|
238
|
+
throw new Error(`refused: ${partial}`);
|
|
239
|
+
return { wire, expiresAfterBlockHeight: life.lastValidBlockHeight.toString(), blockhash: life.blockhash, ...(received !== undefined ? { received } : {}) };
|
|
240
|
+
}
|
|
241
|
+
return { wire, expiresAfterBlockHeight: life.lastValidBlockHeight.toString(), blockhash: life.blockhash };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The confirm flow on Solana without its page. The caller runs the gate first (`buildForIntent`), before any page
|
|
245
|
+
* opens or leg starts; the transaction the wallet gets is built again at the operator's press (`build`), and only a
|
|
246
|
+
* signature for a transaction built here, for this intent, can verify. `deadline`: when every chain read stops waiting.
|
|
247
|
+
*/
|
|
248
|
+
export async function prepareConfirmSolana(intent, session, rpc, verifyOpts, deadline,
|
|
249
|
+
/** A plan's earlier steps: a signature already on record for one of them is never this step's transaction. */
|
|
250
|
+
recordedElsewhere) {
|
|
251
|
+
const account = session.account;
|
|
252
|
+
const done = [];
|
|
253
|
+
// Every blockhash a transaction handed to the page was built with: the landed one must name one of them.
|
|
254
|
+
const built = new Set();
|
|
255
|
+
// What the simulation of each built withdrawal paid, by its blockhash: the landed one is held to it.
|
|
256
|
+
const simulated = new Map();
|
|
257
|
+
let stopReason;
|
|
258
|
+
const a = intent.vault.asset;
|
|
259
|
+
const description = intent.kind === "deposit"
|
|
260
|
+
? `Deposit ${formatAmount(intent.raw, a.decimals)} ${a.symbol} into ${intent.vault.name}`
|
|
261
|
+
: `Withdraw: burn ${formatAmount(intent.raw, intent.vault.shareDecimals)} ${intent.vault.symbol} for ${a.symbol}, to this wallet`;
|
|
262
|
+
const balances = await Promise.race([
|
|
263
|
+
(async () => {
|
|
264
|
+
const [held, sol] = await Promise.all([tokenBalance(rpc, await associatedTokenAccount(account, a.address)), rpc.getBalance(account).send()]);
|
|
265
|
+
return { asset: held.amount.toString(), native: sol.value.toString() };
|
|
266
|
+
})().catch(() => undefined),
|
|
267
|
+
new Promise((r) => setTimeout(() => r(undefined), 5_000)),
|
|
268
|
+
]);
|
|
269
|
+
return {
|
|
270
|
+
done,
|
|
271
|
+
stopReason: () => stopReason,
|
|
272
|
+
onReject: (body) => {
|
|
273
|
+
const sig = body["hash"];
|
|
274
|
+
if (!wellFormedSignature(sig) || done.some((t) => t.hash === sig))
|
|
275
|
+
return;
|
|
276
|
+
done.push({ step: 1, description, hash: sig, verified: "unverified", detail: "the page reported this transaction but could not hand it over for checking; look it up before retrying anything" });
|
|
277
|
+
},
|
|
278
|
+
info: () => ({
|
|
279
|
+
chain: "solana",
|
|
280
|
+
account,
|
|
281
|
+
walletType: session.walletType,
|
|
282
|
+
chainName: "Solana",
|
|
283
|
+
kind: intent.kind,
|
|
284
|
+
description,
|
|
285
|
+
next: done.length,
|
|
286
|
+
txBase: "https://solscan.io/tx/",
|
|
287
|
+
asset: { symbol: a.symbol, decimals: a.decimals },
|
|
288
|
+
nativeSymbol: "SOL",
|
|
289
|
+
...(balances ? { balances } : {}),
|
|
290
|
+
...(intent.kind === "deposit" ? { needs: intent.raw.toString() } : {}),
|
|
291
|
+
vault: { symbol: intent.vault.symbol, name: intent.vault.name, address: intent.vault.address, asset: a.symbol, links: { explorer: `https://solscan.io/account/${intent.vault.address}` } },
|
|
292
|
+
}),
|
|
293
|
+
build: async () => {
|
|
294
|
+
if (done.length > 0)
|
|
295
|
+
return { ok: false, reason: "the transaction was already sent" };
|
|
296
|
+
try {
|
|
297
|
+
const { received, ...reply } = await buildForIntent(rpc, intent, account);
|
|
298
|
+
built.add(reply.blockhash);
|
|
299
|
+
if (received !== undefined)
|
|
300
|
+
simulated.set(reply.blockhash, received);
|
|
301
|
+
return { ok: true, reply };
|
|
302
|
+
}
|
|
303
|
+
catch (e) {
|
|
304
|
+
return { ok: false, reason: redactEndpoints(e instanceof Error ? e.message : String(e)) };
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
accept: async (sig) => {
|
|
308
|
+
if (done.length > 0)
|
|
309
|
+
return { ok: false, reason: "the transaction was already reported" };
|
|
310
|
+
if (!wellFormedSignature(sig))
|
|
311
|
+
return { ok: false, reason: "malformed transaction signature" };
|
|
312
|
+
// Two identical steps can be built on the same blockhash, so the blockhash binding alone cannot tell them apart.
|
|
313
|
+
if (recordedElsewhere?.(sig)) {
|
|
314
|
+
const detail = `${sig} is the transaction of an earlier step of this plan, not one built for this step; check \`earn balance --chain solana\` before retrying anything`;
|
|
315
|
+
done.push({ step: 1, description, hash: sig, verified: "mismatch", detail });
|
|
316
|
+
stopReason = `the ${intent.kind} is mismatch: ${detail}`;
|
|
317
|
+
return { ok: true, kind: "stop", reply: { stop: true, verdict: { verified: "mismatch", detail } } };
|
|
318
|
+
}
|
|
319
|
+
const entry = { step: 1, description, hash: sig, verified: "unverified", detail: "the flow ended while this transaction was still being checked" };
|
|
320
|
+
done.push(entry);
|
|
321
|
+
let verdict;
|
|
322
|
+
try {
|
|
323
|
+
verdict = await verifySolanaLanded(rpc, sig, intent, account, { ...verifyOpts, deadline, built, simulated });
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
verdict = { verified: "unverified", detail: `could not check ${sig}: ${redactEndpoints(e instanceof Error ? e.message : String(e))}; look it up before retrying anything` };
|
|
327
|
+
}
|
|
328
|
+
delete entry.detail;
|
|
329
|
+
Object.assign(entry, verdict);
|
|
330
|
+
if (verdict.verified !== "matched" && verdict.verified !== "extra_transfer") {
|
|
331
|
+
stopReason = `the ${intent.kind} is ${verdict.verified}: ${verdict.detail ?? "it did not land as confirmed"}`;
|
|
332
|
+
return { ok: true, kind: "stop", reply: { stop: true, verdict } };
|
|
333
|
+
}
|
|
334
|
+
return { ok: true, kind: "finished", reply: { finished: true, verdict } };
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
export async function runConfirmSolana(intent, session, deps) {
|
|
339
|
+
const rpc = deps.rpc ?? makeSolanaRpc(solanaRpcUrlFromEnv());
|
|
340
|
+
// The gate runs before any page opens, on a transaction built for exactly this intent.
|
|
341
|
+
await buildForIntent(rpc, intent, session.account);
|
|
342
|
+
const core = await prepareConfirmSolana(intent, session, rpc, deps.verifyOpts, Date.now() + deps.ttlMs, deps.recordedElsewhere);
|
|
343
|
+
const { done } = core;
|
|
344
|
+
const handle = await serveOnce({
|
|
345
|
+
mode: "confirm",
|
|
346
|
+
ttlMs: deps.ttlMs,
|
|
347
|
+
...(deps.cancelGraceMs !== undefined ? { cancelGraceMs: deps.cancelGraceMs } : {}),
|
|
348
|
+
timeoutReason: () => (done.length ? `the ${Math.round(deps.ttlMs / 60_000)}-minute limit ran out after the transaction was reported` : `nothing happened in the browser within ${Math.round(deps.ttlMs / 60_000)} minutes`),
|
|
349
|
+
onReject: core.onReject,
|
|
350
|
+
html: (s) => deps.html(s, "Confirm — Open Agent Treasury"),
|
|
351
|
+
csp: deps.csp,
|
|
352
|
+
assets: deps.assets,
|
|
353
|
+
ports: deps.ports,
|
|
354
|
+
info: () => ({ mode: "confirm", appId: deps.appId, ...core.info() }),
|
|
355
|
+
accept: async (body) => {
|
|
356
|
+
// The page asks for the transaction at the moment the operator confirms.
|
|
357
|
+
if (body["build"] === true) {
|
|
358
|
+
const b = await core.build();
|
|
359
|
+
return b.ok ? { ok: true, final: false, reply: b.reply } : b;
|
|
360
|
+
}
|
|
361
|
+
const r = await core.accept(body["hash"]);
|
|
362
|
+
return r.ok ? { ok: true, final: true, value: done, reply: r.reply } : r;
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
const opened = deps.open(handle.url);
|
|
366
|
+
const result = await handle.done;
|
|
367
|
+
const stopReason = core.stopReason();
|
|
368
|
+
return { result, url: handle.url, opened, done, total: 1, ...(stopReason ? { stopReason } : {}) };
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=solana.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../src/connect/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,SAAS,IAAI,eAAe,EAAE,eAAe,EAAqD,MAAM,aAAa,CAAC;AAC5L,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACpO,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAgB,MAAM,WAAW,CAAC;AAIpD,MAAM,UAAU,mBAAmB,CAAC,CAAuE;IACzG,OAAO;QACL,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,iDAAiD;QAC1E,CAAC,CAAC,OAAO;QACT,EAAE;QACF,wGAAwG;QACxG,EAAE;QACF,QAAQ,CAAC,CAAC,MAAM,EAAE;QAClB,YAAY;QACZ,mBAAmB;QACnB,UAAU,CAAC,CAAC,KAAK,EAAE;QACnB,cAAc,CAAC,CAAC,QAAQ,EAAE;KAC3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