@pear-protocol/core-sdk 1.7.0 → 1.9.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/auth/index.d.ts +33 -2
- package/dist/auth/index.js +40 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +7 -0
- package/package.json +2 -2
package/dist/auth/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class Auth {
|
|
|
15
15
|
id: string;
|
|
16
16
|
role: "basic" | "pro" | "admin";
|
|
17
17
|
providerId: string | null;
|
|
18
|
-
loginMethod: "email" | "evm_wallet";
|
|
18
|
+
loginMethod: "email" | "evm_wallet" | "oauth";
|
|
19
19
|
};
|
|
20
20
|
}>;
|
|
21
21
|
requestNonce(body: HttpTypes.RequestNonceRequest, headers?: ClientHeaders): Promise<{
|
|
@@ -29,7 +29,7 @@ declare class Auth {
|
|
|
29
29
|
id: string;
|
|
30
30
|
role: "basic" | "pro" | "admin";
|
|
31
31
|
providerId: string | null;
|
|
32
|
-
loginMethod: "email" | "evm_wallet";
|
|
32
|
+
loginMethod: "email" | "evm_wallet" | "oauth";
|
|
33
33
|
}>;
|
|
34
34
|
apiKeyMe(headers?: ClientHeaders): Promise<{
|
|
35
35
|
id: string;
|
|
@@ -50,6 +50,37 @@ declare class Auth {
|
|
|
50
50
|
changePassword(body: HttpTypes.ChangePasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
51
51
|
forgotPassword(body: HttpTypes.ForgotPasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
52
52
|
resetPassword(body: HttpTypes.ResetPasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
53
|
+
getInteractionDetails(uid: string, headers?: ClientHeaders): Promise<{
|
|
54
|
+
uid: string;
|
|
55
|
+
prompt: {
|
|
56
|
+
name: string;
|
|
57
|
+
details: Record<string, unknown>;
|
|
58
|
+
};
|
|
59
|
+
params: Record<string, unknown>;
|
|
60
|
+
client: {
|
|
61
|
+
clientId: string;
|
|
62
|
+
redirectUris: string[];
|
|
63
|
+
clientName?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
submitInteractionLogin(uid: string, body: HttpTypes.LoginRequest, headers?: ClientHeaders): Promise<{
|
|
67
|
+
returnTo: string;
|
|
68
|
+
}>;
|
|
69
|
+
confirmInteraction(uid: string, body: HttpTypes.OauthInteractionConfirmRequest, headers?: ClientHeaders): Promise<{
|
|
70
|
+
returnTo: string;
|
|
71
|
+
}>;
|
|
72
|
+
abortInteraction(uid: string, headers?: ClientHeaders): Promise<{
|
|
73
|
+
returnTo: string;
|
|
74
|
+
}>;
|
|
75
|
+
listOauthGrants(headers?: ClientHeaders): Promise<{
|
|
76
|
+
grants: {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
scopes: string[];
|
|
80
|
+
connectedAt: string;
|
|
81
|
+
}[];
|
|
82
|
+
}>;
|
|
83
|
+
revokeOauthGrant(id: string, headers?: ClientHeaders): Promise<void>;
|
|
53
84
|
}
|
|
54
85
|
|
|
55
86
|
export { Auth };
|
package/dist/auth/index.js
CHANGED
|
@@ -111,6 +111,46 @@ class Auth {
|
|
|
111
111
|
body
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
// --- OAuth interaction (login + consent), keyed by uid in the URL, served by apps/auth ---
|
|
115
|
+
async getInteractionDetails(uid, headers) {
|
|
116
|
+
return await this.client.fetch(`/interaction/${uid}`, {
|
|
117
|
+
method: "GET",
|
|
118
|
+
headers
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async submitInteractionLogin(uid, body, headers) {
|
|
122
|
+
return await this.client.fetch(`/interaction/${uid}/login`, {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers,
|
|
125
|
+
body
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async confirmInteraction(uid, body, headers) {
|
|
129
|
+
return await this.client.fetch(`/interaction/${uid}/confirm`, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers,
|
|
132
|
+
body
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async abortInteraction(uid, headers) {
|
|
136
|
+
return await this.client.fetch(`/interaction/${uid}/abort`, {
|
|
137
|
+
method: "POST",
|
|
138
|
+
headers
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
// --- OAuth grants (the user's active authorizations), served by apps/auth ---
|
|
142
|
+
async listOauthGrants(headers) {
|
|
143
|
+
return await this.client.fetch(`/oauth2/grants`, {
|
|
144
|
+
method: "GET",
|
|
145
|
+
headers
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async revokeOauthGrant(id, headers) {
|
|
149
|
+
return await this.client.fetch(`/oauth2/grants/${id}`, {
|
|
150
|
+
method: "DELETE",
|
|
151
|
+
headers
|
|
152
|
+
});
|
|
153
|
+
}
|
|
114
154
|
}
|
|
115
155
|
|
|
116
156
|
export { Auth };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2046,6 +2046,7 @@ declare class Core {
|
|
|
2046
2046
|
status: "OPEN" | "CLOSED";
|
|
2047
2047
|
origin: "PARTIAL" | "PEAR" | "EXTERNAL";
|
|
2048
2048
|
exposure: Record<string, `-${string}` | `+${string}`>;
|
|
2049
|
+
unstableHistoricalData: boolean;
|
|
2049
2050
|
totalFundingPayment: Record<string, `-${string}` | `+${string}`>;
|
|
2050
2051
|
initialExposureUSD: Record<string, `-${string}` | `+${string}`>;
|
|
2051
2052
|
entryPrices: Record<string, string>;
|
|
@@ -2270,6 +2271,7 @@ declare class Core {
|
|
|
2270
2271
|
minimumDriftPct: string;
|
|
2271
2272
|
createdAt: string;
|
|
2272
2273
|
updatedAt: string;
|
|
2274
|
+
pausedReason?: "USER" | "POSITION_CHANGED" | "REPEATED_FAILURES" | undefined;
|
|
2273
2275
|
timeframe?: "1d" | "1h" | "4h" | undefined;
|
|
2274
2276
|
}[];
|
|
2275
2277
|
nextCursor?: string | undefined;
|
|
@@ -2283,6 +2285,7 @@ declare class Core {
|
|
|
2283
2285
|
minimumDriftPct: string;
|
|
2284
2286
|
createdAt: string;
|
|
2285
2287
|
updatedAt: string;
|
|
2288
|
+
pausedReason?: "USER" | "POSITION_CHANGED" | "REPEATED_FAILURES" | undefined;
|
|
2286
2289
|
timeframe?: "1d" | "1h" | "4h" | undefined;
|
|
2287
2290
|
};
|
|
2288
2291
|
}>;
|
|
@@ -2295,6 +2298,20 @@ declare class Core {
|
|
|
2295
2298
|
minimumDriftPct: string;
|
|
2296
2299
|
createdAt: string;
|
|
2297
2300
|
updatedAt: string;
|
|
2301
|
+
pausedReason?: "USER" | "POSITION_CHANGED" | "REPEATED_FAILURES" | undefined;
|
|
2302
|
+
timeframe?: "1d" | "1h" | "4h" | undefined;
|
|
2303
|
+
};
|
|
2304
|
+
}>;
|
|
2305
|
+
replace: (id: string, body: HttpTypes.ReplaceAutoRebalanceConfig, headers?: ClientHeaders) => Promise<{
|
|
2306
|
+
config: {
|
|
2307
|
+
id: string;
|
|
2308
|
+
positionId: string;
|
|
2309
|
+
status: "ACTIVE" | "PAUSED";
|
|
2310
|
+
weightSource: "INITIAL_WEIGHT" | "LIVE_BETA";
|
|
2311
|
+
minimumDriftPct: string;
|
|
2312
|
+
createdAt: string;
|
|
2313
|
+
updatedAt: string;
|
|
2314
|
+
pausedReason?: "USER" | "POSITION_CHANGED" | "REPEATED_FAILURES" | undefined;
|
|
2298
2315
|
timeframe?: "1d" | "1h" | "4h" | undefined;
|
|
2299
2316
|
};
|
|
2300
2317
|
}>;
|
package/dist/core/index.js
CHANGED
|
@@ -282,6 +282,13 @@ class Core {
|
|
|
282
282
|
body
|
|
283
283
|
});
|
|
284
284
|
},
|
|
285
|
+
replace: async (id, body, headers) => {
|
|
286
|
+
return await this.client.fetch(`/rebalance/auto/${id}/replace`, {
|
|
287
|
+
method: "POST",
|
|
288
|
+
headers,
|
|
289
|
+
body
|
|
290
|
+
});
|
|
291
|
+
},
|
|
285
292
|
cancel: async (id, headers) => {
|
|
286
293
|
return await this.client.fetch(`/rebalance/auto/${id}/cancel`, {
|
|
287
294
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Pear Protocol Core SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pear-protocol/types": "^1.
|
|
30
|
+
"@pear-protocol/types": "^1.12.0",
|
|
31
31
|
"@pear-protocol/utils": "^0.2.0",
|
|
32
32
|
"qs": "^6.14.0"
|
|
33
33
|
},
|