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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import { ethers } from 'ethers'
import { describe, it, expect } from 'vitest'
import { getEvents } from './getEvents'
describe(getEvents.name, () => {
// sinc this test is using https://goerli.optimism.io it is currently skipped
// we should start anvil for goerli too and then we can remove this skip
it.skipIf(process.env.CI)('should get events on goerli', async () => {
const key = 'animalfarm.school.attended'
const creator = '0xBCf86Fd70a0183433763ab0c14E7a760194f3a9F'
expect(
await getEvents({
creator,
about: '0x00000000000000000000000000000000000060A7',
key,
provider: new ethers.providers.JsonRpcProvider(
'https://goerli.optimism.io'
),
})
).toMatchInlineSnapshot(`
[
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0xBCf86Fd70a0183433763ab0c14E7a760194f3a9F",
"0x00000000000000000000000000000000000060A7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
"0x01",
],
"blockHash": "0x75feb3572d4b7d682cf632bf64df72c8d9c336dedcf8df1c88f755d529ec1b85",
"blockNumber": 3463240,
"data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 0,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x000000000000000000000000bcf86fd70a0183433763ab0c14e7a760194f3a9f",
"0x00000000000000000000000000000000000000000000000000000000000060a7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
],
"transactionHash": "0x0e77a32b2558f39e60c3e81bd6efd811cf4b3bd80a4f666d042a221ea63c93ab",
"transactionIndex": 0,
},
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0xBCf86Fd70a0183433763ab0c14E7a760194f3a9F",
"0x00000000000000000000000000000000000060A7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
"0x01",
],
"blockHash": "0xdb11b4b06e5866be931667b8c62dca182240b9256a3d8c64c1c247107aa33752",
"blockNumber": 4105095,
"data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 0,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x000000000000000000000000bcf86fd70a0183433763ab0c14e7a760194f3a9f",
"0x00000000000000000000000000000000000000000000000000000000000060a7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
],
"transactionHash": "0x61f59bd4dfe54272d9369effe3ae57a0ef2584161fcf2bbd55f5596002e759bd",
"transactionIndex": 1,
},
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0xBCf86Fd70a0183433763ab0c14E7a760194f3a9F",
"0x00000000000000000000000000000000000060A7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
"0x01",
],
"blockHash": "0x4870baaac6d7195952dc25e5dc0109ea324f819f8152d2889c7b4ad64040a9bf",
"blockNumber": 6278428,
"data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 0,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x000000000000000000000000bcf86fd70a0183433763ab0c14e7a760194f3a9f",
"0x00000000000000000000000000000000000000000000000000000000000060a7",
"0x616e696d616c6661726d2e7363686f6f6c2e617474656e646564000000000000",
],
"transactionHash": "0x4e836b74c51a370375efa374297524d9b0f6eacdd699c30556680ae7dc9a14ea",
"transactionIndex": 1,
},
]
`)
})
it('should get events on mainnet', async () => {
const creator = '0x60c5C9c98bcBd0b0F2fD89B24c16e533BaA8CdA3'
const about = '0x2335022c740d17c2837f9C884Bfe4fFdbf0A95D5'
const key = 'optimist.base-uri'
expect(
await getEvents({
creator,
about,
key,
provider: new ethers.providers.JsonRpcProvider('http://localhost:8545'),
})
).toMatchInlineSnapshot(`
[
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0x60c5C9c98bcBd0b0F2fD89B24c16e533BaA8CdA3",
"0x2335022c740d17c2837f9C884Bfe4fFdbf0A95D5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
"0x68747470733a2f2f73746f726167656170692e666c65656b2e636f2f33336630633965392d666437392d343634622d613431642d3634343238313961316230352d6275636b65742f6f7074696d6973742d6e66742f61747472696275746573",
],
"blockHash": "0x5b5f34cb7a72eb6aaf6d8af873f210278738573386c88f85c605067c10d67ee3",
"blockNumber": 50135778,
"data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005f68747470733a2f2f73746f726167656170692e666c65656b2e636f2f33336630633965392d666437392d343634622d613431642d3634343238313961316230352d6275636b65742f6f7074696d6973742d6e66742f6174747269627574657300",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 1,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x00000000000000000000000060c5c9c98bcbd0b0f2fd89b24c16e533baa8cda3",
"0x0000000000000000000000002335022c740d17c2837f9c884bfe4ffdbf0a95d5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
],
"transactionHash": "0x265c98ce12e0836616efd3ea2130df9647729574feb40d5607e4031ff9aace01",
"transactionIndex": 0,
},
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0x60c5C9c98bcBd0b0F2fD89B24c16e533BaA8CdA3",
"0x2335022c740d17c2837f9C884Bfe4fFdbf0A95D5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
"0x68747470733a2f2f6173736574732e6f7074696d69736d2e696f2f34613630393636312d363737342d343431662d396664622d3435336664626238393933312d6275636b65742f6f7074696d6973742d6e66742f61747472696275746573",
],
"blockHash": "0x889ad6bb2eb7aee0c095c1f6cc11f5a7a65917d7bc06500dad3213fb031f1e9c",
"blockNumber": 50141511,
"data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005e68747470733a2f2f6173736574732e6f7074696d69736d2e696f2f34613630393636312d363737342d343431662d396664622d3435336664626238393933312d6275636b65742f6f7074696d6973742d6e66742f617474726962757465730000",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 1,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x00000000000000000000000060c5c9c98bcbd0b0f2fd89b24c16e533baa8cda3",
"0x0000000000000000000000002335022c740d17c2837f9c884bfe4ffdbf0a95d5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
],
"transactionHash": "0xf4c0fc1ceec42831252c90b7d5c1e7a5bd6d9642d07c80afc8b525211852ee03",
"transactionIndex": 0,
},
{
"address": "0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77",
"args": [
"0x60c5C9c98bcBd0b0F2fD89B24c16e533BaA8CdA3",
"0x2335022c740d17c2837f9C884Bfe4fFdbf0A95D5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
"0x68747470733a2f2f6173736574732e6f7074696d69736d2e696f2f34613630393636312d363737342d343431662d396664622d3435336664626238393933312d6275636b65742f6f7074696d6973742d6e66742f61747472696275746573",
],
"blockHash": "0x120931c24234d03af66b9b21fcaf3b97242ed8f0c0418a9b16fc5cc1a804e917",
"blockNumber": 50141837,
"data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005e68747470733a2f2f6173736574732e6f7074696d69736d2e696f2f34613630393636312d363737342d343431662d396664622d3435336664626238393933312d6275636b65742f6f7074696d6973742d6e66742f617474726962757465730000",
"decode": [Function],
"event": "AttestationCreated",
"eventSignature": "AttestationCreated(address,address,bytes32,bytes)",
"getBlock": [Function],
"getTransaction": [Function],
"getTransactionReceipt": [Function],
"logIndex": 1,
"removeListener": [Function],
"removed": false,
"topics": [
"0x28710dfecab43d1e29e02aa56b2e1e610c0bae19135c9cf7a83a1adb6df96d85",
"0x00000000000000000000000060c5c9c98bcbd0b0f2fd89b24c16e533baa8cda3",
"0x0000000000000000000000002335022c740d17c2837f9c884bfe4ffdbf0a95d5",
"0x6f7074696d6973742e626173652d757269000000000000000000000000000000",
],
"transactionHash": "0xfaf727afe431a920448636b80864dfeeef690903756f9c3041eb625ffcc82f11",
"transactionIndex": 0,
},
]
`)
})
})