@sentio/sdk 2.44.3-rc.1 → 2.44.3-rc.11

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 (109) hide show
  1. package/lib/aptos/aptos-processor.d.ts +5 -4
  2. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  3. package/lib/aptos/aptos-processor.js +13 -6
  4. package/lib/aptos/aptos-processor.js.map +1 -1
  5. package/lib/aptos/builtin/0x1.d.ts +25 -0
  6. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  7. package/lib/aptos/builtin/0x1.js +24 -2
  8. package/lib/aptos/builtin/0x1.js.map +1 -1
  9. package/lib/aptos/builtin/0x3.js +2 -1
  10. package/lib/aptos/builtin/0x3.js.map +1 -1
  11. package/lib/aptos/builtin/0x4.js +2 -1
  12. package/lib/aptos/builtin/0x4.js.map +1 -1
  13. package/lib/aptos/codegen/codegen.js +1 -12
  14. package/lib/aptos/codegen/codegen.js.map +1 -1
  15. package/lib/aptos/index.d.ts +2 -1
  16. package/lib/aptos/index.d.ts.map +1 -1
  17. package/lib/aptos/index.js.map +1 -1
  18. package/lib/aptos/network.d.ts +1 -0
  19. package/lib/aptos/network.d.ts.map +1 -1
  20. package/lib/aptos/network.js +2 -1
  21. package/lib/aptos/network.js.map +1 -1
  22. package/lib/core/event-logger.d.ts.map +1 -1
  23. package/lib/core/event-logger.js +2 -1
  24. package/lib/core/event-logger.js.map +1 -1
  25. package/lib/core/meter.d.ts.map +1 -1
  26. package/lib/core/meter.js +3 -1
  27. package/lib/core/meter.js.map +1 -1
  28. package/lib/eth/codegen/codegen.js +4 -5
  29. package/lib/eth/codegen/codegen.js.map +1 -1
  30. package/lib/eth/context.d.ts.map +1 -1
  31. package/lib/eth/context.js +9 -1
  32. package/lib/eth/context.js.map +1 -1
  33. package/lib/fuel/asset-processor.d.ts +1 -0
  34. package/lib/fuel/asset-processor.d.ts.map +1 -1
  35. package/lib/fuel/asset-processor.js +2 -1
  36. package/lib/fuel/asset-processor.js.map +1 -1
  37. package/lib/fuel/codegen/codegen.js +2 -2
  38. package/lib/fuel/codegen/codegen.js.map +1 -1
  39. package/lib/move/shared-network-codegen.d.ts +3 -1
  40. package/lib/move/shared-network-codegen.d.ts.map +1 -1
  41. package/lib/move/shared-network-codegen.js +19 -6
  42. package/lib/move/shared-network-codegen.js.map +1 -1
  43. package/lib/solana/builtin/types.d.ts +170 -170
  44. package/lib/solana/builtin/types.d.ts.map +1 -1
  45. package/lib/solana/builtin/types.js +1 -1
  46. package/lib/solana/builtin/types.js.map +1 -1
  47. package/lib/stark/codegen/codegen.js +2 -2
  48. package/lib/stark/codegen/codegen.js.map +1 -1
  49. package/lib/store/codegen.js +2 -2
  50. package/lib/store/codegen.js.map +1 -1
  51. package/lib/sui/builtin/0x1.d.ts +19 -0
  52. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  53. package/lib/sui/builtin/0x1.js +28 -3
  54. package/lib/sui/builtin/0x1.js.map +1 -1
  55. package/lib/sui/builtin/0x2.js +0 -2
  56. package/lib/sui/builtin/0x2.js.map +1 -1
  57. package/lib/sui/builtin/0x3.js +1 -3
  58. package/lib/sui/builtin/0x3.js.map +1 -1
  59. package/lib/sui/codegen/codegen.js +1 -12
  60. package/lib/sui/codegen/codegen.js.map +1 -1
  61. package/lib/sui/network.d.ts +0 -2
  62. package/lib/sui/network.d.ts.map +1 -1
  63. package/lib/sui/network.js +3 -3
  64. package/lib/sui/network.js.map +1 -1
  65. package/lib/utils/price.d.ts.map +1 -1
  66. package/lib/utils/price.js +2 -1
  67. package/lib/utils/price.js.map +1 -1
  68. package/package.json +12 -16
  69. package/src/aptos/abis/0x1.json +73 -9
  70. package/src/aptos/aptos-processor.ts +21 -15
  71. package/src/aptos/builtin/0x1.ts +80 -2
  72. package/src/aptos/builtin/0x3.ts +2 -1
  73. package/src/aptos/builtin/0x4.ts +2 -1
  74. package/src/aptos/codegen/codegen.ts +1 -13
  75. package/src/aptos/index.ts +2 -6
  76. package/src/aptos/network.ts +2 -1
  77. package/src/core/event-logger.ts +2 -1
  78. package/src/core/meter.ts +3 -1
  79. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +204 -204
  80. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.ts +12 -12
  81. package/src/eth/builtin/internal/erc1155-processor.ts +95 -95
  82. package/src/eth/builtin/internal/erc1155-test-utils.ts +8 -8
  83. package/src/eth/builtin/internal/erc20-processor.ts +140 -140
  84. package/src/eth/builtin/internal/erc20-test-utils.ts +6 -6
  85. package/src/eth/builtin/internal/erc20bytes-processor.ts +80 -80
  86. package/src/eth/builtin/internal/erc20bytes-test-utils.ts +4 -4
  87. package/src/eth/builtin/internal/erc721-processor.ts +133 -133
  88. package/src/eth/builtin/internal/erc721-test-utils.ts +6 -6
  89. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.ts +1 -1
  90. package/src/eth/builtin/internal/factories/ERC1155__factory.ts +1 -1
  91. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.ts +1 -1
  92. package/src/eth/builtin/internal/weth9-processor.ts +97 -97
  93. package/src/eth/builtin/internal/weth9-test-utils.ts +8 -8
  94. package/src/eth/codegen/codegen.ts +5 -5
  95. package/src/eth/context.ts +9 -1
  96. package/src/fuel/asset-processor.ts +3 -1
  97. package/src/fuel/codegen/codegen.ts +2 -2
  98. package/src/move/shared-network-codegen.ts +14 -7
  99. package/src/solana/builtin/types.ts +1 -1
  100. package/src/stark/codegen/codegen.ts +2 -2
  101. package/src/store/codegen.ts +2 -2
  102. package/src/sui/abis/0x1.json +391 -0
  103. package/src/sui/abis/0x3.json +20 -0
  104. package/src/sui/builtin/0x1.ts +44 -3
  105. package/src/sui/builtin/0x2.ts +0 -2
  106. package/src/sui/builtin/0x3.ts +1 -3
  107. package/src/sui/codegen/codegen.ts +1 -13
  108. package/src/sui/network.ts +3 -3
  109. package/src/utils/price.ts +2 -1
@@ -2,11 +2,9 @@ import { defaultMoveCoder, MoveCoder } from './index.js'
2
2
 
3
3
  import {
4
4
  Event,
5
- WriteSetChangeWriteResource,
6
5
  MoveResource,
7
6
  UserTransactionResponse,
8
7
  EntryFunctionPayloadResponse,
9
- WriteSetChangeDeleteResource,
10
8
  MultisigPayloadResponse
11
9
  } from '@aptos-labs/ts-sdk'
12
10
 
@@ -33,6 +31,8 @@ import {
33
31
  ResourceChangeHandler
34
32
  } from '../move/index.js'
35
33
  import { Labels, PromiseOrVoid } from '../core/index.js'
34
+ import { TypeDescriptor } from '@typemove/move'
35
+ import { decodeResourceChange, ResourceChange } from '@typemove/aptos'
36
36
 
37
37
  const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
38
38
  resourceChanges: false,
@@ -46,8 +46,6 @@ export const DEFAULT_RESOURCE_FETCH_CONFIG: MoveAccountFetchConfig = {
46
46
  owned: true
47
47
  }
48
48
 
49
- export type ResourceChange = WriteSetChangeWriteResource | WriteSetChangeDeleteResource
50
-
51
49
  type IndexConfigure = {
52
50
  address: string
53
51
  network: AptosNetwork
@@ -231,19 +229,21 @@ export class AptosBaseProcessor {
231
229
  return this
232
230
  }
233
231
 
234
- public onResourceChange(
235
- handler: (changes: ResourceChange[], ctx: AptosResourcesContext) => PromiseOrVoid,
236
- type: string
232
+ public onResourceChange<T>(
233
+ handler: (changes: ResourceChange<T>[], ctx: AptosResourcesContext) => PromiseOrVoid,
234
+ typeDesc: TypeDescriptor<T> | string
237
235
  ): this {
236
+ if (typeof typeDesc === 'string') {
237
+ typeDesc = parseMoveType(typeDesc)
238
+ }
239
+
238
240
  const processor = this
239
241
  this.resourceHandlers.push({
240
242
  handler: async function (data) {
241
243
  if (!data.resources || !data.version) {
242
244
  throw new ServerError(Status.INVALID_ARGUMENT, 'resource is null')
243
245
  }
244
- const resources = data.resources as ResourceChange[]
245
246
  const timestamp = Number(data.timestampMicros)
246
-
247
247
  const ctx = new AptosResourcesContext(
248
248
  processor.config.network,
249
249
  processor.config.address,
@@ -251,10 +251,11 @@ export class AptosBaseProcessor {
251
251
  timestamp,
252
252
  processor.config.baseLabels
253
253
  )
254
+ const resources = await decodeResourceChange<T>(data.resources, ctx.coder)
254
255
  await handler(resources, ctx)
255
256
  return ctx.stopAndGetResult()
256
257
  },
257
- type
258
+ type: typeDesc.qname
258
259
  })
259
260
  return this
260
261
  }
@@ -364,10 +365,14 @@ export class AptosResourcesProcessor {
364
365
  )
365
366
  }
366
367
 
367
- public onResourceChange(
368
- handler: (changes: ResourceChange[], ctx: AptosResourcesContext) => PromiseOrVoid,
369
- typeOrPrefix: string
368
+ public onResourceChange<T>(
369
+ handler: (changes: ResourceChange<T>[], ctx: AptosResourcesContext) => PromiseOrVoid,
370
+ typeDesc: TypeDescriptor<T> | string
370
371
  ): this {
372
+ if (typeof typeDesc === 'string') {
373
+ typeDesc = parseMoveType(typeDesc)
374
+ }
375
+
371
376
  const processor = this
372
377
  this.resourcesHandlers.push({
373
378
  fetchConfig: DEFAULT_RESOURCE_FETCH_CONFIG,
@@ -377,7 +382,6 @@ export class AptosResourcesProcessor {
377
382
  if (!data.resources || !data.version) {
378
383
  throw new ServerError(Status.INVALID_ARGUMENT, 'resource is null')
379
384
  }
380
- const resources = data.resources as ResourceChange[]
381
385
  const ctx = new AptosResourcesContext(
382
386
  processor.config.network,
383
387
  processor.config.address,
@@ -385,10 +389,12 @@ export class AptosResourcesProcessor {
385
389
  timestamp,
386
390
  processor.config.baseLabels
387
391
  )
392
+
393
+ const resources = (await decodeResourceChange(data.resources, ctx.coder)) as ResourceChange<T>[]
388
394
  await handler(resources, ctx)
389
395
  return ctx.stopAndGetResult()
390
396
  },
391
- type: typeOrPrefix
397
+ type: typeDesc.qname
392
398
  })
393
399
  return this
394
400
  }