@sentio/sdk 2.58.7 → 2.59.0-rc.10

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 (102) hide show
  1. package/lib/aptos/aptos-plugin.d.ts.map +1 -1
  2. package/lib/aptos/aptos-plugin.js +11 -5
  3. package/lib/aptos/aptos-plugin.js.map +1 -1
  4. package/lib/aptos/aptos-processor.d.ts +1 -0
  5. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  6. package/lib/aptos/aptos-processor.js +1 -0
  7. package/lib/aptos/aptos-processor.js.map +1 -1
  8. package/lib/aptos/builtin/0x1.d.ts +485 -0
  9. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  10. package/lib/aptos/builtin/0x1.js +825 -1
  11. package/lib/aptos/builtin/0x1.js.map +1 -1
  12. package/lib/aptos/builtin/0x3.d.ts.map +1 -1
  13. package/lib/aptos/builtin/0x3.js +2 -1
  14. package/lib/aptos/builtin/0x3.js.map +1 -1
  15. package/lib/aptos/builtin/0x4.d.ts.map +1 -1
  16. package/lib/aptos/builtin/0x4.js +2 -1
  17. package/lib/aptos/builtin/0x4.js.map +1 -1
  18. package/lib/aptos/codegen/codegen.js +27 -5
  19. package/lib/aptos/codegen/codegen.js.map +1 -1
  20. package/lib/aptos/move-coder.js +1 -1
  21. package/lib/aptos/move-coder.js.map +1 -1
  22. package/lib/aptos/network.d.ts +2 -0
  23. package/lib/aptos/network.d.ts.map +1 -1
  24. package/lib/aptos/network.js +5 -1
  25. package/lib/aptos/network.js.map +1 -1
  26. package/lib/eth/base-processor.d.ts +3 -3
  27. package/lib/eth/base-processor.d.ts.map +1 -1
  28. package/lib/eth/base-processor.js +22 -8
  29. package/lib/eth/base-processor.js.map +1 -1
  30. package/lib/eth/bind-options.d.ts +6 -0
  31. package/lib/eth/bind-options.d.ts.map +1 -1
  32. package/lib/eth/bind-options.js +2 -0
  33. package/lib/eth/bind-options.js.map +1 -1
  34. package/lib/eth/eth-plugin.d.ts.map +1 -1
  35. package/lib/eth/eth-plugin.js +12 -5
  36. package/lib/eth/eth-plugin.js.map +1 -1
  37. package/lib/store/codegen.d.ts.map +1 -1
  38. package/lib/store/codegen.js +17 -0
  39. package/lib/store/codegen.js.map +1 -1
  40. package/lib/store/schema.d.ts.map +1 -1
  41. package/lib/store/schema.js +3 -1
  42. package/lib/store/schema.js.map +1 -1
  43. package/lib/store/types.d.ts +1 -1
  44. package/lib/store/types.d.ts.map +1 -1
  45. package/lib/sui/builtin/0x1.d.ts +4 -0
  46. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  47. package/lib/sui/builtin/0x1.js +1 -1
  48. package/lib/sui/builtin/0x1.js.map +1 -1
  49. package/lib/sui/builtin/0x2.d.ts +63 -0
  50. package/lib/sui/builtin/0x2.d.ts.map +1 -1
  51. package/lib/sui/builtin/0x2.js +279 -1
  52. package/lib/sui/builtin/0x2.js.map +1 -1
  53. package/lib/sui/builtin/0x3.d.ts +41 -14
  54. package/lib/sui/builtin/0x3.d.ts.map +1 -1
  55. package/lib/sui/builtin/0x3.js +128 -10
  56. package/lib/sui/builtin/0x3.js.map +1 -1
  57. package/lib/sui/sui-object-processor-template.js +1 -1
  58. package/lib/sui/sui-object-processor-template.js.map +1 -1
  59. package/lib/sui/sui-object-processor.d.ts +2 -0
  60. package/lib/sui/sui-object-processor.d.ts.map +1 -1
  61. package/lib/sui/sui-object-processor.js +4 -0
  62. package/lib/sui/sui-object-processor.js.map +1 -1
  63. package/lib/sui/sui-plugin.d.ts.map +1 -1
  64. package/lib/sui/sui-plugin.js +9 -4
  65. package/lib/sui/sui-plugin.js.map +1 -1
  66. package/lib/sui/sui-processor.d.ts +1 -0
  67. package/lib/sui/sui-processor.d.ts.map +1 -1
  68. package/lib/sui/sui-processor.js +1 -0
  69. package/lib/sui/sui-processor.js.map +1 -1
  70. package/lib/utils/block.d.ts +2 -0
  71. package/lib/utils/block.d.ts.map +1 -1
  72. package/lib/utils/block.js +13 -0
  73. package/lib/utils/block.js.map +1 -1
  74. package/package.json +10 -9
  75. package/src/aptos/abis/0x1.json +9650 -5284
  76. package/src/aptos/abis/0x3.json +13 -13
  77. package/src/aptos/abis/0x4.json +42 -42
  78. package/src/aptos/aptos-plugin.ts +11 -5
  79. package/src/aptos/aptos-processor.ts +2 -0
  80. package/src/aptos/builtin/0x1.ts +1567 -67
  81. package/src/aptos/builtin/0x3.ts +3 -1
  82. package/src/aptos/builtin/0x4.ts +3 -1
  83. package/src/aptos/codegen/codegen.ts +33 -5
  84. package/src/aptos/move-coder.ts +1 -1
  85. package/src/aptos/network.ts +5 -1
  86. package/src/eth/base-processor.ts +23 -9
  87. package/src/eth/bind-options.ts +7 -0
  88. package/src/eth/eth-plugin.ts +22 -5
  89. package/src/store/codegen.ts +22 -0
  90. package/src/store/schema.ts +3 -1
  91. package/src/store/types.ts +1 -1
  92. package/src/sui/abis/0x1.json +8 -0
  93. package/src/sui/abis/0x2.json +437 -0
  94. package/src/sui/abis/0x3.json +116 -5
  95. package/src/sui/builtin/0x1.ts +6 -1
  96. package/src/sui/builtin/0x2.ts +413 -1
  97. package/src/sui/builtin/0x3.ts +211 -22
  98. package/src/sui/sui-object-processor-template.ts +1 -1
  99. package/src/sui/sui-object-processor.ts +6 -0
  100. package/src/sui/sui-plugin.ts +9 -4
  101. package/src/sui/sui-processor.ts +2 -0
  102. package/src/utils/block.ts +15 -0
@@ -94,7 +94,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
94
94
  abi: ''
95
95
  },
96
96
  startBlock: config.startCheckpoint,
97
- endBlock: 0n,
97
+ endBlock: config.endCheckpoint || 0n,
98
98
  baseLabels: config.baseLabels
99
99
  })
100
100
  console.log(`successfully bind template ${sig}`)
@@ -24,6 +24,7 @@ export interface SuiObjectBindOptions {
24
24
  objectId: string
25
25
  network?: SuiNetwork
26
26
  startCheckpoint?: bigint
27
+ endCheckpoint?: bigint
27
28
  baseLabels?: { [key: string]: string }
28
29
  }
29
30
 
@@ -31,6 +32,7 @@ export interface SuiObjectTypeBindOptions<T> {
31
32
  objectType: TypeDescriptor<T>
32
33
  network?: SuiNetwork
33
34
  startCheckpoint?: bigint
35
+ endCheckpoint?: bigint
34
36
  baseLabels?: { [key: string]: string }
35
37
  }
36
38
 
@@ -71,6 +73,7 @@ export abstract class SuiBaseObjectOrAddressProcessor<HandlerType> {
71
73
  if (options.ownerType === MoveOwnerType.TYPE) {
72
74
  this.config = {
73
75
  startCheckpoint: options.startCheckpoint || 0n,
76
+ endCheckpoint: options.endCheckpoint,
74
77
  address: options.address === '*' ? '*' : accountTypeString(options.address),
75
78
  network: options.network || SuiNetwork.MAIN_NET,
76
79
  baseLabels: options.baseLabels
@@ -234,6 +237,7 @@ export class SuiObjectProcessor extends SuiBaseObjectOrAddressProcessorInternal<
234
237
  address: options.objectId,
235
238
  network: options.network,
236
239
  startCheckpoint: options.startCheckpoint,
240
+ endCheckpoint: options.endCheckpoint,
237
241
  ownerType: MoveOwnerType.OBJECT,
238
242
  baseLabels: options.baseLabels
239
243
  })
@@ -266,6 +270,7 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
266
270
  address: ALL_ADDRESS, // current only support on all address
267
271
  network: options.network,
268
272
  startCheckpoint: options.startCheckpoint,
273
+ endCheckpoint: options.endCheckpoint,
269
274
  ownerType: MoveOwnerType.TYPE,
270
275
  baseLabels: options.baseLabels
271
276
  })
@@ -365,6 +370,7 @@ export class SuiWrappedObjectProcessor extends SuiBaseObjectOrAddressProcessorIn
365
370
  address: options.objectId,
366
371
  network: options.network,
367
372
  startCheckpoint: options.startCheckpoint,
373
+ endCheckpoint: options.endCheckpoint,
368
374
  ownerType: MoveOwnerType.WRAPPED_OBJECT,
369
375
  baseLabels: options.baseLabels
370
376
  })
@@ -64,6 +64,7 @@ export class SuiPlugin extends Plugin {
64
64
  objectId: instance.contract?.address || '',
65
65
  network: <SuiNetwork>instance.contract?.chainId || SuiNetwork.MAIN_NET,
66
66
  startCheckpoint: instance.startBlock || 0n,
67
+ endCheckpoint: instance.endBlock || 0n,
67
68
  baseLabels: instance.baseLabels
68
69
  },
69
70
  NoopContext
@@ -88,7 +89,8 @@ export class SuiPlugin extends Plugin {
88
89
  address: suiProcessor.config.address,
89
90
  abi: ''
90
91
  },
91
- startBlock: suiProcessor.config.startCheckpoint
92
+ startBlock: suiProcessor.config.startCheckpoint,
93
+ endBlock: suiProcessor.config.endCheckpoint
92
94
  })
93
95
  for (const handler of suiProcessor.eventHandlers) {
94
96
  const handlerId = handlers.suiEventHandlers.push(handler.handler) - 1
@@ -131,7 +133,8 @@ export class SuiPlugin extends Plugin {
131
133
  const objectChangeHandler: MoveResourceChangeConfig = {
132
134
  type: handler.type,
133
135
  handlerId,
134
- handlerName: handler.handlerName
136
+ handlerName: handler.handlerName,
137
+ includeDeleted: false
135
138
  }
136
139
  contractConfig.moveResourceChangeConfigs.push(objectChangeHandler)
137
140
  }
@@ -142,7 +145,8 @@ export class SuiPlugin extends Plugin {
142
145
  const accountConfig = AccountConfig.fromPartial({
143
146
  address: processor.config.address,
144
147
  chainId: processor.getChainId(),
145
- startBlock: processor.config.startCheckpoint // TODO maybe use another field
148
+ startBlock: processor.config.startCheckpoint, // TODO maybe use another field
149
+ endBlock: processor.config.endCheckpoint
146
150
  })
147
151
 
148
152
  for (const handler of processor.objectChangeHandlers) {
@@ -150,7 +154,8 @@ export class SuiPlugin extends Plugin {
150
154
  const objectChangeHandler: MoveResourceChangeConfig = {
151
155
  type: handler.type,
152
156
  handlerId,
153
- handlerName: handler.handlerName
157
+ handlerName: handler.handlerName,
158
+ includeDeleted: false
154
159
  }
155
160
  accountConfig.moveResourceChangeConfigs.push(objectChangeHandler)
156
161
  }
@@ -31,6 +31,7 @@ export type IndexConfigure = Required<SuiBindOptions, 'startCheckpoint' | 'netwo
31
31
  export function configure(options: SuiBindOptions): IndexConfigure {
32
32
  return {
33
33
  startCheckpoint: options.startCheckpoint || 0n,
34
+ endCheckpoint: options.endCheckpoint,
34
35
  address: options.address === ALL_ADDRESS ? ALL_ADDRESS : accountAddressString(options.address),
35
36
  network: options.network || SuiNetwork.MAIN_NET,
36
37
  baseLabels: options.baseLabels
@@ -41,6 +42,7 @@ export interface SuiBindOptions {
41
42
  address: string
42
43
  network?: SuiNetwork
43
44
  startCheckpoint?: bigint
45
+ endCheckpoint?: bigint
44
46
  baseLabels?: Labels
45
47
  }
46
48
 
@@ -1,3 +1,4 @@
1
+ import { TimeOrBlock } from 'eth/bind-options.js'
1
2
  import { Block, JsonRpcProvider, EthersError } from 'ethers'
2
3
 
3
4
  async function getBlockSafely(provider: JsonRpcProvider, blockNumber: number | string): Promise<Block> {
@@ -81,3 +82,17 @@ export async function estimateBlockNumberAtDateSlow(
81
82
  const closestBlock = await getBlockSafely(provider, high)
82
83
  return closestBlock.number
83
84
  }
85
+
86
+ export async function timeOrBlockToBlockNumber(provider: JsonRpcProvider, timeOrBlock: TimeOrBlock): Promise<bigint> {
87
+ if (timeOrBlock.block) {
88
+ return BigInt(timeOrBlock.block)
89
+ }
90
+ if (!timeOrBlock.time) {
91
+ return 0n
92
+ }
93
+ const block = await estimateBlockNumberAtDate(provider, timeOrBlock.time)
94
+ if (!block) {
95
+ throw new Error('Block not found')
96
+ }
97
+ return BigInt(block)
98
+ }