@ichidao/ichi-vaults-sdk 0.0.112 → 0.1.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.
Files changed (72) hide show
  1. package/README.md +163 -0
  2. package/dist/abis/types/MultiFeeDistributer.d.ts +475 -0
  3. package/dist/abis/types/MultiFeeDistributer.js +3 -0
  4. package/dist/abis/types/MultiFeeDistributer.js.map +1 -0
  5. package/dist/abis/types/factories/MultiFeeDistributer__factory.d.ts +451 -0
  6. package/dist/abis/types/factories/MultiFeeDistributer__factory.js +596 -0
  7. package/dist/abis/types/factories/MultiFeeDistributer__factory.js.map +1 -0
  8. package/dist/abis/types/factories/index.d.ts +1 -0
  9. package/dist/abis/types/factories/index.js +3 -1
  10. package/dist/abis/types/factories/index.js.map +1 -1
  11. package/dist/abis/types/index.d.ts +2 -0
  12. package/dist/abis/types/index.js +3 -1
  13. package/dist/abis/types/index.js.map +1 -1
  14. package/dist/src/__tests__/index.test.js +74 -1
  15. package/dist/src/__tests__/index.test.js.map +1 -1
  16. package/dist/src/abis/types/MultiFeeDistributer.d.ts +475 -0
  17. package/dist/src/abis/types/factories/MultiFeeDistributer__factory.d.ts +451 -0
  18. package/dist/src/abis/types/factories/index.d.ts +1 -0
  19. package/dist/src/abis/types/index.d.ts +2 -0
  20. package/dist/src/contracts/index.d.ts +2 -1
  21. package/dist/src/contracts/index.js +11 -1
  22. package/dist/src/contracts/index.js.map +1 -1
  23. package/dist/src/functions/claimRewards.d.ts +14 -0
  24. package/dist/src/functions/claimRewards.js +108 -0
  25. package/dist/src/functions/claimRewards.js.map +1 -0
  26. package/dist/src/functions/rewardInfo.d.ts +3 -0
  27. package/dist/src/functions/rewardInfo.js +176 -0
  28. package/dist/src/functions/rewardInfo.js.map +1 -0
  29. package/dist/src/functions/userBalances.d.ts +1 -1
  30. package/dist/src/functions/userBalances.js +64 -29
  31. package/dist/src/functions/userBalances.js.map +1 -1
  32. package/dist/src/functions/userRewards.d.ts +7 -0
  33. package/dist/src/functions/userRewards.js +132 -0
  34. package/dist/src/functions/userRewards.js.map +1 -0
  35. package/dist/src/functions/vault.d.ts +2 -1
  36. package/dist/src/functions/vault.js +75 -26
  37. package/dist/src/functions/vault.js.map +1 -1
  38. package/dist/src/graphql/constants.js +53 -46
  39. package/dist/src/graphql/constants.js.map +1 -1
  40. package/dist/src/graphql/queries.d.ts +14 -1
  41. package/dist/src/graphql/queries.js +57 -18
  42. package/dist/src/graphql/queries.js.map +1 -1
  43. package/dist/src/index.cjs.js +4 -1
  44. package/dist/src/index.d.ts +3 -0
  45. package/dist/src/index.esm.js +4 -1
  46. package/dist/src/index.js +3 -0
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/src/contracts/index.d.ts +2 -1
  49. package/dist/src/src/functions/claimRewards.d.ts +14 -0
  50. package/dist/src/src/functions/rewardInfo.d.ts +3 -0
  51. package/dist/src/src/functions/userBalances.d.ts +1 -1
  52. package/dist/src/src/functions/userRewards.d.ts +7 -0
  53. package/dist/src/src/functions/vault.d.ts +2 -1
  54. package/dist/src/src/graphql/queries.d.ts +14 -1
  55. package/dist/src/src/index.d.ts +3 -0
  56. package/dist/src/src/types/index.d.ts +39 -0
  57. package/dist/src/src/types/vaultQueryData.d.ts +10 -1
  58. package/dist/src/src/utils/isVelodrome.d.ts +2 -0
  59. package/dist/src/src/utils/multicallUtils.d.ts +2 -0
  60. package/dist/src/types/index.d.ts +39 -0
  61. package/dist/src/types/index.js +2 -0
  62. package/dist/src/types/index.js.map +1 -1
  63. package/dist/src/types/vaultQueryData.d.ts +10 -1
  64. package/dist/src/utils/config/addresses.js +113 -101
  65. package/dist/src/utils/config/addresses.js.map +1 -1
  66. package/dist/src/utils/isVelodrome.d.ts +2 -0
  67. package/dist/src/utils/isVelodrome.js +11 -0
  68. package/dist/src/utils/isVelodrome.js.map +1 -0
  69. package/dist/src/utils/multicallUtils.d.ts +2 -0
  70. package/dist/src/utils/multicallUtils.js +19 -1
  71. package/dist/src/utils/multicallUtils.js.map +1 -1
  72. 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 amount 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: string = getUserRewards(account, vaultAddress, provider, dex);
1128
+ const rewardsBN: BigNumber = 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
@@ -1070,6 +1185,7 @@ enum SupportedChainId {
1070
1185
  mainnet = 1,
1071
1186
  mantle = 5000,
1072
1187
  mode = 34443,
1188
+ monad_testnet = 10143,
1073
1189
  polygon = 137,
1074
1190
  polygon_zkevm = 1101,
1075
1191
  real = 111188,
@@ -1093,6 +1209,7 @@ enum SupportedChainId {
1093
1209
  enum SupportedDex {
1094
1210
  Agni = 'Agni',
1095
1211
  Ascent = 'Ascent',
1212
+ Atlantis = 'Anlantis',
1096
1213
  Blueprint = 'Blueprint',
1097
1214
  Cleo = 'Cleo',
1098
1215
  Crust = 'Crust',
@@ -1148,6 +1265,9 @@ interface IchiVault {
1148
1265
  allowTokenB: boolean;
1149
1266
  holdersCount?: string // number of vault LP holders
1150
1267
  fee?: string
1268
+ farmingContract?: string; // used for Velodrome vaults only
1269
+ rewardToken?: string; // used for Velodrome vaults only
1270
+ rewardTokenDecimals?: number; // used for Velodrome vaults only
1151
1271
  }
1152
1272
  ```
1153
1273
 
@@ -1249,6 +1369,7 @@ type UserAmountsInVaultBN = {
1249
1369
  type UserBalanceInVault = {
1250
1370
  vaultAddress: string;
1251
1371
  shares: string;
1372
+ stakedShares?: string;
1252
1373
  };
1253
1374
  ```
1254
1375
 
@@ -1258,6 +1379,7 @@ type UserBalanceInVault = {
1258
1379
  type UserBalanceInVaultBN = {
1259
1380
  vaultAddress: string;
1260
1381
  shares: BigNumber;
1382
+ stakedShares?: BigNumber;
1261
1383
  };
1262
1384
  ```
1263
1385
 
@@ -1280,3 +1402,44 @@ type VaultPositionsInfo = {
1280
1402
  } [],
1281
1403
  }
1282
1404
  ```
1405
+
1406
+ ### RewardInfo
1407
+ used for Velodrome vaults only
1408
+
1409
+ ```typescript
1410
+
1411
+ interface RewardInfo {
1412
+ id: string;
1413
+ rewardRatePerToken_1d: string;
1414
+ rewardRatePerToken_3d: string;
1415
+ farmingContract: {
1416
+ id: string;
1417
+ rewardToken: string;
1418
+ rewardTokenDecimals: number;
1419
+ }
1420
+ }
1421
+ ```
1422
+
1423
+ ### UserRewards
1424
+
1425
+ ```typescript
1426
+
1427
+ type UserRewards = {
1428
+ vaultAddress: string;
1429
+ rewardToken: string;
1430
+ rewardTokenDecimals: number;
1431
+ rewardAmount: string;
1432
+ };
1433
+ ```
1434
+
1435
+ ### UserRewardsBN
1436
+
1437
+ ```typescript
1438
+
1439
+ type UserRewardsBN = {
1440
+ vaultAddress: string;
1441
+ rewardToken: string;
1442
+ rewardTokenDecimals: number;
1443
+ rewardAmount: BigNumber;
1444
+ };
1445
+ ```