@sentio/sdk 1.8.1 → 1.8.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/lib/base-processor.d.ts +7 -0
- package/lib/base-processor.js +28 -1
- package/lib/base-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/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/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/context.ts +23 -14
- package/src/gen/processor/protos/processor.ts +104 -13
- package/src/meter.ts +19 -8
- package/src/service.ts +43 -2
- package/src/trace.ts +64 -0
package/lib/base-processor.d.ts
CHANGED
|
@@ -5,13 +5,19 @@ import { BoundContractView, Context, ContractView } from './context';
|
|
|
5
5
|
import { ProcessResult } from './gen/processor/protos/processor';
|
|
6
6
|
import { BindInternalOptions, BindOptions } from './bind-options';
|
|
7
7
|
import { PromiseOrVoid } from './promise-or-void';
|
|
8
|
+
import { Trace } from './trace';
|
|
8
9
|
export declare class EventsHandler {
|
|
9
10
|
filters: EventFilter[];
|
|
10
11
|
handler: (event: Log) => Promise<ProcessResult>;
|
|
11
12
|
}
|
|
13
|
+
export declare class TraceHandler {
|
|
14
|
+
signature: string;
|
|
15
|
+
handler: (trace: Trace) => Promise<ProcessResult>;
|
|
16
|
+
}
|
|
12
17
|
export declare abstract class BaseProcessor<TContract extends BaseContract, TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>> {
|
|
13
18
|
blockHandlers: ((block: Block) => Promise<ProcessResult>)[];
|
|
14
19
|
eventHandlers: EventsHandler[];
|
|
20
|
+
traceHandlers: TraceHandler[];
|
|
15
21
|
name: string;
|
|
16
22
|
config: BindInternalOptions;
|
|
17
23
|
constructor(config: BindOptions);
|
|
@@ -20,4 +26,5 @@ export declare abstract class BaseProcessor<TContract extends BaseContract, TBou
|
|
|
20
26
|
onEvent(handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid, filter: EventFilter | EventFilter[]): this;
|
|
21
27
|
onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
22
28
|
onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
29
|
+
onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
23
30
|
}
|
package/lib/base-processor.js
CHANGED
|
@@ -3,18 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BaseProcessor = exports.EventsHandler = void 0;
|
|
6
|
+
exports.BaseProcessor = exports.TraceHandler = exports.EventsHandler = void 0;
|
|
7
7
|
const providers_1 = require("@ethersproject/providers");
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const context_1 = require("./context");
|
|
10
|
+
const ethers_1 = require("ethers");
|
|
10
11
|
class EventsHandler {
|
|
11
12
|
filters;
|
|
12
13
|
handler;
|
|
13
14
|
}
|
|
14
15
|
exports.EventsHandler = EventsHandler;
|
|
16
|
+
class TraceHandler {
|
|
17
|
+
signature;
|
|
18
|
+
handler;
|
|
19
|
+
}
|
|
20
|
+
exports.TraceHandler = TraceHandler;
|
|
15
21
|
class BaseProcessor {
|
|
16
22
|
blockHandlers = [];
|
|
17
23
|
eventHandlers = [];
|
|
24
|
+
traceHandlers = [];
|
|
18
25
|
name;
|
|
19
26
|
config;
|
|
20
27
|
constructor(config) {
|
|
@@ -109,6 +116,26 @@ class BaseProcessor {
|
|
|
109
116
|
return handler(log, ctx);
|
|
110
117
|
}, _filters);
|
|
111
118
|
}
|
|
119
|
+
onTrace(signature, handler) {
|
|
120
|
+
const chainId = this.getChainId();
|
|
121
|
+
const contractView = this.CreateBoundContractView();
|
|
122
|
+
this.traceHandlers.push({
|
|
123
|
+
signature,
|
|
124
|
+
handler: async function (trace) {
|
|
125
|
+
const contractInterface = contractView.rawContract.interface;
|
|
126
|
+
const fragment = contractInterface.getFunction(signature);
|
|
127
|
+
trace.args = contractInterface._abiCoder.decode(fragment.inputs, ethers_1.utils.hexDataSlice(trace.action.input, 4));
|
|
128
|
+
const ctx = new context_1.Context(contractView, chainId, undefined, undefined, trace);
|
|
129
|
+
await handler(trace, ctx);
|
|
130
|
+
return {
|
|
131
|
+
gauges: ctx.gauges,
|
|
132
|
+
counters: ctx.counters,
|
|
133
|
+
logs: [],
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
112
139
|
}
|
|
113
140
|
exports.BaseProcessor = BaseProcessor;
|
|
114
141
|
//# sourceMappingURL=base-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../src/base-processor.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAiE;AAEjE,gDAAuB;AAEvB,uCAAoE;AAKpE,MAAa,aAAa;IACxB,OAAO,CAAe;IACtB,OAAO,CAAwC;CAChD;AAHD,sCAGC;AAED,MAAsB,aAAa;IAIjC,aAAa,GAAiD,EAAE,CAAA;IAChE,aAAa,GAAoB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../src/base-processor.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAiE;AAEjE,gDAAuB;AAEvB,uCAAoE;AAKpE,mCAA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AAC;IAEM,OAAO,CACZ,SAAiB,EACjB,OAAqF;QAErF,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;QACjC,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAA;QAEnD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACtB,SAAS;YACT,OAAO,EAAE,KAAK,WAAW,KAAY;gBACnC,MAAM,iBAAiB,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,CAAA;gBAC5D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzD,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;gBAE3G,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAgC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;gBAC1G,MAAM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBACzB,OAAO;oBACL,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,IAAI,EAAE,EAAE;iBACT,CAAA;YACH,CAAC;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA7ID,sCA6IC","sourcesContent":["import { Event } from '@ethersproject/contracts'\nimport { BytesLike } from '@ethersproject/bytes'\nimport { Block, Log, getNetwork } from '@ethersproject/providers'\nimport { BaseContract, EventFilter } from '@ethersproject/contracts'\nimport Long from 'long'\n\nimport { BoundContractView, Context, ContractView } from './context'\nimport { ProcessResult } from './gen/processor/protos/processor'\nimport { BindInternalOptions, BindOptions } from './bind-options'\nimport { PromiseOrVoid } from './promise-or-void'\nimport { Trace } from './trace'\nimport { utils } from 'ethers'\n\nexport class EventsHandler {\n filters: EventFilter[]\n handler: (event: Log) => Promise<ProcessResult>\n}\n\nexport class TraceHandler {\n signature: string\n handler: (trace: Trace) => Promise<ProcessResult>\n}\n\nexport abstract class BaseProcessor<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []\n eventHandlers: EventsHandler[] = []\n traceHandlers: TraceHandler[] = []\n\n name: string\n config: BindInternalOptions\n\n constructor(config: BindOptions) {\n this.config = {\n address: config.address,\n name: config.name || '',\n network: config.network ? config.network : 1,\n startBlock: new Long(0),\n }\n if (config.startBlock) {\n if (typeof config.startBlock === 'number') {\n this.config.startBlock = Long.fromNumber(config.startBlock)\n } else {\n this.config.startBlock = config.startBlock\n }\n }\n if (config.endBlock) {\n if (typeof config.endBlock === 'number') {\n this.config.endBlock = Long.fromNumber(config.endBlock)\n } else {\n this.config.endBlock = config.endBlock\n }\n }\n }\n\n protected abstract CreateBoundContractView(): TBoundContractView\n\n public getChainId(): number {\n return getNetwork(this.config.network).chainId\n }\n\n public onEvent(\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: EventFilter | EventFilter[]\n ) {\n const chainId = this.getChainId()\n\n let _filters: EventFilter[] = []\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n const contractView = this.CreateBoundContractView()\n this.eventHandlers.push({\n filters: _filters,\n handler: async function (log) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, log)\n // let event: Event = <Event>deepCopy(log);\n const event: Event = <Event>log\n const parsed = contractView.rawContract.interface.parseLog(log)\n if (parsed) {\n event.args = parsed.args\n event.decode = (data: BytesLike, topics?: Array<any>) => {\n return contractView.rawContract.interface.decodeEventLog(parsed.eventFragment, data, topics)\n }\n event.event = parsed.name\n event.eventSignature = parsed.signature\n\n // TODO fix this bug\n await handler(event, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n }\n return {\n gauges: [],\n counters: [],\n logs: [],\n }\n },\n })\n return this\n }\n\n public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.blockHandlers.push(async function (block: Block) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, block, undefined)\n await handler(block, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n })\n return this\n }\n\n public onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const _filters: EventFilter[] = []\n const tmpContract = this.CreateBoundContractView()\n\n for (const key in tmpContract.filters) {\n _filters.push(tmpContract.filters[key]())\n }\n return this.onEvent(function (log, ctx) {\n return handler(log, ctx)\n }, _filters)\n }\n\n public onTrace(\n signature: string,\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.traceHandlers.push({\n signature,\n handler: async function (trace: Trace) {\n const contractInterface = contractView.rawContract.interface\n const fragment = contractInterface.getFunction(signature)\n trace.args = contractInterface._abiCoder.decode(fragment.inputs, utils.hexDataSlice(trace.action.input, 4))\n\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, undefined, trace)\n await handler(trace, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n },\n })\n return this\n }\n}\n"]}
|
package/lib/context.d.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
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
|
-
|
|
6
|
+
import { Trace } from './trace';
|
|
7
|
+
export declare class BaseContext {
|
|
8
|
+
gauges: GaugeResult[];
|
|
9
|
+
counters: CounterResult[];
|
|
10
|
+
logs: LogResult[];
|
|
11
|
+
meter: Meter;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
export declare class EthContext extends BaseContext {
|
|
7
15
|
chainId: number;
|
|
8
16
|
log?: Log;
|
|
9
17
|
block?: Block;
|
|
18
|
+
trace?: Trace;
|
|
10
19
|
blockNumber: Long;
|
|
11
|
-
|
|
12
|
-
counters: CounterResult[];
|
|
13
|
-
meter: Meter;
|
|
14
|
-
constructor(chainId: number, block?: Block, log?: Log);
|
|
20
|
+
constructor(chainId: number, block?: Block, log?: Log, trace?: Trace);
|
|
15
21
|
}
|
|
16
22
|
export declare class Context<TContract extends BaseContract, TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>> extends EthContext {
|
|
17
23
|
contract: TContractBoundView;
|
|
18
|
-
|
|
24
|
+
address: string;
|
|
25
|
+
constructor(view: TContractBoundView, chainId: number, block?: Block, log?: Log, trace?: Trace);
|
|
19
26
|
}
|
|
20
27
|
export declare class ContractView<TContract extends BaseContract> {
|
|
21
28
|
filters: {
|
|
@@ -36,10 +43,7 @@ export declare class BoundContractView<TContract extends BaseContract, TContract
|
|
|
36
43
|
[name: string]: (...args: any[]) => EventFilter;
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
|
-
export declare class SolanaContext {
|
|
40
|
-
gauges: GaugeResult[];
|
|
41
|
-
counters: CounterResult[];
|
|
42
|
-
meter: Meter;
|
|
46
|
+
export declare class SolanaContext extends BaseContext {
|
|
43
47
|
address: string;
|
|
44
48
|
constructor(address: string);
|
|
45
49
|
}
|
package/lib/context.js
CHANGED
|
@@ -3,18 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SolanaContext = exports.BoundContractView = exports.ContractView = exports.Context = exports.EthContext = void 0;
|
|
6
|
+
exports.SolanaContext = exports.BoundContractView = exports.ContractView = exports.Context = exports.EthContext = exports.BaseContext = void 0;
|
|
7
7
|
const meter_1 = require("./meter");
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
|
-
class
|
|
9
|
+
class BaseContext {
|
|
10
|
+
gauges = [];
|
|
11
|
+
counters = [];
|
|
12
|
+
logs = [];
|
|
13
|
+
meter;
|
|
14
|
+
constructor() {
|
|
15
|
+
this.meter = new meter_1.Meter(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.BaseContext = BaseContext;
|
|
19
|
+
class EthContext extends BaseContext {
|
|
10
20
|
chainId;
|
|
11
21
|
log;
|
|
12
22
|
block;
|
|
23
|
+
trace;
|
|
13
24
|
blockNumber;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
meter;
|
|
17
|
-
constructor(chainId, block, log) {
|
|
25
|
+
constructor(chainId, block, log, trace) {
|
|
26
|
+
super();
|
|
18
27
|
this.chainId = chainId;
|
|
19
28
|
this.log = log;
|
|
20
29
|
this.block = block;
|
|
@@ -24,16 +33,17 @@ class EthContext {
|
|
|
24
33
|
else if (block) {
|
|
25
34
|
this.blockNumber = long_1.default.fromNumber(block.number);
|
|
26
35
|
}
|
|
27
|
-
this.meter = new meter_1.Meter(this);
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
exports.EthContext = EthContext;
|
|
31
39
|
class Context extends EthContext {
|
|
32
40
|
contract;
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
address;
|
|
42
|
+
constructor(view, chainId, block, log, trace) {
|
|
43
|
+
super(chainId, block, log, trace);
|
|
35
44
|
view.context = this;
|
|
36
45
|
this.contract = view;
|
|
46
|
+
this.address = view.rawContract.address;
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
exports.Context = Context;
|
|
@@ -70,12 +80,10 @@ class BoundContractView {
|
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
exports.BoundContractView = BoundContractView;
|
|
73
|
-
class SolanaContext {
|
|
74
|
-
gauges = [];
|
|
75
|
-
counters = [];
|
|
76
|
-
meter;
|
|
83
|
+
class SolanaContext extends BaseContext {
|
|
77
84
|
address;
|
|
78
85
|
constructor(address) {
|
|
86
|
+
super();
|
|
79
87
|
this.meter = new meter_1.Meter(this);
|
|
80
88
|
this.address = address;
|
|
81
89
|
}
|
package/lib/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAGA,mCAA+B;AAC/B,gDAAuB;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAGA,mCAA+B;AAC/B,gDAAuB;AAGvB,MAAa,WAAW;IACtB,MAAM,GAAkB,EAAE,CAAA;IAC1B,QAAQ,GAAoB,EAAE,CAAA;IAC9B,IAAI,GAAgB,EAAE,CAAA;IACtB,KAAK,CAAO;IAEZ;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AATD,kCASC;AAED,MAAa,UAAW,SAAQ,WAAW;IACzC,OAAO,CAAQ;IACf,GAAG,CAAM;IACT,KAAK,CAAQ;IACb,KAAK,CAAQ;IACb,WAAW,CAAM;IAEjB,YAAY,OAAe,EAAE,KAAa,EAAE,GAAS,EAAE,KAAa;QAClE,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,U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IAC3B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;IAC1B,CAAC;CACF;AApBD,8CAoBC;AAED,MAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,CAAQ;IAEf,YAAY,OAAe;QACzB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AARD,sCAQC","sourcesContent":["import { CounterResult, GaugeResult, LogResult } from './gen/processor/protos/processor'\nimport { BaseContract, EventFilter } from 'ethers'\nimport { Block, Log } from '@ethersproject/abstract-provider'\nimport { Meter } from './meter'\nimport Long from 'long'\nimport { Trace } from './trace'\n\nexport class BaseContext {\n gauges: GaugeResult[] = []\n counters: CounterResult[] = []\n logs: LogResult[] = []\n meter: Meter\n\n constructor() {\n this.meter = new Meter(this)\n }\n}\n\nexport class EthContext extends BaseContext {\n chainId: number\n log?: Log\n block?: Block\n trace?: Trace\n blockNumber: Long\n\n constructor(chainId: number, block?: Block, log?: Log, trace?: Trace) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n if (log) {\n this.blockNumber = Long.fromNumber(log.blockNumber)\n } else if (block) {\n this.blockNumber = Long.fromNumber(block.number)\n }\n }\n}\n\nexport class Context<\n TContract extends BaseContract,\n TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>\n> extends EthContext {\n contract: TContractBoundView\n address: string\n\n constructor(view: TContractBoundView, chainId: number, block?: Block, log?: Log, trace?: Trace) {\n super(chainId, block, log, trace)\n view.context = this\n this.contract = view\n this.address = view.rawContract.address\n }\n}\n\nexport class ContractView<TContract extends BaseContract> {\n filters: { [name: string]: (...args: Array<any>) => EventFilter }\n protected contract: TContract\n\n constructor(contract: TContract) {\n this.contract = contract\n this.filters = contract.filters\n }\n\n get rawContract() {\n return this.contract\n }\n\n get provider() {\n return this.contract.provider\n }\n}\n\nexport class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {\n protected view: TContractView\n // context will be set right after context creation (in context's constructor)\n context: Context<TContract, BoundContractView<TContract, TContractView>>\n\n constructor(view: TContractView) {\n this.view = view\n }\n\n get rawContract() {\n return this.view.rawContract\n }\n\n get provider() {\n return this.view.provider\n }\n\n get filters() {\n return this.view.filters\n }\n}\n\nexport class SolanaContext extends BaseContext {\n address: string\n\n constructor(address: string) {\n super()\n this.meter = new Meter(this)\n this.address = address\n }\n}\n"]}
|
|
@@ -37,6 +37,7 @@ export interface ContractConfig {
|
|
|
37
37
|
contract: ContractInfo | undefined;
|
|
38
38
|
blockConfigs: BlockHandlerConfig[];
|
|
39
39
|
logConfigs: LogHandlerConfig[];
|
|
40
|
+
traceConfigs: TraceHandlerConfig[];
|
|
40
41
|
startBlock: Long;
|
|
41
42
|
endBlock: Long;
|
|
42
43
|
instructionConfig: InstructionHandlerConfig | undefined;
|
|
@@ -60,6 +61,10 @@ export interface StartRequest {
|
|
|
60
61
|
export interface BlockHandlerConfig {
|
|
61
62
|
handlerId: number;
|
|
62
63
|
}
|
|
64
|
+
export interface TraceHandlerConfig {
|
|
65
|
+
signature: string;
|
|
66
|
+
handlerId: number;
|
|
67
|
+
}
|
|
63
68
|
export interface LogHandlerConfig {
|
|
64
69
|
filters: LogFilter[];
|
|
65
70
|
handlerId: number;
|
|
@@ -83,7 +88,7 @@ export interface ProcessLogsResponse {
|
|
|
83
88
|
configUpdated: boolean;
|
|
84
89
|
}
|
|
85
90
|
export interface ProcessTracesRequest {
|
|
86
|
-
|
|
91
|
+
traceBindings: TraceBinding[];
|
|
87
92
|
}
|
|
88
93
|
export interface ProcessTracesResponse {
|
|
89
94
|
result: ProcessResult | undefined;
|
|
@@ -243,6 +248,13 @@ export declare const BlockHandlerConfig: {
|
|
|
243
248
|
toJSON(message: BlockHandlerConfig): unknown;
|
|
244
249
|
fromPartial(object: DeepPartial<BlockHandlerConfig>): BlockHandlerConfig;
|
|
245
250
|
};
|
|
251
|
+
export declare const TraceHandlerConfig: {
|
|
252
|
+
encode(message: TraceHandlerConfig, writer?: _m0.Writer): _m0.Writer;
|
|
253
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TraceHandlerConfig;
|
|
254
|
+
fromJSON(object: any): TraceHandlerConfig;
|
|
255
|
+
toJSON(message: TraceHandlerConfig): unknown;
|
|
256
|
+
fromPartial(object: DeepPartial<TraceHandlerConfig>): TraceHandlerConfig;
|
|
257
|
+
};
|
|
246
258
|
export declare const LogHandlerConfig: {
|
|
247
259
|
encode(message: LogHandlerConfig, writer?: _m0.Writer): _m0.Writer;
|
|
248
260
|
decode(input: _m0.Reader | Uint8Array, length?: number): LogHandlerConfig;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProcessorDefinition = exports.LogResult = exports.CounterResult = exports.GaugeResult = exports.RuntimeInfo = exports.BigInteger = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.ProcessResult = exports.RawBlock = exports.BlockBinding = exports.Instruction = exports.RawTransaction = exports.RawTrace = exports.TraceBinding = exports.RawLog = exports.LogBinding = exports.ProcessBlocksResponse = exports.ProcessBlocksRequest = exports.ProcessInstructionsResponse = exports.ProcessTransactionsResponse = exports.ProcessInstructionsRequest = exports.ProcessTransactionsRequest = exports.ProcessTracesResponse = exports.ProcessTracesRequest = exports.ProcessLogsResponse = exports.ProcessLogsRequest = exports.Topic = exports.InstructionHandlerConfig = exports.LogFilter = exports.LogHandlerConfig = exports.BlockHandlerConfig = exports.StartRequest = exports.TemplateInstance = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = exports.logLevelToJSON = exports.logLevelFromJSON = exports.LogLevel = exports.handlerTypeToJSON = exports.handlerTypeFromJSON = exports.HandlerType = void 0;
|
|
6
|
+
exports.ProcessorDefinition = exports.LogResult = exports.CounterResult = exports.GaugeResult = exports.RuntimeInfo = exports.BigInteger = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.ProcessResult = exports.RawBlock = exports.BlockBinding = exports.Instruction = exports.RawTransaction = exports.RawTrace = exports.TraceBinding = exports.RawLog = exports.LogBinding = exports.ProcessBlocksResponse = exports.ProcessBlocksRequest = exports.ProcessInstructionsResponse = exports.ProcessTransactionsResponse = exports.ProcessInstructionsRequest = exports.ProcessTransactionsRequest = exports.ProcessTracesResponse = exports.ProcessTracesRequest = exports.ProcessLogsResponse = exports.ProcessLogsRequest = exports.Topic = exports.InstructionHandlerConfig = exports.LogFilter = exports.LogHandlerConfig = exports.TraceHandlerConfig = exports.BlockHandlerConfig = exports.StartRequest = exports.TemplateInstance = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = exports.logLevelToJSON = exports.logLevelFromJSON = exports.LogLevel = exports.handlerTypeToJSON = exports.handlerTypeFromJSON = exports.HandlerType = void 0;
|
|
7
7
|
const long_1 = __importDefault(require("long"));
|
|
8
8
|
const empty_1 = require("../../google/protobuf/empty");
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
@@ -285,6 +285,7 @@ function createBaseContractConfig() {
|
|
|
285
285
|
contract: undefined,
|
|
286
286
|
blockConfigs: [],
|
|
287
287
|
logConfigs: [],
|
|
288
|
+
traceConfigs: [],
|
|
288
289
|
startBlock: long_1.default.UZERO,
|
|
289
290
|
endBlock: long_1.default.UZERO,
|
|
290
291
|
instructionConfig: undefined,
|
|
@@ -302,6 +303,9 @@ exports.ContractConfig = {
|
|
|
302
303
|
for (const v of message.logConfigs) {
|
|
303
304
|
exports.LogHandlerConfig.encode(v, writer.uint32(26).fork()).ldelim();
|
|
304
305
|
}
|
|
306
|
+
for (const v of message.traceConfigs) {
|
|
307
|
+
exports.TraceHandlerConfig.encode(v, writer.uint32(18).fork()).ldelim();
|
|
308
|
+
}
|
|
305
309
|
if (!message.startBlock.isZero()) {
|
|
306
310
|
writer.uint32(32).uint64(message.startBlock);
|
|
307
311
|
}
|
|
@@ -332,6 +336,9 @@ exports.ContractConfig = {
|
|
|
332
336
|
case 3:
|
|
333
337
|
message.logConfigs.push(exports.LogHandlerConfig.decode(reader, reader.uint32()));
|
|
334
338
|
break;
|
|
339
|
+
case 2:
|
|
340
|
+
message.traceConfigs.push(exports.TraceHandlerConfig.decode(reader, reader.uint32()));
|
|
341
|
+
break;
|
|
335
342
|
case 4:
|
|
336
343
|
message.startBlock = reader.uint64();
|
|
337
344
|
break;
|
|
@@ -362,6 +369,9 @@ exports.ContractConfig = {
|
|
|
362
369
|
logConfigs: Array.isArray(object?.logConfigs)
|
|
363
370
|
? object.logConfigs.map((e) => exports.LogHandlerConfig.fromJSON(e))
|
|
364
371
|
: [],
|
|
372
|
+
traceConfigs: Array.isArray(object?.traceConfigs)
|
|
373
|
+
? object.traceConfigs.map((e) => exports.TraceHandlerConfig.fromJSON(e))
|
|
374
|
+
: [],
|
|
365
375
|
startBlock: isSet(object.startBlock)
|
|
366
376
|
? long_1.default.fromValue(object.startBlock)
|
|
367
377
|
: long_1.default.UZERO,
|
|
@@ -394,6 +404,12 @@ exports.ContractConfig = {
|
|
|
394
404
|
else {
|
|
395
405
|
obj.logConfigs = [];
|
|
396
406
|
}
|
|
407
|
+
if (message.traceConfigs) {
|
|
408
|
+
obj.traceConfigs = message.traceConfigs.map((e) => e ? exports.TraceHandlerConfig.toJSON(e) : undefined);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
obj.traceConfigs = [];
|
|
412
|
+
}
|
|
397
413
|
message.startBlock !== undefined &&
|
|
398
414
|
(obj.startBlock = (message.startBlock || long_1.default.UZERO).toString());
|
|
399
415
|
message.endBlock !== undefined &&
|
|
@@ -416,6 +432,8 @@ exports.ContractConfig = {
|
|
|
416
432
|
object.blockConfigs?.map((e) => exports.BlockHandlerConfig.fromPartial(e)) || [];
|
|
417
433
|
message.logConfigs =
|
|
418
434
|
object.logConfigs?.map((e) => exports.LogHandlerConfig.fromPartial(e)) || [];
|
|
435
|
+
message.traceConfigs =
|
|
436
|
+
object.traceConfigs?.map((e) => exports.TraceHandlerConfig.fromPartial(e)) || [];
|
|
419
437
|
message.startBlock =
|
|
420
438
|
object.startBlock !== undefined && object.startBlock !== null
|
|
421
439
|
? long_1.default.fromValue(object.startBlock)
|
|
@@ -695,6 +713,59 @@ exports.BlockHandlerConfig = {
|
|
|
695
713
|
return message;
|
|
696
714
|
},
|
|
697
715
|
};
|
|
716
|
+
function createBaseTraceHandlerConfig() {
|
|
717
|
+
return { signature: "", handlerId: 0 };
|
|
718
|
+
}
|
|
719
|
+
exports.TraceHandlerConfig = {
|
|
720
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
721
|
+
if (message.signature !== "") {
|
|
722
|
+
writer.uint32(10).string(message.signature);
|
|
723
|
+
}
|
|
724
|
+
if (message.handlerId !== 0) {
|
|
725
|
+
writer.uint32(16).int32(message.handlerId);
|
|
726
|
+
}
|
|
727
|
+
return writer;
|
|
728
|
+
},
|
|
729
|
+
decode(input, length) {
|
|
730
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
731
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
732
|
+
const message = createBaseTraceHandlerConfig();
|
|
733
|
+
while (reader.pos < end) {
|
|
734
|
+
const tag = reader.uint32();
|
|
735
|
+
switch (tag >>> 3) {
|
|
736
|
+
case 1:
|
|
737
|
+
message.signature = reader.string();
|
|
738
|
+
break;
|
|
739
|
+
case 2:
|
|
740
|
+
message.handlerId = reader.int32();
|
|
741
|
+
break;
|
|
742
|
+
default:
|
|
743
|
+
reader.skipType(tag & 7);
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return message;
|
|
748
|
+
},
|
|
749
|
+
fromJSON(object) {
|
|
750
|
+
return {
|
|
751
|
+
signature: isSet(object.signature) ? String(object.signature) : "",
|
|
752
|
+
handlerId: isSet(object.handlerId) ? Number(object.handlerId) : 0,
|
|
753
|
+
};
|
|
754
|
+
},
|
|
755
|
+
toJSON(message) {
|
|
756
|
+
const obj = {};
|
|
757
|
+
message.signature !== undefined && (obj.signature = message.signature);
|
|
758
|
+
message.handlerId !== undefined &&
|
|
759
|
+
(obj.handlerId = Math.round(message.handlerId));
|
|
760
|
+
return obj;
|
|
761
|
+
},
|
|
762
|
+
fromPartial(object) {
|
|
763
|
+
const message = createBaseTraceHandlerConfig();
|
|
764
|
+
message.signature = object.signature ?? "";
|
|
765
|
+
message.handlerId = object.handlerId ?? 0;
|
|
766
|
+
return message;
|
|
767
|
+
},
|
|
768
|
+
};
|
|
698
769
|
function createBaseLogHandlerConfig() {
|
|
699
770
|
return { filters: [], handlerId: 0 };
|
|
700
771
|
}
|
|
@@ -1045,12 +1116,12 @@ exports.ProcessLogsResponse = {
|
|
|
1045
1116
|
},
|
|
1046
1117
|
};
|
|
1047
1118
|
function createBaseProcessTracesRequest() {
|
|
1048
|
-
return {
|
|
1119
|
+
return { traceBindings: [] };
|
|
1049
1120
|
}
|
|
1050
1121
|
exports.ProcessTracesRequest = {
|
|
1051
1122
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
1052
|
-
for (const v of message.
|
|
1053
|
-
exports.
|
|
1123
|
+
for (const v of message.traceBindings) {
|
|
1124
|
+
exports.TraceBinding.encode(v, writer.uint32(10).fork()).ldelim();
|
|
1054
1125
|
}
|
|
1055
1126
|
return writer;
|
|
1056
1127
|
},
|
|
@@ -1062,7 +1133,7 @@ exports.ProcessTracesRequest = {
|
|
|
1062
1133
|
const tag = reader.uint32();
|
|
1063
1134
|
switch (tag >>> 3) {
|
|
1064
1135
|
case 1:
|
|
1065
|
-
message.
|
|
1136
|
+
message.traceBindings.push(exports.TraceBinding.decode(reader, reader.uint32()));
|
|
1066
1137
|
break;
|
|
1067
1138
|
default:
|
|
1068
1139
|
reader.skipType(tag & 7);
|
|
@@ -1073,25 +1144,25 @@ exports.ProcessTracesRequest = {
|
|
|
1073
1144
|
},
|
|
1074
1145
|
fromJSON(object) {
|
|
1075
1146
|
return {
|
|
1076
|
-
|
|
1077
|
-
? object.
|
|
1147
|
+
traceBindings: Array.isArray(object?.traceBindings)
|
|
1148
|
+
? object.traceBindings.map((e) => exports.TraceBinding.fromJSON(e))
|
|
1078
1149
|
: [],
|
|
1079
1150
|
};
|
|
1080
1151
|
},
|
|
1081
1152
|
toJSON(message) {
|
|
1082
1153
|
const obj = {};
|
|
1083
|
-
if (message.
|
|
1084
|
-
obj.
|
|
1154
|
+
if (message.traceBindings) {
|
|
1155
|
+
obj.traceBindings = message.traceBindings.map((e) => e ? exports.TraceBinding.toJSON(e) : undefined);
|
|
1085
1156
|
}
|
|
1086
1157
|
else {
|
|
1087
|
-
obj.
|
|
1158
|
+
obj.traceBindings = [];
|
|
1088
1159
|
}
|
|
1089
1160
|
return obj;
|
|
1090
1161
|
},
|
|
1091
1162
|
fromPartial(object) {
|
|
1092
1163
|
const message = createBaseProcessTracesRequest();
|
|
1093
|
-
message.
|
|
1094
|
-
object.
|
|
1164
|
+
message.traceBindings =
|
|
1165
|
+
object.traceBindings?.map((e) => exports.TraceBinding.fromPartial(e)) || [];
|
|
1095
1166
|
return message;
|
|
1096
1167
|
},
|
|
1097
1168
|
};
|