@sentio/sdk 1.36.4 → 1.37.0-rc.1

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 (192) hide show
  1. package/lib/aptos/api.d.ts +1 -1
  2. package/lib/aptos/api.js +1 -1
  3. package/lib/aptos/api.js.map +1 -1
  4. package/lib/aptos/aptos-plugin.d.ts +2 -2
  5. package/lib/aptos/aptos-plugin.js +14 -19
  6. package/lib/aptos/aptos-plugin.js.map +1 -1
  7. package/lib/aptos/aptos-processor.d.ts +2 -2
  8. package/lib/aptos/aptos-processor.js +3 -3
  9. package/lib/aptos/aptos-processor.js.map +1 -1
  10. package/lib/aptos/context.d.ts +1 -1
  11. package/lib/aptos/context.js +2 -6
  12. package/lib/aptos/context.js.map +1 -1
  13. package/lib/binds.d.ts +1 -1
  14. package/lib/binds.js +2 -2
  15. package/lib/binds.js.map +1 -1
  16. package/lib/builtin/internal/eacaggregatorproxy_processor.js +18 -18
  17. package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
  18. package/lib/builtin/internal/erc1155_processor.js +5 -5
  19. package/lib/builtin/internal/erc1155_processor.js.map +1 -1
  20. package/lib/builtin/internal/erc20_processor.js +8 -8
  21. package/lib/builtin/internal/erc20_processor.js.map +1 -1
  22. package/lib/builtin/internal/erc20bytes_processor.js +6 -6
  23. package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
  24. package/lib/builtin/internal/erc721_processor.js +9 -9
  25. package/lib/builtin/internal/erc721_processor.js.map +1 -1
  26. package/lib/builtin/internal/weth9_processor.js +6 -6
  27. package/lib/builtin/internal/weth9_processor.js.map +1 -1
  28. package/lib/core/account-processor.d.ts +1 -1
  29. package/lib/core/account-processor.js +2 -2
  30. package/lib/core/account-processor.js.map +1 -1
  31. package/lib/core/base-context.d.ts +1 -1
  32. package/lib/core/base-context.js.map +1 -1
  33. package/lib/core/base-processor-template.d.ts +2 -2
  34. package/lib/core/base-processor-template.js +7 -21
  35. package/lib/core/base-processor-template.js.map +1 -1
  36. package/lib/core/base-processor.d.ts +1 -1
  37. package/lib/core/base-processor.js +6 -20
  38. package/lib/core/base-processor.js.map +1 -1
  39. package/lib/core/bind-options.d.ts +5 -6
  40. package/lib/core/bind-options.js.map +1 -1
  41. package/lib/core/context.d.ts +4 -5
  42. package/lib/core/context.js +6 -10
  43. package/lib/core/context.js.map +1 -1
  44. package/lib/core/eth-plugin.d.ts +2 -2
  45. package/lib/core/eth-plugin.js +8 -12
  46. package/lib/core/eth-plugin.js.map +1 -1
  47. package/lib/core/event-tracker.d.ts +1 -1
  48. package/lib/core/event-tracker.js +2 -2
  49. package/lib/core/event-tracker.js.map +1 -1
  50. package/lib/core/exporter.d.ts +1 -1
  51. package/lib/core/exporter.js +2 -2
  52. package/lib/core/exporter.js.map +1 -1
  53. package/lib/core/generic-processor.test.js.map +1 -1
  54. package/lib/core/index.d.ts +1 -1
  55. package/lib/core/index.js +2 -1
  56. package/lib/core/index.js.map +1 -1
  57. package/lib/core/logger.d.ts +1 -1
  58. package/lib/core/logger.js +5 -5
  59. package/lib/core/logger.js.map +1 -1
  60. package/lib/core/meter.d.ts +2 -2
  61. package/lib/core/meter.js +10 -10
  62. package/lib/core/meter.js.map +1 -1
  63. package/lib/core/numberish.d.ts +3 -3
  64. package/lib/core/numberish.js +18 -12
  65. package/lib/core/numberish.js.map +1 -1
  66. package/lib/core/numberish.test.js.map +1 -1
  67. package/lib/core/solana-context.d.ts +2 -3
  68. package/lib/core/solana-context.js.map +1 -1
  69. package/lib/core/solana-options.d.ts +2 -3
  70. package/lib/core/solana-options.js.map +1 -1
  71. package/lib/core/solana-plugin.d.ts +2 -2
  72. package/lib/core/solana-plugin.js +6 -6
  73. package/lib/core/solana-plugin.js.map +1 -1
  74. package/lib/core/solana-processor.d.ts +7 -8
  75. package/lib/core/solana-processor.js +5 -15
  76. package/lib/core/solana-processor.js.map +1 -1
  77. package/lib/core/sui-plugin.d.ts +2 -2
  78. package/lib/core/sui-plugin.js +5 -5
  79. package/lib/core/sui-plugin.js.map +1 -1
  80. package/lib/core/sui-processor.d.ts +8 -9
  81. package/lib/core/sui-processor.js +5 -15
  82. package/lib/core/sui-processor.js.map +1 -1
  83. package/lib/index.d.ts +2 -3
  84. package/lib/index.js +3 -5
  85. package/lib/index.js.map +1 -1
  86. package/lib/processor-runner.js +4 -4
  87. package/lib/processor-runner.js.map +1 -1
  88. package/lib/service.d.ts +3 -4
  89. package/lib/service.js +7 -11
  90. package/lib/service.js.map +1 -1
  91. package/lib/target-ethers-sentio/file.js +1 -0
  92. package/lib/target-ethers-sentio/file.js.map +1 -1
  93. package/lib/target-ethers-sentio/view-function.js +1 -1
  94. package/lib/testing/metric-utils.d.ts +1 -1
  95. package/lib/testing/metric-utils.js.map +1 -1
  96. package/lib/testing/test-processor-server.d.ts +3 -3
  97. package/lib/testing/test-processor-server.js +10 -22
  98. package/lib/testing/test-processor-server.js.map +1 -1
  99. package/lib/utils/conversion.d.ts +1 -1
  100. package/lib/utils/conversion.js.map +1 -1
  101. package/lib/utils/dex-price.test.js.map +1 -1
  102. package/lib/utils/erc20.test.js.map +1 -1
  103. package/lib/utils/price.d.ts +10 -10
  104. package/lib/utils/price.js +1 -1
  105. package/lib/utils/price.js.map +1 -1
  106. package/package.json +4 -2
  107. package/src/aptos/api.ts +1 -1
  108. package/src/aptos/aptos-plugin.ts +10 -11
  109. package/src/aptos/aptos-processor.ts +2 -2
  110. package/src/aptos/context.ts +3 -4
  111. package/src/binds.ts +1 -1
  112. package/src/builtin/internal/eacaggregatorproxy_processor.ts +19 -18
  113. package/src/builtin/internal/erc1155_processor.ts +6 -5
  114. package/src/builtin/internal/erc20_processor.ts +9 -8
  115. package/src/builtin/internal/erc20bytes_processor.ts +7 -6
  116. package/src/builtin/internal/erc721_processor.ts +10 -9
  117. package/src/builtin/internal/weth9_processor.ts +7 -6
  118. package/src/core/account-processor.ts +1 -1
  119. package/src/core/base-context.ts +1 -1
  120. package/src/core/base-processor-template.ts +6 -15
  121. package/src/core/base-processor.ts +4 -13
  122. package/src/core/bind-options.ts +5 -6
  123. package/src/core/context.ts +10 -11
  124. package/src/core/eth-plugin.ts +3 -4
  125. package/src/core/event-tracker.ts +2 -2
  126. package/src/core/exporter.ts +1 -1
  127. package/src/core/index.ts +1 -1
  128. package/src/core/logger.ts +1 -1
  129. package/src/core/meter.ts +2 -2
  130. package/src/core/numberish.ts +12 -6
  131. package/src/core/solana-context.ts +2 -3
  132. package/src/core/solana-options.ts +2 -4
  133. package/src/core/solana-plugin.ts +3 -3
  134. package/src/core/solana-processor.ts +10 -17
  135. package/src/core/sui-plugin.ts +3 -8
  136. package/src/core/sui-processor.ts +11 -18
  137. package/src/index.ts +3 -5
  138. package/src/processor-runner.ts +3 -3
  139. package/src/service.ts +5 -5
  140. package/src/target-ethers-sentio/file.ts +1 -0
  141. package/src/target-ethers-sentio/view-function.ts +1 -1
  142. package/src/testing/metric-utils.ts +1 -1
  143. package/src/testing/test-processor-server.ts +6 -16
  144. package/src/types/global.d.ts +2 -2
  145. package/src/utils/conversion.ts +1 -1
  146. package/src/utils/price.ts +1 -1
  147. package/lib/gen/builtin.d.ts +0 -6
  148. package/lib/gen/builtin.js +0 -3
  149. package/lib/gen/builtin.js.map +0 -1
  150. package/lib/gen/chainquery/protos/chainquery.d.ts +0 -400
  151. package/lib/gen/chainquery/protos/chainquery.js +0 -972
  152. package/lib/gen/chainquery/protos/chainquery.js.map +0 -1
  153. package/lib/gen/google/protobuf/empty.d.ts +0 -16
  154. package/lib/gen/google/protobuf/empty.js +0 -47
  155. package/lib/gen/google/protobuf/empty.js.map +0 -1
  156. package/lib/gen/google/protobuf/struct.d.ts +0 -73
  157. package/lib/gen/google/protobuf/struct.js +0 -371
  158. package/lib/gen/google/protobuf/struct.js.map +0 -1
  159. package/lib/gen/google/protobuf/timestamp.d.ts +0 -18
  160. package/lib/gen/google/protobuf/timestamp.js +0 -71
  161. package/lib/gen/google/protobuf/timestamp.js.map +0 -1
  162. package/lib/gen/index.d.ts +0 -2
  163. package/lib/gen/index.js +0 -19
  164. package/lib/gen/index.js.map +0 -1
  165. package/lib/gen/processor/protos/processor.d.ts +0 -826
  166. package/lib/gen/processor/protos/processor.js +0 -3988
  167. package/lib/gen/processor/protos/processor.js.map +0 -1
  168. package/lib/gen/service/price/protos/price.d.ts +0 -85
  169. package/lib/gen/service/price/protos/price.js +0 -269
  170. package/lib/gen/service/price/protos/price.js.map +0 -1
  171. package/lib/plugin.d.ts +0 -15
  172. package/lib/plugin.js +0 -32
  173. package/lib/plugin.js.map +0 -1
  174. package/lib/state/processor-state.d.ts +0 -3
  175. package/lib/state/processor-state.js +0 -8
  176. package/lib/state/processor-state.js.map +0 -1
  177. package/lib/state/state-storage.d.ts +0 -17
  178. package/lib/state/state-storage.js +0 -60
  179. package/lib/state/state-storage.js.map +0 -1
  180. package/lib/state/state-storage.test.d.ts +0 -1
  181. package/lib/state/state-storage.test.js.map +0 -1
  182. package/src/gen/builtin.ts +0 -22
  183. package/src/gen/chainquery/protos/chainquery.ts +0 -1212
  184. package/src/gen/google/protobuf/empty.ts +0 -58
  185. package/src/gen/google/protobuf/struct.ts +0 -422
  186. package/src/gen/google/protobuf/timestamp.ts +0 -85
  187. package/src/gen/index.ts +0 -3
  188. package/src/gen/processor/protos/processor.ts +0 -4619
  189. package/src/gen/service/price/protos/price.ts +0 -329
  190. package/src/plugin.ts +0 -41
  191. package/src/state/processor-state.ts +0 -3
  192. package/src/state/state-storage.ts +0 -65
@@ -1,5 +1,4 @@
1
- import Long from 'long'
2
- import { RecordMetaData } from '../gen'
1
+ import { RecordMetaData } from '@sentio/protos'
3
2
  import { Labels } from '../core/metadata'
4
3
  import { normalizeLabels } from '../core/meter'
5
4
  import { BaseContext } from '../core/base-context'
@@ -34,7 +33,7 @@ export class AptosContext extends BaseContext {
34
33
  return {
35
34
  address: this.address,
36
35
  contractName: this.moduleName,
37
- blockNumber: Long.fromString(this.version.toString()),
36
+ blockNumber: this.version,
38
37
  transactionIndex: 0,
39
38
  transactionHash: this.transaction?.hash || '', // TODO
40
39
  logIndex: 0,
@@ -63,7 +62,7 @@ export class AptosResourceContext extends BaseContext {
63
62
  return {
64
63
  address: this.address,
65
64
  contractName: 'resources',
66
- blockNumber: Long.fromString(this.version.toString()),
65
+ blockNumber: this.version,
67
66
  transactionIndex: 0,
68
67
  transactionHash: '',
69
68
  logIndex: 0,
package/src/binds.ts CHANGED
@@ -3,7 +3,7 @@ import { BaseProcessor, ContractView } from './core'
3
3
  import { Networkish } from '@ethersproject/networks'
4
4
  import { getNetwork } from '@ethersproject/providers'
5
5
  import { BaseContract } from 'ethers'
6
- import { MapStateStorage } from './state/state-storage'
6
+ import { MapStateStorage } from '@sentio/base'
7
7
 
8
8
  export class ProcessorState extends MapStateStorage<BaseProcessor<any, any>> {
9
9
  static INSTANCE = new ProcessorState()
@@ -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 { EACAggregatorProxy, EACAggregatorProxy__factory } from "./index";
@@ -472,7 +473,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
472
473
  try {
473
474
  if (!overrides && this.context) {
474
475
  overrides = {
475
- blockTag: this.context.blockNumber.toNumber(),
476
+ blockTag: toBlockTag(this.context.blockNumber),
476
477
  };
477
478
  }
478
479
  if (overrides) {
@@ -489,7 +490,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
489
490
  try {
490
491
  if (!overrides && this.context) {
491
492
  overrides = {
492
- blockTag: this.context.blockNumber.toNumber(),
493
+ blockTag: toBlockTag(this.context.blockNumber),
493
494
  };
494
495
  }
495
496
  if (overrides) {
@@ -506,7 +507,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
506
507
  try {
507
508
  if (!overrides && this.context) {
508
509
  overrides = {
509
- blockTag: this.context.blockNumber.toNumber(),
510
+ blockTag: toBlockTag(this.context.blockNumber),
510
511
  };
511
512
  }
512
513
  if (overrides) {
@@ -523,7 +524,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
523
524
  try {
524
525
  if (!overrides && this.context) {
525
526
  overrides = {
526
- blockTag: this.context.blockNumber.toNumber(),
527
+ blockTag: toBlockTag(this.context.blockNumber),
527
528
  };
528
529
  }
529
530
  if (overrides) {
@@ -543,7 +544,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
543
544
  try {
544
545
  if (!overrides && this.context) {
545
546
  overrides = {
546
- blockTag: this.context.blockNumber.toNumber(),
547
+ blockTag: toBlockTag(this.context.blockNumber),
547
548
  };
548
549
  }
549
550
  if (overrides) {
@@ -571,7 +572,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
571
572
  try {
572
573
  if (!overrides && this.context) {
573
574
  overrides = {
574
- blockTag: this.context.blockNumber.toNumber(),
575
+ blockTag: toBlockTag(this.context.blockNumber),
575
576
  };
576
577
  }
577
578
  if (overrides) {
@@ -591,7 +592,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
591
592
  try {
592
593
  if (!overrides && this.context) {
593
594
  overrides = {
594
- blockTag: this.context.blockNumber.toNumber(),
595
+ blockTag: toBlockTag(this.context.blockNumber),
595
596
  };
596
597
  }
597
598
  if (overrides) {
@@ -608,7 +609,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
608
609
  try {
609
610
  if (!overrides && this.context) {
610
611
  overrides = {
611
- blockTag: this.context.blockNumber.toNumber(),
612
+ blockTag: toBlockTag(this.context.blockNumber),
612
613
  };
613
614
  }
614
615
  if (overrides) {
@@ -625,7 +626,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
625
626
  try {
626
627
  if (!overrides && this.context) {
627
628
  overrides = {
628
- blockTag: this.context.blockNumber.toNumber(),
629
+ blockTag: toBlockTag(this.context.blockNumber),
629
630
  };
630
631
  }
631
632
  if (overrides) {
@@ -652,7 +653,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
652
653
  try {
653
654
  if (!overrides && this.context) {
654
655
  overrides = {
655
- blockTag: this.context.blockNumber.toNumber(),
656
+ blockTag: toBlockTag(this.context.blockNumber),
656
657
  };
657
658
  }
658
659
  if (overrides) {
@@ -669,7 +670,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
669
670
  try {
670
671
  if (!overrides && this.context) {
671
672
  overrides = {
672
- blockTag: this.context.blockNumber.toNumber(),
673
+ blockTag: toBlockTag(this.context.blockNumber),
673
674
  };
674
675
  }
675
676
  if (overrides) {
@@ -686,7 +687,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
686
687
  try {
687
688
  if (!overrides && this.context) {
688
689
  overrides = {
689
- blockTag: this.context.blockNumber.toNumber(),
690
+ blockTag: toBlockTag(this.context.blockNumber),
690
691
  };
691
692
  }
692
693
  if (overrides) {
@@ -706,7 +707,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
706
707
  try {
707
708
  if (!overrides && this.context) {
708
709
  overrides = {
709
- blockTag: this.context.blockNumber.toNumber(),
710
+ blockTag: toBlockTag(this.context.blockNumber),
710
711
  };
711
712
  }
712
713
  if (overrides) {
@@ -723,7 +724,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
723
724
  try {
724
725
  if (!overrides && this.context) {
725
726
  overrides = {
726
- blockTag: this.context.blockNumber.toNumber(),
727
+ blockTag: toBlockTag(this.context.blockNumber),
727
728
  };
728
729
  }
729
730
  if (overrides) {
@@ -740,7 +741,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
740
741
  try {
741
742
  if (!overrides && this.context) {
742
743
  overrides = {
743
- blockTag: this.context.blockNumber.toNumber(),
744
+ blockTag: toBlockTag(this.context.blockNumber),
744
745
  };
745
746
  }
746
747
  if (overrides) {
@@ -768,7 +769,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
768
769
  try {
769
770
  if (!overrides && this.context) {
770
771
  overrides = {
771
- blockTag: this.context.blockNumber.toNumber(),
772
+ blockTag: toBlockTag(this.context.blockNumber),
772
773
  };
773
774
  }
774
775
  if (overrides) {
@@ -795,7 +796,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
795
796
  try {
796
797
  if (!overrides && this.context) {
797
798
  overrides = {
798
- blockTag: this.context.blockNumber.toNumber(),
799
+ blockTag: toBlockTag(this.context.blockNumber),
799
800
  };
800
801
  }
801
802
  if (overrides) {
@@ -812,7 +813,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
812
813
  try {
813
814
  if (!overrides && this.context) {
814
815
  overrides = {
815
- blockTag: this.context.blockNumber.toNumber(),
816
+ blockTag: toBlockTag(this.context.blockNumber),
816
817
  };
817
818
  }
818
819
  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 { 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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
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.toNumber(),
295
+ blockTag: toBlockTag(this.context.blockNumber),
295
296
  };
296
297
  }
297
298
  if (overrides) {
@@ -1,4 +1,4 @@
1
- import { ListStateStorage } from '../state/state-storage'
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'
@@ -1,4 +1,4 @@
1
- import { ProcessResult, RecordMetaData } from '../gen'
1
+ import { ProcessResult, RecordMetaData } from '@sentio/protos'
2
2
  import { Logger } from './logger'
3
3
  import { Labels } from './metadata'
4
4
  import { Meter } from './meter'
@@ -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 '../gen'
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 '../state/state-storage'
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: Long.ZERO,
74
- endBlock: Long.ZERO,
72
+ startBlock: 0n,
73
+ endBlock: 0n,
75
74
  }
76
75
  if (options.startBlock) {
77
- if (typeof options.startBlock === 'number') {
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
- if (typeof options.endBlock === 'number') {
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 '../gen'
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: new Long(0),
46
+ startBlock: 0n,
48
47
  }
49
48
  if (config.startBlock) {
50
- if (typeof config.startBlock === 'number') {
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
- if (typeof config.endBlock === 'number') {
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
 
@@ -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?: Long | number
13
- endBlock?: Long | number
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: Long
38
- endBlock?: Long
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?: Long | number
43
+ startBlock?: bigint | number
45
44
  }