@0xsequence/account 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -262,7 +262,7 @@ class Account {
262
262
  if (bootstrapBundle.transactions.length === 0) {
263
263
  return bundle;
264
264
  }
265
- return {
265
+ const decoratedBundle = {
266
266
  entrypoint: bootstrapBundle.entrypoint,
267
267
  chainId: bundle.chainId,
268
268
  intent: bundle.intent,
@@ -275,6 +275,12 @@ class Account {
275
275
  value: 0
276
276
  }]
277
277
  };
278
+
279
+ // Re-compute the meta-transaction id to use the guest module subdigest
280
+ if (!status.onChain.deployed) {
281
+ decoratedBundle.intent.id = core.commons.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule, decoratedBundle.chainId, decoratedBundle.transactions);
282
+ }
283
+ return decoratedBundle;
278
284
  }
279
285
  decorateSignature(signature, status) {
280
286
  if (!status.presignedConfigurations || status.presignedConfigurations.length === 0) {
@@ -528,10 +534,11 @@ class Account {
528
534
  failedChains
529
535
  };
530
536
  }
531
- async sendSignedTransactions(signedBundle, chainId, quote, pstatus) {
537
+ async sendSignedTransactions(signedBundle, chainId, quote, pstatus, callback) {
532
538
  const status = pstatus || (await this.status(signedBundle.chainId));
533
539
  this.mustBeFullyMigrated(status);
534
540
  const decoratedBundle = this.decorateTransactions(signedBundle, status);
541
+ callback == null ? void 0 : callback(decoratedBundle);
535
542
  return this.relayer(chainId).relay(decoratedBundle, quote);
536
543
  }
537
544
  async fillGasLimits(txs, chainId, status) {
@@ -586,8 +593,8 @@ class Account {
586
593
  const status = await this.status(chainId);
587
594
  const predecorated = skipPreDecorate ? txs : await this.predecorateTransactions(txs, status, chainId);
588
595
  const signed = await this.signTransactions(predecorated, chainId);
589
- if (callback) callback(signed);
590
- return this.sendSignedTransactions(signed, chainId, quote);
596
+ // TODO: is it safe to pass status again here?
597
+ return this.sendSignedTransactions(signed, chainId, quote, undefined, callback);
591
598
  }
592
599
  async signTypedData(domain, types, message, chainId, cantValidateBehavior = 'ignore') {
593
600
  const digest = utils.encodeTypedDataDigest({
@@ -262,7 +262,7 @@ class Account {
262
262
  if (bootstrapBundle.transactions.length === 0) {
263
263
  return bundle;
264
264
  }
265
- return {
265
+ const decoratedBundle = {
266
266
  entrypoint: bootstrapBundle.entrypoint,
267
267
  chainId: bundle.chainId,
268
268
  intent: bundle.intent,
@@ -275,6 +275,12 @@ class Account {
275
275
  value: 0
276
276
  }]
277
277
  };
278
+
279
+ // Re-compute the meta-transaction id to use the guest module subdigest
280
+ if (!status.onChain.deployed) {
281
+ decoratedBundle.intent.id = core.commons.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule, decoratedBundle.chainId, decoratedBundle.transactions);
282
+ }
283
+ return decoratedBundle;
278
284
  }
279
285
  decorateSignature(signature, status) {
280
286
  if (!status.presignedConfigurations || status.presignedConfigurations.length === 0) {
@@ -528,10 +534,11 @@ class Account {
528
534
  failedChains
529
535
  };
530
536
  }
531
- async sendSignedTransactions(signedBundle, chainId, quote, pstatus) {
537
+ async sendSignedTransactions(signedBundle, chainId, quote, pstatus, callback) {
532
538
  const status = pstatus || (await this.status(signedBundle.chainId));
533
539
  this.mustBeFullyMigrated(status);
534
540
  const decoratedBundle = this.decorateTransactions(signedBundle, status);
541
+ callback == null ? void 0 : callback(decoratedBundle);
535
542
  return this.relayer(chainId).relay(decoratedBundle, quote);
536
543
  }
537
544
  async fillGasLimits(txs, chainId, status) {
@@ -586,8 +593,8 @@ class Account {
586
593
  const status = await this.status(chainId);
587
594
  const predecorated = skipPreDecorate ? txs : await this.predecorateTransactions(txs, status, chainId);
588
595
  const signed = await this.signTransactions(predecorated, chainId);
589
- if (callback) callback(signed);
590
- return this.sendSignedTransactions(signed, chainId, quote);
596
+ // TODO: is it safe to pass status again here?
597
+ return this.sendSignedTransactions(signed, chainId, quote, undefined, callback);
591
598
  }
592
599
  async signTypedData(domain, types, message, chainId, cantValidateBehavior = 'ignore') {
593
600
  const digest = utils.encodeTypedDataDigest({
@@ -258,7 +258,7 @@ class Account {
258
258
  if (bootstrapBundle.transactions.length === 0) {
259
259
  return bundle;
260
260
  }
261
- return {
261
+ const decoratedBundle = {
262
262
  entrypoint: bootstrapBundle.entrypoint,
263
263
  chainId: bundle.chainId,
264
264
  intent: bundle.intent,
@@ -271,6 +271,12 @@ class Account {
271
271
  value: 0
272
272
  }]
273
273
  };
274
+
275
+ // Re-compute the meta-transaction id to use the guest module subdigest
276
+ if (!status.onChain.deployed) {
277
+ decoratedBundle.intent.id = commons.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule, decoratedBundle.chainId, decoratedBundle.transactions);
278
+ }
279
+ return decoratedBundle;
274
280
  }
275
281
  decorateSignature(signature, status) {
276
282
  if (!status.presignedConfigurations || status.presignedConfigurations.length === 0) {
@@ -524,10 +530,11 @@ class Account {
524
530
  failedChains
525
531
  };
526
532
  }
527
- async sendSignedTransactions(signedBundle, chainId, quote, pstatus) {
533
+ async sendSignedTransactions(signedBundle, chainId, quote, pstatus, callback) {
528
534
  const status = pstatus || (await this.status(signedBundle.chainId));
529
535
  this.mustBeFullyMigrated(status);
530
536
  const decoratedBundle = this.decorateTransactions(signedBundle, status);
537
+ callback == null ? void 0 : callback(decoratedBundle);
531
538
  return this.relayer(chainId).relay(decoratedBundle, quote);
532
539
  }
533
540
  async fillGasLimits(txs, chainId, status) {
@@ -582,8 +589,8 @@ class Account {
582
589
  const status = await this.status(chainId);
583
590
  const predecorated = skipPreDecorate ? txs : await this.predecorateTransactions(txs, status, chainId);
584
591
  const signed = await this.signTransactions(predecorated, chainId);
585
- if (callback) callback(signed);
586
- return this.sendSignedTransactions(signed, chainId, quote);
592
+ // TODO: is it safe to pass status again here?
593
+ return this.sendSignedTransactions(signed, chainId, quote, undefined, callback);
587
594
  }
588
595
  async signTypedData(domain, types, message, chainId, cantValidateBehavior = 'ignore') {
589
596
  const digest = encodeTypedDataDigest({
@@ -111,7 +111,7 @@ export declare class Account {
111
111
  migratedAllChains: boolean;
112
112
  failedChains: number[];
113
113
  }>;
114
- sendSignedTransactions(signedBundle: commons.transaction.IntendedTransactionBundle, chainId: ethers.BigNumberish, quote?: FeeQuote, pstatus?: AccountStatus): Promise<ethers.providers.TransactionResponse>;
114
+ sendSignedTransactions(signedBundle: commons.transaction.IntendedTransactionBundle, chainId: ethers.BigNumberish, quote?: FeeQuote, pstatus?: AccountStatus, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void): Promise<ethers.providers.TransactionResponse>;
115
115
  fillGasLimits(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, status?: AccountStatus): Promise<commons.transaction.SimulatedTransaction[]>;
116
116
  gasRefundQuotes(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, stubSignatureOverrides: Map<string, string>, status?: AccountStatus): Promise<{
117
117
  options: FeeOption[];
@@ -123,7 +123,7 @@ export declare class Account {
123
123
  chainId: ethers.BigNumberish;
124
124
  stubSignatureOverrides: Map<string, string>;
125
125
  }): Promise<PreparedTransactions>;
126
- sendTransaction(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, quote?: FeeQuote, skipPreDecorate?: boolean, callback?: (signed: commons.transaction.SignedTransactionBundle) => void): Promise<ethers.providers.TransactionResponse>;
126
+ sendTransaction(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, quote?: FeeQuote, skipPreDecorate?: boolean, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void): Promise<ethers.providers.TransactionResponse>;
127
127
  signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, message: Record<string, any>, chainId: ethers.BigNumberish, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw'): Promise<string>;
128
128
  getAllSigners(): Promise<{
129
129
  address: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/account",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "tools for migrating sequence wallets to new versions",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/account",
6
6
  "source": "src/index.ts",
@@ -10,19 +10,19 @@
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "ethers": "^5.5.2",
13
- "@0xsequence/core": "1.1.4",
14
- "@0xsequence/migration": "1.1.4",
15
- "@0xsequence/network": "1.1.4",
16
- "@0xsequence/relayer": "1.1.4",
17
- "@0xsequence/sessions": "1.1.4",
18
- "@0xsequence/utils": "1.1.4",
19
- "@0xsequence/wallet": "1.1.4"
13
+ "@0xsequence/core": "1.1.5",
14
+ "@0xsequence/migration": "1.1.5",
15
+ "@0xsequence/network": "1.1.5",
16
+ "@0xsequence/relayer": "1.1.5",
17
+ "@0xsequence/sessions": "1.1.5",
18
+ "@0xsequence/utils": "1.1.5",
19
+ "@0xsequence/wallet": "1.1.5"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
23
23
  "nyc": "^15.1.0",
24
- "@0xsequence/signhub": "1.1.4",
25
- "@0xsequence/tests": "1.1.4"
24
+ "@0xsequence/signhub": "1.1.5",
25
+ "@0xsequence/tests": "1.1.5"
26
26
  },
27
27
  "files": [
28
28
  "src",
package/src/account.ts CHANGED
@@ -373,7 +373,7 @@ export class Account {
373
373
  return bundle
374
374
  }
375
375
 
376
- return {
376
+ const decoratedBundle = {
377
377
  entrypoint: bootstrapBundle.entrypoint,
378
378
  chainId: bundle.chainId,
379
379
  intent: bundle.intent,
@@ -389,6 +389,17 @@ export class Account {
389
389
  }
390
390
  ]
391
391
  }
392
+
393
+ // Re-compute the meta-transaction id to use the guest module subdigest
394
+ if (!status.onChain.deployed) {
395
+ decoratedBundle.intent.id = commons.transaction.subdigestOfGuestModuleTransactions(
396
+ this.contexts[this.version].guestModule,
397
+ decoratedBundle.chainId,
398
+ decoratedBundle.transactions
399
+ )
400
+ }
401
+
402
+ return decoratedBundle
392
403
  }
393
404
 
394
405
  decorateSignature<T extends ethers.BytesLike>(
@@ -691,12 +702,14 @@ export class Account {
691
702
  signedBundle: commons.transaction.IntendedTransactionBundle,
692
703
  chainId: ethers.BigNumberish,
693
704
  quote?: FeeQuote,
694
- pstatus?: AccountStatus
705
+ pstatus?: AccountStatus,
706
+ callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void
695
707
  ): Promise<ethers.providers.TransactionResponse> {
696
708
  const status = pstatus || (await this.status(signedBundle.chainId))
697
709
  this.mustBeFullyMigrated(status)
698
710
 
699
711
  const decoratedBundle = this.decorateTransactions(signedBundle, status)
712
+ callback?.(decoratedBundle)
700
713
 
701
714
  return this.relayer(chainId).relay(decoratedBundle, quote)
702
715
  }
@@ -775,13 +788,13 @@ export class Account {
775
788
  chainId: ethers.BigNumberish,
776
789
  quote?: FeeQuote,
777
790
  skipPreDecorate: boolean = false,
778
- callback?: (signed: commons.transaction.SignedTransactionBundle) => void
791
+ callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void
779
792
  ): Promise<ethers.providers.TransactionResponse> {
780
793
  const status = await this.status(chainId)
781
794
  const predecorated = skipPreDecorate ? txs : await this.predecorateTransactions(txs, status, chainId)
782
795
  const signed = await this.signTransactions(predecorated, chainId)
783
- if (callback) callback(signed)
784
- return this.sendSignedTransactions(signed, chainId, quote)
796
+ // TODO: is it safe to pass status again here?
797
+ return this.sendSignedTransactions(signed, chainId, quote, undefined, callback)
785
798
  }
786
799
 
787
800
  async signTypedData(