@polymarket/relayer-client 1.0.5 → 1.0.6

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.js CHANGED
@@ -12,6 +12,7 @@ const encode_1 = require("./encode");
12
12
  const auth_1 = require("./auth");
13
13
  const utils_1 = require("./utils");
14
14
  const manual_1 = require("./manual");
15
+ const response_1 = require("./response");
15
16
  class RelayClient {
16
17
  constructor(relayerUrl, chainId, signer, authArgs) {
17
18
  this.relayerUrl = relayerUrl.endsWith("/") ? relayerUrl.slice(0, -1) : relayerUrl;
@@ -69,7 +70,8 @@ class RelayClient {
69
70
  };
70
71
  const request = yield builder_1.buildProxyTransactionRequest(this.signer, args);
71
72
  console.log(`Client side proxy request creation took: ${(Date.now() - start) / 1000} seconds`);
72
- return this.submitTransaction(request);
73
+ const resp = yield this.submitTransaction(request);
74
+ return new response_1.ClientRelayerTransactionResponse(resp.transactionID, resp.state, this);
73
75
  });
74
76
  }
75
77
  executeSafeTransactions(txns) {
@@ -89,7 +91,8 @@ class RelayClient {
89
91
  };
90
92
  const request = yield builder_1.buildSafeTransactionRequest(this.signer, args);
91
93
  console.log(`Client side safe request creation took: ${(Date.now() - start) / 1000} seconds`);
92
- return this.submitTransaction(request);
94
+ const resp = yield this.submitTransaction(request);
95
+ return new response_1.ClientRelayerTransactionResponse(resp.transactionID, resp.state, this);
93
96
  });
94
97
  }
95
98
  executeManualTransactions(txns, overrides) {
@@ -120,7 +123,8 @@ class RelayClient {
120
123
  };
121
124
  const request = yield builder_1.buildSafeCreateTransactionRequest(this.signer, args);
122
125
  console.log(`Client side deploy request creation took: ${(Date.now() - start) / 1000} seconds`);
123
- return this.submitTransaction(request);
126
+ const resp = yield this.submitTransaction(request);
127
+ return new response_1.ClientRelayerTransactionResponse(resp.transactionID, resp.state, this);
124
128
  });
125
129
  }
126
130
  // Periodically polls the transaction id until it reaches a desired state
@@ -0,0 +1,9 @@
1
+ import { RelayClient } from "../client";
2
+ import { RelayerTransactionResponse } from "../types";
3
+ export declare class ClientRelayerTransactionResponse implements RelayerTransactionResponse {
4
+ readonly client: RelayClient;
5
+ readonly transactionID: string;
6
+ readonly state: string;
7
+ constructor(transactionID: string, state: string, client: RelayClient);
8
+ wait(): Promise<boolean>;
9
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientRelayerTransactionResponse = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const types_1 = require("../types");
6
+ class ClientRelayerTransactionResponse {
7
+ constructor(transactionID, state, client) {
8
+ this.transactionID = transactionID;
9
+ this.state = state;
10
+ this.client = client;
11
+ }
12
+ wait() {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ const txn = yield this.client.pollUntilState(this.transactionID, [
15
+ types_1.RelayerTransactionState.STATE_MINED,
16
+ types_1.RelayerTransactionState.STATE_CONFIRMED,
17
+ ], 30);
18
+ if (txn == undefined) {
19
+ return false;
20
+ }
21
+ return true;
22
+ });
23
+ }
24
+ }
25
+ exports.ClientRelayerTransactionResponse = ClientRelayerTransactionResponse;
package/dist/types.d.ts CHANGED
@@ -92,6 +92,7 @@ export declare enum RelayerTransactionState {
92
92
  export interface RelayerTransactionResponse {
93
93
  transactionID: string;
94
94
  state: string;
95
+ wait: () => Promise<boolean>;
95
96
  }
96
97
  export interface RelayerSubRequest {
97
98
  address: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@polymarket/relayer-client",
3
3
  "description": "Client for Polymarket relayers",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [