@0xsequence/account 1.2.8 → 1.2.9
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.dev.js +8 -5
- package/dist/0xsequence-account.cjs.prod.js +8 -5
- package/dist/0xsequence-account.esm.js +8 -5
- package/dist/declarations/src/account.d.ts +4 -1
- package/dist/declarations/src/signer.d.ts +3 -1
- package/package.json +10 -10
- package/src/account.ts +9 -3
- package/src/signer.ts +6 -2
|
@@ -126,13 +126,14 @@ class AccountSigner {
|
|
|
126
126
|
}
|
|
127
127
|
throw new Error('No fee option available - not enough balance');
|
|
128
128
|
}
|
|
129
|
-
async sendTransaction(txsPromise) {
|
|
129
|
+
async sendTransaction(txsPromise, options) {
|
|
130
130
|
var _this$options$stubSig, _this$options2, _this$options$selectF, _this$options3, _this$options4;
|
|
131
131
|
const txs = isDeferrable(txsPromise) ? await ethers.ethers.utils.resolveProperties(txsPromise) : txsPromise;
|
|
132
132
|
const prepare = await this.account.prepareTransactions({
|
|
133
133
|
txs,
|
|
134
134
|
chainId: this.chainId,
|
|
135
|
-
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map()
|
|
135
|
+
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map(),
|
|
136
|
+
simulateForFeeOptions: options == null ? void 0 : options.simulateForFeeOptions
|
|
136
137
|
});
|
|
137
138
|
const selectMethod = (_this$options$selectF = (_this$options3 = this.options) == null ? void 0 : _this$options3.selectFee) != null ? _this$options$selectF : this.defaultSelectFee.bind(this);
|
|
138
139
|
const feeOption = await selectMethod(txs, prepare.feeOptions);
|
|
@@ -710,7 +711,7 @@ class Account {
|
|
|
710
711
|
const wallet = this.walletForStatus(chainId, status || (await this.status(chainId)));
|
|
711
712
|
return wallet.fillGasLimits(txs);
|
|
712
713
|
}
|
|
713
|
-
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status) {
|
|
714
|
+
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status, options) {
|
|
714
715
|
const wstatus = status || (await this.status(chainId));
|
|
715
716
|
const wallet = this.walletForStatus(chainId, wstatus);
|
|
716
717
|
const predecorated = await this.predecorateTransactions(txs, wstatus, chainId);
|
|
@@ -737,7 +738,7 @@ class Account {
|
|
|
737
738
|
|
|
738
739
|
const decoratedBundle = this.decorateTransactions(signedBundle, wstatus);
|
|
739
740
|
const data = core.commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
740
|
-
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data);
|
|
741
|
+
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
741
742
|
return _extends({}, res, {
|
|
742
743
|
decorated: decoratedBundle
|
|
743
744
|
});
|
|
@@ -745,7 +746,9 @@ class Account {
|
|
|
745
746
|
async prepareTransactions(args) {
|
|
746
747
|
const status = await this.status(args.chainId);
|
|
747
748
|
const transactions = await this.fillGasLimits(args.txs, args.chainId, status);
|
|
748
|
-
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status
|
|
749
|
+
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status, {
|
|
750
|
+
simulate: args.simulateForFeeOptions
|
|
751
|
+
});
|
|
749
752
|
const flatDecorated = core.commons.transaction.unwind(this.address, gasRefundQuote.decorated.transactions);
|
|
750
753
|
return {
|
|
751
754
|
transactions,
|
|
@@ -126,13 +126,14 @@ class AccountSigner {
|
|
|
126
126
|
}
|
|
127
127
|
throw new Error('No fee option available - not enough balance');
|
|
128
128
|
}
|
|
129
|
-
async sendTransaction(txsPromise) {
|
|
129
|
+
async sendTransaction(txsPromise, options) {
|
|
130
130
|
var _this$options$stubSig, _this$options2, _this$options$selectF, _this$options3, _this$options4;
|
|
131
131
|
const txs = isDeferrable(txsPromise) ? await ethers.ethers.utils.resolveProperties(txsPromise) : txsPromise;
|
|
132
132
|
const prepare = await this.account.prepareTransactions({
|
|
133
133
|
txs,
|
|
134
134
|
chainId: this.chainId,
|
|
135
|
-
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map()
|
|
135
|
+
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map(),
|
|
136
|
+
simulateForFeeOptions: options == null ? void 0 : options.simulateForFeeOptions
|
|
136
137
|
});
|
|
137
138
|
const selectMethod = (_this$options$selectF = (_this$options3 = this.options) == null ? void 0 : _this$options3.selectFee) != null ? _this$options$selectF : this.defaultSelectFee.bind(this);
|
|
138
139
|
const feeOption = await selectMethod(txs, prepare.feeOptions);
|
|
@@ -710,7 +711,7 @@ class Account {
|
|
|
710
711
|
const wallet = this.walletForStatus(chainId, status || (await this.status(chainId)));
|
|
711
712
|
return wallet.fillGasLimits(txs);
|
|
712
713
|
}
|
|
713
|
-
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status) {
|
|
714
|
+
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status, options) {
|
|
714
715
|
const wstatus = status || (await this.status(chainId));
|
|
715
716
|
const wallet = this.walletForStatus(chainId, wstatus);
|
|
716
717
|
const predecorated = await this.predecorateTransactions(txs, wstatus, chainId);
|
|
@@ -737,7 +738,7 @@ class Account {
|
|
|
737
738
|
|
|
738
739
|
const decoratedBundle = this.decorateTransactions(signedBundle, wstatus);
|
|
739
740
|
const data = core.commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
740
|
-
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data);
|
|
741
|
+
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
741
742
|
return _extends({}, res, {
|
|
742
743
|
decorated: decoratedBundle
|
|
743
744
|
});
|
|
@@ -745,7 +746,9 @@ class Account {
|
|
|
745
746
|
async prepareTransactions(args) {
|
|
746
747
|
const status = await this.status(args.chainId);
|
|
747
748
|
const transactions = await this.fillGasLimits(args.txs, args.chainId, status);
|
|
748
|
-
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status
|
|
749
|
+
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status, {
|
|
750
|
+
simulate: args.simulateForFeeOptions
|
|
751
|
+
});
|
|
749
752
|
const flatDecorated = core.commons.transaction.unwind(this.address, gasRefundQuote.decorated.transactions);
|
|
750
753
|
return {
|
|
751
754
|
transactions,
|
|
@@ -122,13 +122,14 @@ class AccountSigner {
|
|
|
122
122
|
}
|
|
123
123
|
throw new Error('No fee option available - not enough balance');
|
|
124
124
|
}
|
|
125
|
-
async sendTransaction(txsPromise) {
|
|
125
|
+
async sendTransaction(txsPromise, options) {
|
|
126
126
|
var _this$options$stubSig, _this$options2, _this$options$selectF, _this$options3, _this$options4;
|
|
127
127
|
const txs = isDeferrable(txsPromise) ? await ethers.utils.resolveProperties(txsPromise) : txsPromise;
|
|
128
128
|
const prepare = await this.account.prepareTransactions({
|
|
129
129
|
txs,
|
|
130
130
|
chainId: this.chainId,
|
|
131
|
-
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map()
|
|
131
|
+
stubSignatureOverrides: (_this$options$stubSig = (_this$options2 = this.options) == null ? void 0 : _this$options2.stubSignatureOverrides) != null ? _this$options$stubSig : new Map(),
|
|
132
|
+
simulateForFeeOptions: options == null ? void 0 : options.simulateForFeeOptions
|
|
132
133
|
});
|
|
133
134
|
const selectMethod = (_this$options$selectF = (_this$options3 = this.options) == null ? void 0 : _this$options3.selectFee) != null ? _this$options$selectF : this.defaultSelectFee.bind(this);
|
|
134
135
|
const feeOption = await selectMethod(txs, prepare.feeOptions);
|
|
@@ -706,7 +707,7 @@ class Account {
|
|
|
706
707
|
const wallet = this.walletForStatus(chainId, status || (await this.status(chainId)));
|
|
707
708
|
return wallet.fillGasLimits(txs);
|
|
708
709
|
}
|
|
709
|
-
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status) {
|
|
710
|
+
async gasRefundQuotes(txs, chainId, stubSignatureOverrides, status, options) {
|
|
710
711
|
const wstatus = status || (await this.status(chainId));
|
|
711
712
|
const wallet = this.walletForStatus(chainId, wstatus);
|
|
712
713
|
const predecorated = await this.predecorateTransactions(txs, wstatus, chainId);
|
|
@@ -733,7 +734,7 @@ class Account {
|
|
|
733
734
|
|
|
734
735
|
const decoratedBundle = this.decorateTransactions(signedBundle, wstatus);
|
|
735
736
|
const data = commons.transaction.encodeBundleExecData(decoratedBundle);
|
|
736
|
-
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data);
|
|
737
|
+
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options);
|
|
737
738
|
return _extends({}, res, {
|
|
738
739
|
decorated: decoratedBundle
|
|
739
740
|
});
|
|
@@ -741,7 +742,9 @@ class Account {
|
|
|
741
742
|
async prepareTransactions(args) {
|
|
742
743
|
const status = await this.status(args.chainId);
|
|
743
744
|
const transactions = await this.fillGasLimits(args.txs, args.chainId, status);
|
|
744
|
-
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status
|
|
745
|
+
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status, {
|
|
746
|
+
simulate: args.simulateForFeeOptions
|
|
747
|
+
});
|
|
745
748
|
const flatDecorated = commons.transaction.unwind(this.address, gasRefundQuote.decorated.transactions);
|
|
746
749
|
return {
|
|
747
750
|
transactions,
|
|
@@ -117,7 +117,9 @@ export declare class Account {
|
|
|
117
117
|
}>;
|
|
118
118
|
sendSignedTransactions(signedBundle: commons.transaction.IntendedTransactionBundle, chainId: ethers.BigNumberish, quote?: FeeQuote, pstatus?: AccountStatus, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void): Promise<ethers.providers.TransactionResponse>;
|
|
119
119
|
fillGasLimits(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, status?: AccountStatus): Promise<commons.transaction.SimulatedTransaction[]>;
|
|
120
|
-
gasRefundQuotes(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, stubSignatureOverrides: Map<string, string>, status?: AccountStatus
|
|
120
|
+
gasRefundQuotes(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, stubSignatureOverrides: Map<string, string>, status?: AccountStatus, options?: {
|
|
121
|
+
simulate?: boolean;
|
|
122
|
+
}): Promise<{
|
|
121
123
|
options: FeeOption[];
|
|
122
124
|
quote?: FeeQuote;
|
|
123
125
|
decorated: commons.transaction.IntendedTransactionBundle;
|
|
@@ -126,6 +128,7 @@ export declare class Account {
|
|
|
126
128
|
txs: commons.transaction.Transactionish;
|
|
127
129
|
chainId: ethers.BigNumberish;
|
|
128
130
|
stubSignatureOverrides: Map<string, string>;
|
|
131
|
+
simulateForFeeOptions?: boolean;
|
|
129
132
|
}): Promise<PreparedTransactions>;
|
|
130
133
|
sendTransaction(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, quote?: FeeQuote, skipPreDecorate?: boolean, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void, options?: {
|
|
131
134
|
nonceSpace?: ethers.BigNumberish;
|
|
@@ -19,7 +19,9 @@ export declare class AccountSigner implements ethers.Signer {
|
|
|
19
19
|
getAddress(): Promise<string>;
|
|
20
20
|
signMessage(message: string | ethers.utils.Bytes): Promise<string>;
|
|
21
21
|
private defaultSelectFee;
|
|
22
|
-
sendTransaction(txsPromise: ethers.utils.Deferrable<ethers.providers.TransactionRequest> | commons.transaction.Transactionish
|
|
22
|
+
sendTransaction(txsPromise: ethers.utils.Deferrable<ethers.providers.TransactionRequest> | commons.transaction.Transactionish, options?: {
|
|
23
|
+
simulateForFeeOptions?: boolean;
|
|
24
|
+
}): Promise<ethers.providers.TransactionResponse>;
|
|
23
25
|
getBalance(blockTag?: ethers.providers.BlockTag | undefined): Promise<ethers.BigNumber>;
|
|
24
26
|
call(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>, blockTag?: ethers.providers.BlockTag | undefined): Promise<string>;
|
|
25
27
|
resolveName(name: string): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/account",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
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/
|
|
14
|
-
"@0xsequence/
|
|
15
|
-
"@0xsequence/
|
|
16
|
-
"@0xsequence/relayer": "1.2.
|
|
17
|
-
"@0xsequence/
|
|
18
|
-
"@0xsequence/
|
|
19
|
-
"@0xsequence/wallet": "1.2.
|
|
13
|
+
"@0xsequence/migration": "1.2.9",
|
|
14
|
+
"@0xsequence/core": "1.2.9",
|
|
15
|
+
"@0xsequence/network": "1.2.9",
|
|
16
|
+
"@0xsequence/relayer": "1.2.9",
|
|
17
|
+
"@0xsequence/sessions": "1.2.9",
|
|
18
|
+
"@0xsequence/utils": "1.2.9",
|
|
19
|
+
"@0xsequence/wallet": "1.2.9"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
23
23
|
"nyc": "^15.1.0",
|
|
24
|
-
"@0xsequence/signhub": "1.2.
|
|
25
|
-
"@0xsequence/tests": "1.2.
|
|
24
|
+
"@0xsequence/signhub": "1.2.9",
|
|
25
|
+
"@0xsequence/tests": "1.2.9"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"src",
|
package/src/account.ts
CHANGED
|
@@ -735,7 +735,10 @@ export class Account {
|
|
|
735
735
|
txs: commons.transaction.Transactionish,
|
|
736
736
|
chainId: ethers.BigNumberish,
|
|
737
737
|
stubSignatureOverrides: Map<string, string>,
|
|
738
|
-
status?: AccountStatus
|
|
738
|
+
status?: AccountStatus,
|
|
739
|
+
options?: {
|
|
740
|
+
simulate?: boolean
|
|
741
|
+
}
|
|
739
742
|
): Promise<{
|
|
740
743
|
options: FeeOption[]
|
|
741
744
|
quote?: FeeQuote
|
|
@@ -768,7 +771,7 @@ export class Account {
|
|
|
768
771
|
|
|
769
772
|
const decoratedBundle = this.decorateTransactions(signedBundle, wstatus)
|
|
770
773
|
const data = commons.transaction.encodeBundleExecData(decoratedBundle)
|
|
771
|
-
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data)
|
|
774
|
+
const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options)
|
|
772
775
|
return { ...res, decorated: decoratedBundle }
|
|
773
776
|
}
|
|
774
777
|
|
|
@@ -776,11 +779,14 @@ export class Account {
|
|
|
776
779
|
txs: commons.transaction.Transactionish
|
|
777
780
|
chainId: ethers.BigNumberish
|
|
778
781
|
stubSignatureOverrides: Map<string, string>
|
|
782
|
+
simulateForFeeOptions?: boolean
|
|
779
783
|
}): Promise<PreparedTransactions> {
|
|
780
784
|
const status = await this.status(args.chainId)
|
|
781
785
|
|
|
782
786
|
const transactions = await this.fillGasLimits(args.txs, args.chainId, status)
|
|
783
|
-
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status
|
|
787
|
+
const gasRefundQuote = await this.gasRefundQuotes(transactions, args.chainId, args.stubSignatureOverrides, status, {
|
|
788
|
+
simulate: args.simulateForFeeOptions
|
|
789
|
+
})
|
|
784
790
|
const flatDecorated = commons.transaction.unwind(this.address, gasRefundQuote.decorated.transactions)
|
|
785
791
|
|
|
786
792
|
return {
|
package/src/signer.ts
CHANGED
|
@@ -125,7 +125,10 @@ export class AccountSigner implements ethers.Signer {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
async sendTransaction(
|
|
128
|
-
txsPromise: ethers.utils.Deferrable<ethers.providers.TransactionRequest> | commons.transaction.Transactionish
|
|
128
|
+
txsPromise: ethers.utils.Deferrable<ethers.providers.TransactionRequest> | commons.transaction.Transactionish,
|
|
129
|
+
options?: {
|
|
130
|
+
simulateForFeeOptions?: boolean
|
|
131
|
+
}
|
|
129
132
|
): Promise<ethers.providers.TransactionResponse> {
|
|
130
133
|
const txs = isDeferrable(txsPromise)
|
|
131
134
|
? await ethers.utils.resolveProperties(txsPromise as ethers.utils.Deferrable<ethers.providers.TransactionRequest>)
|
|
@@ -134,7 +137,8 @@ export class AccountSigner implements ethers.Signer {
|
|
|
134
137
|
const prepare = await this.account.prepareTransactions({
|
|
135
138
|
txs,
|
|
136
139
|
chainId: this.chainId,
|
|
137
|
-
stubSignatureOverrides: this.options?.stubSignatureOverrides ?? new Map()
|
|
140
|
+
stubSignatureOverrides: this.options?.stubSignatureOverrides ?? new Map(),
|
|
141
|
+
simulateForFeeOptions: options?.simulateForFeeOptions
|
|
138
142
|
})
|
|
139
143
|
|
|
140
144
|
const selectMethod = this.options?.selectFee ?? this.defaultSelectFee.bind(this)
|