@0xsequence/relayer 0.29.8 → 0.33.2
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/CHANGELOG.md +41 -0
- package/dist/0xsequence-relayer.cjs.dev.js +42 -13
- package/dist/0xsequence-relayer.cjs.prod.js +42 -13
- package/dist/0xsequence-relayer.esm.js +43 -14
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/provider-relayer.d.ts +5 -2
- package/dist/declarations/src/rpc-relayer/index.d.ts +2 -1
- package/dist/declarations/src/rpc-relayer/relayer.gen.d.ts +19 -1
- package/package.json +7 -7
- package/src/index.ts +3 -0
- package/src/provider-relayer.ts +21 -17
- package/src/rpc-relayer/index.ts +7 -1
- package/src/rpc-relayer/relayer.gen.ts +31 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @0xsequence/relayer
|
|
2
2
|
|
|
3
|
+
## 0.33.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @0xsequence/transactions@0.33.2
|
|
9
|
+
|
|
10
|
+
## 0.31.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- relayer: add Relayer.simulate
|
|
15
|
+
|
|
16
|
+
## 0.31.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- - upgrading to ethers v5.5
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @0xsequence/abi@0.31.0
|
|
26
|
+
- @0xsequence/config@0.31.0
|
|
27
|
+
- @0xsequence/transactions@0.31.0
|
|
28
|
+
- @0xsequence/utils@0.31.0
|
|
29
|
+
|
|
30
|
+
## 0.30.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- - upgrade most deps
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @0xsequence/abi@0.30.0
|
|
40
|
+
- @0xsequence/config@0.30.0
|
|
41
|
+
- @0xsequence/transactions@0.30.0
|
|
42
|
+
- @0xsequence/utils@0.30.0
|
|
43
|
+
|
|
3
44
|
## 0.29.8
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -129,11 +129,10 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
129
129
|
this.fromBlockLog = opts.fromBlockLog;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
async
|
|
132
|
+
async simulate(wallet, ...transactions) {
|
|
133
133
|
var _this = this;
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
const gasCosts = await Promise.all(transactions.map(async function (tx) {
|
|
135
|
+
return (await Promise.all(transactions.map(async function (tx) {
|
|
137
136
|
// Respect gasLimit request of the transaction (as long as its not 0)
|
|
138
137
|
if (tx.gasLimit && !ethers.ethers.BigNumber.from(tx.gasLimit || 0).eq(ethers.ethers.constants.Zero)) {
|
|
139
138
|
return tx.gasLimit;
|
|
@@ -145,7 +144,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
145
144
|
} // Fee can't be estimated for self-called if wallet hasn't been deployed
|
|
146
145
|
|
|
147
146
|
|
|
148
|
-
if (tx.to ===
|
|
147
|
+
if (tx.to === wallet && !(await _this.isWalletDeployed(wallet))) {
|
|
149
148
|
return DEFAULT_GAS_LIMIT;
|
|
150
149
|
}
|
|
151
150
|
|
|
@@ -156,16 +155,25 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
156
155
|
|
|
157
156
|
|
|
158
157
|
return _this.provider.estimateGas({
|
|
159
|
-
from:
|
|
158
|
+
from: wallet,
|
|
160
159
|
to: tx.to,
|
|
161
160
|
data: tx.data,
|
|
162
161
|
value: tx.value
|
|
163
162
|
});
|
|
163
|
+
}))).map(gasLimit => ({
|
|
164
|
+
executed: true,
|
|
165
|
+
succeeded: true,
|
|
166
|
+
gasLimit: ethers.ethers.BigNumber.from(gasLimit).toNumber(),
|
|
167
|
+
gasUsed: ethers.ethers.BigNumber.from(gasLimit).toNumber()
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async estimateGasLimits(config$1, context, ...transactions) {
|
|
172
|
+
const walletAddr = config.addressOf(config$1, context);
|
|
173
|
+
const results = await this.simulate(walletAddr, ...transactions);
|
|
174
|
+
return transactions.map((t, i) => _extends({}, t, {
|
|
175
|
+
gasLimit: results[i].gasLimit
|
|
164
176
|
}));
|
|
165
|
-
return transactions.map((t, i) => {
|
|
166
|
-
t.gasLimit = gasCosts[i];
|
|
167
|
-
return t;
|
|
168
|
-
});
|
|
169
177
|
}
|
|
170
178
|
|
|
171
179
|
async getNonce(config$1, context, space, blockTag) {
|
|
@@ -224,7 +232,9 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
224
232
|
l.topics[0] === "0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7" && l.data.length >= 64 && l.data.replace('0x', '').startsWith(normalMetaTxnId))); // If found return that
|
|
225
233
|
|
|
226
234
|
if (found) {
|
|
227
|
-
return _extends({
|
|
235
|
+
return _extends({
|
|
236
|
+
receipt: found
|
|
237
|
+
}, await this.provider.getTransaction(found.transactionHash));
|
|
228
238
|
} // Otherwise wait and try again
|
|
229
239
|
|
|
230
240
|
|
|
@@ -282,7 +292,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
282
292
|
}
|
|
283
293
|
|
|
284
294
|
/* eslint-disable */
|
|
285
|
-
// sequence-relayer v0.4.0
|
|
295
|
+
// sequence-relayer v0.4.0 1598ae8045a4f054fefc0fa3b244f61f75a7c8bd
|
|
286
296
|
// --
|
|
287
297
|
// This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
|
|
288
298
|
// Do not edit by hand. Update your webrpc schema and re-generate.
|
|
@@ -291,7 +301,7 @@ const WebRPCVersion = 'v1'; // Schema version of your RIDL schema
|
|
|
291
301
|
|
|
292
302
|
const WebRPCSchemaVersion = 'v0.4.0'; // Schema hash generated from your RIDL schema
|
|
293
303
|
|
|
294
|
-
const WebRPCSchemaHash = '
|
|
304
|
+
const WebRPCSchemaHash = '1598ae8045a4f054fefc0fa3b244f61f75a7c8bd'; //
|
|
295
305
|
// Types
|
|
296
306
|
//
|
|
297
307
|
|
|
@@ -423,6 +433,16 @@ class Relayer {
|
|
|
423
433
|
});
|
|
424
434
|
};
|
|
425
435
|
|
|
436
|
+
this.simulate = (args, headers) => {
|
|
437
|
+
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
|
|
438
|
+
return buildResponse(res).then(_data => {
|
|
439
|
+
return {
|
|
440
|
+
results: _data.results
|
|
441
|
+
};
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
|
|
426
446
|
this.updateMetaTxnGasLimits = (args, headers) => {
|
|
427
447
|
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers)).then(res => {
|
|
428
448
|
return buildResponse(res).then(_data => {
|
|
@@ -538,7 +558,7 @@ class RpcRelayer extends BaseRelayer {
|
|
|
538
558
|
constructor(options) {
|
|
539
559
|
super(options);
|
|
540
560
|
this.service = void 0;
|
|
541
|
-
this.service = new Relayer(options.url, fetchPonyfill__default[
|
|
561
|
+
this.service = new Relayer(options.url, fetchPonyfill__default["default"]().fetch);
|
|
542
562
|
}
|
|
543
563
|
|
|
544
564
|
async waitReceipt(metaTxnHash, wait = 1000) {
|
|
@@ -563,6 +583,15 @@ class RpcRelayer extends BaseRelayer {
|
|
|
563
583
|
return result;
|
|
564
584
|
}
|
|
565
585
|
|
|
586
|
+
async simulate(wallet, ...transactions$1) {
|
|
587
|
+
const coder = ethers.ethers.utils.defaultAbiCoder;
|
|
588
|
+
const encoded = coder.encode([transactions.MetaTransactionsType], [transactions.sequenceTxAbiEncode(transactions$1)]);
|
|
589
|
+
return (await this.service.simulate({
|
|
590
|
+
wallet,
|
|
591
|
+
transactions: encoded
|
|
592
|
+
})).results;
|
|
593
|
+
}
|
|
594
|
+
|
|
566
595
|
async estimateGasLimits(config$1, context, ...transactions$1) {
|
|
567
596
|
utils.logger.info(`[rpc-relayer/estimateGasLimits] estimate gas limits request ${JSON.stringify(transactions$1)}`);
|
|
568
597
|
|
|
@@ -129,11 +129,10 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
129
129
|
this.fromBlockLog = opts.fromBlockLog;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
async
|
|
132
|
+
async simulate(wallet, ...transactions) {
|
|
133
133
|
var _this = this;
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
const gasCosts = await Promise.all(transactions.map(async function (tx) {
|
|
135
|
+
return (await Promise.all(transactions.map(async function (tx) {
|
|
137
136
|
// Respect gasLimit request of the transaction (as long as its not 0)
|
|
138
137
|
if (tx.gasLimit && !ethers.ethers.BigNumber.from(tx.gasLimit || 0).eq(ethers.ethers.constants.Zero)) {
|
|
139
138
|
return tx.gasLimit;
|
|
@@ -145,7 +144,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
145
144
|
} // Fee can't be estimated for self-called if wallet hasn't been deployed
|
|
146
145
|
|
|
147
146
|
|
|
148
|
-
if (tx.to ===
|
|
147
|
+
if (tx.to === wallet && !(await _this.isWalletDeployed(wallet))) {
|
|
149
148
|
return DEFAULT_GAS_LIMIT;
|
|
150
149
|
}
|
|
151
150
|
|
|
@@ -156,16 +155,25 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
156
155
|
|
|
157
156
|
|
|
158
157
|
return _this.provider.estimateGas({
|
|
159
|
-
from:
|
|
158
|
+
from: wallet,
|
|
160
159
|
to: tx.to,
|
|
161
160
|
data: tx.data,
|
|
162
161
|
value: tx.value
|
|
163
162
|
});
|
|
163
|
+
}))).map(gasLimit => ({
|
|
164
|
+
executed: true,
|
|
165
|
+
succeeded: true,
|
|
166
|
+
gasLimit: ethers.ethers.BigNumber.from(gasLimit).toNumber(),
|
|
167
|
+
gasUsed: ethers.ethers.BigNumber.from(gasLimit).toNumber()
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async estimateGasLimits(config$1, context, ...transactions) {
|
|
172
|
+
const walletAddr = config.addressOf(config$1, context);
|
|
173
|
+
const results = await this.simulate(walletAddr, ...transactions);
|
|
174
|
+
return transactions.map((t, i) => _extends({}, t, {
|
|
175
|
+
gasLimit: results[i].gasLimit
|
|
164
176
|
}));
|
|
165
|
-
return transactions.map((t, i) => {
|
|
166
|
-
t.gasLimit = gasCosts[i];
|
|
167
|
-
return t;
|
|
168
|
-
});
|
|
169
177
|
}
|
|
170
178
|
|
|
171
179
|
async getNonce(config$1, context, space, blockTag) {
|
|
@@ -224,7 +232,9 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
224
232
|
l.topics[0] === "0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7" && l.data.length >= 64 && l.data.replace('0x', '').startsWith(normalMetaTxnId))); // If found return that
|
|
225
233
|
|
|
226
234
|
if (found) {
|
|
227
|
-
return _extends({
|
|
235
|
+
return _extends({
|
|
236
|
+
receipt: found
|
|
237
|
+
}, await this.provider.getTransaction(found.transactionHash));
|
|
228
238
|
} // Otherwise wait and try again
|
|
229
239
|
|
|
230
240
|
|
|
@@ -282,7 +292,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
282
292
|
}
|
|
283
293
|
|
|
284
294
|
/* eslint-disable */
|
|
285
|
-
// sequence-relayer v0.4.0
|
|
295
|
+
// sequence-relayer v0.4.0 1598ae8045a4f054fefc0fa3b244f61f75a7c8bd
|
|
286
296
|
// --
|
|
287
297
|
// This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
|
|
288
298
|
// Do not edit by hand. Update your webrpc schema and re-generate.
|
|
@@ -291,7 +301,7 @@ const WebRPCVersion = 'v1'; // Schema version of your RIDL schema
|
|
|
291
301
|
|
|
292
302
|
const WebRPCSchemaVersion = 'v0.4.0'; // Schema hash generated from your RIDL schema
|
|
293
303
|
|
|
294
|
-
const WebRPCSchemaHash = '
|
|
304
|
+
const WebRPCSchemaHash = '1598ae8045a4f054fefc0fa3b244f61f75a7c8bd'; //
|
|
295
305
|
// Types
|
|
296
306
|
//
|
|
297
307
|
|
|
@@ -423,6 +433,16 @@ class Relayer {
|
|
|
423
433
|
});
|
|
424
434
|
};
|
|
425
435
|
|
|
436
|
+
this.simulate = (args, headers) => {
|
|
437
|
+
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
|
|
438
|
+
return buildResponse(res).then(_data => {
|
|
439
|
+
return {
|
|
440
|
+
results: _data.results
|
|
441
|
+
};
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
|
|
426
446
|
this.updateMetaTxnGasLimits = (args, headers) => {
|
|
427
447
|
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers)).then(res => {
|
|
428
448
|
return buildResponse(res).then(_data => {
|
|
@@ -538,7 +558,7 @@ class RpcRelayer extends BaseRelayer {
|
|
|
538
558
|
constructor(options) {
|
|
539
559
|
super(options);
|
|
540
560
|
this.service = void 0;
|
|
541
|
-
this.service = new Relayer(options.url, fetchPonyfill__default[
|
|
561
|
+
this.service = new Relayer(options.url, fetchPonyfill__default["default"]().fetch);
|
|
542
562
|
}
|
|
543
563
|
|
|
544
564
|
async waitReceipt(metaTxnHash, wait = 1000) {
|
|
@@ -563,6 +583,15 @@ class RpcRelayer extends BaseRelayer {
|
|
|
563
583
|
return result;
|
|
564
584
|
}
|
|
565
585
|
|
|
586
|
+
async simulate(wallet, ...transactions$1) {
|
|
587
|
+
const coder = ethers.ethers.utils.defaultAbiCoder;
|
|
588
|
+
const encoded = coder.encode([transactions.MetaTransactionsType], [transactions.sequenceTxAbiEncode(transactions$1)]);
|
|
589
|
+
return (await this.service.simulate({
|
|
590
|
+
wallet,
|
|
591
|
+
transactions: encoded
|
|
592
|
+
})).results;
|
|
593
|
+
}
|
|
594
|
+
|
|
566
595
|
async estimateGasLimits(config$1, context, ...transactions$1) {
|
|
567
596
|
utils.logger.info(`[rpc-relayer/estimateGasLimits] estimate gas limits request ${JSON.stringify(transactions$1)}`);
|
|
568
597
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers, providers, Signer } from 'ethers';
|
|
2
2
|
import { Provider } from '@ethersproject/providers';
|
|
3
3
|
import { walletContracts } from '@0xsequence/abi';
|
|
4
|
-
import { sequenceTxAbiEncode, readSequenceNonce, encodeNonce, computeMetaTxnHash,
|
|
4
|
+
import { sequenceTxAbiEncode, readSequenceNonce, encodeNonce, computeMetaTxnHash, MetaTransactionsType, appendNonce, decodeNonce } from '@0xsequence/transactions';
|
|
5
5
|
import { imageHash, addressOf, encodeSignature } from '@0xsequence/config';
|
|
6
6
|
import { Interface } from 'ethers/lib/utils';
|
|
7
7
|
import { isBigNumberish, logger } from '@0xsequence/utils';
|
|
@@ -121,11 +121,10 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
121
121
|
this.fromBlockLog = opts.fromBlockLog;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
async
|
|
124
|
+
async simulate(wallet, ...transactions) {
|
|
125
125
|
var _this = this;
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
const gasCosts = await Promise.all(transactions.map(async function (tx) {
|
|
127
|
+
return (await Promise.all(transactions.map(async function (tx) {
|
|
129
128
|
// Respect gasLimit request of the transaction (as long as its not 0)
|
|
130
129
|
if (tx.gasLimit && !ethers.BigNumber.from(tx.gasLimit || 0).eq(ethers.constants.Zero)) {
|
|
131
130
|
return tx.gasLimit;
|
|
@@ -137,7 +136,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
137
136
|
} // Fee can't be estimated for self-called if wallet hasn't been deployed
|
|
138
137
|
|
|
139
138
|
|
|
140
|
-
if (tx.to ===
|
|
139
|
+
if (tx.to === wallet && !(await _this.isWalletDeployed(wallet))) {
|
|
141
140
|
return DEFAULT_GAS_LIMIT;
|
|
142
141
|
}
|
|
143
142
|
|
|
@@ -148,16 +147,25 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
148
147
|
|
|
149
148
|
|
|
150
149
|
return _this.provider.estimateGas({
|
|
151
|
-
from:
|
|
150
|
+
from: wallet,
|
|
152
151
|
to: tx.to,
|
|
153
152
|
data: tx.data,
|
|
154
153
|
value: tx.value
|
|
155
154
|
});
|
|
155
|
+
}))).map(gasLimit => ({
|
|
156
|
+
executed: true,
|
|
157
|
+
succeeded: true,
|
|
158
|
+
gasLimit: ethers.BigNumber.from(gasLimit).toNumber(),
|
|
159
|
+
gasUsed: ethers.BigNumber.from(gasLimit).toNumber()
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async estimateGasLimits(config, context, ...transactions) {
|
|
164
|
+
const walletAddr = addressOf(config, context);
|
|
165
|
+
const results = await this.simulate(walletAddr, ...transactions);
|
|
166
|
+
return transactions.map((t, i) => _extends({}, t, {
|
|
167
|
+
gasLimit: results[i].gasLimit
|
|
156
168
|
}));
|
|
157
|
-
return transactions.map((t, i) => {
|
|
158
|
-
t.gasLimit = gasCosts[i];
|
|
159
|
-
return t;
|
|
160
|
-
});
|
|
161
169
|
}
|
|
162
170
|
|
|
163
171
|
async getNonce(config, context, space, blockTag) {
|
|
@@ -216,7 +224,9 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
216
224
|
l.topics[0] === "0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7" && l.data.length >= 64 && l.data.replace('0x', '').startsWith(normalMetaTxnId))); // If found return that
|
|
217
225
|
|
|
218
226
|
if (found) {
|
|
219
|
-
return _extends({
|
|
227
|
+
return _extends({
|
|
228
|
+
receipt: found
|
|
229
|
+
}, await this.provider.getTransaction(found.transactionHash));
|
|
220
230
|
} // Otherwise wait and try again
|
|
221
231
|
|
|
222
232
|
|
|
@@ -274,7 +284,7 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
274
284
|
}
|
|
275
285
|
|
|
276
286
|
/* eslint-disable */
|
|
277
|
-
// sequence-relayer v0.4.0
|
|
287
|
+
// sequence-relayer v0.4.0 1598ae8045a4f054fefc0fa3b244f61f75a7c8bd
|
|
278
288
|
// --
|
|
279
289
|
// This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
|
|
280
290
|
// Do not edit by hand. Update your webrpc schema and re-generate.
|
|
@@ -283,7 +293,7 @@ const WebRPCVersion = 'v1'; // Schema version of your RIDL schema
|
|
|
283
293
|
|
|
284
294
|
const WebRPCSchemaVersion = 'v0.4.0'; // Schema hash generated from your RIDL schema
|
|
285
295
|
|
|
286
|
-
const WebRPCSchemaHash = '
|
|
296
|
+
const WebRPCSchemaHash = '1598ae8045a4f054fefc0fa3b244f61f75a7c8bd'; //
|
|
287
297
|
// Types
|
|
288
298
|
//
|
|
289
299
|
|
|
@@ -415,6 +425,16 @@ class Relayer {
|
|
|
415
425
|
});
|
|
416
426
|
};
|
|
417
427
|
|
|
428
|
+
this.simulate = (args, headers) => {
|
|
429
|
+
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
|
|
430
|
+
return buildResponse(res).then(_data => {
|
|
431
|
+
return {
|
|
432
|
+
results: _data.results
|
|
433
|
+
};
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
|
|
418
438
|
this.updateMetaTxnGasLimits = (args, headers) => {
|
|
419
439
|
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers)).then(res => {
|
|
420
440
|
return buildResponse(res).then(_data => {
|
|
@@ -555,6 +575,15 @@ class RpcRelayer extends BaseRelayer {
|
|
|
555
575
|
return result;
|
|
556
576
|
}
|
|
557
577
|
|
|
578
|
+
async simulate(wallet, ...transactions) {
|
|
579
|
+
const coder = ethers.utils.defaultAbiCoder;
|
|
580
|
+
const encoded = coder.encode([MetaTransactionsType], [sequenceTxAbiEncode(transactions)]);
|
|
581
|
+
return (await this.service.simulate({
|
|
582
|
+
wallet,
|
|
583
|
+
transactions: encoded
|
|
584
|
+
})).results;
|
|
585
|
+
}
|
|
586
|
+
|
|
558
587
|
async estimateGasLimits(config, context, ...transactions) {
|
|
559
588
|
logger.info(`[rpc-relayer/estimateGasLimits] estimate gas limits request ${JSON.stringify(transactions)}`);
|
|
560
589
|
|
|
@@ -4,6 +4,7 @@ import { WalletContext } from '@0xsequence/network';
|
|
|
4
4
|
import { WalletConfig } from '@0xsequence/config';
|
|
5
5
|
import { proto } from './rpc-relayer';
|
|
6
6
|
export interface Relayer {
|
|
7
|
+
simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]>;
|
|
7
8
|
estimateGasLimits(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<Transaction[]>;
|
|
8
9
|
gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
9
10
|
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish, blockTag?: providers.BlockTag): Promise<ethers.BigNumberish>;
|
|
@@ -15,5 +16,6 @@ export * from './base-relayer';
|
|
|
15
16
|
export * from './provider-relayer';
|
|
16
17
|
export * from './rpc-relayer';
|
|
17
18
|
export { proto as RpcRelayerProto } from './rpc-relayer';
|
|
19
|
+
export declare type SimulateResult = proto.SimulateResult;
|
|
18
20
|
export declare type FeeOption = proto.FeeOption;
|
|
19
21
|
export declare function isRelayer(cand: any): cand is Relayer;
|
|
@@ -4,7 +4,7 @@ import { SignedTransactions, Transaction } from '@0xsequence/transactions';
|
|
|
4
4
|
import { WalletContext } from '@0xsequence/network';
|
|
5
5
|
import { WalletConfig } from '@0xsequence/config';
|
|
6
6
|
import { BaseRelayer, BaseRelayerOptions } from './base-relayer';
|
|
7
|
-
import { FeeOption, Relayer } from '.';
|
|
7
|
+
import { FeeOption, Relayer, SimulateResult } from '.';
|
|
8
8
|
import { Optionals, Mask } from '@0xsequence/utils';
|
|
9
9
|
export interface ProviderRelayerOptions extends BaseRelayerOptions {
|
|
10
10
|
provider: Provider;
|
|
@@ -22,7 +22,10 @@ export declare abstract class ProviderRelayer extends BaseRelayer implements Rel
|
|
|
22
22
|
constructor(options: ProviderRelayerOptions);
|
|
23
23
|
abstract gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
24
24
|
abstract relay(signedTxs: SignedTransactions): Promise<TransactionResponse>;
|
|
25
|
+
simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]>;
|
|
25
26
|
estimateGasLimits(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<Transaction[]>;
|
|
26
27
|
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish, blockTag?: BlockTag): Promise<ethers.BigNumberish>;
|
|
27
|
-
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<providers.TransactionResponse &
|
|
28
|
+
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<providers.TransactionResponse & {
|
|
29
|
+
receipt: providers.TransactionReceipt;
|
|
30
|
+
}>;
|
|
28
31
|
}
|
|
@@ -2,7 +2,7 @@ import { TransactionResponse } from '@ethersproject/providers';
|
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { Transaction, SignedTransactions } from '@0xsequence/transactions';
|
|
4
4
|
import { BaseRelayer, BaseRelayerOptions } from '../base-relayer';
|
|
5
|
-
import { FeeOption, Relayer } from '..';
|
|
5
|
+
import { FeeOption, Relayer, SimulateResult } from '..';
|
|
6
6
|
import { WalletContext } from '@0xsequence/network';
|
|
7
7
|
import { WalletConfig } from '@0xsequence/config';
|
|
8
8
|
import * as proto from './relayer.gen';
|
|
@@ -15,6 +15,7 @@ export declare class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
15
15
|
private readonly service;
|
|
16
16
|
constructor(options: RpcRelayerOptions);
|
|
17
17
|
waitReceipt(metaTxnHash: string | SignedTransactions, wait?: number): Promise<proto.GetMetaTxnReceiptReturn>;
|
|
18
|
+
simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]>;
|
|
18
19
|
estimateGasLimits(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<Transaction[]>;
|
|
19
20
|
gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
20
21
|
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish): Promise<ethers.BigNumberish>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const WebRPCVersion = "v1";
|
|
2
2
|
export declare const WebRPCSchemaVersion = "v0.4.0";
|
|
3
|
-
export declare const WebRPCSchemaHash = "
|
|
3
|
+
export declare const WebRPCSchemaHash = "1598ae8045a4f054fefc0fa3b244f61f75a7c8bd";
|
|
4
4
|
export declare enum ETHTxnStatus {
|
|
5
5
|
UNKNOWN = "UNKNOWN",
|
|
6
6
|
DROPPED = "DROPPED",
|
|
@@ -79,6 +79,7 @@ export interface MetaTxnLog {
|
|
|
79
79
|
metaTxnID?: string;
|
|
80
80
|
txnStatus: ETHTxnStatus;
|
|
81
81
|
txnRevertReason: string;
|
|
82
|
+
requeues: number;
|
|
82
83
|
target: string;
|
|
83
84
|
input: string;
|
|
84
85
|
txnArgs: {
|
|
@@ -145,6 +146,14 @@ export interface SentTransactionsFilter {
|
|
|
145
146
|
pending?: boolean;
|
|
146
147
|
failed?: boolean;
|
|
147
148
|
}
|
|
149
|
+
export interface SimulateResult {
|
|
150
|
+
executed: boolean;
|
|
151
|
+
succeeded: boolean;
|
|
152
|
+
result?: string;
|
|
153
|
+
reason?: string;
|
|
154
|
+
gasUsed: number;
|
|
155
|
+
gasLimit: number;
|
|
156
|
+
}
|
|
148
157
|
export interface FeeOption {
|
|
149
158
|
token: FeeToken;
|
|
150
159
|
to: string;
|
|
@@ -184,6 +193,7 @@ export interface Relayer {
|
|
|
184
193
|
sendMetaTxn(args: SendMetaTxnArgs, headers?: object): Promise<SendMetaTxnReturn>;
|
|
185
194
|
getMetaTxnNonce(args: GetMetaTxnNonceArgs, headers?: object): Promise<GetMetaTxnNonceReturn>;
|
|
186
195
|
getMetaTxnReceipt(args: GetMetaTxnReceiptArgs, headers?: object): Promise<GetMetaTxnReceiptReturn>;
|
|
196
|
+
simulate(args: SimulateArgs, headers?: object): Promise<SimulateReturn>;
|
|
187
197
|
updateMetaTxnGasLimits(args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn>;
|
|
188
198
|
feeTokens(headers?: object): Promise<FeeTokensReturn>;
|
|
189
199
|
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
|
@@ -235,6 +245,13 @@ export interface GetMetaTxnReceiptArgs {
|
|
|
235
245
|
export interface GetMetaTxnReceiptReturn {
|
|
236
246
|
receipt: MetaTxnReceipt;
|
|
237
247
|
}
|
|
248
|
+
export interface SimulateArgs {
|
|
249
|
+
wallet: string;
|
|
250
|
+
transactions: string;
|
|
251
|
+
}
|
|
252
|
+
export interface SimulateReturn {
|
|
253
|
+
results: Array<SimulateResult>;
|
|
254
|
+
}
|
|
238
255
|
export interface UpdateMetaTxnGasLimitsArgs {
|
|
239
256
|
walletAddress: string;
|
|
240
257
|
walletConfig: WalletConfig;
|
|
@@ -285,6 +302,7 @@ export declare class Relayer implements Relayer {
|
|
|
285
302
|
sendMetaTxn: (args: SendMetaTxnArgs, headers?: object | undefined) => Promise<SendMetaTxnReturn>;
|
|
286
303
|
getMetaTxnNonce: (args: GetMetaTxnNonceArgs, headers?: object | undefined) => Promise<GetMetaTxnNonceReturn>;
|
|
287
304
|
getMetaTxnReceipt: (args: GetMetaTxnReceiptArgs, headers?: object | undefined) => Promise<GetMetaTxnReceiptReturn>;
|
|
305
|
+
simulate: (args: SimulateArgs, headers?: object | undefined) => Promise<SimulateReturn>;
|
|
288
306
|
updateMetaTxnGasLimits: (args: UpdateMetaTxnGasLimitsArgs, headers?: object | undefined) => Promise<UpdateMetaTxnGasLimitsReturn>;
|
|
289
307
|
feeTokens: (headers?: object | undefined) => Promise<FeeTokensReturn>;
|
|
290
308
|
getMetaTxnNetworkFeeOptions: (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object | undefined) => Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.2",
|
|
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",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"typecheck": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@0xsequence/abi": "^0.
|
|
21
|
-
"@0xsequence/config": "^0.
|
|
22
|
-
"@0xsequence/transactions": "^0.
|
|
23
|
-
"@0xsequence/utils": "^0.
|
|
24
|
-
"@ethersproject/providers": "^5.0
|
|
25
|
-
"ethers": "^5.
|
|
20
|
+
"@0xsequence/abi": "^0.31.0",
|
|
21
|
+
"@0xsequence/config": "^0.31.0",
|
|
22
|
+
"@0xsequence/transactions": "^0.33.2",
|
|
23
|
+
"@0xsequence/utils": "^0.31.0",
|
|
24
|
+
"@ethersproject/providers": "^5.5.0",
|
|
25
|
+
"ethers": "^5.5.1",
|
|
26
26
|
"fetch-ponyfill": "^7.1.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {},
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { WalletConfig } from '@0xsequence/config'
|
|
|
5
5
|
import { proto } from './rpc-relayer'
|
|
6
6
|
|
|
7
7
|
export interface Relayer {
|
|
8
|
+
// simulate returns the execution results for a list of transactions.
|
|
9
|
+
simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]>
|
|
8
10
|
|
|
9
11
|
// estimateGasLimits will estimate the gas utilization from the transaction
|
|
10
12
|
// before submission.
|
|
@@ -39,6 +41,7 @@ export * from './base-relayer'
|
|
|
39
41
|
export * from './provider-relayer'
|
|
40
42
|
export * from './rpc-relayer'
|
|
41
43
|
export { proto as RpcRelayerProto } from './rpc-relayer'
|
|
44
|
+
export type SimulateResult = proto.SimulateResult
|
|
42
45
|
export type FeeOption = proto.FeeOption
|
|
43
46
|
|
|
44
47
|
export function isRelayer(cand: any): cand is Relayer {
|
package/src/provider-relayer.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { computeMetaTxnHash, encodeNonce, SignedTransactions, Transaction } from
|
|
|
5
5
|
import { WalletContext } from '@0xsequence/network'
|
|
6
6
|
import { WalletConfig, addressOf } from '@0xsequence/config'
|
|
7
7
|
import { BaseRelayer, BaseRelayerOptions } from './base-relayer'
|
|
8
|
-
import { FeeOption, Relayer } from '.'
|
|
8
|
+
import { FeeOption, Relayer, SimulateResult } from '.'
|
|
9
9
|
import { Optionals, Mask } from '@0xsequence/utils'
|
|
10
10
|
|
|
11
11
|
const DEFAULT_GAS_LIMIT = ethers.BigNumber.from(800000)
|
|
@@ -45,14 +45,8 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
45
45
|
abstract gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>
|
|
46
46
|
abstract relay(signedTxs: SignedTransactions): Promise<TransactionResponse>
|
|
47
47
|
|
|
48
|
-
async
|
|
49
|
-
|
|
50
|
-
context: WalletContext,
|
|
51
|
-
...transactions: Transaction[]
|
|
52
|
-
): Promise<Transaction[]> {
|
|
53
|
-
const walletAddr = addressOf(config, context)
|
|
54
|
-
|
|
55
|
-
const gasCosts = await Promise.all(transactions.map(async tx => {
|
|
48
|
+
async simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]> {
|
|
49
|
+
return (await Promise.all(transactions.map(async tx => {
|
|
56
50
|
// Respect gasLimit request of the transaction (as long as its not 0)
|
|
57
51
|
if (tx.gasLimit && !ethers.BigNumber.from(tx.gasLimit || 0).eq(ethers.constants.Zero)) {
|
|
58
52
|
return tx.gasLimit
|
|
@@ -64,7 +58,7 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
64
58
|
}
|
|
65
59
|
|
|
66
60
|
// Fee can't be estimated for self-called if wallet hasn't been deployed
|
|
67
|
-
if (tx.to ===
|
|
61
|
+
if (tx.to === wallet && !(await this.isWalletDeployed(wallet))) {
|
|
68
62
|
return DEFAULT_GAS_LIMIT
|
|
69
63
|
}
|
|
70
64
|
|
|
@@ -75,17 +69,27 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
75
69
|
// TODO: If the wallet address has been deployed, gas limits can be
|
|
76
70
|
// estimated with more accurately by using self-calls with the batch transactions one by one
|
|
77
71
|
return this.provider.estimateGas({
|
|
78
|
-
from:
|
|
72
|
+
from: wallet,
|
|
79
73
|
to: tx.to,
|
|
80
74
|
data: tx.data,
|
|
81
75
|
value: tx.value
|
|
82
76
|
})
|
|
77
|
+
}))).map(gasLimit => ({
|
|
78
|
+
executed: true,
|
|
79
|
+
succeeded: true,
|
|
80
|
+
gasLimit: ethers.BigNumber.from(gasLimit).toNumber(),
|
|
81
|
+
gasUsed: ethers.BigNumber.from(gasLimit).toNumber()
|
|
83
82
|
}))
|
|
83
|
+
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
async estimateGasLimits(
|
|
86
|
+
config: WalletConfig,
|
|
87
|
+
context: WalletContext,
|
|
88
|
+
...transactions: Transaction[]
|
|
89
|
+
): Promise<Transaction[]> {
|
|
90
|
+
const walletAddr = addressOf(config, context)
|
|
91
|
+
const results = await this.simulate(walletAddr, ...transactions)
|
|
92
|
+
return transactions.map((t, i) => ({ ...t, gasLimit: results[i].gasLimit }))
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
async getNonce(
|
|
@@ -113,7 +117,7 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
113
117
|
return encodeNonce(space, nonce)
|
|
114
118
|
}
|
|
115
119
|
|
|
116
|
-
async wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<providers.TransactionResponse & providers.TransactionReceipt> {
|
|
120
|
+
async wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<providers.TransactionResponse & { receipt: providers.TransactionReceipt }> {
|
|
117
121
|
if (typeof metaTxnId !== 'string') {
|
|
118
122
|
console.log("computing id", metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions)
|
|
119
123
|
return this.wait(
|
|
@@ -164,7 +168,7 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
164
168
|
// If found return that
|
|
165
169
|
if (found) {
|
|
166
170
|
return {
|
|
167
|
-
|
|
171
|
+
receipt: found,
|
|
168
172
|
...await this.provider.getTransaction(found.transactionHash)
|
|
169
173
|
}
|
|
170
174
|
}
|
package/src/rpc-relayer/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
decodeNonce
|
|
13
13
|
} from '@0xsequence/transactions'
|
|
14
14
|
import { BaseRelayer, BaseRelayerOptions } from '../base-relayer'
|
|
15
|
-
import { FeeOption, Relayer } from '..'
|
|
15
|
+
import { FeeOption, Relayer, SimulateResult } from '..'
|
|
16
16
|
import { WalletContext } from '@0xsequence/network'
|
|
17
17
|
import { WalletConfig, addressOf } from '@0xsequence/config'
|
|
18
18
|
import { logger } from '@0xsequence/utils'
|
|
@@ -66,6 +66,12 @@ export class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
66
66
|
return result
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
async simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]> {
|
|
70
|
+
const coder = ethers.utils.defaultAbiCoder
|
|
71
|
+
const encoded = coder.encode([MetaTransactionsType], [sequenceTxAbiEncode(transactions)])
|
|
72
|
+
return (await this.service.simulate({ wallet, transactions: encoded })).results
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
async estimateGasLimits(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<Transaction[]> {
|
|
70
76
|
logger.info(`[rpc-relayer/estimateGasLimits] estimate gas limits request ${JSON.stringify(transactions)}`)
|
|
71
77
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-relayer v0.4.0
|
|
2
|
+
// sequence-relayer v0.4.0 1598ae8045a4f054fefc0fa3b244f61f75a7c8bd
|
|
3
3
|
// --
|
|
4
4
|
// This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
|
|
5
5
|
// Do not edit by hand. Update your webrpc schema and re-generate.
|
|
@@ -11,7 +11,7 @@ export const WebRPCVersion = 'v1'
|
|
|
11
11
|
export const WebRPCSchemaVersion = 'v0.4.0'
|
|
12
12
|
|
|
13
13
|
// Schema hash generated from your RIDL schema
|
|
14
|
-
export const WebRPCSchemaHash = '
|
|
14
|
+
export const WebRPCSchemaHash = '1598ae8045a4f054fefc0fa3b244f61f75a7c8bd'
|
|
15
15
|
|
|
16
16
|
//
|
|
17
17
|
// Types
|
|
@@ -105,6 +105,7 @@ export interface MetaTxnLog {
|
|
|
105
105
|
metaTxnID?: string
|
|
106
106
|
txnStatus: ETHTxnStatus
|
|
107
107
|
txnRevertReason: string
|
|
108
|
+
requeues: number
|
|
108
109
|
target: string
|
|
109
110
|
input: string
|
|
110
111
|
txnArgs: { [key: string]: any }
|
|
@@ -173,6 +174,15 @@ export interface SentTransactionsFilter {
|
|
|
173
174
|
failed?: boolean
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
export interface SimulateResult {
|
|
178
|
+
executed: boolean
|
|
179
|
+
succeeded: boolean
|
|
180
|
+
result?: string
|
|
181
|
+
reason?: string
|
|
182
|
+
gasUsed: number
|
|
183
|
+
gasLimit: number
|
|
184
|
+
}
|
|
185
|
+
|
|
176
186
|
export interface FeeOption {
|
|
177
187
|
token: FeeToken
|
|
178
188
|
to: string
|
|
@@ -216,6 +226,7 @@ export interface Relayer {
|
|
|
216
226
|
sendMetaTxn(args: SendMetaTxnArgs, headers?: object): Promise<SendMetaTxnReturn>
|
|
217
227
|
getMetaTxnNonce(args: GetMetaTxnNonceArgs, headers?: object): Promise<GetMetaTxnNonceReturn>
|
|
218
228
|
getMetaTxnReceipt(args: GetMetaTxnReceiptArgs, headers?: object): Promise<GetMetaTxnReceiptReturn>
|
|
229
|
+
simulate(args: SimulateArgs, headers?: object): Promise<SimulateReturn>
|
|
219
230
|
updateMetaTxnGasLimits(args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn>
|
|
220
231
|
feeTokens(headers?: object): Promise<FeeTokensReturn>
|
|
221
232
|
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>
|
|
@@ -271,6 +282,14 @@ export interface GetMetaTxnReceiptArgs {
|
|
|
271
282
|
export interface GetMetaTxnReceiptReturn {
|
|
272
283
|
receipt: MetaTxnReceipt
|
|
273
284
|
}
|
|
285
|
+
export interface SimulateArgs {
|
|
286
|
+
wallet: string
|
|
287
|
+
transactions: string
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface SimulateReturn {
|
|
291
|
+
results: Array<SimulateResult>
|
|
292
|
+
}
|
|
274
293
|
export interface UpdateMetaTxnGasLimitsArgs {
|
|
275
294
|
walletAddress: string
|
|
276
295
|
walletConfig: WalletConfig
|
|
@@ -410,6 +429,16 @@ export class Relayer implements Relayer {
|
|
|
410
429
|
})
|
|
411
430
|
}
|
|
412
431
|
|
|
432
|
+
simulate = (args: SimulateArgs, headers?: object): Promise<SimulateReturn> => {
|
|
433
|
+
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
|
|
434
|
+
return buildResponse(res).then(_data => {
|
|
435
|
+
return {
|
|
436
|
+
results: <Array<SimulateResult>>_data.results
|
|
437
|
+
}
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
}
|
|
441
|
+
|
|
413
442
|
updateMetaTxnGasLimits = (args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn> => {
|
|
414
443
|
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers)).then(res => {
|
|
415
444
|
return buildResponse(res).then(_data => {
|