@gearbox-protocol/sdk 13.2.0-next.1 → 13.2.0
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/dev/AccountOpener.js +5 -45
- package/dist/cjs/dev/index.js +13 -0
- package/dist/cjs/dev/isTransientError.js +5 -1
- package/dist/cjs/dev/logSplitterTransport.js +154 -0
- package/dist/cjs/plugins/zappers/ZappersPlugin.js +144 -0
- package/dist/cjs/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +6 -110
- package/dist/cjs/plugins/zappers/index.js +26 -0
- package/dist/cjs/plugins/zappers/package.json +1 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +104 -462
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +5 -16
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +32 -255
- package/dist/cjs/sdk/base/index.js +0 -2
- package/dist/cjs/sdk/chain/chains.js +1 -2
- package/dist/cjs/sdk/constants/index.js +2 -0
- package/dist/cjs/sdk/{base/token-types.js → constants/phantom-tokens.js} +3 -9
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/market/MarketSuite.js +0 -6
- package/dist/cjs/sdk/market/index.js +1 -3
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -17
- package/dist/cjs/sdk/market/pool/index.js +0 -4
- package/dist/cjs/sdk/pools/AbstractPoolService.js +137 -0
- package/dist/cjs/{abi/iStateSerializer.js → sdk/pools/PoolServiceV310.js} +8 -14
- package/dist/cjs/sdk/pools/createPoolService.js +35 -0
- package/dist/cjs/sdk/pools/index.js +4 -2
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +0 -16
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/dev/index.js +10 -0
- package/dist/esm/dev/isTransientError.js +5 -1
- package/dist/esm/dev/logSplitterTransport.js +131 -0
- package/dist/esm/plugins/zappers/ZappersPlugin.js +126 -0
- package/dist/esm/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +2 -109
- package/dist/esm/plugins/zappers/index.js +3 -0
- package/dist/esm/plugins/zappers/package.json +1 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +104 -462
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +5 -16
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +32 -261
- package/dist/esm/sdk/base/index.js +0 -1
- package/dist/esm/sdk/chain/chains.js +1 -2
- package/dist/esm/sdk/constants/index.js +1 -0
- package/dist/esm/sdk/{base/token-types.js → constants/phantom-tokens.js} +0 -4
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +0 -6
- package/dist/esm/sdk/market/index.js +0 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -17
- package/dist/esm/sdk/market/pool/index.js +0 -2
- package/dist/esm/sdk/pools/AbstractPoolService.js +113 -0
- package/dist/esm/sdk/pools/PoolServiceV310.js +6 -0
- package/dist/esm/sdk/pools/createPoolService.js +11 -0
- package/dist/esm/sdk/pools/index.js +2 -1
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/viem/sendRawTx.js +1 -19
- package/dist/types/dev/index.d.ts +1 -0
- package/dist/types/dev/logSplitterTransport.d.ts +118 -0
- package/dist/types/plugins/zappers/ZappersPlugin.d.ts +18 -0
- package/dist/types/plugins/zappers/extraZappers.d.ts +6 -0
- package/dist/types/plugins/zappers/index.d.ts +3 -0
- package/dist/types/plugins/zappers/types.d.ts +12 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +27 -123
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +8 -108
- package/dist/types/sdk/base/TokensMeta.d.ts +18 -34
- package/dist/types/sdk/base/index.d.ts +0 -1
- package/dist/types/sdk/base/types.d.ts +1 -0
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/constants/index.d.ts +1 -0
- package/dist/types/sdk/constants/phantom-tokens.d.ts +2 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/MarketSuite.d.ts +0 -3
- package/dist/types/sdk/market/credit/CreditFacadeV310BaseContract.d.ts +1 -1
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/index.d.ts +0 -2
- package/dist/types/sdk/pools/AbstractPoolService.d.ts +9 -0
- package/dist/types/sdk/pools/PoolServiceV310.d.ts +4 -0
- package/dist/types/sdk/pools/createPoolService.d.ts +3 -0
- package/dist/types/sdk/pools/index.d.ts +2 -1
- package/dist/types/sdk/pools/types.d.ts +63 -84
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +1 -5
- package/package.json +5 -3
- package/dist/cjs/abi/310/iSecuritizeDegenNFT.js +0 -263
- package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +0 -278
- package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +0 -97
- package/dist/cjs/sdk/pools/PoolService.js +0 -391
- package/dist/esm/abi/310/iSecuritizeDegenNFT.js +0 -239
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +0 -254
- package/dist/esm/abi/iStateSerializer.js +0 -12
- package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +0 -73
- package/dist/esm/sdk/pools/PoolService.js +0 -371
- package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +0 -324
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +0 -322
- package/dist/types/abi/iStateSerializer.d.ts +0 -11
- package/dist/types/sdk/base/token-types.d.ts +0 -33
- package/dist/types/sdk/market/ZapperRegister.d.ts +0 -17
- package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +0 -345
- package/dist/types/sdk/market/types.d.ts +0 -10
- package/dist/types/sdk/pools/PoolService.d.ts +0 -14
- /package/dist/cjs/{sdk/market → plugins/zappers}/types.js +0 -0
- /package/dist/esm/{sdk/market → plugins/zappers}/types.js +0 -0
|
@@ -1,56 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Address, Chain, PublicClient, Transport } from "viem";
|
|
2
|
+
import type { PhantomTokenContractType } from "../constants/index.js";
|
|
2
3
|
import type { Asset } from "../router/index.js";
|
|
3
|
-
import type { ILogger } from "../types/logger.js";
|
|
4
4
|
import { AddressMap } from "../utils/index.js";
|
|
5
|
-
import
|
|
5
|
+
import type { TokenMetaData } from "./types.js";
|
|
6
6
|
export interface FormatBNOptions {
|
|
7
7
|
precision?: number;
|
|
8
8
|
symbol?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export interface TokenMetaDataExtended extends TokenMetaData {
|
|
11
|
+
/**
|
|
12
|
+
* Undefined if token is not a phantom token
|
|
13
|
+
*/
|
|
14
|
+
phantomTokenType?: PhantomTokenContractType;
|
|
15
|
+
}
|
|
16
|
+
export declare class TokensMeta extends AddressMap<TokenMetaDataExtended> {
|
|
11
17
|
#private;
|
|
12
|
-
constructor(client: PublicClient<Transport, Chain
|
|
18
|
+
constructor(client: PublicClient<Transport, Chain>);
|
|
13
19
|
reset(): void;
|
|
14
|
-
upsert(address: string, value: TokenMetaData | undefined): void;
|
|
15
20
|
symbol(token: Address): string;
|
|
16
21
|
decimals(token: Address): number;
|
|
17
22
|
/**
|
|
18
|
-
* Returns
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
isPhantomToken(t: TokenMetaData): t is PhantomTokenMeta;
|
|
23
|
-
/**
|
|
24
|
-
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
25
|
-
* @param t
|
|
26
|
-
* @returns
|
|
23
|
+
* Returns the phantom token type for a given token, or undefined for normal tokens
|
|
24
|
+
* Throws if the phantom token data is not loaded
|
|
27
25
|
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Returns true if the token is a DSToken, throws if the token data is not loaded
|
|
31
|
-
* @param t
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
isDSToken(t: TokenMetaData): t is DSTokenMeta;
|
|
26
|
+
phantomTokenType(token: Address): PhantomTokenContractType | undefined;
|
|
35
27
|
/**
|
|
36
28
|
* Returns a map of all phantom tokens
|
|
37
|
-
* Throws if token data is not loaded
|
|
38
|
-
*/
|
|
39
|
-
get phantomTokens(): AddressMap<PhantomTokenMeta>;
|
|
40
|
-
/**
|
|
41
|
-
* Returns a map of all KYC underlying tokens
|
|
42
|
-
* Throws if token data is not loaded
|
|
29
|
+
* Throws if the phantom token data is not loaded
|
|
43
30
|
*/
|
|
44
|
-
get
|
|
45
|
-
get dsTokens(): AddressMap<DSTokenMeta>;
|
|
31
|
+
get phantomTokens(): AddressMap<TokenMetaDataExtended>;
|
|
46
32
|
formatBN(asset: Asset, options?: FormatBNOptions): string;
|
|
47
33
|
formatBN(token: Address, amount: number | bigint | string | undefined, options?: FormatBNOptions): string;
|
|
48
34
|
findBySymbol(symbol: string): TokenMetaData | undefined;
|
|
49
35
|
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
50
36
|
/**
|
|
51
|
-
* Loads token
|
|
52
|
-
*
|
|
53
|
-
* @param tokens - tokens to load data for, defaults to all tokens
|
|
37
|
+
* Loads phantom token data for all known tokens from chain
|
|
54
38
|
*/
|
|
55
|
-
|
|
39
|
+
loadPhantomTokens(): Promise<void>;
|
|
56
40
|
}
|
|
@@ -35,6 +35,7 @@ export type CreditManagerState = CreditSuiteState["creditManager"];
|
|
|
35
35
|
export type CreditFacadeState = CreditSuiteState["creditFacade"];
|
|
36
36
|
export type CreditConfiguratorState = CreditSuiteState["creditConfigurator"];
|
|
37
37
|
export type AdapterData = Unarray<CreditSuiteState["adapters"]>;
|
|
38
|
+
export type TokenMetaData = Unarray<MarketData["tokens"]>;
|
|
38
39
|
export type PoolState = MarketData["pool"];
|
|
39
40
|
export type QuotaKeeperState = MarketData["quotaKeeper"];
|
|
40
41
|
export type QuotaState = Unarray<QuotaKeeperState["quotas"]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain } from "viem";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
|
-
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs"
|
|
3
|
+
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs";
|
|
4
4
|
export interface GearboxChain extends Chain {
|
|
5
5
|
network: NetworkType;
|
|
6
6
|
defaultMarketConfigurators: Record<Address, Curator>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const PHANTOM_TOKEN_CONTRACT_TYPES: readonly ["PHANTOM_TOKEN::CONVEX", "PHANTOM_TOKEN::INFINIFI_UNWIND", "PHANTOM_TOKEN::INFRARED", "PHANTOM_TOKEN::MELLOW_WITHDRAWAL", "PHANTOM_TOKEN::MIDAS_REDEMPTION", "PHANTOM_TOKEN::STAKING_REWARDS", "PHANTOM_TOKEN::UPSHIFT_WITHDRAW"];
|
|
2
|
+
export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { MarketData, MarketFilter } from "../base/index.js";
|
|
3
|
+
import { SDKConstruct } from "../base/index.js";
|
|
3
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
4
5
|
import type { MarketStateHuman } from "../types/index.js";
|
|
5
6
|
import { AddressMap } from "../utils/index.js";
|
|
@@ -8,8 +9,7 @@ import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
|
8
9
|
import { MarketSuite } from "./MarketSuite.js";
|
|
9
10
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
10
11
|
import type { PoolSuite } from "./pool/index.js";
|
|
11
|
-
|
|
12
|
-
export declare class MarketRegister extends ZapperRegister {
|
|
12
|
+
export declare class MarketRegister extends SDKConstruct {
|
|
13
13
|
#private;
|
|
14
14
|
constructor(sdk: GearboxSDK, ignoreMarkets?: Address[]);
|
|
15
15
|
hydrate(state: MarketData[]): void;
|
|
@@ -8,7 +8,6 @@ import { type ILossPolicyContract } from "./loss-policy/index.js";
|
|
|
8
8
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
9
9
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
10
10
|
import { PoolSuite } from "./pool/index.js";
|
|
11
|
-
import type { SecuritizeKYCFactory } from "./pool/SecuritizeKYCFactory.js";
|
|
12
11
|
export declare class MarketSuite extends SDKConstruct {
|
|
13
12
|
readonly acl: Address;
|
|
14
13
|
readonly treasury: Address;
|
|
@@ -22,8 +21,6 @@ export declare class MarketSuite extends SDKConstruct {
|
|
|
22
21
|
*/
|
|
23
22
|
readonly state: MarketData;
|
|
24
23
|
constructor(sdk: GearboxSDK, marketData: MarketData);
|
|
25
|
-
get underlying(): Address;
|
|
26
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
27
24
|
get dirty(): boolean;
|
|
28
25
|
get watchAddresses(): Set<Address>;
|
|
29
26
|
stateHuman(raw?: boolean): MarketStateHuman;
|
|
@@ -844,8 +844,8 @@ declare const abi: readonly [{
|
|
|
844
844
|
readonly anonymous: false;
|
|
845
845
|
}];
|
|
846
846
|
type abi = typeof abi;
|
|
847
|
-
export { abi as creditFacadeV310Abi };
|
|
848
847
|
export type { abi as CreditFacadeV310Abi };
|
|
848
|
+
export { abi as creditFacadeV310Abi };
|
|
849
849
|
/**
|
|
850
850
|
* SDK-less facade contract, only needs address
|
|
851
851
|
*/
|
|
@@ -6,7 +6,6 @@ import type { PoolSuiteStateHuman } from "../../types/index.js";
|
|
|
6
6
|
import type { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
|
|
7
7
|
import { GaugeContract } from "./GaugeContract.js";
|
|
8
8
|
import { LinearInterestRateModelContract } from "./LinearInterestRateModelContract.js";
|
|
9
|
-
import type { SecuritizeKYCFactory } from "./SecuritizeKYCFactory.js";
|
|
10
9
|
import { TumblerContract } from "./TumblerContract.js";
|
|
11
10
|
import type { IInterestRateModelContract, IRateKeeperContract, PoolContract, PoolQuotaKeeperContract } from "./types.js";
|
|
12
11
|
export declare class PoolSuite extends SDKConstruct {
|
|
@@ -21,7 +20,6 @@ export declare class PoolSuite extends SDKConstruct {
|
|
|
21
20
|
get linearModel(): LinearInterestRateModelContract;
|
|
22
21
|
get marketConfigurator(): MarketConfiguratorContract;
|
|
23
22
|
get underlying(): Address;
|
|
24
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
25
23
|
get dirty(): boolean;
|
|
26
24
|
get watchAddresses(): Set<Address>;
|
|
27
25
|
stateHuman(raw?: boolean): PoolSuiteStateHuman;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { ContractEventName, DecodeFunctionDataReturnType, Log } from "viem";
|
|
2
|
-
import type { CreditManagerDebtParams, PoolState } from "../../base/index.js";
|
|
2
|
+
import type { ConstructOptions, CreditManagerDebtParams, PoolState } from "../../base/index.js";
|
|
3
3
|
import { BaseContract } from "../../base/index.js";
|
|
4
|
-
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
5
4
|
import type { PoolStateHuman } from "../../types/index.js";
|
|
6
5
|
import { AddressMap } from "../../utils/index.js";
|
|
7
|
-
import { SecuritizeKYCFactory } from "./SecuritizeKYCFactory.js";
|
|
8
6
|
declare const abi: readonly [{
|
|
9
7
|
readonly type: "function";
|
|
10
8
|
readonly inputs: readonly [];
|
|
@@ -1132,10 +1130,8 @@ type abi = typeof abi;
|
|
|
1132
1130
|
export interface PoolV310Contract extends Omit<PoolState, "baseParams" | "creditManagerDebtParams" | "name">, BaseContract<abi> {
|
|
1133
1131
|
}
|
|
1134
1132
|
export declare class PoolV310Contract extends BaseContract<abi> {
|
|
1135
|
-
#private;
|
|
1136
1133
|
readonly creditManagerDebtParams: AddressMap<CreditManagerDebtParams>;
|
|
1137
|
-
constructor(
|
|
1138
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
1134
|
+
constructor(options: ConstructOptions, data: PoolState);
|
|
1139
1135
|
stateHuman(raw?: boolean): PoolStateHuman;
|
|
1140
1136
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
1141
1137
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SDKConstruct } from "../base/index.js";
|
|
2
|
+
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
3
|
+
import type { AddLiquidityCall, AddLiquidityProps, RemoveLiquidityCall, RemoveLiquidityProps } from "./types.js";
|
|
4
|
+
export declare abstract class AbstractPoolService extends SDKConstruct {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(sdk: GearboxSDK, version: number);
|
|
7
|
+
addLiquidity({ collateral, pool, account, zapper, permit, nativeTokenAddress, referralCode, migrate, }: AddLiquidityProps): AddLiquidityCall;
|
|
8
|
+
removeLiquidity({ pool, amount, account, zapper, permit, }: RemoveLiquidityProps): RemoveLiquidityCall;
|
|
9
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
3
|
+
import type { ierc20ZapperDepositsAbi } from "../../abi/iERC20ZapperDeposits.js";
|
|
4
|
+
import type { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
|
|
5
|
+
import type { iZapperAbi } from "../../abi/iZapper.js";
|
|
4
6
|
import type { Asset } from "../router/index.js";
|
|
7
|
+
interface IZapper {
|
|
8
|
+
zapper: Address;
|
|
9
|
+
tokenIn: Address;
|
|
10
|
+
tokenOut: Address;
|
|
11
|
+
}
|
|
5
12
|
interface PermitResult {
|
|
6
13
|
r: Address;
|
|
7
14
|
s: Address;
|
|
@@ -13,105 +20,77 @@ interface PermitResult {
|
|
|
13
20
|
deadline: bigint;
|
|
14
21
|
nonce: bigint;
|
|
15
22
|
}
|
|
16
|
-
export type PoolServiceCall<abi extends Abi | readonly unknown[] = Abi, functionName extends ContractFunctionName<abi, "nonpayable" | "payable"> = ContractFunctionName<abi, "nonpayable" | "payable">, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName> = ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>> = {
|
|
17
|
-
abi: abi;
|
|
18
|
-
functionName: functionName;
|
|
19
|
-
args: args;
|
|
20
|
-
target: Address;
|
|
21
|
-
value?: bigint;
|
|
22
|
-
};
|
|
23
23
|
export interface AddLiquidityProps {
|
|
24
24
|
collateral: Asset;
|
|
25
25
|
pool: Address;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
account: Address;
|
|
27
|
+
migrate: boolean;
|
|
28
|
+
zapper: IZapper | undefined;
|
|
29
|
+
permit: PermitResult | undefined;
|
|
30
|
+
nativeTokenAddress: Address;
|
|
31
|
+
referralCode: bigint | undefined;
|
|
30
32
|
}
|
|
33
|
+
export type AddLiquidityCall = [
|
|
34
|
+
{
|
|
35
|
+
target: Address;
|
|
36
|
+
abi: typeof iethZapperDepositsAbi;
|
|
37
|
+
functionName: "depositWithReferral";
|
|
38
|
+
args: [Address, bigint];
|
|
39
|
+
value: bigint;
|
|
40
|
+
} | {
|
|
41
|
+
target: Address;
|
|
42
|
+
abi: typeof ierc20ZapperDepositsAbi;
|
|
43
|
+
functionName: "depositWithReferralAndPermit";
|
|
44
|
+
args: [bigint, Address, bigint, bigint, number, Address, Address];
|
|
45
|
+
} | {
|
|
46
|
+
target: Address;
|
|
47
|
+
abi: typeof ierc20ZapperDepositsAbi;
|
|
48
|
+
functionName: "depositWithReferral";
|
|
49
|
+
args: [bigint, Address, bigint];
|
|
50
|
+
} | {
|
|
51
|
+
target: Address;
|
|
52
|
+
abi: typeof iPoolV310Abi;
|
|
53
|
+
functionName: "depositWithReferral";
|
|
54
|
+
args: [bigint, Address, bigint];
|
|
55
|
+
}
|
|
56
|
+
];
|
|
31
57
|
export interface RemoveLiquidityProps {
|
|
32
58
|
pool: Address;
|
|
33
59
|
amount: bigint;
|
|
34
|
-
|
|
60
|
+
account: Address;
|
|
35
61
|
permit: PermitResult | undefined;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
export interface DepositMetadata {
|
|
39
|
-
/**
|
|
40
|
-
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
41
|
-
*/
|
|
42
|
-
zapper?: ZapperData;
|
|
43
|
-
/**
|
|
44
|
-
* Before deposit user will nedd to call approve method on token that he wants to deposit,
|
|
45
|
-
* this is the spender address that will be used to call approve method.
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
approveTarget: Address;
|
|
49
|
-
/**
|
|
50
|
-
* If true, user can avoid approval step and deposit with permit
|
|
51
|
-
*/
|
|
52
|
-
permissible: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Type of deposit
|
|
55
|
-
*/
|
|
56
|
-
type: "kyc-on-demand" | "kyc-default" | "classic";
|
|
57
|
-
}
|
|
58
|
-
export interface WithdrawalMetadata {
|
|
59
|
-
/**
|
|
60
|
-
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
61
|
-
*/
|
|
62
|
-
zapper?: ZapperData;
|
|
63
|
-
/**
|
|
64
|
-
* Before deposit user will nedd to call approve method on token that he wants to deposit,
|
|
65
|
-
* this is the spender address that will be used to call approve method.
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
approveTarget?: Address;
|
|
69
|
-
/**
|
|
70
|
-
* If true, user can avoid approval step and deposit with permit
|
|
71
|
-
*/
|
|
72
|
-
permissible: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Type of deposit
|
|
75
|
-
*/
|
|
76
|
-
type: "kyc-on-demand" | "kyc-default" | "classic";
|
|
62
|
+
zapper: IZapper;
|
|
77
63
|
}
|
|
64
|
+
export type RemoveLiquidityCall = [
|
|
65
|
+
{
|
|
66
|
+
target: Address;
|
|
67
|
+
abi: typeof iZapperAbi;
|
|
68
|
+
functionName: "redeemWithPermit";
|
|
69
|
+
args: [bigint, Address, bigint, number, Address, Address];
|
|
70
|
+
} | {
|
|
71
|
+
target: Address;
|
|
72
|
+
abi: typeof iZapperAbi;
|
|
73
|
+
functionName: "redeem";
|
|
74
|
+
args: [bigint, Address];
|
|
75
|
+
} | {
|
|
76
|
+
target: Address;
|
|
77
|
+
abi: typeof iPoolV310Abi;
|
|
78
|
+
functionName: "redeem";
|
|
79
|
+
args: [bigint, Address, Address];
|
|
80
|
+
}
|
|
81
|
+
];
|
|
78
82
|
export interface IPoolsService {
|
|
79
83
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @param pool
|
|
82
|
-
*/
|
|
83
|
-
getDepositTokensIn(pool: Address): Address[];
|
|
84
|
-
/**
|
|
85
|
-
* Returns list of tokens that user can receive after depositing to a pool,
|
|
86
|
-
* depends on the pool type and the token being deposited (one of returned by {@link getDepositTokensIn}).
|
|
87
|
-
*
|
|
88
|
-
* Can return empty array if no tokens can be received (e.g. for KYC underlying on demand)
|
|
89
|
-
*
|
|
90
|
-
* @param pool
|
|
91
|
-
* @param tokenIn
|
|
92
|
-
*/
|
|
93
|
-
getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
94
|
-
/**
|
|
95
|
-
* After user chooses tokenIn from {@link getDepositTokensIn} and tokenOut from {@link getDepositTokensOut},
|
|
96
|
-
* this method returns metadata that will be used to perform the deposit.
|
|
97
|
-
*
|
|
98
|
-
* @param pool
|
|
99
|
-
* @param tokenIn
|
|
100
|
-
* @param tokenOut can be undefined if deposit is not resulting in a token out (e.g. for KYC underlying on demand)
|
|
101
|
-
*/
|
|
102
|
-
getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
|
|
103
|
-
/**
|
|
104
|
-
* Returns contract call parameters for adding liquidity to a pool
|
|
105
|
-
* Or undefined if no deposit action is required (e.g. for KYC underlying on demand)
|
|
84
|
+
* Add liquidity to a pool
|
|
106
85
|
* @param props - {@link AddLiquidityProps}
|
|
107
86
|
* @returns - {@link AddLiquidityCall}
|
|
108
87
|
*/
|
|
109
|
-
addLiquidity(props: AddLiquidityProps):
|
|
88
|
+
addLiquidity(props: AddLiquidityProps): AddLiquidityCall;
|
|
110
89
|
/**
|
|
111
90
|
* Remove liquidity from a pool
|
|
112
91
|
* @param props - {@link RemoveLiquidityProps}
|
|
113
92
|
* @returns - {@link RemoveLiquidityCall}
|
|
114
93
|
*/
|
|
115
|
-
removeLiquidity(props: RemoveLiquidityProps):
|
|
94
|
+
removeLiquidity(props: RemoveLiquidityProps): RemoveLiquidityCall;
|
|
116
95
|
}
|
|
117
96
|
export {};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { Account, Chain, Client, SendTransactionRequest, SendTransactionReturnType, Transport } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { 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.2.0
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -63,7 +63,9 @@
|
|
|
63
63
|
"prepare": "husky",
|
|
64
64
|
"check": "biome check --write",
|
|
65
65
|
"check:ci": "biome check --diagnostic-level=error",
|
|
66
|
-
"typecheck:ci": "tsc --noEmit"
|
|
66
|
+
"typecheck:ci": "tsc --noEmit",
|
|
67
|
+
"docs": "NODE_OPTIONS='--max-old-space-size=8192' pnpm --filter @gearbox-protocol/sdk-docs build",
|
|
68
|
+
"docs:dev": "pnpm --filter @gearbox-protocol/sdk-docs start"
|
|
67
69
|
},
|
|
68
70
|
"dependencies": {
|
|
69
71
|
"@gearbox-protocol/integrations-v3": "1.54.2",
|
|
@@ -112,5 +114,5 @@
|
|
|
112
114
|
"biome check --no-errors-on-unmatched --write"
|
|
113
115
|
]
|
|
114
116
|
},
|
|
115
|
-
"packageManager": "
|
|
117
|
+
"packageManager": "pnpm@10.33.0"
|
|
116
118
|
}
|