@polymarket/relayer-client 1.0.5 → 1.0.7

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,10 @@
1
+ import { RelayClient } from "../client";
2
+ import { RelayerTransaction, 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
+ getTransaction(): Promise<RelayerTransaction[]>;
9
+ wait(): Promise<RelayerTransaction | undefined>;
10
+ }
@@ -0,0 +1,26 @@
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
+ getTransaction() {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ return this.client.getTransaction(this.transactionID);
15
+ });
16
+ }
17
+ wait() {
18
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ return this.client.pollUntilState(this.transactionID, [
20
+ types_1.RelayerTransactionState.STATE_MINED,
21
+ types_1.RelayerTransactionState.STATE_CONFIRMED,
22
+ ], 30);
23
+ });
24
+ }
25
+ }
26
+ exports.ClientRelayerTransactionResponse = ClientRelayerTransactionResponse;
package/dist/types.d.ts CHANGED
@@ -89,10 +89,6 @@ export declare enum RelayerTransactionState {
89
89
  STATE_CONFIRMED = "STATE_CONFIRMED",
90
90
  STATE_FAILED = "STATE_FAILED"
91
91
  }
92
- export interface RelayerTransactionResponse {
93
- transactionID: string;
94
- state: string;
95
- }
96
92
  export interface RelayerSubRequest {
97
93
  address: string;
98
94
  transactions: string[];
@@ -117,6 +113,12 @@ export interface RelayerTransaction {
117
113
  createdAt: Date;
118
114
  updatedAt: Date;
119
115
  }
116
+ export interface RelayerTransactionResponse {
117
+ transactionID: string;
118
+ state: string;
119
+ getTransaction: () => Promise<RelayerTransaction[]>;
120
+ wait: () => Promise<RelayerTransaction | undefined>;
121
+ }
120
122
  export interface ManualOverrides {
121
123
  gasLimit?: BigNumberish;
122
124
  gasPrice?: BigNumberish;
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.7",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [