@ichidao/ichi-vaults-sdk 0.0.113 → 0.1.1
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 +191 -0
- package/dist/abis/types/MultiFeeDistributer.d.ts +475 -0
- package/dist/abis/types/MultiFeeDistributer.js +3 -0
- package/dist/abis/types/MultiFeeDistributer.js.map +1 -0
- package/dist/abis/types/factories/MultiFeeDistributer__factory.d.ts +451 -0
- package/dist/abis/types/factories/MultiFeeDistributer__factory.js +596 -0
- package/dist/abis/types/factories/MultiFeeDistributer__factory.js.map +1 -0
- package/dist/abis/types/factories/index.d.ts +1 -0
- package/dist/abis/types/factories/index.js +3 -1
- package/dist/abis/types/factories/index.js.map +1 -1
- package/dist/abis/types/index.d.ts +2 -0
- package/dist/abis/types/index.js +3 -1
- package/dist/abis/types/index.js.map +1 -1
- package/dist/src/__tests__/index.test.js +74 -1
- package/dist/src/__tests__/index.test.js.map +1 -1
- package/dist/src/abis/types/MultiFeeDistributer.d.ts +475 -0
- package/dist/src/abis/types/factories/MultiFeeDistributer__factory.d.ts +451 -0
- package/dist/src/abis/types/factories/index.d.ts +1 -0
- package/dist/src/abis/types/index.d.ts +2 -0
- package/dist/src/contracts/index.d.ts +2 -1
- package/dist/src/contracts/index.js +11 -1
- package/dist/src/contracts/index.js.map +1 -1
- package/dist/src/functions/claimRewards.d.ts +14 -0
- package/dist/src/functions/claimRewards.js +109 -0
- package/dist/src/functions/claimRewards.js.map +1 -0
- package/dist/src/functions/rewardInfo.d.ts +3 -0
- package/dist/src/functions/rewardInfo.js +176 -0
- package/dist/src/functions/rewardInfo.js.map +1 -0
- package/dist/src/functions/userBalances.d.ts +1 -1
- package/dist/src/functions/userBalances.js +64 -29
- package/dist/src/functions/userBalances.js.map +1 -1
- package/dist/src/functions/userRewards.d.ts +6 -0
- package/dist/src/functions/userRewards.js +161 -0
- package/dist/src/functions/userRewards.js.map +1 -0
- package/dist/src/functions/vault.d.ts +2 -1
- package/dist/src/functions/vault.js +74 -26
- package/dist/src/functions/vault.js.map +1 -1
- package/dist/src/graphql/constants.js +2 -2
- package/dist/src/graphql/constants.js.map +1 -1
- package/dist/src/graphql/queries.d.ts +14 -1
- package/dist/src/graphql/queries.js +57 -18
- package/dist/src/graphql/queries.js.map +1 -1
- package/dist/src/index.cjs.js +4 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.esm.js +4 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/src/contracts/index.d.ts +2 -1
- package/dist/src/src/functions/claimRewards.d.ts +14 -0
- package/dist/src/src/functions/rewardInfo.d.ts +3 -0
- package/dist/src/src/functions/userBalances.d.ts +1 -1
- package/dist/src/src/functions/userRewards.d.ts +6 -0
- package/dist/src/src/functions/vault.d.ts +2 -1
- package/dist/src/src/graphql/queries.d.ts +14 -1
- package/dist/src/src/index.d.ts +3 -0
- package/dist/src/src/types/index.d.ts +50 -0
- package/dist/src/src/types/vaultQueryData.d.ts +10 -1
- package/dist/src/src/utils/isVelodrome.d.ts +2 -0
- package/dist/src/src/utils/multicallUtils.d.ts +2 -0
- package/dist/src/types/index.d.ts +50 -0
- package/dist/src/types/vaultQueryData.d.ts +10 -1
- package/dist/src/utils/isVelodrome.d.ts +2 -0
- package/dist/src/utils/isVelodrome.js +11 -0
- package/dist/src/utils/isVelodrome.js.map +1 -0
- package/dist/src/utils/multicallUtils.d.ts +2 -0
- package/dist/src/utils/multicallUtils.js +19 -1
- package/dist/src/utils/multicallUtils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -38,6 +38,11 @@ This sdk contains collection of functions to interact with IchiVault's smart con
|
|
38
38
|
* [`getVaultPositions()`](#26-getVaultPositions)
|
39
39
|
* [`getSupportedDexes()`](#27-getSupportedDexes)
|
40
40
|
* [`getChainsForDex()`](#28-getChainsForDex)
|
41
|
+
* [`getRewardInfo()`](#29-getRewardInfo)
|
42
|
+
* [`getAllRewardInfo()`](#30-getAllRewardInfo)
|
43
|
+
* [`getAllUserRewards()`](#31-getAllUserRewards)
|
44
|
+
* [`getUserRewards()`](#32-getUserRewards)
|
45
|
+
* [`claimRewards()`](#33-claimRewards)
|
41
46
|
|
42
47
|
## Installation
|
43
48
|
Install with
|
@@ -1036,6 +1041,116 @@ const dex = SupportedChainId.UniswapV3;
|
|
1036
1041
|
const chains: SupportedChainId[] = getChainsForDex(dex);
|
1037
1042
|
```
|
1038
1043
|
|
1044
|
+
#### 29. `getRewardInfo()`
|
1045
|
+
|
1046
|
+
| param | type | default | required
|
1047
|
+
| -------- | -------- | -------- | --------
|
1048
|
+
| chainId | SupportedChainId | - | true |
|
1049
|
+
| dex | SupportedDex | - | true |
|
1050
|
+
| vaultAddress | string | - | true |
|
1051
|
+
|
1052
|
+
<br/>
|
1053
|
+
This function returns information about reward rates and farming contract for the specified vault. This functions is specific for the Velodrome vaults.
|
1054
|
+
|
1055
|
+
```typescript
|
1056
|
+
import { getRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
1057
|
+
|
1058
|
+
const vaultAddress = "0x3e4...45a";
|
1059
|
+
const chainId = SupportedChainId.Ink;
|
1060
|
+
const dex = SupportedDex.Velodrome;
|
1061
|
+
|
1062
|
+
const rewardInfo: RewardInfo = getRewardInfo(chainId, dex, vaultAddress);
|
1063
|
+
```
|
1064
|
+
|
1065
|
+
#### 30. `getAllRewardInfo()`
|
1066
|
+
|
1067
|
+
| param | type | default | required
|
1068
|
+
| -------- | -------- | -------- | --------
|
1069
|
+
| chainId | SupportedChainId | - | true |
|
1070
|
+
| dex | SupportedDex | - | true |
|
1071
|
+
|
1072
|
+
<br/>
|
1073
|
+
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
|
+
|
1075
|
+
```typescript
|
1076
|
+
import { getAllRewardInfo, SupportedChainId, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
1077
|
+
|
1078
|
+
const chainId = SupportedChainId.Ink;
|
1079
|
+
const dex = SupportedDex.Velodrome;
|
1080
|
+
|
1081
|
+
const chains: RewardInfo[] = getAllRewardInfo(chainId, dex);
|
1082
|
+
```
|
1083
|
+
|
1084
|
+
#### 31. `getAllUserRewards()`
|
1085
|
+
|
1086
|
+
| param | type | default | required
|
1087
|
+
| -------- | -------- | -------- | --------
|
1088
|
+
| accountAddress | string | - | true |
|
1089
|
+
| jsonProvider | JsonRpcProvider | - | true |
|
1090
|
+
| dex | SupportedDex | - | true |
|
1091
|
+
| raw | true | undefined | - | false |
|
1092
|
+
|
1093
|
+
<br/>
|
1094
|
+
This function returns user rewards for all vaults on the dex. This functions is specific for the Velodrome vaults.
|
1095
|
+
|
1096
|
+
```typescript
|
1097
|
+
import { getAllUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
1098
|
+
|
1099
|
+
const account = "0x123...890";
|
1100
|
+
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
1101
|
+
const dex = SupportedDex.Velodrome;
|
1102
|
+
|
1103
|
+
const rewards: UserRewards[] = await getAllUserRewards(account, provider, dex);
|
1104
|
+
```
|
1105
|
+
|
1106
|
+
#### 32. `getUserRewards()`
|
1107
|
+
|
1108
|
+
| param | type | default | required
|
1109
|
+
| -------- | -------- | -------- | --------
|
1110
|
+
| accountAddress | string | - | true |
|
1111
|
+
| vaultAddress | string | - | true |
|
1112
|
+
| jsonProvider | JsonRpcProvider | - | true |
|
1113
|
+
| dex | SupportedDex | - | true |
|
1114
|
+
| raw | true | undefined | - | false |
|
1115
|
+
|
1116
|
+
<br/>
|
1117
|
+
This function returns claimable reward amounts for the specified vault and user account. This functions is specific for the Velodrome vaults.
|
1118
|
+
|
1119
|
+
```typescript
|
1120
|
+
import { getUserRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
1121
|
+
|
1122
|
+
const account = "0x123...890";
|
1123
|
+
const vaultAddress = "0x3e4...45a";
|
1124
|
+
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
1125
|
+
const dex = SupportedDex.Velodrome;
|
1126
|
+
|
1127
|
+
const rewards: UserRewardByToken[] = getUserRewards(account, vaultAddress, provider, dex);
|
1128
|
+
const rewardsBN: UserRewardByTokenBN[] = getUserRewards(account, vaultAddress, provider, dex, true);
|
1129
|
+
```
|
1130
|
+
|
1131
|
+
#### 33. `claimRewards()`
|
1132
|
+
|
1133
|
+
| param | type | default | required
|
1134
|
+
| -------- | -------- | -------- | --------
|
1135
|
+
| accountAddress | string | - | true |
|
1136
|
+
| vaultAddress | string | - | true |
|
1137
|
+
| jsonProvider | JsonRpcProvider | - | true |
|
1138
|
+
| dex | SupportedDex | - | true |
|
1139
|
+
|
1140
|
+
<br/>
|
1141
|
+
This function transfers rewards from the reward contract to the specified account. This functions is specific for the Velodrome vaults.
|
1142
|
+
|
1143
|
+
```typescript
|
1144
|
+
import { claimRewards, SupportedDex } from '@ichidao/ichi-vaults-sdk';
|
1145
|
+
|
1146
|
+
const account = "0x123...890";
|
1147
|
+
const vaultAddress = "0x3e4...45a";
|
1148
|
+
const provider = new Web3Provider(YOUR_WEB3_PROVIDER);
|
1149
|
+
const dex = SupportedDex.Velodrome;
|
1150
|
+
|
1151
|
+
await claimRewards(account, vaultAddress, provider, dex);
|
1152
|
+
```
|
1153
|
+
|
1039
1154
|
## Types
|
1040
1155
|
|
1041
1156
|
### SupportedChainId
|
@@ -1150,6 +1265,12 @@ interface IchiVault {
|
|
1150
1265
|
allowTokenB: boolean;
|
1151
1266
|
holdersCount?: string // number of vault LP holders
|
1152
1267
|
fee?: string
|
1268
|
+
farmingContract?: string; // used for Velodrome vaults only
|
1269
|
+
rewardTokens?: {
|
1270
|
+
// used for Velodrome vaults only
|
1271
|
+
token: string;
|
1272
|
+
tokenDecimals: number;
|
1273
|
+
}[];
|
1153
1274
|
}
|
1154
1275
|
```
|
1155
1276
|
|
@@ -1251,6 +1372,7 @@ type UserAmountsInVaultBN = {
|
|
1251
1372
|
type UserBalanceInVault = {
|
1252
1373
|
vaultAddress: string;
|
1253
1374
|
shares: string;
|
1375
|
+
stakedShares?: string;
|
1254
1376
|
};
|
1255
1377
|
```
|
1256
1378
|
|
@@ -1260,6 +1382,7 @@ type UserBalanceInVault = {
|
|
1260
1382
|
type UserBalanceInVaultBN = {
|
1261
1383
|
vaultAddress: string;
|
1262
1384
|
shares: BigNumber;
|
1385
|
+
stakedShares?: BigNumber;
|
1263
1386
|
};
|
1264
1387
|
```
|
1265
1388
|
|
@@ -1282,3 +1405,71 @@ type VaultPositionsInfo = {
|
|
1282
1405
|
} [],
|
1283
1406
|
}
|
1284
1407
|
```
|
1408
|
+
|
1409
|
+
### RewardToken
|
1410
|
+
used for Velodrome vaults only
|
1411
|
+
|
1412
|
+
```typescript
|
1413
|
+
|
1414
|
+
type RewardToken = {
|
1415
|
+
rewardRatePerToken_1d: string;
|
1416
|
+
rewardRatePerToken_3d: string;
|
1417
|
+
token: string;
|
1418
|
+
tokenDecimals: number;
|
1419
|
+
};
|
1420
|
+
```
|
1421
|
+
|
1422
|
+
### UserRewardsByToken
|
1423
|
+
|
1424
|
+
```typescript
|
1425
|
+
|
1426
|
+
type UserRewardsByToken = {
|
1427
|
+
token: string;
|
1428
|
+
tokenDecimals: number;
|
1429
|
+
rewardAmount: string;
|
1430
|
+
};
|
1431
|
+
```
|
1432
|
+
|
1433
|
+
### UserRewardsByTokenBN
|
1434
|
+
|
1435
|
+
```typescript
|
1436
|
+
|
1437
|
+
type UserRewardsByTokenBN = {
|
1438
|
+
token: string;
|
1439
|
+
tokenDecimals: number;
|
1440
|
+
rewardAmount: BigNumber;
|
1441
|
+
};
|
1442
|
+
```
|
1443
|
+
|
1444
|
+
### RewardInfo
|
1445
|
+
|
1446
|
+
```typescript
|
1447
|
+
|
1448
|
+
type RewardInfo = {
|
1449
|
+
id: string;
|
1450
|
+
farmingContract: {
|
1451
|
+
id: string;
|
1452
|
+
rewardTokens: RewardToken[];
|
1453
|
+
};
|
1454
|
+
};
|
1455
|
+
```
|
1456
|
+
|
1457
|
+
### UserRewards
|
1458
|
+
|
1459
|
+
```typescript
|
1460
|
+
|
1461
|
+
type UserRewards = {
|
1462
|
+
vaultAddress: string;
|
1463
|
+
rewardTokens: UserRewardsByToken[];
|
1464
|
+
};
|
1465
|
+
```
|
1466
|
+
|
1467
|
+
### UserRewardsBN
|
1468
|
+
|
1469
|
+
```typescript
|
1470
|
+
|
1471
|
+
type UserRewardsBN = {
|
1472
|
+
vaultAddress: string;
|
1473
|
+
rewardTokens: UserRewardsByTokenBN[];
|
1474
|
+
};
|
1475
|
+
```
|