@polymarket/relayer-client 1.0.4 → 1.0.5
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 +1 -1
- package/dist/client.js +8 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class RelayClient {
|
|
|
19
19
|
executeSafeTransactions(txns: SafeTransaction[]): Promise<RelayerTransactionResponse>;
|
|
20
20
|
executeManualTransactions(txns: SafeTransaction[], overrides?: ManualOverrides): Promise<TransactionResponse>;
|
|
21
21
|
deploySafe(): Promise<RelayerTransactionResponse>;
|
|
22
|
-
pollUntilState(transactionId: string, states: string[], maxPolls?: number): Promise<RelayerTransaction | undefined>;
|
|
22
|
+
pollUntilState(transactionId: string, states: string[], maxPolls?: number, pollFrequency?: number): Promise<RelayerTransaction | undefined>;
|
|
23
23
|
private submitTransaction;
|
|
24
24
|
private send;
|
|
25
25
|
}
|
package/dist/client.js
CHANGED
|
@@ -126,10 +126,16 @@ class RelayClient {
|
|
|
126
126
|
// Periodically polls the transaction id until it reaches a desired state
|
|
127
127
|
// Returns the relayer transaction if it does each the desired state
|
|
128
128
|
// Times out after 10s
|
|
129
|
-
pollUntilState(transactionId, states, maxPolls) {
|
|
129
|
+
pollUntilState(transactionId, states, maxPolls, pollFrequency) {
|
|
130
130
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
console.log(`Waiting for transaction ${transactionId} matching states: ${states}...`);
|
|
132
132
|
const maxPollCount = maxPolls != undefined ? maxPolls : 10;
|
|
133
|
+
let pollFreq = 2000; // Default to polling every 2 seconds
|
|
134
|
+
if (pollFrequency != undefined) {
|
|
135
|
+
if (pollFrequency >= 1000) {
|
|
136
|
+
pollFreq = pollFrequency;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
133
139
|
let pollCount = 0;
|
|
134
140
|
while (pollCount < maxPollCount) {
|
|
135
141
|
const txns = yield this.getTransaction(transactionId);
|
|
@@ -140,7 +146,7 @@ class RelayClient {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
pollCount++;
|
|
143
|
-
yield utils_1.sleep(
|
|
149
|
+
yield utils_1.sleep(pollFreq);
|
|
144
150
|
}
|
|
145
151
|
console.log(`Transaction not found or not in given states, timing out`);
|
|
146
152
|
});
|