This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathLogs.test.ts
94 lines (91 loc) · 3.93 KB
/
Logs.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { getSolo } from './helpers/Solo';
import { TestSolo } from './modules/TestSolo';
let solo: TestSolo;
describe('Logs', () => {
beforeAll(async () => {
const r = await getSolo();
solo = r.solo;
});
it('Succeeds in parsing txResult.logs', async () => {
const txResult = {
logs: [
{
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
blockHash: '0x81441018c1131afd6f7ceec2077257f4ecfc3325d56b375bf370008d17a20d65',
blockNumber: 7492404,
data: '0x00000000000000000000000000000000000000000000000000038d7ea4c68000',
logIndex: 119,
removed: false,
topics: [
'0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c',
'0x0000000000000000000000006e86dc68723d9811f67d9f6acfec6ec9d3818527',
],
transactionHash: '0xfbb9bc794809a190e7a18278181128d53ed41cec7bf34667e7052edfbff8ad69',
transactionIndex: 152,
transactionLogIndex: '0x0',
type: 'mined',
id: 'log_21ca9c63',
},
{
address: solo.contracts.testSoloMargin.options.address,
blockHash: '0x81441018c1131afd6f7ceec2077257f4ecfc3325d56b375bf370008d17a20d65',
blockNumber: 7492404,
data: '0x0000000000000000000000006e86dc68723d9811f67d9f6acfec6ec9d3818527',
logIndex: 120,
removed: false,
topics: [
'0x91b01baeee3a24b590d112613814d86801005c7ef9353e7fc1eaeaf33ccf83b0',
],
transactionHash: '0xfbb9bc794809a190e7a18278181128d53ed41cec7bf34667e7052edfbff8ad69',
transactionIndex: 152,
transactionLogIndex: '0x1',
type: 'mined',
id: 'log_0ffe7292',
},
{
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
blockHash: '0x81441018c1131afd6f7ceec2077257f4ecfc3325d56b375bf370008d17a20d65',
blockNumber: 7492404,
data: '0x00000000000000000000000000000000000000000000000000038d7ea4c68000',
logIndex: 122,
removed: false,
topics: [
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
'0x0000000000000000000000006e86dc68723d9811f67d9f6acfec6ec9d3818527',
'0x00000000000000000000000022cb2d5de2009c9afd321bdf8759743665e45844',
],
transactionHash: '0xfbb9bc794809a190e7a18278181128d53ed41cec7bf34667e7052edfbff8ad69',
transactionIndex: 152,
transactionLogIndex: '0x3',
type: 'mined',
id: 'log_e4f19380',
},
{
address: solo.contracts.testSoloMargin.options.address,
blockHash: '0x81441018c1131afd6f7ceec2077257f4ecfc3325d56b375bf370008d17a20d65',
blockNumber: 7492404,
data: '0x0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'00000000000000000000000000000000000000000000000000038d7ea4c68000' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'00000000000000000000000000000000000000000000000000038d7ea4c68000' +
'0000000000000000000000006e86dc68723d9811f67d9f6acfec6ec9d3818527',
logIndex: 123,
removed: false,
topics: [
'0x2bad8bc95088af2c247b30fa2b2e6a0886f88625e0945cd3051008e0e270198f',
'0x0000000000000000000000006a08b12aa520d319768e0d3a779af8660794c5e1',
],
transactionHash: '0xfbb9bc794809a190e7a18278181128d53ed41cec7bf34667e7052edfbff8ad69',
transactionIndex: 152,
transactionLogIndex: '0x4',
type: 'mined',
id: 'log_9aab3f86',
},
],
};
const logs = solo.logs.parseLogs((txResult as any));
expect(logs.length).not.toEqual(0);
});
});