recon-crypto-mcp 0.1.0
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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/abis/aave-pool.d.ts +174 -0
- package/dist/abis/aave-pool.js +101 -0
- package/dist/abis/aave-pool.js.map +1 -0
- package/dist/abis/aave-ui-pool-data-provider.d.ts +232 -0
- package/dist/abis/aave-ui-pool-data-provider.js +107 -0
- package/dist/abis/aave-ui-pool-data-provider.js.map +1 -0
- package/dist/abis/access-control.d.ts +94 -0
- package/dist/abis/access-control.js +51 -0
- package/dist/abis/access-control.js.map +1 -0
- package/dist/abis/compound-comet.d.ts +120 -0
- package/dist/abis/compound-comet.js +84 -0
- package/dist/abis/compound-comet.js.map +1 -0
- package/dist/abis/eigenlayer-delegation-manager.d.ts +23 -0
- package/dist/abis/eigenlayer-delegation-manager.js +18 -0
- package/dist/abis/eigenlayer-delegation-manager.js.map +1 -0
- package/dist/abis/eigenlayer-strategy-manager.d.ts +53 -0
- package/dist/abis/eigenlayer-strategy-manager.js +47 -0
- package/dist/abis/eigenlayer-strategy-manager.js.map +1 -0
- package/dist/abis/erc20.d.ts +78 -0
- package/dist/abis/erc20.js +10 -0
- package/dist/abis/erc20.js.map +1 -0
- package/dist/abis/lido.d.ts +80 -0
- package/dist/abis/lido.js +60 -0
- package/dist/abis/lido.js.map +1 -0
- package/dist/abis/morpho-blue.d.ts +321 -0
- package/dist/abis/morpho-blue.js +193 -0
- package/dist/abis/morpho-blue.js.map +1 -0
- package/dist/abis/uniswap-pool.d.ts +70 -0
- package/dist/abis/uniswap-pool.js +53 -0
- package/dist/abis/uniswap-pool.js.map +1 -0
- package/dist/abis/uniswap-position-manager.d.ts +71 -0
- package/dist/abis/uniswap-position-manager.js +41 -0
- package/dist/abis/uniswap-position-manager.js.map +1 -0
- package/dist/config/cache.d.ts +12 -0
- package/dist/config/cache.js +12 -0
- package/dist/config/cache.js.map +1 -0
- package/dist/config/chains.d.ts +24 -0
- package/dist/config/chains.js +158 -0
- package/dist/config/chains.js.map +1 -0
- package/dist/config/contracts.d.ts +107 -0
- package/dist/config/contracts.js +123 -0
- package/dist/config/contracts.js.map +1 -0
- package/dist/config/user-config.d.ts +15 -0
- package/dist/config/user-config.js +93 -0
- package/dist/config/user-config.js.map +1 -0
- package/dist/data/apis/etherscan.d.ts +30 -0
- package/dist/data/apis/etherscan.js +109 -0
- package/dist/data/apis/etherscan.js.map +1 -0
- package/dist/data/cache.d.ts +18 -0
- package/dist/data/cache.js +47 -0
- package/dist/data/cache.js.map +1 -0
- package/dist/data/format.d.ts +6 -0
- package/dist/data/format.js +44 -0
- package/dist/data/format.js.map +1 -0
- package/dist/data/prices.d.ts +12 -0
- package/dist/data/prices.js +81 -0
- package/dist/data/prices.js.map +1 -0
- package/dist/data/rpc.d.ts +17 -0
- package/dist/data/rpc.js +68 -0
- package/dist/data/rpc.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +344 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/balances/index.d.ts +20 -0
- package/dist/modules/balances/index.js +49 -0
- package/dist/modules/balances/index.js.map +1 -0
- package/dist/modules/balances/schemas.d.ts +32 -0
- package/dist/modules/balances/schemas.js +21 -0
- package/dist/modules/balances/schemas.js.map +1 -0
- package/dist/modules/bitcoin/index.d.ts +26 -0
- package/dist/modules/bitcoin/index.js +128 -0
- package/dist/modules/bitcoin/index.js.map +1 -0
- package/dist/modules/bitcoin/schemas.d.ts +49 -0
- package/dist/modules/bitcoin/schemas.js +51 -0
- package/dist/modules/bitcoin/schemas.js.map +1 -0
- package/dist/modules/bitcoin/send.d.ts +52 -0
- package/dist/modules/bitcoin/send.js +158 -0
- package/dist/modules/bitcoin/send.js.map +1 -0
- package/dist/modules/bitcoin/utxo.d.ts +99 -0
- package/dist/modules/bitcoin/utxo.js +116 -0
- package/dist/modules/bitcoin/utxo.js.map +1 -0
- package/dist/modules/compound/actions.d.ts +8 -0
- package/dist/modules/compound/actions.js +154 -0
- package/dist/modules/compound/actions.js.map +1 -0
- package/dist/modules/compound/index.d.ts +26 -0
- package/dist/modules/compound/index.js +141 -0
- package/dist/modules/compound/index.js.map +1 -0
- package/dist/modules/compound/schemas.d.ts +95 -0
- package/dist/modules/compound/schemas.js +37 -0
- package/dist/modules/compound/schemas.js.map +1 -0
- package/dist/modules/execution/index.d.ts +51 -0
- package/dist/modules/execution/index.js +271 -0
- package/dist/modules/execution/index.js.map +1 -0
- package/dist/modules/execution/schemas.d.ts +183 -0
- package/dist/modules/execution/schemas.js +88 -0
- package/dist/modules/execution/schemas.js.map +1 -0
- package/dist/modules/feedback/index.d.ts +28 -0
- package/dist/modules/feedback/index.js +161 -0
- package/dist/modules/feedback/index.js.map +1 -0
- package/dist/modules/feedback/rate-limit.d.ts +15 -0
- package/dist/modules/feedback/rate-limit.js +110 -0
- package/dist/modules/feedback/rate-limit.js.map +1 -0
- package/dist/modules/feedback/schemas.d.ts +41 -0
- package/dist/modules/feedback/schemas.js +40 -0
- package/dist/modules/feedback/schemas.js.map +1 -0
- package/dist/modules/morpho/actions.d.ts +8 -0
- package/dist/modules/morpho/actions.js +265 -0
- package/dist/modules/morpho/actions.js.map +1 -0
- package/dist/modules/morpho/index.d.ts +26 -0
- package/dist/modules/morpho/index.js +94 -0
- package/dist/modules/morpho/index.js.map +1 -0
- package/dist/modules/morpho/schemas.d.ts +130 -0
- package/dist/modules/morpho/schemas.js +34 -0
- package/dist/modules/morpho/schemas.js.map +1 -0
- package/dist/modules/portfolio/index.d.ts +3 -0
- package/dist/modules/portfolio/index.js +197 -0
- package/dist/modules/portfolio/index.js.map +1 -0
- package/dist/modules/portfolio/schemas.d.ts +20 -0
- package/dist/modules/portfolio/schemas.js +15 -0
- package/dist/modules/portfolio/schemas.js.map +1 -0
- package/dist/modules/positions/aave.d.ts +22 -0
- package/dist/modules/positions/aave.js +197 -0
- package/dist/modules/positions/aave.js.map +1 -0
- package/dist/modules/positions/actions.d.ts +18 -0
- package/dist/modules/positions/actions.js +205 -0
- package/dist/modules/positions/actions.js.map +1 -0
- package/dist/modules/positions/index.d.ts +37 -0
- package/dist/modules/positions/index.js +59 -0
- package/dist/modules/positions/index.js.map +1 -0
- package/dist/modules/positions/schemas.d.ts +55 -0
- package/dist/modules/positions/schemas.js +25 -0
- package/dist/modules/positions/schemas.js.map +1 -0
- package/dist/modules/positions/uniswap.d.ts +4 -0
- package/dist/modules/positions/uniswap.js +181 -0
- package/dist/modules/positions/uniswap.js.map +1 -0
- package/dist/modules/prices/index.d.ts +19 -0
- package/dist/modules/prices/index.js +22 -0
- package/dist/modules/prices/index.js.map +1 -0
- package/dist/modules/security/index.d.ts +26 -0
- package/dist/modules/security/index.js +13 -0
- package/dist/modules/security/index.js.map +1 -0
- package/dist/modules/security/permissions.d.ts +8 -0
- package/dist/modules/security/permissions.js +96 -0
- package/dist/modules/security/permissions.js.map +1 -0
- package/dist/modules/security/risk-score.d.ts +18 -0
- package/dist/modules/security/risk-score.js +116 -0
- package/dist/modules/security/risk-score.js.map +1 -0
- package/dist/modules/security/schemas.d.ts +31 -0
- package/dist/modules/security/schemas.js +16 -0
- package/dist/modules/security/schemas.js.map +1 -0
- package/dist/modules/security/verification.d.ts +4 -0
- package/dist/modules/security/verification.js +82 -0
- package/dist/modules/security/verification.js.map +1 -0
- package/dist/modules/shared/approval.d.ts +71 -0
- package/dist/modules/shared/approval.js +130 -0
- package/dist/modules/shared/approval.js.map +1 -0
- package/dist/modules/staking/actions.d.ts +22 -0
- package/dist/modules/staking/actions.js +100 -0
- package/dist/modules/staking/actions.js.map +1 -0
- package/dist/modules/staking/eigenlayer.d.ts +14 -0
- package/dist/modules/staking/eigenlayer.js +105 -0
- package/dist/modules/staking/eigenlayer.js.map +1 -0
- package/dist/modules/staking/index.d.ts +24 -0
- package/dist/modules/staking/index.js +59 -0
- package/dist/modules/staking/index.js.map +1 -0
- package/dist/modules/staking/lido.d.ts +14 -0
- package/dist/modules/staking/lido.js +113 -0
- package/dist/modules/staking/lido.js.map +1 -0
- package/dist/modules/staking/schemas.d.ts +34 -0
- package/dist/modules/staking/schemas.js +20 -0
- package/dist/modules/staking/schemas.js.map +1 -0
- package/dist/modules/swap/index.d.ts +47 -0
- package/dist/modules/swap/index.js +376 -0
- package/dist/modules/swap/index.js.map +1 -0
- package/dist/modules/swap/lifi.d.ts +17 -0
- package/dist/modules/swap/lifi.js +44 -0
- package/dist/modules/swap/lifi.js.map +1 -0
- package/dist/modules/swap/oneinch.d.ts +26 -0
- package/dist/modules/swap/oneinch.js +33 -0
- package/dist/modules/swap/oneinch.js.map +1 -0
- package/dist/modules/swap/schemas.d.ts +65 -0
- package/dist/modules/swap/schemas.js +46 -0
- package/dist/modules/swap/schemas.js.map +1 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +257 -0
- package/dist/setup.js.map +1 -0
- package/dist/signing/pre-sign-check.d.ts +8 -0
- package/dist/signing/pre-sign-check.js +231 -0
- package/dist/signing/pre-sign-check.js.map +1 -0
- package/dist/signing/session.d.ts +28 -0
- package/dist/signing/session.js +26 -0
- package/dist/signing/session.js.map +1 -0
- package/dist/signing/tx-store.d.ts +29 -0
- package/dist/signing/tx-store.js +85 -0
- package/dist/signing/tx-store.js.map +1 -0
- package/dist/signing/walletconnect.d.ts +33 -0
- package/dist/signing/walletconnect.js +226 -0
- package/dist/signing/walletconnect.js.map +1 -0
- package/dist/types/index.d.ts +222 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +134 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PrepareAaveSupplyArgs, PrepareAaveWithdrawArgs, PrepareAaveBorrowArgs, PrepareAaveRepayArgs, PrepareLidoStakeArgs, PrepareLidoUnstakeArgs, PrepareEigenLayerDepositArgs, PrepareNativeSendArgs, PrepareTokenSendArgs, SendTransactionArgs, GetTransactionStatusArgs } from "./schemas.js";
|
|
2
|
+
import type { SupportedChain, UnsignedTx } from "../../types/index.js";
|
|
3
|
+
export declare function pairLedgerLive(): Promise<{
|
|
4
|
+
uri: string;
|
|
5
|
+
qr: string;
|
|
6
|
+
instructions: string;
|
|
7
|
+
waitingForApproval: true;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function getLedgerStatus(): Promise<import("../../signing/session.js").SessionStatus>;
|
|
10
|
+
export declare function prepareAaveSupply(args: PrepareAaveSupplyArgs): Promise<UnsignedTx>;
|
|
11
|
+
export declare function prepareAaveWithdraw(args: PrepareAaveWithdrawArgs): Promise<UnsignedTx>;
|
|
12
|
+
export declare function prepareAaveBorrow(args: PrepareAaveBorrowArgs): Promise<UnsignedTx>;
|
|
13
|
+
export declare function prepareAaveRepay(args: PrepareAaveRepayArgs): Promise<UnsignedTx>;
|
|
14
|
+
export declare function prepareLidoStake(args: PrepareLidoStakeArgs): Promise<UnsignedTx>;
|
|
15
|
+
export declare function prepareLidoUnstake(args: PrepareLidoUnstakeArgs): Promise<UnsignedTx>;
|
|
16
|
+
export declare function prepareEigenLayerDeposit(args: PrepareEigenLayerDepositArgs): Promise<UnsignedTx>;
|
|
17
|
+
export declare function prepareNativeSend(args: PrepareNativeSendArgs): Promise<UnsignedTx>;
|
|
18
|
+
export declare function prepareTokenSend(args: PrepareTokenSendArgs): Promise<UnsignedTx>;
|
|
19
|
+
export declare function sendTransaction(args: SendTransactionArgs): Promise<{
|
|
20
|
+
txHash: `0x${string}`;
|
|
21
|
+
chain: SupportedChain;
|
|
22
|
+
nextHandle?: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getTransactionStatus(args: GetTransactionStatusArgs): Promise<{
|
|
25
|
+
chain: string;
|
|
26
|
+
txHash: string;
|
|
27
|
+
status: string;
|
|
28
|
+
blockNumber: string;
|
|
29
|
+
gasUsed: string;
|
|
30
|
+
from: `0x${string}`;
|
|
31
|
+
to: `0x${string}` | null;
|
|
32
|
+
note?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
chain: string;
|
|
35
|
+
txHash: string;
|
|
36
|
+
status: string;
|
|
37
|
+
from: `0x${string}`;
|
|
38
|
+
to: `0x${string}` | null;
|
|
39
|
+
blockNumber?: undefined;
|
|
40
|
+
gasUsed?: undefined;
|
|
41
|
+
note?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
chain: string;
|
|
44
|
+
txHash: string;
|
|
45
|
+
status: string;
|
|
46
|
+
note: string;
|
|
47
|
+
blockNumber?: undefined;
|
|
48
|
+
gasUsed?: undefined;
|
|
49
|
+
from?: undefined;
|
|
50
|
+
to?: undefined;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { encodeFunctionData, formatUnits, parseEther, parseUnits } from "viem";
|
|
2
|
+
import qrcodeTerminal from "qrcode-terminal";
|
|
3
|
+
import { initiatePairing, requestSendTransaction, getConnectedAccounts, } from "../../signing/walletconnect.js";
|
|
4
|
+
import { getSessionStatus } from "../../signing/session.js";
|
|
5
|
+
import { consumeHandle, retireHandle } from "../../signing/tx-store.js";
|
|
6
|
+
import { assertTransactionSafe } from "../../signing/pre-sign-check.js";
|
|
7
|
+
import { getClient, verifyChainId } from "../../data/rpc.js";
|
|
8
|
+
import { erc20Abi } from "../../abis/erc20.js";
|
|
9
|
+
import { buildAaveSupply, buildAaveWithdraw, buildAaveBorrow, buildAaveRepay, } from "../positions/actions.js";
|
|
10
|
+
import { buildLidoStake, buildLidoUnstake, buildEigenLayerDeposit, } from "../staking/actions.js";
|
|
11
|
+
import { getTokenPrice } from "../../data/prices.js";
|
|
12
|
+
import { round } from "../../data/format.js";
|
|
13
|
+
/** Render a QR code as an ASCII string (returns promise with the string). */
|
|
14
|
+
function qrString(uri) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
qrcodeTerminal.generate(uri, { small: true }, (qr) => resolve(qr));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export async function pairLedgerLive() {
|
|
20
|
+
const { uri, approval } = await initiatePairing();
|
|
21
|
+
const qr = await qrString(uri);
|
|
22
|
+
// Fire-and-forget: once approval resolves, the session is persisted automatically.
|
|
23
|
+
approval.catch(() => {
|
|
24
|
+
// WalletConnect will surface any error on the next call.
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
uri,
|
|
28
|
+
qr,
|
|
29
|
+
instructions: "Open Ledger Live → Discover → WalletConnect, paste this URI (or scan the QR) to pair. " +
|
|
30
|
+
"Once pairing completes, the session is persisted; you can call `send_transaction` without re-pairing.",
|
|
31
|
+
waitingForApproval: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export async function getLedgerStatus() {
|
|
35
|
+
return getSessionStatus();
|
|
36
|
+
}
|
|
37
|
+
async function resolveAssetMeta(chain, asset) {
|
|
38
|
+
const client = getClient(chain);
|
|
39
|
+
const [decimals, symbol] = await client.multicall({
|
|
40
|
+
contracts: [
|
|
41
|
+
{ address: asset, abi: erc20Abi, functionName: "decimals" },
|
|
42
|
+
{ address: asset, abi: erc20Abi, functionName: "symbol" },
|
|
43
|
+
],
|
|
44
|
+
allowFailure: false,
|
|
45
|
+
});
|
|
46
|
+
return { decimals: Number(decimals), symbol: symbol };
|
|
47
|
+
}
|
|
48
|
+
/** Attach gas estimate + USD cost + eth_call simulation result. */
|
|
49
|
+
async function enrichTx(tx) {
|
|
50
|
+
const client = getClient(tx.chain);
|
|
51
|
+
const from = tx.from;
|
|
52
|
+
try {
|
|
53
|
+
const gas = await client.estimateGas({
|
|
54
|
+
account: from ?? "0x0000000000000000000000000000000000000001",
|
|
55
|
+
to: tx.to,
|
|
56
|
+
data: tx.data,
|
|
57
|
+
value: BigInt(tx.value),
|
|
58
|
+
});
|
|
59
|
+
tx.gasEstimate = gas.toString();
|
|
60
|
+
const gasPrice = await client.getGasPrice();
|
|
61
|
+
const gasWei = gas * gasPrice;
|
|
62
|
+
const ethPrice = await getTokenPrice(tx.chain, "native");
|
|
63
|
+
if (ethPrice) {
|
|
64
|
+
const gasEth = Number(formatUnits(gasWei, 18));
|
|
65
|
+
tx.gasCostUsd = round(gasEth * ethPrice, 2);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Simulation fails for many legitimate reasons (insufficient allowance, etc.) — we surface the tx anyway.
|
|
70
|
+
}
|
|
71
|
+
if (tx.next)
|
|
72
|
+
tx.next = await enrichTx(tx.next);
|
|
73
|
+
return tx;
|
|
74
|
+
}
|
|
75
|
+
// ----- Aave preparation handlers -----
|
|
76
|
+
export async function prepareAaveSupply(args) {
|
|
77
|
+
const meta = await resolveAssetMeta(args.chain, args.asset);
|
|
78
|
+
return enrichTx(await buildAaveSupply({
|
|
79
|
+
wallet: args.wallet,
|
|
80
|
+
chain: args.chain,
|
|
81
|
+
asset: args.asset,
|
|
82
|
+
amount: args.amount,
|
|
83
|
+
decimals: meta.decimals,
|
|
84
|
+
symbol: meta.symbol,
|
|
85
|
+
approvalCap: args.approvalCap,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
export async function prepareAaveWithdraw(args) {
|
|
89
|
+
const meta = await resolveAssetMeta(args.chain, args.asset);
|
|
90
|
+
return enrichTx(await buildAaveWithdraw({
|
|
91
|
+
wallet: args.wallet,
|
|
92
|
+
chain: args.chain,
|
|
93
|
+
asset: args.asset,
|
|
94
|
+
amount: args.amount,
|
|
95
|
+
decimals: meta.decimals,
|
|
96
|
+
symbol: meta.symbol,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
export async function prepareAaveBorrow(args) {
|
|
100
|
+
const meta = await resolveAssetMeta(args.chain, args.asset);
|
|
101
|
+
return enrichTx(await buildAaveBorrow({
|
|
102
|
+
wallet: args.wallet,
|
|
103
|
+
chain: args.chain,
|
|
104
|
+
asset: args.asset,
|
|
105
|
+
amount: args.amount,
|
|
106
|
+
decimals: meta.decimals,
|
|
107
|
+
symbol: meta.symbol,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
export async function prepareAaveRepay(args) {
|
|
111
|
+
const meta = await resolveAssetMeta(args.chain, args.asset);
|
|
112
|
+
return enrichTx(await buildAaveRepay({
|
|
113
|
+
wallet: args.wallet,
|
|
114
|
+
chain: args.chain,
|
|
115
|
+
asset: args.asset,
|
|
116
|
+
amount: args.amount,
|
|
117
|
+
decimals: meta.decimals,
|
|
118
|
+
symbol: meta.symbol,
|
|
119
|
+
approvalCap: args.approvalCap,
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
// ----- Staking preparation handlers -----
|
|
123
|
+
export async function prepareLidoStake(args) {
|
|
124
|
+
return enrichTx(buildLidoStake({ wallet: args.wallet, amountEth: args.amountEth }));
|
|
125
|
+
}
|
|
126
|
+
export async function prepareLidoUnstake(args) {
|
|
127
|
+
return enrichTx(await buildLidoUnstake({
|
|
128
|
+
wallet: args.wallet,
|
|
129
|
+
amountStETH: args.amountStETH,
|
|
130
|
+
approvalCap: args.approvalCap,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
export async function prepareEigenLayerDeposit(args) {
|
|
134
|
+
const meta = await resolveAssetMeta("ethereum", args.token);
|
|
135
|
+
return enrichTx(await buildEigenLayerDeposit({
|
|
136
|
+
wallet: args.wallet,
|
|
137
|
+
strategy: args.strategy,
|
|
138
|
+
token: args.token,
|
|
139
|
+
amount: args.amount,
|
|
140
|
+
decimals: meta.decimals,
|
|
141
|
+
symbol: meta.symbol,
|
|
142
|
+
approvalCap: args.approvalCap,
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
// ----- Native + ERC-20 transfers -----
|
|
146
|
+
export async function prepareNativeSend(args) {
|
|
147
|
+
const wallet = args.wallet;
|
|
148
|
+
const chain = args.chain;
|
|
149
|
+
const to = args.to;
|
|
150
|
+
const value = parseEther(args.amount);
|
|
151
|
+
return enrichTx({
|
|
152
|
+
chain,
|
|
153
|
+
to,
|
|
154
|
+
data: "0x",
|
|
155
|
+
value: value.toString(),
|
|
156
|
+
from: wallet,
|
|
157
|
+
description: `Send ${args.amount} native coin to ${to} on ${chain}`,
|
|
158
|
+
decoded: { functionName: "transfer", args: { to, amount: args.amount } },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
export async function prepareTokenSend(args) {
|
|
162
|
+
const wallet = args.wallet;
|
|
163
|
+
const chain = args.chain;
|
|
164
|
+
const token = args.token;
|
|
165
|
+
const to = args.to;
|
|
166
|
+
const meta = await resolveAssetMeta(chain, token);
|
|
167
|
+
let amountWei;
|
|
168
|
+
let displayAmount = args.amount;
|
|
169
|
+
if (args.amount === "max") {
|
|
170
|
+
const client = getClient(chain);
|
|
171
|
+
amountWei = (await client.readContract({
|
|
172
|
+
address: token,
|
|
173
|
+
abi: erc20Abi,
|
|
174
|
+
functionName: "balanceOf",
|
|
175
|
+
args: [wallet],
|
|
176
|
+
}));
|
|
177
|
+
displayAmount = formatUnits(amountWei, meta.decimals);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
amountWei = parseUnits(args.amount, meta.decimals);
|
|
181
|
+
}
|
|
182
|
+
return enrichTx({
|
|
183
|
+
chain,
|
|
184
|
+
to: token,
|
|
185
|
+
data: encodeFunctionData({
|
|
186
|
+
abi: erc20Abi,
|
|
187
|
+
functionName: "transfer",
|
|
188
|
+
args: [to, amountWei],
|
|
189
|
+
}),
|
|
190
|
+
value: "0",
|
|
191
|
+
from: wallet,
|
|
192
|
+
description: `Send ${displayAmount} ${meta.symbol} to ${to} on ${chain}`,
|
|
193
|
+
decoded: {
|
|
194
|
+
functionName: "transfer",
|
|
195
|
+
args: { to, amount: displayAmount, symbol: meta.symbol },
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// ----- Send + status -----
|
|
200
|
+
export async function sendTransaction(args) {
|
|
201
|
+
const tx = consumeHandle(args.handle);
|
|
202
|
+
// Last-line check: refuse to sign against an RPC that's pointing at the
|
|
203
|
+
// wrong chain. See verifyChainId() for the threat model.
|
|
204
|
+
await verifyChainId(tx.chain);
|
|
205
|
+
// Independent of the prepare_* pipeline: validate destination + selector +
|
|
206
|
+
// (for approve) spender allowlist. A compromised agent can't slip an
|
|
207
|
+
// "approve(attacker, MAX)" past this, even if the handle system were bypassed.
|
|
208
|
+
await assertTransactionSafe(tx);
|
|
209
|
+
// Assert that tx.from is actually an account the paired wallet holds keys
|
|
210
|
+
// for. Without this check, a prepare_* call with a user-supplied `wallet`
|
|
211
|
+
// arg referencing an address the wallet doesn't control would be forwarded
|
|
212
|
+
// to Ledger Live and rejected deep in the sign flow with a confusing error.
|
|
213
|
+
// Worse: a prompt-injected agent could get us to request signing for an
|
|
214
|
+
// address the user didn't intend to use in this session.
|
|
215
|
+
if (tx.from) {
|
|
216
|
+
const accounts = (await getConnectedAccounts()).map((a) => a.toLowerCase());
|
|
217
|
+
const from = tx.from.toLowerCase();
|
|
218
|
+
if (accounts.length > 0 && !accounts.includes(from)) {
|
|
219
|
+
throw new Error(`Pre-sign check: tx.from (${tx.from}) is not one of the accounts exposed by the paired ` +
|
|
220
|
+
`WalletConnect session (${accounts.join(", ")}). Refusing to submit. If this is a ` +
|
|
221
|
+
`different Ledger account, re-pair with that account unlocked.`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const hash = await requestSendTransaction(tx);
|
|
225
|
+
// Only retire the handle after successful submission. If requestSendTransaction
|
|
226
|
+
// throws (device disconnect, user rejection, relay timeout), the handle stays
|
|
227
|
+
// valid and the caller can retry until the 15-minute TTL expires.
|
|
228
|
+
retireHandle(args.handle);
|
|
229
|
+
return {
|
|
230
|
+
txHash: hash,
|
|
231
|
+
chain: tx.chain,
|
|
232
|
+
...(tx.next?.handle ? { nextHandle: tx.next.handle } : {}),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
export async function getTransactionStatus(args) {
|
|
236
|
+
const client = getClient(args.chain);
|
|
237
|
+
try {
|
|
238
|
+
const receipt = await client.getTransactionReceipt({ hash: args.txHash });
|
|
239
|
+
return {
|
|
240
|
+
chain: args.chain,
|
|
241
|
+
txHash: args.txHash,
|
|
242
|
+
status: receipt.status === "success" ? "success" : "failed",
|
|
243
|
+
blockNumber: receipt.blockNumber.toString(),
|
|
244
|
+
gasUsed: receipt.gasUsed.toString(),
|
|
245
|
+
from: receipt.from,
|
|
246
|
+
to: receipt.to,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// No receipt yet — try to find it pending.
|
|
251
|
+
try {
|
|
252
|
+
const tx = await client.getTransaction({ hash: args.txHash });
|
|
253
|
+
return {
|
|
254
|
+
chain: args.chain,
|
|
255
|
+
txHash: args.txHash,
|
|
256
|
+
status: "pending",
|
|
257
|
+
from: tx.from,
|
|
258
|
+
to: tx.to,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
return {
|
|
263
|
+
chain: args.chain,
|
|
264
|
+
txHash: args.txHash,
|
|
265
|
+
status: "unknown",
|
|
266
|
+
note: "Transaction not yet visible to this RPC — it may still be propagating.",
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/E,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CA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AAE,EAAE,EAAE,CAAC,EAAE;aACV,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE,wEAAwE;aAC/E,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const pairLedgerLiveInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
3
|
+
export declare const getLedgerStatusInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
4
|
+
export declare const prepareAaveSupplyInput: z.ZodObject<{
|
|
5
|
+
wallet: z.ZodString;
|
|
6
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
7
|
+
asset: z.ZodString;
|
|
8
|
+
amount: z.ZodString;
|
|
9
|
+
} & {
|
|
10
|
+
approvalCap: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
chain: string;
|
|
13
|
+
asset: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
wallet: string;
|
|
16
|
+
approvalCap?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
asset: string;
|
|
19
|
+
amount: string;
|
|
20
|
+
wallet: string;
|
|
21
|
+
chain?: string | undefined;
|
|
22
|
+
approvalCap?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const prepareAaveWithdrawInput: z.ZodObject<{
|
|
25
|
+
wallet: z.ZodString;
|
|
26
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
27
|
+
asset: z.ZodString;
|
|
28
|
+
amount: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
chain: string;
|
|
31
|
+
asset: string;
|
|
32
|
+
amount: string;
|
|
33
|
+
wallet: string;
|
|
34
|
+
}, {
|
|
35
|
+
asset: string;
|
|
36
|
+
amount: string;
|
|
37
|
+
wallet: string;
|
|
38
|
+
chain?: string | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const prepareAaveBorrowInput: z.ZodObject<{
|
|
41
|
+
wallet: z.ZodString;
|
|
42
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
43
|
+
asset: z.ZodString;
|
|
44
|
+
amount: z.ZodString;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
chain: string;
|
|
47
|
+
asset: string;
|
|
48
|
+
amount: string;
|
|
49
|
+
wallet: string;
|
|
50
|
+
}, {
|
|
51
|
+
asset: string;
|
|
52
|
+
amount: string;
|
|
53
|
+
wallet: string;
|
|
54
|
+
chain?: string | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const prepareAaveRepayInput: z.ZodObject<{
|
|
57
|
+
wallet: z.ZodString;
|
|
58
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
59
|
+
asset: z.ZodString;
|
|
60
|
+
amount: z.ZodString;
|
|
61
|
+
} & {
|
|
62
|
+
approvalCap: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
chain: string;
|
|
65
|
+
asset: string;
|
|
66
|
+
amount: string;
|
|
67
|
+
wallet: string;
|
|
68
|
+
approvalCap?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
asset: string;
|
|
71
|
+
amount: string;
|
|
72
|
+
wallet: string;
|
|
73
|
+
chain?: string | undefined;
|
|
74
|
+
approvalCap?: string | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const prepareLidoStakeInput: z.ZodObject<{
|
|
77
|
+
wallet: z.ZodString;
|
|
78
|
+
amountEth: z.ZodString;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
wallet: string;
|
|
81
|
+
amountEth: string;
|
|
82
|
+
}, {
|
|
83
|
+
wallet: string;
|
|
84
|
+
amountEth: string;
|
|
85
|
+
}>;
|
|
86
|
+
export declare const prepareLidoUnstakeInput: z.ZodObject<{
|
|
87
|
+
wallet: z.ZodString;
|
|
88
|
+
amountStETH: z.ZodString;
|
|
89
|
+
approvalCap: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
wallet: string;
|
|
92
|
+
amountStETH: string;
|
|
93
|
+
approvalCap?: string | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
wallet: string;
|
|
96
|
+
amountStETH: string;
|
|
97
|
+
approvalCap?: string | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
export declare const prepareEigenLayerDepositInput: z.ZodObject<{
|
|
100
|
+
wallet: z.ZodString;
|
|
101
|
+
strategy: z.ZodString;
|
|
102
|
+
token: z.ZodString;
|
|
103
|
+
amount: z.ZodString;
|
|
104
|
+
approvalCap: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
amount: string;
|
|
107
|
+
wallet: string;
|
|
108
|
+
strategy: string;
|
|
109
|
+
token: string;
|
|
110
|
+
approvalCap?: string | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
amount: string;
|
|
113
|
+
wallet: string;
|
|
114
|
+
strategy: string;
|
|
115
|
+
token: string;
|
|
116
|
+
approvalCap?: string | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const prepareNativeSendInput: z.ZodObject<{
|
|
119
|
+
wallet: z.ZodString;
|
|
120
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
121
|
+
to: z.ZodString;
|
|
122
|
+
amount: z.ZodString;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
to: string;
|
|
125
|
+
chain: string;
|
|
126
|
+
amount: string;
|
|
127
|
+
wallet: string;
|
|
128
|
+
}, {
|
|
129
|
+
to: string;
|
|
130
|
+
amount: string;
|
|
131
|
+
wallet: string;
|
|
132
|
+
chain?: string | undefined;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const prepareTokenSendInput: z.ZodObject<{
|
|
135
|
+
wallet: z.ZodString;
|
|
136
|
+
chain: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
137
|
+
token: z.ZodString;
|
|
138
|
+
to: z.ZodString;
|
|
139
|
+
amount: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
to: string;
|
|
142
|
+
chain: string;
|
|
143
|
+
amount: string;
|
|
144
|
+
wallet: string;
|
|
145
|
+
token: string;
|
|
146
|
+
}, {
|
|
147
|
+
to: string;
|
|
148
|
+
amount: string;
|
|
149
|
+
wallet: string;
|
|
150
|
+
token: string;
|
|
151
|
+
chain?: string | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
export declare const sendTransactionInput: z.ZodObject<{
|
|
154
|
+
handle: z.ZodString;
|
|
155
|
+
confirmed: z.ZodLiteral<true>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
handle: string;
|
|
158
|
+
confirmed: true;
|
|
159
|
+
}, {
|
|
160
|
+
handle: string;
|
|
161
|
+
confirmed: true;
|
|
162
|
+
}>;
|
|
163
|
+
export declare const getTransactionStatusInput: z.ZodObject<{
|
|
164
|
+
chain: z.ZodEnum<[string, ...string[]]>;
|
|
165
|
+
txHash: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
chain: string;
|
|
168
|
+
txHash: string;
|
|
169
|
+
}, {
|
|
170
|
+
chain: string;
|
|
171
|
+
txHash: string;
|
|
172
|
+
}>;
|
|
173
|
+
export type PrepareAaveSupplyArgs = z.infer<typeof prepareAaveSupplyInput>;
|
|
174
|
+
export type PrepareAaveWithdrawArgs = z.infer<typeof prepareAaveWithdrawInput>;
|
|
175
|
+
export type PrepareAaveBorrowArgs = z.infer<typeof prepareAaveBorrowInput>;
|
|
176
|
+
export type PrepareAaveRepayArgs = z.infer<typeof prepareAaveRepayInput>;
|
|
177
|
+
export type PrepareLidoStakeArgs = z.infer<typeof prepareLidoStakeInput>;
|
|
178
|
+
export type PrepareLidoUnstakeArgs = z.infer<typeof prepareLidoUnstakeInput>;
|
|
179
|
+
export type PrepareEigenLayerDepositArgs = z.infer<typeof prepareEigenLayerDepositInput>;
|
|
180
|
+
export type PrepareNativeSendArgs = z.infer<typeof prepareNativeSendInput>;
|
|
181
|
+
export type PrepareTokenSendArgs = z.infer<typeof prepareTokenSendInput>;
|
|
182
|
+
export type SendTransactionArgs = z.infer<typeof sendTransactionInput>;
|
|
183
|
+
export type GetTransactionStatusArgs = z.infer<typeof getTransactionStatusInput>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SUPPORTED_CHAINS } from "../../types/index.js";
|
|
3
|
+
import { approvalCapSchema } from "../shared/approval.js";
|
|
4
|
+
const chainEnum = z.enum(SUPPORTED_CHAINS);
|
|
5
|
+
const walletSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/);
|
|
6
|
+
const addressSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/);
|
|
7
|
+
const dataSchema = z.string().regex(/^0x[a-fA-F0-9]*$/);
|
|
8
|
+
export const pairLedgerLiveInput = z.object({});
|
|
9
|
+
export const getLedgerStatusInput = z.object({});
|
|
10
|
+
const baseAaveAction = z.object({
|
|
11
|
+
wallet: walletSchema,
|
|
12
|
+
chain: chainEnum.default("ethereum"),
|
|
13
|
+
asset: addressSchema,
|
|
14
|
+
amount: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('Human-readable decimal amount of `asset`, NOT raw wei/base units. ' +
|
|
17
|
+
'Example: "1.5" for 1.5 USDC, "0.01" for 0.01 ETH. Pass "max" for full-balance withdraw/repay.'),
|
|
18
|
+
});
|
|
19
|
+
export const prepareAaveSupplyInput = baseAaveAction.extend({
|
|
20
|
+
approvalCap: approvalCapSchema,
|
|
21
|
+
});
|
|
22
|
+
export const prepareAaveWithdrawInput = baseAaveAction;
|
|
23
|
+
// Aave V3 stable-rate borrowing is disabled on all production markets — we only
|
|
24
|
+
// build variable-rate borrow/repay txs. No `interestRateMode` arg on purpose.
|
|
25
|
+
export const prepareAaveBorrowInput = baseAaveAction;
|
|
26
|
+
export const prepareAaveRepayInput = baseAaveAction.extend({
|
|
27
|
+
approvalCap: approvalCapSchema,
|
|
28
|
+
});
|
|
29
|
+
export const prepareLidoStakeInput = z.object({
|
|
30
|
+
wallet: walletSchema,
|
|
31
|
+
amountEth: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe('Human-readable ETH amount, NOT raw wei. Example: "0.5" for 0.5 ETH.'),
|
|
34
|
+
});
|
|
35
|
+
export const prepareLidoUnstakeInput = z.object({
|
|
36
|
+
wallet: walletSchema,
|
|
37
|
+
amountStETH: z
|
|
38
|
+
.string()
|
|
39
|
+
.describe('Human-readable stETH amount, NOT raw wei. Example: "0.5" for 0.5 stETH (18 decimals).'),
|
|
40
|
+
approvalCap: approvalCapSchema,
|
|
41
|
+
});
|
|
42
|
+
export const prepareEigenLayerDepositInput = z.object({
|
|
43
|
+
wallet: walletSchema,
|
|
44
|
+
strategy: addressSchema,
|
|
45
|
+
token: addressSchema,
|
|
46
|
+
amount: z
|
|
47
|
+
.string()
|
|
48
|
+
.describe('Human-readable decimal amount of `token`, NOT raw wei/base units. Example: "0.5" for 0.5 stETH.'),
|
|
49
|
+
approvalCap: approvalCapSchema,
|
|
50
|
+
});
|
|
51
|
+
export const prepareNativeSendInput = z.object({
|
|
52
|
+
wallet: walletSchema,
|
|
53
|
+
chain: chainEnum.default("ethereum"),
|
|
54
|
+
to: addressSchema,
|
|
55
|
+
amount: z
|
|
56
|
+
.string()
|
|
57
|
+
.describe('Human-readable native-asset amount, NOT raw wei. Example: "0.5" for 0.5 ETH (or 0.5 MATIC on polygon).'),
|
|
58
|
+
});
|
|
59
|
+
export const prepareTokenSendInput = z.object({
|
|
60
|
+
wallet: walletSchema,
|
|
61
|
+
chain: chainEnum.default("ethereum"),
|
|
62
|
+
token: addressSchema,
|
|
63
|
+
to: addressSchema,
|
|
64
|
+
amount: z
|
|
65
|
+
.string()
|
|
66
|
+
.describe('Human-readable decimal amount, NOT raw wei/base units. Example: "10" for 10 USDC. ' +
|
|
67
|
+
'Decimals resolved from the token contract. Pass "max" to send the full balance.'),
|
|
68
|
+
});
|
|
69
|
+
export const sendTransactionInput = z.object({
|
|
70
|
+
handle: z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1)
|
|
73
|
+
.describe("Opaque handle returned by a prepare_* tool in the `handle` field of the UnsignedTx. " +
|
|
74
|
+
"Raw calldata is NOT accepted — the handle is the only way to name a tx for signing, " +
|
|
75
|
+
"so the tx the user previewed is exactly the tx sent to Ledger. If the tx chain has a " +
|
|
76
|
+
"`next` step (e.g. approve → swap), each step has its own handle; call send_transaction " +
|
|
77
|
+
"once per handle in order. Handles expire 15 minutes after prepare and are single-use."),
|
|
78
|
+
confirmed: z
|
|
79
|
+
.literal(true)
|
|
80
|
+
.describe("Must be literally `true`. The agent is affirming that the user has seen and acknowledged " +
|
|
81
|
+
"the decoded preview returned by the preceding prepare_* call. This is a schema-enforced " +
|
|
82
|
+
"contract — omitting it fails validation before any tx is submitted."),
|
|
83
|
+
});
|
|
84
|
+
export const getTransactionStatusInput = z.object({
|
|
85
|
+
chain: chainEnum,
|
|
86
|
+
txHash: z.string().regex(/^0x[a-fA-F0-9]{64}$/),
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/modules/execution/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAA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AsF;QACpF,sFAAsF;QACtF,uFAAuF;QACvF,yFAAyF;QACzF,uFAAuF,CAC1F;IACH,SAAS,EAAE,CAAC;SACT,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CACP,2FAA2F;QACzF,0FAA0F;QAC1F,qEAAqE,CACxE;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC;CAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { requestCapabilityInput, type RequestCapabilityArgs } from "./schemas.js";
|
|
2
|
+
export { requestCapabilityInput };
|
|
3
|
+
export type { RequestCapabilityArgs };
|
|
4
|
+
export declare function requestCapability(args: RequestCapabilityArgs): Promise<{
|
|
5
|
+
status: "submitted";
|
|
6
|
+
endpoint: string;
|
|
7
|
+
response: unknown;
|
|
8
|
+
rateLimit: {
|
|
9
|
+
readonly minIntervalSeconds: number;
|
|
10
|
+
readonly perHour: 3;
|
|
11
|
+
readonly perDay: 10;
|
|
12
|
+
readonly dedupeWindowDays: number;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
status: "prefilled_url";
|
|
16
|
+
message: string;
|
|
17
|
+
issueUrl: string;
|
|
18
|
+
repo: string;
|
|
19
|
+
title: string;
|
|
20
|
+
labels: string[];
|
|
21
|
+
bodyTruncated: boolean;
|
|
22
|
+
rateLimit: {
|
|
23
|
+
readonly minIntervalSeconds: number;
|
|
24
|
+
readonly perHour: 3;
|
|
25
|
+
readonly perDay: 10;
|
|
26
|
+
readonly dedupeWindowDays: number;
|
|
27
|
+
};
|
|
28
|
+
}>;
|