@xyo-network/evm-abi-diviner 2.93.1 → 2.94.0
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.
- package/dist/browser/Diviner.d.cts +2 -2
- package/dist/browser/Diviner.d.cts.map +1 -1
- package/dist/browser/Diviner.d.mts +2 -2
- package/dist/browser/Diviner.d.mts.map +1 -1
- package/dist/browser/Diviner.d.ts +2 -2
- package/dist/browser/Diviner.d.ts.map +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Diviner.d.cts +2 -2
- package/dist/node/Diviner.d.cts.map +1 -1
- package/dist/node/Diviner.d.mts +2 -2
- package/dist/node/Diviner.d.mts.map +1 -1
- package/dist/node/Diviner.d.ts +2 -2
- package/dist/node/Diviner.d.ts.map +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +9 -9
- package/src/Diviner.ts +2 -2
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,O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,MAAM,MAAM,oCAAoC,GAAG,OAAO,oCAAoC,CAAA;AAE9F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,oCAAoC,CAAA;CAAE,CAAC,CAAA;AAEhI,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE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AM,oCAAoC,GAAG,OAAO,oCAAoC,CAAA;AAE9F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,oCAAoC,CAAA;CAAE,CAAC,CAAA;AAEhI,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EA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C,GAAG,OAAO,oCAAoC,CAAA;AAE9F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,oCAAoC,CAAA;CAAE,CAAC,CAAA;AAEhI,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './Payload'\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'\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 configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override 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,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './Payload'\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'\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 +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'\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 configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override 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,
|
|
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'\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":[]}
|
package/dist/node/Diviner.d.cts
CHANGED
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,WAAW,EAAqB,MAAM,mCAAmC,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAyB,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG1E,OAAO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AAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
package/dist/node/Diviner.d.mts
CHANGED
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,WAAW,EAAqB,MAAM,mCAAmC,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAyB,MAAM,EAAE,MAAM,4BAA4B,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C,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
package/dist/node/Diviner.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export type EvmAbiImplementedDivinerConfig = DivinerConfig<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type EvmAbiImplementedDivinerParams = DivinerParams<AnyConfigSchema<EvmAbiImplementedDivinerConfig>>;
|
|
14
14
|
export declare class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerParams = EvmAbiImplementedDivinerParams> extends AbstractDiviner<TParams, EvmContract, EvmFunctionImplemented> {
|
|
15
|
-
static configSchemas: Schema[];
|
|
16
|
-
static defaultConfigSchema: Schema;
|
|
15
|
+
static readonly configSchemas: Schema[];
|
|
16
|
+
static readonly defaultConfigSchema: Schema;
|
|
17
17
|
get abi(): InterfaceAbi;
|
|
18
18
|
protected divineHandler(inPayloads?: EvmContract[]): Promise<EvmFunctionImplemented[]>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,WAAW,EAAqB,MAAM,mCAAmC,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAyB,MAAM,EA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8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,CAAE,SAAQ,eAAe,CAC5I,OAAO,EACP,WAAW,EACX,sBAAsB,CACvB;IACC,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,IAAI,GAAG,iBAEN;cAEwB,aAAa,CAAC,UAAU,GAAE,WAAW,EAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CA8B1G"}
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './Payload'\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'\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 configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override 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,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Diviner.ts","../../src/Payload.ts"],"sourcesContent":["export * from './Diviner'\nexport * from './Payload'\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'\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":[]}
|
package/dist/node/index.js.map
CHANGED
|
@@ -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'\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 configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]\n static override 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,
|
|
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'\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.1.
|
|
14
|
-
"@xyo-network/diviner-abstract": "^2.
|
|
15
|
-
"@xyo-network/diviner-model": "^2.
|
|
16
|
-
"@xyo-network/evm-contract-witness": "~2.
|
|
17
|
-
"@xyo-network/module-model": "^2.
|
|
18
|
-
"@xyo-network/payload-model": "^2.
|
|
13
|
+
"@xylabs/assert": "^3.1.11",
|
|
14
|
+
"@xyo-network/diviner-abstract": "^2.99.0",
|
|
15
|
+
"@xyo-network/diviner-model": "^2.99.0",
|
|
16
|
+
"@xyo-network/evm-contract-witness": "~2.94.0",
|
|
17
|
+
"@xyo-network/module-model": "^2.99.0",
|
|
18
|
+
"@xyo-network/payload-model": "^2.99.0",
|
|
19
19
|
"ethers": "^6.12.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@xylabs/jest-helpers": "^3.1.
|
|
22
|
+
"@xylabs/jest-helpers": "^3.1.11",
|
|
23
23
|
"@xylabs/ts-scripts-yarn3": "^3.9.1",
|
|
24
24
|
"@xylabs/tsconfig": "^3.9.1",
|
|
25
25
|
"@xyo-network/open-zeppelin-typechain": "^3.0.5",
|
|
26
|
-
"@xyo-network/witness-evm-abstract": "^2.
|
|
26
|
+
"@xyo-network/witness-evm-abstract": "^2.99.0",
|
|
27
27
|
"jest": "^29.7.0",
|
|
28
28
|
"typescript": "^5.4.5"
|
|
29
29
|
},
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"url": "https://github.com/XYOracleNetwork/plugins.git"
|
|
67
67
|
},
|
|
68
68
|
"sideEffects": false,
|
|
69
|
-
"version": "2.
|
|
69
|
+
"version": "2.94.0",
|
|
70
70
|
"type": "module"
|
|
71
71
|
}
|
package/src/Diviner.ts
CHANGED
|
@@ -20,8 +20,8 @@ export class EvmAbiImplementedDiviner<TParams extends EvmAbiImplementedDivinerPa
|
|
|
20
20
|
EvmContract,
|
|
21
21
|
EvmFunctionImplemented
|
|
22
22
|
> {
|
|
23
|
-
static override configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]
|
|
24
|
-
static override defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema
|
|
23
|
+
static override readonly configSchemas: Schema[] = [...super.configSchemas, EvmAbiImplementedDivinerConfigSchema]
|
|
24
|
+
static override readonly defaultConfigSchema: Schema = EvmAbiImplementedDivinerConfigSchema
|
|
25
25
|
|
|
26
26
|
get abi() {
|
|
27
27
|
return assertEx(this.config?.abi, () => 'No ABI specified')
|