@xyo-network/xl1-validation 1.28.0 → 1.28.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.
- package/README.md +106 -6
- package/package.json +50 -50
package/README.md
CHANGED
|
@@ -1,24 +1,124 @@
|
|
|
1
|
+
[![logo][]][logo-link]
|
|
2
|
+
|
|
1
3
|
# @xyo-network/xl1-validation
|
|
2
4
|
|
|
3
|
-
[![npm
|
|
4
|
-
[![license
|
|
5
|
+
[![npm-badge][]][npm-link]
|
|
6
|
+
[![license-badge][]][license-link]
|
|
7
|
+
|
|
8
|
+
> Composable validators for XL1 blocks, bound witnesses, and transactions.
|
|
9
|
+
|
|
10
|
+
## About
|
|
5
11
|
|
|
6
|
-
|
|
12
|
+
This package provides the validation layer that nodes, indexers, and SDK consumers use to verify XL1 protocol data integrity. Validators are individual functions composed by domain-level orchestrators (e.g. `validateTransaction`) — each returns an array of validation errors, and the composer flattens results from running them in parallel.
|
|
13
|
+
|
|
14
|
+
It's typically pulled in via [`@xyo-network/xl1-protocol`](https://www.npmjs.com/package/@xyo-network/xl1-protocol) or [`@xyo-network/xl1-sdk`](https://www.npmjs.com/package/@xyo-network/xl1-sdk). Install directly if you're authoring custom validators or running validation in isolation.
|
|
7
15
|
|
|
8
16
|
## Install
|
|
9
17
|
|
|
18
|
+
Using npm:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm i --save @xyo-network/xl1-validation
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Using yarn:
|
|
25
|
+
|
|
10
26
|
```sh
|
|
11
|
-
|
|
27
|
+
yarn add @xyo-network/xl1-validation
|
|
12
28
|
```
|
|
13
29
|
|
|
30
|
+
Using pnpm:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pnpm add @xyo-network/xl1-validation
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Using bun:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
bun add @xyo-network/xl1-validation
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## What's Inside
|
|
43
|
+
|
|
44
|
+
**Transaction validators** (composed by `validateTransaction`):
|
|
45
|
+
|
|
46
|
+
- `TransactionProtocolValidator` — chain ID matches context
|
|
47
|
+
- `TransactionDurationValidator` — `nbf`/`exp` bounds and window
|
|
48
|
+
- `TransactionFromValidator` — `from` address present in signers
|
|
49
|
+
- `TransactionGasValidator` — gas/fee fields meet minimums
|
|
50
|
+
- `TransactionElevationValidator` — required elevated script hashes present
|
|
51
|
+
- `TransactionJsonSchemaValidator` — structure validates against AJV JSON schema
|
|
52
|
+
- `TransactionTransfersValidator` — transfers authorized by signer (extensible)
|
|
53
|
+
|
|
54
|
+
**Bound-witness validators**:
|
|
55
|
+
|
|
56
|
+
- `BoundWitnessSignaturesValidator` — cryptographic signature validity per address
|
|
57
|
+
- `BoundWitnessReferencesValidator` — payload hashes match referenced payloads, with optional schema filter
|
|
58
|
+
|
|
59
|
+
**Block validators**:
|
|
60
|
+
|
|
61
|
+
- `BlockCumulativeBalanceValidator` — total outflow per address (fees + transfers) does not exceed pre-block balance
|
|
62
|
+
|
|
63
|
+
## Composer Pattern
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { validateTransaction } from '@xyo-network/xl1-validation'
|
|
67
|
+
|
|
68
|
+
const errors = await validateTransaction(context, tx, [/* additional validators */])
|
|
69
|
+
if (errors.length === 0) {
|
|
70
|
+
// valid
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Building Locally
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
xy build @xyo-network/xl1-validation
|
|
78
|
+
xy test @xyo-network/xl1-validation
|
|
79
|
+
xy lint @xyo-network/xl1-validation
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Maintainers
|
|
83
|
+
|
|
84
|
+
<table>
|
|
85
|
+
<tr>
|
|
86
|
+
<td align="center" valign="top" width="120">
|
|
87
|
+
<a href="https://github.com/arietrouw">
|
|
88
|
+
<img src="https://github.com/arietrouw.png" width="80" height="80" alt="Arie Trouw" /><br />
|
|
89
|
+
<sub><b>Arie Trouw</b></sub>
|
|
90
|
+
</a>
|
|
91
|
+
<br />
|
|
92
|
+
<a href="https://arietrouw.com">arietrouw.com</a>
|
|
93
|
+
</td>
|
|
94
|
+
<td align="center" valign="top" width="120">
|
|
95
|
+
<a href="https://github.com/jonesmac">
|
|
96
|
+
<img src="https://github.com/jonesmac.png" width="80" height="80" alt="Matt Jones" /><br />
|
|
97
|
+
<sub><b>Matt Jones</b></sub>
|
|
98
|
+
</a>
|
|
99
|
+
</td>
|
|
100
|
+
<td align="center" valign="top" width="120">
|
|
101
|
+
<a href="https://github.com/JoelBCarter">
|
|
102
|
+
<img src="https://github.com/JoelBCarter.png" width="80" height="80" alt="Joel Carter" /><br />
|
|
103
|
+
<sub><b>Joel Carter</b></sub>
|
|
104
|
+
</a>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</table>
|
|
14
108
|
|
|
15
109
|
## License
|
|
16
110
|
|
|
17
|
-
See the [LICENSE](LICENSE) file
|
|
111
|
+
See the [LICENSE](./LICENSE) file (LGPL-3.0-only).
|
|
18
112
|
|
|
113
|
+
## Credits
|
|
19
114
|
|
|
115
|
+
[Made with 🔥 and ❄️ by XYO](https://xyo.network)
|
|
116
|
+
|
|
117
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
118
|
+
[logo-link]: https://xyo.network
|
|
20
119
|
|
|
21
120
|
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/xl1-validation.svg
|
|
22
121
|
[npm-link]: https://www.npmjs.com/package/@xyo-network/xl1-validation
|
|
122
|
+
|
|
23
123
|
[license-badge]: https://img.shields.io/npm/l/@xyo-network/xl1-validation.svg
|
|
24
|
-
[license-link]:
|
|
124
|
+
[license-link]: ./LICENSE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/xl1-validation",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.2",
|
|
4
4
|
"description": "XYO Layer One SDK Validation",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/xl1-protocol-lib": "~1.28.
|
|
38
|
-
"@xyo-network/xl1-schema": "~1.28.
|
|
37
|
+
"@xyo-network/xl1-protocol-lib": "~1.28.2",
|
|
38
|
+
"@xyo-network/xl1-schema": "~1.28.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@bitauth/libauth": "~3.0.0",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@xylabs/geo": "^5.1.1",
|
|
48
48
|
"@xylabs/sdk-js": "^5.1.1",
|
|
49
49
|
"@xylabs/threads": "~5.1.1",
|
|
50
|
-
"@xylabs/toolchain": "~7.13.
|
|
51
|
-
"@xylabs/tsconfig": "~7.13.
|
|
50
|
+
"@xylabs/toolchain": "~7.13.13",
|
|
51
|
+
"@xylabs/tsconfig": "~7.13.13",
|
|
52
52
|
"@xyo-network/account": "~5.6.1",
|
|
53
53
|
"@xyo-network/account-model": "~5.6.2",
|
|
54
54
|
"@xyo-network/api": "~5.6.1",
|
|
@@ -91,51 +91,51 @@
|
|
|
91
91
|
"zod": "~4.4.3"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@bitauth/libauth": "
|
|
95
|
-
"@metamask/providers": "
|
|
96
|
-
"@opentelemetry/api": "
|
|
97
|
-
"@opentelemetry/sdk-trace-base": "
|
|
98
|
-
"@scure/base": "
|
|
99
|
-
"@scure/bip39": "
|
|
100
|
-
"@xylabs/geo": "
|
|
101
|
-
"@xylabs/sdk-js": "
|
|
102
|
-
"@xylabs/threads": "
|
|
103
|
-
"@xyo-network/account": "
|
|
104
|
-
"@xyo-network/account-model": "
|
|
105
|
-
"@xyo-network/api": "
|
|
106
|
-
"@xyo-network/api-models": "
|
|
107
|
-
"@xyo-network/boundwitness-builder": "
|
|
108
|
-
"@xyo-network/boundwitness-model": "
|
|
109
|
-
"@xyo-network/boundwitness-wrapper": "
|
|
110
|
-
"@xyo-network/config-payload-plugin": "
|
|
111
|
-
"@xyo-network/huri": "
|
|
112
|
-
"@xyo-network/manifest-model": "
|
|
113
|
-
"@xyo-network/payload-builder": "
|
|
114
|
-
"@xyo-network/payload-model": "
|
|
115
|
-
"@xyo-network/payload-plugin": "
|
|
116
|
-
"@xyo-network/payload-wrapper": "
|
|
117
|
-
"@xyo-network/query-payload-plugin": "
|
|
118
|
-
"@xyo-network/sdk-js": "
|
|
119
|
-
"@xyo-network/sdk-protocol-js": "
|
|
120
|
-
"@xyo-network/wallet": "
|
|
121
|
-
"@xyo-network/wallet-model": "
|
|
122
|
-
"ajv": "
|
|
123
|
-
"async-mutex": "
|
|
124
|
-
"bn.js": "
|
|
125
|
-
"buffer": "
|
|
126
|
-
"chalk": "
|
|
127
|
-
"debug": "
|
|
128
|
-
"ethers": "
|
|
129
|
-
"hash-wasm": "
|
|
130
|
-
"idb": "
|
|
131
|
-
"lru-cache": "
|
|
132
|
-
"mapbox-gl": "
|
|
133
|
-
"observable-fns": "
|
|
134
|
-
"pako": "
|
|
135
|
-
"store2": "
|
|
136
|
-
"wasm-feature-detect": "
|
|
137
|
-
"webextension-polyfill": "
|
|
138
|
-
"zod": "
|
|
94
|
+
"@bitauth/libauth": "~3.0",
|
|
95
|
+
"@metamask/providers": "^22.1",
|
|
96
|
+
"@opentelemetry/api": "^1.9",
|
|
97
|
+
"@opentelemetry/sdk-trace-base": "^2.7",
|
|
98
|
+
"@scure/base": "~2.2",
|
|
99
|
+
"@scure/bip39": "~2.2",
|
|
100
|
+
"@xylabs/geo": "^5.1",
|
|
101
|
+
"@xylabs/sdk-js": "^5.1",
|
|
102
|
+
"@xylabs/threads": "~5.1",
|
|
103
|
+
"@xyo-network/account": "~5.6",
|
|
104
|
+
"@xyo-network/account-model": "~5.6",
|
|
105
|
+
"@xyo-network/api": "~5.6",
|
|
106
|
+
"@xyo-network/api-models": "~5.6",
|
|
107
|
+
"@xyo-network/boundwitness-builder": "~5.6",
|
|
108
|
+
"@xyo-network/boundwitness-model": "~5.6",
|
|
109
|
+
"@xyo-network/boundwitness-wrapper": "~5.6",
|
|
110
|
+
"@xyo-network/config-payload-plugin": "~5.6",
|
|
111
|
+
"@xyo-network/huri": "~5.6",
|
|
112
|
+
"@xyo-network/manifest-model": "~5.6",
|
|
113
|
+
"@xyo-network/payload-builder": "~5.6",
|
|
114
|
+
"@xyo-network/payload-model": "~5.6",
|
|
115
|
+
"@xyo-network/payload-plugin": "~5.6",
|
|
116
|
+
"@xyo-network/payload-wrapper": "~5.6",
|
|
117
|
+
"@xyo-network/query-payload-plugin": "~5.6",
|
|
118
|
+
"@xyo-network/sdk-js": "^5.6",
|
|
119
|
+
"@xyo-network/sdk-protocol-js": "~5.6",
|
|
120
|
+
"@xyo-network/wallet": "~5.6",
|
|
121
|
+
"@xyo-network/wallet-model": "^5.6",
|
|
122
|
+
"ajv": "^8.20",
|
|
123
|
+
"async-mutex": "^0.5",
|
|
124
|
+
"bn.js": "^5.2",
|
|
125
|
+
"buffer": "^6.0",
|
|
126
|
+
"chalk": "^5.6",
|
|
127
|
+
"debug": "~4.4",
|
|
128
|
+
"ethers": "^6.16",
|
|
129
|
+
"hash-wasm": "~4.12",
|
|
130
|
+
"idb": "^8.0",
|
|
131
|
+
"lru-cache": "^11.3",
|
|
132
|
+
"mapbox-gl": "^3.23",
|
|
133
|
+
"observable-fns": "~0.6",
|
|
134
|
+
"pako": "^2.1",
|
|
135
|
+
"store2": "~2.14",
|
|
136
|
+
"wasm-feature-detect": "~1.8",
|
|
137
|
+
"webextension-polyfill": "^0.12",
|
|
138
|
+
"zod": "~4.4"
|
|
139
139
|
},
|
|
140
140
|
"engines": {
|
|
141
141
|
"node": ">=22.3"
|