@oydual31/more-vaults-sdk 0.1.5 → 0.1.8
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/{topology-8tTSPMpL.d.cts → distribution-CnFU3szC.d.cts} +67 -1
- package/dist/{topology-8tTSPMpL.d.ts → distribution-CnFU3szC.d.ts} +67 -1
- package/dist/ethers/index.cjs +1 -1
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +8 -4
- package/dist/ethers/index.d.ts +8 -4
- package/dist/ethers/index.js +1 -1
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +120 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +27 -2
- package/dist/react/index.d.ts +27 -2
- package/dist/react/index.js +122 -7
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +512 -5
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +396 -6
- package/dist/viem/index.d.ts +396 -6
- package/dist/viem/index.js +505 -7
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/chains.ts +6 -2
- package/src/ethers/crossChainFlows.ts +1 -1
- package/src/ethers/redeemFlows.ts +1 -1
- package/src/react/index.ts +3 -0
- package/src/react/useVaultDistribution.ts +83 -0
- package/src/viem/chains.ts +202 -2
- package/src/viem/crossChainFlows.ts +1 -1
- package/src/viem/distribution.ts +149 -0
- package/src/viem/index.ts +9 -1
- package/src/viem/redeemFlows.ts +1 -1
- package/src/viem/spokeRoutes.ts +210 -0
|
@@ -347,4 +347,70 @@ declare function isOnHubChain(currentChainId: number, topology: VaultTopology):
|
|
|
347
347
|
*/
|
|
348
348
|
declare function getAllVaultChainIds(topology: VaultTopology): number[];
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
interface SpokeBalance {
|
|
351
|
+
chainId: number;
|
|
352
|
+
totalAssets: bigint;
|
|
353
|
+
/** false if the RPC call to this spoke failed */
|
|
354
|
+
isReachable: boolean;
|
|
355
|
+
}
|
|
356
|
+
interface VaultDistribution {
|
|
357
|
+
hubChainId: number;
|
|
358
|
+
/** Underlying token balance idle on the hub (not deployed to strategies) */
|
|
359
|
+
hubLiquidBalance: bigint;
|
|
360
|
+
/** Hub totalAssets minus hubLiquidBalance (capital in Morpho, Aave, etc.) */
|
|
361
|
+
hubStrategyBalance: bigint;
|
|
362
|
+
/** Hub vault totalAssets() */
|
|
363
|
+
hubTotalAssets: bigint;
|
|
364
|
+
/** What the hub's accounting thinks is deployed on spokes */
|
|
365
|
+
spokesDeployedBalance: bigint;
|
|
366
|
+
/** Actual per-spoke balances read directly from each spoke chain */
|
|
367
|
+
spokeBalances: SpokeBalance[];
|
|
368
|
+
/** hubTotalAssets + sum of reachable spoke totalAssets */
|
|
369
|
+
totalActual: bigint;
|
|
370
|
+
oracleAccountingEnabled: boolean;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Read the full cross-chain capital distribution of a vault.
|
|
374
|
+
*
|
|
375
|
+
* Queries the hub for its status, then reads `totalAssets()` on each spoke
|
|
376
|
+
* chain in parallel. Spoke calls are individually wrapped so a single
|
|
377
|
+
* unreachable RPC never fails the entire call.
|
|
378
|
+
*
|
|
379
|
+
* @param hubClient Public client connected to the hub chain
|
|
380
|
+
* @param vault Vault address (same on all chains via CREATE3)
|
|
381
|
+
* @param spokeClients Map of chainId → PublicClient for each spoke chain
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```ts
|
|
385
|
+
* const dist = await getVaultDistribution(baseClient, VAULT, {
|
|
386
|
+
* [1]: ethClient,
|
|
387
|
+
* [42161]: arbClient,
|
|
388
|
+
* })
|
|
389
|
+
* console.log(`Hub liquid: ${dist.hubLiquidBalance}`)
|
|
390
|
+
* console.log(`Total actual: ${dist.totalActual}`)
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
declare function getVaultDistribution(hubClient: PublicClient, vault: Address, spokeClients: Record<number, PublicClient>): Promise<VaultDistribution>;
|
|
394
|
+
/**
|
|
395
|
+
* Hub-only distribution — uses topology to discover spokes but does NOT
|
|
396
|
+
* read spoke chains (no spoke clients needed).
|
|
397
|
+
*
|
|
398
|
+
* Returns hub data plus the list of spoke chainIds from the factory.
|
|
399
|
+
* `spokeBalances` will be empty — callers must provide spoke clients to
|
|
400
|
+
* `getVaultDistribution` for actual spoke reads.
|
|
401
|
+
*
|
|
402
|
+
* @param hubClient Public client connected to the hub chain
|
|
403
|
+
* @param vault Vault address
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* const dist = await getVaultDistributionWithTopology(baseClient, VAULT)
|
|
408
|
+
* // dist.spokeBalances === [] (no spoke clients provided)
|
|
409
|
+
* // dist.spokeChainIds tells you which chains to query
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
declare function getVaultDistributionWithTopology(hubClient: PublicClient, vault: Address): Promise<VaultDistribution & {
|
|
413
|
+
spokeChainIds: number[];
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
export { type AsyncRequestStatus as A, previewRedeem as B, quoteLzFee as C, type DepositBlockReason as D, type MaxWithdrawable as M, OMNI_FACTORY_ADDRESS as O, type SpokeBalance as S, type UserBalances as U, type VaultDistribution as V, type AsyncRequestStatusInfo as a, type DepositEligibility as b, type UserPosition as c, type VaultMetadata as d, type VaultMode as e, type VaultStatus as f, type VaultSummary as g, type VaultTopology as h, canDeposit as i, ensureAllowance as j, getAllVaultChainIds as k, getAsyncRequestStatus as l, getAsyncRequestStatusLabel as m, getFullVaultTopology as n, getMaxWithdrawable as o, getUserBalances as p, getUserPosition as q, getVaultDistribution as r, getVaultDistributionWithTopology as s, getVaultMetadata as t, getVaultStatus as u, getVaultSummary as v, getVaultTopology as w, isAsyncMode as x, isOnHubChain as y, previewDeposit as z };
|
|
@@ -347,4 +347,70 @@ declare function isOnHubChain(currentChainId: number, topology: VaultTopology):
|
|
|
347
347
|
*/
|
|
348
348
|
declare function getAllVaultChainIds(topology: VaultTopology): number[];
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
interface SpokeBalance {
|
|
351
|
+
chainId: number;
|
|
352
|
+
totalAssets: bigint;
|
|
353
|
+
/** false if the RPC call to this spoke failed */
|
|
354
|
+
isReachable: boolean;
|
|
355
|
+
}
|
|
356
|
+
interface VaultDistribution {
|
|
357
|
+
hubChainId: number;
|
|
358
|
+
/** Underlying token balance idle on the hub (not deployed to strategies) */
|
|
359
|
+
hubLiquidBalance: bigint;
|
|
360
|
+
/** Hub totalAssets minus hubLiquidBalance (capital in Morpho, Aave, etc.) */
|
|
361
|
+
hubStrategyBalance: bigint;
|
|
362
|
+
/** Hub vault totalAssets() */
|
|
363
|
+
hubTotalAssets: bigint;
|
|
364
|
+
/** What the hub's accounting thinks is deployed on spokes */
|
|
365
|
+
spokesDeployedBalance: bigint;
|
|
366
|
+
/** Actual per-spoke balances read directly from each spoke chain */
|
|
367
|
+
spokeBalances: SpokeBalance[];
|
|
368
|
+
/** hubTotalAssets + sum of reachable spoke totalAssets */
|
|
369
|
+
totalActual: bigint;
|
|
370
|
+
oracleAccountingEnabled: boolean;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Read the full cross-chain capital distribution of a vault.
|
|
374
|
+
*
|
|
375
|
+
* Queries the hub for its status, then reads `totalAssets()` on each spoke
|
|
376
|
+
* chain in parallel. Spoke calls are individually wrapped so a single
|
|
377
|
+
* unreachable RPC never fails the entire call.
|
|
378
|
+
*
|
|
379
|
+
* @param hubClient Public client connected to the hub chain
|
|
380
|
+
* @param vault Vault address (same on all chains via CREATE3)
|
|
381
|
+
* @param spokeClients Map of chainId → PublicClient for each spoke chain
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```ts
|
|
385
|
+
* const dist = await getVaultDistribution(baseClient, VAULT, {
|
|
386
|
+
* [1]: ethClient,
|
|
387
|
+
* [42161]: arbClient,
|
|
388
|
+
* })
|
|
389
|
+
* console.log(`Hub liquid: ${dist.hubLiquidBalance}`)
|
|
390
|
+
* console.log(`Total actual: ${dist.totalActual}`)
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
declare function getVaultDistribution(hubClient: PublicClient, vault: Address, spokeClients: Record<number, PublicClient>): Promise<VaultDistribution>;
|
|
394
|
+
/**
|
|
395
|
+
* Hub-only distribution — uses topology to discover spokes but does NOT
|
|
396
|
+
* read spoke chains (no spoke clients needed).
|
|
397
|
+
*
|
|
398
|
+
* Returns hub data plus the list of spoke chainIds from the factory.
|
|
399
|
+
* `spokeBalances` will be empty — callers must provide spoke clients to
|
|
400
|
+
* `getVaultDistribution` for actual spoke reads.
|
|
401
|
+
*
|
|
402
|
+
* @param hubClient Public client connected to the hub chain
|
|
403
|
+
* @param vault Vault address
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* const dist = await getVaultDistributionWithTopology(baseClient, VAULT)
|
|
408
|
+
* // dist.spokeBalances === [] (no spoke clients provided)
|
|
409
|
+
* // dist.spokeChainIds tells you which chains to query
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
declare function getVaultDistributionWithTopology(hubClient: PublicClient, vault: Address): Promise<VaultDistribution & {
|
|
413
|
+
spokeChainIds: number[];
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
export { type AsyncRequestStatus as A, previewRedeem as B, quoteLzFee as C, type DepositBlockReason as D, type MaxWithdrawable as M, OMNI_FACTORY_ADDRESS as O, type SpokeBalance as S, type UserBalances as U, type VaultDistribution as V, type AsyncRequestStatusInfo as a, type DepositEligibility as b, type UserPosition as c, type VaultMetadata as d, type VaultMode as e, type VaultStatus as f, type VaultSummary as g, type VaultTopology as h, canDeposit as i, ensureAllowance as j, getAllVaultChainIds as k, getAsyncRequestStatus as l, getAsyncRequestStatusLabel as m, getFullVaultTopology as n, getMaxWithdrawable as o, getUserBalances as p, getUserPosition as q, getVaultDistribution as r, getVaultDistributionWithTopology as s, getVaultMetadata as t, getVaultStatus as u, getVaultSummary as v, getVaultTopology as w, isAsyncMode as x, isOnHubChain as y, previewDeposit as z };
|