@xyo-network/xl1-validation 1.12.0 → 1.12.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/dist/neutral/index.mjs +83 -136
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +22 -23
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/boundwitness/validators/BoundWitnessReferences.ts
|
|
2
5
|
import { ZERO_HASH } from "@xylabs/hex";
|
|
3
6
|
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
@@ -5,12 +8,16 @@ import { HydratedBoundWitnessValidationError } from "@xyo-network/xl1-protocol";
|
|
|
5
8
|
function getPayloadsFromPayloadArray(payloads, hashes) {
|
|
6
9
|
return hashes.map((hash) => payloads.find((payload) => payload._hash === hash || payload._dataHash === hash));
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
__name(getPayloadsFromPayloadArray, "getPayloadsFromPayloadArray");
|
|
12
|
+
var BoundWitnessReferencesValidator = /* @__PURE__ */ __name((allowedSchemas) => ([bw, payloadSet]) => {
|
|
9
13
|
const errors = [];
|
|
10
14
|
try {
|
|
11
15
|
const payloads = getPayloadsFromPayloadArray(payloadSet, bw.payload_hashes);
|
|
12
16
|
if (payloads.length !== bw.payload_hashes.length) {
|
|
13
|
-
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
17
|
+
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
18
|
+
bw,
|
|
19
|
+
payloadSet
|
|
20
|
+
], "unable to locate payloads"));
|
|
14
21
|
}
|
|
15
22
|
for (let payload of payloads) {
|
|
16
23
|
if (isAnyPayload(payload)) {
|
|
@@ -18,26 +25,41 @@ var BoundWitnessReferencesValidator = (allowedSchemas) => ([bw, payloadSet]) =>
|
|
|
18
25
|
const payloadDataHashIndex = bw.payload_hashes.indexOf(payload._dataHash);
|
|
19
26
|
const payloadIndex = Math.max(payloadHashIndex, payloadDataHashIndex);
|
|
20
27
|
if (payloadIndex === -1) {
|
|
21
|
-
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
28
|
+
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
29
|
+
bw,
|
|
30
|
+
payloadSet
|
|
31
|
+
], "payload hash not found"));
|
|
22
32
|
}
|
|
23
33
|
const declaredSchema = bw.payload_schemas[payloadIndex];
|
|
24
34
|
if (declaredSchema !== payload.schema) {
|
|
25
|
-
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
35
|
+
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
36
|
+
bw,
|
|
37
|
+
payloadSet
|
|
38
|
+
], "mismatched schema"));
|
|
26
39
|
}
|
|
27
40
|
if (allowedSchemas && !allowedSchemas.includes(payload.schema)) {
|
|
28
|
-
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
41
|
+
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
42
|
+
bw,
|
|
43
|
+
payloadSet
|
|
44
|
+
], `disallowed schema [${payload.schema}]`));
|
|
29
45
|
}
|
|
30
46
|
} else {
|
|
31
|
-
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
47
|
+
errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
48
|
+
bw,
|
|
49
|
+
payloadSet
|
|
50
|
+
], "invalid payload"));
|
|
32
51
|
}
|
|
33
52
|
}
|
|
34
53
|
} catch (ex) {
|
|
35
|
-
const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
54
|
+
const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [
|
|
55
|
+
bw,
|
|
56
|
+
payloadSet
|
|
57
|
+
], `validation excepted: ${ex}`);
|
|
36
58
|
error.cause = ex;
|
|
37
59
|
errors.push(error);
|
|
38
60
|
}
|
|
39
61
|
return errors;
|
|
40
|
-
};
|
|
62
|
+
}, "BoundWitnessReferencesValidator");
|
|
41
63
|
|
|
42
64
|
// src/boundwitness/validators/BoundWitnessSignatures.ts
|
|
43
65
|
import { toArrayBuffer } from "@xylabs/arraybuffer";
|
|
@@ -45,12 +67,15 @@ import { ZERO_HASH as ZERO_HASH2 } from "@xylabs/hex";
|
|
|
45
67
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
46
68
|
import { BoundWitnessValidator } from "@xyo-network/boundwitness-validator";
|
|
47
69
|
import { BoundWitnessValidationError } from "@xyo-network/xl1-protocol";
|
|
48
|
-
var BoundWitnessSignaturesValidator = async (bw) => {
|
|
70
|
+
var BoundWitnessSignaturesValidator = /* @__PURE__ */ __name(async (bw) => {
|
|
49
71
|
const errors = [];
|
|
50
72
|
try {
|
|
51
73
|
const dataHash = await BoundWitnessBuilder.dataHash(bw);
|
|
52
74
|
const results = await Promise.all(bw.addresses.map(async (address, index) => {
|
|
53
|
-
return [
|
|
75
|
+
return [
|
|
76
|
+
address,
|
|
77
|
+
await BoundWitnessValidator.validateSignature(toArrayBuffer(dataHash), toArrayBuffer(address), toArrayBuffer(bw.$signatures[index]))
|
|
78
|
+
];
|
|
54
79
|
}));
|
|
55
80
|
for (const [, bwErrors] of results) {
|
|
56
81
|
for (const bwError of bwErrors) {
|
|
@@ -61,7 +86,7 @@ var BoundWitnessSignaturesValidator = async (bw) => {
|
|
|
61
86
|
errors.push(new BoundWitnessValidationError(bw?._hash ?? ZERO_HASH2, bw, "validation excepted", ex));
|
|
62
87
|
}
|
|
63
88
|
return errors;
|
|
64
|
-
};
|
|
89
|
+
}, "BoundWitnessSignaturesValidator");
|
|
65
90
|
|
|
66
91
|
// src/transaction/validateTransaction.ts
|
|
67
92
|
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
@@ -69,34 +94,25 @@ import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
|
69
94
|
// src/transaction/validators/TransactionDurationValidator.ts
|
|
70
95
|
import { ZERO_HASH as ZERO_HASH3 } from "@xylabs/hex";
|
|
71
96
|
import { HydratedTransactionValidationError } from "@xyo-network/xl1-protocol";
|
|
72
|
-
var TransactionDurationValidator = (tx) => {
|
|
97
|
+
var TransactionDurationValidator = /* @__PURE__ */ __name((tx) => {
|
|
73
98
|
const errors = [];
|
|
74
99
|
try {
|
|
75
100
|
const { exp, nbf } = tx[0];
|
|
76
101
|
if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction nbf must be positive"));
|
|
77
102
|
if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction exp must be positive"));
|
|
78
103
|
if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction exp must greater than nbf"));
|
|
79
|
-
if (exp - nbf > 1e4) errors.push(new HydratedTransactionValidationError(
|
|
80
|
-
tx?.[0]?._hash ?? ZERO_HASH3,
|
|
81
|
-
tx,
|
|
82
|
-
"Transaction exp must not be too far in the future"
|
|
83
|
-
));
|
|
104
|
+
if (exp - nbf > 1e4) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction exp must not be too far in the future"));
|
|
84
105
|
} catch (ex) {
|
|
85
|
-
errors.push(new HydratedTransactionValidationError(
|
|
86
|
-
tx?.[0]?._hash ?? ZERO_HASH3,
|
|
87
|
-
tx,
|
|
88
|
-
`Failed TransactionDurationValidator: ${ex}`,
|
|
89
|
-
ex
|
|
90
|
-
));
|
|
106
|
+
errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, `Failed TransactionDurationValidator: ${ex}`, ex));
|
|
91
107
|
}
|
|
92
108
|
return errors;
|
|
93
|
-
};
|
|
109
|
+
}, "TransactionDurationValidator");
|
|
94
110
|
|
|
95
111
|
// src/transaction/validators/TransactionElevationValidator.ts
|
|
96
112
|
import { ZERO_HASH as ZERO_HASH4 } from "@xylabs/hex";
|
|
97
113
|
import { HydratedTransactionValidationError as HydratedTransactionValidationError2 } from "@xyo-network/xl1-protocol";
|
|
98
114
|
import { extractElevatedHashes } from "@xyo-network/xl1-protocol-sdk";
|
|
99
|
-
var TransactionElevationValidator = (tx) => {
|
|
115
|
+
var TransactionElevationValidator = /* @__PURE__ */ __name((tx) => {
|
|
100
116
|
const errors = [];
|
|
101
117
|
try {
|
|
102
118
|
try {
|
|
@@ -105,135 +121,60 @@ var TransactionElevationValidator = (tx) => {
|
|
|
105
121
|
errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, "Hydrated transaction does not include all script hashes"));
|
|
106
122
|
}
|
|
107
123
|
} catch (ex) {
|
|
108
|
-
errors.push(new HydratedTransactionValidationError2(
|
|
109
|
-
tx?.[0]?._hash ?? ZERO_HASH4,
|
|
110
|
-
tx,
|
|
111
|
-
`Failed TransactionElevationValidator: ${ex}`,
|
|
112
|
-
ex
|
|
113
|
-
));
|
|
124
|
+
errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, `Failed TransactionElevationValidator: ${ex}`, ex));
|
|
114
125
|
}
|
|
115
126
|
return errors;
|
|
116
|
-
};
|
|
127
|
+
}, "TransactionElevationValidator");
|
|
117
128
|
|
|
118
129
|
// src/transaction/validators/TransactionFromValidator.ts
|
|
119
130
|
import { asAddress, ZERO_HASH as ZERO_HASH5 } from "@xylabs/hex";
|
|
120
131
|
import { addressesContains } from "@xyo-network/boundwitness-validator";
|
|
121
132
|
import { HydratedTransactionValidationError as HydratedTransactionValidationError3 } from "@xyo-network/xl1-protocol";
|
|
122
|
-
var TransactionFromValidator = (tx) => {
|
|
133
|
+
var TransactionFromValidator = /* @__PURE__ */ __name((tx) => {
|
|
123
134
|
const errors = [];
|
|
124
135
|
try {
|
|
125
136
|
const from = asAddress(tx[0].from);
|
|
126
|
-
if (from === void 0) errors.push(new HydratedTransactionValidationError3(
|
|
127
|
-
|
|
128
|
-
tx,
|
|
129
|
-
"Transaction from is not a valid address"
|
|
130
|
-
));
|
|
131
|
-
else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError3(
|
|
132
|
-
tx?.[0]?._hash ?? ZERO_HASH5,
|
|
133
|
-
tx,
|
|
134
|
-
"Transaction from address must be listed in addresses"
|
|
135
|
-
));
|
|
137
|
+
if (from === void 0) errors.push(new HydratedTransactionValidationError3(tx?.[0]?._hash ?? ZERO_HASH5, tx, "Transaction from is not a valid address"));
|
|
138
|
+
else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError3(tx?.[0]?._hash ?? ZERO_HASH5, tx, "Transaction from address must be listed in addresses"));
|
|
136
139
|
} catch (ex) {
|
|
137
|
-
errors.push(new HydratedTransactionValidationError3(
|
|
138
|
-
tx?.[0]?._hash ?? ZERO_HASH5,
|
|
139
|
-
tx,
|
|
140
|
-
`Failed TransactionFromValidator: ${ex}`,
|
|
141
|
-
ex
|
|
142
|
-
));
|
|
140
|
+
errors.push(new HydratedTransactionValidationError3(tx?.[0]?._hash ?? ZERO_HASH5, tx, `Failed TransactionFromValidator: ${ex}`, ex));
|
|
143
141
|
}
|
|
144
142
|
return errors;
|
|
145
|
-
};
|
|
143
|
+
}, "TransactionFromValidator");
|
|
146
144
|
|
|
147
145
|
// src/transaction/validators/TransactionGasValidator.ts
|
|
148
146
|
import { hexToBigInt, ZERO_HASH as ZERO_HASH6 } from "@xylabs/hex";
|
|
149
|
-
import {
|
|
150
|
-
|
|
151
|
-
HydratedTransactionValidationError as HydratedTransactionValidationError4,
|
|
152
|
-
minTransactionFees
|
|
153
|
-
} from "@xyo-network/xl1-protocol";
|
|
154
|
-
var TransactionGasValidator = (tx) => {
|
|
147
|
+
import { AttoXL1, HydratedTransactionValidationError as HydratedTransactionValidationError4, minTransactionFees } from "@xyo-network/xl1-protocol";
|
|
148
|
+
var TransactionGasValidator = /* @__PURE__ */ __name((tx) => {
|
|
155
149
|
const errors = [];
|
|
156
150
|
try {
|
|
157
151
|
if (tx?.[0].fees === void 0) {
|
|
158
|
-
errors.push(new HydratedTransactionValidationError4(
|
|
159
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
160
|
-
tx,
|
|
161
|
-
"Missing fees"
|
|
162
|
-
));
|
|
152
|
+
errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, "Missing fees"));
|
|
163
153
|
} else {
|
|
164
|
-
const {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"fees.base must be defined and a valid number"
|
|
174
|
-
));
|
|
175
|
-
else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError4(
|
|
176
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
177
|
-
tx,
|
|
178
|
-
`fees.base must be >= ${minTransactionFees.base}`
|
|
179
|
-
));
|
|
180
|
-
if (gasLimit === void 0) errors.push(new HydratedTransactionValidationError4(
|
|
181
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
182
|
-
tx,
|
|
183
|
-
"fees.gasLimit must be defined and a valid number"
|
|
184
|
-
));
|
|
185
|
-
else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError4(
|
|
186
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
187
|
-
tx,
|
|
188
|
-
`fees.gasLimit must be >= ${minTransactionFees.gasLimit}`
|
|
189
|
-
));
|
|
190
|
-
if (gasPrice === void 0) errors.push(
|
|
191
|
-
new HydratedTransactionValidationError4(
|
|
192
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
193
|
-
tx,
|
|
194
|
-
"fees.gasPrice must be defined and a valid number"
|
|
195
|
-
)
|
|
196
|
-
);
|
|
197
|
-
else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError4(
|
|
198
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
199
|
-
tx,
|
|
200
|
-
`fees.gasPrice must be >= ${minTransactionFees.gasPrice}`
|
|
201
|
-
));
|
|
202
|
-
if (priority === void 0) errors.push(new HydratedTransactionValidationError4(
|
|
203
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
204
|
-
tx,
|
|
205
|
-
"fees.priority must be defined and a valid number"
|
|
206
|
-
));
|
|
207
|
-
else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError4(
|
|
208
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
209
|
-
tx,
|
|
210
|
-
`fees.priority must be >= ${minTransactionFees.priority}`
|
|
211
|
-
));
|
|
154
|
+
const { base, gasLimit, gasPrice, priority } = parseFees(tx[0].fees);
|
|
155
|
+
if (base === void 0) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, "fees.base must be defined and a valid number"));
|
|
156
|
+
else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, `fees.base must be >= ${minTransactionFees.base}`));
|
|
157
|
+
if (gasLimit === void 0) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, "fees.gasLimit must be defined and a valid number"));
|
|
158
|
+
else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`));
|
|
159
|
+
if (gasPrice === void 0) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, "fees.gasPrice must be defined and a valid number"));
|
|
160
|
+
else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`));
|
|
161
|
+
if (priority === void 0) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, "fees.priority must be defined and a valid number"));
|
|
162
|
+
else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, `fees.priority must be >= ${minTransactionFees.priority}`));
|
|
212
163
|
}
|
|
213
164
|
} catch (ex) {
|
|
214
|
-
errors.push(new HydratedTransactionValidationError4(
|
|
215
|
-
tx?.[0]?._hash ?? ZERO_HASH6,
|
|
216
|
-
tx,
|
|
217
|
-
`Failed TransactionGasValidator: ${ex}`,
|
|
218
|
-
ex
|
|
219
|
-
));
|
|
165
|
+
errors.push(new HydratedTransactionValidationError4(tx?.[0]?._hash ?? ZERO_HASH6, tx, `Failed TransactionGasValidator: ${ex}`, ex));
|
|
220
166
|
}
|
|
221
167
|
return errors;
|
|
222
|
-
};
|
|
223
|
-
var parseFees = (fees) => {
|
|
168
|
+
}, "TransactionGasValidator");
|
|
169
|
+
var parseFees = /* @__PURE__ */ __name((fees) => {
|
|
224
170
|
const ret = {};
|
|
225
|
-
const {
|
|
226
|
-
base,
|
|
227
|
-
gasLimit,
|
|
228
|
-
gasPrice,
|
|
229
|
-
priority
|
|
230
|
-
} = fees;
|
|
171
|
+
const { base, gasLimit, gasPrice, priority } = fees;
|
|
231
172
|
if (base !== void 0) ret.base = AttoXL1(hexToBigInt(base));
|
|
232
173
|
if (gasLimit !== void 0) ret.gasLimit = AttoXL1(hexToBigInt(gasLimit));
|
|
233
174
|
if (gasPrice !== void 0) ret.gasPrice = AttoXL1(hexToBigInt(gasPrice));
|
|
234
175
|
if (priority !== void 0) ret.priority = AttoXL1(hexToBigInt(priority));
|
|
235
176
|
return ret;
|
|
236
|
-
};
|
|
177
|
+
}, "parseFees");
|
|
237
178
|
|
|
238
179
|
// src/transaction/validators/TransactionJsonSchemaValidator.ts
|
|
239
180
|
import { ZERO_HASH as ZERO_HASH7 } from "@xylabs/hex";
|
|
@@ -241,18 +182,19 @@ import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
|
241
182
|
import { HydratedTransactionValidationError as HydratedTransactionValidationError5 } from "@xyo-network/xl1-protocol";
|
|
242
183
|
import { TransactionBoundWitnessJsonSchema } from "@xyo-network/xl1-schema";
|
|
243
184
|
import { Ajv } from "ajv";
|
|
244
|
-
var ajv = new Ajv({
|
|
185
|
+
var ajv = new Ajv({
|
|
186
|
+
allErrors: true,
|
|
187
|
+
strict: true
|
|
188
|
+
});
|
|
245
189
|
var validate;
|
|
246
|
-
var TransactionJsonSchemaValidator = (tx) => {
|
|
190
|
+
var TransactionJsonSchemaValidator = /* @__PURE__ */ __name((tx) => {
|
|
247
191
|
const errors = [];
|
|
248
192
|
try {
|
|
249
193
|
if (validate === void 0) validate = ajv.compile(TransactionBoundWitnessJsonSchema);
|
|
250
194
|
if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {
|
|
251
|
-
const error = new HydratedTransactionValidationError5(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
`failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: "\n" })}`
|
|
255
|
-
);
|
|
195
|
+
const error = new HydratedTransactionValidationError5(tx?.[0]?._hash ?? ZERO_HASH7, tx, `failed JSON schema validation: ${ajv.errorsText(validate.errors, {
|
|
196
|
+
separator: "\n"
|
|
197
|
+
})}`);
|
|
256
198
|
error.cause = validate.errors;
|
|
257
199
|
errors.push(error);
|
|
258
200
|
}
|
|
@@ -260,12 +202,12 @@ var TransactionJsonSchemaValidator = (tx) => {
|
|
|
260
202
|
errors.push(new HydratedTransactionValidationError5(tx?.[0]?._hash ?? ZERO_HASH7, tx, "validation excepted", ex));
|
|
261
203
|
}
|
|
262
204
|
return errors;
|
|
263
|
-
};
|
|
205
|
+
}, "TransactionJsonSchemaValidator");
|
|
264
206
|
|
|
265
207
|
// src/transaction/validators/TransactionProtocolValidator.ts
|
|
266
208
|
import { ZERO_HASH as ZERO_HASH8 } from "@xylabs/hex";
|
|
267
209
|
import { HydratedTransactionValidationError as HydratedTransactionValidationError6 } from "@xyo-network/xl1-protocol";
|
|
268
|
-
var TransactionProtocolValidator = async (tx, chainId) => {
|
|
210
|
+
var TransactionProtocolValidator = /* @__PURE__ */ __name(async (tx, chainId) => {
|
|
269
211
|
const errors = [];
|
|
270
212
|
try {
|
|
271
213
|
if (chainId !== void 0 && tx[0].chain !== chainId) {
|
|
@@ -275,13 +217,15 @@ var TransactionProtocolValidator = async (tx, chainId) => {
|
|
|
275
217
|
errors.push(new HydratedTransactionValidationError6(tx?.[0]?._hash ?? ZERO_HASH8, tx, "validation excepted", ex));
|
|
276
218
|
}
|
|
277
219
|
return await Promise.resolve(errors);
|
|
278
|
-
};
|
|
220
|
+
}, "TransactionProtocolValidator");
|
|
279
221
|
|
|
280
222
|
// src/transaction/validateTransaction.ts
|
|
281
223
|
async function validateTransaction(tx, chainId, additionalValidators = []) {
|
|
282
224
|
try {
|
|
283
225
|
if (!isTransactionBoundWitness(tx[0])) {
|
|
284
|
-
return [
|
|
226
|
+
return [
|
|
227
|
+
new Error("failed isTransactionBoundWitness identity check")
|
|
228
|
+
];
|
|
285
229
|
}
|
|
286
230
|
const validators = [
|
|
287
231
|
TransactionProtocolValidator,
|
|
@@ -293,9 +237,12 @@ async function validateTransaction(tx, chainId, additionalValidators = []) {
|
|
|
293
237
|
];
|
|
294
238
|
return (await Promise.all(validators.map((v) => v(tx, chainId)))).flat();
|
|
295
239
|
} catch (ex) {
|
|
296
|
-
return [
|
|
240
|
+
return [
|
|
241
|
+
new Error(`Failed TransactionGasValidator: ${ex}`)
|
|
242
|
+
];
|
|
297
243
|
}
|
|
298
244
|
}
|
|
245
|
+
__name(validateTransaction, "validateTransaction");
|
|
299
246
|
export {
|
|
300
247
|
BoundWitnessReferencesValidator,
|
|
301
248
|
BoundWitnessSignaturesValidator,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/boundwitness/validators/BoundWitnessReferences.ts","../../src/boundwitness/validators/BoundWitnessSignatures.ts","../../src/transaction/validateTransaction.ts","../../src/transaction/validators/TransactionDurationValidator.ts","../../src/transaction/validators/TransactionElevationValidator.ts","../../src/transaction/validators/TransactionFromValidator.ts","../../src/transaction/validators/TransactionGasValidator.ts","../../src/transaction/validators/TransactionJsonSchemaValidator.ts","../../src/transaction/validators/TransactionProtocolValidator.ts"],"sourcesContent":["import { type Hash, ZERO_HASH } from '@xylabs/hex'\nimport type { Promisable } from '@xylabs/promise'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type {\n Payload,\n Schema,\n WithHashStorageMeta,\n} from '@xyo-network/payload-model'\nimport { isAnyPayload } from '@xyo-network/payload-model'\nimport type { HydratedBoundWitnessValidationFunction, HydratedBoundWitnessWithHashStorageMeta } from '@xyo-network/xl1-protocol'\nimport { HydratedBoundWitnessValidationError } from '@xyo-network/xl1-protocol'\n\nfunction getPayloadsFromPayloadArray(payloads: WithHashStorageMeta<Payload>[], hashes: Hash[]): (WithHashStorageMeta<Payload> | undefined)[] {\n return hashes.map(hash => payloads.find(payload => payload._hash === hash || payload._dataHash === hash))\n}\n\nexport const BoundWitnessReferencesValidator\n// eslint-disable-next-line complexity\n= <T extends BoundWitness = BoundWitness>(allowedSchemas?: Schema[]): HydratedBoundWitnessValidationFunction<T> => (\n [bw, payloadSet]: HydratedBoundWitnessWithHashStorageMeta<T>,\n): Promisable<HydratedBoundWitnessValidationError[]> => {\n const errors: HydratedBoundWitnessValidationError[] = []\n try {\n const payloads = getPayloadsFromPayloadArray(payloadSet, bw.payload_hashes)\n if (payloads.length !== bw.payload_hashes.length) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'unable to locate payloads'))\n }\n\n // check if payloads are valid and if their schemas match the declared schemas\n for (let payload of payloads) {\n if (isAnyPayload(payload)) {\n const payloadHashIndex = bw.payload_hashes.indexOf(payload._hash)\n const payloadDataHashIndex = bw.payload_hashes.indexOf(payload._dataHash)\n const payloadIndex = Math.max(payloadHashIndex, payloadDataHashIndex)\n if (payloadIndex === -1) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'payload hash not found'))\n }\n\n const declaredSchema = bw.payload_schemas[payloadIndex]\n if (declaredSchema !== payload.schema) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'mismatched schema'))\n }\n\n if (allowedSchemas && !allowedSchemas.includes(payload.schema)) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `disallowed schema [${payload.schema}]`))\n }\n } else {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'invalid payload'))\n }\n }\n } catch (ex) {\n const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${ex}`)\n error.cause = ex\n errors.push(error)\n }\n return errors\n}\n","import { toArrayBuffer } from '@xylabs/arraybuffer'\nimport { type Address, ZERO_HASH } from '@xylabs/hex'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type { BoundWitnessValidationFunction } from '@xyo-network/xl1-protocol'\nimport { BoundWitnessValidationError } from '@xyo-network/xl1-protocol'\n\nexport const BoundWitnessSignaturesValidator: BoundWitnessValidationFunction = async (\n bw: BoundWitness,\n) => {\n const errors: BoundWitnessValidationError[] = []\n try {\n const dataHash = await BoundWitnessBuilder.dataHash(bw)\n const results: [Address, Error[]][] = await Promise.all(bw.addresses.map(async (address, index) => {\n return [address, await BoundWitnessValidator.validateSignature(toArrayBuffer(dataHash), toArrayBuffer(address), toArrayBuffer(bw.$signatures[index]))]\n }))\n for (const [, bwErrors] of results) {\n for (const bwError of bwErrors) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation errors', bwError))\n }\n }\n } catch (ex) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation excepted', ex))\n }\n return errors\n}\n","import type {\n Chain, HydratedTransactionValidationFunction,\n SignedHydratedTransactionWithStorageMeta,\n} from '@xyo-network/xl1-protocol'\nimport { isTransactionBoundWitness } from '@xyo-network/xl1-protocol'\n\nimport {\n TransactionDurationValidator,\n TransactionElevationValidator, TransactionFromValidator, TransactionGasValidator, TransactionProtocolValidator,\n} from './validators/index.ts'\n\nexport async function validateTransaction(\n tx: SignedHydratedTransactionWithStorageMeta,\n chainId?: Chain,\n additionalValidators: HydratedTransactionValidationFunction[] = [],\n) {\n try {\n if (!isTransactionBoundWitness(tx[0])) {\n return [new Error('failed isTransactionBoundWitness identity check')]\n }\n\n const validators: HydratedTransactionValidationFunction[] = [\n TransactionProtocolValidator,\n TransactionDurationValidator,\n TransactionFromValidator,\n TransactionGasValidator,\n TransactionElevationValidator,\n ...additionalValidators,\n ]\n return (await Promise.all(validators.map(v => v(tx, chainId)))).flat()\n } catch (ex) {\n return [(new Error(`Failed TransactionGasValidator: ${ex}`))]\n }\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction, HydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\n// eslint-disable-next-line complexity\nexport const TransactionDurationValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: HydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const { exp, nbf } = tx[0]\n if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction nbf must be positive'))\n\n if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must be positive'))\n if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must greater than nbf'))\n if (exp - nbf > 10_000) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction exp must not be too far in the future',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionDurationValidator: ${ex}`,\n ex,\n ))\n }\n\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\nimport { extractElevatedHashes } from '@xyo-network/xl1-protocol-sdk'\n\nexport const TransactionElevationValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n try {\n extractElevatedHashes(tx)\n } catch {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Hydrated transaction does not include all script hashes'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionElevationValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n","import { asAddress, ZERO_HASH } from '@xylabs/hex'\nimport { addressesContains } from '@xyo-network/boundwitness-validator'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\nexport const TransactionFromValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const from = asAddress(tx[0].from)\n if (from === undefined)errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from is not a valid address',\n ))\n else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from address must be listed in addresses',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionFromValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n","import { hexToBigInt, ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction,\n SignedHydratedTransactionWithStorageMeta,\n TransactionBoundWitness, TransactionFeesBigInt, TransactionFeesHex,\n} from '@xyo-network/xl1-protocol'\nimport {\n AttoXL1,\n HydratedTransactionValidationError,\n minTransactionFees,\n} from '@xyo-network/xl1-protocol'\n\n// eslint-disable-next-line complexity\nexport const TransactionGasValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (tx?.[0].fees === undefined) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Missing fees',\n ))\n } else {\n const {\n base, gasLimit, gasPrice, priority,\n } = parseFees(tx[0].fees)\n\n if (base === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.base must be defined and a valid number',\n ))\n else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.base must be >= ${minTransactionFees.base}`,\n ))\n\n if (gasLimit === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasLimit must be defined and a valid number',\n ))\n else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`,\n ))\n\n if (gasPrice === undefined) errors.push(\n new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasPrice must be defined and a valid number',\n ),\n )\n else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`,\n ))\n\n if (priority === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.priority must be defined and a valid number',\n ))\n else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.priority must be >= ${minTransactionFees.priority}`,\n ))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionGasValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n\nconst parseFees = (fees: TransactionFeesHex): Partial<TransactionFeesBigInt> => {\n const ret: Partial<TransactionFeesBigInt> = {}\n const {\n base, gasLimit, gasPrice, priority,\n } = fees\n if (base !== undefined) ret.base = AttoXL1(hexToBigInt(base))\n if (gasLimit !== undefined) ret.gasLimit = AttoXL1(hexToBigInt(gasLimit))\n if (gasPrice !== undefined) ret.gasPrice = AttoXL1(hexToBigInt(gasPrice))\n if (priority !== undefined) ret.priority = AttoXL1(hexToBigInt(priority))\n return ret\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\nimport { TransactionBoundWitnessJsonSchema } from '@xyo-network/xl1-schema'\nimport type { ValidateFunction } from 'ajv'\nimport { Ajv } from 'ajv'\n\nconst ajv = new Ajv({ allErrors: true, strict: true })\n\nlet validate: ValidateFunction<TransactionBoundWitness> | undefined\n\nexport const TransactionJsonSchemaValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (validate === undefined) validate = ajv.compile(TransactionBoundWitnessJsonSchema)\n if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {\n const error = new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: '\\n' })}`,\n )\n error.cause = validate.errors\n errors.push(error)\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n Chain,\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\nexport const TransactionProtocolValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = async (\n tx: SignedHydratedTransactionWithStorageMeta,\n chainId?: Chain,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (chainId !== undefined && tx[0].chain !== chainId) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'invalid chain id'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n}\n"],"mappings":";AAAA,SAAoB,iBAAiB;AAQrC,SAAS,oBAAoB;AAE7B,SAAS,2CAA2C;AAEpD,SAAS,4BAA4B,UAA0C,QAA8D;AAC3I,SAAO,OAAO,IAAI,UAAQ,SAAS,KAAK,aAAW,QAAQ,UAAU,QAAQ,QAAQ,cAAc,IAAI,CAAC;AAC1G;AAEO,IAAM,kCAEX,CAAwC,mBAAyE,CACjH,CAAC,IAAI,UAAU,MACuC;AACtD,QAAM,SAAgD,CAAC;AACvD,MAAI;AACF,UAAM,WAAW,4BAA4B,YAAY,GAAG,cAAc;AAC1E,QAAI,SAAS,WAAW,GAAG,eAAe,QAAQ;AAChD,aAAO,KAAK,IAAI,oCAAoC,IAAI,SAAS,WAAW,CAAC,IAAI,UAAU,GAAG,2BAA2B,CAAC;AAAA,IAC5H;AAGA,aAAS,WAAW,UAAU;AAC5B,UAAI,aAAa,OAAO,GAAG;AACzB,cAAM,mBAAmB,GAAG,eAAe,QAAQ,QAAQ,KAAK;AAChE,cAAM,uBAAuB,GAAG,eAAe,QAAQ,QAAQ,SAAS;AACxE,cAAM,eAAe,KAAK,IAAI,kBAAkB,oBAAoB;AACpE,YAAI,iBAAiB,IAAI;AACvB,iBAAO,KAAK,IAAI,oCAAoC,IAAI,SAAS,WAAW,CAAC,IAAI,UAAU,GAAG,wBAAwB,CAAC;AAAA,QACzH;AAEA,cAAM,iBAAiB,GAAG,gBAAgB,YAAY;AACtD,YAAI,mBAAmB,QAAQ,QAAQ;AACrC,iBAAO,KAAK,IAAI,oCAAoC,IAAI,SAAS,WAAW,CAAC,IAAI,UAAU,GAAG,mBAAmB,CAAC;AAAA,QACpH;AAEA,YAAI,kBAAkB,CAAC,eAAe,SAAS,QAAQ,MAAM,GAAG;AAC9D,iBAAO,KAAK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aAAO,KAAK,IAAIA,oCAAmC,KAAK,CAAC,GAAG,SAASD,YAAW,IAAI,kBAAkB,CAAC;AAAA,IACzG;AAAA,EACF,SAAS,IAAI;AACX,WAAO,KAAK,IAAIC,oCAAmC,KAAK,CAAC,GAAG,SAASD,YAAW,IAAI,uBAAuB,EAAE,CAAC;AAAA,EAChH;AACA,SAAO,MAAM,QAAQ,QAAQ,MAAM;AACrC;;;ANTA,eAAsB,oBACpB,IACA,SACA,uBAAgE,CAAC,GACjE;AACA,MAAI;AACF,QAAI,CAAC,0BAA0B,GAAG,CAAC,CAAC,GAAG;AACrC,aAAO,CAAC,IAAI,MAAM,iDAAiD,CAAC;AAAA,IACtE;AAEA,UAAM,aAAsD;AAAA,MAC1D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AACA,YAAQ,MAAM,QAAQ,IAAI,WAAW,IAAI,OAAK,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK;AAAA,EACvE,SAAS,IAAI;AACX,WAAO,CAAE,IAAI,MAAM,mCAAmC,EAAE,EAAE,CAAE;AAAA,EAC9D;AACF;","names":["ZERO_HASH","ZERO_HASH","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError"]}
|
|
1
|
+
{"version":3,"sources":["../../src/boundwitness/validators/BoundWitnessReferences.ts","../../src/boundwitness/validators/BoundWitnessSignatures.ts","../../src/transaction/validateTransaction.ts","../../src/transaction/validators/TransactionDurationValidator.ts","../../src/transaction/validators/TransactionElevationValidator.ts","../../src/transaction/validators/TransactionFromValidator.ts","../../src/transaction/validators/TransactionGasValidator.ts","../../src/transaction/validators/TransactionJsonSchemaValidator.ts","../../src/transaction/validators/TransactionProtocolValidator.ts"],"sourcesContent":["import { type Hash, ZERO_HASH } from '@xylabs/hex'\nimport type { Promisable } from '@xylabs/promise'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type {\n Payload,\n Schema,\n WithHashStorageMeta,\n} from '@xyo-network/payload-model'\nimport { isAnyPayload } from '@xyo-network/payload-model'\nimport type { HydratedBoundWitnessValidationFunction, HydratedBoundWitnessWithHashStorageMeta } from '@xyo-network/xl1-protocol'\nimport { HydratedBoundWitnessValidationError } from '@xyo-network/xl1-protocol'\n\nfunction getPayloadsFromPayloadArray(payloads: WithHashStorageMeta<Payload>[], hashes: Hash[]): (WithHashStorageMeta<Payload> | undefined)[] {\n return hashes.map(hash => payloads.find(payload => payload._hash === hash || payload._dataHash === hash))\n}\n\nexport const BoundWitnessReferencesValidator\n// eslint-disable-next-line complexity\n= <T extends BoundWitness = BoundWitness>(allowedSchemas?: Schema[]): HydratedBoundWitnessValidationFunction<T> => (\n [bw, payloadSet]: HydratedBoundWitnessWithHashStorageMeta<T>,\n): Promisable<HydratedBoundWitnessValidationError[]> => {\n const errors: HydratedBoundWitnessValidationError[] = []\n try {\n const payloads = getPayloadsFromPayloadArray(payloadSet, bw.payload_hashes)\n if (payloads.length !== bw.payload_hashes.length) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'unable to locate payloads'))\n }\n\n // check if payloads are valid and if their schemas match the declared schemas\n for (let payload of payloads) {\n if (isAnyPayload(payload)) {\n const payloadHashIndex = bw.payload_hashes.indexOf(payload._hash)\n const payloadDataHashIndex = bw.payload_hashes.indexOf(payload._dataHash)\n const payloadIndex = Math.max(payloadHashIndex, payloadDataHashIndex)\n if (payloadIndex === -1) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'payload hash not found'))\n }\n\n const declaredSchema = bw.payload_schemas[payloadIndex]\n if (declaredSchema !== payload.schema) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'mismatched schema'))\n }\n\n if (allowedSchemas && !allowedSchemas.includes(payload.schema)) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `disallowed schema [${payload.schema}]`))\n }\n } else {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'invalid payload'))\n }\n }\n } catch (ex) {\n const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${ex}`)\n error.cause = ex\n errors.push(error)\n }\n return errors\n}\n","import { toArrayBuffer } from '@xylabs/arraybuffer'\nimport { type Address, ZERO_HASH } from '@xylabs/hex'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type { BoundWitnessValidationFunction } from '@xyo-network/xl1-protocol'\nimport { BoundWitnessValidationError } from '@xyo-network/xl1-protocol'\n\nexport const BoundWitnessSignaturesValidator: BoundWitnessValidationFunction = async (\n bw: BoundWitness,\n) => {\n const errors: BoundWitnessValidationError[] = []\n try {\n const dataHash = await BoundWitnessBuilder.dataHash(bw)\n const results: [Address, Error[]][] = await Promise.all(bw.addresses.map(async (address, index) => {\n return [address, await BoundWitnessValidator.validateSignature(toArrayBuffer(dataHash), toArrayBuffer(address), toArrayBuffer(bw.$signatures[index]))]\n }))\n for (const [, bwErrors] of results) {\n for (const bwError of bwErrors) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation errors', bwError))\n }\n }\n } catch (ex) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation excepted', ex))\n }\n return errors\n}\n","import type {\n Chain, HydratedTransactionValidationFunction,\n SignedHydratedTransactionWithStorageMeta,\n} from '@xyo-network/xl1-protocol'\nimport { isTransactionBoundWitness } from '@xyo-network/xl1-protocol'\n\nimport {\n TransactionDurationValidator,\n TransactionElevationValidator, TransactionFromValidator, TransactionGasValidator, TransactionProtocolValidator,\n} from './validators/index.ts'\n\nexport async function validateTransaction(\n tx: SignedHydratedTransactionWithStorageMeta,\n chainId?: Chain,\n additionalValidators: HydratedTransactionValidationFunction[] = [],\n) {\n try {\n if (!isTransactionBoundWitness(tx[0])) {\n return [new Error('failed isTransactionBoundWitness identity check')]\n }\n\n const validators: HydratedTransactionValidationFunction[] = [\n TransactionProtocolValidator,\n TransactionDurationValidator,\n TransactionFromValidator,\n TransactionGasValidator,\n TransactionElevationValidator,\n ...additionalValidators,\n ]\n return (await Promise.all(validators.map(v => v(tx, chainId)))).flat()\n } catch (ex) {\n return [(new Error(`Failed TransactionGasValidator: ${ex}`))]\n }\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction, HydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\n// eslint-disable-next-line complexity\nexport const TransactionDurationValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: HydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const { exp, nbf } = tx[0]\n if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction nbf must be positive'))\n\n if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must be positive'))\n if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must greater than nbf'))\n if (exp - nbf > 10_000) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction exp must not be too far in the future',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionDurationValidator: ${ex}`,\n ex,\n ))\n }\n\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\nimport { extractElevatedHashes } from '@xyo-network/xl1-protocol-sdk'\n\nexport const TransactionElevationValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n try {\n extractElevatedHashes(tx)\n } catch {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Hydrated transaction does not include all script hashes'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionElevationValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n","import { asAddress, ZERO_HASH } from '@xylabs/hex'\nimport { addressesContains } from '@xyo-network/boundwitness-validator'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\nexport const TransactionFromValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const from = asAddress(tx[0].from)\n if (from === undefined)errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from is not a valid address',\n ))\n else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from address must be listed in addresses',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionFromValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n","import { hexToBigInt, ZERO_HASH } from '@xylabs/hex'\nimport type {\n HydratedTransactionValidationFunction,\n SignedHydratedTransactionWithStorageMeta,\n TransactionBoundWitness, TransactionFeesBigInt, TransactionFeesHex,\n} from '@xyo-network/xl1-protocol'\nimport {\n AttoXL1,\n HydratedTransactionValidationError,\n minTransactionFees,\n} from '@xyo-network/xl1-protocol'\n\n// eslint-disable-next-line complexity\nexport const TransactionGasValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (tx?.[0].fees === undefined) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Missing fees',\n ))\n } else {\n const {\n base, gasLimit, gasPrice, priority,\n } = parseFees(tx[0].fees)\n\n if (base === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.base must be defined and a valid number',\n ))\n else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.base must be >= ${minTransactionFees.base}`,\n ))\n\n if (gasLimit === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasLimit must be defined and a valid number',\n ))\n else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`,\n ))\n\n if (gasPrice === undefined) errors.push(\n new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasPrice must be defined and a valid number',\n ),\n )\n else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`,\n ))\n\n if (priority === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.priority must be defined and a valid number',\n ))\n else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.priority must be >= ${minTransactionFees.priority}`,\n ))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionGasValidator: ${ex}`,\n ex,\n ))\n }\n return errors\n}\n\nconst parseFees = (fees: TransactionFeesHex): Partial<TransactionFeesBigInt> => {\n const ret: Partial<TransactionFeesBigInt> = {}\n const {\n base, gasLimit, gasPrice, priority,\n } = fees\n if (base !== undefined) ret.base = AttoXL1(hexToBigInt(base))\n if (gasLimit !== undefined) ret.gasLimit = AttoXL1(hexToBigInt(gasLimit))\n if (gasPrice !== undefined) ret.gasPrice = AttoXL1(hexToBigInt(gasPrice))\n if (priority !== undefined) ret.priority = AttoXL1(hexToBigInt(priority))\n return ret\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type {\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\nimport { TransactionBoundWitnessJsonSchema } from '@xyo-network/xl1-schema'\nimport type { ValidateFunction } from 'ajv'\nimport { Ajv } from 'ajv'\n\nconst ajv = new Ajv({ allErrors: true, strict: true })\n\nlet validate: ValidateFunction<TransactionBoundWitness> | undefined\n\nexport const TransactionJsonSchemaValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = (\n tx: SignedHydratedTransactionWithStorageMeta,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (validate === undefined) validate = ajv.compile(TransactionBoundWitnessJsonSchema)\n if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {\n const error = new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: '\\n' })}`,\n )\n error.cause = validate.errors\n errors.push(error)\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/hex'\nimport type {\n Chain,\n HydratedTransactionValidationFunction, SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,\n} from '@xyo-network/xl1-protocol'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol'\n\nexport const TransactionProtocolValidator: HydratedTransactionValidationFunction<TransactionBoundWitness> = async (\n tx: SignedHydratedTransactionWithStorageMeta,\n chainId?: Chain,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (chainId !== undefined && tx[0].chain !== chainId) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'invalid chain id'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n}\n"],"mappings":";;;;AAAA,SAAoBA,iBAAiB;AAQrC,SAASC,oBAAoB;AAE7B,SAASC,2CAA2C;AAEpD,SAASC,4BAA4BC,UAA0CC,QAAc;AAC3F,SAAOA,OAAOC,IAAIC,CAAAA,SAAQH,SAASI,KAAKC,CAAAA,YAAWA,QAAQC,UAAUH,QAAQE,QAAQE,cAAcJ,IAAAA,CAAAA;AACrG;AAFSJ;AAIF,IAAMS,kCAEX,wBAAwCC,mBAAyE,CACjH,CAACC,IAAIC,UAAAA,MAAuD;AAE5D,QAAMC,SAA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MACAC;SACGR;;AAEL,YAAQ,MAAMS,QAAQC,IAAIP,WAAWQ,IAAIC,CAAAA,MAAKA,EAAEd,IAAIC,OAAAA,CAAAA,CAAAA,GAAYc,KAAI;EACtE,SAASC,IAAI;AACX,WAAO;MAAE,IAAIZ,MAAM,mCAAmCY,EAAAA,EAAI;;EAC5D;AACF;AAtBsBjB;","names":["ZERO_HASH","isAnyPayload","HydratedBoundWitnessValidationError","getPayloadsFromPayloadArray","payloads","hashes","map","hash","find","payload","_hash","_dataHash","BoundWitnessReferencesValidator","allowedSchemas","bw","payloadSet","errors","payload_hashes","length","push","HydratedBoundWitnessValidationError","ZERO_HASH","isAnyPayload","payloadHashIndex","indexOf","payloadDataHashIndex","payloadIndex","Math","max","declaredSchema","payload_schemas","schema","includes","ex","error","cause","toArrayBuffer","ZERO_HASH","BoundWitnessBuilder","BoundWitnessValidator","BoundWitnessValidationError","BoundWitnessSignaturesValidator","bw","errors","dataHash","BoundWitnessBuilder","results","Promise","all","addresses","map","address","index","BoundWitnessValidator","validateSignature","toArrayBuffer","$signatures","bwErrors","bwError","push","BoundWitnessValidationError","_hash","ZERO_HASH","ex","isTransactionBoundWitness","ZERO_HASH","HydratedTransactionValidationError","TransactionDurationValidator","tx","errors","exp","nbf","push","HydratedTransactionValidationError","_hash","ZERO_HASH","ex","ZERO_HASH","HydratedTransactionValidationError","extractElevatedHashes","TransactionElevationValidator","tx","errors","extractElevatedHashes","push","HydratedTransactionValidationError","_hash","ZERO_HASH","ex","asAddress","ZERO_HASH","addressesContains","HydratedTransactionValidationError","TransactionFromValidator","tx","errors","from","asAddress","undefined","push","HydratedTransactionValidationError","_hash","ZERO_HASH","addressesContains","ex","hexToBigInt","ZERO_HASH","AttoXL1","HydratedTransactionValidationError","minTransactionFees","TransactionGasValidator","tx","errors","fees","undefined","push","HydratedTransactionValidationError","_hash","ZERO_HASH","base","gasLimit","gasPrice","priority","parseFees","minTransactionFees","ex","ret","AttoXL1","hexToBigInt","ZERO_HASH","PayloadBuilder","HydratedTransactionValidationError","TransactionBoundWitnessJsonSchema","Ajv","ajv","Ajv","allErrors","strict","validate","TransactionJsonSchemaValidator","tx","errors","undefined","compile","TransactionBoundWitnessJsonSchema","PayloadBuilder","omitStorageMeta","error","HydratedTransactionValidationError","_hash","ZERO_HASH","errorsText","separator","cause","push","ex","ZERO_HASH","HydratedTransactionValidationError","TransactionProtocolValidator","tx","chainId","errors","undefined","chain","push","HydratedTransactionValidationError","_hash","ZERO_HASH","ex","Promise","resolve","validateTransaction","tx","chainId","additionalValidators","isTransactionBoundWitness","Error","validators","TransactionProtocolValidator","TransactionDurationValidator","TransactionFromValidator","TransactionGasValidator","TransactionElevationValidator","Promise","all","map","v","flat","ex"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-validation",
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.2",
|
|
5
5
|
"description": "XYO Layer One SDK Validation",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -36,31 +36,30 @@
|
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xylabs/arraybuffer": "~5.0.
|
|
40
|
-
"@xylabs/hex": "~5.0.
|
|
41
|
-
"@xyo-network/boundwitness-builder": "~5.0.
|
|
42
|
-
"@xyo-network/boundwitness-model": "~5.0.
|
|
43
|
-
"@xyo-network/boundwitness-validator": "~5.0.
|
|
44
|
-
"@xyo-network/payload-builder": "~5.0.
|
|
45
|
-
"@xyo-network/payload-model": "~5.0.
|
|
46
|
-
"@xyo-network/xl1-protocol": "~1.10.
|
|
47
|
-
"@xyo-network/xl1-protocol-sdk": "~1.12.
|
|
48
|
-
"@xyo-network/xl1-schema": "~1.12.
|
|
39
|
+
"@xylabs/arraybuffer": "~5.0.10",
|
|
40
|
+
"@xylabs/hex": "~5.0.10",
|
|
41
|
+
"@xyo-network/boundwitness-builder": "~5.0.7",
|
|
42
|
+
"@xyo-network/boundwitness-model": "~5.0.7",
|
|
43
|
+
"@xyo-network/boundwitness-validator": "~5.0.7",
|
|
44
|
+
"@xyo-network/payload-builder": "~5.0.7",
|
|
45
|
+
"@xyo-network/payload-model": "~5.0.7",
|
|
46
|
+
"@xyo-network/xl1-protocol": "~1.10.15",
|
|
47
|
+
"@xyo-network/xl1-protocol-sdk": "~1.12.2",
|
|
48
|
+
"@xyo-network/xl1-schema": "~1.12.2",
|
|
49
49
|
"ajv": "~8.17.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/node": "~24.
|
|
53
|
-
"@xylabs/assert": "~5.0.
|
|
54
|
-
"@xylabs/promise": "~5.0.
|
|
55
|
-
"@xylabs/ts-scripts-yarn3": "~7.1.
|
|
56
|
-
"@xylabs/tsconfig": "~7.1.
|
|
57
|
-
"@xyo-network/account": "~5.0.
|
|
58
|
-
"@xyo-network/account-model": "~5.0.
|
|
59
|
-
"@xyo-network/archivist-memory": "~5.0.
|
|
60
|
-
"@xyo-network/archivist-model": "~5.0.
|
|
61
|
-
"@xyo-network/chain-protocol": "~1.12.
|
|
62
|
-
"@xyo-network/wallet": "~5.0.
|
|
63
|
-
"@xyo-network/xl1-protocol-sdk": "~1.12.0",
|
|
52
|
+
"@types/node": "~24.3.0",
|
|
53
|
+
"@xylabs/assert": "~5.0.10",
|
|
54
|
+
"@xylabs/promise": "~5.0.10",
|
|
55
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.3",
|
|
56
|
+
"@xylabs/tsconfig": "~7.1.3",
|
|
57
|
+
"@xyo-network/account": "~5.0.7",
|
|
58
|
+
"@xyo-network/account-model": "~5.0.7",
|
|
59
|
+
"@xyo-network/archivist-memory": "~5.0.7",
|
|
60
|
+
"@xyo-network/archivist-model": "~5.0.7",
|
|
61
|
+
"@xyo-network/chain-protocol": "~1.12.2",
|
|
62
|
+
"@xyo-network/wallet": "~5.0.7",
|
|
64
63
|
"typescript": "~5.9.2",
|
|
65
64
|
"vitest": "~3.2.4"
|
|
66
65
|
},
|