@aegis-engine/core 0.1.2 → 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 +2371 -1784
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AegisBackendConfig, AegisBackendMarket, AegisBackendToken } from './contract/backendClient.js';
|
|
2
|
+
import { type AegisSwapChainConfig, type AegisSwapChainConfigInput, type AegisSwapPoolConfig, type AegisSwapToken } from './config/index.js';
|
|
3
|
+
export type AegisBackendChainOptions = {
|
|
4
|
+
rpcUrls?: readonly string[] | Partial<Record<number, readonly string[]>>;
|
|
5
|
+
metadataEndpoint?: string | null;
|
|
6
|
+
/** Backend chain ids the host project exposes. Omit to use every backend chain. */
|
|
7
|
+
enabledChainIds?: readonly number[];
|
|
8
|
+
};
|
|
9
|
+
export declare function backendTokenToAegisSwapToken(token: AegisBackendToken): AegisSwapToken;
|
|
10
|
+
export declare function backendTokensToAegisSwapTokens(tokens: readonly AegisBackendToken[]): AegisSwapToken[];
|
|
11
|
+
export declare function createAegisSwapChainsFromBackendConfig(config: AegisBackendConfig, hostChains?: Partial<Record<number, AegisSwapChainConfigInput>>, options?: AegisBackendChainOptions): Record<number, AegisSwapChainConfig>;
|
|
12
|
+
export declare function createAegisSwapPoolsFromBackendMarkets({ config, markets, tokens, enabledOnly }: {
|
|
13
|
+
config: AegisBackendConfig;
|
|
14
|
+
markets: readonly AegisBackendMarket[];
|
|
15
|
+
tokens: readonly AegisBackendToken[];
|
|
16
|
+
enabledOnly?: boolean;
|
|
17
|
+
}): AegisSwapPoolConfig[];
|
package/dist/config/chains.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Hex } from 'viem';
|
|
2
|
-
import type { AegisSwapChainConfig, AegisSwapChainConfigInput } from './types';
|
|
2
|
+
import type { AegisSwapChainConfig, AegisSwapChainConfigInput } from './types.js';
|
|
3
3
|
export declare function getExplorerUrl(hash: Hex, chain: AegisSwapChainConfig): string;
|
|
4
4
|
export declare const AEGIS_SWAP_MAINNET_CHAIN: AegisSwapChainConfig;
|
|
5
5
|
export declare const AEGIS_SWAP_CHAINS: Record<number, AegisSwapChainConfig>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput } from './types';
|
|
1
|
+
import type { AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput } from './types.js';
|
|
2
2
|
export declare function createAegisSwapUniswapV4Contracts(input: AegisSwapUniswapV4ContractsInput): AegisSwapUniswapV4Contracts;
|
|
3
3
|
export declare const UNISWAP_V4_CONTRACTS_BY_CHAIN: Record<number, AegisSwapUniswapV4Contracts>;
|
|
4
4
|
export declare const AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS: AegisSwapUniswapV4Contracts;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './constants';
|
|
3
|
-
export * from './contracts';
|
|
4
|
-
export * from './chains';
|
|
5
|
-
export * from './tokens';
|
|
6
|
-
export * from './markets';
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './contracts.js';
|
|
4
|
+
export * from './chains.js';
|
|
5
|
+
export * from './tokens.js';
|
|
6
|
+
export * from './markets.js';
|
package/dist/config/markets.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapPoolConfig } from './types';
|
|
1
|
+
import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapPoolConfig } from './types.js';
|
|
2
2
|
export declare function createAegisSwapPoolMarket(input: AegisSwapPoolConfig, chains?: Record<number, AegisSwapChainConfig>): AegisSwapMarket;
|
|
3
3
|
export declare function createAegisSwapMarketsFromPools(pools: AegisSwapPoolConfig[] | undefined, chains?: Record<number, AegisSwapChainConfig>): Record<string, AegisSwapMarket>;
|
package/dist/config/tokens.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AegisSwapBuiltInTokenSymbol, AegisSwapToken, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapWolfGameTokenSymbol } from './types';
|
|
1
|
+
import type { AegisSwapBuiltInTokenSymbol, AegisSwapToken, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapWolfGameTokenSymbol } from './types.js';
|
|
2
2
|
export declare const AEGIS_SWAP_TOKENS: Record<AegisSwapBuiltInTokenSymbol, AegisSwapToken>;
|
|
3
3
|
export declare const AGGREGATED_SWAP_DEFAULT_TOKENS: Record<AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken>;
|
|
4
4
|
export declare const AGGREGATED_SWAP_WOLFGAME_TOKENS: Record<AggregatedSwapWolfGameTokenSymbol, AggregatedSwapToken>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { Address, Hex } from 'viem';
|
|
3
|
+
import type { AegisPoolKey } from '../config/index.js';
|
|
4
|
+
import { aegisBackendSwapQuoteRequestSchema } from './schemas.js';
|
|
5
|
+
import type { components, paths } from './generated/aegis-swap.js';
|
|
6
|
+
export type AegisBackendOpenApiPaths = paths;
|
|
7
|
+
export type AegisBackendOpenApiComponents = components;
|
|
8
|
+
type AegisBackendWireConfig = components['schemas']['SwapConfig'];
|
|
9
|
+
type AegisBackendWireToken = components['schemas']['Token'];
|
|
10
|
+
type AegisBackendWireMarket = components['schemas']['Market'];
|
|
11
|
+
type AegisBackendWireSwapQuoteRequest = components['schemas']['SwapQuoteRequest'];
|
|
12
|
+
type AegisBackendWireSwapQuoteResponse = components['schemas']['SwapQuoteResponse'];
|
|
13
|
+
export type AegisBackendSwapProvider = AegisBackendWireConfig['providers'][number];
|
|
14
|
+
export type AegisBackendQuoteMode = AegisBackendWireSwapQuoteRequest['mode'];
|
|
15
|
+
export type AegisBackendMarketStatus = AegisBackendWireMarket['status'];
|
|
16
|
+
export declare const AEGIS_BACKEND_PROD_BASE_URL = "https://nlkvpvkx9h.execute-api.us-east-1.amazonaws.com/prod";
|
|
17
|
+
export type AegisBackendChain = AegisBackendWireConfig['chains'][number];
|
|
18
|
+
export type AegisBackendQuoteDefaults = AegisBackendWireConfig['quote'];
|
|
19
|
+
export type AegisBackendContractRegistry = {
|
|
20
|
+
aegisRouter?: Address;
|
|
21
|
+
permit2?: Address;
|
|
22
|
+
v4Quoter?: Address;
|
|
23
|
+
v4PoolManager?: Address;
|
|
24
|
+
[contractName: string]: Address | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type AegisBackendAddressAllowlist = {
|
|
27
|
+
routers: Address[];
|
|
28
|
+
spenders: Address[];
|
|
29
|
+
};
|
|
30
|
+
export type AegisBackendContractsByChain = {
|
|
31
|
+
[ChainId in keyof AegisBackendWireConfig['contracts']]: AegisBackendContractRegistry;
|
|
32
|
+
};
|
|
33
|
+
export type AegisBackendAllowlistsByChain = {
|
|
34
|
+
[ChainId in keyof AegisBackendWireConfig['allowlists']]: AegisBackendAddressAllowlist;
|
|
35
|
+
};
|
|
36
|
+
export type AegisBackendFeeConfig = Omit<AegisBackendWireConfig['fee'], 'recipient'> & {
|
|
37
|
+
recipient: Address;
|
|
38
|
+
};
|
|
39
|
+
export type AegisBackendConfig = Omit<AegisBackendWireConfig, 'contracts' | 'allowlists' | 'fee'> & {
|
|
40
|
+
contracts: AegisBackendContractsByChain;
|
|
41
|
+
allowlists: AegisBackendAllowlistsByChain;
|
|
42
|
+
fee: AegisBackendFeeConfig;
|
|
43
|
+
};
|
|
44
|
+
export type AegisBackendToken = Omit<AegisBackendWireToken, 'address'> & {
|
|
45
|
+
address: Address;
|
|
46
|
+
};
|
|
47
|
+
export type AegisBackendMarketMetrics = AegisBackendWireMarket['metrics'];
|
|
48
|
+
export type AegisBackendMarket = Omit<AegisBackendWireMarket, 'baseToken' | 'quoteToken' | 'poolId' | 'poolKey'> & {
|
|
49
|
+
baseToken: Address;
|
|
50
|
+
quoteToken: Address;
|
|
51
|
+
poolId: Hex;
|
|
52
|
+
poolKey: AegisPoolKey;
|
|
53
|
+
};
|
|
54
|
+
export type AegisBackendSwapQuoteRequest = z.infer<typeof aegisBackendSwapQuoteRequestSchema>;
|
|
55
|
+
export type AegisBackendSwapQuoteResponse = Omit<AegisBackendWireSwapQuoteResponse, 'tokenIn' | 'tokenOut' | 'fee'> & {
|
|
56
|
+
tokenIn: Address;
|
|
57
|
+
tokenOut: Address;
|
|
58
|
+
fee: AegisBackendFeeConfig;
|
|
59
|
+
};
|
|
60
|
+
export type AegisBackendApiClientOptions = {
|
|
61
|
+
baseUrl: string;
|
|
62
|
+
fetch?: typeof fetch;
|
|
63
|
+
headers?: Record<string, string>;
|
|
64
|
+
validate?: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type AegisBackendRequestOptions = {
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
headers?: Record<string, string>;
|
|
69
|
+
timeoutMs?: number;
|
|
70
|
+
};
|
|
71
|
+
export declare class AegisBackendApiError extends Error {
|
|
72
|
+
readonly status: number;
|
|
73
|
+
readonly statusText: string;
|
|
74
|
+
readonly body: unknown;
|
|
75
|
+
constructor({ status, statusText, body }: {
|
|
76
|
+
status: number;
|
|
77
|
+
statusText: string;
|
|
78
|
+
body: unknown;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export declare class AegisBackendContractError extends Error {
|
|
82
|
+
readonly endpoint: string;
|
|
83
|
+
readonly issues: z.core.$ZodIssue[];
|
|
84
|
+
constructor({ endpoint, issues }: {
|
|
85
|
+
endpoint: string;
|
|
86
|
+
issues: z.core.$ZodIssue[];
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export declare function isRetryableAegisBackendApiError(error: unknown): boolean;
|
|
90
|
+
export type AegisBackendApiClient = {
|
|
91
|
+
health: (options?: AegisBackendRequestOptions) => Promise<{
|
|
92
|
+
ok: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
config: (options?: AegisBackendRequestOptions) => Promise<AegisBackendConfig>;
|
|
95
|
+
tokens: (args: {
|
|
96
|
+
chainId: number;
|
|
97
|
+
}, options?: AegisBackendRequestOptions) => Promise<AegisBackendToken[]>;
|
|
98
|
+
tokensByAddress: (args: {
|
|
99
|
+
chainId: number;
|
|
100
|
+
addresses: Address[];
|
|
101
|
+
}, options?: AegisBackendRequestOptions) => Promise<AegisBackendToken[]>;
|
|
102
|
+
markets: (args: {
|
|
103
|
+
chainId: number;
|
|
104
|
+
}, options?: AegisBackendRequestOptions) => Promise<AegisBackendMarket[]>;
|
|
105
|
+
quote: (args: AegisBackendSwapQuoteRequest, options?: AegisBackendRequestOptions) => Promise<AegisBackendSwapQuoteResponse>;
|
|
106
|
+
};
|
|
107
|
+
export declare function createAegisBackendApiClient(options: AegisBackendApiClientOptions): AegisBackendApiClient;
|
|
108
|
+
export {};
|