@gearbox-protocol/sdk 14.12.0-next.22 → 14.12.0-next.24
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/IWithdrawalCompressorV313.js +2 -1
- package/dist/cjs/abi/compressors/withdrawalCompressor.js +2 -1
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +31 -9
- package/dist/cjs/plugins/adapters/contracts/AbstractCurveAdapter.js +8 -5
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +6 -9
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +7 -5
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +13 -4
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +8 -8
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +8 -5
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MellowClaimerAdapterContract.js +29 -0
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +11 -4
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +31 -4
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +14 -16
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +14 -13
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +7 -5
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +6 -9
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +8 -8
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +6 -4
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +1 -5
- package/dist/cjs/preview/preview/applyInnerOperations.js +83 -58
- package/dist/cjs/preview/preview/applyQuotaChanges.js +43 -0
- package/dist/cjs/preview/preview/errors.js +0 -16
- package/dist/cjs/preview/preview/index.js +2 -0
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +19 -8
- package/dist/cjs/preview/preview/previewCloseOrRepayCreditAccount.js +18 -7
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +18 -6
- package/dist/cjs/preview/preview/types.js +30 -0
- package/dist/cjs/preview/preview/unwrapNativeCollateral.js +10 -4
- package/dist/cjs/sdk/OnchainSDK.js +3 -6
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +2 -4
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +14 -22
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +6 -18
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +3 -5
- package/dist/esm/abi/IWithdrawalCompressorV313.js +2 -1
- package/dist/esm/abi/compressors/withdrawalCompressor.js +2 -1
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +31 -9
- package/dist/esm/plugins/adapters/contracts/AbstractCurveAdapter.js +8 -5
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +6 -9
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +7 -5
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +13 -4
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +8 -8
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +8 -5
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MellowClaimerAdapterContract.js +32 -1
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +11 -4
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +33 -5
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +14 -16
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +14 -13
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +7 -5
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +6 -9
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +8 -8
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +6 -4
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +2 -9
- package/dist/esm/preview/preview/applyInnerOperations.js +90 -59
- package/dist/esm/preview/preview/applyQuotaChanges.js +19 -0
- package/dist/esm/preview/preview/errors.js +0 -15
- package/dist/esm/preview/preview/index.js +1 -0
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +20 -8
- package/dist/esm/preview/preview/previewCloseOrRepayCreditAccount.js +18 -7
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +20 -6
- package/dist/esm/preview/preview/types.js +16 -0
- package/dist/esm/preview/preview/unwrapNativeCollateral.js +12 -4
- package/dist/esm/sdk/OnchainSDK.js +3 -6
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +14 -22
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +6 -18
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +3 -5
- package/dist/types/abi/IWithdrawalCompressorV313.d.ts +4 -0
- package/dist/types/abi/compressors/withdrawalCompressor.d.ts +4 -0
- package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +4 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +27 -7
- package/dist/types/plugins/adapters/contracts/AbstractCurveAdapter.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowClaimerAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/types.d.ts +0 -10
- package/dist/types/preview/preview/applyInnerOperations.d.ts +8 -33
- package/dist/types/preview/preview/applyQuotaChanges.d.ts +24 -0
- package/dist/types/preview/preview/errors.d.ts +0 -12
- package/dist/types/preview/preview/index.d.ts +1 -0
- package/dist/types/preview/preview/previewAdjustCreditAccount.d.ts +1 -1
- package/dist/types/preview/preview/previewOpenCreditAccount.d.ts +1 -1
- package/dist/types/preview/preview/types.d.ts +81 -0
- package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +19 -4
- package/dist/types/sdk/OnchainSDK.d.ts +3 -6
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +4 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/addresses.d.ts +1 -2
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +2 -4
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import { type
|
|
3
|
-
import type { DiffLeftover } from "../types.js";
|
|
2
|
+
import { type AssetsMap, type ConstructOptions } from "../../../sdk/index.js";
|
|
4
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
5
|
declare const abi: readonly [{
|
|
@@ -281,6 +280,6 @@ export declare class StakingRewardsAdapterContract extends AbstractAdapterContra
|
|
|
281
280
|
stakedPhantomToken: string | undefined;
|
|
282
281
|
referral: number | undefined;
|
|
283
282
|
};
|
|
284
|
-
protected
|
|
283
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
285
284
|
}
|
|
286
285
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { DiffLeftover } from "../types.js";
|
|
2
|
+
import type { AssetsMap, ConstructOptions } from "../../../sdk/index.js";
|
|
4
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
5
|
export declare enum TraderJoePoolVersion {
|
|
@@ -484,6 +483,6 @@ export declare class TraderJoeRouterAdapterContract extends AbstractAdapterContr
|
|
|
484
483
|
poolVersion: TraderJoePoolVersion;
|
|
485
484
|
}[] | undefined;
|
|
486
485
|
};
|
|
487
|
-
protected
|
|
486
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
488
487
|
}
|
|
489
488
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AssetsMap, ConstructOptions, ParsedCallV2 } from "../../../sdk/index.js";
|
|
3
3
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
4
|
-
import type { DiffLeftover } from "../types.js";
|
|
5
4
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
6
5
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
7
6
|
declare const abi: readonly [{
|
|
@@ -966,6 +965,6 @@ export declare class UniswapV2AdapterContract extends AbstractAdapterContract<ab
|
|
|
966
965
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
967
966
|
/** @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type.go#L81-L91 */
|
|
968
967
|
classifyLegacyOperation(_parsed: ParsedCallV2, transfers: Transfers): LegacyAdapterOperation;
|
|
969
|
-
protected
|
|
968
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
970
969
|
}
|
|
971
970
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { DiffLeftover } from "../types.js";
|
|
2
|
+
import type { AssetsMap, ConstructOptions } from "../../../sdk/index.js";
|
|
4
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
5
|
declare const abi: readonly [{
|
|
@@ -557,7 +556,7 @@ export declare class UniswapV3AdapterContract extends AbstractAdapterContract<ab
|
|
|
557
556
|
fee: number;
|
|
558
557
|
}[] | undefined;
|
|
559
558
|
};
|
|
560
|
-
protected
|
|
559
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
561
560
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
562
561
|
private trackInputPath;
|
|
563
562
|
private trackOutputPath;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AssetsMap, ConstructOptions, ParsedCallV2 } from "../../../sdk/index.js";
|
|
3
3
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
4
|
-
import type { DiffLeftover } from "../types.js";
|
|
5
4
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
6
5
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
7
6
|
declare const abi: readonly [{
|
|
@@ -422,6 +421,6 @@ export declare class UniswapV4AdapterContract extends AbstractAdapterContract<ab
|
|
|
422
421
|
};
|
|
423
422
|
/** @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type.go#L81-L91 */
|
|
424
423
|
classifyLegacyOperation(_parsed: ParsedCallV2, transfers: Transfers): LegacyAdapterOperation;
|
|
425
|
-
protected
|
|
424
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
426
425
|
}
|
|
427
426
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import { type
|
|
3
|
-
import type { DiffLeftover } from "../types.js";
|
|
2
|
+
import { type AssetsMap, type ConstructOptions } from "../../../sdk/index.js";
|
|
4
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
5
|
declare const abi: readonly [{
|
|
@@ -357,6 +356,6 @@ export declare class UpshiftVaultAdapterContract extends AbstractAdapterContract
|
|
|
357
356
|
asset: string | undefined;
|
|
358
357
|
stakedPhantomToken: string | undefined;
|
|
359
358
|
};
|
|
360
|
-
protected
|
|
359
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
361
360
|
}
|
|
362
361
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { DiffLeftover } from "../types.js";
|
|
2
|
+
import type { AssetsMap, ConstructOptions } from "../../../sdk/index.js";
|
|
4
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
6
5
|
declare const abi: readonly [{
|
|
@@ -362,6 +361,6 @@ export declare class VelodromeV2RouterAdapterContract extends AbstractAdapterCon
|
|
|
362
361
|
factory: string;
|
|
363
362
|
}[] | undefined;
|
|
364
363
|
};
|
|
365
|
-
protected
|
|
364
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
366
365
|
}
|
|
367
366
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type AssetsMap, type ConstructOptions, type ParsedCallV2 } from "../../../sdk/index.js";
|
|
3
3
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
4
|
-
import type { DiffLeftover } from "../types.js";
|
|
5
4
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
6
5
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
7
6
|
declare const abi: readonly [{
|
|
@@ -394,6 +393,6 @@ export declare class WstETHV1AdapterContract extends AbstractAdapterContract<abi
|
|
|
394
393
|
};
|
|
395
394
|
/** @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type.go#L264-L275 */
|
|
396
395
|
classifyLegacyOperation(parsed: ParsedCallV2, transfers: Transfers): LegacyAdapterOperation;
|
|
397
|
-
protected
|
|
396
|
+
protected applyBalanceChanges(balances: AssetsMap, decoded: DecodeFunctionDataReturnType<abi>): void;
|
|
398
397
|
}
|
|
399
398
|
export {};
|
|
@@ -44,16 +44,6 @@ export declare enum AdapterType {
|
|
|
44
44
|
UPSHIFT_VAULT = "UPSHIFT_VAULT",
|
|
45
45
|
VELODROME_V2_ROUTER = "VELODROME_V2_ROUTER"
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Diff-call semantics of a diff-style adapter call: the call spends the
|
|
49
|
-
* consumed token down to the exact `leftoverAmount` encoded in its calldata,
|
|
50
|
-
* so the post-call balance of `tokenIn` is `leftoverAmount` regardless of the
|
|
51
|
-
* actual amount spent.
|
|
52
|
-
*/
|
|
53
|
-
export interface DiffLeftover {
|
|
54
|
-
tokenIn: Address;
|
|
55
|
-
leftoverAmount: bigint;
|
|
56
|
-
}
|
|
57
47
|
export interface AdapterContractStateHuman extends BaseContractStateHuman {
|
|
58
48
|
creditManager?: string;
|
|
59
49
|
targetContract?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type SdkWithAdapters } from "../../plugins/adapters/index.js";
|
|
2
2
|
import { type Asset, AssetsMap, type PluginsMap } from "../../sdk/index.js";
|
|
3
3
|
import type { InnerOperation } from "../parse/index.js";
|
|
4
|
+
import { type OperationPreviewError } from "./types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Running state threaded through a credit-facade multicall by
|
|
6
7
|
* {@link applyInnerOperations}. Seeded by the caller:
|
|
@@ -37,8 +38,7 @@ export interface InnerOperationsState {
|
|
|
37
38
|
/**
|
|
38
39
|
* Raw `updateQuota` changes, one entry per op. Entries are relative signed
|
|
39
40
|
* changes (with the `MIN_INT96` "disable" sentinel kept as-is), not final
|
|
40
|
-
* quotas: folding them requires pre-state quotas, see
|
|
41
|
-
* {@link applyQuotaChanges}.
|
|
41
|
+
* quotas: folding them requires pre-state quotas, see `applyQuotaChanges`.
|
|
42
42
|
*/
|
|
43
43
|
quotaChanges: Asset[];
|
|
44
44
|
}
|
|
@@ -48,37 +48,12 @@ export interface InnerOperationsState {
|
|
|
48
48
|
export declare function makeInnerOperationsState(): InnerOperationsState;
|
|
49
49
|
/**
|
|
50
50
|
* Replays a credit-facade multicall over `state`, mutating it in place in
|
|
51
|
-
* facade execution order. The result is the *minimal guaranteed* post-state
|
|
52
|
-
* exact deltas for explicit facade calls, exact leftovers for diff-style
|
|
53
|
-
* adapter calls inside `storeExpectedBalances`/`compareBalances` brackets and
|
|
54
|
-
* enforced minimums for bracket targets. Adapter calls outside a bracket are
|
|
55
|
-
* ignored: nothing enforces their outcome on-chain (e.g. reward claims), so
|
|
56
|
-
* their guaranteed balance change is zero.
|
|
51
|
+
* facade execution order. The result is the *minimal guaranteed* post-state.
|
|
57
52
|
*
|
|
58
|
-
* The
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* (the conversion between the market underlying and its asset); RWA
|
|
62
|
-
* underlyings always convert 1-to-1 with their vault asset, so the conversion
|
|
63
|
-
* is applied directly, see {@link applyRWAWrapUnwrap}.
|
|
53
|
+
* The function assumes that the call was generated by our frontend using
|
|
54
|
+
* router/withdrawal compressor, otherwise it returns an error, but still
|
|
55
|
+
* proceeds best-effort.
|
|
64
56
|
*
|
|
65
|
-
* @
|
|
66
|
-
* on bracketed calls to non-adapter targets.
|
|
57
|
+
* @returns `undefined` on success, the error on a malformed multicall.
|
|
67
58
|
*/
|
|
68
|
-
export declare function applyInnerOperations<P extends PluginsMap>(sdk: SdkWithAdapters<P>, multicall: InnerOperation[], state: InnerOperationsState):
|
|
69
|
-
/**
|
|
70
|
-
* Applies raw `updateQuota` changes to the account's initial quotas.
|
|
71
|
-
*
|
|
72
|
-
* Each change is applied sequentially: `MIN_INT96` disables the quota, other
|
|
73
|
-
* changes are added to the running quota with the result clamped at zero
|
|
74
|
-
* (quotas cannot go negative on-chain).
|
|
75
|
-
*
|
|
76
|
-
* @param initialQuotas - Per-token quotas before the operation.
|
|
77
|
-
* @param changes - Raw changes recorded by {@link applyInnerOperations}.
|
|
78
|
-
* @returns `quotas` - final non-zero per-token quotas; `quotasChange` -
|
|
79
|
-
* applied (post-clamp) per-token deltas, non-zero entries only.
|
|
80
|
-
*/
|
|
81
|
-
export declare function applyQuotaChanges(initialQuotas: AssetsMap, changes: Asset[]): {
|
|
82
|
-
quotas: Asset[];
|
|
83
|
-
quotasChange: Asset[];
|
|
84
|
-
};
|
|
59
|
+
export declare function applyInnerOperations<P extends PluginsMap>(sdk: SdkWithAdapters<P>, multicall: InnerOperation[], state: InnerOperationsState): OperationPreviewError | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Asset, type AssetsMap } from "../../sdk/index.js";
|
|
2
|
+
export interface ApplyQuotaChangesResult {
|
|
3
|
+
/**
|
|
4
|
+
* Final non-zero per-token quotas.
|
|
5
|
+
*/
|
|
6
|
+
quotas: Asset[];
|
|
7
|
+
/**
|
|
8
|
+
* Applied (post-clamp) per-token deltas, non-zero entries only.
|
|
9
|
+
*/
|
|
10
|
+
quotasChange: Asset[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Applies raw `updateQuota` changes to the account's initial quotas.
|
|
14
|
+
*
|
|
15
|
+
* Each change is applied sequentially: `MIN_INT96` disables the quota, other
|
|
16
|
+
* changes are added to the running quota with the result clamped at zero
|
|
17
|
+
* (quotas cannot go negative on-chain).
|
|
18
|
+
*
|
|
19
|
+
* @param initialQuotas - Per-token quotas before the operation.
|
|
20
|
+
* @param changes - Raw changes recorded by `applyInnerOperations`.
|
|
21
|
+
* @returns `quotas` - final non-zero per-token quotas; `quotasChange` -
|
|
22
|
+
* applied (post-clamp) per-token deltas, non-zero entries only.
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyQuotaChanges(initialQuotas: AssetsMap, changes: Asset[]): ApplyQuotaChangesResult;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thrown when a transaction's attached native value (`msg.value`) does not fit
|
|
3
|
-
* into the WETH collateral declared by the multicall: such a transaction is
|
|
4
|
-
* malformed and would not execute successfully.
|
|
5
|
-
*/
|
|
6
|
-
export declare class InvalidTransactionValueError extends Error {
|
|
7
|
-
/** Transaction `msg.value`. */
|
|
8
|
-
readonly value: bigint;
|
|
9
|
-
/** Amount of wrapped native token added as collateral. */
|
|
10
|
-
readonly wethCollateral: bigint;
|
|
11
|
-
constructor(value: bigint, wethCollateral: bigint);
|
|
12
|
-
}
|
|
13
1
|
/**
|
|
14
2
|
* Thrown by `previewOperation` for parsed operations it cannot preview yet.
|
|
15
3
|
* Currently only pool operations and credit account opening are supported.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PluginsMap } from "../../sdk/index.js";
|
|
2
2
|
import type { MulticallOperation, RWAMulticallOperation } from "../parse/index.js";
|
|
3
3
|
import type { PreviewOperationInput, PreviewOperationOptions } from "../types.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type AdjustCreditAccountPreview } from "./types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Previews a `multicall`/`botMulticall` operation on an existing credit
|
|
7
7
|
* account: fetches the account's pre-state (unless provided via options),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PluginsMap } from "../../sdk/index.js";
|
|
2
2
|
import type { OpenCreditAccountOperation, RWAOpenCreditAccountOperation } from "../parse/index.js";
|
|
3
3
|
import type { PreviewOperationInput } from "../types.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type OpenCreditAccountPreview } from "./types.js";
|
|
5
5
|
export declare function previewOpenCreditAccount<P extends PluginsMap>(input: PreviewOperationInput<P>, operation: OpenCreditAccountOperation | RWAOpenCreditAccountOperation): OpenCreditAccountPreview;
|
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { Asset } from "../../sdk/index.js";
|
|
3
3
|
import type { PoolOperationType } from "../parse/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Broken `storeExpectedBalances`/`compareBalances` bracket structure:
|
|
6
|
+
* `storeExpectedBalances` without a matching `compareBalances`, more than one
|
|
7
|
+
* bracket, or `compareBalances` without a preceding `storeExpectedBalances`.
|
|
8
|
+
* We expect transactions that were generated by our frontend using router/withdrawal compressor
|
|
9
|
+
**/
|
|
10
|
+
export declare const ERROR_MALFORMED_BRACKET = 1001;
|
|
11
|
+
/**
|
|
12
|
+
* Adapter call outside a `storeExpectedBalances`/`compareBalances` bracket
|
|
13
|
+
* We expect transactions that were generated by our frontend using router/withdrawal compressor,
|
|
14
|
+
**/
|
|
15
|
+
export declare const ERROR_ADAPTER_CALL_OUTSIDE_BRACKET = 1002;
|
|
16
|
+
/**
|
|
17
|
+
* Bracketed call whose target is not an adapter (or adapter that is not known to the SDK)
|
|
18
|
+
**/
|
|
19
|
+
export declare const ERROR_NON_ADAPTER_CALL_IN_BRACKET = 1003;
|
|
20
|
+
/**
|
|
21
|
+
* Bracketed adapter call cannot be replayed (undecodable/unsupported calldata)
|
|
22
|
+
**/
|
|
23
|
+
export declare const ERROR_UNPREVIEWABLE_ADAPTER_CALL = 1004;
|
|
24
|
+
/**
|
|
25
|
+
* Out-of-bracket RWA wrap/unwrap calldata cannot be decoded
|
|
26
|
+
**/
|
|
27
|
+
export declare const ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = 1005;
|
|
28
|
+
/**
|
|
29
|
+
* `msg.value` does not fit into the declared WETH collateral
|
|
30
|
+
* Transactions can have arbitrary value, but the ones that we create
|
|
31
|
+
* using our frontend should have a value that fits into the declared WETH collateral.
|
|
32
|
+
**/
|
|
33
|
+
export declare const ERROR_INVALID_TRANSACTION_VALUE = 1006;
|
|
34
|
+
/** A token in the preview could not be priced by the oracle */
|
|
35
|
+
export declare const ERROR_UNPRICEABLE_TOKEN = 2001;
|
|
36
|
+
/**
|
|
37
|
+
* Non-throwing preview failure. When set on a preview, all fields are still
|
|
38
|
+
* computed best-effort, but some of them may be unreliable.
|
|
39
|
+
*/
|
|
40
|
+
export interface OperationPreviewError {
|
|
41
|
+
/**
|
|
42
|
+
* Numeric http-style error code, see the `ERROR_*` constants:
|
|
43
|
+
* - 1xxx: the transaction is malformed (we expect transactions
|
|
44
|
+
* that were generated by our fromtend using router/withdrawal compressor)
|
|
45
|
+
* and fields derived from replayed balances
|
|
46
|
+
* may be unreliable;
|
|
47
|
+
* - 2xxx: the transaction may be fine, but the SDK could not fully
|
|
48
|
+
* evaluate the preview (e.g. a token could not be priced).
|
|
49
|
+
*/
|
|
50
|
+
code: number;
|
|
51
|
+
/**
|
|
52
|
+
* Human-readable details of the specific failure
|
|
53
|
+
*/
|
|
54
|
+
message: string;
|
|
55
|
+
}
|
|
4
56
|
export interface PoolOperationPreview {
|
|
5
57
|
operation: PoolOperationType;
|
|
6
58
|
/**
|
|
@@ -27,6 +79,11 @@ export interface PoolOperationPreview {
|
|
|
27
79
|
* (previewDeposit/previewRedeem).
|
|
28
80
|
*/
|
|
29
81
|
tokenOut: Asset;
|
|
82
|
+
/**
|
|
83
|
+
* Set when preview encountered non-fatal errors, all fields are
|
|
84
|
+
* still computed best-effort
|
|
85
|
+
*/
|
|
86
|
+
error?: OperationPreviewError;
|
|
30
87
|
}
|
|
31
88
|
export interface OpenCreditAccountPreview {
|
|
32
89
|
operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
|
|
@@ -64,6 +121,12 @@ export interface OpenCreditAccountPreview {
|
|
|
64
121
|
* as estimated by router
|
|
65
122
|
*/
|
|
66
123
|
assets: Asset[];
|
|
124
|
+
/**
|
|
125
|
+
* Set when preview encountered non-fatal errors, all fields are
|
|
126
|
+
* still computed best-effort, but derived fields (`assets`, `target`,
|
|
127
|
+
* `collateralValue`) may be unreliable in that case.
|
|
128
|
+
*/
|
|
129
|
+
error?: OperationPreviewError;
|
|
67
130
|
}
|
|
68
131
|
export interface AdjustCreditAccountPreview {
|
|
69
132
|
operation: "AdjustCreditAccount";
|
|
@@ -116,6 +179,12 @@ export interface AdjustCreditAccountPreview {
|
|
|
116
179
|
* Assets after minus assets before
|
|
117
180
|
*/
|
|
118
181
|
assetsChange: Asset[];
|
|
182
|
+
/**
|
|
183
|
+
* Set when preview encountered non-fatal errors, all fields are
|
|
184
|
+
* still computed best-effort, but derived fields (`assets`, `assetsChange`,
|
|
185
|
+
* `totalValue`) may be unreliable in that case.
|
|
186
|
+
*/
|
|
187
|
+
error?: OperationPreviewError;
|
|
119
188
|
}
|
|
120
189
|
export interface CloseCreditAccountPreview {
|
|
121
190
|
operation: "CloseCreditAccount";
|
|
@@ -139,6 +208,12 @@ export interface CloseCreditAccountPreview {
|
|
|
139
208
|
* withdrawal)
|
|
140
209
|
*/
|
|
141
210
|
receivedAmount: bigint;
|
|
211
|
+
/**
|
|
212
|
+
* Set when preview encountered non-fatal errors, all fields are
|
|
213
|
+
* still computed best-effort, but the
|
|
214
|
+
* balance-derived `receivedAmount` may be unreliable in that case.
|
|
215
|
+
*/
|
|
216
|
+
error?: OperationPreviewError;
|
|
142
217
|
}
|
|
143
218
|
export interface RepayCreditAccountPreview {
|
|
144
219
|
operation: "RepayCreditAccount";
|
|
@@ -173,6 +248,12 @@ export interface RepayCreditAccountPreview {
|
|
|
173
248
|
* Total debt repaid: principal + accrued interest + fees, in underlying
|
|
174
249
|
*/
|
|
175
250
|
debtRepaid: bigint;
|
|
251
|
+
/**
|
|
252
|
+
* Set when preview encountered non-fatal errors, all fields are
|
|
253
|
+
* still computed best-effort, but the
|
|
254
|
+
* balance-derived `collateralWithdrawn` may be unreliable in that case.
|
|
255
|
+
*/
|
|
256
|
+
error?: OperationPreviewError;
|
|
176
257
|
}
|
|
177
258
|
/**
|
|
178
259
|
* Result of previewing a raw operation calldata: currently pool operations and
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import { type Asset } from "../../sdk/index.js";
|
|
3
|
+
import { type OperationPreviewError } from "./types.js";
|
|
4
|
+
export interface UnwrapNativeCollateralResult {
|
|
5
|
+
/**
|
|
6
|
+
* Collateral with the native amount unwrapped from the WETH entry.
|
|
7
|
+
*/
|
|
8
|
+
assets: Asset[];
|
|
9
|
+
/**
|
|
10
|
+
* Error set when the transaction value is malformed.
|
|
11
|
+
*/
|
|
12
|
+
error?: OperationPreviewError;
|
|
13
|
+
}
|
|
3
14
|
/**
|
|
4
15
|
* Represents the transaction's attached native value as a `NATIVE_ADDRESS`
|
|
5
16
|
* entry in the collateral list.
|
|
@@ -10,11 +21,15 @@ import { type Asset } from "../../sdk/index.js";
|
|
|
10
21
|
* `NATIVE_ADDRESS` and the WETH entry is reduced accordingly (dropped when it
|
|
11
22
|
* reaches zero). Other entries are preserved.
|
|
12
23
|
*
|
|
24
|
+
* When `nativeAmount` is positive but the WETH collateral is missing or
|
|
25
|
+
* smaller than it, the transaction is malformed: the collateral is returned
|
|
26
|
+
* as-is (no unwrapping) together with an `ERROR_INVALID_TRANSACTION_VALUE`
|
|
27
|
+
* error.
|
|
28
|
+
*
|
|
13
29
|
* @param collateral - Collateral assets as declared by the multicall.
|
|
14
30
|
* @param nativeAmount - Transaction `msg.value`.
|
|
15
31
|
* @param wethToken - Wrapped native token address.
|
|
16
|
-
* @returns Collateral with the native amount unwrapped from the WETH entry
|
|
17
|
-
*
|
|
18
|
-
* WETH collateral is missing or smaller than it.
|
|
32
|
+
* @returns Collateral with the native amount unwrapped from the WETH entry,
|
|
33
|
+
* plus the error on a malformed transaction value.
|
|
19
34
|
*/
|
|
20
|
-
export declare function unwrapNativeCollateral(collateral: Asset[], nativeAmount: bigint, wethToken: Address):
|
|
35
|
+
export declare function unwrapNativeCollateral(collateral: Asset[], nativeAmount: bigint, wethToken: Address): UnwrapNativeCollateralResult;
|
|
@@ -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, type IWithdrawalCompressorContract
|
|
4
|
+
import { type ICreditAccountsService, type IWithdrawalCompressorContract } 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";
|
|
@@ -289,10 +289,7 @@ export declare class OnchainSDK<const Plugins extends PluginsMap = {}> extends C
|
|
|
289
289
|
/**
|
|
290
290
|
* Lazily returns a withdrawal compressor contract for the current chain.
|
|
291
291
|
*
|
|
292
|
-
* @
|
|
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.
|
|
292
|
+
* @throws If no withdrawal compressor is supported on the current chain.
|
|
296
293
|
**/
|
|
297
|
-
withdrawalCompressor(
|
|
294
|
+
get withdrawalCompressor(): IWithdrawalCompressorContract;
|
|
298
295
|
}
|
|
@@ -103,6 +103,10 @@ declare const abi: readonly [{
|
|
|
103
103
|
readonly name: "claimableAt";
|
|
104
104
|
readonly type: "uint256";
|
|
105
105
|
readonly internalType: "uint256";
|
|
106
|
+
}, {
|
|
107
|
+
readonly name: "extraData";
|
|
108
|
+
readonly type: "bytes";
|
|
109
|
+
readonly internalType: "bytes";
|
|
106
110
|
}];
|
|
107
111
|
}];
|
|
108
112
|
readonly stateMutability: "view";
|
|
@@ -15,7 +15,6 @@ export interface WithdrawalCompressorLocation {
|
|
|
15
15
|
* Returns the withdrawal compressor deployment for the given network,
|
|
16
16
|
* or `undefined` if none is configured.
|
|
17
17
|
* @param network - Network type.
|
|
18
|
-
* @param version - Desired compressor version; when omitted, the latest supported version is returned.
|
|
19
18
|
* @returns Withdrawal compressor address and version, or `undefined`.
|
|
20
19
|
**/
|
|
21
|
-
export declare function getWithdrawalCompressorAddress(network: NetworkType
|
|
20
|
+
export declare function getWithdrawalCompressorAddress(network: NetworkType): WithdrawalCompressorLocation | undefined;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
2
|
-
import type { WithdrawalCompressorVersion } from "./addresses.js";
|
|
3
2
|
import type { IWithdrawalCompressorContract } from "./types.js";
|
|
4
3
|
/**
|
|
5
4
|
* Returns a withdrawal compressor contract for the current chain,
|
|
6
5
|
* reusing an instance from the contracts register when available.
|
|
7
6
|
* @param sdk
|
|
8
|
-
* @
|
|
9
|
-
* @throws if no withdrawal compressor of given version is supported on the current chain.
|
|
7
|
+
* @throws if no withdrawal compressor is supported on the current chain.
|
|
10
8
|
**/
|
|
11
|
-
export declare function createWithdrawalCompressor(sdk: OnchainSDK
|
|
9
|
+
export declare function createWithdrawalCompressor(sdk: OnchainSDK): IWithdrawalCompressorContract;
|
|
@@ -209,6 +209,13 @@ export interface PendingWithdrawal {
|
|
|
209
209
|
* Unix timestamp (in seconds) when the withdrawal becomes claimable
|
|
210
210
|
**/
|
|
211
211
|
claimableAt: bigint;
|
|
212
|
+
/**
|
|
213
|
+
* Delayed intent decoded from the withdrawal's `extraData`, enriched with
|
|
214
|
+
* the credit manager of the credit account. `undefined` on compressor
|
|
215
|
+
* versions below 313, and on v313+ when the withdrawal was requested
|
|
216
|
+
* without an intent (empty `extraData`).
|
|
217
|
+
**/
|
|
218
|
+
intent?: DelayedIntentExtended;
|
|
212
219
|
}
|
|
213
220
|
/**
|
|
214
221
|
* Result of previewing a delayed withdrawal request.
|