@polymarket/relayer-client 0.0.12 → 0.0.13
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 +4 -3
- package/dist/client.js +8 -8
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import { Wallet } from "@ethersproject/wallet";
|
|
|
2
2
|
import { JsonRpcSigner } from "@ethersproject/providers";
|
|
3
3
|
import { HttpClient } from "./http-helpers";
|
|
4
4
|
import { AddressPayload, AuthArgs, NoncePayload, ProxyTransaction, RelayPayload, SafeTransaction } from "./types";
|
|
5
|
+
import { AuthHandler } from "./auth";
|
|
5
6
|
export declare class RelayClient {
|
|
6
7
|
readonly relayerUrl: string;
|
|
7
8
|
readonly chainId: number;
|
|
8
9
|
readonly httpClient: HttpClient;
|
|
9
|
-
private authHandler?;
|
|
10
10
|
readonly signer?: Wallet | JsonRpcSigner;
|
|
11
|
-
|
|
11
|
+
readonly authHandler?: AuthHandler;
|
|
12
|
+
constructor(relayerUrl: string, chainId: number, signer?: Wallet | JsonRpcSigner, authArgs?: AuthArgs);
|
|
12
13
|
getRelayAddress(): Promise<AddressPayload>;
|
|
13
14
|
getNonce(signerAddress: string, signerType: string): Promise<NoncePayload>;
|
|
14
15
|
getRelayPayload(signerAddress: string, signerType: string): Promise<RelayPayload>;
|
|
@@ -17,6 +18,6 @@ export declare class RelayClient {
|
|
|
17
18
|
executeProxyTransactions(txns: ProxyTransaction[]): Promise<any>;
|
|
18
19
|
executeSafeTransactions(txns: SafeTransaction[]): Promise<any>;
|
|
19
20
|
deploySafe(): Promise<any>;
|
|
20
|
-
private
|
|
21
|
+
private post;
|
|
21
22
|
private send;
|
|
22
23
|
}
|
package/dist/client.js
CHANGED
|
@@ -12,19 +12,19 @@ const encode_1 = require("./encode");
|
|
|
12
12
|
const builder_2 = require("./builder");
|
|
13
13
|
const auth_1 = require("./auth");
|
|
14
14
|
class RelayClient {
|
|
15
|
-
constructor(relayerUrl, chainId,
|
|
15
|
+
constructor(relayerUrl, chainId, signer, authArgs) {
|
|
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
|
-
if (authArgs !== undefined) {
|
|
20
|
-
this.authHandler = new auth_1.AuthHandler(this.httpClient, authArgs);
|
|
21
|
-
}
|
|
22
19
|
if (signer !== undefined) {
|
|
23
20
|
this.signer = signer;
|
|
24
21
|
if (signer.provider == undefined) {
|
|
25
22
|
throw new Error("signer must have provider attached");
|
|
26
23
|
}
|
|
27
24
|
}
|
|
25
|
+
if (authArgs !== undefined) {
|
|
26
|
+
this.authHandler = new auth_1.AuthHandler(this.httpClient, authArgs);
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
getRelayAddress() {
|
|
30
30
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -68,7 +68,7 @@ class RelayClient {
|
|
|
68
68
|
};
|
|
69
69
|
const request = yield builder_1.buildProxyTransactionRequest(this.signer, args);
|
|
70
70
|
console.log(`Client side request creation took: ${(Date.now() - start) / 1000} seconds`);
|
|
71
|
-
return this.
|
|
71
|
+
return this.post(request);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
executeSafeTransactions(txns) {
|
|
@@ -88,7 +88,7 @@ class RelayClient {
|
|
|
88
88
|
};
|
|
89
89
|
const request = yield builder_1.buildSafeTransactionRequest(this.signer, args);
|
|
90
90
|
console.log(`Client side request creation took: ${(Date.now() - start) / 1000} seconds`);
|
|
91
|
-
return this.
|
|
91
|
+
return this.post(request);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
deploySafe() {
|
|
@@ -108,10 +108,10 @@ class RelayClient {
|
|
|
108
108
|
};
|
|
109
109
|
const request = yield builder_2.buildSafeCreateTransactionRequest(this.signer, args);
|
|
110
110
|
console.log(`Client side request creation took: ${(Date.now() - start) / 1000} seconds`);
|
|
111
|
-
return this.
|
|
111
|
+
return this.post(request);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
post(req) {
|
|
115
115
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
116
116
|
return this.send(`${this.relayerUrl}${endpoints_1.SUBMIT_TRANSACTION}`, http_helpers_1.POST, undefined, req);
|
|
117
117
|
});
|