@temporalabs/treasury 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 +44 -12
- package/THIRD_PARTY_NOTICES.connect-page.md +416 -0
- package/THIRD_PARTY_NOTICES.md +575 -2
- package/dist/cli.js +28 -5
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +149 -7
- 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 +18 -1
- package/dist/connect/ack.js +42 -6
- package/dist/connect/ack.js.map +1 -1
- package/dist/connect/commands.d.ts +3 -0
- package/dist/connect/commands.js +168 -24
- 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 +7 -1
- package/dist/connect/http.js +41 -11
- 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 +23 -0
- package/dist/connect/session.js +126 -1
- package/dist/connect/session.js.map +1 -1
- package/dist/connect/solana.d.ts +73 -0
- package/dist/connect/solana.js +267 -0
- package/dist/connect/solana.js.map +1 -0
- package/dist/connect-page.js +604 -602
- package/dist/disclosures.d.ts +5 -4
- package/dist/disclosures.js +5 -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 +302 -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/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 +324 -0
- package/dist/solana/vault.js.map +1 -0
- package/dist/treasury.mjs +8123 -1082
- package/dist/version.js +5 -10
- package/dist/version.js.map +1 -1
- package/llms.txt +621 -0
- package/package.json +9 -6
- package/registry/vaults.json +113 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { SolanaVaultEntry } from "../registry-schema.js";
|
|
2
|
+
import { type SolanaRpc } from "../solana/rpc.js";
|
|
3
|
+
import { type Settled } from "./http.js";
|
|
4
|
+
import type { Session } from "./session.js";
|
|
5
|
+
import type { Verdict } from "./verify.js";
|
|
6
|
+
export declare function solanaSignInMessage(a: {
|
|
7
|
+
address: string;
|
|
8
|
+
origin: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
issuedAt: string;
|
|
11
|
+
}): string;
|
|
12
|
+
/** Checks an ed25519 signature (base64) over `message` against the Solana address that claims it. */
|
|
13
|
+
export declare function verifySolanaSignIn(address: string, message: string, signatureBase64: string): Promise<boolean>;
|
|
14
|
+
export interface SolanaFlowDeps {
|
|
15
|
+
open: (url: string) => boolean;
|
|
16
|
+
ttlMs: number;
|
|
17
|
+
cancelGraceMs?: number;
|
|
18
|
+
/** The confirm flow's chain reads, injectable for tests. */
|
|
19
|
+
rpc?: SolanaRpc;
|
|
20
|
+
verifyOpts?: {
|
|
21
|
+
attempts?: number;
|
|
22
|
+
delayMs?: number;
|
|
23
|
+
};
|
|
24
|
+
html: (secret: string, title: string) => string;
|
|
25
|
+
csp: string;
|
|
26
|
+
assets: Record<string, {
|
|
27
|
+
type: string;
|
|
28
|
+
body: string | Buffer;
|
|
29
|
+
}>;
|
|
30
|
+
ports: readonly number[];
|
|
31
|
+
appId: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function runConnectSolana(deps: SolanaFlowDeps): Promise<{
|
|
34
|
+
result: Settled<Session>;
|
|
35
|
+
url: string;
|
|
36
|
+
opened: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/** What the operator acknowledged: the action, the vault, and its raw amount (base units in, or shares burned). */
|
|
39
|
+
export interface SolanaIntent {
|
|
40
|
+
kind: "deposit" | "withdraw";
|
|
41
|
+
vault: SolanaVaultEntry;
|
|
42
|
+
raw: bigint;
|
|
43
|
+
}
|
|
44
|
+
export interface SolanaTxOutcome extends Verdict {
|
|
45
|
+
step: 1;
|
|
46
|
+
description: string;
|
|
47
|
+
hash: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Did the transaction land, and do the account's own balances say it did what was acknowledged? Read from the
|
|
51
|
+
* signature's status and the transaction's token-balance records — not from the wallet's word, and not from
|
|
52
|
+
* a blockhash-expiry wait: a wallet can report "block height exceeded" for a transaction that in fact landed.
|
|
53
|
+
*/
|
|
54
|
+
export declare function verifySolanaLanded(rpc: SolanaRpc, signature: string, intent: SolanaIntent, account: string, opts: {
|
|
55
|
+
attempts?: number;
|
|
56
|
+
delayMs?: number;
|
|
57
|
+
deadline: number;
|
|
58
|
+
built: ReadonlySet<string>;
|
|
59
|
+
}): Promise<Verdict>;
|
|
60
|
+
/** Builds the intent's transaction now, holds it to the intent through the gate, and simulates it. */
|
|
61
|
+
export declare function buildForIntent(rpc: SolanaRpc, intent: SolanaIntent, account: string): Promise<{
|
|
62
|
+
wire: string;
|
|
63
|
+
expiresAfterBlockHeight: string;
|
|
64
|
+
blockhash: string;
|
|
65
|
+
}>;
|
|
66
|
+
export declare function runConfirmSolana(intent: SolanaIntent, session: Session, deps: SolanaFlowDeps): Promise<{
|
|
67
|
+
result: Settled<SolanaTxOutcome[]>;
|
|
68
|
+
url: string;
|
|
69
|
+
opened: boolean;
|
|
70
|
+
done: SolanaTxOutcome[];
|
|
71
|
+
total: number;
|
|
72
|
+
stopReason?: string;
|
|
73
|
+
}>;
|
|
@@ -0,0 +1,267 @@
|
|
|
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
|
+
* Did the transaction land, and do the account's own balances say it did what was acknowledged? Read from the
|
|
88
|
+
* signature's status and the transaction's token-balance records — not from the wallet's word, and not from
|
|
89
|
+
* a blockhash-expiry wait: a wallet can report "block height exceeded" for a transaction that in fact landed.
|
|
90
|
+
*/
|
|
91
|
+
export async function verifySolanaLanded(rpc, signature, intent, account, opts) {
|
|
92
|
+
const sig = signature;
|
|
93
|
+
for (let i = 0; i < (opts.attempts ?? 45) && Date.now() < opts.deadline; i++) {
|
|
94
|
+
const st = (await rpc.getSignatureStatuses([sig], { searchTransactionHistory: true }).send()).value[0];
|
|
95
|
+
if (st && st.err)
|
|
96
|
+
return { verified: "reverted", detail: `the transaction failed on chain: ${JSON.stringify(st.err, (_k, x) => (typeof x === "bigint" ? x.toString() : x))}` };
|
|
97
|
+
if (st && (st.confirmationStatus === "confirmed" || st.confirmationStatus === "finalized")) {
|
|
98
|
+
const tx = await rpc.getTransaction(sig, { commitment: "confirmed", maxSupportedTransactionVersion: 0, encoding: "json" }).send();
|
|
99
|
+
if (!tx || !tx.meta)
|
|
100
|
+
return { verified: "unverified", detail: "the signature is confirmed but its transaction could not be read; look it up before retrying anything" };
|
|
101
|
+
const meta = tx.meta;
|
|
102
|
+
if (meta.err)
|
|
103
|
+
return { verified: "reverted", detail: `the transaction failed on chain: ${JSON.stringify(meta.err)}` };
|
|
104
|
+
// Bound to what this flow built: the page is handed a transaction with a fresh blockhash, recorded in
|
|
105
|
+
// `built`. A signature for any other transaction — an older one of the same shape, or a share transfer
|
|
106
|
+
// — names another blockhash, and its balances say nothing about this deposit or withdrawal.
|
|
107
|
+
const message = tx.transaction?.message;
|
|
108
|
+
if (!message?.recentBlockhash || !opts.built.has(message.recentBlockhash)) {
|
|
109
|
+
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` };
|
|
110
|
+
}
|
|
111
|
+
if (message.accountKeys?.[0] !== account) {
|
|
112
|
+
return { verified: "mismatch", detail: `${signature} was paid for by ${message.accountKeys?.[0] ?? "an unknown account"}, not the connected account` };
|
|
113
|
+
}
|
|
114
|
+
const shares = tokenDelta(meta, account, intent.vault.sharesMint);
|
|
115
|
+
const asset = tokenDelta(meta, account, intent.vault.asset.address);
|
|
116
|
+
const a = intent.vault.asset;
|
|
117
|
+
if (intent.kind === "deposit") {
|
|
118
|
+
if (shares <= 0n)
|
|
119
|
+
return { verified: "mismatch", detail: `the transaction landed but the account received no ${intent.vault.symbol} shares` };
|
|
120
|
+
// The program mints whole share units and takes only the asset that backs them, so it can take less than
|
|
121
|
+
// asked by up to one share unit's worth (measured: 1,999,999 of 2,000,000). Short by more is not this deposit.
|
|
122
|
+
const taken = -asset;
|
|
123
|
+
if (taken < intent.raw && (intent.raw - taken) * shares >= taken + shares) {
|
|
124
|
+
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` };
|
|
125
|
+
}
|
|
126
|
+
if (-asset > intent.raw) {
|
|
127
|
+
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() }] };
|
|
128
|
+
}
|
|
129
|
+
return { verified: "matched", detail: `received ${formatAmount(shares, intent.vault.shareDecimals)} ${intent.vault.symbol}` };
|
|
130
|
+
}
|
|
131
|
+
// The program pays what a leg can and leaves the rest of the shares with the account, without an error. Up to
|
|
132
|
+
// one share unit per withdraw instruction is rounding, the same allowance the simulation before sending makes.
|
|
133
|
+
const keys = message.accountKeys ?? [];
|
|
134
|
+
const legs = (message.instructions ?? []).filter((ix) => isWithdrawInstruction(keys[ix.programIdIndex] ?? "", getBase58Encoder().encode(ix.data))).length;
|
|
135
|
+
if (-shares > intent.raw || -shares + BigInt(legs) < intent.raw) {
|
|
136
|
+
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.` };
|
|
137
|
+
}
|
|
138
|
+
if (asset <= 0n)
|
|
139
|
+
return { verified: "mismatch", detail: `the shares burned but the account's ${a.symbol} did not rise` };
|
|
140
|
+
return { verified: "matched", detail: `received ${formatAmount(asset, a.decimals)} ${a.symbol}` };
|
|
141
|
+
}
|
|
142
|
+
await new Promise((r) => setTimeout(r, opts.delayMs ?? 2_000));
|
|
143
|
+
}
|
|
144
|
+
return { verified: "unverified", detail: "no confirmation within the wait; look the signature up before retrying anything" };
|
|
145
|
+
}
|
|
146
|
+
/** Builds the intent's transaction now, holds it to the intent through the gate, and simulates it. */
|
|
147
|
+
export async function buildForIntent(rpc, intent, account) {
|
|
148
|
+
const v = await readVault(rpc, intent.vault);
|
|
149
|
+
const ixs = intent.kind === "deposit" ? await depositInstructions(v, account, intent.raw) : await withdrawInstructions(v, account, intent.raw);
|
|
150
|
+
const life = await freshLifetime(rpc);
|
|
151
|
+
const wire = compileUnsigned(ixs, account, life).base64;
|
|
152
|
+
const admitted = await admitSolana(wire, account);
|
|
153
|
+
if (admitted.kind !== intent.kind || admitted.vault.address !== intent.vault.address || admitted.amount !== intent.raw) {
|
|
154
|
+
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})`);
|
|
155
|
+
}
|
|
156
|
+
if (intent.kind === "deposit") {
|
|
157
|
+
const sim = await simulate(rpc, ixs, account, []);
|
|
158
|
+
if (!sim.ok)
|
|
159
|
+
throw new Error(`the simulated deposit fails at slot ${sim.slot}: ${describeSimulation(sim)}`);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// A leg the program caps would land as a partial withdrawal with no error, so the shares it burns are
|
|
163
|
+
// checked here, before the page opens, rather than only after it lands.
|
|
164
|
+
const { sim, burned, legs } = await simulateWithdrawal(rpc, v, account, ixs);
|
|
165
|
+
if (burned === undefined)
|
|
166
|
+
throw new Error(`the simulated withdraw fails at slot ${sim.slot}: ${describeSimulation(sim)}`);
|
|
167
|
+
const partial = partialWithdrawal(intent.raw, burned, legs, intent.vault.shareDecimals, sim.slot);
|
|
168
|
+
if (partial)
|
|
169
|
+
throw new Error(`refused: ${partial}`);
|
|
170
|
+
}
|
|
171
|
+
return { wire, expiresAfterBlockHeight: life.lastValidBlockHeight.toString(), blockhash: life.blockhash };
|
|
172
|
+
}
|
|
173
|
+
export async function runConfirmSolana(intent, session, deps) {
|
|
174
|
+
const account = session.account;
|
|
175
|
+
const rpc = deps.rpc ?? makeSolanaRpc(solanaRpcUrlFromEnv());
|
|
176
|
+
// The gate runs before any page opens, on a transaction built for exactly this intent.
|
|
177
|
+
await buildForIntent(rpc, intent, account);
|
|
178
|
+
const done = [];
|
|
179
|
+
// Every blockhash a transaction handed to the page was built with: the landed one must name one of them.
|
|
180
|
+
const built = new Set();
|
|
181
|
+
let stopReason;
|
|
182
|
+
const deadline = Date.now() + deps.ttlMs;
|
|
183
|
+
const a = intent.vault.asset;
|
|
184
|
+
const description = intent.kind === "deposit"
|
|
185
|
+
? `Deposit ${formatAmount(intent.raw, a.decimals)} ${a.symbol} into ${intent.vault.name}`
|
|
186
|
+
: `Withdraw: burn ${formatAmount(intent.raw, intent.vault.shareDecimals)} ${intent.vault.symbol} for ${a.symbol}, to this wallet`;
|
|
187
|
+
const balances = await Promise.race([
|
|
188
|
+
(async () => {
|
|
189
|
+
const [held, sol] = await Promise.all([tokenBalance(rpc, await associatedTokenAccount(account, a.address)), rpc.getBalance(account).send()]);
|
|
190
|
+
return { asset: held.amount.toString(), native: sol.value.toString() };
|
|
191
|
+
})().catch(() => undefined),
|
|
192
|
+
new Promise((r) => setTimeout(() => r(undefined), 5_000)),
|
|
193
|
+
]);
|
|
194
|
+
const handle = await serveOnce({
|
|
195
|
+
mode: "confirm",
|
|
196
|
+
ttlMs: deps.ttlMs,
|
|
197
|
+
...(deps.cancelGraceMs !== undefined ? { cancelGraceMs: deps.cancelGraceMs } : {}),
|
|
198
|
+
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`),
|
|
199
|
+
onReject: (body) => {
|
|
200
|
+
const sig = body["hash"];
|
|
201
|
+
if (!wellFormedSignature(sig) || done.some((t) => t.hash === sig))
|
|
202
|
+
return;
|
|
203
|
+
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" });
|
|
204
|
+
},
|
|
205
|
+
html: (s) => deps.html(s, "Confirm — Open Agent Treasury"),
|
|
206
|
+
csp: deps.csp,
|
|
207
|
+
assets: deps.assets,
|
|
208
|
+
ports: deps.ports,
|
|
209
|
+
info: () => ({
|
|
210
|
+
mode: "confirm",
|
|
211
|
+
chain: "solana",
|
|
212
|
+
appId: deps.appId,
|
|
213
|
+
account,
|
|
214
|
+
walletType: session.walletType,
|
|
215
|
+
chainName: "Solana",
|
|
216
|
+
kind: intent.kind,
|
|
217
|
+
description,
|
|
218
|
+
next: done.length,
|
|
219
|
+
txBase: "https://solscan.io/tx/",
|
|
220
|
+
asset: { symbol: a.symbol, decimals: a.decimals },
|
|
221
|
+
nativeSymbol: "SOL",
|
|
222
|
+
...(balances ? { balances } : {}),
|
|
223
|
+
...(intent.kind === "deposit" ? { needs: intent.raw.toString() } : {}),
|
|
224
|
+
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}` } },
|
|
225
|
+
}),
|
|
226
|
+
accept: async (body) => {
|
|
227
|
+
// The page asks for the transaction at the moment the operator confirms.
|
|
228
|
+
if (body["build"] === true) {
|
|
229
|
+
if (done.length > 0)
|
|
230
|
+
return { ok: false, reason: "the transaction was already sent" };
|
|
231
|
+
try {
|
|
232
|
+
const reply = await buildForIntent(rpc, intent, account);
|
|
233
|
+
built.add(reply.blockhash);
|
|
234
|
+
return { ok: true, final: false, reply };
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
return { ok: false, reason: redactEndpoints(e instanceof Error ? e.message : String(e)) };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const sig = body["hash"];
|
|
241
|
+
if (done.length > 0)
|
|
242
|
+
return { ok: false, reason: "the transaction was already reported" };
|
|
243
|
+
if (!wellFormedSignature(sig))
|
|
244
|
+
return { ok: false, reason: "malformed transaction signature" };
|
|
245
|
+
const entry = { step: 1, description, hash: sig, verified: "unverified", detail: "the flow ended while this transaction was still being checked" };
|
|
246
|
+
done.push(entry);
|
|
247
|
+
let verdict;
|
|
248
|
+
try {
|
|
249
|
+
verdict = await verifySolanaLanded(rpc, sig, intent, account, { ...deps.verifyOpts, deadline, built });
|
|
250
|
+
}
|
|
251
|
+
catch (e) {
|
|
252
|
+
verdict = { verified: "unverified", detail: `could not check ${sig}: ${redactEndpoints(e instanceof Error ? e.message : String(e))}; look it up before retrying anything` };
|
|
253
|
+
}
|
|
254
|
+
delete entry.detail;
|
|
255
|
+
Object.assign(entry, verdict);
|
|
256
|
+
if (verdict.verified !== "matched" && verdict.verified !== "extra_transfer") {
|
|
257
|
+
stopReason = `the ${intent.kind} is ${verdict.verified}: ${verdict.detail ?? "it did not land as confirmed"}`;
|
|
258
|
+
return { ok: true, final: true, value: done, reply: { stop: true, verdict } };
|
|
259
|
+
}
|
|
260
|
+
return { ok: true, final: true, value: done, reply: { finished: true, verdict } };
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
const opened = deps.open(handle.url);
|
|
264
|
+
const result = await handle.done;
|
|
265
|
+
return { result, url: handle.url, opened, done, total: 1, ...(stopReason ? { stopReason } : {}) };
|
|
266
|
+
}
|
|
267
|
+
//# 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,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