@gearbox-protocol/sdk 13.3.3 → 13.3.5
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/sdk/GearboxSDK.js +135 -20
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +78 -157
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +5 -5
- package/dist/cjs/sdk/base/BaseContract.js +26 -6
- package/dist/cjs/sdk/base/ChainContractsRegister.js +39 -2
- package/dist/cjs/sdk/base/Construct.js +15 -3
- package/dist/cjs/sdk/base/TokensMeta.js +23 -0
- package/dist/cjs/sdk/constants/address-provider.js +0 -22
- package/dist/cjs/sdk/core/AbstractAddressProviderContract.js +15 -0
- package/dist/cjs/sdk/market/MarketRegister.js +74 -3
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +31 -50
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedRef.js +16 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +55 -12
- package/dist/cjs/sdk/options.js +30 -24
- package/dist/cjs/sdk/plugins/BasePlugin.js +24 -0
- package/dist/cjs/sdk/pools/AbstractPoolService.js +6 -0
- package/dist/cjs/sdk/router/AbstractRouterContract.js +4 -1
- package/dist/cjs/sdk/router/RouterV310Contract.js +20 -15
- package/dist/cjs/sdk/utils/AddressMap.js +53 -17
- package/dist/cjs/sdk/utils/AddressSet.js +9 -0
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/sdk/GearboxSDK.js +135 -20
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +78 -157
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +5 -5
- package/dist/esm/sdk/base/BaseContract.js +26 -6
- package/dist/esm/sdk/base/ChainContractsRegister.js +39 -2
- package/dist/esm/sdk/base/Construct.js +15 -3
- package/dist/esm/sdk/base/TokensMeta.js +23 -0
- package/dist/esm/sdk/constants/address-provider.js +0 -21
- package/dist/esm/sdk/core/AbstractAddressProviderContract.js +15 -0
- package/dist/esm/sdk/market/MarketRegister.js +74 -3
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +31 -50
- package/dist/esm/sdk/market/pricefeeds/PriceFeedRef.js +16 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +55 -12
- package/dist/esm/sdk/options.js +30 -24
- package/dist/esm/sdk/plugins/BasePlugin.js +24 -0
- package/dist/esm/sdk/pools/AbstractPoolService.js +6 -0
- package/dist/esm/sdk/router/AbstractRouterContract.js +4 -1
- package/dist/esm/sdk/router/RouterV310Contract.js +20 -15
- package/dist/esm/sdk/utils/AddressMap.js +53 -17
- package/dist/esm/sdk/utils/AddressSet.js +9 -0
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/sdk/GearboxSDK.d.ts +236 -34
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +56 -142
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +14 -5
- package/dist/types/sdk/accounts/types.d.ts +230 -18
- package/dist/types/sdk/base/BaseContract.d.ts +67 -6
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +51 -2
- package/dist/types/sdk/base/Construct.d.ts +31 -0
- package/dist/types/sdk/base/PlaceholderContract.d.ts +3 -0
- package/dist/types/sdk/base/SDKConstruct.d.ts +10 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +59 -2
- package/dist/types/sdk/base/types.d.ts +185 -25
- package/dist/types/sdk/chain/chains.d.ts +78 -18
- package/dist/types/sdk/chain/detectNetwork.d.ts +7 -0
- package/dist/types/sdk/constants/address-provider.d.ts +4 -3
- package/dist/types/sdk/core/AbstractAddressProviderContract.d.ts +23 -0
- package/dist/types/sdk/core/types.d.ts +46 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +81 -0
- package/dist/types/sdk/market/adapters/PlaceholderAdapterContracts.d.ts +3 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +40 -50
- package/dist/types/sdk/market/oracle/types.d.ts +76 -57
- package/dist/types/sdk/market/pricefeeds/AbstractLPPriceFeed.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/PriceFeedRef.d.ts +22 -2
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +77 -13
- package/dist/types/sdk/market/pricefeeds/types.d.ts +70 -10
- package/dist/types/sdk/options.d.ts +13 -4
- package/dist/types/sdk/plugins/BasePlugin.d.ts +39 -0
- package/dist/types/sdk/plugins/types.d.ts +73 -43
- package/dist/types/sdk/pools/AbstractPoolService.d.ts +12 -0
- package/dist/types/sdk/pools/types.d.ts +75 -6
- package/dist/types/sdk/router/AbstractRouterContract.d.ts +21 -2
- package/dist/types/sdk/router/RouterV310Contract.d.ts +27 -15
- package/dist/types/sdk/router/types.d.ts +51 -69
- package/dist/types/sdk/types/state.d.ts +32 -3
- package/dist/types/sdk/utils/AddressMap.d.ts +61 -17
- package/dist/types/sdk/utils/AddressSet.d.ts +15 -0
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +4 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { CreditAccountData, IBaseContract } from "../base/index.js";
|
|
3
3
|
import type { MultiCall } from "../types/index.js";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Type of swap the router should perform.
|
|
6
|
+
*
|
|
7
|
+
* - `"EXACT_INPUT"` — swap an exact amount of the input token.
|
|
8
|
+
* - `"EXACT_INPUT_ALL"` — swap the entire balance of the input token.
|
|
9
|
+
* - `"EXACT_OUTPUT"` — swap to receive an exact amount of the output token (no longer supported by the router).
|
|
10
|
+
**/
|
|
5
11
|
export type SwapOperation = "EXACT_INPUT" | "EXACT_INPUT_ALL" | "EXACT_OUTPUT";
|
|
6
|
-
export interface PathOption {
|
|
7
|
-
target: Address;
|
|
8
|
-
option: number;
|
|
9
|
-
totalOptions: number;
|
|
10
|
-
}
|
|
11
|
-
export type PathOptionSerie = Array<PathOption>;
|
|
12
12
|
/**
|
|
13
13
|
* Result returned from router contract
|
|
14
14
|
*/
|
|
@@ -65,8 +65,18 @@ export interface RouterCloseResult extends RouterResult {
|
|
|
65
65
|
*/
|
|
66
66
|
underlyingBalance: bigint;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* A token address paired with a balance, used throughout the router to
|
|
70
|
+
* represent holdings, collateral inputs, and leftover targets.
|
|
71
|
+
**/
|
|
68
72
|
export interface Asset {
|
|
73
|
+
/**
|
|
74
|
+
* ERC-20 token address.
|
|
75
|
+
**/
|
|
69
76
|
token: Address;
|
|
77
|
+
/**
|
|
78
|
+
* Token amount in the token's native decimals.
|
|
79
|
+
**/
|
|
70
80
|
balance: bigint;
|
|
71
81
|
}
|
|
72
82
|
/**
|
|
@@ -78,50 +88,14 @@ export interface RouterCMSlice {
|
|
|
78
88
|
collateralTokens: Array<Address>;
|
|
79
89
|
}
|
|
80
90
|
/**
|
|
81
|
-
*
|
|
82
|
-
|
|
91
|
+
* Minimal slice of credit-account data required by router operations.
|
|
92
|
+
**/
|
|
83
93
|
export type RouterCASlice = Pick<CreditAccountData, "tokens" | "enabledTokensMask" | "underlying" | "creditAccount" | "creditFacade" | "debt" | "totalDebtUSD" | "creditManager">;
|
|
94
|
+
/**
|
|
95
|
+
* Lightweight slice of credit-account data containing only token
|
|
96
|
+
* balances and the enabled-tokens bitmask.
|
|
97
|
+
**/
|
|
84
98
|
export type CreditAccountTokensSlice = Pick<CreditAccountData, "creditAccount" | "tokens" | "enabledTokensMask">;
|
|
85
|
-
export interface FindAllSwapsProps {
|
|
86
|
-
/**
|
|
87
|
-
* Minimal credit account data on which operation is performed
|
|
88
|
-
*/
|
|
89
|
-
creditAccount: RouterCASlice;
|
|
90
|
-
/**
|
|
91
|
-
* Minimal credit manager data on which operation is performed
|
|
92
|
-
*/
|
|
93
|
-
creditManager: RouterCMSlice;
|
|
94
|
-
/**
|
|
95
|
-
* {@link SwapOperation} = "EXACT_INPUT" | "EXACT_INPUT_ALL" | "EXACT_OUTPUT"; however router stopped to support EXACT_OUTPUT
|
|
96
|
-
*/
|
|
97
|
-
swapOperation: SwapOperation;
|
|
98
|
-
/**
|
|
99
|
-
* Address of input token
|
|
100
|
-
*/
|
|
101
|
-
tokenIn: Address;
|
|
102
|
-
/**
|
|
103
|
-
* Address of target token
|
|
104
|
-
*/
|
|
105
|
-
tokenOut: Address;
|
|
106
|
-
/**
|
|
107
|
-
* Incoming amount of tokenIn to swap
|
|
108
|
-
*/
|
|
109
|
-
amount: bigint;
|
|
110
|
-
/**
|
|
111
|
-
* Amount that should be left on account after swap; technically equals to 0 in the most of the cases
|
|
112
|
-
*/
|
|
113
|
-
leftoverAmount: bigint;
|
|
114
|
-
/**
|
|
115
|
-
* Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
116
|
-
*/
|
|
117
|
-
slippage: number | bigint;
|
|
118
|
-
}
|
|
119
|
-
export interface FindClosePathInput {
|
|
120
|
-
pathOptions: Array<PathOptionSerie>;
|
|
121
|
-
expected: Array<Asset>;
|
|
122
|
-
leftover: Array<Asset>;
|
|
123
|
-
connectors: Array<Address>;
|
|
124
|
-
}
|
|
125
99
|
export interface FindOneTokenPathProps {
|
|
126
100
|
/**
|
|
127
101
|
* Minimal credit account data on which operation is performed
|
|
@@ -136,7 +110,7 @@ export interface FindOneTokenPathProps {
|
|
|
136
110
|
*/
|
|
137
111
|
tokenIn: Address;
|
|
138
112
|
/**
|
|
139
|
-
*
|
|
113
|
+
* Address of target token
|
|
140
114
|
*/
|
|
141
115
|
tokenOut: Address;
|
|
142
116
|
/**
|
|
@@ -206,7 +180,7 @@ export interface FindBestClosePathProps {
|
|
|
206
180
|
*/
|
|
207
181
|
keepAssets?: Address[];
|
|
208
182
|
/**
|
|
209
|
-
* Debt only mode - will try to sell just
|
|
183
|
+
* Debt only mode - will try to sell just enough of most valuable token to cover debt
|
|
210
184
|
*/
|
|
211
185
|
debtOnly?: boolean;
|
|
212
186
|
}
|
|
@@ -228,35 +202,43 @@ export interface ClosePathBalances {
|
|
|
228
202
|
*/
|
|
229
203
|
tokensToClaim?: Array<Asset>;
|
|
230
204
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
205
|
+
/**
|
|
206
|
+
* On-chain router contract that finds optimal multi-hop swap paths
|
|
207
|
+
* for credit-account operations: single-token swaps, open-strategy
|
|
208
|
+
* collateral conversion, reward claiming, and full account closure.
|
|
209
|
+
**/
|
|
236
210
|
export interface IRouterContract extends IBaseContract {
|
|
237
211
|
/**
|
|
238
|
-
* Find the best path to swap
|
|
212
|
+
* Find the best path to swap one token into another.
|
|
213
|
+
*
|
|
239
214
|
* @param props - {@link FindOneTokenPathProps}
|
|
240
|
-
* @
|
|
241
|
-
|
|
215
|
+
* @returns The optimal swap result including amount, slippage-adjusted
|
|
216
|
+
* minimum, and the multi-call sequence to execute.
|
|
217
|
+
**/
|
|
242
218
|
findOneTokenPath: (props: FindOneTokenPathProps) => Promise<RouterResult>;
|
|
243
219
|
/**
|
|
244
|
-
*
|
|
220
|
+
* Find the best path for opening a credit account by converting all
|
|
221
|
+
* collateral (except leftovers) into a single target token.
|
|
222
|
+
*
|
|
245
223
|
* @param props - {@link FindOpenStrategyPathProps}
|
|
246
|
-
* @returns result -
|
|
247
|
-
|
|
224
|
+
* @returns Swap result with projected post-open balances.
|
|
225
|
+
**/
|
|
248
226
|
findOpenStrategyPath: (props: FindOpenStrategyPathProps) => Promise<OpenStrategyResult>;
|
|
249
227
|
/**
|
|
250
|
-
*
|
|
228
|
+
* Construct calls to claim all pending rewards on a credit account
|
|
229
|
+
* and swap them to the underlying token.
|
|
230
|
+
*
|
|
251
231
|
* @param props - {@link FindClaimAllRewardsProps}
|
|
252
|
-
* @returns
|
|
253
|
-
|
|
232
|
+
* @returns Multi-call sequence for claiming and swapping rewards.
|
|
233
|
+
**/
|
|
254
234
|
findClaimAllRewards: (props: FindClaimAllRewardsProps) => Promise<RouterRewardsResult>;
|
|
255
235
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
236
|
+
* Find the best path to swap all credit-account assets into the
|
|
237
|
+
* underlying token. Used for account closure and liquidation.
|
|
238
|
+
*
|
|
258
239
|
* @param props - {@link FindBestClosePathProps}
|
|
259
|
-
* @
|
|
260
|
-
|
|
240
|
+
* @returns Swap result including the total underlying balance
|
|
241
|
+
* after all swaps.
|
|
242
|
+
**/
|
|
261
243
|
findBestClosePath: (props: FindBestClosePathProps) => Promise<RouterCloseResult>;
|
|
262
244
|
}
|
|
@@ -2,17 +2,46 @@ import type { MarketData } from "../base/index.js";
|
|
|
2
2
|
import type { NetworkType } from "../chain/chains.js";
|
|
3
3
|
import type { AddressProviderState } from "../core/index.js";
|
|
4
4
|
import type { PluginStatesMap, PluginsMap } from "../plugins/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Complete serialisable snapshot of the Gearbox SDK state.
|
|
7
|
+
*
|
|
8
|
+
* Produced by {@link GearboxSDK.state} and consumed by
|
|
9
|
+
* {@link GearboxSDK.hydrate} for instant offline restoration.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam Plugins - Map of plugin names to plugin instances.
|
|
12
|
+
**/
|
|
5
13
|
export interface GearboxState<Plugins extends PluginsMap = {}> {
|
|
6
14
|
/**
|
|
7
|
-
* State version, checked
|
|
8
|
-
* This is not the
|
|
9
|
-
|
|
15
|
+
* State format version, checked during hydration.
|
|
16
|
+
* This is *not* the `@gearbox-protocol/sdk` package version.
|
|
17
|
+
**/
|
|
10
18
|
version: number;
|
|
19
|
+
/**
|
|
20
|
+
* Gearbox network type the snapshot was taken from.
|
|
21
|
+
**/
|
|
11
22
|
network: NetworkType;
|
|
23
|
+
/**
|
|
24
|
+
* EVM chain ID the snapshot was taken from.
|
|
25
|
+
**/
|
|
12
26
|
chainId: number;
|
|
27
|
+
/**
|
|
28
|
+
* Block number the snapshot corresponds to.
|
|
29
|
+
**/
|
|
13
30
|
currentBlock: bigint;
|
|
31
|
+
/**
|
|
32
|
+
* Block timestamp (Unix epoch seconds).
|
|
33
|
+
**/
|
|
14
34
|
timestamp: bigint;
|
|
35
|
+
/**
|
|
36
|
+
* Address provider contract state.
|
|
37
|
+
**/
|
|
15
38
|
addressProvider: AddressProviderState;
|
|
39
|
+
/**
|
|
40
|
+
* All loaded market data.
|
|
41
|
+
**/
|
|
16
42
|
markets: MarketData[];
|
|
43
|
+
/**
|
|
44
|
+
* Per-plugin serialised state.
|
|
45
|
+
**/
|
|
17
46
|
plugins: PluginStatesMap<Plugins>;
|
|
18
47
|
}
|
|
@@ -1,50 +1,94 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Case-insensitive map keyed by EVM addresses.
|
|
4
|
+
*
|
|
5
|
+
* All keys are checksummed via viem's {@link getAddress} on insertion and
|
|
6
|
+
* lookup, so `0xabc...` and `0xABC...` resolve to the same entry.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam T - Type of values stored in the map.
|
|
9
|
+
*/
|
|
2
10
|
export declare class AddressMap<T> {
|
|
3
11
|
#private;
|
|
12
|
+
/**
|
|
13
|
+
* @param entries - Optional initial key-value pairs. Address strings are checksummed automatically.
|
|
14
|
+
* @param name - Optional label used in error messages when a lookup fails.
|
|
15
|
+
*/
|
|
4
16
|
constructor(entries?: Array<[string, T]>, name?: string);
|
|
5
17
|
/**
|
|
6
|
-
* Adds or updates value
|
|
7
|
-
* @param address
|
|
8
|
-
* @param value
|
|
18
|
+
* Adds or updates a value. Passing `undefined` removes the entry.
|
|
19
|
+
* @param address - EVM address (checksummed automatically).
|
|
20
|
+
* @param value - Value to store, or `undefined` to delete the entry.
|
|
21
|
+
* @throws If the map has been {@link freeze | frozen}.
|
|
9
22
|
*/
|
|
10
23
|
upsert(address: string, value: T | undefined): void;
|
|
11
24
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param address
|
|
14
|
-
* @param value
|
|
25
|
+
* Inserts a value, throwing if the address is already present.
|
|
26
|
+
* @param address - EVM address (checksummed automatically).
|
|
27
|
+
* @param value - Value to store.
|
|
28
|
+
* @throws If the map has been {@link freeze | frozen} or if `address` already exists.
|
|
15
29
|
*/
|
|
16
30
|
insert(address: string, value: T): void;
|
|
17
31
|
/**
|
|
18
|
-
* Checks
|
|
19
|
-
* @param address
|
|
20
|
-
* @returns
|
|
32
|
+
* Checks whether an address is present in the map.
|
|
33
|
+
* @param address - EVM address (case-insensitive).
|
|
21
34
|
*/
|
|
22
35
|
has(address: string): boolean;
|
|
23
36
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param address
|
|
26
|
-
* @returns
|
|
37
|
+
* Looks up a value by EVM address (case-insensitive).
|
|
38
|
+
* @param address - EVM address to look up.
|
|
39
|
+
* @returns The stored value, or `undefined` if not present.
|
|
27
40
|
*/
|
|
28
41
|
get(address: string): T | undefined;
|
|
29
42
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param address
|
|
32
|
-
* @
|
|
43
|
+
* Looks up a value by EVM address, throwing if the address is absent.
|
|
44
|
+
* @param address - EVM address to look up.
|
|
45
|
+
* @throws If `address` is not in the map.
|
|
33
46
|
*/
|
|
34
47
|
mustGet(address: string): T;
|
|
35
48
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param address
|
|
49
|
+
* Removes an entry by address. No-op if the address is absent.
|
|
50
|
+
* @param address - EVM address to remove.
|
|
38
51
|
*/
|
|
39
52
|
delete(address: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Removes all entries from the map.
|
|
55
|
+
**/
|
|
40
56
|
clear(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Returns all entries as an array of `[checksummedAddress, value]` tuples.
|
|
59
|
+
**/
|
|
41
60
|
entries(): Array<[Address, T]>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns all values in insertion order.
|
|
63
|
+
**/
|
|
42
64
|
values(): T[];
|
|
65
|
+
/**
|
|
66
|
+
* Returns all checksummed addresses in insertion order.
|
|
67
|
+
**/
|
|
43
68
|
keys(): Address[];
|
|
69
|
+
/**
|
|
70
|
+
* Converts the map to a plain `Record<Address, T>` object.
|
|
71
|
+
**/
|
|
44
72
|
asRecord(): Record<Address, T>;
|
|
73
|
+
/**
|
|
74
|
+
* Number of entries in the map.
|
|
75
|
+
**/
|
|
45
76
|
get size(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Prevents further mutations. Any subsequent call to {@link upsert},
|
|
79
|
+
* {@link insert}, or {@link delete} will throw.
|
|
80
|
+
*/
|
|
46
81
|
freeze(): void;
|
|
47
82
|
protected get name(): string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Creates an `AddressMap` from a plain record object.
|
|
85
|
+
* @param record - Object whose keys are EVM addresses.
|
|
86
|
+
*/
|
|
48
87
|
static fromRecord<T>(record: Record<Address, T>): AddressMap<T>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates an `AddressMap` by extracting an address from each array element.
|
|
90
|
+
* @param array - Source items.
|
|
91
|
+
* @param mapFn - Function that returns the address key for a given item.
|
|
92
|
+
*/
|
|
49
93
|
static fromMappedArray<T>(array: T[], mapFn: (item: T) => Address): AddressMap<T>;
|
|
50
94
|
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Case-insensitive set of EVM addresses.
|
|
4
|
+
*
|
|
5
|
+
* All addresses are checksummed via viem's {@link getAddress} on insertion and
|
|
6
|
+
* lookup, so `0xabc...` and `0xABC...` are treated as the same entry.
|
|
7
|
+
*/
|
|
2
8
|
export declare class AddressSet extends Set<Address> {
|
|
9
|
+
/**
|
|
10
|
+
* @param entries - Optional initial addresses. Each is checksummed automatically.
|
|
11
|
+
*/
|
|
3
12
|
constructor(entries?: Iterable<Address>);
|
|
4
13
|
add(value: Address): this;
|
|
5
14
|
delete(value: Address): boolean;
|
|
6
15
|
has(value: Address): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Returns all addresses as an array.
|
|
18
|
+
**/
|
|
7
19
|
asArray(): Address[];
|
|
20
|
+
/**
|
|
21
|
+
* Maps each address through `fn` and returns the resulting array.
|
|
22
|
+
**/
|
|
8
23
|
map<T>(fn: (address: Address) => T): T[];
|
|
9
24
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Account, Chain, Client, SendTransactionRequest, SendTransactionReturnType, Transport } from "viem";
|
|
2
|
-
import { type SendTransactionParameters } from "viem/actions";
|
|
2
|
+
import { type EstimateGasParameters, type SendTransactionParameters } from "viem/actions";
|
|
3
3
|
import type { RawTx } from "../../types/index.js";
|
|
4
4
|
export type SendRawTxParameters<chain extends Chain, account extends Account | undefined, request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends Chain | undefined = undefined> = Omit<SendTransactionParameters<chain, account, chainOverride, request>, "data" | "to" | "value"> & {
|
|
5
5
|
tx: Pick<RawTx, "to" | "callData" | "value">;
|
|
6
6
|
};
|
|
7
7
|
export declare function sendRawTx<chain extends Chain, account extends Account | undefined, const request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends Chain | undefined>(client: Client<Transport, chain, account>, params: SendRawTxParameters<chain, account, request, chainOverride>): Promise<SendTransactionReturnType>;
|
|
8
|
+
export type EstimateRawTxGasParameters<chain extends Chain> = Omit<EstimateGasParameters<chain>, "data" | "to" | "value"> & {
|
|
9
|
+
tx: Pick<RawTx, "to" | "callData" | "value">;
|
|
10
|
+
};
|
|
11
|
+
export declare function estimateRawTxGas<chain extends Chain, account extends Account | undefined>(client: Client<Transport, chain, account>, params: EstimateRawTxGasParameters<chain>): Promise<bigint>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "13.3.
|
|
3
|
+
"version": "13.3.5",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
"check:ci": "biome check --diagnostic-level=error",
|
|
71
71
|
"typecheck:ci": "tsc --noEmit",
|
|
72
72
|
"docs": "NODE_OPTIONS='--max-old-space-size=8192' pnpm --filter @gearbox-protocol/sdk-docs build",
|
|
73
|
-
"docs:dev": "pnpm --filter @gearbox-protocol/sdk-docs start"
|
|
73
|
+
"docs:dev": "pnpm --filter @gearbox-protocol/sdk-docs start",
|
|
74
|
+
"docs:serve": "pnpm --filter @gearbox-protocol/sdk-docs serve"
|
|
74
75
|
},
|
|
75
76
|
"dependencies": {
|
|
76
77
|
"@gearbox-protocol/integrations-v3": "1.54.2",
|
|
@@ -103,6 +104,7 @@
|
|
|
103
104
|
"tsx": "^4.21.0",
|
|
104
105
|
"typescript": "^5.9.3",
|
|
105
106
|
"viem-deal": "^2.0.4",
|
|
107
|
+
"vite": "^8.0.3",
|
|
106
108
|
"vitest": "^4.1.2"
|
|
107
109
|
},
|
|
108
110
|
"peerDependencies": {
|