@dripfi/drip-sdk 1.4.8 → 1.4.9
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/CHANGELOG.md +7 -0
- package/dist/PerqApi.d.ts +3 -1
- package/dist/PerqApi.js +25 -0
- package/dist/PerqSdk.d.ts +2 -0
- package/dist/PerqSdk.js +14 -0
- package/dist/types/LinkWalletPayload.d.ts +4 -0
- package/dist/types/LinkWalletPayload.js +2 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -102,3 +102,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
102
102
|
### Changed
|
103
103
|
|
104
104
|
- Updated `PerqApi` to use the new 1inch API endpoint
|
105
|
+
|
106
|
+
## [1.4.9] - 2025-02-14
|
107
|
+
|
108
|
+
### Added
|
109
|
+
|
110
|
+
- Added method `linkSuiWalletWithEthWallet` to the `PerqSdk`
|
111
|
+
- Added method `getLinkedSuiWallet` to the `PerqSdk`
|
package/dist/PerqApi.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BigNumber } from 'ethers';
|
2
|
-
import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload } from './types';
|
2
|
+
import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, LinkWalletPayload } from './types';
|
3
3
|
export default class PerqApi {
|
4
4
|
route: string;
|
5
5
|
constructor(route: string);
|
@@ -26,6 +26,8 @@ export default class PerqApi {
|
|
26
26
|
fetchMyPerqData(userAddress: string): Promise<MyPerqData[]>;
|
27
27
|
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
28
28
|
fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
|
29
|
+
linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<LinkWalletPayload>): Promise<boolean>;
|
30
|
+
getLinkedSuiWallet(walletAddress: string): Promise<string>;
|
29
31
|
getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
|
30
32
|
fetchUserVaultDeposits(userAddress: string, vaultAddress: string): Promise<{
|
31
33
|
pending: number;
|
package/dist/PerqApi.js
CHANGED
@@ -301,6 +301,31 @@ class PerqApi {
|
|
301
301
|
throw Error(`${await res.text()}`);
|
302
302
|
}
|
303
303
|
}
|
304
|
+
async linkSuiWalletWithEthWallet(signedPayload) {
|
305
|
+
const res = await fetch(`${this.route}/api-be/api/user/suiWallet`, {
|
306
|
+
method: 'POST',
|
307
|
+
headers: {
|
308
|
+
'Content-Type': 'application/json',
|
309
|
+
},
|
310
|
+
body: JSON.stringify(signedPayload),
|
311
|
+
});
|
312
|
+
if (res.ok) {
|
313
|
+
return true;
|
314
|
+
}
|
315
|
+
else {
|
316
|
+
throw Error(`${await res.text()}`);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
async getLinkedSuiWallet(walletAddress) {
|
320
|
+
const res = await fetch(`${this.route}/api-be/api/user/suiWallet/${walletAddress}`);
|
321
|
+
if (res.ok) {
|
322
|
+
const data = await res.json();
|
323
|
+
return data.suiWalletAddr;
|
324
|
+
}
|
325
|
+
else {
|
326
|
+
throw Error(`${await res.text()}`);
|
327
|
+
}
|
328
|
+
}
|
304
329
|
async getNonceEnrichedPayload(payload) {
|
305
330
|
const res = await fetch(`${this.route}/api-be/api/nonce`, {
|
306
331
|
method: 'POST',
|
package/dist/PerqSdk.d.ts
CHANGED
@@ -59,6 +59,8 @@ export default class PerqSdk {
|
|
59
59
|
getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>;
|
60
60
|
claimVestedPerq(amount: string): Promise<string>;
|
61
61
|
burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>;
|
62
|
+
linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>;
|
63
|
+
getLinkedSuiWallet(): Promise<string>;
|
62
64
|
signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>;
|
63
65
|
private getEnrichedPayload;
|
64
66
|
private generateRedeemBagStruct;
|
package/dist/PerqSdk.js
CHANGED
@@ -458,6 +458,20 @@ class PerqSdk {
|
|
458
458
|
throw new Error('Failed to get total releasable amount: Unknown error');
|
459
459
|
}
|
460
460
|
}
|
461
|
+
async linkSuiWalletWithEthWallet(suiWalletAddress) {
|
462
|
+
const payload = {
|
463
|
+
suiWalletAddr: suiWalletAddress,
|
464
|
+
};
|
465
|
+
const signedPayload = await this.signPayload(payload);
|
466
|
+
return this.perqApi.linkSuiWalletWithEthWallet(signedPayload);
|
467
|
+
}
|
468
|
+
async getLinkedSuiWallet() {
|
469
|
+
if (!this.signer) {
|
470
|
+
throw new Error('No signer provided');
|
471
|
+
}
|
472
|
+
const walletAddr = await this.signer.getAddress();
|
473
|
+
return this.perqApi.getLinkedSuiWallet(walletAddr);
|
474
|
+
}
|
461
475
|
async signPayload(payload) {
|
462
476
|
if (!this.signer) {
|
463
477
|
throw new Error('No signer provided');
|
package/dist/types/index.d.ts
CHANGED
@@ -5,6 +5,7 @@ import DeployedProject, { ProjectBacker } from './DeployedProject';
|
|
5
5
|
import DeployedVault from './DeployedVault';
|
6
6
|
import DepositToken from './DepositToken';
|
7
7
|
import ELoyaltyCardTier from './ELoyaltyCardTier';
|
8
|
+
import LinkWalletPayload from './LinkWalletPayload';
|
8
9
|
import LoyaltyCard from './LoyaltyCard';
|
9
10
|
import MyPerqData from './MyPerqData';
|
10
11
|
import NFTBoost from './NFTBoost';
|
@@ -24,4 +25,4 @@ import VaultStats from './VaultStats';
|
|
24
25
|
import VaultType from './VaultType';
|
25
26
|
import VestingInfo from './VestingInfo';
|
26
27
|
import YelayVersion from './YelayVersion';
|
27
|
-
export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, ELoyaltyCardTier, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, };
|
28
|
+
export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, ELoyaltyCardTier, LinkWalletPayload, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, };
|