@0xsequence/account 1.5.0 → 1.6.0
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.
|
@@ -76,10 +76,10 @@ function encodeGasRefundTransaction(option) {
|
|
|
76
76
|
}
|
|
77
77
|
class AccountSigner {
|
|
78
78
|
constructor(account, chainId, options) {
|
|
79
|
-
this._isSigner = true;
|
|
80
79
|
this.account = account;
|
|
81
80
|
this.chainId = chainId;
|
|
82
81
|
this.options = options;
|
|
82
|
+
this._isSigner = true;
|
|
83
83
|
}
|
|
84
84
|
get provider() {
|
|
85
85
|
return this.account.providerFor(this.chainId);
|
|
@@ -142,7 +142,6 @@ class AccountSigner {
|
|
|
142
142
|
nonceSpace: this.options.nonceSpace
|
|
143
143
|
} : undefined); // Will always have a transaction response
|
|
144
144
|
}
|
|
145
|
-
|
|
146
145
|
getBalance(blockTag) {
|
|
147
146
|
return this.provider.getBalance(this.account.address, blockTag);
|
|
148
147
|
}
|
|
@@ -205,6 +204,14 @@ class Chain0Reader {
|
|
|
205
204
|
}
|
|
206
205
|
class Account {
|
|
207
206
|
constructor(options) {
|
|
207
|
+
this.address = void 0;
|
|
208
|
+
this.networks = void 0;
|
|
209
|
+
this.tracker = void 0;
|
|
210
|
+
this.contexts = void 0;
|
|
211
|
+
this.migrator = void 0;
|
|
212
|
+
this.migrations = void 0;
|
|
213
|
+
this.orchestrator = void 0;
|
|
214
|
+
this.jwt = void 0;
|
|
208
215
|
this.address = ethers.ethers.utils.getAddress(options.address);
|
|
209
216
|
this.contexts = options.contexts;
|
|
210
217
|
this.tracker = options.tracker;
|
|
@@ -678,9 +685,11 @@ class Account {
|
|
|
678
685
|
decorate: true,
|
|
679
686
|
cantValidateBehavior: 'ignore'
|
|
680
687
|
};
|
|
681
|
-
const
|
|
682
|
-
space: options == null ? void 0 : options.nonceSpace
|
|
683
|
-
|
|
688
|
+
const nonceOptions = (options == null ? void 0 : options.nonceSpace) && {
|
|
689
|
+
space: options == null ? void 0 : options.nonceSpace,
|
|
690
|
+
serial: options == null ? void 0 : options.serial
|
|
691
|
+
};
|
|
692
|
+
const signed = await wallet.signTransactions(txs, nonceOptions, metadata);
|
|
684
693
|
return _extends({}, signed, {
|
|
685
694
|
signature: await this.decorateSignature(signed.signature, status)
|
|
686
695
|
});
|
|
@@ -765,7 +774,7 @@ class Account {
|
|
|
765
774
|
const status = pstatus || (await this.status(chainId));
|
|
766
775
|
this.mustBeFullyMigrated(status);
|
|
767
776
|
const decoratedBundle = await this.decorateTransactions(signedBundle, status, chainId);
|
|
768
|
-
callback == null
|
|
777
|
+
callback == null || callback(decoratedBundle);
|
|
769
778
|
return this.relayer(chainId).relay(decoratedBundle, quote);
|
|
770
779
|
}
|
|
771
780
|
async fillGasLimits(txs, chainId, status) {
|
|
@@ -796,7 +805,6 @@ class Account {
|
|
|
796
805
|
entrypoint: this.address,
|
|
797
806
|
nonce: 0 // The relayer also ignored the nonce
|
|
798
807
|
};
|
|
799
|
-
|
|
800
808
|
const decoratedBundle = await this.decorateTransactions(signedBundle, wstatus);
|
|
801
809
|
const data = core.commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
802
810
|
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
@@ -76,10 +76,10 @@ function encodeGasRefundTransaction(option) {
|
|
|
76
76
|
}
|
|
77
77
|
class AccountSigner {
|
|
78
78
|
constructor(account, chainId, options) {
|
|
79
|
-
this._isSigner = true;
|
|
80
79
|
this.account = account;
|
|
81
80
|
this.chainId = chainId;
|
|
82
81
|
this.options = options;
|
|
82
|
+
this._isSigner = true;
|
|
83
83
|
}
|
|
84
84
|
get provider() {
|
|
85
85
|
return this.account.providerFor(this.chainId);
|
|
@@ -142,7 +142,6 @@ class AccountSigner {
|
|
|
142
142
|
nonceSpace: this.options.nonceSpace
|
|
143
143
|
} : undefined); // Will always have a transaction response
|
|
144
144
|
}
|
|
145
|
-
|
|
146
145
|
getBalance(blockTag) {
|
|
147
146
|
return this.provider.getBalance(this.account.address, blockTag);
|
|
148
147
|
}
|
|
@@ -205,6 +204,14 @@ class Chain0Reader {
|
|
|
205
204
|
}
|
|
206
205
|
class Account {
|
|
207
206
|
constructor(options) {
|
|
207
|
+
this.address = void 0;
|
|
208
|
+
this.networks = void 0;
|
|
209
|
+
this.tracker = void 0;
|
|
210
|
+
this.contexts = void 0;
|
|
211
|
+
this.migrator = void 0;
|
|
212
|
+
this.migrations = void 0;
|
|
213
|
+
this.orchestrator = void 0;
|
|
214
|
+
this.jwt = void 0;
|
|
208
215
|
this.address = ethers.ethers.utils.getAddress(options.address);
|
|
209
216
|
this.contexts = options.contexts;
|
|
210
217
|
this.tracker = options.tracker;
|
|
@@ -678,9 +685,11 @@ class Account {
|
|
|
678
685
|
decorate: true,
|
|
679
686
|
cantValidateBehavior: 'ignore'
|
|
680
687
|
};
|
|
681
|
-
const
|
|
682
|
-
space: options == null ? void 0 : options.nonceSpace
|
|
683
|
-
|
|
688
|
+
const nonceOptions = (options == null ? void 0 : options.nonceSpace) && {
|
|
689
|
+
space: options == null ? void 0 : options.nonceSpace,
|
|
690
|
+
serial: options == null ? void 0 : options.serial
|
|
691
|
+
};
|
|
692
|
+
const signed = await wallet.signTransactions(txs, nonceOptions, metadata);
|
|
684
693
|
return _extends({}, signed, {
|
|
685
694
|
signature: await this.decorateSignature(signed.signature, status)
|
|
686
695
|
});
|
|
@@ -765,7 +774,7 @@ class Account {
|
|
|
765
774
|
const status = pstatus || (await this.status(chainId));
|
|
766
775
|
this.mustBeFullyMigrated(status);
|
|
767
776
|
const decoratedBundle = await this.decorateTransactions(signedBundle, status, chainId);
|
|
768
|
-
callback == null
|
|
777
|
+
callback == null || callback(decoratedBundle);
|
|
769
778
|
return this.relayer(chainId).relay(decoratedBundle, quote);
|
|
770
779
|
}
|
|
771
780
|
async fillGasLimits(txs, chainId, status) {
|
|
@@ -796,7 +805,6 @@ class Account {
|
|
|
796
805
|
entrypoint: this.address,
|
|
797
806
|
nonce: 0 // The relayer also ignored the nonce
|
|
798
807
|
};
|
|
799
|
-
|
|
800
808
|
const decoratedBundle = await this.decorateTransactions(signedBundle, wstatus);
|
|
801
809
|
const data = core.commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
802
810
|
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
@@ -72,10 +72,10 @@ function encodeGasRefundTransaction(option) {
|
|
|
72
72
|
}
|
|
73
73
|
class AccountSigner {
|
|
74
74
|
constructor(account, chainId, options) {
|
|
75
|
-
this._isSigner = true;
|
|
76
75
|
this.account = account;
|
|
77
76
|
this.chainId = chainId;
|
|
78
77
|
this.options = options;
|
|
78
|
+
this._isSigner = true;
|
|
79
79
|
}
|
|
80
80
|
get provider() {
|
|
81
81
|
return this.account.providerFor(this.chainId);
|
|
@@ -138,7 +138,6 @@ class AccountSigner {
|
|
|
138
138
|
nonceSpace: this.options.nonceSpace
|
|
139
139
|
} : undefined); // Will always have a transaction response
|
|
140
140
|
}
|
|
141
|
-
|
|
142
141
|
getBalance(blockTag) {
|
|
143
142
|
return this.provider.getBalance(this.account.address, blockTag);
|
|
144
143
|
}
|
|
@@ -201,6 +200,14 @@ class Chain0Reader {
|
|
|
201
200
|
}
|
|
202
201
|
class Account {
|
|
203
202
|
constructor(options) {
|
|
203
|
+
this.address = void 0;
|
|
204
|
+
this.networks = void 0;
|
|
205
|
+
this.tracker = void 0;
|
|
206
|
+
this.contexts = void 0;
|
|
207
|
+
this.migrator = void 0;
|
|
208
|
+
this.migrations = void 0;
|
|
209
|
+
this.orchestrator = void 0;
|
|
210
|
+
this.jwt = void 0;
|
|
204
211
|
this.address = ethers.utils.getAddress(options.address);
|
|
205
212
|
this.contexts = options.contexts;
|
|
206
213
|
this.tracker = options.tracker;
|
|
@@ -674,9 +681,11 @@ class Account {
|
|
|
674
681
|
decorate: true,
|
|
675
682
|
cantValidateBehavior: 'ignore'
|
|
676
683
|
};
|
|
677
|
-
const
|
|
678
|
-
space: options == null ? void 0 : options.nonceSpace
|
|
679
|
-
|
|
684
|
+
const nonceOptions = (options == null ? void 0 : options.nonceSpace) && {
|
|
685
|
+
space: options == null ? void 0 : options.nonceSpace,
|
|
686
|
+
serial: options == null ? void 0 : options.serial
|
|
687
|
+
};
|
|
688
|
+
const signed = await wallet.signTransactions(txs, nonceOptions, metadata);
|
|
680
689
|
return _extends({}, signed, {
|
|
681
690
|
signature: await this.decorateSignature(signed.signature, status)
|
|
682
691
|
});
|
|
@@ -761,7 +770,7 @@ class Account {
|
|
|
761
770
|
const status = pstatus || (await this.status(chainId));
|
|
762
771
|
this.mustBeFullyMigrated(status);
|
|
763
772
|
const decoratedBundle = await this.decorateTransactions(signedBundle, status, chainId);
|
|
764
|
-
callback == null
|
|
773
|
+
callback == null || callback(decoratedBundle);
|
|
765
774
|
return this.relayer(chainId).relay(decoratedBundle, quote);
|
|
766
775
|
}
|
|
767
776
|
async fillGasLimits(txs, chainId, status) {
|
|
@@ -792,7 +801,6 @@ class Account {
|
|
|
792
801
|
entrypoint: this.address,
|
|
793
802
|
nonce: 0 // The relayer also ignored the nonce
|
|
794
803
|
};
|
|
795
|
-
|
|
796
804
|
const decoratedBundle = await this.decorateTransactions(signedBundle, wstatus);
|
|
797
805
|
const data = commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
798
806
|
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
@@ -109,6 +109,7 @@ export declare class Account {
|
|
|
109
109
|
signMessage(message: ethers.BytesLike, chainId: ethers.BigNumberish, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw'): Promise<string>;
|
|
110
110
|
signTransactions(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, pstatus?: AccountStatus, options?: {
|
|
111
111
|
nonceSpace?: ethers.BigNumberish;
|
|
112
|
+
serial?: boolean;
|
|
112
113
|
}): Promise<commons.transaction.SignedTransactionBundle>;
|
|
113
114
|
signMigrations(chainId: ethers.BigNumberish, editConfig: (prevConfig: commons.config.Config) => commons.config.Config): Promise<boolean>;
|
|
114
115
|
signAllMigrations(editConfig: (prevConfig: commons.config.Config) => commons.config.Config): Promise<{
|
|
@@ -136,6 +137,7 @@ export declare class Account {
|
|
|
136
137
|
}): Promise<PreparedTransactions>;
|
|
137
138
|
sendTransaction(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, quote?: FeeQuote, skipPreDecorate?: boolean, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void, options?: {
|
|
138
139
|
nonceSpace?: ethers.BigNumberish;
|
|
140
|
+
serial?: boolean;
|
|
139
141
|
}): Promise<ethers.providers.TransactionResponse | undefined>;
|
|
140
142
|
signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, message: Record<string, any>, chainId: ethers.BigNumberish, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw'): Promise<string>;
|
|
141
143
|
getSigners(): Promise<Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/account",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
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.
|
|
14
|
-
"@0xsequence/migration": "1.
|
|
15
|
-
"@0xsequence/network": "1.
|
|
16
|
-
"@0xsequence/relayer": "1.
|
|
17
|
-
"@0xsequence/sessions": "1.
|
|
18
|
-
"@0xsequence/utils": "1.
|
|
19
|
-
"@0xsequence/wallet": "1.
|
|
13
|
+
"@0xsequence/core": "1.6.0",
|
|
14
|
+
"@0xsequence/migration": "1.6.0",
|
|
15
|
+
"@0xsequence/network": "1.6.0",
|
|
16
|
+
"@0xsequence/relayer": "1.6.0",
|
|
17
|
+
"@0xsequence/sessions": "1.6.0",
|
|
18
|
+
"@0xsequence/utils": "1.6.0",
|
|
19
|
+
"@0xsequence/wallet": "1.6.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
23
23
|
"nyc": "^15.1.0",
|
|
24
|
-
"@0xsequence/
|
|
25
|
-
"@0xsequence/
|
|
24
|
+
"@0xsequence/tests": "1.6.0",
|
|
25
|
+
"@0xsequence/signhub": "1.6.0"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"src",
|
package/src/account.ts
CHANGED
|
@@ -669,6 +669,7 @@ export class Account {
|
|
|
669
669
|
pstatus?: AccountStatus,
|
|
670
670
|
options?: {
|
|
671
671
|
nonceSpace?: ethers.BigNumberish
|
|
672
|
+
serial?: boolean
|
|
672
673
|
}
|
|
673
674
|
): Promise<commons.transaction.SignedTransactionBundle> {
|
|
674
675
|
const status = pstatus || (await this.status(chainId))
|
|
@@ -685,7 +686,8 @@ export class Account {
|
|
|
685
686
|
cantValidateBehavior: 'ignore'
|
|
686
687
|
}
|
|
687
688
|
|
|
688
|
-
const
|
|
689
|
+
const nonceOptions = options?.nonceSpace && { space: options?.nonceSpace, serial: options?.serial }
|
|
690
|
+
const signed = await wallet.signTransactions(txs, nonceOptions, metadata)
|
|
689
691
|
|
|
690
692
|
return {
|
|
691
693
|
...signed,
|
|
@@ -871,6 +873,7 @@ export class Account {
|
|
|
871
873
|
callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void,
|
|
872
874
|
options?: {
|
|
873
875
|
nonceSpace?: ethers.BigNumberish
|
|
876
|
+
serial?: boolean
|
|
874
877
|
}
|
|
875
878
|
): Promise<ethers.providers.TransactionResponse | undefined> {
|
|
876
879
|
const status = await this.status(chainId)
|