@pear-protocol/core-sdk 0.0.4 → 0.0.6

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.
@@ -5,18 +5,32 @@ import { ClientHeaders } from '../types.js';
5
5
  declare class Auth {
6
6
  private client;
7
7
  constructor(client: HttpClient);
8
- me(headers?: ClientHeaders): Promise<{
9
- id: string;
10
- role: "basic" | "pro";
11
- address?: string | undefined;
8
+ linkEmail(body: HttpTypes.LinkEmailRequest, headers?: ClientHeaders): Promise<void>;
9
+ linkWallet(body: HttpTypes.LinkWalletRequest, headers?: ClientHeaders): Promise<{
10
+ user: {
11
+ id: string;
12
+ role: "basic" | "pro";
13
+ address: string | null;
14
+ };
12
15
  }>;
13
16
  login(body: HttpTypes.LoginRequest, headers?: ClientHeaders): Promise<{
14
17
  user: {
15
18
  id: string;
16
19
  role: "basic" | "pro";
17
- address?: string | undefined;
20
+ address: string | null;
18
21
  };
19
22
  }>;
23
+ requestNonce(body: HttpTypes.RequestNonceRequest, headers?: ClientHeaders): Promise<{
24
+ nonce: string;
25
+ expiresAt: number;
26
+ }>;
27
+ registerEmail(body: HttpTypes.EmailRegisterRequest, headers?: ClientHeaders): Promise<void>;
28
+ logout(headers?: ClientHeaders): Promise<void>;
29
+ me(headers?: ClientHeaders): Promise<{
30
+ id: string;
31
+ role: "basic" | "pro";
32
+ address: string | null;
33
+ }>;
20
34
  refreshSession(headers?: ClientHeaders): Promise<void>;
21
35
  refreshToken(body: HttpTypes.RefreshTokenRequest, headers?: ClientHeaders): Promise<{
22
36
  accessToken: string;
@@ -24,32 +38,9 @@ declare class Auth {
24
38
  tokenType: "Bearer";
25
39
  expiresIn: number;
26
40
  }>;
27
- logout(headers?: ClientHeaders): Promise<void>;
28
- requestNonce(body: HttpTypes.RequestNonceRequest, headers?: ClientHeaders): Promise<{
29
- nonce: string;
30
- expiresAt: number;
31
- }>;
32
- register(body: HttpTypes.EmailRegisterRequest, headers?: ClientHeaders): Promise<{
33
- user: {
34
- id: string;
35
- role: "basic" | "pro";
36
- address?: string | undefined;
37
- };
38
- }>;
39
- linkEmail(body: HttpTypes.LinkEmailRequest, headers?: ClientHeaders): Promise<{
40
- user: {
41
- id: string;
42
- role: "basic" | "pro";
43
- address?: string | undefined;
44
- };
45
- }>;
46
- linkWallet(body: HttpTypes.LinkWalletRequest, headers?: ClientHeaders): Promise<{
47
- user: {
48
- id: string;
49
- role: "basic" | "pro";
50
- address?: string | undefined;
51
- };
52
- }>;
41
+ verifyEmail(body: HttpTypes.VerifyEmailRequest, headers?: ClientHeaders): Promise<void>;
42
+ resendVerificationForLink(headers?: ClientHeaders): Promise<void>;
43
+ resendVerificationForRegister(body: HttpTypes.ResendVerificationForRegisterRequest, headers?: ClientHeaders): Promise<void>;
53
44
  }
54
45
 
55
46
  export { Auth };
@@ -3,10 +3,18 @@ class Auth {
3
3
  constructor(client) {
4
4
  this.client = client;
5
5
  }
6
- async me(headers) {
7
- return await this.client.fetch(`/auth/me`, {
8
- method: "GET",
9
- headers
6
+ async linkEmail(body, headers) {
7
+ return await this.client.fetch(`/auth/link/emailpass`, {
8
+ method: "POST",
9
+ headers,
10
+ body
11
+ });
12
+ }
13
+ async linkWallet(body, headers) {
14
+ return await this.client.fetch(`/auth/link/wallet`, {
15
+ method: "POST",
16
+ headers,
17
+ body
10
18
  });
11
19
  }
12
20
  async login(body, headers) {
@@ -16,48 +24,60 @@ class Auth {
16
24
  body
17
25
  });
18
26
  }
19
- async refreshSession(headers) {
20
- return await this.client.fetch(`/auth/refresh`, {
27
+ async requestNonce(body, headers) {
28
+ return await this.client.fetch(`/auth/nonce`, {
21
29
  method: "POST",
22
- headers
30
+ headers,
31
+ body
23
32
  });
24
33
  }
25
- async refreshToken(body, headers) {
26
- return await this.client.fetch(`/auth/refresh/token`, {
34
+ async registerEmail(body, headers) {
35
+ return await this.client.fetch(`/auth/register/emailpass`, {
27
36
  method: "POST",
28
37
  headers,
29
38
  body
30
39
  });
31
40
  }
32
41
  async logout(headers) {
33
- return await this.client.fetch(`/auth/logout`, {
42
+ return await this.client.fetch(`/auth/session/logout`, {
34
43
  method: "POST",
35
44
  headers
36
45
  });
37
46
  }
38
- async requestNonce(body, headers) {
39
- return await this.client.fetch(`/auth/nonce`, {
47
+ async me(headers) {
48
+ return await this.client.fetch(`/auth/session/me`, {
49
+ method: "GET",
50
+ headers
51
+ });
52
+ }
53
+ async refreshSession(headers) {
54
+ return await this.client.fetch(`/auth/session/refresh`, {
40
55
  method: "POST",
41
- headers,
42
- body
56
+ headers
43
57
  });
44
58
  }
45
- async register(body, headers) {
46
- return await this.client.fetch(`/auth/register`, {
59
+ async refreshToken(body, headers) {
60
+ return await this.client.fetch(`/auth/session/refresh/token`, {
47
61
  method: "POST",
48
62
  headers,
49
63
  body
50
64
  });
51
65
  }
52
- async linkEmail(body, headers) {
53
- return await this.client.fetch(`/auth/link/email`, {
66
+ async verifyEmail(body, headers) {
67
+ return await this.client.fetch(`/auth/verify-email`, {
54
68
  method: "POST",
55
69
  headers,
56
70
  body
57
71
  });
58
72
  }
59
- async linkWallet(body, headers) {
60
- return await this.client.fetch(`/auth/link/wallet`, {
73
+ async resendVerificationForLink(headers) {
74
+ return await this.client.fetch(`/auth/resend-verification/link`, {
75
+ method: "POST",
76
+ headers
77
+ });
78
+ }
79
+ async resendVerificationForRegister(body, headers) {
80
+ return await this.client.fetch(`/auth/resend-verification/email`, {
61
81
  method: "POST",
62
82
  headers,
63
83
  body
@@ -18,6 +18,7 @@ declare class Info {
18
18
  agentWalletAddress: string;
19
19
  isSubaccount: boolean;
20
20
  } | undefined;
21
+ deletedAt?: string | undefined;
21
22
  }[];
22
23
  }>;
23
24
  create: (body: HttpTypes.CreateTradeAccountInput, headers?: ClientHeaders) => Promise<{
@@ -32,6 +33,7 @@ declare class Info {
32
33
  agentWalletAddress: string;
33
34
  isSubaccount: boolean;
34
35
  } | undefined;
36
+ deletedAt?: string | undefined;
35
37
  };
36
38
  }>;
37
39
  update: (id: string, body: HttpTypes.UpdateTradeAccountInput, headers?: ClientHeaders) => Promise<{
@@ -46,6 +48,7 @@ declare class Info {
46
48
  agentWalletAddress: string;
47
49
  isSubaccount: boolean;
48
50
  } | undefined;
51
+ deletedAt?: string | undefined;
49
52
  };
50
53
  }>;
51
54
  delete: (id: string, headers?: ClientHeaders) => Promise<void>;
@@ -82,8 +85,9 @@ declare class Info {
82
85
  id: string;
83
86
  displayName: string;
84
87
  role: "basic" | "pro";
85
- address?: string | undefined;
86
- email?: string | undefined;
88
+ address: string | null;
89
+ email: string | null;
90
+ emailVerified: boolean;
87
91
  };
88
92
  preferences: {
89
93
  slippageToleranceBps: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/core-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Pear Protocol Core SDK",
5
5
  "private": false,
6
6
  "type": "module",
@@ -25,8 +25,8 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@pear-protocol/types": "0.0.3",
29
- "@pear-protocol/utils": "0.0.3",
28
+ "@pear-protocol/types": "0.0.5",
29
+ "@pear-protocol/utils": "0.0.5",
30
30
  "qs": "^6.14.0"
31
31
  },
32
32
  "devDependencies": {