@dripfi/drip-sdk 1.4.3-yelay-lite-5 → 1.4.3-yelay-lite-7
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 +13 -0
- package/dist/PerqApi.d.ts +2 -1
- package/dist/PerqApi.js +10 -0
- package/dist/subpackages/UserPackage.d.ts +2 -0
- package/dist/subpackages/UserPackage.js +6 -0
- package/dist/types/Earnings.d.ts +11 -0
- package/dist/types/Earnings.js +2 -0
- package/dist/types/VaultData.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -130,6 +130,7 @@ Access user methods through `sdk.user`:
|
|
130
130
|
| -------------------------------------------------------------------- | -------------------------------------- |
|
131
131
|
| `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
|
132
132
|
| `getLinkedSuiWallet(): Promise<string>` | Retrieves the Sui wallet address linked to the user's Ethereum wallet. |
|
133
|
+
| `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
|
133
134
|
|
134
135
|
|
135
136
|
## Recycler
|
@@ -523,6 +524,7 @@ type VaultData = {
|
|
523
524
|
projectType: string;
|
524
525
|
liveFrom: string;
|
525
526
|
liveUntil: string;
|
527
|
+
apy: number;
|
526
528
|
tvlUsd: number;
|
527
529
|
avgTvl: number;
|
528
530
|
tokenPrice: number;
|
@@ -643,6 +645,17 @@ type ChainId =
|
|
643
645
|
| typeof ETHEREUM_SEPOLIA_CHAIN_ID
|
644
646
|
| typeof ARBITRUM_CHAIN_ID;
|
645
647
|
|
648
|
+
type Earnings = {
|
649
|
+
[vaultAddress: string]: {
|
650
|
+
onChainProjectId: number;
|
651
|
+
precisionDecimals: number;
|
652
|
+
amountEarned: string;
|
653
|
+
symbol: string;
|
654
|
+
deposit: string;
|
655
|
+
earningPerHour: string;
|
656
|
+
};
|
657
|
+
};
|
658
|
+
|
646
659
|
```
|
647
660
|
|
648
661
|
# Abis
|
package/dist/PerqApi.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BigNumber } from 'ethers';
|
2
|
-
import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, LinkWalletPayload, UserVaultBalance } from './types';
|
2
|
+
import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, LinkWalletPayload, UserVaultBalance, Earnings } from './types';
|
3
3
|
import CachedVaultData from './types/VaultData';
|
4
4
|
import PerqSdk from './PerqSdk';
|
5
5
|
export default class PerqApi {
|
@@ -31,4 +31,5 @@ export default class PerqApi {
|
|
31
31
|
getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
|
32
32
|
fetchV2PoolUserBalance(userAddress: string, vaultAddress: string): Promise<UserVaultBalance>;
|
33
33
|
fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>;
|
34
|
+
fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
|
34
35
|
}
|
package/dist/PerqApi.js
CHANGED
@@ -346,5 +346,15 @@ class PerqApi {
|
|
346
346
|
throw Error(`${await res.text()}`);
|
347
347
|
}
|
348
348
|
}
|
349
|
+
async fetchEarnings(userAddress, projectName) {
|
350
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${userAddress}/earnings/${projectName}`);
|
351
|
+
if (res.ok) {
|
352
|
+
const data = await res.json();
|
353
|
+
return data;
|
354
|
+
}
|
355
|
+
else {
|
356
|
+
throw Error(`${await res.text()}`);
|
357
|
+
}
|
358
|
+
}
|
349
359
|
}
|
350
360
|
exports.default = PerqApi;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import PerqSdk from '../PerqSdk';
|
2
|
+
import { Earnings } from '../types';
|
2
3
|
export default class UserPackage {
|
3
4
|
private perqSdk;
|
4
5
|
constructor(perqSdk: PerqSdk);
|
6
|
+
getEarnings(projectName: string): Promise<Earnings>;
|
5
7
|
linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>;
|
6
8
|
getLinkedSuiWallet(): Promise<string>;
|
7
9
|
}
|
@@ -5,6 +5,12 @@ class UserPackage {
|
|
5
5
|
constructor(perqSdk) {
|
6
6
|
this.perqSdk = perqSdk;
|
7
7
|
}
|
8
|
+
async getEarnings(projectName) {
|
9
|
+
if (!this.perqSdk.signer) {
|
10
|
+
throw new Error('No signer provided');
|
11
|
+
}
|
12
|
+
return this.perqSdk.perqApi.fetchEarnings(await this.perqSdk.signer.getAddress(), projectName);
|
13
|
+
}
|
8
14
|
async linkSuiWalletWithEthWallet(suiWalletAddress) {
|
9
15
|
const payload = {
|
10
16
|
suiWalletAddr: suiWalletAddress,
|
package/dist/types/index.d.ts
CHANGED
@@ -28,4 +28,5 @@ import VaultStats from './VaultStats';
|
|
28
28
|
import VaultType from './VaultType';
|
29
29
|
import VestingInfo from './VestingInfo';
|
30
30
|
import YelayVersion from './YelayVersion';
|
31
|
-
|
31
|
+
import Earnings from './Earnings';
|
32
|
+
export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, LinkWalletPayload, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultData, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, Earnings, };
|