@sentio/sdk 2.0.0-rc.21 → 2.0.0-rc.23

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 (50) hide show
  1. package/lib/aptos/codegen/codegen.js +5 -1
  2. package/lib/aptos/codegen/codegen.js.map +1 -1
  3. package/lib/aptos/{run-codegen.d.ts → codegen/run.d.ts} +0 -0
  4. package/lib/aptos/{run-codegen.js → codegen/run.js} +2 -2
  5. package/lib/aptos/codegen/run.js.map +1 -0
  6. package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js +1 -1
  7. package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
  8. package/lib/eth/builtin/internal/erc1155_processor.js +1 -1
  9. package/lib/eth/builtin/internal/erc1155_processor.js.map +1 -1
  10. package/lib/eth/builtin/internal/erc20_processor.js +1 -1
  11. package/lib/eth/builtin/internal/erc20_processor.js.map +1 -1
  12. package/lib/eth/builtin/internal/erc20bytes_processor.js +1 -1
  13. package/lib/eth/builtin/internal/erc20bytes_processor.js.map +1 -1
  14. package/lib/eth/builtin/internal/erc721_processor.js +1 -1
  15. package/lib/eth/builtin/internal/erc721_processor.js.map +1 -1
  16. package/lib/eth/builtin/internal/weth9_processor.js +1 -1
  17. package/lib/eth/builtin/internal/weth9_processor.js.map +1 -1
  18. package/lib/eth/codegen/file.js +1 -1
  19. package/lib/eth/codegen/file.js.map +1 -1
  20. package/lib/eth/{run-codegen.d.ts → codegen/run.d.ts} +0 -0
  21. package/lib/eth/{run-codegen.js → codegen/run.js} +2 -2
  22. package/lib/eth/codegen/run.js.map +1 -0
  23. package/lib/eth/context.d.ts +2 -1
  24. package/lib/eth/context.js +4 -5
  25. package/lib/eth/context.js.map +1 -1
  26. package/lib/eth/generic-processor.js +1 -1
  27. package/lib/eth/generic-processor.js.map +1 -1
  28. package/lib/solana/{run-codegen.d.ts → codegen/run.d.ts} +0 -0
  29. package/lib/solana/{run-codegen.js → codegen/run.js} +2 -2
  30. package/lib/solana/codegen/run.js.map +1 -0
  31. package/package.json +11 -11
  32. package/src/aptos/codegen/codegen.ts +5 -1
  33. package/src/aptos/{run-codegen.ts → codegen/run.ts} +1 -1
  34. package/src/aptos/codegen/tsconfig.json +1 -1
  35. package/src/eth/builtin/internal/eacaggregatorproxy_processor.ts +1 -1
  36. package/src/eth/builtin/internal/erc1155_processor.ts +1 -1
  37. package/src/eth/builtin/internal/erc20_processor.ts +1 -1
  38. package/src/eth/builtin/internal/erc20bytes_processor.ts +1 -1
  39. package/src/eth/builtin/internal/erc721_processor.ts +1 -1
  40. package/src/eth/builtin/internal/weth9_processor.ts +1 -1
  41. package/src/eth/codegen/file.ts +1 -1
  42. package/src/eth/{run-codegen.ts → codegen/run.ts} +1 -1
  43. package/src/eth/codegen/tsconfig.json +1 -1
  44. package/src/eth/context.ts +4 -5
  45. package/src/eth/generic-processor.ts +1 -1
  46. package/src/solana/{run-codegen.ts → codegen/run.ts} +1 -2
  47. package/src/solana/codegen/tsconfig.json +1 -1
  48. package/lib/aptos/run-codegen.js.map +0 -1
  49. package/lib/eth/run-codegen.js.map +0 -1
  50. package/lib/solana/run-codegen.js.map +0 -1
@@ -36,8 +36,9 @@ export declare class ContractView<TContract extends BaseContract> {
36
36
  }
37
37
  export declare class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {
38
38
  protected view: TContractView;
39
+ readonly address: string;
39
40
  context: ContractContext<TContract, BoundContractView<TContract, TContractView>>;
40
- constructor(view: TContractView);
41
+ constructor(address: string, view: TContractView);
41
42
  get rawContract(): TContract;
42
43
  get provider(): import("ethers").Provider | null | undefined;
43
44
  get filters(): Record<string, import("ethers").ContractEvent<any[]>>;
@@ -89,10 +89,7 @@ export class ContractContext extends EthContext {
89
89
  contract;
90
90
  contractName;
91
91
  constructor(contractName, view, chainId, timestamp, block, log, trace, transaction, transactionReceipt) {
92
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
93
- // @ts-ignore
94
- const address = view.rawContract.getAddress();
95
- super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt);
92
+ super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt);
96
93
  view.context = this;
97
94
  this.contractName = contractName;
98
95
  this.contract = view;
@@ -115,9 +112,11 @@ export class ContractView {
115
112
  }
116
113
  export class BoundContractView {
117
114
  view;
115
+ address;
118
116
  // context will be set right after context creation (in context's constructor)
119
117
  context;
120
- constructor(view) {
118
+ constructor(address, view) {
119
+ this.address = address;
121
120
  this.view = view;
122
121
  }
123
122
  get rawContract() {
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/eth/context.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,MAAM,OAAgB,UAAW,SAAQ,WAAW;IAClD,OAAO,CAAQ;IACf,OAAO,CAAQ;IACE,GAAG,CAAY;IAChC,KAAK,CAAQ;IACI,KAAK,CAAQ;IAC9B,WAAW,CAAiB;IAC5B,eAAe,CAAS;IACxB,WAAW,CAAc;IACzB,kBAAkB,CAAqB;IACvC,SAAS,CAAM;IAEf,YACE,OAAe,EACf,OAAe,EACf,SAAgB,EAChB,KAAa,EACb,GAAe,EACf,KAAa,EACb,WAAyB,EACzB,kBAAuC;QAEvC,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,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;Q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;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,SAAS,CAAC,UAAU;YAC7B,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF","sourcesContent":["import { BaseContract, Transaction, TransactionReceipt, Block } from 'ethers'\nimport { LogParams } from 'ethers/providers'\n\nimport { RecordMetaData } from '@sentio/protos'\nimport { Trace } from './trace.js'\nimport { Labels, normalizeLabels } from '../core/metadata.js'\nimport { CHAIN_IDS } from '../core/chain.js'\nimport { BaseContext } from '../core/base-context.js'\n\nexport abstract class EthContext extends BaseContext {\n chainId: number\n address: string\n private readonly log?: LogParams\n block?: Block\n private readonly trace?: Trace\n blockNumber: bigint | number\n transactionHash?: string\n transaction?: Transaction\n transactionReceipt?: TransactionReceipt\n timestamp: Date\n\n constructor(\n chainId: number,\n address: string,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n this.trace = trace\n this.address = address\n this.transaction = transaction\n this.transactionReceipt = transactionReceipt\n this.timestamp = timestamp || new Date(0)\n if (log) {\n this.blockNumber = log.blockNumber\n this.transactionHash = log.transactionHash\n } else if (block) {\n this.blockNumber = block.number\n } else if (trace) {\n this.blockNumber = trace.blockNumber\n this.transactionHash = trace.transactionHash\n }\n }\n\n protected abstract getContractName(): string\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n if (this.log) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.log.transactionIndex,\n transactionHash: this.transactionHash || '',\n logIndex: this.log.index,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.block) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: -1,\n transactionHash: '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.trace) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.trace.transactionPosition,\n transactionHash: this.transactionHash || '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n throw new Error(\"Invaid ctx argument can't happen\")\n }\n}\n\nexport class AccountContext extends EthContext {\n // constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {\n // super(chainId, address, new Date(0), block, log, trace)\n // }\n protected getContractName(): string {\n return 'account'\n }\n}\n\nexport class ContractContext<\n TContract extends BaseContract,\n TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>\n> extends EthContext {\n contract: TContractBoundView\n contractName: string\n\n constructor(\n contractName: string,\n view: TContractBoundView,\n chainId: number,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const address = view.rawContract.getAddress() as string\n super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt)\n view.context = this\n this.contractName = contractName\n this.contract = view\n }\n\n protected getContractName(): string {\n return this.contractName\n }\n}\n\nexport class ContractView<TContract extends BaseContract> {\n protected contract: TContract\n\n constructor(contract: TContract) {\n this.contract = contract\n }\n\n get rawContract() {\n return this.contract\n }\n\n get provider() {\n return this.contract.runner?.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: ContractContext<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.rawContract.filters\n }\n}\n\nexport class SuiContext extends BaseContext {\n address: string\n moduleName: string\n blockNumber: bigint\n\n constructor(address: string, slot: bigint) {\n super()\n this.address = address\n this.blockNumber = slot\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: this.moduleName,\n blockNumber: this.blockNumber,\n transactionIndex: 0,\n transactionHash: '', // TODO\n logIndex: 0,\n chainId: CHAIN_IDS.SUI_DEVNET, // TODO set in context\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/eth/context.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,MAAM,OAAgB,UAAW,SAAQ,WAAW;IAClD,OAAO,CAAQ;IACf,OAAO,CAAQ;IACE,GAAG,CAAY;IAChC,KAAK,CAAQ;IACI,KAAK,CAAQ;IAC9B,WAAW,CAAiB;IAC5B,eAAe,CAAS;IACxB,WAAW,CAAc;IACzB,kBAAkB,CAAqB;IACvC,SAAS,CAAM;IAEf,YACE,OAAe,EACf,OAAe,EACf,SAAgB,EAChB,KAAa,EACb,GAAe,EACf,KAAa,EACb,WAAyB,EACzB,kBAAuC;QAEvC,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,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,kBAAkB,G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I,CAAC,UAAU;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,SAAS,CAAC,UAAU;YAC7B,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF","sourcesContent":["import { BaseContract, Transaction, TransactionReceipt, Block } from 'ethers'\nimport { LogParams } from 'ethers/providers'\n\nimport { RecordMetaData } from '@sentio/protos'\nimport { Trace } from './trace.js'\nimport { Labels, normalizeLabels } from '../core/metadata.js'\nimport { CHAIN_IDS } from '../core/chain.js'\nimport { BaseContext } from '../core/base-context.js'\n\nexport abstract class EthContext extends BaseContext {\n chainId: number\n address: string\n private readonly log?: LogParams\n block?: Block\n private readonly trace?: Trace\n blockNumber: bigint | number\n transactionHash?: string\n transaction?: Transaction\n transactionReceipt?: TransactionReceipt\n timestamp: Date\n\n constructor(\n chainId: number,\n address: string,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n this.trace = trace\n this.address = address\n this.transaction = transaction\n this.transactionReceipt = transactionReceipt\n this.timestamp = timestamp || new Date(0)\n if (log) {\n this.blockNumber = log.blockNumber\n this.transactionHash = log.transactionHash\n } else if (block) {\n this.blockNumber = block.number\n } else if (trace) {\n this.blockNumber = trace.blockNumber\n this.transactionHash = trace.transactionHash\n }\n }\n\n protected abstract getContractName(): string\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n if (this.log) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.log.transactionIndex,\n transactionHash: this.transactionHash || '',\n logIndex: this.log.index,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.block) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: -1,\n transactionHash: '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n if (this.trace) {\n return {\n address: this.address,\n contractName: this.getContractName(),\n blockNumber: BigInt(this.blockNumber),\n transactionIndex: this.trace.transactionPosition,\n transactionHash: this.transactionHash || '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n throw new Error(\"Invaid ctx argument can't happen\")\n }\n}\n\nexport class AccountContext extends EthContext {\n // constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {\n // super(chainId, address, new Date(0), block, log, trace)\n // }\n protected getContractName(): string {\n return 'account'\n }\n}\n\nexport class ContractContext<\n TContract extends BaseContract,\n TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>\n> extends EthContext {\n contract: TContractBoundView\n contractName: string\n\n constructor(\n contractName: string,\n view: TContractBoundView,\n chainId: number,\n timestamp?: Date,\n block?: Block,\n log?: LogParams,\n trace?: Trace,\n transaction?: Transaction,\n transactionReceipt?: TransactionReceipt\n ) {\n super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt)\n view.context = this\n this.contractName = contractName\n this.contract = view\n }\n\n protected getContractName(): string {\n return this.contractName\n }\n}\n\nexport class ContractView<TContract extends BaseContract> {\n protected contract: TContract\n\n constructor(contract: TContract) {\n this.contract = contract\n }\n\n get rawContract() {\n return this.contract\n }\n\n get provider() {\n return this.contract.runner?.provider\n }\n}\n\nexport class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {\n protected view: TContractView\n readonly address: string\n // context will be set right after context creation (in context's constructor)\n context: ContractContext<TContract, BoundContractView<TContract, TContractView>>\n\n constructor(address: string, view: TContractView) {\n this.address = address\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.rawContract.filters\n }\n}\n\nexport class SuiContext extends BaseContext {\n address: string\n moduleName: string\n blockNumber: bigint\n\n constructor(address: string, slot: bigint) {\n super()\n this.address = address\n this.blockNumber = slot\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: this.moduleName,\n blockNumber: this.blockNumber,\n transactionIndex: 0,\n transactionHash: '', // TODO\n logIndex: 0,\n chainId: CHAIN_IDS.SUI_DEVNET, // TODO set in context\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
@@ -11,7 +11,7 @@ export class GenericProcessor extends BaseProcessor {
11
11
  }
12
12
  CreateBoundContractView() {
13
13
  const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network));
14
- return new BoundContractView(new ContractView(contract));
14
+ return new BoundContractView(this.config.address, new ContractView(contract));
15
15
  }
16
16
  static bind(eventABI, options) {
17
17
  if (!Array.isArray(eventABI)) {
@@ -1 +1 @@
1
- {"version":3,"file":"generic-processor.js","sourceRoot":"","sources":["../../src/eth/generic-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,OAAO,gBAAiB,SAAQ,aAGrC;IACC,QAAQ,CAAU;IAClB,YAAY,QAAkB,EAAE,OAAoB;QAClD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAES,uBAAuB;QAC/B,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACvG,OAAO,IAAI,iBAAiB,CAAC,IAAI,YAAY,CAAe,QAAQ,CAAC,CAAC,CAAA;IACxE,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,QAA2B,EAAE,OAAoB;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5B,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAA;SACtB;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACjB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAA;SACzB;QACD,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACzD,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;QAChC,OAAO,SAAS,CAAA;IAClB,CAAC;CACF","sourcesContent":["import { BaseContract } from 'ethers'\nimport { BoundContractView, ContractView } from './context.js'\nimport { BindOptions } from './bind-options.js'\nimport { BaseProcessor } from './base-processor.js'\nimport { getProvider } from './provider.js'\nimport { addProcessor } from './binds.js'\n\nexport class GenericProcessor extends BaseProcessor<\n BaseContract,\n BoundContractView<BaseContract, ContractView<BaseContract>>\n> {\n eventABI: string[]\n constructor(eventABI: string[], options: BindOptions) {\n super(options)\n this.eventABI = eventABI\n }\n\n protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {\n const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))\n return new BoundContractView(new ContractView<BaseContract>(contract))\n }\n\n public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {\n if (!Array.isArray(eventABI)) {\n eventABI = [eventABI]\n }\n if (!options.name) {\n options.name = 'Generic'\n }\n const processor = new GenericProcessor(eventABI, options)\n addProcessor(options, processor)\n return processor\n }\n}\n"]}
1
+ {"version":3,"file":"generic-processor.js","sourceRoot":"","sources":["../../src/eth/generic-processor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View } from './context.js'\nimport { BindOptions } from './bind-options.js'\nimport { BaseProcessor } from './base-processor.js'\nimport { getProvider } from './provider.js'\nimport { addProcessor } from './binds.js'\n\nexport class GenericProcessor extends BaseProcessor<\n BaseContract,\n BoundContractView<BaseContract, ContractView<BaseContract>>\n> {\n eventABI: string[]\n constructor(eventABI: string[], options: BindOptions) {\n super(options)\n this.eventABI = eventABI\n }\n\n protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {\n const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))\n return new BoundContractView(this.config.address, new ContractView<BaseContract>(contract))\n }\n\n public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {\n if (!Array.isArray(eventABI)) {\n eventABI = [eventABI]\n }\n if (!options.name) {\n options.name = 'Generic'\n }\n const processor = new GenericProcessor(eventABI, options)\n addProcessor(options, processor)\n return processor\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { codegen } from './codegen/codegen.js';
2
+ import { codegen } from './codegen.js';
3
3
  if (process.argv.length > 3) {
4
4
  const abisDir = process.argv[2];
5
5
  const targetDir = process.argv[3];
@@ -9,4 +9,4 @@ else {
9
9
  console.error('Not enough argument');
10
10
  process.exit(1);
11
11
  }
12
- //# sourceMappingURL=run-codegen.js.map
12
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/solana/codegen/run.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;CAC5B;KAAM;IACL,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAChB","sourcesContent":["#!/usr/bin/env node\n\nimport { codegen } from './codegen.js'\n\nif (process.argv.length > 3) {\n const abisDir = process.argv[2]\n const targetDir = process.argv[3]\n codegen(abisDir, targetDir)\n} else {\n console.error('Not enough argument')\n process.exit(1)\n}\n"]}
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.0.0-rc.21",
4
+ "version": "2.0.0-rc.23",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "compile": "tsc -p . && cp src/utils/*.csv lib/utils && cp src/tsup.config.ts lib",
8
8
  "build": "yarn gen:eth && yarn gen:aptos && yarn gen:solana && yarn compile",
9
9
  "build_all": "yarn lerna run --scope=@sentio/sdk build --include-dependencies",
10
10
  "test": "NODE_OPTIONS=--experimental-vm-modules yarn jest",
11
- "gen:eth": "ts-node-esm ./src/eth/run-codegen.ts src/eth/abis src/eth/builtin && yarn gen:eth_test",
12
- "gen:eth_test": "ts-node-esm ./src/eth/run-codegen.ts src/tests/abis/eth ./src/tests/types/eth",
13
- "gen:aptos": "ts-node-esm ./src/aptos/run-codegen.ts src/aptos/abis src/aptos/builtin && yarn gen:aptos_test",
14
- "gen:aptos_test": "ts-node-esm ./src/aptos/run-codegen.ts src/aptos/tests/abis src/aptos/tests/types",
15
- "gen:solana": "ts-node-esm ./src/solana/run-codegen.ts src/solana/tests/abis src/solana/tests/types"
11
+ "gen:eth": "ts-node-esm src/eth/codegen/run.ts src/eth/abis src/eth/builtin && yarn gen:eth_test",
12
+ "gen:eth_test": "ts-node-esm src/eth/codegen/run.ts src/tests/abis/eth ./src/tests/types/eth",
13
+ "gen:aptos": "ts-node-esm src/aptos/codegen/run.ts src/aptos/abis src/aptos/builtin && yarn gen:aptos_test",
14
+ "gen:aptos_test": "ts-node-esm src/aptos/codegen/run.ts src/aptos/tests/abis src/aptos/tests/types",
15
+ "gen:solana": "ts-node-esm src/solana/codegen/run.ts src/solana/tests/abis src/solana/tests/types"
16
16
  },
17
17
  "dependencies": {
18
18
  "@project-serum/anchor": "^0.26.0",
19
19
  "@sentio/bigdecimal": "^9.1.1-patch.3",
20
20
  "@sentio/ethers-v6": "^1.0.24",
21
- "@sentio/protos": "^2.0.0-rc.21",
22
- "@sentio/runtime": "^2.0.0-rc.21",
23
- "@sentio/sdk": "^2.0.0-rc.21",
21
+ "@sentio/protos": "^2.0.0-rc.23",
22
+ "@sentio/runtime": "^2.0.0-rc.23",
23
+ "@sentio/sdk": "^2.0.0-rc.23",
24
24
  "@solana/web3.js": "^1.47.3",
25
25
  "@types/prettier": "^2.7.2",
26
26
  "aptos-sdk": "npm:@sentio/aptos@^1.6.0",
27
27
  "bs58": "^5.0.0",
28
28
  "chalk": "^5.2.0",
29
29
  "csv-parse": "^5.3.0",
30
- "ethers": "npm:@sentio/ethers@^6.0.0-patch.3",
30
+ "ethers": "npm:@sentio/ethers@^6.0.2",
31
31
  "lodash-es": "^4.17.21",
32
32
  "mkdirp": "^2.1.3",
33
33
  "p-queue": "^7.3.0",
@@ -71,5 +71,5 @@
71
71
  "typedoc": {
72
72
  "entryPoint": "./src/index.ts"
73
73
  },
74
- "gitHead": "b42181478b4662da271cbf72cbcd4cdcfbee2002"
74
+ "gitHead": "253f64172b8c3871867c769303569083e11799a9"
75
75
  }
@@ -217,7 +217,11 @@ export class AccountCodegen {
217
217
 
218
218
  ${this.modules
219
219
  .map((m) => {
220
- return `_r.load(${normalizeToJSName(m.abi!.name)}.ABI)`
220
+ if (m.abi) {
221
+ return `_r.load(${normalizeToJSName(m.abi.name)}.ABI)`
222
+ }
223
+ console.error('Find Module with empty ABI')
224
+ return ''
221
225
  })
222
226
  .join('\n')}
223
227
  }
@@ -1,6 +1,6 @@
1
1
  // #!/usr/bin/env node
2
2
 
3
- import { codegen } from './codegen/codegen.js'
3
+ import { codegen } from './codegen.js'
4
4
 
5
5
  if (process.argv.length > 3) {
6
6
  const abisDir = process.argv[2]
@@ -3,6 +3,6 @@
3
3
  "rootDir": "..",
4
4
  "outDir": "../../../lib/aptos"
5
5
  },
6
- "extends": "@sentio/sdk/tsconfig.json",
6
+ "extends": "../../../tsconfig.json",
7
7
  "include": ["./"]
8
8
  }
@@ -985,7 +985,7 @@ export class EACAggregatorProxyProcessor extends BaseProcessor<
985
985
  this.config.address,
986
986
  this.config.network
987
987
  );
988
- return new EACAggregatorProxyBoundContractView(view);
988
+ return new EACAggregatorProxyBoundContractView(this.config.address, view);
989
989
  }
990
990
 
991
991
  public static bind(options: BindOptions): EACAggregatorProxyProcessor {
@@ -423,7 +423,7 @@ export class ERC1155Processor extends BaseProcessor<
423
423
 
424
424
  protected CreateBoundContractView(): ERC1155BoundContractView {
425
425
  const view = getERC1155Contract(this.config.address, this.config.network);
426
- return new ERC1155BoundContractView(view);
426
+ return new ERC1155BoundContractView(this.config.address, view);
427
427
  }
428
428
 
429
429
  public static bind(options: BindOptions): ERC1155Processor {
@@ -543,7 +543,7 @@ export class ERC20Processor extends BaseProcessor<
543
543
 
544
544
  protected CreateBoundContractView(): ERC20BoundContractView {
545
545
  const view = getERC20Contract(this.config.address, this.config.network);
546
- return new ERC20BoundContractView(view);
546
+ return new ERC20BoundContractView(this.config.address, view);
547
547
  }
548
548
 
549
549
  public static bind(options: BindOptions): ERC20Processor {
@@ -354,7 +354,7 @@ export class ERC20BytesProcessor extends BaseProcessor<
354
354
  this.config.address,
355
355
  this.config.network
356
356
  );
357
- return new ERC20BytesBoundContractView(view);
357
+ return new ERC20BytesBoundContractView(this.config.address, view);
358
358
  }
359
359
 
360
360
  public static bind(options: BindOptions): ERC20BytesProcessor {
@@ -560,7 +560,7 @@ export class ERC721Processor extends BaseProcessor<
560
560
 
561
561
  protected CreateBoundContractView(): ERC721BoundContractView {
562
562
  const view = getERC721Contract(this.config.address, this.config.network);
563
- return new ERC721BoundContractView(view);
563
+ return new ERC721BoundContractView(this.config.address, view);
564
564
  }
565
565
 
566
566
  public static bind(options: BindOptions): ERC721Processor {
@@ -403,7 +403,7 @@ export class WETH9Processor extends BaseProcessor<
403
403
 
404
404
  protected CreateBoundContractView(): WETH9BoundContractView {
405
405
  const view = getWETH9Contract(this.config.address, this.config.network);
406
- return new WETH9BoundContractView(view);
406
+ return new WETH9BoundContractView(this.config.address, view);
407
407
  }
408
408
 
409
409
  public static bind(options: BindOptions): WETH9Processor {
@@ -63,7 +63,7 @@ export function codeGenSentioFile(contract: Contract): string {
63
63
 
64
64
  protected CreateBoundContractView(): ${contract.name}BoundContractView {
65
65
  const view = get${contract.name}Contract(this.config.address, this.config.network)
66
- return new ${contract.name}BoundContractView(view)
66
+ return new ${contract.name}BoundContractView(this.config.address, view)
67
67
  }
68
68
 
69
69
  public static bind(options: BindOptions): ${contract.name}Processor {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { codegen } from './codegen/index.js'
3
+ import { codegen } from './index.js'
4
4
 
5
5
  if (process.argv.length > 3) {
6
6
  const abisDir = process.argv[2]
@@ -3,6 +3,6 @@
3
3
  "rootDir": "..",
4
4
  "outDir": "../../../lib"
5
5
  },
6
- "extends": "@sentio/sdk/tsconfig.json",
6
+ "extends": "../../../tsconfig.json",
7
7
  "include": ["./"]
8
8
  }
@@ -122,10 +122,7 @@ export class ContractContext<
122
122
  transaction?: Transaction,
123
123
  transactionReceipt?: TransactionReceipt
124
124
  ) {
125
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
126
- // @ts-ignore
127
- const address = view.rawContract.getAddress() as string
128
- super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt)
125
+ super(chainId, view.address, timestamp, block, log, trace, transaction, transactionReceipt)
129
126
  view.context = this
130
127
  this.contractName = contractName
131
128
  this.contract = view
@@ -154,10 +151,12 @@ export class ContractView<TContract extends BaseContract> {
154
151
 
155
152
  export class BoundContractView<TContract extends BaseContract, TContractView extends ContractView<TContract>> {
156
153
  protected view: TContractView
154
+ readonly address: string
157
155
  // context will be set right after context creation (in context's constructor)
158
156
  context: ContractContext<TContract, BoundContractView<TContract, TContractView>>
159
157
 
160
- constructor(view: TContractView) {
158
+ constructor(address: string, view: TContractView) {
159
+ this.address = address
161
160
  this.view = view
162
161
  }
163
162
 
@@ -17,7 +17,7 @@ export class GenericProcessor extends BaseProcessor<
17
17
 
18
18
  protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {
19
19
  const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))
20
- return new BoundContractView(new ContractView<BaseContract>(contract))
20
+ return new BoundContractView(this.config.address, new ContractView<BaseContract>(contract))
21
21
  }
22
22
 
23
23
  public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path'
4
- import { codegen } from './codegen/codegen.js'
3
+ import { codegen } from './codegen.js'
5
4
 
6
5
  if (process.argv.length > 3) {
7
6
  const abisDir = process.argv[2]
@@ -3,6 +3,6 @@
3
3
  "rootDir": "..",
4
4
  "outDir": "../../../lib"
5
5
  },
6
- "extends": "@sentio/sdk/tsconfig.json",
6
+ "extends": "../../../tsconfig.json",
7
7
  "include": ["./"]
8
8
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-codegen.js","sourceRoot":"","sources":["../../src/aptos/run-codegen.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAEjC,MAAM,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;CAClC;KAAM;IACL,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAChB","sourcesContent":["// #!/usr/bin/env node\n\nimport { codegen } from './codegen/codegen.js'\n\nif (process.argv.length > 3) {\n const abisDir = process.argv[2]\n const targetDir = process.argv[3]\n\n await codegen(abisDir, targetDir)\n} else {\n console.error('Not enough argument')\n process.exit(1)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-codegen.js","sourceRoot":"","sources":["../../src/eth/run-codegen.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjC,MAAM,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;CAClC;KAAM;IACL,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAChB","sourcesContent":["#!/usr/bin/env node\n\nimport { codegen } from './codegen/index.js'\n\nif (process.argv.length > 3) {\n const abisDir = process.argv[2]\n const targetDir = process.argv[3]\n await codegen(abisDir, targetDir)\n} else {\n console.error('Not enough argument')\n process.exit(1)\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-codegen.js","sourceRoot":"","sources":["../../src/solana/run-codegen.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;CAC5B;KAAM;IACL,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAChB","sourcesContent":["#!/usr/bin/env node\n\nimport path from 'path'\nimport { codegen } from './codegen/codegen.js'\n\nif (process.argv.length > 3) {\n const abisDir = process.argv[2]\n const targetDir = process.argv[3]\n codegen(abisDir, targetDir)\n} else {\n console.error('Not enough argument')\n process.exit(1)\n}\n"]}