@ichidao/ichi-vaults-sdk 0.1.37 → 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 +22 -22
- package/dist/src/index.cjs.js +1 -1
- package/dist/src/index.esm.js +1 -1
- 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';
|
|
@@ -575,7 +575,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
|
575
575
|
const dex = SupportedDex.UniswapV3
|
|
576
576
|
const accountAddress = "0xaaaa...aaaaaa"
|
|
577
577
|
|
|
578
|
-
const userBalancesInVaults:
|
|
578
|
+
const userBalancesInVaults: UserBalanceInVault[] = await getAllUserBalances(
|
|
579
579
|
accountAddress,
|
|
580
580
|
web3Provider,
|
|
581
581
|
dex
|
|
@@ -583,7 +583,7 @@ const userBalancesInVaults: [UserBalanceInVault](#userbalanceinvault)[] = await
|
|
|
583
583
|
|
|
584
584
|
// - or -
|
|
585
585
|
|
|
586
|
-
const userBalancesInVaultsBN:
|
|
586
|
+
const userBalancesInVaultsBN: UserBalanceInVaultBN[] = await getAllUserBalances(
|
|
587
587
|
accountAddress,
|
|
588
588
|
web3Provider,
|
|
589
589
|
dex,
|
|
@@ -601,7 +601,7 @@ const userBalancesInVaultsBN: [UserBalanceInVaultBN](#userbalanceinvaultbn)[] =
|
|
|
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';
|
|
@@ -611,7 +611,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
|
611
611
|
const dex = SupportedDex.UniswapV3
|
|
612
612
|
const accountAddress = "0xaaaa...aaaaaa"
|
|
613
613
|
|
|
614
|
-
const amounts:
|
|
614
|
+
const amounts: UserAmountsInVault[] = await getAllUserAmounts(
|
|
615
615
|
accountAddress,
|
|
616
616
|
web3Provider,
|
|
617
617
|
dex,
|
|
@@ -619,7 +619,7 @@ const amounts: [UserAmountsInVault](#useramountsinvault)[] = await getAllUserAmo
|
|
|
619
619
|
|
|
620
620
|
// - or -
|
|
621
621
|
|
|
622
|
-
const amountsBN:
|
|
622
|
+
const amountsBN: UserAmountsInVaultBN[] = await getAllUserAmounts(
|
|
623
623
|
accountAddress,
|
|
624
624
|
web3Provider,
|
|
625
625
|
dex,
|
|
@@ -790,7 +790,7 @@ const vaultAddress = "0x3ac9...a5f132";
|
|
|
790
790
|
const dex = SupportedDex.UniswapV3;
|
|
791
791
|
const days = [2, 5, 14, 60];
|
|
792
792
|
|
|
793
|
-
const feesInfo:
|
|
793
|
+
const feesInfo: FeesInfo[] = await getFeesCollectedInfo(
|
|
794
794
|
vaultAddress,
|
|
795
795
|
web3Provider,
|
|
796
796
|
dex
|
|
@@ -798,7 +798,7 @@ const feesInfo: [FeesInfo](#feesinfo)[] = await getFeesCollectedInfo(
|
|
|
798
798
|
|
|
799
799
|
// - or -
|
|
800
800
|
|
|
801
|
-
const feesInfo:
|
|
801
|
+
const feesInfo: FeesInfo[] = await getFeesCollectedInfo(
|
|
802
802
|
vaultAddress,
|
|
803
803
|
web3Provider,
|
|
804
804
|
dex,
|
|
@@ -851,7 +851,7 @@ const vaultAddress = "0x3ac9...a5f132";
|
|
|
851
851
|
const dex = SupportedDex.UniswapV3;
|
|
852
852
|
const days = [2, 5, 14, 60];
|
|
853
853
|
|
|
854
|
-
const averageDtr:
|
|
854
|
+
const averageDtr: AverageDepositTokenRatio[] = await getAverageDepositTokenRatios(
|
|
855
855
|
vaultAddress,
|
|
856
856
|
web3Provider,
|
|
857
857
|
dex
|
|
@@ -859,7 +859,7 @@ const averageDtr: [AverageDepositTokenRatio](#averagedeposittokenratio)[] = awai
|
|
|
859
859
|
|
|
860
860
|
// - or -
|
|
861
861
|
|
|
862
|
-
const averageDtr:
|
|
862
|
+
const averageDtr: AverageDepositTokenRatio[] = await getAverageDepositTokenRatios(
|
|
863
863
|
vaultAddress,
|
|
864
864
|
web3Provider,
|
|
865
865
|
dex,
|
|
@@ -892,7 +892,7 @@ const vaultAddress = "0x3ac9...a5f132";
|
|
|
892
892
|
const dex = SupportedDex.UniswapV3;
|
|
893
893
|
const days = [2, 5, 14, 60];
|
|
894
894
|
|
|
895
|
-
const vaultMetrics:
|
|
895
|
+
const vaultMetrics: VaultMetrics[] = await getVaultMetrics(
|
|
896
896
|
vaultAddress,
|
|
897
897
|
web3Provider,
|
|
898
898
|
dex
|
|
@@ -900,7 +900,7 @@ const vaultMetrics: [VaultMetrics](#vaultmetrics)[] = await getVaultMetrics(
|
|
|
900
900
|
|
|
901
901
|
// - or -
|
|
902
902
|
|
|
903
|
-
const vaultMetrics:
|
|
903
|
+
const vaultMetrics: VaultMetrics[] = await getVaultMetrics(
|
|
904
904
|
vaultAddress,
|
|
905
905
|
web3Provider,
|
|
906
906
|
dex,
|
|
@@ -1010,7 +1010,7 @@ const web3Provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
|
1010
1010
|
const vaultAddress = "0x3ac9...a5f132";
|
|
1011
1011
|
const dex = SupportedDex.UniswapV3;
|
|
1012
1012
|
|
|
1013
|
-
const vaultPositions:
|
|
1013
|
+
const vaultPositions: VaultPositionsInfo = await getVaultPositions(
|
|
1014
1014
|
vaultAddress,
|
|
1015
1015
|
web3Provider,
|
|
1016
1016
|
dex
|
|
@@ -1061,7 +1061,7 @@ const chains: SupportedChainId[] = getChainsForDex(dex);
|
|
|
1061
1061
|
| vaultAddress | string | - | true |
|
|
1062
1062
|
|
|
1063
1063
|
<br/>
|
|
1064
|
-
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.
|
|
1065
1065
|
|
|
1066
1066
|
```typescript
|
|
1067
1067
|
import { getRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1070,7 +1070,7 @@ const vaultAddress = "0x3e4...45a";
|
|
|
1070
1070
|
const chainId = SupportedChainId.Ink;
|
|
1071
1071
|
const dex = SupportedDex.Velodrome;
|
|
1072
1072
|
|
|
1073
|
-
const rewardInfo:
|
|
1073
|
+
const rewardInfo: RewardInfo = getRewardInfo(chainId, dex, vaultAddress);
|
|
1074
1074
|
```
|
|
1075
1075
|
|
|
1076
1076
|
#### 30. `getAllRewardInfo()`
|
|
@@ -1081,7 +1081,7 @@ const rewardInfo: [RewardInfo](#rewardinfo) = getRewardInfo(chainId, dex, vaultA
|
|
|
1081
1081
|
| dex | SupportedDex | - | true |
|
|
1082
1082
|
|
|
1083
1083
|
<br/>
|
|
1084
|
-
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.
|
|
1085
1085
|
|
|
1086
1086
|
```typescript
|
|
1087
1087
|
import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1089,7 +1089,7 @@ import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-
|
|
|
1089
1089
|
const chainId = SupportedChainId.Ink;
|
|
1090
1090
|
const dex = SupportedDex.Velodrome;
|
|
1091
1091
|
|
|
1092
|
-
const
|
|
1092
|
+
const allRewardInfo: RewardInfo[] = getAllRewardInfo(chainId, dex);
|
|
1093
1093
|
```
|
|
1094
1094
|
|
|
1095
1095
|
#### 31. `getAllUserRewards()`
|
|
@@ -1102,7 +1102,7 @@ const chains: [RewardInfo](#rewardinfo)[] = getAllRewardInfo(chainId, dex);
|
|
|
1102
1102
|
| raw | true | undefined | - | false |
|
|
1103
1103
|
|
|
1104
1104
|
<br/>
|
|
1105
|
-
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.
|
|
1106
1106
|
|
|
1107
1107
|
```typescript
|
|
1108
1108
|
import { getAllUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1111,7 +1111,7 @@ const account = "0x123...890";
|
|
|
1111
1111
|
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
1112
1112
|
const dex = SupportedDex.Velodrome;
|
|
1113
1113
|
|
|
1114
|
-
const rewards:
|
|
1114
|
+
const rewards: UserRewards[] = await getAllUserRewards(account, provider, dex);
|
|
1115
1115
|
```
|
|
1116
1116
|
|
|
1117
1117
|
#### 32. `getUserRewards()`
|
|
@@ -1125,7 +1125,7 @@ const rewards: [UserRewards](#userrewards)[] = await getAllUserRewards(account,
|
|
|
1125
1125
|
| raw | true | undefined | - | false |
|
|
1126
1126
|
|
|
1127
1127
|
<br/>
|
|
1128
|
-
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.
|
|
1129
1129
|
|
|
1130
1130
|
```typescript
|
|
1131
1131
|
import { getUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
|
@@ -1135,8 +1135,8 @@ const vaultAddress = "0x3e4...45a";
|
|
|
1135
1135
|
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
|
1136
1136
|
const dex = SupportedDex.Velodrome;
|
|
1137
1137
|
|
|
1138
|
-
const rewards:
|
|
1139
|
-
const rewardsBN:
|
|
1138
|
+
const rewards: UserRewardsByToken[] = getUserRewards(account, vaultAddress, provider, dex);
|
|
1139
|
+
const rewardsBN: UserRewardsByTokenBN[] = getUserRewards(account, vaultAddress, provider, dex, true);
|
|
1140
1140
|
```
|
|
1141
1141
|
|
|
1142
1142
|
#### 33. `claimRewards()`
|
package/dist/src/index.cjs.js
CHANGED
package/dist/src/index.esm.js
CHANGED