@apibara/indexer 2.1.0-beta.1 → 2.1.0-beta.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/dist/index.cjs CHANGED
@@ -114,9 +114,13 @@ async function run(client, indexer, runOptions = {}) {
114
114
  if (indexer.options.startingCursor) {
115
115
  startingCursor = indexer.options.startingCursor;
116
116
  } else if (indexer.options.startingBlock !== void 0) {
117
- startingCursor = {
118
- orderKey: indexer.options.startingBlock
119
- };
117
+ if (indexer.options.startingBlock === 0n) {
118
+ startingCursor = void 0;
119
+ } else if (indexer.options.startingBlock > 0n) {
120
+ startingCursor = {
121
+ orderKey: indexer.options.startingBlock - 1n
122
+ };
123
+ }
120
124
  }
121
125
  const request = indexer.streamConfig.Request.make({
122
126
  filter: isFactoryMode ? [indexer.options.filter, {}] : [indexer.options.filter],
package/dist/index.mjs CHANGED
@@ -107,9 +107,13 @@ async function run(client, indexer, runOptions = {}) {
107
107
  if (indexer.options.startingCursor) {
108
108
  startingCursor = indexer.options.startingCursor;
109
109
  } else if (indexer.options.startingBlock !== void 0) {
110
- startingCursor = {
111
- orderKey: indexer.options.startingBlock
112
- };
110
+ if (indexer.options.startingBlock === 0n) {
111
+ startingCursor = void 0;
112
+ } else if (indexer.options.startingBlock > 0n) {
113
+ startingCursor = {
114
+ orderKey: indexer.options.startingBlock - 1n
115
+ };
116
+ }
113
117
  }
114
118
  const request = indexer.streamConfig.Request.make({
115
119
  filter: isFactoryMode ? [indexer.options.filter, {}] : [indexer.options.filter],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/indexer",
3
- "version": "2.1.0-beta.1",
3
+ "version": "2.1.0-beta.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -70,7 +70,7 @@
70
70
  "vitest": "^1.6.0"
71
71
  },
72
72
  "dependencies": {
73
- "@apibara/protocol": "2.1.0-beta.1",
73
+ "@apibara/protocol": "2.1.0-beta.2",
74
74
  "@opentelemetry/api": "^1.9.0",
75
75
  "ci-info": "^4.1.0",
76
76
  "consola": "^3.2.3",
package/src/indexer.ts CHANGED
@@ -225,9 +225,13 @@ export async function run<TFilter, TBlock>(
225
225
  if (indexer.options.startingCursor) {
226
226
  startingCursor = indexer.options.startingCursor;
227
227
  } else if (indexer.options.startingBlock !== undefined) {
228
- startingCursor = {
229
- orderKey: indexer.options.startingBlock,
230
- };
228
+ if (indexer.options.startingBlock === 0n) {
229
+ startingCursor = undefined;
230
+ } else if (indexer.options.startingBlock > 0n) {
231
+ startingCursor = {
232
+ orderKey: indexer.options.startingBlock - 1n,
233
+ };
234
+ }
231
235
  }
232
236
 
233
237
  // if factory mode we add a empty filter at the end of the filter array.