@dripfi/drip-sdk 1.0.18 → 1.0.20

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 CHANGED
@@ -226,7 +226,7 @@ type VaultReward = {
226
226
  tokenAddress: string;
227
227
  monthlyEmissionRate: number;
228
228
  blockNumber: number;
229
- rewardrate: number;
229
+ rewardRate: number;
230
230
  timestamp: number;
231
231
  endTime: number;
232
232
  };
package/dist/DripSdk.js CHANGED
@@ -77,27 +77,16 @@ class DripSdk {
77
77
  }
78
78
  isUserAuthenticated() {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
- try {
81
- if (!this.signer) {
82
- return { isAuthenticated: false, message: 'Signer not provided' };
83
- }
84
- const userAddress = yield this.signer.getAddress();
85
- const cookieName = `auth_${userAddress.toLowerCase()}`;
86
- const authToken = js_cookie_1.default.get(cookieName);
87
- if (!authToken) {
88
- return { isAuthenticated: false, message: 'Auth token not found' };
89
- }
90
- const { address } = web3_token_1.default.verify(authToken);
91
- if (address.toLowerCase() !== userAddress.toLowerCase()) {
92
- js_cookie_1.default.remove(cookieName);
93
- return { isAuthenticated: false, message: 'Invalid token' };
94
- }
95
- return { isAuthenticated: true, address: address.toLowerCase(), token: authToken };
80
+ if (!this.signer) {
81
+ return { isAuthenticated: false, message: 'Signer not provided' };
96
82
  }
97
- catch (error) {
98
- console.log(error);
83
+ const userAddress = yield this.signer.getAddress();
84
+ const cookieName = `auth_${userAddress.toLowerCase()}`;
85
+ const authToken = js_cookie_1.default.get(cookieName);
86
+ if (!authToken) {
87
+ return { isAuthenticated: false, message: 'Auth token not found' };
99
88
  }
100
- return { isAuthenticated: false };
89
+ return { isAuthenticated: true, address: userAddress.toLowerCase(), token: authToken };
101
90
  });
102
91
  }
103
92
  authenticate() {
@@ -108,11 +97,25 @@ class DripSdk {
108
97
  }
109
98
  const address = yield this.signer.getAddress();
110
99
  const cookieName = `auth_${address.toLowerCase()}`;
111
- const token = yield web3_token_1.default.sign((msg) => __awaiter(this, void 0, void 0, function* () { return yield this.signer.signMessage(msg); }), {
112
- statement: 'Please sign this message to authenticate.',
100
+ const token = yield web3_token_1.default.sign((message) => __awaiter(this, void 0, void 0, function* () { return yield this.signer.signMessage(message); }), {
101
+ statement: JSON.stringify({ address, message: 'Please sign in into Drip' }),
113
102
  expires_in: '30d',
114
103
  });
115
- js_cookie_1.default.set(cookieName, token, { expires: 30 });
104
+ const response = yield fetch(`${this.dripConfig.dripRoute}/api-be/auth/verify`, {
105
+ method: 'POST',
106
+ headers: {
107
+ 'Content-Type': 'application/json',
108
+ },
109
+ body: JSON.stringify({ token }),
110
+ });
111
+ const result = yield response.json();
112
+ if (result.success) {
113
+ js_cookie_1.default.set(cookieName, result.auth, { expires: 30 });
114
+ }
115
+ else {
116
+ js_cookie_1.default.remove(cookieName);
117
+ return false;
118
+ }
116
119
  return true;
117
120
  }
118
121
  catch (error) {
@@ -1,8 +1,6 @@
1
- import { StretchGoal } from './StretchGoal';
2
1
  export type DeployedProject = {
3
2
  id: number | undefined;
4
3
  projectName: string;
5
- logo: string;
6
4
  telegramLink: string;
7
5
  twitterLink: string;
8
6
  mediumLink: string;
@@ -28,9 +26,6 @@ export type DeployedProject = {
28
26
  tikTokLink: string;
29
27
  isMoonMathDisabled: boolean;
30
28
  isFastWithdrawDisabled: boolean;
31
- projectInfoText: string;
32
- projectRewardText: string;
33
- stretchGoals: StretchGoal[];
34
29
  };
35
30
  export type ProjectBacker = {
36
31
  name: string;
@@ -1,4 +1,9 @@
1
1
  export interface StretchGoal {
2
2
  threshhold: number;
3
+ threshholdDescription: string;
4
+ rewardTooltip: string;
5
+ rewardDescription: string;
3
6
  amountOfTokens: number;
7
+ nodeTierRange?: string;
8
+ nodeTierTooltip?: string;
4
9
  }
@@ -1,6 +1,6 @@
1
- import { DeployedProject } from './DeployedProject';
2
1
  import { NFTBoost } from './NFTBoost';
3
2
  import { Strategy } from './Strategy';
3
+ import { StretchGoal } from './StretchGoal';
4
4
  import { VaultDepositToken } from './VaultDepositToken';
5
5
  import { RewardType, VaultReward } from './VaultReward';
6
6
  import { VaultType } from './VaultType';
@@ -15,15 +15,15 @@ export type Vault = {
15
15
  rewards: VaultReward[];
16
16
  rewardType: RewardType;
17
17
  liveUntil: string;
18
- liveFrom: string;
19
18
  liveUntilFormatted: string;
20
19
  hasPoolEnded: boolean;
21
20
  boosters: NFTBoost[];
21
+ stretchGoals: StretchGoal[];
22
22
  strategies: Strategy[];
23
23
  newWithdraw: boolean;
24
24
  tgePrice?: number;
25
25
  maxAmountOfTokens?: number;
26
- project: DeployedProject;
26
+ projectName: string;
27
27
  projectId: number;
28
28
  coingeckoId?: string;
29
29
  depositTokenId: string;
@@ -7,7 +7,7 @@ export type VaultReward = {
7
7
  tokenAddress: string;
8
8
  monthlyEmissionRate: number;
9
9
  blockNumber: number;
10
- rewardrate: number;
10
+ rewardRate: number;
11
11
  timestamp: number;
12
12
  endTime: number;
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",