@0xsequence/account 2.0.19 → 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.
- package/dist/0xsequence-account.cjs.d.ts +1 -1
- package/dist/0xsequence-account.cjs.dev.js +31 -11
- package/dist/0xsequence-account.cjs.prod.js +31 -11
- package/dist/0xsequence-account.esm.js +31 -11
- package/dist/declarations/src/account.d.ts +1 -0
- package/package.json +14 -14
- package/src/account.ts +26 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./declarations/src/index";
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
2
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMHhzZXF1ZW5jZS1hY2NvdW50LmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
|
|
@@ -11,18 +11,13 @@ var wallet = require('@0xsequence/wallet');
|
|
|
11
11
|
var ethers = require('ethers');
|
|
12
12
|
|
|
13
13
|
function _extends() {
|
|
14
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
15
|
-
for (var
|
|
16
|
-
var
|
|
17
|
-
for (var
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
14
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
15
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
16
|
+
var t = arguments[e];
|
|
17
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
22
18
|
}
|
|
23
|
-
return
|
|
24
|
-
};
|
|
25
|
-
return _extends.apply(this, arguments);
|
|
19
|
+
return n;
|
|
20
|
+
}, _extends.apply(null, arguments);
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
function encodeGasRefundTransaction(option) {
|
|
@@ -514,6 +509,31 @@ class Account {
|
|
|
514
509
|
const chainedSignature = coder.chainSignatures(signature, chain);
|
|
515
510
|
return coder.trim(chainedSignature);
|
|
516
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
|
+
}
|
|
517
537
|
async publishWitness() {
|
|
518
538
|
const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
|
|
519
539
|
const signature = await this.signDigest(digest, 0, false);
|
|
@@ -11,18 +11,13 @@ var wallet = require('@0xsequence/wallet');
|
|
|
11
11
|
var ethers = require('ethers');
|
|
12
12
|
|
|
13
13
|
function _extends() {
|
|
14
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
15
|
-
for (var
|
|
16
|
-
var
|
|
17
|
-
for (var
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
14
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
15
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
16
|
+
var t = arguments[e];
|
|
17
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
22
18
|
}
|
|
23
|
-
return
|
|
24
|
-
};
|
|
25
|
-
return _extends.apply(this, arguments);
|
|
19
|
+
return n;
|
|
20
|
+
}, _extends.apply(null, arguments);
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
function encodeGasRefundTransaction(option) {
|
|
@@ -514,6 +509,31 @@ class Account {
|
|
|
514
509
|
const chainedSignature = coder.chainSignatures(signature, chain);
|
|
515
510
|
return coder.trim(chainedSignature);
|
|
516
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
|
+
}
|
|
517
537
|
async publishWitness() {
|
|
518
538
|
const digest = ethers.ethers.id(`This is a Sequence account woo! ${Date.now()}`);
|
|
519
539
|
const signature = await this.signDigest(digest, 0, false);
|
|
@@ -7,18 +7,13 @@ import { Wallet } from '@0xsequence/wallet';
|
|
|
7
7
|
import { ethers } from 'ethers';
|
|
8
8
|
|
|
9
9
|
function _extends() {
|
|
10
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
11
|
-
for (var
|
|
12
|
-
var
|
|
13
|
-
for (var
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
15
|
-
target[key] = source[key];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
10
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
11
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
12
|
+
var t = arguments[e];
|
|
13
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
18
14
|
}
|
|
19
|
-
return
|
|
20
|
-
};
|
|
21
|
-
return _extends.apply(this, arguments);
|
|
15
|
+
return n;
|
|
16
|
+
}, _extends.apply(null, arguments);
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
function encodeGasRefundTransaction(option) {
|
|
@@ -510,6 +505,31 @@ class Account {
|
|
|
510
505
|
const chainedSignature = coder.chainSignatures(signature, chain);
|
|
511
506
|
return coder.trim(chainedSignature);
|
|
512
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
|
+
}
|
|
513
533
|
async publishWitness() {
|
|
514
534
|
const digest = ethers.id(`This is a Sequence account woo! ${Date.now()}`);
|
|
515
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.
|
|
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",
|
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
"module": "dist/0xsequence-account.esm.js",
|
|
9
9
|
"author": "Horizon Blockchain Games",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@0xsequence/core": "2.0.19",
|
|
13
|
-
"@0xsequence/migration": "2.0.19",
|
|
14
|
-
"@0xsequence/abi": "2.0.19",
|
|
15
|
-
"@0xsequence/relayer": "2.0.19",
|
|
16
|
-
"@0xsequence/sessions": "2.0.19",
|
|
17
|
-
"@0xsequence/wallet": "2.0.19",
|
|
18
|
-
"@0xsequence/utils": "2.0.19",
|
|
19
|
-
"@0xsequence/network": "2.0.19"
|
|
20
|
-
},
|
|
21
11
|
"peerDependencies": {
|
|
22
12
|
"ethers": ">=6"
|
|
23
13
|
},
|
|
14
|
+
"dependencies": {
|
|
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
|
+
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
26
|
-
"ethers": "
|
|
26
|
+
"ethers": "6.13.4",
|
|
27
27
|
"nyc": "^15.1.0",
|
|
28
|
-
"@0xsequence/signhub": "2.0.
|
|
29
|
-
"@0xsequence/tests": "2.0.
|
|
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)
|