@xyo-network/evm-abi-diviner 2.99.4 → 2.99.5

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.
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,7 +40,13 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
39
40
  // src/Diviner.ts
40
41
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
41
42
  var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
42
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
43
+ static {
44
+ __name(this, "EvmAbiImplementedDiviner");
45
+ }
46
+ static configSchemas = [
47
+ ...super.configSchemas,
48
+ EvmAbiImplementedDivinerConfigSchema
49
+ ];
43
50
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
44
51
  get abi() {
45
52
  return (0, import_assert.assertEx)(this.config?.abi, () => "No ABI specified");
@@ -47,23 +54,21 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
47
54
  async divineHandler(inPayloads = []) {
48
55
  await this.started("throw");
49
56
  try {
50
- const observations = await Promise.all(
51
- inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
52
- const contractInterface = new import_ethers.Interface(this.abi);
53
- const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
54
- const results = [];
55
- contractInterface.forEachFunction(({ selector }) => {
56
- const observation = {
57
- address,
58
- implemented: byteCode.includes(BigInt(selector).toString(16)),
59
- schema: EvmFunctionImplementedSchema,
60
- selector
61
- };
62
- results.push(observation);
63
- });
64
- return results;
65
- })
66
- );
57
+ const observations = await Promise.all(inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
58
+ const contractInterface = new import_ethers.Interface(this.abi);
59
+ const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
60
+ const results = [];
61
+ contractInterface.forEachFunction(({ selector }) => {
62
+ const observation = {
63
+ address,
64
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
65
+ schema: EvmFunctionImplementedSchema,
66
+ selector
67
+ };
68
+ results.push(observation);
69
+ });
70
+ return results;
71
+ }));
67
72
  return observations.flat();
68
73
  } catch (ex) {
69
74
  const error = ex;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.js'\nexport * from './Payload.js'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,wCAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AACR,eAAO,wBAAS,KAAK,QAAQ,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,WAAO,4CAAmC,6CAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,wBAAU,KAAK,GAAG;AAChD,gBAAM,eAAW,wBAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.ts'\nexport * from './Payload.ts'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAMA,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,2BAAN,cAAwHC,wCAAAA;EAjB/H,OAiB+HA;;;EAK7H,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeH;;EAC5E,OAAyBI,sBAA8BJ;EAEvD,IAAIK,MAAM;AACR,eAAOC,wBAAS,KAAKC,QAAQF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,WAAOC,4CAAmCC,6CAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,wBAAU,KAAKhB,GAAG;AAChD,cAAMiB,eAAWhB,wBAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;","names":["EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","configSchemas","defaultConfigSchema","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message"]}
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/Diviner.ts
2
5
  import { assertEx } from "@xylabs/assert";
3
6
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
@@ -11,7 +14,13 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
11
14
  // src/Diviner.ts
12
15
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
13
16
  var EvmAbiImplementedDiviner = class extends AbstractDiviner {
14
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
17
+ static {
18
+ __name(this, "EvmAbiImplementedDiviner");
19
+ }
20
+ static configSchemas = [
21
+ ...super.configSchemas,
22
+ EvmAbiImplementedDivinerConfigSchema
23
+ ];
15
24
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
16
25
  get abi() {
17
26
  return assertEx(this.config?.abi, () => "No ABI specified");
@@ -19,23 +28,21 @@ var EvmAbiImplementedDiviner = class extends AbstractDiviner {
19
28
  async divineHandler(inPayloads = []) {
20
29
  await this.started("throw");
21
30
  try {
22
- const observations = await Promise.all(
23
- inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
24
- const contractInterface = new Interface(this.abi);
25
- const byteCode = assertEx(code, () => "Missing code");
26
- const results = [];
27
- contractInterface.forEachFunction(({ selector }) => {
28
- const observation = {
29
- address,
30
- implemented: byteCode.includes(BigInt(selector).toString(16)),
31
- schema: EvmFunctionImplementedSchema,
32
- selector
33
- };
34
- results.push(observation);
35
- });
36
- return results;
37
- })
38
- );
31
+ const observations = await Promise.all(inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
32
+ const contractInterface = new Interface(this.abi);
33
+ const byteCode = assertEx(code, () => "Missing code");
34
+ const results = [];
35
+ contractInterface.forEachFunction(({ selector }) => {
36
+ const observation = {
37
+ address,
38
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
39
+ schema: EvmFunctionImplementedSchema,
40
+ selector
41
+ };
42
+ results.push(observation);
43
+ });
44
+ return results;
45
+ }));
39
46
  return observations.flat();
40
47
  } catch (ex) {
41
48
  const error = ex;
@@ -49,4 +56,4 @@ export {
49
56
  EvmAbiImplementedDivinerConfigSchema,
50
57
  EvmFunctionImplementedSchema
51
58
  };
52
- //# sourceMappingURL=index.js.map
59
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAsB,yBAAyB;AAE/C,SAAS,6BAAqC;AAC9C,SAAS,iBAAiB;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,gBAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AAzBZ;AA0BI,WAAO,UAAS,UAAK,WAAL,mBAAa,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAmC,iBAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,UAAU,KAAK,GAAG;AAChD,gBAAM,WAAW,SAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AACzB,SAASC,uBAAuB;AAEhC,SAAsBC,yBAAyB;AAE/C,SAASC,6BAAqC;AAC9C,SAASC,iBAAiB;;;ACDnB,IAAMC,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,2BAAN,cAAwHC,gBAAAA;EAjB/H,OAiB+HA;;;EAK7H,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeH;;EAC5E,OAAyBI,sBAA8BJ;EAEvD,IAAIK,MAAM;AACR,WAAOC,SAAS,KAAKC,QAAQF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,OAAOC,sBAAmCC,iBAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,UAAU,KAAKhB,GAAG;AAChD,cAAMiB,WAAWhB,SAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;","names":["assertEx","AbstractDiviner","EvmContractSchema","isPayloadOfSchemaType","Interface","EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","configSchemas","defaultConfigSchema","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message"]}
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,7 +40,13 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
39
40
  // src/Diviner.ts
40
41
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
41
42
  var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
42
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
43
+ static {
44
+ __name(this, "EvmAbiImplementedDiviner");
45
+ }
46
+ static configSchemas = [
47
+ ...super.configSchemas,
48
+ EvmAbiImplementedDivinerConfigSchema
49
+ ];
43
50
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
44
51
  get abi() {
45
52
  return (0, import_assert.assertEx)(this.config?.abi, () => "No ABI specified");
@@ -47,23 +54,21 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
47
54
  async divineHandler(inPayloads = []) {
48
55
  await this.started("throw");
49
56
  try {
50
- const observations = await Promise.all(
51
- inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
52
- const contractInterface = new import_ethers.Interface(this.abi);
53
- const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
54
- const results = [];
55
- contractInterface.forEachFunction(({ selector }) => {
56
- const observation = {
57
- address,
58
- implemented: byteCode.includes(BigInt(selector).toString(16)),
59
- schema: EvmFunctionImplementedSchema,
60
- selector
61
- };
62
- results.push(observation);
63
- });
64
- return results;
65
- })
66
- );
57
+ const observations = await Promise.all(inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
58
+ const contractInterface = new import_ethers.Interface(this.abi);
59
+ const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
60
+ const results = [];
61
+ contractInterface.forEachFunction(({ selector }) => {
62
+ const observation = {
63
+ address,
64
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
65
+ schema: EvmFunctionImplementedSchema,
66
+ selector
67
+ };
68
+ results.push(observation);
69
+ });
70
+ return results;
71
+ }));
67
72
  return observations.flat();
68
73
  } catch (ex) {
69
74
  const error = ex;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.js'\nexport * from './Payload.js'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,wCAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AACR,eAAO,wBAAS,KAAK,QAAQ,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,WAAO,4CAAmC,6CAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,wBAAU,KAAK,GAAG;AAChD,gBAAM,eAAW,wBAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.ts'\nexport * from './Payload.ts'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAMA,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,2BAAN,cAAwHC,wCAAAA;EAjB/H,OAiB+HA;;;EAK7H,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeH;;EAC5E,OAAyBI,sBAA8BJ;EAEvD,IAAIK,MAAM;AACR,eAAOC,wBAAS,KAAKC,QAAQF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,WAAOC,4CAAmCC,6CAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,wBAAU,KAAKhB,GAAG;AAChD,cAAMiB,eAAWhB,wBAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;","names":["EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","configSchemas","defaultConfigSchema","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message"]}
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/Diviner.ts
2
5
  import { assertEx } from "@xylabs/assert";
3
6
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
@@ -11,7 +14,13 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
11
14
  // src/Diviner.ts
12
15
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
13
16
  var EvmAbiImplementedDiviner = class extends AbstractDiviner {
14
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
17
+ static {
18
+ __name(this, "EvmAbiImplementedDiviner");
19
+ }
20
+ static configSchemas = [
21
+ ...super.configSchemas,
22
+ EvmAbiImplementedDivinerConfigSchema
23
+ ];
15
24
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
16
25
  get abi() {
17
26
  return assertEx(this.config?.abi, () => "No ABI specified");
@@ -19,23 +28,21 @@ var EvmAbiImplementedDiviner = class extends AbstractDiviner {
19
28
  async divineHandler(inPayloads = []) {
20
29
  await this.started("throw");
21
30
  try {
22
- const observations = await Promise.all(
23
- inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
24
- const contractInterface = new Interface(this.abi);
25
- const byteCode = assertEx(code, () => "Missing code");
26
- const results = [];
27
- contractInterface.forEachFunction(({ selector }) => {
28
- const observation = {
29
- address,
30
- implemented: byteCode.includes(BigInt(selector).toString(16)),
31
- schema: EvmFunctionImplementedSchema,
32
- selector
33
- };
34
- results.push(observation);
35
- });
36
- return results;
37
- })
38
- );
31
+ const observations = await Promise.all(inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
32
+ const contractInterface = new Interface(this.abi);
33
+ const byteCode = assertEx(code, () => "Missing code");
34
+ const results = [];
35
+ contractInterface.forEachFunction(({ selector }) => {
36
+ const observation = {
37
+ address,
38
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
39
+ schema: EvmFunctionImplementedSchema,
40
+ selector
41
+ };
42
+ results.push(observation);
43
+ });
44
+ return results;
45
+ }));
39
46
  return observations.flat();
40
47
  } catch (ex) {
41
48
  const error = ex;
@@ -49,4 +56,4 @@ export {
49
56
  EvmAbiImplementedDivinerConfigSchema,
50
57
  EvmFunctionImplementedSchema
51
58
  };
52
- //# sourceMappingURL=index.js.map
59
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAsB,yBAAyB;AAE/C,SAAS,6BAAqC;AAC9C,SAAS,iBAAiB;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,gBAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AACR,WAAO,SAAS,KAAK,QAAQ,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAmC,iBAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,UAAU,KAAK,GAAG;AAChD,gBAAM,WAAW,SAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AACzB,SAASC,uBAAuB;AAEhC,SAAsBC,yBAAyB;AAE/C,SAASC,6BAAqC;AAC9C,SAASC,iBAAiB;;;ACDnB,IAAMC,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,2BAAN,cAAwHC,gBAAAA;EAjB/H,OAiB+HA;;;EAK7H,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeH;;EAC5E,OAAyBI,sBAA8BJ;EAEvD,IAAIK,MAAM;AACR,WAAOC,SAAS,KAAKC,QAAQF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,OAAOC,sBAAmCC,iBAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,UAAU,KAAKhB,GAAG;AAChD,cAAMiB,WAAWhB,SAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;","names":["assertEx","AbstractDiviner","EvmContractSchema","isPayloadOfSchemaType","Interface","EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","configSchemas","defaultConfigSchema","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message"]}
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -3,7 +3,7 @@ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
3
3
  import { EvmContract } from '@xyo-network/evm-contract-witness';
4
4
  import { AnyConfigSchema } from '@xyo-network/module-model';
5
5
  import { Schema } from '@xyo-network/payload-model';
6
- import { EvmFunctionImplemented, InterfaceAbi } from './Payload.js';
6
+ import { EvmFunctionImplemented, InterfaceAbi } from './Payload.ts';
7
7
  export declare const EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
8
8
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema;
9
9
  export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
@@ -2,7 +2,11 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
5
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __reflectGet = Reflect.get;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
10
  var __export = (target, all) => {
7
11
  for (var name in all)
8
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,6 +20,8 @@ var __copyProps = (to, from, except, desc) => {
16
20
  return to;
17
21
  };
18
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
19
25
 
20
26
  // src/index.ts
21
27
  var src_exports = {};
@@ -38,9 +44,7 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
38
44
 
39
45
  // src/Diviner.ts
40
46
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
41
- var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
42
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
43
- static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
47
+ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends import_diviner_abstract.AbstractDiviner {
44
48
  get abi() {
45
49
  var _a;
46
50
  return (0, import_assert.assertEx)((_a = this.config) == null ? void 0 : _a.abi, () => "No ABI specified");
@@ -48,23 +52,21 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
48
52
  async divineHandler(inPayloads = []) {
49
53
  await this.started("throw");
50
54
  try {
51
- const observations = await Promise.all(
52
- inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
53
- const contractInterface = new import_ethers.Interface(this.abi);
54
- const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
55
- const results = [];
56
- contractInterface.forEachFunction(({ selector }) => {
57
- const observation = {
58
- address,
59
- implemented: byteCode.includes(BigInt(selector).toString(16)),
60
- schema: EvmFunctionImplementedSchema,
61
- selector
62
- };
63
- results.push(observation);
64
- });
65
- return results;
66
- })
67
- );
55
+ const observations = await Promise.all(inPayloads.filter((0, import_payload_model.isPayloadOfSchemaType)(import_evm_contract_witness.EvmContractSchema)).map(({ address, code }) => {
56
+ const contractInterface = new import_ethers.Interface(this.abi);
57
+ const byteCode = (0, import_assert.assertEx)(code, () => "Missing code");
58
+ const results = [];
59
+ contractInterface.forEachFunction(({ selector }) => {
60
+ const observation = {
61
+ address,
62
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
63
+ schema: EvmFunctionImplementedSchema,
64
+ selector
65
+ };
66
+ results.push(observation);
67
+ });
68
+ return results;
69
+ }));
68
70
  return observations.flat();
69
71
  } catch (ex) {
70
72
  const error = ex;
@@ -73,6 +75,13 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
73
75
  }
74
76
  }
75
77
  };
78
+ __name(_EvmAbiImplementedDiviner, "EvmAbiImplementedDiviner");
79
+ __publicField(_EvmAbiImplementedDiviner, "configSchemas", [
80
+ ...__superGet(_EvmAbiImplementedDiviner, _EvmAbiImplementedDiviner, "configSchemas"),
81
+ EvmAbiImplementedDivinerConfigSchema
82
+ ]);
83
+ __publicField(_EvmAbiImplementedDiviner, "defaultConfigSchema", EvmAbiImplementedDivinerConfigSchema);
84
+ var EvmAbiImplementedDiviner = _EvmAbiImplementedDiviner;
76
85
  // Annotate the CommonJS export names for ESM import in node:
77
86
  0 && (module.exports = {
78
87
  EvmAbiImplementedDiviner,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.js'\nexport * from './Payload.js'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,wCAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AAzBZ;AA0BI,eAAO,yBAAS,UAAK,WAAL,mBAAa,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,WAAO,4CAAmC,6CAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,wBAAU,KAAK,GAAG;AAChD,gBAAM,eAAW,wBAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner.ts'\nexport * from './Payload.ts'\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,oBAAyB;AACzB,8BAAgC;AAEhC,kCAA+C;AAE/C,2BAA8C;AAC9C,oBAA0B;;;ACDnB,IAAMA,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,4BAAN,MAAMA,kCAAkHC,wCAAAA;EAQ7H,IAAIC,MAAM;AAzBZ;AA0BI,eAAOC,yBAAS,UAAKC,WAAL,mBAAaF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,WAAOC,4CAAmCC,6CAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,wBAAU,KAAKhB,GAAG;AAChD,cAAMiB,eAAWhB,wBAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;AA1C+HhC;AAK7H,cALWD,2BAKcsC,iBAA0B;KAAI,iEAAMA;EAAevC;;AAC5E,cANWC,2BAMcuC,uBAA8BxC;AANlD,IAAMC,2BAAN;","names":["EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message","configSchemas","defaultConfigSchema"]}
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './Diviner.js';
2
- export * from './Payload.js';
1
+ export * from './Diviner.ts';
2
+ export * from './Payload.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,64 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __reflectGet = Reflect.get;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
8
+
9
+ // src/Diviner.ts
10
+ import { assertEx } from "@xylabs/assert";
11
+ import { AbstractDiviner } from "@xyo-network/diviner-abstract";
12
+ import { EvmContractSchema } from "@xyo-network/evm-contract-witness";
13
+ import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
14
+ import { Interface } from "ethers";
15
+
16
+ // src/Payload.ts
17
+ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
18
+
19
+ // src/Diviner.ts
20
+ var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
21
+ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends AbstractDiviner {
22
+ get abi() {
23
+ var _a;
24
+ return assertEx((_a = this.config) == null ? void 0 : _a.abi, () => "No ABI specified");
25
+ }
26
+ async divineHandler(inPayloads = []) {
27
+ await this.started("throw");
28
+ try {
29
+ const observations = await Promise.all(inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
30
+ const contractInterface = new Interface(this.abi);
31
+ const byteCode = assertEx(code, () => "Missing code");
32
+ const results = [];
33
+ contractInterface.forEachFunction(({ selector }) => {
34
+ const observation = {
35
+ address,
36
+ implemented: byteCode.includes(BigInt(selector).toString(16)),
37
+ schema: EvmFunctionImplementedSchema,
38
+ selector
39
+ };
40
+ results.push(observation);
41
+ });
42
+ return results;
43
+ }));
44
+ return observations.flat();
45
+ } catch (ex) {
46
+ const error = ex;
47
+ console.log(`Error [${this.config.name}]: ${error.message}`);
48
+ throw error;
49
+ }
50
+ }
51
+ };
52
+ __name(_EvmAbiImplementedDiviner, "EvmAbiImplementedDiviner");
53
+ __publicField(_EvmAbiImplementedDiviner, "configSchemas", [
54
+ ...__superGet(_EvmAbiImplementedDiviner, _EvmAbiImplementedDiviner, "configSchemas"),
55
+ EvmAbiImplementedDivinerConfigSchema
56
+ ]);
57
+ __publicField(_EvmAbiImplementedDiviner, "defaultConfigSchema", EvmAbiImplementedDivinerConfigSchema);
58
+ var EvmAbiImplementedDiviner = _EvmAbiImplementedDiviner;
59
+ export {
60
+ EvmAbiImplementedDiviner,
61
+ EvmAbiImplementedDivinerConfigSchema,
62
+ EvmFunctionImplementedSchema
63
+ };
64
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAsB,yBAAyB;AAE/C,SAAS,6BAAqC;AAC9C,SAAS,iBAAiB;;;ACDnB,IAAM,+BAA+B;;;ADKrC,IAAM,uCAAuC;AAO7C,IAAM,2BAAN,cAAwH,gBAI7H;AAAA,EACA,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oCAAoC;AAAA,EAChH,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,MAAM;AACR,WAAO,SAAS,KAAK,QAAQ,KAAK,MAAM,kBAAkB;AAAA,EAC5D;AAAA,EAEA,MAAyB,cAAc,aAA4B,CAAC,GAAsC;AACxG,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAmC,iBAAiB,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClG,gBAAM,oBAAoB,IAAI,UAAU,KAAK,GAAG;AAChD,gBAAM,WAAW,SAAS,MAAM,MAAM,cAAc;AAEpD,gBAAM,UAAoC,CAAC;AAE3C,4BAAkB,gBAAgB,CAAC,EAAE,SAAS,MAAM;AAClD,kBAAM,cAAsC;AAAA,cAC1C;AAAA,cACA,aAAa,SAAS,SAAS,OAAO,QAAQ,EAAE,SAAS,EAAE,CAAC;AAAA,cAC5D,QAAQ;AAAA,cACR;AAAA,YACF;AACA,oBAAQ,KAAK,WAAW;AAAA,UAC1B,CAAC;AAED,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO,aAAa,KAAK;AAAA,IAC3B,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { EvmContract, EvmContractSchema } from '@xyo-network/evm-contract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'\nimport { Interface } from 'ethers'\n\nimport { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'\n\nexport const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'\nexport type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema\n\nexport type EvmAbiImplementedDivinerConfig = DivinerConfig<{ abi?: InterfaceAbi; schema: EvmAbiImplementedDivinerConfigSchema }>\n\nexport type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>\n\nexport class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<\n TParams,\n EvmContract,\n EvmFunctionImplemented\n> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema\n\n get abi() {\n return assertEx(this.config?.abi, () => 'No ABI specified')\n }\n\n protected override async divineHandler(inPayloads: EvmContract[] = []): Promise<EvmFunctionImplemented[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<EvmContract>(EvmContractSchema)).map(({ address, code }) => {\n const contractInterface = new Interface(this.abi)\n const byteCode = assertEx(code, () => 'Missing code')\n\n const results: EvmFunctionImplemented[] = []\n\n contractInterface.forEachFunction(({ selector }) => {\n const observation: EvmFunctionImplemented = {\n address,\n implemented: byteCode.includes(BigInt(selector).toString(16)),\n schema: EvmFunctionImplementedSchema,\n selector,\n }\n results.push(observation)\n })\n\n return results\n }),\n )\n return observations.flat()\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n","import { Payload } from '@xyo-network/payload-model'\nimport { JsonFragment } from 'ethers'\n\nexport type InterfaceAbi = ReadonlyArray<JsonFragment>\n\nexport const EvmFunctionImplementedSchema = 'network.xyo.evm.function.implemented'\nexport type EvmFunctionImplementedSchema = typeof EvmFunctionImplementedSchema\n\nexport type EvmFunctionImplemented = Payload<\n {\n address: string\n implemented: boolean\n selector: string\n },\n EvmFunctionImplementedSchema\n>\n"],"mappings":";;;;;;;;;AAAA,SAASA,gBAAgB;AACzB,SAASC,uBAAuB;AAEhC,SAAsBC,yBAAyB;AAE/C,SAASC,6BAAqC;AAC9C,SAASC,iBAAiB;;;ACDnB,IAAMC,+BAA+B;;;ADKrC,IAAMC,uCAAuC;AAO7C,IAAMC,4BAAN,MAAMA,kCAAkHC,gBAAAA;EAQ7H,IAAIC,MAAM;AAzBZ;AA0BI,WAAOC,UAAS,UAAKC,WAAL,mBAAaF,KAAK,MAAM,kBAAA;EAC1C;EAEA,MAAyBG,cAAcC,aAA4B,CAAA,GAAuC;AACxG,UAAM,KAAKC,QAAQ,OAAA;AACnB,QAAI;AACF,YAAMC,eAAe,MAAMC,QAAQC,IACjCJ,WAAWK,OAAOC,sBAAmCC,iBAAAA,CAAAA,EAAoBC,IAAI,CAAC,EAAEC,SAASC,KAAI,MAAE;AAC7F,cAAMC,oBAAoB,IAAIC,UAAU,KAAKhB,GAAG;AAChD,cAAMiB,WAAWhB,SAASa,MAAM,MAAM,cAAA;AAEtC,cAAMI,UAAoC,CAAA;AAE1CH,0BAAkBI,gBAAgB,CAAC,EAAEC,SAAQ,MAAE;AAC7C,gBAAMC,cAAsC;YAC1CR;YACAS,aAAaL,SAASM,SAASC,OAAOJ,QAAAA,EAAUK,SAAS,EAAA,CAAA;YACzDC,QAAQC;YACRP;UACF;AACAF,kBAAQU,KAAKP,WAAAA;QACf,CAAA;AAEA,eAAOH;MACT,CAAA,CAAA;AAEF,aAAOZ,aAAauB,KAAI;IAC1B,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAK/B,OAAOgC,IAAI,MAAMH,MAAMI,OAAO,EAAE;AAC3D,YAAMJ;IACR;EACF;AACF;AA1C+HhC;AAK7H,cALWD,2BAKcsC,iBAA0B;KAAI,iEAAMA;EAAevC;;AAC5E,cANWC,2BAMcuC,uBAA8BxC;AANlD,IAAMC,2BAAN;","names":["assertEx","AbstractDiviner","EvmContractSchema","isPayloadOfSchemaType","Interface","EvmFunctionImplementedSchema","EvmAbiImplementedDivinerConfigSchema","EvmAbiImplementedDiviner","AbstractDiviner","abi","assertEx","config","divineHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","EvmContractSchema","map","address","code","contractInterface","Interface","byteCode","results","forEachFunction","selector","observation","implemented","includes","BigInt","toString","schema","EvmFunctionImplementedSchema","push","flat","ex","error","console","log","name","message","configSchemas","defaultConfigSchema"]}
package/package.json CHANGED
@@ -10,22 +10,22 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^3.6.1",
14
- "@xyo-network/diviner-abstract": "^2.110.6",
15
- "@xyo-network/diviner-model": "^2.110.6",
16
- "@xyo-network/evm-contract-witness": "^2.99.4",
17
- "@xyo-network/module-model": "^2.110.6",
18
- "@xyo-network/payload-model": "^2.110.6",
19
- "ethers": "^6.13.1"
13
+ "@xylabs/assert": "^3.6.8",
14
+ "@xyo-network/diviner-abstract": "^2.111.2",
15
+ "@xyo-network/diviner-model": "^2.111.2",
16
+ "@xyo-network/evm-contract-witness": "^2.99.5",
17
+ "@xyo-network/module-model": "^2.111.2",
18
+ "@xyo-network/payload-model": "^2.111.2",
19
+ "ethers": "^6.13.2"
20
20
  },
21
21
  "devDependencies": {
22
- "@xylabs/jest-helpers": "^3.6.1",
23
- "@xylabs/ts-scripts-yarn3": "^3.12.2",
24
- "@xylabs/tsconfig": "^3.12.2",
22
+ "@xylabs/jest-helpers": "^3.6.8",
23
+ "@xylabs/ts-scripts-yarn3": "^3.15.13",
24
+ "@xylabs/tsconfig": "^3.15.13",
25
25
  "@xyo-network/open-zeppelin-typechain": "^3.0.5",
26
- "@xyo-network/witness-evm-abstract": "^2.110.6",
26
+ "@xyo-network/witness-evm-abstract": "^2.111.2",
27
27
  "jest": "^29.7.0",
28
- "typescript": "^5.5.3"
28
+ "typescript": "^5.5.4"
29
29
  },
30
30
  "description": "Typescript/Javascript Plugins for XYO Platform",
31
31
  "types": "dist/node/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "import": {
40
40
  "types": "./dist/browser/index.d.mts",
41
- "default": "./dist/browser/index.js"
41
+ "default": "./dist/browser/index.mjs"
42
42
  }
43
43
  },
44
44
  "node": {
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "import": {
50
50
  "types": "./dist/node/index.d.mts",
51
- "default": "./dist/node/index.js"
51
+ "default": "./dist/node/index.mjs"
52
52
  }
53
53
  }
54
54
  },
55
55
  "./package.json": "./package.json"
56
56
  },
57
57
  "main": "dist/node/index.cjs",
58
- "module": "dist/node/index.js",
58
+ "module": "dist/node/index.mjs",
59
59
  "homepage": "https://xyo.network",
60
60
  "license": "LGPL-3.0-only",
61
61
  "publishConfig": {
@@ -66,6 +66,6 @@
66
66
  "url": "https://github.com/XYOracleNetwork/plugins.git"
67
67
  },
68
68
  "sideEffects": false,
69
- "version": "2.99.4",
69
+ "version": "2.99.5",
70
70
  "type": "module"
71
71
  }
package/src/Diviner.ts CHANGED
@@ -6,7 +6,7 @@ import { AnyConfigSchema } from '@xyo-network/module-model'
6
6
  import { isPayloadOfSchemaType, Schema } from '@xyo-network/payload-model'
7
7
  import { Interface } from 'ethers'
8
8
 
9
- import { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.js'
9
+ import { EvmFunctionImplemented, EvmFunctionImplementedSchema, InterfaceAbi } from './Payload.ts'
10
10
 
11
11
  export const EvmAbiImplementedDivinerConfigSchema = 'network.xyo.evm.abi.implemented.diviner.config'
12
12
  export type EvmAbiImplementedDivinerConfigSchema = typeof EvmAbiImplementedDivinerConfigSchema
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './Diviner.js'
2
- export * from './Payload.js'
1
+ export * from './Diviner.ts'
2
+ export * from './Payload.ts'
@@ -1,53 +0,0 @@
1
- // src/Diviner.ts
2
- import { assertEx } from "@xylabs/assert";
3
- import { AbstractDiviner } from "@xyo-network/diviner-abstract";
4
- import { EvmContractSchema } from "@xyo-network/evm-contract-witness";
5
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
6
- import { Interface } from "ethers";
7
-
8
- // src/Payload.ts
9
- var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
10
-
11
- // src/Diviner.ts
12
- var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
13
- var EvmAbiImplementedDiviner = class extends AbstractDiviner {
14
- static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
15
- static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
16
- get abi() {
17
- var _a;
18
- return assertEx((_a = this.config) == null ? void 0 : _a.abi, () => "No ABI specified");
19
- }
20
- async divineHandler(inPayloads = []) {
21
- await this.started("throw");
22
- try {
23
- const observations = await Promise.all(
24
- inPayloads.filter(isPayloadOfSchemaType(EvmContractSchema)).map(({ address, code }) => {
25
- const contractInterface = new Interface(this.abi);
26
- const byteCode = assertEx(code, () => "Missing code");
27
- const results = [];
28
- contractInterface.forEachFunction(({ selector }) => {
29
- const observation = {
30
- address,
31
- implemented: byteCode.includes(BigInt(selector).toString(16)),
32
- schema: EvmFunctionImplementedSchema,
33
- selector
34
- };
35
- results.push(observation);
36
- });
37
- return results;
38
- })
39
- );
40
- return observations.flat();
41
- } catch (ex) {
42
- const error = ex;
43
- console.log(`Error [${this.config.name}]: ${error.message}`);
44
- throw error;
45
- }
46
- }
47
- };
48
- export {
49
- EvmAbiImplementedDiviner,
50
- EvmAbiImplementedDivinerConfigSchema,
51
- EvmFunctionImplementedSchema
52
- };
53
- //# sourceMappingURL=index.js.map