@sentio/sdk 1.30.2 → 1.31.0
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/lib/aptos/aptos-processor.d.ts +9 -2
- package/lib/aptos/aptos-processor.js +12 -3
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/builtin/erc1155/index.d.ts +2 -0
- package/lib/builtin/erc1155/index.js +22 -0
- package/lib/builtin/erc1155/index.js.map +1 -0
- package/lib/builtin/erc1155/test-utils.d.ts +6 -0
- package/lib/builtin/erc1155/test-utils.js +57 -0
- package/lib/builtin/erc1155/test-utils.js.map +1 -0
- package/lib/builtin/erc721/index.d.ts +2 -0
- package/lib/builtin/erc721/index.js +22 -0
- package/lib/builtin/erc721/index.js.map +1 -0
- package/lib/builtin/erc721/test-utils.d.ts +5 -0
- package/lib/builtin/erc721/test-utils.js +46 -0
- package/lib/builtin/erc721/test-utils.js.map +1 -0
- package/lib/builtin/internal/ERC1155.d.ts +199 -0
- package/lib/builtin/internal/ERC1155.js +3 -0
- package/lib/builtin/internal/ERC1155.js.map +1 -0
- package/lib/builtin/internal/ERC721.d.ts +252 -0
- package/lib/builtin/internal/ERC721.js +3 -0
- package/lib/builtin/internal/ERC721.js.map +1 -0
- package/lib/builtin/internal/erc1155_processor.d.ts +134 -0
- package/lib/builtin/internal/erc1155_processor.js +337 -0
- package/lib/builtin/internal/erc1155_processor.js.map +1 -0
- package/lib/builtin/internal/erc721_processor.d.ts +169 -0
- package/lib/builtin/internal/erc721_processor.js +479 -0
- package/lib/builtin/internal/erc721_processor.js.map +1 -0
- package/lib/builtin/internal/factories/ERC1155__factory.d.ts +35 -0
- package/lib/builtin/internal/factories/ERC1155__factory.js +332 -0
- package/lib/builtin/internal/factories/ERC1155__factory.js.map +1 -0
- package/lib/builtin/internal/factories/ERC721__factory.d.ts +51 -0
- package/lib/builtin/internal/factories/ERC721__factory.js +364 -0
- package/lib/builtin/internal/factories/ERC721__factory.js.map +1 -0
- package/lib/builtin/internal/factories/index.d.ts +2 -0
- package/lib/builtin/internal/factories/index.js +5 -1
- package/lib/builtin/internal/factories/index.js.map +1 -1
- package/lib/builtin/internal/index.d.ts +4 -0
- package/lib/builtin/internal/index.js +5 -1
- package/lib/builtin/internal/index.js.map +1 -1
- package/lib/core/account-processor.d.ts +58 -0
- package/lib/core/account-processor.js +147 -0
- package/lib/core/account-processor.js.map +1 -0
- package/lib/core/base-processor.d.ts +5 -2
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/bind-options.d.ts +5 -0
- package/lib/core/bind-options.js +7 -1
- package/lib/core/bind-options.js.map +1 -1
- package/lib/core/context.d.ts +7 -1
- package/lib/core/context.js +30 -18
- package/lib/core/context.js.map +1 -1
- package/lib/core/event-tracker.d.ts +5 -1
- package/lib/core/event-tracker.js +8 -5
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/meter.js +6 -0
- package/lib/core/meter.js.map +1 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +1 -0
- package/lib/gen/chainquery/protos/chainquery.js +17 -1
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +11 -0
- package/lib/gen/processor/protos/processor.js +84 -3
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/service.d.ts +1 -0
- package/lib/service.js +72 -45
- package/lib/service.js.map +1 -1
- package/lib/state/processor-state.d.ts +1 -5
- package/lib/state/processor-state.js +1 -3
- package/lib/state/processor-state.js.map +1 -1
- package/lib/state/state-storage.d.ts +5 -0
- package/lib/state/state-storage.js +15 -1
- package/lib/state/state-storage.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +6 -2
- package/lib/testing/test-processor-server.js +66 -5
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/price.js +11 -4
- package/lib/utils/price.js.map +1 -1
- package/package.json +1 -1
- package/src/abis/ERC1155.json +314 -0
- package/src/abis/ERC721.json +346 -0
- package/src/aptos/aptos-processor.ts +15 -6
- package/src/builtin/erc1155/index.ts +6 -0
- package/src/builtin/erc1155/test-utils.ts +89 -0
- package/src/builtin/erc721/index.ts +6 -0
- package/src/builtin/erc721/test-utils.ts +71 -0
- package/src/builtin/internal/ERC1155.ts +529 -0
- package/src/builtin/internal/ERC721.ts +639 -0
- package/src/builtin/internal/erc1155_processor.ts +580 -0
- package/src/builtin/internal/erc721_processor.ts +768 -0
- package/src/builtin/internal/factories/ERC1155__factory.ts +335 -0
- package/src/builtin/internal/factories/ERC721__factory.ts +364 -0
- package/src/builtin/internal/factories/index.ts +2 -0
- package/src/builtin/internal/index.ts +4 -0
- package/src/core/account-processor.ts +217 -0
- package/src/core/base-processor.ts +6 -2
- package/src/core/bind-options.ts +6 -0
- package/src/core/context.ts +42 -27
- package/src/core/event-tracker.ts +8 -5
- package/src/core/meter.ts +9 -3
- package/src/gen/chainquery/protos/chainquery.ts +18 -1
- package/src/gen/processor/protos/processor.ts +88 -1
- package/src/index.ts +1 -1
- package/src/service.ts +80 -49
- package/src/state/processor-state.ts +1 -6
- package/src/state/state-storage.ts +16 -0
- package/src/testing/test-processor-server.ts +71 -5
- package/src/utils/price.ts +12 -4
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"indexed": true,
|
|
7
|
+
"internalType": "address",
|
|
8
|
+
"name": "owner",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"indexed": true,
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "approved",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"indexed": true,
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "tokenId",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "Approval",
|
|
25
|
+
"type": "event"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"anonymous": false,
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
31
|
+
"indexed": true,
|
|
32
|
+
"internalType": "address",
|
|
33
|
+
"name": "owner",
|
|
34
|
+
"type": "address"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"indexed": true,
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "operator",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"indexed": false,
|
|
44
|
+
"internalType": "bool",
|
|
45
|
+
"name": "approved",
|
|
46
|
+
"type": "bool"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"name": "ApprovalForAll",
|
|
50
|
+
"type": "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"anonymous": false,
|
|
54
|
+
"inputs": [
|
|
55
|
+
{
|
|
56
|
+
"indexed": true,
|
|
57
|
+
"internalType": "address",
|
|
58
|
+
"name": "from",
|
|
59
|
+
"type": "address"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"indexed": true,
|
|
63
|
+
"internalType": "address",
|
|
64
|
+
"name": "to",
|
|
65
|
+
"type": "address"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"indexed": true,
|
|
69
|
+
"internalType": "uint256",
|
|
70
|
+
"name": "tokenId",
|
|
71
|
+
"type": "uint256"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"name": "Transfer",
|
|
75
|
+
"type": "event"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"inputs": [
|
|
79
|
+
{
|
|
80
|
+
"internalType": "address",
|
|
81
|
+
"name": "to",
|
|
82
|
+
"type": "address"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"internalType": "uint256",
|
|
86
|
+
"name": "tokenId",
|
|
87
|
+
"type": "uint256"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"name": "approve",
|
|
91
|
+
"outputs": [],
|
|
92
|
+
"stateMutability": "nonpayable",
|
|
93
|
+
"type": "function"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"constant": true,
|
|
97
|
+
"inputs": [],
|
|
98
|
+
"name": "totalSupply",
|
|
99
|
+
"outputs": [
|
|
100
|
+
{
|
|
101
|
+
"name": "",
|
|
102
|
+
"type": "uint256"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"payable": false,
|
|
106
|
+
"stateMutability": "view",
|
|
107
|
+
"type": "function"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"inputs": [
|
|
111
|
+
{
|
|
112
|
+
"internalType": "address",
|
|
113
|
+
"name": "owner",
|
|
114
|
+
"type": "address"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"name": "balanceOf",
|
|
118
|
+
"outputs": [
|
|
119
|
+
{
|
|
120
|
+
"internalType": "uint256",
|
|
121
|
+
"name": "balance",
|
|
122
|
+
"type": "uint256"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"stateMutability": "view",
|
|
126
|
+
"type": "function"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"inputs": [
|
|
130
|
+
{
|
|
131
|
+
"internalType": "uint256",
|
|
132
|
+
"name": "tokenId",
|
|
133
|
+
"type": "uint256"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"name": "getApproved",
|
|
137
|
+
"outputs": [
|
|
138
|
+
{
|
|
139
|
+
"internalType": "address",
|
|
140
|
+
"name": "operator",
|
|
141
|
+
"type": "address"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"stateMutability": "view",
|
|
145
|
+
"type": "function"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"inputs": [
|
|
149
|
+
{
|
|
150
|
+
"internalType": "address",
|
|
151
|
+
"name": "owner",
|
|
152
|
+
"type": "address"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"internalType": "address",
|
|
156
|
+
"name": "operator",
|
|
157
|
+
"type": "address"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"name": "isApprovedForAll",
|
|
161
|
+
"outputs": [
|
|
162
|
+
{
|
|
163
|
+
"internalType": "bool",
|
|
164
|
+
"name": "",
|
|
165
|
+
"type": "bool"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [],
|
|
173
|
+
"name": "name",
|
|
174
|
+
"outputs": [
|
|
175
|
+
{
|
|
176
|
+
"internalType": "string",
|
|
177
|
+
"name": "",
|
|
178
|
+
"type": "string"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"stateMutability": "view",
|
|
182
|
+
"type": "function"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"inputs": [
|
|
186
|
+
{
|
|
187
|
+
"internalType": "uint256",
|
|
188
|
+
"name": "tokenId",
|
|
189
|
+
"type": "uint256"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"name": "ownerOf",
|
|
193
|
+
"outputs": [
|
|
194
|
+
{
|
|
195
|
+
"internalType": "address",
|
|
196
|
+
"name": "owner",
|
|
197
|
+
"type": "address"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"stateMutability": "view",
|
|
201
|
+
"type": "function"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"inputs": [
|
|
205
|
+
{
|
|
206
|
+
"internalType": "address",
|
|
207
|
+
"name": "from",
|
|
208
|
+
"type": "address"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"internalType": "address",
|
|
212
|
+
"name": "to",
|
|
213
|
+
"type": "address"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"internalType": "uint256",
|
|
217
|
+
"name": "tokenId",
|
|
218
|
+
"type": "uint256"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"name": "safeTransferFrom",
|
|
222
|
+
"outputs": [],
|
|
223
|
+
"stateMutability": "nonpayable",
|
|
224
|
+
"type": "function"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"inputs": [
|
|
228
|
+
{
|
|
229
|
+
"internalType": "address",
|
|
230
|
+
"name": "from",
|
|
231
|
+
"type": "address"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"internalType": "address",
|
|
235
|
+
"name": "to",
|
|
236
|
+
"type": "address"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"internalType": "uint256",
|
|
240
|
+
"name": "tokenId",
|
|
241
|
+
"type": "uint256"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"internalType": "bytes",
|
|
245
|
+
"name": "data",
|
|
246
|
+
"type": "bytes"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"name": "safeTransferFrom",
|
|
250
|
+
"outputs": [],
|
|
251
|
+
"stateMutability": "nonpayable",
|
|
252
|
+
"type": "function"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": [
|
|
256
|
+
{
|
|
257
|
+
"internalType": "address",
|
|
258
|
+
"name": "operator",
|
|
259
|
+
"type": "address"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"internalType": "bool",
|
|
263
|
+
"name": "_approved",
|
|
264
|
+
"type": "bool"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"name": "setApprovalForAll",
|
|
268
|
+
"outputs": [],
|
|
269
|
+
"stateMutability": "nonpayable",
|
|
270
|
+
"type": "function"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"inputs": [
|
|
274
|
+
{
|
|
275
|
+
"internalType": "bytes4",
|
|
276
|
+
"name": "interfaceId",
|
|
277
|
+
"type": "bytes4"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"name": "supportsInterface",
|
|
281
|
+
"outputs": [
|
|
282
|
+
{
|
|
283
|
+
"internalType": "bool",
|
|
284
|
+
"name": "",
|
|
285
|
+
"type": "bool"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
"stateMutability": "view",
|
|
289
|
+
"type": "function"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"inputs": [],
|
|
293
|
+
"name": "symbol",
|
|
294
|
+
"outputs": [
|
|
295
|
+
{
|
|
296
|
+
"internalType": "string",
|
|
297
|
+
"name": "",
|
|
298
|
+
"type": "string"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"stateMutability": "view",
|
|
302
|
+
"type": "function"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"inputs": [
|
|
306
|
+
{
|
|
307
|
+
"internalType": "uint256",
|
|
308
|
+
"name": "tokenId",
|
|
309
|
+
"type": "uint256"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"name": "tokenURI",
|
|
313
|
+
"outputs": [
|
|
314
|
+
{
|
|
315
|
+
"internalType": "string",
|
|
316
|
+
"name": "",
|
|
317
|
+
"type": "string"
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"stateMutability": "view",
|
|
321
|
+
"type": "function"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"inputs": [
|
|
325
|
+
{
|
|
326
|
+
"internalType": "address",
|
|
327
|
+
"name": "from",
|
|
328
|
+
"type": "address"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"internalType": "address",
|
|
332
|
+
"name": "to",
|
|
333
|
+
"type": "address"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"internalType": "uint256",
|
|
337
|
+
"name": "tokenId",
|
|
338
|
+
"type": "uint256"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"name": "transferFrom",
|
|
342
|
+
"outputs": [],
|
|
343
|
+
"stateMutability": "nonpayable",
|
|
344
|
+
"type": "function"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ProcessResult } from '../gen'
|
|
2
|
-
|
|
3
|
-
import { TYPE_REGISTRY, TypeRegistry } from './type-registry'
|
|
4
|
-
import { AptosBindOptions, AptosNetwork, getChainId } from './network'
|
|
5
1
|
import {
|
|
6
2
|
MoveResource,
|
|
7
3
|
Transaction_UserTransaction,
|
|
8
4
|
TransactionPayload_EntryFunctionPayload,
|
|
9
5
|
} from 'aptos-sdk/src/generated'
|
|
6
|
+
|
|
7
|
+
import { TYPE_REGISTRY, TypeRegistry } from './type-registry'
|
|
8
|
+
import { AptosBindOptions, AptosNetwork, getChainId } from './network'
|
|
10
9
|
import { AptosContext, AptosResourceContext } from './context'
|
|
11
10
|
import { EventInstance } from './models'
|
|
11
|
+
import { ListStateStorage } from '../state/state-storage'
|
|
12
|
+
import { ProcessResult } from '../gen'
|
|
12
13
|
|
|
13
14
|
type IndexConfigure = {
|
|
14
15
|
address: string
|
|
@@ -60,6 +61,10 @@ class ResourceHandlder {
|
|
|
60
61
|
handler: (resource: MoveResourcesWithVersionPayload) => Promise<ProcessResult>
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
export class AptosProcessorState extends ListStateStorage<AptosBaseProcessor> {
|
|
65
|
+
static INSTANCE = new AptosProcessorState()
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
export class AptosBaseProcessor {
|
|
64
69
|
readonly moduleName: string
|
|
65
70
|
config: IndexConfigure
|
|
@@ -69,7 +74,7 @@ export class AptosBaseProcessor {
|
|
|
69
74
|
constructor(moduleName: string, options: AptosBindOptions) {
|
|
70
75
|
this.moduleName = moduleName
|
|
71
76
|
this.config = configure(options)
|
|
72
|
-
|
|
77
|
+
AptosProcessorState.INSTANCE.addValue(this)
|
|
73
78
|
this.loadTypes(TYPE_REGISTRY)
|
|
74
79
|
}
|
|
75
80
|
|
|
@@ -202,6 +207,10 @@ export class AptosBaseProcessor {
|
|
|
202
207
|
}
|
|
203
208
|
}
|
|
204
209
|
|
|
210
|
+
export class AptosAccountProcessorState extends ListStateStorage<AptosAccountProcessor> {
|
|
211
|
+
static INSTANCE = new AptosAccountProcessorState()
|
|
212
|
+
}
|
|
213
|
+
|
|
205
214
|
export class AptosAccountProcessor {
|
|
206
215
|
config: IndexConfigure
|
|
207
216
|
|
|
@@ -213,7 +222,7 @@ export class AptosAccountProcessor {
|
|
|
213
222
|
|
|
214
223
|
protected constructor(options: AptosBindOptions) {
|
|
215
224
|
this.config = configure(options)
|
|
216
|
-
|
|
225
|
+
AptosAccountProcessorState.INSTANCE.addValue(this)
|
|
217
226
|
}
|
|
218
227
|
|
|
219
228
|
getChainId(): string {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { Log } from "@ethersproject/providers";
|
|
5
|
+
import {
|
|
6
|
+
getERC1155Contract,
|
|
7
|
+
ApprovalForAllEventObject,
|
|
8
|
+
TransferBatchEventObject,
|
|
9
|
+
TransferSingleEventObject,
|
|
10
|
+
URIEventObject,
|
|
11
|
+
} from ".";
|
|
12
|
+
const mockField = {
|
|
13
|
+
blockHash:
|
|
14
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
15
|
+
blockNumber: 0,
|
|
16
|
+
logIndex: 0,
|
|
17
|
+
removed: false,
|
|
18
|
+
transactionHash:
|
|
19
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
20
|
+
transactionIndex: 0,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function mockApprovalForAllLog(
|
|
24
|
+
contractAddress: string,
|
|
25
|
+
event: ApprovalForAllEventObject
|
|
26
|
+
): Log {
|
|
27
|
+
const contract = getERC1155Contract(contractAddress);
|
|
28
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
29
|
+
contract.rawContract.interface.getEvent("ApprovalForAll"),
|
|
30
|
+
[event.account, event.operator, event.approved]
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
...mockField,
|
|
34
|
+
address: contractAddress,
|
|
35
|
+
data: encodedLog.data,
|
|
36
|
+
topics: encodedLog.topics,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function mockTransferBatchLog(
|
|
41
|
+
contractAddress: string,
|
|
42
|
+
event: TransferBatchEventObject
|
|
43
|
+
): Log {
|
|
44
|
+
const contract = getERC1155Contract(contractAddress);
|
|
45
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
46
|
+
contract.rawContract.interface.getEvent("TransferBatch"),
|
|
47
|
+
[event.operator, event.from, event.to, event.ids, event.values]
|
|
48
|
+
);
|
|
49
|
+
return {
|
|
50
|
+
...mockField,
|
|
51
|
+
address: contractAddress,
|
|
52
|
+
data: encodedLog.data,
|
|
53
|
+
topics: encodedLog.topics,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function mockTransferSingleLog(
|
|
58
|
+
contractAddress: string,
|
|
59
|
+
event: TransferSingleEventObject
|
|
60
|
+
): Log {
|
|
61
|
+
const contract = getERC1155Contract(contractAddress);
|
|
62
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
63
|
+
contract.rawContract.interface.getEvent("TransferSingle"),
|
|
64
|
+
[event.operator, event.from, event.to, event.id, event.value]
|
|
65
|
+
);
|
|
66
|
+
return {
|
|
67
|
+
...mockField,
|
|
68
|
+
address: contractAddress,
|
|
69
|
+
data: encodedLog.data,
|
|
70
|
+
topics: encodedLog.topics,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function mockURILog(
|
|
75
|
+
contractAddress: string,
|
|
76
|
+
event: URIEventObject
|
|
77
|
+
): Log {
|
|
78
|
+
const contract = getERC1155Contract(contractAddress);
|
|
79
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
80
|
+
contract.rawContract.interface.getEvent("URI"),
|
|
81
|
+
[event.value, event.id]
|
|
82
|
+
);
|
|
83
|
+
return {
|
|
84
|
+
...mockField,
|
|
85
|
+
address: contractAddress,
|
|
86
|
+
data: encodedLog.data,
|
|
87
|
+
topics: encodedLog.topics,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { Log } from "@ethersproject/providers";
|
|
5
|
+
import {
|
|
6
|
+
getERC721Contract,
|
|
7
|
+
ApprovalEventObject,
|
|
8
|
+
ApprovalForAllEventObject,
|
|
9
|
+
TransferEventObject,
|
|
10
|
+
} from ".";
|
|
11
|
+
const mockField = {
|
|
12
|
+
blockHash:
|
|
13
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
14
|
+
blockNumber: 0,
|
|
15
|
+
logIndex: 0,
|
|
16
|
+
removed: false,
|
|
17
|
+
transactionHash:
|
|
18
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
19
|
+
transactionIndex: 0,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function mockApprovalLog(
|
|
23
|
+
contractAddress: string,
|
|
24
|
+
event: ApprovalEventObject
|
|
25
|
+
): Log {
|
|
26
|
+
const contract = getERC721Contract(contractAddress);
|
|
27
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
28
|
+
contract.rawContract.interface.getEvent("Approval"),
|
|
29
|
+
[event.owner, event.approved, event.tokenId]
|
|
30
|
+
);
|
|
31
|
+
return {
|
|
32
|
+
...mockField,
|
|
33
|
+
address: contractAddress,
|
|
34
|
+
data: encodedLog.data,
|
|
35
|
+
topics: encodedLog.topics,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function mockApprovalForAllLog(
|
|
40
|
+
contractAddress: string,
|
|
41
|
+
event: ApprovalForAllEventObject
|
|
42
|
+
): Log {
|
|
43
|
+
const contract = getERC721Contract(contractAddress);
|
|
44
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
45
|
+
contract.rawContract.interface.getEvent("ApprovalForAll"),
|
|
46
|
+
[event.owner, event.operator, event.approved]
|
|
47
|
+
);
|
|
48
|
+
return {
|
|
49
|
+
...mockField,
|
|
50
|
+
address: contractAddress,
|
|
51
|
+
data: encodedLog.data,
|
|
52
|
+
topics: encodedLog.topics,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function mockTransferLog(
|
|
57
|
+
contractAddress: string,
|
|
58
|
+
event: TransferEventObject
|
|
59
|
+
): Log {
|
|
60
|
+
const contract = getERC721Contract(contractAddress);
|
|
61
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
62
|
+
contract.rawContract.interface.getEvent("Transfer"),
|
|
63
|
+
[event.from, event.to, event.tokenId]
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
...mockField,
|
|
67
|
+
address: contractAddress,
|
|
68
|
+
data: encodedLog.data,
|
|
69
|
+
topics: encodedLog.topics,
|
|
70
|
+
};
|
|
71
|
+
}
|