@aegis-engine/core 0.6.0 → 0.8.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/README.md +232 -7
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/account.d.ts +11 -0
- package/dist/account.js +129 -0
- package/dist/actions/allowance.d.ts +94 -0
- package/dist/actions/directPoolSwap.d.ts +10 -1
- package/dist/actions/kyberSwap.d.ts +2 -0
- package/dist/actions/types.d.ts +10 -3
- package/dist/actions/wallet.d.ts +1 -0
- package/dist/aegis-core.js +9653 -200
- package/dist/backendAdapters.d.ts +3 -1
- package/dist/config/chains.d.ts +1 -0
- package/dist/config/constants.d.ts +4 -0
- package/dist/config/tokens.d.ts +2 -1
- package/dist/config/types.d.ts +8 -0
- package/dist/contract/backendClient.d.ts +3 -1
- package/dist/contract/generated/aegis-swap.d.ts +6337 -1377
- package/dist/contract/generated/market-data.d.ts +8286 -0
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/responseBudget.d.ts +9 -0
- package/dist/contract/schemas.d.ts +13 -3
- package/dist/engine/account/accounting.d.ts +24 -0
- package/dist/engine/account/accountingSchemas.d.ts +2056 -0
- package/dist/engine/account/activity.d.ts +42 -0
- package/dist/engine/account/activitySchemas.d.ts +327 -0
- package/dist/engine/account/amountSchemas.d.ts +9 -0
- package/dist/engine/account/catalogSchemas.d.ts +108 -0
- package/dist/engine/account/client.d.ts +14 -0
- package/dist/engine/account/history.d.ts +40 -0
- package/dist/engine/account/historySchemas.d.ts +251 -0
- package/dist/engine/account/management.d.ts +13 -0
- package/dist/engine/account/portfolioSchemas.d.ts +712 -0
- package/dist/engine/account/positionPerformance.d.ts +18 -0
- package/dist/engine/account/positionPerformanceSchemas.d.ts +101 -0
- package/dist/engine/account/positionPnl.d.ts +18 -0
- package/dist/engine/account/positionPnlSchemas.d.ts +149 -0
- package/dist/engine/account/transactionHistory.d.ts +50 -0
- package/dist/engine/account/transactionSchemas.d.ts +101 -0
- package/dist/engine/account/transactions.d.ts +26 -0
- package/dist/engine/account/transport.d.ts +31 -0
- package/dist/engine/account/types.d.ts +39 -0
- package/dist/engine/actions.d.ts +14 -4
- package/dist/engine/adaptiveFee.d.ts +14 -0
- package/dist/engine/balancedLending.d.ts +82 -0
- package/dist/engine/borrowCollateralFloor.d.ts +3 -0
- package/dist/engine/borrowLimits.d.ts +18 -0
- package/dist/engine/dataSource.d.ts +2 -0
- package/dist/engine/index.d.ts +20 -0
- package/dist/engine/marketAdapter.d.ts +3 -0
- package/dist/engine/marketSeries.d.ts +61 -0
- package/dist/engine/marketSeriesSchemas.d.ts +312 -0
- package/dist/engine/marketTrust.d.ts +26 -0
- package/dist/engine/openingEntry.d.ts +41 -0
- package/dist/engine/rateHistorySchemas.d.ts +88 -0
- package/dist/engine/reads.d.ts +1 -1
- package/dist/engine/registry.d.ts +1 -1
- package/dist/engine/restSchemas.d.ts +59 -1
- package/dist/engine/tradeExecutionSession.d.ts +155 -0
- package/dist/engine/types.d.ts +169 -15
- package/dist/engine/v4Quote.d.ts +5 -0
- package/dist/index.d.ts +13 -8
- package/dist/internal/guardedWalletTransaction.d.ts +31 -0
- package/dist/permit.d.ts +80 -6
- package/dist/quote/aggregatedSwapQuote.d.ts +5 -1
- package/dist/quote/kyberCalldata.d.ts +5 -1
- package/dist/{sdkRuntime-C_vaU-0g.js → sdkRuntime-3aRt_g55.js} +3385 -2957
- package/dist/services/kyberSwap.d.ts +12 -0
- package/dist/swap/authorizePermit.d.ts +11 -9
- package/dist/swap/executeSwapTransaction.d.ts +5 -1
- package/dist/swap/receiptWait.d.ts +9 -0
- package/dist/swap/sendSwapTransaction.d.ts +7 -0
- package/dist/swap/settlement.d.ts +4 -0
- package/dist/swap/trustedMarket.d.ts +25 -0
- package/dist/transactionHistory-1Zl2KCcV.js +5915 -0
- package/dist/transactionProgress.d.ts +41 -2
- package/dist/wallet.d.ts +5 -1
- package/package.json +12 -5
- package/dist/index-D9EfUokZ.js +0 -11031
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RateHistoryPointSchema: z.ZodObject<{
|
|
3
|
+
t: z.ZodNumber;
|
|
4
|
+
observedAt: z.ZodString;
|
|
5
|
+
evmBlockNumber: z.ZodNumber;
|
|
6
|
+
borrowAprPct: z.ZodNullable<z.ZodNumber>;
|
|
7
|
+
lendAprPct: z.ZodNullable<z.ZodNumber>;
|
|
8
|
+
lendingRateBasis: z.ZodLiteral<"simple-borrow-interest-apr">;
|
|
9
|
+
utilizationPct: z.ZodNullable<z.ZodNumber>;
|
|
10
|
+
ratePerSecondWad: z.ZodNullable<z.ZodString>;
|
|
11
|
+
fullUtilizationRate: z.ZodNullable<z.ZodString>;
|
|
12
|
+
sharePriceWad: z.ZodNullable<z.ZodString>;
|
|
13
|
+
rateObservation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
status: z.ZodLiteral<"verified">;
|
|
15
|
+
basis: z.ZodLiteral<"irm-accrual-preview">;
|
|
16
|
+
rpcBlockNumber: z.ZodNumber;
|
|
17
|
+
blockHash: z.ZodString;
|
|
18
|
+
observedAt: z.ZodString;
|
|
19
|
+
elapsedSeconds: z.ZodString;
|
|
20
|
+
canonicality: z.ZodLiteral<"rpc-checked-at-read">;
|
|
21
|
+
finality: z.ZodLiteral<"not-a-finality-verdict">;
|
|
22
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
23
|
+
status: z.ZodLiteral<"unavailable">;
|
|
24
|
+
reason: z.ZodEnum<{
|
|
25
|
+
"legacy-unpinned": "legacy-unpinned";
|
|
26
|
+
"invalid-provenance": "invalid-provenance";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strict>], "status">;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const RateHistoryResponseSchema: z.ZodObject<{
|
|
31
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
32
|
+
marketId: z.ZodString;
|
|
33
|
+
resolution: z.ZodLiteral<"12h">;
|
|
34
|
+
window: z.ZodEnum<{
|
|
35
|
+
"7d": "7d";
|
|
36
|
+
"30d": "30d";
|
|
37
|
+
"60d": "60d";
|
|
38
|
+
}>;
|
|
39
|
+
status: z.ZodEnum<{
|
|
40
|
+
ready: "ready";
|
|
41
|
+
warming_up: "warming_up";
|
|
42
|
+
no_data: "no_data";
|
|
43
|
+
partial: "partial";
|
|
44
|
+
}>;
|
|
45
|
+
pointCount: z.ZodNumber;
|
|
46
|
+
points: z.ZodArray<z.ZodObject<{
|
|
47
|
+
t: z.ZodNumber;
|
|
48
|
+
observedAt: z.ZodString;
|
|
49
|
+
evmBlockNumber: z.ZodNumber;
|
|
50
|
+
borrowAprPct: z.ZodNullable<z.ZodNumber>;
|
|
51
|
+
lendAprPct: z.ZodNullable<z.ZodNumber>;
|
|
52
|
+
lendingRateBasis: z.ZodLiteral<"simple-borrow-interest-apr">;
|
|
53
|
+
utilizationPct: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
ratePerSecondWad: z.ZodNullable<z.ZodString>;
|
|
55
|
+
fullUtilizationRate: z.ZodNullable<z.ZodString>;
|
|
56
|
+
sharePriceWad: z.ZodNullable<z.ZodString>;
|
|
57
|
+
rateObservation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
status: z.ZodLiteral<"verified">;
|
|
59
|
+
basis: z.ZodLiteral<"irm-accrual-preview">;
|
|
60
|
+
rpcBlockNumber: z.ZodNumber;
|
|
61
|
+
blockHash: z.ZodString;
|
|
62
|
+
observedAt: z.ZodString;
|
|
63
|
+
elapsedSeconds: z.ZodString;
|
|
64
|
+
canonicality: z.ZodLiteral<"rpc-checked-at-read">;
|
|
65
|
+
finality: z.ZodLiteral<"not-a-finality-verdict">;
|
|
66
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
67
|
+
status: z.ZodLiteral<"unavailable">;
|
|
68
|
+
reason: z.ZodEnum<{
|
|
69
|
+
"legacy-unpinned": "legacy-unpinned";
|
|
70
|
+
"invalid-provenance": "invalid-provenance";
|
|
71
|
+
}>;
|
|
72
|
+
}, z.core.$strict>], "status">;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
updatedAt: z.ZodNullable<z.ZodString>;
|
|
75
|
+
coverage: z.ZodObject<{
|
|
76
|
+
fromBucket: z.ZodNumber;
|
|
77
|
+
throughClosedBucket: z.ZodNumber;
|
|
78
|
+
expectedClosedBuckets: z.ZodNumber;
|
|
79
|
+
firstObservedBucket: z.ZodNullable<z.ZodNumber>;
|
|
80
|
+
leadingMissingBucketCount: z.ZodNumber;
|
|
81
|
+
presentClosedBuckets: z.ZodNumber;
|
|
82
|
+
missingBuckets: z.ZodArray<z.ZodNumber>;
|
|
83
|
+
missingRateBuckets: z.ZodArray<z.ZodNumber>;
|
|
84
|
+
verifiedRatePoints: z.ZodNumber;
|
|
85
|
+
legacyRatePoints: z.ZodNumber;
|
|
86
|
+
invalidRows: z.ZodNumber;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$strict>;
|
package/dist/engine/reads.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
2
|
import { UserFacingError } from '../errors.js';
|
|
3
3
|
import type { AegisEngineBorrowQuoteContext, AegisEngineMarket, AegisEngineMarketMark, AegisEngineMarketReadInput, AegisEngineMarketSnapshot, AegisEnginePositionsHydration, AegisEnginePositionsHydrationInput, AegisEngineVaultActivityEntry } from './types.js';
|
|
4
4
|
export declare class AegisEngineMarketNotReadyError extends UserFacingError {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
2
|
import type { AegisEngineVersion } from './types.js';
|
|
3
3
|
/** Engine hard utilization cap as a percentage of supplied liquidity.
|
|
4
4
|
* Mirrors the SDK's UTILIZATION_CAP_PIPS (950_000/1_000_000), inlined so
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const engineAdaptiveTickThresholdModeSchema: z.ZodLiteral<"post_swap_surge_trigger">;
|
|
2
3
|
export declare const enginePoolIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
3
4
|
export declare const engineMarketsRestResponseSchema: z.ZodObject<{
|
|
4
5
|
schemaVersion: z.ZodLiteral<"1">;
|
|
@@ -9,8 +10,21 @@ export declare const engineMarketsRestResponseSchema: z.ZodObject<{
|
|
|
9
10
|
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
10
11
|
blockNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
11
12
|
marketCount: z.ZodNumber;
|
|
12
|
-
}, z.core.$
|
|
13
|
+
}, z.core.$strict>;
|
|
13
14
|
}, z.core.$strip>;
|
|
15
|
+
/** Opt-in market envelope from GET /v1/engine/markets/v2. Market rows are
|
|
16
|
+
* validated by marketAdapter because static and REST rows share normalization. */
|
|
17
|
+
export declare const engineMarketsV2RestResponseSchema: z.ZodObject<{
|
|
18
|
+
schemaVersion: z.ZodLiteral<"2">;
|
|
19
|
+
chainId: z.ZodNumber;
|
|
20
|
+
markets: z.ZodArray<z.ZodUnknown>;
|
|
21
|
+
freshness: z.ZodObject<{
|
|
22
|
+
source: z.ZodLiteral<"canopy">;
|
|
23
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
24
|
+
blockNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
marketCount: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
}, z.core.$strict>;
|
|
14
28
|
export declare const engineMarketIdSchema: z.ZodString;
|
|
15
29
|
export declare const engineMetricHistoryRestResponseSchema: z.ZodObject<{
|
|
16
30
|
marketId: z.ZodString;
|
|
@@ -52,6 +66,50 @@ export declare const engineMetricHistoryRestResponseSchema: z.ZodObject<{
|
|
|
52
66
|
}, z.core.$strict>>;
|
|
53
67
|
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
54
68
|
}, z.core.$strict>;
|
|
69
|
+
export declare const engineMetricHistoryV2RestResponseSchema: z.ZodObject<{
|
|
70
|
+
schemaVersion: z.ZodLiteral<"2">;
|
|
71
|
+
marketId: z.ZodString;
|
|
72
|
+
resolution: z.ZodLiteral<"12h">;
|
|
73
|
+
window: z.ZodEnum<{
|
|
74
|
+
"7d": "7d";
|
|
75
|
+
"30d": "30d";
|
|
76
|
+
"60d": "60d";
|
|
77
|
+
}>;
|
|
78
|
+
status: z.ZodEnum<{
|
|
79
|
+
ready: "ready";
|
|
80
|
+
warming_up: "warming_up";
|
|
81
|
+
no_data: "no_data";
|
|
82
|
+
}>;
|
|
83
|
+
pointCount: z.ZodNumber;
|
|
84
|
+
points: z.ZodArray<z.ZodObject<{
|
|
85
|
+
t: z.ZodNumber;
|
|
86
|
+
observedAt: z.ZodISODateTime;
|
|
87
|
+
blockNumber: z.ZodNumber;
|
|
88
|
+
utilizationPct: z.ZodNullable<z.ZodNumber>;
|
|
89
|
+
borrowAprPct: z.ZodNullable<z.ZodNumber>;
|
|
90
|
+
lendApyPct: z.ZodNullable<z.ZodNumber>;
|
|
91
|
+
ratePerSecondWad: z.ZodNullable<z.ZodString>;
|
|
92
|
+
rateSource: z.ZodNullable<z.ZodString>;
|
|
93
|
+
fullUtilizationRate: z.ZodNullable<z.ZodString>;
|
|
94
|
+
sharePriceWad: z.ZodNullable<z.ZodString>;
|
|
95
|
+
suppliedUsd: z.ZodNullable<z.ZodNumber>;
|
|
96
|
+
borrowedUsd: z.ZodNullable<z.ZodNumber>;
|
|
97
|
+
availableToBorrowUsd: z.ZodNullable<z.ZodNumber>;
|
|
98
|
+
baseFeePpm: z.ZodNullable<z.ZodNumber>;
|
|
99
|
+
activeFeePpm: z.ZodNullable<z.ZodNumber>;
|
|
100
|
+
surgeFeePpm: z.ZodNullable<z.ZodNumber>;
|
|
101
|
+
feeSource: z.ZodNullable<z.ZodString>;
|
|
102
|
+
surgeActive: z.ZodNullable<z.ZodBoolean>;
|
|
103
|
+
inCapEvent: z.ZodNullable<z.ZodBoolean>;
|
|
104
|
+
manualOverride: z.ZodNullable<z.ZodBoolean>;
|
|
105
|
+
perSwapMode: z.ZodNullable<z.ZodBoolean>;
|
|
106
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
107
|
+
adaptiveTickThresholdTicks: z.ZodNullable<z.ZodNumber>;
|
|
108
|
+
adaptiveTickThresholdMode: z.ZodNullable<z.ZodLiteral<"post_swap_surge_trigger">>;
|
|
109
|
+
feeObservedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
112
|
+
}, z.core.$strict>;
|
|
55
113
|
export declare const enginePositionsRestResponseSchema: z.ZodObject<{
|
|
56
114
|
schemaVersion: z.ZodLiteral<"1">;
|
|
57
115
|
chainId: z.ZodNumber;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Address, Hex, PublicClient } from 'viem';
|
|
2
|
+
import type { AegisSwapChainConfig } from '../config/index.js';
|
|
3
|
+
import { type ClassifiedError } from '../errors.js';
|
|
4
|
+
import { type AegisTransactionObservation } from '../swap/receiptWait.js';
|
|
5
|
+
import { type Eip1193Provider } from '../wallet.js';
|
|
6
|
+
import type { AegisEngineApprovalInput, AegisEngineAuthorizationPlan, AegisEngineAuthorizationStepKind, AegisEngineMarket, AegisEngineToken, AegisEngineTradeDirection, AegisEngineTradeOpenQuote, AegisEngineTransactionResult } from './types.js';
|
|
7
|
+
export type AegisEngineTradeOpenIntent = Readonly<{
|
|
8
|
+
owner: Address;
|
|
9
|
+
market: AegisEngineMarket;
|
|
10
|
+
direction: AegisEngineTradeDirection;
|
|
11
|
+
token: AegisEngineToken;
|
|
12
|
+
amount: bigint;
|
|
13
|
+
leverage?: number;
|
|
14
|
+
horizonSeconds: number;
|
|
15
|
+
priceMove: number;
|
|
16
|
+
slippageBps: number;
|
|
17
|
+
maxPriceImpactBps: number;
|
|
18
|
+
approvalMode: 'exact' | 'max';
|
|
19
|
+
}>;
|
|
20
|
+
export type AegisEngineTradeExecutionStepStatus = 'planned' | 'wallet-requested' | 'submitted' | 'confirmed' | 'failed' | 'cancelled';
|
|
21
|
+
export type AegisEngineTradeExecutionStep = Readonly<{
|
|
22
|
+
kind: AegisEngineAuthorizationStepKind;
|
|
23
|
+
status: AegisEngineTradeExecutionStepStatus;
|
|
24
|
+
hash: Hex | null;
|
|
25
|
+
}>;
|
|
26
|
+
export type AegisEngineTradeExecutionFailure = ClassifiedError & Readonly<{
|
|
27
|
+
step: AegisEngineAuthorizationStepKind | null;
|
|
28
|
+
hash: Hex | null;
|
|
29
|
+
/**
|
|
30
|
+
* Last execution boundary observed before this failure.
|
|
31
|
+
*
|
|
32
|
+
* `submission` means the wallet transaction request started but returned no
|
|
33
|
+
* hash. It does not claim that signing completed or that the transaction
|
|
34
|
+
* reached the network. Optional only so existing v1 consumers that
|
|
35
|
+
* construct failure fixtures remain source-compatible; sessions created by
|
|
36
|
+
* this version always publish it.
|
|
37
|
+
*/
|
|
38
|
+
failurePhase?: 'preparation' | 'wallet-request' | 'submission' | 'confirmation';
|
|
39
|
+
}>;
|
|
40
|
+
export type AegisEngineTradeExecutionRecovery = Readonly<{
|
|
41
|
+
kind: 'retry-wallet';
|
|
42
|
+
}> | Readonly<{
|
|
43
|
+
kind: 'switch-network';
|
|
44
|
+
chainId: number;
|
|
45
|
+
}> | Readonly<{
|
|
46
|
+
kind: 'review-quote';
|
|
47
|
+
}> | Readonly<{
|
|
48
|
+
kind: 'view-transaction';
|
|
49
|
+
hash: Hex;
|
|
50
|
+
}> | Readonly<{
|
|
51
|
+
kind: 'resume-remaining';
|
|
52
|
+
}> | Readonly<{
|
|
53
|
+
kind: 'none';
|
|
54
|
+
}>;
|
|
55
|
+
export type AegisEngineAuthorizationReviewReason = Readonly<{
|
|
56
|
+
kind: 'intent-changed';
|
|
57
|
+
}> | Readonly<{
|
|
58
|
+
kind: 'wallet-chain-switch-added';
|
|
59
|
+
}> | Readonly<{
|
|
60
|
+
kind: 'permission-added' | 'permission-changed' | 'unexpected-wallet-request';
|
|
61
|
+
step: AegisEngineAuthorizationStepKind;
|
|
62
|
+
}>;
|
|
63
|
+
export type AegisEngineTradeQuoteReviewReason = Readonly<{
|
|
64
|
+
kind: 'intent-changed';
|
|
65
|
+
}> | Readonly<{
|
|
66
|
+
kind: 'position-availability-changed' | 'swap-route-changed' | 'minimum-output-lower' | 'price-impact-higher' | 'displayed-leverage-changed' | 'opening-ltv-higher' | 'interest-higher' | 'target-return-lower' | 'borrow-limit-lower' | 'liquidation-threshold-lower' | 'utilization-worse-or-missing' | 'runway-shorter' | 'adaptive-fee-evidence-unavailable' | 'adaptive-fee-mode-changed' | 'adaptive-manual-override-changed' | 'adaptive-threshold-lower' | 'adaptive-surge-entered' | 'active-fee-higher';
|
|
67
|
+
}>;
|
|
68
|
+
export type AegisEngineTradeExecutionReview = Readonly<{
|
|
69
|
+
kind: 'permissions';
|
|
70
|
+
revision: number;
|
|
71
|
+
reasons: readonly AegisEngineAuthorizationReviewReason[];
|
|
72
|
+
}> | Readonly<{
|
|
73
|
+
kind: 'quote';
|
|
74
|
+
revision: number;
|
|
75
|
+
reasons: readonly AegisEngineTradeQuoteReviewReason[];
|
|
76
|
+
}>;
|
|
77
|
+
export type AegisEngineTradeExecutionPhase = 'ready' | 'executing' | 'quote-review-required' | 'awaiting-receipt' | 'resume-required' | 'success' | 'failed' | 'cancelled';
|
|
78
|
+
export type AegisEngineTradeExecutionNext = Readonly<{
|
|
79
|
+
kind: 'continue';
|
|
80
|
+
}> | Readonly<{
|
|
81
|
+
kind: 'accept-review';
|
|
82
|
+
revision: number;
|
|
83
|
+
}> | Readonly<{
|
|
84
|
+
kind: 'check-receipt';
|
|
85
|
+
hash: Hex;
|
|
86
|
+
}> | Readonly<{
|
|
87
|
+
kind: 'cancel';
|
|
88
|
+
}> | Readonly<{
|
|
89
|
+
kind: 'none';
|
|
90
|
+
}>;
|
|
91
|
+
export type AegisEngineTradeExecutionSnapshot = Readonly<{
|
|
92
|
+
schemaVersion: '1';
|
|
93
|
+
kind: 'engine-trade-open-execution';
|
|
94
|
+
sessionId: string;
|
|
95
|
+
sequence: number;
|
|
96
|
+
occurredAt: string;
|
|
97
|
+
chainId: number;
|
|
98
|
+
quoteRevision: number;
|
|
99
|
+
phase: AegisEngineTradeExecutionPhase;
|
|
100
|
+
plan: AegisEngineAuthorizationPlan;
|
|
101
|
+
quote: AegisEngineTradeOpenQuote;
|
|
102
|
+
review: AegisEngineTradeExecutionReview | null;
|
|
103
|
+
next: AegisEngineTradeExecutionNext;
|
|
104
|
+
steps: readonly AegisEngineTradeExecutionStep[];
|
|
105
|
+
currentStep: AegisEngineTradeExecutionStep | null;
|
|
106
|
+
completedPermissions: readonly AegisEngineAuthorizationStepKind[];
|
|
107
|
+
completedTransactions: readonly Readonly<{
|
|
108
|
+
kind: AegisEngineAuthorizationStepKind;
|
|
109
|
+
hash: Hex;
|
|
110
|
+
}>[];
|
|
111
|
+
transactionHash: Hex | null;
|
|
112
|
+
receiptSummary?: AegisEngineTransactionResult['summary'];
|
|
113
|
+
quoteReviewRequired: boolean;
|
|
114
|
+
failure: AegisEngineTradeExecutionFailure | null;
|
|
115
|
+
recovery: AegisEngineTradeExecutionRecovery;
|
|
116
|
+
}>;
|
|
117
|
+
export type AegisEngineTradeExecutionCommand = Readonly<{
|
|
118
|
+
kind: 'continue';
|
|
119
|
+
}> | Readonly<{
|
|
120
|
+
kind: 'accept-review';
|
|
121
|
+
revision: number;
|
|
122
|
+
}> | Readonly<{
|
|
123
|
+
kind: 'check-receipt';
|
|
124
|
+
}> | Readonly<{
|
|
125
|
+
kind: 'cancel';
|
|
126
|
+
}>;
|
|
127
|
+
export type AegisEngineTradeOpenExecutionSession = Readonly<{
|
|
128
|
+
getSnapshot: () => AegisEngineTradeExecutionSnapshot;
|
|
129
|
+
subscribe: (listener: () => void) => () => void;
|
|
130
|
+
dispatch: (command: AegisEngineTradeExecutionCommand, options?: Readonly<{
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}>) => Promise<AegisEngineTradeExecutionSnapshot>;
|
|
133
|
+
}>;
|
|
134
|
+
export type AegisEngineTradeOpenExecutionSessionOptions = Readonly<{
|
|
135
|
+
wallet: Readonly<{
|
|
136
|
+
provider: Eip1193Provider;
|
|
137
|
+
account: Address;
|
|
138
|
+
}>;
|
|
139
|
+
publicClient: PublicClient;
|
|
140
|
+
activeChain: AegisSwapChainConfig;
|
|
141
|
+
intent: AegisEngineTradeOpenIntent;
|
|
142
|
+
reviewed: Readonly<{
|
|
143
|
+
plan: AegisEngineAuthorizationPlan;
|
|
144
|
+
quote: AegisEngineTradeOpenQuote;
|
|
145
|
+
}>;
|
|
146
|
+
onTransactionObservation?: (event: AegisTransactionObservation, stage: 'authorization' | 'action') => void;
|
|
147
|
+
onAuthorizationExecution?: AegisEngineApprovalInput['onAuthorizationExecution'];
|
|
148
|
+
sessionId?: string;
|
|
149
|
+
onChange?: (snapshot: AegisEngineTradeExecutionSnapshot) => void;
|
|
150
|
+
}>;
|
|
151
|
+
/** Pure review policy for newly introduced or materially changed wallet authority. */
|
|
152
|
+
export declare function engineAuthorizationPlanReviewReasons(reviewed: AegisEngineAuthorizationPlan, fresh: AegisEngineAuthorizationPlan): readonly AegisEngineAuthorizationReviewReason[];
|
|
153
|
+
/** Pure zero-tolerance policy for weaker or materially different quote facts. */
|
|
154
|
+
export declare function engineTradeQuoteReviewReasons(reviewed: AegisEngineTradeOpenQuote, fresh: AegisEngineTradeOpenQuote): readonly AegisEngineTradeQuoteReviewReason[];
|
|
155
|
+
export declare function createEngineTradeOpenExecutionSession(options: AegisEngineTradeOpenExecutionSessionOptions): AegisEngineTradeOpenExecutionSession;
|