@sentio/sdk 2.0.0-rc.13 → 2.0.0-rc.14

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/builtin/internal/eacaggregatorproxy_processor.js +90 -180
  2. package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
  3. package/lib/builtin/internal/erc1155_processor.js +25 -50
  4. package/lib/builtin/internal/erc1155_processor.js.map +1 -1
  5. package/lib/builtin/internal/erc20_processor.js +40 -80
  6. package/lib/builtin/internal/erc20_processor.js.map +1 -1
  7. package/lib/builtin/internal/erc20bytes_processor.js +30 -60
  8. package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
  9. package/lib/builtin/internal/erc721_processor.js +45 -90
  10. package/lib/builtin/internal/erc721_processor.js.map +1 -1
  11. package/lib/builtin/internal/weth9_processor.js +30 -60
  12. package/lib/builtin/internal/weth9_processor.js.map +1 -1
  13. package/lib/error.d.ts +1 -1
  14. package/lib/error.js +10 -12
  15. package/lib/error.js.map +1 -1
  16. package/lib/eth/base-processor-template.d.ts +3 -3
  17. package/lib/eth/base-processor-template.js.map +1 -1
  18. package/lib/eth/base-processor.d.ts +3 -3
  19. package/lib/eth/base-processor.js.map +1 -1
  20. package/lib/eth/{eth-event.d.ts → eth.d.ts} +1 -1
  21. package/lib/eth/eth.js +2 -0
  22. package/lib/eth/eth.js.map +1 -0
  23. package/lib/eth/index.d.ts +1 -0
  24. package/lib/eth/index.js +1 -0
  25. package/lib/eth/index.js.map +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/target-ethers-sentio/view-function.cjs +4 -9
  30. package/lib/target-ethers-sentio/view-function.cjs.map +1 -1
  31. package/package.json +5 -4
  32. package/src/builtin/internal/eacaggregatorproxy_processor.ts +90 -162
  33. package/src/builtin/internal/erc1155_processor.ts +25 -49
  34. package/src/builtin/internal/erc20_processor.ts +40 -72
  35. package/src/builtin/internal/erc20bytes_processor.ts +30 -54
  36. package/src/builtin/internal/erc721_processor.ts +45 -81
  37. package/src/builtin/internal/weth9_processor.ts +30 -54
  38. package/src/error.ts +12 -14
  39. package/src/eth/base-processor-template.ts +3 -3
  40. package/src/eth/base-processor.ts +4 -4
  41. package/src/eth/{eth-event.ts → eth.ts} +1 -1
  42. package/src/eth/index.ts +2 -0
  43. package/src/index.ts +1 -1
  44. package/src/target-ethers-sentio/view-function.cts +4 -11
  45. package/lib/eth/eth-event.js +0 -2
  46. package/lib/eth/eth-event.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"base-processor-template.js","sourceRoot":"","sources":["../../src/eth/base-processor-template.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAI1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAA0B,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAIlE,MAAM,OAAO,+BAAgC,SAAQ,gBAEpD;IACC,MAAM,CAAC,QAAQ,GAAG,IAAI,+BAA+B,EAAE,CAAA;;AAGzD,MAAM,OAAO,qBAAsB,SAAQ,gBAAkC;IAC3E,MAAM,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAA;;AAG/C,MAAM,OAAgB,qBAAqB;IAIzC,EAAE,CAAQ;IACV,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IACzB,aAAa,GAIP,EAAE,CAAA;IACR,aAAa,GAIP,EAAE,CAAA;IACR,aAAa,GAIP,EAAE,CAAA;IAER;QACE,IAAI,CAAC,EAAE,GAAG,+BAA+B,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,CAAA;QACrE,+BAA+B,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzD,CAAC;IAEM,IAAI,CAAC,OAAoB;QAC9B,MAAM,GAAG,GAAG,mBAAmB,CA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AO,EAAE,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;CAGF","sourcesContent":["import { BoundContractView, ContractContext, ContractView } from '../core/context.js'\nimport { BaseContract, ContractEvent, Block, LogDescription } from 'ethers'\nimport { AddressOrTypeEventFilter, BaseProcessor } from './base-processor.js'\nimport { BindOptions, getOptionsSignature } from '../core/bind-options.js'\nimport { EthFetchConfig, HandleInterval, TemplateInstance } from '@sentio/protos'\nimport { PromiseOrVoid } from '../promise-or-void.js'\nimport { Trace } from './trace.js'\nimport { ListStateStorage } from '@sentio/runtime'\nimport { EventFilter, LogParams, Network } from 'ethers/providers'\nimport { DeferredTopicFilter } from 'ethers/contract'\nimport { EthEvent } from './eth-event.js'\n\nexport class ProcessorTemplateProcessorState extends ListStateStorage<\n BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>\n> {\n static INSTANCE = new ProcessorTemplateProcessorState()\n}\n\nexport class TemplateInstanceState extends ListStateStorage<TemplateInstance> {\n static INSTANCE = new TemplateInstanceState()\n}\n\nexport abstract class BaseProcessorTemplate<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n id: number\n binds = new Set<string>()\n blockHandlers: {\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n blockInterval?: HandleInterval\n timeIntervalInMinutes?: HandleInterval\n }[] = []\n traceHandlers: {\n signature: string\n handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n fetchConfig?: EthFetchConfig\n }[] = []\n eventHandlers: {\n handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n filter: DeferredTopicFilter | DeferredTopicFilter[]\n fetchConfig?: EthFetchConfig\n }[] = []\n\n constructor() {\n this.id = ProcessorTemplateProcessorState.INSTANCE.getValues().length\n ProcessorTemplateProcessorState.INSTANCE.addValue(this)\n }\n\n public bind(options: BindOptions) {\n const sig = getOptionsSignature(options)\n if (this.binds.has(sig)) {\n return\n }\n this.binds.add(sig)\n\n const processor = this.bindInternal(options)\n\n for (const eh of this.eventHandlers) {\n processor.onEvent(eh.handler, eh.filter, eh.fetchConfig)\n }\n for (const th of this.traceHandlers) {\n processor.onTrace(th.signature, th.handler, th.fetchConfig)\n }\n for (const bh of this.blockHandlers) {\n processor.onInterval(bh.handler, bh.timeIntervalInMinutes, bh.blockInterval)\n }\n\n const instance: TemplateInstance = {\n templateId: this.id,\n contract: {\n address: options.address,\n name: options.name || '',\n chainId: options.network ? Network.from(options.network).chainId.toString() : '1',\n abi: '',\n },\n startBlock: 0n,\n endBlock: 0n,\n }\n if (options.startBlock) {\n instance.startBlock = BigInt(options.startBlock)\n }\n if (options.endBlock) {\n instance.endBlock = BigInt(options.endBlock)\n }\n TemplateInstanceState.INSTANCE.addValue(instance)\n return processor\n }\n\n public onEvent(\n handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: DeferredTopicFilter | DeferredTopicFilter[],\n fetchConfig?: EthFetchConfig\n ) {\n this.eventHandlers.push({\n handler: handler,\n filter: filter,\n fetchConfig: fetchConfig,\n })\n return this\n }\n\n public onBlockInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n blockInterval = 1000,\n backfillBlockInterval = 4000\n ) {\n return this.onInterval(handler, undefined, {\n recentInterval: blockInterval,\n backfillInterval: backfillBlockInterval,\n })\n }\n\n public onTimeInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeIntervalInMinutes = 60,\n backfillBlockInterval = 240\n ) {\n return this.onInterval(\n handler,\n { recentInterval: timeIntervalInMinutes, backfillInterval: backfillBlockInterval },\n undefined\n )\n }\n\n public onInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeInterval: HandleInterval | undefined,\n blockInterval: HandleInterval | undefined\n ) {\n this.blockHandlers.push({ handler, timeIntervalInMinutes: timeInterval, blockInterval: blockInterval })\n return this\n }\n\n public onTrace(\n signature: string,\n handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n this.traceHandlers.push({ signature, handler })\n return this\n }\n\n protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>\n}\n"]}
1
+ {"version":3,"file":"base-processor-template.js","sourceRoot":"","sources":["../../src/eth/base-processor-template.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAI1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAA0B,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAIlE,MAAM,OAAO,+BAAgC,SAAQ,gBAEpD;IACC,MAAM,CAAC,QAAQ,GAAG,IAAI,+BAA+B,EAAE,CAAA;;AAGzD,MAAM,OAAO,qBAAsB,SAAQ,gBAAkC;IAC3E,MAAM,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAA;;AAG/C,MAAM,OAAgB,qBAAqB;IAIzC,EAAE,CAAQ;IACV,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IACzB,aAAa,GAIP,EAAE,CAAA;IACR,aAAa,GAIP,EAAE,CAAA;IACR,aAAa,GAIP,EAAE,CAAA;IAER;QACE,IAAI,CAAC,EAAE,GAAG,+BAA+B,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,CAAA;QACrE,+BAA+B,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzD,CAAC;IAEM,IAAI,CAAC,OAAoB;QAC9B,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACxC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACvB,OAAM;SACP;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAA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AAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACjD,OAAO,SAAS,CAAA;IAClB,CAAC;IAEM,OAAO,CACZ,OAA2F,EAC3F,MAAmD,EACnD,WAA4B;QAE5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACtB,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,eAAe,CACpB,OAA6F,EAC7F,aAAa,GAAG,IAAI,EACpB,qBAAqB,GAAG,IAAI;QAE5B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE;YACzC,cAAc,EAAE,aAAa;YAC7B,gBAAgB,EAAE,qBAAqB;SACxC,CAAC,CAAA;IACJ,CAAC;IAEM,cAAc,CACnB,OAA6F,EAC7F,qBAAqB,GAAG,EAAE,EAC1B,qBAAqB,GAAG,GAAG;QAE3B,OAAO,IAAI,CAAC,UAAU,CACpB,OAAO,EACP,EAAE,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EAClF,SAAS,CACV,CAAA;IACH,CAAC;IAEM,UAAU,CACf,OAA6F,EAC7F,YAAwC,EACxC,aAAyC;QAEzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC,CAAA;QACvG,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,OAAO,CACZ,SAAiB,EACjB,OAA6F;QAE7F,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;CAGF","sourcesContent":["import { BoundContractView, ContractContext, ContractView } from '../core/context.js'\nimport { BaseContract, ContractEvent, Block, LogDescription } from 'ethers'\nimport { AddressOrTypeEventFilter, BaseProcessor } from './base-processor.js'\nimport { BindOptions, getOptionsSignature } from '../core/bind-options.js'\nimport { EthFetchConfig, HandleInterval, TemplateInstance } from '@sentio/protos'\nimport { PromiseOrVoid } from '../promise-or-void.js'\nimport { Trace } from './trace.js'\nimport { ListStateStorage } from '@sentio/runtime'\nimport { EventFilter, LogParams, Network } from 'ethers/providers'\nimport { DeferredTopicFilter } from 'ethers/contract'\nimport { Eth } from './eth.js'\n\nexport class ProcessorTemplateProcessorState extends ListStateStorage<\n BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>\n> {\n static INSTANCE = new ProcessorTemplateProcessorState()\n}\n\nexport class TemplateInstanceState extends ListStateStorage<TemplateInstance> {\n static INSTANCE = new TemplateInstanceState()\n}\n\nexport abstract class BaseProcessorTemplate<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n id: number\n binds = new Set<string>()\n blockHandlers: {\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n blockInterval?: HandleInterval\n timeIntervalInMinutes?: HandleInterval\n }[] = []\n traceHandlers: {\n signature: string\n handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n fetchConfig?: EthFetchConfig\n }[] = []\n eventHandlers: {\n handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n filter: DeferredTopicFilter | DeferredTopicFilter[]\n fetchConfig?: EthFetchConfig\n }[] = []\n\n constructor() {\n this.id = ProcessorTemplateProcessorState.INSTANCE.getValues().length\n ProcessorTemplateProcessorState.INSTANCE.addValue(this)\n }\n\n public bind(options: BindOptions) {\n const sig = getOptionsSignature(options)\n if (this.binds.has(sig)) {\n return\n }\n this.binds.add(sig)\n\n const processor = this.bindInternal(options)\n\n for (const eh of this.eventHandlers) {\n processor.onEvent(eh.handler, eh.filter, eh.fetchConfig)\n }\n for (const th of this.traceHandlers) {\n processor.onTrace(th.signature, th.handler, th.fetchConfig)\n }\n for (const bh of this.blockHandlers) {\n processor.onInterval(bh.handler, bh.timeIntervalInMinutes, bh.blockInterval)\n }\n\n const instance: TemplateInstance = {\n templateId: this.id,\n contract: {\n address: options.address,\n name: options.name || '',\n chainId: options.network ? Network.from(options.network).chainId.toString() : '1',\n abi: '',\n },\n startBlock: 0n,\n endBlock: 0n,\n }\n if (options.startBlock) {\n instance.startBlock = BigInt(options.startBlock)\n }\n if (options.endBlock) {\n instance.endBlock = BigInt(options.endBlock)\n }\n TemplateInstanceState.INSTANCE.addValue(instance)\n return processor\n }\n\n public onEvent(\n handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: DeferredTopicFilter | DeferredTopicFilter[],\n fetchConfig?: EthFetchConfig\n ) {\n this.eventHandlers.push({\n handler: handler,\n filter: filter,\n fetchConfig: fetchConfig,\n })\n return this\n }\n\n public onBlockInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n blockInterval = 1000,\n backfillBlockInterval = 4000\n ) {\n return this.onInterval(handler, undefined, {\n recentInterval: blockInterval,\n backfillInterval: backfillBlockInterval,\n })\n }\n\n public onTimeInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeIntervalInMinutes = 60,\n backfillBlockInterval = 240\n ) {\n return this.onInterval(\n handler,\n { recentInterval: timeIntervalInMinutes, backfillInterval: backfillBlockInterval },\n undefined\n )\n }\n\n public onInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeInterval: HandleInterval | undefined,\n blockInterval: HandleInterval | undefined\n ) {\n this.blockHandlers.push({ handler, timeIntervalInMinutes: timeInterval, blockInterval: blockInterval })\n return this\n }\n\n public onTrace(\n signature: string,\n handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n this.traceHandlers.push({ signature, handler })\n return this\n }\n\n protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>\n}\n"]}
@@ -4,7 +4,7 @@ import { AddressType, Data_EthBlock, Data_EthLog, Data_EthTrace, EthFetchConfig,
4
4
  import { BindInternalOptions, BindOptions } from '../core/bind-options.js';
5
5
  import { PromiseOrVoid } from '../promise-or-void.js';
6
6
  import { Trace } from './trace.js';
7
- import { EthEvent } from './eth-event.js';
7
+ import { Eth } from './eth.js';
8
8
  export interface AddressOrTypeEventFilter extends DeferredTopicFilter {
9
9
  addressType?: AddressType;
10
10
  address?: string;
@@ -32,10 +32,10 @@ export declare abstract class BaseProcessor<TContract extends BaseContract, TBou
32
32
  constructor(config: BindOptions);
33
33
  protected abstract CreateBoundContractView(): TBoundContractView;
34
34
  getChainId(): number;
35
- onEvent(handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, filter: DeferredTopicFilter | DeferredTopicFilter[], fetchConfig?: EthFetchConfig): this;
35
+ onEvent(handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, filter: DeferredTopicFilter | DeferredTopicFilter[], fetchConfig?: EthFetchConfig): this;
36
36
  onBlockInterval(handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, blockInterval?: number, backfillBlockInterval?: number): this;
37
37
  onTimeInterval(handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, timeIntervalInMinutes?: number, backfillTimeIntervalInMinutes?: number): this;
38
38
  onInterval(handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, timeInterval: HandleInterval | undefined, blockInterval: HandleInterval | undefined): this;
39
- onAllEvents(handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid): this;
39
+ onAllEvents(handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid): this;
40
40
  onTrace(signature: string, handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid, fetchConfig?: EthFetchConfig): this;
41
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../../src/eth/base-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAqB,eAAe,EAAgB,MAAM,oBAAoB,CAAA;AACrF,OAAO,EAKL,cAAc,EAEd,aAAa,GACd,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAQ/C,MAAM,OAAO,aAAa;IACxB,OAAO,CAA4B;IACnC,OAAO,CAAgD;IACvD,WAAW,CAAgB;CAC5B;AAED,MAAM,OAAO,YAAY;IACvB,SAAS,CAAQ;IACjB,OAAO,CAAkD;IACzD,WAAW,CAAgB;CAC5B;AAED,MAAM,OAAO,aAAa;IACxB,aAAa,CAAiB;IAC9B,qBAAqB,CAAiB;IACtC,OAAO,CAAkD;CAC1D;AAED,MAAM,OAAgB,aAAa;IAIjC,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GAAmB,EAAE,CAAA;IAElC,MAAM,CAAqB;IAE3B,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5C,UAAU,EAAE,EAAE;SACf,CAAA;QACD,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;YAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC3C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,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AAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;gBAE/E,MAAM,GAAG,GAAG,IAAI,eAAe,CAC7B,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAc,EACnB,SAAS,EACT,KAAK,EACL,IAAI,CAAC,WAA0B,EAC/B,IAAI,CAAC,kBAAwC,CAC9C,CAAA;gBACD,MAAM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBACzB,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAA;YAC/B,CAAC;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { Block, TransactionReceipt, BaseContract, Transaction, DeferredTopicFilter } from 'ethers'\nimport { LogParams, Network } from 'ethers/providers'\n\nimport { BoundContractView, ContractContext, ContractView } from '../core/context.js'\nimport {\n AddressType,\n Data_EthBlock,\n Data_EthLog,\n Data_EthTrace,\n EthFetchConfig,\n HandleInterval,\n ProcessResult,\n} from '@sentio/protos'\nimport { BindInternalOptions, BindOptions } from '../core/bind-options.js'\nimport { PromiseOrVoid } from '../promise-or-void.js'\nimport { Trace } from './trace.js'\nimport { ServerError, Status } from 'nice-grpc'\nimport { EthEvent } from './eth-event.js'\n\nexport interface AddressOrTypeEventFilter extends DeferredTopicFilter {\n addressType?: AddressType\n address?: string\n}\n\nexport class EventsHandler {\n filters: AddressOrTypeEventFilter[]\n handler: (event: Data_EthLog) => Promise<ProcessResult>\n fetchConfig: EthFetchConfig\n}\n\nexport class TraceHandler {\n signature: string\n handler: (trace: Data_EthTrace) => Promise<ProcessResult>\n fetchConfig: EthFetchConfig\n}\n\nexport class BlockHandlder {\n blockInterval?: HandleInterval\n timeIntervalInMinutes?: HandleInterval\n handler: (block: Data_EthBlock) => Promise<ProcessResult>\n}\n\nexport abstract class BaseProcessor<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n blockHandlers: BlockHandlder[] = []\n eventHandlers: EventsHandler[] = []\n traceHandlers: TraceHandler[] = []\n\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: 0n,\n }\n if (typeof this.config.network === 'string') {\n const asInt = parseInt(this.config.network)\n if (Number.isFinite(asInt)) {\n this.config.network = asInt\n }\n }\n if (config.startBlock) {\n this.config.startBlock = BigInt(config.startBlock)\n }\n if (config.endBlock) {\n this.config.endBlock = BigInt(config.endBlock)\n }\n }\n\n protected abstract CreateBoundContractView(): TBoundContractView\n\n public getChainId(): number {\n return Number(Network.from(this.config.network).chainId)\n }\n\n public onEvent(\n handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: DeferredTopicFilter | DeferredTopicFilter[],\n fetchConfig?: EthFetchConfig\n ) {\n const chainId = this.getChainId()\n let _filters: DeferredTopicFilter[] = []\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n const contractName = this.config.name\n const processor = this\n this.eventHandlers.push({\n filters: _filters,\n fetchConfig: fetchConfig || EthFetchConfig.fromPartial({}),\n handler: async function (data: Data_EthLog) {\n if (!data.log) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Log is empty')\n }\n const log = data.log as LogParams\n\n const contractView = processor.CreateBoundContractView()\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n data.timestamp,\n data.block as Block,\n log,\n undefined,\n data.transaction as Transaction,\n data.transactionReceipt as TransactionReceipt\n )\n const logParam = log as any as { topics: Array<string>; data: string }\n\n const parsed = contractView.rawContract.interface.parseLog(logParam)\n\n if (parsed) {\n const event: EthEvent = { ...log, args: parsed.args }\n await handler(event, ctx)\n return ctx.getProcessResult()\n }\n return ProcessResult.fromPartial({})\n },\n })\n return this\n }\n\n public onBlockInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n blockInterval = 250,\n backfillBlockInterval = 1000\n ) {\n return this.onInterval(handler, undefined, {\n recentInterval: blockInterval,\n backfillInterval: backfillBlockInterval,\n })\n }\n\n public onTimeInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeIntervalInMinutes = 60,\n backfillTimeIntervalInMinutes = 240\n ) {\n return this.onInterval(\n handler,\n { recentInterval: timeIntervalInMinutes, backfillInterval: backfillTimeIntervalInMinutes },\n undefined\n )\n }\n\n public onInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeInterval: HandleInterval | undefined,\n blockInterval: HandleInterval | undefined\n ) {\n const chainId = this.getChainId()\n const processor = this\n const contractName = this.config.name\n\n this.blockHandlers.push({\n handler: async function (data: Data_EthBlock) {\n if (!data.block) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Block is empty')\n }\n const block = data.block as Block\n\n const contractView = processor.CreateBoundContractView()\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n new Date(block.timestamp * 1000),\n block,\n undefined,\n undefined\n )\n await handler(block, ctx)\n return ctx.getProcessResult()\n },\n timeIntervalInMinutes: timeInterval,\n blockInterval: blockInterval,\n })\n return this\n }\n\n public onAllEvents(handler: (event: EthEvent, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {\n const _filters: DeferredTopicFilter[] = []\n const tmpContract = this.CreateBoundContractView()\n\n for (const fragment of tmpContract.rawContract.interface.fragments) {\n if (fragment.type === 'event') {\n const filter = tmpContract.rawContract.filters[fragment.format()]\n _filters.push(filter())\n }\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: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n fetchConfig?: EthFetchConfig\n ) {\n const chainId = this.getChainId()\n const contractName = this.config.name\n const processor = this\n\n this.traceHandlers.push({\n signature,\n fetchConfig: fetchConfig || EthFetchConfig.fromPartial({}),\n handler: async function (data: Data_EthTrace) {\n const contractView = processor.CreateBoundContractView()\n const contractInterface = contractView.rawContract.interface\n const fragment = contractInterface.getFunction(signature)\n if (!data.trace || !fragment) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'trace is null')\n }\n const trace = data.trace as Trace\n if (!trace.action.input) {\n return ProcessResult.fromPartial({})\n }\n const traceData = '0x' + trace.action.input.slice(10)\n trace.args = contractInterface.getAbiCoder().decode(fragment.inputs, traceData)\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n data.timestamp,\n data.block as Block,\n undefined,\n trace,\n data.transaction as Transaction,\n data.transactionReceipt as TransactionReceipt\n )\n await handler(trace, ctx)\n return ctx.getProcessResult()\n },\n })\n return this\n }\n}\n"]}
1
+ {"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../../src/eth/base-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAqB,eAAe,EAAgB,MAAM,oBAAoB,CAAA;AACrF,OAAO,EAKL,cAAc,EAEd,aAAa,GACd,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAQ/C,MAAM,OAAO,aAAa;IACxB,OAAO,CAA4B;IACnC,OAAO,CAAgD;IACvD,WAAW,CAAgB;CAC5B;AAED,MAAM,OAAO,YAAY;IACvB,SAAS,CAAQ;IACjB,OAAO,CAAkD;IACzD,WAAW,CAAgB;CAC5B;AAED,MAAM,OAAO,aAAa;IACxB,aAAa,CAAiB;IAC9B,qBAAqB,CAAiB;IACtC,OAAO,CAAkD;CAC1D;AAED,MAAM,OAAgB,aAAa;IAIjC,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GA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,WAAW,CAAC,SAAS,CAAC,CAAA;gBACzD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE;oBAC5B,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAA;iBAChE;gBACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAc,CAAA;gBACjC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;oBACvB,OAAO,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;iBACrC;gBACD,MAAM,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;gBACrD,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;gBAE/E,MAAM,GAAG,GAAG,IAAI,eAAe,CAC7B,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAc,EACnB,SAAS,EACT,KAAK,EACL,IAAI,CAAC,WAA0B,EAC/B,IAAI,CAAC,kBAAwC,CAC9C,CAAA;gBACD,MAAM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBACzB,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAA;YAC/B,CAAC;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { Block, TransactionReceipt, BaseContract, Transaction, DeferredTopicFilter } from 'ethers'\nimport { LogParams, Network } from 'ethers/providers'\n\nimport { BoundContractView, ContractContext, ContractView } from '../core/context.js'\nimport {\n AddressType,\n Data_EthBlock,\n Data_EthLog,\n Data_EthTrace,\n EthFetchConfig,\n HandleInterval,\n ProcessResult,\n} from '@sentio/protos'\nimport { BindInternalOptions, BindOptions } from '../core/bind-options.js'\nimport { PromiseOrVoid } from '../promise-or-void.js'\nimport { Trace } from './trace.js'\nimport { ServerError, Status } from 'nice-grpc'\nimport { Eth } from './eth.js'\n\nexport interface AddressOrTypeEventFilter extends DeferredTopicFilter {\n addressType?: AddressType\n address?: string\n}\n\nexport class EventsHandler {\n filters: AddressOrTypeEventFilter[]\n handler: (event: Data_EthLog) => Promise<ProcessResult>\n fetchConfig: EthFetchConfig\n}\n\nexport class TraceHandler {\n signature: string\n handler: (trace: Data_EthTrace) => Promise<ProcessResult>\n fetchConfig: EthFetchConfig\n}\n\nexport class BlockHandlder {\n blockInterval?: HandleInterval\n timeIntervalInMinutes?: HandleInterval\n handler: (block: Data_EthBlock) => Promise<ProcessResult>\n}\n\nexport abstract class BaseProcessor<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n blockHandlers: BlockHandlder[] = []\n eventHandlers: EventsHandler[] = []\n traceHandlers: TraceHandler[] = []\n\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: 0n,\n }\n if (typeof this.config.network === 'string') {\n const asInt = parseInt(this.config.network)\n if (Number.isFinite(asInt)) {\n this.config.network = asInt\n }\n }\n if (config.startBlock) {\n this.config.startBlock = BigInt(config.startBlock)\n }\n if (config.endBlock) {\n this.config.endBlock = BigInt(config.endBlock)\n }\n }\n\n protected abstract CreateBoundContractView(): TBoundContractView\n\n public getChainId(): number {\n return Number(Network.from(this.config.network).chainId)\n }\n\n public onEvent(\n handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: DeferredTopicFilter | DeferredTopicFilter[],\n fetchConfig?: EthFetchConfig\n ) {\n const chainId = this.getChainId()\n let _filters: DeferredTopicFilter[] = []\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n const contractName = this.config.name\n const processor = this\n this.eventHandlers.push({\n filters: _filters,\n fetchConfig: fetchConfig || EthFetchConfig.fromPartial({}),\n handler: async function (data: Data_EthLog) {\n if (!data.log) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Log is empty')\n }\n const log = data.log as LogParams\n\n const contractView = processor.CreateBoundContractView()\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n data.timestamp,\n data.block as Block,\n log,\n undefined,\n data.transaction as Transaction,\n data.transactionReceipt as TransactionReceipt\n )\n const logParam = log as any as { topics: Array<string>; data: string }\n\n const parsed = contractView.rawContract.interface.parseLog(logParam)\n\n if (parsed) {\n const event: Eth = { ...log, args: parsed.args }\n await handler(event, ctx)\n return ctx.getProcessResult()\n }\n return ProcessResult.fromPartial({})\n },\n })\n return this\n }\n\n public onBlockInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n blockInterval = 250,\n backfillBlockInterval = 1000\n ) {\n return this.onInterval(handler, undefined, {\n recentInterval: blockInterval,\n backfillInterval: backfillBlockInterval,\n })\n }\n\n public onTimeInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeIntervalInMinutes = 60,\n backfillTimeIntervalInMinutes = 240\n ) {\n return this.onInterval(\n handler,\n { recentInterval: timeIntervalInMinutes, backfillInterval: backfillTimeIntervalInMinutes },\n undefined\n )\n }\n\n public onInterval(\n handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n timeInterval: HandleInterval | undefined,\n blockInterval: HandleInterval | undefined\n ) {\n const chainId = this.getChainId()\n const processor = this\n const contractName = this.config.name\n\n this.blockHandlers.push({\n handler: async function (data: Data_EthBlock) {\n if (!data.block) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Block is empty')\n }\n const block = data.block as Block\n\n const contractView = processor.CreateBoundContractView()\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n new Date(block.timestamp * 1000),\n block,\n undefined,\n undefined\n )\n await handler(block, ctx)\n return ctx.getProcessResult()\n },\n timeIntervalInMinutes: timeInterval,\n blockInterval: blockInterval,\n })\n return this\n }\n\n public onAllEvents(handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {\n const _filters: DeferredTopicFilter[] = []\n const tmpContract = this.CreateBoundContractView()\n\n for (const fragment of tmpContract.rawContract.interface.fragments) {\n if (fragment.type === 'event') {\n const filter = tmpContract.rawContract.filters[fragment.format()]\n _filters.push(filter())\n }\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: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,\n fetchConfig?: EthFetchConfig\n ) {\n const chainId = this.getChainId()\n const contractName = this.config.name\n const processor = this\n\n this.traceHandlers.push({\n signature,\n fetchConfig: fetchConfig || EthFetchConfig.fromPartial({}),\n handler: async function (data: Data_EthTrace) {\n const contractView = processor.CreateBoundContractView()\n const contractInterface = contractView.rawContract.interface\n const fragment = contractInterface.getFunction(signature)\n if (!data.trace || !fragment) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'trace is null')\n }\n const trace = data.trace as Trace\n if (!trace.action.input) {\n return ProcessResult.fromPartial({})\n }\n const traceData = '0x' + trace.action.input.slice(10)\n trace.args = contractInterface.getAbiCoder().decode(fragment.inputs, traceData)\n\n const ctx = new ContractContext<TContract, TBoundContractView>(\n contractName,\n contractView,\n chainId,\n data.timestamp,\n data.block as Block,\n undefined,\n trace,\n data.transaction as Transaction,\n data.transactionReceipt as TransactionReceipt\n )\n await handler(trace, ctx)\n return ctx.getProcessResult()\n },\n })\n return this\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from 'ethers/providers';
2
2
  import { Result } from 'ethers';
3
- export interface EthEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends LogParams {
3
+ export interface Eth<TArgsArray extends Array<any> = any, TArgsObject = any> extends LogParams {
4
4
  args: TArgsArray & TArgsObject & Result;
5
5
  }
package/lib/eth/eth.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=eth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eth.js","sourceRoot":"","sources":["../../src/eth/eth.ts"],"names":[],"mappings":"","sourcesContent":["import { LogParams } from 'ethers/providers'\nimport { Result } from 'ethers'\n\nexport interface Eth<TArgsArray extends Array<any> = any, TArgsObject = any> extends LogParams {\n args: TArgsArray & TArgsObject & Result\n}\n"]}
@@ -4,4 +4,5 @@ export { BaseProcessorTemplate } from './base-processor-template.js';
4
4
  export { getProvider, DummyProvider } from './provider.js';
5
5
  export type { TypedCallTrace, Trace } from './trace.js';
6
6
  export { EthPlugin } from './eth-plugin.js';
7
+ export * from './eth.js';
7
8
  export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds.js';
package/lib/eth/index.js CHANGED
@@ -3,5 +3,6 @@ export { GenericProcessor } from './generic-processor.js';
3
3
  export { BaseProcessorTemplate } from './base-processor-template.js';
4
4
  export { getProvider, DummyProvider } from './provider.js';
5
5
  export { EthPlugin } from './eth-plugin.js';
6
+ export * from './eth.js';
6
7
  export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA","sourcesContent":["export { BaseProcessor } from './base-processor.js'\nexport { GenericProcessor } from './generic-processor.js'\nexport { BaseProcessorTemplate } from './base-processor-template.js'\nexport { getProvider, DummyProvider } from './provider.js'\nexport type { TypedCallTrace, Trace } from './trace.js'\nexport { EthPlugin } from './eth-plugin.js'\n\nexport { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,cAAc,UAAU,CAAA;AAExB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA","sourcesContent":["export { BaseProcessor } from './base-processor.js'\nexport { GenericProcessor } from './generic-processor.js'\nexport { BaseProcessorTemplate } from './base-processor-template.js'\nexport { getProvider, DummyProvider } from './provider.js'\nexport type { TypedCallTrace, Trace } from './trace.js'\nexport { EthPlugin } from './eth-plugin.js'\n\nexport * from './eth.js'\n\nexport { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds.js'\n"]}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { transformEtherError, EthersError } from './error.js';
1
+ export { transformEtherError, SimpleEthersError } from './error.js';
2
2
  export * from '@sentio/protos';
3
3
  export * from './core/index.js';
4
4
  export * from './eth/index.js';
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { transformEtherError, EthersError } from './error.js';
1
+ export { transformEtherError, SimpleEthersError } from './error.js';
2
2
  // TODO maybe remove this
3
3
  export * from '@sentio/protos';
4
4
  export * from './core/index.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7D,yBAAyB;AACzB,cAAc,gBAAgB,CAAA;AAE9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAChC,yBAAyB","sourcesContent":["export { transformEtherError, EthersError } from './error.js'\n\n// TODO maybe remove this\nexport * from '@sentio/protos'\n\nexport * from './core/index.js'\nexport * from './eth/index.js'\n\nexport * from './utils/chain.js'\n// export * from './api'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnE,yBAAyB;AACzB,cAAc,gBAAgB,CAAA;AAE9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAChC,yBAAyB","sourcesContent":["export { transformEtherError, SimpleEthersError } from './error.js'\n\n// TODO maybe remove this\nexport * from '@sentio/protos'\n\nexport * from './core/index.js'\nexport * from './eth/index.js'\n\nexport * from './utils/chain.js'\n// export * from './api'\n"]}
@@ -56,17 +56,12 @@ function generateBoundViewFunction(fn, includeArgTypes) {
56
56
  async ${declName ?? fn.name}(${(0, types_1.generateInputTypes)(fn.inputs, {
57
57
  useStructs: true,
58
58
  })}overrides?: Overrides): ${generateReturnTypes(fn)} {
59
- try {
60
- if (!overrides && this.context) {
61
- overrides = {
62
- blockTag: toBlockTag(this.context.blockNumber),
63
- }
59
+ if (!overrides && this.context) {
60
+ overrides = {
61
+ blockTag: toBlockTag(this.context.blockNumber),
64
62
  }
65
- return await this.view.${declName}(${fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''} overrides || {})
66
-
67
- } catch (e) {
68
- throw transformEtherError(e, this.context)
69
63
  }
64
+ return await this.view.${declName}(${fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''} overrides || {})
70
65
  }
71
66
  `;
72
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"view-function.cjs","sourceRoot":"","sources":["../../src/target-ethers-sentio/view-function.cts"],"names":[],"mappings":";;;AAEA,gEAA8F;AAC9F,2CAA8F;AAE9F,SAAS,mBAAmB,CAAC,EAAuB;IAClD,yFAAyF;IACzF,OAAO,WAAW,IAAA,2BAAmB,EAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAA;AACvG,CAAC;AAED,SAAgB,qBAAqB,CAAC,SAAgC;IACpE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;KACjD;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzE,CAAC;AALD,sDAKC;AAED,SAAgB,oBAAoB,CAAC,EAAuB,EAAE,eAAwB;IACpF,IAAI,EAAE,CAAC,eAAe,KAAK,MAAM,IAAI,EAAE,CAAC,eAAe,KAAK,MAAM,EAAE;QAClE,OAAO,EAAE,CAAA;KACV;IACD,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,IAAA,+CAAmC,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAA;IACpF,MAAM,IAAI,GAAG,6BAA6B,GAAG,IAAA,uCAA2B,EAAC,EA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AAM,IAAI,EAAE,CAAC,eAAe,KAAK,MAAM,EAAE;QAClE,OAAO,EAAE,CAAA;KACV;IACD,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,IAAA,+CAAmC,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAA;IAEpF,OAAO;UACC,QAAQ,IAAI,EAAE,CAAC,IAAI,IAAI,IAAA,0BAAkB,EAAC,EAAE,CAAC,MAAM,EAAE;QAC3D,UAAU,EAAE,IAAI;KACjB,CAAC,2BAA2B,mBAAmB,CAAC,EAAE,CAAC;;;;;;6BAMzB,QAAQ,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE;;GAE9I,CAAA;AACH,CAAC;AAlBD,8DAkBC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.0.0-rc.13",
4
+ "version": "2.0.0-rc.14",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@sentio/bigdecimal": "^9.1.1-patch.3",
17
17
  "@sentio/ethers-v6": "^1.0.24",
18
- "@sentio/protos": "^2.0.0-rc.13",
19
- "@sentio/runtime": "^2.0.0-rc.13",
18
+ "@sentio/protos": "^2.0.0-rc.14",
19
+ "@sentio/runtime": "^2.0.0-rc.14",
20
20
  "csv-parse": "^5.3.0",
21
21
  "ethers": "6.0.0",
22
22
  "google-protobuf": "^3.15.8",
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "exports": {
31
31
  ".": "./lib/index.js",
32
+ "./eth": "./lib/eth/index.js",
32
33
  "./testing": "./lib/testing/index.js",
33
34
  "./builtin": "./lib/builtin/index.js",
34
35
  "./builtin/erc20": "./lib/builtin/erc20/index.js",
@@ -49,5 +50,5 @@
49
50
  "typedoc": {
50
51
  "entryPoint": "./src/index.ts"
51
52
  },
52
- "gitHead": "f840521e61cbc11d76e56e4246dd1021e5befec7"
53
+ "gitHead": "1e0ec0302aa8e1a60c06b4ea6d8d5a0e48e83743"
53
54
  }
@@ -440,71 +440,51 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
440
440
  EACAggregatorProxyContractView
441
441
  > {
442
442
  async accessController(overrides?: Overrides): Promise<string> {
443
- try {
444
- if (!overrides && this.context) {
445
- overrides = {
446
- blockTag: toBlockTag(this.context.blockNumber),
447
- };
448
- }
449
- return await this.view.accessController(overrides || {});
450
- } catch (e) {
451
- throw transformEtherError(e, this.context);
443
+ if (!overrides && this.context) {
444
+ overrides = {
445
+ blockTag: toBlockTag(this.context.blockNumber),
446
+ };
452
447
  }
448
+ return await this.view.accessController(overrides || {});
453
449
  }
454
450
 
455
451
  async aggregator(overrides?: Overrides): Promise<string> {
456
- try {
457
- if (!overrides && this.context) {
458
- overrides = {
459
- blockTag: toBlockTag(this.context.blockNumber),
460
- };
461
- }
462
- return await this.view.aggregator(overrides || {});
463
- } catch (e) {
464
- throw transformEtherError(e, this.context);
452
+ if (!overrides && this.context) {
453
+ overrides = {
454
+ blockTag: toBlockTag(this.context.blockNumber),
455
+ };
465
456
  }
457
+ return await this.view.aggregator(overrides || {});
466
458
  }
467
459
 
468
460
  async decimals(overrides?: Overrides): Promise<bigint> {
469
- try {
470
- if (!overrides && this.context) {
471
- overrides = {
472
- blockTag: toBlockTag(this.context.blockNumber),
473
- };
474
- }
475
- return await this.view.decimals(overrides || {});
476
- } catch (e) {
477
- throw transformEtherError(e, this.context);
461
+ if (!overrides && this.context) {
462
+ overrides = {
463
+ blockTag: toBlockTag(this.context.blockNumber),
464
+ };
478
465
  }
466
+ return await this.view.decimals(overrides || {});
479
467
  }
480
468
 
481
469
  async description(overrides?: Overrides): Promise<string> {
482
- try {
483
- if (!overrides && this.context) {
484
- overrides = {
485
- blockTag: toBlockTag(this.context.blockNumber),
486
- };
487
- }
488
- return await this.view.description(overrides || {});
489
- } catch (e) {
490
- throw transformEtherError(e, this.context);
470
+ if (!overrides && this.context) {
471
+ overrides = {
472
+ blockTag: toBlockTag(this.context.blockNumber),
473
+ };
491
474
  }
475
+ return await this.view.description(overrides || {});
492
476
  }
493
477
 
494
478
  async getAnswer(
495
479
  _roundId: BigNumberish,
496
480
  overrides?: Overrides
497
481
  ): Promise<bigint> {
498
- try {
499
- if (!overrides && this.context) {
500
- overrides = {
501
- blockTag: toBlockTag(this.context.blockNumber),
502
- };
503
- }
504
- return await this.view.getAnswer(_roundId, overrides || {});
505
- } catch (e) {
506
- throw transformEtherError(e, this.context);
482
+ if (!overrides && this.context) {
483
+ overrides = {
484
+ blockTag: toBlockTag(this.context.blockNumber),
485
+ };
507
486
  }
487
+ return await this.view.getAnswer(_roundId, overrides || {});
508
488
  }
509
489
 
510
490
  async getRoundData(
@@ -519,58 +499,42 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
519
499
  answeredInRound: bigint;
520
500
  }
521
501
  > {
522
- try {
523
- if (!overrides && this.context) {
524
- overrides = {
525
- blockTag: toBlockTag(this.context.blockNumber),
526
- };
527
- }
528
- return await this.view.getRoundData(_roundId, overrides || {});
529
- } catch (e) {
530
- throw transformEtherError(e, this.context);
502
+ if (!overrides && this.context) {
503
+ overrides = {
504
+ blockTag: toBlockTag(this.context.blockNumber),
505
+ };
531
506
  }
507
+ return await this.view.getRoundData(_roundId, overrides || {});
532
508
  }
533
509
 
534
510
  async getTimestamp(
535
511
  _roundId: BigNumberish,
536
512
  overrides?: Overrides
537
513
  ): Promise<bigint> {
538
- try {
539
- if (!overrides && this.context) {
540
- overrides = {
541
- blockTag: toBlockTag(this.context.blockNumber),
542
- };
543
- }
544
- return await this.view.getTimestamp(_roundId, overrides || {});
545
- } catch (e) {
546
- throw transformEtherError(e, this.context);
514
+ if (!overrides && this.context) {
515
+ overrides = {
516
+ blockTag: toBlockTag(this.context.blockNumber),
517
+ };
547
518
  }
519
+ return await this.view.getTimestamp(_roundId, overrides || {});
548
520
  }
549
521
 
550
522
  async latestAnswer(overrides?: Overrides): Promise<bigint> {
551
- try {
552
- if (!overrides && this.context) {
553
- overrides = {
554
- blockTag: toBlockTag(this.context.blockNumber),
555
- };
556
- }
557
- return await this.view.latestAnswer(overrides || {});
558
- } catch (e) {
559
- throw transformEtherError(e, this.context);
523
+ if (!overrides && this.context) {
524
+ overrides = {
525
+ blockTag: toBlockTag(this.context.blockNumber),
526
+ };
560
527
  }
528
+ return await this.view.latestAnswer(overrides || {});
561
529
  }
562
530
 
563
531
  async latestRound(overrides?: Overrides): Promise<bigint> {
564
- try {
565
- if (!overrides && this.context) {
566
- overrides = {
567
- blockTag: toBlockTag(this.context.blockNumber),
568
- };
569
- }
570
- return await this.view.latestRound(overrides || {});
571
- } catch (e) {
572
- throw transformEtherError(e, this.context);
532
+ if (!overrides && this.context) {
533
+ overrides = {
534
+ blockTag: toBlockTag(this.context.blockNumber),
535
+ };
573
536
  }
537
+ return await this.view.latestRound(overrides || {});
574
538
  }
575
539
 
576
540
  async latestRoundData(
@@ -584,84 +548,60 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
584
548
  answeredInRound: bigint;
585
549
  }
586
550
  > {
587
- try {
588
- if (!overrides && this.context) {
589
- overrides = {
590
- blockTag: toBlockTag(this.context.blockNumber),
591
- };
592
- }
593
- return await this.view.latestRoundData(overrides || {});
594
- } catch (e) {
595
- throw transformEtherError(e, this.context);
551
+ if (!overrides && this.context) {
552
+ overrides = {
553
+ blockTag: toBlockTag(this.context.blockNumber),
554
+ };
596
555
  }
556
+ return await this.view.latestRoundData(overrides || {});
597
557
  }
598
558
 
599
559
  async latestTimestamp(overrides?: Overrides): Promise<bigint> {
600
- try {
601
- if (!overrides && this.context) {
602
- overrides = {
603
- blockTag: toBlockTag(this.context.blockNumber),
604
- };
605
- }
606
- return await this.view.latestTimestamp(overrides || {});
607
- } catch (e) {
608
- throw transformEtherError(e, this.context);
560
+ if (!overrides && this.context) {
561
+ overrides = {
562
+ blockTag: toBlockTag(this.context.blockNumber),
563
+ };
609
564
  }
565
+ return await this.view.latestTimestamp(overrides || {});
610
566
  }
611
567
 
612
568
  async owner(overrides?: Overrides): Promise<string> {
613
- try {
614
- if (!overrides && this.context) {
615
- overrides = {
616
- blockTag: toBlockTag(this.context.blockNumber),
617
- };
618
- }
619
- return await this.view.owner(overrides || {});
620
- } catch (e) {
621
- throw transformEtherError(e, this.context);
569
+ if (!overrides && this.context) {
570
+ overrides = {
571
+ blockTag: toBlockTag(this.context.blockNumber),
572
+ };
622
573
  }
574
+ return await this.view.owner(overrides || {});
623
575
  }
624
576
 
625
577
  async phaseAggregators(
626
578
  arg0: BigNumberish,
627
579
  overrides?: Overrides
628
580
  ): Promise<string> {
629
- try {
630
- if (!overrides && this.context) {
631
- overrides = {
632
- blockTag: toBlockTag(this.context.blockNumber),
633
- };
634
- }
635
- return await this.view.phaseAggregators(arg0, overrides || {});
636
- } catch (e) {
637
- throw transformEtherError(e, this.context);
581
+ if (!overrides && this.context) {
582
+ overrides = {
583
+ blockTag: toBlockTag(this.context.blockNumber),
584
+ };
638
585
  }
586
+ return await this.view.phaseAggregators(arg0, overrides || {});
639
587
  }
640
588
 
641
589
  async phaseId(overrides?: Overrides): Promise<bigint> {
642
- try {
643
- if (!overrides && this.context) {
644
- overrides = {
645
- blockTag: toBlockTag(this.context.blockNumber),
646
- };
647
- }
648
- return await this.view.phaseId(overrides || {});
649
- } catch (e) {
650
- throw transformEtherError(e, this.context);
590
+ if (!overrides && this.context) {
591
+ overrides = {
592
+ blockTag: toBlockTag(this.context.blockNumber),
593
+ };
651
594
  }
595
+ return await this.view.phaseId(overrides || {});
652
596
  }
653
597
 
654
598
  async proposedAggregator(overrides?: Overrides): Promise<string> {
655
- try {
656
- if (!overrides && this.context) {
657
- overrides = {
658
- blockTag: toBlockTag(this.context.blockNumber),
659
- };
660
- }
661
- return await this.view.proposedAggregator(overrides || {});
662
- } catch (e) {
663
- throw transformEtherError(e, this.context);
599
+ if (!overrides && this.context) {
600
+ overrides = {
601
+ blockTag: toBlockTag(this.context.blockNumber),
602
+ };
664
603
  }
604
+ return await this.view.proposedAggregator(overrides || {});
665
605
  }
666
606
 
667
607
  async proposedGetRoundData(
@@ -676,16 +616,12 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
676
616
  answeredInRound: bigint;
677
617
  }
678
618
  > {
679
- try {
680
- if (!overrides && this.context) {
681
- overrides = {
682
- blockTag: toBlockTag(this.context.blockNumber),
683
- };
684
- }
685
- return await this.view.proposedGetRoundData(_roundId, overrides || {});
686
- } catch (e) {
687
- throw transformEtherError(e, this.context);
619
+ if (!overrides && this.context) {
620
+ overrides = {
621
+ blockTag: toBlockTag(this.context.blockNumber),
622
+ };
688
623
  }
624
+ return await this.view.proposedGetRoundData(_roundId, overrides || {});
689
625
  }
690
626
 
691
627
  async proposedLatestRoundData(
@@ -699,29 +635,21 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
699
635
  answeredInRound: bigint;
700
636
  }
701
637
  > {
702
- try {
703
- if (!overrides && this.context) {
704
- overrides = {
705
- blockTag: toBlockTag(this.context.blockNumber),
706
- };
707
- }
708
- return await this.view.proposedLatestRoundData(overrides || {});
709
- } catch (e) {
710
- throw transformEtherError(e, this.context);
638
+ if (!overrides && this.context) {
639
+ overrides = {
640
+ blockTag: toBlockTag(this.context.blockNumber),
641
+ };
711
642
  }
643
+ return await this.view.proposedLatestRoundData(overrides || {});
712
644
  }
713
645
 
714
646
  async version(overrides?: Overrides): Promise<bigint> {
715
- try {
716
- if (!overrides && this.context) {
717
- overrides = {
718
- blockTag: toBlockTag(this.context.blockNumber),
719
- };
720
- }
721
- return await this.view.version(overrides || {});
722
- } catch (e) {
723
- throw transformEtherError(e, this.context);
647
+ if (!overrides && this.context) {
648
+ overrides = {
649
+ blockTag: toBlockTag(this.context.blockNumber),
650
+ };
724
651
  }
652
+ return await this.view.version(overrides || {});
725
653
  }
726
654
  }
727
655