@xyo-network/crypto-contract-function-read-plugin 2.77.20 → 2.78.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/CryptoContractDiviner.d.cts +3 -4
- package/dist/browser/CryptoContractDiviner.d.cts.map +1 -1
- package/dist/browser/CryptoContractDiviner.d.mts +3 -4
- package/dist/browser/CryptoContractDiviner.d.mts.map +1 -1
- package/dist/browser/CryptoContractDiviner.d.ts +3 -4
- package/dist/browser/CryptoContractDiviner.d.ts.map +1 -1
- package/dist/browser/Plugin.d.cts +33 -3
- package/dist/browser/Plugin.d.cts.map +1 -1
- package/dist/browser/Plugin.d.mts +33 -3
- package/dist/browser/Plugin.d.mts.map +1 -1
- package/dist/browser/Plugin.d.ts +33 -3
- package/dist/browser/Plugin.d.ts.map +1 -1
- package/dist/browser/Witness.d.cts +5 -5
- package/dist/browser/Witness.d.cts.map +1 -1
- package/dist/browser/Witness.d.mts +5 -5
- package/dist/browser/Witness.d.mts.map +1 -1
- package/dist/browser/Witness.d.ts +5 -5
- package/dist/browser/Witness.d.ts.map +1 -1
- package/dist/browser/index.cjs +40 -38
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +42 -40
- package/dist/browser/index.js.map +1 -1
- package/dist/node/CryptoContractDiviner.d.cts +3 -4
- package/dist/node/CryptoContractDiviner.d.cts.map +1 -1
- package/dist/node/CryptoContractDiviner.d.mts +3 -4
- package/dist/node/CryptoContractDiviner.d.mts.map +1 -1
- package/dist/node/CryptoContractDiviner.d.ts +3 -4
- package/dist/node/CryptoContractDiviner.d.ts.map +1 -1
- package/dist/node/Plugin.d.cts +33 -3
- package/dist/node/Plugin.d.cts.map +1 -1
- package/dist/node/Plugin.d.mts +33 -3
- package/dist/node/Plugin.d.mts.map +1 -1
- package/dist/node/Plugin.d.ts +33 -3
- package/dist/node/Plugin.d.ts.map +1 -1
- package/dist/node/Witness.d.cts +5 -5
- package/dist/node/Witness.d.cts.map +1 -1
- package/dist/node/Witness.d.mts +5 -5
- package/dist/node/Witness.d.mts.map +1 -1
- package/dist/node/Witness.d.ts +5 -5
- package/dist/node/Witness.d.ts.map +1 -1
- package/dist/node/index.js +42 -38
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +44 -40
- package/dist/node/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/CryptoContractDiviner.ts +8 -23
- package/src/Erc721Sentinel.json +12 -63
- package/src/Witness.ts +44 -33
package/dist/browser/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
|
4
4
|
import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
|
|
5
5
|
|
|
6
6
|
// src/Witness.ts
|
|
7
|
+
import { BigNumber } from "@ethersproject/bignumber";
|
|
8
|
+
import { Contract } from "@ethersproject/contracts";
|
|
7
9
|
import { assertEx } from "@xylabs/assert";
|
|
8
10
|
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
9
11
|
import {
|
|
@@ -11,42 +13,53 @@ import {
|
|
|
11
13
|
CryptoContractFunctionCallSchema,
|
|
12
14
|
CryptoContractFunctionReadWitnessConfigSchema
|
|
13
15
|
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
14
|
-
import { PayloadHasher } from "@xyo-network/hash";
|
|
15
16
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
16
|
-
import { BigNumber } from "ethers";
|
|
17
17
|
var CryptoContractFunctionReadWitness = class extends AbstractWitness {
|
|
18
18
|
static configSchemas = [CryptoContractFunctionReadWitnessConfigSchema];
|
|
19
19
|
async observeHandler(inPayloads = []) {
|
|
20
20
|
await this.started("throw");
|
|
21
21
|
try {
|
|
22
22
|
const observations = await Promise.all(
|
|
23
|
-
inPayloads.filter(isPayloadOfSchemaType(CryptoContractFunctionCallSchema)).map(async (
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const validatedAddress = assertEx(address, "Missing address");
|
|
27
|
-
const validatedFunctionName = assertEx(functionName, "Missing
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
inPayloads.filter(isPayloadOfSchemaType(CryptoContractFunctionCallSchema)).map(async ({ functionName, args, address }) => {
|
|
24
|
+
const { providers } = this.params;
|
|
25
|
+
const provider = providers[Date.now() % providers.length];
|
|
26
|
+
const validatedAddress = assertEx(address ?? this.config.address, "Missing address");
|
|
27
|
+
const validatedFunctionName = assertEx(functionName ?? this.config.functionName, "Missing address");
|
|
28
|
+
const mergedArgs = [...args ?? this.config.args ?? []];
|
|
29
|
+
const contract = new Contract(validatedAddress, this.config.contract, provider);
|
|
30
|
+
try {
|
|
31
|
+
const result = await contract.callStatic[validatedFunctionName](...mergedArgs);
|
|
32
|
+
const transformedResult = BigNumber.isBigNumber(result) ? result.toHexString() : result;
|
|
33
|
+
const observation = {
|
|
34
|
+
address: validatedAddress,
|
|
35
|
+
args: mergedArgs,
|
|
36
|
+
chainId: provider.network.chainId,
|
|
37
|
+
functionName: validatedFunctionName,
|
|
38
|
+
result: transformedResult,
|
|
39
|
+
schema: CryptoContractFunctionCallResultSchema
|
|
40
|
+
};
|
|
41
|
+
return observation;
|
|
42
|
+
} catch (ex) {
|
|
43
|
+
const error = ex;
|
|
44
|
+
console.log(`Error [${this.config.name}]: ${error.code}`);
|
|
45
|
+
const observation = {
|
|
46
|
+
address: validatedAddress,
|
|
47
|
+
args: mergedArgs,
|
|
48
|
+
chainId: provider.network.chainId,
|
|
49
|
+
error: error.code,
|
|
50
|
+
functionName: validatedFunctionName,
|
|
51
|
+
schema: CryptoContractFunctionCallResultSchema
|
|
52
|
+
};
|
|
53
|
+
return observation;
|
|
54
|
+
}
|
|
42
55
|
})
|
|
43
56
|
);
|
|
44
|
-
return observations
|
|
57
|
+
return observations;
|
|
45
58
|
} catch (ex) {
|
|
46
59
|
const error = ex;
|
|
47
60
|
console.log(`Error [${this.config.name}]: ${error.message}`);
|
|
61
|
+
throw error;
|
|
48
62
|
}
|
|
49
|
-
return [];
|
|
50
63
|
}
|
|
51
64
|
};
|
|
52
65
|
|
|
@@ -65,28 +78,17 @@ var CryptoContractFunctionReadWitnessPlugin = () => createPayloadSetWitnessPlugi
|
|
|
65
78
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
66
79
|
import { AbstractDiviner } from "@xyo-network/abstract-diviner";
|
|
67
80
|
import {
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
asCryptoContractFunctionCallSuccess,
|
|
82
|
+
CryptoContractFunctionCallResultSchema as CryptoContractFunctionCallResultSchema2
|
|
70
83
|
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
71
|
-
import { PayloadHasher as PayloadHasher2 } from "@xyo-network/hash";
|
|
72
84
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
73
85
|
var CryptoContractDivinerConfigSchema = "network.xyo.crypto.contract.diviner.config";
|
|
74
86
|
var ContractInfoSchema = "network.xyo.crypto.contract.info";
|
|
75
87
|
var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner {
|
|
76
88
|
static configSchemas = [CryptoContractDivinerConfigSchema];
|
|
77
|
-
static
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
return foundPayload?.result.value;
|
|
81
|
-
}
|
|
82
|
-
static async generateCallHash(address, functionName, params) {
|
|
83
|
-
const callPayload = {
|
|
84
|
-
address,
|
|
85
|
-
functionName,
|
|
86
|
-
params,
|
|
87
|
-
schema: CryptoContractFunctionCallSchema2
|
|
88
|
-
};
|
|
89
|
-
return await PayloadHasher2.hashAsync(callPayload);
|
|
89
|
+
static findCallResult(address, functionName, payloads) {
|
|
90
|
+
const foundPayload = payloads.find((payload) => payload.functionName === functionName && payload.address === address);
|
|
91
|
+
return asCryptoContractFunctionCallSuccess(foundPayload)?.result;
|
|
90
92
|
}
|
|
91
93
|
static matchingExistingField(objs, field) {
|
|
92
94
|
const expectedValue = objs.at(0)?.[field];
|
|
@@ -126,7 +128,7 @@ var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner
|
|
|
126
128
|
}
|
|
127
129
|
reduceResults(callResults) {
|
|
128
130
|
return callResults.reduce((prev, callResult) => {
|
|
129
|
-
prev[callResult.functionName] = callResult
|
|
131
|
+
prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result;
|
|
130
132
|
return prev;
|
|
131
133
|
}, {});
|
|
132
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/CryptoContractDiviner.ts","../../src/index.ts"],"sourcesContent":["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'\n\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\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 { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionReadWitnessConfig,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { BigNumber, Contract } from 'ethers'\n\nexport type CryptoContractFunctionReadWitnessParams<TContract extends Contract> = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n factory: (address: string) => TContract\n }\n>\n\nexport class CryptoContractFunctionReadWitness<\n TContract extends Contract = Contract,\n TParams extends CryptoContractFunctionReadWitnessParams<TContract> = CryptoContractFunctionReadWitnessParams<TContract>,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall<keyof TContract['callStatic']>, CryptoContractFunctionCallResult> {\n static override configSchemas = [CryptoContractFunctionReadWitnessConfigSchema]\n\n protected override async observeHandler(\n inPayloads: CryptoContractFunctionCall<keyof TContract['callStatic']>[] = [],\n ): Promise<CryptoContractFunctionCallResult[]> {\n await this.started('throw')\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType(CryptoContractFunctionCallSchema)).map(async (callPayload) => {\n const fullCallPayload = { ...{ params: [] }, ...this.config.call, ...callPayload }\n const { address, functionName, params } = fullCallPayload\n const validatedAddress = assertEx(address, 'Missing address')\n const validatedFunctionName = assertEx(functionName, 'Missing functionName')\n const contract = this.params.factory(validatedAddress)\n const func = assertEx(contract.callStatic[validatedFunctionName], `functionName [${validatedFunctionName}] not found`)\n const rawResult = await func(...(params ?? []))\n const result: CryptoContractFunctionCallResult['result'] = BigNumber.isBigNumber(rawResult)\n ? { type: 'BigNumber', value: rawResult.toHexString() }\n : { value: rawResult }\n const observation: CryptoContractFunctionCallResult = {\n address: validatedAddress,\n call: await PayloadHasher.hashAsync(fullCallPayload),\n chainId: (await contract.provider.getNetwork()).chainId,\n functionName: validatedFunctionName,\n params,\n result,\n schema: CryptoContractFunctionCallResultSchema,\n }\n return observation\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 }\n\n return []\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport {\n ContractFunctionResult,\n CryptoContractFunctionCall,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\nexport const CryptoContractDivinerConfigSchema = 'network.xyo.crypto.contract.diviner.config'\nexport type CryptoContractDivinerConfigSchema = typeof CryptoContractDivinerConfigSchema\n\nexport type CryptoContractDivinerConfig = DivinerConfig<{\n schema: CryptoContractDivinerConfigSchema\n}>\nexport type CryptoContractDivinerParams = DivinerParams<CryptoContractDivinerConfig>\n\nexport const ContractInfoSchema = 'network.xyo.crypto.contract.info'\nexport type ContractInfoSchema = typeof ContractInfoSchema\n\nexport type ContractInfo = Payload<\n {\n address: string\n chainId: string\n results?: Record<string, ContractFunctionResult>\n },\n ContractInfoSchema\n>\n\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override configSchemas = [CryptoContractDivinerConfigSchema]\n\n protected static async findCallResult<TResult = string>(\n address: string,\n functionName: string,\n params: unknown[],\n payloads: CryptoContractFunctionCallResult[],\n ): Promise<TResult | undefined> {\n const callHash = await this.generateCallHash(address, functionName, params)\n const foundPayload = payloads.find((payload) => payload.call === callHash)\n return foundPayload?.result.value as TResult | undefined\n }\n\n protected static async generateCallHash(address: string, functionName: string, params: unknown[]) {\n const callPayload: CryptoContractFunctionCall = {\n address,\n functionName,\n params,\n schema: CryptoContractFunctionCallSchema,\n }\n return await PayloadHasher.hashAsync(callPayload)\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 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 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 return callResults.reduce<Record<string, ContractFunctionResult>>((prev, callResult) => {\n prev[callResult.functionName] = callResult.result\n return prev\n }, {})\n }\n}\n","import { CryptoContractFunctionReadWitnessPlugin } from './Plugin'\n\nexport * from './CryptoContractDiviner'\nexport * from './Witness'\n\nexport { CryptoContractFunctionReadWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default CryptoContractFunctionReadWitnessPlugin\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EACA;AAAA,EAEA;AAAA,OAC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O;AAAA,MACL,SAASH,UAAS,uBAAsB,sBAAsB,aAAa,SAAS,GAAG,oBAAoB;AAAA,MAC3G,SAASA,UAAS,uBAAsB,sBAAsB,aAAa,SAAS,GAAG,oBAAoB;AAAA,MAC3G,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,MAAyB,cAAc,aAAiD,CAAC,GAA4B;AACnH,UAAM,cAAc,WAAW,OAAOI,uBAAwDH,uCAAsC,CAAC;AACrI,UAAM,YAAY,OAAO;AAAA,MACvB,YAAY,OAAgC,CAAC,MAAMI,YAAW;AAC5D,YAAIA,QAAO,SAAS;AAClB,eAAKA,QAAO,OAAO,IAAI;AAAA,QACzB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,IACP;AACA,UAAM,SAAS,MAAM,QAAQ;AAAA,MAC3B,UAAU,IAAI,OAAO,YAAY;AAC/B,cAAM,mBAAmB,YAAY,OAAO,CAAC,eAAe,WAAW,YAAY,OAAO;AAC1F,cAAM,OAAqB;AAAA,UACzB,GAAG,EAAE,SAAS,MAAM,KAAK,cAAc,gBAAgB,EAAE;AAAA,UACzD,GAAG,KAAK,2BAA2B,gBAAgB;AAAA,QACrD;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA,EAEU,cAAc,aAAsF;AAC5G,WAAO,YAAY,OAA+C,CAAC,MAAM,eAAe;AACtF,WAAK,WAAW,YAAY,IAAI,WAAW;AAC3C,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,EACP;AACF;;;AClGA,IAAO,cAAQ;","names":["assertEx","CryptoContractFunctionCallResultSchema","CryptoContractFunctionCallSchema","PayloadHasher","isPayloadOfSchemaType","result"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/CryptoContractDiviner.ts","../../src/index.ts"],"sourcesContent":["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'\n\nexport const CryptoContractFunctionReadWitnessPlugin = () =>\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 { BigNumber } from '@ethersproject/bignumber'\nimport { Contract } from '@ethersproject/contracts'\nimport { JsonRpcProvider } from '@ethersproject/providers'\nimport { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport {\n CryptoContractFunctionCall,\n CryptoContractFunctionCallFailure,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n CryptoContractFunctionCallSchema,\n CryptoContractFunctionCallSuccess,\n CryptoContractFunctionReadWitnessConfig,\n CryptoContractFunctionReadWitnessConfigSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\n\nexport type CryptoContractFunctionReadWitnessParams = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n providers: JsonRpcProvider[]\n }\n>\n\nexport class CryptoContractFunctionReadWitness<\n TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,\n> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {\n static override configSchemas = [CryptoContractFunctionReadWitnessConfigSchema]\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(CryptoContractFunctionCallSchema)).map(async ({ functionName, args, address }) => {\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 ?? [])]\n\n const contract = new Contract(validatedAddress, this.config.contract, provider)\n try {\n const result = await contract.callStatic[validatedFunctionName](...mergedArgs)\n const transformedResult = BigNumber.isBigNumber(result) ? result.toHexString() : result\n const observation: CryptoContractFunctionCallSuccess = {\n address: validatedAddress,\n args: mergedArgs,\n chainId: provider.network.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: provider.network.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","import { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport {\n asCryptoContractFunctionCallSuccess,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]\n\nexport const CryptoContractDivinerConfigSchema = 'network.xyo.crypto.contract.diviner.config'\nexport type CryptoContractDivinerConfigSchema = typeof CryptoContractDivinerConfigSchema\n\nexport type CryptoContractDivinerConfig = DivinerConfig<{\n schema: CryptoContractDivinerConfigSchema\n}>\nexport type CryptoContractDivinerParams = DivinerParams<CryptoContractDivinerConfig>\n\nexport const ContractInfoSchema = 'network.xyo.crypto.contract.info'\nexport type ContractInfoSchema = typeof ContractInfoSchema\n\nexport type ContractInfo = Payload<\n {\n address: string\n chainId: string\n results?: Record<string, unknown>\n },\n ContractInfoSchema\n>\n\nexport class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {\n static override configSchemas = [CryptoContractDivinerConfigSchema]\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 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 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 return callResults.reduce<Record<string, unknown>>((prev, callResult) => {\n prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result\n return prev\n }, {})\n }\n}\n","import { CryptoContractFunctionReadWitnessPlugin } from './Plugin'\n\nexport * from './CryptoContractDiviner'\nexport * from './Witness'\n\nexport { CryptoContractFunctionReadWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default CryptoContractFunctionReadWitnessPlugin\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC;AAAA,EAIE;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAEP,SAAS,6BAA6B;AAU/B,IAAM,oCAAN,cAEG,gBAAuF;AAAA,EAC/F,OAAgB,gBAAgB,CAAC,6CAA6C;AAAA,EAE9E,MAAyB,eAAe,aAA2C,CAAC,GAAgD;AAClI,UAAM,KAAK,QAAQ,OAAO;AAC1B,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAsB,gCAAgC,CAAC,EAAE,IAAI,OAAO,EAAE,cAAc,MAAM,QAAQ,MAAM;AACxH,gBAAM,EAAE,UAAU,IAAI,KAAK;AAC3B,gBAAM,WAAW,UAAU,KAAK,IAAI,IAAI,UAAU,MAAM;AACxD,gBAAM,mBAAmB,SAAS,WAAW,KAAK,OAAO,SAAS,iBAAiB;AACnF,gBAAM,wBAAwB,SAAS,gBAAgB,KAAK,OAAO,cAAc,iBAAiB;AAClG,gBAAM,aAAa,CAAC,GAAI,QAAQ,KAAK,OAAO,QAAQ,CAAC,CAAE;AAEvD,gBAAM,WAAW,IAAI,SAAS,kBAAkB,KAAK,OAAO,UAAU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AO;AAAA,MACT,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAAA,EAEU,cAAc,aAAsF;AAC5G,WAAO,YAAY,OAAgC,CAAC,MAAM,eAAe;AACvE,WAAK,WAAW,YAAY,IAAI,oCAAoC,UAAU,GAAG;AACjF,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,EACP;AACF;;;ACnFA,IAAO,cAAQ;","names":["assertEx","CryptoContractFunctionCallResultSchema","isPayloadOfSchemaType","result"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Promisable } from '@xylabs/promise';
|
|
2
2
|
import { AbstractDiviner } from '@xyo-network/abstract-diviner';
|
|
3
|
-
import {
|
|
3
|
+
import { CryptoContractFunctionCallResult } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
4
4
|
import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
|
|
5
5
|
import { Payload } from '@xyo-network/payload-model';
|
|
6
6
|
export type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined];
|
|
@@ -15,12 +15,11 @@ export type ContractInfoSchema = typeof ContractInfoSchema;
|
|
|
15
15
|
export type ContractInfo = Payload<{
|
|
16
16
|
address: string;
|
|
17
17
|
chainId: string;
|
|
18
|
-
results?: Record<string,
|
|
18
|
+
results?: Record<string, unknown>;
|
|
19
19
|
}, ContractInfoSchema>;
|
|
20
20
|
export declare class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {
|
|
21
21
|
static configSchemas: string[];
|
|
22
|
-
protected static findCallResult<TResult = string>(address: string, functionName: string,
|
|
23
|
-
protected static generateCallHash(address: string, functionName: string, params: unknown[]): Promise<string>;
|
|
22
|
+
protected static findCallResult<TResult = string>(address: string, functionName: string, payloads: CryptoContractFunctionCallResult[]): TResult | undefined;
|
|
24
23
|
protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined;
|
|
25
24
|
protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo;
|
|
26
25
|
protected divineHandler(inPayloads?: CryptoContractFunctionCallResult[]): Promise<ContractInfo[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAEL,gCAAgC,EAEjC,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAyB,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,cAAc,CAAC,OAAO,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEvI,eAAO,MAAM,iCAAiC,+CAA+C,CAAA;AAC7F,MAAM,MAAM,iCAAiC,GAAG,OAAO,iCAAiC,CAAA;AAExF,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC;IACtD,MAAM,EAAE,iCAAiC,CAAA;CAC1C,CAAC,CAAA;AACF,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC,2BAA2B,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,qCAAqC,CAAA;AACpE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG,OAAO,CAChC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,EACD,kBAAkB,CACnB,CAAA;AAED,qBAAa,qBAAqB,CAAC,OAAO,SAAS,2BAA2B,GAAG,2BAA2B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC5I,OAAgB,aAAa,WAAsC;IAEnE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,GAAG,MAAM,EAC9C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,gCAAgC,EAAE,GAC3C,OAAO,GAAG,SAAS;IAKtB,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS;IAQzH,SAAS,CAAC,0BAA0B,CAAC,WAAW,EAAE,gCAAgC,EAAE,GAAG,YAAY;cAQ1E,aAAa,CAAC,UAAU,GAAE,gCAAgC,EAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAwBpH,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE,gCAAgC,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;CAM9G"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Promisable } from '@xylabs/promise';
|
|
2
2
|
import { AbstractDiviner } from '@xyo-network/abstract-diviner';
|
|
3
|
-
import {
|
|
3
|
+
import { CryptoContractFunctionCallResult } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
4
4
|
import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
|
|
5
5
|
import { Payload } from '@xyo-network/payload-model';
|
|
6
6
|
export type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined];
|
|
@@ -15,12 +15,11 @@ export type ContractInfoSchema = typeof ContractInfoSchema;
|
|
|
15
15
|
export type ContractInfo = Payload<{
|
|
16
16
|
address: string;
|
|
17
17
|
chainId: string;
|
|
18
|
-
results?: Record<string,
|
|
18
|
+
results?: Record<string, unknown>;
|
|
19
19
|
}, ContractInfoSchema>;
|
|
20
20
|
export declare class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {
|
|
21
21
|
static configSchemas: string[];
|
|
22
|
-
protected static findCallResult<TResult = string>(address: string, functionName: string,
|
|
23
|
-
protected static generateCallHash(address: string, functionName: string, params: unknown[]): Promise<string>;
|
|
22
|
+
protected static findCallResult<TResult = string>(address: string, functionName: string, payloads: CryptoContractFunctionCallResult[]): TResult | undefined;
|
|
24
23
|
protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined;
|
|
25
24
|
protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo;
|
|
26
25
|
protected divineHandler(inPayloads?: CryptoContractFunctionCallResult[]): Promise<ContractInfo[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAA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S,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS;IAQzH,SAAS,CAAC,0BAA0B,CAAC,WAAW,EAAE,gCAAgC,EAAE,GAAG,YAAY;cAQ1E,aAAa,CAAC,UAAU,GAAE,gCAAgC,EAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAwBpH,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE,gCAAgC,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;CAM9G"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Promisable } from '@xylabs/promise';
|
|
2
2
|
import { AbstractDiviner } from '@xyo-network/abstract-diviner';
|
|
3
|
-
import {
|
|
3
|
+
import { CryptoContractFunctionCallResult } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
4
4
|
import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
|
|
5
5
|
import { Payload } from '@xyo-network/payload-model';
|
|
6
6
|
export type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined];
|
|
@@ -15,12 +15,11 @@ export type ContractInfoSchema = typeof ContractInfoSchema;
|
|
|
15
15
|
export type ContractInfo = Payload<{
|
|
16
16
|
address: string;
|
|
17
17
|
chainId: string;
|
|
18
|
-
results?: Record<string,
|
|
18
|
+
results?: Record<string, unknown>;
|
|
19
19
|
}, ContractInfoSchema>;
|
|
20
20
|
export declare class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {
|
|
21
21
|
static configSchemas: string[];
|
|
22
|
-
protected static findCallResult<TResult = string>(address: string, functionName: string,
|
|
23
|
-
protected static generateCallHash(address: string, functionName: string, params: unknown[]): Promise<string>;
|
|
22
|
+
protected static findCallResult<TResult = string>(address: string, functionName: string, payloads: CryptoContractFunctionCallResult[]): TResult | undefined;
|
|
24
23
|
protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined;
|
|
25
24
|
protected contractInfoRequiredFields(callResults: CryptoContractFunctionCallResult[]): ContractInfo;
|
|
26
25
|
protected divineHandler(inPayloads?: CryptoContractFunctionCallResult[]): Promise<ContractInfo[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"CryptoContractDiviner.d.ts","sourceRoot":"","sources":["../../src/CryptoContractDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAEL,gCAAgC,EAEjC,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAyB,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,cAAc,CAAC,OAAO,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAEvI,eAAO,MAAM,iCAAiC,+CAA+C,CAAA;AAC7F,MAAM,MAAM,iCAAiC,GAAG,OAAO,iCAAiC,CAAA;AAExF,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC;IACtD,MAAM,EAAE,iCAAiC,CA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
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("
|
|
2
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("@xyo-network/core").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
4
4
|
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
5
5
|
accountDerivationPath?: string | undefined;
|
|
@@ -17,7 +17,37 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
17
17
|
readonly sign?: boolean | undefined;
|
|
18
18
|
readonly storeQueries?: boolean | undefined;
|
|
19
19
|
readonly timestamp?: boolean | undefined;
|
|
20
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/
|
|
20
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
21
|
+
accountDerivationPath?: string | undefined;
|
|
22
|
+
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
23
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
24
|
+
readonly name?: string | undefined;
|
|
25
|
+
readonly paging?: Record<string, {
|
|
26
|
+
size?: number | undefined;
|
|
27
|
+
}> | undefined;
|
|
28
|
+
readonly security?: {
|
|
29
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
30
|
+
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
31
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly sign?: boolean | undefined;
|
|
34
|
+
readonly storeQueries?: boolean | undefined;
|
|
35
|
+
readonly timestamp?: boolean | undefined;
|
|
36
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
37
|
+
archivist?: string | undefined;
|
|
38
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
39
|
+
targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadSet & {
|
|
40
|
+
schema: "network.xyo.payload.set";
|
|
41
|
+
}) | undefined;
|
|
42
|
+
} & {
|
|
43
|
+
address?: string | undefined;
|
|
44
|
+
args?: unknown[] | undefined;
|
|
45
|
+
contract: import("@ethersproject/contracts").ContractInterface;
|
|
46
|
+
functionName?: string | undefined;
|
|
47
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
48
|
+
}, "schema"> & {
|
|
49
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
50
|
+
}, "schema"> & {
|
|
21
51
|
schema: string;
|
|
22
52
|
}, "schema"> & {
|
|
23
53
|
schema: string;
|
|
@@ -25,6 +55,6 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
25
55
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
26
56
|
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
27
57
|
} & {
|
|
28
|
-
|
|
58
|
+
providers: import("@ethersproject/providers").JsonRpcProvider[];
|
|
29
59
|
}>>;
|
|
30
60
|
//# 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,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASjD,CAAA"}
|
package/dist/node/Plugin.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CryptoContractFunctionReadWitness } from './Witness';
|
|
2
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("
|
|
2
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("@xyo-network/core").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
4
4
|
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
5
5
|
accountDerivationPath?: string | undefined;
|
|
@@ -17,7 +17,37 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
17
17
|
readonly sign?: boolean | undefined;
|
|
18
18
|
readonly storeQueries?: boolean | undefined;
|
|
19
19
|
readonly timestamp?: boolean | undefined;
|
|
20
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/
|
|
20
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
21
|
+
accountDerivationPath?: string | undefined;
|
|
22
|
+
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
23
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
24
|
+
readonly name?: string | undefined;
|
|
25
|
+
readonly paging?: Record<string, {
|
|
26
|
+
size?: number | undefined;
|
|
27
|
+
}> | undefined;
|
|
28
|
+
readonly security?: {
|
|
29
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
30
|
+
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
31
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly sign?: boolean | undefined;
|
|
34
|
+
readonly storeQueries?: boolean | undefined;
|
|
35
|
+
readonly timestamp?: boolean | undefined;
|
|
36
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
37
|
+
archivist?: string | undefined;
|
|
38
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
39
|
+
targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadSet & {
|
|
40
|
+
schema: "network.xyo.payload.set";
|
|
41
|
+
}) | undefined;
|
|
42
|
+
} & {
|
|
43
|
+
address?: string | undefined;
|
|
44
|
+
args?: unknown[] | undefined;
|
|
45
|
+
contract: import("@ethersproject/contracts").ContractInterface;
|
|
46
|
+
functionName?: string | undefined;
|
|
47
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
48
|
+
}, "schema"> & {
|
|
49
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
50
|
+
}, "schema"> & {
|
|
21
51
|
schema: string;
|
|
22
52
|
}, "schema"> & {
|
|
23
53
|
schema: string;
|
|
@@ -25,6 +55,6 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
25
55
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
26
56
|
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
27
57
|
} & {
|
|
28
|
-
|
|
58
|
+
providers: import("@ethersproject/providers").JsonRpcProvider[];
|
|
29
59
|
}>>;
|
|
30
60
|
//# 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,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASjD,CAAA"}
|
package/dist/node/Plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CryptoContractFunctionReadWitness } from './Witness';
|
|
2
|
-
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("
|
|
2
|
+
export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CryptoContractFunctionReadWitness<import("@xyo-network/core").BaseParamsFields & {
|
|
3
3
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
4
4
|
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
5
5
|
accountDerivationPath?: string | undefined;
|
|
@@ -17,7 +17,37 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
17
17
|
readonly sign?: boolean | undefined;
|
|
18
18
|
readonly storeQueries?: boolean | undefined;
|
|
19
19
|
readonly timestamp?: boolean | undefined;
|
|
20
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/
|
|
20
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
21
|
+
accountDerivationPath?: string | undefined;
|
|
22
|
+
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
23
|
+
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
24
|
+
readonly name?: string | undefined;
|
|
25
|
+
readonly paging?: Record<string, {
|
|
26
|
+
size?: number | undefined;
|
|
27
|
+
}> | undefined;
|
|
28
|
+
readonly security?: {
|
|
29
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
30
|
+
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
31
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly sign?: boolean | undefined;
|
|
34
|
+
readonly storeQueries?: boolean | undefined;
|
|
35
|
+
readonly timestamp?: boolean | undefined;
|
|
36
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
37
|
+
archivist?: string | undefined;
|
|
38
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
39
|
+
targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadSet & {
|
|
40
|
+
schema: "network.xyo.payload.set";
|
|
41
|
+
}) | undefined;
|
|
42
|
+
} & {
|
|
43
|
+
address?: string | undefined;
|
|
44
|
+
args?: unknown[] | undefined;
|
|
45
|
+
contract: import("@ethersproject/contracts").ContractInterface;
|
|
46
|
+
functionName?: string | undefined;
|
|
47
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
48
|
+
}, "schema"> & {
|
|
49
|
+
schema: "network.xyo.crypto.contract.function.read.config";
|
|
50
|
+
}, "schema"> & {
|
|
21
51
|
schema: string;
|
|
22
52
|
}, "schema"> & {
|
|
23
53
|
schema: string;
|
|
@@ -25,6 +55,6 @@ export declare const CryptoContractFunctionReadWitnessPlugin: () => import("@xyo
|
|
|
25
55
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
26
56
|
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
27
57
|
} & {
|
|
28
|
-
|
|
58
|
+
providers: import("@ethersproject/providers").JsonRpcProvider[];
|
|
29
59
|
}>>;
|
|
30
60
|
//# 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,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAA;AAE7D,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASjD,CAAA"}
|
package/dist/node/Witness.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
1
2
|
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
3
|
import { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
4
|
import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
5
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
factory: (address: string) => TContract;
|
|
6
|
+
export type CryptoContractFunctionReadWitnessParams = WitnessParams<AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>, {
|
|
7
|
+
providers: JsonRpcProvider[];
|
|
8
8
|
}>;
|
|
9
|
-
export declare class CryptoContractFunctionReadWitness<
|
|
9
|
+
export declare class CryptoContractFunctionReadWitness<TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {
|
|
10
10
|
static configSchemas: string[];
|
|
11
|
-
protected observeHandler(inPayloads?: CryptoContractFunctionCall
|
|
11
|
+
protected observeHandler(inPayloads?: CryptoContractFunctionCall[]): Promise<CryptoContractFunctionCallResult[]>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=Witness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EACL,0BAA0B,EAE1B,gCAAgC,EAIhC,uCAAuC,EAExC,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,MAAM,uCAAuC,GAAG,aAAa,CACjE,eAAe,CAAC,uCAAuC,CAAC,EACxD;IACE,SAAS,EAAE,eAAe,EAAE,CAAA;CAC7B,CACF,CAAA;AAED,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,OAAgB,aAAa,WAAkD;cAEtD,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CA8CpI"}
|
package/dist/node/Witness.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
1
2
|
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
3
|
import { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
4
|
import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
5
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
factory: (address: string) => TContract;
|
|
6
|
+
export type CryptoContractFunctionReadWitnessParams = WitnessParams<AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>, {
|
|
7
|
+
providers: JsonRpcProvider[];
|
|
8
8
|
}>;
|
|
9
|
-
export declare class CryptoContractFunctionReadWitness<
|
|
9
|
+
export declare class CryptoContractFunctionReadWitness<TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {
|
|
10
10
|
static configSchemas: string[];
|
|
11
|
-
protected observeHandler(inPayloads?: CryptoContractFunctionCall
|
|
11
|
+
protected observeHandler(inPayloads?: CryptoContractFunctionCall[]): Promise<CryptoContractFunctionCallResult[]>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=Witness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EACL,0BAA0B,EAE1B,gCAAgC,EAIhC,uCAAuC,EAExC,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,MAAM,uCAAuC,GAAG,aAAa,CACjE,eAAe,CAAC,uCAAuC,CAAC,EACxD;IACE,SAAS,EAAE,eAAe,EAAE,CAAA;CAC7B,CACF,CAAA;AAED,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,OAAgB,aAAa,WAAkD;cAEtD,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CA8CpI"}
|
package/dist/node/Witness.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
1
2
|
import { AbstractWitness } from '@xyo-network/abstract-witness';
|
|
2
3
|
import { CryptoContractFunctionCall, CryptoContractFunctionCallResult, CryptoContractFunctionReadWitnessConfig } from '@xyo-network/crypto-contract-function-read-payload-plugin';
|
|
3
4
|
import { AnyConfigSchema } from '@xyo-network/module-model';
|
|
4
5
|
import { WitnessParams } from '@xyo-network/witness-model';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
factory: (address: string) => TContract;
|
|
6
|
+
export type CryptoContractFunctionReadWitnessParams = WitnessParams<AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>, {
|
|
7
|
+
providers: JsonRpcProvider[];
|
|
8
8
|
}>;
|
|
9
|
-
export declare class CryptoContractFunctionReadWitness<
|
|
9
|
+
export declare class CryptoContractFunctionReadWitness<TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams> extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {
|
|
10
10
|
static configSchemas: string[];
|
|
11
|
-
protected observeHandler(inPayloads?: CryptoContractFunctionCall
|
|
11
|
+
protected observeHandler(inPayloads?: CryptoContractFunctionCall[]): Promise<CryptoContractFunctionCallResult[]>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=Witness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EACL,0BAA0B,EAE1B,gCAAgC,EAIhC,uCAAuC,EAExC,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,MAAM,uCAAuC,GAAG,aAAa,CACjE,eAAe,CAAC,uCAAuC,CAAC,EACxD;IACE,SAAS,EAAE,eAAe,EAAE,CAAA;CAC7B,CACF,CAAA;AAED,qBAAa,iCAAiC,CAC5C,OAAO,SAAS,uCAAuC,GAAG,uCAAuC,CACjG,SAAQ,eAAe,CAAC,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,CAAC;IAC9F,OAAgB,aAAa,WAAkD;cAEtD,cAAc,CAAC,UAAU,GAAE,0BAA0B,EAAO,GAAG,OAAO,CAAC,gCAAgC,EAAE,CAAC;CA8CpI"}
|