@0xsequence/account 2.0.20 → 2.0.21

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.
@@ -509,6 +509,31 @@ class Account {
509
509
  const chainedSignature = coder.chainSignatures(signature, chain);
510
510
  return coder.trim(chainedSignature);
511
511
  }
512
+ async publishWitnessFor(signers, chainId = 0) {
513
+ const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
514
+ const status = await this.status(chainId);
515
+ const allOfAll = this.coders.config.fromSimple({
516
+ threshold: signers.length,
517
+ checkpoint: 0,
518
+ signers: signers.map(s => ({
519
+ address: s,
520
+ weight: 1
521
+ }))
522
+ });
523
+ const wallet = this.walletFor(chainId, status.original.context, allOfAll, this.coders);
524
+ const signature = await wallet.signDigest(digest);
525
+ const decoded = this.coders.signature.decode(signature);
526
+ const signatures = this.coders.signature.signaturesOfDecoded(decoded);
527
+ if (signatures.length === 0) {
528
+ throw new Error("No signatures found");
529
+ }
530
+ return this.tracker.saveWitnesses({
531
+ wallet: this.address,
532
+ digest,
533
+ chainId,
534
+ signatures
535
+ });
536
+ }
512
537
  async publishWitness() {
513
538
  const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
514
539
  const signature = await this.signDigest(digest, 0, false);
@@ -509,6 +509,31 @@ class Account {
509
509
  const chainedSignature = coder.chainSignatures(signature, chain);
510
510
  return coder.trim(chainedSignature);
511
511
  }
512
+ async publishWitnessFor(signers, chainId = 0) {
513
+ const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
514
+ const status = await this.status(chainId);
515
+ const allOfAll = this.coders.config.fromSimple({
516
+ threshold: signers.length,
517
+ checkpoint: 0,
518
+ signers: signers.map(s => ({
519
+ address: s,
520
+ weight: 1
521
+ }))
522
+ });
523
+ const wallet = this.walletFor(chainId, status.original.context, allOfAll, this.coders);
524
+ const signature = await wallet.signDigest(digest);
525
+ const decoded = this.coders.signature.decode(signature);
526
+ const signatures = this.coders.signature.signaturesOfDecoded(decoded);
527
+ if (signatures.length === 0) {
528
+ throw new Error("No signatures found");
529
+ }
530
+ return this.tracker.saveWitnesses({
531
+ wallet: this.address,
532
+ digest,
533
+ chainId,
534
+ signatures
535
+ });
536
+ }
512
537
  async publishWitness() {
513
538
  const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
514
539
  const signature = await this.signDigest(digest, 0, false);
@@ -505,6 +505,31 @@ class Account {
505
505
  const chainedSignature = coder.chainSignatures(signature, chain);
506
506
  return coder.trim(chainedSignature);
507
507
  }
508
+ async publishWitnessFor(signers, chainId = 0) {
509
+ const digest = ethers.id(`This is a Sequence account woo! ${Date.now()}`);
510
+ const status = await this.status(chainId);
511
+ const allOfAll = this.coders.config.fromSimple({
512
+ threshold: signers.length,
513
+ checkpoint: 0,
514
+ signers: signers.map(s => ({
515
+ address: s,
516
+ weight: 1
517
+ }))
518
+ });
519
+ const wallet = this.walletFor(chainId, status.original.context, allOfAll, this.coders);
520
+ const signature = await wallet.signDigest(digest);
521
+ const decoded = this.coders.signature.decode(signature);
522
+ const signatures = this.coders.signature.signaturesOfDecoded(decoded);
523
+ if (signatures.length === 0) {
524
+ throw new Error("No signatures found");
525
+ }
526
+ return this.tracker.saveWitnesses({
527
+ wallet: this.address,
528
+ digest,
529
+ chainId,
530
+ signatures
531
+ });
532
+ }
508
533
  async publishWitness() {
509
534
  const digest = ethers.id(`This is a Sequence account woo! ${Date.now()}`);
510
535
  const signature = await this.signDigest(digest, 0, false);
@@ -86,6 +86,7 @@ export declare class Account {
86
86
  predecorateTransactions(txs: commons.transaction.Transactionish, status: AccountStatus, chainId: ethers.BigNumberish): Promise<commons.transaction.Transactionish>;
87
87
  decorateTransactions(bundles: commons.transaction.IntendedTransactionBundle | commons.transaction.IntendedTransactionBundle[], status: AccountStatus, chainId?: ethers.BigNumberish): Promise<commons.transaction.IntendedTransactionBundle>;
88
88
  decorateSignature<T extends ethers.BytesLike>(signature: T, status: Partial<Pick<AccountStatus, 'presignedConfigurations'>>): Promise<T | string>;
89
+ publishWitnessFor(signers: string[], chainId?: ethers.BigNumberish): Promise<void>;
89
90
  publishWitness(): Promise<void>;
90
91
  signDigest(digest: ethers.BytesLike, chainId: ethers.BigNumberish, decorate?: boolean, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw', metadata?: object): Promise<string>;
91
92
  buildOnChainSignature(digest: ethers.BytesLike): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/account",
3
- "version": "2.0.20",
3
+ "version": "2.0.21",
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",
@@ -12,21 +12,21 @@
12
12
  "ethers": ">=6"
13
13
  },
14
14
  "dependencies": {
15
- "@0xsequence/abi": "2.0.20",
16
- "@0xsequence/core": "2.0.20",
17
- "@0xsequence/migration": "2.0.20",
18
- "@0xsequence/network": "2.0.20",
19
- "@0xsequence/relayer": "2.0.20",
20
- "@0xsequence/wallet": "2.0.20",
21
- "@0xsequence/utils": "2.0.20",
22
- "@0xsequence/sessions": "2.0.20"
15
+ "@0xsequence/abi": "2.0.21",
16
+ "@0xsequence/core": "2.0.21",
17
+ "@0xsequence/migration": "2.0.21",
18
+ "@0xsequence/network": "2.0.21",
19
+ "@0xsequence/relayer": "2.0.21",
20
+ "@0xsequence/sessions": "2.0.21",
21
+ "@0xsequence/utils": "2.0.21",
22
+ "@0xsequence/wallet": "2.0.21"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
26
26
  "ethers": "6.13.4",
27
27
  "nyc": "^15.1.0",
28
- "@0xsequence/tests": "2.0.20",
29
- "@0xsequence/signhub": "2.0.20"
28
+ "@0xsequence/signhub": "2.0.21",
29
+ "@0xsequence/tests": "2.0.21"
30
30
  },
31
31
  "files": [
32
32
  "src",
package/src/account.ts CHANGED
@@ -490,6 +490,32 @@ export class Account {
490
490
  return coder.trim(chainedSignature)
491
491
  }
492
492
 
493
+ async publishWitnessFor(signers: string[], chainId: ethers.BigNumberish = 0): Promise<void> {
494
+ const digest = ethers.id(`This is a Sequence account woo! ${Date.now()}`)
495
+
496
+ const status = await this.status(chainId)
497
+ const allOfAll = this.coders.config.fromSimple({
498
+ threshold: signers.length,
499
+ checkpoint: 0,
500
+ signers: signers.map(s => ({
501
+ address: s,
502
+ weight: 1
503
+ })),
504
+ })
505
+
506
+ const wallet = this.walletFor(chainId, status.original.context, allOfAll, this.coders)
507
+ const signature = await wallet.signDigest(digest)
508
+
509
+ const decoded = this.coders.signature.decode(signature)
510
+ const signatures = this.coders.signature.signaturesOfDecoded(decoded)
511
+
512
+ if (signatures.length === 0) {
513
+ throw new Error("No signatures found")
514
+ }
515
+
516
+ return this.tracker.saveWitnesses({ wallet: this.address, digest, chainId, signatures })
517
+ }
518
+
493
519
  async publishWitness(): Promise<void> {
494
520
  const digest = ethers.id(`This is a Sequence account woo! ${Date.now()}`)
495
521
  const signature = await this.signDigest(digest, 0, false)