@gearbox-protocol/sdk 14.12.0-next.17 → 14.12.0-next.18
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/cjs/abi/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +49 -6
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/cjs/dev/index.js +3 -1
- package/dist/cjs/dev/withdrawalAbi.js +2105 -0
- package/dist/cjs/dev/withdrawalUtils.js +271 -0
- package/dist/cjs/permissionless/bindings/factory/rate-keeper-factory.js +35 -0
- package/dist/cjs/permissionless/bindings/market-configurator.js +11 -0
- package/dist/cjs/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +1015 -0
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +6 -6
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +9 -9
- package/dist/cjs/plugins/adapters/abi/adapters/index.js +6 -4
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/cjs/plugins/adapters/abi/targetContractAbi.js +3 -3
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +121 -0
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/index.js +2 -0
- package/dist/cjs/plugins/adapters/createAdapter.js +2 -0
- package/dist/cjs/plugins/adapters/types.js +1 -0
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +20 -37
- package/dist/cjs/sdk/OnchainSDK.js +11 -0
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +9 -55
- package/dist/cjs/sdk/accounts/index.js +3 -1
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +229 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +52 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +53 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/index.js +36 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/intent.js +172 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/types.js +16 -0
- package/dist/esm/abi/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +45 -2
- package/dist/esm/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/esm/dev/index.js +1 -0
- package/dist/esm/dev/withdrawalAbi.js +2074 -0
- package/dist/esm/dev/withdrawalUtils.js +259 -0
- package/dist/esm/permissionless/bindings/factory/rate-keeper-factory.js +11 -0
- package/dist/esm/permissionless/bindings/market-configurator.js +11 -0
- package/dist/esm/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +990 -0
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +2 -2
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +4 -4
- package/dist/esm/plugins/adapters/abi/adapters/index.js +3 -2
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/esm/plugins/adapters/abi/targetContractAbi.js +2 -2
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +104 -0
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/index.js +1 -0
- package/dist/esm/plugins/adapters/createAdapter.js +3 -0
- package/dist/esm/plugins/adapters/types.js +1 -0
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +21 -39
- package/dist/esm/sdk/OnchainSDK.js +13 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +8 -53
- package/dist/esm/sdk/accounts/index.js +1 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +205 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +28 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +29 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/index.js +8 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/intent.js +137 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/types.js +0 -0
- package/dist/types/abi/{IWithdrawalCompressorV312.d.ts → IWithdrawalCompressorV313.d.ts} +74 -1
- package/dist/types/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/withdrawalCompressor.d.ts +77 -0
- package/dist/types/dev/index.d.ts +1 -0
- package/dist/types/dev/withdrawalAbi.d.ts +1584 -0
- package/dist/types/dev/withdrawalUtils.d.ts +19 -0
- package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +77 -0
- package/dist/types/permissionless/bindings/factory/rate-keeper-factory.d.ts +179 -0
- package/dist/types/permissionless/bindings/market-configurator.d.ts +2 -0
- package/dist/types/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.d.ts +754 -0
- package/dist/types/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.d.ts → iMidasIssuanceVaultAdapterV310.d.ts} +1 -1
- package/dist/types/plugins/adapters/abi/adapters/{iMidasRedemptionVault.d.ts → iMidasRedemptionVaultAdapterV310.d.ts} +2 -2
- package/dist/types/plugins/adapters/abi/adapters/index.d.ts +3 -2
- package/dist/types/plugins/adapters/abi/targetContractAbi.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +790 -0
- package/dist/types/plugins/adapters/contracts/index.d.ts +1 -0
- package/dist/types/plugins/adapters/types.d.ts +2 -1
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +4 -17
- package/dist/types/sdk/OnchainSDK.d.ts +10 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +3 -11
- package/dist/types/sdk/accounts/index.d.ts +1 -0
- package/dist/types/sdk/accounts/types.d.ts +4 -18
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +35 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.d.ts +334 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.d.ts +338 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +300 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/addresses.d.ts +21 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +11 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/index.d.ts +8 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/intent.d.ts +106 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +122 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ export * from "./MellowClaimerAdapterContract.js";
|
|
|
23
23
|
export * from "./MellowDVVAdapterContract.js";
|
|
24
24
|
export * from "./MellowERC4626VaultAdapterContract.js";
|
|
25
25
|
export * from "./MellowWrapperAdapterContract.js";
|
|
26
|
+
export * from "./MidasGatewayAdapterContract.js";
|
|
26
27
|
export * from "./MidasIssuanceVaultAdapterContract.js";
|
|
27
28
|
export * from "./MidasRedemptionVaultAdapterContract.js";
|
|
28
29
|
export * from "./PendleRouterAdapterContract.js";
|
|
@@ -3,7 +3,7 @@ import type { OnchainSDK, PluginsMap } from "../../sdk/index.js";
|
|
|
3
3
|
import type { BaseContractStateHuman } from "../../sdk/types/state-human.js";
|
|
4
4
|
import type { AdaptersPlugin } from "./AdaptersPlugin.js";
|
|
5
5
|
export type VersionedAbi = Record<number, readonly AbiParameter[]>;
|
|
6
|
-
export type AdapterContractType = "ADAPTER::ACCOUNT_MIGRATOR" | "ADAPTER::BALANCER_V3_ROUTER" | "ADAPTER::BALANCER_V3_WRAPPER" | "ADAPTER::CAMELOT_V3_ROUTER" | "ADAPTER::CURVE_STABLE_NG" | "ADAPTER::CURVE_V1_2ASSETS" | "ADAPTER::CURVE_V1_3ASSETS" | "ADAPTER::CURVE_V1_4ASSETS" | "ADAPTER::CURVE_V1_STECRV_POOL" | "ADAPTER::CVX_V1_BASE_REWARD_POOL" | "ADAPTER::CVX_V1_BOOSTER" | "ADAPTER::DAI_USDS_EXCHANGE" | "ADAPTER::ERC4626_VAULT" | "ADAPTER::ERC4626_VAULT_REFERRAL" | "ADAPTER::FLUID_DEX" | "ADAPTER::INFINIFI_GATEWAY" | "ADAPTER::INFINIFI_UNWINDING" | "ADAPTER::KELP_DEPOSIT_POOL" | "ADAPTER::KELP_WITHDRAWAL" | "ADAPTER::LIDO_V1" | "ADAPTER::LIDO_WSTETH_V1" | "ADAPTER::MELLOW_CLAIMER" | "ADAPTER::MELLOW_DVV" | "ADAPTER::MELLOW_ERC4626_VAULT" | "ADAPTER::MELLOW_WRAPPER" | "ADAPTER::MIDAS_ISSUANCE_VAULT" | "ADAPTER::MIDAS_REDEMPTION_VAULT" | "ADAPTER::PENDLE_ROUTER" | "ADAPTER::SECURITIZE_ONRAMP" | "ADAPTER::SECURITIZE_REDEMPTION" | "ADAPTER::STAKING_REWARDS" | "ADAPTER::TRADERJOE_ROUTER" | "ADAPTER::UNISWAP_V2_ROUTER" | "ADAPTER::UNISWAP_V3_ROUTER" | "ADAPTER::UNISWAP_V4_GATEWAY" | "ADAPTER::UPSHIFT_VAULT" | "ADAPTER::VELODROME_V2_ROUTER";
|
|
6
|
+
export type AdapterContractType = "ADAPTER::ACCOUNT_MIGRATOR" | "ADAPTER::BALANCER_V3_ROUTER" | "ADAPTER::BALANCER_V3_WRAPPER" | "ADAPTER::CAMELOT_V3_ROUTER" | "ADAPTER::CURVE_STABLE_NG" | "ADAPTER::CURVE_V1_2ASSETS" | "ADAPTER::CURVE_V1_3ASSETS" | "ADAPTER::CURVE_V1_4ASSETS" | "ADAPTER::CURVE_V1_STECRV_POOL" | "ADAPTER::CVX_V1_BASE_REWARD_POOL" | "ADAPTER::CVX_V1_BOOSTER" | "ADAPTER::DAI_USDS_EXCHANGE" | "ADAPTER::ERC4626_VAULT" | "ADAPTER::ERC4626_VAULT_REFERRAL" | "ADAPTER::FLUID_DEX" | "ADAPTER::INFINIFI_GATEWAY" | "ADAPTER::INFINIFI_UNWINDING" | "ADAPTER::KELP_DEPOSIT_POOL" | "ADAPTER::KELP_WITHDRAWAL" | "ADAPTER::LIDO_V1" | "ADAPTER::LIDO_WSTETH_V1" | "ADAPTER::MELLOW_CLAIMER" | "ADAPTER::MELLOW_DVV" | "ADAPTER::MELLOW_ERC4626_VAULT" | "ADAPTER::MELLOW_WRAPPER" | "ADAPTER::MIDAS_GATEWAY" | "ADAPTER::MIDAS_ISSUANCE_VAULT" | "ADAPTER::MIDAS_REDEMPTION_VAULT" | "ADAPTER::PENDLE_ROUTER" | "ADAPTER::SECURITIZE_ONRAMP" | "ADAPTER::SECURITIZE_REDEMPTION" | "ADAPTER::STAKING_REWARDS" | "ADAPTER::TRADERJOE_ROUTER" | "ADAPTER::UNISWAP_V2_ROUTER" | "ADAPTER::UNISWAP_V3_ROUTER" | "ADAPTER::UNISWAP_V4_GATEWAY" | "ADAPTER::UPSHIFT_VAULT" | "ADAPTER::VELODROME_V2_ROUTER";
|
|
7
7
|
export declare enum AdapterType {
|
|
8
8
|
ACCOUNT_MIGRATOR = "ACCOUNT_MIGRATOR",
|
|
9
9
|
BALANCER_V3_ROUTER = "BALANCER_V3_ROUTER",
|
|
@@ -30,6 +30,7 @@ export declare enum AdapterType {
|
|
|
30
30
|
MELLOW_DVV = "MELLOW_DVV",
|
|
31
31
|
MELLOW_ERC4626_VAULT = "MELLOW_ERC4626_VAULT",
|
|
32
32
|
MELLOW_WRAPPER = "MELLOW_WRAPPER",
|
|
33
|
+
MIDAS_GATEWAY = "MIDAS_GATEWAY",
|
|
33
34
|
MIDAS_ISSUANCE_VAULT = "MIDAS_ISSUANCE_VAULT",
|
|
34
35
|
MIDAS_REDEMPTION_VAULT = "MIDAS_REDEMPTION_VAULT",
|
|
35
36
|
PENDLE_ROUTER = "PENDLE_ROUTER",
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { iWithdrawalCompressorV311Abi } from "../../abi/IWithdrawalCompressorV311.js";
|
|
4
|
-
import type { BaseContractStateHuman } from "../../sdk/index.js";
|
|
5
|
-
type WithdrawalCompressorV310InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV310Abi, PublicClient>;
|
|
6
|
-
type WithdrawalCompressorV311InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV311Abi, PublicClient>;
|
|
7
|
-
type WithdrawableAssetV310 = Awaited<ReturnType<WithdrawalCompressorV310InstanceType["read"]["getWithdrawableAssets"]>>[number] & {
|
|
8
|
-
creditManager: Address;
|
|
1
|
+
import type { BaseContractStateHuman, WithdrawableAsset as WithdrawableAssetBase } from "../../sdk/index.js";
|
|
2
|
+
export interface WithdrawableAsset extends WithdrawableAssetBase {
|
|
9
3
|
disabled: boolean;
|
|
10
|
-
};
|
|
11
|
-
type WithdrawableAssetV311 = Awaited<ReturnType<WithdrawalCompressorV311InstanceType["read"]["getWithdrawableAssets"]>>[number] & {
|
|
12
|
-
creditManager: Address;
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
};
|
|
15
|
-
type CommonType = WithdrawableAssetV310 & Partial<Omit<WithdrawableAssetV311, keyof WithdrawableAssetV310>>;
|
|
16
|
-
export type WithdrawableAsset = CommonType;
|
|
17
|
-
export interface WithdrawableAssetStateHuman extends CommonType, BaseContractStateHuman {
|
|
18
4
|
}
|
|
19
|
-
export {
|
|
5
|
+
export interface WithdrawableAssetStateHuman extends WithdrawableAsset, BaseContractStateHuman {
|
|
6
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import { type PublicClient, type Transport } from "viem";
|
|
3
3
|
import type { HttpRpcClientOptions } from "viem/utils";
|
|
4
|
-
import { type ICreditAccountsService } from "./accounts/index.js";
|
|
4
|
+
import { type ICreditAccountsService, type IWithdrawalCompressorContract, type WithdrawalCompressorVersion } from "./accounts/index.js";
|
|
5
5
|
import type { BaseState, IBaseContract } from "./base/index.js";
|
|
6
6
|
import { ChainContractsRegister } from "./base/index.js";
|
|
7
7
|
import type { GearboxChain, NetworkType } from "./chain/chains.js";
|
|
@@ -286,4 +286,13 @@ export declare class OnchainSDK<const Plugins extends PluginsMap = {}> extends C
|
|
|
286
286
|
} | {
|
|
287
287
|
creditFacade: Address | BaseState | IBaseContract;
|
|
288
288
|
} | VersionRange): IRouterContract;
|
|
289
|
+
/**
|
|
290
|
+
* Lazily returns a withdrawal compressor contract for the current chain.
|
|
291
|
+
*
|
|
292
|
+
* @param version - Desired compressor version; when omitted, the latest
|
|
293
|
+
* version supported on the current chain is used.
|
|
294
|
+
* @throws If no withdrawal compressor of the given version is supported
|
|
295
|
+
* on the current chain.
|
|
296
|
+
**/
|
|
297
|
+
withdrawalCompressor(version?: WithdrawalCompressorVersion): IWithdrawalCompressorContract;
|
|
289
298
|
}
|
|
@@ -6,7 +6,8 @@ import type { RWAOpenAccountRequirements } from "../market/rwa/index.js";
|
|
|
6
6
|
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
7
7
|
import type { RouterCASlice } from "../router/index.js";
|
|
8
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
9
|
-
import type { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps,
|
|
9
|
+
import type { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js";
|
|
10
|
+
import type { RequestableWithdrawal } from "./withdrawal-compressor/index.js";
|
|
10
11
|
/**
|
|
11
12
|
* Options for configuring the credit account service.
|
|
12
13
|
**/
|
|
@@ -17,15 +18,6 @@ export interface CreditAccountServiceOptions {
|
|
|
17
18
|
**/
|
|
18
19
|
batchSize?: number;
|
|
19
20
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns the withdrawal compressor contract address for the given chain, or `undefined` if none is configured.
|
|
22
|
-
* @param chainId - Numeric chain ID.
|
|
23
|
-
* @returns Withdrawal compressor address, or `undefined`.
|
|
24
|
-
**/
|
|
25
|
-
export declare function getWithdrawalCompressorAddress(chainId: number): {
|
|
26
|
-
address: Address;
|
|
27
|
-
version: 311 | 310;
|
|
28
|
-
};
|
|
29
21
|
/**
|
|
30
22
|
* Service for querying and operating on Gearbox credit accounts.
|
|
31
23
|
*
|
|
@@ -102,7 +94,7 @@ export declare class CreditAccountsServiceV310 extends SDKConstruct implements I
|
|
|
102
94
|
/**
|
|
103
95
|
* {@inheritDoc ICreditAccountsService.previewDelayedWithdrawal}
|
|
104
96
|
**/
|
|
105
|
-
previewDelayedWithdrawal({ creditAccount, amount, token, }: PreviewDelayedWithdrawalProps): Promise<
|
|
97
|
+
previewDelayedWithdrawal({ creditAccount, amount, token, }: PreviewDelayedWithdrawalProps): Promise<RequestableWithdrawal>;
|
|
106
98
|
/**
|
|
107
99
|
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
108
100
|
**/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Address, ContractFunctionArgs,
|
|
1
|
+
import type { Address, ContractFunctionArgs, Hex } from "viem";
|
|
2
2
|
import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
|
|
3
|
-
import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
4
3
|
import type { Asset, ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
|
|
5
4
|
import type { CreditSuite, PriceUpdate, RWAOperationArgs } from "../market/index.js";
|
|
6
5
|
import type { RWAOpenAccountRequirements } from "../market/rwa/index.js";
|
|
7
6
|
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
8
7
|
import type { RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
9
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
9
|
+
import type { ClaimableWithdrawal, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
* Arguments tuple for the credit account compressor's `getCreditAccounts` view method.
|
|
@@ -347,20 +347,6 @@ export interface GetPendingWithdrawalsProps {
|
|
|
347
347
|
*/
|
|
348
348
|
creditAccount: Address;
|
|
349
349
|
}
|
|
350
|
-
type WithdrawalCompressorV310InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV310Abi, PublicClient>;
|
|
351
|
-
/**
|
|
352
|
-
* Result of previewing a delayed withdrawal request, as returned by the withdrawal compressor.
|
|
353
|
-
**/
|
|
354
|
-
export type PreviewDelayedWithdrawalResult = Awaited<ReturnType<WithdrawalCompressorV310InstanceType["read"]["getWithdrawalRequestResult"]>>;
|
|
355
|
-
type PendingWithdrawalResult = Awaited<ReturnType<WithdrawalCompressorV310InstanceType["read"]["getCurrentWithdrawals"]>>;
|
|
356
|
-
/**
|
|
357
|
-
* A single pending delayed withdrawal that is not yet claimable.
|
|
358
|
-
**/
|
|
359
|
-
export type PendingWithdrawal = PendingWithdrawalResult[1][number];
|
|
360
|
-
/**
|
|
361
|
-
* A single delayed withdrawal that is ready to be claimed.
|
|
362
|
-
**/
|
|
363
|
-
export type ClaimableWithdrawal = PendingWithdrawalResult[0][number];
|
|
364
350
|
/**
|
|
365
351
|
* Aggregated delayed withdrawal status, split into immediately claimable and still-pending entries.
|
|
366
352
|
**/
|
|
@@ -378,7 +364,7 @@ export interface StartDelayedWithdrawalProps extends PrepareUpdateQuotasProps {
|
|
|
378
364
|
/**
|
|
379
365
|
* Withdrawal preview
|
|
380
366
|
*/
|
|
381
|
-
preview:
|
|
367
|
+
preview: RequestableWithdrawal;
|
|
382
368
|
/**
|
|
383
369
|
* Minimal credit account data on which operation is performed
|
|
384
370
|
*/
|
|
@@ -890,7 +876,7 @@ export interface ICreditAccountsService extends Construct {
|
|
|
890
876
|
* @param props - {@link PreviewDelayedWithdrawalProps}
|
|
891
877
|
* @returns
|
|
892
878
|
*/
|
|
893
|
-
previewDelayedWithdrawal(props: PreviewDelayedWithdrawalProps): Promise<
|
|
879
|
+
previewDelayedWithdrawal(props: PreviewDelayedWithdrawalProps): Promise<RequestableWithdrawal>;
|
|
894
880
|
/**
|
|
895
881
|
* Get claimable and pending withdrawals of an account
|
|
896
882
|
* @param props - {@link GetPendingWithdrawalsProps}
|
package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Abi, Address } from "viem";
|
|
2
|
+
import type { BaseContractArgs } from "../../base/index.js";
|
|
3
|
+
import { BaseContract } from "../../base/index.js";
|
|
4
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
|
+
import type { DelayedIntent } from "./intent.js";
|
|
6
|
+
import type { CurrentWithdrawals, IWithdrawalCompressorContract, RequestableWithdrawal, WithdrawableAsset } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Base class for WithdrawalCompressor contracts of different versions.
|
|
9
|
+
* Implements version-agnostic reads, normalizing results to common types.
|
|
10
|
+
**/
|
|
11
|
+
export declare abstract class AbstractWithdrawalCompressorContract<abi extends Abi> extends BaseContract<abi> implements IWithdrawalCompressorContract {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(sdk: OnchainSDK, args: BaseContractArgs<abi>);
|
|
14
|
+
/**
|
|
15
|
+
* The contract is instantiated with the actual versioned ABI,
|
|
16
|
+
* this cast is type-level only (see {@link CommonAbi}).
|
|
17
|
+
**/
|
|
18
|
+
private get common();
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritDoc IWithdrawalCompressorContract.getWithdrawableAssets}
|
|
21
|
+
**/
|
|
22
|
+
getWithdrawableAssets(creditManager: Address): Promise<WithdrawableAsset[]>;
|
|
23
|
+
/**
|
|
24
|
+
* {@inheritDoc IWithdrawalCompressorContract.getWithdrawableAssetsBatch}
|
|
25
|
+
**/
|
|
26
|
+
getWithdrawableAssetsBatch(creditManagers?: Address[]): Promise<WithdrawableAsset[]>;
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc IWithdrawalCompressorContract.getCurrentWithdrawals}
|
|
29
|
+
**/
|
|
30
|
+
getCurrentWithdrawals(creditAccount: Address): Promise<CurrentWithdrawals>;
|
|
31
|
+
/**
|
|
32
|
+
* {@inheritDoc IWithdrawalCompressorContract.getWithdrawalRequestResult}
|
|
33
|
+
**/
|
|
34
|
+
getWithdrawalRequestResult(creditAccount: Address, token: Address, amount: bigint, intent?: DelayedIntent): Promise<RequestableWithdrawal>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
4
|
+
declare const abi: readonly [{
|
|
5
|
+
readonly type: "constructor";
|
|
6
|
+
readonly inputs: readonly [{
|
|
7
|
+
readonly name: "_owner";
|
|
8
|
+
readonly internalType: "address";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "addressProvider_";
|
|
12
|
+
readonly internalType: "address";
|
|
13
|
+
readonly type: "address";
|
|
14
|
+
}];
|
|
15
|
+
readonly stateMutability: "nonpayable";
|
|
16
|
+
}, {
|
|
17
|
+
readonly type: "function";
|
|
18
|
+
readonly inputs: readonly [];
|
|
19
|
+
readonly name: "addressProvider";
|
|
20
|
+
readonly outputs: readonly [{
|
|
21
|
+
readonly name: "";
|
|
22
|
+
readonly internalType: "address";
|
|
23
|
+
readonly type: "address";
|
|
24
|
+
}];
|
|
25
|
+
readonly stateMutability: "view";
|
|
26
|
+
}, {
|
|
27
|
+
readonly type: "function";
|
|
28
|
+
readonly inputs: readonly [{
|
|
29
|
+
readonly name: "";
|
|
30
|
+
readonly internalType: "bytes32";
|
|
31
|
+
readonly type: "bytes32";
|
|
32
|
+
}];
|
|
33
|
+
readonly name: "compressorTypeToCompressor";
|
|
34
|
+
readonly outputs: readonly [{
|
|
35
|
+
readonly name: "";
|
|
36
|
+
readonly internalType: "address";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}];
|
|
39
|
+
readonly stateMutability: "view";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
readonly inputs: readonly [];
|
|
43
|
+
readonly name: "contractType";
|
|
44
|
+
readonly outputs: readonly [{
|
|
45
|
+
readonly name: "";
|
|
46
|
+
readonly internalType: "bytes32";
|
|
47
|
+
readonly type: "bytes32";
|
|
48
|
+
}];
|
|
49
|
+
readonly stateMutability: "view";
|
|
50
|
+
}, {
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
readonly inputs: readonly [{
|
|
53
|
+
readonly name: "creditAccount";
|
|
54
|
+
readonly internalType: "address";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}];
|
|
57
|
+
readonly name: "getCurrentWithdrawals";
|
|
58
|
+
readonly outputs: readonly [{
|
|
59
|
+
readonly name: "";
|
|
60
|
+
readonly internalType: "struct ClaimableWithdrawal[]";
|
|
61
|
+
readonly type: "tuple[]";
|
|
62
|
+
readonly components: readonly [{
|
|
63
|
+
readonly name: "token";
|
|
64
|
+
readonly internalType: "address";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "withdrawalPhantomToken";
|
|
68
|
+
readonly internalType: "address";
|
|
69
|
+
readonly type: "address";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "withdrawalTokenSpent";
|
|
72
|
+
readonly internalType: "uint256";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "outputs";
|
|
76
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
77
|
+
readonly type: "tuple[]";
|
|
78
|
+
readonly components: readonly [{
|
|
79
|
+
readonly name: "token";
|
|
80
|
+
readonly internalType: "address";
|
|
81
|
+
readonly type: "address";
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "isDelayed";
|
|
84
|
+
readonly internalType: "bool";
|
|
85
|
+
readonly type: "bool";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "amount";
|
|
88
|
+
readonly internalType: "uint256";
|
|
89
|
+
readonly type: "uint256";
|
|
90
|
+
}];
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "claimCalls";
|
|
93
|
+
readonly internalType: "struct MultiCall[]";
|
|
94
|
+
readonly type: "tuple[]";
|
|
95
|
+
readonly components: readonly [{
|
|
96
|
+
readonly name: "target";
|
|
97
|
+
readonly internalType: "address";
|
|
98
|
+
readonly type: "address";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "callData";
|
|
101
|
+
readonly internalType: "bytes";
|
|
102
|
+
readonly type: "bytes";
|
|
103
|
+
}];
|
|
104
|
+
}];
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "";
|
|
107
|
+
readonly internalType: "struct PendingWithdrawal[]";
|
|
108
|
+
readonly type: "tuple[]";
|
|
109
|
+
readonly components: readonly [{
|
|
110
|
+
readonly name: "token";
|
|
111
|
+
readonly internalType: "address";
|
|
112
|
+
readonly type: "address";
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "withdrawalPhantomToken";
|
|
115
|
+
readonly internalType: "address";
|
|
116
|
+
readonly type: "address";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "expectedOutputs";
|
|
119
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
120
|
+
readonly type: "tuple[]";
|
|
121
|
+
readonly components: readonly [{
|
|
122
|
+
readonly name: "token";
|
|
123
|
+
readonly internalType: "address";
|
|
124
|
+
readonly type: "address";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "isDelayed";
|
|
127
|
+
readonly internalType: "bool";
|
|
128
|
+
readonly type: "bool";
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "amount";
|
|
131
|
+
readonly internalType: "uint256";
|
|
132
|
+
readonly type: "uint256";
|
|
133
|
+
}];
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "claimableAt";
|
|
136
|
+
readonly internalType: "uint256";
|
|
137
|
+
readonly type: "uint256";
|
|
138
|
+
}];
|
|
139
|
+
}];
|
|
140
|
+
readonly stateMutability: "view";
|
|
141
|
+
}, {
|
|
142
|
+
readonly type: "function";
|
|
143
|
+
readonly inputs: readonly [{
|
|
144
|
+
readonly name: "creditManager";
|
|
145
|
+
readonly internalType: "address";
|
|
146
|
+
readonly type: "address";
|
|
147
|
+
}];
|
|
148
|
+
readonly name: "getWithdrawableAssets";
|
|
149
|
+
readonly outputs: readonly [{
|
|
150
|
+
readonly name: "";
|
|
151
|
+
readonly internalType: "struct WithdrawableAsset[]";
|
|
152
|
+
readonly type: "tuple[]";
|
|
153
|
+
readonly components: readonly [{
|
|
154
|
+
readonly name: "token";
|
|
155
|
+
readonly internalType: "address";
|
|
156
|
+
readonly type: "address";
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "withdrawalPhantomToken";
|
|
159
|
+
readonly internalType: "address";
|
|
160
|
+
readonly type: "address";
|
|
161
|
+
}, {
|
|
162
|
+
readonly name: "underlying";
|
|
163
|
+
readonly internalType: "address";
|
|
164
|
+
readonly type: "address";
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "withdrawalLength";
|
|
167
|
+
readonly internalType: "uint256";
|
|
168
|
+
readonly type: "uint256";
|
|
169
|
+
}];
|
|
170
|
+
}];
|
|
171
|
+
readonly stateMutability: "view";
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "function";
|
|
174
|
+
readonly inputs: readonly [{
|
|
175
|
+
readonly name: "creditAccount";
|
|
176
|
+
readonly internalType: "address";
|
|
177
|
+
readonly type: "address";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "token";
|
|
180
|
+
readonly internalType: "address";
|
|
181
|
+
readonly type: "address";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "amount";
|
|
184
|
+
readonly internalType: "uint256";
|
|
185
|
+
readonly type: "uint256";
|
|
186
|
+
}];
|
|
187
|
+
readonly name: "getWithdrawalRequestResult";
|
|
188
|
+
readonly outputs: readonly [{
|
|
189
|
+
readonly name: "withdrawal";
|
|
190
|
+
readonly internalType: "struct RequestableWithdrawal";
|
|
191
|
+
readonly type: "tuple";
|
|
192
|
+
readonly components: readonly [{
|
|
193
|
+
readonly name: "token";
|
|
194
|
+
readonly internalType: "address";
|
|
195
|
+
readonly type: "address";
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "amountIn";
|
|
198
|
+
readonly internalType: "uint256";
|
|
199
|
+
readonly type: "uint256";
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "outputs";
|
|
202
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
203
|
+
readonly type: "tuple[]";
|
|
204
|
+
readonly components: readonly [{
|
|
205
|
+
readonly name: "token";
|
|
206
|
+
readonly internalType: "address";
|
|
207
|
+
readonly type: "address";
|
|
208
|
+
}, {
|
|
209
|
+
readonly name: "isDelayed";
|
|
210
|
+
readonly internalType: "bool";
|
|
211
|
+
readonly type: "bool";
|
|
212
|
+
}, {
|
|
213
|
+
readonly name: "amount";
|
|
214
|
+
readonly internalType: "uint256";
|
|
215
|
+
readonly type: "uint256";
|
|
216
|
+
}];
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "requestCalls";
|
|
219
|
+
readonly internalType: "struct MultiCall[]";
|
|
220
|
+
readonly type: "tuple[]";
|
|
221
|
+
readonly components: readonly [{
|
|
222
|
+
readonly name: "target";
|
|
223
|
+
readonly internalType: "address";
|
|
224
|
+
readonly type: "address";
|
|
225
|
+
}, {
|
|
226
|
+
readonly name: "callData";
|
|
227
|
+
readonly internalType: "bytes";
|
|
228
|
+
readonly type: "bytes";
|
|
229
|
+
}];
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "claimableAt";
|
|
232
|
+
readonly internalType: "uint256";
|
|
233
|
+
readonly type: "uint256";
|
|
234
|
+
}];
|
|
235
|
+
}];
|
|
236
|
+
readonly stateMutability: "view";
|
|
237
|
+
}, {
|
|
238
|
+
readonly type: "function";
|
|
239
|
+
readonly inputs: readonly [];
|
|
240
|
+
readonly name: "owner";
|
|
241
|
+
readonly outputs: readonly [{
|
|
242
|
+
readonly name: "";
|
|
243
|
+
readonly internalType: "address";
|
|
244
|
+
readonly type: "address";
|
|
245
|
+
}];
|
|
246
|
+
readonly stateMutability: "view";
|
|
247
|
+
}, {
|
|
248
|
+
readonly type: "function";
|
|
249
|
+
readonly inputs: readonly [];
|
|
250
|
+
readonly name: "renounceOwnership";
|
|
251
|
+
readonly outputs: readonly [];
|
|
252
|
+
readonly stateMutability: "nonpayable";
|
|
253
|
+
}, {
|
|
254
|
+
readonly type: "function";
|
|
255
|
+
readonly inputs: readonly [{
|
|
256
|
+
readonly name: "subcompressor";
|
|
257
|
+
readonly internalType: "address";
|
|
258
|
+
readonly type: "address";
|
|
259
|
+
}];
|
|
260
|
+
readonly name: "setSubcompressor";
|
|
261
|
+
readonly outputs: readonly [];
|
|
262
|
+
readonly stateMutability: "nonpayable";
|
|
263
|
+
}, {
|
|
264
|
+
readonly type: "function";
|
|
265
|
+
readonly inputs: readonly [{
|
|
266
|
+
readonly name: "withdrawableType";
|
|
267
|
+
readonly internalType: "bytes32";
|
|
268
|
+
readonly type: "bytes32";
|
|
269
|
+
}, {
|
|
270
|
+
readonly name: "compressorType";
|
|
271
|
+
readonly internalType: "bytes32";
|
|
272
|
+
readonly type: "bytes32";
|
|
273
|
+
}];
|
|
274
|
+
readonly name: "setWithdrawableTypeToCompressorType";
|
|
275
|
+
readonly outputs: readonly [];
|
|
276
|
+
readonly stateMutability: "nonpayable";
|
|
277
|
+
}, {
|
|
278
|
+
readonly type: "function";
|
|
279
|
+
readonly inputs: readonly [{
|
|
280
|
+
readonly name: "newOwner";
|
|
281
|
+
readonly internalType: "address";
|
|
282
|
+
readonly type: "address";
|
|
283
|
+
}];
|
|
284
|
+
readonly name: "transferOwnership";
|
|
285
|
+
readonly outputs: readonly [];
|
|
286
|
+
readonly stateMutability: "nonpayable";
|
|
287
|
+
}, {
|
|
288
|
+
readonly type: "function";
|
|
289
|
+
readonly inputs: readonly [];
|
|
290
|
+
readonly name: "version";
|
|
291
|
+
readonly outputs: readonly [{
|
|
292
|
+
readonly name: "";
|
|
293
|
+
readonly internalType: "uint256";
|
|
294
|
+
readonly type: "uint256";
|
|
295
|
+
}];
|
|
296
|
+
readonly stateMutability: "view";
|
|
297
|
+
}, {
|
|
298
|
+
readonly type: "function";
|
|
299
|
+
readonly inputs: readonly [{
|
|
300
|
+
readonly name: "";
|
|
301
|
+
readonly internalType: "bytes32";
|
|
302
|
+
readonly type: "bytes32";
|
|
303
|
+
}];
|
|
304
|
+
readonly name: "withdrawableTypeToCompressorType";
|
|
305
|
+
readonly outputs: readonly [{
|
|
306
|
+
readonly name: "";
|
|
307
|
+
readonly internalType: "bytes32";
|
|
308
|
+
readonly type: "bytes32";
|
|
309
|
+
}];
|
|
310
|
+
readonly stateMutability: "view";
|
|
311
|
+
}, {
|
|
312
|
+
readonly type: "event";
|
|
313
|
+
readonly anonymous: false;
|
|
314
|
+
readonly inputs: readonly [{
|
|
315
|
+
readonly name: "previousOwner";
|
|
316
|
+
readonly internalType: "address";
|
|
317
|
+
readonly type: "address";
|
|
318
|
+
readonly indexed: true;
|
|
319
|
+
}, {
|
|
320
|
+
readonly name: "newOwner";
|
|
321
|
+
readonly internalType: "address";
|
|
322
|
+
readonly type: "address";
|
|
323
|
+
readonly indexed: true;
|
|
324
|
+
}];
|
|
325
|
+
readonly name: "OwnershipTransferred";
|
|
326
|
+
}];
|
|
327
|
+
type abi = typeof abi;
|
|
328
|
+
/**
|
|
329
|
+
* V3.10 implementation of the {@link IWithdrawalCompressorContract} interface.
|
|
330
|
+
**/
|
|
331
|
+
export declare class WithdrawalCompressorV310Contract extends AbstractWithdrawalCompressorContract<abi> {
|
|
332
|
+
constructor(sdk: OnchainSDK, address: Address);
|
|
333
|
+
}
|
|
334
|
+
export {};
|