@0xsequence/relayer 1.9.4 → 1.9.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.
|
@@ -39,6 +39,9 @@ class ProviderRelayer {
|
|
|
39
39
|
this.fromBlockLog = void 0;
|
|
40
40
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
41
41
|
this.provider = opts.provider;
|
|
42
|
+
this.waitPollRate = opts.waitPollRate;
|
|
43
|
+
this.deltaBlocksLog = opts.deltaBlocksLog;
|
|
44
|
+
this.fromBlockLog = opts.fromBlockLog;
|
|
42
45
|
}
|
|
43
46
|
async simulate(wallet, ...transactions) {
|
|
44
47
|
var _this = this;
|
|
@@ -92,7 +95,7 @@ class ProviderRelayer {
|
|
|
92
95
|
});
|
|
93
96
|
return core.commons.transaction.encodeNonce(space, nonce);
|
|
94
97
|
}
|
|
95
|
-
async wait(metaTxnId,
|
|
98
|
+
async wait(metaTxnId, timeoutDuration, delay = this.waitPollRate, maxFails = 5) {
|
|
96
99
|
var _this2 = this;
|
|
97
100
|
if (typeof metaTxnId !== 'string') {
|
|
98
101
|
metaTxnId = core.commons.transaction.intendedTransactionID(metaTxnId);
|
|
@@ -162,11 +165,11 @@ class ProviderRelayer {
|
|
|
162
165
|
}
|
|
163
166
|
throw new Error(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
164
167
|
};
|
|
165
|
-
if (
|
|
168
|
+
if (timeoutDuration !== undefined) {
|
|
166
169
|
return Promise.race([waitReceipt(), new Promise((_, reject) => setTimeout(() => {
|
|
167
170
|
timedOut = true;
|
|
168
171
|
reject(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
169
|
-
},
|
|
172
|
+
}, timeoutDuration))]);
|
|
170
173
|
} else {
|
|
171
174
|
return waitReceipt();
|
|
172
175
|
}
|
|
@@ -39,6 +39,9 @@ class ProviderRelayer {
|
|
|
39
39
|
this.fromBlockLog = void 0;
|
|
40
40
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
41
41
|
this.provider = opts.provider;
|
|
42
|
+
this.waitPollRate = opts.waitPollRate;
|
|
43
|
+
this.deltaBlocksLog = opts.deltaBlocksLog;
|
|
44
|
+
this.fromBlockLog = opts.fromBlockLog;
|
|
42
45
|
}
|
|
43
46
|
async simulate(wallet, ...transactions) {
|
|
44
47
|
var _this = this;
|
|
@@ -92,7 +95,7 @@ class ProviderRelayer {
|
|
|
92
95
|
});
|
|
93
96
|
return core.commons.transaction.encodeNonce(space, nonce);
|
|
94
97
|
}
|
|
95
|
-
async wait(metaTxnId,
|
|
98
|
+
async wait(metaTxnId, timeoutDuration, delay = this.waitPollRate, maxFails = 5) {
|
|
96
99
|
var _this2 = this;
|
|
97
100
|
if (typeof metaTxnId !== 'string') {
|
|
98
101
|
metaTxnId = core.commons.transaction.intendedTransactionID(metaTxnId);
|
|
@@ -162,11 +165,11 @@ class ProviderRelayer {
|
|
|
162
165
|
}
|
|
163
166
|
throw new Error(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
164
167
|
};
|
|
165
|
-
if (
|
|
168
|
+
if (timeoutDuration !== undefined) {
|
|
166
169
|
return Promise.race([waitReceipt(), new Promise((_, reject) => setTimeout(() => {
|
|
167
170
|
timedOut = true;
|
|
168
171
|
reject(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
169
|
-
},
|
|
172
|
+
}, timeoutDuration))]);
|
|
170
173
|
} else {
|
|
171
174
|
return waitReceipt();
|
|
172
175
|
}
|
|
@@ -35,6 +35,9 @@ class ProviderRelayer {
|
|
|
35
35
|
this.fromBlockLog = void 0;
|
|
36
36
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
37
37
|
this.provider = opts.provider;
|
|
38
|
+
this.waitPollRate = opts.waitPollRate;
|
|
39
|
+
this.deltaBlocksLog = opts.deltaBlocksLog;
|
|
40
|
+
this.fromBlockLog = opts.fromBlockLog;
|
|
38
41
|
}
|
|
39
42
|
async simulate(wallet, ...transactions) {
|
|
40
43
|
var _this = this;
|
|
@@ -88,7 +91,7 @@ class ProviderRelayer {
|
|
|
88
91
|
});
|
|
89
92
|
return commons.transaction.encodeNonce(space, nonce);
|
|
90
93
|
}
|
|
91
|
-
async wait(metaTxnId,
|
|
94
|
+
async wait(metaTxnId, timeoutDuration, delay = this.waitPollRate, maxFails = 5) {
|
|
92
95
|
var _this2 = this;
|
|
93
96
|
if (typeof metaTxnId !== 'string') {
|
|
94
97
|
metaTxnId = commons.transaction.intendedTransactionID(metaTxnId);
|
|
@@ -158,11 +161,11 @@ class ProviderRelayer {
|
|
|
158
161
|
}
|
|
159
162
|
throw new Error(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
160
163
|
};
|
|
161
|
-
if (
|
|
164
|
+
if (timeoutDuration !== undefined) {
|
|
162
165
|
return Promise.race([waitReceipt(), new Promise((_, reject) => setTimeout(() => {
|
|
163
166
|
timedOut = true;
|
|
164
167
|
reject(`Timeout waiting for transaction receipt ${metaTxnId}`);
|
|
165
|
-
},
|
|
168
|
+
}, timeoutDuration))]);
|
|
166
169
|
} else {
|
|
167
170
|
return waitReceipt();
|
|
168
171
|
}
|
|
@@ -30,7 +30,7 @@ export declare abstract class ProviderRelayer implements Relayer {
|
|
|
30
30
|
abstract relay(signedTxs: commons.transaction.IntendedTransactionBundle, quote?: FeeQuote, waitForReceipt?: boolean): Promise<commons.transaction.TransactionResponse>;
|
|
31
31
|
simulate(wallet: string, ...transactions: commons.transaction.Transaction[]): Promise<SimulateResult[]>;
|
|
32
32
|
getNonce(address: string, space?: ethers.BigNumberish, blockTag?: providers.BlockTag): Promise<ethers.BigNumberish>;
|
|
33
|
-
wait(metaTxnId: string | commons.transaction.SignedTransactionBundle,
|
|
33
|
+
wait(metaTxnId: string | commons.transaction.SignedTransactionBundle, timeoutDuration?: number, delay?: number, maxFails?: number): Promise<providers.TransactionResponse & {
|
|
34
34
|
receipt: providers.TransactionReceipt;
|
|
35
35
|
}>;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"description": "relayer sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"author": "Horizon Blockchain Games",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@0xsequence/
|
|
13
|
-
"@0xsequence/
|
|
14
|
-
"@0xsequence/
|
|
12
|
+
"@0xsequence/utils": "1.9.6",
|
|
13
|
+
"@0xsequence/abi": "1.9.6",
|
|
14
|
+
"@0xsequence/core": "1.9.6"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"ethers": ">=5.5 < 6"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@0xsequence/wallet-contracts": "^1.10.0",
|
|
21
21
|
"ethers": "^5.7.2",
|
|
22
|
-
"@0xsequence/
|
|
23
|
-
"@0xsequence/
|
|
22
|
+
"@0xsequence/tests": "1.9.6",
|
|
23
|
+
"@0xsequence/signhub": "1.9.6"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
package/src/provider-relayer.ts
CHANGED
|
@@ -31,7 +31,11 @@ export abstract class ProviderRelayer implements Relayer {
|
|
|
31
31
|
|
|
32
32
|
constructor(options: ProviderRelayerOptions) {
|
|
33
33
|
const opts = { ...ProviderRelayerDefaults, ...options }
|
|
34
|
+
|
|
34
35
|
this.provider = opts.provider
|
|
36
|
+
this.waitPollRate = opts.waitPollRate
|
|
37
|
+
this.deltaBlocksLog = opts.deltaBlocksLog
|
|
38
|
+
this.fromBlockLog = opts.fromBlockLog
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
abstract getFeeOptions(
|
|
@@ -116,7 +120,7 @@ export abstract class ProviderRelayer implements Relayer {
|
|
|
116
120
|
|
|
117
121
|
async wait(
|
|
118
122
|
metaTxnId: string | commons.transaction.SignedTransactionBundle,
|
|
119
|
-
|
|
123
|
+
timeoutDuration?: number,
|
|
120
124
|
delay: number = this.waitPollRate,
|
|
121
125
|
maxFails: number = 5
|
|
122
126
|
): Promise<providers.TransactionResponse & { receipt: providers.TransactionReceipt }> {
|
|
@@ -226,14 +230,14 @@ export abstract class ProviderRelayer implements Relayer {
|
|
|
226
230
|
throw new Error(`Timeout waiting for transaction receipt ${metaTxnId}`)
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
if (
|
|
233
|
+
if (timeoutDuration !== undefined) {
|
|
230
234
|
return Promise.race([
|
|
231
235
|
waitReceipt(),
|
|
232
236
|
new Promise<providers.TransactionResponse & { receipt: providers.TransactionReceipt }>((_, reject) =>
|
|
233
237
|
setTimeout(() => {
|
|
234
238
|
timedOut = true
|
|
235
239
|
reject(`Timeout waiting for transaction receipt ${metaTxnId}`)
|
|
236
|
-
},
|
|
240
|
+
}, timeoutDuration)
|
|
237
241
|
)
|
|
238
242
|
])
|
|
239
243
|
} else {
|