aegis-swap-widget 0.3.2 → 0.3.4

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 (40) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +114 -43
  3. package/dist/abis.d.ts +0 -73
  4. package/dist/aegis-swap-widget.js +3468 -2344
  5. package/dist/config/chains.d.ts +11 -0
  6. package/dist/config/constants.d.ts +8 -0
  7. package/dist/config/contracts.d.ts +6 -0
  8. package/dist/config/createMarket.d.ts +3 -0
  9. package/dist/config/index.d.ts +7 -0
  10. package/dist/config/markets.d.ts +3 -0
  11. package/dist/config/tokens.d.ts +11 -0
  12. package/dist/{config.d.ts → config/types.d.ts} +5 -26
  13. package/dist/core.d.ts +3 -15
  14. package/dist/core.js +4 -64
  15. package/dist/encoding.d.ts +0 -29
  16. package/dist/hooks/useSubmitSwap.d.ts +11 -29
  17. package/dist/hooks/useSwapQuote.d.ts +3 -2
  18. package/dist/index.d.ts +3 -1
  19. package/dist/markets-LIeOtFf_.js +229 -0
  20. package/dist/permit.d.ts +1 -47
  21. package/dist/quote/aggregatedSwapQuote.d.ts +5 -0
  22. package/dist/services/kyberSwap.d.ts +84 -0
  23. package/dist/styles.css +1 -1
  24. package/dist/types/aggregatedSwap.d.ts +29 -0
  25. package/dist/widget/AegisAggregatedSwapWidget.d.ts +3 -0
  26. package/dist/widget/AmountField.d.ts +5 -1
  27. package/dist/widget/SwapWidgetShell.d.ts +51 -0
  28. package/dist/widget/TokenSelector.d.ts +13 -0
  29. package/dist/widget/types.d.ts +23 -2
  30. package/dist/widget/useAggregatedSwapController.d.ts +74 -0
  31. package/dist/widget/useRailAutoReset.d.ts +11 -0
  32. package/dist/widget/useStatusSurface.d.ts +32 -0
  33. package/dist/widget/useSwapController.d.ts +13 -14
  34. package/dist/widget/useWidgetStyle.d.ts +13 -0
  35. package/dist/widget/viewState.d.ts +21 -1
  36. package/package.json +23 -21
  37. package/dist/polling-BI4pZg8Z.js +0 -1252
  38. package/dist/swap/authorizePermit.d.ts +0 -30
  39. package/dist/swap/executeSwapTransaction.d.ts +0 -39
  40. package/dist/swap/types.d.ts +0 -7
@@ -1,30 +0,0 @@
1
- import type { Address, PublicClient } from 'viem';
2
- import type { AegisSwapChainConfig } from '../config';
3
- import type { SignedPermitBatch } from '../encoding';
4
- import { readPermit2RouterAllowance } from '../permit';
5
- import type { SubmitStatus } from '../transactionProgress';
6
- import type { AegisSwapApprovalMode } from '../hooks/useSubmitSwap';
7
- import type { WalletSession } from './types';
8
- /**
9
- * Produces the Permit2 authorization the swap calldata needs.
10
- *
11
- * Tries an off-chain Permit2 signature first (`null` calldata permit when the
12
- * on-chain allowance already covers the spend). Wallets that cannot produce an
13
- * EOA-style typed-data signature Permit2 can verify — undeployed smart accounts
14
- * sign ERC-6492, some wallets refuse `eth_signTypedData_v4` — fall back to an
15
- * on-chain Permit2 approval scoped to the same amount and expiration the permit
16
- * would have carried, and this returns `null` so the swap proceeds without an
17
- * inline permit. A user rejection is rethrown untouched.
18
- */
19
- export declare function authorizePermit({ wallet, publicClient, activeChain, permit2, router, token, amount, approvalMode, allowanceRead, setStatus }: {
20
- wallet: WalletSession;
21
- publicClient: PublicClient;
22
- activeChain: AegisSwapChainConfig;
23
- permit2: Address;
24
- router: Address;
25
- token: Address;
26
- amount: bigint;
27
- approvalMode: AegisSwapApprovalMode;
28
- allowanceRead: ReturnType<typeof readPermit2RouterAllowance>;
29
- setStatus: (status: SubmitStatus) => void;
30
- }): Promise<SignedPermitBatch | null>;
@@ -1,39 +0,0 @@
1
- import { type Hex, type PublicClient } from 'viem';
2
- import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapToken } from '../config';
3
- import { type SignedPermitBatch } from '../encoding';
4
- import { type DirectSwapQuote } from '../quote';
5
- import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress';
6
- import type { AegisSwapSubmitDetails } from '../hooks/useSubmitSwap';
7
- import type { WalletSession } from './types';
8
- export type SwapExecutionResult = {
9
- receipt: {
10
- status: 'success' | 'reverted';
11
- transactionHash: Hex;
12
- };
13
- /** Settlement facts (gas, block, fee) lifted off the mined receipt. */
14
- summary: AegisSwapReceiptSummary;
15
- swapDetails: AegisSwapSubmitDetails;
16
- };
17
- /**
18
- * Builds the swap calldata, sends it, and waits for the receipt.
19
- *
20
- * Estimates gas with a 20% headroom bump, surfaces the optimistic hash through
21
- * `setTxHash` (and `onSubmitted`) before mining, then tracks replacements: a
22
- * wallet speed-up swaps in the hash that actually mines, while a wallet cancel
23
- * mines a no-op whose "successful" receipt must not count as a swap — so a
24
- * cancelled or reverted receipt throws. Setting the success status and the
25
- * post-success refreshes stay with the caller.
26
- */
27
- export declare function executeSwapTransaction({ wallet, publicClient, activeChain, market, inputToken, outputToken, swapQuote, permit, setStatus, setTxHash, onSubmitted }: {
28
- wallet: WalletSession;
29
- publicClient: PublicClient;
30
- activeChain: AegisSwapChainConfig;
31
- market: AegisSwapMarket;
32
- inputToken: AegisSwapToken;
33
- outputToken: AegisSwapToken;
34
- swapQuote: DirectSwapQuote;
35
- permit: SignedPermitBatch | null;
36
- setStatus: (status: SubmitStatus) => void;
37
- setTxHash: (hash: Hex | null) => void;
38
- onSubmitted?: (hash: Hex, swap?: AegisSwapSubmitDetails) => void;
39
- }): Promise<SwapExecutionResult>;
@@ -1,7 +0,0 @@
1
- import type { Address } from 'viem';
2
- import type { Eip1193Provider } from '../wallet';
3
- /** A resolved wallet: a provider landed on the active chain plus its account. */
4
- export type WalletSession = {
5
- provider: Eip1193Provider;
6
- account: Address;
7
- };