@xyo-network/plugins 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/plugins",
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,6 +28,10 @@
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
  "workspaces": [
32
36
  "packages/**/*"
33
37
  ],
@@ -42,8 +46,8 @@
42
46
  "test": "vitest run"
43
47
  },
44
48
  "dependencies": {
45
- "@xyo-network/payload-plugins": "^4.2.0",
46
- "@xyo-network/payloadset-plugins": "^4.2.0"
49
+ "@xyo-network/payload-plugins": "^5.0.0",
50
+ "@xyo-network/payloadset-plugins": "^5.0.0"
47
51
  },
48
52
  "devDependencies": {
49
53
  "@ethersproject/address": "^5.8.0",
@@ -53,24 +57,24 @@
53
57
  "@typescript-eslint/eslint-plugin": "^8.38.0",
54
58
  "@typescript-eslint/parser": "^8.38.0",
55
59
  "@vitest/coverage-v8": "^3.2.4",
56
- "@xylabs/eslint-config-flat": "^7.0.1",
57
- "@xylabs/express": "^4.15.1",
58
- "@xylabs/forget": "^4.15.1",
59
- "@xylabs/platform": "^4.15.1",
60
- "@xylabs/ts-scripts-yarn3": "^7.0.1",
61
- "@xylabs/tsconfig": "^7.0.1",
62
- "@xylabs/tsconfig-dom": "^7.0.1",
63
- "@xylabs/vitest-extended": "^4.15.1",
64
- "@xyo-network/account": "^4.3.0",
65
- "@xyo-network/archivist-memory": "^4.3.0",
66
- "@xyo-network/boundwitness-builder": "^4.3.0",
67
- "@xyo-network/hash": "^4.3.0",
68
- "@xyo-network/manifest": "^4.3.0",
69
- "@xyo-network/manifest-wrapper": "^4.3.0",
70
- "@xyo-network/module-factory-locator": "^4.3.0",
71
- "@xyo-network/node-memory": "^4.3.0",
72
- "@xyo-network/payload-builder": "^4.3.0",
73
- "@xyo-network/wallet": "^4.3.0",
60
+ "@xylabs/eslint-config-flat": "^7.0.2",
61
+ "@xylabs/express": "^5.0.0",
62
+ "@xylabs/forget": "^5.0.0",
63
+ "@xylabs/platform": "^5.0.0",
64
+ "@xylabs/ts-scripts-yarn3": "^7.0.2",
65
+ "@xylabs/tsconfig": "^7.0.2",
66
+ "@xylabs/tsconfig-dom": "^7.0.2",
67
+ "@xylabs/vitest-extended": "^5.0.0",
68
+ "@xyo-network/account": "^5.0.0",
69
+ "@xyo-network/archivist-memory": "^5.0.0",
70
+ "@xyo-network/boundwitness-builder": "^5.0.0",
71
+ "@xyo-network/hash": "^5.0.0",
72
+ "@xyo-network/manifest": "^5.0.0",
73
+ "@xyo-network/manifest-wrapper": "^5.0.0",
74
+ "@xyo-network/module-factory-locator": "^5.0.0",
75
+ "@xyo-network/node-memory": "^5.0.0",
76
+ "@xyo-network/payload-builder": "^5.0.0",
77
+ "@xyo-network/wallet": "^5.0.0",
74
78
  "chalk": "^5.4.1",
75
79
  "dotenv": "^17.2.1",
76
80
  "eslint": "^9.32.0",
@@ -0,0 +1,14 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { describe, it } from 'vitest'
4
+
5
+ describe('Payload', () => {
6
+ it('create simple ', () => {
7
+ const payload = { schema: 'network.xyo.payload' }
8
+ console.log(payload)
9
+ })
10
+ it('create of schema', () => {
11
+ const payload = { salt: '1', schema: 'network.xyo.id' }
12
+ console.log(payload)
13
+ })
14
+ })
@@ -0,0 +1,12 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { ObjectHasher } from '@xyo-network/hash'
4
+ import { describe, it } from 'vitest'
5
+
6
+ describe('PayloadHasher', () => {
7
+ it('hash a async (async)', async () => {
8
+ const payload = { salt: '1', schema: 'network.xyo.id' }
9
+ const hash = await ObjectHasher.hash(payload)
10
+ console.log(hash)
11
+ })
12
+ })
@@ -0,0 +1,15 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { Account } from '@xyo-network/account'
4
+ import { describe, it } from 'vitest'
5
+
6
+ describe('Account', () => {
7
+ it('create random', async () => {
8
+ const account = await Account.random()
9
+ console.log(account.address)
10
+ })
11
+ it('create random (async)', async () => {
12
+ const account = await Account.create()
13
+ console.log(account.address)
14
+ })
15
+ })
@@ -0,0 +1,26 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { HDWallet } from '@xyo-network/wallet'
4
+ import { describe, it } from 'vitest'
5
+
6
+ describe('Wallet', () => {
7
+ describe('create', () => {
8
+ it('random', async () => {
9
+ const wallet = await HDWallet.random()
10
+ console.log(wallet.address)
11
+ })
12
+ it('reusable', async () => {
13
+ const seedPhrase = 'inhale setup middle assault install bulb language acoustic argue allow kiss peanut march friend finish'
14
+ const wallet = await HDWallet.fromPhrase(seedPhrase)
15
+ console.log(wallet.address)
16
+ })
17
+ })
18
+ describe('create child', () => {
19
+ it('create child', async () => {
20
+ const wallet = await HDWallet.random()
21
+ console.log(wallet.address)
22
+ const childAccount = await wallet.derivePath("0'/0/0")
23
+ console.log(childAccount.address)
24
+ })
25
+ })
26
+ })
@@ -0,0 +1,26 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { Account } from '@xyo-network/account'
4
+ import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
5
+ import { describe, it } from 'vitest'
6
+
7
+ describe('BoundWitness', () => {
8
+ it('create boundwitness', async () => {
9
+ const payload = { salt: '1', schema: 'network.xyo.id' }
10
+ const [boundWitness] = await new BoundWitnessBuilder().payload(payload).build()
11
+ console.log(boundWitness)
12
+ })
13
+ it('create boundwitness with signer', async () => {
14
+ const payload = { salt: '1', schema: 'network.xyo.id' }
15
+ const account = await Account.random()
16
+ const [boundWitness] = await new BoundWitnessBuilder().payload(payload).signer(account).build()
17
+ console.log(boundWitness)
18
+ })
19
+ it('create boundwitness with multiple signers', async () => {
20
+ const payload = { salt: '1', schema: 'network.xyo.id' }
21
+ const accountA = await Account.random()
22
+ const accountB = await Account.random()
23
+ const [boundWitness] = await new BoundWitnessBuilder().payload(payload).signers([accountA, accountB]).build()
24
+ console.log(boundWitness)
25
+ })
26
+ })
@@ -0,0 +1,34 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { Account } from '@xyo-network/account'
4
+ import { MemoryArchivist } from '@xyo-network/archivist-memory'
5
+ import { PayloadBuilder } from '@xyo-network/payload-builder'
6
+ import { describe, it } from 'vitest'
7
+
8
+ describe('Archivist', () => {
9
+ describe('insert', () => {
10
+ it('payload', async () => {
11
+ const archivist = await MemoryArchivist.create({ account: await Account.random() })
12
+ const payload = { salt: '1', schema: 'network.xyo.id' }
13
+ await archivist.insert([payload])
14
+ })
15
+ it('payloads', async () => {
16
+ const archivist = await MemoryArchivist.create({ account: await Account.random() })
17
+ const payloads = [
18
+ { data: '1', schema: 'network.xyo.id' },
19
+ { data: '2', schema: 'network.xyo.id' },
20
+ ]
21
+ await archivist.insert(payloads)
22
+ })
23
+ })
24
+ describe('get', () => {
25
+ it('get payload', async () => {
26
+ const archivist = await MemoryArchivist.create({ account: await Account.random() })
27
+ const payload = { salt: '1', schema: 'network.xyo.id' }
28
+ const hash = await PayloadBuilder.dataHash(payload)
29
+ await archivist.insert([payload])
30
+ const result = await archivist.get([hash])
31
+ console.log(result)
32
+ })
33
+ })
34
+ })
@@ -0,0 +1,87 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { readFile } from 'node:fs/promises'
4
+ import Path from 'node:path'
5
+
6
+ import { Account } from '@xyo-network/account'
7
+ import type { PackageManifestPayload } from '@xyo-network/manifest'
8
+ import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
9
+ import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
10
+ import { MemoryNode } from '@xyo-network/node-memory'
11
+ import { HDWallet } from '@xyo-network/wallet'
12
+ import { describe, it } from 'vitest'
13
+
14
+ describe('Node', () => {
15
+ it('create', async () => {
16
+ const node = await MemoryNode.create({ account: await Account.random() })
17
+ const state = await node.state()
18
+ console.log(state)
19
+ })
20
+ it('create from manifest', async () => {
21
+ const wallet = await HDWallet.random()
22
+ const manifest: PackageManifestPayload = {
23
+ nodes: [
24
+ {
25
+ config: {
26
+ name: 'Node',
27
+ schema: 'network.xyo.node.config',
28
+ },
29
+ modules: {
30
+ private: [],
31
+ public: [],
32
+ },
33
+ },
34
+ ],
35
+ schema: 'network.xyo.manifest.package',
36
+ }
37
+ const wrapper = new ManifestWrapper(manifest, wallet, new ModuleFactoryLocator())
38
+ const [node] = await wrapper.loadNodes()
39
+ const state = await node.state()
40
+ console.log(state)
41
+ })
42
+ it('create from manifest with module', async () => {
43
+ const wallet = await HDWallet.random()
44
+ const manifest: PackageManifestPayload = {
45
+ nodes: [
46
+ {
47
+ config: {
48
+ name: 'Node',
49
+ schema: 'network.xyo.node.config',
50
+ },
51
+ modules: {
52
+ private: [
53
+ {
54
+ config: {
55
+ name: 'PrivateArchivist',
56
+ schema: 'network.xyo.archivist.config',
57
+ },
58
+ },
59
+ ],
60
+ public: [
61
+ {
62
+ config: {
63
+ name: 'PublicArchivist',
64
+ schema: 'network.xyo.archivist.config',
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ },
70
+ ],
71
+ schema: 'network.xyo.manifest.package',
72
+ }
73
+ const wrapper = new ManifestWrapper(manifest, wallet, new ModuleFactoryLocator())
74
+ const [node] = await wrapper.loadNodes()
75
+ const state = await node.state()
76
+ console.log(state)
77
+ })
78
+ it('create from manifest file', async () => {
79
+ const wallet = await HDWallet.random()
80
+ const manifestPath = Path.join(__dirname, 'manifest.json')
81
+ const manifest: PackageManifestPayload = JSON.parse(await readFile(manifestPath, 'utf8'))
82
+ const wrapper = new ManifestWrapper(manifest, wallet, new ModuleFactoryLocator())
83
+ const [node] = await wrapper.loadNodes()
84
+ const state = await node.state()
85
+ console.log(state)
86
+ })
87
+ })
package/eslint.config.mjs DELETED
@@ -1,48 +0,0 @@
1
- import {
2
- typescriptConfig,
3
- unicornConfig,
4
- workspacesConfig,
5
- rulesConfig,
6
- sonarConfig,
7
- importConfig,
8
- } from '@xylabs/eslint-config-flat'
9
-
10
- export default [
11
- { ignores: ['.yarn', 'dist', '**/dist/**', 'build', '**/build/**', 'node_modules/**', 'public', 'storybook-static', 'eslint.config.mjs'] },
12
- unicornConfig,
13
- workspacesConfig,
14
- rulesConfig,
15
- typescriptConfig,
16
- importConfig,
17
- sonarConfig,
18
- {
19
- rules: {
20
- 'sonarjs/prefer-single-boolean-return': ['off'],
21
- 'import-x/no-unresolved': ['off'],
22
- 'no-restricted-imports': [
23
- 'warn',
24
- {
25
- paths: [
26
- ...rulesConfig.rules['no-restricted-imports'][1].paths,
27
- '@types/node',
28
- '@xyo-network/archivist',
29
- '@xyo-network/bridge',
30
- '@xyo-network/core',
31
- '@xyo-network/diviner',
32
- '@xyo-network/module',
33
- '@xyo-network/modules',
34
- '@xyo-network/node',
35
- '@xyo-network/sdk',
36
- '@xyo-network/plugins',
37
- '@xyo-network/protocol',
38
- '@xyo-network/sentinel',
39
- '@xyo-network/witness',
40
- '@xyo-network/core-payload-plugins',
41
- ],
42
- },
43
- ],
44
- },
45
- },
46
- ]
47
-
48
-
package/knip.config.ts DELETED
@@ -1,44 +0,0 @@
1
- import type { KnipConfig } from 'knip'
2
-
3
- const entry = ['src/index.ts*', 'src/index-*.ts*', '*.ts', '*.mjs', 'scripts/**/*.*', 'bin/*', 'src/**/*.stories.ts*', 'src/**/*.spec.ts']
4
- const project = ['src/**/*.ts*', '*.ts*']
5
-
6
- const config: KnipConfig = {
7
- entry: [
8
- 'src/index.ts*',
9
- 'src/index-*.ts*',
10
- '*.ts',
11
- '*.mjs',
12
- 'scripts/**/*.*',
13
- 'bin/*',
14
- 'src/**/*.stories.ts*',
15
- 'src/**/*.spec.ts',
16
- ],
17
- project: ['src/**/*.ts*', '*.ts*'],
18
- ignoreDependencies: ['@xylabs/ts-scripts-yarn3', 'tslib'],
19
- workspaces: {
20
- '.': {
21
- entry: [...entry, 'src/**/*.ts', './storybook/**/*.ts', 'vite.config.ts'],
22
- project,
23
- ignoreDependencies: [
24
- '@typescript-eslint/eslint-plugin',
25
- '@typescript-eslint/parser',
26
- 'eslint',
27
- 'eslint-import-resolver-typescript',
28
- ],
29
- },
30
- 'packages/*': { entry, project },
31
- 'packages/*/packages/*': { entry, project },
32
- 'packages/*/packages/packages/*': { entry, project },
33
- 'packages/*/packages/*/packages/*': { entry, project },
34
- 'packages/*/packages/*/packages/*/packages/*': { entry, project },
35
- },
36
- typescript: {
37
- config: [
38
- 'tsconfig.json',
39
- 'packages/**/*/tsconfig.json',
40
- ],
41
- },
42
- }
43
-
44
- export default config
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env bash
2
- clear
3
- printf '\e[3J'
package/typedoc.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "entryPointStrategy": "packages",
4
- "entryPoints": [
5
- "./**/packages/*",
6
- "."
7
- ],
8
- "exclude": ["**/*.d.ts"],
9
- "includeVersion": true,
10
- "name": "XYO Platform Plugins",
11
- "tsconfig": "./tsconfig.typedoc.json"
12
- }
package/vitest.config.ts DELETED
@@ -1,22 +0,0 @@
1
- import dotenv from 'dotenv'
2
- import { defineConfig } from 'vitest/config'
3
-
4
- dotenv.config()
5
-
6
- export default defineConfig({
7
- test: {
8
- globals: false,
9
- environment: 'node',
10
- environmentMatchGlobs: [
11
- ['**/*.dom.spec.*', 'jsdom'], // Use jsdom
12
- ['**/*.node.spec.*', 'node'], // Use node
13
- ],
14
- coverage: {
15
- provider: 'v8', // Use V8 native coverage provider
16
- reporter: ['text', 'html', 'lcov'], // Output formats
17
- // reportsDirectory: './coverage', // Directory for coverage output
18
- // include: ['**/src/**/*.ts'], // Include files to track
19
- // exclude: ['node_modules', '**/src/*.spec.*'], // Exclude unnecessary files
20
- },
21
- },
22
- })
@@ -1,5 +0,0 @@
1
- import { defineWorkspace } from 'vitest/config'
2
-
3
- export default defineWorkspace([
4
- './vitest.config.ts',
5
- ])