@sentio/sdk 1.30.3 → 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.
Files changed (85) hide show
  1. package/lib/builtin/erc1155/index.d.ts +2 -0
  2. package/lib/builtin/erc1155/index.js +22 -0
  3. package/lib/builtin/erc1155/index.js.map +1 -0
  4. package/lib/builtin/erc1155/test-utils.d.ts +6 -0
  5. package/lib/builtin/erc1155/test-utils.js +57 -0
  6. package/lib/builtin/erc1155/test-utils.js.map +1 -0
  7. package/lib/builtin/erc721/index.d.ts +2 -0
  8. package/lib/builtin/erc721/index.js +22 -0
  9. package/lib/builtin/erc721/index.js.map +1 -0
  10. package/lib/builtin/erc721/test-utils.d.ts +5 -0
  11. package/lib/builtin/erc721/test-utils.js +46 -0
  12. package/lib/builtin/erc721/test-utils.js.map +1 -0
  13. package/lib/builtin/internal/ERC1155.d.ts +199 -0
  14. package/lib/builtin/internal/ERC1155.js +3 -0
  15. package/lib/builtin/internal/ERC1155.js.map +1 -0
  16. package/lib/builtin/internal/ERC721.d.ts +252 -0
  17. package/lib/builtin/internal/ERC721.js +3 -0
  18. package/lib/builtin/internal/ERC721.js.map +1 -0
  19. package/lib/builtin/internal/erc1155_processor.d.ts +134 -0
  20. package/lib/builtin/internal/erc1155_processor.js +337 -0
  21. package/lib/builtin/internal/erc1155_processor.js.map +1 -0
  22. package/lib/builtin/internal/erc721_processor.d.ts +169 -0
  23. package/lib/builtin/internal/erc721_processor.js +479 -0
  24. package/lib/builtin/internal/erc721_processor.js.map +1 -0
  25. package/lib/builtin/internal/factories/ERC1155__factory.d.ts +35 -0
  26. package/lib/builtin/internal/factories/ERC1155__factory.js +332 -0
  27. package/lib/builtin/internal/factories/ERC1155__factory.js.map +1 -0
  28. package/lib/builtin/internal/factories/ERC721__factory.d.ts +51 -0
  29. package/lib/builtin/internal/factories/ERC721__factory.js +364 -0
  30. package/lib/builtin/internal/factories/ERC721__factory.js.map +1 -0
  31. package/lib/builtin/internal/factories/index.d.ts +2 -0
  32. package/lib/builtin/internal/factories/index.js +5 -1
  33. package/lib/builtin/internal/factories/index.js.map +1 -1
  34. package/lib/builtin/internal/index.d.ts +4 -0
  35. package/lib/builtin/internal/index.js +5 -1
  36. package/lib/builtin/internal/index.js.map +1 -1
  37. package/lib/core/account-processor.d.ts +58 -0
  38. package/lib/core/account-processor.js +147 -0
  39. package/lib/core/account-processor.js.map +1 -0
  40. package/lib/core/base-processor.d.ts +5 -2
  41. package/lib/core/base-processor.js.map +1 -1
  42. package/lib/core/bind-options.d.ts +5 -0
  43. package/lib/core/bind-options.js +7 -1
  44. package/lib/core/bind-options.js.map +1 -1
  45. package/lib/core/context.d.ts +7 -1
  46. package/lib/core/context.js +30 -18
  47. package/lib/core/context.js.map +1 -1
  48. package/lib/core/meter.js +6 -0
  49. package/lib/core/meter.js.map +1 -1
  50. package/lib/gen/chainquery/protos/chainquery.d.ts +1 -0
  51. package/lib/gen/chainquery/protos/chainquery.js +17 -1
  52. package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
  53. package/lib/gen/processor/protos/processor.d.ts +11 -0
  54. package/lib/gen/processor/protos/processor.js +84 -3
  55. package/lib/gen/processor/protos/processor.js.map +1 -1
  56. package/lib/service.d.ts +1 -0
  57. package/lib/service.js +67 -42
  58. package/lib/service.js.map +1 -1
  59. package/lib/testing/test-processor-server.d.ts +6 -2
  60. package/lib/testing/test-processor-server.js +66 -5
  61. package/lib/testing/test-processor-server.js.map +1 -1
  62. package/package.json +1 -1
  63. package/src/abis/ERC1155.json +314 -0
  64. package/src/abis/ERC721.json +346 -0
  65. package/src/builtin/erc1155/index.ts +6 -0
  66. package/src/builtin/erc1155/test-utils.ts +89 -0
  67. package/src/builtin/erc721/index.ts +6 -0
  68. package/src/builtin/erc721/test-utils.ts +71 -0
  69. package/src/builtin/internal/ERC1155.ts +529 -0
  70. package/src/builtin/internal/ERC721.ts +639 -0
  71. package/src/builtin/internal/erc1155_processor.ts +580 -0
  72. package/src/builtin/internal/erc721_processor.ts +768 -0
  73. package/src/builtin/internal/factories/ERC1155__factory.ts +335 -0
  74. package/src/builtin/internal/factories/ERC721__factory.ts +364 -0
  75. package/src/builtin/internal/factories/index.ts +2 -0
  76. package/src/builtin/internal/index.ts +4 -0
  77. package/src/core/account-processor.ts +217 -0
  78. package/src/core/base-processor.ts +6 -2
  79. package/src/core/bind-options.ts +6 -0
  80. package/src/core/context.ts +42 -27
  81. package/src/core/meter.ts +8 -2
  82. package/src/gen/chainquery/protos/chainquery.ts +18 -1
  83. package/src/gen/processor/protos/processor.ts +88 -1
  84. package/src/service.ts +71 -44
  85. package/src/testing/test-processor-server.ts +71 -5
@@ -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
+ ]
@@ -0,0 +1,6 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ export * from "../internal/erc1155_processor";
6
+ export * from "../internal/ERC1155";
@@ -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,6 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ export * from "../internal/erc721_processor";
6
+ export * from "../internal/ERC721";
@@ -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
+ }