2021-06-08 17:25:48 +02:00
|
|
|
import { GAS_LIMITS } from '../../../../shared/constants/gas';
|
2021-03-09 22:37:19 +01:00
|
|
|
import {
|
|
|
|
ROPSTEN_CHAIN_ID,
|
|
|
|
ROPSTEN_NETWORK_ID,
|
2021-04-28 21:53:59 +02:00
|
|
|
} from '../../../../shared/constants/network';
|
2020-11-07 08:38:12 +01:00
|
|
|
import {
|
|
|
|
TRANSACTION_STATUSES,
|
|
|
|
TRANSACTION_TYPES,
|
2021-04-28 21:53:59 +02:00
|
|
|
} from '../../../../shared/constants/transaction';
|
2020-11-03 00:41:28 +01:00
|
|
|
import {
|
|
|
|
combineTransactionHistories,
|
|
|
|
getActivities,
|
2021-03-16 22:00:08 +01:00
|
|
|
} from './transaction-activity-log.util';
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('TransactionActivityLog utils', () => {
|
|
|
|
describe('combineTransactionHistories', () => {
|
|
|
|
it('should return no activities for an empty list of transactions', () => {
|
|
|
|
expect(combineTransactionHistories([])).toStrictEqual([]);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should return activities for an array of transactions', () => {
|
2020-02-11 17:51:13 +01:00
|
|
|
const transactions = [
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
hash:
|
|
|
|
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
2020-02-11 17:51:13 +01:00
|
|
|
history: [
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
id: 6400627574331058,
|
|
|
|
time: 1543958845581,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.UNAPPROVED,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
loadingDefaults: true,
|
|
|
|
txParams: {
|
|
|
|
from: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
|
|
|
|
to: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6',
|
|
|
|
value: '0x2386f26fc10000',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-11-03 00:41:28 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
2020-11-07 08:38:12 +01:00
|
|
|
type: TRANSACTION_TYPES.STANDARD,
|
2018-12-09 21:48:06 +01:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.APPROVED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'txStateManager: setting status to approved',
|
|
|
|
timestamp: 1543958847813,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.SUBMITTED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'txStateManager: setting status to submitted',
|
|
|
|
timestamp: 1543958848147,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.DROPPED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'txStateManager: setting status to dropped',
|
|
|
|
timestamp: 1543958897181,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
op: 'add',
|
|
|
|
path: '/replacedBy',
|
|
|
|
value:
|
|
|
|
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
|
|
|
},
|
|
|
|
],
|
2020-02-11 17:51:13 +01:00
|
|
|
],
|
|
|
|
id: 6400627574331058,
|
|
|
|
loadingDefaults: false,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.DROPPED,
|
2020-02-11 17:51:13 +01:00
|
|
|
submittedTime: 1543958848135,
|
|
|
|
time: 1543958845581,
|
|
|
|
txParams: {
|
|
|
|
from: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-02-11 17:51:13 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
|
|
|
nonce: '0x32',
|
|
|
|
to: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6',
|
|
|
|
value: '0x2386f26fc10000',
|
2018-12-09 21:48:06 +01:00
|
|
|
},
|
2020-11-07 08:38:12 +01:00
|
|
|
type: TRANSACTION_TYPES.STANDARD,
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
hash:
|
|
|
|
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
2020-02-11 17:51:13 +01:00
|
|
|
history: [
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
id: 6400627574331060,
|
|
|
|
time: 1543958857697,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.UNAPPROVED,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
loadingDefaults: false,
|
|
|
|
txParams: {
|
|
|
|
from: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
|
|
|
|
to: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6',
|
|
|
|
value: '0x2386f26fc10000',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-11-03 00:41:28 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
|
|
|
nonce: '0x32',
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
lastGasPrice: '0x4190ab00',
|
2020-11-07 08:38:12 +01:00
|
|
|
type: TRANSACTION_TYPES.RETRY,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/txParams/gasPrice',
|
|
|
|
value: '0x481f2280',
|
|
|
|
note: 'confTx: user approved transaction',
|
|
|
|
timestamp: 1543958859470,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.APPROVED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'txStateManager: setting status to approved',
|
|
|
|
timestamp: 1543958859485,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.SIGNED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'transactions#publishTransaction',
|
|
|
|
timestamp: 1543958859889,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.SUBMITTED,
|
2020-11-03 00:41:28 +01:00
|
|
|
note: 'txStateManager: setting status to submitted',
|
|
|
|
timestamp: 1543958860061,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'add',
|
|
|
|
path: '/firstRetryBlockNumber',
|
|
|
|
value: '0x45a0fd',
|
|
|
|
note: 'transactions/pending-tx-tracker#event: tx:block-update',
|
|
|
|
timestamp: 1543958896466,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.CONFIRMED,
|
2020-11-03 00:41:28 +01:00
|
|
|
timestamp: 1543958897165,
|
|
|
|
},
|
|
|
|
],
|
2020-02-11 17:51:13 +01:00
|
|
|
],
|
|
|
|
id: 6400627574331060,
|
|
|
|
lastGasPrice: '0x4190ab00',
|
|
|
|
loadingDefaults: false,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
2020-02-11 17:51:13 +01:00
|
|
|
submittedTime: 1543958860054,
|
|
|
|
time: 1543958857697,
|
|
|
|
txParams: {
|
|
|
|
from: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-02-11 17:51:13 +01:00
|
|
|
gasPrice: '0x481f2280',
|
|
|
|
nonce: '0x32',
|
|
|
|
to: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6',
|
|
|
|
value: '0x2386f26fc10000',
|
|
|
|
},
|
|
|
|
txReceipt: {
|
|
|
|
status: '0x1',
|
|
|
|
},
|
2020-11-07 08:38:12 +01:00
|
|
|
type: TRANSACTION_TYPES.RETRY,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
];
|
2020-02-11 17:51:13 +01:00
|
|
|
|
|
|
|
const expected = [
|
|
|
|
{
|
|
|
|
id: 6400627574331058,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
hash:
|
|
|
|
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
2020-02-11 17:51:13 +01:00
|
|
|
eventKey: 'transactionCreated',
|
|
|
|
timestamp: 1543958845581,
|
|
|
|
value: '0x2386f26fc10000',
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-02-11 17:51:13 +01:00
|
|
|
id: 6400627574331058,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
hash:
|
|
|
|
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
2020-02-11 17:51:13 +01:00
|
|
|
eventKey: 'transactionSubmitted',
|
|
|
|
timestamp: 1543958848147,
|
|
|
|
value: '0x1319718a5000',
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-02-11 17:51:13 +01:00
|
|
|
id: 6400627574331060,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
hash:
|
|
|
|
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
2020-02-11 17:51:13 +01:00
|
|
|
eventKey: 'transactionResubmitted',
|
|
|
|
timestamp: 1543958860061,
|
|
|
|
value: '0x171c3a061400',
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-02-11 17:51:13 +01:00
|
|
|
id: 6400627574331060,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-03 00:41:28 +01:00
|
|
|
hash:
|
|
|
|
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
2020-02-11 17:51:13 +01:00
|
|
|
eventKey: 'transactionConfirmed',
|
|
|
|
timestamp: 1543958897165,
|
|
|
|
value: '0x171c3a061400',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
];
|
2020-02-11 17:51:13 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(combineTransactionHistories(transactions)).toStrictEqual(expected);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2020-02-11 17:51:13 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('getActivities', () => {
|
|
|
|
it('should return no activities for an empty history', () => {
|
2020-02-11 17:51:13 +01:00
|
|
|
const transaction = {
|
|
|
|
history: [],
|
|
|
|
id: 1,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
2018-12-09 21:48:06 +01:00
|
|
|
txParams: {
|
2020-02-11 17:51:13 +01:00
|
|
|
from: '0x1',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2018-12-09 21:48:06 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
2020-02-11 17:51:13 +01:00
|
|
|
nonce: '0xa4',
|
|
|
|
to: '0x2',
|
2018-12-09 21:48:06 +01:00
|
|
|
value: '0x2386f26fc10000',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-11 17:51:13 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(getActivities(transaction)).toStrictEqual([]);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-02-11 17:51:13 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it("should return activities for a transaction's history", () => {
|
2020-02-11 17:51:13 +01:00
|
|
|
const transaction = {
|
2018-12-09 21:48:06 +01:00
|
|
|
history: [
|
|
|
|
{
|
2020-02-11 17:51:13 +01:00
|
|
|
id: 5559712943815343,
|
|
|
|
loadingDefaults: true,
|
2021-03-09 22:37:19 +01:00
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.UNAPPROVED,
|
2020-02-11 17:51:13 +01:00
|
|
|
time: 1535507561452,
|
|
|
|
txParams: {
|
|
|
|
from: '0x1',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-02-11 17:51:13 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
|
|
|
nonce: '0xa4',
|
|
|
|
to: '0x2',
|
|
|
|
value: '0x2386f26fc10000',
|
2018-12-09 21:48:06 +01:00
|
|
|
},
|
|
|
|
},
|
2020-02-11 17:51:13 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
op: 'replace',
|
|
|
|
path: '/loadingDefaults',
|
|
|
|
timestamp: 1535507561515,
|
|
|
|
value: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: '#newUnapprovedTransaction - adding the origin',
|
|
|
|
op: 'add',
|
|
|
|
path: '/origin',
|
|
|
|
timestamp: 1535507561516,
|
|
|
|
value: 'MetaMask',
|
|
|
|
},
|
|
|
|
[],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'confTx: user approved transaction',
|
|
|
|
op: 'replace',
|
|
|
|
path: '/txParams/gasPrice',
|
|
|
|
timestamp: 1535664571504,
|
|
|
|
value: '0x77359400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'txStateManager: setting status to approved',
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
|
|
|
timestamp: 1535507564302,
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.APPROVED,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'transactions#approveTransaction',
|
|
|
|
op: 'add',
|
|
|
|
path: '/txParams/nonce',
|
|
|
|
timestamp: 1535507564439,
|
|
|
|
value: '0xa4',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
op: 'add',
|
|
|
|
path: '/nonceDetails',
|
|
|
|
value: {
|
|
|
|
local: {},
|
|
|
|
network: {},
|
|
|
|
params: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'transactions#publishTransaction',
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
|
|
|
timestamp: 1535507564518,
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.SIGNED,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
op: 'add',
|
|
|
|
path: '/rawTx',
|
2020-11-03 00:41:28 +01:00
|
|
|
value:
|
|
|
|
'0xf86b81a4843b9aca008252089450a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706872386f26fc10000802aa007b30119fc4fc5954fad727895b7e3ba80a78d197e95703cc603bcf017879151a01c50beda40ffaee541da9c05b9616247074f25f392800e0ad6c7a835d5366edf',
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'transactions#setTxHash',
|
|
|
|
op: 'add',
|
|
|
|
path: '/hash',
|
|
|
|
timestamp: 1535507564658,
|
2020-11-03 00:41:28 +01:00
|
|
|
value:
|
|
|
|
'0x7acc4987b5c0dfa8d423798a8c561138259de1f98a62e3d52e7e83c0e0dd9fb7',
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'txStateManager - add submitted time stamp',
|
|
|
|
op: 'add',
|
|
|
|
path: '/submittedTime',
|
|
|
|
timestamp: 1535507564660,
|
|
|
|
value: 1535507564660,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'txStateManager: setting status to submitted',
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
|
|
|
timestamp: 1535507564665,
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.SUBMITTED,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'transactions/pending-tx-tracker#event: tx:block-update',
|
|
|
|
op: 'add',
|
|
|
|
path: '/firstRetryBlockNumber',
|
|
|
|
timestamp: 1535507575476,
|
|
|
|
value: '0x3bf624',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
note: 'txStateManager: setting status to confirmed',
|
|
|
|
op: 'replace',
|
|
|
|
path: '/status',
|
|
|
|
timestamp: 1535507615993,
|
2020-11-07 08:38:12 +01:00
|
|
|
value: TRANSACTION_STATUSES.CONFIRMED,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
],
|
2018-12-09 21:48:06 +01:00
|
|
|
],
|
2020-02-11 17:51:13 +01:00
|
|
|
id: 1,
|
2020-11-07 08:38:12 +01:00
|
|
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
2018-12-09 21:48:06 +01:00
|
|
|
txParams: {
|
2020-02-11 17:51:13 +01:00
|
|
|
from: '0x1',
|
2021-06-08 17:25:48 +02:00
|
|
|
gas: GAS_LIMITS.SIMPLE,
|
2020-02-11 17:51:13 +01:00
|
|
|
gasPrice: '0x3b9aca00',
|
|
|
|
nonce: '0xa4',
|
|
|
|
to: '0x2',
|
2018-12-09 21:48:06 +01:00
|
|
|
value: '0x2386f26fc10000',
|
|
|
|
},
|
2020-02-11 17:51:13 +01:00
|
|
|
hash: '0xabc',
|
2021-03-09 22:37:19 +01:00
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-12-09 21:48:06 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
const expectedResult = [
|
2018-08-31 21:34:22 +02:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
eventKey: 'transactionCreated',
|
|
|
|
timestamp: 1535507561452,
|
|
|
|
value: '0x2386f26fc10000',
|
|
|
|
id: 1,
|
|
|
|
hash: '0xabc',
|
2021-03-09 22:37:19 +01:00
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
2018-08-31 21:34:22 +02:00
|
|
|
},
|
2020-02-11 17:51:13 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
eventKey: 'transactionSubmitted',
|
|
|
|
timestamp: 1535507564665,
|
|
|
|
value: '0x2632e314a000',
|
|
|
|
id: 1,
|
|
|
|
hash: '0xabc',
|
2021-03-09 22:37:19 +01:00
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
eventKey: 'transactionConfirmed',
|
|
|
|
timestamp: 1535507615993,
|
|
|
|
value: '0x2632e314a000',
|
|
|
|
id: 1,
|
|
|
|
hash: '0xabc',
|
2021-03-09 22:37:19 +01:00
|
|
|
chainId: ROPSTEN_CHAIN_ID,
|
|
|
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
2020-02-11 17:51:13 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
];
|
2018-08-31 21:34:22 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(getActivities(transaction, true)).toStrictEqual(expectedResult);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|