@aegis-engine/core 0.7.0 → 0.8.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 +215 -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 +8 -1
- package/dist/actions/kyberSwap.d.ts +1 -0
- package/dist/actions/types.d.ts +2 -0
- package/dist/actions/wallet.d.ts +1 -0
- package/dist/aegis-core.js +9657 -205
- 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 +8 -3
- package/dist/engine/adaptiveFee.d.ts +14 -0
- package/dist/engine/balancedLending.d.ts +82 -0
- package/dist/engine/dataSource.d.ts +2 -0
- package/dist/engine/index.d.ts +19 -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 +132 -14
- package/dist/engine/v4Quote.d.ts +5 -0
- package/dist/index.d.ts +11 -7
- package/dist/internal/guardedWalletTransaction.d.ts +31 -0
- package/dist/permit.d.ts +80 -7
- package/dist/quote/aggregatedSwapQuote.d.ts +5 -1
- package/dist/quote/kyberCalldata.d.ts +5 -1
- package/dist/{sdkRuntime-BE3ZMb5o.js → sdkRuntime-BLOOWtPv.js} +3644 -3155
- 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/trustedMarket.d.ts +25 -0
- package/dist/transactionHistory-1Zl2KCcV.js +5915 -0
- package/dist/wallet.d.ts +4 -0
- package/package.json +12 -5
- package/dist/index-DofKgro2.js +0 -11201
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
export { AEGIS_DYNAMIC_FEE_FLAG, AEGIS_SWAP_CHAINS, AEGIS_SWAP_CHAIN_ID, AEGIS_SWAP_DEFAULT_FEE_BPS, AEGIS_SWAP_DEFAULT_FEE_RECIPIENT, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_HOOK, AEGIS_SWAP_MAINNET_CHAIN, AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS, AEGIS_SWAP_PERMIT2, AEGIS_SWAP_ROUTER, AEGIS_SWAP_TOKENS, AEGIS_SWAP_TRUSTED_ROUTERS_BY_CHAIN, AEGIS_SWAP_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST, AGGREGATED_SWAP_WOLFGAME_TOKENS, UNISWAP_V4_CONTRACTS_BY_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, createAegisSwapMarketsFromPools, createAegisSwapPoolMarket, createAegisSwapUniswapV4Contracts, getExplorerUrl } from './config/index.js';
|
|
2
|
-
export type { AegisPoolKey, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from './config/index.js';
|
|
1
|
+
export { AEGIS_DYNAMIC_FEE_FLAG, AEGIS_SWAP_BSC_CHAIN, AEGIS_SWAP_BSC_CHAIN_ID, AEGIS_SWAP_BSC_HOOK, AEGIS_SWAP_BSC_ROUTER, AEGIS_SWAP_BSC_RPC_URLS, AEGIS_SWAP_BSC_TOKENS, AEGIS_SWAP_CHAINS, AEGIS_SWAP_CHAIN_ID, AEGIS_SWAP_DEFAULT_FEE_BPS, AEGIS_SWAP_DEFAULT_FEE_RECIPIENT, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_HOOK, AEGIS_SWAP_MAINNET_CHAIN, AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS, AEGIS_SWAP_PERMIT2, AEGIS_SWAP_ROUTER, AEGIS_SWAP_TOKENS, AEGIS_SWAP_TRUSTED_ROUTERS_BY_CHAIN, AEGIS_SWAP_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST, AGGREGATED_SWAP_WOLFGAME_TOKENS, UNISWAP_V4_CONTRACTS_BY_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, createAegisSwapMarketsFromPools, createAegisSwapPoolMarket, createAegisSwapUniswapV4Contracts, getExplorerUrl } from './config/index.js';
|
|
2
|
+
export type { AegisPoolKey, AegisSwapBscTokenSymbol, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from './config/index.js';
|
|
3
3
|
export { assertUint128, buildExactInSwapTransaction, buildExactOutSwapTransaction, computePoolId, MAX_UINT128 } from './encoding.js';
|
|
4
4
|
export type { BuiltSwapTransaction, ExecutionBatch, PermitBatch, PermitDetails, SignedPermitBatch, SwapOutputFee } from './encoding.js';
|
|
5
5
|
export { getZeroForOne, outputFeeForQuote, quoteSpendAmount, reconcileSubmitQuote, sameQuote } from './quote.js';
|
|
6
6
|
export type { DirectSwapQuote, ReconciledSubmitQuote, SwapQuoteMode } from './quote.js';
|
|
7
7
|
export { AggregatedSwapBuildMismatchError, aggregatedSwapErrorMessage, fetchAggregatedSwapQuote } from './quote/aggregatedSwapQuote.js';
|
|
8
|
+
export type { AggregatedSwapExecutionIntent } from './quote/aggregatedSwapQuote.js';
|
|
8
9
|
export { AggregatedSwapCalldataError } from './quote/kyberCalldata.js';
|
|
9
10
|
export type { AggregatedSwapQuote, AggregatedSwapRoute, HopInfo } from './types/aggregatedSwap.js';
|
|
10
|
-
export { KyberSwapApiError, KyberSwapContractError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
|
|
11
|
+
export { KyberSwapApiError, KyberSwapContractError, KyberSwapResourceLimitError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
|
|
11
12
|
export type { KyberSwapBuild, KyberSwapError, KyberSwapFeeParams, KyberSwapRoute, KyberSwapRouteLeg, KyberSwapRouteSummary } from './services/kyberSwap.js';
|
|
12
|
-
export { approveErc20Spender, approveErc20ToPermit2, approvePermit2ToRouter, buildSignedPermitBatch, DEFAULT_PERMIT_EXPIRATION_SECONDS, MAX_UINT160, MAX_UINT256, PERMIT2_FAR_FUTURE_EXPIRATION, readErc20Allowance, readPermit2RouterAllowance, SWAP_TX_DEADLINE_SECONDS } from './permit.js';
|
|
13
|
+
export { approveErc20Spender, approveErc20ToPermit2, approvePermit2ToRouter, buildSignedPermitBatch, DEFAULT_PERMIT_EXPIRATION_SECONDS, hasUsablePermit2Allowance, isUnlimitedErc20Approval, isUnlimitedPermit2Approval, MAX_UINT160, MAX_UINT256, PERMIT2_FAR_FUTURE_EXPIRATION, readErc20Allowance, readPermit2RouterAllowance, SWAP_TX_DEADLINE_SECONDS, UNLIMITED_ERC20_FLOOR, UNLIMITED_PERMIT2_FLOOR } from './permit.js';
|
|
13
14
|
export { fetchGlobalTokenMetadata, resolveTokenIconUrl } from './metadata.js';
|
|
14
15
|
export type { AegisSwapGlobalTokenMetadata, TokenMetadataByAddress } from './metadata.js';
|
|
15
|
-
export { clearTokenPriceHistoryCache, fetchTokenPriceHistory, peekTokenPriceHistory } from './historicalPrices.js';
|
|
16
|
+
export { clearTokenPriceHistoryCache, fetchTokenPriceHistory, peekTokenPriceHistory, tokenPriceHistoryRestResponseSchema } from './historicalPrices.js';
|
|
16
17
|
export type { AegisTokenPriceHistory, AegisTokenPriceHistoryStatus, AegisTokenPriceHistoryWindow, AegisTokenPricePoint } from './historicalPrices.js';
|
|
17
|
-
export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, subscribeProvider, switchProviderChain } from './wallet.js';
|
|
18
|
+
export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, SDK_RPC_MULTICALL_RULE_ID, subscribeProvider, switchProviderChain } from './wallet.js';
|
|
18
19
|
export type { AegisSwapProviderResolver, AegisSwapWalletConnection, Eip1193Provider, ProviderChainConfig } from './wallet.js';
|
|
19
20
|
export { approveDirectPoolSwapInput, DirectPoolSwapPriceMovedError, executeDirectPoolSwap, fetchDirectPoolSwapQuote } from './actions/directPoolSwap.js';
|
|
20
21
|
export type { DirectPoolSwapApprovalResult } from './actions/directPoolSwap.js';
|
|
21
22
|
export { isNativeAssetAddress } from './address.js';
|
|
22
23
|
export { approveKyberSwapInput, executeKyberSwap, isNativeToken, KyberSwapPriceMovedError, NATIVE_TOKEN_ADDRESS } from './actions/kyberSwap.js';
|
|
23
24
|
export type { KyberSwapApprovalResult } from './actions/kyberSwap.js';
|
|
25
|
+
export { erc20ApprovalRequest, requiresErc20ApprovalReset } from './actions/allowance.js';
|
|
24
26
|
export { ensureWalletChain, resolveWalletSession, waitForProviderChain } from './actions/wallet.js';
|
|
25
27
|
export type { AegisSwapActionCallbacks, AegisSwapActionResult, AegisSwapApprovalProgress, AegisSwapApprovalRequest, AegisSwapAuthorizationProgress } from './actions/types.js';
|
|
26
28
|
export { estimateSwapGasWithBuffer } from './swap/gas.js';
|
|
27
29
|
export type { SwapGasRequest } from './swap/gas.js';
|
|
30
|
+
export { assertDirectSwapMarketTrusted, authorizeHostDirectSwapMarket, DIRECT_SWAP_MARKET_TRUST_RULE_ID, DirectSwapMarketTrustError, isDirectSwapMarketTrusted } from './swap/trustedMarket.js';
|
|
28
31
|
export type { AegisSwapApprovalMode, AegisSwapSubmitDetails, WalletSession } from './swap/types.js';
|
|
29
32
|
export { classifyError, errorMessage, isSubmittedTransactionReceiptError, isUserRejectedError, SubmittedTransactionReceiptError, TransactionReceiptTimeoutError, USER_REJECTED_MESSAGE, UserFacingError } from './errors.js';
|
|
30
33
|
export type { ClassifiedError, UserFacingErrorKind } from './errors.js';
|
|
31
34
|
export { isBusy, progressRailSteps, transactionProgressView, transactionSequenceProgress } from './transactionProgress.js';
|
|
32
35
|
export type { AegisSwapReceiptSummary, AegisSwapStatusSnapshot, AegisSwapStatusTransactionContext, AegisSwapStatusTransactionToken, AegisSwapWalletPromptProgress, SubmitStatus, TransactionProgressState, TransactionProgressView } from './transactionProgress.js';
|
|
33
36
|
export { reconcileSubmittedReceipt } from './swap/receiptWait.js';
|
|
34
|
-
export type { SubmittedReceiptOutcome } from './swap/receiptWait.js';
|
|
37
|
+
export type { SubmittedReceiptOutcome, AegisTransactionObservation } from './swap/receiptWait.js';
|
|
35
38
|
export { summarizeTransactionReceipt } from './swap/sendSwapTransaction.js';
|
|
36
39
|
export { isDocumentVisible, pollUntil, retryOnError } from './polling.js';
|
|
37
40
|
export { AEGIS_BACKEND_PROD_BASE_URL, AegisBackendApiError, AegisBackendContractError, createAegisBackendApiClient, isRetryableAegisBackendApiError, normalizeAegisBackendBaseUrl } from './contract/backendClient.js';
|
|
@@ -42,3 +45,4 @@ export { aegisBackendAddressAllowlistSchema, aegisBackendAddressSchema, aegisBac
|
|
|
42
45
|
export type { AegisContractGuardCode } from './contract/index.js';
|
|
43
46
|
export { engineMarketsRestResponseSchema } from './engine/restSchemas.js';
|
|
44
47
|
export * from './engine/index.js';
|
|
48
|
+
export { PortfolioQuerySchema, PortfolioPageQuerySchema, PortfolioResponseSchema, PortfolioPageSchema } from './engine/account/portfolioSchemas.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Chain, Hex, PublicClient, TransactionReceipt } from 'viem';
|
|
2
|
+
import { type Eip1193Provider } from '../wallet.js';
|
|
3
|
+
import { type AegisTransactionObservation } from '../swap/receiptWait.js';
|
|
4
|
+
/**
|
|
5
|
+
* Sends one already-prepared wallet transaction through the safety boundary
|
|
6
|
+
* shared by swaps and authorization writes.
|
|
7
|
+
*
|
|
8
|
+
* Preparation and simulation stay with the caller. This helper owns the
|
|
9
|
+
* invariants that begin immediately before the wallet prompt: verify the
|
|
10
|
+
* active chain, honor cancellation until a hash exists, publish submitted and
|
|
11
|
+
* replacement hashes without trusting host callbacks, and reconcile the
|
|
12
|
+
* receipt. Once submitted, caller cancellation cannot hide the mined result.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runGuardedWalletTransaction(args: {
|
|
15
|
+
provider: Eip1193Provider;
|
|
16
|
+
publicClient: PublicClient;
|
|
17
|
+
chain: Chain;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
timeoutMs: number;
|
|
20
|
+
submit: () => Promise<Hex>;
|
|
21
|
+
unreadableChainMessage: string;
|
|
22
|
+
cancelledMessage: string;
|
|
23
|
+
revertedMessage: string;
|
|
24
|
+
onWalletRequest?: () => void;
|
|
25
|
+
onHash?: (hash: Hex, replacement?: {
|
|
26
|
+
replacesHash: Hex;
|
|
27
|
+
executionChanged: boolean;
|
|
28
|
+
}) => void;
|
|
29
|
+
onTransactionObservation?: (event: AegisTransactionObservation) => void;
|
|
30
|
+
onSubmitted?: (hash: Hex) => void;
|
|
31
|
+
}): Promise<TransactionReceipt>;
|
package/dist/permit.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type
|
|
2
|
+
import { type Eip1193Provider } from './wallet.js';
|
|
3
3
|
import type { SignedPermitBatch } from './encoding.js';
|
|
4
4
|
export declare const MAX_UINT160: bigint;
|
|
5
5
|
export declare const MAX_UINT256: bigint;
|
|
6
|
+
/** "No limit" only counts once the standing grant still reads as effectively
|
|
7
|
+
* unlimited. Half the type maximum tolerates tokens and Permit2 flows that
|
|
8
|
+
* decrement a max grant on spend — an equality test against the maximum would
|
|
9
|
+
* re-approve before every swap — while an exact-sized allowance, however large
|
|
10
|
+
* against today's amount, never qualifies. */
|
|
11
|
+
export declare const UNLIMITED_ERC20_FLOOR: bigint;
|
|
12
|
+
export declare const UNLIMITED_PERMIT2_FLOOR: bigint;
|
|
13
|
+
/** Whether an ERC-20 grant reads as "no limit" rather than a number worth
|
|
14
|
+
* showing — formatting the integer yields a quantity nobody can read. */
|
|
15
|
+
export declare function isUnlimitedErc20Approval(amount: bigint): boolean;
|
|
16
|
+
/** The Permit2 counterpart, against the uint160 wire type's own floor. */
|
|
17
|
+
export declare function isUnlimitedPermit2Approval(amount: bigint): boolean;
|
|
6
18
|
export declare const SWAP_TX_DEADLINE_SECONDS = 600;
|
|
7
19
|
export declare const DEFAULT_PERMIT_EXPIRATION_SECONDS: number;
|
|
8
20
|
export declare const PERMIT2_FAR_FUTURE_EXPIRATION: number;
|
|
@@ -14,8 +26,14 @@ export declare function approveErc20ToPermit2(args: {
|
|
|
14
26
|
token: Address;
|
|
15
27
|
permit2: Address;
|
|
16
28
|
amount?: bigint;
|
|
29
|
+
/** Stops preparation before the approval is handed to the wallet. */
|
|
30
|
+
signal?: AbortSignal;
|
|
17
31
|
onWalletRequest?: () => void;
|
|
18
|
-
onHash?: (hash: Hex
|
|
32
|
+
onHash?: (hash: Hex, replacement?: {
|
|
33
|
+
replacesHash: Hex;
|
|
34
|
+
executionChanged: boolean;
|
|
35
|
+
}) => void;
|
|
36
|
+
onSubmitted?: (hash: Hex) => void;
|
|
19
37
|
}): Promise<Hex>;
|
|
20
38
|
export declare function readErc20Allowance(args: {
|
|
21
39
|
publicClient: PublicClient;
|
|
@@ -30,9 +48,25 @@ export declare function approveErc20Spender(args: {
|
|
|
30
48
|
chain: Chain;
|
|
31
49
|
token: Address;
|
|
32
50
|
spender: Address;
|
|
33
|
-
onHash?: (hash: Hex) => void;
|
|
34
51
|
amount?: bigint;
|
|
52
|
+
/** Stops preparation before the approval is handed to the wallet. */
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
onWalletRequest?: () => void;
|
|
55
|
+
onHash?: (hash: Hex, replacement?: {
|
|
56
|
+
replacesHash: Hex;
|
|
57
|
+
executionChanged: boolean;
|
|
58
|
+
}) => void;
|
|
59
|
+
onSubmitted?: (hash: Hex) => void;
|
|
35
60
|
}): Promise<Hex>;
|
|
61
|
+
/**
|
|
62
|
+
* Installs a Permit2 -> router spending cap on-chain: the fallback for wallets
|
|
63
|
+
* whose typed-data signature Permit2 will not accept.
|
|
64
|
+
*
|
|
65
|
+
* `amount` follows the same convention as the ERC-20 writers above — omitted
|
|
66
|
+
* means maximum authority (MAX_UINT160), and an explicit `0n` revokes. Anything
|
|
67
|
+
* wider than the uint160 wire type is clamped. `expiration` defaults to
|
|
68
|
+
* Permit2's far-future sentinel.
|
|
69
|
+
*/
|
|
36
70
|
export declare function approvePermit2ToRouter(args: {
|
|
37
71
|
provider: Eip1193Provider;
|
|
38
72
|
publicClient: PublicClient;
|
|
@@ -43,8 +77,14 @@ export declare function approvePermit2ToRouter(args: {
|
|
|
43
77
|
router: Address;
|
|
44
78
|
amount?: bigint;
|
|
45
79
|
expiration?: number;
|
|
80
|
+
/** Stops preparation before the approval is handed to the wallet. */
|
|
81
|
+
signal?: AbortSignal;
|
|
46
82
|
onWalletRequest?: () => void;
|
|
47
|
-
onHash?: (hash: Hex
|
|
83
|
+
onHash?: (hash: Hex, replacement?: {
|
|
84
|
+
replacesHash: Hex;
|
|
85
|
+
executionChanged: boolean;
|
|
86
|
+
}) => void;
|
|
87
|
+
onSubmitted?: (hash: Hex) => void;
|
|
48
88
|
}): Promise<Hex>;
|
|
49
89
|
export declare function readPermit2RouterAllowance(args: {
|
|
50
90
|
publicClient: PublicClient;
|
|
@@ -53,7 +93,36 @@ export declare function readPermit2RouterAllowance(args: {
|
|
|
53
93
|
token: Address;
|
|
54
94
|
router: Address;
|
|
55
95
|
}): Promise<readonly [amount: bigint, expiration: number, nonce: number]>;
|
|
56
|
-
export declare function hasUsablePermit2Allowance(allowance: Awaited<ReturnType<typeof readPermit2RouterAllowance>>, amount: bigint): boolean;
|
|
96
|
+
export declare function hasUsablePermit2Allowance(allowance: Awaited<ReturnType<typeof readPermit2RouterAllowance>>, amount: bigint, sizing?: 'exact' | 'max'): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* True only when Permit2's own `SignatureVerification` would accept this
|
|
99
|
+
* signature. It branches on the owner's code, not on the signature's shape: an
|
|
100
|
+
* address with code is checked through ERC-1271 alone, with no ecrecover
|
|
101
|
+
* fallback, so an EIP-7702-delegated EOA whose delegate does not implement
|
|
102
|
+
* `isValidSignature` rejects the ordinary 65-byte signature its own key just
|
|
103
|
+
* produced. A codeless owner takes the other branch and reverts on any length
|
|
104
|
+
* other than 64 or 65, which is where an ERC-6492 wrapper from an undeployed
|
|
105
|
+
* smart account dies.
|
|
106
|
+
*
|
|
107
|
+
* viem's `verifyTypedData` is used only for the codeless branch it models
|
|
108
|
+
* exactly, in `eoa` mode: its default `auto` mode opens with an `eth_call` that
|
|
109
|
+
* deploys viem's ERC-6492 validator, a blocking round trip sitting between the
|
|
110
|
+
* wallet signature and the submit on every ordinary swap.
|
|
111
|
+
*
|
|
112
|
+
* `false` means the owner refused, never "the check could not run": an RPC
|
|
113
|
+
* failure throws so the caller cannot mistake it for an unsignable wallet.
|
|
114
|
+
*/
|
|
115
|
+
export declare function isPermit2AcceptableSignature(args: {
|
|
116
|
+
publicClient: PublicClient;
|
|
117
|
+
chainId: number;
|
|
118
|
+
permit2: Address;
|
|
119
|
+
signed: SignedPermitBatch;
|
|
120
|
+
/**
|
|
121
|
+
* The owner's deployed code, read by the caller so a failed read propagates
|
|
122
|
+
* instead of arriving here as a `false`.
|
|
123
|
+
*/
|
|
124
|
+
ownerCode: Hex | undefined;
|
|
125
|
+
}): Promise<boolean>;
|
|
57
126
|
export declare function buildSignedPermitBatch(args: {
|
|
58
127
|
provider: Eip1193Provider;
|
|
59
128
|
publicClient: PublicClient;
|
|
@@ -67,11 +136,15 @@ export declare function buildSignedPermitBatch(args: {
|
|
|
67
136
|
/**
|
|
68
137
|
* 'max' signs a MAX_UINT160 permit (still expiring in 30 minutes) so quick
|
|
69
138
|
* follow-up swaps reuse it instead of prompting for a new signature each
|
|
70
|
-
* time — Permit2 decrements exact-sized permits to zero on transfer.
|
|
71
|
-
*
|
|
139
|
+
* time — Permit2 decrements exact-sized permits to zero on transfer. It also
|
|
140
|
+
* re-signs over a merely amount-covering standing cap, because that cap is
|
|
141
|
+
* not the unlimited authority 'max' asked for. Defaults to 'exact'.
|
|
72
142
|
*/
|
|
73
143
|
sizing?: 'exact' | 'max';
|
|
74
144
|
/** Pre-started readPermit2RouterAllowance result to overlap with other RPC work. */
|
|
75
145
|
allowanceRead?: ReturnType<typeof readPermit2RouterAllowance>;
|
|
146
|
+
/** Stops preparation before typed data is handed to the wallet. */
|
|
147
|
+
signal?: AbortSignal;
|
|
148
|
+
/** Fires only when a new typed-data signature is actually requested. */
|
|
76
149
|
onWalletRequest?: () => void;
|
|
77
150
|
}): Promise<SignedPermitBatch | null>;
|
|
@@ -13,5 +13,9 @@ export declare class AggregatedSwapBuildMismatchError extends UserFacingError {
|
|
|
13
13
|
actual: bigint;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
+
/** Absolute settlement floor established by the quote the user approved. */
|
|
17
|
+
export type AggregatedSwapExecutionIntent = Readonly<{
|
|
18
|
+
reviewedAmountOutMinimum: bigint;
|
|
19
|
+
}>;
|
|
16
20
|
export declare function assertAggregatedRouterTrusted(router: Address, chainId: number): void;
|
|
17
|
-
export declare function fetchAggregatedSwapQuote(inputToken: AegisSwapToken, outputToken: AegisSwapToken, amount: bigint, slippageBps: number, mode?: 'exactIn' | 'exactOut', account?: Address | null, signal?: AbortSignal, _publicClient?: PublicClient): Promise<AggregatedSwapQuote>;
|
|
21
|
+
export declare function fetchAggregatedSwapQuote(inputToken: AegisSwapToken, outputToken: AegisSwapToken, amount: bigint, slippageBps: number, mode?: 'exactIn' | 'exactOut', account?: Address | null, signal?: AbortSignal, _publicClient?: PublicClient, executionIntent?: AggregatedSwapExecutionIntent): Promise<AggregatedSwapQuote>;
|
|
@@ -189,6 +189,10 @@ export declare const KYBER_META_AGGREGATION_ROUTER_V2_ABI: readonly [{
|
|
|
189
189
|
readonly type: "uint256";
|
|
190
190
|
}];
|
|
191
191
|
}];
|
|
192
|
+
export type KyberSettlementFeePolicy = Readonly<{
|
|
193
|
+
receiver: Address;
|
|
194
|
+
feeBps: number;
|
|
195
|
+
}>;
|
|
192
196
|
export declare class AggregatedSwapCalldataError extends UserFacingError {
|
|
193
197
|
readonly reason: string;
|
|
194
198
|
constructor(reason: string);
|
|
@@ -207,5 +211,5 @@ export declare function assertKyberCalldataMatchesQuote(args: {
|
|
|
207
211
|
recipient: Address;
|
|
208
212
|
/** Lowest acceptable value for the calldata's embedded minReturnAmount. */
|
|
209
213
|
minReturnFloor: bigint;
|
|
210
|
-
|
|
214
|
+
feePolicy: KyberSettlementFeePolicy | null;
|
|
211
215
|
}): void;
|