@0xsequence/relayer 1.9.5 → 1.9.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/0xsequence-relayer.cjs.dev.js +20 -6
- package/dist/0xsequence-relayer.cjs.prod.js +20 -6
- package/dist/0xsequence-relayer.esm.js +20 -6
- package/dist/declarations/src/provider-relayer.d.ts +1 -1
- package/dist/declarations/src/rpc-relayer/relayer.gen.d.ts +21 -2
- package/package.json +6 -6
- package/src/provider-relayer.ts +7 -3
- package/src/rpc-relayer/relayer.gen.ts +34 -3
|
@@ -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
|
}
|
|
@@ -235,7 +238,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
/* eslint-disable */
|
|
238
|
-
// sequence-relayer v0.4.
|
|
241
|
+
// sequence-relayer v0.4.1 13cf0e854e8127ae83218cc188ef0e7456241c96
|
|
239
242
|
// --
|
|
240
243
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
241
244
|
//
|
|
@@ -245,10 +248,10 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
245
248
|
const WebRPCVersion = 'v1';
|
|
246
249
|
|
|
247
250
|
// Schema version of your RIDL schema
|
|
248
|
-
const WebRPCSchemaVersion = 'v0.4.
|
|
251
|
+
const WebRPCSchemaVersion = 'v0.4.1';
|
|
249
252
|
|
|
250
253
|
// Schema hash generated from your RIDL schema
|
|
251
|
-
const WebRPCSchemaHash = '
|
|
254
|
+
const WebRPCSchemaHash = '13cf0e854e8127ae83218cc188ef0e7456241c96';
|
|
252
255
|
|
|
253
256
|
//
|
|
254
257
|
// Types
|
|
@@ -398,6 +401,7 @@ class Relayer {
|
|
|
398
401
|
return buildResponse(res).then(_data => {
|
|
399
402
|
return {
|
|
400
403
|
options: _data.options,
|
|
404
|
+
sponsored: _data.sponsored,
|
|
401
405
|
quote: _data.quote
|
|
402
406
|
};
|
|
403
407
|
});
|
|
@@ -412,6 +416,16 @@ class Relayer {
|
|
|
412
416
|
});
|
|
413
417
|
});
|
|
414
418
|
};
|
|
419
|
+
this.getMetaTransactions = (args, headers) => {
|
|
420
|
+
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
421
|
+
return buildResponse(res).then(_data => {
|
|
422
|
+
return {
|
|
423
|
+
page: _data.page,
|
|
424
|
+
transactions: _data.transactions
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
};
|
|
415
429
|
this.sentTransactions = (args, headers) => {
|
|
416
430
|
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
417
431
|
return buildResponse(res).then(_data => {
|
|
@@ -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
|
}
|
|
@@ -235,7 +238,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
/* eslint-disable */
|
|
238
|
-
// sequence-relayer v0.4.
|
|
241
|
+
// sequence-relayer v0.4.1 13cf0e854e8127ae83218cc188ef0e7456241c96
|
|
239
242
|
// --
|
|
240
243
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
241
244
|
//
|
|
@@ -245,10 +248,10 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
245
248
|
const WebRPCVersion = 'v1';
|
|
246
249
|
|
|
247
250
|
// Schema version of your RIDL schema
|
|
248
|
-
const WebRPCSchemaVersion = 'v0.4.
|
|
251
|
+
const WebRPCSchemaVersion = 'v0.4.1';
|
|
249
252
|
|
|
250
253
|
// Schema hash generated from your RIDL schema
|
|
251
|
-
const WebRPCSchemaHash = '
|
|
254
|
+
const WebRPCSchemaHash = '13cf0e854e8127ae83218cc188ef0e7456241c96';
|
|
252
255
|
|
|
253
256
|
//
|
|
254
257
|
// Types
|
|
@@ -398,6 +401,7 @@ class Relayer {
|
|
|
398
401
|
return buildResponse(res).then(_data => {
|
|
399
402
|
return {
|
|
400
403
|
options: _data.options,
|
|
404
|
+
sponsored: _data.sponsored,
|
|
401
405
|
quote: _data.quote
|
|
402
406
|
};
|
|
403
407
|
});
|
|
@@ -412,6 +416,16 @@ class Relayer {
|
|
|
412
416
|
});
|
|
413
417
|
});
|
|
414
418
|
};
|
|
419
|
+
this.getMetaTransactions = (args, headers) => {
|
|
420
|
+
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
421
|
+
return buildResponse(res).then(_data => {
|
|
422
|
+
return {
|
|
423
|
+
page: _data.page,
|
|
424
|
+
transactions: _data.transactions
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
};
|
|
415
429
|
this.sentTransactions = (args, headers) => {
|
|
416
430
|
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
417
431
|
return buildResponse(res).then(_data => {
|
|
@@ -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
|
}
|
|
@@ -231,7 +234,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
/* eslint-disable */
|
|
234
|
-
// sequence-relayer v0.4.
|
|
237
|
+
// sequence-relayer v0.4.1 13cf0e854e8127ae83218cc188ef0e7456241c96
|
|
235
238
|
// --
|
|
236
239
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
237
240
|
//
|
|
@@ -241,10 +244,10 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
241
244
|
const WebRPCVersion = 'v1';
|
|
242
245
|
|
|
243
246
|
// Schema version of your RIDL schema
|
|
244
|
-
const WebRPCSchemaVersion = 'v0.4.
|
|
247
|
+
const WebRPCSchemaVersion = 'v0.4.1';
|
|
245
248
|
|
|
246
249
|
// Schema hash generated from your RIDL schema
|
|
247
|
-
const WebRPCSchemaHash = '
|
|
250
|
+
const WebRPCSchemaHash = '13cf0e854e8127ae83218cc188ef0e7456241c96';
|
|
248
251
|
|
|
249
252
|
//
|
|
250
253
|
// Types
|
|
@@ -394,6 +397,7 @@ class Relayer {
|
|
|
394
397
|
return buildResponse(res).then(_data => {
|
|
395
398
|
return {
|
|
396
399
|
options: _data.options,
|
|
400
|
+
sponsored: _data.sponsored,
|
|
397
401
|
quote: _data.quote
|
|
398
402
|
};
|
|
399
403
|
});
|
|
@@ -408,6 +412,16 @@ class Relayer {
|
|
|
408
412
|
});
|
|
409
413
|
});
|
|
410
414
|
};
|
|
415
|
+
this.getMetaTransactions = (args, headers) => {
|
|
416
|
+
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
417
|
+
return buildResponse(res).then(_data => {
|
|
418
|
+
return {
|
|
419
|
+
page: _data.page,
|
|
420
|
+
transactions: _data.transactions
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
};
|
|
411
425
|
this.sentTransactions = (args, headers) => {
|
|
412
426
|
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
413
427
|
return buildResponse(res).then(_data => {
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const WebRPCVersion = "v1";
|
|
2
|
-
export declare const WebRPCSchemaVersion = "v0.4.
|
|
3
|
-
export declare const WebRPCSchemaHash = "
|
|
2
|
+
export declare const WebRPCSchemaVersion = "v0.4.1";
|
|
3
|
+
export declare const WebRPCSchemaHash = "13cf0e854e8127ae83218cc188ef0e7456241c96";
|
|
4
4
|
export declare enum ETHTxnStatus {
|
|
5
5
|
UNKNOWN = "UNKNOWN",
|
|
6
6
|
DROPPED = "DROPPED",
|
|
@@ -84,6 +84,7 @@ export interface GasTankBalanceAdjustment {
|
|
|
84
84
|
export interface GasSponsor {
|
|
85
85
|
id: number;
|
|
86
86
|
gasTankId: number;
|
|
87
|
+
projectId: number;
|
|
87
88
|
address: string;
|
|
88
89
|
name: string;
|
|
89
90
|
active: boolean;
|
|
@@ -109,6 +110,7 @@ export interface MetaTxn {
|
|
|
109
110
|
}
|
|
110
111
|
export interface MetaTxnLog {
|
|
111
112
|
id: number;
|
|
113
|
+
projectId: number;
|
|
112
114
|
txnHash: string;
|
|
113
115
|
txnNonce: string;
|
|
114
116
|
metaTxnID?: string;
|
|
@@ -134,6 +136,7 @@ export interface MetaTxnLog {
|
|
|
134
136
|
gasEstimated: number;
|
|
135
137
|
gasFeeMarkup?: number;
|
|
136
138
|
usdRate: string;
|
|
139
|
+
creditsUsed: number;
|
|
137
140
|
isWhitelisted: boolean;
|
|
138
141
|
gasSponsor?: number;
|
|
139
142
|
gasTank?: number;
|
|
@@ -217,6 +220,7 @@ export interface FeeToken {
|
|
|
217
220
|
export interface Page {
|
|
218
221
|
pageSize?: number;
|
|
219
222
|
page?: number;
|
|
223
|
+
more?: boolean;
|
|
220
224
|
totalRecords?: number;
|
|
221
225
|
column?: string;
|
|
222
226
|
before?: any;
|
|
@@ -241,6 +245,7 @@ export interface Relayer {
|
|
|
241
245
|
feeTokens(headers?: object): Promise<FeeTokensReturn>;
|
|
242
246
|
feeOptions(args: FeeOptionsArgs, headers?: object): Promise<FeeOptionsReturn>;
|
|
243
247
|
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
|
248
|
+
getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object): Promise<GetMetaTransactionsReturn>;
|
|
244
249
|
sentTransactions(args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn>;
|
|
245
250
|
pendingTransactions(args: PendingTransactionsArgs, headers?: object): Promise<PendingTransactionsReturn>;
|
|
246
251
|
getGasTank(args: GetGasTankArgs, headers?: object): Promise<GetGasTankReturn>;
|
|
@@ -332,6 +337,7 @@ export interface FeeOptionsArgs {
|
|
|
332
337
|
}
|
|
333
338
|
export interface FeeOptionsReturn {
|
|
334
339
|
options: Array<FeeOption>;
|
|
340
|
+
sponsored: boolean;
|
|
335
341
|
quote?: string;
|
|
336
342
|
}
|
|
337
343
|
export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
@@ -341,6 +347,15 @@ export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
|
341
347
|
export interface GetMetaTxnNetworkFeeOptionsReturn {
|
|
342
348
|
options: Array<FeeOption>;
|
|
343
349
|
}
|
|
350
|
+
export interface GetMetaTransactionsArgs {
|
|
351
|
+
projectId: number;
|
|
352
|
+
gasTankId: number;
|
|
353
|
+
page?: Page;
|
|
354
|
+
}
|
|
355
|
+
export interface GetMetaTransactionsReturn {
|
|
356
|
+
page: Page;
|
|
357
|
+
transactions: Array<MetaTxnLog>;
|
|
358
|
+
}
|
|
344
359
|
export interface SentTransactionsArgs {
|
|
345
360
|
filter?: SentTransactionsFilter;
|
|
346
361
|
page?: Page;
|
|
@@ -388,6 +403,7 @@ export interface GetGasSponsorReturn {
|
|
|
388
403
|
gasSponsor: GasSponsor;
|
|
389
404
|
}
|
|
390
405
|
export interface ListGasSponsorsArgs {
|
|
406
|
+
projectId: number;
|
|
391
407
|
gasTankId: number;
|
|
392
408
|
page?: Page;
|
|
393
409
|
}
|
|
@@ -396,6 +412,7 @@ export interface ListGasSponsorsReturn {
|
|
|
396
412
|
gasSponsors: Array<GasSponsor>;
|
|
397
413
|
}
|
|
398
414
|
export interface AddGasSponsorArgs {
|
|
415
|
+
projectId: number;
|
|
399
416
|
gasTankId: number;
|
|
400
417
|
address: string;
|
|
401
418
|
name?: string;
|
|
@@ -421,6 +438,7 @@ export interface RemoveGasSponsorReturn {
|
|
|
421
438
|
status: boolean;
|
|
422
439
|
}
|
|
423
440
|
export interface ReportGasSponsorUsageArgs {
|
|
441
|
+
projectId: number;
|
|
424
442
|
gasTankId: number;
|
|
425
443
|
startTime?: string;
|
|
426
444
|
endTime?: string;
|
|
@@ -477,6 +495,7 @@ export declare class Relayer implements Relayer {
|
|
|
477
495
|
feeTokens: (headers?: object | undefined) => Promise<FeeTokensReturn>;
|
|
478
496
|
feeOptions: (args: FeeOptionsArgs, headers?: object | undefined) => Promise<FeeOptionsReturn>;
|
|
479
497
|
getMetaTxnNetworkFeeOptions: (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object | undefined) => Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
|
498
|
+
getMetaTransactions: (args: GetMetaTransactionsArgs, headers?: object | undefined) => Promise<GetMetaTransactionsReturn>;
|
|
480
499
|
sentTransactions: (args: SentTransactionsArgs, headers?: object | undefined) => Promise<SentTransactionsReturn>;
|
|
481
500
|
pendingTransactions: (args: PendingTransactionsArgs, headers?: object | undefined) => Promise<PendingTransactionsReturn>;
|
|
482
501
|
getGasTank: (args: GetGasTankArgs, headers?: object | undefined) => Promise<GetGasTankReturn>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.7",
|
|
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/core": "1.9.7",
|
|
13
|
+
"@0xsequence/utils": "1.9.7",
|
|
14
|
+
"@0xsequence/abi": "1.9.7"
|
|
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/signhub": "1.9.
|
|
23
|
-
"@0xsequence/tests": "1.9.
|
|
22
|
+
"@0xsequence/signhub": "1.9.7",
|
|
23
|
+
"@0xsequence/tests": "1.9.7"
|
|
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 {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-relayer v0.4.
|
|
2
|
+
// sequence-relayer v0.4.1 13cf0e854e8127ae83218cc188ef0e7456241c96
|
|
3
3
|
// --
|
|
4
4
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
export const WebRPCVersion = 'v1'
|
|
10
10
|
|
|
11
11
|
// Schema version of your RIDL schema
|
|
12
|
-
export const WebRPCSchemaVersion = 'v0.4.
|
|
12
|
+
export const WebRPCSchemaVersion = 'v0.4.1'
|
|
13
13
|
|
|
14
14
|
// Schema hash generated from your RIDL schema
|
|
15
|
-
export const WebRPCSchemaHash = '
|
|
15
|
+
export const WebRPCSchemaHash = '13cf0e854e8127ae83218cc188ef0e7456241c96'
|
|
16
16
|
|
|
17
17
|
//
|
|
18
18
|
// Types
|
|
@@ -109,6 +109,7 @@ export interface GasTankBalanceAdjustment {
|
|
|
109
109
|
export interface GasSponsor {
|
|
110
110
|
id: number
|
|
111
111
|
gasTankId: number
|
|
112
|
+
projectId: number
|
|
112
113
|
address: string
|
|
113
114
|
name: string
|
|
114
115
|
active: boolean
|
|
@@ -137,6 +138,7 @@ export interface MetaTxn {
|
|
|
137
138
|
|
|
138
139
|
export interface MetaTxnLog {
|
|
139
140
|
id: number
|
|
141
|
+
projectId: number
|
|
140
142
|
txnHash: string
|
|
141
143
|
txnNonce: string
|
|
142
144
|
metaTxnID?: string
|
|
@@ -158,6 +160,7 @@ export interface MetaTxnLog {
|
|
|
158
160
|
gasEstimated: number
|
|
159
161
|
gasFeeMarkup?: number
|
|
160
162
|
usdRate: string
|
|
163
|
+
creditsUsed: number
|
|
161
164
|
isWhitelisted: boolean
|
|
162
165
|
gasSponsor?: number
|
|
163
166
|
gasTank?: number
|
|
@@ -250,6 +253,7 @@ export interface FeeToken {
|
|
|
250
253
|
export interface Page {
|
|
251
254
|
pageSize?: number
|
|
252
255
|
page?: number
|
|
256
|
+
more?: boolean
|
|
253
257
|
totalRecords?: number
|
|
254
258
|
column?: string
|
|
255
259
|
before?: any
|
|
@@ -276,6 +280,7 @@ export interface Relayer {
|
|
|
276
280
|
feeTokens(headers?: object): Promise<FeeTokensReturn>
|
|
277
281
|
feeOptions(args: FeeOptionsArgs, headers?: object): Promise<FeeOptionsReturn>
|
|
278
282
|
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>
|
|
283
|
+
getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object): Promise<GetMetaTransactionsReturn>
|
|
279
284
|
sentTransactions(args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn>
|
|
280
285
|
pendingTransactions(args: PendingTransactionsArgs, headers?: object): Promise<PendingTransactionsReturn>
|
|
281
286
|
getGasTank(args: GetGasTankArgs, headers?: object): Promise<GetGasTankReturn>
|
|
@@ -380,6 +385,7 @@ export interface FeeOptionsArgs {
|
|
|
380
385
|
|
|
381
386
|
export interface FeeOptionsReturn {
|
|
382
387
|
options: Array<FeeOption>
|
|
388
|
+
sponsored: boolean
|
|
383
389
|
quote?: string
|
|
384
390
|
}
|
|
385
391
|
export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
@@ -390,6 +396,16 @@ export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
|
390
396
|
export interface GetMetaTxnNetworkFeeOptionsReturn {
|
|
391
397
|
options: Array<FeeOption>
|
|
392
398
|
}
|
|
399
|
+
export interface GetMetaTransactionsArgs {
|
|
400
|
+
projectId: number
|
|
401
|
+
gasTankId: number
|
|
402
|
+
page?: Page
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface GetMetaTransactionsReturn {
|
|
406
|
+
page: Page
|
|
407
|
+
transactions: Array<MetaTxnLog>
|
|
408
|
+
}
|
|
393
409
|
export interface SentTransactionsArgs {
|
|
394
410
|
filter?: SentTransactionsFilter
|
|
395
411
|
page?: Page
|
|
@@ -443,6 +459,7 @@ export interface GetGasSponsorReturn {
|
|
|
443
459
|
gasSponsor: GasSponsor
|
|
444
460
|
}
|
|
445
461
|
export interface ListGasSponsorsArgs {
|
|
462
|
+
projectId: number
|
|
446
463
|
gasTankId: number
|
|
447
464
|
page?: Page
|
|
448
465
|
}
|
|
@@ -452,6 +469,7 @@ export interface ListGasSponsorsReturn {
|
|
|
452
469
|
gasSponsors: Array<GasSponsor>
|
|
453
470
|
}
|
|
454
471
|
export interface AddGasSponsorArgs {
|
|
472
|
+
projectId: number
|
|
455
473
|
gasTankId: number
|
|
456
474
|
address: string
|
|
457
475
|
name?: string
|
|
@@ -480,6 +498,7 @@ export interface RemoveGasSponsorReturn {
|
|
|
480
498
|
status: boolean
|
|
481
499
|
}
|
|
482
500
|
export interface ReportGasSponsorUsageArgs {
|
|
501
|
+
projectId: number
|
|
483
502
|
gasTankId: number
|
|
484
503
|
startTime?: string
|
|
485
504
|
endTime?: string
|
|
@@ -657,6 +676,7 @@ export class Relayer implements Relayer {
|
|
|
657
676
|
return buildResponse(res).then(_data => {
|
|
658
677
|
return {
|
|
659
678
|
options: <Array<FeeOption>>_data.options,
|
|
679
|
+
sponsored: <boolean>_data.sponsored,
|
|
660
680
|
quote: <string>_data.quote
|
|
661
681
|
}
|
|
662
682
|
})
|
|
@@ -676,6 +696,17 @@ export class Relayer implements Relayer {
|
|
|
676
696
|
})
|
|
677
697
|
}
|
|
678
698
|
|
|
699
|
+
getMetaTransactions = (args: GetMetaTransactionsArgs, headers?: object): Promise<GetMetaTransactionsReturn> => {
|
|
700
|
+
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
701
|
+
return buildResponse(res).then(_data => {
|
|
702
|
+
return {
|
|
703
|
+
page: <Page>_data.page,
|
|
704
|
+
transactions: <Array<MetaTxnLog>>_data.transactions
|
|
705
|
+
}
|
|
706
|
+
})
|
|
707
|
+
})
|
|
708
|
+
}
|
|
709
|
+
|
|
679
710
|
sentTransactions = (args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn> => {
|
|
680
711
|
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
681
712
|
return buildResponse(res).then(_data => {
|