@gearbox-protocol/sdk 14.11.0-next.1 → 14.11.0-next.10
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/common-utils/utils/index.js +2 -0
- package/dist/cjs/{history/trace-utils.js → common-utils/utils/trace.js} +62 -5
- package/dist/cjs/dev/index.js +3 -1
- package/dist/cjs/dev/verifyTestnet.js +124 -0
- package/dist/cjs/history/assembleOperations.js +6 -6
- package/dist/cjs/history/classifyMulticallOperations.js +31 -25
- package/dist/cjs/history/index.js +0 -2
- package/dist/cjs/history/parseCreditAccountTransaction.js +5 -6
- package/dist/cjs/history/toLegacyOperation.js +5 -1
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +25 -37
- package/dist/cjs/plugins/adapters/contracts/AccountMigratorAdapterContract.js +9 -0
- package/dist/cjs/{history/internal-types.js → plugins/adapters/transfers.js} +2 -2
- package/dist/cjs/preview/index.js +3 -1
- package/dist/cjs/preview/parse/classifyInnerOperations.js +5 -43
- package/dist/cjs/preview/parse/extractExpectedBalanceChanges.js +48 -0
- package/dist/cjs/preview/parse/index.js +8 -6
- package/dist/cjs/preview/parse/{parseCreditFacadeOperation.js → parseFacadeOperationCalldata.js} +19 -15
- package/dist/cjs/preview/parse/{parseTransaction.js → parseOperationCalldata.js} +10 -10
- package/dist/cjs/preview/parse/{parsePoolOperation.js → parsePoolOperationCalldata.js} +27 -12
- package/dist/cjs/{history/inner-operations.js → preview/parse/types-adapters.js} +2 -2
- package/dist/cjs/preview/parse/types-facades.js +16 -0
- package/dist/cjs/preview/parse/types-pools.js +16 -0
- package/dist/cjs/preview/parse/types.js +9 -2
- package/dist/cjs/preview/prerequisites/buildPrerequisites.js +46 -0
- package/dist/cjs/preview/prerequisites/index.js +2 -0
- package/dist/cjs/preview/prerequisites/prepareAction.js +48 -0
- package/dist/cjs/preview/simulate/constants.js +28 -0
- package/dist/cjs/preview/simulate/{decodeSimulationError.js → errors.js} +37 -3
- package/dist/cjs/preview/simulate/holders.js +45 -0
- package/dist/cjs/preview/simulate/index.js +21 -9
- package/dist/cjs/preview/simulate/simulateFacadeOperation.js +30 -0
- package/dist/cjs/preview/simulate/simulateOperation.js +37 -0
- package/dist/cjs/preview/simulate/simulatePoolOpMulticall.js +155 -0
- package/dist/cjs/preview/simulate/simulatePoolOpV1.js +106 -0
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +30 -62
- package/dist/cjs/{history → preview/trace}/errors.js +0 -26
- package/dist/cjs/preview/trace/extractAdapterCallTraces.js +58 -0
- package/dist/cjs/{history → preview/trace}/extractTransfers.js +10 -13
- package/dist/cjs/{history → preview/trace}/findFacadeCalls.js +3 -3
- package/dist/cjs/preview/trace/index.js +30 -0
- package/dist/cjs/preview/trace/types.js +16 -0
- package/dist/cjs/rewards/rewards/api.js +4 -2
- package/dist/cjs/rewards/rewards/merkl-api.js +9 -3
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +154 -0
- package/dist/esm/common-utils/utils/index.js +1 -0
- package/dist/esm/common-utils/utils/trace.js +93 -0
- package/dist/esm/dev/index.js +1 -0
- package/dist/esm/dev/verifyTestnet.js +98 -0
- package/dist/esm/history/assembleOperations.js +8 -6
- package/dist/esm/history/classifyMulticallOperations.js +29 -23
- package/dist/esm/history/index.js +0 -1
- package/dist/esm/history/parseCreditAccountTransaction.js +3 -4
- package/dist/esm/history/toLegacyOperation.js +5 -1
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +28 -38
- package/dist/esm/plugins/adapters/contracts/AccountMigratorAdapterContract.js +9 -0
- package/dist/esm/preview/index.js +1 -0
- package/dist/esm/preview/parse/classifyInnerOperations.js +6 -46
- package/dist/esm/preview/parse/extractExpectedBalanceChanges.js +24 -0
- package/dist/esm/preview/parse/index.js +4 -3
- package/dist/esm/preview/parse/{parseCreditFacadeOperation.js → parseFacadeOperationCalldata.js} +16 -16
- package/dist/esm/preview/parse/{parseTransaction.js → parseOperationCalldata.js} +6 -6
- package/dist/esm/preview/parse/{parsePoolOperation.js → parsePoolOperationCalldata.js} +23 -8
- package/dist/esm/preview/parse/types-facades.js +0 -0
- package/dist/esm/preview/parse/types-pools.js +0 -0
- package/dist/esm/preview/parse/types.js +4 -1
- package/dist/esm/preview/prerequisites/buildPrerequisites.js +46 -0
- package/dist/esm/preview/prerequisites/index.js +1 -0
- package/dist/esm/preview/prerequisites/prepareAction.js +23 -0
- package/dist/esm/preview/simulate/constants.js +4 -0
- package/dist/esm/preview/simulate/{decodeSimulationError.js → errors.js} +31 -0
- package/dist/esm/preview/simulate/holders.js +21 -0
- package/dist/esm/preview/simulate/index.js +12 -4
- package/dist/esm/preview/simulate/simulateFacadeOperation.js +6 -0
- package/dist/esm/preview/simulate/simulateOperation.js +13 -0
- package/dist/esm/preview/simulate/simulatePoolOpMulticall.js +130 -0
- package/dist/esm/preview/simulate/simulatePoolOpV1.js +82 -0
- package/dist/esm/preview/simulate/simulatePoolOperation.js +33 -62
- package/dist/esm/{history → preview/trace}/errors.js +0 -24
- package/dist/esm/preview/trace/extractAdapterCallTraces.js +40 -0
- package/dist/esm/{history → preview/trace}/extractTransfers.js +10 -13
- package/dist/esm/{history → preview/trace}/findFacadeCalls.js +4 -2
- package/dist/esm/preview/trace/index.js +5 -0
- package/dist/esm/preview/trace/types.js +0 -0
- package/dist/esm/rewards/rewards/api.js +4 -2
- package/dist/esm/rewards/rewards/merkl-api.js +9 -3
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +154 -0
- package/dist/types/common-utils/utils/index.d.ts +1 -0
- package/dist/types/common-utils/utils/trace.d.ts +73 -0
- package/dist/types/dev/index.d.ts +1 -0
- package/dist/types/dev/verifyTestnet.d.ts +82 -0
- package/dist/types/history/assembleOperations.d.ts +11 -6
- package/dist/types/history/classifyMulticallOperations.d.ts +21 -9
- package/dist/types/history/index.d.ts +0 -1
- package/dist/types/history/mapOperations.d.ts +7 -9
- package/dist/types/history/types.d.ts +22 -65
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +16 -17
- package/dist/types/plugins/adapters/contracts/AccountMigratorAdapterContract.d.ts +10 -1
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/transferHelpers.d.ts +1 -1
- package/dist/types/plugins/adapters/transfers.d.ts +17 -0
- package/dist/types/plugins/adapters/types.d.ts +8 -46
- package/dist/types/preview/index.d.ts +1 -0
- package/dist/types/preview/parse/classifyInnerOperations.d.ts +8 -8
- package/dist/types/preview/parse/extractExpectedBalanceChanges.d.ts +22 -0
- package/dist/types/preview/parse/index.d.ts +4 -3
- package/dist/types/preview/parse/parseFacadeOperationCalldata.d.ts +19 -0
- package/dist/types/preview/parse/{parseTransaction.d.ts → parseOperationCalldata.d.ts} +4 -4
- package/dist/types/preview/parse/parsePoolOperationCalldata.d.ts +17 -0
- package/dist/types/preview/parse/types-adapters.d.ts +69 -0
- package/dist/types/preview/parse/types-facades.d.ts +157 -0
- package/dist/types/preview/parse/types-pools.d.ts +55 -0
- package/dist/types/preview/parse/types.d.ts +16 -50
- package/dist/types/preview/prerequisites/buildPrerequisites.d.ts +3 -3
- package/dist/types/preview/prerequisites/index.d.ts +1 -0
- package/dist/types/preview/prerequisites/prepareAction.d.ts +52 -0
- package/dist/types/preview/simulate/constants.d.ts +6 -0
- package/dist/types/preview/simulate/errors.d.ts +51 -0
- package/dist/types/preview/simulate/extractERC20Transfers.d.ts +1 -1
- package/dist/types/preview/simulate/holders.d.ts +7 -0
- package/dist/types/preview/simulate/index.d.ts +9 -4
- package/dist/types/preview/simulate/simulateFacadeOperation.d.ts +25 -0
- package/dist/types/preview/simulate/simulateOperation.d.ts +20 -0
- package/dist/types/preview/simulate/simulatePoolOpMulticall.d.ts +28 -0
- package/dist/types/preview/simulate/simulatePoolOpV1.d.ts +14 -0
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +5 -27
- package/dist/types/preview/simulate/types.d.ts +54 -18
- package/dist/types/{history → preview/trace}/errors.d.ts +0 -10
- package/dist/types/preview/trace/extractAdapterCallTraces.d.ts +23 -0
- package/dist/types/{history → preview/trace}/extractTransfers.d.ts +14 -5
- package/dist/types/{history → preview/trace}/findFacadeCalls.d.ts +3 -2
- package/dist/types/preview/trace/index.d.ts +5 -0
- package/dist/types/preview/trace/types.d.ts +21 -0
- package/dist/types/rewards/rewards/api.d.ts +2 -1
- package/dist/types/rewards/rewards/merkl-api.d.ts +2 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +21 -1
- package/dist/types/sdk/accounts/types.d.ts +82 -0
- package/package.json +1 -1
- package/dist/cjs/history/extractProtocolCalls.js +0 -53
- package/dist/esm/history/extractProtocolCalls.js +0 -32
- package/dist/esm/history/trace-utils.js +0 -36
- package/dist/types/history/extractProtocolCalls.d.ts +0 -8
- package/dist/types/history/inner-operations.d.ts +0 -57
- package/dist/types/history/internal-types.d.ts +0 -47
- package/dist/types/history/trace-utils.d.ts +0 -12
- package/dist/types/preview/parse/parseCreditFacadeOperation.d.ts +0 -18
- package/dist/types/preview/parse/parsePoolOperation.d.ts +0 -15
- package/dist/types/preview/simulate/decodeSimulationError.d.ts +0 -18
- /package/dist/esm/{history/inner-operations.js → plugins/adapters/transfers.js} +0 -0
- /package/dist/esm/{history/internal-types.js → preview/parse/types-adapters.js} +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { OuterFacadeOperation } from "../../history/index.js";
|
|
3
|
-
import type { AdaptersPlugin, TokenTransfer } from "../../plugins/adapters/index.js";
|
|
1
|
+
import type { AdaptersPlugin } from "../../plugins/adapters/index.js";
|
|
4
2
|
import type { OnchainSDK, PluginsMap } from "../../sdk/index.js";
|
|
3
|
+
import type { OuterFacadeOperation } from "./types-facades.js";
|
|
4
|
+
import type { PoolOperation } from "./types-pools.js";
|
|
5
|
+
export * from "./types-adapters.js";
|
|
6
|
+
export * from "./types-facades.js";
|
|
7
|
+
export * from "./types-pools.js";
|
|
5
8
|
/**
|
|
6
9
|
* True when the plugin map `P` contains the {@link AdaptersPlugin} under any
|
|
7
10
|
* key. Matched nominally (the plugin's private fields make it non-structural),
|
|
@@ -26,53 +29,16 @@ export type RequireAdaptersPlugin<P extends PluginsMap> = HasAdaptersPlugin<P> e
|
|
|
26
29
|
*/
|
|
27
30
|
export type SdkWithAdapters<P extends PluginsMap = PluginsMap> = OnchainSDK<P> & RequireAdaptersPlugin<P>;
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
operation: "Deposit";
|
|
35
|
-
pool: Address;
|
|
36
|
-
receiver: Address;
|
|
37
|
-
/** Underlying assets supplied to the pool. */
|
|
38
|
-
assets: bigint;
|
|
39
|
-
underlying: Address;
|
|
40
|
-
/** Referral code, present only for `depositWithReferral` calls. */
|
|
41
|
-
referralCode?: bigint;
|
|
42
|
-
/**
|
|
43
|
-
* ERC-20 transfers involving the wallet, recovered by simulating the call.
|
|
44
|
-
* Empty for the calldata-only parse; populated by the simulation stage.
|
|
45
|
-
*/
|
|
46
|
-
transfers: TokenTransfer[];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* ERC4626 `redeem` from a Gearbox pool.
|
|
50
|
-
* Token metadata (symbol/decimals) is intentionally omitted: consumers resolve
|
|
51
|
-
* it from `sdk.tokensMeta` using the token addresses below.
|
|
52
|
-
*/
|
|
53
|
-
export interface PoolRedeemOperation {
|
|
54
|
-
operation: "Redeem";
|
|
55
|
-
pool: Address;
|
|
56
|
-
receiver: Address;
|
|
57
|
-
owner: Address;
|
|
58
|
-
/** Pool shares (diesel) burned. */
|
|
59
|
-
shares: bigint;
|
|
60
|
-
underlying: Address;
|
|
61
|
-
/**
|
|
62
|
-
* ERC-20 transfers involving the wallet, recovered by simulating the call.
|
|
63
|
-
* Empty for the calldata-only parse; populated by the simulation stage.
|
|
64
|
-
*/
|
|
65
|
-
transfers: TokenTransfer[];
|
|
66
|
-
}
|
|
67
|
-
export type PoolOperation = PoolDepositOperation | PoolRedeemOperation;
|
|
68
|
-
/**
|
|
69
|
-
* Narrows a {@link ParsedTransaction} to a {@link PoolOperation} (deposit or
|
|
70
|
-
* redeem). Used by the UI to decide whether a custom view exists for the parsed
|
|
71
|
-
* result; everything else falls back to the raw JSON view.
|
|
32
|
+
* Result of decoding a single raw operation calldata: either a pool
|
|
33
|
+
* deposit/redeem or one of the credit-facade operations.
|
|
34
|
+
*
|
|
35
|
+
* Calldata-only parse produces base (descriptor) adapter operations, so the
|
|
36
|
+
* facade operations are used with the default `Ext = {}`.
|
|
72
37
|
*/
|
|
73
|
-
export
|
|
38
|
+
export type Operation = PoolOperation | OuterFacadeOperation;
|
|
74
39
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
40
|
+
* Narrows an {@link Operation} to a {@link PoolOperation} (deposit, mint,
|
|
41
|
+
* withdraw or redeem). Used by the UI to decide whether a custom view exists for
|
|
42
|
+
* the parsed result; everything else falls back to the raw JSON view.
|
|
77
43
|
*/
|
|
78
|
-
export
|
|
44
|
+
export declare function isPoolOperation(tx: Operation): tx is PoolOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation } from "../parse/index.js";
|
|
2
2
|
import type { AnyPrerequisite } from "./Prerequisite.js";
|
|
3
3
|
import type { PrerequisiteContext } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
* Derives the on-chain prerequisites for a parsed
|
|
5
|
+
* Derives the on-chain prerequisites for a parsed operation: the conditions
|
|
6
6
|
* that must hold for the call not to revert and that we can verify with the
|
|
7
7
|
* SDK (token approvals, wallet balances).
|
|
8
8
|
*
|
|
@@ -13,4 +13,4 @@ import type { PrerequisiteContext } from "./types.js";
|
|
|
13
13
|
* bot permissions) is intentionally out of scope, since the user cannot
|
|
14
14
|
* resolve it. New {@link AnyPrerequisite} subclasses must follow the same rule.
|
|
15
15
|
*/
|
|
16
|
-
export declare function buildPrerequisites(tx:
|
|
16
|
+
export declare function buildPrerequisites(tx: Operation, ctx: PrerequisiteContext): AnyPrerequisite[];
|
|
@@ -2,5 +2,6 @@ export * from "./AllowancePrerequisite.js";
|
|
|
2
2
|
export * from "./BalancePrerequisite.js";
|
|
3
3
|
export * from "./buildPrerequisites.js";
|
|
4
4
|
export * from "./Prerequisite.js";
|
|
5
|
+
export * from "./prepareAction.js";
|
|
5
6
|
export * from "./runPrerequisites.js";
|
|
6
7
|
export * from "./types.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import type { AnyPrerequisiteResult } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A single transaction that satisfies a sender-actionable prerequisite.
|
|
5
|
+
*
|
|
6
|
+
* The shape is intentionally minimal (`to`/`data`/optional `value`) so it maps
|
|
7
|
+
* directly onto wallet send primitives (e.g. viem `sendTransaction`, wagmi
|
|
8
|
+
* `useSendTransaction`/`useWriteContract`). It is deliberately *not* the heavier
|
|
9
|
+
* {@link import("../../sdk/types/transactions.js").RawTx} used for Safe batches.
|
|
10
|
+
*
|
|
11
|
+
* The `kind` mirrors the prerequisite kind it remediates, so consumers can label
|
|
12
|
+
* the action (e.g. "Approve") without re-deriving it.
|
|
13
|
+
*/
|
|
14
|
+
export interface PrerequisiteAction {
|
|
15
|
+
/** Prerequisite kind this action remediates. */
|
|
16
|
+
kind: "allowance";
|
|
17
|
+
/** Contract the transaction is sent to (the ERC-20 token for allowances). */
|
|
18
|
+
to: Address;
|
|
19
|
+
/** Encoded calldata (e.g. `approve(spender, required)`). */
|
|
20
|
+
data: Hex;
|
|
21
|
+
/** Native value to send; omitted (treated as 0) for ERC-20 approvals. */
|
|
22
|
+
value?: bigint;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Builds the transaction that resolves an unsatisfied, sender-actionable
|
|
26
|
+
* prerequisite, or returns `null` when the prerequisite cannot be fixed with a
|
|
27
|
+
* single wallet transaction.
|
|
28
|
+
*
|
|
29
|
+
* Currently only `allowance` is actionable: it returns an ERC-20
|
|
30
|
+
* `approve(spender, required)` for the exact required amount. `balance`
|
|
31
|
+
* shortfalls (the user must acquire/free up funds) and errored reads are not
|
|
32
|
+
* actionable and return `null`. New actionable kinds (permits, native unwrap,
|
|
33
|
+
* approve-reset-to-zero for non-standard tokens, ...) should be encoded here so
|
|
34
|
+
* consumers do not have to special-case them.
|
|
35
|
+
*
|
|
36
|
+
* Operates on the serializable {@link AnyPrerequisiteResult} produced by
|
|
37
|
+
* `verifyPrerequisites` (not on {@link import("./Prerequisite.js").Prerequisite}
|
|
38
|
+
* instances), so it works against cached/persisted results.
|
|
39
|
+
*
|
|
40
|
+
* @param result - A verified prerequisite result.
|
|
41
|
+
* @returns The remediation transaction, or `null` if not auto-actionable.
|
|
42
|
+
*/
|
|
43
|
+
export declare function preparePrerequisiteAction(result: AnyPrerequisiteResult): PrerequisiteAction | null;
|
|
44
|
+
/**
|
|
45
|
+
* Whether a prerequisite result represents something the sender can fix with a
|
|
46
|
+
* single wallet transaction (i.e. {@link preparePrerequisiteAction} returns a
|
|
47
|
+
* transaction for it).
|
|
48
|
+
*
|
|
49
|
+
* Useful for UIs that distinguish "approve to continue" (actionable) from hard
|
|
50
|
+
* blocks like an insufficient balance (not actionable).
|
|
51
|
+
*/
|
|
52
|
+
export declare function isActionablePrerequisite(result: AnyPrerequisiteResult): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NetworkType } from "../../sdk/chain/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Networks where the `eth_simulateV1` JSON-RPC method is available and usable
|
|
4
|
+
* for pool or credit account operation simulation.
|
|
5
|
+
**/
|
|
6
|
+
export declare const ETH_SIMULATE_V1_NETWORKS: ReadonlySet<NetworkType>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseError, type Hex } from "viem";
|
|
2
|
+
/** Which simulation flow produced a failure. */
|
|
3
|
+
export type SimulationFlowSource = "eth_simulateV1" | "multicall" | "unknown";
|
|
4
|
+
/** A single flow failure with its decoded revert detail. */
|
|
5
|
+
export interface SimulationFlowFailure {
|
|
6
|
+
source: SimulationFlowSource;
|
|
7
|
+
detail: SimulationError;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error returned by the pool simulation when all attempted flows fail.
|
|
11
|
+
*
|
|
12
|
+
* On a single-flow failure it wraps that flow's decoded revert reason; when both
|
|
13
|
+
* the `eth_simulateV1` and multicall flows fail, it carries the details of both
|
|
14
|
+
* (see {@link failures}).
|
|
15
|
+
*/
|
|
16
|
+
export declare class PreviewSimulationError extends BaseError {
|
|
17
|
+
name: string;
|
|
18
|
+
/** Per-flow decoded failures behind this error. */
|
|
19
|
+
readonly failures: SimulationFlowFailure[];
|
|
20
|
+
constructor(failures: SimulationFlowFailure[]);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Normalises an unknown rejection reason into a {@link PreviewSimulationError}.
|
|
24
|
+
* Pass-through when it already is one; otherwise decodes it under `source`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function asPreviewSimulationError(reason: unknown, source: SimulationFlowSource): PreviewSimulationError;
|
|
27
|
+
/** Merges several {@link PreviewSimulationError}s into one carrying all failures. */
|
|
28
|
+
export declare function combinePreviewSimulationErrors(...errors: (PreviewSimulationError | undefined)[]): PreviewSimulationError;
|
|
29
|
+
/** Decoded revert of the simulated transaction. */
|
|
30
|
+
export interface SimulationError {
|
|
31
|
+
/** Human-readable revert reason / error name. */
|
|
32
|
+
reason: string;
|
|
33
|
+
/** Original error, kept for debugging. */
|
|
34
|
+
cause?: unknown;
|
|
35
|
+
}
|
|
36
|
+
/** Per-call slice of a `simulateCalls` failure we need to decode. */
|
|
37
|
+
export interface SimulationRevert {
|
|
38
|
+
error?: Error;
|
|
39
|
+
/** Raw revert return data, when present. */
|
|
40
|
+
data?: Hex;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Decodes a simulated transaction revert into a {@link SimulationError}.
|
|
44
|
+
*
|
|
45
|
+
* The simulated call is raw calldata (no ABI), so viem cannot decode the revert
|
|
46
|
+
* itself. We first try to decode the raw return bytes against the SDK's
|
|
47
|
+
* {@link errorAbis} (Gearbox protocol exceptions plus standard ERC-20 custom
|
|
48
|
+
* errors); failing that, we walk viem's error chain for a
|
|
49
|
+
* {@link ContractFunctionRevertedError} (covers `Error(string)` / `Panic`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function decodeSimulationError(revert: SimulationRevert): SimulationError;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Log } from "viem";
|
|
2
|
-
import type { TokenTransfer } from "
|
|
2
|
+
import type { TokenTransfer } from "../parse/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parses ERC-20 `Transfer` logs and keeps only those involving one of the
|
|
5
5
|
* watched addresses (as sender or receiver). A log that touches several watched
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { PoolOperation } from "../parse/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Distinct addresses whose balances change during the operation: the funds
|
|
5
|
+
* source (payer or share owner) and the receiver.
|
|
6
|
+
*/
|
|
7
|
+
export declare function watchedHolders(operation: PoolOperation, wallet: Address): Address[];
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { ETH_SIMULATE_V1_NETWORKS } from "./constants.js";
|
|
2
|
+
export type { SimulationError, SimulationFlowFailure, SimulationFlowSource, } from "./errors.js";
|
|
3
|
+
export { PreviewSimulationError } from "./errors.js";
|
|
4
|
+
export type { SimulateFacadeOperationInput } from "./simulateFacadeOperation.js";
|
|
5
|
+
export { simulateFacadeOperation } from "./simulateFacadeOperation.js";
|
|
6
|
+
export type { SimulateOperationInput } from "./simulateOperation.js";
|
|
7
|
+
export { simulateOperation } from "./simulateOperation.js";
|
|
8
|
+
export { simulatePoolOperation } from "./simulatePoolOperation.js";
|
|
9
|
+
export type { AddressBalanceChanges, OperationSimulationOptions, PoolOperationSimulation, PoolOperationSimulationInput, PoolOperationSimulationResult, TokenBalanceChange, } from "./types.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
|
+
import type { OuterFacadeOperation } from "../parse/index.js";
|
|
4
|
+
import type { OperationSimulationOptions, PoolOperationSimulation } from "./types.js";
|
|
5
|
+
export interface SimulateFacadeOperationInput {
|
|
6
|
+
/** Only `client`/`networkType` are used, so any OnchainSDK works. */
|
|
7
|
+
sdk: OnchainSDK;
|
|
8
|
+
/** Parsed credit-facade operation to simulate. */
|
|
9
|
+
operation: OuterFacadeOperation;
|
|
10
|
+
/** Target contract the calldata is sent to (the credit facade). */
|
|
11
|
+
to: Address;
|
|
12
|
+
/** Raw credit-facade calldata to simulate. */
|
|
13
|
+
calldata: Hex;
|
|
14
|
+
/** Wallet whose balance changes and transfers we track. */
|
|
15
|
+
wallet: Address;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Simulates a credit-facade operation.
|
|
19
|
+
*
|
|
20
|
+
* Not yet implemented: credit-facade simulation requires multicall-aware
|
|
21
|
+
* balance/transfer accounting that the pool simulation does not cover. The
|
|
22
|
+
* signature mirrors {@link simulatePoolOperation} so the
|
|
23
|
+
* {@link simulateOperation} wrapper can delegate uniformly once implemented.
|
|
24
|
+
*/
|
|
25
|
+
export declare function simulateFacadeOperation(_input: SimulateFacadeOperationInput, _options?: OperationSimulationOptions): Promise<PoolOperationSimulation>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
|
+
import { type Operation } from "../parse/index.js";
|
|
4
|
+
import type { OperationSimulationOptions, PoolOperationSimulation } from "./types.js";
|
|
5
|
+
export interface SimulateOperationInput {
|
|
6
|
+
/** Gearbox SDK instance. */
|
|
7
|
+
sdk: OnchainSDK;
|
|
8
|
+
/** Parsed pool or credit account operation */
|
|
9
|
+
operation: Operation;
|
|
10
|
+
/** Target contract the calldata is sent to. */
|
|
11
|
+
to: Address;
|
|
12
|
+
/** Raw operation calldata to simulate. */
|
|
13
|
+
calldata: Hex;
|
|
14
|
+
/** Wallet whose balance changes and transfers we track. */
|
|
15
|
+
wallet: Address;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Simulates a parsed pool or credit account operation {@link Operation}
|
|
19
|
+
*/
|
|
20
|
+
export declare function simulateOperation(input: SimulateOperationInput, options?: OperationSimulationOptions): Promise<PoolOperationSimulation>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { PoolOperation } from "../parse/index.js";
|
|
3
|
+
import type { AddressBalanceChanges, OperationSimulationOptions, PoolOperationSimulationInput, PoolOperationSimulationResult } from "./types.js";
|
|
4
|
+
/** Reads a watched holder's "before" balance of a token. */
|
|
5
|
+
export type BalanceLookup = (token: Address, holder: Address) => bigint;
|
|
6
|
+
/**
|
|
7
|
+
* Multicall pool-operation flow, used where `eth_simulateV1` is unavailable or
|
|
8
|
+
* as a fallback alongside it.
|
|
9
|
+
*
|
|
10
|
+
* Reads the watched holders' "before" balances together with the matching
|
|
11
|
+
* ERC4626 preview (`previewDeposit`/`previewMint`/`previewWithdraw`/
|
|
12
|
+
* `previewRedeem`) in a single multicall, then computes the theoretical balance
|
|
13
|
+
* changes via {@link computePoolOpBalanceChanges}.
|
|
14
|
+
*
|
|
15
|
+
* Unlike the `eth_simulateV1` flow it does not execute the calldata, so it
|
|
16
|
+
* cannot recover ERC-20 transfers (`transfers` is always `undefined`) and it
|
|
17
|
+
* ignores balance/allowance prerequisites (preview reads succeed regardless).
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link PreviewSimulationError} when the multicall round-trip throws or
|
|
20
|
+
* any call (a balance read or the preview read) reverts.
|
|
21
|
+
*/
|
|
22
|
+
export declare function simulatePoolOpMulticall(input: PoolOperationSimulationInput, options?: OperationSimulationOptions): Promise<PoolOperationSimulationResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Pure computation of {@link AddressBalanceChanges} for a pool operation from
|
|
25
|
+
* its ERC4626 preview result and the watched holders' "before" balances. Legs
|
|
26
|
+
* sharing the same address are grouped together.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computePoolOpBalanceChanges(operation: PoolOperation, wallet: Address, previewAmount: bigint, before: BalanceLookup): AddressBalanceChanges[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OperationSimulationOptions, PoolOperationSimulationInput, PoolOperationSimulationResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* `eth_simulateV1` pool-operation flow.
|
|
4
|
+
*
|
|
5
|
+
* Sandwiches the raw calldata between `balanceOf` reads of the underlying and
|
|
6
|
+
* pool (share) tokens for every watched holder, then derives the balance changes
|
|
7
|
+
* from the before/after diff and the wallet-relevant ERC-20 transfers from the
|
|
8
|
+
* emitted logs. Simulation runs against real chain state (no overrides), so an
|
|
9
|
+
* unmet prerequisite surfaces here as a revert.
|
|
10
|
+
*
|
|
11
|
+
* @throws {@link PreviewSimulationError} when the round-trip throws or the
|
|
12
|
+
* simulated transaction reverts.
|
|
13
|
+
*/
|
|
14
|
+
export declare function simulatePoolOpV1(input: PoolOperationSimulationInput, options?: OperationSimulationOptions): Promise<PoolOperationSimulationResult>;
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
|
-
import type { PoolOperation } from "../parse/index.js";
|
|
4
|
-
import type { PoolSimulationResult } from "./types.js";
|
|
5
|
-
export interface SimulatePoolOperationInput {
|
|
6
|
-
/** Only `client` is used, so any OnchainSDK works. */
|
|
7
|
-
sdk: OnchainSDK;
|
|
8
|
-
/** Parsed operation, used to resolve the underlying and pool tokens. */
|
|
9
|
-
operation: PoolOperation;
|
|
10
|
-
/** Target contract the calldata is sent to (the pool). */
|
|
11
|
-
to: Address;
|
|
12
|
-
/** Raw deposit/redeem calldata to simulate. */
|
|
13
|
-
calldata: Hex;
|
|
14
|
-
/** Wallet whose balance changes and transfers we track. */
|
|
15
|
-
wallet: Address;
|
|
16
|
-
/** Block to simulate at; defaults to latest. Only set for testnet forks. */
|
|
17
|
-
blockNumber?: bigint;
|
|
18
|
-
}
|
|
1
|
+
import type { OperationSimulationOptions, PoolOperationSimulation, PoolOperationSimulationInput } from "./types.js";
|
|
19
2
|
/**
|
|
20
|
-
* Simulates a pool deposit/redeem
|
|
21
|
-
*
|
|
3
|
+
* Simulates a pool deposit/mint/withdraw/redeem and returns the resulting
|
|
4
|
+
* balance changes (and, when available, ERC-20 transfers), or a decoded failure.
|
|
22
5
|
*
|
|
23
|
-
*
|
|
24
|
-
* wallet or the operation recipient (for merging into the parsed operation) and
|
|
25
|
-
* the balance changes grouped by watched address (wallet, plus the recipient
|
|
26
|
-
* when distinct); on revert, returns the decoded reason. Simulation runs against
|
|
27
|
-
* real chain state (no overrides), so an unmet prerequisite surfaces here as a
|
|
28
|
-
* failure.
|
|
6
|
+
* @throws {@link PreviewSimulationError} when the simulation fails.
|
|
29
7
|
*/
|
|
30
|
-
export declare function simulatePoolOperation(input:
|
|
8
|
+
export declare function simulatePoolOperation(input: PoolOperationSimulationInput, options?: OperationSimulationOptions): Promise<PoolOperationSimulation>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
|
+
import type { ILogger } from "../../sdk/types/logger.js";
|
|
4
|
+
import type { PoolOperation, TokenTransfer } from "../parse/index.js";
|
|
5
|
+
import type { PreviewSimulationError } from "./errors.js";
|
|
3
6
|
/**
|
|
4
7
|
* Change in an address's balance of a single token over the simulated call.
|
|
5
8
|
* `delta` is `after - before` (negative when the address spent the token).
|
|
@@ -19,25 +22,58 @@ export interface AddressBalanceChanges {
|
|
|
19
22
|
address: Address;
|
|
20
23
|
changes: TokenBalanceChange[];
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export interface PoolOperationSimulationInput {
|
|
26
|
+
/** Only `client`/`networkType` are used, so any OnchainSDK works. */
|
|
27
|
+
sdk: OnchainSDK;
|
|
28
|
+
/** Parsed operation, used to resolve the underlying and pool tokens. */
|
|
29
|
+
operation: PoolOperation;
|
|
30
|
+
/** Target contract the calldata is sent to (the pool). */
|
|
31
|
+
to: Address;
|
|
32
|
+
/** Raw deposit/mint/withdraw/redeem calldata to simulate. */
|
|
33
|
+
calldata: Hex;
|
|
34
|
+
/** Wallet whose balance changes and transfers we track. */
|
|
35
|
+
wallet: Address;
|
|
36
|
+
}
|
|
37
|
+
export interface OperationSimulationOptions {
|
|
38
|
+
/** Block to simulate at; defaults to latest. */
|
|
39
|
+
blockNumber?: bigint;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to run the `eth_simulateV1` flow (preferred, recovers transfers).
|
|
42
|
+
* When `undefined`, defaults to whether the SDK's network is in
|
|
43
|
+
* {@link ETH_SIMULATE_V1_NETWORKS}.
|
|
44
|
+
*/
|
|
45
|
+
useSimulateV1?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Optional logger.
|
|
48
|
+
**/
|
|
49
|
+
logger?: ILogger;
|
|
28
50
|
}
|
|
29
51
|
/**
|
|
30
|
-
*
|
|
31
|
-
* wallet-filtered ERC-20 transfers
|
|
32
|
-
*
|
|
33
|
-
*
|
|
52
|
+
* Successful simulation of a pool operation: the balance changes grouped by
|
|
53
|
+
* watched address and, when available, the wallet-filtered ERC-20 transfers.
|
|
54
|
+
* This is the success payload of {@link PoolOperationSimulation} without the
|
|
55
|
+
* `status` discriminant.
|
|
34
56
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
export interface PoolOperationSimulationResult {
|
|
58
|
+
/**
|
|
59
|
+
* Balance changes grouped by watched address (wallet, recipient, owner).
|
|
60
|
+
**/
|
|
38
61
|
balanceChanges: AddressBalanceChanges[];
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
/**
|
|
63
|
+
* ERC-20 transfers involving the watched addresses.
|
|
64
|
+
*
|
|
65
|
+
* NOTE: transfers are **not guaranteed** to be returned.
|
|
66
|
+
*/
|
|
67
|
+
transfers?: TokenTransfer[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Outcome of simulating a pool operation. On success it carries a
|
|
71
|
+
* {@link PoolOperationSimulationResult}; on failure it carries a
|
|
72
|
+
* {@link PreviewSimulationError}.
|
|
73
|
+
*/
|
|
74
|
+
export type PoolOperationSimulation = ({
|
|
75
|
+
status: "success";
|
|
76
|
+
} & PoolOperationSimulationResult) | {
|
|
41
77
|
status: "failure";
|
|
42
|
-
error:
|
|
78
|
+
error: PreviewSimulationError;
|
|
43
79
|
};
|
|
@@ -9,16 +9,6 @@ export declare class TransferAlignmentError extends Error {
|
|
|
9
9
|
export declare class WithdrawCollateralAlignmentError extends Error {
|
|
10
10
|
constructor(expected: number, actual: number);
|
|
11
11
|
}
|
|
12
|
-
export declare class ProtocolCallNotFoundError extends Error {
|
|
13
|
-
readonly targetContract: Address;
|
|
14
|
-
readonly executeIndex: number;
|
|
15
|
-
constructor(targetContract: Address, executeIndex: number);
|
|
16
|
-
}
|
|
17
|
-
export declare class AdapterTraceAlignmentError extends Error {
|
|
18
|
-
readonly expected: number;
|
|
19
|
-
readonly actual: number;
|
|
20
|
-
constructor(expected: number, actual: number);
|
|
21
|
-
}
|
|
22
12
|
export declare class UnexpectedFacadeEventOrderError extends Error {
|
|
23
13
|
constructor(e: {
|
|
24
14
|
eventName: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CallTrace } from "../../common-utils/utils/trace.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the user multicall's adapter-level call traces from a single facade
|
|
4
|
+
* call trace.
|
|
5
|
+
*
|
|
6
|
+
* Returns the direct children of the facade trace that perform an external
|
|
7
|
+
* protocol call (their subtree resolves to a `CreditManager.execute(bytes)`
|
|
8
|
+
* that reaches a leaf CALL to a target contract), in trace order.
|
|
9
|
+
*
|
|
10
|
+
* Scoping to direct children of the facade trace (rather than flattening the
|
|
11
|
+
* whole subtree) avoids over-counting in nested credit-manager scenarios such
|
|
12
|
+
* as account migration, where a single migrate-adapter subtree nests another
|
|
13
|
+
* account's `execute(bytes)` calls.
|
|
14
|
+
*
|
|
15
|
+
* Facade-synthesized phantom-token withdrawals are excluded: while processing
|
|
16
|
+
* `withdrawCollateral` on a phantom token the facade issues its own
|
|
17
|
+
* `withdrawPhantomToken` adapter call, which also reaches an external target
|
|
18
|
+
* but does not correspond to a user multicall inner call. These are detected
|
|
19
|
+
* via the preceding `getPhantomTokenInfo()` probe (see
|
|
20
|
+
* {@link isSynthesizedPhantomWithdrawal}), so the returned traces line up 1:1,
|
|
21
|
+
* in order, with the multicall's adapter inner calls.
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractAdapterCallTraces(facadeTrace: CallTrace): CallTrace[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Address, type Log } from "viem";
|
|
2
|
-
import { AddressMap } from "
|
|
3
|
-
import type {
|
|
4
|
-
import type { DirectTransferInfo } from "./types.js";
|
|
2
|
+
import { AddressMap } from "../../sdk/index.js";
|
|
3
|
+
import type { TokenTransfer } from "../parse/index.js";
|
|
5
4
|
type RawLog = Log<bigint | number, number, false>;
|
|
6
5
|
/**
|
|
7
6
|
* Effective `withdrawCollateral` outcome decoded from the facade's
|
|
@@ -25,8 +24,18 @@ export interface WithdrawCollateralEventInfo {
|
|
|
25
24
|
* @param creditAccount - the credit account address to track
|
|
26
25
|
*/
|
|
27
26
|
export interface ExtractTransfersResult {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/**
|
|
28
|
+
* ERC-20 transfers grouped per facade `Execute` event, one inner array per
|
|
29
|
+
* Execute event across the whole transaction, in emission order. Each inner
|
|
30
|
+
* array holds the transfers to/from the credit account that occurred between
|
|
31
|
+
* that Execute boundary and the previous one.
|
|
32
|
+
*/
|
|
33
|
+
executeTransfers: TokenTransfer[][];
|
|
34
|
+
/**
|
|
35
|
+
* ERC-20 transfers that are not part of a facade `Execute` event and are
|
|
36
|
+
* direct incoming transfers to the credit account.
|
|
37
|
+
*/
|
|
38
|
+
directTransfers: TokenTransfer[];
|
|
30
39
|
liquidationRemainingFunds?: bigint;
|
|
31
40
|
/** Maps phantom token address to its deposited (underlying) token address. */
|
|
32
41
|
phantomTokens: AddressMap<Address>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
2
|
+
import { type CallTrace } from "../../common-utils/utils/trace.js";
|
|
3
|
+
import type { ChainContractsRegister } from "../../sdk/index.js";
|
|
4
|
+
import type { FacadeParsedCall } from "./types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Walks a `debug_traceTransaction` callTracer tree, finds all non-reverted
|
|
6
7
|
* calls to the credit facade, parses them via the register, and returns
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { CallTrace } from "../../common-utils/utils/trace.js";
|
|
3
|
+
import type { ParsedCallV2 } from "../../sdk/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The set of credit facade entry-point functions that produce history operations.
|
|
6
|
+
*/
|
|
7
|
+
export type FacadeCallType = "MultiCall" | "BotMulticall" | "OpenCreditAccount" | "CloseCreditAccount" | "LiquidateCreditAccount" | "PartiallyLiquidateCreditAccount";
|
|
8
|
+
/**
|
|
9
|
+
* A parsed credit facade call extracted from a call trace,
|
|
10
|
+
* with inner multicall calls already decoded.
|
|
11
|
+
*/
|
|
12
|
+
export interface FacadeParsedCall {
|
|
13
|
+
operation: FacadeCallType;
|
|
14
|
+
creditAccount: Address;
|
|
15
|
+
/** The full ParsedCallV2 from facade calldata parsing. */
|
|
16
|
+
parsed: ParsedCallV2;
|
|
17
|
+
/** Inner multicall entries from rawArgs.calls (empty for partiallyLiquidateCreditAccount). */
|
|
18
|
+
innerCalls: ParsedCallV2[];
|
|
19
|
+
/** The full call trace node for this facade call (used to extract protocol-level calldata). */
|
|
20
|
+
trace: CallTrace;
|
|
21
|
+
}
|
|
@@ -26,10 +26,11 @@ export interface GetLmRewardsMerkleProps {
|
|
|
26
26
|
account: Address;
|
|
27
27
|
network: NetworkType;
|
|
28
28
|
reportError?: ReportHandler;
|
|
29
|
+
apiKey?: string;
|
|
29
30
|
}
|
|
30
31
|
export declare class RewardAmountAPI {
|
|
31
32
|
private constructor();
|
|
32
|
-
static getLmRewardsMerkle({ pools, account, network, reportError, }: GetLmRewardsMerkleProps): Promise<GearboxExtraMerkleLmReward[]>;
|
|
33
|
+
static getLmRewardsMerkle({ pools, account, network, reportError, apiKey, }: GetLmRewardsMerkleProps): Promise<GearboxExtraMerkleLmReward[]>;
|
|
33
34
|
private static extractFulfilled;
|
|
34
35
|
}
|
|
35
36
|
export {};
|
|
@@ -39,7 +39,8 @@ export declare class MerkleXYZApi {
|
|
|
39
39
|
private constructor();
|
|
40
40
|
static defaultDomain: string;
|
|
41
41
|
static angleDomain: string;
|
|
42
|
-
static
|
|
42
|
+
static apiKeyHeader: string;
|
|
43
|
+
static fetchWithFallback: <T>(getUrl: (domain: string) => string, apiKey?: string) => Promise<import("axios").AxiosResponse<T, any, {}>>;
|
|
43
44
|
static getUserRewardsUrl: (options: UserOptions) => (domain: string) => string;
|
|
44
45
|
}
|
|
45
46
|
export {};
|