@sentio/sdk 1.36.4 → 1.37.0-rc.2
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/api.d.ts +1 -1
- package/lib/aptos/api.js +1 -1
- package/lib/aptos/api.js.map +1 -1
- package/lib/aptos/aptos-plugin.d.ts +2 -2
- package/lib/aptos/aptos-plugin.js +14 -19
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts +2 -2
- package/lib/aptos/aptos-processor.js +3 -3
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +1 -1
- package/lib/aptos/context.js +2 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/binds.d.ts +1 -1
- package/lib/binds.js +2 -2
- package/lib/binds.js.map +1 -1
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +18 -18
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/builtin/internal/erc1155_processor.js +5 -5
- package/lib/builtin/internal/erc1155_processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.js +8 -8
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.js +6 -6
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/erc721_processor.js +9 -9
- package/lib/builtin/internal/erc721_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.js +6 -6
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/builtin/solana/wormhole-processor.d.ts +0 -4
- package/lib/builtin/solana/wormhole-processor.js +123 -50
- package/lib/builtin/solana/wormhole-processor.js.map +1 -1
- package/lib/core/account-processor.d.ts +1 -1
- package/lib/core/account-processor.js +2 -2
- package/lib/core/account-processor.js.map +1 -1
- package/lib/core/base-context.d.ts +1 -1
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/base-processor-template.d.ts +2 -2
- package/lib/core/base-processor-template.js +7 -21
- package/lib/core/base-processor-template.js.map +1 -1
- package/lib/core/base-processor.d.ts +1 -1
- package/lib/core/base-processor.js +6 -20
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/bind-options.d.ts +5 -6
- package/lib/core/bind-options.js.map +1 -1
- package/lib/core/context.d.ts +4 -5
- package/lib/core/context.js +6 -10
- package/lib/core/context.js.map +1 -1
- package/lib/core/eth-plugin.d.ts +2 -2
- package/lib/core/eth-plugin.js +8 -12
- package/lib/core/eth-plugin.js.map +1 -1
- package/lib/core/event-tracker.d.ts +1 -1
- package/lib/core/event-tracker.js +2 -2
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +1 -1
- package/lib/core/exporter.js +2 -2
- package/lib/core/exporter.js.map +1 -1
- package/lib/core/generic-processor.test.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +2 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +1 -1
- package/lib/core/logger.js +5 -5
- package/lib/core/logger.js.map +1 -1
- package/lib/core/meter.d.ts +2 -2
- package/lib/core/meter.js +10 -10
- package/lib/core/meter.js.map +1 -1
- package/lib/core/numberish.d.ts +4 -4
- package/lib/core/numberish.js +23 -25
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/numberish.test.js.map +1 -1
- package/lib/core/solana-context.d.ts +2 -3
- package/lib/core/solana-context.js.map +1 -1
- package/lib/core/solana-options.d.ts +2 -3
- package/lib/core/solana-options.js.map +1 -1
- package/lib/core/solana-plugin.d.ts +2 -2
- package/lib/core/solana-plugin.js +6 -6
- package/lib/core/solana-plugin.js.map +1 -1
- package/lib/core/solana-processor.d.ts +7 -8
- package/lib/core/solana-processor.js +5 -15
- package/lib/core/solana-processor.js.map +1 -1
- package/lib/core/sui-plugin.d.ts +2 -2
- package/lib/core/sui-plugin.js +5 -5
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/core/sui-processor.d.ts +8 -9
- package/lib/core/sui-processor.js +5 -15
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +3 -5
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.js +4 -4
- package/lib/processor-runner.js.map +1 -1
- package/lib/service.d.ts +3 -4
- package/lib/service.js +7 -11
- package/lib/service.js.map +1 -1
- package/lib/solana-codegen/codegen.js +16 -5
- package/lib/solana-codegen/codegen.js.map +1 -1
- package/lib/target-ethers-sentio/file.js +1 -0
- package/lib/target-ethers-sentio/file.js.map +1 -1
- package/lib/target-ethers-sentio/view-function.js +1 -1
- package/lib/testing/metric-utils.d.ts +1 -1
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +3 -3
- package/lib/testing/test-processor-server.js +10 -22
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/conversion.d.ts +1 -1
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/dex-price.test.js.map +1 -1
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/price.d.ts +10 -10
- package/lib/utils/price.js +1 -1
- package/lib/utils/price.js.map +1 -1
- package/package.json +5 -2
- package/src/aptos/api.ts +1 -1
- package/src/aptos/aptos-plugin.ts +10 -11
- package/src/aptos/aptos-processor.ts +2 -2
- package/src/aptos/context.ts +3 -4
- package/src/binds.ts +1 -1
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +19 -18
- package/src/builtin/internal/erc1155_processor.ts +6 -5
- package/src/builtin/internal/erc20_processor.ts +9 -8
- package/src/builtin/internal/erc20bytes_processor.ts +7 -6
- package/src/builtin/internal/erc721_processor.ts +10 -9
- package/src/builtin/internal/weth9_processor.ts +7 -6
- package/src/builtin/solana/wormhole-processor.ts +119 -28
- package/src/core/account-processor.ts +1 -1
- package/src/core/base-context.ts +1 -1
- package/src/core/base-processor-template.ts +6 -15
- package/src/core/base-processor.ts +4 -13
- package/src/core/bind-options.ts +5 -6
- package/src/core/context.ts +10 -11
- package/src/core/eth-plugin.ts +3 -4
- package/src/core/event-tracker.ts +2 -2
- package/src/core/exporter.ts +1 -1
- package/src/core/index.ts +1 -1
- package/src/core/logger.ts +1 -1
- package/src/core/meter.ts +2 -2
- package/src/core/numberish.ts +20 -21
- package/src/core/solana-context.ts +2 -3
- package/src/core/solana-options.ts +2 -4
- package/src/core/solana-plugin.ts +3 -3
- package/src/core/solana-processor.ts +10 -17
- package/src/core/sui-plugin.ts +3 -8
- package/src/core/sui-processor.ts +11 -18
- package/src/index.ts +3 -5
- package/src/processor-runner.ts +3 -3
- package/src/service.ts +5 -5
- package/src/solana-codegen/codegen.ts +20 -7
- package/src/target-ethers-sentio/file.ts +1 -0
- package/src/target-ethers-sentio/view-function.ts +1 -1
- package/src/testing/metric-utils.ts +1 -1
- package/src/testing/test-processor-server.ts +6 -16
- package/src/types/global.d.ts +2 -2
- package/src/utils/conversion.ts +1 -1
- package/src/utils/price.ts +1 -1
- package/lib/gen/builtin.d.ts +0 -6
- package/lib/gen/builtin.js +0 -3
- package/lib/gen/builtin.js.map +0 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +0 -400
- package/lib/gen/chainquery/protos/chainquery.js +0 -972
- package/lib/gen/chainquery/protos/chainquery.js.map +0 -1
- package/lib/gen/google/protobuf/empty.d.ts +0 -16
- package/lib/gen/google/protobuf/empty.js +0 -47
- package/lib/gen/google/protobuf/empty.js.map +0 -1
- package/lib/gen/google/protobuf/struct.d.ts +0 -73
- package/lib/gen/google/protobuf/struct.js +0 -371
- package/lib/gen/google/protobuf/struct.js.map +0 -1
- package/lib/gen/google/protobuf/timestamp.d.ts +0 -18
- package/lib/gen/google/protobuf/timestamp.js +0 -71
- package/lib/gen/google/protobuf/timestamp.js.map +0 -1
- package/lib/gen/index.d.ts +0 -2
- package/lib/gen/index.js +0 -19
- package/lib/gen/index.js.map +0 -1
- package/lib/gen/processor/protos/processor.d.ts +0 -826
- package/lib/gen/processor/protos/processor.js +0 -3988
- package/lib/gen/processor/protos/processor.js.map +0 -1
- package/lib/gen/service/price/protos/price.d.ts +0 -85
- package/lib/gen/service/price/protos/price.js +0 -269
- package/lib/gen/service/price/protos/price.js.map +0 -1
- package/lib/plugin.d.ts +0 -15
- package/lib/plugin.js +0 -32
- package/lib/plugin.js.map +0 -1
- package/lib/state/processor-state.d.ts +0 -3
- package/lib/state/processor-state.js +0 -8
- package/lib/state/processor-state.js.map +0 -1
- package/lib/state/state-storage.d.ts +0 -17
- package/lib/state/state-storage.js +0 -60
- package/lib/state/state-storage.js.map +0 -1
- package/lib/state/state-storage.test.d.ts +0 -1
- package/lib/state/state-storage.test.js.map +0 -1
- package/src/gen/builtin.ts +0 -22
- package/src/gen/chainquery/protos/chainquery.ts +0 -1212
- package/src/gen/google/protobuf/empty.ts +0 -58
- package/src/gen/google/protobuf/struct.ts +0 -422
- package/src/gen/google/protobuf/timestamp.ts +0 -85
- package/src/gen/index.ts +0 -3
- package/src/gen/processor/protos/processor.ts +0 -4619
- package/src/gen/service/price/protos/price.ts +0 -329
- package/src/plugin.ts +0 -41
- package/src/state/processor-state.ts +0 -3
- package/src/state/state-storage.ts +0 -65
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
TypedCallTrace,
|
|
21
|
+
toBlockTag,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC1155, ERC1155__factory } from "./index";
|
|
@@ -219,7 +220,7 @@ export class ERC1155BoundContractView extends BoundContractView<
|
|
|
219
220
|
try {
|
|
220
221
|
if (!overrides && this.context) {
|
|
221
222
|
overrides = {
|
|
222
|
-
blockTag: this.context.blockNumber
|
|
223
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
223
224
|
};
|
|
224
225
|
}
|
|
225
226
|
if (overrides) {
|
|
@@ -240,7 +241,7 @@ export class ERC1155BoundContractView extends BoundContractView<
|
|
|
240
241
|
try {
|
|
241
242
|
if (!overrides && this.context) {
|
|
242
243
|
overrides = {
|
|
243
|
-
blockTag: this.context.blockNumber
|
|
244
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
244
245
|
};
|
|
245
246
|
}
|
|
246
247
|
if (overrides) {
|
|
@@ -261,7 +262,7 @@ export class ERC1155BoundContractView extends BoundContractView<
|
|
|
261
262
|
try {
|
|
262
263
|
if (!overrides && this.context) {
|
|
263
264
|
overrides = {
|
|
264
|
-
blockTag: this.context.blockNumber
|
|
265
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
265
266
|
};
|
|
266
267
|
}
|
|
267
268
|
if (overrides) {
|
|
@@ -281,7 +282,7 @@ export class ERC1155BoundContractView extends BoundContractView<
|
|
|
281
282
|
try {
|
|
282
283
|
if (!overrides && this.context) {
|
|
283
284
|
overrides = {
|
|
284
|
-
blockTag: this.context.blockNumber
|
|
285
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
285
286
|
};
|
|
286
287
|
}
|
|
287
288
|
if (overrides) {
|
|
@@ -301,7 +302,7 @@ export class ERC1155BoundContractView extends BoundContractView<
|
|
|
301
302
|
try {
|
|
302
303
|
if (!overrides && this.context) {
|
|
303
304
|
overrides = {
|
|
304
|
-
blockTag: this.context.blockNumber
|
|
305
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
305
306
|
};
|
|
306
307
|
}
|
|
307
308
|
if (overrides) {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
TypedCallTrace,
|
|
21
|
+
toBlockTag,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC20, ERC20__factory } from "./index";
|
|
@@ -286,7 +287,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
286
287
|
try {
|
|
287
288
|
if (!overrides && this.context) {
|
|
288
289
|
overrides = {
|
|
289
|
-
blockTag: this.context.blockNumber
|
|
290
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
290
291
|
};
|
|
291
292
|
}
|
|
292
293
|
if (overrides) {
|
|
@@ -306,7 +307,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
306
307
|
try {
|
|
307
308
|
if (!overrides && this.context) {
|
|
308
309
|
overrides = {
|
|
309
|
-
blockTag: this.context.blockNumber
|
|
310
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
310
311
|
};
|
|
311
312
|
}
|
|
312
313
|
if (overrides) {
|
|
@@ -323,7 +324,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
323
324
|
try {
|
|
324
325
|
if (!overrides && this.context) {
|
|
325
326
|
overrides = {
|
|
326
|
-
blockTag: this.context.blockNumber
|
|
327
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
327
328
|
};
|
|
328
329
|
}
|
|
329
330
|
if (overrides) {
|
|
@@ -340,7 +341,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
340
341
|
try {
|
|
341
342
|
if (!overrides && this.context) {
|
|
342
343
|
overrides = {
|
|
343
|
-
blockTag: this.context.blockNumber
|
|
344
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
347
|
if (overrides) {
|
|
@@ -357,7 +358,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
357
358
|
try {
|
|
358
359
|
if (!overrides && this.context) {
|
|
359
360
|
overrides = {
|
|
360
|
-
blockTag: this.context.blockNumber
|
|
361
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
if (overrides) {
|
|
@@ -374,7 +375,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
374
375
|
try {
|
|
375
376
|
if (!overrides && this.context) {
|
|
376
377
|
overrides = {
|
|
377
|
-
blockTag: this.context.blockNumber
|
|
378
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
378
379
|
};
|
|
379
380
|
}
|
|
380
381
|
if (overrides) {
|
|
@@ -391,7 +392,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
391
392
|
try {
|
|
392
393
|
if (!overrides && this.context) {
|
|
393
394
|
overrides = {
|
|
394
|
-
blockTag: this.context.blockNumber
|
|
395
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
395
396
|
};
|
|
396
397
|
}
|
|
397
398
|
if (overrides) {
|
|
@@ -408,7 +409,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
408
409
|
try {
|
|
409
410
|
if (!overrides && this.context) {
|
|
410
411
|
overrides = {
|
|
411
|
-
blockTag: this.context.blockNumber
|
|
412
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
415
|
if (overrides) {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
TypedCallTrace,
|
|
21
|
+
toBlockTag,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC20Bytes, ERC20Bytes__factory } from "./index";
|
|
@@ -190,7 +191,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
190
191
|
try {
|
|
191
192
|
if (!overrides && this.context) {
|
|
192
193
|
overrides = {
|
|
193
|
-
blockTag: this.context.blockNumber
|
|
194
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
197
|
if (overrides) {
|
|
@@ -207,7 +208,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
207
208
|
try {
|
|
208
209
|
if (!overrides && this.context) {
|
|
209
210
|
overrides = {
|
|
210
|
-
blockTag: this.context.blockNumber
|
|
211
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
211
212
|
};
|
|
212
213
|
}
|
|
213
214
|
if (overrides) {
|
|
@@ -224,7 +225,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
224
225
|
try {
|
|
225
226
|
if (!overrides && this.context) {
|
|
226
227
|
overrides = {
|
|
227
|
-
blockTag: this.context.blockNumber
|
|
228
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
228
229
|
};
|
|
229
230
|
}
|
|
230
231
|
if (overrides) {
|
|
@@ -244,7 +245,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
244
245
|
try {
|
|
245
246
|
if (!overrides && this.context) {
|
|
246
247
|
overrides = {
|
|
247
|
-
blockTag: this.context.blockNumber
|
|
248
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
248
249
|
};
|
|
249
250
|
}
|
|
250
251
|
if (overrides) {
|
|
@@ -261,7 +262,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
261
262
|
try {
|
|
262
263
|
if (!overrides && this.context) {
|
|
263
264
|
overrides = {
|
|
264
|
-
blockTag: this.context.blockNumber
|
|
265
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
265
266
|
};
|
|
266
267
|
}
|
|
267
268
|
if (overrides) {
|
|
@@ -282,7 +283,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
282
283
|
try {
|
|
283
284
|
if (!overrides && this.context) {
|
|
284
285
|
overrides = {
|
|
285
|
-
blockTag: this.context.blockNumber
|
|
286
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
286
287
|
};
|
|
287
288
|
}
|
|
288
289
|
if (overrides) {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
TypedCallTrace,
|
|
21
|
+
toBlockTag,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC721, ERC721__factory } from "./index";
|
|
@@ -290,7 +291,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
290
291
|
try {
|
|
291
292
|
if (!overrides && this.context) {
|
|
292
293
|
overrides = {
|
|
293
|
-
blockTag: this.context.blockNumber
|
|
294
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
294
295
|
};
|
|
295
296
|
}
|
|
296
297
|
if (overrides) {
|
|
@@ -310,7 +311,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
310
311
|
try {
|
|
311
312
|
if (!overrides && this.context) {
|
|
312
313
|
overrides = {
|
|
313
|
-
blockTag: this.context.blockNumber
|
|
314
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
317
|
if (overrides) {
|
|
@@ -330,7 +331,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
330
331
|
try {
|
|
331
332
|
if (!overrides && this.context) {
|
|
332
333
|
overrides = {
|
|
333
|
-
blockTag: this.context.blockNumber
|
|
334
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
334
335
|
};
|
|
335
336
|
}
|
|
336
337
|
if (overrides) {
|
|
@@ -351,7 +352,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
351
352
|
try {
|
|
352
353
|
if (!overrides && this.context) {
|
|
353
354
|
overrides = {
|
|
354
|
-
blockTag: this.context.blockNumber
|
|
355
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
355
356
|
};
|
|
356
357
|
}
|
|
357
358
|
if (overrides) {
|
|
@@ -368,7 +369,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
368
369
|
try {
|
|
369
370
|
if (!overrides && this.context) {
|
|
370
371
|
overrides = {
|
|
371
|
-
blockTag: this.context.blockNumber
|
|
372
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
372
373
|
};
|
|
373
374
|
}
|
|
374
375
|
if (overrides) {
|
|
@@ -388,7 +389,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
388
389
|
try {
|
|
389
390
|
if (!overrides && this.context) {
|
|
390
391
|
overrides = {
|
|
391
|
-
blockTag: this.context.blockNumber
|
|
392
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
392
393
|
};
|
|
393
394
|
}
|
|
394
395
|
if (overrides) {
|
|
@@ -408,7 +409,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
408
409
|
try {
|
|
409
410
|
if (!overrides && this.context) {
|
|
410
411
|
overrides = {
|
|
411
|
-
blockTag: this.context.blockNumber
|
|
412
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
415
|
if (overrides) {
|
|
@@ -425,7 +426,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
425
426
|
try {
|
|
426
427
|
if (!overrides && this.context) {
|
|
427
428
|
overrides = {
|
|
428
|
-
blockTag: this.context.blockNumber
|
|
429
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
429
430
|
};
|
|
430
431
|
}
|
|
431
432
|
if (overrides) {
|
|
@@ -445,7 +446,7 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
445
446
|
try {
|
|
446
447
|
if (!overrides && this.context) {
|
|
447
448
|
overrides = {
|
|
448
|
-
blockTag: this.context.blockNumber
|
|
449
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
449
450
|
};
|
|
450
451
|
}
|
|
451
452
|
if (overrides) {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
TypedCallTrace,
|
|
21
|
+
toBlockTag,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { WETH9, WETH9__factory } from "./index";
|
|
@@ -199,7 +200,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
199
200
|
try {
|
|
200
201
|
if (!overrides && this.context) {
|
|
201
202
|
overrides = {
|
|
202
|
-
blockTag: this.context.blockNumber
|
|
203
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
203
204
|
};
|
|
204
205
|
}
|
|
205
206
|
if (overrides) {
|
|
@@ -216,7 +217,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
216
217
|
try {
|
|
217
218
|
if (!overrides && this.context) {
|
|
218
219
|
overrides = {
|
|
219
|
-
blockTag: this.context.blockNumber
|
|
220
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
if (overrides) {
|
|
@@ -233,7 +234,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
233
234
|
try {
|
|
234
235
|
if (!overrides && this.context) {
|
|
235
236
|
overrides = {
|
|
236
|
-
blockTag: this.context.blockNumber
|
|
237
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
240
|
if (overrides) {
|
|
@@ -253,7 +254,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
253
254
|
try {
|
|
254
255
|
if (!overrides && this.context) {
|
|
255
256
|
overrides = {
|
|
256
|
-
blockTag: this.context.blockNumber
|
|
257
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
if (overrides) {
|
|
@@ -270,7 +271,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
270
271
|
try {
|
|
271
272
|
if (!overrides && this.context) {
|
|
272
273
|
overrides = {
|
|
273
|
-
blockTag: this.context.blockNumber
|
|
274
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
274
275
|
};
|
|
275
276
|
}
|
|
276
277
|
if (overrides) {
|
|
@@ -291,7 +292,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
291
292
|
try {
|
|
292
293
|
if (!overrides && this.context) {
|
|
293
294
|
overrides = {
|
|
294
|
-
blockTag: this.context.blockNumber
|
|
295
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
295
296
|
};
|
|
296
297
|
}
|
|
297
298
|
if (overrides) {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from '@sentio/sdk'
|
|
2
2
|
import { Instruction } from '@project-serum/anchor'
|
|
3
|
-
import * as borsh from "@coral-xyz/borsh";
|
|
4
3
|
import bs58 from 'bs58'
|
|
5
4
|
|
|
5
|
+
import {
|
|
6
|
+
deserialize,
|
|
7
|
+
field,
|
|
8
|
+
vec, fixedArray, option,
|
|
9
|
+
} from "@dao-xyz/borsh";
|
|
10
|
+
|
|
6
11
|
// https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/lib.rs#L100
|
|
7
12
|
enum TokenBridgeInstruction {
|
|
8
13
|
Initialize = 0,
|
|
@@ -20,30 +25,104 @@ enum TokenBridgeInstruction {
|
|
|
20
25
|
TransferNativeWithPayload,
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
class TransferDataValues {
|
|
29
|
+
@field({ type: 'u32' })
|
|
30
|
+
nonce: number
|
|
31
|
+
|
|
32
|
+
@field({type: 'u64'})
|
|
33
|
+
amount: bigint
|
|
34
|
+
|
|
35
|
+
@field({type: 'u64'})
|
|
36
|
+
fee: bigint
|
|
37
|
+
|
|
38
|
+
@field({ type: fixedArray('u8', 32) })
|
|
39
|
+
target_address: number[];
|
|
40
|
+
|
|
41
|
+
@field({ type: 'u16' })
|
|
42
|
+
target_chain: number
|
|
43
|
+
|
|
44
|
+
constructor(data?: TransferDataValues) {
|
|
45
|
+
if(data){
|
|
46
|
+
Object.assign(this,data)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class TransferNativeWithPayloadData {
|
|
52
|
+
@field({ type: 'u32' })
|
|
53
|
+
nonce: number
|
|
54
|
+
|
|
55
|
+
@field({type: 'u64'})
|
|
56
|
+
amount: bigint
|
|
57
|
+
|
|
58
|
+
@field({type: 'u64'})
|
|
59
|
+
fee: bigint
|
|
60
|
+
|
|
61
|
+
@field({ type: fixedArray('u8', 32) })
|
|
62
|
+
target_address: number[];
|
|
63
|
+
|
|
64
|
+
@field({ type: 'u16' })
|
|
65
|
+
target_chain: number
|
|
66
|
+
|
|
67
|
+
@field({ type: vec('u8') })
|
|
68
|
+
payload: number[];
|
|
69
|
+
|
|
70
|
+
@field({type: option(fixedArray('u8', 32) )})
|
|
71
|
+
cpi_program_id?: number[]
|
|
72
|
+
|
|
73
|
+
constructor(data?: TransferNativeWithPayloadData) {
|
|
74
|
+
if(data){
|
|
75
|
+
Object.assign(this,data)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class AttestTokenValues {
|
|
81
|
+
@field({ type: 'u32' })
|
|
82
|
+
nonce: number
|
|
83
|
+
|
|
84
|
+
constructor(data?: AttestTokenValues) {
|
|
85
|
+
if(data){
|
|
86
|
+
Object.assign(this,data)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class InitializeDataValues {
|
|
92
|
+
@field({type: fixedArray('u8', 32) })
|
|
93
|
+
bridge: number[]
|
|
94
|
+
|
|
95
|
+
constructor(data?: InitializeDataValues) {
|
|
96
|
+
if(data){
|
|
97
|
+
Object.assign(this,data)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
23
102
|
export class TokenBridgeProcessor extends SolanaBaseProcessor {
|
|
24
103
|
|
|
25
|
-
private readonly transferDataValues = [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
]
|
|
104
|
+
// private readonly transferDataValues = [
|
|
105
|
+
// borsh.u32('nonce'),
|
|
106
|
+
// borsh.u64('amount'),
|
|
107
|
+
// borsh.u64('fee'),
|
|
108
|
+
// borsh.array(borsh.u8(undefined), 32, 'target_address'),
|
|
109
|
+
// borsh.u16('target_chain')
|
|
110
|
+
// ]
|
|
32
111
|
// https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer_payload.rs#L170
|
|
33
|
-
private readonly transferDataWithPayloadValues = [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]
|
|
41
|
-
private readonly attestTokenValues = [
|
|
42
|
-
|
|
43
|
-
]
|
|
44
|
-
private readonly initializeDataValues = [
|
|
45
|
-
|
|
46
|
-
]
|
|
112
|
+
// private readonly transferDataWithPayloadValues = [
|
|
113
|
+
// borsh.u32('nonce'),
|
|
114
|
+
// borsh.u64('amount'),
|
|
115
|
+
// borsh.array(borsh.u8(undefined), 32, 'target_address'),
|
|
116
|
+
// borsh.u16('target_chain'),
|
|
117
|
+
// borsh.vecU8('payload'),
|
|
118
|
+
// borsh.option(borsh.publicKey(undefined), 'cpi_program_id')
|
|
119
|
+
// ]
|
|
120
|
+
// private readonly attestTokenValues = [
|
|
121
|
+
// borsh.u32('nonce')
|
|
122
|
+
// ]
|
|
123
|
+
// private readonly initializeDataValues = [
|
|
124
|
+
// borsh.publicKey('bridge')
|
|
125
|
+
// ]
|
|
47
126
|
|
|
48
127
|
static bind(options: SolanaBindOptions): TokenBridgeProcessor {
|
|
49
128
|
if (options && !options.name) {
|
|
@@ -67,39 +146,51 @@ export class TokenBridgeProcessor extends SolanaBaseProcessor {
|
|
|
67
146
|
name: TokenBridgeInstruction[TokenBridgeInstruction.Initialize]
|
|
68
147
|
}
|
|
69
148
|
case TokenBridgeInstruction.TransferNative:
|
|
149
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), TransferDataValues)
|
|
150
|
+
|
|
70
151
|
// struct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295
|
|
71
|
-
data = borsh.struct(this.transferDataValues, 'TransferNativeData').decode(Buffer.from(u8Arr.slice(1)))
|
|
152
|
+
// data = borsh.struct(this.transferDataValues, 'TransferNativeData').decode(Buffer.from(u8Arr.slice(1)))
|
|
72
153
|
return {
|
|
73
154
|
data,
|
|
74
155
|
name: TokenBridgeInstruction[TokenBridgeInstruction.TransferNative]
|
|
75
156
|
}
|
|
76
157
|
case TokenBridgeInstruction.TransferWrapped:
|
|
158
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), TransferDataValues)
|
|
159
|
+
|
|
77
160
|
// stuct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295
|
|
78
|
-
data = borsh.struct(this.transferDataValues, 'TransferWrappedData').decode(Buffer.from(u8Arr.slice(1)))
|
|
161
|
+
// data = borsh.struct(this.transferDataValues, 'TransferWrappedData').decode(Buffer.from(u8Arr.slice(1)))
|
|
79
162
|
return {
|
|
80
163
|
data,
|
|
81
164
|
name: TokenBridgeInstruction[TokenBridgeInstruction.TransferWrapped]
|
|
82
165
|
}
|
|
83
166
|
case TokenBridgeInstruction.TransferNativeWithPayload:
|
|
84
|
-
data =
|
|
167
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), TransferNativeWithPayloadData)
|
|
168
|
+
|
|
169
|
+
// data = borsh.struct(this.transferDataWithPayloadValues, 'TransferNativeWithPayloadData').decode(Buffer.from(u8Arr.slice(1)))
|
|
85
170
|
return {
|
|
86
171
|
data,
|
|
87
172
|
name: TokenBridgeInstruction[TokenBridgeInstruction.TransferNativeWithPayload]
|
|
88
173
|
}
|
|
89
174
|
case TokenBridgeInstruction.TransferWrappedWithPayload:
|
|
90
|
-
data =
|
|
175
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), TransferNativeWithPayloadData)
|
|
176
|
+
|
|
177
|
+
// data = borsh.struct(this.transferDataWithPayloadValues, 'TransferWrappedWithPayloadData').decode(Buffer.from(u8Arr.slice(1)))
|
|
91
178
|
return {
|
|
92
179
|
data,
|
|
93
180
|
name: TokenBridgeInstruction[TokenBridgeInstruction.TransferWrappedWithPayload]
|
|
94
181
|
}
|
|
95
182
|
case TokenBridgeInstruction.Initialize:
|
|
96
|
-
data =
|
|
183
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), InitializeDataValues)
|
|
184
|
+
|
|
185
|
+
// data = borsh.struct(this.initializeDataValues, 'InitializeData').decode(Buffer.from(u8Arr.slice(1)))
|
|
97
186
|
return {
|
|
98
187
|
data,
|
|
99
188
|
name: TokenBridgeInstruction[TokenBridgeInstruction.Initialize]
|
|
100
189
|
}
|
|
101
190
|
case TokenBridgeInstruction.AttestToken:
|
|
102
|
-
data =
|
|
191
|
+
data = deserialize(Buffer.from(u8Arr.slice(1)), AttestTokenValues)
|
|
192
|
+
|
|
193
|
+
// data = borsh.struct(this.attestTokenValues, 'AttestTokenData').decode(Buffer.from(u8Arr.slice(1)))
|
|
103
194
|
return {
|
|
104
195
|
data,
|
|
105
196
|
name: TokenBridgeInstruction[TokenBridgeInstruction.AttestToken]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListStateStorage } from '
|
|
1
|
+
import { ListStateStorage } from '@sentio/base'
|
|
2
2
|
import { ERC20__factory, ERC721__factory } from '../builtin/internal'
|
|
3
3
|
import { AddressType, DummyProvider, ProcessResult } from '@sentio/sdk'
|
|
4
4
|
import { AccountBindOptions } from './bind-options'
|
package/src/core/base-context.ts
CHANGED
|
@@ -4,12 +4,11 @@ import { BaseContract, EventFilter } from 'ethers'
|
|
|
4
4
|
import { Event } from '@ethersproject/contracts'
|
|
5
5
|
import { BaseProcessor } from './base-processor'
|
|
6
6
|
import { BindOptions, getOptionsSignature } from './bind-options'
|
|
7
|
-
import { HandleInterval, TemplateInstance } from '
|
|
8
|
-
import Long from 'long'
|
|
7
|
+
import { HandleInterval, TemplateInstance } from '@sentio/protos'
|
|
9
8
|
import { getNetwork } from '@ethersproject/providers'
|
|
10
9
|
import { PromiseOrVoid } from '../promise-or-void'
|
|
11
10
|
import { Trace } from './trace'
|
|
12
|
-
import { ListStateStorage } from '
|
|
11
|
+
import { ListStateStorage } from '@sentio/base'
|
|
13
12
|
|
|
14
13
|
export class ProcessorTemplateProcessorState extends ListStateStorage<
|
|
15
14
|
BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>
|
|
@@ -70,22 +69,14 @@ export abstract class BaseProcessorTemplate<
|
|
|
70
69
|
chainId: options.network ? getNetwork(options.network).chainId.toString() : '1',
|
|
71
70
|
abi: '',
|
|
72
71
|
},
|
|
73
|
-
startBlock:
|
|
74
|
-
endBlock:
|
|
72
|
+
startBlock: 0n,
|
|
73
|
+
endBlock: 0n,
|
|
75
74
|
}
|
|
76
75
|
if (options.startBlock) {
|
|
77
|
-
|
|
78
|
-
instance.startBlock = Long.fromNumber(options.startBlock)
|
|
79
|
-
} else {
|
|
80
|
-
instance.startBlock = options.startBlock
|
|
81
|
-
}
|
|
76
|
+
instance.startBlock = BigInt(options.startBlock)
|
|
82
77
|
}
|
|
83
78
|
if (options.endBlock) {
|
|
84
|
-
|
|
85
|
-
instance.endBlock = Long.fromNumber(options.endBlock)
|
|
86
|
-
} else {
|
|
87
|
-
instance.endBlock = options.endBlock
|
|
88
|
-
}
|
|
79
|
+
instance.endBlock = BigInt(options.endBlock)
|
|
89
80
|
}
|
|
90
81
|
TemplateInstanceState.INSTANCE.addValue(instance)
|
|
91
82
|
return processor
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BytesLike } from '@ethersproject/bytes'
|
|
2
2
|
import { Block, Log, getNetwork } from '@ethersproject/providers'
|
|
3
3
|
import { BaseContract, Event, EventFilter } from '@ethersproject/contracts'
|
|
4
|
-
import Long from 'long'
|
|
5
4
|
|
|
6
5
|
import { BoundContractView, ContractContext, ContractView } from './context'
|
|
7
|
-
import { AddressType, HandleInterval, ProcessResult } from '
|
|
6
|
+
import { AddressType, HandleInterval, ProcessResult } from '@sentio/protos'
|
|
8
7
|
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
9
8
|
import { PromiseOrVoid } from '../promise-or-void'
|
|
10
9
|
import { Trace } from './trace'
|
|
@@ -44,21 +43,13 @@ export abstract class BaseProcessor<
|
|
|
44
43
|
address: config.address,
|
|
45
44
|
name: config.name || '',
|
|
46
45
|
network: config.network ? config.network : 1,
|
|
47
|
-
startBlock:
|
|
46
|
+
startBlock: 0n,
|
|
48
47
|
}
|
|
49
48
|
if (config.startBlock) {
|
|
50
|
-
|
|
51
|
-
this.config.startBlock = Long.fromNumber(config.startBlock)
|
|
52
|
-
} else {
|
|
53
|
-
this.config.startBlock = config.startBlock
|
|
54
|
-
}
|
|
49
|
+
this.config.startBlock = BigInt(config.startBlock)
|
|
55
50
|
}
|
|
56
51
|
if (config.endBlock) {
|
|
57
|
-
|
|
58
|
-
this.config.endBlock = Long.fromNumber(config.endBlock)
|
|
59
|
-
} else {
|
|
60
|
-
this.config.endBlock = config.endBlock
|
|
61
|
-
}
|
|
52
|
+
this.config.endBlock = BigInt(config.endBlock)
|
|
62
53
|
}
|
|
63
54
|
}
|
|
64
55
|
|
package/src/core/bind-options.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Networkish } from '@ethersproject/networks'
|
|
2
|
-
import Long from 'long'
|
|
3
2
|
import { getNetwork } from '@ethersproject/providers'
|
|
4
3
|
|
|
5
4
|
export class BindOptions {
|
|
@@ -9,8 +8,8 @@ export class BindOptions {
|
|
|
9
8
|
network?: Networkish = 1
|
|
10
9
|
// Optional, override default contract name
|
|
11
10
|
name?: string
|
|
12
|
-
startBlock?:
|
|
13
|
-
endBlock?:
|
|
11
|
+
startBlock?: bigint | number
|
|
12
|
+
endBlock?: bigint | number
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export function getOptionsSignature(opts: BindOptions): string {
|
|
@@ -34,12 +33,12 @@ export class BindInternalOptions {
|
|
|
34
33
|
address: string
|
|
35
34
|
network: Networkish
|
|
36
35
|
name: string
|
|
37
|
-
startBlock:
|
|
38
|
-
endBlock?:
|
|
36
|
+
startBlock: bigint
|
|
37
|
+
endBlock?: bigint
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export class AccountBindOptions {
|
|
42
41
|
address: string
|
|
43
42
|
network?: Networkish
|
|
44
|
-
startBlock?:
|
|
43
|
+
startBlock?: bigint | number
|
|
45
44
|
}
|