@sentio/sdk 1.8.1 → 1.9.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.
- package/lib/base-processor.d.ts +7 -0
- package/lib/base-processor.js +28 -1
- package/lib/base-processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.d.ts +87 -2
- package/lib/builtin/internal/erc20_processor.js +54 -0
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.d.ts +42 -2
- package/lib/builtin/internal/erc20bytes_processor.js +27 -0
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.d.ts +50 -2
- package/lib/builtin/internal/weth9_processor.js +33 -0
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/context.d.ts +15 -11
- package/lib/context.js +21 -13
- package/lib/context.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +13 -1
- package/lib/gen/processor/protos/processor.js +83 -12
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js.map +1 -1
- package/lib/meter.d.ts +4 -4
- package/lib/meter.js +11 -0
- package/lib/meter.js.map +1 -1
- package/lib/service.d.ts +3 -1
- package/lib/service.js +34 -2
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +8 -0
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/target-ethers-sentio/functions.d.ts +3 -0
- package/lib/target-ethers-sentio/functions.js +54 -0
- package/lib/target-ethers-sentio/functions.js.map +1 -0
- package/lib/trace.d.ts +35 -0
- package/lib/trace.js +22 -0
- package/lib/trace.js.map +1 -0
- package/package.json +1 -1
- package/src/base-processor.ts +34 -0
- package/src/builtin/internal/erc20_processor.ts +183 -1
- package/src/builtin/internal/erc20bytes_processor.ts +94 -1
- package/src/builtin/internal/weth9_processor.ts +108 -1
- package/src/context.ts +23 -14
- package/src/gen/processor/protos/processor.ts +104 -13
- package/src/index.ts +1 -0
- package/src/meter.ts +19 -8
- package/src/service.ts +43 -2
- package/src/target-ethers-sentio/codegen.ts +8 -0
- package/src/target-ethers-sentio/functions.ts +55 -0
- package/src/trace.ts +64 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
import { CallOverrides } from "ethers";
|
|
4
|
+
import { BigNumberish, CallOverrides } from "ethers";
|
|
5
5
|
import { Networkish } from "@ethersproject/providers";
|
|
6
6
|
import {
|
|
7
7
|
addContractByABI,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
getContractName,
|
|
21
|
+
TypedTrace,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC20, ERC20__factory } from "./index";
|
|
@@ -350,6 +351,91 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
353
|
|
|
354
|
+
export interface AllowanceCallTrace extends TypedTrace {
|
|
355
|
+
args: [owner: PromiseOrValue<string>, spender: PromiseOrValue<string>];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface ApproveCallTrace extends TypedTrace {
|
|
359
|
+
args: [spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface BalanceOfCallTrace extends TypedTrace {
|
|
363
|
+
args: [account: PromiseOrValue<string>];
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface BurnCallTrace extends TypedTrace {
|
|
367
|
+
args: [amount: PromiseOrValue<BigNumberish>];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface BurnFromCallTrace extends TypedTrace {
|
|
371
|
+
args: [account: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface DecimalsCallTrace extends TypedTrace {
|
|
375
|
+
args: [];
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface DecreaseAllowanceCallTrace extends TypedTrace {
|
|
379
|
+
args: [
|
|
380
|
+
spender: PromiseOrValue<string>,
|
|
381
|
+
subtractedValue: PromiseOrValue<BigNumberish>
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface IncreaseAllowanceCallTrace extends TypedTrace {
|
|
386
|
+
args: [
|
|
387
|
+
spender: PromiseOrValue<string>,
|
|
388
|
+
addedValue: PromiseOrValue<BigNumberish>
|
|
389
|
+
];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface LockerCallTrace extends TypedTrace {
|
|
393
|
+
args: [];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface NameCallTrace extends TypedTrace {
|
|
397
|
+
args: [];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface OwnerCallTrace extends TypedTrace {
|
|
401
|
+
args: [];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface RenounceOwnershipCallTrace extends TypedTrace {
|
|
405
|
+
args: [];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface SetLockerCallTrace extends TypedTrace {
|
|
409
|
+
args: [_locker: PromiseOrValue<string>];
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface SymbolCallTrace extends TypedTrace {
|
|
413
|
+
args: [];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface TotalSupplyCallTrace extends TypedTrace {
|
|
417
|
+
args: [];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface TransferCallTrace extends TypedTrace {
|
|
421
|
+
args: [
|
|
422
|
+
recipient: PromiseOrValue<string>,
|
|
423
|
+
amount: PromiseOrValue<BigNumberish>
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export interface TransferFromCallTrace extends TypedTrace {
|
|
428
|
+
args: [
|
|
429
|
+
sender: PromiseOrValue<string>,
|
|
430
|
+
recipient: PromiseOrValue<string>,
|
|
431
|
+
amount: PromiseOrValue<BigNumberish>
|
|
432
|
+
];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface TransferOwnershipCallTrace extends TypedTrace {
|
|
436
|
+
args: [newOwner: PromiseOrValue<string>];
|
|
437
|
+
}
|
|
438
|
+
|
|
353
439
|
export class ERC20Processor extends BaseProcessor<
|
|
354
440
|
ERC20,
|
|
355
441
|
ERC20BoundContractView
|
|
@@ -395,6 +481,102 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
395
481
|
return super.onEvent(handler, filter);
|
|
396
482
|
}
|
|
397
483
|
|
|
484
|
+
onAllowanceCall(
|
|
485
|
+
handler: (trace: AllowanceCallTrace, ctx: ERC20Context) => void
|
|
486
|
+
) {
|
|
487
|
+
return super.onTrace("allowance(address,address)", handler);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
onApproveCall(handler: (trace: ApproveCallTrace, ctx: ERC20Context) => void) {
|
|
491
|
+
return super.onTrace("approve(address,uint256)", handler);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
onBalanceOfCall(
|
|
495
|
+
handler: (trace: BalanceOfCallTrace, ctx: ERC20Context) => void
|
|
496
|
+
) {
|
|
497
|
+
return super.onTrace("balanceOf(address)", handler);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
onBurnCall(handler: (trace: BurnCallTrace, ctx: ERC20Context) => void) {
|
|
501
|
+
return super.onTrace("burn(uint256)", handler);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
onBurnFromCall(
|
|
505
|
+
handler: (trace: BurnFromCallTrace, ctx: ERC20Context) => void
|
|
506
|
+
) {
|
|
507
|
+
return super.onTrace("burnFrom(address,uint256)", handler);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
onDecimalsCall(
|
|
511
|
+
handler: (trace: DecimalsCallTrace, ctx: ERC20Context) => void
|
|
512
|
+
) {
|
|
513
|
+
return super.onTrace("decimals()", handler);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
onDecreaseAllowanceCall(
|
|
517
|
+
handler: (trace: DecreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
518
|
+
) {
|
|
519
|
+
return super.onTrace("decreaseAllowance(address,uint256)", handler);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
onIncreaseAllowanceCall(
|
|
523
|
+
handler: (trace: IncreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
524
|
+
) {
|
|
525
|
+
return super.onTrace("increaseAllowance(address,uint256)", handler);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
onLockerCall(handler: (trace: LockerCallTrace, ctx: ERC20Context) => void) {
|
|
529
|
+
return super.onTrace("locker()", handler);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
onNameCall(handler: (trace: NameCallTrace, ctx: ERC20Context) => void) {
|
|
533
|
+
return super.onTrace("name()", handler);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
onOwnerCall(handler: (trace: OwnerCallTrace, ctx: ERC20Context) => void) {
|
|
537
|
+
return super.onTrace("owner()", handler);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
onRenounceOwnershipCall(
|
|
541
|
+
handler: (trace: RenounceOwnershipCallTrace, ctx: ERC20Context) => void
|
|
542
|
+
) {
|
|
543
|
+
return super.onTrace("renounceOwnership()", handler);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
onSetLockerCall(
|
|
547
|
+
handler: (trace: SetLockerCallTrace, ctx: ERC20Context) => void
|
|
548
|
+
) {
|
|
549
|
+
return super.onTrace("setLocker(address)", handler);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
onSymbolCall(handler: (trace: SymbolCallTrace, ctx: ERC20Context) => void) {
|
|
553
|
+
return super.onTrace("symbol()", handler);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
onTotalSupplyCall(
|
|
557
|
+
handler: (trace: TotalSupplyCallTrace, ctx: ERC20Context) => void
|
|
558
|
+
) {
|
|
559
|
+
return super.onTrace("totalSupply()", handler);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
onTransferCall(
|
|
563
|
+
handler: (trace: TransferCallTrace, ctx: ERC20Context) => void
|
|
564
|
+
) {
|
|
565
|
+
return super.onTrace("transfer(address,uint256)", handler);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
onTransferFromCall(
|
|
569
|
+
handler: (trace: TransferFromCallTrace, ctx: ERC20Context) => void
|
|
570
|
+
) {
|
|
571
|
+
return super.onTrace("transferFrom(address,address,uint256)", handler);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
onTransferOwnershipCall(
|
|
575
|
+
handler: (trace: TransferOwnershipCallTrace, ctx: ERC20Context) => void
|
|
576
|
+
) {
|
|
577
|
+
return super.onTrace("transferOwnership(address)", handler);
|
|
578
|
+
}
|
|
579
|
+
|
|
398
580
|
public static filters = templateContract.filters;
|
|
399
581
|
|
|
400
582
|
protected CreateBoundContractView(): ERC20BoundContractView {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
import { CallOverrides } from "ethers";
|
|
4
|
+
import { BigNumberish, CallOverrides } from "ethers";
|
|
5
5
|
import { Networkish } from "@ethersproject/providers";
|
|
6
6
|
import {
|
|
7
7
|
addContractByABI,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
getContractName,
|
|
21
|
+
TypedTrace,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC20Bytes, ERC20Bytes__factory } from "./index";
|
|
@@ -280,6 +281,46 @@ export class ERC20BytesProcessorTemplate extends BaseProcessorTemplate<
|
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
|
|
284
|
+
export interface NameCallTrace extends TypedTrace {
|
|
285
|
+
args: [];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ApproveCallTrace extends TypedTrace {
|
|
289
|
+
args: [spender: PromiseOrValue<string>, value: PromiseOrValue<BigNumberish>];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface TotalSupplyCallTrace extends TypedTrace {
|
|
293
|
+
args: [];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface TransferFromCallTrace extends TypedTrace {
|
|
297
|
+
args: [
|
|
298
|
+
from: PromiseOrValue<string>,
|
|
299
|
+
to: PromiseOrValue<string>,
|
|
300
|
+
value: PromiseOrValue<BigNumberish>
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface DecimalsCallTrace extends TypedTrace {
|
|
305
|
+
args: [];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface BalanceOfCallTrace extends TypedTrace {
|
|
309
|
+
args: [who: PromiseOrValue<string>];
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface SymbolCallTrace extends TypedTrace {
|
|
313
|
+
args: [];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface TransferCallTrace extends TypedTrace {
|
|
317
|
+
args: [to: PromiseOrValue<string>, value: PromiseOrValue<BigNumberish>];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface AllowanceCallTrace extends TypedTrace {
|
|
321
|
+
args: [owner: PromiseOrValue<string>, spender: PromiseOrValue<string>];
|
|
322
|
+
}
|
|
323
|
+
|
|
283
324
|
export class ERC20BytesProcessor extends BaseProcessor<
|
|
284
325
|
ERC20Bytes,
|
|
285
326
|
ERC20BytesBoundContractView
|
|
@@ -312,6 +353,58 @@ export class ERC20BytesProcessor extends BaseProcessor<
|
|
|
312
353
|
return super.onEvent(handler, filter);
|
|
313
354
|
}
|
|
314
355
|
|
|
356
|
+
onNameCall(handler: (trace: NameCallTrace, ctx: ERC20BytesContext) => void) {
|
|
357
|
+
return super.onTrace("name()", handler);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
onApproveCall(
|
|
361
|
+
handler: (trace: ApproveCallTrace, ctx: ERC20BytesContext) => void
|
|
362
|
+
) {
|
|
363
|
+
return super.onTrace("approve(address,uint256)", handler);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
onTotalSupplyCall(
|
|
367
|
+
handler: (trace: TotalSupplyCallTrace, ctx: ERC20BytesContext) => void
|
|
368
|
+
) {
|
|
369
|
+
return super.onTrace("totalSupply()", handler);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
onTransferFromCall(
|
|
373
|
+
handler: (trace: TransferFromCallTrace, ctx: ERC20BytesContext) => void
|
|
374
|
+
) {
|
|
375
|
+
return super.onTrace("transferFrom(address,address,uint256)", handler);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
onDecimalsCall(
|
|
379
|
+
handler: (trace: DecimalsCallTrace, ctx: ERC20BytesContext) => void
|
|
380
|
+
) {
|
|
381
|
+
return super.onTrace("decimals()", handler);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
onBalanceOfCall(
|
|
385
|
+
handler: (trace: BalanceOfCallTrace, ctx: ERC20BytesContext) => void
|
|
386
|
+
) {
|
|
387
|
+
return super.onTrace("balanceOf(address)", handler);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
onSymbolCall(
|
|
391
|
+
handler: (trace: SymbolCallTrace, ctx: ERC20BytesContext) => void
|
|
392
|
+
) {
|
|
393
|
+
return super.onTrace("symbol()", handler);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
onTransferCall(
|
|
397
|
+
handler: (trace: TransferCallTrace, ctx: ERC20BytesContext) => void
|
|
398
|
+
) {
|
|
399
|
+
return super.onTrace("transfer(address,uint256)", handler);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
onAllowanceCall(
|
|
403
|
+
handler: (trace: AllowanceCallTrace, ctx: ERC20BytesContext) => void
|
|
404
|
+
) {
|
|
405
|
+
return super.onTrace("allowance(address,address)", handler);
|
|
406
|
+
}
|
|
407
|
+
|
|
315
408
|
public static filters = templateContract.filters;
|
|
316
409
|
|
|
317
410
|
protected CreateBoundContractView(): ERC20BytesBoundContractView {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
import { CallOverrides } from "ethers";
|
|
4
|
+
import { BigNumberish, CallOverrides } from "ethers";
|
|
5
5
|
import { Networkish } from "@ethersproject/providers";
|
|
6
6
|
import {
|
|
7
7
|
addContractByABI,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
getContractName,
|
|
21
|
+
TypedTrace,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { WETH9, WETH9__factory } from "./index";
|
|
@@ -304,6 +305,54 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
304
305
|
}
|
|
305
306
|
}
|
|
306
307
|
|
|
308
|
+
export interface NameCallTrace extends TypedTrace {
|
|
309
|
+
args: [];
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface ApproveCallTrace extends TypedTrace {
|
|
313
|
+
args: [guy: PromiseOrValue<string>, wad: PromiseOrValue<BigNumberish>];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface TotalSupplyCallTrace extends TypedTrace {
|
|
317
|
+
args: [];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface TransferFromCallTrace extends TypedTrace {
|
|
321
|
+
args: [
|
|
322
|
+
src: PromiseOrValue<string>,
|
|
323
|
+
dst: PromiseOrValue<string>,
|
|
324
|
+
wad: PromiseOrValue<BigNumberish>
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface WithdrawCallTrace extends TypedTrace {
|
|
329
|
+
args: [wad: PromiseOrValue<BigNumberish>];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface DecimalsCallTrace extends TypedTrace {
|
|
333
|
+
args: [];
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface BalanceOfCallTrace extends TypedTrace {
|
|
337
|
+
args: [arg0: PromiseOrValue<string>];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface SymbolCallTrace extends TypedTrace {
|
|
341
|
+
args: [];
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface TransferCallTrace extends TypedTrace {
|
|
345
|
+
args: [dst: PromiseOrValue<string>, wad: PromiseOrValue<BigNumberish>];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface DepositCallTrace extends TypedTrace {
|
|
349
|
+
args: [];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface AllowanceCallTrace extends TypedTrace {
|
|
353
|
+
args: [arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>];
|
|
354
|
+
}
|
|
355
|
+
|
|
307
356
|
export class WETH9Processor extends BaseProcessor<
|
|
308
357
|
WETH9,
|
|
309
358
|
WETH9BoundContractView
|
|
@@ -359,6 +408,64 @@ export class WETH9Processor extends BaseProcessor<
|
|
|
359
408
|
return super.onEvent(handler, filter);
|
|
360
409
|
}
|
|
361
410
|
|
|
411
|
+
onNameCall(handler: (trace: NameCallTrace, ctx: WETH9Context) => void) {
|
|
412
|
+
return super.onTrace("name()", handler);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
onApproveCall(handler: (trace: ApproveCallTrace, ctx: WETH9Context) => void) {
|
|
416
|
+
return super.onTrace("approve(address,uint256)", handler);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
onTotalSupplyCall(
|
|
420
|
+
handler: (trace: TotalSupplyCallTrace, ctx: WETH9Context) => void
|
|
421
|
+
) {
|
|
422
|
+
return super.onTrace("totalSupply()", handler);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
onTransferFromCall(
|
|
426
|
+
handler: (trace: TransferFromCallTrace, ctx: WETH9Context) => void
|
|
427
|
+
) {
|
|
428
|
+
return super.onTrace("transferFrom(address,address,uint256)", handler);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
onWithdrawCall(
|
|
432
|
+
handler: (trace: WithdrawCallTrace, ctx: WETH9Context) => void
|
|
433
|
+
) {
|
|
434
|
+
return super.onTrace("withdraw(uint256)", handler);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
onDecimalsCall(
|
|
438
|
+
handler: (trace: DecimalsCallTrace, ctx: WETH9Context) => void
|
|
439
|
+
) {
|
|
440
|
+
return super.onTrace("decimals()", handler);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
onBalanceOfCall(
|
|
444
|
+
handler: (trace: BalanceOfCallTrace, ctx: WETH9Context) => void
|
|
445
|
+
) {
|
|
446
|
+
return super.onTrace("balanceOf(address)", handler);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
onSymbolCall(handler: (trace: SymbolCallTrace, ctx: WETH9Context) => void) {
|
|
450
|
+
return super.onTrace("symbol()", handler);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
onTransferCall(
|
|
454
|
+
handler: (trace: TransferCallTrace, ctx: WETH9Context) => void
|
|
455
|
+
) {
|
|
456
|
+
return super.onTrace("transfer(address,uint256)", handler);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
onDepositCall(handler: (trace: DepositCallTrace, ctx: WETH9Context) => void) {
|
|
460
|
+
return super.onTrace("deposit()", handler);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
onAllowanceCall(
|
|
464
|
+
handler: (trace: AllowanceCallTrace, ctx: WETH9Context) => void
|
|
465
|
+
) {
|
|
466
|
+
return super.onTrace("allowance(address,address)", handler);
|
|
467
|
+
}
|
|
468
|
+
|
|
362
469
|
public static filters = templateContract.filters;
|
|
363
470
|
|
|
364
471
|
protected CreateBoundContractView(): WETH9BoundContractView {
|
package/src/context.ts
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
import { CounterResult, GaugeResult } from './gen/processor/protos/processor'
|
|
1
|
+
import { CounterResult, GaugeResult, LogResult } from './gen/processor/protos/processor'
|
|
2
2
|
import { BaseContract, EventFilter } from 'ethers'
|
|
3
3
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
4
4
|
import { Meter } from './meter'
|
|
5
5
|
import Long from 'long'
|
|
6
|
+
import { Trace } from './trace'
|
|
6
7
|
|
|
7
|
-
export class
|
|
8
|
+
export class BaseContext {
|
|
9
|
+
gauges: GaugeResult[] = []
|
|
10
|
+
counters: CounterResult[] = []
|
|
11
|
+
logs: LogResult[] = []
|
|
12
|
+
meter: Meter
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this.meter = new Meter(this)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class EthContext extends BaseContext {
|
|
8
20
|
chainId: number
|
|
9
21
|
log?: Log
|
|
10
22
|
block?: Block
|
|
23
|
+
trace?: Trace
|
|
11
24
|
blockNumber: Long
|
|
12
|
-
gauges: GaugeResult[] = []
|
|
13
|
-
counters: CounterResult[] = []
|
|
14
|
-
meter: Meter
|
|
15
25
|
|
|
16
|
-
constructor(chainId: number, block?: Block, log?: Log) {
|
|
26
|
+
constructor(chainId: number, block?: Block, log?: Log, trace?: Trace) {
|
|
27
|
+
super()
|
|
17
28
|
this.chainId = chainId
|
|
18
29
|
this.log = log
|
|
19
30
|
this.block = block
|
|
@@ -22,7 +33,6 @@ export class EthContext {
|
|
|
22
33
|
} else if (block) {
|
|
23
34
|
this.blockNumber = Long.fromNumber(block.number)
|
|
24
35
|
}
|
|
25
|
-
this.meter = new Meter(this)
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
|
|
@@ -31,11 +41,13 @@ export class Context<
|
|
|
31
41
|
TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>
|
|
32
42
|
> extends EthContext {
|
|
33
43
|
contract: TContractBoundView
|
|
44
|
+
address: string
|
|
34
45
|
|
|
35
|
-
constructor(view: TContractBoundView, chainId: number, block?: Block, log?: Log) {
|
|
36
|
-
super(chainId, block, log)
|
|
46
|
+
constructor(view: TContractBoundView, chainId: number, block?: Block, log?: Log, trace?: Trace) {
|
|
47
|
+
super(chainId, block, log, trace)
|
|
37
48
|
view.context = this
|
|
38
49
|
this.contract = view
|
|
50
|
+
this.address = view.rawContract.address
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
53
|
|
|
@@ -79,14 +91,11 @@ export class BoundContractView<TContract extends BaseContract, TContractView ext
|
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
|
|
82
|
-
export class SolanaContext {
|
|
83
|
-
gauges: GaugeResult[] = []
|
|
84
|
-
counters: CounterResult[] = []
|
|
85
|
-
meter: Meter
|
|
86
|
-
|
|
94
|
+
export class SolanaContext extends BaseContext {
|
|
87
95
|
address: string
|
|
88
96
|
|
|
89
97
|
constructor(address: string) {
|
|
98
|
+
super()
|
|
90
99
|
this.meter = new Meter(this)
|
|
91
100
|
this.address = address
|
|
92
101
|
}
|