2021-02-04 19:15:23 +01:00
|
|
|
import { snapshotFromTxMeta } from '../../app/scripts/controllers/transactions/lib/tx-state-history-helpers';
|
2023-01-18 15:47:29 +01:00
|
|
|
import { TransactionStatus } from '../../shared/constants/transaction';
|
2018-05-25 08:19:39 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export default function createTxMeta(partialMeta) {
|
2020-08-19 18:27:05 +02:00
|
|
|
const txMeta = {
|
2023-01-18 15:47:29 +01:00
|
|
|
status: TransactionStatus.unapproved,
|
2018-05-25 08:19:39 +02:00
|
|
|
txParams: {},
|
2020-08-19 18:27:05 +02:00
|
|
|
...partialMeta,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-05-25 08:19:39 +02:00
|
|
|
// initialize history
|
2021-02-04 19:15:23 +01:00
|
|
|
txMeta.history = [];
|
2018-05-25 08:19:39 +02:00
|
|
|
// capture initial snapshot of txMeta for history
|
2021-02-04 19:15:23 +01:00
|
|
|
const snapshot = snapshotFromTxMeta(txMeta);
|
|
|
|
txMeta.history.push(snapshot);
|
|
|
|
return txMeta;
|
2018-05-25 08:19:39 +02:00
|
|
|
}
|