@oydual31/more-vaults-sdk 0.3.0 → 0.3.2
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/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-FgKCJQYa.d.cts → spokeRoutes-DK7cIW4z.d.cts} +4 -0
- package/dist/{spokeRoutes-FgKCJQYa.d.ts → spokeRoutes-DK7cIW4z.d.ts} +4 -0
- package/dist/viem/index.cjs +450 -5
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +396 -3
- package/dist/viem/index.d.ts +396 -3
- package/dist/viem/index.js +438 -7
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/abis.ts +51 -0
- package/src/viem/chains.ts +17 -0
- package/src/viem/curatorMulticall.ts +299 -0
- package/src/viem/curatorStatus.ts +197 -2
- package/src/viem/curatorSwaps.ts +239 -0
- package/src/viem/index.ts +22 -1
- package/src/viem/types.ts +38 -0
- package/src/viem/userHelpers.ts +22 -6
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Address, Hash, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-DK7cIW4z.js';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
|
@@ -402,6 +402,16 @@ declare const LZ_TIMEOUTS: {
|
|
|
402
402
|
/** Full spoke→hub→spoke redeem (all steps combined) */
|
|
403
403
|
readonly FULL_SPOKE_REDEEM: 3600000;
|
|
404
404
|
};
|
|
405
|
+
/**
|
|
406
|
+
* Uniswap V3 SwapRouter addresses per chain.
|
|
407
|
+
* Used by curator swap helpers to build calldata for on-chain swaps.
|
|
408
|
+
*
|
|
409
|
+
* Note on struct differences:
|
|
410
|
+
* - SwapRouter (Eth/Arb/Op, 0xE592...): exactInputSingle struct includes `deadline`
|
|
411
|
+
* - SwapRouter02 (Base, 0x2626...): exactInputSingle struct does NOT include `deadline`
|
|
412
|
+
* - FlowSwap V3 (Flow EVM, 0xeEDC...): derived from original UniV3, includes `deadline`
|
|
413
|
+
*/
|
|
414
|
+
declare const UNISWAP_V3_ROUTERS: Record<number, `0x${string}`>;
|
|
405
415
|
/** @deprecated Use OFT_ROUTES.stgUSDC instead */
|
|
406
416
|
declare const USDC_STARGATE_OFT: Partial<Record<number, `0x${string}`>>;
|
|
407
417
|
/** @deprecated Use OFT_ROUTES.stgUSDC[chainId].token instead */
|
|
@@ -1415,6 +1425,143 @@ declare const LZ_ADAPTER_ABI: readonly [{
|
|
|
1415
1425
|
}];
|
|
1416
1426
|
readonly stateMutability: "view";
|
|
1417
1427
|
}];
|
|
1428
|
+
/**
|
|
1429
|
+
* ERC4626Facet ABI — synchronous deposit and redeem into whitelisted ERC-4626 vaults.
|
|
1430
|
+
*/
|
|
1431
|
+
declare const ERC4626_FACET_ABI: readonly [{
|
|
1432
|
+
readonly type: "function";
|
|
1433
|
+
readonly name: "erc4626Deposit";
|
|
1434
|
+
readonly inputs: readonly [{
|
|
1435
|
+
readonly name: "vault";
|
|
1436
|
+
readonly type: "address";
|
|
1437
|
+
}, {
|
|
1438
|
+
readonly name: "assets";
|
|
1439
|
+
readonly type: "uint256";
|
|
1440
|
+
}];
|
|
1441
|
+
readonly outputs: readonly [{
|
|
1442
|
+
readonly name: "shares";
|
|
1443
|
+
readonly type: "uint256";
|
|
1444
|
+
}];
|
|
1445
|
+
readonly stateMutability: "nonpayable";
|
|
1446
|
+
}, {
|
|
1447
|
+
readonly type: "function";
|
|
1448
|
+
readonly name: "erc4626Redeem";
|
|
1449
|
+
readonly inputs: readonly [{
|
|
1450
|
+
readonly name: "vault";
|
|
1451
|
+
readonly type: "address";
|
|
1452
|
+
}, {
|
|
1453
|
+
readonly name: "shares";
|
|
1454
|
+
readonly type: "uint256";
|
|
1455
|
+
}];
|
|
1456
|
+
readonly outputs: readonly [{
|
|
1457
|
+
readonly name: "assets";
|
|
1458
|
+
readonly type: "uint256";
|
|
1459
|
+
}];
|
|
1460
|
+
readonly stateMutability: "nonpayable";
|
|
1461
|
+
}];
|
|
1462
|
+
/**
|
|
1463
|
+
* Vault analysis ABIs — per-vault whitelist and registry reads.
|
|
1464
|
+
*/
|
|
1465
|
+
declare const VAULT_ANALYSIS_ABI: readonly [{
|
|
1466
|
+
readonly type: "function";
|
|
1467
|
+
readonly name: "getAvailableAssets";
|
|
1468
|
+
readonly inputs: readonly [];
|
|
1469
|
+
readonly outputs: readonly [{
|
|
1470
|
+
readonly type: "address[]";
|
|
1471
|
+
}];
|
|
1472
|
+
readonly stateMutability: "view";
|
|
1473
|
+
}, {
|
|
1474
|
+
readonly type: "function";
|
|
1475
|
+
readonly name: "getDepositableAssets";
|
|
1476
|
+
readonly inputs: readonly [];
|
|
1477
|
+
readonly outputs: readonly [{
|
|
1478
|
+
readonly type: "address[]";
|
|
1479
|
+
}];
|
|
1480
|
+
readonly stateMutability: "view";
|
|
1481
|
+
}, {
|
|
1482
|
+
readonly type: "function";
|
|
1483
|
+
readonly name: "isAssetAvailable";
|
|
1484
|
+
readonly inputs: readonly [{
|
|
1485
|
+
readonly name: "asset";
|
|
1486
|
+
readonly type: "address";
|
|
1487
|
+
}];
|
|
1488
|
+
readonly outputs: readonly [{
|
|
1489
|
+
readonly type: "bool";
|
|
1490
|
+
}];
|
|
1491
|
+
readonly stateMutability: "view";
|
|
1492
|
+
}, {
|
|
1493
|
+
readonly type: "function";
|
|
1494
|
+
readonly name: "isAssetDepositable";
|
|
1495
|
+
readonly inputs: readonly [{
|
|
1496
|
+
readonly name: "asset";
|
|
1497
|
+
readonly type: "address";
|
|
1498
|
+
}];
|
|
1499
|
+
readonly outputs: readonly [{
|
|
1500
|
+
readonly type: "bool";
|
|
1501
|
+
}];
|
|
1502
|
+
readonly stateMutability: "view";
|
|
1503
|
+
}, {
|
|
1504
|
+
readonly type: "function";
|
|
1505
|
+
readonly name: "isDepositWhitelistEnabled";
|
|
1506
|
+
readonly inputs: readonly [];
|
|
1507
|
+
readonly outputs: readonly [{
|
|
1508
|
+
readonly type: "bool";
|
|
1509
|
+
}];
|
|
1510
|
+
readonly stateMutability: "view";
|
|
1511
|
+
}, {
|
|
1512
|
+
readonly type: "function";
|
|
1513
|
+
readonly name: "getAvailableToDeposit";
|
|
1514
|
+
readonly inputs: readonly [{
|
|
1515
|
+
readonly name: "depositor";
|
|
1516
|
+
readonly type: "address";
|
|
1517
|
+
}];
|
|
1518
|
+
readonly outputs: readonly [{
|
|
1519
|
+
readonly type: "uint256";
|
|
1520
|
+
}];
|
|
1521
|
+
readonly stateMutability: "view";
|
|
1522
|
+
}, {
|
|
1523
|
+
readonly type: "function";
|
|
1524
|
+
readonly name: "moreVaultsRegistry";
|
|
1525
|
+
readonly inputs: readonly [];
|
|
1526
|
+
readonly outputs: readonly [{
|
|
1527
|
+
readonly type: "address";
|
|
1528
|
+
}];
|
|
1529
|
+
readonly stateMutability: "view";
|
|
1530
|
+
}];
|
|
1531
|
+
/**
|
|
1532
|
+
* MoreVaultsRegistry ABI — global protocol and bridge whitelist checks.
|
|
1533
|
+
*/
|
|
1534
|
+
declare const REGISTRY_ABI: readonly [{
|
|
1535
|
+
readonly type: "function";
|
|
1536
|
+
readonly name: "isWhitelisted";
|
|
1537
|
+
readonly inputs: readonly [{
|
|
1538
|
+
readonly name: "protocol";
|
|
1539
|
+
readonly type: "address";
|
|
1540
|
+
}];
|
|
1541
|
+
readonly outputs: readonly [{
|
|
1542
|
+
readonly type: "bool";
|
|
1543
|
+
}];
|
|
1544
|
+
readonly stateMutability: "view";
|
|
1545
|
+
}, {
|
|
1546
|
+
readonly type: "function";
|
|
1547
|
+
readonly name: "isBridgeAllowed";
|
|
1548
|
+
readonly inputs: readonly [{
|
|
1549
|
+
readonly name: "bridge";
|
|
1550
|
+
readonly type: "address";
|
|
1551
|
+
}];
|
|
1552
|
+
readonly outputs: readonly [{
|
|
1553
|
+
readonly type: "bool";
|
|
1554
|
+
}];
|
|
1555
|
+
readonly stateMutability: "view";
|
|
1556
|
+
}, {
|
|
1557
|
+
readonly type: "function";
|
|
1558
|
+
readonly name: "getAllowedFacets";
|
|
1559
|
+
readonly inputs: readonly [];
|
|
1560
|
+
readonly outputs: readonly [{
|
|
1561
|
+
readonly type: "address[]";
|
|
1562
|
+
}];
|
|
1563
|
+
readonly stateMutability: "view";
|
|
1564
|
+
}];
|
|
1418
1565
|
/**
|
|
1419
1566
|
* Minimal LZ Endpoint V2 ABI for compose queue management.
|
|
1420
1567
|
* Used by the Stargate 2-TX flow to check compose status and execute pending composes.
|
|
@@ -1624,6 +1771,36 @@ interface CuratorVaultStatus {
|
|
|
1624
1771
|
lzAdapter: Address;
|
|
1625
1772
|
paused: boolean;
|
|
1626
1773
|
}
|
|
1774
|
+
interface AssetInfo {
|
|
1775
|
+
address: Address;
|
|
1776
|
+
symbol: string;
|
|
1777
|
+
name: string;
|
|
1778
|
+
decimals: number;
|
|
1779
|
+
}
|
|
1780
|
+
interface VaultAnalysis {
|
|
1781
|
+
/** All tokens the vault can hold/swap (curator-managed) */
|
|
1782
|
+
availableAssets: AssetInfo[];
|
|
1783
|
+
/** Tokens users can deposit */
|
|
1784
|
+
depositableAssets: AssetInfo[];
|
|
1785
|
+
/** Whether deposit whitelist is enabled (restricts who can deposit) */
|
|
1786
|
+
depositWhitelistEnabled: boolean;
|
|
1787
|
+
/** Registry address for global protocol whitelist checks */
|
|
1788
|
+
registryAddress: Address | null;
|
|
1789
|
+
}
|
|
1790
|
+
interface AssetBalance extends AssetInfo {
|
|
1791
|
+
/** Raw balance held by the vault */
|
|
1792
|
+
balance: bigint;
|
|
1793
|
+
}
|
|
1794
|
+
interface VaultAssetBreakdown {
|
|
1795
|
+
/** Per-asset balances held by the vault on the hub chain */
|
|
1796
|
+
assets: AssetBalance[];
|
|
1797
|
+
/** totalAssets() as reported by the vault (all positions converted to underlying) */
|
|
1798
|
+
totalAssets: bigint;
|
|
1799
|
+
/** totalSupply() of vault shares */
|
|
1800
|
+
totalSupply: bigint;
|
|
1801
|
+
/** Vault underlying token decimals */
|
|
1802
|
+
underlyingDecimals: number;
|
|
1803
|
+
}
|
|
1627
1804
|
|
|
1628
1805
|
/**
|
|
1629
1806
|
* Typed error classes for the MoreVaults SDK.
|
|
@@ -2297,6 +2474,222 @@ declare function getPendingActions(publicClient: PublicClient, vault: Address, n
|
|
|
2297
2474
|
* @returns true if address is the current curator
|
|
2298
2475
|
*/
|
|
2299
2476
|
declare function isCurator(publicClient: PublicClient, vault: Address, address: Address): Promise<boolean>;
|
|
2477
|
+
/**
|
|
2478
|
+
* Full vault analysis — available assets with metadata, depositable assets, whitelist config.
|
|
2479
|
+
* Useful for curator dashboards to understand what the vault can do.
|
|
2480
|
+
*
|
|
2481
|
+
* @param publicClient Viem public client (must be on the vault's chain)
|
|
2482
|
+
* @param vault Vault address (diamond proxy)
|
|
2483
|
+
* @returns VaultAnalysis snapshot
|
|
2484
|
+
*/
|
|
2485
|
+
declare function getVaultAnalysis(publicClient: PublicClient, vault: Address): Promise<VaultAnalysis>;
|
|
2486
|
+
/**
|
|
2487
|
+
* Check if specific protocol addresses are whitelisted in the global registry.
|
|
2488
|
+
* Useful for curators to verify DEX routers before building swap calldata.
|
|
2489
|
+
*
|
|
2490
|
+
* @param publicClient Viem public client (must be on the vault's chain)
|
|
2491
|
+
* @param vault Vault address (diamond proxy)
|
|
2492
|
+
* @param protocols Protocol addresses to check
|
|
2493
|
+
* @returns Record mapping address → whitelisted boolean
|
|
2494
|
+
*/
|
|
2495
|
+
declare function checkProtocolWhitelist(publicClient: PublicClient, vault: Address, protocols: Address[]): Promise<Record<string, boolean>>;
|
|
2496
|
+
/**
|
|
2497
|
+
* Get the vault's per-asset balance breakdown on the hub chain.
|
|
2498
|
+
*
|
|
2499
|
+
* Returns the balance of every available asset held by the vault, plus
|
|
2500
|
+
* totalAssets and totalSupply for context. Useful for portfolio views
|
|
2501
|
+
* that need to show individual holdings rather than a single USD-denominated total.
|
|
2502
|
+
*
|
|
2503
|
+
* @param publicClient Viem public client (must be on the vault's hub chain)
|
|
2504
|
+
* @param vault Vault address (diamond proxy)
|
|
2505
|
+
* @returns VaultAssetBreakdown with per-asset balances
|
|
2506
|
+
*/
|
|
2507
|
+
declare function getVaultAssetBreakdown(publicClient: PublicClient, vault: Address): Promise<VaultAssetBreakdown>;
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* Curator MulticallFacet write operations for the MoreVaults SDK.
|
|
2511
|
+
*
|
|
2512
|
+
* Provides typed helpers to submit, execute, and veto curator action batches
|
|
2513
|
+
* on any MoreVaults diamond that has the MulticallFacet installed.
|
|
2514
|
+
*
|
|
2515
|
+
* All write functions use the simulate-then-write pattern:
|
|
2516
|
+
* 1. `publicClient.simulateContract` — validates on-chain, catches reverts early
|
|
2517
|
+
* 2. `walletClient.writeContract` — sends the actual transaction
|
|
2518
|
+
*
|
|
2519
|
+
* @module curatorMulticall
|
|
2520
|
+
*/
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Encode a single typed CuratorAction into raw calldata bytes suitable for
|
|
2524
|
+
* passing into `submitActions(bytes[] actionsData)`.
|
|
2525
|
+
*
|
|
2526
|
+
* The encoded bytes are the full ABI-encoded function call (4-byte selector +
|
|
2527
|
+
* arguments) targeting the vault diamond itself — the MulticallFacet will
|
|
2528
|
+
* call `address(this).call(actionsData[i])` for each entry.
|
|
2529
|
+
*
|
|
2530
|
+
* @param action A discriminated-union CuratorAction describing what to do
|
|
2531
|
+
* @returns ABI-encoded calldata bytes (`0x`-prefixed hex string)
|
|
2532
|
+
*/
|
|
2533
|
+
declare function encodeCuratorAction(action: CuratorAction): `0x${string}`;
|
|
2534
|
+
/**
|
|
2535
|
+
* Encode an array of CuratorActions into a calldata array ready for
|
|
2536
|
+
* `submitActions`.
|
|
2537
|
+
*
|
|
2538
|
+
* @param actions Array of typed CuratorAction objects
|
|
2539
|
+
* @returns Array of ABI-encoded calldata hex strings
|
|
2540
|
+
*/
|
|
2541
|
+
declare function buildCuratorBatch(actions: CuratorAction[]): `0x${string}`[];
|
|
2542
|
+
/**
|
|
2543
|
+
* Submit a batch of curator actions to the vault's MulticallFacet.
|
|
2544
|
+
*
|
|
2545
|
+
* When `timeLockPeriod == 0` the contract immediately executes the actions
|
|
2546
|
+
* inside `submitActions` itself. When a timelock is configured the actions
|
|
2547
|
+
* are queued and must be executed later with `executeActions`.
|
|
2548
|
+
*
|
|
2549
|
+
* Uses the simulate-then-write pattern: simulation runs first so any on-chain
|
|
2550
|
+
* revert (wrong curator, bad selector, slippage limit, etc.) surfaces before
|
|
2551
|
+
* any gas is spent on a failing transaction.
|
|
2552
|
+
*
|
|
2553
|
+
* After the write succeeds, the function reads `getCurrentNonce` to determine
|
|
2554
|
+
* which nonce was assigned to this batch (nonce - 1 after the submit increments it).
|
|
2555
|
+
*
|
|
2556
|
+
* @param walletClient Wallet client with curator account attached
|
|
2557
|
+
* @param publicClient Public client for reads and simulation
|
|
2558
|
+
* @param vault Vault address (diamond proxy)
|
|
2559
|
+
* @param actions Array of raw calldata bytes — use `buildCuratorBatch` to build
|
|
2560
|
+
* @returns Transaction hash and the nonce assigned to this batch
|
|
2561
|
+
* @throws If the caller is not the curator, or any action selector is
|
|
2562
|
+
* not allowed, or any action would revert
|
|
2563
|
+
*/
|
|
2564
|
+
declare function submitActions(walletClient: WalletClient, publicClient: PublicClient, vault: Address, actions: `0x${string}`[]): Promise<SubmitActionsResult>;
|
|
2565
|
+
/**
|
|
2566
|
+
* Execute pending actions after their timelock period has expired.
|
|
2567
|
+
*
|
|
2568
|
+
* Can only be called when `block.timestamp >= pendingUntil`. The contract
|
|
2569
|
+
* reverts with `ActionsStillPending` if the timelock has not expired.
|
|
2570
|
+
*
|
|
2571
|
+
* Caller must be the curator (or any address when timeLockPeriod == 0, since
|
|
2572
|
+
* in that case `submitActions` auto-executes and there is nothing to execute here).
|
|
2573
|
+
*
|
|
2574
|
+
* Uses simulate-then-write to surface on-chain reverts early.
|
|
2575
|
+
*
|
|
2576
|
+
* @param walletClient Wallet client with curator account attached
|
|
2577
|
+
* @param publicClient Public client for reads and simulation
|
|
2578
|
+
* @param vault Vault address (diamond proxy)
|
|
2579
|
+
* @param nonce The action batch nonce to execute
|
|
2580
|
+
* @returns Transaction hash
|
|
2581
|
+
*/
|
|
2582
|
+
declare function executeActions(walletClient: WalletClient, publicClient: PublicClient, vault: Address, nonce: bigint): Promise<{
|
|
2583
|
+
txHash: `0x${string}`;
|
|
2584
|
+
}>;
|
|
2585
|
+
/**
|
|
2586
|
+
* Guardian-only: cancel (veto) one or more pending action batches.
|
|
2587
|
+
*
|
|
2588
|
+
* Deletes the pending actions from storage, preventing them from ever being
|
|
2589
|
+
* executed. Only the vault guardian can call this.
|
|
2590
|
+
*
|
|
2591
|
+
* Uses simulate-then-write to catch `NoSuchActions` and permission errors early.
|
|
2592
|
+
*
|
|
2593
|
+
* @param walletClient Wallet client with guardian account attached
|
|
2594
|
+
* @param publicClient Public client for reads and simulation
|
|
2595
|
+
* @param vault Vault address (diamond proxy)
|
|
2596
|
+
* @param nonces Array of action nonces to cancel
|
|
2597
|
+
* @returns Transaction hash
|
|
2598
|
+
*/
|
|
2599
|
+
declare function vetoActions(walletClient: WalletClient, publicClient: PublicClient, vault: Address, nonces: bigint[]): Promise<{
|
|
2600
|
+
txHash: `0x${string}`;
|
|
2601
|
+
}>;
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Curator swap helpers for Uniswap V3-compatible DEXes.
|
|
2605
|
+
*
|
|
2606
|
+
* Provides typed helpers to build CuratorAction objects and raw calldata for
|
|
2607
|
+
* Uniswap V3 exactInputSingle swaps, automatically resolving the correct router
|
|
2608
|
+
* and ABI variant (SwapRouter vs SwapRouter02) per chain.
|
|
2609
|
+
*
|
|
2610
|
+
* Supported chains and routers:
|
|
2611
|
+
* - Base (8453): SwapRouter02 0x2626... — NO deadline field
|
|
2612
|
+
* - Ethereum (1): SwapRouter 0xE592... — HAS deadline field
|
|
2613
|
+
* - Arbitrum (42161): SwapRouter 0xE592... — HAS deadline field
|
|
2614
|
+
* - Optimism (10): SwapRouter 0xE592... — HAS deadline field
|
|
2615
|
+
* - Flow EVM (747): FlowSwap V3 0xeEDC... — HAS deadline field
|
|
2616
|
+
*
|
|
2617
|
+
* @module curatorSwaps
|
|
2618
|
+
*/
|
|
2619
|
+
|
|
2620
|
+
/**
|
|
2621
|
+
* Encode Uniswap V3 exactInputSingle calldata directly.
|
|
2622
|
+
* For curators who want raw calldata without the CuratorAction wrapper.
|
|
2623
|
+
*
|
|
2624
|
+
* Automatically selects the correct ABI variant (SwapRouter vs SwapRouter02)
|
|
2625
|
+
* based on the chainId. The deadline (for SwapRouter chains) is set to
|
|
2626
|
+
* `now + 20 minutes` to prevent stale transactions from executing.
|
|
2627
|
+
*
|
|
2628
|
+
* @param params.chainId EVM chain ID — must be present in UNISWAP_V3_ROUTERS
|
|
2629
|
+
* @param params.tokenIn Input token address
|
|
2630
|
+
* @param params.tokenOut Output token address
|
|
2631
|
+
* @param params.fee Pool fee tier: 100, 500, 3000, or 10000
|
|
2632
|
+
* @param params.amountIn Exact input amount (in tokenIn units)
|
|
2633
|
+
* @param params.minAmountOut Minimum acceptable output (slippage protection)
|
|
2634
|
+
* @param params.recipient Address to receive the output tokens (usually the vault)
|
|
2635
|
+
* @returns The router contract address and ABI-encoded calldata
|
|
2636
|
+
* @throws If no router is configured for the given chainId
|
|
2637
|
+
*/
|
|
2638
|
+
declare function encodeUniswapV3SwapCalldata(params: {
|
|
2639
|
+
chainId: number;
|
|
2640
|
+
tokenIn: Address;
|
|
2641
|
+
tokenOut: Address;
|
|
2642
|
+
fee: number;
|
|
2643
|
+
amountIn: bigint;
|
|
2644
|
+
minAmountOut: bigint;
|
|
2645
|
+
recipient: Address;
|
|
2646
|
+
}): {
|
|
2647
|
+
targetContract: Address;
|
|
2648
|
+
swapCallData: `0x${string}`;
|
|
2649
|
+
};
|
|
2650
|
+
/**
|
|
2651
|
+
* Build a CuratorAction for a Uniswap V3 exactInputSingle swap.
|
|
2652
|
+
*
|
|
2653
|
+
* Automatically resolves the router address from UNISWAP_V3_ROUTERS and
|
|
2654
|
+
* selects the correct ABI struct (with or without deadline) based on chainId.
|
|
2655
|
+
*
|
|
2656
|
+
* The returned action is a `swap` variant ready to be passed to
|
|
2657
|
+
* `buildCuratorBatch` and then `submitActions`.
|
|
2658
|
+
*
|
|
2659
|
+
* @param params.chainId EVM chain ID — must be present in UNISWAP_V3_ROUTERS
|
|
2660
|
+
* @param params.tokenIn Input token address
|
|
2661
|
+
* @param params.tokenOut Output token address
|
|
2662
|
+
* @param params.fee Pool fee tier: 100, 500, 3000, or 10000
|
|
2663
|
+
* @param params.amountIn Exact input amount (in tokenIn units)
|
|
2664
|
+
* @param params.minAmountOut Minimum acceptable output (slippage protection)
|
|
2665
|
+
* @param params.recipient Address to receive output tokens (usually the vault)
|
|
2666
|
+
* @returns A typed CuratorAction ready for buildCuratorBatch
|
|
2667
|
+
* @throws If no router is configured for the given chainId
|
|
2668
|
+
*
|
|
2669
|
+
* @example
|
|
2670
|
+
* ```typescript
|
|
2671
|
+
* const action = buildUniswapV3Swap({
|
|
2672
|
+
* chainId: 8453,
|
|
2673
|
+
* tokenIn: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
|
|
2674
|
+
* tokenOut: '0x4200000000000000000000000000000000000006', // WETH
|
|
2675
|
+
* fee: 500, // 0.05% pool
|
|
2676
|
+
* amountIn: 150_000n, // 0.15 USDC (6 decimals)
|
|
2677
|
+
* minAmountOut: 1n, // accept any amount (set properly in production)
|
|
2678
|
+
* recipient: VAULT,
|
|
2679
|
+
* })
|
|
2680
|
+
* const batch = buildCuratorBatch([action])
|
|
2681
|
+
* await submitActions(walletClient, publicClient, vault, batch)
|
|
2682
|
+
* ```
|
|
2683
|
+
*/
|
|
2684
|
+
declare function buildUniswapV3Swap(params: {
|
|
2685
|
+
chainId: number;
|
|
2686
|
+
tokenIn: Address;
|
|
2687
|
+
tokenOut: Address;
|
|
2688
|
+
fee: number;
|
|
2689
|
+
amountIn: bigint;
|
|
2690
|
+
minAmountOut: bigint;
|
|
2691
|
+
recipient: Address;
|
|
2692
|
+
}): CuratorAction;
|
|
2300
2693
|
|
|
2301
2694
|
/**
|
|
2302
2695
|
* Cast a wagmi PublicClient to the SDK's expected type.
|
|
@@ -2312,4 +2705,4 @@ declare function isCurator(publicClient: PublicClient, vault: Address, address:
|
|
|
2312
2705
|
*/
|
|
2313
2706
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
2314
2707
|
|
|
2315
|
-
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type CuratorAction, type CuratorVaultStatus, DEX_ABI, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type PendingAction, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, type SubmitActionsResult, type SwapParams, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getCuratorVaultStatus, getPendingActions, getWithdrawalRequest, isCurator, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
|
2708
|
+
export { ActionType, type ActionTypeValue, type AssetBalance, type AssetInfo, type AsyncRequestResult, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type CuratorAction, type CuratorVaultStatus, DEX_ABI, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type PendingAction, REGISTRY_ABI, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, type SubmitActionsResult, type SwapParams, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, type VaultAddresses, type VaultAnalysis, type VaultAssetBreakdown, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, encodeCuratorAction, encodeUniswapV3SwapCalldata, executeActions, executeCompose, getCuratorVaultStatus, getPendingActions, getVaultAnalysis, getVaultAssetBreakdown, getWithdrawalRequest, isCurator, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|