@aegis-engine/core 0.12.0 → 0.13.1
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 +26 -2
- package/dist/account.js +1 -129
- package/dist/actions/kyberSwap.d.ts +5 -0
- package/dist/aegis-core.js +71 -10334
- package/dist/contract/generated/aegis-swap.d.ts +167 -10
- package/dist/contract/generated/market-data.d.ts +333 -21
- package/dist/engine/account/portfolioSchemas.d.ts +2 -1
- package/dist/engine/registry.d.ts +15 -0
- package/dist/engine/types.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/quote/aggregatedSwapQuote.d.ts +13 -3
- package/dist/sdkRuntime-CMBWjHxv.js +1593 -0
- package/dist/transactionHistory-C8KRA_tE.js +149 -0
- package/dist/types/aggregatedSwap.d.ts +21 -0
- package/package.json +1 -1
- package/dist/sdkRuntime-Dcfu-Hbw.js +0 -18757
- package/dist/transactionHistory-B-F6o9hW.js +0 -6994
package/README.md
CHANGED
|
@@ -626,17 +626,32 @@ carry the `uniswap-v4-aegis` tag. It checks this before build and, in
|
|
|
626
626
|
hop is tagged with any other source, it throws `NoAegisRouteError`
|
|
627
627
|
(`reason: 'no-route' | 'non-aegis-leg'`).
|
|
628
628
|
|
|
629
|
+
Mainnet and Ink charge an output fee. Pass the deployment's `/v1/config`
|
|
630
|
+
`fee.outputFeeBps` as `outputFeeBps` in the same options object (an integer from
|
|
631
|
+
0 to 200; `0` charges no fee) and to `executeKyberSwap`; the route request,
|
|
632
|
+
build and calldata check all use it. `executeKyberSwap` rejects a displayed
|
|
633
|
+
quote at any other fee before any wallet prompt, approval or signature, and
|
|
634
|
+
refuses to sign if the submitted fee differs. Omit it when config is
|
|
635
|
+
unavailable to keep the bundled 50 bps (`AGGREGATED_SWAP_FEE_BPS`).
|
|
636
|
+
|
|
629
637
|
Ink (57073) has no Kyber coverage, so it uses an in-house provider that accepts
|
|
630
638
|
only `liquiditySources: 'aegis'` (`'any'` is rejected). It enumerates every path
|
|
631
639
|
of up to three hops through the shipped Ink pool catalogue, quotes all of them
|
|
632
640
|
(at most 32) in one Multicall3 `eth_call` to the V4 quoter, and takes the best
|
|
633
|
-
output net of the
|
|
641
|
+
output net of the output fee. Pass a `publicClient` (the eighth argument) to
|
|
634
642
|
reuse your RPC. The swap goes to the Aegis router, which pulls input through
|
|
635
643
|
Permit2: `executeKyberSwap` approves Permit2 for the exact input, signs a
|
|
636
644
|
Permit2 grant for the router, re-quotes, and simulates before sending. The
|
|
637
645
|
calldata ends with a fixed `TAKE` of the reviewed minimum, so a short fill
|
|
638
646
|
reverts.
|
|
639
647
|
|
|
648
|
+
Quotes carry `routePaths` for display: each path's input share (`amountIn`) and
|
|
649
|
+
its legs (`pool`, `tokenIn`, `tokenOut`, `source`), as the provider reported
|
|
650
|
+
them. It is omitted unless every path is complete, its legs chain, and its
|
|
651
|
+
endpoints match the quoted assets up to canonical native/wrapped aliases. Known
|
|
652
|
+
input allocations must sum to the quoted input. Invalid metadata is omitted
|
|
653
|
+
without rejecting the display quote. Execution never reads it.
|
|
654
|
+
|
|
640
655
|
## KyberSwap Execution
|
|
641
656
|
|
|
642
657
|
```ts
|
|
@@ -738,7 +753,13 @@ pnpm pack:check
|
|
|
738
753
|
|
|
739
754
|
## Engine account portfolio and activity
|
|
740
755
|
|
|
741
|
-
`fetchEngineAccountPortfolio({ source, account, chainIds, signal })` reads one complete, bounded account snapshot from the versioned portfolio API. The returned positions, totals, prices and per-chain frames belong to the same snapshot. A failed or expired page rejects the read instead of mixing snapshots. Supported chain IDs are 1, 130, 8453 and
|
|
756
|
+
`fetchEngineAccountPortfolio({ source, account, chainIds, signal })` reads one complete, bounded account snapshot from the versioned portfolio API. The returned positions, totals, prices and per-chain frames belong to the same snapshot. A failed or expired page rejects the read instead of mixing snapshots. Supported chain IDs are 1, 56, 130, 8453, 4663 and 57073 (Ink); pass the distinct host-selected set. The complete read is bounded to 300 positions, matching the backend's six-chain maximum of 50 positions per chain, with the existing 25-position page requests, response byte limits and shared deadline.
|
|
757
|
+
|
|
758
|
+
Portfolio, paged activity and transaction acknowledgement reads are available through the existing `@aegis-engine/core/account` entrypoint. Ink support admits the source contract; it does not enable borrowing, activate an operator or establish a live wallet/accounting result. Hosts retain their existing action gates and must qualify the deployed backend separately.
|
|
759
|
+
|
|
760
|
+
Ink account reads require a deployed Engine account API that supports Ink and
|
|
761
|
+
the six-chain, 300-position contract. Hosts must qualify that backend before
|
|
762
|
+
enabling the integration and retain their existing action gates.
|
|
742
763
|
|
|
743
764
|
Metrics keep `usd: null`, a `knownUsd` subtotal and reasons when coverage is incomplete. Gross assets include supplied value; adding supply again would double count it. Debt and net equity remain separate. NFT principal, fees, unknown prices and unavailable chains retain their coverage reasons. `performance` explicitly reports unavailable cash-flow and cost-basis evidence.
|
|
744
765
|
|
|
@@ -765,6 +786,9 @@ change does not claim it is already available through the accounting endpoint.
|
|
|
765
786
|
|
|
766
787
|
`fetchEngineMarketCandles`, `fetchEngineMarketReferenceHistory`, and
|
|
767
788
|
`fetchEngineRateHistory` read public market data with a shared, bounded REST request.
|
|
789
|
+
These display reads admit Ink (`57073`) through the same market identity, asset,
|
|
790
|
+
coverage and provenance guards. Admission does not establish live source coverage;
|
|
791
|
+
an unavailable history remains unavailable rather than falling back to another feed.
|
|
768
792
|
Validated responses are cached for 30 seconds with at most 16 entries, keyed by
|
|
769
793
|
endpoint, request headers, timeout, market, series and window. A missing endpoint
|
|
770
794
|
backs off for 60 seconds; 429/503 responses back off for at least 30 seconds and
|
package/dist/account.js
CHANGED
|
@@ -1,129 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { g as M, h as j, j as J, k as O, m as U, p as G, q as Z, t as Q, u as V, v as W, x as X, y as Y, z as ee, B as ae, C as oe, D as se, F as ne, G as te, H as re } from "./transactionHistory-B-F6o9hW.js";
|
|
3
|
-
import { keccak256 as k, encodeAbiParameters as y } from "viem";
|
|
4
|
-
const H = b({ version: P(1), snapshotId: I().uuid(), page: A().int().min(1).max(95) }).strict();
|
|
5
|
-
function v(e) {
|
|
6
|
-
if (!/^[A-Za-z0-9_-]{1,256}$/.test(e)) throw new Error("invalid-cursor");
|
|
7
|
-
return H.parse(JSON.parse(atob(e.replace(/-/g, "+").replace(/_/g, "/"))));
|
|
8
|
-
}
|
|
9
|
-
function L(e) {
|
|
10
|
-
return u({ ...e, chainIds: [e.chainId] }, async (r) => {
|
|
11
|
-
let o;
|
|
12
|
-
try {
|
|
13
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(e.poolId) || !["lend_shares", "borrow_vault"].includes(e.kind) || (e.kind === "borrow_vault" ? !g.safeParse(e.vaultId).success : e.vaultId !== void 0)) throw new Error("invalid-query");
|
|
14
|
-
e.cursor !== void 0 && (o = v(e.cursor));
|
|
15
|
-
} catch {
|
|
16
|
-
throw new h("invalid-query", 400);
|
|
17
|
-
}
|
|
18
|
-
const a = await f(r, "positions/accounting", {
|
|
19
|
-
chainId: String(e.chainId),
|
|
20
|
-
poolId: e.poolId.toLowerCase(),
|
|
21
|
-
kind: e.kind,
|
|
22
|
-
...e.kind === "borrow_vault" ? { vaultId: e.vaultId } : {},
|
|
23
|
-
...e.cursor ? { cursor: e.cursor } : {}
|
|
24
|
-
}, x, { omitChainIds: !0, responseLimit: 256 * 1024 });
|
|
25
|
-
if (Date.parse(a.expiresAt) <= Date.now()) throw new h("snapshot-expired", 410);
|
|
26
|
-
const n = a.position, l = n.key;
|
|
27
|
-
if ((n.account !== r.query.account || n.chainId !== e.chainId || n.poolId !== e.poolId.toLowerCase() || n.kind !== e.kind || n.vaultId !== (e.vaultId ?? null) || n.scope !== (e.kind === "lend_shares" ? "account-lending" : "vault-lifetime") || a.page.snapshotId !== a.snapshotId || a.page.page !== ((o == null ? void 0 : o.page) ?? 0) || o && o.snapshotId !== a.snapshotId || a.page.page >= a.pageCount || a.recordCount > 0 && a.page.records.length === 0 || a.page.records.length > a.recordCount || a.pageCount === 1 && a.page.records.length !== a.recordCount || Date.parse(a.expiresAt) - Date.parse(a.createdAt) !== 6e5 || l.currency0 >= l.currency1 || k(y(
|
|
28
|
-
[{ type: "address" }, { type: "address" }, { type: "uint24" }, { type: "int24" }, { type: "address" }],
|
|
29
|
-
[l.currency0, l.currency1, l.fee, l.tickSpacing, l.hooks]
|
|
30
|
-
)) !== n.poolId) && c(), a.page.page + 1 < a.pageCount != (a.nextCursor !== null) && c(), a.nextCursor !== null)
|
|
31
|
-
try {
|
|
32
|
-
const t = v(a.nextCursor);
|
|
33
|
-
(t.snapshotId !== a.snapshotId || t.page !== a.page.page + 1) && c();
|
|
34
|
-
} catch {
|
|
35
|
-
c();
|
|
36
|
-
}
|
|
37
|
-
const m = /* @__PURE__ */ new Map();
|
|
38
|
-
let i;
|
|
39
|
-
for (const t of a.page.records) {
|
|
40
|
-
const s = t.event, p = m.get(s.transactionHash);
|
|
41
|
-
if ((s.blockNumber > a.frame.blockNumber || s.blockTimestamp > a.frame.blockTimestamp || i && (s.blockNumber < i.blockNumber || s.blockTimestamp < i.blockTimestamp || s.blockNumber === i.blockNumber && (s.logIndex <= i.logIndex || s.blockTimestamp !== i.blockTimestamp || s.transactionIndex < i.transactionIndex || s.transactionIndex === i.transactionIndex != (s.transactionHash === i.transactionHash))) || p && (p.blockNumber !== s.blockNumber || p.blockTimestamp !== s.blockTimestamp || p.transactionIndex !== s.transactionIndex)) && c(), t.type === "ownership")
|
|
42
|
-
(e.kind !== "borrow_vault" || t.event.vaultId !== e.vaultId || t.event.registry !== n.registry || s.id !== `vault-transfer:${n.chainId}:${n.registry}:${s.transactionHash}:${s.logIndex}` || s.blockNumber === a.frame.blockNumber && t.event.blockHash !== a.frame.blockHash) && c();
|
|
43
|
-
else {
|
|
44
|
-
const d = t.event, w = ["liquidity_modified", "share_transfer", "protocol_fee_minted"].includes(d.kind);
|
|
45
|
-
(e.kind === "lend_shares" !== w || d.kind === "liquidity_modified" && d.details.account !== n.account || d.kind === "protocol_fee_minted" && d.details.recipient !== n.account || d.kind === "share_transfer" && d.details.from !== n.account && d.details.to !== n.account) && c(), (t.event.id !== `engine-event:${n.chainId}:${n.engine}:${s.transactionHash}:${s.logIndex}` || t.event.sourceId !== `${s.transactionHash}-${s.logIndex}` || e.kind === "lend_shares" && t.ownershipAtEvent.status !== "not-applicable" || e.kind === "borrow_vault" && (a.ownership.status !== "complete" ? t.ownershipAtEvent.status !== "unavailable" : !["known", "inactive"].includes(t.ownershipAtEvent.status))) && c();
|
|
46
|
-
}
|
|
47
|
-
m.set(s.transactionHash, s), i = s;
|
|
48
|
-
}
|
|
49
|
-
return a;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const R = _({ ttlMs: 0, maxEntries: 64 });
|
|
53
|
-
async function F(e) {
|
|
54
|
-
var n;
|
|
55
|
-
(n = e.signal) == null || n.throwIfAborted();
|
|
56
|
-
const r = { ...e.source, headers: { ...e.source.headers } }, o = JSON.stringify([
|
|
57
|
-
E(r.baseUrl),
|
|
58
|
-
S(r.headers),
|
|
59
|
-
r.timeoutMs,
|
|
60
|
-
e.account,
|
|
61
|
-
e.chainId,
|
|
62
|
-
e.poolId,
|
|
63
|
-
e.vaultId,
|
|
64
|
-
e.snapshotId
|
|
65
|
-
]), a = R.read(o, () => $({ ...e, source: r, signal: void 0 }));
|
|
66
|
-
return structuredClone(await C(a, e.signal, "Position PnL read aborted."));
|
|
67
|
-
}
|
|
68
|
-
function $(e) {
|
|
69
|
-
return u({ ...e, chainIds: [e.chainId] }, async (r) => {
|
|
70
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(e.poolId) || !g.safeParse(e.vaultId).success || !I().uuid().safeParse(e.snapshotId).success) throw new h("invalid-query", 400);
|
|
71
|
-
const o = await f(r, "positions/pnl", {
|
|
72
|
-
chainId: String(e.chainId),
|
|
73
|
-
poolId: e.poolId.toLowerCase(),
|
|
74
|
-
kind: "borrow_vault",
|
|
75
|
-
vaultId: e.vaultId,
|
|
76
|
-
snapshotId: e.snapshotId
|
|
77
|
-
}, T, { omitChainIds: !0, responseLimit: 32 * 1024 });
|
|
78
|
-
if (Date.parse(o.expiresAt) <= Date.now()) throw new h("snapshot-expired", 410);
|
|
79
|
-
if ((o.account !== r.query.account || o.chainId !== e.chainId || o.poolId !== e.poolId.toLowerCase() || o.vaultId !== e.vaultId || o.snapshotId !== e.snapshotId || Date.parse(o.capturedAt) > Date.now() + 6e4 || Date.parse(o.expiresAt) - Date.parse(o.capturedAt) > 6e5) && c(), o.status === "token-pnl") {
|
|
80
|
-
const a = o.key;
|
|
81
|
-
k(y(
|
|
82
|
-
[{ type: "address" }, { type: "address" }, { type: "uint24" }, { type: "int24" }, { type: "address" }],
|
|
83
|
-
[a.currency0, a.currency1, a.fee, a.tickSpacing, a.hooks]
|
|
84
|
-
)) !== o.poolId && c();
|
|
85
|
-
}
|
|
86
|
-
return o;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function z(e) {
|
|
90
|
-
return u({ ...e, chainIds: [e.chainId] }, async (r) => {
|
|
91
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(e.poolId) || !g.safeParse(e.vaultId).success || !I().uuid().safeParse(e.snapshotId).success || e.portfolioSnapshotId !== void 0 && !I().uuid().safeParse(e.portfolioSnapshotId).success)
|
|
92
|
-
throw new h("invalid-query", 400);
|
|
93
|
-
const o = await f(r, "positions/performance", {
|
|
94
|
-
chainId: String(e.chainId),
|
|
95
|
-
poolId: e.poolId.toLowerCase(),
|
|
96
|
-
kind: "borrow_vault",
|
|
97
|
-
vaultId: e.vaultId,
|
|
98
|
-
snapshotId: e.snapshotId,
|
|
99
|
-
...e.portfolioSnapshotId ? { portfolioSnapshotId: e.portfolioSnapshotId } : {}
|
|
100
|
-
}, D, { omitChainIds: !0, responseLimit: 32 * 1024 });
|
|
101
|
-
if (Date.parse(o.expiresAt) <= Date.now()) throw new h("snapshot-expired", 410);
|
|
102
|
-
return (o.account !== r.query.account || o.chainId !== e.chainId || o.poolId !== e.poolId.toLowerCase() || o.vaultId !== e.vaultId || o.snapshotId !== e.snapshotId || o.portfolioSnapshotId !== (e.portfolioSnapshotId ?? null) || Date.parse(o.capturedAt) > Date.now() + 6e4 || Date.parse(o.expiresAt) - Date.parse(o.capturedAt) > 6e5) && c(), o;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
export {
|
|
106
|
-
h as AegisEngineAccountReadError,
|
|
107
|
-
M as createEngineTransactionHistory,
|
|
108
|
-
j as engineAccountPositionKey,
|
|
109
|
-
J as engineAccountTransactionKey,
|
|
110
|
-
O as engineHistoryCatalogResponseSchema,
|
|
111
|
-
U as enginePortfolioPriceFor,
|
|
112
|
-
G as enginePositionHistoryResponseSchema,
|
|
113
|
-
Z as engineTransactionStorageKey,
|
|
114
|
-
Q as fetchEngineAccountActivity,
|
|
115
|
-
V as fetchEngineAccountPortfolio,
|
|
116
|
-
W as fetchEngineHistoryPositions,
|
|
117
|
-
L as fetchEnginePositionAccounting,
|
|
118
|
-
X as fetchEnginePositionHistory,
|
|
119
|
-
z as fetchEnginePositionPerformance,
|
|
120
|
-
F as fetchEnginePositionPnl,
|
|
121
|
-
Y as fetchEngineTransactionStatus,
|
|
122
|
-
ee as formatEngineAccountTokenAmount,
|
|
123
|
-
ae as groupEngineAccountActivity,
|
|
124
|
-
oe as groupEnginePortfolioPositions,
|
|
125
|
-
se as mergeEngineTransactionRecord,
|
|
126
|
-
ne as parseEngineTransactionRecords,
|
|
127
|
-
te as resolveEngineAccountPositionTarget,
|
|
128
|
-
re as serializeEngineTransactionRecords
|
|
129
|
-
};
|
|
1
|
+
import{w as u,o as b,n as A,s as I,l as P,E as g,A as h,r as f,a as x,i as c,b as E,c as S,d as C,e as _,P as T,f as D}from"./transactionHistory-C8KRA_tE.js";import{g as M,h as j,j as J,k as O,m as U,p as G,q as Z,t as Q,u as V,v as W,x as X,y as Y,z as ee,B as ae,C as oe,D as se,F as ne,G as te,H as re}from"./transactionHistory-C8KRA_tE.js";import{keccak256 as k,encodeAbiParameters as y}from"viem";const H=b({version:P(1),snapshotId:I().uuid(),page:A().int().min(1).max(95)}).strict();function v(e){if(!/^[A-Za-z0-9_-]{1,256}$/.test(e))throw new Error("invalid-cursor");return H.parse(JSON.parse(atob(e.replace(/-/g,"+").replace(/_/g,"/"))));}function L(e){return u({...e,chainIds:[e.chainId]},async r=>{let o;try{if(!/^0x[0-9a-fA-F]{64}$/.test(e.poolId)||!["lend_shares","borrow_vault"].includes(e.kind)||(e.kind==="borrow_vault"?!g.safeParse(e.vaultId).success:e.vaultId!==void 0))throw new Error("invalid-query");e.cursor!==void 0&&(o=v(e.cursor));}catch{throw new h("invalid-query",400);}const a=await f(r,"positions/accounting",{chainId:String(e.chainId),poolId:e.poolId.toLowerCase(),kind:e.kind,...(e.kind==="borrow_vault"?{vaultId:e.vaultId}:{}),...(e.cursor?{cursor:e.cursor}:{})},x,{omitChainIds:!0,responseLimit:256*1024});if(Date.parse(a.expiresAt)<=Date.now())throw new h("snapshot-expired",410);const n=a.position,l=n.key;if((n.account!==r.query.account||n.chainId!==e.chainId||n.poolId!==e.poolId.toLowerCase()||n.kind!==e.kind||n.vaultId!==(e.vaultId??null)||n.scope!==(e.kind==="lend_shares"?"account-lending":"vault-lifetime")||a.page.snapshotId!==a.snapshotId||a.page.page!==((o==null?void 0:o.page)??0)||o&&o.snapshotId!==a.snapshotId||a.page.page>=a.pageCount||a.recordCount>0&&a.page.records.length===0||a.page.records.length>a.recordCount||a.pageCount===1&&a.page.records.length!==a.recordCount||Date.parse(a.expiresAt)-Date.parse(a.createdAt)!==6e5||l.currency0>=l.currency1||k(y([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[l.currency0,l.currency1,l.fee,l.tickSpacing,l.hooks]))!==n.poolId)&&c(),a.page.page+1<a.pageCount!=(a.nextCursor!==null)&&c(),a.nextCursor!==null)try{const t=v(a.nextCursor);(t.snapshotId!==a.snapshotId||t.page!==a.page.page+1)&&c();}catch{c();}const m=/* @__PURE__ */new Map();let i;for(const t of a.page.records){const s=t.event,p=m.get(s.transactionHash);if((s.blockNumber>a.frame.blockNumber||s.blockTimestamp>a.frame.blockTimestamp||i&&(s.blockNumber<i.blockNumber||s.blockTimestamp<i.blockTimestamp||s.blockNumber===i.blockNumber&&(s.logIndex<=i.logIndex||s.blockTimestamp!==i.blockTimestamp||s.transactionIndex<i.transactionIndex||s.transactionIndex===i.transactionIndex!=(s.transactionHash===i.transactionHash)))||p&&(p.blockNumber!==s.blockNumber||p.blockTimestamp!==s.blockTimestamp||p.transactionIndex!==s.transactionIndex))&&c(),t.type==="ownership")(e.kind!=="borrow_vault"||t.event.vaultId!==e.vaultId||t.event.registry!==n.registry||s.id!==`vault-transfer:${n.chainId}:${n.registry}:${s.transactionHash}:${s.logIndex}`||s.blockNumber===a.frame.blockNumber&&t.event.blockHash!==a.frame.blockHash)&&c();else{const d=t.event,w=["liquidity_modified","share_transfer","protocol_fee_minted"].includes(d.kind);(e.kind==="lend_shares"!==w||d.kind==="liquidity_modified"&&d.details.account!==n.account||d.kind==="protocol_fee_minted"&&d.details.recipient!==n.account||d.kind==="share_transfer"&&d.details.from!==n.account&&d.details.to!==n.account)&&c(),(t.event.id!==`engine-event:${n.chainId}:${n.engine}:${s.transactionHash}:${s.logIndex}`||t.event.sourceId!==`${s.transactionHash}-${s.logIndex}`||e.kind==="lend_shares"&&t.ownershipAtEvent.status!=="not-applicable"||e.kind==="borrow_vault"&&(a.ownership.status!=="complete"?t.ownershipAtEvent.status!=="unavailable":!["known","inactive"].includes(t.ownershipAtEvent.status)))&&c();}m.set(s.transactionHash,s),i=s;}return a;});}const R=_({ttlMs:0,maxEntries:64});async function F(e){var n;(n=e.signal)==null||n.throwIfAborted();const r={...e.source,headers:{...e.source.headers}},o=JSON.stringify([E(r.baseUrl),S(r.headers),r.timeoutMs,e.account,e.chainId,e.poolId,e.vaultId,e.snapshotId]),a=R.read(o,()=>$({...e,source:r,signal:void 0}));return structuredClone(await C(a,e.signal,"Position PnL read aborted."));}function $(e){return u({...e,chainIds:[e.chainId]},async r=>{if(!/^0x[0-9a-fA-F]{64}$/.test(e.poolId)||!g.safeParse(e.vaultId).success||!I().uuid().safeParse(e.snapshotId).success)throw new h("invalid-query",400);const o=await f(r,"positions/pnl",{chainId:String(e.chainId),poolId:e.poolId.toLowerCase(),kind:"borrow_vault",vaultId:e.vaultId,snapshotId:e.snapshotId},T,{omitChainIds:!0,responseLimit:32*1024});if(Date.parse(o.expiresAt)<=Date.now())throw new h("snapshot-expired",410);if((o.account!==r.query.account||o.chainId!==e.chainId||o.poolId!==e.poolId.toLowerCase()||o.vaultId!==e.vaultId||o.snapshotId!==e.snapshotId||Date.parse(o.capturedAt)>Date.now()+6e4||Date.parse(o.expiresAt)-Date.parse(o.capturedAt)>6e5)&&c(),o.status==="token-pnl"){const a=o.key;k(y([{type:"address"},{type:"address"},{type:"uint24"},{type:"int24"},{type:"address"}],[a.currency0,a.currency1,a.fee,a.tickSpacing,a.hooks]))!==o.poolId&&c();}return o;});}function z(e){return u({...e,chainIds:[e.chainId]},async r=>{if(!/^0x[0-9a-fA-F]{64}$/.test(e.poolId)||!g.safeParse(e.vaultId).success||!I().uuid().safeParse(e.snapshotId).success||e.portfolioSnapshotId!==void 0&&!I().uuid().safeParse(e.portfolioSnapshotId).success)throw new h("invalid-query",400);const o=await f(r,"positions/performance",{chainId:String(e.chainId),poolId:e.poolId.toLowerCase(),kind:"borrow_vault",vaultId:e.vaultId,snapshotId:e.snapshotId,...(e.portfolioSnapshotId?{portfolioSnapshotId:e.portfolioSnapshotId}:{})},D,{omitChainIds:!0,responseLimit:32*1024});if(Date.parse(o.expiresAt)<=Date.now())throw new h("snapshot-expired",410);return(o.account!==r.query.account||o.chainId!==e.chainId||o.poolId!==e.poolId.toLowerCase()||o.vaultId!==e.vaultId||o.snapshotId!==e.snapshotId||o.portfolioSnapshotId!==(e.portfolioSnapshotId??null)||Date.parse(o.capturedAt)>Date.now()+6e4||Date.parse(o.expiresAt)-Date.parse(o.capturedAt)>6e5)&&c(),o;});}export{h as AegisEngineAccountReadError,M as createEngineTransactionHistory,j as engineAccountPositionKey,J as engineAccountTransactionKey,O as engineHistoryCatalogResponseSchema,U as enginePortfolioPriceFor,G as enginePositionHistoryResponseSchema,Z as engineTransactionStorageKey,Q as fetchEngineAccountActivity,V as fetchEngineAccountPortfolio,W as fetchEngineHistoryPositions,L as fetchEnginePositionAccounting,X as fetchEnginePositionHistory,z as fetchEnginePositionPerformance,F as fetchEnginePositionPnl,Y as fetchEngineTransactionStatus,ee as formatEngineAccountTokenAmount,ae as groupEngineAccountActivity,oe as groupEnginePortfolioPositions,se as mergeEngineTransactionRecord,ne as parseEngineTransactionRecords,te as resolveEngineAccountPositionTarget,re as serializeEngineTransactionRecords};
|
|
@@ -39,6 +39,11 @@ export declare function executeKyberSwap(args: {
|
|
|
39
39
|
approvalMode?: AegisSwapApprovalMode;
|
|
40
40
|
/** `'aegis'` routes only through Aegis pools and fails closed otherwise. Defaults to `'any'`. */
|
|
41
41
|
liquiditySources?: AggregatedSwapLiquiditySources;
|
|
42
|
+
/**
|
|
43
|
+
* Output fee in bps from `/v1/config` (`fee.outputFeeBps`). Pass the value
|
|
44
|
+
* the displayed quote was fetched with; omit it to keep the bundled default.
|
|
45
|
+
*/
|
|
46
|
+
outputFeeBps?: number;
|
|
42
47
|
signal?: AbortSignal;
|
|
43
48
|
onWalletChainId?: (chainId: number | null) => void;
|
|
44
49
|
} & AegisSwapActionCallbacks): Promise<AegisSwapActionResult<AggregatedSwapQuote>>;
|