@ichidao/ichi-vaults-sdk 0.1.36 → 0.1.38
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 +28 -19
- package/dist/src/index.cjs.js +2 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.esm.js +2 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/src/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -565,7 +565,7 @@ const amountsBN: [BigNumber, BigNumber] & {amount0: BigNumber, amount1: BigNumbe
|
|
|
565
565
|
| raw | true | undefined | false |
|
|
566
566
|
|
|
567
567
|
<br/>
|
|
568
|
-
This function returns user balances for all vaults on the specified decentralized exchange (DEX). The result is cached for 2 minutes by default. You can set your own cache TTL by adding the CACHE_TTL environment variable in millisecond. For example, CACHE_TTL = 60000 is 1 minute.
|
|
568
|
+
This function returns user balances (as [UserBalanceInVault](#userbalanceinvault) or [UserBalanceInVaultBN](#userbalanceinvaultbn)) for all vaults on the specified decentralized exchange (DEX). The result is cached for 2 minutes by default. You can set your own cache TTL by adding the CACHE_TTL environment variable in millisecond. For example, CACHE_TTL = 60000 is 1 minute.
|
|
569
569
|
|
|
570
570
|
```typescript
|
|
571
571
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -601,7 +601,7 @@ const userBalancesInVaultsBN: UserBalanceInVaultBN[] = await getAllUserBalances(
|
|
|
601
601
|
| raw | true | undefined | false |
|
|
602
602
|
|
|
603
603
|
<br/>
|
|
604
|
-
This function returns user token amounts in all vaults on the specified decentralized exchange (DEX). The result is cached for 2 minutes by default. You can set your own cache TTL by adding the CACHE_TTL environment variable in millisecond. For example, CACHE_TTL = 60000 is 1 minute.
|
|
604
|
+
This function returns user token amounts (as [UserAmountsInVault](#useramountsinvault) or [UserAmountsInVaultBN](#useramountsinvaultbn)) in all vaults on the specified decentralized exchange (DEX). The result is cached for 2 minutes by default. You can set your own cache TTL by adding the CACHE_TTL environment variable in millisecond. For example, CACHE_TTL = 60000 is 1 minute.
|
|
605
605
|
|
|
606
606
|
```typescript
|
|
607
607
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -715,6 +715,9 @@ const amountsBN: [BigNumber, BigNumber] & {total0: BigNumber, total1: BigNumber}
|
|
|
715
715
|
| days | number | undefined | false |
|
|
716
716
|
|
|
717
717
|
<br/>
|
|
718
|
+
|
|
719
|
+
> **Note:** This function may take several seconds to execute as it processes historical data. It is best suited for report generation and batched backend processes rather than user-facing interfaces where immediate responses are expected. For real-time UI updates, consider using [`getFeeAprs()`](#20-getfeeaprs) instead.
|
|
720
|
+
|
|
718
721
|
The getFeesCollected() function returns the number of fees collected for the specified number of days. If the 'days' parameter is not included, it returns the number of fees collected since the vault's inception.
|
|
719
722
|
|
|
720
723
|
```typescript
|
|
@@ -771,8 +774,11 @@ const amountsBN: [BigNumber, BigNumber] & {total0: BigNumber, total1: BigNumber}
|
|
|
771
774
|
| forDays | number[] | undefined | false |
|
|
772
775
|
|
|
773
776
|
<br/>
|
|
774
|
-
|
|
775
|
-
|
|
777
|
+
|
|
778
|
+
> **Note:** This function may take several seconds to execute as it processes historical data. It is best suited for report generation and batched backend processes rather than user-facing interfaces where immediate responses are expected. For real-time UI updates, consider using [`getFeeAprs()`](#20-getfeeaprs) instead.
|
|
779
|
+
|
|
780
|
+
The getFeesCollectedInfo() function returns an array of [FeesInfo](#feesinfo) objects representing the number of fees collected for the periods of time specified by the 'forDays' parameter, along with the fee Annual Percentage Rate (APR) for those periods.
|
|
781
|
+
If 'forDays' is not specified, it returns [FeesInfo](#feesinfo) for time periods of 1, 7, and 30 days.
|
|
776
782
|
<br/>
|
|
777
783
|
|
|
778
784
|
```typescript
|
|
@@ -809,7 +815,7 @@ const feesInfo: FeesInfo[] = await getFeesCollectedInfo(
|
|
|
809
815
|
| dex | SupportedDex | - | true
|
|
810
816
|
|
|
811
817
|
<br/>
|
|
812
|
-
The getFeeAprs() function calculates and returns fee Annual Percentage Rates (APRs) for the specified vault over different standard time periods. It returns an object of type FeeAprData containing APR values for 1 day, 3 days, 7 days, and 30 days.
|
|
818
|
+
The getFeeAprs() function calculates and returns fee Annual Percentage Rates (APRs) for the specified vault over different standard time periods. It returns an object of type [FeeAprData](#feeaprdata) containing APR values for 1 day, 3 days, 7 days, and 30 days.
|
|
813
819
|
|
|
814
820
|
```typescript
|
|
815
821
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -833,8 +839,8 @@ console.log(`1-day Fee APR: ${feeAprs.feeApr_1d}%`);
|
|
|
833
839
|
| timeIntervals | number[] | [1, 7, 30] | false |
|
|
834
840
|
|
|
835
841
|
<br/>
|
|
836
|
-
The getAverageDepositTokenRatios() function returns an array of
|
|
837
|
-
If 'timeIntervals' is not specified, it returns
|
|
842
|
+
The getAverageDepositTokenRatios() function returns an array of [AverageDepositTokenRatio](#averagedeposittokenratio) objects representing the average deposit token ratio for the periods of time specified by the 'timeIntervals' parameter.
|
|
843
|
+
If 'timeIntervals' is not specified, it returns [AverageDepositTokenRatio](#averagedeposittokenratio) objects for time periods of 1, 7, and 30 days.
|
|
838
844
|
|
|
839
845
|
```typescript
|
|
840
846
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -871,8 +877,11 @@ const averageDtr: AverageDepositTokenRatio[] = await getAverageDepositTokenRatio
|
|
|
871
877
|
| timeIntervals | number[] | [1, 7, 30] | false |
|
|
872
878
|
|
|
873
879
|
<br/>
|
|
874
|
-
|
|
875
|
-
|
|
880
|
+
|
|
881
|
+
> **Note:** This function may take several seconds to execute as it processes historical data. It is best suited for report generation and batched backend processes rather than user-facing interfaces where immediate responses are expected.
|
|
882
|
+
|
|
883
|
+
The getVaultMetrics() function returns an array of [VaultMetrics](#vaultmetrics) objects for the periods of time specified by the 'timeIntervals' parameter.
|
|
884
|
+
If 'timeIntervals' is not specified, it returns [VaultMetrics](#vaultmetrics) objects for time periods of 1, 7, and 30 days.
|
|
876
885
|
|
|
877
886
|
```typescript
|
|
878
887
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -909,7 +918,7 @@ const vaultMetrics: VaultMetrics[] = await getVaultMetrics(
|
|
|
909
918
|
| jsonProvider | JsonRpcProvider | - | false |
|
|
910
919
|
|
|
911
920
|
<br/>
|
|
912
|
-
This function returns IchiVault object.
|
|
921
|
+
This function returns [IchiVault](#ichivault) object.
|
|
913
922
|
|
|
914
923
|
```typescript
|
|
915
924
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -935,7 +944,7 @@ if (vaultInfo) {
|
|
|
935
944
|
| pairedTokenAddress | string | - | true |
|
|
936
945
|
|
|
937
946
|
<br/>
|
|
938
|
-
This function returns an array of all vaults (IchiVault[]) on the specified DEX that contain two tokens defined by the 'depositTokenAddress' and 'pairedTokenAddress' parameters.
|
|
947
|
+
This function returns an array of all vaults ([IchiVault](#ichivault)[]) on the specified DEX that contain two tokens defined by the 'depositTokenAddress' and 'pairedTokenAddress' parameters.
|
|
939
948
|
|
|
940
949
|
```typescript
|
|
941
950
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -991,7 +1000,7 @@ if (vaults.length === 0) {
|
|
|
991
1000
|
| dex | SupportedDex | - | true
|
|
992
1001
|
|
|
993
1002
|
<br/>
|
|
994
|
-
This function returns an object of type VaultPositionsInfo.
|
|
1003
|
+
This function returns an object of type [VaultPositionsInfo](#vaultpositionsinfo).
|
|
995
1004
|
|
|
996
1005
|
```typescript
|
|
997
1006
|
import { Web3Provider } from '@ethersproject/providers';
|
|
@@ -1052,7 +1061,7 @@ const chains: SupportedChainId[] = getChainsForDex(dex);
|
|
|
1052
1061
|
| vaultAddress | string | - | true |
|
|
1053
1062
|
|
|
1054
1063
|
<br/>
|
|
1055
|
-
This function returns
|
|
1064
|
+
This function returns [RewardInfo](#rewardinfo) about reward rates and farming contract for the specified vault. This function is specific for Velodrome vaults.
|
|
1056
1065
|
|
|
1057
1066
|
```typescript
|
|
1058
1067
|
import { getRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1072,7 +1081,7 @@ const rewardInfo: RewardInfo = getRewardInfo(chainId, dex, vaultAddress);
|
|
|
1072
1081
|
| dex | SupportedDex | - | true |
|
|
1073
1082
|
|
|
1074
1083
|
<br/>
|
|
1075
|
-
This function returns
|
|
1084
|
+
This function returns an array of [RewardInfo](#rewardinfo) about reward rates and farming contracts for all vaults on the dex. This function is specific for Velodrome vaults.
|
|
1076
1085
|
|
|
1077
1086
|
```typescript
|
|
1078
1087
|
import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1080,7 +1089,7 @@ import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-
|
|
|
1080
1089
|
const chainId = SupportedChainId.Ink;
|
|
1081
1090
|
const dex = SupportedDex.Velodrome;
|
|
1082
1091
|
|
|
1083
|
-
const
|
|
1092
|
+
const allRewardInfo: RewardInfo[] = getAllRewardInfo(chainId, dex);
|
|
1084
1093
|
```
|
|
1085
1094
|
|
|
1086
1095
|
#### 31. `getAllUserRewards()`
|
|
@@ -1093,7 +1102,7 @@ const chains: RewardInfo[] = getAllRewardInfo(chainId, dex);
|
|
|
1093
1102
|
| raw | true | undefined | - | false |
|
|
1094
1103
|
|
|
1095
1104
|
<br/>
|
|
1096
|
-
This function returns user rewards for all vaults on the dex. This
|
|
1105
|
+
This function returns user rewards (as [UserRewards](#userrewards)) for all vaults on the dex. This function is specific for Velodrome vaults.
|
|
1097
1106
|
|
|
1098
1107
|
```typescript
|
|
1099
1108
|
import { getAllUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1116,7 +1125,7 @@ const rewards: UserRewards[] = await getAllUserRewards(account, provider, dex);
|
|
|
1116
1125
|
| raw | true | undefined | - | false |
|
|
1117
1126
|
|
|
1118
1127
|
<br/>
|
|
1119
|
-
This function returns claimable reward amounts for the specified vault and user account. This
|
|
1128
|
+
This function returns claimable reward amounts (as [UserRewardsByToken](#userrewardsbytoken) or [UserRewardsByTokenBN](#userrewardsbytokenbn)) for the specified vault and user account. This function is specific for Velodrome vaults.
|
|
1120
1129
|
|
|
1121
1130
|
```typescript
|
|
1122
1131
|
import { getUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1126,8 +1135,8 @@ const vaultAddress = "0x3e4...45a";
|
|
|
1126
1135
|
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
1127
1136
|
const dex = SupportedDex.Velodrome;
|
|
1128
1137
|
|
|
1129
|
-
const rewards:
|
|
1130
|
-
const rewardsBN:
|
|
1138
|
+
const rewards: UserRewardsByToken[] = getUserRewards(account, vaultAddress, provider, dex);
|
|
1139
|
+
const rewardsBN: UserRewardsByTokenBN[] = getUserRewards(account, vaultAddress, provider, dex, true);
|
|
1131
1140
|
```
|
|
1132
1141
|
|
|
1133
1142
|
#### 33. `claimRewards()`
|
package/dist/src/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* author: ICHI DAO <core@ichi.org>
|
|
5
|
-
* ichi-vaults-sdk.js v0.1.
|
|
5
|
+
* ichi-vaults-sdk.js v0.1.38
|
|
6
6
|
* Released under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -30,3 +30,4 @@ tslib_1.__exportStar(require("./functions/userRewards"), exports);
|
|
|
30
30
|
tslib_1.__exportStar(require("./functions/claimRewards"), exports);
|
|
31
31
|
tslib_1.__exportStar(require("./types/index"), exports);
|
|
32
32
|
tslib_1.__exportStar(require("./utils/getGraphUrls"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./utils/config/addresses"), exports);
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* author: ICHI DAO <core@ichi.org>
|
|
5
|
-
* ichi-vaults-sdk.js v0.1.
|
|
5
|
+
* ichi-vaults-sdk.js v0.1.38
|
|
6
6
|
* Released under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -28,3 +28,4 @@ tslib_1.__exportStar(require("./functions/userRewards"), exports);
|
|
|
28
28
|
tslib_1.__exportStar(require("./functions/claimRewards"), exports);
|
|
29
29
|
tslib_1.__exportStar(require("./types/index"), exports);
|
|
30
30
|
tslib_1.__exportStar(require("./utils/getGraphUrls"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./utils/config/addresses"), exports);
|
package/dist/src/index.js
CHANGED
|
@@ -34,4 +34,5 @@ __exportStar(require("./functions/userRewards"), exports);
|
|
|
34
34
|
__exportStar(require("./functions/claimRewards"), exports);
|
|
35
35
|
__exportStar(require("./types/index"), exports);
|
|
36
36
|
__exportStar(require("./utils/getGraphUrls"), exports);
|
|
37
|
+
__exportStar(require("./utils/config/addresses"), exports);
|
|
37
38
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,oDAAkC;AAClC,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,qDAAmC;AACnC,6DAA2C;AAC3C,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,2DAAyC;AACzC,gDAA8B;AAC9B,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,oDAAkC;AAClC,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,qDAAmC;AACnC,6DAA2C;AAC3C,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,2DAAyC;AACzC,gDAA8B;AAC9B,uDAAqC;AACrC,2DAAyC"}
|
package/dist/src/src/index.d.ts
CHANGED