@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.
Files changed (78) hide show
  1. package/README.md +232 -7
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/account.d.ts +11 -0
  4. package/dist/account.js +129 -0
  5. package/dist/actions/allowance.d.ts +94 -0
  6. package/dist/actions/directPoolSwap.d.ts +10 -1
  7. package/dist/actions/kyberSwap.d.ts +2 -0
  8. package/dist/actions/types.d.ts +10 -3
  9. package/dist/actions/wallet.d.ts +1 -0
  10. package/dist/aegis-core.js +9653 -200
  11. package/dist/backendAdapters.d.ts +3 -1
  12. package/dist/config/chains.d.ts +1 -0
  13. package/dist/config/constants.d.ts +4 -0
  14. package/dist/config/tokens.d.ts +2 -1
  15. package/dist/config/types.d.ts +8 -0
  16. package/dist/contract/backendClient.d.ts +3 -1
  17. package/dist/contract/generated/aegis-swap.d.ts +6337 -1377
  18. package/dist/contract/generated/market-data.d.ts +8286 -0
  19. package/dist/contract/index.d.ts +1 -0
  20. package/dist/contract/responseBudget.d.ts +9 -0
  21. package/dist/contract/schemas.d.ts +13 -3
  22. package/dist/engine/account/accounting.d.ts +24 -0
  23. package/dist/engine/account/accountingSchemas.d.ts +2056 -0
  24. package/dist/engine/account/activity.d.ts +42 -0
  25. package/dist/engine/account/activitySchemas.d.ts +327 -0
  26. package/dist/engine/account/amountSchemas.d.ts +9 -0
  27. package/dist/engine/account/catalogSchemas.d.ts +108 -0
  28. package/dist/engine/account/client.d.ts +14 -0
  29. package/dist/engine/account/history.d.ts +40 -0
  30. package/dist/engine/account/historySchemas.d.ts +251 -0
  31. package/dist/engine/account/management.d.ts +13 -0
  32. package/dist/engine/account/portfolioSchemas.d.ts +712 -0
  33. package/dist/engine/account/positionPerformance.d.ts +18 -0
  34. package/dist/engine/account/positionPerformanceSchemas.d.ts +101 -0
  35. package/dist/engine/account/positionPnl.d.ts +18 -0
  36. package/dist/engine/account/positionPnlSchemas.d.ts +149 -0
  37. package/dist/engine/account/transactionHistory.d.ts +50 -0
  38. package/dist/engine/account/transactionSchemas.d.ts +101 -0
  39. package/dist/engine/account/transactions.d.ts +26 -0
  40. package/dist/engine/account/transport.d.ts +31 -0
  41. package/dist/engine/account/types.d.ts +39 -0
  42. package/dist/engine/actions.d.ts +14 -4
  43. package/dist/engine/adaptiveFee.d.ts +14 -0
  44. package/dist/engine/balancedLending.d.ts +82 -0
  45. package/dist/engine/borrowCollateralFloor.d.ts +3 -0
  46. package/dist/engine/borrowLimits.d.ts +18 -0
  47. package/dist/engine/dataSource.d.ts +2 -0
  48. package/dist/engine/index.d.ts +20 -0
  49. package/dist/engine/marketAdapter.d.ts +3 -0
  50. package/dist/engine/marketSeries.d.ts +61 -0
  51. package/dist/engine/marketSeriesSchemas.d.ts +312 -0
  52. package/dist/engine/marketTrust.d.ts +26 -0
  53. package/dist/engine/openingEntry.d.ts +41 -0
  54. package/dist/engine/rateHistorySchemas.d.ts +88 -0
  55. package/dist/engine/reads.d.ts +1 -1
  56. package/dist/engine/registry.d.ts +1 -1
  57. package/dist/engine/restSchemas.d.ts +59 -1
  58. package/dist/engine/tradeExecutionSession.d.ts +155 -0
  59. package/dist/engine/types.d.ts +169 -15
  60. package/dist/engine/v4Quote.d.ts +5 -0
  61. package/dist/index.d.ts +13 -8
  62. package/dist/internal/guardedWalletTransaction.d.ts +31 -0
  63. package/dist/permit.d.ts +80 -6
  64. package/dist/quote/aggregatedSwapQuote.d.ts +5 -1
  65. package/dist/quote/kyberCalldata.d.ts +5 -1
  66. package/dist/{sdkRuntime-C_vaU-0g.js → sdkRuntime-3aRt_g55.js} +3385 -2957
  67. package/dist/services/kyberSwap.d.ts +12 -0
  68. package/dist/swap/authorizePermit.d.ts +11 -9
  69. package/dist/swap/executeSwapTransaction.d.ts +5 -1
  70. package/dist/swap/receiptWait.d.ts +9 -0
  71. package/dist/swap/sendSwapTransaction.d.ts +7 -0
  72. package/dist/swap/settlement.d.ts +4 -0
  73. package/dist/swap/trustedMarket.d.ts +25 -0
  74. package/dist/transactionHistory-1Zl2KCcV.js +5915 -0
  75. package/dist/transactionProgress.d.ts +41 -2
  76. package/dist/wallet.d.ts +5 -1
  77. package/package.json +12 -5
  78. package/dist/index-D9EfUokZ.js +0 -11031
@@ -19,6 +19,8 @@ export type AegisSwapReceiptSummary = {
19
19
  * case UIs should keep showing the quote estimate with a "~" affordance.
20
20
  */
21
21
  settledAmountOut?: bigint;
22
+ /** Net input-token transfers from the payer in this receipt, after refunds. */
23
+ settledAmountIn?: bigint;
22
24
  };
23
25
  export declare function isBusy(status: SubmitStatus): boolean;
24
26
  export type TransactionProgressState = 'pending' | 'mining' | 'success' | 'error';
@@ -51,12 +53,42 @@ export type TransactionProgressView = {
51
53
  state: TransactionProgressState;
52
54
  label: string;
53
55
  walletPrompts: AegisSwapWalletPromptProgress;
54
- /** Calm fill showing completed wallet-provider prompts. */
56
+ /** Calm fill showing settled rail steps; the final action settles on receipt. */
55
57
  completePct: number;
56
58
  /** Visual activity layer width; pending/mining sweeps full-width by default. */
57
59
  activeWidthPct: number;
60
+ /**
61
+ * Steps the rail divides itself into, so a three-step flow reads
62
+ * 33/66/100 instead of one indivisible half. Presentation only, and separate
63
+ * from `walletPrompts`: the Engine counts settlement steps it can name, not
64
+ * provider prompts it cannot predict. Absent when the total is not known
65
+ * before the first prompt — the rail then stays one continuous bar rather
66
+ * than inventing a denominator that could grow mid-flight.
67
+ */
68
+ steps?: number;
69
+ };
70
+ /**
71
+ * Chips the top rail divides itself into. Explicit settlement steps when a
72
+ * producer counts them, else the wallet-prompt plan — which is the swap path's
73
+ * step count already. Fewer than two is not a division worth drawing, so the
74
+ * rail stays one continuous bar. Where along those chips the bar sits comes
75
+ * from `completePct`, so only the count is needed here.
76
+ */
77
+ export declare function progressRailSteps(view: TransactionProgressView | null | undefined): number | undefined;
78
+ export declare function normalizeProgressCount(value: number): number;
79
+ /** Shared geometry for every widget and host rail. The final action is only
80
+ * complete after confirmation, even if every wallet prompt has finished. */
81
+ export declare function transactionSequenceProgress({ total, completed, confirmed }: {
82
+ total: number;
83
+ completed: number;
84
+ confirmed?: boolean;
85
+ }): {
86
+ total: number;
87
+ completed: number;
88
+ completePct: number;
89
+ steps?: number;
58
90
  };
59
- export declare function transactionProgressView({ status, inputSymbol, txHash, transactionStage, actionError, approvalRequired, approvalDone, resetRequired, approvalsCompleted, authorizationRequired, authorizationPrompts, authorizationsCompleted }: {
91
+ export declare function transactionProgressView({ status, inputSymbol, txHash, transactionStage, actionError, approvalRequired, approvalPrompts, approvalDone, resetRequired, approvalsCompleted, authorizationRequired, authorizationPrompts, authorizationsCompleted }: {
60
92
  status: SubmitStatus;
61
93
  inputSymbol: string;
62
94
  txHash: Hex | null;
@@ -64,6 +96,8 @@ export declare function transactionProgressView({ status, inputSymbol, txHash, t
64
96
  transactionStage?: 'permission' | 'swap' | null;
65
97
  actionError: string | null;
66
98
  approvalRequired: boolean;
99
+ /** Explicit executor plan, including every prerequisite approval. */
100
+ approvalPrompts?: number;
67
101
  approvalDone: boolean;
68
102
  /** Whether the approval spends an extra approve(0) prompt first. */
69
103
  resetRequired?: boolean;
@@ -89,6 +123,11 @@ export type AegisSwapStatusSnapshot = {
89
123
  /** Rail geometry; null while idle. */
90
124
  completePct: number | null;
91
125
  activeWidthPct: number | null;
126
+ /**
127
+ * Segmented rail chip count; null for a continuous or hidden rail.
128
+ * Optional so existing host-authored snapshot fixtures may omit it.
129
+ */
130
+ steps?: number | null;
92
131
  txHash: Hex | null;
93
132
  /**
94
133
  * Submission-time chain, account, and asset identity for `txHash`. Null
package/dist/wallet.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { type Address, type Chain, type PublicClient } from 'viem';
2
+ export declare const SDK_RPC_MULTICALL_RULE_ID: "SDK-RPC-001";
2
3
  export type Eip1193Provider = {
3
4
  request<T = unknown>(args: {
4
5
  method: string;
5
6
  params?: unknown[] | Record<string, unknown>;
6
7
  }): Promise<T>;
7
8
  };
9
+ /** Stop later requests, including requests viem starts after an internal await.
10
+ * A request already handed to the wallet retains its result for receipt tracking. */
11
+ export declare function withWalletRequestSignal(provider: Eip1193Provider, signal?: AbortSignal): Eip1193Provider;
8
12
  export type ProviderChainConfig = {
9
13
  chainId: number;
10
14
  name?: string;
@@ -27,7 +31,7 @@ export declare function getProviderAccount(provider: Eip1193Provider): Promise<A
27
31
  export declare function requestProviderAccount(provider: Eip1193Provider): Promise<Address | null>;
28
32
  export declare function getProviderChainId(provider: Eip1193Provider): Promise<number | null>;
29
33
  export declare function switchProviderChain(provider: Eip1193Provider, chain: number | ProviderChainConfig): Promise<void>;
30
- export declare function createSwapPublicClient(chain: Chain, rpcUrls: readonly string[]): PublicClient;
34
+ export declare function createSwapPublicClient(chain: Chain, rpcUrls: readonly string[], readProvider?: Eip1193Provider): PublicClient;
31
35
  export declare function subscribeProvider(provider: Eip1193Provider, handlers: {
32
36
  onAccountsChanged?: () => void;
33
37
  onChainChanged?: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aegis-engine/core",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "React-free Aegis Swap and Engine quoting, risk, approval, and execution operations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,13 @@
14
14
  "require": null,
15
15
  "default": "./dist/aegis-core.js"
16
16
  },
17
- "./package.json": "./package.json"
17
+ "./package.json": "./package.json",
18
+ "./account": {
19
+ "types": "./dist/account.d.ts",
20
+ "import": "./dist/account.js",
21
+ "require": null,
22
+ "default": "./dist/account.js"
23
+ }
18
24
  },
19
25
  "publishConfig": {
20
26
  "access": "public"
@@ -29,8 +35,9 @@
29
35
  "viem": "^2.23.1"
30
36
  },
31
37
  "devDependencies": {
32
- "@labs-solo/aegis-engine-sdk": "0.33.0",
38
+ "@labs-solo/aegis-engine-sdk": "0.40.0",
33
39
  "@types/node": "^25.9.1",
40
+ "fast-check": "^4.9.0",
34
41
  "openapi-typescript": "^7.13.0",
35
42
  "typescript": "~5.6.2",
36
43
  "viem": "^2.54.3",
@@ -52,8 +59,8 @@
52
59
  },
53
60
  "bugs": "https://github.com/amplifi-liquidity/aegis-widget/issues",
54
61
  "scripts": {
55
- "openapi:generate": "openapi-typescript ./openapi/aegis-swap.json -o ./src/contract/generated/aegis-swap.ts",
56
- "openapi:check": "pnpm run openapi:generate && git diff --exit-code -- src/contract/generated/aegis-swap.ts",
62
+ "openapi:generate": "openapi-typescript ./openapi/aegis-swap.json -o ./src/contract/generated/aegis-swap.ts && openapi-typescript ./openapi/market-data.json -o ./src/contract/generated/market-data.ts",
63
+ "openapi:check": "pnpm run openapi:generate && git diff --exit-code -- src/contract/generated/aegis-swap.ts src/contract/generated/market-data.ts",
57
64
  "typecheck": "tsc -p tsconfig.build.json --noEmit",
58
65
  "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
59
66
  "test": "vitest run",