@xyo-network/crypto-contract-function-read-plugin 2.85.0 → 2.85.2

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.
Files changed (66) hide show
  1. package/dist/browser/Diviner/Diviner.d.cts +3 -1
  2. package/dist/browser/Diviner/Diviner.d.cts.map +1 -1
  3. package/dist/browser/Diviner/Diviner.d.mts +3 -1
  4. package/dist/browser/Diviner/Diviner.d.mts.map +1 -1
  5. package/dist/browser/Diviner/Diviner.d.ts +3 -1
  6. package/dist/browser/Diviner/Diviner.d.ts.map +1 -1
  7. package/dist/browser/Plugin.d.cts +1 -2
  8. package/dist/browser/Plugin.d.cts.map +1 -1
  9. package/dist/browser/Plugin.d.mts +1 -2
  10. package/dist/browser/Plugin.d.mts.map +1 -1
  11. package/dist/browser/Plugin.d.ts +1 -2
  12. package/dist/browser/Plugin.d.ts.map +1 -1
  13. package/dist/browser/Witness.d.cts +2 -0
  14. package/dist/browser/Witness.d.cts.map +1 -1
  15. package/dist/browser/Witness.d.mts +2 -0
  16. package/dist/browser/Witness.d.mts.map +1 -1
  17. package/dist/browser/Witness.d.ts +2 -0
  18. package/dist/browser/Witness.d.ts.map +1 -1
  19. package/dist/browser/index.cjs +70 -72
  20. package/dist/browser/index.cjs.map +1 -1
  21. package/dist/browser/index.d.cts +1 -3
  22. package/dist/browser/index.d.cts.map +1 -1
  23. package/dist/browser/index.d.mts +1 -3
  24. package/dist/browser/index.d.mts.map +1 -1
  25. package/dist/browser/index.d.ts +1 -3
  26. package/dist/browser/index.d.ts.map +1 -1
  27. package/dist/browser/index.js +73 -75
  28. package/dist/browser/index.js.map +1 -1
  29. package/dist/node/Diviner/Diviner.d.cts +3 -1
  30. package/dist/node/Diviner/Diviner.d.cts.map +1 -1
  31. package/dist/node/Diviner/Diviner.d.mts +3 -1
  32. package/dist/node/Diviner/Diviner.d.mts.map +1 -1
  33. package/dist/node/Diviner/Diviner.d.ts +3 -1
  34. package/dist/node/Diviner/Diviner.d.ts.map +1 -1
  35. package/dist/node/Plugin.d.cts +1 -2
  36. package/dist/node/Plugin.d.cts.map +1 -1
  37. package/dist/node/Plugin.d.mts +1 -2
  38. package/dist/node/Plugin.d.mts.map +1 -1
  39. package/dist/node/Plugin.d.ts +1 -2
  40. package/dist/node/Plugin.d.ts.map +1 -1
  41. package/dist/node/Witness.d.cts +2 -0
  42. package/dist/node/Witness.d.cts.map +1 -1
  43. package/dist/node/Witness.d.mts +2 -0
  44. package/dist/node/Witness.d.mts.map +1 -1
  45. package/dist/node/Witness.d.ts +2 -0
  46. package/dist/node/Witness.d.ts.map +1 -1
  47. package/dist/node/index.cjs +73 -75
  48. package/dist/node/index.cjs.map +1 -1
  49. package/dist/node/index.d.cts +1 -3
  50. package/dist/node/index.d.cts.map +1 -1
  51. package/dist/node/index.d.mts +1 -3
  52. package/dist/node/index.d.mts.map +1 -1
  53. package/dist/node/index.d.ts +1 -3
  54. package/dist/node/index.d.ts.map +1 -1
  55. package/dist/node/index.js +76 -78
  56. package/dist/node/index.js.map +1 -1
  57. package/package.json +31 -31
  58. package/src/Diviner/Diviner.ts +7 -2
  59. package/src/Plugin.ts +2 -0
  60. package/src/Witness.ts +2 -0
  61. package/src/index.ts +1 -7
  62. package/src/spec/AddressToContract/AddressToContractIndex/Contract.Sentinel.Node.json +44 -18
  63. package/src/spec/AddressToContract/Erc721Sentinel.json +7 -7
  64. package/src/spec/AddressToTotalSupplyIndex/Erc721.TotalSupply.Index.json +5 -3
  65. package/src/spec/NftIndexToNftIdIndex/Erc721.NftId.Index.json +325 -0
  66. package/src/spec/TotalSupplyToNftIndexIndex/Erc721.NftIndex.Index.json +118 -28
package/package.json CHANGED
@@ -10,41 +10,41 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^2.13.20",
14
- "@xylabs/promise": "^2.13.20",
15
- "@xyo-network/abstract-diviner": "^2.85.0",
16
- "@xyo-network/abstract-witness": "^2.85.0",
17
- "@xyo-network/crypto-contract-function-read-payload-plugin": "~2.85.0",
18
- "@xyo-network/crypto-nft-payload-plugin": "~2.85.0",
19
- "@xyo-network/module-model": "^2.85.0",
20
- "@xyo-network/payload-model": "^2.85.0",
21
- "@xyo-network/payloadset-plugin": "^2.85.0",
22
- "@xyo-network/witness-model": "^2.85.0",
23
- "ethers": "^6.9.1"
13
+ "@xylabs/assert": "^2.13.23",
14
+ "@xylabs/promise": "^2.13.23",
15
+ "@xyo-network/abstract-witness": "^2.85.8",
16
+ "@xyo-network/crypto-contract-function-read-payload-plugin": "~2.85.2",
17
+ "@xyo-network/crypto-nft-payload-plugin": "~2.85.2",
18
+ "@xyo-network/diviner-abstract": "^2.85.8",
19
+ "@xyo-network/module-model": "^2.85.8",
20
+ "@xyo-network/payload-model": "^2.85.8",
21
+ "@xyo-network/payloadset-plugin": "^2.85.8",
22
+ "@xyo-network/witness-model": "^2.85.8",
23
+ "ethers": "^6.9.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@xylabs/delay": "^2.13.20",
27
- "@xylabs/hex": "^2.13.20",
28
- "@xylabs/jest-helpers": "^2.13.20",
26
+ "@xylabs/delay": "^2.13.23",
27
+ "@xylabs/hex": "^2.13.23",
28
+ "@xylabs/jest-helpers": "^2.13.23",
29
29
  "@xylabs/ts-scripts-yarn3": "^3.2.25",
30
30
  "@xylabs/tsconfig": "^3.2.25",
31
- "@xyo-network/account": "^2.85.0",
32
- "@xyo-network/diviner-boundwitness-memory": "^2.85.0",
33
- "@xyo-network/diviner-jsonpatch": "^2.85.0",
34
- "@xyo-network/diviner-jsonpath-aggregate-memory": "^2.85.0",
35
- "@xyo-network/diviner-model": "^2.85.0",
36
- "@xyo-network/diviner-payload-memory": "^2.85.0",
37
- "@xyo-network/diviner-payload-model": "^2.85.0",
38
- "@xyo-network/diviner-range": "^2.85.0",
39
- "@xyo-network/diviner-temporal-indexing": "^2.85.0",
40
- "@xyo-network/evm-nft-id-payload-plugin": "~2.85.0",
41
- "@xyo-network/manifest": "^2.85.0",
42
- "@xyo-network/memory-archivist": "^2.85.0",
43
- "@xyo-network/node-memory": "^2.85.0",
31
+ "@xyo-network/account": "^2.85.8",
32
+ "@xyo-network/archivist-memory": "^2.85.8",
33
+ "@xyo-network/diviner-boundwitness-memory": "^2.85.8",
34
+ "@xyo-network/diviner-jsonpatch": "^2.85.8",
35
+ "@xyo-network/diviner-jsonpath-aggregate-memory": "^2.85.8",
36
+ "@xyo-network/diviner-model": "^2.85.8",
37
+ "@xyo-network/diviner-payload-memory": "^2.85.8",
38
+ "@xyo-network/diviner-payload-model": "^2.85.8",
39
+ "@xyo-network/diviner-range": "^2.85.8",
40
+ "@xyo-network/diviner-temporal-indexing": "^2.85.8",
41
+ "@xyo-network/evm-nft-id-payload-plugin": "~2.85.2",
42
+ "@xyo-network/manifest": "^2.85.8",
43
+ "@xyo-network/node-memory": "^2.85.8",
44
44
  "@xyo-network/open-zeppelin-typechain": "^3.0.5",
45
- "@xyo-network/sentinel-model": "^2.85.0",
46
- "@xyo-network/witness-blockchain-abstract": "^2.85.0",
47
- "@xyo-network/witness-timestamp": "^2.85.0",
45
+ "@xyo-network/sentinel-model": "^2.85.8",
46
+ "@xyo-network/witness-blockchain-abstract": "^2.85.8",
47
+ "@xyo-network/witness-timestamp": "^2.85.8",
48
48
  "async-mutex": "^0.4.0",
49
49
  "jest": "^29.7.0",
50
50
  "typescript": "^5.3.3"
@@ -88,6 +88,6 @@
88
88
  "url": "https://github.com/XYOracleNetwork/plugins.git"
89
89
  },
90
90
  "sideEffects": false,
91
- "version": "2.85.0",
91
+ "version": "2.85.2",
92
92
  "type": "module"
93
93
  }
@@ -1,6 +1,5 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { Promisable } from '@xylabs/promise'
3
- import { AbstractDiviner } from '@xyo-network/abstract-diviner'
4
3
  import {
5
4
  asCryptoContractFunctionCallSuccess,
6
5
  ContractInfo,
@@ -11,10 +10,13 @@ import {
11
10
  CryptoContractFunctionCallResult,
12
11
  CryptoContractFunctionCallResultSchema,
13
12
  } from '@xyo-network/crypto-contract-function-read-payload-plugin'
13
+ import { AbstractDiviner } from '@xyo-network/diviner-abstract'
14
14
  import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'
15
15
 
16
+ /** @deprecated use EvmCallDiviner instead */
16
17
  export type FindCallResult<TResult = string, TPayload = Payload> = [TResult, TPayload] | [undefined, TPayload] | [undefined, undefined]
17
18
 
19
+ /** @deprecated use EvmCallDiviner instead */
18
20
  export class CryptoContractDiviner<TParams extends CryptoContractDivinerParams = CryptoContractDivinerParams> extends AbstractDiviner<TParams> {
19
21
  static override configSchemas = [CryptoContractDivinerConfigSchema]
20
22
  static labels: CryptoContractDivinerLabels = CryptoContractDivinerLabels
@@ -30,6 +32,7 @@ export class CryptoContractDiviner<TParams extends CryptoContractDivinerParams =
30
32
 
31
33
  protected static matchingExistingField<R = string, T extends Payload = Payload>(objs: T[], field: keyof T): R | undefined {
32
34
  const expectedValue = objs.at(0)?.[field] as R
35
+ // eslint-disable-next-line unicorn/no-array-reduce
33
36
  const didNotMatch = objs.reduce((prev, obj) => {
34
37
  return prev || obj[field] !== expectedValue
35
38
  }, false)
@@ -47,6 +50,7 @@ export class CryptoContractDiviner<TParams extends CryptoContractDivinerParams =
47
50
  protected override async divineHandler(inPayloads: CryptoContractFunctionCallResult[] = []): Promise<ContractInfo[]> {
48
51
  const callResults = inPayloads.filter(isPayloadOfSchemaType<CryptoContractFunctionCallResult>(CryptoContractFunctionCallResultSchema))
49
52
  const addresses = Object.keys(
53
+ // eslint-disable-next-line unicorn/no-array-reduce
50
54
  callResults.reduce<Record<string, boolean>>((prev, result) => {
51
55
  if (result.address) {
52
56
  prev[result.address] = true
@@ -58,7 +62,7 @@ export class CryptoContractDiviner<TParams extends CryptoContractDivinerParams =
58
62
  addresses.map(async (address) => {
59
63
  const foundCallResults = callResults.filter((callResult) => callResult.address === address)
60
64
  const info: ContractInfo = {
61
- ...{ results: await this.reduceResults(foundCallResults) },
65
+ results: await this.reduceResults(foundCallResults),
62
66
  ...this.contractInfoRequiredFields(foundCallResults),
63
67
  }
64
68
  return info
@@ -69,6 +73,7 @@ export class CryptoContractDiviner<TParams extends CryptoContractDivinerParams =
69
73
  }
70
74
 
71
75
  protected reduceResults(callResults: CryptoContractFunctionCallResult[]): Promisable<ContractInfo['results']> {
76
+ // eslint-disable-next-line unicorn/no-array-reduce
72
77
  return callResults.reduce<Record<string, unknown>>((prev, callResult) => {
73
78
  prev[callResult.functionName] = asCryptoContractFunctionCallSuccess(callResult)?.result
74
79
  return prev
package/src/Plugin.ts CHANGED
@@ -1,9 +1,11 @@
1
+ /* eslint-disable import/no-deprecated */
1
2
  import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'
2
3
  import { PayloadSetSchema } from '@xyo-network/payload-model'
3
4
  import { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'
4
5
 
5
6
  import { CryptoContractFunctionReadWitness } from './Witness'
6
7
 
8
+ /** @deprecated use EvmCallWitness instead */
7
9
  export const CryptoContractFunctionReadWitnessPlugin = () =>
8
10
  createPayloadSetWitnessPlugin<CryptoContractFunctionReadWitness>(
9
11
  { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },
package/src/Witness.ts CHANGED
@@ -15,6 +15,7 @@ import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
15
15
  import { WitnessParams } from '@xyo-network/witness-model'
16
16
  import { Contract, Provider } from 'ethers'
17
17
 
18
+ /** @deprecated use EvmCallWitness instead */
18
19
  export type CryptoContractFunctionReadWitnessParams = WitnessParams<
19
20
  AnyConfigSchema<CryptoContractFunctionReadWitnessConfig>,
20
21
  {
@@ -22,6 +23,7 @@ export type CryptoContractFunctionReadWitnessParams = WitnessParams<
22
23
  }
23
24
  >
24
25
 
26
+ /** @deprecated use EvmCallWitness instead */
25
27
  export class CryptoContractFunctionReadWitness<
26
28
  TParams extends CryptoContractFunctionReadWitnessParams = CryptoContractFunctionReadWitnessParams,
27
29
  > extends AbstractWitness<TParams, CryptoContractFunctionCall, CryptoContractFunctionCallResult> {
package/src/index.ts CHANGED
@@ -1,9 +1,3 @@
1
- import { CryptoContractFunctionReadWitnessPlugin } from './Plugin'
2
-
3
1
  export * from './Diviner'
2
+ export { CryptoContractFunctionReadWitnessPlugin, CryptoContractFunctionReadWitnessPlugin as default } from './Plugin'
4
3
  export * from './Witness'
5
-
6
- export { CryptoContractFunctionReadWitnessPlugin }
7
-
8
- // eslint-disable-next-line import/no-default-export
9
- export default CryptoContractFunctionReadWitnessPlugin
@@ -20,7 +20,7 @@
20
20
  "config": {
21
21
  "functionName": "name",
22
22
  "labels": {
23
- "network.xyo.crypto.contract.interface": "Erc721"
23
+ "network.xyo.evm.interface": "Erc721"
24
24
  },
25
25
  "language": "javascript",
26
26
  "name": "Erc721NameWitness",
@@ -32,7 +32,7 @@
32
32
  "config": {
33
33
  "functionName": "symbol",
34
34
  "labels": {
35
- "network.xyo.crypto.contract.interface": "Erc721"
35
+ "network.xyo.evm.interface": "Erc721"
36
36
  },
37
37
  "language": "javascript",
38
38
  "name": "Erc721SymbolWitness",
@@ -44,7 +44,7 @@
44
44
  "config": {
45
45
  "functionName": "tokenURI",
46
46
  "labels": {
47
- "network.xyo.crypto.contract.interface": "Erc721"
47
+ "network.xyo.evm.interface": "Erc721"
48
48
  },
49
49
  "language": "javascript",
50
50
  "name": "Erc721TokenURIWitness",
@@ -55,7 +55,7 @@
55
55
  "config": {
56
56
  "functionName": "ownerOf",
57
57
  "labels": {
58
- "network.xyo.crypto.contract.interface": "Erc721"
58
+ "network.xyo.evm.interface": "Erc721"
59
59
  },
60
60
  "language": "javascript",
61
61
  "name": "Erc721OwnerOfWitness",
@@ -66,7 +66,7 @@
66
66
  "config": {
67
67
  "functionName": "totalSupply",
68
68
  "labels": {
69
- "network.xyo.crypto.contract.interface": "Erc721Enumerable"
69
+ "network.xyo.evm.interface": "Erc721Enumerable"
70
70
  },
71
71
  "language": "javascript",
72
72
  "name": "Erc721TotalSupplyWitness",
@@ -76,10 +76,12 @@
76
76
  },
77
77
  {
78
78
  "config": {
79
- "args": ["0x1"],
79
+ "args": [
80
+ "0x1"
81
+ ],
80
82
  "functionName": "uri",
81
83
  "labels": {
82
- "network.xyo.crypto.contract.interface": "Erc1155"
84
+ "network.xyo.evm.interface": "Erc1155"
83
85
  },
84
86
  "language": "javascript",
85
87
  "name": "Erc1155UriWitness",
@@ -111,9 +113,18 @@
111
113
  "path": "/schema",
112
114
  "value": "network.xyo.crypto.contract.info"
113
115
  },
114
- { "op": "defined", "path": "/results/name" },
115
- { "op": "defined", "path": "/results/symbol" },
116
- { "op": "defined", "path": "/results/totalSupply" },
116
+ {
117
+ "op": "defined",
118
+ "path": "/results/name"
119
+ },
120
+ {
121
+ "op": "defined",
122
+ "path": "/results/symbol"
123
+ },
124
+ {
125
+ "op": "defined",
126
+ "path": "/results/totalSupply"
127
+ },
117
128
  {
118
129
  "op": "replace",
119
130
  "path": "/schema",
@@ -133,7 +144,10 @@
133
144
  "path": "/schema",
134
145
  "value": "network.xyo.crypto.contract.info"
135
146
  },
136
- { "op": "defined", "path": "/results/uri" },
147
+ {
148
+ "op": "defined",
149
+ "path": "/results/uri"
150
+ },
137
151
  {
138
152
  "op": "replace",
139
153
  "path": "/schema",
@@ -171,7 +185,9 @@
171
185
  {
172
186
  "config": {
173
187
  "archiving": {
174
- "archivists": ["NftArchivist"]
188
+ "archivists": [
189
+ "NftArchivist"
190
+ ]
175
191
  },
176
192
  "language": "javascript",
177
193
  "name": "NftInfoSentinel",
@@ -203,23 +219,33 @@
203
219
  "module": "Erc721ContractInfoDiviner"
204
220
  },
205
221
  {
206
- "input": ["Erc1155UriWitness"],
222
+ "input": [
223
+ "Erc1155UriWitness"
224
+ ],
207
225
  "module": "Erc1155ContractInfoDiviner"
208
226
  },
209
227
  {
210
- "input": ["Erc721ContractInfoDiviner"],
228
+ "input": [
229
+ "Erc721ContractInfoDiviner"
230
+ ],
211
231
  "module": "Erc721ContractInfoTransformDiviner"
212
232
  },
213
233
  {
214
- "input": ["Erc721ContractInfoDiviner"],
234
+ "input": [
235
+ "Erc721ContractInfoDiviner"
236
+ ],
215
237
  "module": "TimestampWitness"
216
238
  },
217
239
  {
218
- "input": ["Erc1155ContractInfoDiviner"],
240
+ "input": [
241
+ "Erc1155ContractInfoDiviner"
242
+ ],
219
243
  "module": "Erc1155ContractInfoTransformDiviner"
220
244
  },
221
245
  {
222
- "input": ["Erc1155ContractInfoDiviner"],
246
+ "input": [
247
+ "Erc1155ContractInfoDiviner"
248
+ ],
223
249
  "module": "TimestampWitness"
224
250
  }
225
251
  ]
@@ -230,4 +256,4 @@
230
256
  }
231
257
  ],
232
258
  "schema": "network.xyo.manifest"
233
- }
259
+ }
@@ -12,7 +12,7 @@
12
12
  "config": {
13
13
  "functionName": "name",
14
14
  "labels": {
15
- "network.xyo.crypto.contract.interface": "Erc721"
15
+ "network.xyo.evm.interface": "Erc721"
16
16
  },
17
17
  "language": "javascript",
18
18
  "name": "Erc721NameWitness",
@@ -24,7 +24,7 @@
24
24
  "config": {
25
25
  "functionName": "symbol",
26
26
  "labels": {
27
- "network.xyo.crypto.contract.interface": "Erc721"
27
+ "network.xyo.evm.interface": "Erc721"
28
28
  },
29
29
  "language": "javascript",
30
30
  "name": "Erc721SymbolWitness",
@@ -36,7 +36,7 @@
36
36
  "config": {
37
37
  "functionName": "tokenURI",
38
38
  "labels": {
39
- "network.xyo.crypto.contract.interface": "Erc721"
39
+ "network.xyo.evm.interface": "Erc721"
40
40
  },
41
41
  "language": "javascript",
42
42
  "name": "Erc721TokenURIWitness",
@@ -47,7 +47,7 @@
47
47
  "config": {
48
48
  "functionName": "ownerOf",
49
49
  "labels": {
50
- "network.xyo.crypto.contract.interface": "Erc721"
50
+ "network.xyo.evm.interface": "Erc721"
51
51
  },
52
52
  "language": "javascript",
53
53
  "name": "Erc721OwnerOfWitness",
@@ -58,7 +58,7 @@
58
58
  "config": {
59
59
  "functionName": "totalSupply",
60
60
  "labels": {
61
- "network.xyo.crypto.contract.interface": "Erc721Enumerable"
61
+ "network.xyo.evm.interface": "Erc721Enumerable"
62
62
  },
63
63
  "language": "javascript",
64
64
  "name": "Erc721TotalSupplyWitness",
@@ -70,7 +70,7 @@
70
70
  "config": {
71
71
  "functionName": "tokenByIndex",
72
72
  "labels": {
73
- "network.xyo.crypto.contract.interface": "Erc721Enumerable"
73
+ "network.xyo.evm.interface": "Erc721Enumerable"
74
74
  },
75
75
  "language": "javascript",
76
76
  "name": "Erc721TokenByIndexWitness",
@@ -81,7 +81,7 @@
81
81
  "config": {
82
82
  "functionName": "uri",
83
83
  "labels": {
84
- "network.xyo.crypto.contract.interface": "Erc1155"
84
+ "network.xyo.evm.interface": "Erc1155"
85
85
  },
86
86
  "language": "javascript",
87
87
  "name": "Erc1155UriWitness",
@@ -155,7 +155,7 @@
155
155
  "config": {
156
156
  "functionName": "totalSupply",
157
157
  "labels": {
158
- "network.xyo.crypto.contract.interface": "Erc721Enumerable"
158
+ "network.xyo.evm.interface": "Erc721Enumerable"
159
159
  },
160
160
  "name": "Erc721TotalSupplyWitness",
161
161
  "schema": "network.xyo.crypto.contract.function.read.config"
@@ -214,7 +214,9 @@
214
214
  {
215
215
  "config": {
216
216
  "archiving": {
217
- "archivists": ["Archivist"]
217
+ "archivists": [
218
+ "Archivist"
219
+ ]
218
220
  },
219
221
  "language": "javascript",
220
222
  "name": "Sentinel",
@@ -237,4 +239,4 @@
237
239
  }
238
240
  ],
239
241
  "schema": "network.xyo.manifest"
240
- }
242
+ }