@xyo-network/evm-events-witness 4.2.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/evm-events-witness",
3
- "version": "4.2.0",
3
+ "version": "5.0.0",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -28,18 +28,22 @@
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src"
34
+ ],
31
35
  "dependencies": {
32
- "@xylabs/assert": "^4.15.1",
33
- "@xylabs/exists": "^4.15.1",
34
- "@xylabs/hex": "^4.15.1",
35
- "@xyo-network/payload-model": "^4.3.0",
36
- "@xyo-network/witness-evm-abstract": "^4.3.0",
36
+ "@xylabs/assert": "^5.0.0",
37
+ "@xylabs/exists": "^5.0.0",
38
+ "@xylabs/hex": "^5.0.0",
39
+ "@xyo-network/payload-model": "^5.0.0",
40
+ "@xyo-network/witness-evm-abstract": "^5.0.0",
37
41
  "ethers": "^6.15.0"
38
42
  },
39
43
  "devDependencies": {
40
- "@xylabs/ts-scripts-yarn3": "^7.0.1",
41
- "@xylabs/tsconfig": "^7.0.1",
42
- "@xylabs/vitest-extended": "^4.15.1",
44
+ "@xylabs/ts-scripts-yarn3": "^7.0.2",
45
+ "@xylabs/tsconfig": "^7.0.2",
46
+ "@xylabs/vitest-extended": "^5.0.0",
43
47
  "@xyo-network/open-zeppelin-typechain": "^3.5.4",
44
48
  "typescript": "^5.8.3",
45
49
  "vitest": "^3.2.4"
@@ -0,0 +1,44 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { ERC1155__factory } from '@xyo-network/open-zeppelin-typechain'
4
+ import type { Payload } from '@xyo-network/payload-model'
5
+ import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
6
+ import { getProvidersFromEnv } from '@xyo-network/witness-evm-abstract'
7
+ import {
8
+ describe, expect,
9
+ it,
10
+ } from 'vitest'
11
+
12
+ import { EvmEventsWitnessConfigSchema } from '../model.ts'
13
+ import type { EvmEvent, EvmEvents } from '../Payload.ts'
14
+ import { EvmEventSchema, EvmEventsSchema } from '../Payload.ts'
15
+ import { EvmEventsWitness } from '../Witness.ts'
16
+
17
+ const validateObservation = (observation: Payload[]) => {
18
+ const results = observation.filter(isPayloadOfSchemaType<EvmEvent>(EvmEventSchema))
19
+ expect(results.length).toBeGreaterThan(0)
20
+ expect(observation.length).toEqual(results.length)
21
+ }
22
+
23
+ describe.skipIf(!process.env.INFURA_PROJECT_ID).skip('EvmEventsWitness', () => {
24
+ const address = '0x6811f2f20c42f42656a3c8623ad5e9461b83f719' // ParallelPlanetFall
25
+ const eventName = 'TransferSingle'
26
+ describe('observe', () => {
27
+ describe('with no address or chainId in query', () => {
28
+ it('uses values from config', async () => {
29
+ const witness = await EvmEventsWitness.create({
30
+ account: 'random',
31
+ config: {
32
+ abi: ERC1155__factory.abi, fromBlock: 19_180_000, schema: EvmEventsWitnessConfigSchema,
33
+ },
34
+ providers: getProvidersFromEnv,
35
+ })
36
+ const call: EvmEvents = {
37
+ address, eventName, schema: EvmEventsSchema,
38
+ }
39
+ const observation = await witness.observe([call])
40
+ validateObservation(observation)
41
+ }, 20_000)
42
+ })
43
+ })
44
+ })
package/typedoc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["./src/index.ts"],
4
- "tsconfig": "./tsconfig.typedoc.json"
5
- }
package/xy.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
- const config: XyTsupConfig = {
3
- compile: {
4
- browser: {},
5
- node: {},
6
- neutral: { src: true },
7
- },
8
- }
9
-
10
- export default config