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

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,6 @@ 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 });
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -40,13 +39,7 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
40
39
  // src/Diviner.ts
41
40
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
42
41
  var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
43
- static {
44
- __name(this, "EvmAbiImplementedDiviner");
45
- }
46
- static configSchemas = [
47
- ...super.configSchemas,
48
- EvmAbiImplementedDivinerConfigSchema
49
- ];
42
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
50
43
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
51
44
  get abi() {
52
45
  return (0, import_assert.assertEx)(this.config?.abi, () => "No ABI specified");
@@ -54,21 +47,23 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
54
47
  async divineHandler(inPayloads = []) {
55
48
  await this.started("throw");
56
49
  try {
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
- }));
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
+ );
72
67
  return observations.flat();
73
68
  } catch (ex) {
74
69
  const error = ex;
@@ -1 +1 @@
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
+ {"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;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,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/Diviner.ts
5
2
  import { assertEx } from "@xylabs/assert";
6
3
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
@@ -14,13 +11,7 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
14
11
  // src/Diviner.ts
15
12
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
16
13
  var EvmAbiImplementedDiviner = class extends AbstractDiviner {
17
- static {
18
- __name(this, "EvmAbiImplementedDiviner");
19
- }
20
- static configSchemas = [
21
- ...super.configSchemas,
22
- EvmAbiImplementedDivinerConfigSchema
23
- ];
14
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
24
15
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
25
16
  get abi() {
26
17
  return assertEx(this.config?.abi, () => "No ABI specified");
@@ -28,21 +19,23 @@ var EvmAbiImplementedDiviner = class extends AbstractDiviner {
28
19
  async divineHandler(inPayloads = []) {
29
20
  await this.started("throw");
30
21
  try {
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
- }));
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
+ );
46
39
  return observations.flat();
47
40
  } catch (ex) {
48
41
  const error = ex;
@@ -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.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"]}
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,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":[]}
@@ -3,7 +3,6 @@ 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 });
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -40,13 +39,7 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
40
39
  // src/Diviner.ts
41
40
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
42
41
  var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
43
- static {
44
- __name(this, "EvmAbiImplementedDiviner");
45
- }
46
- static configSchemas = [
47
- ...super.configSchemas,
48
- EvmAbiImplementedDivinerConfigSchema
49
- ];
42
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
50
43
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
51
44
  get abi() {
52
45
  return (0, import_assert.assertEx)(this.config?.abi, () => "No ABI specified");
@@ -54,21 +47,23 @@ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiv
54
47
  async divineHandler(inPayloads = []) {
55
48
  await this.started("throw");
56
49
  try {
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
- }));
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
+ );
72
67
  return observations.flat();
73
68
  } catch (ex) {
74
69
  const error = ex;
@@ -1 +1 @@
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
+ {"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;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,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/Diviner.ts
5
2
  import { assertEx } from "@xylabs/assert";
6
3
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
@@ -14,13 +11,7 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
14
11
  // src/Diviner.ts
15
12
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
16
13
  var EvmAbiImplementedDiviner = class extends AbstractDiviner {
17
- static {
18
- __name(this, "EvmAbiImplementedDiviner");
19
- }
20
- static configSchemas = [
21
- ...super.configSchemas,
22
- EvmAbiImplementedDivinerConfigSchema
23
- ];
14
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
24
15
  static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
25
16
  get abi() {
26
17
  return assertEx(this.config?.abi, () => "No ABI specified");
@@ -28,21 +19,23 @@ var EvmAbiImplementedDiviner = class extends AbstractDiviner {
28
19
  async divineHandler(inPayloads = []) {
29
20
  await this.started("throw");
30
21
  try {
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
- }));
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
+ );
46
39
  return observations.flat();
47
40
  } catch (ex) {
48
41
  const error = ex;
@@ -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.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"]}
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,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":[]}
@@ -2,11 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
5
  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 });
10
6
  var __export = (target, all) => {
11
7
  for (var name in all)
12
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,8 +16,6 @@ var __copyProps = (to, from, except, desc) => {
20
16
  return to;
21
17
  };
22
18
  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);
25
19
 
26
20
  // src/index.ts
27
21
  var src_exports = {};
@@ -44,7 +38,9 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
44
38
 
45
39
  // src/Diviner.ts
46
40
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
47
- var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends import_diviner_abstract.AbstractDiviner {
41
+ var EvmAbiImplementedDiviner = class extends import_diviner_abstract.AbstractDiviner {
42
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
43
+ static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
48
44
  get abi() {
49
45
  var _a;
50
46
  return (0, import_assert.assertEx)((_a = this.config) == null ? void 0 : _a.abi, () => "No ABI specified");
@@ -52,21 +48,23 @@ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends import_d
52
48
  async divineHandler(inPayloads = []) {
53
49
  await this.started("throw");
54
50
  try {
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
- }));
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
+ );
70
68
  return observations.flat();
71
69
  } catch (ex) {
72
70
  const error = ex;
@@ -75,13 +73,6 @@ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends import_d
75
73
  }
76
74
  }
77
75
  };
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;
85
76
  // Annotate the CommonJS export names for ESM import in node:
86
77
  0 && (module.exports = {
87
78
  EvmAbiImplementedDiviner,
@@ -1 +1 @@
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
+ {"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;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,11 +1,3 @@
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
1
  // src/Diviner.ts
10
2
  import { assertEx } from "@xylabs/assert";
11
3
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
@@ -18,7 +10,9 @@ var EvmFunctionImplementedSchema = "network.xyo.evm.function.implemented";
18
10
 
19
11
  // src/Diviner.ts
20
12
  var EvmAbiImplementedDivinerConfigSchema = "network.xyo.evm.abi.implemented.diviner.config";
21
- var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends AbstractDiviner {
13
+ var EvmAbiImplementedDiviner = class extends AbstractDiviner {
14
+ static configSchemas = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema];
15
+ static defaultConfigSchema = EvmAbiImplementedDivinerConfigSchema;
22
16
  get abi() {
23
17
  var _a;
24
18
  return assertEx((_a = this.config) == null ? void 0 : _a.abi, () => "No ABI specified");
@@ -26,21 +20,23 @@ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends Abstract
26
20
  async divineHandler(inPayloads = []) {
27
21
  await this.started("throw");
28
22
  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
- }));
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
+ );
44
40
  return observations.flat();
45
41
  } catch (ex) {
46
42
  const error = ex;
@@ -49,13 +45,6 @@ var _EvmAbiImplementedDiviner = class _EvmAbiImplementedDiviner extends Abstract
49
45
  }
50
46
  }
51
47
  };
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
48
  export {
60
49
  EvmAbiImplementedDiviner,
61
50
  EvmAbiImplementedDivinerConfigSchema,
@@ -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.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"]}
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,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":[]}
package/package.json CHANGED
@@ -10,20 +10,20 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
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",
13
+ "@xylabs/assert": "^3.6.12",
14
+ "@xyo-network/diviner-abstract": "^2.111.3",
15
+ "@xyo-network/diviner-model": "^2.111.3",
16
+ "@xyo-network/evm-contract-witness": "^2.99.6",
17
+ "@xyo-network/module-model": "^2.111.3",
18
+ "@xyo-network/payload-model": "^2.111.3",
19
19
  "ethers": "^6.13.2"
20
20
  },
21
21
  "devDependencies": {
22
- "@xylabs/jest-helpers": "^3.6.8",
23
- "@xylabs/ts-scripts-yarn3": "^3.15.13",
24
- "@xylabs/tsconfig": "^3.15.13",
25
- "@xyo-network/open-zeppelin-typechain": "^3.0.5",
26
- "@xyo-network/witness-evm-abstract": "^2.111.2",
22
+ "@xylabs/jest-helpers": "^3.6.12",
23
+ "@xylabs/ts-scripts-yarn3": "^3.15.14",
24
+ "@xylabs/tsconfig": "^3.15.14",
25
+ "@xyo-network/open-zeppelin-typechain": "^3.1.0",
26
+ "@xyo-network/witness-evm-abstract": "^2.111.3",
27
27
  "jest": "^29.7.0",
28
28
  "typescript": "^5.5.4"
29
29
  },
@@ -66,6 +66,6 @@
66
66
  "url": "https://github.com/XYOracleNetwork/plugins.git"
67
67
  },
68
68
  "sideEffects": false,
69
- "version": "2.99.5",
69
+ "version": "2.99.6",
70
70
  "type": "module"
71
71
  }