@gearbox-protocol/sdk 14.12.0-next.54 → 14.12.0-next.55
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/rwa/iMidasLiquidatorV311.js +96 -0
- package/dist/cjs/abi/rwa/iSecuritizeLiquidatorV311.js +111 -0
- package/dist/cjs/sdk/base/BaseContract.js +26 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/cjs/sdk/index.js +12 -1
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +3 -3
- package/dist/cjs/sdk/market/index.js +7 -0
- package/dist/cjs/sdk/market/rwa/index.js +8 -0
- package/dist/cjs/sdk/market/rwa/midas/MidasLiquidator.js +43 -0
- package/dist/cjs/sdk/market/rwa/midas/constants.js +5 -0
- package/dist/cjs/sdk/market/rwa/midas/index.js +5 -0
- package/dist/cjs/sdk/market/rwa/securitize/SecuritizeLiquidator.js +31 -0
- package/dist/cjs/sdk/market/rwa/securitize/constants.js +2 -0
- package/dist/cjs/sdk/market/rwa/securitize/index.js +3 -0
- package/dist/cjs/sdk/utils/viem/cast.js +20 -15
- package/dist/cjs/sdk/utils/viem/index.js +4 -0
- package/dist/cjs/sdk/utils/viem/simulateCall.js +82 -0
- package/dist/esm/abi/rwa/iMidasLiquidatorV311.js +95 -0
- package/dist/esm/abi/rwa/iSecuritizeLiquidatorV311.js +110 -0
- package/dist/esm/permissionless/bindings/factory/credit-factory.js +1 -1
- package/dist/esm/preview/index.js +5 -5
- package/dist/esm/sdk/base/BaseContract.js +26 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/esm/sdk/index.js +7 -3
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +3 -3
- package/dist/esm/sdk/market/index.js +5 -2
- package/dist/esm/sdk/market/rwa/index.js +6 -2
- package/dist/esm/sdk/market/rwa/midas/MidasLiquidator.js +43 -0
- package/dist/esm/sdk/market/rwa/midas/constants.js +4 -0
- package/dist/esm/sdk/market/rwa/midas/index.js +3 -0
- package/dist/esm/sdk/market/rwa/securitize/SecuritizeLiquidator.js +31 -0
- package/dist/esm/sdk/market/rwa/securitize/constants.js +2 -1
- package/dist/esm/sdk/market/rwa/securitize/index.js +3 -2
- package/dist/esm/sdk/utils/viem/cast.js +20 -16
- package/dist/esm/sdk/utils/viem/index.js +3 -2
- package/dist/esm/sdk/utils/viem/simulateCall.js +80 -0
- package/dist/types/abi/rwa/iMidasLiquidatorV311.d.ts +83 -0
- package/dist/types/abi/rwa/iSecuritizeLiquidatorV311.d.ts +95 -0
- package/dist/types/sdk/base/BaseContract.d.ts +13 -0
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +15 -0
- package/dist/types/sdk/index.d.ts +7 -3
- package/dist/types/sdk/market/index.d.ts +5 -2
- package/dist/types/sdk/market/rwa/index.d.ts +6 -2
- package/dist/types/sdk/market/rwa/midas/MidasLiquidator.d.ts +93 -0
- package/dist/types/sdk/market/rwa/midas/constants.d.ts +4 -0
- package/dist/types/sdk/market/rwa/midas/index.d.ts +3 -0
- package/dist/types/sdk/market/rwa/securitize/SecuritizeLiquidator.d.ts +104 -0
- package/dist/types/sdk/market/rwa/securitize/constants.d.ts +2 -1
- package/dist/types/sdk/market/rwa/securitize/index.d.ts +3 -2
- package/dist/types/sdk/utils/viem/cast.d.ts +6 -1
- package/dist/types/sdk/utils/viem/index.d.ts +3 -2
- package/dist/types/sdk/utils/viem/simulateCall.d.ts +57 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ConstructOptions } from "../../../base/Construct.js";
|
|
2
|
+
import { BaseContract } from "../../../base/BaseContract.js";
|
|
3
|
+
import "../../../base/index.js";
|
|
4
|
+
import { Address, DecodeFunctionDataReturnType } from "viem";
|
|
5
|
+
//#region src/sdk/market/rwa/securitize/SecuritizeLiquidator.d.ts
|
|
6
|
+
declare const abi: readonly [{
|
|
7
|
+
readonly type: "function";
|
|
8
|
+
readonly name: "contractType";
|
|
9
|
+
readonly inputs: readonly [];
|
|
10
|
+
readonly outputs: readonly [{
|
|
11
|
+
readonly name: "";
|
|
12
|
+
readonly type: "bytes32";
|
|
13
|
+
readonly internalType: "bytes32";
|
|
14
|
+
}];
|
|
15
|
+
readonly stateMutability: "view";
|
|
16
|
+
}, {
|
|
17
|
+
readonly type: "function";
|
|
18
|
+
readonly name: "isTransferAllowed";
|
|
19
|
+
readonly inputs: readonly [{
|
|
20
|
+
readonly name: "redeemerOwner";
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
readonly internalType: "address";
|
|
23
|
+
}];
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly name: "";
|
|
26
|
+
readonly type: "bool";
|
|
27
|
+
readonly internalType: "bool";
|
|
28
|
+
}];
|
|
29
|
+
readonly stateMutability: "view";
|
|
30
|
+
}, {
|
|
31
|
+
readonly type: "function";
|
|
32
|
+
readonly name: "liquidatePendingRedemption";
|
|
33
|
+
readonly inputs: readonly [{
|
|
34
|
+
readonly name: "creditAccount";
|
|
35
|
+
readonly type: "address";
|
|
36
|
+
readonly internalType: "address";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "redemptionGateway";
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
readonly internalType: "address";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "priceUpdates";
|
|
43
|
+
readonly type: "tuple[]";
|
|
44
|
+
readonly internalType: "struct PriceUpdate[]";
|
|
45
|
+
readonly components: readonly [{
|
|
46
|
+
readonly name: "priceFeed";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
readonly internalType: "address";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "data";
|
|
51
|
+
readonly type: "bytes";
|
|
52
|
+
readonly internalType: "bytes";
|
|
53
|
+
}];
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "lossPolicyData";
|
|
56
|
+
readonly type: "bytes";
|
|
57
|
+
readonly internalType: "bytes";
|
|
58
|
+
}];
|
|
59
|
+
readonly outputs: readonly [];
|
|
60
|
+
readonly stateMutability: "nonpayable";
|
|
61
|
+
}, {
|
|
62
|
+
readonly type: "function";
|
|
63
|
+
readonly name: "transferableRedeemerOwner";
|
|
64
|
+
readonly inputs: readonly [];
|
|
65
|
+
readonly outputs: readonly [{
|
|
66
|
+
readonly name: "";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
readonly internalType: "address";
|
|
69
|
+
}];
|
|
70
|
+
readonly stateMutability: "view";
|
|
71
|
+
}, {
|
|
72
|
+
readonly type: "function";
|
|
73
|
+
readonly name: "version";
|
|
74
|
+
readonly inputs: readonly [];
|
|
75
|
+
readonly outputs: readonly [{
|
|
76
|
+
readonly name: "";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
readonly internalType: "uint256";
|
|
79
|
+
}];
|
|
80
|
+
readonly stateMutability: "view";
|
|
81
|
+
}, {
|
|
82
|
+
readonly type: "error";
|
|
83
|
+
readonly name: "AccountHasSufficientLiquidityException";
|
|
84
|
+
readonly inputs: readonly [];
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "error";
|
|
87
|
+
readonly name: "NotValidGatewayException";
|
|
88
|
+
readonly inputs: readonly [];
|
|
89
|
+
}, {
|
|
90
|
+
readonly type: "error";
|
|
91
|
+
readonly name: "StableCoinIsNotConvertibleException";
|
|
92
|
+
readonly inputs: readonly [];
|
|
93
|
+
}, {
|
|
94
|
+
readonly type: "error";
|
|
95
|
+
readonly name: "UnknownCreditAccountException";
|
|
96
|
+
readonly inputs: readonly [];
|
|
97
|
+
}];
|
|
98
|
+
type abi = typeof abi;
|
|
99
|
+
declare class SecuritizeLiquidator extends BaseContract<abi> {
|
|
100
|
+
constructor(options: ConstructOptions, address: Address);
|
|
101
|
+
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { SecuritizeLiquidator };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/sdk/market/rwa/securitize/constants.d.ts
|
|
2
2
|
declare const RWA_FACTORY_SECURITIZE = "RWA_FACTORY::SECURITIZE";
|
|
3
|
+
declare const RWA_LIQUIDATOR_SECURITIZE = "RWA_LIQUIDATOR::SECURITIZE";
|
|
3
4
|
//#endregion
|
|
4
|
-
export { RWA_FACTORY_SECURITIZE };
|
|
5
|
+
export { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { RWA_FACTORY_SECURITIZE } from "./constants.js";
|
|
1
|
+
import { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./constants.js";
|
|
2
|
+
import { SecuritizeLiquidator } from "./SecuritizeLiquidator.js";
|
|
2
3
|
import { DStokenData, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./types.js";
|
|
3
4
|
import { SecuritizeRWAFactory } from "./SecuritizeRWAFactory.js";
|
|
4
|
-
export { DStokenData, RWA_FACTORY_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature };
|
|
5
|
+
export { DStokenData, RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidator, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { CallParameters } from "viem";
|
|
2
2
|
//#region src/sdk/utils/viem/cast.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Builds the argument list of a `cast call --trace` command reproducing the call,
|
|
5
|
+
* without the leading `cast` binary, so that it can be spawned directly.
|
|
6
|
+
*/
|
|
7
|
+
declare function getCastTraceArgs(params: CallParameters, rpcUrl?: string): string[];
|
|
3
8
|
declare function generateCastTraceCall(params: CallParameters, rpcUrl?: string): string;
|
|
4
9
|
//#endregion
|
|
5
|
-
export { generateCastTraceCall };
|
|
10
|
+
export { generateCastTraceCall, getCastTraceArgs };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulationError, SimulationErrorType, simulateCall } from "./simulateCall.js";
|
|
2
|
+
import { generateCastTraceCall, getCastTraceArgs } from "./cast.js";
|
|
2
3
|
import { DelegatedMulticall, executeDelegatedMulticalls } from "./executeDelegatedMulticalls.js";
|
|
3
4
|
import { EstimateRawTxGasParameters, SendRawTxParameters, estimateRawTxGas, sendRawTx } from "./sendRawTx.js";
|
|
4
5
|
import { SimulateMulticallParameters, SimulateMulticallReturnType, simulateMulticall } from "./simulateMulticall.js";
|
|
5
6
|
import { SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, getSimulateWithPriceUpdatesError, simulateWithPriceUpdates } from "./simulateWithPriceUpdates.js";
|
|
6
7
|
import { WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, watchBlocksAsync } from "./watchBlocksAsync.js";
|
|
7
|
-
export { DelegatedMulticall, EstimateRawTxGasParameters, SendRawTxParameters, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, estimateRawTxGas, executeDelegatedMulticalls, generateCastTraceCall, getSimulateWithPriceUpdatesError, sendRawTx, simulateMulticall, simulateWithPriceUpdates, watchBlocksAsync };
|
|
8
|
+
export { DelegatedMulticall, EstimateRawTxGasParameters, SendRawTxParameters, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, estimateRawTxGas, executeDelegatedMulticalls, generateCastTraceCall, getCastTraceArgs, getSimulateWithPriceUpdatesError, sendRawTx, simulateCall, simulateMulticall, simulateWithPriceUpdates, watchBlocksAsync };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Abi, BaseError, CallParameters, Chain, Client, Hex, Transport, UnionOmit } from "viem";
|
|
2
|
+
//#region src/sdk/utils/viem/simulateCall.d.ts
|
|
3
|
+
type SimulateCallParameters<chain extends Chain | undefined = Chain | undefined> = CallParameters<chain> & {
|
|
4
|
+
/**
|
|
5
|
+
* ABIs used to decode the function and any custom error, but only when the call reverts.
|
|
6
|
+
* Nothing is appended implicitly: pass `errorAbis` yourself to have gearbox exceptions decoded.
|
|
7
|
+
*/
|
|
8
|
+
abis?: readonly (Abi | readonly unknown[])[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Same as {@link SimulateCallParameters}, minus the parts a contract knows about itself.
|
|
12
|
+
*/
|
|
13
|
+
type SimulateCallOptions<chain extends Chain | undefined = Chain | undefined> = UnionOmit<SimulateCallParameters<chain>, "to" | "data">;
|
|
14
|
+
interface SimulateCallReturnType {
|
|
15
|
+
/**
|
|
16
|
+
* Raw bytes returned by the call, `0x` when the function returns nothing.
|
|
17
|
+
*/
|
|
18
|
+
data: Hex;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Simulates raw calldata with `eth_call`, without encoding or decoding anything on success.
|
|
22
|
+
*
|
|
23
|
+
* Use it when calldata already exists (for example a {@link RawTx} built by the SDK): the happy
|
|
24
|
+
* path is a pure passthrough, and the calldata is only decoded when the call reverts, to build a
|
|
25
|
+
* viem {@link ContractFunctionExecutionError} out of the revert data.
|
|
26
|
+
*
|
|
27
|
+
* @param client - viem client to call with.
|
|
28
|
+
* @param parameters - viem call parameters, plus the ABIs used for error decoding.
|
|
29
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
30
|
+
*/
|
|
31
|
+
declare function simulateCall<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: SimulateCallParameters<chain>): Promise<SimulateCallReturnType>;
|
|
32
|
+
type SimulationErrorType = SimulationError & {
|
|
33
|
+
name: "SimulationError";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Thrown by {@link simulateCall} when a simulation fails.
|
|
37
|
+
*
|
|
38
|
+
* The viem {@link ContractFunctionExecutionError} built from the revert data is kept as `cause`,
|
|
39
|
+
* so `walk()` still finds `ContractFunctionRevertedError` and its decoded (or raw) revert data.
|
|
40
|
+
*/
|
|
41
|
+
declare class SimulationError extends BaseError {
|
|
42
|
+
/**
|
|
43
|
+
* The call that failed, kept verbatim so that it can be replayed or traced.
|
|
44
|
+
*/
|
|
45
|
+
readonly request: CallParameters;
|
|
46
|
+
constructor(cause: Error, request: CallParameters, abi: Abi);
|
|
47
|
+
/**
|
|
48
|
+
* Arguments of a `cast call --trace` command replaying this call, for spawning `cast` directly.
|
|
49
|
+
*/
|
|
50
|
+
getCastTraceArgs(rpcUrl?: string): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Full `cast call --trace` command replaying this call.
|
|
53
|
+
*/
|
|
54
|
+
getCastTraceCall(rpcUrl?: string): string;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulationError, SimulationErrorType, simulateCall };
|