@0xsequence/relayer 0.43.34 → 1.0.1

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.
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var ethers = require('ethers');
6
- var abi = require('@0xsequence/abi');
7
- var transactions = require('@0xsequence/transactions');
8
6
  var utils = require('@0xsequence/utils');
9
- var config = require('@0xsequence/config');
7
+ var abi = require('@0xsequence/abi');
8
+ var core = require('@0xsequence/core');
10
9
 
11
10
  function _extends() {
12
11
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -23,105 +22,6 @@ function _extends() {
23
22
  return _extends.apply(this, arguments);
24
23
  }
25
24
 
26
- function isBaseRelayerOptions(obj) {
27
- return obj.bundleCreation !== undefined && typeof obj.bundleCreation === 'boolean' || obj.creationGasLimit !== undefined && utils.isBigNumberish(obj.creationGasLimit) || obj.provider !== undefined && (ethers.providers.Provider.isProvider(obj.provider) || typeof obj.provider === 'string');
28
- }
29
- const BaseRelayerDefaults = {
30
- bundleCreation: true,
31
- creationGasLimit: ethers.ethers.constants.Two.pow(17)
32
- };
33
- class BaseRelayer {
34
- constructor(options) {
35
- this.provider = void 0;
36
- this.bundleCreation = void 0;
37
- this.creationGasLimit = void 0;
38
- const opts = _extends({}, BaseRelayerDefaults, options);
39
- this.bundleCreation = opts.bundleCreation;
40
- this.provider = opts.provider;
41
- this.creationGasLimit = ethers.ethers.BigNumber.from(opts.creationGasLimit);
42
- }
43
- async isWalletDeployed(walletAddress) {
44
- if (!this.provider) throw new Error('Bundled creation provider not found');
45
- return (await this.provider.getCode(walletAddress)) !== '0x';
46
- }
47
- prepareWalletDeploy(config$1, context) {
48
- const factoryInterface = new ethers.utils.Interface(abi.walletContracts.factory.abi);
49
- return {
50
- to: context.factory,
51
- data: factoryInterface.encodeFunctionData(factoryInterface.getFunction('deploy'), [context.mainModule, config.imageHash(config$1)])
52
- };
53
- }
54
- async prependWalletDeploy(signedTransactions) {
55
- const {
56
- config: config$1,
57
- context,
58
- transactions: transactions$1,
59
- nonce,
60
- signature
61
- } = signedTransactions;
62
- const walletAddress = config.addressOf(config$1, context);
63
- const walletInterface = new ethers.utils.Interface(abi.walletContracts.mainModule.abi);
64
- const encodedSignature = async function () {
65
- const sig = await signature;
66
- if (typeof sig === 'string') return sig;
67
- return config.encodeSignature(sig);
68
- }();
69
- if (this.bundleCreation && !(await this.isWalletDeployed(walletAddress))) {
70
- return {
71
- to: context.guestModule,
72
- execute: {
73
- transactions: [_extends({}, this.prepareWalletDeploy(config$1, context), {
74
- delegateCall: false,
75
- revertOnError: false,
76
- gasLimit: this.creationGasLimit,
77
- value: ethers.ethers.constants.Zero
78
- }), {
79
- delegateCall: false,
80
- revertOnError: true,
81
- gasLimit: ethers.ethers.constants.Zero,
82
- to: walletAddress,
83
- value: ethers.ethers.constants.Zero,
84
- data: walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [transactions.sequenceTxAbiEncode(transactions$1), nonce, await encodedSignature])
85
- }],
86
- nonce: ethers.ethers.constants.Zero,
87
- signature: '0x'
88
- }
89
- };
90
- } else {
91
- return {
92
- to: walletAddress,
93
- execute: {
94
- transactions: transactions$1,
95
- nonce: ethers.ethers.BigNumber.from(nonce),
96
- signature: await encodedSignature
97
- }
98
- };
99
- }
100
- }
101
- async prepareTransactions(config, context, signature, ...transactions$1) {
102
- //, gasLimit?: ethers.BigNumberish }> {
103
- const nonce = transactions.readSequenceNonce(...transactions$1);
104
- if (!nonce) {
105
- throw new Error('Unable to prepare transactions without a defined nonce');
106
- }
107
- const {
108
- to,
109
- execute
110
- } = await this.prependWalletDeploy({
111
- config,
112
- context,
113
- transactions: transactions$1,
114
- nonce,
115
- signature
116
- });
117
- const walletInterface = new ethers.utils.Interface(abi.walletContracts.mainModule.abi);
118
- return {
119
- to,
120
- data: walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [transactions.sequenceTxAbiEncode(execute.transactions), execute.nonce, execute.signature])
121
- };
122
- }
123
- }
124
-
125
25
  const DEFAULT_GAS_LIMIT = ethers.ethers.BigNumber.from(800000);
126
26
  const ProviderRelayerDefaults = {
127
27
  waitPollRate: 1000,
@@ -131,18 +31,10 @@ const ProviderRelayerDefaults = {
131
31
  function isProviderRelayerOptions(obj) {
132
32
  return obj.provider !== undefined && ethers.providers.Provider.isProvider(obj.provider);
133
33
  }
134
- class ProviderRelayer extends BaseRelayer {
34
+ class ProviderRelayer {
135
35
  constructor(options) {
136
- super(options);
137
- this.provider = void 0;
138
- this.waitPollRate = void 0;
139
- this.deltaBlocksLog = void 0;
140
- this.fromBlockLog = void 0;
141
36
  const opts = _extends({}, ProviderRelayerDefaults, options);
142
37
  this.provider = opts.provider;
143
- this.waitPollRate = opts.waitPollRate;
144
- this.deltaBlocksLog = opts.deltaBlocksLog;
145
- this.fromBlockLog = opts.fromBlockLog;
146
38
  }
147
39
  async simulate(wallet, ...transactions) {
148
40
  var _this = this;
@@ -158,7 +50,7 @@ class ProviderRelayer extends BaseRelayer {
158
50
  }
159
51
 
160
52
  // Fee can't be estimated for self-called if wallet hasn't been deployed
161
- if (tx.to === wallet && !(await _this.isWalletDeployed(wallet))) {
53
+ if (tx.to === wallet && (await _this.provider.getCode(wallet).then(code => ethers.ethers.utils.arrayify(code).length === 0))) {
162
54
  return DEFAULT_GAS_LIMIT;
163
55
  }
164
56
  if (!_this.provider) {
@@ -180,28 +72,26 @@ class ProviderRelayer extends BaseRelayer {
180
72
  gasLimit: ethers.ethers.BigNumber.from(gasLimit).toNumber()
181
73
  }));
182
74
  }
183
- async getNonce(config$1, context, space, blockTag) {
75
+ async getNonce(address, space, blockTag) {
184
76
  if (!this.provider) {
185
77
  throw new Error('provider is not set');
186
78
  }
187
- const addr = config.addressOf(config$1, context);
188
- if ((await this.provider.getCode(addr)) === '0x') {
79
+ if ((await this.provider.getCode(address)) === '0x') {
189
80
  return 0;
190
81
  }
191
82
  if (space === undefined) {
192
83
  space = 0;
193
84
  }
194
- const module = new ethers.ethers.Contract(addr, abi.walletContracts.mainModule.abi, this.provider);
85
+ const module = new ethers.ethers.Contract(address, abi.walletContracts.mainModule.abi, this.provider);
195
86
  const nonce = await module.readNonce(space, {
196
87
  blockTag: blockTag
197
88
  });
198
- return transactions.encodeNonce(space, nonce);
89
+ return core.commons.transaction.encodeNonce(space, nonce);
199
90
  }
200
91
  async wait(metaTxnId, timeout, delay = this.waitPollRate, maxFails = 5) {
201
92
  var _this2 = this;
202
93
  if (typeof metaTxnId !== 'string') {
203
- utils.logger.info('computing id', metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions);
204
- metaTxnId = transactions.computeMetaTxnHash(config.addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions);
94
+ metaTxnId = core.commons.transaction.intendedTransactionID(metaTxnId);
205
95
  }
206
96
  let timedOut = false;
207
97
  const retry = async function retry(f, errorMessage) {
@@ -289,31 +179,23 @@ class LocalRelayer extends ProviderRelayer {
289
179
  } : _extends({}, options, {
290
180
  provider: options.signer.provider
291
181
  }));
292
- this.signer = void 0;
293
- this.txnOptions = void 0;
294
182
  this.signer = ethers.Signer.isSigner(options) ? options : options.signer;
295
183
  if (!this.signer.provider) throw new Error("Signer must have a provider");
296
184
  }
297
- async deployWallet(config, context) {
298
- // NOTE: on hardhat some tests fail on HookCallerMock when not passing gasLimit directly as below,
299
- // and using eth_gasEstimate. Perhaps review HookCallerMock.sol and fix it to avoid what looks
300
- // like an infinite loop?
301
- const walletDeployTxn = this.prepareWalletDeploy(config, context);
302
-
303
- // NOTE: for hardhat to pass, we have to set the gasLimit directly, as its unable to estimate
304
- return this.signer.sendTransaction(_extends({}, walletDeployTxn, {
305
- gasLimit: ethers.ethers.constants.Two.pow(17)
306
- }));
185
+ async getFeeOptions(_address, ..._transactions) {
186
+ return {
187
+ options: []
188
+ };
307
189
  }
308
- async getFeeOptions(_config, _context, ..._transactions) {
190
+ async getFeeOptionsRaw(_entrypoint, _data) {
309
191
  return {
310
192
  options: []
311
193
  };
312
194
  }
313
- async gasRefundOptions(config, context, ...transactions) {
195
+ async gasRefundOptions(address, ...transactions) {
314
196
  const {
315
197
  options
316
- } = await this.getFeeOptions(config, context, ...transactions);
198
+ } = await this.getFeeOptions(address, ...transactions);
317
199
  return options;
318
200
  }
319
201
  setTransactionOptions(transactionRequest) {
@@ -323,15 +205,7 @@ class LocalRelayer extends ProviderRelayer {
323
205
  if (quote !== undefined) {
324
206
  utils.logger.warn(`LocalRelayer doesn't accept fee quotes`);
325
207
  }
326
- if (!signedTxs.context.guestModule || signedTxs.context.guestModule.length !== 42) {
327
- throw new Error('LocalRelayer requires the context.guestModule address');
328
- }
329
- const {
330
- to,
331
- execute
332
- } = await this.prependWalletDeploy(signedTxs);
333
- const walletInterface = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi);
334
- const data = walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [transactions.sequenceTxAbiEncode(execute.transactions), execute.nonce, execute.signature]);
208
+ const data = core.commons.transaction.encodeBundleExecData(signedTxs);
335
209
 
336
210
  // TODO: think about computing gas limit individually, summing together and passing across
337
211
  // NOTE: we expect that all txns have set their gasLimit ahead of time through proper estimation
@@ -339,9 +213,11 @@ class LocalRelayer extends ProviderRelayer {
339
213
  // txRequest.gasLimit = gasLimit
340
214
 
341
215
  const responsePromise = this.signer.sendTransaction(_extends({
342
- to,
216
+ to: signedTxs.entrypoint,
343
217
  data
344
- }, this.txnOptions));
218
+ }, this.txnOptions, {
219
+ gasLimit: 9000000
220
+ }));
345
221
  if (waitForReceipt) {
346
222
  const response = await responsePromise;
347
223
  response.receipt = await response.wait();
@@ -372,8 +248,7 @@ const WebRPCSchemaHash = "752f4f4274ca80d2fd974b5b44ed8245dfe40554";
372
248
  // Types
373
249
  //
374
250
 
375
- let ETHTxnStatus;
376
- (function (ETHTxnStatus) {
251
+ let ETHTxnStatus = /*#__PURE__*/function (ETHTxnStatus) {
377
252
  ETHTxnStatus["UNKNOWN"] = "UNKNOWN";
378
253
  ETHTxnStatus["DROPPED"] = "DROPPED";
379
254
  ETHTxnStatus["QUEUED"] = "QUEUED";
@@ -381,34 +256,33 @@ let ETHTxnStatus;
381
256
  ETHTxnStatus["SUCCEEDED"] = "SUCCEEDED";
382
257
  ETHTxnStatus["PARTIALLY_FAILED"] = "PARTIALLY_FAILED";
383
258
  ETHTxnStatus["FAILED"] = "FAILED";
384
- })(ETHTxnStatus || (ETHTxnStatus = {}));
385
- let TransferType;
386
- (function (TransferType) {
259
+ return ETHTxnStatus;
260
+ }({});
261
+ let TransferType = /*#__PURE__*/function (TransferType) {
387
262
  TransferType["SEND"] = "SEND";
388
263
  TransferType["RECEIVE"] = "RECEIVE";
389
264
  TransferType["BRIDGE_DEPOSIT"] = "BRIDGE_DEPOSIT";
390
265
  TransferType["BRIDGE_WITHDRAW"] = "BRIDGE_WITHDRAW";
391
266
  TransferType["BURN"] = "BURN";
392
267
  TransferType["UNKNOWN"] = "UNKNOWN";
393
- })(TransferType || (TransferType = {}));
394
- let FeeTokenType;
395
- (function (FeeTokenType) {
268
+ return TransferType;
269
+ }({});
270
+ let FeeTokenType = /*#__PURE__*/function (FeeTokenType) {
396
271
  FeeTokenType["UNKNOWN"] = "UNKNOWN";
397
272
  FeeTokenType["ERC20_TOKEN"] = "ERC20_TOKEN";
398
273
  FeeTokenType["ERC1155_TOKEN"] = "ERC1155_TOKEN";
399
- })(FeeTokenType || (FeeTokenType = {}));
400
- let SortOrder;
401
- (function (SortOrder) {
274
+ return FeeTokenType;
275
+ }({});
276
+ let SortOrder = /*#__PURE__*/function (SortOrder) {
402
277
  SortOrder["DESC"] = "DESC";
403
278
  SortOrder["ASC"] = "ASC";
404
- })(SortOrder || (SortOrder = {}));
279
+ return SortOrder;
280
+ }({});
405
281
  //
406
282
  // Client
407
283
  //
408
284
  class Relayer {
409
285
  constructor(hostname, fetch) {
410
- this.hostname = void 0;
411
- this.fetch = void 0;
412
286
  this.path = '/rpc/Relayer/';
413
287
  this.ping = headers => {
414
288
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
@@ -630,29 +504,27 @@ var relayer_gen = /*#__PURE__*/Object.freeze({
630
504
  WebRPCVersion: WebRPCVersion,
631
505
  WebRPCSchemaVersion: WebRPCSchemaVersion,
632
506
  WebRPCSchemaHash: WebRPCSchemaHash,
633
- get ETHTxnStatus () { return ETHTxnStatus; },
634
- get TransferType () { return TransferType; },
635
- get FeeTokenType () { return FeeTokenType; },
636
- get SortOrder () { return SortOrder; },
507
+ ETHTxnStatus: ETHTxnStatus,
508
+ TransferType: TransferType,
509
+ FeeTokenType: FeeTokenType,
510
+ SortOrder: SortOrder,
637
511
  Relayer: Relayer
638
512
  });
639
513
 
640
514
  const FINAL_STATUSES = [ETHTxnStatus.DROPPED, ETHTxnStatus.SUCCEEDED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.FAILED];
641
515
  const FAILED_STATUSES = [ETHTxnStatus.DROPPED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.FAILED];
642
516
  function isRpcRelayerOptions(obj) {
643
- return obj.url !== undefined && typeof obj.url === 'string';
517
+ return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && ethers.ethers.providers.Provider.isProvider(obj.provider);
644
518
  }
645
519
  const fetch = typeof global === 'object' ? global.fetch : window.fetch;
646
- class RpcRelayer extends BaseRelayer {
520
+ class RpcRelayer {
647
521
  constructor(options) {
648
- super(options);
649
- this.service = void 0;
650
522
  this.service = new Relayer(options.url, fetch);
523
+ this.provider = ethers.ethers.providers.Provider.isProvider(options.provider) ? options.provider : new ethers.ethers.providers.StaticJsonRpcProvider(utils.getDefaultConnectionInfo(options.provider.url));
651
524
  }
652
525
  async waitReceipt(metaTxnId, delay = 1000, maxFails = 5, isCancelled) {
653
526
  if (typeof metaTxnId !== 'string') {
654
- utils.logger.info('computing id', metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions);
655
- metaTxnId = transactions.computeMetaTxnHash(config.addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions);
527
+ metaTxnId = core.commons.transaction.intendedTransactionID(metaTxnId);
656
528
  }
657
529
  utils.logger.info(`[rpc-relayer/waitReceipt] waiting for ${metaTxnId}`);
658
530
  let fails = 0;
@@ -680,15 +552,15 @@ class RpcRelayer extends BaseRelayer {
680
552
  }
681
553
  throw new Error(`Cancelled waiting for transaction receipt ${metaTxnId}`);
682
554
  }
683
- async simulate(wallet, ...transactions$1) {
555
+ async simulate(wallet, ...transactions) {
684
556
  const coder = ethers.ethers.utils.defaultAbiCoder;
685
- const encoded = coder.encode([transactions.MetaTransactionsType], [transactions.sequenceTxAbiEncode(transactions$1)]);
557
+ const encoded = coder.encode([core.commons.transaction.MetaTransactionsType], [core.commons.transaction.sequenceTxAbiEncode(transactions)]);
686
558
  return (await this.service.simulate({
687
559
  wallet,
688
560
  transactions: encoded
689
561
  })).results;
690
562
  }
691
- async getFeeOptions(config$1, context, ...transactions$1) {
563
+ async getFeeOptions(address, ...transactions) {
692
564
  // NOTE/TODO: for a given `service` the feeTokens will not change between execution, so we should memoize this value
693
565
  // for a short-period of time, perhaps for 1 day or in memory. Perhaps one day we can make this happen automatically
694
566
  // with http cache response for this endpoint and service-worker.. lots of approaches
@@ -696,34 +568,22 @@ class RpcRelayer extends BaseRelayer {
696
568
  if (feeTokens.isFeeRequired) {
697
569
  const symbols = feeTokens.tokens.map(token => token.symbol).join(', ');
698
570
  utils.logger.info(`[rpc-relayer/getFeeOptions] relayer fees are required, accepted tokens are ${symbols}`);
699
- const wallet = config.addressOf(config$1, context);
700
- let nonce = transactions.readSequenceNonce(...transactions$1);
701
- if (nonce === undefined) {
702
- nonce = await this.getNonce(config$1, context);
703
- }
571
+ const nonce = await this.getNonce(address);
704
572
  if (!this.provider) {
705
573
  utils.logger.warn(`[rpc-relayer/getFeeOptions] provider not set, needed for stub signature`);
706
574
  throw new Error('provider is not set');
707
575
  }
708
- const {
709
- to,
710
- execute
711
- } = await this.prependWalletDeploy({
712
- config: config$1,
713
- context,
714
- transactions: transactions$1,
715
- nonce,
716
- signature: config.buildStubSignature(this.provider, config$1)
717
- });
718
- const walletInterface = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi);
719
- const data = walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [transactions.sequenceTxAbiEncode(execute.transactions), execute.nonce, execute.signature]);
720
576
  const {
721
577
  options,
722
578
  quote
723
579
  } = await this.service.feeOptions({
724
- wallet,
725
- to,
726
- data
580
+ wallet: address,
581
+ to: address,
582
+ data: core.commons.transaction.encodeBundleExecData({
583
+ entrypoint: address,
584
+ transactions,
585
+ nonce
586
+ })
727
587
  });
728
588
  utils.logger.info(`[rpc-relayer/getFeeOptions] got refund options ${JSON.stringify(options)}`);
729
589
  return {
@@ -740,23 +600,39 @@ class RpcRelayer extends BaseRelayer {
740
600
  };
741
601
  }
742
602
  }
743
- async gasRefundOptions(config, context, ...transactions) {
603
+ async getFeeOptionsRaw(entrypoint, data) {
604
+ const {
605
+ options,
606
+ quote
607
+ } = await this.service.feeOptions({
608
+ wallet: entrypoint,
609
+ to: entrypoint,
610
+ data: ethers.ethers.utils.hexlify(data)
611
+ });
612
+ return {
613
+ options,
614
+ quote: {
615
+ _tag: 'FeeQuote',
616
+ _quote: quote
617
+ }
618
+ };
619
+ }
620
+ async gasRefundOptions(address, ...transactions) {
744
621
  const {
745
622
  options
746
- } = await this.getFeeOptions(config, context, ...transactions);
623
+ } = await this.getFeeOptions(address, ...transactions);
747
624
  return options;
748
625
  }
749
- async getNonce(config$1, context, space) {
750
- const addr = config.addressOf(config$1, context);
751
- utils.logger.info(`[rpc-relayer/getNonce] get nonce for wallet ${addr} space: ${space}`);
626
+ async getNonce(address, space) {
627
+ utils.logger.info(`[rpc-relayer/getNonce] get nonce for wallet ${address} space: ${space}`);
752
628
  const encodedNonce = space !== undefined ? ethers.ethers.BigNumber.from(space).toHexString() : undefined;
753
629
  const resp = await this.service.getMetaTxnNonce({
754
- walletContractAddress: addr,
630
+ walletContractAddress: address,
755
631
  space: encodedNonce
756
632
  });
757
633
  const nonce = ethers.ethers.BigNumber.from(resp.nonce);
758
- const [decodedSpace, decodedNonce] = transactions.decodeNonce(nonce);
759
- utils.logger.info(`[rpc-relayer/getNonce] got next nonce for wallet ${addr} ${decodedNonce} space: ${decodedSpace}`);
634
+ const [decodedSpace, decodedNonce] = core.commons.transaction.decodeNonce(nonce);
635
+ utils.logger.info(`[rpc-relayer/getNonce] got next nonce for wallet ${address} ${decodedNonce} space: ${decodedSpace}`);
760
636
  return nonce;
761
637
  }
762
638
  async relay(signedTxs, quote, waitForReceipt = true) {
@@ -774,29 +650,23 @@ class RpcRelayer extends BaseRelayer {
774
650
  utils.logger.warn(`[rpc-relayer/relay] provider not set, failed relay`);
775
651
  throw new Error('provider is not set');
776
652
  }
777
- const {
778
- to: contract,
779
- execute
780
- } = await this.prependWalletDeploy(signedTxs);
781
- const walletAddress = config.addressOf(signedTxs.config, signedTxs.context);
782
- const walletInterface = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi);
783
- const input = walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [transactions.sequenceTxAbiEncode(execute.transactions), execute.nonce, execute.signature]);
653
+ const data = core.commons.transaction.encodeBundleExecData(signedTxs);
784
654
  const metaTxn = await this.service.sendMetaTxn({
785
655
  call: {
786
- walletAddress,
787
- contract,
788
- input
656
+ walletAddress: signedTxs.intent.wallet,
657
+ contract: signedTxs.entrypoint,
658
+ input: data
789
659
  },
790
660
  quote: typecheckedQuote
791
661
  });
792
662
  utils.logger.info(`[rpc-relayer/relay] got relay result ${JSON.stringify(metaTxn)}`);
793
663
  if (waitForReceipt) {
794
- return this.wait(metaTxn.txnHash);
664
+ return this.wait(signedTxs.intent.id);
795
665
  } else {
796
666
  const response = {
797
- hash: metaTxn.txnHash,
667
+ hash: signedTxs.intent.id,
798
668
  confirmations: 0,
799
- from: walletAddress,
669
+ from: signedTxs.intent.wallet,
800
670
  wait: _confirmations => Promise.reject(new Error('impossible'))
801
671
  };
802
672
  const wait = async function wait(confirmations) {
@@ -804,7 +674,7 @@ class RpcRelayer extends BaseRelayer {
804
674
  if (!_this.provider) {
805
675
  throw new Error('cannot wait for receipt, relayer has no provider set');
806
676
  }
807
- const waitResponse = await _this.wait(metaTxn.txnHash);
677
+ const waitResponse = await _this.wait(signedTxs.intent.id);
808
678
  const transactionHash = (_waitResponse$receipt = waitResponse.receipt) == null ? void 0 : _waitResponse$receipt.transactionHash;
809
679
  if (!transactionHash) {
810
680
  throw new Error('cannot wait for receipt, unknown native transaction hash');
@@ -833,7 +703,7 @@ class RpcRelayer extends BaseRelayer {
833
703
  blockHash: txReceipt.blockHash,
834
704
  blockNumber: ethers.ethers.BigNumber.from(txReceipt.blockNumber).toNumber(),
835
705
  confirmations: 1,
836
- from: typeof metaTxnId === 'string' ? undefined : config.addressOf(metaTxnId.config, metaTxnId.context),
706
+ from: typeof metaTxnId === 'string' ? undefined : metaTxnId.intent.wallet,
837
707
  hash: txReceipt.transactionHash,
838
708
  raw: receipt.txnReceipt,
839
709
  receipt: txReceipt,
@@ -850,18 +720,21 @@ class MetaTransactionResponseException {
850
720
  }
851
721
  }
852
722
 
723
+ // A fee quote is simply an opaque value that can be obtained via Relayer.getFeeOptions(), and
724
+ // returned back to the same relayer via Relayer.relay(). Fee quotes should be treated as an
725
+ // implementation detail of the relayer that produces them.
726
+ //
727
+ // This interface exists for type-safety purposes to protect against passing non-FeeQuotes to
728
+ // Relayer.relay(), or any other functions that call it indirectly (e.g. Account.sendTransaction).
853
729
  function isRelayer(cand) {
854
730
  return typeof cand === 'object' && typeof cand.simulate === 'function' && typeof cand.getFeeOptions === 'function' && typeof cand.gasRefundOptions === 'function' && typeof cand.getNonce === 'function' && typeof cand.relay === 'function' && typeof cand.wait === 'function';
855
731
  }
856
732
 
857
- exports.BaseRelayer = BaseRelayer;
858
- exports.BaseRelayerDefaults = BaseRelayerDefaults;
859
733
  exports.LocalRelayer = LocalRelayer;
860
734
  exports.ProviderRelayer = ProviderRelayer;
861
735
  exports.ProviderRelayerDefaults = ProviderRelayerDefaults;
862
736
  exports.RpcRelayer = RpcRelayer;
863
737
  exports.RpcRelayerProto = relayer_gen;
864
- exports.isBaseRelayerOptions = isBaseRelayerOptions;
865
738
  exports.isLocalRelayerOptions = isLocalRelayerOptions;
866
739
  exports.isProviderRelayerOptions = isProviderRelayerOptions;
867
740
  exports.isRelayer = isRelayer;