@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.
Files changed (105) hide show
  1. package/dist/cjs/dev/AccountOpener.js +5 -45
  2. package/dist/cjs/dev/index.js +13 -0
  3. package/dist/cjs/dev/isTransientError.js +5 -1
  4. package/dist/cjs/dev/logSplitterTransport.js +154 -0
  5. package/dist/cjs/plugins/zappers/ZappersPlugin.js +144 -0
  6. package/dist/cjs/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +6 -110
  7. package/dist/cjs/plugins/zappers/index.js +26 -0
  8. package/dist/cjs/plugins/zappers/package.json +1 -0
  9. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +104 -462
  10. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +5 -16
  11. package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
  12. package/dist/cjs/sdk/base/TokensMeta.js +32 -255
  13. package/dist/cjs/sdk/base/index.js +0 -2
  14. package/dist/cjs/sdk/chain/chains.js +1 -2
  15. package/dist/cjs/sdk/constants/index.js +2 -0
  16. package/dist/cjs/sdk/{base/token-types.js → constants/phantom-tokens.js} +3 -9
  17. package/dist/cjs/sdk/market/MarketRegister.js +2 -2
  18. package/dist/cjs/sdk/market/MarketSuite.js +0 -6
  19. package/dist/cjs/sdk/market/index.js +1 -3
  20. package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
  21. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -17
  22. package/dist/cjs/sdk/market/pool/index.js +0 -4
  23. package/dist/cjs/sdk/pools/AbstractPoolService.js +137 -0
  24. package/dist/cjs/{abi/iStateSerializer.js → sdk/pools/PoolServiceV310.js} +8 -14
  25. package/dist/cjs/sdk/pools/createPoolService.js +35 -0
  26. package/dist/cjs/sdk/pools/index.js +4 -2
  27. package/dist/cjs/sdk/utils/AddressMap.js +1 -1
  28. package/dist/cjs/sdk/utils/viem/sendRawTx.js +0 -16
  29. package/dist/esm/dev/AccountOpener.js +6 -47
  30. package/dist/esm/dev/index.js +10 -0
  31. package/dist/esm/dev/isTransientError.js +5 -1
  32. package/dist/esm/dev/logSplitterTransport.js +131 -0
  33. package/dist/esm/plugins/zappers/ZappersPlugin.js +126 -0
  34. package/dist/esm/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +2 -109
  35. package/dist/esm/plugins/zappers/index.js +3 -0
  36. package/dist/esm/plugins/zappers/package.json +1 -0
  37. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +104 -462
  38. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +5 -16
  39. package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
  40. package/dist/esm/sdk/base/TokensMeta.js +32 -261
  41. package/dist/esm/sdk/base/index.js +0 -1
  42. package/dist/esm/sdk/chain/chains.js +1 -2
  43. package/dist/esm/sdk/constants/index.js +1 -0
  44. package/dist/esm/sdk/{base/token-types.js → constants/phantom-tokens.js} +0 -4
  45. package/dist/esm/sdk/market/MarketRegister.js +2 -2
  46. package/dist/esm/sdk/market/MarketSuite.js +0 -6
  47. package/dist/esm/sdk/market/index.js +0 -1
  48. package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
  49. package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -17
  50. package/dist/esm/sdk/market/pool/index.js +0 -2
  51. package/dist/esm/sdk/pools/AbstractPoolService.js +113 -0
  52. package/dist/esm/sdk/pools/PoolServiceV310.js +6 -0
  53. package/dist/esm/sdk/pools/createPoolService.js +11 -0
  54. package/dist/esm/sdk/pools/index.js +2 -1
  55. package/dist/esm/sdk/utils/AddressMap.js +1 -1
  56. package/dist/esm/sdk/utils/viem/sendRawTx.js +1 -19
  57. package/dist/types/dev/index.d.ts +1 -0
  58. package/dist/types/dev/logSplitterTransport.d.ts +118 -0
  59. package/dist/types/plugins/zappers/ZappersPlugin.d.ts +18 -0
  60. package/dist/types/plugins/zappers/extraZappers.d.ts +6 -0
  61. package/dist/types/plugins/zappers/index.d.ts +3 -0
  62. package/dist/types/plugins/zappers/types.d.ts +12 -0
  63. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +27 -123
  64. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
  65. package/dist/types/sdk/accounts/types.d.ts +8 -108
  66. package/dist/types/sdk/base/TokensMeta.d.ts +18 -34
  67. package/dist/types/sdk/base/index.d.ts +0 -1
  68. package/dist/types/sdk/base/types.d.ts +1 -0
  69. package/dist/types/sdk/chain/chains.d.ts +1 -1
  70. package/dist/types/sdk/constants/index.d.ts +1 -0
  71. package/dist/types/sdk/constants/phantom-tokens.d.ts +2 -0
  72. package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
  73. package/dist/types/sdk/market/MarketSuite.d.ts +0 -3
  74. package/dist/types/sdk/market/credit/CreditFacadeV310BaseContract.d.ts +1 -1
  75. package/dist/types/sdk/market/index.d.ts +0 -1
  76. package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
  77. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
  78. package/dist/types/sdk/market/pool/index.d.ts +0 -2
  79. package/dist/types/sdk/pools/AbstractPoolService.d.ts +9 -0
  80. package/dist/types/sdk/pools/PoolServiceV310.d.ts +4 -0
  81. package/dist/types/sdk/pools/createPoolService.d.ts +3 -0
  82. package/dist/types/sdk/pools/index.d.ts +2 -1
  83. package/dist/types/sdk/pools/types.d.ts +63 -84
  84. package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
  85. package/dist/types/sdk/utils/viem/sendRawTx.d.ts +1 -5
  86. package/package.json +5 -3
  87. package/dist/cjs/abi/310/iSecuritizeDegenNFT.js +0 -263
  88. package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +0 -278
  89. package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +0 -97
  90. package/dist/cjs/sdk/pools/PoolService.js +0 -391
  91. package/dist/esm/abi/310/iSecuritizeDegenNFT.js +0 -239
  92. package/dist/esm/abi/310/iSecuritizeKYCFactory.js +0 -254
  93. package/dist/esm/abi/iStateSerializer.js +0 -12
  94. package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +0 -73
  95. package/dist/esm/sdk/pools/PoolService.js +0 -371
  96. package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +0 -324
  97. package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +0 -322
  98. package/dist/types/abi/iStateSerializer.d.ts +0 -11
  99. package/dist/types/sdk/base/token-types.d.ts +0 -33
  100. package/dist/types/sdk/market/ZapperRegister.d.ts +0 -17
  101. package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +0 -345
  102. package/dist/types/sdk/market/types.d.ts +0 -10
  103. package/dist/types/sdk/pools/PoolService.d.ts +0 -14
  104. /package/dist/cjs/{sdk/market → plugins/zappers}/types.js +0 -0
  105. /package/dist/esm/{sdk/market → plugins/zappers}/types.js +0 -0
@@ -1,56 +1,40 @@
1
- import { type Address, type Chain, type PublicClient, type Transport } from "viem";
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 { type DSTokenMeta, type KYCTokenMeta, type PhantomTokenMeta, type TokenMetaData } from "./token-types.js";
5
+ import type { TokenMetaData } from "./types.js";
6
6
  export interface FormatBNOptions {
7
7
  precision?: number;
8
8
  symbol?: boolean;
9
9
  }
10
- export declare class TokensMeta extends AddressMap<TokenMetaData> {
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>, logger?: ILogger);
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 true if the token is a phantom token, throws if the token data is not loaded
19
- * @param t
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
- isKYCUnderlying(t: TokenMetaData): t is KYCTokenMeta;
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 kycUnderlyings(): AddressMap<KYCTokenMeta>;
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 information about phantom tokens, KYC underlying tokens and DSTokens
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
- loadTokenData(...tokens: Address[]): Promise<void>;
39
+ loadPhantomTokens(): Promise<void>;
56
40
  }
@@ -5,5 +5,4 @@ export * from "./errors.js";
5
5
  export * from "./PlaceholderContract.js";
6
6
  export * from "./SDKConstruct.js";
7
7
  export * from "./TokensMeta.js";
8
- export * from "./token-types.js";
9
8
  export * from "./types.js";
@@ -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" | "Securitize";
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>;
@@ -4,4 +4,5 @@ export * from "./bot-permissions.js";
4
4
  export * from "./math.js";
5
5
  export * from "./networks.js";
6
6
  export * from "./periphery.js";
7
+ export * from "./phantom-tokens.js";
7
8
  export * from "./versions.js";
@@ -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
- import { ZapperRegister } from "./ZapperRegister.js";
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
  */
@@ -5,4 +5,3 @@ export * from "./MarketSuite.js";
5
5
  export * from "./oracle/index.js";
6
6
  export * from "./pool/index.js";
7
7
  export * from "./pricefeeds/index.js";
8
- export * from "./types.js";
@@ -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(sdk: GearboxSDK, data: PoolState);
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[];
@@ -1,6 +1,4 @@
1
1
  export * from "./GaugeContract.js";
2
2
  export * from "./LinearInterestRateModelContract.js";
3
3
  export * from "./PoolSuite.js";
4
- export * from "./PoolV310Contract.js";
5
- export * from "./SecuritizeKYCFactory.js";
6
4
  export * from "./types.js";
@@ -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
+ }
@@ -0,0 +1,4 @@
1
+ import { AbstractPoolService } from "./AbstractPoolService.js";
2
+ import type { IPoolsService } from "./types.js";
3
+ export declare class PoolServiceV310 extends AbstractPoolService implements IPoolsService {
4
+ }
@@ -0,0 +1,3 @@
1
+ import type { GearboxSDK } from "../GearboxSDK.js";
2
+ import type { AbstractPoolService } from "./AbstractPoolService.js";
3
+ export declare function createPoolService(sdk: GearboxSDK, version: number): AbstractPoolService;
@@ -1,2 +1,3 @@
1
- export * from "./PoolService.js";
1
+ export * from "./AbstractPoolService.js";
2
+ export * from "./createPoolService.js";
2
3
  export * from "./types.js";
@@ -1,7 +1,14 @@
1
- import type { Abi } from "abitype";
2
- import type { Address, ContractFunctionArgs, ContractFunctionName } from "viem";
3
- import type { ZapperData } from "../market/index.js";
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
- wallet: Address;
27
- meta: DepositMetadata;
28
- permit?: PermitResult;
29
- referralCode?: bigint;
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
- wallet: Address;
60
+ account: Address;
35
61
  permit: PermitResult | undefined;
36
- meta: WithdrawalMetadata;
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
- * Returns list of tokens that can be deposited to a pool
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): PoolServiceCall | undefined;
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): PoolServiceCall;
94
+ removeLiquidity(props: RemoveLiquidityProps): RemoveLiquidityCall;
116
95
  }
117
96
  export {};
@@ -3,7 +3,7 @@ export declare class AddressMap<T> {
3
3
  #private;
4
4
  constructor(entries?: Array<[string, T]>, name?: string);
5
5
  /**
6
- * Adds or overwrites value, undefined removes value
6
+ * Adds or updates value, undefined removes value
7
7
  * @param address
8
8
  * @param value
9
9
  */
@@ -1,11 +1,7 @@
1
1
  import type { Account, Chain, Client, SendTransactionRequest, SendTransactionReturnType, Transport } from "viem";
2
- import { type EstimateGasParameters, type SendTransactionParameters } from "viem/actions";
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-next.1",
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": "yarn@4.9.2"
117
+ "packageManager": "pnpm@10.33.0"
116
118
  }