@polymarket/relayer-client 0.0.11 → 0.0.12
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/client.d.ts +2 -2
- package/dist/client.js +4 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export declare class RelayClient {
|
|
|
6
6
|
readonly relayerUrl: string;
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly httpClient: HttpClient;
|
|
9
|
-
private authHandler
|
|
9
|
+
private authHandler?;
|
|
10
10
|
readonly signer?: Wallet | JsonRpcSigner;
|
|
11
|
-
constructor(relayerUrl: string, chainId: number, authArgs
|
|
11
|
+
constructor(relayerUrl: string, chainId: number, authArgs?: AuthArgs, signer?: Wallet | JsonRpcSigner);
|
|
12
12
|
getRelayAddress(): Promise<AddressPayload>;
|
|
13
13
|
getNonce(signerAddress: string, signerType: string): Promise<NoncePayload>;
|
|
14
14
|
getRelayPayload(signerAddress: string, signerType: string): Promise<RelayPayload>;
|
package/dist/client.js
CHANGED
|
@@ -16,7 +16,9 @@ class RelayClient {
|
|
|
16
16
|
this.relayerUrl = relayerUrl.endsWith("/") ? relayerUrl.slice(0, -1) : relayerUrl;
|
|
17
17
|
this.chainId = chainId;
|
|
18
18
|
this.httpClient = new http_helpers_1.HttpClient();
|
|
19
|
-
|
|
19
|
+
if (authArgs !== undefined) {
|
|
20
|
+
this.authHandler = new auth_1.AuthHandler(this.httpClient, authArgs);
|
|
21
|
+
}
|
|
20
22
|
if (signer !== undefined) {
|
|
21
23
|
this.signer = signer;
|
|
22
24
|
if (signer.provider == undefined) {
|
|
@@ -119,7 +121,7 @@ class RelayClient {
|
|
|
119
121
|
// Explicitly inject the polymarket session cookies
|
|
120
122
|
// In prod environments, this will be unnecessary as the browser will have the needed cookies
|
|
121
123
|
// Needed only for local testing
|
|
122
|
-
if (!browser_or_node_1.default) {
|
|
124
|
+
if (!browser_or_node_1.default && this.authHandler !== undefined) {
|
|
123
125
|
const cookie = yield this.authHandler.getPolymarketCookies();
|
|
124
126
|
if (headers != undefined) {
|
|
125
127
|
headers["Cookie"] = cookie;
|