@sentio/sdk 1.33.2 → 1.34.1-rc.1

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 (38) hide show
  1. package/lib/aptos/context.js +0 -3
  2. package/lib/aptos/context.js.map +1 -1
  3. package/lib/core/context.js +0 -6
  4. package/lib/core/context.js.map +1 -1
  5. package/lib/core/logger.js.map +1 -1
  6. package/lib/gen/chainquery/protos/chainquery.d.ts +1 -1
  7. package/lib/gen/chainquery/protos/chainquery.js +108 -211
  8. package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
  9. package/lib/gen/google/protobuf/empty.js.map +1 -1
  10. package/lib/gen/google/protobuf/timestamp.js +5 -9
  11. package/lib/gen/google/protobuf/timestamp.js.map +1 -1
  12. package/lib/gen/processor/protos/processor.d.ts +119 -189
  13. package/lib/gen/processor/protos/processor.js +783 -1118
  14. package/lib/gen/processor/protos/processor.js.map +1 -1
  15. package/lib/gen/service/price/protos/price.d.ts +4 -4
  16. package/lib/gen/service/price/protos/price.js +15 -27
  17. package/lib/gen/service/price/protos/price.js.map +1 -1
  18. package/lib/release.config.js +2 -2
  19. package/lib/service.d.ts +8 -8
  20. package/lib/service.js +47 -160
  21. package/lib/service.js.map +1 -1
  22. package/lib/testing/test-processor-server.d.ts +7 -5
  23. package/lib/testing/test-processor-server.js +42 -19
  24. package/lib/testing/test-processor-server.js.map +1 -1
  25. package/lib/utils/token.d.ts +1 -1
  26. package/lib/utils/token.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/aptos/context.ts +1 -3
  29. package/src/core/context.ts +1 -6
  30. package/src/core/logger.ts +1 -1
  31. package/src/gen/chainquery/protos/chainquery.ts +171 -379
  32. package/src/gen/google/protobuf/empty.ts +7 -19
  33. package/src/gen/google/protobuf/timestamp.ts +11 -31
  34. package/src/gen/processor/protos/processor.ts +1058 -1847
  35. package/src/gen/service/price/protos/price.ts +38 -103
  36. package/src/service.ts +59 -210
  37. package/src/testing/test-processor-server.ts +47 -28
  38. package/src/utils/token.ts +1 -1
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AptosResourceContext = exports.AptosContext = void 0;
7
7
  const long_1 = __importDefault(require("long"));
8
- const gen_1 = require("../gen");
9
8
  const meter_1 = require("../core/meter");
10
9
  const base_context_1 = require("../core/base-context");
11
10
  const network_1 = require("./network");
@@ -34,7 +33,6 @@ class AptosContext extends base_context_1.BaseContext {
34
33
  transactionHash: this.transaction?.hash || '',
35
34
  logIndex: 0,
36
35
  chainId: (0, network_1.getChainId)(this.network),
37
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
38
36
  name: name,
39
37
  labels: (0, meter_1.normalizeLabels)(labels),
40
38
  };
@@ -62,7 +60,6 @@ class AptosResourceContext extends base_context_1.BaseContext {
62
60
  transactionHash: '',
63
61
  logIndex: 0,
64
62
  chainId: (0, network_1.getChainId)(this.network),
65
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
66
63
  name: name,
67
64
  labels: (0, meter_1.normalizeLabels)(labels),
68
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/aptos/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,gCAAuD;AAEvD,yCAA+C;AAC/C,uDAAkD;AAElD,uCAAoD;AAEpD,MAAa,YAAa,SAAQ,0BAAW;IAC3C,OAAO,CAAQ;IACf,OAAO,CAAc;IACrB,UAAU,CAAQ;IAClB,OAAO,CAAQ;IACf,WAAW,CAA6B;IAExC,YACE,UAAkB,EAClB,OAAqB,EACrB,OAAe,EACf,OAAe,EACf,WAAyC;QAEzC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IA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Q,EAAE,CAAC;YACrD,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,IAAA,oBAAU,EAAC,IAAI,CAAC,OAAO,CAAC;YACjC,cAAc,EAAE,oBAAc,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;YACpD,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AA5BD,oDA4BC","sourcesContent":["import Long from 'long'\nimport { DataDescriptor, RecordMetaData } from '../gen'\nimport { Labels } from '../core/metadata'\nimport { normalizeLabels } from '../core/meter'\nimport { BaseContext } from '../core/base-context'\nimport { Transaction_UserTransaction } from 'aptos-sdk/src/generated'\nimport { AptosNetwork, getChainId } from './network'\n\nexport class AptosContext extends BaseContext {\n address: string\n network: AptosNetwork\n moduleName: string\n version: bigint\n transaction: Transaction_UserTransaction\n\n constructor(\n moduleName: string,\n network: AptosNetwork,\n address: string,\n version: bigint,\n transaction?: Transaction_UserTransaction\n ) {\n super()\n this.address = address\n this.network = network\n this.moduleName = moduleName\n this.version = version\n if (transaction) {\n this.transaction = transaction\n }\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: this.moduleName,\n blockNumber: Long.fromString(this.version.toString()),\n transactionIndex: 0,\n transactionHash: this.transaction?.hash || '', // TODO\n logIndex: 0,\n chainId: getChainId(this.network),\n dataDescriptor: DataDescriptor.fromPartial({ name }),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n\nexport class AptosResourceContext extends BaseContext {\n address: string\n network: AptosNetwork\n version: bigint\n timestampInMicros: number\n\n constructor(network: AptosNetwork, address: string, version: bigint, timestampInMicros: number) {\n super()\n this.address = address\n this.network = network\n this.version = version\n this.timestampInMicros = timestampInMicros\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: 'resources',\n blockNumber: Long.fromString(this.version.toString()),\n transactionIndex: 0,\n transactionHash: '',\n logIndex: 0,\n chainId: getChainId(this.network),\n dataDescriptor: DataDescriptor.fromPartial({ name }),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/aptos/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAGvB,yCAA+C;AAC/C,uDAAkD;AAElD,uCAAoD;AAEpD,MAAa,YAAa,SAAQ,0BAAW;IAC3C,OAAO,CAAQ;IACf,OAAO,CAAc;IACrB,UAAU,CAAQ;IAClB,OAAO,CAAQ;IACf,WAAW,CAA6B;IAExC,YACE,UAAkB,EAClB,OAAqB,EACrB,OAAe,EACf,OAAe,EACf,WAAyC;QAEzC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;SAC/B;IACH,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,MAAc;QACtC,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,WAAW,EAAE,cAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrD,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE;YAC7C,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,IAAA,oBAAU,EAAC,IAAI,CAAC,OAAO,CAAC;YACjC,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AArCD,oCAqCC;AAED,MAAa,oBAAqB,SAAQ,0BAAW;IACnD,OAAO,CAAQ;IACf,OAAO,CAAc;IACrB,OAAO,CAAQ;IACf,iBAAiB,CAAQ;IAEzB,YAAY,OAAqB,EAAE,OAAe,EAAE,OAAe,EAAE,iBAAyB;QAC5F,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,MAAc;QACtC,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,cAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrD,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,IAAA,oBAAU,EAAC,IAAI,CAAC,OAAO,CAAC;YACjC,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AA3BD,oDA2BC","sourcesContent":["import Long from 'long'\nimport { RecordMetaData } from '../gen'\nimport { Labels } from '../core/metadata'\nimport { normalizeLabels } from '../core/meter'\nimport { BaseContext } from '../core/base-context'\nimport { Transaction_UserTransaction } from 'aptos-sdk/src/generated'\nimport { AptosNetwork, getChainId } from './network'\n\nexport class AptosContext extends BaseContext {\n address: string\n network: AptosNetwork\n moduleName: string\n version: bigint\n transaction: Transaction_UserTransaction\n\n constructor(\n moduleName: string,\n network: AptosNetwork,\n address: string,\n version: bigint,\n transaction?: Transaction_UserTransaction\n ) {\n super()\n this.address = address\n this.network = network\n this.moduleName = moduleName\n this.version = version\n if (transaction) {\n this.transaction = transaction\n }\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: this.moduleName,\n blockNumber: Long.fromString(this.version.toString()),\n transactionIndex: 0,\n transactionHash: this.transaction?.hash || '', // TODO\n logIndex: 0,\n chainId: getChainId(this.network),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n\nexport class AptosResourceContext extends BaseContext {\n address: string\n network: AptosNetwork\n version: bigint\n timestampInMicros: number\n\n constructor(network: AptosNetwork, address: string, version: bigint, timestampInMicros: number) {\n super()\n this.address = address\n this.network = network\n this.version = version\n this.timestampInMicros = timestampInMicros\n }\n\n getMetaData(name: string, labels: Labels): RecordMetaData {\n return {\n address: this.address,\n contractName: 'resources',\n blockNumber: Long.fromString(this.version.toString()),\n transactionIndex: 0,\n transactionHash: '',\n logIndex: 0,\n chainId: getChainId(this.network),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SuiContext = exports.SolanaContext = exports.BoundContractView = exports.ContractView = exports.ContractContext = exports.AccountContext = exports.EthContext = void 0;
7
- const gen_1 = require("../gen");
8
7
  const meter_1 = require("./meter");
9
8
  const long_1 = __importDefault(require("long"));
10
9
  const chain_1 = require("../utils/chain");
@@ -46,7 +45,6 @@ class EthContext extends base_context_1.BaseContext {
46
45
  transactionHash: this.transactionHash || '',
47
46
  logIndex: this.log.logIndex,
48
47
  chainId: this.chainId.toString(),
49
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
50
48
  name: name,
51
49
  labels: (0, meter_1.normalizeLabels)(labels),
52
50
  };
@@ -60,7 +58,6 @@ class EthContext extends base_context_1.BaseContext {
60
58
  transactionHash: '',
61
59
  logIndex: -1,
62
60
  chainId: this.chainId.toString(),
63
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
64
61
  name: name,
65
62
  labels: (0, meter_1.normalizeLabels)(labels),
66
63
  };
@@ -74,7 +71,6 @@ class EthContext extends base_context_1.BaseContext {
74
71
  transactionHash: this.transactionHash || '',
75
72
  logIndex: -1,
76
73
  chainId: this.chainId.toString(),
77
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
78
74
  name: name,
79
75
  labels: (0, meter_1.normalizeLabels)(labels),
80
76
  };
@@ -158,7 +154,6 @@ class SolanaContext extends base_context_1.BaseContext {
158
154
  transactionHash: '',
159
155
  logIndex: 0,
160
156
  chainId: chain_1.SOL_MAINMET_ID,
161
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
162
157
  name: name,
163
158
  labels: (0, meter_1.normalizeLabels)(labels),
164
159
  };
@@ -183,7 +178,6 @@ class SuiContext extends base_context_1.BaseContext {
183
178
  transactionHash: '',
184
179
  logIndex: 0,
185
180
  chainId: chain_1.SUI_DEVNET_ID,
186
- dataDescriptor: gen_1.DataDescriptor.fromPartial({ name }),
187
181
  name: name,
188
182
  labels: (0, meter_1.normalizeLabels)(labels),
189
183
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":";;;;;;AAAA,gCAAsE;AAGtE,mCAAyC;AACzC,gDAAuB;AAGvB,0CAA8D;AAC9D,iDAA4C;AAE5C,MAAsB,UAAW,SAAQ,0BAAW;IAClD,OAAO,CAAQ;IACf,OAAO,CAAQ;IACf,GAAG,CAAM;IACT,KAAK,CAAQ;IACb,KAAK,CAAQ;IACb,WAAW,CAAM;IACjB,eAAe,CAAS;IAExB,YAAsB,OAAe,EAAE,OAAe,EAAE,KAAa,EAAE,GAAS,EAAE,KAAa;QAC7F,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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X,OAAO,EAAE,qBAAa;YACtB,cAAc,EAAE,oBAAc,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;YACpD,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AAzBD,gCAyBC","sourcesContent":["import { DataDescriptor, RecordMetaData, ProcessResult } from '../gen'\nimport { BaseContract, EventFilter } from 'ethers'\nimport { Block, Log } from '@ethersproject/abstract-provider'\nimport { normalizeLabels } from './meter'\nimport Long from 'long'\nimport { Trace } from './trace'\nimport { Labels } from './metadata'\nimport { SOL_MAINMET_ID, SUI_DEVNET_ID } from '../utils/chain'\nimport { BaseContext } from './base-context'\n\nexport abstract class EthContext extends BaseContext {\n chainId: number\n address: string\n log?: Log\n block?: Block\n trace?: Trace\n blockNumber: Long\n transactionHash?: string\n\n protected constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n this.trace = trace\n this.address = address\n if (log) {\n this.blockNumber = Long.fromNumber(log.blockNumber, true)\n this.transactionHash = log.transactionHash\n } else if (block) {\n this.blockNumber = Long.fromNumber(block.number, true)\n } else if (trace) {\n this.blockNumber = Long.fromNumber(trace.blockNumber, true)\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: this.blockNumber,\n transactionIndex: this.log.transactionIndex,\n transactionHash: this.transactionHash || '',\n logIndex: this.log.logIndex,\n chainId: this.chainId.toString(),\n dataDescriptor: DataDescriptor.fromPartial({ name }),\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: this.blockNumber,\n transactionIndex: -1,\n transactionHash: '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n dataDescriptor: DataDescriptor.fromPartial({ name }),\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: this.blockNumber,\n transactionIndex: this.trace.transactionPosition,\n transactionHash: this.transactionHash || '',\n logIndex: -1,\n chainId: this.chainId.toString(),\n dataDescriptor: DataDescriptor.fromPartial({ name }),\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, 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 block?: Block,\n log?: Log,\n trace?: Trace\n ) {\n super(chainId, view.rawContract.address, block, log, trace)\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 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: 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.filters\n }\n}\n\nexport class SolanaContext extends BaseContext {\n address: string\n programName: string\n blockNumber: Long\n\n constructor(programName: string, address: string, slot: Long) {\n super()\n this.programName = programName\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.programName,\n blockNumber: this.blockNumber,\n transactionIndex: 0,\n transactionHash: '', // TODO add\n logIndex: 0,\n chainId: SOL_MAINMET_ID, // TODO set in context\n dataDescriptor: DataDescriptor.fromPartial({ name }),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n\nexport class SuiContext extends BaseContext {\n address: string\n moduleName: string\n blockNumber: Long\n\n constructor(address: string, slot: Long) {\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: SUI_DEVNET_ID, // TODO set in context\n dataDescriptor: DataDescriptor.fromPartial({ name }),\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":";;;;;;AAGA,mCAAyC;AACzC,gDAAuB;AAGvB,0CAA8D;AAC9D,iDAA4C;AAE5C,MAAsB,UAAW,SAAQ,0BAAW;IAClD,OAAO,CAAQ;IACf,OAAO,CAAQ;IACf,GAAG,CAAM;IACT,KAAK,CAAQ;IACb,KAAK,CAAQ;IACb,WAAW,CAAM;IACjB,eAAe,CAAS;IAExB,YAAsB,OAAe,EAAE,OAAe,EAAE,KAAa,EAAE,GAAS,EAAE,KAAa;QAC7F,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,GAAG,EAAE;YACP,IAAI,CAAC,WAAW,GAAG,cAAI,CA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E,MAAc;QACtC,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,IAAI,CAAC,WAAW;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,sBAAc;YACvB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AAzBD,sCAyBC;AAED,MAAa,UAAW,SAAQ,0BAAW;IACzC,OAAO,CAAQ;IACf,UAAU,CAAQ;IAClB,WAAW,CAAM;IAEjB,YAAY,OAAe,EAAE,IAAU;QACrC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,MAAc;QACtC,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,qBAAa;YACtB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,uBAAe,EAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF;AAxBD,gCAwBC","sourcesContent":["import { RecordMetaData, ProcessResult } from '../gen'\nimport { BaseContract, EventFilter } from 'ethers'\nimport { Block, Log } from '@ethersproject/abstract-provider'\nimport { normalizeLabels } from './meter'\nimport Long from 'long'\nimport { Trace } from './trace'\nimport { Labels } from './metadata'\nimport { SOL_MAINMET_ID, SUI_DEVNET_ID } from '../utils/chain'\nimport { BaseContext } from './base-context'\n\nexport abstract class EthContext extends BaseContext {\n chainId: number\n address: string\n log?: Log\n block?: Block\n trace?: Trace\n blockNumber: Long\n transactionHash?: string\n\n protected constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {\n super()\n this.chainId = chainId\n this.log = log\n this.block = block\n this.trace = trace\n this.address = address\n if (log) {\n this.blockNumber = Long.fromNumber(log.blockNumber, true)\n this.transactionHash = log.transactionHash\n } else if (block) {\n this.blockNumber = Long.fromNumber(block.number, true)\n } else if (trace) {\n this.blockNumber = Long.fromNumber(trace.blockNumber, true)\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: this.blockNumber,\n transactionIndex: this.log.transactionIndex,\n transactionHash: this.transactionHash || '',\n logIndex: this.log.logIndex,\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: 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: 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, 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 block?: Block,\n log?: Log,\n trace?: Trace\n ) {\n super(chainId, view.rawContract.address, block, log, trace)\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 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: 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.filters\n }\n}\n\nexport class SolanaContext extends BaseContext {\n address: string\n programName: string\n blockNumber: Long\n\n constructor(programName: string, address: string, slot: Long) {\n super()\n this.programName = programName\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.programName,\n blockNumber: this.blockNumber,\n transactionIndex: 0,\n transactionHash: '', // TODO add\n logIndex: 0,\n chainId: SOL_MAINMET_ID, // TODO set in context\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n\nexport class SuiContext extends BaseContext {\n address: string\n moduleName: string\n blockNumber: Long\n\n constructor(address: string, slot: Long) {\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: SUI_DEVNET_ID, // TODO set in context\n name: name,\n labels: normalizeLabels(labels),\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;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AU,CAAC,CAAA;IAC3C,CAAC;IAED,QAAQ,CAAC,GAAQ,EAAE,aAAyB,EAAE;QAC5C,IAAI,CAAC,GAAG,CAAC,cAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC,CAAA;IAC9C,CAAC;CACF;AA1CD,wBA0CC","sourcesContent":["import { BaseContext } from './base-context'\nimport { DataDescriptor, LogLevel } from '../gen'\nimport { NamedResultDescriptor } from './metadata'\n\nexport type Attributes = Record<string, any>\n\nexport class Logger extends NamedResultDescriptor {\n private readonly ctx: BaseContext\n\n constructor(ctx: BaseContext, name = '') {\n super(name)\n this.ctx = ctx\n }\n\n withName(name: string) {\n return new Logger(this.ctx, name)\n }\n\n log(level: LogLevel, message: any, attributes: Attributes = {}) {\n if (typeof message !== 'string' && !(message instanceof String)) {\n message = JSON.stringify(message)\n }\n\n this.ctx.res.logs.push({\n // name: this.name,\n metadata: this.ctx.getMetaData(this.name, {}), // GetRecordMetaData(this.ctx, this, {}),\n level,\n message,\n attributes: JSON.stringify(attributes),\n runtimeInfo: undefined,\n })\n }\n\n info(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.INFO, msg, attributes)\n }\n\n warn(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.WARNING, msg, attributes)\n }\n\n error(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.ERROR, msg, attributes)\n }\n\n critical(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.CRITICAL, msg, attributes)\n }\n}\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;;AACA,gCAAiC;AACjC,yCAAkD;AAIlD,MAAa,MAAO,SAAQ,gCAAqB;IAC9B,GAAG,CAAa;IAEjC,YAAY,GAAgB,EAAE,IAAI,GAAG,EAAE;QACrC,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,QAAQ,CAAC,I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'../gen'\nimport { NamedResultDescriptor } from './metadata'\n\nexport type Attributes = Record<string, any>\n\nexport class Logger extends NamedResultDescriptor {\n private readonly ctx: BaseContext\n\n constructor(ctx: BaseContext, name = '') {\n super(name)\n this.ctx = ctx\n }\n\n withName(name: string) {\n return new Logger(this.ctx, name)\n }\n\n log(level: LogLevel, message: any, attributes: Attributes = {}) {\n if (typeof message !== 'string' && !(message instanceof String)) {\n message = JSON.stringify(message)\n }\n\n this.ctx.res.logs.push({\n // name: this.name,\n metadata: this.ctx.getMetaData(this.name, {}), // GetRecordMetaData(this.ctx, this, {}),\n level,\n message,\n attributes: JSON.stringify(attributes),\n runtimeInfo: undefined,\n })\n }\n\n info(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.INFO, msg, attributes)\n }\n\n warn(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.WARNING, msg, attributes)\n }\n\n error(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.ERROR, msg, attributes)\n }\n\n critical(msg: any, attributes: Attributes = {}) {\n this.log(LogLevel.CRITICAL, msg, attributes)\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { CallContext, CallOptions } from "nice-grpc-common";
2
1
  import Long from "long";
2
+ import type { CallContext, CallOptions } from "nice-grpc-common";
3
3
  import _m0 from "protobufjs/minimal";
4
4
  export interface AptosGetTxnsByFunctionRequest {
5
5
  network: string;