@xyo-network/crypto-contract-function-read-plugin 2.99.5 → 2.99.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Plugin.d.cts +2 -2
- package/dist/browser/Plugin.d.mts +2 -2
- package/dist/browser/Plugin.d.ts +2 -2
- package/dist/browser/index.cjs +57 -73
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +69 -77
- package/dist/browser/index.mjs.map +1 -1
- package/dist/neutral/Plugin.d.cts +2 -2
- package/dist/neutral/Plugin.d.mts +2 -2
- package/dist/neutral/Plugin.d.ts +2 -2
- package/dist/neutral/index.cjs +57 -73
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.mjs +69 -77
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/Plugin.d.cts +2 -2
- package/dist/node/Plugin.d.mts +2 -2
- package/dist/node/Plugin.d.ts +2 -2
- package/dist/node/index.cjs +61 -80
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +73 -84
- package/dist/node/index.mjs.map +1 -1
- package/package.json +34 -34
package/dist/node/index.cjs
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __reflectGet = Reflect.get;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
6
|
var __export = (target, all) => {
|
|
11
7
|
for (var name in all)
|
|
12
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,8 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
22
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
-
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
25
19
|
|
|
26
20
|
// src/index.ts
|
|
27
21
|
var src_exports = {};
|
|
@@ -38,7 +32,10 @@ var import_assert = require("@xylabs/assert");
|
|
|
38
32
|
var import_crypto_contract_function_read_payload_plugin = require("@xyo-network/crypto-contract-function-read-payload-plugin");
|
|
39
33
|
var import_diviner_abstract = require("@xyo-network/diviner-abstract");
|
|
40
34
|
var import_payload_model = require("@xyo-network/payload-model");
|
|
41
|
-
var
|
|
35
|
+
var CryptoContractDiviner = class _CryptoContractDiviner extends import_diviner_abstract.AbstractDiviner {
|
|
36
|
+
static configSchemas = [...super.configSchemas, import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerConfigSchema];
|
|
37
|
+
static defaultConfigSchema = import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerConfigSchema;
|
|
38
|
+
static labels = { ...super.labels, ...import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerLabels };
|
|
42
39
|
static findCallResult(address, functionName, payloads) {
|
|
43
40
|
var _a;
|
|
44
41
|
const foundPayload = payloads.find((payload) => payload.functionName === functionName && payload.address === address);
|
|
@@ -70,14 +67,16 @@ var _CryptoContractDiviner = class _CryptoContractDiviner extends import_diviner
|
|
|
70
67
|
return prev;
|
|
71
68
|
}, {})
|
|
72
69
|
);
|
|
73
|
-
const result = await Promise.all(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
const result = await Promise.all(
|
|
71
|
+
addresses.map(async (address) => {
|
|
72
|
+
const foundCallResults = callResults.filter((callResult) => callResult.address === address);
|
|
73
|
+
const info = {
|
|
74
|
+
results: await this.reduceResults(foundCallResults),
|
|
75
|
+
...this.contractInfoRequiredFields(foundCallResults)
|
|
76
|
+
};
|
|
77
|
+
return info;
|
|
78
|
+
})
|
|
79
|
+
);
|
|
81
80
|
return result;
|
|
82
81
|
}
|
|
83
82
|
reduceResults(callResults) {
|
|
@@ -88,17 +87,6 @@ var _CryptoContractDiviner = class _CryptoContractDiviner extends import_diviner
|
|
|
88
87
|
}, {});
|
|
89
88
|
}
|
|
90
89
|
};
|
|
91
|
-
__name(_CryptoContractDiviner, "CryptoContractDiviner");
|
|
92
|
-
__publicField(_CryptoContractDiviner, "configSchemas", [
|
|
93
|
-
...__superGet(_CryptoContractDiviner, _CryptoContractDiviner, "configSchemas"),
|
|
94
|
-
import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerConfigSchema
|
|
95
|
-
]);
|
|
96
|
-
__publicField(_CryptoContractDiviner, "defaultConfigSchema", import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerConfigSchema);
|
|
97
|
-
__publicField(_CryptoContractDiviner, "labels", {
|
|
98
|
-
...__superGet(_CryptoContractDiviner, _CryptoContractDiviner, "labels"),
|
|
99
|
-
...import_crypto_contract_function_read_payload_plugin.CryptoContractDivinerLabels
|
|
100
|
-
});
|
|
101
|
-
var CryptoContractDiviner = _CryptoContractDiviner;
|
|
102
90
|
|
|
103
91
|
// src/Plugin.ts
|
|
104
92
|
var import_crypto_nft_payload_plugin = require("@xyo-network/crypto-nft-payload-plugin");
|
|
@@ -111,48 +99,50 @@ var import_abstract_witness = require("@xyo-network/abstract-witness");
|
|
|
111
99
|
var import_crypto_contract_function_read_payload_plugin2 = require("@xyo-network/crypto-contract-function-read-payload-plugin");
|
|
112
100
|
var import_payload_model2 = require("@xyo-network/payload-model");
|
|
113
101
|
var import_ethers = require("ethers");
|
|
114
|
-
var
|
|
102
|
+
var CryptoContractFunctionReadWitness = class extends import_abstract_witness.AbstractWitness {
|
|
103
|
+
static configSchemas = [...super.configSchemas, import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionReadWitnessConfigSchema];
|
|
104
|
+
static defaultConfigSchema = import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionReadWitnessConfigSchema;
|
|
115
105
|
get abi() {
|
|
116
106
|
return (0, import_assert2.assertEx)(this.config.abi, () => "Missing abi");
|
|
117
107
|
}
|
|
118
108
|
async observeHandler(inPayloads = []) {
|
|
119
109
|
await this.started("throw");
|
|
120
110
|
try {
|
|
121
|
-
const observations = await Promise.all(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
...args ?? this.config.args ?? []
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
111
|
+
const observations = await Promise.all(
|
|
112
|
+
inPayloads.filter((0, import_payload_model2.isPayloadOfSchemaType)(import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionCallSchema)).map(async ({ functionName, args, address }) => {
|
|
113
|
+
const { providers } = this.params;
|
|
114
|
+
const provider = providers[Date.now() % providers.length];
|
|
115
|
+
const validatedAddress = (0, import_assert2.assertEx)(address ?? this.config.address, () => "Missing address");
|
|
116
|
+
const validatedFunctionName = (0, import_assert2.assertEx)(functionName ?? this.config.functionName, () => "Missing address");
|
|
117
|
+
const mergedArgs = [...args ?? this.config.args ?? []];
|
|
118
|
+
const contract = new import_ethers.Contract(validatedAddress, this.abi, provider);
|
|
119
|
+
try {
|
|
120
|
+
const result = await contract[validatedFunctionName](...mergedArgs);
|
|
121
|
+
const transformedResult = typeof result === "bigint" ? result.toString(16) : result;
|
|
122
|
+
const observation = {
|
|
123
|
+
address: validatedAddress,
|
|
124
|
+
args: mergedArgs,
|
|
125
|
+
chainId: Number((await provider.getNetwork()).chainId),
|
|
126
|
+
functionName: validatedFunctionName,
|
|
127
|
+
result: transformedResult,
|
|
128
|
+
schema: import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionCallResultSchema
|
|
129
|
+
};
|
|
130
|
+
return observation;
|
|
131
|
+
} catch (ex) {
|
|
132
|
+
const error = ex;
|
|
133
|
+
console.log(`Error [${this.config.name}]: ${error.code}`);
|
|
134
|
+
const observation = {
|
|
135
|
+
address: validatedAddress,
|
|
136
|
+
args: mergedArgs,
|
|
137
|
+
chainId: Number((await provider.getNetwork()).chainId),
|
|
138
|
+
error: error.code,
|
|
139
|
+
functionName: validatedFunctionName,
|
|
140
|
+
schema: import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionCallResultSchema
|
|
141
|
+
};
|
|
142
|
+
return observation;
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
);
|
|
156
146
|
return observations;
|
|
157
147
|
} catch (ex) {
|
|
158
148
|
const error = ex;
|
|
@@ -161,26 +151,17 @@ var _CryptoContractFunctionReadWitness = class _CryptoContractFunctionReadWitnes
|
|
|
161
151
|
}
|
|
162
152
|
}
|
|
163
153
|
};
|
|
164
|
-
__name(_CryptoContractFunctionReadWitness, "CryptoContractFunctionReadWitness");
|
|
165
|
-
__publicField(_CryptoContractFunctionReadWitness, "configSchemas", [
|
|
166
|
-
...__superGet(_CryptoContractFunctionReadWitness, _CryptoContractFunctionReadWitness, "configSchemas"),
|
|
167
|
-
import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionReadWitnessConfigSchema
|
|
168
|
-
]);
|
|
169
|
-
__publicField(_CryptoContractFunctionReadWitness, "defaultConfigSchema", import_crypto_contract_function_read_payload_plugin2.CryptoContractFunctionReadWitnessConfigSchema);
|
|
170
|
-
var CryptoContractFunctionReadWitness = _CryptoContractFunctionReadWitness;
|
|
171
154
|
|
|
172
155
|
// src/Plugin.ts
|
|
173
|
-
var CryptoContractFunctionReadWitnessPlugin =
|
|
174
|
-
required: {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}, "witness")
|
|
183
|
-
}), "CryptoContractFunctionReadWitnessPlugin");
|
|
156
|
+
var CryptoContractFunctionReadWitnessPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
|
|
157
|
+
{ required: { [import_crypto_nft_payload_plugin.NftSchema]: 1 }, schema: import_payload_model3.PayloadSetSchema },
|
|
158
|
+
{
|
|
159
|
+
witness: async (params) => {
|
|
160
|
+
const result = await CryptoContractFunctionReadWitness.create(params);
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
);
|
|
184
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
185
166
|
0 && (module.exports = {
|
|
186
167
|
CryptoContractDiviner,
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["export * from './Diviner/index.ts'\nexport { CryptoContractFunctionReadWitnessPlugin, CryptoContractFunctionReadWitnessPlugin as default } from './Plugin.ts'\nexport * from './Witness.ts'\n","import { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfo,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadOfSchemaType, Payload, Schema } 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 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\n// eslint-disable-next-line import/no-deprecated\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 { 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, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Contract, Provider } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport type CryptoContractFunctionReadWitnessParams = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n providers: Provider[]\n }\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')\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(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.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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA,oBAAyB;AAEzB,0DASO;AACP,8BAAgC;AAChC,2BAAuD;AAMhD,IAAMA,yBAAN,MAAMA,+BAAyGC,wCAAAA;EAKpH,OAAiBC,eACfC,SACAC,cACAC,UACqB;AA5BzB;AA6BI,UAAMC,eAAeD,SAASE,KAAKC,CAAAA,YAAWA,QAAQJ,iBAAiBA,gBAAgBI,QAAQL,YAAYA,OAAAA;AAC3G,YAAOM,kGAAoCH,YAAAA,MAApCG,mBAAmDC;EAC5D;EAEA,OAAiBC,sBAA+DC,MAAWC,OAA+B;AAjC5H;AAkCI,UAAMC,iBAAgBF,UAAKG,GAAG,CAAA,MAARH,mBAAaC;AAEnC,UAAMG,cAAcJ,KAAKK,OAAO,CAACC,MAAMC,QAAAA;AACrC,aAAOD,QAAQC,IAAIN,KAAAA,MAAWC;IAChC,GAAG,KAAA;AACH,WAAOE,cAAcI,SAAYN;EACnC;EAEUO,2BAA2BC,aAA+D;AAClG,WAAO;MACLnB,aAASoB,wBAASvB,uBAAsBW,sBAAsBW,aAAa,SAAA,GAAY,MAAM,oBAAA;MAC7FE,aAASD,wBAASvB,uBAAsBW,sBAAsBW,aAAa,SAAA,GAAY,MAAM,oBAAA;MAC7FG,QAAQC;IACV;EACF;EAEA,MAAyBC,cAAcC,aAAiD,CAAA,GAA6B;AACnH,UAAMN,cAAcM,WAAWC,WAAOC,4CAAwDC,0FAAAA,CAAAA;AAC9F,UAAMC,YAAYC,OAAOC;;MAEvBZ,YAAYL,OAAgC,CAACC,MAAMR,YAAAA;AACjD,YAAIA,QAAOP,SAAS;AAClBe,eAAKR,QAAOP,OAAO,IAAI;QACzB;AACA,eAAOe;MACT,GAAG,CAAC,CAAA;IAAA;AAEN,UAAMR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BA,IAAMgD,0CAA0C,iCAErDC,wDACE;EAAEC,UAAU;IAAE,CAACC,0CAAAA,GAAY;EAAE;EAAGC,QAAQC;AAAiB,GACzD;EACEC,SAAS,8BAAOC,WAAAA;AACd,UAAMC,SAAS,MAAMC,kCAAkCC,OAAOH,MAAAA;AAC9D,WAAOC;EACT,GAHS;AAIX,CAAA,GATmD;","names":["CryptoContractDiviner","AbstractDiviner","findCallResult","address","functionName","payloads","foundPayload","find","payload","asCryptoContractFunctionCallSuccess","result","matchingExistingField","objs","field","expectedValue","at","didNotMatch","reduce","prev","obj","undefined","contractInfoRequiredFields","callResults","assertEx","chainId","schema","ContractInfoSchema","divineHandler","inPayloads","filter","isPayloadOfSchemaType","CryptoContractFunctionCallResultSchema","addresses","Object","keys","Promise","all","map","foundCallResults","callResult","info","results","reduceResults","configSchemas","CryptoContractDivinerConfigSchema","defaultConfigSchema","labels","CryptoContractDivinerLabels","import_payload_model","import_assert","import_crypto_contract_function_read_payload_plugin","import_payload_model","CryptoContractFunctionReadWitness","AbstractWitness","abi","assertEx","config","observeHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","CryptoContractFunctionCallSchema","map","functionName","args","address","providers","params","provider","Date","now","length","validatedAddress","validatedFunctionName","mergedArgs","contract","Contract","result","transformedResult","toString","observation","chainId","Number","getNetwork","schema","CryptoContractFunctionCallResultSchema","ex","error","console","log","name","code","message","configSchemas","CryptoContractFunctionReadWitnessConfigSchema","defaultConfigSchema","CryptoContractFunctionReadWitnessPlugin","createPayloadSetWitnessPlugin","required","NftSchema","schema","PayloadSetSchema","witness","params","result","CryptoContractFunctionReadWitness","create"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["export * from './Diviner/index.ts'\nexport { CryptoContractFunctionReadWitnessPlugin, CryptoContractFunctionReadWitnessPlugin as default } from './Plugin.ts'\nexport * from './Witness.ts'\n","import { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfo,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadOfSchemaType, Payload, Schema } 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 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\n// eslint-disable-next-line import/no-deprecated\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 { 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, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Contract, Provider } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport type CryptoContractFunctionReadWitnessParams = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n providers: Provider[]\n }\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')\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(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.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AAEzB,0DASO;AACP,8BAAgC;AAChC,2BAAuD;AAMhD,IAAM,wBAAN,MAAM,+BAAyG,wCAAyB;AAAA,EAC7I,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,qFAAiC;AAAA,EAC7G,OAAyB,sBAA8B;AAAA,EACvD,OAAgB,SAAsC,EAAE,GAAG,MAAM,QAAQ,GAAG,gFAA4B;AAAA,EAExG,OAAiB,eACf,SACA,cACA,UACqB;AA5BzB;AA6BI,UAAM,eAAe,SAAS,KAAK,aAAW,QAAQ,iBAAiB,gBAAgB,QAAQ,YAAY,OAAO;AAClH,YAAO,kGAAoC,YAAY,MAAhD,mBAAmD;AAAA,EAC5D;AAAA,EAEA,OAAiB,sBAA+D,MAAW,OAA+B;AAjC5H;AAkCI,UAAM,iBAAgB,UAAK,GAAG,CAAC,MAAT,mBAAa;AAEnC,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,aAAS,wBAAS,uBAAsB,sBAAsB,aAAa,SAAS,GA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;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;;;AD1EO,IAAM,0CAA0C,UAErD;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,0CAAS,GAAG,EAAE,GAAG,QAAQ,uCAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,kCAAkC,OAAO,MAAM;AACpE,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result","import_payload_model","import_assert","import_crypto_contract_function_read_payload_plugin","import_payload_model"]}
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
-
var __reflectGet = Reflect.get;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
8
|
-
|
|
9
1
|
// src/Diviner/Diviner.ts
|
|
10
2
|
import { assertEx } from "@xylabs/assert";
|
|
11
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
asCryptoContractFunctionCallSuccess,
|
|
5
|
+
ContractInfoSchema,
|
|
6
|
+
CryptoContractDivinerConfigSchema,
|
|
7
|
+
CryptoContractDivinerLabels,
|
|
8
|
+
CryptoContractFunctionCallResultSchema
|
|
9
|
+
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
12
10
|
import { AbstractDiviner } from "@xyo-network/diviner-abstract";
|
|
13
11
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
14
|
-
var
|
|
12
|
+
var CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDiviner {
|
|
13
|
+
static configSchemas = [...super.configSchemas, CryptoContractDivinerConfigSchema];
|
|
14
|
+
static defaultConfigSchema = CryptoContractDivinerConfigSchema;
|
|
15
|
+
static labels = { ...super.labels, ...CryptoContractDivinerLabels };
|
|
15
16
|
static findCallResult(address, functionName, payloads) {
|
|
16
17
|
var _a;
|
|
17
18
|
const foundPayload = payloads.find((payload) => payload.functionName === functionName && payload.address === address);
|
|
@@ -43,14 +44,16 @@ var _CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDivine
|
|
|
43
44
|
return prev;
|
|
44
45
|
}, {})
|
|
45
46
|
);
|
|
46
|
-
const result = await Promise.all(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
const result = await Promise.all(
|
|
48
|
+
addresses.map(async (address) => {
|
|
49
|
+
const foundCallResults = callResults.filter((callResult) => callResult.address === address);
|
|
50
|
+
const info = {
|
|
51
|
+
results: await this.reduceResults(foundCallResults),
|
|
52
|
+
...this.contractInfoRequiredFields(foundCallResults)
|
|
53
|
+
};
|
|
54
|
+
return info;
|
|
55
|
+
})
|
|
56
|
+
);
|
|
54
57
|
return result;
|
|
55
58
|
}
|
|
56
59
|
reduceResults(callResults) {
|
|
@@ -61,17 +64,6 @@ var _CryptoContractDiviner = class _CryptoContractDiviner extends AbstractDivine
|
|
|
61
64
|
}, {});
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
|
-
__name(_CryptoContractDiviner, "CryptoContractDiviner");
|
|
65
|
-
__publicField(_CryptoContractDiviner, "configSchemas", [
|
|
66
|
-
...__superGet(_CryptoContractDiviner, _CryptoContractDiviner, "configSchemas"),
|
|
67
|
-
CryptoContractDivinerConfigSchema
|
|
68
|
-
]);
|
|
69
|
-
__publicField(_CryptoContractDiviner, "defaultConfigSchema", CryptoContractDivinerConfigSchema);
|
|
70
|
-
__publicField(_CryptoContractDiviner, "labels", {
|
|
71
|
-
...__superGet(_CryptoContractDiviner, _CryptoContractDiviner, "labels"),
|
|
72
|
-
...CryptoContractDivinerLabels
|
|
73
|
-
});
|
|
74
|
-
var CryptoContractDiviner = _CryptoContractDiviner;
|
|
75
67
|
|
|
76
68
|
// src/Plugin.ts
|
|
77
69
|
import { NftSchema } from "@xyo-network/crypto-nft-payload-plugin";
|
|
@@ -81,51 +73,57 @@ import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
|
|
|
81
73
|
// src/Witness.ts
|
|
82
74
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
83
75
|
import { AbstractWitness } from "@xyo-network/abstract-witness";
|
|
84
|
-
import {
|
|
76
|
+
import {
|
|
77
|
+
CryptoContractFunctionCallResultSchema as CryptoContractFunctionCallResultSchema2,
|
|
78
|
+
CryptoContractFunctionCallSchema,
|
|
79
|
+
CryptoContractFunctionReadWitnessConfigSchema
|
|
80
|
+
} from "@xyo-network/crypto-contract-function-read-payload-plugin";
|
|
85
81
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
86
82
|
import { Contract } from "ethers";
|
|
87
|
-
var
|
|
83
|
+
var CryptoContractFunctionReadWitness = class extends AbstractWitness {
|
|
84
|
+
static configSchemas = [...super.configSchemas, CryptoContractFunctionReadWitnessConfigSchema];
|
|
85
|
+
static defaultConfigSchema = CryptoContractFunctionReadWitnessConfigSchema;
|
|
88
86
|
get abi() {
|
|
89
87
|
return assertEx2(this.config.abi, () => "Missing abi");
|
|
90
88
|
}
|
|
91
89
|
async observeHandler(inPayloads = []) {
|
|
92
90
|
await this.started("throw");
|
|
93
91
|
try {
|
|
94
|
-
const observations = await Promise.all(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
...args ?? this.config.args ?? []
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
92
|
+
const observations = await Promise.all(
|
|
93
|
+
inPayloads.filter(isPayloadOfSchemaType2(CryptoContractFunctionCallSchema)).map(async ({ functionName, args, address }) => {
|
|
94
|
+
const { providers } = this.params;
|
|
95
|
+
const provider = providers[Date.now() % providers.length];
|
|
96
|
+
const validatedAddress = assertEx2(address ?? this.config.address, () => "Missing address");
|
|
97
|
+
const validatedFunctionName = assertEx2(functionName ?? this.config.functionName, () => "Missing address");
|
|
98
|
+
const mergedArgs = [...args ?? this.config.args ?? []];
|
|
99
|
+
const contract = new Contract(validatedAddress, this.abi, provider);
|
|
100
|
+
try {
|
|
101
|
+
const result = await contract[validatedFunctionName](...mergedArgs);
|
|
102
|
+
const transformedResult = typeof result === "bigint" ? result.toString(16) : result;
|
|
103
|
+
const observation = {
|
|
104
|
+
address: validatedAddress,
|
|
105
|
+
args: mergedArgs,
|
|
106
|
+
chainId: Number((await provider.getNetwork()).chainId),
|
|
107
|
+
functionName: validatedFunctionName,
|
|
108
|
+
result: transformedResult,
|
|
109
|
+
schema: CryptoContractFunctionCallResultSchema2
|
|
110
|
+
};
|
|
111
|
+
return observation;
|
|
112
|
+
} catch (ex) {
|
|
113
|
+
const error = ex;
|
|
114
|
+
console.log(`Error [${this.config.name}]: ${error.code}`);
|
|
115
|
+
const observation = {
|
|
116
|
+
address: validatedAddress,
|
|
117
|
+
args: mergedArgs,
|
|
118
|
+
chainId: Number((await provider.getNetwork()).chainId),
|
|
119
|
+
error: error.code,
|
|
120
|
+
functionName: validatedFunctionName,
|
|
121
|
+
schema: CryptoContractFunctionCallResultSchema2
|
|
122
|
+
};
|
|
123
|
+
return observation;
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
);
|
|
129
127
|
return observations;
|
|
130
128
|
} catch (ex) {
|
|
131
129
|
const error = ex;
|
|
@@ -134,26 +132,17 @@ var _CryptoContractFunctionReadWitness = class _CryptoContractFunctionReadWitnes
|
|
|
134
132
|
}
|
|
135
133
|
}
|
|
136
134
|
};
|
|
137
|
-
__name(_CryptoContractFunctionReadWitness, "CryptoContractFunctionReadWitness");
|
|
138
|
-
__publicField(_CryptoContractFunctionReadWitness, "configSchemas", [
|
|
139
|
-
...__superGet(_CryptoContractFunctionReadWitness, _CryptoContractFunctionReadWitness, "configSchemas"),
|
|
140
|
-
CryptoContractFunctionReadWitnessConfigSchema
|
|
141
|
-
]);
|
|
142
|
-
__publicField(_CryptoContractFunctionReadWitness, "defaultConfigSchema", CryptoContractFunctionReadWitnessConfigSchema);
|
|
143
|
-
var CryptoContractFunctionReadWitness = _CryptoContractFunctionReadWitness;
|
|
144
135
|
|
|
145
136
|
// src/Plugin.ts
|
|
146
|
-
var CryptoContractFunctionReadWitnessPlugin =
|
|
147
|
-
required: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}, "witness")
|
|
156
|
-
}), "CryptoContractFunctionReadWitnessPlugin");
|
|
137
|
+
var CryptoContractFunctionReadWitnessPlugin = () => createPayloadSetWitnessPlugin(
|
|
138
|
+
{ required: { [NftSchema]: 1 }, schema: PayloadSetSchema },
|
|
139
|
+
{
|
|
140
|
+
witness: async (params) => {
|
|
141
|
+
const result = await CryptoContractFunctionReadWitness.create(params);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
);
|
|
157
146
|
export {
|
|
158
147
|
CryptoContractDiviner,
|
|
159
148
|
CryptoContractFunctionReadWitness,
|
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 { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfo,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadOfSchemaType, Payload, Schema } 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 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\n// eslint-disable-next-line import/no-deprecated\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 { 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, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Contract, Provider } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport type CryptoContractFunctionReadWitnessParams = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n providers: Provider[]\n }\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')\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(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.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":";;;;;;;;;AAAA,SAASA,gBAAgB;AAEzB,SACEC,qCAEAC,oBACAC,mCACAC,6BAGAC,8CACK;AACP,SAASC,uBAAuB;AAChC,SAASC,6BAA8C;AAMhD,IAAMC,yBAAN,MAAMA,+BAAyGC,gBAAAA;EAKpH,OAAiBC,eACfC,SACAC,cACAC,UACqB;AA5BzB;AA6BI,UAAMC,eAAeD,SAASE,KAAKC,CAAAA,YAAWA,QAAQJ,iBAAiBA,gBAAgBI,QAAQL,YAAYA,OAAAA;AAC3G,YAAOM,yCAAoCH,YAAAA,MAApCG,mBAAmDC;EAC5D;EAEA,OAAiBC,sBAA+DC,MAAWC,OAA+B;AAjC5H;AAkCI,UAAMC,iBAAgBF,UAAKG,GAAG,CAAA,MAARH,mBAAaC;AAEnC,UAAMG,cAAcJ,KAAKK,OAAO,CAACC,MAAMC,QAAAA;AACrC,aAAOD,QAAQC,IAAIN,KAAAA,MAAWC;IAChC,GAAG,KAAA;AACH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L;QACT,SAASM,IAAI;AACX,gBAAMC,QAAQD;AACdE,kBAAQC,IAAI,UAAU,KAAKrC,OAAOsC,IAAI,MAAMH,MAAMI,IAAI,EAAE;AACxD,gBAAMX,cAAiD;YACrDf,SAASO;YACTR,MAAMU;YACNO,SAASC,QAAQ,MAAMd,SAASe,WAAU,GAAIF,OAAO;YACrDM,OAAOA,MAAMI;YACb5B,cAAcU;YACdW,QAAQC;UACV;AACA,iBAAOL;QACT;MACF,CAAA,CAAA;AAEF,aAAOxB;IACT,SAAS8B,IAAI;AACX,YAAMC,QAAQD;AACdE,cAAQC,IAAI,UAAU,KAAKrC,OAAOsC,IAAI,MAAMH,MAAMK,OAAO,EAAE;AAC3D,YAAML;IACR;EACF;AACF;AAtDUtC;AACR,cAHWD,oCAGc6C,iBAA0B;KAAI,mFAAMA;EAAeC;;AAC5E,cAJW9C,oCAIc+C,uBAA8BD;AAJlD,IAAM9C,oCAAN;;;ADlBA,IAAMgD,0CAA0C,6BAErDC,8BACE;EAAEC,UAAU;IAAE,CAACC,SAAAA,GAAY;EAAE;EAAGC,QAAQC;AAAiB,GACzD;EACEC,SAAS,8BAAOC,WAAAA;AACd,UAAMC,SAAS,MAAMC,kCAAkCC,OAAOH,MAAAA;AAC9D,WAAOC;EACT,GAHS;AAIX,CAAA,GATmD;","names":["assertEx","asCryptoContractFunctionCallSuccess","ContractInfoSchema","CryptoContractDivinerConfigSchema","CryptoContractDivinerLabels","CryptoContractFunctionCallResultSchema","AbstractDiviner","isPayloadOfSchemaType","CryptoContractDiviner","AbstractDiviner","findCallResult","address","functionName","payloads","foundPayload","find","payload","asCryptoContractFunctionCallSuccess","result","matchingExistingField","objs","field","expectedValue","at","didNotMatch","reduce","prev","obj","undefined","contractInfoRequiredFields","callResults","assertEx","chainId","schema","ContractInfoSchema","divineHandler","inPayloads","filter","isPayloadOfSchemaType","CryptoContractFunctionCallResultSchema","addresses","Object","keys","Promise","all","map","foundCallResults","callResult","info","results","reduceResults","configSchemas","CryptoContractDivinerConfigSchema","defaultConfigSchema","labels","CryptoContractDivinerLabels","NftSchema","PayloadSetSchema","createPayloadSetWitnessPlugin","assertEx","AbstractWitness","CryptoContractFunctionCallResultSchema","CryptoContractFunctionCallSchema","CryptoContractFunctionReadWitnessConfigSchema","isPayloadOfSchemaType","Contract","CryptoContractFunctionReadWitness","AbstractWitness","abi","assertEx","config","observeHandler","inPayloads","started","observations","Promise","all","filter","isPayloadOfSchemaType","CryptoContractFunctionCallSchema","map","functionName","args","address","providers","params","provider","Date","now","length","validatedAddress","validatedFunctionName","mergedArgs","contract","Contract","result","transformedResult","toString","observation","chainId","Number","getNetwork","schema","CryptoContractFunctionCallResultSchema","ex","error","console","log","name","code","message","configSchemas","CryptoContractFunctionReadWitnessConfigSchema","defaultConfigSchema","CryptoContractFunctionReadWitnessPlugin","createPayloadSetWitnessPlugin","required","NftSchema","schema","PayloadSetSchema","witness","params","result","CryptoContractFunctionReadWitness","create"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { Promisable } from '@xylabs/promise'\nimport {\n asCryptoContractFunctionCallSuccess,\n ContractInfo,\n ContractInfoSchema,\n CryptoContractDivinerConfigSchema,\n CryptoContractDivinerLabels,\n CryptoContractDivinerParams,\n CryptoContractFunctionCallResult,\n CryptoContractFunctionCallResultSchema,\n} from '@xyo-network/crypto-contract-function-read-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { isPayloadOfSchemaType, Payload, Schema } 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 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\n// eslint-disable-next-line import/no-deprecated\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 { 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, Schema } from '@xyo-network/payload-model'\nimport { WitnessParams } from '@xyo-network/witness-model'\nimport { Contract, Provider } from 'ethers'\n\n/** @deprecated use EvmCallWitness instead */\nexport type CryptoContractFunctionReadWitnessParams = WitnessParams<\n AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,\n {\n providers: Provider[]\n }\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')\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(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.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":";AAAA,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,6BAA8C;AAMhD,IAAM,wBAAN,MAAM,+BAAyG,g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ptoContractFunctionCallResultSchema","isPayloadOfSchemaType"]}
|
package/package.json
CHANGED
|
@@ -10,42 +10,42 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/plugins/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/assert": "^3.6.
|
|
14
|
-
"@xylabs/promise": "^3.6.
|
|
15
|
-
"@xyo-network/abstract-witness": "^2.111.
|
|
16
|
-
"@xyo-network/crypto-contract-function-read-payload-plugin": "^2.99.
|
|
17
|
-
"@xyo-network/crypto-nft-payload-plugin": "^2.99.
|
|
18
|
-
"@xyo-network/diviner-abstract": "^2.111.
|
|
19
|
-
"@xyo-network/module-model": "^2.111.
|
|
20
|
-
"@xyo-network/payload-model": "^2.111.
|
|
21
|
-
"@xyo-network/payloadset-plugin": "^2.111.
|
|
22
|
-
"@xyo-network/witness-model": "^2.111.
|
|
13
|
+
"@xylabs/assert": "^3.6.12",
|
|
14
|
+
"@xylabs/promise": "^3.6.12",
|
|
15
|
+
"@xyo-network/abstract-witness": "^2.111.3",
|
|
16
|
+
"@xyo-network/crypto-contract-function-read-payload-plugin": "^2.99.6",
|
|
17
|
+
"@xyo-network/crypto-nft-payload-plugin": "^2.99.6",
|
|
18
|
+
"@xyo-network/diviner-abstract": "^2.111.3",
|
|
19
|
+
"@xyo-network/module-model": "^2.111.3",
|
|
20
|
+
"@xyo-network/payload-model": "^2.111.3",
|
|
21
|
+
"@xyo-network/payloadset-plugin": "^2.111.3",
|
|
22
|
+
"@xyo-network/witness-model": "^2.111.3",
|
|
23
23
|
"ethers": "^6.13.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@xylabs/delay": "^3.6.
|
|
27
|
-
"@xylabs/hex": "^3.6.
|
|
28
|
-
"@xylabs/jest-helpers": "^3.6.
|
|
29
|
-
"@xylabs/ts-scripts-yarn3": "^3.15.
|
|
30
|
-
"@xylabs/tsconfig": "^3.15.
|
|
31
|
-
"@xyo-network/account": "^2.111.
|
|
32
|
-
"@xyo-network/archivist-memory": "^2.111.
|
|
33
|
-
"@xyo-network/diviner-boundwitness-memory": "^2.111.
|
|
34
|
-
"@xyo-network/diviner-jsonpatch": "^2.111.
|
|
35
|
-
"@xyo-network/diviner-jsonpath-aggregate-memory": "^2.111.
|
|
36
|
-
"@xyo-network/diviner-model": "^2.111.
|
|
37
|
-
"@xyo-network/diviner-payload-memory": "^2.111.
|
|
38
|
-
"@xyo-network/diviner-payload-model": "^2.111.
|
|
39
|
-
"@xyo-network/diviner-range": "^2.111.
|
|
40
|
-
"@xyo-network/diviner-temporal-indexing": "^2.111.
|
|
41
|
-
"@xyo-network/evm-nft-id-payload-plugin": "^2.99.
|
|
42
|
-
"@xyo-network/manifest": "^2.111.
|
|
43
|
-
"@xyo-network/module-factory-locator": "^2.111.
|
|
44
|
-
"@xyo-network/node-memory": "^2.111.
|
|
45
|
-
"@xyo-network/open-zeppelin-typechain": "^3.0
|
|
46
|
-
"@xyo-network/sentinel-model": "^2.111.
|
|
47
|
-
"@xyo-network/witness-blockchain-abstract": "^2.111.
|
|
48
|
-
"@xyo-network/witness-timestamp": "^2.111.
|
|
26
|
+
"@xylabs/delay": "^3.6.12",
|
|
27
|
+
"@xylabs/hex": "^3.6.12",
|
|
28
|
+
"@xylabs/jest-helpers": "^3.6.12",
|
|
29
|
+
"@xylabs/ts-scripts-yarn3": "^3.15.14",
|
|
30
|
+
"@xylabs/tsconfig": "^3.15.14",
|
|
31
|
+
"@xyo-network/account": "^2.111.3",
|
|
32
|
+
"@xyo-network/archivist-memory": "^2.111.3",
|
|
33
|
+
"@xyo-network/diviner-boundwitness-memory": "^2.111.3",
|
|
34
|
+
"@xyo-network/diviner-jsonpatch": "^2.111.3",
|
|
35
|
+
"@xyo-network/diviner-jsonpath-aggregate-memory": "^2.111.3",
|
|
36
|
+
"@xyo-network/diviner-model": "^2.111.3",
|
|
37
|
+
"@xyo-network/diviner-payload-memory": "^2.111.3",
|
|
38
|
+
"@xyo-network/diviner-payload-model": "^2.111.3",
|
|
39
|
+
"@xyo-network/diviner-range": "^2.111.3",
|
|
40
|
+
"@xyo-network/diviner-temporal-indexing": "^2.111.3",
|
|
41
|
+
"@xyo-network/evm-nft-id-payload-plugin": "^2.99.6",
|
|
42
|
+
"@xyo-network/manifest": "^2.111.3",
|
|
43
|
+
"@xyo-network/module-factory-locator": "^2.111.3",
|
|
44
|
+
"@xyo-network/node-memory": "^2.111.3",
|
|
45
|
+
"@xyo-network/open-zeppelin-typechain": "^3.1.0",
|
|
46
|
+
"@xyo-network/sentinel-model": "^2.111.3",
|
|
47
|
+
"@xyo-network/witness-blockchain-abstract": "^2.111.3",
|
|
48
|
+
"@xyo-network/witness-timestamp": "^2.111.3",
|
|
49
49
|
"async-mutex": "^0.5.0",
|
|
50
50
|
"jest": "^29.7.0",
|
|
51
51
|
"typescript": "^5.5.4"
|
|
@@ -89,6 +89,6 @@
|
|
|
89
89
|
"url": "https://github.com/XYOracleNetwork/plugins.git"
|
|
90
90
|
},
|
|
91
91
|
"sideEffects": false,
|
|
92
|
-
"version": "2.99.
|
|
92
|
+
"version": "2.99.6",
|
|
93
93
|
"type": "module"
|
|
94
94
|
}
|