@aegis-engine/core 0.1.3 → 0.2.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 +15 -29
- package/dist/actions/directPoolSwap.d.ts +4 -4
- package/dist/actions/kyberSwap.d.ts +4 -4
- package/dist/actions/types.d.ts +4 -4
- package/dist/actions/wallet.d.ts +3 -3
- package/dist/aegis-core.js +2363 -1787
- package/dist/backendAdapters.d.ts +17 -0
- package/dist/config/chains.d.ts +1 -1
- package/dist/config/contracts.d.ts +1 -1
- package/dist/config/index.d.ts +6 -6
- package/dist/config/markets.d.ts +1 -1
- package/dist/config/tokens.d.ts +1 -1
- package/dist/contract/backendClient.d.ts +108 -0
- package/dist/contract/generated/aegis-swap.d.ts +720 -0
- package/dist/contract/index.d.ts +3 -2
- package/dist/contract/schemas.d.ts +101 -140
- package/dist/encoding.d.ts +1 -1
- package/dist/index.d.ts +34 -32
- package/dist/metadata.d.ts +1 -1
- package/dist/permit.d.ts +2 -2
- package/dist/quote/aggregatedSwapQuote.d.ts +2 -2
- package/dist/quote.d.ts +2 -2
- package/dist/swap/authorizePermit.d.ts +5 -5
- package/dist/swap/executeSwapTransaction.d.ts +5 -5
- package/dist/swap/sendSwapTransaction.d.ts +2 -2
- package/dist/swap/types.d.ts +2 -2
- package/dist/types/aggregatedSwap.d.ts +1 -1
- package/package.json +6 -2
- package/dist/backendApi.d.ts +0 -201
package/README.md
CHANGED
|
@@ -102,15 +102,18 @@ simple integrations and demos.
|
|
|
102
102
|
## Backend V1 API
|
|
103
103
|
|
|
104
104
|
The V1 backend/indexer contract is exposed as typed REST helpers. This is the
|
|
105
|
-
public boundary for widget/core integrations
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
public boundary for widget/core integrations: backend-owned config, token
|
|
106
|
+
metadata, market discovery, allowlists, and fee policy come from REST. Swap
|
|
107
|
+
execution remains client-side.
|
|
108
108
|
|
|
109
109
|
```ts
|
|
110
|
-
import {
|
|
110
|
+
import {
|
|
111
|
+
AEGIS_BACKEND_PROD_BASE_URL,
|
|
112
|
+
createAegisBackendApiClient
|
|
113
|
+
} from '@aegis-engine/core'
|
|
111
114
|
|
|
112
115
|
const aegisApi = createAegisBackendApiClient({
|
|
113
|
-
baseUrl:
|
|
116
|
+
baseUrl: AEGIS_BACKEND_PROD_BASE_URL
|
|
114
117
|
})
|
|
115
118
|
|
|
116
119
|
const config = await aegisApi.config()
|
|
@@ -125,14 +128,7 @@ const quote = await aegisApi.quote({
|
|
|
125
128
|
tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
126
129
|
tokenOut: '0x828B22c9ea1c20B551EeFC6198174C4bb7a8CBF6',
|
|
127
130
|
amountIn: '1000000',
|
|
128
|
-
slippageBps: config.quote.defaultSlippageBps
|
|
129
|
-
account
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
const build = await aegisApi.build({
|
|
133
|
-
quoteId: quote.quoteId,
|
|
134
|
-
account,
|
|
135
|
-
recipient: account
|
|
131
|
+
slippageBps: config.quote.defaultSlippageBps
|
|
136
132
|
})
|
|
137
133
|
```
|
|
138
134
|
|
|
@@ -144,22 +140,12 @@ The backend endpoints are:
|
|
|
144
140
|
- `GET /v1/tokens/by-address?chainId=1&addresses=0x...,0x...`
|
|
145
141
|
- `GET /v1/markets?chainId=1`
|
|
146
142
|
- `POST /v1/swap/quote`
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
route data, router addresses, and spender addresses are not accepted in the
|
|
154
|
-
build request. The backend must reject expired or tampered quotes, validate the
|
|
155
|
-
chain/router/spender/pool allowlists, and simulate the unsigned transaction
|
|
156
|
-
before returning wallet-ready `tx` data.
|
|
157
|
-
|
|
158
|
-
Core still includes direct-pool and Kyber client-side helpers for the current
|
|
159
|
-
widget flow. Those helpers are transitional for swap execution: once the backend
|
|
160
|
-
service is available, production widget paths should fetch config, tokens,
|
|
161
|
-
markets, quotes, builds, and transaction status through this REST client while
|
|
162
|
-
wallet signing and transaction sending remain client-side.
|
|
143
|
+
|
|
144
|
+
`quote` is indicative only. It returns normalized pricing, output fee policy,
|
|
145
|
+
`asOf`, and warnings for fast first paint; it does not return executable route
|
|
146
|
+
truth, calldata, or a transaction status handle. The widget/core must still
|
|
147
|
+
re-quote, build, simulate, sign, and send client-side through the wallet/RPC
|
|
148
|
+
execution helpers and validate execution against `/v1/config` allowlists.
|
|
163
149
|
|
|
164
150
|
## Direct Pool Market Config
|
|
165
151
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapToken } from '../config';
|
|
3
|
-
import { type DirectSwapQuote, type SwapQuoteMode } from '../quote';
|
|
4
|
-
import type { AegisSwapApprovalMode, WalletSession } from '../swap/types';
|
|
5
|
-
import type { AegisSwapActionCallbacks, AegisSwapActionResult } from './types';
|
|
2
|
+
import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapToken } from '../config/index.js';
|
|
3
|
+
import { type DirectSwapQuote, type SwapQuoteMode } from '../quote.js';
|
|
4
|
+
import type { AegisSwapApprovalMode, WalletSession } from '../swap/types.js';
|
|
5
|
+
import type { AegisSwapActionCallbacks, AegisSwapActionResult } from './types.js';
|
|
6
6
|
export declare class DirectPoolSwapPriceMovedError extends Error {
|
|
7
7
|
readonly quote: DirectSwapQuote;
|
|
8
8
|
constructor(quote: DirectSwapQuote);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type { AegisSwapChainConfig, AegisSwapToken } from '../config';
|
|
3
|
-
import type { AegisSwapApprovalMode, WalletSession } from '../swap/types';
|
|
4
|
-
import type { AggregatedSwapQuote } from '../types/aggregatedSwap';
|
|
5
|
-
import type { AegisSwapActionCallbacks, AegisSwapActionResult } from './types';
|
|
2
|
+
import type { AegisSwapChainConfig, AegisSwapToken } from '../config/index.js';
|
|
3
|
+
import type { AegisSwapApprovalMode, WalletSession } from '../swap/types.js';
|
|
4
|
+
import type { AggregatedSwapQuote } from '../types/aggregatedSwap.js';
|
|
5
|
+
import type { AegisSwapActionCallbacks, AegisSwapActionResult } from './types.js';
|
|
6
6
|
export declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
7
7
|
export declare function isNativeToken(token: AegisSwapToken): boolean;
|
|
8
8
|
export declare class KyberSwapPriceMovedError extends Error {
|
package/dist/actions/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Hex } from 'viem';
|
|
2
|
-
import type { DirectSwapQuote } from '../quote';
|
|
3
|
-
import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress';
|
|
4
|
-
import type { AggregatedSwapQuote } from '../types/aggregatedSwap';
|
|
5
|
-
import type { AegisSwapSubmitDetails } from '../swap/types';
|
|
2
|
+
import type { DirectSwapQuote } from '../quote.js';
|
|
3
|
+
import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress.js';
|
|
4
|
+
import type { AggregatedSwapQuote } from '../types/aggregatedSwap.js';
|
|
5
|
+
import type { AegisSwapSubmitDetails } from '../swap/types.js';
|
|
6
6
|
export type AegisSwapActionCallbacks<TSwapDetails = AegisSwapSubmitDetails> = {
|
|
7
7
|
onStatus?: (status: SubmitStatus) => void;
|
|
8
8
|
onTxHash?: (hash: Hex | null) => void;
|
package/dist/actions/wallet.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
|
-
import type { AegisSwapChainConfig } from '../config';
|
|
3
|
-
import type { WalletSession } from '../swap/types';
|
|
4
|
-
import { type AegisSwapProviderResolver, type AegisSwapWalletConnection, type Eip1193Provider } from '../wallet';
|
|
2
|
+
import type { AegisSwapChainConfig } from '../config/index.js';
|
|
3
|
+
import type { WalletSession } from '../swap/types.js';
|
|
4
|
+
import { type AegisSwapProviderResolver, type AegisSwapWalletConnection, type Eip1193Provider } from '../wallet.js';
|
|
5
5
|
export declare function waitForProviderChain(provider: Eip1193Provider, targetChainId: number, attempts?: number, delayMs?: number): Promise<boolean>;
|
|
6
6
|
export declare function ensureWalletChain(args: {
|
|
7
7
|
provider: Eip1193Provider;
|