@metamask-previews/transaction-controller 28.1.1-preview-a1db0714 → 29.0.0-preview-a6633f22
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/CHANGELOG.md +28 -1
- package/dist/TransactionController.js +3 -3
- package/dist/TransactionController.mjs +2 -2
- package/dist/{chunk-BSTN6LDB.mjs → chunk-26BABWPE.mjs} +88 -90
- package/dist/chunk-26BABWPE.mjs.map +1 -0
- package/dist/{chunk-XC5NBJOF.js → chunk-DTDTOMTB.js} +6 -13
- package/dist/chunk-DTDTOMTB.js.map +1 -0
- package/dist/{chunk-ASVFMULG.js → chunk-KT3F6CZP.js} +89 -91
- package/dist/chunk-KT3F6CZP.js.map +1 -0
- package/dist/{chunk-QWHMXCGZ.mjs → chunk-Y7ENNK7L.mjs} +6 -13
- package/dist/chunk-Y7ENNK7L.mjs.map +1 -0
- package/dist/helpers/IncomingTransactionHelper.js +2 -2
- package/dist/helpers/IncomingTransactionHelper.mjs +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +8 -7
- package/dist/types/TransactionController.d.ts.map +1 -1
- package/dist/types/helpers/IncomingTransactionHelper.d.ts +1 -2
- package/dist/types/helpers/IncomingTransactionHelper.d.ts.map +1 -1
- package/package.json +2 -5
- package/dist/chunk-ASVFMULG.js.map +0 -1
- package/dist/chunk-BSTN6LDB.mjs.map +0 -1
- package/dist/chunk-QWHMXCGZ.mjs.map +0 -1
- package/dist/chunk-XC5NBJOF.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [29.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `estimateGasFee` method ([#4216](https://github.com/MetaMask/core/pull/4216))
|
|
15
|
+
- Add `TestGasFeeFlow` that is activated by optional `testGasFeeFlows` constructor option.
|
|
16
|
+
- Add related types:
|
|
17
|
+
- `FeeMarketGasFeeEstimateForLevel`
|
|
18
|
+
- `FeeMarketGasFeeEstimates`
|
|
19
|
+
- `GasFeeEstimates`
|
|
20
|
+
- `GasFeeEstimateLevel`
|
|
21
|
+
- `GasFeeEstimateType`
|
|
22
|
+
- `GasPriceGasFeeEstimates`
|
|
23
|
+
- `LegacyGasFeeEstimates`
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **BREAKING:** Update `GasFeeEstimates` type to support alternate estimate types ([#4216](https://github.com/MetaMask/core/pull/4216))
|
|
28
|
+
- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232))
|
|
29
|
+
- Bump `@metamask/approval-controller` to `^6.0.2` ([#4234](https://github.com/MetaMask/core/pull/4234))
|
|
30
|
+
- Bump `@metamask/gas-fee-controller` to `^15.1.1` ([#4234](https://github.com/MetaMask/core/pull/4234))
|
|
31
|
+
|
|
32
|
+
### Removed
|
|
33
|
+
|
|
34
|
+
- **BREAKING:** Remove `gasFeeControllerEstimateType` property from `mergeGasFeeEstimates` function ([#4216](https://github.com/MetaMask/core/pull/4216))
|
|
35
|
+
|
|
10
36
|
## [28.1.1]
|
|
11
37
|
|
|
12
38
|
### Changed
|
|
@@ -790,7 +816,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
790
816
|
|
|
791
817
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
792
818
|
|
|
793
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
819
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@29.0.0...HEAD
|
|
820
|
+
[29.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@28.1.1...@metamask/transaction-controller@29.0.0
|
|
794
821
|
[28.1.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@28.1.0...@metamask/transaction-controller@28.1.1
|
|
795
822
|
[28.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@28.0.0...@metamask/transaction-controller@28.1.0
|
|
796
823
|
[28.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@27.0.1...@metamask/transaction-controller@28.0.0
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkKT3F6CZPjs = require('./chunk-KT3F6CZP.js');
|
|
8
8
|
require('./chunk-ZNZEJDOE.js');
|
|
9
9
|
require('./chunk-X3KACH5P.js');
|
|
10
10
|
require('./chunk-KT6UAKBB.js');
|
|
@@ -20,7 +20,7 @@ require('./chunk-YVCX6Z75.js');
|
|
|
20
20
|
require('./chunk-TJMQEH57.js');
|
|
21
21
|
require('./chunk-7DJO6UZA.js');
|
|
22
22
|
require('./chunk-2XKEAKQG.js');
|
|
23
|
-
require('./chunk-
|
|
23
|
+
require('./chunk-DTDTOMTB.js');
|
|
24
24
|
require('./chunk-5XQ2KRYL.js');
|
|
25
25
|
require('./chunk-EQT25RSP.js');
|
|
26
26
|
require('./chunk-FDUCRHYT.js');
|
|
@@ -41,5 +41,5 @@ require('./chunk-Z4BLTVTB.js');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
exports.ApprovalState =
|
|
44
|
+
exports.ApprovalState = _chunkKT3F6CZPjs.ApprovalState; exports.CANCEL_RATE = _chunkKT3F6CZPjs.CANCEL_RATE; exports.HARDFORK = _chunkKT3F6CZPjs.HARDFORK; exports.SPEED_UP_RATE = _chunkKT3F6CZPjs.SPEED_UP_RATE; exports.TransactionController = _chunkKT3F6CZPjs.TransactionController;
|
|
45
45
|
//# sourceMappingURL=TransactionController.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
HARDFORK,
|
|
5
5
|
SPEED_UP_RATE,
|
|
6
6
|
TransactionController
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-26BABWPE.mjs";
|
|
8
8
|
import "./chunk-NHRBO3LU.mjs";
|
|
9
9
|
import "./chunk-MDRMMUMS.mjs";
|
|
10
10
|
import "./chunk-K4KOSAGM.mjs";
|
|
@@ -20,7 +20,7 @@ import "./chunk-FG74Z3F5.mjs";
|
|
|
20
20
|
import "./chunk-FMRLPVFZ.mjs";
|
|
21
21
|
import "./chunk-SL3GHHKG.mjs";
|
|
22
22
|
import "./chunk-NOHEXQ7Y.mjs";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-Y7ENNK7L.mjs";
|
|
24
24
|
import "./chunk-F6E3TTR3.mjs";
|
|
25
25
|
import "./chunk-CPMTUMMZ.mjs";
|
|
26
26
|
import "./chunk-QZLPYOGC.mjs";
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
} from "./chunk-NOHEXQ7Y.mjs";
|
|
46
46
|
import {
|
|
47
47
|
IncomingTransactionHelper
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-Y7ENNK7L.mjs";
|
|
49
49
|
import {
|
|
50
50
|
MultichainTrackingHelper
|
|
51
51
|
} from "./chunk-F6E3TTR3.mjs";
|
|
@@ -161,7 +161,7 @@ var TransactionController = class extends BaseController {
|
|
|
161
161
|
* @param options.getNetworkState - Gets the state of the network controller.
|
|
162
162
|
* @param options.getPermittedAccounts - Get accounts that a given origin has permissions for.
|
|
163
163
|
* @param options.getSavedGasFees - Gets the saved gas fee config.
|
|
164
|
-
* @param options.
|
|
164
|
+
* @param options.getSelectedAddress - Gets the address of the currently selected account.
|
|
165
165
|
* @param options.incomingTransactions - Configuration options for incoming transaction support.
|
|
166
166
|
* @param options.isMultichainEnabled - Enable multichain support.
|
|
167
167
|
* @param options.isSimulationEnabled - Whether new transactions will be automatically simulated.
|
|
@@ -189,7 +189,7 @@ var TransactionController = class extends BaseController {
|
|
|
189
189
|
getNetworkState,
|
|
190
190
|
getPermittedAccounts,
|
|
191
191
|
getSavedGasFees,
|
|
192
|
-
|
|
192
|
+
getSelectedAddress,
|
|
193
193
|
incomingTransactions = {},
|
|
194
194
|
isMultichainEnabled = false,
|
|
195
195
|
isSimulationEnabled,
|
|
@@ -234,7 +234,7 @@ var TransactionController = class extends BaseController {
|
|
|
234
234
|
__privateAdd(this, _getGlobalChainId);
|
|
235
235
|
__privateAdd(this, _isCustomNetwork);
|
|
236
236
|
__privateAdd(this, _internalEvents, new EventEmitter());
|
|
237
|
-
this.
|
|
237
|
+
this.approvingTransactionIds = /* @__PURE__ */ new Set();
|
|
238
238
|
this.mutex = new Mutex();
|
|
239
239
|
__privateAdd(this, _incomingTransactionOptions, void 0);
|
|
240
240
|
__privateAdd(this, _pendingTransactionOptions, void 0);
|
|
@@ -259,7 +259,7 @@ var TransactionController = class extends BaseController {
|
|
|
259
259
|
this.getCurrentNetworkEIP1559Compatibility = getCurrentNetworkEIP1559Compatibility;
|
|
260
260
|
this.getGasFeeEstimates = getGasFeeEstimates || (() => Promise.resolve({}));
|
|
261
261
|
this.getPermittedAccounts = getPermittedAccounts;
|
|
262
|
-
this.
|
|
262
|
+
this.getSelectedAddress = getSelectedAddress;
|
|
263
263
|
this.getExternalPendingTransactions = getExternalPendingTransactions ?? (() => []);
|
|
264
264
|
this.securityProviderRequest = securityProviderRequest;
|
|
265
265
|
__privateSet(this, _incomingTransactionOptions, incomingTransactions);
|
|
@@ -456,10 +456,6 @@ var TransactionController = class extends BaseController {
|
|
|
456
456
|
networkClientId: requestNetworkClientId
|
|
457
457
|
} = {}) {
|
|
458
458
|
projectLogger("Adding transaction", txParams);
|
|
459
|
-
const selectedAccount = this.getSelectedAccount();
|
|
460
|
-
if (selectedAccount.type !== "eip155:eoa" && selectedAccount.type !== "eip155:erc4337") {
|
|
461
|
-
throw new Error("Selected account is not an EVM account");
|
|
462
|
-
}
|
|
463
459
|
txParams = normalizeTransactionParams(txParams);
|
|
464
460
|
if (requestNetworkClientId && !__privateGet(this, _multichainTrackingHelper).has(requestNetworkClientId)) {
|
|
465
461
|
throw new Error(
|
|
@@ -474,7 +470,7 @@ var TransactionController = class extends BaseController {
|
|
|
474
470
|
if (origin) {
|
|
475
471
|
await validateTransactionOrigin(
|
|
476
472
|
await this.getPermittedAccounts(origin),
|
|
477
|
-
|
|
473
|
+
this.getSelectedAddress(),
|
|
478
474
|
txParams.from,
|
|
479
475
|
origin
|
|
480
476
|
);
|
|
@@ -729,9 +725,7 @@ var TransactionController = class extends BaseController {
|
|
|
729
725
|
validateGasValues(gasValues);
|
|
730
726
|
}
|
|
731
727
|
projectLogger("Creating speed up transaction", transactionId, gasValues);
|
|
732
|
-
const transactionMeta = this.
|
|
733
|
-
({ id }) => id === transactionId
|
|
734
|
-
);
|
|
728
|
+
const transactionMeta = this.getTransaction(transactionId);
|
|
735
729
|
if (!transactionMeta) {
|
|
736
730
|
return;
|
|
737
731
|
}
|
|
@@ -780,7 +774,7 @@ var TransactionController = class extends BaseController {
|
|
|
780
774
|
unsignedEthTx,
|
|
781
775
|
transactionMeta.txParams.from
|
|
782
776
|
);
|
|
783
|
-
const transactionMetaWithRsv =
|
|
777
|
+
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
784
778
|
transactionMeta,
|
|
785
779
|
signedTx
|
|
786
780
|
);
|
|
@@ -1219,10 +1213,10 @@ var TransactionController = class extends BaseController {
|
|
|
1219
1213
|
common
|
|
1220
1214
|
});
|
|
1221
1215
|
const initialTxAsSerializedHex = bufferToHex(initialTxAsEthTx.serialize());
|
|
1222
|
-
if (this.
|
|
1216
|
+
if (this.approvingTransactionIds.has(initialTxAsSerializedHex)) {
|
|
1223
1217
|
return "";
|
|
1224
1218
|
}
|
|
1225
|
-
this.
|
|
1219
|
+
this.approvingTransactionIds.add(initialTxAsSerializedHex);
|
|
1226
1220
|
let rawTransactions, nonceLock;
|
|
1227
1221
|
try {
|
|
1228
1222
|
const fromAddress = initialTx.from;
|
|
@@ -1243,7 +1237,7 @@ var TransactionController = class extends BaseController {
|
|
|
1243
1237
|
throw err;
|
|
1244
1238
|
} finally {
|
|
1245
1239
|
nonceLock?.releaseLock();
|
|
1246
|
-
this.
|
|
1240
|
+
this.approvingTransactionIds.delete(initialTxAsSerializedHex);
|
|
1247
1241
|
}
|
|
1248
1242
|
return rawTransactions;
|
|
1249
1243
|
}
|
|
@@ -1284,10 +1278,10 @@ var TransactionController = class extends BaseController {
|
|
|
1284
1278
|
transactionMeta,
|
|
1285
1279
|
pickBy({ hash, status })
|
|
1286
1280
|
);
|
|
1287
|
-
if (status === "submitted" /* submitted */) {
|
|
1281
|
+
if (updatedTransactionMeta.status === "submitted" /* submitted */) {
|
|
1288
1282
|
updatedTransactionMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1289
1283
|
}
|
|
1290
|
-
if (status === "failed" /* failed */) {
|
|
1284
|
+
if (updatedTransactionMeta.status === "failed" /* failed */) {
|
|
1291
1285
|
updatedTransactionMeta.error = normalizeTxError(new Error(errorMessage));
|
|
1292
1286
|
}
|
|
1293
1287
|
this.updateTransaction(
|
|
@@ -1643,68 +1637,62 @@ var TransactionController = class extends BaseController {
|
|
|
1643
1637
|
* @param transactionId - The ID of the transaction to approve.
|
|
1644
1638
|
*/
|
|
1645
1639
|
async approveTransaction(transactionId) {
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
const transactionMeta = transactions[index];
|
|
1650
|
-
const updatedTransactionMeta = cloneDeep(transactionMeta);
|
|
1651
|
-
const {
|
|
1652
|
-
txParams: { from },
|
|
1653
|
-
networkClientId
|
|
1654
|
-
} = transactionMeta;
|
|
1655
|
-
let releaseNonceLock;
|
|
1640
|
+
const cleanupTasks = new Array();
|
|
1641
|
+
cleanupTasks.push(await this.mutex.acquire());
|
|
1642
|
+
let transactionMeta = this.getTransactionOrThrow(transactionId);
|
|
1656
1643
|
try {
|
|
1657
1644
|
if (!this.sign) {
|
|
1658
|
-
releaseLock();
|
|
1659
1645
|
this.failTransaction(
|
|
1660
1646
|
transactionMeta,
|
|
1661
1647
|
new Error("No sign method defined.")
|
|
1662
1648
|
);
|
|
1663
1649
|
return "not-approved" /* NotApproved */;
|
|
1664
1650
|
} else if (!transactionMeta.chainId) {
|
|
1665
|
-
releaseLock();
|
|
1666
1651
|
this.failTransaction(transactionMeta, new Error("No chainId defined."));
|
|
1667
1652
|
return "not-approved" /* NotApproved */;
|
|
1668
1653
|
}
|
|
1669
|
-
if (this.
|
|
1654
|
+
if (this.approvingTransactionIds.has(transactionId)) {
|
|
1670
1655
|
projectLogger("Skipping approval as signing in progress", transactionId);
|
|
1671
1656
|
return "not-approved" /* NotApproved */;
|
|
1672
1657
|
}
|
|
1658
|
+
this.approvingTransactionIds.add(transactionId);
|
|
1659
|
+
cleanupTasks.push(
|
|
1660
|
+
() => this.approvingTransactionIds.delete(transactionId)
|
|
1661
|
+
);
|
|
1673
1662
|
const [nonce, releaseNonce] = await getNextNonce(
|
|
1674
1663
|
transactionMeta,
|
|
1675
|
-
(address) => __privateGet(this, _multichainTrackingHelper).getNonceLock(
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
updatedTransactionMeta.txParams = {
|
|
1680
|
-
...updatedTransactionMeta.txParams,
|
|
1681
|
-
nonce,
|
|
1682
|
-
chainId: transactionMeta.chainId
|
|
1683
|
-
};
|
|
1684
|
-
const baseTxParams = {
|
|
1685
|
-
...updatedTransactionMeta.txParams,
|
|
1686
|
-
gasLimit: updatedTransactionMeta.txParams.gas
|
|
1687
|
-
};
|
|
1688
|
-
this.updateTransaction(
|
|
1689
|
-
updatedTransactionMeta,
|
|
1690
|
-
"TransactionController#approveTransaction - Transaction approved"
|
|
1664
|
+
(address) => __privateGet(this, _multichainTrackingHelper).getNonceLock(
|
|
1665
|
+
address,
|
|
1666
|
+
transactionMeta.networkClientId
|
|
1667
|
+
)
|
|
1691
1668
|
);
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1669
|
+
releaseNonce && cleanupTasks.push(releaseNonce);
|
|
1670
|
+
transactionMeta = __privateMethod(this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1671
|
+
transactionId,
|
|
1672
|
+
note: "TransactionController#approveTransaction - Transaction approved"
|
|
1673
|
+
}, (draftTxMeta) => {
|
|
1674
|
+
const { txParams, chainId } = draftTxMeta;
|
|
1675
|
+
draftTxMeta.status = "approved" /* approved */;
|
|
1676
|
+
draftTxMeta.txParams = {
|
|
1677
|
+
...txParams,
|
|
1678
|
+
nonce,
|
|
1679
|
+
chainId,
|
|
1680
|
+
gasLimit: txParams.gas,
|
|
1681
|
+
...isEIP1559Transaction(txParams) && {
|
|
1682
|
+
type: "0x2" /* feeMarket */
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
});
|
|
1686
|
+
this.onTransactionStatusChange(transactionMeta);
|
|
1699
1687
|
const rawTx = await this.signTransaction(
|
|
1700
|
-
|
|
1701
|
-
txParams
|
|
1688
|
+
transactionMeta,
|
|
1689
|
+
transactionMeta.txParams
|
|
1702
1690
|
);
|
|
1703
|
-
if (!this.beforePublish(
|
|
1691
|
+
if (!this.beforePublish(transactionMeta)) {
|
|
1704
1692
|
projectLogger("Skipping publishing transaction based on hook");
|
|
1705
1693
|
this.messagingSystem.publish(
|
|
1706
1694
|
`${controllerName}:transactionPublishingSkipped`,
|
|
1707
|
-
|
|
1695
|
+
transactionMeta
|
|
1708
1696
|
);
|
|
1709
1697
|
return "skipped-via-before-publish-hook" /* SkippedViaBeforePublishHook */;
|
|
1710
1698
|
}
|
|
@@ -1715,51 +1703,50 @@ var TransactionController = class extends BaseController {
|
|
|
1715
1703
|
networkClientId: transactionMeta.networkClientId,
|
|
1716
1704
|
chainId: transactionMeta.chainId
|
|
1717
1705
|
});
|
|
1718
|
-
|
|
1706
|
+
let preTxBalance;
|
|
1707
|
+
const shouldUpdatePreTxBalance = transactionMeta.type === "swap" /* swap */;
|
|
1708
|
+
if (shouldUpdatePreTxBalance) {
|
|
1719
1709
|
projectLogger("Determining pre-transaction balance");
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
"Updated pre-transaction balance",
|
|
1724
|
-
updatedTransactionMeta.preTxBalance
|
|
1725
|
-
);
|
|
1710
|
+
preTxBalance = await query(ethQuery, "getBalance", [
|
|
1711
|
+
transactionMeta.txParams.from
|
|
1712
|
+
]);
|
|
1726
1713
|
}
|
|
1727
|
-
projectLogger("Publishing transaction", txParams);
|
|
1714
|
+
projectLogger("Publishing transaction", transactionMeta.txParams);
|
|
1728
1715
|
let { transactionHash: hash } = await this.publish(
|
|
1729
|
-
|
|
1716
|
+
transactionMeta,
|
|
1730
1717
|
rawTx
|
|
1731
1718
|
);
|
|
1732
1719
|
if (hash === void 0) {
|
|
1733
1720
|
hash = await this.publishTransaction(ethQuery, rawTx);
|
|
1734
1721
|
}
|
|
1735
1722
|
projectLogger("Publish successful", hash);
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
"
|
|
1742
|
-
|
|
1723
|
+
transactionMeta = __privateMethod(this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1724
|
+
transactionId,
|
|
1725
|
+
note: "TransactionController#approveTransaction - Transaction submitted"
|
|
1726
|
+
}, (draftTxMeta) => {
|
|
1727
|
+
draftTxMeta.hash = hash;
|
|
1728
|
+
draftTxMeta.status = "submitted" /* submitted */;
|
|
1729
|
+
draftTxMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1730
|
+
if (shouldUpdatePreTxBalance) {
|
|
1731
|
+
draftTxMeta.preTxBalance = preTxBalance;
|
|
1732
|
+
projectLogger("Updated pre-transaction balance", preTxBalance);
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1743
1735
|
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
1744
|
-
transactionMeta
|
|
1736
|
+
transactionMeta
|
|
1745
1737
|
});
|
|
1746
1738
|
this.messagingSystem.publish(
|
|
1747
1739
|
`${controllerName}:transactionFinished`,
|
|
1748
|
-
|
|
1749
|
-
);
|
|
1750
|
-
__privateGet(this, _internalEvents).emit(
|
|
1751
|
-
`${updatedTransactionMeta.id}:finished`,
|
|
1752
|
-
updatedTransactionMeta
|
|
1740
|
+
transactionMeta
|
|
1753
1741
|
);
|
|
1754
|
-
this.
|
|
1742
|
+
__privateGet(this, _internalEvents).emit(`${transactionId}:finished`, transactionMeta);
|
|
1743
|
+
this.onTransactionStatusChange(transactionMeta);
|
|
1755
1744
|
return "approved" /* Approved */;
|
|
1756
1745
|
} catch (error) {
|
|
1757
1746
|
this.failTransaction(transactionMeta, error);
|
|
1758
1747
|
return "not-approved" /* NotApproved */;
|
|
1759
1748
|
} finally {
|
|
1760
|
-
|
|
1761
|
-
releaseNonceLock?.();
|
|
1762
|
-
releaseLock();
|
|
1749
|
+
cleanupTasks.forEach((task) => task());
|
|
1763
1750
|
}
|
|
1764
1751
|
}
|
|
1765
1752
|
async publishTransaction(ethQuery, rawTransaction) {
|
|
@@ -1881,6 +1868,15 @@ var TransactionController = class extends BaseController {
|
|
|
1881
1868
|
const { transactions } = this.state;
|
|
1882
1869
|
return transactions.find(({ id }) => id === transactionId);
|
|
1883
1870
|
}
|
|
1871
|
+
getTransactionOrThrow(transactionId, errorMessagePrefix = "TransactionController") {
|
|
1872
|
+
const txMeta = this.getTransaction(transactionId);
|
|
1873
|
+
if (!txMeta) {
|
|
1874
|
+
throw new Error(
|
|
1875
|
+
`${errorMessagePrefix}: No transaction found with id ${transactionId}`
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
return txMeta;
|
|
1879
|
+
}
|
|
1884
1880
|
getApprovalId(txMeta) {
|
|
1885
1881
|
return String(txMeta.id);
|
|
1886
1882
|
}
|
|
@@ -2089,8 +2085,9 @@ var TransactionController = class extends BaseController {
|
|
|
2089
2085
|
*
|
|
2090
2086
|
* @param transactionMeta - The TransactionMeta object to update.
|
|
2091
2087
|
* @param signedTx - The encompassing type for all transaction types containing r, s, and v values.
|
|
2088
|
+
* @returns The updated TransactionMeta object.
|
|
2092
2089
|
*/
|
|
2093
|
-
|
|
2090
|
+
updateTransactionMetaRSV(transactionMeta, signedTx) {
|
|
2094
2091
|
const transactionMetaWithRsv = cloneDeep(transactionMeta);
|
|
2095
2092
|
for (const key of ["r", "s", "v"]) {
|
|
2096
2093
|
const value = signedTx[key];
|
|
@@ -2112,7 +2109,7 @@ var TransactionController = class extends BaseController {
|
|
|
2112
2109
|
transactionMeta.chainId,
|
|
2113
2110
|
txParams
|
|
2114
2111
|
);
|
|
2115
|
-
this.
|
|
2112
|
+
this.approvingTransactionIds.add(transactionMeta.id);
|
|
2116
2113
|
const signedTx = await new Promise((resolve, reject) => {
|
|
2117
2114
|
this.sign?.(
|
|
2118
2115
|
unsignedEthTx,
|
|
@@ -2138,7 +2135,7 @@ var TransactionController = class extends BaseController {
|
|
|
2138
2135
|
return void 0;
|
|
2139
2136
|
}
|
|
2140
2137
|
const transactionMetaWithRsv = {
|
|
2141
|
-
...
|
|
2138
|
+
...this.updateTransactionMetaRSV(transactionMeta, signedTx),
|
|
2142
2139
|
status: "signed" /* signed */
|
|
2143
2140
|
};
|
|
2144
2141
|
this.updateTransaction(
|
|
@@ -2267,7 +2264,7 @@ createIncomingTransactionHelper_fn = function({
|
|
|
2267
2264
|
}) {
|
|
2268
2265
|
const incomingTransactionHelper = new IncomingTransactionHelper({
|
|
2269
2266
|
blockTracker,
|
|
2270
|
-
getCurrentAccount: this.
|
|
2267
|
+
getCurrentAccount: this.getSelectedAddress,
|
|
2271
2268
|
getLastFetchedBlockNumbers: () => this.state.lastFetchedBlockNumbers,
|
|
2272
2269
|
getChainId: chainId ? () => chainId : this.getChainId.bind(this),
|
|
2273
2270
|
isEnabled: __privateGet(this, _incomingTransactionOptions).isEnabled,
|
|
@@ -2417,6 +2414,7 @@ updateTransactionInternal_fn = function({
|
|
|
2417
2414
|
if (updatedTransactionParams.length > 0) {
|
|
2418
2415
|
__privateMethod(this, _onTransactionParamsUpdated, onTransactionParamsUpdated_fn).call(this, transactionMeta, updatedTransactionParams);
|
|
2419
2416
|
}
|
|
2417
|
+
return transactionMeta;
|
|
2420
2418
|
};
|
|
2421
2419
|
_checkIfTransactionParamsUpdated = new WeakSet();
|
|
2422
2420
|
checkIfTransactionParamsUpdated_fn = function(newTransactionMeta) {
|
|
@@ -2551,4 +2549,4 @@ export {
|
|
|
2551
2549
|
ApprovalState,
|
|
2552
2550
|
TransactionController
|
|
2553
2551
|
};
|
|
2554
|
-
//# sourceMappingURL=chunk-
|
|
2552
|
+
//# sourceMappingURL=chunk-26BABWPE.mjs.map
|