@sentio/sdk 1.25.2 → 1.26.0

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 (46) hide show
  1. package/lib/aptos/aptos-processor.d.ts +23 -3
  2. package/lib/aptos/aptos-processor.js +69 -20
  3. package/lib/aptos/aptos-processor.js.map +1 -1
  4. package/lib/aptos/context.d.ts +9 -3
  5. package/lib/aptos/context.js +32 -2
  6. package/lib/aptos/context.js.map +1 -1
  7. package/lib/aptos/network.d.ts +1 -2
  8. package/lib/aptos/network.js +1 -1
  9. package/lib/aptos/network.js.map +1 -1
  10. package/lib/builtin/internal/eacaggregatorproxy_processor.js +24 -8
  11. package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
  12. package/lib/builtin/internal/erc20_processor.js +18 -6
  13. package/lib/builtin/internal/erc20_processor.js.map +1 -1
  14. package/lib/builtin/internal/erc20bytes_processor.js +12 -4
  15. package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
  16. package/lib/builtin/internal/weth9_processor.js +24 -8
  17. package/lib/builtin/internal/weth9_processor.js.map +1 -1
  18. package/lib/gen/processor/protos/processor.d.ts +22 -9
  19. package/lib/gen/processor/protos/processor.js +113 -24
  20. package/lib/gen/processor/protos/processor.js.map +1 -1
  21. package/lib/processor-state.d.ts +2 -0
  22. package/lib/processor-state.js +1 -0
  23. package/lib/processor-state.js.map +1 -1
  24. package/lib/service.d.ts +3 -0
  25. package/lib/service.js +40 -2
  26. package/lib/service.js.map +1 -1
  27. package/lib/target-ethers-sentio/codegen.js +3 -1
  28. package/lib/target-ethers-sentio/codegen.js.map +1 -1
  29. package/lib/tests/aptos.test.js +25 -0
  30. package/lib/tests/aptos.test.js.map +1 -1
  31. package/lib/tests/souffl3.js +5 -1
  32. package/lib/tests/souffl3.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/aptos/aptos-processor.ts +92 -19
  35. package/src/aptos/context.ts +31 -3
  36. package/src/aptos/network.ts +2 -4
  37. package/src/builtin/internal/eacaggregatorproxy_processor.ts +8 -0
  38. package/src/builtin/internal/erc20_processor.ts +24 -28
  39. package/src/builtin/internal/erc20bytes_processor.ts +16 -20
  40. package/src/builtin/internal/weth9_processor.ts +32 -30
  41. package/src/gen/processor/protos/processor.ts +153 -37
  42. package/src/processor-state.ts +2 -0
  43. package/src/service.ts +45 -2
  44. package/src/target-ethers-sentio/codegen.ts +3 -1
  45. package/src/tests/aptos.test.ts +28 -0
  46. package/src/tests/souffl3.ts +6 -1
@@ -224,12 +224,19 @@ export interface AccountConfig {
224
224
  chainId: string;
225
225
  address: string;
226
226
  startBlock: Long;
227
- aptosOnVersionConfigs: AptosOnVersionConfig[];
227
+ onIntervalConfigs: OnIntervalConfig[];
228
+ onAptosIntervalConfigs: AptosOnIntervalConfig[];
228
229
  }
229
230
 
230
- export interface AptosOnVersionConfig {
231
+ export interface OnIntervalConfig {
231
232
  handlerId: number;
232
- step: number;
233
+ minutes: number;
234
+ slot: number;
235
+ }
236
+
237
+ export interface AptosOnIntervalConfig {
238
+ intervalConfig: OnIntervalConfig | undefined;
239
+ type: string;
233
240
  }
234
241
 
235
242
  export interface ContractInfo {
@@ -1325,7 +1332,8 @@ function createBaseAccountConfig(): AccountConfig {
1325
1332
  chainId: "",
1326
1333
  address: "",
1327
1334
  startBlock: Long.UZERO,
1328
- aptosOnVersionConfigs: [],
1335
+ onIntervalConfigs: [],
1336
+ onAptosIntervalConfigs: [],
1329
1337
  };
1330
1338
  }
1331
1339
 
@@ -1343,8 +1351,11 @@ export const AccountConfig = {
1343
1351
  if (!message.startBlock.isZero()) {
1344
1352
  writer.uint32(24).uint64(message.startBlock);
1345
1353
  }
1346
- for (const v of message.aptosOnVersionConfigs) {
1347
- AptosOnVersionConfig.encode(v!, writer.uint32(34).fork()).ldelim();
1354
+ for (const v of message.onIntervalConfigs) {
1355
+ OnIntervalConfig.encode(v!, writer.uint32(34).fork()).ldelim();
1356
+ }
1357
+ for (const v of message.onAptosIntervalConfigs) {
1358
+ AptosOnIntervalConfig.encode(v!, writer.uint32(42).fork()).ldelim();
1348
1359
  }
1349
1360
  return writer;
1350
1361
  },
@@ -1366,8 +1377,13 @@ export const AccountConfig = {
1366
1377
  message.startBlock = reader.uint64() as Long;
1367
1378
  break;
1368
1379
  case 4:
1369
- message.aptosOnVersionConfigs.push(
1370
- AptosOnVersionConfig.decode(reader, reader.uint32())
1380
+ message.onIntervalConfigs.push(
1381
+ OnIntervalConfig.decode(reader, reader.uint32())
1382
+ );
1383
+ break;
1384
+ case 5:
1385
+ message.onAptosIntervalConfigs.push(
1386
+ AptosOnIntervalConfig.decode(reader, reader.uint32())
1371
1387
  );
1372
1388
  break;
1373
1389
  default:
@@ -1385,9 +1401,12 @@ export const AccountConfig = {
1385
1401
  startBlock: isSet(object.startBlock)
1386
1402
  ? Long.fromValue(object.startBlock)
1387
1403
  : Long.UZERO,
1388
- aptosOnVersionConfigs: Array.isArray(object?.aptosOnVersionConfigs)
1389
- ? object.aptosOnVersionConfigs.map((e: any) =>
1390
- AptosOnVersionConfig.fromJSON(e)
1404
+ onIntervalConfigs: Array.isArray(object?.onIntervalConfigs)
1405
+ ? object.onIntervalConfigs.map((e: any) => OnIntervalConfig.fromJSON(e))
1406
+ : [],
1407
+ onAptosIntervalConfigs: Array.isArray(object?.onAptosIntervalConfigs)
1408
+ ? object.onAptosIntervalConfigs.map((e: any) =>
1409
+ AptosOnIntervalConfig.fromJSON(e)
1391
1410
  )
1392
1411
  : [],
1393
1412
  };
@@ -1399,12 +1418,19 @@ export const AccountConfig = {
1399
1418
  message.address !== undefined && (obj.address = message.address);
1400
1419
  message.startBlock !== undefined &&
1401
1420
  (obj.startBlock = (message.startBlock || Long.UZERO).toString());
1402
- if (message.aptosOnVersionConfigs) {
1403
- obj.aptosOnVersionConfigs = message.aptosOnVersionConfigs.map((e) =>
1404
- e ? AptosOnVersionConfig.toJSON(e) : undefined
1421
+ if (message.onIntervalConfigs) {
1422
+ obj.onIntervalConfigs = message.onIntervalConfigs.map((e) =>
1423
+ e ? OnIntervalConfig.toJSON(e) : undefined
1405
1424
  );
1406
1425
  } else {
1407
- obj.aptosOnVersionConfigs = [];
1426
+ obj.onIntervalConfigs = [];
1427
+ }
1428
+ if (message.onAptosIntervalConfigs) {
1429
+ obj.onAptosIntervalConfigs = message.onAptosIntervalConfigs.map((e) =>
1430
+ e ? AptosOnIntervalConfig.toJSON(e) : undefined
1431
+ );
1432
+ } else {
1433
+ obj.onAptosIntervalConfigs = [];
1408
1434
  }
1409
1435
  return obj;
1410
1436
  },
@@ -1417,39 +1443,42 @@ export const AccountConfig = {
1417
1443
  object.startBlock !== undefined && object.startBlock !== null
1418
1444
  ? Long.fromValue(object.startBlock)
1419
1445
  : Long.UZERO;
1420
- message.aptosOnVersionConfigs =
1421
- object.aptosOnVersionConfigs?.map((e) =>
1422
- AptosOnVersionConfig.fromPartial(e)
1446
+ message.onIntervalConfigs =
1447
+ object.onIntervalConfigs?.map((e) => OnIntervalConfig.fromPartial(e)) ||
1448
+ [];
1449
+ message.onAptosIntervalConfigs =
1450
+ object.onAptosIntervalConfigs?.map((e) =>
1451
+ AptosOnIntervalConfig.fromPartial(e)
1423
1452
  ) || [];
1424
1453
  return message;
1425
1454
  },
1426
1455
  };
1427
1456
 
1428
- function createBaseAptosOnVersionConfig(): AptosOnVersionConfig {
1429
- return { handlerId: 0, step: 0 };
1457
+ function createBaseOnIntervalConfig(): OnIntervalConfig {
1458
+ return { handlerId: 0, minutes: 0, slot: 0 };
1430
1459
  }
1431
1460
 
1432
- export const AptosOnVersionConfig = {
1461
+ export const OnIntervalConfig = {
1433
1462
  encode(
1434
- message: AptosOnVersionConfig,
1463
+ message: OnIntervalConfig,
1435
1464
  writer: _m0.Writer = _m0.Writer.create()
1436
1465
  ): _m0.Writer {
1437
1466
  if (message.handlerId !== 0) {
1438
1467
  writer.uint32(8).int32(message.handlerId);
1439
1468
  }
1440
- if (message.step !== 0) {
1441
- writer.uint32(16).int32(message.step);
1469
+ if (message.minutes !== 0) {
1470
+ writer.uint32(16).int32(message.minutes);
1471
+ }
1472
+ if (message.slot !== 0) {
1473
+ writer.uint32(24).int32(message.slot);
1442
1474
  }
1443
1475
  return writer;
1444
1476
  },
1445
1477
 
1446
- decode(
1447
- input: _m0.Reader | Uint8Array,
1448
- length?: number
1449
- ): AptosOnVersionConfig {
1478
+ decode(input: _m0.Reader | Uint8Array, length?: number): OnIntervalConfig {
1450
1479
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1451
1480
  let end = length === undefined ? reader.len : reader.pos + length;
1452
- const message = createBaseAptosOnVersionConfig();
1481
+ const message = createBaseOnIntervalConfig();
1453
1482
  while (reader.pos < end) {
1454
1483
  const tag = reader.uint32();
1455
1484
  switch (tag >>> 3) {
@@ -1457,7 +1486,10 @@ export const AptosOnVersionConfig = {
1457
1486
  message.handlerId = reader.int32();
1458
1487
  break;
1459
1488
  case 2:
1460
- message.step = reader.int32();
1489
+ message.minutes = reader.int32();
1490
+ break;
1491
+ case 3:
1492
+ message.slot = reader.int32();
1461
1493
  break;
1462
1494
  default:
1463
1495
  reader.skipType(tag & 7);
@@ -1467,25 +1499,109 @@ export const AptosOnVersionConfig = {
1467
1499
  return message;
1468
1500
  },
1469
1501
 
1470
- fromJSON(object: any): AptosOnVersionConfig {
1502
+ fromJSON(object: any): OnIntervalConfig {
1471
1503
  return {
1472
1504
  handlerId: isSet(object.handlerId) ? Number(object.handlerId) : 0,
1473
- step: isSet(object.step) ? Number(object.step) : 0,
1505
+ minutes: isSet(object.minutes) ? Number(object.minutes) : 0,
1506
+ slot: isSet(object.slot) ? Number(object.slot) : 0,
1474
1507
  };
1475
1508
  },
1476
1509
 
1477
- toJSON(message: AptosOnVersionConfig): unknown {
1510
+ toJSON(message: OnIntervalConfig): unknown {
1478
1511
  const obj: any = {};
1479
1512
  message.handlerId !== undefined &&
1480
1513
  (obj.handlerId = Math.round(message.handlerId));
1481
- message.step !== undefined && (obj.step = Math.round(message.step));
1514
+ message.minutes !== undefined &&
1515
+ (obj.minutes = Math.round(message.minutes));
1516
+ message.slot !== undefined && (obj.slot = Math.round(message.slot));
1482
1517
  return obj;
1483
1518
  },
1484
1519
 
1485
- fromPartial(object: DeepPartial<AptosOnVersionConfig>): AptosOnVersionConfig {
1486
- const message = createBaseAptosOnVersionConfig();
1520
+ fromPartial(object: DeepPartial<OnIntervalConfig>): OnIntervalConfig {
1521
+ const message = createBaseOnIntervalConfig();
1487
1522
  message.handlerId = object.handlerId ?? 0;
1488
- message.step = object.step ?? 0;
1523
+ message.minutes = object.minutes ?? 0;
1524
+ message.slot = object.slot ?? 0;
1525
+ return message;
1526
+ },
1527
+ };
1528
+
1529
+ function createBaseAptosOnIntervalConfig(): AptosOnIntervalConfig {
1530
+ return { intervalConfig: undefined, type: "" };
1531
+ }
1532
+
1533
+ export const AptosOnIntervalConfig = {
1534
+ encode(
1535
+ message: AptosOnIntervalConfig,
1536
+ writer: _m0.Writer = _m0.Writer.create()
1537
+ ): _m0.Writer {
1538
+ if (message.intervalConfig !== undefined) {
1539
+ OnIntervalConfig.encode(
1540
+ message.intervalConfig,
1541
+ writer.uint32(10).fork()
1542
+ ).ldelim();
1543
+ }
1544
+ if (message.type !== "") {
1545
+ writer.uint32(18).string(message.type);
1546
+ }
1547
+ return writer;
1548
+ },
1549
+
1550
+ decode(
1551
+ input: _m0.Reader | Uint8Array,
1552
+ length?: number
1553
+ ): AptosOnIntervalConfig {
1554
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1555
+ let end = length === undefined ? reader.len : reader.pos + length;
1556
+ const message = createBaseAptosOnIntervalConfig();
1557
+ while (reader.pos < end) {
1558
+ const tag = reader.uint32();
1559
+ switch (tag >>> 3) {
1560
+ case 1:
1561
+ message.intervalConfig = OnIntervalConfig.decode(
1562
+ reader,
1563
+ reader.uint32()
1564
+ );
1565
+ break;
1566
+ case 2:
1567
+ message.type = reader.string();
1568
+ break;
1569
+ default:
1570
+ reader.skipType(tag & 7);
1571
+ break;
1572
+ }
1573
+ }
1574
+ return message;
1575
+ },
1576
+
1577
+ fromJSON(object: any): AptosOnIntervalConfig {
1578
+ return {
1579
+ intervalConfig: isSet(object.intervalConfig)
1580
+ ? OnIntervalConfig.fromJSON(object.intervalConfig)
1581
+ : undefined,
1582
+ type: isSet(object.type) ? String(object.type) : "",
1583
+ };
1584
+ },
1585
+
1586
+ toJSON(message: AptosOnIntervalConfig): unknown {
1587
+ const obj: any = {};
1588
+ message.intervalConfig !== undefined &&
1589
+ (obj.intervalConfig = message.intervalConfig
1590
+ ? OnIntervalConfig.toJSON(message.intervalConfig)
1591
+ : undefined);
1592
+ message.type !== undefined && (obj.type = message.type);
1593
+ return obj;
1594
+ },
1595
+
1596
+ fromPartial(
1597
+ object: DeepPartial<AptosOnIntervalConfig>
1598
+ ): AptosOnIntervalConfig {
1599
+ const message = createBaseAptosOnIntervalConfig();
1600
+ message.intervalConfig =
1601
+ object.intervalConfig !== undefined && object.intervalConfig !== null
1602
+ ? OnIntervalConfig.fromPartial(object.intervalConfig)
1603
+ : undefined;
1604
+ message.type = object.type ?? "";
1489
1605
  return message;
1490
1606
  },
1491
1607
  };
@@ -14,6 +14,7 @@ import { TemplateInstance } from './gen'
14
14
  import { Provider } from '@ethersproject/providers'
15
15
  import { EventTracker } from './core'
16
16
  import { Metric } from './core/meter'
17
+ import { AptosAccountProcessor } from './aptos/aptos-processor'
17
18
 
18
19
  export class ProcessorState {
19
20
  // from abiName_address_chainId => contract wrapper
@@ -34,6 +35,7 @@ export class ProcessorState {
34
35
  suiProcessors: SuiBaseProcessor[] = []
35
36
 
36
37
  aptosProcessors: AptosBaseProcessor[] = []
38
+ aptosAccountProcessors: AptosAccountProcessor[] = []
37
39
 
38
40
  eventTrackers: EventTracker[] = []
39
41
 
package/src/service.ts CHANGED
@@ -3,6 +3,7 @@ import { CallContext, ServerError, Status } from 'nice-grpc'
3
3
  import { SOL_MAINMET_ID, SUI_DEVNET_ID } from './utils/chain'
4
4
 
5
5
  import {
6
+ AccountConfig,
6
7
  AptosCallHandlerConfig,
7
8
  AptosEventHandlerConfig,
8
9
  BlockBinding,
@@ -31,6 +32,7 @@ import Long from 'long'
31
32
  import { TextDecoder } from 'util'
32
33
  import { Trace } from './core'
33
34
  import { Instruction } from '@project-serum/anchor'
35
+ import { MoveResourcesWithVersionPayload } from './aptos/aptos-processor'
34
36
 
35
37
  const DEFAULT_MAX_BLOCK = Long.ZERO
36
38
 
@@ -42,6 +44,8 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
42
44
  private blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []
43
45
  private aptosEventHandlers: ((event: any) => Promise<ProcessResult>)[] = []
44
46
  private aptosCallHandlers: ((func: any) => Promise<ProcessResult>)[] = []
47
+ private aptosResourceHandlers: ((resourceWithVersion: MoveResourcesWithVersionPayload) => Promise<ProcessResult>)[] =
48
+ []
45
49
 
46
50
  // map from chain id to list of processors
47
51
  // private blockHandlers = new Map<string, ((block: Block) => Promise<ProcessResult>)[]>()
@@ -49,6 +53,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
49
53
 
50
54
  private started = false
51
55
  private contractConfigs: ContractConfig[]
56
+ private accountConfigs: AccountConfig[]
52
57
  private templateInstances: TemplateInstance[]
53
58
  private metricConfigs: MetricConfig[]
54
59
  private eventTrackingConfigs: EventTrackingConfig[]
@@ -72,7 +77,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
72
77
  templateInstances: this.templateInstances,
73
78
  eventTrackingConfigs: this.eventTrackingConfigs,
74
79
  metricConfigs: this.metricConfigs,
75
- accountConfigs: [],
80
+ accountConfigs: this.accountConfigs,
76
81
  }
77
82
  }
78
83
 
@@ -81,6 +86,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
81
86
  this.templateInstances = []
82
87
  // this.processorsByChainId.clear()
83
88
  this.contractConfigs = []
89
+ this.accountConfigs = []
84
90
 
85
91
  this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances]
86
92
  this.eventTrackingConfigs = []
@@ -247,7 +253,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
247
253
  blockConfigs: [],
248
254
  logConfigs: [],
249
255
  traceConfigs: [],
250
- startBlock: aptosProcessor.config.startVersion,
256
+ startBlock: Long.fromString(aptosProcessor.config.startVersion.toString()),
251
257
  endBlock: DEFAULT_MAX_BLOCK,
252
258
  instructionConfig: undefined,
253
259
  aptosEventConfigs: [],
@@ -286,6 +292,28 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
286
292
  }
287
293
  this.contractConfigs.push(contractConfig)
288
294
  }
295
+
296
+ for (const aptosProcessor of global.PROCESSOR_STATE.aptosAccountProcessors) {
297
+ const accountConfig: AccountConfig = {
298
+ address: aptosProcessor.config.address,
299
+ chainId: aptosProcessor.getChainId(),
300
+ startBlock: Long.fromValue(aptosProcessor.config.startVersion.toString()),
301
+ onAptosIntervalConfigs: [],
302
+ onIntervalConfigs: [],
303
+ }
304
+ for (const handler of aptosProcessor.resourcesHandlers) {
305
+ const handlerId = this.aptosResourceHandlers.push(handler.handler) - 1
306
+ accountConfig.onAptosIntervalConfigs.push({
307
+ intervalConfig: {
308
+ handlerId: handlerId,
309
+ minutes: handler.timeIntervalInMinutes || 0,
310
+ slot: handler.versionInterval || 0,
311
+ },
312
+ type: handler.type || '',
313
+ })
314
+ }
315
+ this.accountConfigs.push(accountConfig)
316
+ }
289
317
  }
290
318
 
291
319
  async start(request: StartRequest, context: CallContext): Promise<Empty> {
@@ -361,6 +389,8 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
361
389
  return this.processAptosFunctionCall(request)
362
390
  case HandlerType.APT_EVENT:
363
391
  return this.processAptosEvent(request)
392
+ case HandlerType.APT_RESOURCE:
393
+ return this.processAptosResource(request)
364
394
  default:
365
395
  throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
366
396
  }
@@ -613,6 +643,19 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
613
643
  return result
614
644
  }
615
645
 
646
+ async processAptosResource(binding: DataBinding): Promise<ProcessResult> {
647
+ if (!binding.data) {
648
+ throw new ServerError(Status.INVALID_ARGUMENT, "Event can't be empty")
649
+ }
650
+ const jsonString = Utf8ArrayToStr(binding.data.raw)
651
+ const json = JSON.parse(jsonString) as MoveResourcesWithVersionPayload
652
+ const result = await this.aptosResourceHandlers[binding.handlerId](json).catch((e) => {
653
+ throw new ServerError(Status.INTERNAL, 'error processing event: ' + jsonString + '\n' + errorString(e))
654
+ })
655
+ recordRuntimeInfo(result, HandlerType.APT_RESOURCE)
656
+ return result
657
+ }
658
+
616
659
  async processAptosFunctionCall(binding: DataBinding): Promise<ProcessResult> {
617
660
  if (!binding.data) {
618
661
  throw new ServerError(Status.INVALID_ARGUMENT, "Event can't be empty")
@@ -258,7 +258,9 @@ function generateOnEventFunction(event: EventDeclaration, contractName: string,
258
258
  ) {
259
259
  if (!filter) {
260
260
  // @ts-ignore
261
- filter = ${contractName}Processor.filters['${filterName}'](${event.inputs.map(() => 'null').join(',')})
261
+ filter = ${contractName}Processor.filters[
262
+ // @ts-ignore
263
+ '${filterName}'](${event.inputs.map(() => 'null').join(',')})
262
264
  }
263
265
  return super.onEvent(handler, filter!)
264
266
  }
@@ -115,6 +115,34 @@ describe('Test Aptos Example', () => {
115
115
  const res = await service.processBindings(request)
116
116
  expect(firstGaugeValue(res.result, 'size')).equal(2n)
117
117
  })
118
+
119
+ test('check on timer', async () => {
120
+ const request: ProcessBindingsRequest = {
121
+ bindings: [
122
+ {
123
+ data: {
124
+ raw: new TextEncoder().encode(
125
+ JSON.stringify({
126
+ version: '12345',
127
+ resources: [
128
+ {
129
+ type: '0x1::coin::SupplyConfig',
130
+ data: {
131
+ allow_upgrades: false,
132
+ },
133
+ },
134
+ ],
135
+ })
136
+ ),
137
+ },
138
+ handlerId: 0,
139
+ handlerType: HandlerType.APT_RESOURCE,
140
+ },
141
+ ],
142
+ }
143
+ const res = await service.processBindings(request)
144
+ expect(firstCounterValue(res.result, 'onTimer')).equal(1n)
145
+ })
118
146
  })
119
147
 
120
148
  const testData = {
@@ -3,10 +3,11 @@ import { token } from '../builtin/aptos/0x3'
3
3
  import { voting } from '../builtin/aptos/0x1'
4
4
  import { TYPE_REGISTRY } from '../aptos/types'
5
5
  import { AccountEventTracker } from '@sentio/sdk'
6
+ import { AptosAccountProcessor } from '../aptos/aptos-processor'
6
7
 
7
8
  const accountTracker = AccountEventTracker.register('pull')
8
9
 
9
- SouffleChefCampaign.bind({ startVersion: 3212312 })
10
+ SouffleChefCampaign.bind({ startVersion: 3212312n })
10
11
  .onEntryPullTokenV2((call: SouffleChefCampaign.PullTokenV2Payload, ctx) => {
11
12
  ctx.meter.Counter('call_num').add(1)
12
13
  ctx.meter.Counter('pulled').add(call.arguments_typed[3])
@@ -45,3 +46,7 @@ voting.bind().onEventCreateProposalEvent((evt, ctx) => {
45
46
  evt.data_typed.expiration_secs + evt.data_typed.expiration_secs
46
47
  ctx.meter.Gauge('size').record(evt.data_typed.metadata.data.length)
47
48
  })
49
+
50
+ AptosAccountProcessor.bind({ address: '0x1' }).onTimeInterval((resources, ctx) => {
51
+ ctx.meter.Counter('onTimer').add(1)
52
+ }, 10000)