@ichidao/ichi-vaults-sdk 0.1.37 → 0.1.39

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 CHANGED
@@ -564,8 +564,7 @@ const amountsBN: [BigNumber, BigNumber] & {amount0: BigNumber, amount1: BigNumbe
564
564
  | dex | SupportedDex | - | true
565
565
  | raw | true | undefined | false |
566
566
 
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.
567
+ 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
568
 
570
569
  ```typescript
571
570
  import { Web3Provider } from '@ethersproject/providers';
@@ -575,7 +574,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
575
574
  const dex = SupportedDex.UniswapV3
576
575
  const accountAddress = "0xaaaa...aaaaaa"
577
576
 
578
- const userBalancesInVaults: [UserBalanceInVault](#userbalanceinvault)[] = await getAllUserBalances(
577
+ const userBalancesInVaults: UserBalanceInVault[] = await getAllUserBalances(
579
578
  accountAddress,
580
579
  web3Provider,
581
580
  dex
@@ -583,7 +582,7 @@ const userBalancesInVaults: [UserBalanceInVault](#userbalanceinvault)[] = await
583
582
 
584
583
  // - or -
585
584
 
586
- const userBalancesInVaultsBN: [UserBalanceInVaultBN](#userbalanceinvaultbn)[] = await getAllUserBalances(
585
+ const userBalancesInVaultsBN: UserBalanceInVaultBN[] = await getAllUserBalances(
587
586
  accountAddress,
588
587
  web3Provider,
589
588
  dex,
@@ -600,8 +599,7 @@ const userBalancesInVaultsBN: [UserBalanceInVaultBN](#userbalanceinvaultbn)[] =
600
599
  | dex | SupportedDex | - | true
601
600
  | raw | true | undefined | false |
602
601
 
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.
602
+ 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
603
 
606
604
  ```typescript
607
605
  import { Web3Provider } from '@ethersproject/providers';
@@ -611,7 +609,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
611
609
  const dex = SupportedDex.UniswapV3
612
610
  const accountAddress = "0xaaaa...aaaaaa"
613
611
 
614
- const amounts: [UserAmountsInVault](#useramountsinvault)[] = await getAllUserAmounts(
612
+ const amounts: UserAmountsInVault[] = await getAllUserAmounts(
615
613
  accountAddress,
616
614
  web3Provider,
617
615
  dex,
@@ -619,7 +617,7 @@ const amounts: [UserAmountsInVault](#useramountsinvault)[] = await getAllUserAmo
619
617
 
620
618
  // - or -
621
619
 
622
- const amountsBN: [UserAmountsInVaultBN](#useramountsinvaultbn)[] = await getAllUserAmounts(
620
+ const amountsBN: UserAmountsInVaultBN[] = await getAllUserAmounts(
623
621
  accountAddress,
624
622
  web3Provider,
625
623
  dex,
@@ -779,7 +777,6 @@ const amountsBN: [BigNumber, BigNumber] & {total0: BigNumber, total1: BigNumber}
779
777
 
780
778
  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
779
  If 'forDays' is not specified, it returns [FeesInfo](#feesinfo) for time periods of 1, 7, and 30 days.
782
- <br/>
783
780
 
784
781
  ```typescript
785
782
  import { Web3Provider } from '@ethersproject/providers';
@@ -790,7 +787,7 @@ const vaultAddress = "0x3ac9...a5f132";
790
787
  const dex = SupportedDex.UniswapV3;
791
788
  const days = [2, 5, 14, 60];
792
789
 
793
- const feesInfo: [FeesInfo](#feesinfo)[] = await getFeesCollectedInfo(
790
+ const feesInfo: FeesInfo[] = await getFeesCollectedInfo(
794
791
  vaultAddress,
795
792
  web3Provider,
796
793
  dex
@@ -798,7 +795,7 @@ const feesInfo: [FeesInfo](#feesinfo)[] = await getFeesCollectedInfo(
798
795
 
799
796
  // - or -
800
797
 
801
- const feesInfo: [FeesInfo](#feesinfo)[] = await getFeesCollectedInfo(
798
+ const feesInfo: FeesInfo[] = await getFeesCollectedInfo(
802
799
  vaultAddress,
803
800
  web3Provider,
804
801
  dex,
@@ -814,7 +811,6 @@ const feesInfo: [FeesInfo](#feesinfo)[] = await getFeesCollectedInfo(
814
811
  | jsonProvider | [JsonRpcProvider](https://github.com/ethers-io/ethers.js/blob/f97b92bbb1bde22fcc44100af78d7f31602863ab/packages/providers/src.ts/json-rpc-provider.ts#L393) | - | true
815
812
  | dex | SupportedDex | - | true
816
813
 
817
- <br/>
818
814
  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.
819
815
 
820
816
  ```typescript
@@ -838,7 +834,6 @@ console.log(`1-day Fee APR: ${feeAprs.feeApr_1d}%`);
838
834
  | dex | SupportedDex | - | true
839
835
  | timeIntervals | number[] | [1, 7, 30] | false |
840
836
 
841
- <br/>
842
837
  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
838
  If 'timeIntervals' is not specified, it returns [AverageDepositTokenRatio](#averagedeposittokenratio) objects for time periods of 1, 7, and 30 days.
844
839
 
@@ -851,7 +846,7 @@ const vaultAddress = "0x3ac9...a5f132";
851
846
  const dex = SupportedDex.UniswapV3;
852
847
  const days = [2, 5, 14, 60];
853
848
 
854
- const averageDtr: [AverageDepositTokenRatio](#averagedeposittokenratio)[] = await getAverageDepositTokenRatios(
849
+ const averageDtr: AverageDepositTokenRatio[] = await getAverageDepositTokenRatios(
855
850
  vaultAddress,
856
851
  web3Provider,
857
852
  dex
@@ -859,7 +854,7 @@ const averageDtr: [AverageDepositTokenRatio](#averagedeposittokenratio)[] = awai
859
854
 
860
855
  // - or -
861
856
 
862
- const averageDtr: [AverageDepositTokenRatio](#averagedeposittokenratio)[] = await getAverageDepositTokenRatios(
857
+ const averageDtr: AverageDepositTokenRatio[] = await getAverageDepositTokenRatios(
863
858
  vaultAddress,
864
859
  web3Provider,
865
860
  dex,
@@ -892,7 +887,7 @@ const vaultAddress = "0x3ac9...a5f132";
892
887
  const dex = SupportedDex.UniswapV3;
893
888
  const days = [2, 5, 14, 60];
894
889
 
895
- const vaultMetrics: [VaultMetrics](#vaultmetrics)[] = await getVaultMetrics(
890
+ const vaultMetrics: VaultMetrics[] = await getVaultMetrics(
896
891
  vaultAddress,
897
892
  web3Provider,
898
893
  dex
@@ -900,7 +895,7 @@ const vaultMetrics: [VaultMetrics](#vaultmetrics)[] = await getVaultMetrics(
900
895
 
901
896
  // - or -
902
897
 
903
- const vaultMetrics: [VaultMetrics](#vaultmetrics)[] = await getVaultMetrics(
898
+ const vaultMetrics: VaultMetrics[] = await getVaultMetrics(
904
899
  vaultAddress,
905
900
  web3Provider,
906
901
  dex,
@@ -917,8 +912,7 @@ const vaultMetrics: [VaultMetrics](#vaultmetrics)[] = await getVaultMetrics(
917
912
  | vaultAddress | string | - | true |
918
913
  | jsonProvider | JsonRpcProvider | - | false |
919
914
 
920
- <br/>
921
- This function returns [IchiVault](#ichivault) object.
915
+ This function returns an [IchiVault](#ichivault) object.
922
916
 
923
917
  ```typescript
924
918
  import { Web3Provider } from '@ethersproject/providers';
@@ -943,7 +937,6 @@ if (vaultInfo) {
943
937
  | depositTokenAddress | string | - | true |
944
938
  | pairedTokenAddress | string | - | true |
945
939
 
946
- <br/>
947
940
  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.
948
941
 
949
942
  ```typescript
@@ -999,7 +992,6 @@ if (vaults.length === 0) {
999
992
  | jsonProvider | [JsonRpcProvider](https://github.com/ethers-io/ethers.js/blob/f97b92bbb1bde22fcc44100af78d7f31602863ab/packages/providers/src.ts/json-rpc-provider.ts#L393) | - | true
1000
993
  | dex | SupportedDex | - | true
1001
994
 
1002
- <br/>
1003
995
  This function returns an object of type [VaultPositionsInfo](#vaultpositionsinfo).
1004
996
 
1005
997
  ```typescript
@@ -1010,7 +1002,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
1010
1002
  const vaultAddress = "0x3ac9...a5f132";
1011
1003
  const dex = SupportedDex.UniswapV3;
1012
1004
 
1013
- const vaultPositions: [VaultPositionsInfo](#vaultpositionsinfo) = await getVaultPositions(
1005
+ const vaultPositions: VaultPositionsInfo = await getVaultPositions(
1014
1006
  vaultAddress,
1015
1007
  web3Provider,
1016
1008
  dex
@@ -1060,8 +1052,7 @@ const chains: SupportedChainId[] = getChainsForDex(dex);
1060
1052
  | dex | SupportedDex | - | true |
1061
1053
  | vaultAddress | string | - | true |
1062
1054
 
1063
- <br/>
1064
- This function returns information about reward rates and farming contract for the specified vault. This functions is specific for the Velodrome vaults.
1055
+ This function returns [RewardInfo](#rewardinfo) about reward rates and farming contract for the specified vault. This function is specific for Velodrome vaults.
1065
1056
 
1066
1057
  ```typescript
1067
1058
  import { getRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
@@ -1070,7 +1061,7 @@ const vaultAddress = "0x3e4...45a";
1070
1061
  const chainId = SupportedChainId.Ink;
1071
1062
  const dex = SupportedDex.Velodrome;
1072
1063
 
1073
- const rewardInfo: [RewardInfo](#rewardinfo) = getRewardInfo(chainId, dex, vaultAddress);
1064
+ const rewardInfo: RewardInfo = getRewardInfo(chainId, dex, vaultAddress);
1074
1065
  ```
1075
1066
 
1076
1067
  #### 30. `getAllRewardInfo()`
@@ -1080,8 +1071,7 @@ const rewardInfo: [RewardInfo](#rewardinfo) = getRewardInfo(chainId, dex, vaultA
1080
1071
  | chainId | SupportedChainId | - | true |
1081
1072
  | dex | SupportedDex | - | true |
1082
1073
 
1083
- <br/>
1084
- This function returns information about reward rates and farming contract for all vaults on the dex. This functions is specific for the Velodrome vaults.
1074
+ 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.
1085
1075
 
1086
1076
  ```typescript
1087
1077
  import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
@@ -1089,7 +1079,7 @@ import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-
1089
1079
  const chainId = SupportedChainId.Ink;
1090
1080
  const dex = SupportedDex.Velodrome;
1091
1081
 
1092
- const chains: [RewardInfo](#rewardinfo)[] = getAllRewardInfo(chainId, dex);
1082
+ const allRewardInfo: RewardInfo[] = getAllRewardInfo(chainId, dex);
1093
1083
  ```
1094
1084
 
1095
1085
  #### 31. `getAllUserRewards()`
@@ -1101,8 +1091,7 @@ const chains: [RewardInfo](#rewardinfo)[] = getAllRewardInfo(chainId, dex);
1101
1091
  | dex | SupportedDex | - | true |
1102
1092
  | raw | true | undefined | - | false |
1103
1093
 
1104
- <br/>
1105
- This function returns user rewards for all vaults on the dex. This functions is specific for the Velodrome vaults.
1094
+ This function returns user rewards (as [UserRewards](#userrewards)) for all vaults on the dex. This function is specific for Velodrome vaults.
1106
1095
 
1107
1096
  ```typescript
1108
1097
  import { getAllUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
@@ -1111,7 +1100,7 @@ const account = "0x123...890";
1111
1100
  const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
1112
1101
  const dex = SupportedDex.Velodrome;
1113
1102
 
1114
- const rewards: [UserRewards](#userrewards)[] = await getAllUserRewards(account, provider, dex);
1103
+ const rewards: UserRewards[] = await getAllUserRewards(account, provider, dex);
1115
1104
  ```
1116
1105
 
1117
1106
  #### 32. `getUserRewards()`
@@ -1124,8 +1113,7 @@ const rewards: [UserRewards](#userrewards)[] = await getAllUserRewards(account,
1124
1113
  | dex | SupportedDex | - | true |
1125
1114
  | raw | true | undefined | - | false |
1126
1115
 
1127
- <br/>
1128
- This function returns claimable reward amounts for the specified vault and user account. This functions is specific for the Velodrome vaults.
1116
+ 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.
1129
1117
 
1130
1118
  ```typescript
1131
1119
  import { getUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
@@ -1135,8 +1123,8 @@ const vaultAddress = "0x3e4...45a";
1135
1123
  const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
1136
1124
  const dex = SupportedDex.Velodrome;
1137
1125
 
1138
- const rewards: [UserRewardsByToken](#userrewardsbytoken)[] = getUserRewards(account, vaultAddress, provider, dex);
1139
- const rewardsBN: [UserRewardsByTokenBN](#userrewardsbytokenbn)[] = getUserRewards(account, vaultAddress, provider, dex, true);
1126
+ const rewards: UserRewardsByToken[] = getUserRewards(account, vaultAddress, provider, dex);
1127
+ const rewardsBN: UserRewardsByTokenBN[] = getUserRewards(account, vaultAddress, provider, dex, true);
1140
1128
  ```
1141
1129
 
1142
1130
  #### 33. `claimRewards()`
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @license
4
4
  * author: ICHI DAO <core@ichi.org>
5
- * ichi-vaults-sdk.js v0.1.37
5
+ * ichi-vaults-sdk.js v0.1.39
6
6
  * Released under the MIT license.
7
7
  */
8
8
 
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @license
4
4
  * author: ICHI DAO <core@ichi.org>
5
- * ichi-vaults-sdk.js v0.1.37
5
+ * ichi-vaults-sdk.js v0.1.39
6
6
  * Released under the MIT license.
7
7
  */
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichidao/ichi-vaults-sdk",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "The ICHI Vaults SDK",
5
5
  "main": "dist/src/index.cjs.js",
6
6
  "module": "dist/src/index.esm.js",