@polymarket/relayer-client 0.0.8 → 0.0.10
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/handler.js +0 -2
- package/dist/client.js +9 -13
- package/package.json +1 -1
package/dist/auth/handler.js
CHANGED
|
@@ -23,8 +23,6 @@ class AuthHandler {
|
|
|
23
23
|
// Logging in will set the session cookies on the httpClient
|
|
24
24
|
const resp = yield this.httpClient.send(`${this.url}/login`, http_helpers_1.GET, { Authorization: `Bearer ${this.token}` });
|
|
25
25
|
const cookies = resp.headers['set-cookie'];
|
|
26
|
-
console.log(`RelayClient Coookies:`);
|
|
27
|
-
console.log(cookies);
|
|
28
26
|
let aggregatedCookie = "";
|
|
29
27
|
for (const cookie of cookies) {
|
|
30
28
|
if (cookie.includes(POLYMARKET_COOKIE_NAME)) {
|
package/dist/client.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RelayClient = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
|
-
const browser_or_node_1 = require("browser-or-node");
|
|
7
6
|
const http_helpers_1 = require("./http-helpers");
|
|
8
7
|
const types_1 = require("./types");
|
|
9
8
|
const endpoints_1 = require("./endpoints");
|
|
@@ -116,19 +115,16 @@ class RelayClient {
|
|
|
116
115
|
}
|
|
117
116
|
send(endpoint, method, headers, data, params) {
|
|
118
117
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
headers = { "Cookie": cookie };
|
|
129
|
-
}
|
|
118
|
+
// Explicitly inject the polymarket session cookies
|
|
119
|
+
// In prod environments, this will be unnecessary as the browser will have the needed cookies
|
|
120
|
+
// Needed only for local testing
|
|
121
|
+
const cookie = yield this.authHandler.getPolymarketCookies();
|
|
122
|
+
if (headers != undefined) {
|
|
123
|
+
headers["Cookie"] = cookie;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
headers = { "Cookie": cookie };
|
|
130
127
|
}
|
|
131
|
-
// If the client is instantiated on the browser, do not inject cookies
|
|
132
128
|
const resp = yield this.httpClient.send(endpoint, method, headers, data, params);
|
|
133
129
|
return resp.data;
|
|
134
130
|
});
|