@xyo-network/crypto-contract-function-read-plugin 5.4.6 → 5.4.9
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/Plugin.d.ts +1 -1
- package/dist/browser/Plugin.d.ts.map +1 -1
- package/dist/browser/Witness.d.ts +1 -1
- package/dist/browser/Witness.d.ts.map +1 -1
- package/dist/browser/index.mjs +2 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/neutral/Plugin.d.ts +1 -1
- package/dist/neutral/Plugin.d.ts.map +1 -1
- package/dist/neutral/Witness.d.ts +1 -1
- package/dist/neutral/Witness.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -2
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/Plugin.d.ts +1 -1
- package/dist/node/Plugin.d.ts.map +1 -1
- package/dist/node/Witness.d.ts +1 -1
- package/dist/node/Witness.d.ts.map +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/node/index.mjs.map +1 -1
- package/package.json +110 -95
package/dist/browser/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CryptoContractFunctionReadWitness } from './Witness.ts';
|
|
2
2
|
/** @deprecated use EvmCallWitness instead */
|
|
3
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/
|
|
3
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/sdk-js").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("./Witness.ts").CryptoContractFunctionReadWitnessParams>>;
|
|
4
4
|
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,gKAUjD,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
1
|
import type { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
2
|
import type { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
3
|
import type { Schema } from '@xyo-network/payload-model';
|
|
4
|
+
import { AbstractWitness } from '@xyo-network/witness-abstract';
|
|
5
5
|
import type { WitnessParams } from '@xyo-network/witness-model';
|
|
6
6
|
import type { InterfaceAbi, Provider } from 'ethers';
|
|
7
7
|
/** @deprecated use EvmCallWitness instead */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAE1B,gCAAgC,EAEhC,uCAAuC,EACxC,MAAM,2DAA2D,CAAA;AAMlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGpD,6CAA6C;AAC7C,MAAM,WAAW,uCAAwC,SAAQ,aAAa,CAC5E,eAAe,CAAC,uCAAuC,CAAC,CAAC;IAEzD,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,6CAA6C;AAC7C,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA0E;IAC1H,gBAAyB,mBAAmB,EAAE,MAAM,CAAgD;IAEpG,IAAI,GAAG,IACoD,YAAY,CACtE;cAEwB,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CAgDpI"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -65,17 +65,17 @@ var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner
|
|
|
65
65
|
// src/Plugin.ts
|
|
66
66
|
import { NftSchema } from "@xyo-network/crypto-nft-payload-plugin";
|
|
67
67
|
import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
68
|
-
import { createPayloadSetWitnessPlugin } from "@xyo-network/
|
|
68
|
+
import { createPayloadSetWitnessPlugin } from "@xyo-network/sdk-js";
|
|
69
69
|
|
|
70
70
|
// src/Witness.ts
|
|
71
71
|
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
72
|
-
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
73
72
|
import {
|
|
74
73
|
CryptoContractFunctionCallResultSchema as CryptoContractFunctionCallResultSchema2,
|
|
75
74
|
CryptoContractFunctionCallSchema,
|
|
76
75
|
CryptoContractFunctionReadWitnessConfigSchema
|
|
77
76
|
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
78
77
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
78
|
+
import { AbstractWitness } from "@xyo-network/witness-abstract";
|
|
79
79
|
import { Contract } from "ethers";
|
|
80
80
|
var CryptoContractFunctionReadWitness = class extends AbstractWitness {
|
|
81
81
|
static configSchemas = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,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O,SAAS,EAAE,IAAI;AAC7E,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,cAAc;AAAA,cACd,QAAQ;AAAA,cACR,QAAQC;AAAA,YACV;AACA,mBAAO;AAAA,UACT,SAAS,IAAI;AACX,kBAAM,QAAQ;AACd,oBAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,IAAI,EAAE;AACxD,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/sdk-js'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness-abstract'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,gBAAgB,QAAQ,YAAY,OAAO;AAClH,WAAO,oCAAoC,YAAY,GAAG;AAAA,EAC5D;AAAA,EAEA,OAAiB,sBAA+D,MAAW,OAA+B;AACxH,UAAM,gBAAgB,KAAK,GAAG,CAAC,IAAI,KAAK;AAExC,UAAM,cAAc,KAAK,OAAO,CAAC,MAAM,QAAQ;AAC7C,aAAO,QAAQ,IAAI,KAAK,MAAM;AAAA,IAChC,GAAG,KAAK;AACR,WAAO,cAAc,SAAY;AAAA,EACnC;AAAA,EAEU,2BAA2B,aAA+D;AAClG,WAAO;AAAA,MACL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,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
package/dist/neutral/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CryptoContractFunctionReadWitness } from './Witness.ts';
|
|
2
2
|
/** @deprecated use EvmCallWitness instead */
|
|
3
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/
|
|
3
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/sdk-js").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("./Witness.ts").CryptoContractFunctionReadWitnessParams>>;
|
|
4
4
|
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,gKAUjD,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
1
|
import type { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
2
|
import type { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
3
|
import type { Schema } from '@xyo-network/payload-model';
|
|
4
|
+
import { AbstractWitness } from '@xyo-network/witness-abstract';
|
|
5
5
|
import type { WitnessParams } from '@xyo-network/witness-model';
|
|
6
6
|
import type { InterfaceAbi, Provider } from 'ethers';
|
|
7
7
|
/** @deprecated use EvmCallWitness instead */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAE1B,gCAAgC,EAEhC,uCAAuC,EACxC,MAAM,2DAA2D,CAAA;AAMlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGpD,6CAA6C;AAC7C,MAAM,WAAW,uCAAwC,SAAQ,aAAa,CAC5E,eAAe,CAAC,uCAAuC,CAAC,CAAC;IAEzD,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,6CAA6C;AAC7C,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA0E;IAC1H,gBAAyB,mBAAmB,EAAE,MAAM,CAAgD;IAEpG,IAAI,GAAG,IACoD,YAAY,CACtE;cAEwB,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CAgDpI"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -65,17 +65,17 @@ var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner
|
|
|
65
65
|
// src/Plugin.ts
|
|
66
66
|
import { NftSchema } from "@xyo-network/crypto-nft-payload-plugin";
|
|
67
67
|
import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
68
|
-
import { createPayloadSetWitnessPlugin } from "@xyo-network/
|
|
68
|
+
import { createPayloadSetWitnessPlugin } from "@xyo-network/sdk-js";
|
|
69
69
|
|
|
70
70
|
// src/Witness.ts
|
|
71
71
|
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
72
|
-
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
73
72
|
import {
|
|
74
73
|
CryptoContractFunctionCallResultSchema as CryptoContractFunctionCallResultSchema2,
|
|
75
74
|
CryptoContractFunctionCallSchema,
|
|
76
75
|
CryptoContractFunctionReadWitnessConfigSchema
|
|
77
76
|
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
78
77
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
78
|
+
import { AbstractWitness } from "@xyo-network/witness-abstract";
|
|
79
79
|
import { Contract } from "ethers";
|
|
80
80
|
var CryptoContractFunctionReadWitness = class extends AbstractWitness {
|
|
81
81
|
static configSchemas = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,gBAAgB,QAAQ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IAAI;AAC7E,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,cAAc;AAAA,cACd,QAAQ;AAAA,cACR,QAAQC;AAAA,YACV;AACA,mBAAO;AAAA,UACT,SAAS,IAAI;AACX,kBAAM,QAAQ;AACd,oBAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,IAAI,EAAE;AACxD,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/sdk-js'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness-abstract'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,gBAAgB,QAAQ,YAAY,OAAO;AAClH,WAAO,oCAAoC,YAAY,GAAG;AAAA,EAC5D;AAAA,EAEA,OAAiB,sBAA+D,MAAW,OAA+B;AACxH,UAAM,gBAAgB,KAAK,GAAG,CAAC,IAAI,KAAK;AAExC,UAAM,cAAc,KAAK,OAAO,CAAC,MAAM,QAAQ;AAC7C,aAAO,QAAQ,IAAI,KAAK,MAAM;AAAA,IAChC,GAAG,KAAK;AACR,WAAO,cAAc,SAAY;AAAA,EACnC;AAAA,EAEU,2BAA2B,aAA+D;AAClG,WAAO;AAAA,MACL,SAAS,SAAS,u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AA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
package/dist/node/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CryptoContractFunctionReadWitness } from './Witness.ts';
|
|
2
2
|
/** @deprecated use EvmCallWitness instead */
|
|
3
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/
|
|
3
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/sdk-js").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("./Witness.ts").CryptoContractFunctionReadWitnessParams>>;
|
|
4
4
|
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAA;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,uCAAuC,gKAUjD,CAAA"}
|
package/dist/node/Witness.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
1
|
import type { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
2
|
import type { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
3
|
import type { Schema } from '@xyo-network/payload-model';
|
|
4
|
+
import { AbstractWitness } from '@xyo-network/witness-abstract';
|
|
5
5
|
import type { WitnessParams } from '@xyo-network/witness-model';
|
|
6
6
|
import type { InterfaceAbi, Provider } from 'ethers';
|
|
7
7
|
/** @deprecated use EvmCallWitness instead */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAE1B,gCAAgC,EAEhC,uCAAuC,EACxC,MAAM,2DAA2D,CAAA;AAMlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGpD,6CAA6C;AAC7C,MAAM,WAAW,uCAAwC,SAAQ,aAAa,CAC5E,eAAe,CAAC,uCAAuC,CAAC,CAAC;IAEzD,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,6CAA6C;AAC7C,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA0E;IAC1H,gBAAyB,mBAAmB,EAAE,MAAM,CAAgD;IAEpG,IAAI,GAAG,IACoD,YAAY,CACtE;cAEwB,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CAgDpI"}
|
package/dist/node/index.mjs
CHANGED
|
@@ -65,17 +65,17 @@ var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner
|
|
|
65
65
|
// src/Plugin.ts
|
|
66
66
|
import { NftSchema } from "@xyo-network/crypto-nft-payload-plugin";
|
|
67
67
|
import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
68
|
-
import { createPayloadSetWitnessPlugin } from "@xyo-network/
|
|
68
|
+
import { createPayloadSetWitnessPlugin } from "@xyo-network/sdk-js";
|
|
69
69
|
|
|
70
70
|
// src/Witness.ts
|
|
71
71
|
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
72
|
-
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
73
72
|
import {
|
|
74
73
|
CryptoContractFunctionCallResultSchema as CryptoContractFunctionCallResultSchema2,
|
|
75
74
|
CryptoContractFunctionCallSchema,
|
|
76
75
|
CryptoContractFunctionReadWitnessConfigSchema
|
|
77
76
|
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
78
77
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
78
|
+
import { AbstractWitness } from "@xyo-network/witness-abstract";
|
|
79
79
|
import { Contract } from "ethers";
|
|
80
80
|
var CryptoContractFunctionReadWitness = class extends AbstractWitness {
|
|
81
81
|
static configSchemas = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema];
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAA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O,WAAW,WAAW,OAAO,SAAS,EAAE,IAAI;AAC7E,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,cAAc;AAAA,cACd,QAAQ;AAAA,cACR,QAAQC;AAAA,YACV;AACA,mBAAO;AAAA,UACT,SAAS,IAAI;AACX,kBAAM,QAAQ;AACd,oBAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,IAAI,EAAE;AACxD,kBAAM,cAAiD;AAAA,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import type { Promisable } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n ContractInfo,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n/** @deprecated use EvmCallDiviner instead */\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\n/** @deprecated use EvmCallDiviner instead */\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractDivinerConfigSchema\n static override readonly labels: CryptoContractDivinerLabels = { ...super.labels, ...CryptoContractDivinerLabels }\n\n protected static findCallResult<TResult = string>(\n address: string,\n functionName: string,\n payloads: CryptoContractFunctionCallResult[],\n ): TResult | undefined {\n const foundPayload = payloads.find(payload => payload.functionName === functionName && payload.address === address)\n return asCryptoContractFunctionCallSuccess(foundPayload)?.result as TResult | undefined\n }\n\n protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {\n const expectedValue = objs.at(0)?.[field] as R\n // eslint-disable-next-line unicorn/no-array-reduce\n const didNotMatch = objs.reduce((prev, obj) => {\n return prev || obj[field] !== expectedValue\n }, false)\n return didNotMatch ? undefined : expectedValue\n }\n\n protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo {\n return {\n address: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'address'), () => 'Mismatched address'),\n chainId: assertEx(CryptoContractDiviner.matchingExistingField(callResults, 'chainId'), () => 'Mismatched chainId'),\n schema: ContractInfoSchema,\n }\n }\n\n protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {\n const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))\n const addresses = Object.keys(\n // eslint-disable-next-line unicorn/no-array-reduce\n callResults.reduce<Record<string, boolean>>((prev, result) => {\n if (result.address) {\n prev[result.address] = true\n }\n return prev\n }, {}),\n )\n const result = await Promise.all(\n addresses.map(async (address) => {\n const foundCallResults = callResults.filter(callResult => callResult.address === address)\n const info: ContractInfo = {\n results: await this.reduceResults(foundCallResults),\n ...this.contractInfoRequiredFields(foundCallResults),\n }\n return info\n }),\n )\n\n return result\n }\n\n protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {\n // eslint-disable-next-line unicorn/no-array-reduce\n return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/sdk-js'\n\nimport { CryptoContractFunctionReadWitness } from './Witness.ts'\n\n/** @deprecated use EvmCallWitness instead */\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\n\n createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await CryptoContractFunctionReadWitness.create(params)\n return result\n },\n },\n )\n","import type { JsonObject } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport {\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport type { AnyConfigSchema } from '@xyo-network/module-model'\nimport type { Schema } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness-abstract'\nimport type { WitnessParams } from '@xyo-network/witness-model'\nimport type { InterfaceAbi, Provider } from 'ethers'\nimport { Contract } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport interface CryptoContractFunctionReadWitnessParams extends WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>>\n{\n providers: Provider[]\n}\n\n/** @deprecated use EvmCallWitness instead */\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = CryptoContractFunctionReadWitnessConfigSchema\n\n get abi() {\n return assertEx(this.config.abi, () => 'Missing abi') as InterfaceAbi\n }\n\n protected override async observeHandler(inPayloads: CryptoContractFunctionCall[] = []): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCall>(CryptoContractFunctionCallSchema)).map(async ({\n functionName, args, address,\n }) => {\n const { providers } = this.params\n const provider = providers[Date.now() % providers.length] // pick a random provider\n const validatedAddress = assertEx(address ?? this.config.address, () => 'Missing address')\n const validatedFunctionName = assertEx(functionName ?? this.config.functionName, () => 'Missing address')\n const mergedArgs = [...(args ?? this.config.args ?? [])] as JsonObject[]\n\n const contract = new Contract(validatedAddress, this.abi, provider)\n try {\n const result = await contract[validatedFunctionName](...mergedArgs)\n const transformedResult = typeof result === 'bigint' ? result.toString(16) : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n functionName: validatedFunctionName,\n result: transformedResult,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n } catch (ex) {\n const error = ex as Error & { code: string }\n console.log(`Error [${this.config.name}]: ${error.code}`)\n const observation: CryptoContractFunctionCallFailure = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: Number((await provider.getNetwork()).chainId),\n error: error.code,\n functionName: validatedFunctionName,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\n }\n }),\n )\n return observations\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"],"mappings":";AACA,SAAS,gBAAgB;AAMzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAM/B,IAAM,wBAAN,MAAM,+BAAyG,gBAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,iCAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAyB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,4BAA4B;AAAA,EAEjH,OAAiB,eACf,SACA,cACA,UACqB;AACrB,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,gBAAgB,QAAQ,YAAY,OAAO;AAClH,WAAO,oCAAoC,YAAY,GAAG;AAAA,EAC5D;AAAA,EAEA,OAAiB,sBAA+D,MAAW,OAA+B;AACxH,UAAM,gBAAgB,KAAK,GAAG,CAAC,IAAI,KAAK;AAExC,UAAM,cAAc,KAAK,OAAO,CAAC,MAAM,QAAQ;AAC7C,aAAO,QAAQ,IAAI,KAAK,MAAM;AAAA,IAChC,GAAG,KAAK;AACR,WAAO,cAAc,SAAY;AAAA,EACnC;AAAA,EAEU,2BAA2B,aAA+D;AACl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,cACrD,SAAS;AAAA,cACT,MAAM;AAAA,cACN,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,cACrD,OAAO,MAAM;AAAA,cACb,cAAc;AAAA,cACd,QAAQA;AAAA,YACV;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;;;ADjFO,IAAM,0CAA0C,MAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/crypto-contract-function-read-plugin",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.9",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -31,109 +31,124 @@
|
|
|
31
31
|
"README.md"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@xyo-network/crypto-contract-function-read-payload-plugin": "~5.4.
|
|
35
|
-
"@xyo-network/crypto-nft-payload-plugin": "~5.4.
|
|
34
|
+
"@xyo-network/crypto-contract-function-read-payload-plugin": "~5.4.9",
|
|
35
|
+
"@xyo-network/crypto-nft-payload-plugin": "~5.4.9"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@xylabs/
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@xyo-network/
|
|
53
|
-
"@xyo-network/
|
|
54
|
-
"@xyo-network/
|
|
55
|
-
"@xyo-network/
|
|
56
|
-
"@xyo-network/
|
|
57
|
-
"@xyo-network/boundwitness-
|
|
58
|
-
"@xyo-network/
|
|
59
|
-
"@xyo-network/
|
|
60
|
-
"@xyo-network/
|
|
61
|
-
"@xyo-network/
|
|
62
|
-
"@xyo-network/
|
|
63
|
-
"@xyo-network/diviner-
|
|
64
|
-
"@xyo-network/diviner-
|
|
65
|
-
"@xyo-network/diviner-jsonpatch": "~5.
|
|
66
|
-
"@xyo-network/diviner-jsonpath-aggregate-memory": "~5.
|
|
67
|
-
"@xyo-network/diviner-
|
|
68
|
-
"@xyo-network/diviner-
|
|
69
|
-
"@xyo-network/diviner-
|
|
70
|
-
"@xyo-network/diviner-
|
|
71
|
-
"@xyo-network/diviner-
|
|
72
|
-
"@xyo-network/
|
|
73
|
-
"@xyo-network/
|
|
74
|
-
"@xyo-network/
|
|
75
|
-
"@xyo-network/
|
|
76
|
-
"@xyo-network/
|
|
77
|
-
"@xyo-network/
|
|
78
|
-
"@xyo-network/
|
|
79
|
-
"@xyo-network/
|
|
80
|
-
"@xyo-network/
|
|
81
|
-
"@xyo-network/
|
|
82
|
-
"@xyo-network/
|
|
83
|
-
"@xyo-network/
|
|
84
|
-
"@xyo-network/
|
|
85
|
-
"@xyo-network/
|
|
86
|
-
"@xyo-network/
|
|
87
|
-
"@xyo-network/
|
|
88
|
-
"@xyo-network/
|
|
89
|
-
"@xyo-network/
|
|
90
|
-
"@xyo-network/
|
|
91
|
-
"@xyo-network/
|
|
92
|
-
"@xyo-network/
|
|
93
|
-
"@xyo-network/
|
|
94
|
-
"@xyo-network/
|
|
95
|
-
"@xyo-network/
|
|
96
|
-
"@xyo-network/
|
|
97
|
-
"@xyo-network/payload-plugin": "^5.3.30",
|
|
98
|
-
"@xyo-network/payload-utils": "~5.3.30",
|
|
99
|
-
"@xyo-network/payload-validator": "~5.3.30",
|
|
100
|
-
"@xyo-network/payloadset-plugin": "~5.3.30",
|
|
101
|
-
"@xyo-network/previous-hash-store-model": "~5.3.30",
|
|
102
|
-
"@xyo-network/sdk-js": "~5.3.30",
|
|
103
|
-
"@xyo-network/sentinel-abstract": "~5.3.30",
|
|
104
|
-
"@xyo-network/sentinel-memory": "~5.3.30",
|
|
105
|
-
"@xyo-network/sentinel-model": "~5.3.30",
|
|
106
|
-
"@xyo-network/wallet": "~5.3.30",
|
|
107
|
-
"@xyo-network/wallet-model": "~5.3.30",
|
|
108
|
-
"@xyo-network/wasm": "~5.3.30",
|
|
109
|
-
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
110
|
-
"@xyo-network/witness-blockchain-abstract": "~5.3.30",
|
|
111
|
-
"@xyo-network/witness-model": "~5.3.30",
|
|
112
|
-
"@xyo-network/witness-timestamp": "~5.3.30",
|
|
38
|
+
"@bitauth/libauth": "~3.0.0",
|
|
39
|
+
"@metamask/providers": "^22.1.1",
|
|
40
|
+
"@opentelemetry/api": "^1.9.1",
|
|
41
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
42
|
+
"@scure/base": "^2.2.0",
|
|
43
|
+
"@scure/bip39": "~2.2.0",
|
|
44
|
+
"@types/node": "^25.6.0",
|
|
45
|
+
"@xylabs/geo": "^5.0.100",
|
|
46
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
47
|
+
"@xylabs/threads": "^5.0.100",
|
|
48
|
+
"@xylabs/toolchain": "~7.11.8",
|
|
49
|
+
"@xylabs/tsconfig": "~7.11.8",
|
|
50
|
+
"@xylabs/vitest-extended": "~5.0.100",
|
|
51
|
+
"@xylabs/vitest-matchers": "~5.0.100",
|
|
52
|
+
"@xyo-network/account": "~5.5.1",
|
|
53
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
54
|
+
"@xyo-network/api": "~5.5.1",
|
|
55
|
+
"@xyo-network/api-models": "~5.5.1",
|
|
56
|
+
"@xyo-network/archivist-model": "^5.5.5",
|
|
57
|
+
"@xyo-network/boundwitness-builder": "~5.5.1",
|
|
58
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
59
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
60
|
+
"@xyo-network/boundwitness-wrapper": "~5.5.1",
|
|
61
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
62
|
+
"@xyo-network/data": "~5.5.1",
|
|
63
|
+
"@xyo-network/diviner-abstract": "^5.5.5",
|
|
64
|
+
"@xyo-network/diviner-boundwitness-memory": "~5.5.2",
|
|
65
|
+
"@xyo-network/diviner-jsonpatch": "~5.5.5",
|
|
66
|
+
"@xyo-network/diviner-jsonpath-aggregate-memory": "~5.5.5",
|
|
67
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
68
|
+
"@xyo-network/diviner-payload-generic": "~5.5.5",
|
|
69
|
+
"@xyo-network/diviner-payload-model": "^5.5.5",
|
|
70
|
+
"@xyo-network/diviner-range": "~5.5.5",
|
|
71
|
+
"@xyo-network/diviner-temporal-indexing": "~5.5.5",
|
|
72
|
+
"@xyo-network/elliptic": "~5.5.1",
|
|
73
|
+
"@xyo-network/hash": "~5.5.1",
|
|
74
|
+
"@xyo-network/huri": "~5.5.1",
|
|
75
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
76
|
+
"@xyo-network/module-abstract": "~5.5.5",
|
|
77
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
78
|
+
"@xyo-network/node-memory": "~5.5.5",
|
|
79
|
+
"@xyo-network/open-zeppelin-typechain": "^4.1.3",
|
|
80
|
+
"@xyo-network/payload-builder": "~5.5.1",
|
|
81
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
82
|
+
"@xyo-network/payload-plugin": "~5.5.1",
|
|
83
|
+
"@xyo-network/payload-utils": "~5.5.1",
|
|
84
|
+
"@xyo-network/payload-validator": "~5.5.1",
|
|
85
|
+
"@xyo-network/payload-wrapper": "~5.5.1",
|
|
86
|
+
"@xyo-network/previous-hash-store-model": "~5.5.1",
|
|
87
|
+
"@xyo-network/query-payload-plugin": "~5.5.1",
|
|
88
|
+
"@xyo-network/sdk-js": "^5.5.5",
|
|
89
|
+
"@xyo-network/sdk-protocol-js": "~5.5.1",
|
|
90
|
+
"@xyo-network/sentinel-model": "~5.5.5",
|
|
91
|
+
"@xyo-network/wallet": "~5.5.1",
|
|
92
|
+
"@xyo-network/wallet-model": "~5.5.1",
|
|
93
|
+
"@xyo-network/witness-abstract": "^5.5.5",
|
|
94
|
+
"@xyo-network/witness-blockchain-abstract": "^5.5.5",
|
|
95
|
+
"@xyo-network/witness-model": "^5.5.5",
|
|
96
|
+
"@xyo-network/witness-timestamp": "^5.5.5",
|
|
113
97
|
"ajv": "^8.18.0",
|
|
114
|
-
"async-mutex": "
|
|
115
|
-
"axios": "^1.15.
|
|
116
|
-
"
|
|
98
|
+
"async-mutex": "^0.5.0",
|
|
99
|
+
"axios": "^1.15.2",
|
|
100
|
+
"bn.js": "^5.2.3",
|
|
101
|
+
"buffer": "^6.0.3",
|
|
102
|
+
"chalk": "^5.6.2",
|
|
103
|
+
"debug": "~4.4.3",
|
|
104
|
+
"esbuild": "~0.28.0",
|
|
105
|
+
"eslint": "^10.2.1",
|
|
117
106
|
"ethers": "^6.16.0",
|
|
107
|
+
"fast-json-patch": "~3.1.1",
|
|
108
|
+
"hash-wasm": "^4.12.0",
|
|
109
|
+
"idb": "^8.0.3",
|
|
110
|
+
"jsonpath": "~1.3.0",
|
|
111
|
+
"lru-cache": "^11.3.5",
|
|
112
|
+
"mapbox-gl": "^3.22.0",
|
|
113
|
+
"observable-fns": "~0.6.1",
|
|
118
114
|
"pako": "~2.1.0",
|
|
115
|
+
"store2": "~2.14.4",
|
|
119
116
|
"typescript": "~5.9.3",
|
|
120
|
-
"vite": "^8.0.
|
|
121
|
-
"vitest": "
|
|
117
|
+
"vite": "^8.0.10",
|
|
118
|
+
"vitest": "^4.1.5",
|
|
119
|
+
"wasm-feature-detect": "~1.8.0",
|
|
120
|
+
"webextension-polyfill": "^0.12.0",
|
|
122
121
|
"zod": "^4.3.6",
|
|
123
|
-
"@xyo-network/evm-nft-id-payload-plugin": "~5.4.
|
|
122
|
+
"@xyo-network/evm-nft-id-payload-plugin": "~5.4.9"
|
|
124
123
|
},
|
|
125
124
|
"peerDependencies": {
|
|
126
|
-
"@xylabs/sdk-js": "^5",
|
|
127
|
-
"@xyo-network/
|
|
128
|
-
"@xyo-network/
|
|
129
|
-
"@xyo-network/
|
|
130
|
-
"@xyo-network/
|
|
131
|
-
"@xyo-network/
|
|
132
|
-
"@xyo-network/
|
|
133
|
-
"@xyo-network/
|
|
134
|
-
"@xyo-network/
|
|
135
|
-
"
|
|
136
|
-
"
|
|
125
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
126
|
+
"@xyo-network/account": "~5.5.1",
|
|
127
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
128
|
+
"@xyo-network/api-models": "~5.5.1",
|
|
129
|
+
"@xyo-network/archivist-model": "^5.5.5",
|
|
130
|
+
"@xyo-network/boundwitness-builder": "~5.5.1",
|
|
131
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
132
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
133
|
+
"@xyo-network/data": "~5.5.1",
|
|
134
|
+
"@xyo-network/diviner-abstract": "^5.5.5",
|
|
135
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
136
|
+
"@xyo-network/elliptic": "~5.5.1",
|
|
137
|
+
"@xyo-network/hash": "~5.5.1",
|
|
138
|
+
"@xyo-network/huri": "~5.5.1",
|
|
139
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
140
|
+
"@xyo-network/module-abstract": "~5.5.5",
|
|
141
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
142
|
+
"@xyo-network/payload-builder": "~5.5.1",
|
|
143
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
144
|
+
"@xyo-network/payload-validator": "~5.5.1",
|
|
145
|
+
"@xyo-network/previous-hash-store-model": "~5.5.1",
|
|
146
|
+
"@xyo-network/sdk-js": "^5.5.5",
|
|
147
|
+
"@xyo-network/wallet-model": "~5.5.1",
|
|
148
|
+
"@xyo-network/witness-abstract": "^5.5.5",
|
|
149
|
+
"@xyo-network/witness-model": "^5.5.5",
|
|
150
|
+
"ethers": "^6.16.0",
|
|
151
|
+
"zod": "^4.3.6"
|
|
137
152
|
},
|
|
138
153
|
"publishConfig": {
|
|
139
154
|
"access": "public"
|