@ichidao/ichi-vaults-sdk 0.1.43 → 2.0.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/README.md +61 -208
- package/dist/abis/types/AlgebraIntegralPool.d.ts +702 -793
- package/dist/abis/types/AlgebraPool.d.ts +693 -730
- package/dist/abis/types/ClPool.d.ts +789 -871
- package/dist/abis/types/DepositGuard.d.ts +193 -178
- package/dist/abis/types/DepositGuardWithHtsWrapping.d.ts +300 -297
- package/dist/abis/types/ERC20.d.ts +120 -147
- package/dist/abis/types/ERC20Wrapper.d.ts +147 -155
- package/dist/abis/types/IchiVault.d.ts +598 -728
- package/dist/abis/types/MultiFeeDistributer.d.ts +314 -423
- package/dist/abis/types/Multicall.d.ts +58 -73
- package/dist/abis/types/UniswapV3Pool.d.ts +654 -693
- package/dist/abis/types/common.d.ts +40 -12
- package/dist/abis/types/factories/AlgebraIntegralPool__factory.d.ts +2 -3
- package/dist/abis/types/factories/AlgebraIntegralPool__factory.js +10 -13
- package/dist/abis/types/factories/AlgebraIntegralPool__factory.js.map +1 -1
- package/dist/abis/types/factories/AlgebraPool__factory.d.ts +2 -3
- package/dist/abis/types/factories/AlgebraPool__factory.js +10 -13
- package/dist/abis/types/factories/AlgebraPool__factory.js.map +1 -1
- package/dist/abis/types/factories/ClPool__factory.d.ts +2 -3
- package/dist/abis/types/factories/ClPool__factory.js +10 -13
- package/dist/abis/types/factories/ClPool__factory.js.map +1 -1
- package/dist/abis/types/factories/DepositGuardWithHtsWrapping__factory.d.ts +2 -3
- package/dist/abis/types/factories/DepositGuardWithHtsWrapping__factory.js +10 -13
- package/dist/abis/types/factories/DepositGuardWithHtsWrapping__factory.js.map +1 -1
- package/dist/abis/types/factories/DepositGuard__factory.d.ts +2 -3
- package/dist/abis/types/factories/DepositGuard__factory.js +10 -13
- package/dist/abis/types/factories/DepositGuard__factory.js.map +1 -1
- package/dist/abis/types/factories/ERC20Wrapper__factory.d.ts +2 -3
- package/dist/abis/types/factories/ERC20Wrapper__factory.js +10 -13
- package/dist/abis/types/factories/ERC20Wrapper__factory.js.map +1 -1
- package/dist/abis/types/factories/ERC20__factory.d.ts +2 -3
- package/dist/abis/types/factories/ERC20__factory.js +10 -13
- package/dist/abis/types/factories/ERC20__factory.js.map +1 -1
- package/dist/abis/types/factories/IchiVault__factory.d.ts +2 -3
- package/dist/abis/types/factories/IchiVault__factory.js +10 -13
- package/dist/abis/types/factories/IchiVault__factory.js.map +1 -1
- package/dist/abis/types/factories/MultiFeeDistributer__factory.d.ts +2 -3
- package/dist/abis/types/factories/MultiFeeDistributer__factory.js +10 -13
- package/dist/abis/types/factories/MultiFeeDistributer__factory.js.map +1 -1
- package/dist/abis/types/factories/Multicall__factory.d.ts +2 -3
- package/dist/abis/types/factories/Multicall__factory.js +10 -13
- package/dist/abis/types/factories/Multicall__factory.js.map +1 -1
- package/dist/abis/types/factories/UniswapV3Pool__factory.d.ts +2 -3
- package/dist/abis/types/factories/UniswapV3Pool__factory.js +10 -13
- package/dist/abis/types/factories/UniswapV3Pool__factory.js.map +1 -1
- package/dist/src/__tests__/index.test.js +356 -738
- package/dist/src/__tests__/index.test.js.map +1 -1
- package/dist/src/abis/types/AlgebraIntegralPool.d.ts +702 -793
- package/dist/src/abis/types/AlgebraPool.d.ts +693 -730
- package/dist/src/abis/types/ClPool.d.ts +789 -871
- package/dist/src/abis/types/DepositGuard.d.ts +193 -178
- package/dist/src/abis/types/DepositGuardWithHtsWrapping.d.ts +300 -297
- package/dist/src/abis/types/ERC20.d.ts +120 -147
- package/dist/src/abis/types/ERC20Wrapper.d.ts +147 -155
- package/dist/src/abis/types/IchiVault.d.ts +598 -728
- package/dist/src/abis/types/MultiFeeDistributer.d.ts +314 -423
- package/dist/src/abis/types/Multicall.d.ts +58 -73
- package/dist/src/abis/types/UniswapV3Pool.d.ts +654 -693
- package/dist/src/abis/types/common.d.ts +40 -12
- package/dist/src/abis/types/factories/AlgebraIntegralPool__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/AlgebraPool__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/ClPool__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/DepositGuardWithHtsWrapping__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/DepositGuard__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/ERC20Wrapper__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/ERC20__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/IchiVault__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/MultiFeeDistributer__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/Multicall__factory.d.ts +2 -3
- package/dist/src/abis/types/factories/UniswapV3Pool__factory.d.ts +2 -3
- package/dist/src/contracts/index.d.ts +1 -1
- package/dist/src/contracts/index.js +12 -12
- package/dist/src/contracts/index.js.map +1 -1
- package/dist/src/functions/_totalBalances.d.ts +2 -3
- package/dist/src/functions/_totalBalances.js +46 -117
- package/dist/src/functions/_totalBalances.js.map +1 -1
- package/dist/src/functions/_vaultEvents.js +347 -488
- package/dist/src/functions/_vaultEvents.js.map +1 -1
- package/dist/src/functions/_withdrawHelpers.d.ts +2 -3
- package/dist/src/functions/_withdrawHelpers.js +13 -62
- package/dist/src/functions/_withdrawHelpers.js.map +1 -1
- package/dist/src/functions/calculateApr.d.ts +1 -1
- package/dist/src/functions/calculateApr.js +77 -150
- package/dist/src/functions/calculateApr.js.map +1 -1
- package/dist/src/functions/calculateDtr.d.ts +1 -1
- package/dist/src/functions/calculateDtr.js +84 -169
- package/dist/src/functions/calculateDtr.js.map +1 -1
- package/dist/src/functions/calculateFees.d.ts +1 -1
- package/dist/src/functions/calculateFees.js +97 -172
- package/dist/src/functions/calculateFees.js.map +1 -1
- package/dist/src/functions/chains.js +6 -6
- package/dist/src/functions/chains.js.map +1 -1
- package/dist/src/functions/claimRewards.d.ts +3 -4
- package/dist/src/functions/claimRewards.js +29 -92
- package/dist/src/functions/claimRewards.js.map +1 -1
- package/dist/src/functions/deposit.d.ts +7 -9
- package/dist/src/functions/deposit.js +199 -364
- package/dist/src/functions/deposit.js.map +1 -1
- package/dist/src/functions/depositWithHtsWrapping.d.ts +4 -6
- package/dist/src/functions/depositWithHtsWrapping.js +109 -226
- package/dist/src/functions/depositWithHtsWrapping.js.map +1 -1
- package/dist/src/functions/getFeeAprs.d.ts +1 -1
- package/dist/src/functions/getFeeAprs.js +55 -111
- package/dist/src/functions/getFeeAprs.js.map +1 -1
- package/dist/src/functions/priceFromPool.d.ts +3 -4
- package/dist/src/functions/priceFromPool.js +99 -208
- package/dist/src/functions/priceFromPool.js.map +1 -1
- package/dist/src/functions/rewardInfo.js +79 -159
- package/dist/src/functions/rewardInfo.js.map +1 -1
- package/dist/src/functions/totalBalances.d.ts +2 -3
- package/dist/src/functions/totalBalances.js +14 -67
- package/dist/src/functions/totalBalances.js.map +1 -1
- package/dist/src/functions/userBalances.d.ts +2 -3
- package/dist/src/functions/userBalances.js +244 -368
- package/dist/src/functions/userBalances.js.map +1 -1
- package/dist/src/functions/userRewards.d.ts +1 -1
- package/dist/src/functions/userRewards.js +87 -145
- package/dist/src/functions/userRewards.js.map +1 -1
- package/dist/src/functions/vault.d.ts +1 -1
- package/dist/src/functions/vault.js +203 -383
- package/dist/src/functions/vault.js.map +1 -1
- package/dist/src/functions/vaultBasics.js +6 -7
- package/dist/src/functions/vaultBasics.js.map +1 -1
- package/dist/src/functions/vaultMetrics.d.ts +1 -1
- package/dist/src/functions/vaultMetrics.js +111 -189
- package/dist/src/functions/vaultMetrics.js.map +1 -1
- package/dist/src/functions/vaultPositions.d.ts +1 -1
- package/dist/src/functions/vaultPositions.js +69 -134
- package/dist/src/functions/vaultPositions.js.map +1 -1
- package/dist/src/functions/vaultTvl.d.ts +1 -1
- package/dist/src/functions/vaultTvl.js +80 -165
- package/dist/src/functions/vaultTvl.js.map +1 -1
- package/dist/src/functions/withdraw.d.ts +6 -8
- package/dist/src/functions/withdraw.js +165 -295
- package/dist/src/functions/withdraw.js.map +1 -1
- package/dist/src/functions/withdrawWithErc20Wrapping.d.ts +2 -4
- package/dist/src/functions/withdrawWithErc20Wrapping.js +59 -126
- package/dist/src/functions/withdrawWithErc20Wrapping.js.map +1 -1
- package/dist/src/graphql/constants.js +211 -212
- package/dist/src/graphql/constants.js.map +1 -1
- package/dist/src/graphql/functions.js +30 -102
- package/dist/src/graphql/functions.js.map +1 -1
- package/dist/src/graphql/queries.js +407 -42
- package/dist/src/graphql/queries.js.map +1 -1
- package/dist/src/index.cjs.js +2 -2
- package/dist/src/index.esm.js +2 -2
- package/dist/src/src/contracts/index.d.ts +1 -1
- package/dist/src/src/functions/_totalBalances.d.ts +2 -3
- package/dist/src/src/functions/_withdrawHelpers.d.ts +2 -3
- package/dist/src/src/functions/calculateApr.d.ts +1 -1
- package/dist/src/src/functions/calculateDtr.d.ts +1 -1
- package/dist/src/src/functions/calculateFees.d.ts +1 -1
- package/dist/src/src/functions/claimRewards.d.ts +3 -4
- package/dist/src/src/functions/deposit.d.ts +7 -9
- package/dist/src/src/functions/depositWithHtsWrapping.d.ts +4 -6
- package/dist/src/src/functions/getFeeAprs.d.ts +1 -1
- package/dist/src/src/functions/priceFromPool.d.ts +3 -4
- package/dist/src/src/functions/totalBalances.d.ts +2 -3
- package/dist/src/src/functions/userBalances.d.ts +2 -3
- package/dist/src/src/functions/userRewards.d.ts +1 -1
- package/dist/src/src/functions/vault.d.ts +1 -1
- package/dist/src/src/functions/vaultMetrics.d.ts +1 -1
- package/dist/src/src/functions/vaultPositions.d.ts +1 -1
- package/dist/src/src/functions/vaultTvl.d.ts +1 -1
- package/dist/src/src/functions/withdraw.d.ts +6 -8
- package/dist/src/src/functions/withdrawWithErc20Wrapping.d.ts +2 -4
- package/dist/src/src/types/calculateGasMargin.d.ts +1 -2
- package/dist/src/src/types/index.d.ts +11 -13
- package/dist/src/src/utils/amountWithSlippage.d.ts +1 -2
- package/dist/src/src/utils/config/addresses.d.ts +1 -1
- package/dist/src/src/utils/formatBigInt.d.ts +1 -2
- package/dist/src/src/utils/getPrice.d.ts +1 -2
- package/dist/src/src/utils/multicallUtils.d.ts +9 -10
- package/dist/src/src/utils/parseBigInt.d.ts +1 -2
- package/dist/src/types/calculateGasMargin.d.ts +1 -2
- package/dist/src/types/calculateGasMargin.js +4 -5
- package/dist/src/types/calculateGasMargin.js.map +1 -1
- package/dist/src/types/index.d.ts +11 -13
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/utils/amountWithSlippage.d.ts +1 -2
- package/dist/src/utils/amountWithSlippage.js +1 -1
- package/dist/src/utils/amountWithSlippage.js.map +1 -1
- package/dist/src/utils/cache.js +2 -2
- package/dist/src/utils/cache.js.map +1 -1
- package/dist/src/utils/config/addresses.d.ts +1 -1
- package/dist/src/utils/config/addresses.js +267 -268
- package/dist/src/utils/config/addresses.js.map +1 -1
- package/dist/src/utils/formatBigInt.d.ts +1 -2
- package/dist/src/utils/formatBigInt.js +4 -5
- package/dist/src/utils/formatBigInt.js.map +1 -1
- package/dist/src/utils/getConfigByFactory.js +24 -28
- package/dist/src/utils/getConfigByFactory.js.map +1 -1
- package/dist/src/utils/getGraphUrls.js +8 -12
- package/dist/src/utils/getGraphUrls.js.map +1 -1
- package/dist/src/utils/getPrice.d.ts +1 -2
- package/dist/src/utils/getPrice.js +5 -6
- package/dist/src/utils/getPrice.js.map +1 -1
- package/dist/src/utils/isVelodrome.js +2 -3
- package/dist/src/utils/isVelodrome.js.map +1 -1
- package/dist/src/utils/multicallUtils.d.ts +9 -10
- package/dist/src/utils/multicallUtils.js +38 -93
- package/dist/src/utils/multicallUtils.js.map +1 -1
- package/dist/src/utils/parseBigInt.d.ts +1 -2
- package/dist/src/utils/parseBigInt.js +5 -7
- package/dist/src/utils/parseBigInt.js.map +1 -1
- package/dist/src/utils/positionKey.js +2 -4
- package/dist/src/utils/positionKey.js.map +1 -1
- package/package.json +5 -17
|
@@ -1,22 +1,50 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
|
|
4
|
-
args: TArgsArray & TArgsObject;
|
|
1
|
+
import type { FunctionFragment, Typed, EventFragment, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventLog, TransactionRequest, LogDescription } from "ethers";
|
|
2
|
+
export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
|
|
5
3
|
}
|
|
6
|
-
export interface
|
|
4
|
+
export interface TypedContractEvent<InputTuple extends Array<any> = any, OutputTuple extends Array<any> = any, OutputObject = any> {
|
|
5
|
+
(...args: Partial<InputTuple>): TypedDeferredTopicFilter<TypedContractEvent<InputTuple, OutputTuple, OutputObject>>;
|
|
6
|
+
name: string;
|
|
7
|
+
fragment: EventFragment;
|
|
8
|
+
getFragment(...args: Partial<InputTuple>): EventFragment;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
type __TypechainAOutputTuple<T> = T extends TypedContractEvent<infer _U, infer W> ? W : never;
|
|
11
|
+
type __TypechainOutputObject<T> = T extends TypedContractEvent<infer _U, infer _W, infer V> ? V : never;
|
|
12
|
+
export interface TypedEventLog<TCEvent extends TypedContractEvent> extends Omit<EventLog, "args"> {
|
|
13
|
+
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
|
|
14
|
-
(eventName: string, listener: Listener): TRes;
|
|
15
|
+
export interface TypedLogDescription<TCEvent extends TypedContractEvent> extends Omit<LogDescription, "args"> {
|
|
16
|
+
args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
|
|
15
17
|
}
|
|
18
|
+
export type TypedListener<TCEvent extends TypedContractEvent> = (...listenerArg: [
|
|
19
|
+
...__TypechainAOutputTuple<TCEvent>,
|
|
20
|
+
TypedEventLog<TCEvent>,
|
|
21
|
+
...undefined[]
|
|
22
|
+
]) => void;
|
|
16
23
|
export type MinEthersFactory<C, ARGS> = {
|
|
17
24
|
deploy(...a: ARGS[]): Promise<C>;
|
|
18
25
|
};
|
|
19
26
|
export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
|
|
20
27
|
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
|
|
21
|
-
export type
|
|
28
|
+
export type StateMutability = "nonpayable" | "payable" | "view";
|
|
29
|
+
export type BaseOverrides = Omit<TransactionRequest, "to" | "data">;
|
|
30
|
+
export type NonPayableOverrides = Omit<BaseOverrides, "value" | "blockTag" | "enableCcipRead">;
|
|
31
|
+
export type PayableOverrides = Omit<BaseOverrides, "blockTag" | "enableCcipRead">;
|
|
32
|
+
export type ViewOverrides = Omit<TransactionRequest, "to" | "data">;
|
|
33
|
+
export type Overrides<S extends StateMutability> = S extends "nonpayable" ? NonPayableOverrides : S extends "payable" ? PayableOverrides : ViewOverrides;
|
|
34
|
+
export type PostfixOverrides<A extends Array<any>, S extends StateMutability> = A | [...A, Overrides<S>];
|
|
35
|
+
export type ContractMethodArgs<A extends Array<any>, S extends StateMutability> = PostfixOverrides<{
|
|
36
|
+
[I in keyof A]-?: A[I] | Typed;
|
|
37
|
+
}, S>;
|
|
38
|
+
export type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
|
|
39
|
+
export interface TypedContractMethod<A extends Array<any> = Array<any>, R = any, S extends StateMutability = "payable"> {
|
|
40
|
+
(...args: ContractMethodArgs<A, S>): S extends "view" ? Promise<DefaultReturnType<R>> : Promise<ContractTransactionResponse>;
|
|
41
|
+
name: string;
|
|
42
|
+
fragment: FunctionFragment;
|
|
43
|
+
getFragment(...args: ContractMethodArgs<A, S>): FunctionFragment;
|
|
44
|
+
populateTransaction(...args: ContractMethodArgs<A, S>): Promise<ContractTransaction>;
|
|
45
|
+
staticCall(...args: ContractMethodArgs<A, "view">): Promise<DefaultReturnType<R>>;
|
|
46
|
+
send(...args: ContractMethodArgs<A, S>): Promise<ContractTransactionResponse>;
|
|
47
|
+
estimateGas(...args: ContractMethodArgs<A, S>): Promise<bigint>;
|
|
48
|
+
staticCallResult(...args: ContractMethodArgs<A, "view">): Promise<R>;
|
|
49
|
+
}
|
|
22
50
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { AlgebraIntegralPool, AlgebraIntegralPoolInterface } from "../AlgebraIntegralPool";
|
|
4
3
|
export declare class AlgebraIntegralPool__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -1050,5 +1049,5 @@ export declare class AlgebraIntegralPool__factory {
|
|
|
1050
1049
|
readonly type: "function";
|
|
1051
1050
|
}];
|
|
1052
1051
|
static createInterface(): AlgebraIntegralPoolInterface;
|
|
1053
|
-
static connect(address: string,
|
|
1052
|
+
static connect(address: string, runner?: ContractRunner | null): AlgebraIntegralPool;
|
|
1054
1053
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { AlgebraPool, AlgebraPoolInterface } from "../AlgebraPool";
|
|
4
3
|
export declare class AlgebraPool__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -817,5 +816,5 @@ export declare class AlgebraPool__factory {
|
|
|
817
816
|
readonly type: "function";
|
|
818
817
|
}];
|
|
819
818
|
static createInterface(): AlgebraPoolInterface;
|
|
820
|
-
static connect(address: string,
|
|
819
|
+
static connect(address: string, runner?: ContractRunner | null): AlgebraPool;
|
|
821
820
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { ClPool, ClPoolInterface } from "../ClPool";
|
|
4
3
|
export declare class ClPool__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -1016,5 +1015,5 @@ export declare class ClPool__factory {
|
|
|
1016
1015
|
readonly type: "function";
|
|
1017
1016
|
}];
|
|
1018
1017
|
static createInterface(): ClPoolInterface;
|
|
1019
|
-
static connect(address: string,
|
|
1018
|
+
static connect(address: string, runner?: ContractRunner | null): ClPool;
|
|
1020
1019
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { DepositGuardWithHtsWrapping, DepositGuardWithHtsWrappingInterface } from "../DepositGuardWithHtsWrapping";
|
|
4
3
|
export declare class DepositGuardWithHtsWrapping__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -406,5 +405,5 @@ export declare class DepositGuardWithHtsWrapping__factory {
|
|
|
406
405
|
readonly type: "receive";
|
|
407
406
|
}];
|
|
408
407
|
static createInterface(): DepositGuardWithHtsWrappingInterface;
|
|
409
|
-
static connect(address: string,
|
|
408
|
+
static connect(address: string, runner?: ContractRunner | null): DepositGuardWithHtsWrapping;
|
|
410
409
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { DepositGuard, DepositGuardInterface } from "../DepositGuard";
|
|
4
3
|
export declare class DepositGuard__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -255,5 +254,5 @@ export declare class DepositGuard__factory {
|
|
|
255
254
|
readonly type: "receive";
|
|
256
255
|
}];
|
|
257
256
|
static createInterface(): DepositGuardInterface;
|
|
258
|
-
static connect(address: string,
|
|
257
|
+
static connect(address: string, runner?: ContractRunner | null): DepositGuard;
|
|
259
258
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { ERC20Wrapper, ERC20WrapperInterface } from "../ERC20Wrapper";
|
|
4
3
|
export declare class ERC20Wrapper__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -164,5 +163,5 @@ export declare class ERC20Wrapper__factory {
|
|
|
164
163
|
readonly stateMutability: "payable";
|
|
165
164
|
}];
|
|
166
165
|
static createInterface(): ERC20WrapperInterface;
|
|
167
|
-
static connect(address: string,
|
|
166
|
+
static connect(address: string, runner?: ContractRunner | null): ERC20Wrapper;
|
|
168
167
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { ERC20, ERC20Interface } from "../ERC20";
|
|
4
3
|
export declare class ERC20__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -171,5 +170,5 @@ export declare class ERC20__factory {
|
|
|
171
170
|
readonly type: "event";
|
|
172
171
|
}];
|
|
173
172
|
static createInterface(): ERC20Interface;
|
|
174
|
-
static connect(address: string,
|
|
173
|
+
static connect(address: string, runner?: ContractRunner | null): ERC20;
|
|
175
174
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { IchiVault, IchiVaultInterface } from "../IchiVault";
|
|
4
3
|
export declare class IchiVault__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -895,5 +894,5 @@ export declare class IchiVault__factory {
|
|
|
895
894
|
readonly type: "function";
|
|
896
895
|
}];
|
|
897
896
|
static createInterface(): IchiVaultInterface;
|
|
898
|
-
static connect(address: string,
|
|
897
|
+
static connect(address: string, runner?: ContractRunner | null): IchiVault;
|
|
899
898
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { MultiFeeDistributer, MultiFeeDistributerInterface } from "../MultiFeeDistributer";
|
|
4
3
|
export declare class MultiFeeDistributer__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -447,5 +446,5 @@ export declare class MultiFeeDistributer__factory {
|
|
|
447
446
|
readonly type: "function";
|
|
448
447
|
}];
|
|
449
448
|
static createInterface(): MultiFeeDistributerInterface;
|
|
450
|
-
static connect(address: string,
|
|
449
|
+
static connect(address: string, runner?: ContractRunner | null): MultiFeeDistributer;
|
|
451
450
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { Multicall, MulticallInterface } from "../Multicall";
|
|
4
3
|
export declare class Multicall__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -72,5 +71,5 @@ export declare class Multicall__factory {
|
|
|
72
71
|
readonly type: "function";
|
|
73
72
|
}];
|
|
74
73
|
static createInterface(): MulticallInterface;
|
|
75
|
-
static connect(address: string,
|
|
74
|
+
static connect(address: string, runner?: ContractRunner | null): Multicall;
|
|
76
75
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Provider } from "@ethersproject/providers";
|
|
1
|
+
import { type ContractRunner } from "ethers";
|
|
3
2
|
import type { UniswapV3Pool, UniswapV3PoolInterface } from "../UniswapV3Pool";
|
|
4
3
|
export declare class UniswapV3Pool__factory {
|
|
5
4
|
static readonly abi: readonly [{
|
|
@@ -777,5 +776,5 @@ export declare class UniswapV3Pool__factory {
|
|
|
777
776
|
readonly type: "function";
|
|
778
777
|
}];
|
|
779
778
|
static createInterface(): UniswapV3PoolInterface;
|
|
780
|
-
static connect(address: string,
|
|
779
|
+
static connect(address: string, runner?: ContractRunner | null): UniswapV3Pool;
|
|
781
780
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
2
|
import { SignerOrProvider } from '../types';
|
|
3
3
|
import { ERC20, IchiVault, DepositGuard, DepositGuardWithHtsWrapping, ERC20Wrapper, UniswapV3Pool, AlgebraPool, AlgebraIntegralPool, ClPool, MultiFeeDistributer } from '../../abis/types';
|
|
4
4
|
export declare function getERC20Contract(address: string, signerOrProvider: SignerOrProvider): ERC20;
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getERC20WrapperContract = exports.getDepositGuardWithHtsWrappingContract = exports.getMultiFeeDistributorContract = exports.getClPoolContract = exports.getAlgebraIntegralPoolContract = exports.getAlgebraPoolContract = exports.getUniswapV3PoolContract = exports.getIchiVaultContract = exports.getDepositGuardContract = exports.getERC20Contract = void 0;
|
|
4
4
|
/* eslint-disable camelcase */
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
6
|
+
const types_1 = require("../../abis/types");
|
|
7
7
|
function getERC20Contract(address, signerOrProvider) {
|
|
8
|
-
(0,
|
|
8
|
+
(0, ethers_1.getAddress)(address);
|
|
9
9
|
return types_1.ERC20__factory.connect(address, signerOrProvider);
|
|
10
10
|
}
|
|
11
11
|
exports.getERC20Contract = getERC20Contract;
|
|
12
12
|
function getDepositGuardContract(address, signerOrProvider) {
|
|
13
|
-
(0,
|
|
13
|
+
(0, ethers_1.getAddress)(address);
|
|
14
14
|
return types_1.DepositGuard__factory.connect(address, signerOrProvider);
|
|
15
15
|
}
|
|
16
16
|
exports.getDepositGuardContract = getDepositGuardContract;
|
|
17
17
|
function getIchiVaultContract(address, signerOrProvider) {
|
|
18
|
-
(0,
|
|
18
|
+
(0, ethers_1.getAddress)(address);
|
|
19
19
|
return types_1.IchiVault__factory.connect(address, signerOrProvider);
|
|
20
20
|
}
|
|
21
21
|
exports.getIchiVaultContract = getIchiVaultContract;
|
|
@@ -24,7 +24,7 @@ function getUniswapV3PoolContract(address, provider) {
|
|
|
24
24
|
return types_1.UniswapV3Pool__factory.connect(address, provider);
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
|
-
console.error(
|
|
27
|
+
console.error(`Couldn't create UniswapV3Pool contract with address: ${address}`);
|
|
28
28
|
throw e;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -34,7 +34,7 @@ function getAlgebraPoolContract(address, provider) {
|
|
|
34
34
|
return types_1.AlgebraPool__factory.connect(address, provider);
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
|
-
console.error(
|
|
37
|
+
console.error(`Couldn't create AlgebraPool contract with address: ${address}`);
|
|
38
38
|
throw e;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -44,7 +44,7 @@ function getAlgebraIntegralPoolContract(address, provider) {
|
|
|
44
44
|
return types_1.AlgebraIntegralPool__factory.connect(address, provider);
|
|
45
45
|
}
|
|
46
46
|
catch (e) {
|
|
47
|
-
console.error(
|
|
47
|
+
console.error(`Couldn't create AlgebraIntegralPool contract with address: ${address}`);
|
|
48
48
|
throw e;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -54,7 +54,7 @@ function getClPoolContract(address, provider) {
|
|
|
54
54
|
return types_1.ClPool__factory.connect(address, provider);
|
|
55
55
|
}
|
|
56
56
|
catch (e) {
|
|
57
|
-
console.error(
|
|
57
|
+
console.error(`Couldn't create ClPool contract with address: ${address}`);
|
|
58
58
|
throw e;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -64,18 +64,18 @@ function getMultiFeeDistributorContract(address, signerOrProvider) {
|
|
|
64
64
|
return types_1.MultiFeeDistributer__factory.connect(address, signerOrProvider);
|
|
65
65
|
}
|
|
66
66
|
catch (e) {
|
|
67
|
-
console.error(
|
|
67
|
+
console.error(`Couldn't create MultiFeeDistributer contract with address: ${address}`);
|
|
68
68
|
throw e;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
exports.getMultiFeeDistributorContract = getMultiFeeDistributorContract;
|
|
72
72
|
function getDepositGuardWithHtsWrappingContract(address, signerOrProvider) {
|
|
73
|
-
(0,
|
|
73
|
+
(0, ethers_1.getAddress)(address);
|
|
74
74
|
return types_1.DepositGuardWithHtsWrapping__factory.connect(address, signerOrProvider);
|
|
75
75
|
}
|
|
76
76
|
exports.getDepositGuardWithHtsWrappingContract = getDepositGuardWithHtsWrappingContract;
|
|
77
77
|
function getERC20WrapperContract(address, signerOrProvider) {
|
|
78
|
-
(0,
|
|
78
|
+
(0, ethers_1.getAddress)(address);
|
|
79
79
|
return types_1.ERC20Wrapper__factory.connect(address, signerOrProvider);
|
|
80
80
|
}
|
|
81
81
|
exports.getERC20WrapperContract = getERC20WrapperContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,mCAAqD;AAErD,4CAqB0B;AAE1B,SAAgB,gBAAgB,CAAC,OAAe,EAAE,gBAAkC;IAClF,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;IACpB,OAAO,sBAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACzD,CAAC;AAHD,4CAGC;AAED,SAAgB,uBAAuB,CAAC,OAAe,EAAE,gBAAkC;IACzF,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;IACpB,OAAO,6BAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,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D,OAAO,EAAE,CAAC,CAAC;QAC1E,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAPD,8CAOC;AACD,SAAgB,8BAA8B,CAC5C,OAAe,EACf,gBAAkC;IAElC,IAAI;QACF,OAAO,oCAA4B,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;KACxE;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,8DAA8D,OAAO,EAAE,CAAC,CAAC;QACvF,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAVD,wEAUC;AAED,SAAgB,sCAAsC,CACpD,OAAe,EACf,gBAAkC;IAElC,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;IACpB,OAAO,4CAAoC,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACjF,CAAC;AAND,wFAMC;AAED,SAAgB,uBAAuB,CAAC,OAAe,EAAE,gBAAkC;IACzF,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;IACpB,OAAO,6BAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAClE,CAAC;AAHD,0DAGC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '
|
|
2
|
-
import { BigNumber } from 'ethers';
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
3
2
|
import { IchiVault, SupportedChainId, TotalAmounts, TotalAmountsBN } from '../types';
|
|
4
3
|
export declare function getTokenDecimals(tokenAddress: string, jsonProvider: JsonRpcProvider, chainId: SupportedChainId): Promise<number>;
|
|
5
4
|
export declare function _getTotalAmounts(vault: IchiVault, jsonProvider: JsonRpcProvider, chainId: SupportedChainId): Promise<TotalAmounts>;
|
|
6
5
|
export declare function _getTotalAmounts(vault: IchiVault, jsonProvider: JsonRpcProvider, chainId: SupportedChainId, raw: true): Promise<TotalAmountsBN>;
|
|
7
6
|
export declare function _getTotalSupply(vaultAddress: string, jsonProvider: JsonRpcProvider): Promise<string>;
|
|
8
|
-
export declare function _getTotalSupply(vaultAddress: string, jsonProvider: JsonRpcProvider, raw: true): Promise<
|
|
7
|
+
export declare function _getTotalSupply(vaultAddress: string, jsonProvider: JsonRpcProvider, raw: true): Promise<bigint>;
|
|
@@ -2,133 +2,62 @@
|
|
|
2
2
|
/* eslint-disable no-redeclare */
|
|
3
3
|
/* eslint-disable import/prefer-default-export */
|
|
4
4
|
/* eslint-disable no-underscore-dangle */
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
15
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
16
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
17
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
18
|
-
function step(op) {
|
|
19
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
20
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
21
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
22
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23
|
-
switch (op[0]) {
|
|
24
|
-
case 0: case 1: t = op; break;
|
|
25
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
26
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
27
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
28
|
-
default:
|
|
29
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
30
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
31
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
32
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
33
|
-
if (t[2]) _.ops.pop();
|
|
34
|
-
_.trys.pop(); continue;
|
|
35
|
-
}
|
|
36
|
-
op = body.call(thisArg, _);
|
|
37
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
38
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
5
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
7
|
};
|
|
44
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
9
|
exports._getTotalSupply = exports._getTotalAmounts = exports.getTokenDecimals = void 0;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
10
|
+
const contracts_1 = require("../contracts");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const formatBigInt_1 = __importDefault(require("../utils/formatBigInt"));
|
|
49
13
|
// eslint-disable-next-line import/no-cycle
|
|
50
|
-
|
|
51
|
-
function getTokenDecimals(tokenAddress, jsonProvider, chainId) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
case 2:
|
|
69
|
-
tokenDecimals = _a.sent();
|
|
70
|
-
cache_1.default.set(key, tokenDecimals, ttl);
|
|
71
|
-
return [2 /*return*/, tokenDecimals];
|
|
72
|
-
case 3:
|
|
73
|
-
error_1 = _a.sent();
|
|
74
|
-
console.error(error_1);
|
|
75
|
-
throw new Error("Could not get token decimals for ".concat(tokenAddress, " on ").concat(chainId));
|
|
76
|
-
case 4: return [2 /*return*/];
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
14
|
+
const cache_1 = __importDefault(require("../utils/cache"));
|
|
15
|
+
async function getTokenDecimals(tokenAddress, jsonProvider, chainId) {
|
|
16
|
+
const key = `token-${chainId}-${tokenAddress}`;
|
|
17
|
+
const cachedData = cache_1.default.get(key);
|
|
18
|
+
if (cachedData) {
|
|
19
|
+
return cachedData;
|
|
20
|
+
}
|
|
21
|
+
const ttl = 24 * 60 * 60 * 1000;
|
|
22
|
+
try {
|
|
23
|
+
const tokenContract = (0, contracts_1.getERC20Contract)(tokenAddress, jsonProvider);
|
|
24
|
+
const tokenDecimals = Number(await tokenContract.decimals());
|
|
25
|
+
cache_1.default.set(key, tokenDecimals, ttl);
|
|
26
|
+
return tokenDecimals;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(error);
|
|
30
|
+
throw new Error(`Could not get token decimals for ${tokenAddress} on ${chainId}`);
|
|
31
|
+
}
|
|
80
32
|
}
|
|
81
33
|
exports.getTokenDecimals = getTokenDecimals;
|
|
82
|
-
function _getTotalAmounts(vault, jsonProvider, chainId, raw) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
case 3:
|
|
98
|
-
token1Decimals = _a.sent();
|
|
99
|
-
totalAmounts = {
|
|
100
|
-
total0: (0, formatBigInt_1.default)(totalAmountsBN.total0, token0Decimals),
|
|
101
|
-
total1: (0, formatBigInt_1.default)(totalAmountsBN.total1, token1Decimals),
|
|
102
|
-
0: (0, formatBigInt_1.default)(totalAmountsBN.total0, token0Decimals),
|
|
103
|
-
1: (0, formatBigInt_1.default)(totalAmountsBN.total1, token1Decimals),
|
|
104
|
-
};
|
|
105
|
-
return [2 /*return*/, totalAmounts];
|
|
106
|
-
case 4: return [2 /*return*/, totalAmountsBN];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
34
|
+
async function _getTotalAmounts(vault, jsonProvider, chainId, raw) {
|
|
35
|
+
const vaultContract = (0, contracts_1.getIchiVaultContract)(vault.id, jsonProvider);
|
|
36
|
+
const totalAmountsBN = await vaultContract.getTotalAmounts();
|
|
37
|
+
if (!raw) {
|
|
38
|
+
const token0Decimals = await getTokenDecimals(vault.tokenA, jsonProvider, chainId);
|
|
39
|
+
const token1Decimals = await getTokenDecimals(vault.tokenB, jsonProvider, chainId);
|
|
40
|
+
const totalAmounts = {
|
|
41
|
+
total0: (0, formatBigInt_1.default)(totalAmountsBN.total0, token0Decimals),
|
|
42
|
+
total1: (0, formatBigInt_1.default)(totalAmountsBN.total1, token1Decimals),
|
|
43
|
+
0: (0, formatBigInt_1.default)(totalAmountsBN.total0, token0Decimals),
|
|
44
|
+
1: (0, formatBigInt_1.default)(totalAmountsBN.total1, token1Decimals),
|
|
45
|
+
};
|
|
46
|
+
return totalAmounts;
|
|
47
|
+
}
|
|
48
|
+
return totalAmountsBN;
|
|
110
49
|
}
|
|
111
50
|
exports._getTotalAmounts = _getTotalAmounts;
|
|
112
|
-
function _getTotalSupply(vaultAddress, jsonProvider, raw) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
totalSupply = _a.sent();
|
|
123
|
-
return [2 /*return*/, raw ? totalSupply : (0, formatBigInt_1.default)(totalSupply, types_1.ichiVaultDecimals)];
|
|
124
|
-
case 2:
|
|
125
|
-
error_2 = _a.sent();
|
|
126
|
-
console.error(error_2);
|
|
127
|
-
throw new Error("Could not get total supply for ".concat(vaultAddress));
|
|
128
|
-
case 3: return [2 /*return*/];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
51
|
+
async function _getTotalSupply(vaultAddress, jsonProvider, raw) {
|
|
52
|
+
try {
|
|
53
|
+
const vaultContract = (0, contracts_1.getIchiVaultContract)(vaultAddress, jsonProvider);
|
|
54
|
+
const totalSupply = await vaultContract.totalSupply();
|
|
55
|
+
return raw ? totalSupply : (0, formatBigInt_1.default)(totalSupply, types_1.ichiVaultDecimals);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(error);
|
|
59
|
+
throw new Error(`Could not get total supply for ${vaultAddress}`);
|
|
60
|
+
}
|
|
132
61
|
}
|
|
133
62
|
exports._getTotalSupply = _getTotalSupply;
|
|
134
63
|
//# sourceMappingURL=_totalBalances.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_totalBalances.js","sourceRoot":"","sources":["../../../src/functions/_totalBalances.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,iDAAiD;AACjD,yCAAyC
|
|
1
|
+
{"version":3,"file":"_totalBalances.js","sourceRoot":"","sources":["../../../src/functions/_totalBalances.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,iDAAiD;AACjD,yCAAyC;;;;;;AAGzC,4CAAsE;AACtE,oCAAwG;AACxG,yEAAiD;AACjD,2CAA2C;AAC3C,2DAAmC;AAE5B,KAAK,UAAU,gBAAgB,CACpC,YAAoB,EACpB,YAA6B,EAC7B,OA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