@pear-protocol/core-sdk 0.0.24 → 1.0.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.
- package/dist/admin/index.d.ts +57 -0
- package/dist/admin/index.js +43 -0
- package/dist/auth/index.d.ts +8 -2
- package/dist/auth/index.js +7 -0
- package/dist/core/index.d.ts +627 -2
- package/dist/core/index.js +102 -10
- package/dist/external/index.d.ts +17 -0
- package/dist/external/index.js +25 -0
- package/dist/external/kalshi.d.ts +6 -0
- package/dist/external/kalshi.js +69 -0
- package/dist/external/polymarket.d.ts +6 -0
- package/dist/external/polymarket.js +91 -0
- package/dist/external/types.d.ts +49 -0
- package/dist/external/types.js +1 -0
- package/dist/http.d.ts +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +27 -0
- package/dist/types.d.ts +30 -7
- package/dist/utils.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { HttpTypes } from '@pear-protocol/types';
|
|
2
|
+
import { HttpClient } from '../http.js';
|
|
3
|
+
import { ClientHeaders } from '../types.js';
|
|
4
|
+
|
|
5
|
+
declare class Admin {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
clientIds: {
|
|
9
|
+
list: (query?: HttpTypes.ListClientIdsParamsInput, headers?: ClientHeaders) => Promise<{
|
|
10
|
+
id: string;
|
|
11
|
+
code: string;
|
|
12
|
+
label: string;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
}[]>;
|
|
18
|
+
create: (body: HttpTypes.CreateClientIdPayloadInput, headers?: ClientHeaders) => Promise<{
|
|
19
|
+
id: string;
|
|
20
|
+
code: string;
|
|
21
|
+
label: string;
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
update: (id: string, body: HttpTypes.UpdateClientIdPayloadInput, headers?: ClientHeaders) => Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
code: string;
|
|
30
|
+
label: string;
|
|
31
|
+
isActive: boolean;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
activate: (id: string, headers?: ClientHeaders) => Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
code: string;
|
|
39
|
+
label: string;
|
|
40
|
+
isActive: boolean;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
description?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
deactivate: (id: string, headers?: ClientHeaders) => Promise<{
|
|
46
|
+
id: string;
|
|
47
|
+
code: string;
|
|
48
|
+
label: string;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Admin };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class Admin {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
clientIds = {
|
|
7
|
+
list: async (query, headers) => {
|
|
8
|
+
return await this.client.fetch(`/admin/client-ids`, {
|
|
9
|
+
method: "GET",
|
|
10
|
+
headers,
|
|
11
|
+
query
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
create: async (body, headers) => {
|
|
15
|
+
return await this.client.fetch(`/admin/client-ids`, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers,
|
|
18
|
+
body
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
update: async (id, body, headers) => {
|
|
22
|
+
return await this.client.fetch(`/admin/client-ids/${id}`, {
|
|
23
|
+
method: "PATCH",
|
|
24
|
+
headers,
|
|
25
|
+
body
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
activate: async (id, headers) => {
|
|
29
|
+
return await this.client.fetch(`/admin/client-ids/${id}/activate`, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
deactivate: async (id, headers) => {
|
|
35
|
+
return await this.client.fetch(`/admin/client-ids/${id}/deactivate`, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Admin };
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare class Auth {
|
|
|
12
12
|
refreshToken: string;
|
|
13
13
|
user: {
|
|
14
14
|
id: string;
|
|
15
|
-
role: "basic" | "pro";
|
|
15
|
+
role: "basic" | "pro" | "admin";
|
|
16
16
|
providerId: string | null;
|
|
17
17
|
loginMethod: "email" | "evm_wallet";
|
|
18
18
|
};
|
|
@@ -26,10 +26,16 @@ declare class Auth {
|
|
|
26
26
|
logout(headers?: ClientHeaders): Promise<void>;
|
|
27
27
|
me(headers?: ClientHeaders): Promise<{
|
|
28
28
|
id: string;
|
|
29
|
-
role: "basic" | "pro";
|
|
29
|
+
role: "basic" | "pro" | "admin";
|
|
30
30
|
providerId: string | null;
|
|
31
31
|
loginMethod: "email" | "evm_wallet";
|
|
32
32
|
}>;
|
|
33
|
+
apiKeyMe(headers?: ClientHeaders): Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
role: "basic" | "pro" | "admin";
|
|
36
|
+
scope: "read" | "read_write";
|
|
37
|
+
authMethod: "api_key";
|
|
38
|
+
}>;
|
|
33
39
|
refreshSession(headers?: ClientHeaders): Promise<void>;
|
|
34
40
|
refreshToken(body: HttpTypes.RefreshTokenRequest, headers?: ClientHeaders): Promise<{
|
|
35
41
|
accessToken: string;
|
package/dist/auth/index.js
CHANGED
|
@@ -50,6 +50,13 @@ class Auth {
|
|
|
50
50
|
headers
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
// Resolve the identity behind an API key (x-api-key auth). Session-less counterpart to `me`.
|
|
54
|
+
async apiKeyMe(headers) {
|
|
55
|
+
return await this.client.fetch(`/auth/api-key/me`, {
|
|
56
|
+
method: "GET",
|
|
57
|
+
headers
|
|
58
|
+
});
|
|
59
|
+
}
|
|
53
60
|
async refreshSession(headers) {
|
|
54
61
|
return await this.client.fetch(`/auth/session/refresh`, {
|
|
55
62
|
method: "POST",
|