@xyo-network/xl1-protocol-sdk 2.2.1 → 3.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/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts +35 -2
- package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
- package/dist/neutral/capabilities/Capability.d.ts +1 -8
- package/dist/neutral/capabilities/Capability.d.ts.map +1 -1
- package/dist/neutral/capabilities/Provider.d.ts +14 -23
- package/dist/neutral/capabilities/Provider.d.ts.map +1 -1
- package/dist/neutral/capabilities/connectionTypes.d.ts +9 -0
- package/dist/neutral/capabilities/connectionTypes.d.ts.map +1 -0
- package/dist/neutral/capabilities/index.d.ts +1 -0
- package/dist/neutral/capabilities/index.d.ts.map +1 -1
- package/dist/neutral/capabilities/resolveProviders.d.ts +27 -20
- package/dist/neutral/capabilities/resolveProviders.d.ts.map +1 -1
- package/dist/neutral/config/Actor.d.ts +216 -12
- package/dist/neutral/config/Actor.d.ts.map +1 -1
- package/dist/neutral/config/Actors.d.ts +41 -2
- package/dist/neutral/config/Actors.d.ts.map +1 -1
- package/dist/neutral/config/Base.d.ts +41 -2
- package/dist/neutral/config/Base.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +152 -8
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/HostActor.d.ts +216 -12
- package/dist/neutral/config/HostActor.d.ts.map +1 -1
- package/dist/neutral/config/ProviderBinding.d.ts +4 -5
- package/dist/neutral/config/ProviderBinding.d.ts.map +1 -1
- package/dist/neutral/config/adaptLegacyConfig.d.ts +2 -3
- package/dist/neutral/config/adaptLegacyConfig.d.ts.map +1 -1
- package/dist/neutral/config/connections/index.d.ts +6 -0
- package/dist/neutral/config/connections/index.d.ts.map +1 -0
- package/dist/neutral/config/index.d.ts +2 -0
- package/dist/neutral/config/index.d.ts.map +1 -1
- package/dist/neutral/config/normalizeConnectionsConfig.d.ts +20 -0
- package/dist/neutral/config/normalizeConnectionsConfig.d.ts.map +1 -0
- package/dist/neutral/config/transports/Transport.d.ts +18 -3
- package/dist/neutral/config/transports/Transport.d.ts.map +1 -1
- package/dist/neutral/context/Actor.d.ts +216 -12
- package/dist/neutral/context/Actor.d.ts.map +1 -1
- package/dist/neutral/context/HostActor.d.ts +216 -12
- package/dist/neutral/context/HostActor.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.d.ts +70 -4
- package/dist/neutral/getFileConfig.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.mjs +204 -191
- package/dist/neutral/getFileConfig.mjs.map +4 -4
- package/dist/neutral/index.mjs +570 -393
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts +216 -12
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +1 -1
- package/dist/neutral/test/index.mjs +204 -191
- package/dist/neutral/test/index.mjs.map +4 -4
- package/package.json +6 -6
package/dist/neutral/index.mjs
CHANGED
|
@@ -1017,6 +1017,18 @@ function filterViewerBySurface(viewer, surface) {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
|
+
// src/capabilities/connectionTypes.ts
|
|
1021
|
+
function descriptorConnectionTypes(descriptor) {
|
|
1022
|
+
return descriptor.connectionTypes ?? [];
|
|
1023
|
+
}
|
|
1024
|
+
function descriptorMatchesConnectionType(descriptor, connectionType) {
|
|
1025
|
+
const types = descriptorConnectionTypes(descriptor);
|
|
1026
|
+
if (types.length === 0) {
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
return types.includes(connectionType);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1020
1032
|
// src/capabilities/factoryBrand.ts
|
|
1021
1033
|
function backedFactory(_backings, factory) {
|
|
1022
1034
|
return factory;
|
|
@@ -1029,6 +1041,7 @@ function factoryBackingsCompatible(declared, available) {
|
|
|
1029
1041
|
}
|
|
1030
1042
|
|
|
1031
1043
|
// src/capabilities/resolveProviders.ts
|
|
1044
|
+
import { isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
1032
1045
|
var MissingCapabilityError = class extends Error {
|
|
1033
1046
|
moniker;
|
|
1034
1047
|
reasons;
|
|
@@ -1040,155 +1053,206 @@ var MissingCapabilityError = class extends Error {
|
|
|
1040
1053
|
this.reasons = reasons;
|
|
1041
1054
|
}
|
|
1042
1055
|
};
|
|
1056
|
+
var AmbiguousProviderError = class extends Error {
|
|
1057
|
+
candidates;
|
|
1058
|
+
moniker;
|
|
1059
|
+
constructor(moniker, candidates) {
|
|
1060
|
+
const ids = candidates.map((descriptor) => descriptor.id);
|
|
1061
|
+
super(
|
|
1062
|
+
`Multiple providers satisfy capability '${moniker}' for the requested connection: ${ids.join(", ")}`
|
|
1063
|
+
);
|
|
1064
|
+
this.name = "AmbiguousProviderError";
|
|
1065
|
+
this.moniker = moniker;
|
|
1066
|
+
this.candidates = ids;
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
var UnboundProviderError = class extends Error {
|
|
1070
|
+
moniker;
|
|
1071
|
+
constructor(moniker) {
|
|
1072
|
+
super(`Provider "${moniker}" has no providerBindings.connection`);
|
|
1073
|
+
this.name = "UnboundProviderError";
|
|
1074
|
+
this.moniker = moniker;
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
var UnknownConnectionError = class extends Error {
|
|
1078
|
+
connectionName;
|
|
1079
|
+
moniker;
|
|
1080
|
+
constructor(moniker, connectionName) {
|
|
1081
|
+
super(
|
|
1082
|
+
`providerBindings.${moniker}.connection references unknown connection "${connectionName}"`
|
|
1083
|
+
);
|
|
1084
|
+
this.name = "UnknownConnectionError";
|
|
1085
|
+
this.moniker = moniker;
|
|
1086
|
+
this.connectionName = connectionName;
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1043
1089
|
function resolveProviders(needs, candidates, ctx, options = {}) {
|
|
1044
|
-
const
|
|
1045
|
-
const {
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
const
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1090
|
+
const rejected = [];
|
|
1091
|
+
const { preconditionFiltered, preconditionRejected } = filterByPreconditions(candidates, ctx);
|
|
1092
|
+
rejected.push(...preconditionRejected);
|
|
1093
|
+
const wanted = new Set(needs);
|
|
1094
|
+
const bindings = {};
|
|
1095
|
+
const selectedById = /* @__PURE__ */ new Map();
|
|
1096
|
+
const candidatesByMoniker = indexCandidatesByMoniker(preconditionFiltered);
|
|
1097
|
+
expandBindingClosure(
|
|
1098
|
+
wanted,
|
|
1099
|
+
bindings,
|
|
1100
|
+
selectedById,
|
|
1101
|
+
candidatesByMoniker,
|
|
1102
|
+
rejected,
|
|
1103
|
+
candidates,
|
|
1104
|
+
options
|
|
1105
|
+
);
|
|
1106
|
+
const selected = topoSort(selectedById.values().toArray(), bindings, selectedById);
|
|
1051
1107
|
return {
|
|
1052
1108
|
bindings,
|
|
1053
1109
|
rejected,
|
|
1054
1110
|
selected
|
|
1055
1111
|
};
|
|
1056
1112
|
}
|
|
1057
|
-
function
|
|
1058
|
-
|
|
1059
|
-
|
|
1113
|
+
function expandBindingClosure(wanted, bindings, selectedById, candidatesByMoniker, rejected, allCandidates, options) {
|
|
1114
|
+
let grew = true;
|
|
1115
|
+
while (grew) {
|
|
1116
|
+
grew = false;
|
|
1117
|
+
for (const moniker of [...wanted].toSorted((a, b) => a.localeCompare(b))) {
|
|
1118
|
+
if (!Object.hasOwn(bindings, moniker)) {
|
|
1119
|
+
grew = bindMoniker(
|
|
1120
|
+
moniker,
|
|
1121
|
+
wanted,
|
|
1122
|
+
bindings,
|
|
1123
|
+
selectedById,
|
|
1124
|
+
candidatesByMoniker,
|
|
1125
|
+
rejected,
|
|
1126
|
+
allCandidates,
|
|
1127
|
+
options
|
|
1128
|
+
) || grew;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1060
1131
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1132
|
+
}
|
|
1133
|
+
function bindMoniker(moniker, wanted, bindings, selectedById, candidatesByMoniker, rejected, allCandidates, options) {
|
|
1134
|
+
const connectionName = connectionNameForMoniker(moniker, options);
|
|
1135
|
+
const connection = options.connections?.[connectionName];
|
|
1136
|
+
if (!isDefined4(connection)) {
|
|
1137
|
+
throw new UnknownConnectionError(moniker, connectionName);
|
|
1138
|
+
}
|
|
1139
|
+
const group = candidatesByMoniker.get(moniker) ?? [];
|
|
1140
|
+
const { filtered, rejected: connectionRejected } = filterByConnection(
|
|
1141
|
+
group,
|
|
1142
|
+
connection.type,
|
|
1143
|
+
connectionName
|
|
1144
|
+
);
|
|
1145
|
+
rejected.push(...connectionRejected);
|
|
1146
|
+
if (filtered.length === 0) {
|
|
1147
|
+
throw new MissingCapabilityError(moniker, reasonsFor(moniker, rejected, allCandidates));
|
|
1148
|
+
}
|
|
1149
|
+
if (filtered.length > 1) {
|
|
1150
|
+
throw new AmbiguousProviderError(moniker, filtered);
|
|
1151
|
+
}
|
|
1152
|
+
const winner = filtered[0];
|
|
1153
|
+
bindings[moniker] = winner.id;
|
|
1154
|
+
selectedById.set(winner.id, winner);
|
|
1155
|
+
let grew = false;
|
|
1156
|
+
for (const dep of winner.dependencies ?? []) {
|
|
1157
|
+
if (!wanted.has(dep)) {
|
|
1158
|
+
wanted.add(dep);
|
|
1159
|
+
grew = true;
|
|
1070
1160
|
}
|
|
1071
1161
|
}
|
|
1072
|
-
return
|
|
1162
|
+
return grew;
|
|
1073
1163
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1164
|
+
function connectionNameForMoniker(moniker, options) {
|
|
1165
|
+
const binding = options.providerBindings?.[moniker];
|
|
1166
|
+
const connectionName = binding?.connection ?? binding?.transport;
|
|
1167
|
+
if (!isDefined4(connectionName) || connectionName === "") {
|
|
1168
|
+
throw new UnboundProviderError(moniker);
|
|
1169
|
+
}
|
|
1170
|
+
return connectionName;
|
|
1171
|
+
}
|
|
1172
|
+
function indexCandidatesByMoniker(candidates) {
|
|
1173
|
+
const byMoniker = /* @__PURE__ */ new Map();
|
|
1174
|
+
for (const descriptor of candidates) {
|
|
1175
|
+
for (const moniker of descriptor.satisfies) {
|
|
1176
|
+
const list = byMoniker.get(moniker) ?? [];
|
|
1177
|
+
list.push(descriptor);
|
|
1178
|
+
byMoniker.set(moniker, list);
|
|
1086
1179
|
}
|
|
1087
1180
|
}
|
|
1088
|
-
return
|
|
1181
|
+
return byMoniker;
|
|
1089
1182
|
}
|
|
1090
|
-
function
|
|
1091
|
-
const surviving = [];
|
|
1183
|
+
function filterByConnection(group, connectionType, connectionName) {
|
|
1092
1184
|
const rejected = [];
|
|
1185
|
+
const filtered = group.filter((descriptor) => {
|
|
1186
|
+
const matches = descriptorMatchesConnectionType(descriptor, connectionType);
|
|
1187
|
+
if (!matches) {
|
|
1188
|
+
const types = descriptor.connectionTypes;
|
|
1189
|
+
rejected.push({
|
|
1190
|
+
descriptor,
|
|
1191
|
+
reason: `connection "${connectionName}" is type "${connectionType}" but descriptor supports [${types.join(", ")}]`
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
return matches;
|
|
1195
|
+
});
|
|
1196
|
+
return { filtered, rejected };
|
|
1197
|
+
}
|
|
1198
|
+
function filterByPreconditions(candidates, ctx) {
|
|
1199
|
+
const preconditionFiltered = [];
|
|
1200
|
+
const preconditionRejected = [];
|
|
1093
1201
|
for (const descriptor of candidates) {
|
|
1094
1202
|
try {
|
|
1095
1203
|
if (descriptor.preconditions(ctx)) {
|
|
1096
|
-
|
|
1204
|
+
preconditionFiltered.push(descriptor);
|
|
1097
1205
|
} else {
|
|
1098
|
-
|
|
1206
|
+
preconditionRejected.push({ descriptor, reason: "preconditions returned false" });
|
|
1099
1207
|
}
|
|
1100
1208
|
} catch (err) {
|
|
1101
|
-
|
|
1209
|
+
preconditionRejected.push({
|
|
1102
1210
|
descriptor,
|
|
1103
1211
|
reason: `preconditions threw: ${err instanceof Error ? err.message : String(err)}`
|
|
1104
1212
|
});
|
|
1105
1213
|
}
|
|
1106
1214
|
}
|
|
1107
|
-
return {
|
|
1215
|
+
return { preconditionFiltered, preconditionRejected };
|
|
1108
1216
|
}
|
|
1109
|
-
function
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
}
|
|
1114
|
-
const list = byCapability.get(moniker) ?? [];
|
|
1115
|
-
list.push(descriptor);
|
|
1116
|
-
byCapability.set(moniker, list);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
function groupByCapability(surviving, wanted) {
|
|
1120
|
-
const byCapability = /* @__PURE__ */ new Map();
|
|
1121
|
-
for (const descriptor of surviving) {
|
|
1122
|
-
addDescriptorCapabilities(byCapability, descriptor, wanted);
|
|
1217
|
+
function reasonsFor(moniker, rejected, allCandidates) {
|
|
1218
|
+
const candidatesForMoniker = allCandidates.filter((candidate) => candidate.satisfies.includes(moniker));
|
|
1219
|
+
if (candidatesForMoniker.length === 0) {
|
|
1220
|
+
return [];
|
|
1123
1221
|
}
|
|
1124
|
-
return
|
|
1222
|
+
return rejected.filter((rejection) => rejection.descriptor.satisfies.includes(moniker)).map((rejection) => `${rejection.descriptor.id}: ${rejection.reason}`);
|
|
1125
1223
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
if (pinned !== void 0 && pinned !== "") {
|
|
1133
|
-
const pinnedGroup = group?.filter((descriptor) => descriptor.id === pinned);
|
|
1134
|
-
if (!pinnedGroup || pinnedGroup.length === 0) {
|
|
1135
|
-
throw new MissingCapabilityError(moniker, [`requested implementation '${pinned}' not available`]);
|
|
1136
|
-
}
|
|
1137
|
-
group = pinnedGroup;
|
|
1138
|
-
}
|
|
1139
|
-
if (!group || group.length === 0) {
|
|
1140
|
-
throw new MissingCapabilityError(moniker, reasonsFor(moniker, rejected, allCandidates));
|
|
1141
|
-
}
|
|
1142
|
-
const sorted = group.toSorted(compareDescriptors);
|
|
1143
|
-
const winner = sorted[0];
|
|
1144
|
-
bindings[moniker] = winner.id;
|
|
1145
|
-
selectedById.set(winner.id, winner);
|
|
1146
|
-
for (const loser of sorted.slice(1)) {
|
|
1147
|
-
rejected.push({
|
|
1148
|
-
descriptor: loser,
|
|
1149
|
-
reason: `tier ${loser.tier} lost to ${winner.id} (tier ${winner.tier}) for ${moniker}`
|
|
1150
|
-
});
|
|
1224
|
+
function topoSort(descriptors, bindings, selectedById) {
|
|
1225
|
+
const monikerToDescriptor = /* @__PURE__ */ new Map();
|
|
1226
|
+
for (const [moniker, id] of Object.entries(bindings)) {
|
|
1227
|
+
const descriptor = selectedById.get(id);
|
|
1228
|
+
if (descriptor !== void 0) {
|
|
1229
|
+
monikerToDescriptor.set(moniker, descriptor);
|
|
1151
1230
|
}
|
|
1152
1231
|
}
|
|
1153
|
-
return { bindings, selectedById };
|
|
1154
|
-
}
|
|
1155
|
-
function reasonsFor(moniker, rejected, allCandidates) {
|
|
1156
|
-
const candidatesForMoniker = allCandidates.filter((c) => c.satisfies.includes(moniker));
|
|
1157
|
-
if (candidatesForMoniker.length === 0) return [];
|
|
1158
|
-
return rejected.filter((r) => r.descriptor.satisfies.includes(moniker)).map((r) => `${r.descriptor.id}: ${r.reason}`);
|
|
1159
|
-
}
|
|
1160
|
-
function compareDescriptors(a, b) {
|
|
1161
|
-
if (a.tier !== b.tier) return a.tier - b.tier;
|
|
1162
|
-
const pa = a.priority ?? 0;
|
|
1163
|
-
const pb = b.priority ?? 0;
|
|
1164
|
-
if (pa !== pb) return pb - pa;
|
|
1165
|
-
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
1166
|
-
}
|
|
1167
|
-
function topoSort(descriptors, ctx) {
|
|
1168
|
-
const byMoniker = /* @__PURE__ */ new Map();
|
|
1169
|
-
for (const d of descriptors) for (const m of d.satisfies) byMoniker.set(m, d);
|
|
1170
1232
|
const order = [];
|
|
1171
1233
|
const seen = /* @__PURE__ */ new Set();
|
|
1172
1234
|
const visiting = /* @__PURE__ */ new Set();
|
|
1173
|
-
const visit = (
|
|
1174
|
-
if (seen.has(
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1235
|
+
const visit = (descriptor) => {
|
|
1236
|
+
if (seen.has(descriptor.id)) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
if (visiting.has(descriptor.id)) {
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
visiting.add(descriptor.id);
|
|
1243
|
+
for (const depMoniker of descriptor.dependencies ?? []) {
|
|
1244
|
+
const depDescriptor = monikerToDescriptor.get(depMoniker);
|
|
1245
|
+
if (depDescriptor !== void 0) {
|
|
1246
|
+
visit(depDescriptor);
|
|
1185
1247
|
}
|
|
1186
1248
|
}
|
|
1187
|
-
visiting.delete(
|
|
1188
|
-
seen.add(
|
|
1189
|
-
order.push(
|
|
1249
|
+
visiting.delete(descriptor.id);
|
|
1250
|
+
seen.add(descriptor.id);
|
|
1251
|
+
order.push(descriptor);
|
|
1190
1252
|
};
|
|
1191
|
-
for (const
|
|
1253
|
+
for (const descriptor of descriptors) {
|
|
1254
|
+
visit(descriptor);
|
|
1255
|
+
}
|
|
1192
1256
|
return order;
|
|
1193
1257
|
}
|
|
1194
1258
|
|
|
@@ -1220,16 +1284,191 @@ var ChainConfigZod = z2.object({
|
|
|
1220
1284
|
})
|
|
1221
1285
|
});
|
|
1222
1286
|
|
|
1287
|
+
// src/config/transports/Transport.ts
|
|
1288
|
+
import { globalRegistry as globalRegistry4, z as z6 } from "zod";
|
|
1289
|
+
|
|
1290
|
+
// src/config/Remote.ts
|
|
1291
|
+
import { globalRegistry as globalRegistry2, z as z3 } from "zod";
|
|
1292
|
+
var RpcRemoteConfigBaseZod = z3.object({
|
|
1293
|
+
protocol: z3.string("http").register(globalRegistry2, {
|
|
1294
|
+
description: "Protocol for the RPC connection",
|
|
1295
|
+
type: "string"
|
|
1296
|
+
})
|
|
1297
|
+
}).describe("Base configuration for the remote RPC");
|
|
1298
|
+
var HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1299
|
+
protocol: z3.string("http").register(globalRegistry2, {
|
|
1300
|
+
description: "Protocol for the RPC connection",
|
|
1301
|
+
type: "string"
|
|
1302
|
+
}).default("http"),
|
|
1303
|
+
url: z3.string().register(globalRegistry2, {
|
|
1304
|
+
description: "URL for the Chain RPC API",
|
|
1305
|
+
type: "string"
|
|
1306
|
+
})
|
|
1307
|
+
}).describe("Configuration for the remote RPC using Http");
|
|
1308
|
+
var PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1309
|
+
protocol: z3.string().register(globalRegistry2, {
|
|
1310
|
+
description: "Protocol for the RPC connection",
|
|
1311
|
+
type: "string"
|
|
1312
|
+
}).default("postMessage"),
|
|
1313
|
+
networkId: z3.string().register(globalRegistry2, {
|
|
1314
|
+
description: "Network ID to use for the postMessage RPC connection",
|
|
1315
|
+
type: "string"
|
|
1316
|
+
}),
|
|
1317
|
+
sessionId: z3.string().register(globalRegistry2, {
|
|
1318
|
+
description: "Session ID to use for the postMessage RPC connection",
|
|
1319
|
+
type: "string"
|
|
1320
|
+
})
|
|
1321
|
+
}).describe("Configuration for the remote RPC using postMessage");
|
|
1322
|
+
var RpcRemoteConfigZod = z3.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod]).describe("Configuration for a remote RPC connection, either Http or postMessage");
|
|
1323
|
+
var RemoteConfigZod = z3.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
|
|
1324
|
+
|
|
1325
|
+
// src/config/storage/driver/Mongo.ts
|
|
1326
|
+
import { isDefined as isDefined5, isUndefined as isUndefined5 } from "@xylabs/sdk-js";
|
|
1327
|
+
import { globalRegistry as globalRegistry3, z as z4 } from "zod";
|
|
1328
|
+
var hasMongoConfig = (config) => {
|
|
1329
|
+
if (isUndefined5(config)) return false;
|
|
1330
|
+
return isDefined5(config.connectionString) && isDefined5(config.database) && isDefined5(config.domain);
|
|
1331
|
+
};
|
|
1332
|
+
var MongoConfigZod = z4.object({
|
|
1333
|
+
// TODO: Create from other arguments
|
|
1334
|
+
connectionString: z4.string().nonempty().optional().register(globalRegistry3, {
|
|
1335
|
+
description: "MongoDB connection string",
|
|
1336
|
+
title: "storage.mongo.connectionString",
|
|
1337
|
+
type: "string"
|
|
1338
|
+
}),
|
|
1339
|
+
database: z4.string().nonempty().optional().register(globalRegistry3, {
|
|
1340
|
+
description: "MongoDB database name",
|
|
1341
|
+
title: "storage.mongo.database",
|
|
1342
|
+
type: "string"
|
|
1343
|
+
}),
|
|
1344
|
+
domain: z4.string().nonempty().optional().register(globalRegistry3, {
|
|
1345
|
+
description: "MongoDB domain",
|
|
1346
|
+
title: "storage.mongo.domain",
|
|
1347
|
+
type: "string"
|
|
1348
|
+
}),
|
|
1349
|
+
password: z4.string().nonempty().optional().register(globalRegistry3, {
|
|
1350
|
+
description: "MongoDB password",
|
|
1351
|
+
title: "storage.mongo.password",
|
|
1352
|
+
type: "string"
|
|
1353
|
+
}),
|
|
1354
|
+
username: z4.string().nonempty().optional().register(globalRegistry3, {
|
|
1355
|
+
description: "MongoDB username",
|
|
1356
|
+
title: "storage.mongo.username",
|
|
1357
|
+
type: "string"
|
|
1358
|
+
})
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
// src/config/storage/driver/S3.ts
|
|
1362
|
+
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
1363
|
+
import { z as z5 } from "zod";
|
|
1364
|
+
var S3BucketConfigZod = z5.object({
|
|
1365
|
+
accessKeyId: z5.string().nonempty().optional().describe("S3-compatible access key id for this bucket (overrides the shared default)"),
|
|
1366
|
+
accountId: z5.string().nonempty().optional().describe("Account id for this bucket; on Cloudflare R2 it forms the endpoint (overrides the shared default)"),
|
|
1367
|
+
bucket: z5.string().nonempty().optional().describe("S3-compatible bucket name"),
|
|
1368
|
+
prefix: z5.string().nonempty().optional().describe("Optional key prefix within the bucket"),
|
|
1369
|
+
readUrl: z5.string().nonempty().optional().describe("Public HTTP/CDN base URL for anonymous reads of this bucket"),
|
|
1370
|
+
secretAccessKey: z5.string().nonempty().optional().describe("S3-compatible secret access key for this bucket (overrides the shared default)")
|
|
1371
|
+
});
|
|
1372
|
+
var S3ConfigZod = z5.object({
|
|
1373
|
+
accessKeyId: z5.string().nonempty().optional().describe("Shared S3-compatible access key id (default for all buckets)"),
|
|
1374
|
+
accountId: z5.string().nonempty().optional().describe("Shared account id (default for all buckets; on Cloudflare R2 it forms the endpoint)"),
|
|
1375
|
+
chainState: S3BucketConfigZod.optional().describe("Bucket for the mutable chain state (the head pointer)"),
|
|
1376
|
+
finalized: S3BucketConfigZod.optional().describe("Bucket for the finalized files (blocks, payloads, manifest)"),
|
|
1377
|
+
index: S3BucketConfigZod.optional().describe("Bucket for the chain index (the step-summary families)"),
|
|
1378
|
+
prefix: z5.string().nonempty().optional().describe("Shared key prefix (default for all buckets)"),
|
|
1379
|
+
secretAccessKey: z5.string().nonempty().optional().describe("Shared S3-compatible secret access key (default for all buckets)")
|
|
1380
|
+
});
|
|
1381
|
+
function resolveS3Bucket(config, which) {
|
|
1382
|
+
if (config === void 0) return void 0;
|
|
1383
|
+
const entry = config[which];
|
|
1384
|
+
const accessKeyId = entry?.accessKeyId ?? config.accessKeyId;
|
|
1385
|
+
const accountId = entry?.accountId ?? config.accountId;
|
|
1386
|
+
const secretAccessKey = entry?.secretAccessKey ?? config.secretAccessKey;
|
|
1387
|
+
const bucket = entry?.bucket ?? config.finalized?.bucket;
|
|
1388
|
+
if (!isDefined6(accessKeyId) || !isDefined6(accountId) || !isDefined6(secretAccessKey) || !isDefined6(bucket)) return void 0;
|
|
1389
|
+
return {
|
|
1390
|
+
accessKeyId,
|
|
1391
|
+
accountId,
|
|
1392
|
+
bucket,
|
|
1393
|
+
prefix: entry?.prefix ?? config.prefix,
|
|
1394
|
+
readUrl: entry?.readUrl,
|
|
1395
|
+
secretAccessKey
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
function hasS3Config(config, which = "finalized") {
|
|
1399
|
+
return resolveS3Bucket(config, which) !== void 0;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
// src/config/transports/Transport.ts
|
|
1403
|
+
var LmdbTransportConfigZod = z6.object({
|
|
1404
|
+
access: z6.enum(["read", "write"]).optional().register(globalRegistry4, {
|
|
1405
|
+
description: "Access mode for this LMDB connection (read or write)",
|
|
1406
|
+
title: "transports.lmdb.access",
|
|
1407
|
+
type: "string"
|
|
1408
|
+
}),
|
|
1409
|
+
root: z6.string().register(globalRegistry4, {
|
|
1410
|
+
description: "Root directory for local LMDB storage",
|
|
1411
|
+
title: "transports.lmdb.root",
|
|
1412
|
+
type: "string"
|
|
1413
|
+
}),
|
|
1414
|
+
store: z6.string().optional().register(globalRegistry4, {
|
|
1415
|
+
description: "Logical store name within the LMDB root (e.g. finalized-chain, mempool)",
|
|
1416
|
+
title: "transports.lmdb.store",
|
|
1417
|
+
type: "string"
|
|
1418
|
+
}),
|
|
1419
|
+
type: z6.literal("lmdb")
|
|
1420
|
+
}).describe("LMDB local storage transport");
|
|
1421
|
+
var MongoTransportConfigZod = z6.object({
|
|
1422
|
+
type: z6.literal("mongo"),
|
|
1423
|
+
connectionString: MongoConfigZod.shape.connectionString,
|
|
1424
|
+
database: MongoConfigZod.shape.database,
|
|
1425
|
+
domain: MongoConfigZod.shape.domain,
|
|
1426
|
+
password: MongoConfigZod.shape.password,
|
|
1427
|
+
username: MongoConfigZod.shape.username
|
|
1428
|
+
}).describe("MongoDB storage transport");
|
|
1429
|
+
var RpcTransportConfigZod = HttpRpcRemoteConfigZod.extend({ type: z6.literal("rpc") }).describe("XL1 JSON-RPC transport");
|
|
1430
|
+
var RestTransportConfigZod = z6.object({
|
|
1431
|
+
type: z6.literal("rest"),
|
|
1432
|
+
baseUrl: z6.string().register(globalRegistry4, {
|
|
1433
|
+
description: "HTTP base URL for REST reads",
|
|
1434
|
+
title: "transports.rest.baseUrl",
|
|
1435
|
+
type: "string"
|
|
1436
|
+
})
|
|
1437
|
+
}).describe("HTTP REST read transport");
|
|
1438
|
+
var S3TransportConfigZod = S3BucketConfigZod.extend({
|
|
1439
|
+
type: z6.literal("s3"),
|
|
1440
|
+
accessKeyId: z6.string().optional(),
|
|
1441
|
+
accountId: z6.string().optional(),
|
|
1442
|
+
secretAccessKey: z6.string().optional()
|
|
1443
|
+
}).describe("S3-compatible object storage transport");
|
|
1444
|
+
var EvmRpcTransportConfigZod = z6.object({
|
|
1445
|
+
type: z6.literal("evm-rpc"),
|
|
1446
|
+
url: z6.string().register(globalRegistry4, {
|
|
1447
|
+
description: "EVM JSON-RPC URL",
|
|
1448
|
+
title: "transports.evm-rpc.url",
|
|
1449
|
+
type: "string"
|
|
1450
|
+
})
|
|
1451
|
+
}).describe("EVM JSON-RPC transport");
|
|
1452
|
+
var TransportConfigZod = z6.discriminatedUnion("type", [
|
|
1453
|
+
LmdbTransportConfigZod,
|
|
1454
|
+
MongoTransportConfigZod,
|
|
1455
|
+
RpcTransportConfigZod,
|
|
1456
|
+
RestTransportConfigZod,
|
|
1457
|
+
S3TransportConfigZod,
|
|
1458
|
+
EvmRpcTransportConfigZod
|
|
1459
|
+
]);
|
|
1460
|
+
var TransportsConfigZod = z6.record(z6.string(), TransportConfigZod).default({});
|
|
1461
|
+
|
|
1223
1462
|
// src/config/DataLake/DataLake.ts
|
|
1224
|
-
import { z as
|
|
1463
|
+
import { z as z10 } from "zod";
|
|
1225
1464
|
|
|
1226
1465
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
1227
|
-
import { globalRegistry as
|
|
1466
|
+
import { globalRegistry as globalRegistry6, z as z8 } from "zod";
|
|
1228
1467
|
|
|
1229
1468
|
// src/config/DataLake/DataLakeRemoteConfig.ts
|
|
1230
|
-
import { globalRegistry as
|
|
1231
|
-
var DataLakeDriverConfigBaseZod =
|
|
1232
|
-
driver:
|
|
1469
|
+
import { globalRegistry as globalRegistry5, z as z7 } from "zod";
|
|
1470
|
+
var DataLakeDriverConfigBaseZod = z7.object({
|
|
1471
|
+
driver: z7.string().register(globalRegistry5, {
|
|
1233
1472
|
description: "Driver for the data lake",
|
|
1234
1473
|
type: "string"
|
|
1235
1474
|
})
|
|
@@ -1237,55 +1476,55 @@ var DataLakeDriverConfigBaseZod = z3.object({
|
|
|
1237
1476
|
|
|
1238
1477
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
1239
1478
|
var RestDataLakeConfigZod = DataLakeDriverConfigBaseZod.extend({
|
|
1240
|
-
driver:
|
|
1479
|
+
driver: z8.literal("rest").register(globalRegistry6, {
|
|
1241
1480
|
description: "Driver for the REST data lake",
|
|
1242
1481
|
type: "string"
|
|
1243
1482
|
}),
|
|
1244
|
-
url:
|
|
1483
|
+
url: z8.string().register(globalRegistry6, {
|
|
1245
1484
|
description: "URL for the REST data lake",
|
|
1246
1485
|
type: "string"
|
|
1247
1486
|
})
|
|
1248
1487
|
}).describe("Configuration for the REST data lake driver");
|
|
1249
1488
|
|
|
1250
1489
|
// src/config/DataLake/RouterDataLakeConfig.ts
|
|
1251
|
-
import { globalRegistry as
|
|
1252
|
-
var RouterDataLakeConfigZod =
|
|
1253
|
-
driver:
|
|
1490
|
+
import { globalRegistry as globalRegistry7, z as z9 } from "zod";
|
|
1491
|
+
var RouterDataLakeConfigZod = z9.object({
|
|
1492
|
+
driver: z9.literal("router").register(globalRegistry7, {
|
|
1254
1493
|
description: "Driver for the router data lake",
|
|
1255
1494
|
type: "string"
|
|
1256
1495
|
}),
|
|
1257
|
-
children:
|
|
1496
|
+
children: z9.array(z9.lazy(() => DataLakeConfigZod)).register(globalRegistry7, {
|
|
1258
1497
|
description: "Child data lake drivers",
|
|
1259
1498
|
type: "array"
|
|
1260
1499
|
})
|
|
1261
1500
|
}).describe("Configuration for the router data lake driver");
|
|
1262
1501
|
|
|
1263
1502
|
// src/config/DataLake/DataLake.ts
|
|
1264
|
-
var DataLakeConfigZod =
|
|
1503
|
+
var DataLakeConfigZod = z10.lazy(() => z10.union([RestDataLakeConfigZod, RouterDataLakeConfigZod])).describe("Configuration for a data lake");
|
|
1265
1504
|
|
|
1266
1505
|
// src/config/Evm.ts
|
|
1267
|
-
import { globalRegistry as
|
|
1268
|
-
var EvmInfuraConfigZod =
|
|
1269
|
-
projectId:
|
|
1506
|
+
import { globalRegistry as globalRegistry8, z as z11 } from "zod";
|
|
1507
|
+
var EvmInfuraConfigZod = z11.object({
|
|
1508
|
+
projectId: z11.string().optional().register(globalRegistry8, {
|
|
1270
1509
|
description: "Infura project ID",
|
|
1271
1510
|
title: "evm.infura.projectId",
|
|
1272
1511
|
type: "string"
|
|
1273
1512
|
}),
|
|
1274
|
-
projectSecret:
|
|
1513
|
+
projectSecret: z11.string().optional().register(globalRegistry8, {
|
|
1275
1514
|
description: "Infura project secret",
|
|
1276
1515
|
title: "evm.infura.projectSecret",
|
|
1277
1516
|
type: "string"
|
|
1278
1517
|
})
|
|
1279
1518
|
});
|
|
1280
|
-
var EvmJsonRpcConfigZod =
|
|
1281
|
-
url:
|
|
1519
|
+
var EvmJsonRpcConfigZod = z11.object({
|
|
1520
|
+
url: z11.url().optional().register(globalRegistry8, {
|
|
1282
1521
|
description: "JSON-RPC URL",
|
|
1283
1522
|
title: "evm.jsonRpc.url",
|
|
1284
1523
|
type: "string"
|
|
1285
1524
|
})
|
|
1286
1525
|
});
|
|
1287
|
-
var EvmConfigZod =
|
|
1288
|
-
chainId:
|
|
1526
|
+
var EvmConfigZod = z11.object({
|
|
1527
|
+
chainId: z11.string().optional().register(globalRegistry8, {
|
|
1289
1528
|
description: "EVM chain ID",
|
|
1290
1529
|
title: "evm.chainId",
|
|
1291
1530
|
type: "string"
|
|
@@ -1296,17 +1535,17 @@ var EvmConfigZod = z7.object({
|
|
|
1296
1535
|
|
|
1297
1536
|
// src/config/Log.ts
|
|
1298
1537
|
import { LogLevel } from "@xylabs/sdk-js";
|
|
1299
|
-
import { globalRegistry as
|
|
1538
|
+
import { globalRegistry as globalRegistry9, z as z12 } from "zod";
|
|
1300
1539
|
var LogLevelNames = Object.keys(LogLevel);
|
|
1301
|
-
var LogConfigZod =
|
|
1302
|
-
logLevel:
|
|
1540
|
+
var LogConfigZod = z12.object({
|
|
1541
|
+
logLevel: z12.enum(LogLevelNames).default("info").register(globalRegistry9, {
|
|
1303
1542
|
choices: LogLevelNames,
|
|
1304
1543
|
default: "info",
|
|
1305
1544
|
description: "Desired process verbosity",
|
|
1306
1545
|
title: "logLevel",
|
|
1307
1546
|
type: "string"
|
|
1308
1547
|
}),
|
|
1309
|
-
silent:
|
|
1548
|
+
silent: z12.boolean().default(false).register(globalRegistry9, {
|
|
1310
1549
|
default: false,
|
|
1311
1550
|
description: "Whether to run in silent mode",
|
|
1312
1551
|
title: "silent",
|
|
@@ -1315,23 +1554,23 @@ var LogConfigZod = z8.object({
|
|
|
1315
1554
|
});
|
|
1316
1555
|
|
|
1317
1556
|
// src/config/ProviderBinding.ts
|
|
1318
|
-
import { globalRegistry as
|
|
1319
|
-
var ProviderBindingConfigZod =
|
|
1320
|
-
|
|
1321
|
-
description: "
|
|
1322
|
-
title: "providerBindings.
|
|
1557
|
+
import { globalRegistry as globalRegistry10, z as z13 } from "zod";
|
|
1558
|
+
var ProviderBindingConfigZod = z13.object({
|
|
1559
|
+
connection: z13.string().optional().register(globalRegistry10, {
|
|
1560
|
+
description: "Named connection from the top-level connections map",
|
|
1561
|
+
title: "providerBindings.connection",
|
|
1323
1562
|
type: "string"
|
|
1324
1563
|
}),
|
|
1325
|
-
transport:
|
|
1326
|
-
description: "
|
|
1564
|
+
transport: z13.string().optional().register(globalRegistry10, {
|
|
1565
|
+
description: "Deprecated alias for connection (kept in sync during migration)",
|
|
1327
1566
|
title: "providerBindings.transport",
|
|
1328
1567
|
type: "string"
|
|
1329
1568
|
})
|
|
1330
|
-
}).describe("Provider
|
|
1331
|
-
var ProviderBindingsConfigZod =
|
|
1569
|
+
}).describe("Provider connection binding");
|
|
1570
|
+
var ProviderBindingsConfigZod = z13.record(z13.string(), ProviderBindingConfigZod).default({});
|
|
1332
1571
|
|
|
1333
1572
|
// src/config/Providers.ts
|
|
1334
|
-
import
|
|
1573
|
+
import z15 from "zod";
|
|
1335
1574
|
|
|
1336
1575
|
// src/config/Provider.ts
|
|
1337
1576
|
import {
|
|
@@ -1339,135 +1578,23 @@ import {
|
|
|
1339
1578
|
zodIsFactory,
|
|
1340
1579
|
zodToFactory
|
|
1341
1580
|
} from "@xylabs/sdk-js";
|
|
1342
|
-
import { z as
|
|
1343
|
-
var ProviderConfigZod =
|
|
1344
|
-
moniker:
|
|
1345
|
-
labels:
|
|
1581
|
+
import { z as z14 } from "zod";
|
|
1582
|
+
var ProviderConfigZod = z14.object({
|
|
1583
|
+
moniker: z14.string(),
|
|
1584
|
+
labels: z14.array(z14.string()).optional()
|
|
1346
1585
|
}).describe("Configuration for a Provider");
|
|
1347
1586
|
var isProviderConfig = zodIsFactory(ProviderConfigZod);
|
|
1348
1587
|
var asProviderConfig = zodAsFactory2(ProviderConfigZod, "asProviderConfig");
|
|
1349
1588
|
var toProviderConfig = zodToFactory(ProviderConfigZod, "toProviderConfig");
|
|
1350
1589
|
|
|
1351
1590
|
// src/config/Providers.ts
|
|
1352
|
-
var ProvidersConfigZod =
|
|
1353
|
-
|
|
1354
|
-
// src/config/Remote.ts
|
|
1355
|
-
import { globalRegistry as globalRegistry8, z as z12 } from "zod";
|
|
1356
|
-
var RpcRemoteConfigBaseZod = z12.object({
|
|
1357
|
-
protocol: z12.string("http").register(globalRegistry8, {
|
|
1358
|
-
description: "Protocol for the RPC connection",
|
|
1359
|
-
type: "string"
|
|
1360
|
-
})
|
|
1361
|
-
}).describe("Base configuration for the remote RPC");
|
|
1362
|
-
var HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1363
|
-
protocol: z12.string("http").register(globalRegistry8, {
|
|
1364
|
-
description: "Protocol for the RPC connection",
|
|
1365
|
-
type: "string"
|
|
1366
|
-
}).default("http"),
|
|
1367
|
-
url: z12.string().register(globalRegistry8, {
|
|
1368
|
-
description: "URL for the Chain RPC API",
|
|
1369
|
-
type: "string"
|
|
1370
|
-
})
|
|
1371
|
-
}).describe("Configuration for the remote RPC using Http");
|
|
1372
|
-
var PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1373
|
-
protocol: z12.string().register(globalRegistry8, {
|
|
1374
|
-
description: "Protocol for the RPC connection",
|
|
1375
|
-
type: "string"
|
|
1376
|
-
}).default("postMessage"),
|
|
1377
|
-
networkId: z12.string().register(globalRegistry8, {
|
|
1378
|
-
description: "Network ID to use for the postMessage RPC connection",
|
|
1379
|
-
type: "string"
|
|
1380
|
-
}),
|
|
1381
|
-
sessionId: z12.string().register(globalRegistry8, {
|
|
1382
|
-
description: "Session ID to use for the postMessage RPC connection",
|
|
1383
|
-
type: "string"
|
|
1384
|
-
})
|
|
1385
|
-
}).describe("Configuration for the remote RPC using postMessage");
|
|
1386
|
-
var RpcRemoteConfigZod = z12.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod]).describe("Configuration for a remote RPC connection, either Http or postMessage");
|
|
1387
|
-
var RemoteConfigZod = z12.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
|
|
1388
|
-
|
|
1389
|
-
// src/config/storage/driver/Mongo.ts
|
|
1390
|
-
import { isDefined as isDefined4, isUndefined as isUndefined5 } from "@xylabs/sdk-js";
|
|
1391
|
-
import { globalRegistry as globalRegistry9, z as z13 } from "zod";
|
|
1392
|
-
var hasMongoConfig = (config) => {
|
|
1393
|
-
if (isUndefined5(config)) return false;
|
|
1394
|
-
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain);
|
|
1395
|
-
};
|
|
1396
|
-
var MongoConfigZod = z13.object({
|
|
1397
|
-
// TODO: Create from other arguments
|
|
1398
|
-
connectionString: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1399
|
-
description: "MongoDB connection string",
|
|
1400
|
-
title: "storage.mongo.connectionString",
|
|
1401
|
-
type: "string"
|
|
1402
|
-
}),
|
|
1403
|
-
database: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1404
|
-
description: "MongoDB database name",
|
|
1405
|
-
title: "storage.mongo.database",
|
|
1406
|
-
type: "string"
|
|
1407
|
-
}),
|
|
1408
|
-
domain: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1409
|
-
description: "MongoDB domain",
|
|
1410
|
-
title: "storage.mongo.domain",
|
|
1411
|
-
type: "string"
|
|
1412
|
-
}),
|
|
1413
|
-
password: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1414
|
-
description: "MongoDB password",
|
|
1415
|
-
title: "storage.mongo.password",
|
|
1416
|
-
type: "string"
|
|
1417
|
-
}),
|
|
1418
|
-
username: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1419
|
-
description: "MongoDB username",
|
|
1420
|
-
title: "storage.mongo.username",
|
|
1421
|
-
type: "string"
|
|
1422
|
-
})
|
|
1423
|
-
});
|
|
1424
|
-
|
|
1425
|
-
// src/config/storage/driver/S3.ts
|
|
1426
|
-
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
1427
|
-
import { z as z14 } from "zod";
|
|
1428
|
-
var S3BucketConfigZod = z14.object({
|
|
1429
|
-
accessKeyId: z14.string().nonempty().optional().describe("S3-compatible access key id for this bucket (overrides the shared default)"),
|
|
1430
|
-
accountId: z14.string().nonempty().optional().describe("Account id for this bucket; on Cloudflare R2 it forms the endpoint (overrides the shared default)"),
|
|
1431
|
-
bucket: z14.string().nonempty().optional().describe("S3-compatible bucket name"),
|
|
1432
|
-
prefix: z14.string().nonempty().optional().describe("Optional key prefix within the bucket"),
|
|
1433
|
-
readUrl: z14.string().nonempty().optional().describe("Public HTTP/CDN base URL for anonymous reads of this bucket"),
|
|
1434
|
-
secretAccessKey: z14.string().nonempty().optional().describe("S3-compatible secret access key for this bucket (overrides the shared default)")
|
|
1435
|
-
});
|
|
1436
|
-
var S3ConfigZod = z14.object({
|
|
1437
|
-
accessKeyId: z14.string().nonempty().optional().describe("Shared S3-compatible access key id (default for all buckets)"),
|
|
1438
|
-
accountId: z14.string().nonempty().optional().describe("Shared account id (default for all buckets; on Cloudflare R2 it forms the endpoint)"),
|
|
1439
|
-
chainState: S3BucketConfigZod.optional().describe("Bucket for the mutable chain state (the head pointer)"),
|
|
1440
|
-
finalized: S3BucketConfigZod.optional().describe("Bucket for the finalized files (blocks, payloads, manifest)"),
|
|
1441
|
-
index: S3BucketConfigZod.optional().describe("Bucket for the chain index (the step-summary families)"),
|
|
1442
|
-
prefix: z14.string().nonempty().optional().describe("Shared key prefix (default for all buckets)"),
|
|
1443
|
-
secretAccessKey: z14.string().nonempty().optional().describe("Shared S3-compatible secret access key (default for all buckets)")
|
|
1444
|
-
});
|
|
1445
|
-
function resolveS3Bucket(config, which) {
|
|
1446
|
-
if (config === void 0) return void 0;
|
|
1447
|
-
const entry = config[which];
|
|
1448
|
-
const accessKeyId = entry?.accessKeyId ?? config.accessKeyId;
|
|
1449
|
-
const accountId = entry?.accountId ?? config.accountId;
|
|
1450
|
-
const secretAccessKey = entry?.secretAccessKey ?? config.secretAccessKey;
|
|
1451
|
-
const bucket = entry?.bucket ?? config.finalized?.bucket;
|
|
1452
|
-
if (!isDefined5(accessKeyId) || !isDefined5(accountId) || !isDefined5(secretAccessKey) || !isDefined5(bucket)) return void 0;
|
|
1453
|
-
return {
|
|
1454
|
-
accessKeyId,
|
|
1455
|
-
accountId,
|
|
1456
|
-
bucket,
|
|
1457
|
-
prefix: entry?.prefix ?? config.prefix,
|
|
1458
|
-
readUrl: entry?.readUrl,
|
|
1459
|
-
secretAccessKey
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
function hasS3Config(config, which = "finalized") {
|
|
1463
|
-
return resolveS3Bucket(config, which) !== void 0;
|
|
1464
|
-
}
|
|
1591
|
+
var ProvidersConfigZod = z15.array(ProviderConfigZod.loose()).describe("Configuration for providers").default([]);
|
|
1465
1592
|
|
|
1466
1593
|
// src/config/storage/Storage.ts
|
|
1467
|
-
import { globalRegistry as
|
|
1468
|
-
var StorageConfigZod =
|
|
1594
|
+
import { globalRegistry as globalRegistry11, z as z16 } from "zod";
|
|
1595
|
+
var StorageConfigZod = z16.object({
|
|
1469
1596
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
1470
|
-
root:
|
|
1597
|
+
root: z16.string().optional().register(globalRegistry11, {
|
|
1471
1598
|
description: "Root directory for local storage",
|
|
1472
1599
|
title: "storage.root",
|
|
1473
1600
|
type: "string"
|
|
@@ -1476,7 +1603,7 @@ var StorageConfigZod = z15.object({
|
|
|
1476
1603
|
}).describe("Storage configuration options");
|
|
1477
1604
|
|
|
1478
1605
|
// src/config/Telemetry.ts
|
|
1479
|
-
import { globalRegistry as
|
|
1606
|
+
import { globalRegistry as globalRegistry12, z as z17 } from "zod";
|
|
1480
1607
|
var DefaultMetricsScrapePorts = {
|
|
1481
1608
|
api: 9465,
|
|
1482
1609
|
bridge: 9468,
|
|
@@ -1484,86 +1611,35 @@ var DefaultMetricsScrapePorts = {
|
|
|
1484
1611
|
producer: 9464,
|
|
1485
1612
|
rewardRedemptionApi: 9467
|
|
1486
1613
|
};
|
|
1487
|
-
var MetricsScrapeConfigZod =
|
|
1488
|
-
path:
|
|
1614
|
+
var MetricsScrapeConfigZod = z17.object({
|
|
1615
|
+
path: z17.string().default("/metrics").register(globalRegistry12, {
|
|
1489
1616
|
default: "/metrics",
|
|
1490
1617
|
description: "Path for the metrics scrape endpoint",
|
|
1491
1618
|
title: "telemetry.metrics.scrape.path",
|
|
1492
1619
|
type: "string"
|
|
1493
1620
|
}),
|
|
1494
|
-
port:
|
|
1621
|
+
port: z17.coerce.number().int().positive().optional().register(globalRegistry12, {
|
|
1495
1622
|
description: "Port for the metrics scrape endpoint",
|
|
1496
1623
|
title: "telemetry.metrics.scrape.port",
|
|
1497
1624
|
type: "number"
|
|
1498
1625
|
})
|
|
1499
1626
|
}).describe("Metrics scrape configuration");
|
|
1500
|
-
var MetricsConfigZod =
|
|
1501
|
-
var OpenTelemetryConfigZod =
|
|
1627
|
+
var MetricsConfigZod = z17.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
1628
|
+
var OpenTelemetryConfigZod = z17.object({
|
|
1502
1629
|
// OpenTelemetry options
|
|
1503
|
-
otlpEndpoint:
|
|
1630
|
+
otlpEndpoint: z17.url().optional().register(globalRegistry12, {
|
|
1504
1631
|
description: "OTLP endpoint for exporting telemetry data",
|
|
1505
1632
|
title: "telemetry.otel.otlpEndpoint",
|
|
1506
1633
|
type: "string"
|
|
1507
1634
|
})
|
|
1508
1635
|
});
|
|
1509
|
-
var TelemetryConfigZod =
|
|
1636
|
+
var TelemetryConfigZod = z17.object({
|
|
1510
1637
|
// Metrics configuration
|
|
1511
1638
|
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
1512
1639
|
// OpenTelemetry configuration
|
|
1513
1640
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
1514
1641
|
}).describe("Telemetry configuration options");
|
|
1515
1642
|
|
|
1516
|
-
// src/config/transports/Transport.ts
|
|
1517
|
-
import { globalRegistry as globalRegistry12, z as z17 } from "zod";
|
|
1518
|
-
var LmdbTransportConfigZod = z17.object({
|
|
1519
|
-
type: z17.literal("lmdb"),
|
|
1520
|
-
root: z17.string().register(globalRegistry12, {
|
|
1521
|
-
description: "Root directory for local LMDB storage",
|
|
1522
|
-
title: "transports.lmdb.root",
|
|
1523
|
-
type: "string"
|
|
1524
|
-
})
|
|
1525
|
-
}).describe("LMDB local storage transport");
|
|
1526
|
-
var MongoTransportConfigZod = z17.object({
|
|
1527
|
-
type: z17.literal("mongo"),
|
|
1528
|
-
connectionString: MongoConfigZod.shape.connectionString,
|
|
1529
|
-
database: MongoConfigZod.shape.database,
|
|
1530
|
-
domain: MongoConfigZod.shape.domain,
|
|
1531
|
-
password: MongoConfigZod.shape.password,
|
|
1532
|
-
username: MongoConfigZod.shape.username
|
|
1533
|
-
}).describe("MongoDB storage transport");
|
|
1534
|
-
var RpcTransportConfigZod = HttpRpcRemoteConfigZod.extend({ type: z17.literal("rpc") }).describe("XL1 JSON-RPC transport");
|
|
1535
|
-
var RestTransportConfigZod = z17.object({
|
|
1536
|
-
type: z17.literal("rest"),
|
|
1537
|
-
baseUrl: z17.string().register(globalRegistry12, {
|
|
1538
|
-
description: "HTTP base URL for REST reads",
|
|
1539
|
-
title: "transports.rest.baseUrl",
|
|
1540
|
-
type: "string"
|
|
1541
|
-
})
|
|
1542
|
-
}).describe("HTTP REST read transport");
|
|
1543
|
-
var S3TransportConfigZod = S3BucketConfigZod.extend({
|
|
1544
|
-
type: z17.literal("s3"),
|
|
1545
|
-
accessKeyId: z17.string().optional(),
|
|
1546
|
-
accountId: z17.string().optional(),
|
|
1547
|
-
secretAccessKey: z17.string().optional()
|
|
1548
|
-
}).describe("S3-compatible object storage transport");
|
|
1549
|
-
var EvmRpcTransportConfigZod = z17.object({
|
|
1550
|
-
type: z17.literal("evm-rpc"),
|
|
1551
|
-
url: z17.string().register(globalRegistry12, {
|
|
1552
|
-
description: "EVM JSON-RPC URL",
|
|
1553
|
-
title: "transports.evm-rpc.url",
|
|
1554
|
-
type: "string"
|
|
1555
|
-
})
|
|
1556
|
-
}).describe("EVM JSON-RPC transport");
|
|
1557
|
-
var TransportConfigZod = z17.discriminatedUnion("type", [
|
|
1558
|
-
LmdbTransportConfigZod,
|
|
1559
|
-
MongoTransportConfigZod,
|
|
1560
|
-
RpcTransportConfigZod,
|
|
1561
|
-
RestTransportConfigZod,
|
|
1562
|
-
S3TransportConfigZod,
|
|
1563
|
-
EvmRpcTransportConfigZod
|
|
1564
|
-
]);
|
|
1565
|
-
var TransportsConfigZod = z17.record(z17.string(), TransportConfigZod).default({});
|
|
1566
|
-
|
|
1567
1643
|
// src/config/Validation.ts
|
|
1568
1644
|
import { XyoAddressZod as XyoAddressZod2 } from "@xyo-network/sdk-js";
|
|
1569
1645
|
import { globalRegistry as globalRegistry13, z as z18 } from "zod";
|
|
@@ -1587,11 +1663,11 @@ function blockRangeSteps(range, steps) {
|
|
|
1587
1663
|
}
|
|
1588
1664
|
|
|
1589
1665
|
// src/primitives/block/rate/blockRate.ts
|
|
1590
|
-
import { isDefined as
|
|
1666
|
+
import { isDefined as isDefined8, isFalsy } from "@xylabs/sdk-js";
|
|
1591
1667
|
import { asXL1BlockRange } from "@xyo-network/xl1-protocol-lib";
|
|
1592
1668
|
|
|
1593
1669
|
// src/primitives/block/rate/timeHelpers.ts
|
|
1594
|
-
import { assertEx as assertEx8, isDefined as
|
|
1670
|
+
import { assertEx as assertEx8, isDefined as isDefined7 } from "@xylabs/sdk-js";
|
|
1595
1671
|
var rateMultipliers = {
|
|
1596
1672
|
millis: 1,
|
|
1597
1673
|
seconds: 1e3,
|
|
@@ -1609,7 +1685,7 @@ var timeDurations = (timeInMs) => ({
|
|
|
1609
1685
|
weeks: timeInMs / (1e3 * 60 * 60 * 24 * 7)
|
|
1610
1686
|
});
|
|
1611
1687
|
var getTimeConfigInMilliseconds = (timeConfig) => {
|
|
1612
|
-
const assertedTimeConfig = assertEx8(
|
|
1688
|
+
const assertedTimeConfig = assertEx8(isDefined7(timeConfig) ? timeConfig : void 0, () => "Time configuration must be provided");
|
|
1613
1689
|
let totalMilliseconds = 0;
|
|
1614
1690
|
if ("years" in assertedTimeConfig) {
|
|
1615
1691
|
totalMilliseconds += assertedTimeConfig.years * 31536e6;
|
|
@@ -1648,13 +1724,13 @@ var blockRate = (startBlock, endBlock, timeUnit) => {
|
|
|
1648
1724
|
throw new Error("Time difference must be greater than 0");
|
|
1649
1725
|
}
|
|
1650
1726
|
const rate = heightDifference / timeDifference;
|
|
1651
|
-
const timeUnitValue =
|
|
1652
|
-
const returnedTimeDifference =
|
|
1727
|
+
const timeUnitValue = isDefined8(timeUnit) ? timeUnit : "millis";
|
|
1728
|
+
const returnedTimeDifference = isDefined8(timeUnit) ? timeDurations(timeDifference)[timeUnit] : timeDifference;
|
|
1653
1729
|
const timePerBlock = returnedTimeDifference / heightDifference;
|
|
1654
1730
|
return {
|
|
1655
1731
|
range: asXL1BlockRange([startingBlock.block, endingBlock.block], true),
|
|
1656
1732
|
span: heightDifference,
|
|
1657
|
-
rate:
|
|
1733
|
+
rate: isDefined8(timeUnit) ? rate * rateMultipliers[timeUnit] : rate,
|
|
1658
1734
|
timeUnit: timeUnitValue,
|
|
1659
1735
|
timeDifference: returnedTimeDifference,
|
|
1660
1736
|
timePerBlock
|
|
@@ -1702,7 +1778,7 @@ var calculateStepSizeRate = async (viewer, start, stepIndex, count = 1, timeUnit
|
|
|
1702
1778
|
// src/primitives/block/rate/timeRate.ts
|
|
1703
1779
|
import {
|
|
1704
1780
|
assertEx as assertEx10,
|
|
1705
|
-
isDefined as
|
|
1781
|
+
isDefined as isDefined9,
|
|
1706
1782
|
isDefinedNotNull
|
|
1707
1783
|
} from "@xylabs/sdk-js";
|
|
1708
1784
|
import { asXL1BlockNumber as asXL1BlockNumber3, asXL1BlockRange as asXL1BlockRange3 } from "@xyo-network/xl1-protocol-lib";
|
|
@@ -1741,7 +1817,7 @@ var findEndBlockRecursive = async (viewer, startBlock, targetTimeMs, estimatedBl
|
|
|
1741
1817
|
}
|
|
1742
1818
|
const endBlock = await viewer.blockByNumber(estimatedEndBlockNumber);
|
|
1743
1819
|
const resolvedEndBlock = assertEx10(
|
|
1744
|
-
|
|
1820
|
+
isDefined9(endBlock?.[0]) ? endBlock[0] : void 0,
|
|
1745
1821
|
() => `Could not retrieve block ${estimatedEndBlockNumber} for time rate calculation`
|
|
1746
1822
|
);
|
|
1747
1823
|
const endBlockEpoch = resolvedEndBlock.$epoch;
|
|
@@ -1778,7 +1854,7 @@ var findEndBlockRecursive = async (viewer, startBlock, targetTimeMs, estimatedBl
|
|
|
1778
1854
|
// src/primitives/chain/getWindowedChain.ts
|
|
1779
1855
|
import {
|
|
1780
1856
|
assertEx as assertEx11,
|
|
1781
|
-
isDefined as
|
|
1857
|
+
isDefined as isDefined10,
|
|
1782
1858
|
isNull,
|
|
1783
1859
|
spanRootAsync
|
|
1784
1860
|
} from "@xylabs/sdk-js";
|
|
@@ -1792,7 +1868,7 @@ async function getWindowedChain(context, blockViewer, maxWindowSize, previousCha
|
|
|
1792
1868
|
while (currentBlock !== null && newChain.length < maxWindowSize) {
|
|
1793
1869
|
const currentBlockNumber = currentBlock[0].block;
|
|
1794
1870
|
const nextBlock = newChain[0];
|
|
1795
|
-
if (
|
|
1871
|
+
if (isDefined10(nextBlock)) {
|
|
1796
1872
|
const nextBlockNumber = nextBlock[0].block;
|
|
1797
1873
|
assertEx11(
|
|
1798
1874
|
currentBlockNumber === nextBlockNumber - 1,
|
|
@@ -1889,7 +1965,7 @@ async function chainStepRewardAddress(context, blockViewer, { block, step }) {
|
|
|
1889
1965
|
}
|
|
1890
1966
|
|
|
1891
1967
|
// src/primitives/chain/step/stepRewardTotal.ts
|
|
1892
|
-
import { assertEx as assertEx15, isDefined as
|
|
1968
|
+
import { assertEx as assertEx15, isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
1893
1969
|
import {
|
|
1894
1970
|
asAttoXL1,
|
|
1895
1971
|
asXL1BlockRange as asXL1BlockRange5,
|
|
@@ -1982,7 +2058,7 @@ function stepInRange(step, range) {
|
|
|
1982
2058
|
return stepRange[0] >= range[0] && stepRange[1] <= range[1];
|
|
1983
2059
|
}
|
|
1984
2060
|
async function stepRewardTotal(context, blockViewer, { block, step }, multipliers) {
|
|
1985
|
-
const cacheKey = `${block}|${step}|${
|
|
2061
|
+
const cacheKey = `${block}|${step}|${isDefined11(multipliers)}`;
|
|
1986
2062
|
return await withContextCacheResponse(context, "stepRewardTotal", cacheKey, async () => {
|
|
1987
2063
|
const [blockBw, payloads] = await stepRewardBlock(context, blockViewer, { block, step });
|
|
1988
2064
|
assertEx15(blockBw.block === block, () => `Block Mismatch: expected ${block}, got ${blockBw.block}`);
|
|
@@ -2073,7 +2149,7 @@ async function externalBlockRangeFromStep(context, blockViewer, stepIdentity) {
|
|
|
2073
2149
|
}
|
|
2074
2150
|
|
|
2075
2151
|
// src/primitives/mapToMapType.ts
|
|
2076
|
-
import { isDefined as
|
|
2152
|
+
import { isDefined as isDefined12 } from "@xylabs/sdk-js";
|
|
2077
2153
|
function mapToMapType(map) {
|
|
2078
2154
|
return {
|
|
2079
2155
|
get: (key) => map.get(key),
|
|
@@ -2092,7 +2168,7 @@ function mapToMapType(map) {
|
|
|
2092
2168
|
const result = [];
|
|
2093
2169
|
for (const key of keys) {
|
|
2094
2170
|
const value = map.get(key);
|
|
2095
|
-
if (
|
|
2171
|
+
if (isDefined12(value)) {
|
|
2096
2172
|
result.push(value);
|
|
2097
2173
|
}
|
|
2098
2174
|
}
|
|
@@ -2107,7 +2183,7 @@ function mapToMapType(map) {
|
|
|
2107
2183
|
}
|
|
2108
2184
|
|
|
2109
2185
|
// src/primitives/readPayloadMapFromStore.ts
|
|
2110
|
-
import { isDefined as
|
|
2186
|
+
import { isDefined as isDefined13 } from "@xylabs/sdk-js";
|
|
2111
2187
|
function readPayloadMapFromStore(store) {
|
|
2112
2188
|
if (isReadArchivist(store)) {
|
|
2113
2189
|
return {
|
|
@@ -2120,7 +2196,7 @@ function readPayloadMapFromStore(store) {
|
|
|
2120
2196
|
},
|
|
2121
2197
|
has: async (hash) => {
|
|
2122
2198
|
const results = await store.get([hash]);
|
|
2123
|
-
return
|
|
2199
|
+
return isDefined13(results[0]);
|
|
2124
2200
|
}
|
|
2125
2201
|
};
|
|
2126
2202
|
}
|
|
@@ -2138,7 +2214,7 @@ function payloadMapFromStore(store) {
|
|
|
2138
2214
|
},
|
|
2139
2215
|
has: async (hash) => {
|
|
2140
2216
|
const results = await store.get([hash]);
|
|
2141
|
-
return
|
|
2217
|
+
return isDefined13(results[0]);
|
|
2142
2218
|
},
|
|
2143
2219
|
clear: async () => {
|
|
2144
2220
|
return await store.clear();
|
|
@@ -2184,7 +2260,7 @@ function rewardFromBlockNumber(blockNumber) {
|
|
|
2184
2260
|
import { XYO_NETWORK_STAKING_ADDRESS } from "@xyo-network/xl1-protocol-lib";
|
|
2185
2261
|
|
|
2186
2262
|
// src/primitives/stake/activeStakeAtTimeByAddress.ts
|
|
2187
|
-
import { isDefined as
|
|
2263
|
+
import { isDefined as isDefined14 } from "@xylabs/sdk-js";
|
|
2188
2264
|
|
|
2189
2265
|
// src/primitives/stake/mergedAddRemoveStakeEventsByStaker.ts
|
|
2190
2266
|
async function mergedAddRemoveStakeEventsByStaker(chainEvents, range, staked, staker) {
|
|
@@ -2204,7 +2280,7 @@ async function activeStakeAtTimeByAddress(chain, staked, time, staker) {
|
|
|
2204
2280
|
for (const event of stakeEvents) {
|
|
2205
2281
|
if (event.time > time) break;
|
|
2206
2282
|
if (event.args.staked !== staked) continue;
|
|
2207
|
-
if (
|
|
2283
|
+
if (isDefined14(staker) && event.args.staker !== staker) continue;
|
|
2208
2284
|
if (event.name === "StakeAdded") {
|
|
2209
2285
|
result += event.args.amount;
|
|
2210
2286
|
} else if (event.name === "StakeRemoved") {
|
|
@@ -2278,20 +2354,20 @@ async function allStakersForStep(context, blockViewer, stakeEventsViewer, stepCo
|
|
|
2278
2354
|
}
|
|
2279
2355
|
|
|
2280
2356
|
// src/primitives/stake/weightedStakeForRangeByPosition.ts
|
|
2281
|
-
import { isDefined as
|
|
2357
|
+
import { isDefined as isDefined15 } from "@xylabs/sdk-js";
|
|
2282
2358
|
import { asBlockNumber as asBlockNumber2 } from "@xyo-network/xl1-protocol-lib";
|
|
2283
2359
|
async function weightedStakeForRangeByPosition(context, blockViewer, stakeEventsViewer, externalRange, staked, positionId) {
|
|
2284
|
-
const cacheKey =
|
|
2360
|
+
const cacheKey = isDefined15(positionId) ? `${externalRange[0]}-${externalRange[1]}-${positionId}` : `${externalRange[0]}-${externalRange[1]}-all`;
|
|
2285
2361
|
return await withContextCacheResponse(context, "weightedStakeForRangeByPosition", cacheKey, async () => {
|
|
2286
2362
|
let weightedStakeSum = 0n;
|
|
2287
|
-
if (
|
|
2363
|
+
if (isDefined15(positionId)) {
|
|
2288
2364
|
const mergedEventsResult = await mergedAddRemoveStakeEventsByPosition(
|
|
2289
2365
|
stakeEventsViewer,
|
|
2290
2366
|
[0, externalRange[1]],
|
|
2291
2367
|
positionId
|
|
2292
2368
|
);
|
|
2293
2369
|
const mergedEvents = mergedEventsResult.toSorted((a, b) => a.time - b.time);
|
|
2294
|
-
if (
|
|
2370
|
+
if (isDefined15(staked) && mergedEvents.at(0)?.args.staked !== staked) {
|
|
2295
2371
|
return 0n;
|
|
2296
2372
|
}
|
|
2297
2373
|
let currentTime = externalRange[0];
|
|
@@ -2515,10 +2591,11 @@ var BaseConfigZod = z19.object({
|
|
|
2515
2591
|
dataLake: z19.optional(DataLakeConfigZod).check(z19.describe("Configuration for data lakes")),
|
|
2516
2592
|
evm: z19._default(EvmConfigZod, EvmConfigZod.parse({})).check(z19.describe("Configuration for EVM-backed services")),
|
|
2517
2593
|
log: z19._default(LogConfigZod, LogConfigZod.parse({})).check(z19.describe("Configuration for logging")),
|
|
2518
|
-
|
|
2594
|
+
connections: z19._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z19.describe("Named connection profiles (rpc, rest, s3, lmdb, mongo, evm-rpc)")),
|
|
2595
|
+
providerBindings: z19._default(ProviderBindingsConfigZod, ProviderBindingsConfigZod.parse({})).check(z19.describe("Per-moniker provider connection bindings")),
|
|
2519
2596
|
providers: z19._default(ProvidersConfigZod, ProvidersConfigZod.parse([])).check(z19.describe("Configuration for providers")),
|
|
2520
2597
|
remote: z19._default(RemoteConfigZod, RemoteConfigZod.parse({})).check(z19.describe("Configuration for remote services")),
|
|
2521
|
-
transports: z19._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z19.describe("
|
|
2598
|
+
transports: z19._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z19.describe("Deprecated alias for connections (kept in sync during migration)")),
|
|
2522
2599
|
storage: z19._default(StorageConfigZod, StorageConfigZod.parse({})).check(z19.describe("Configuration for the storage")),
|
|
2523
2600
|
telemetry: z19._default(TelemetryConfigZod, TelemetryConfigZod.parse({})).check(z19.describe("Configuration for telemetry")),
|
|
2524
2601
|
validation: z19._default(ValidationConfigZod, ValidationConfigZod.parse({})).check(z19.describe("Configuration for validation"))
|
|
@@ -2549,7 +2626,7 @@ var ActorsConfigZod = z21._default(
|
|
|
2549
2626
|
);
|
|
2550
2627
|
|
|
2551
2628
|
// src/config/adaptLegacyConfig.ts
|
|
2552
|
-
import { isDefined as
|
|
2629
|
+
import { isDefined as isDefined16 } from "@xylabs/sdk-js";
|
|
2553
2630
|
|
|
2554
2631
|
// src/config/Config.ts
|
|
2555
2632
|
import { globalRegistry as globalRegistry15, z as z22 } from "zod/mini";
|
|
@@ -2574,6 +2651,44 @@ function resolveConfig(config) {
|
|
|
2574
2651
|
return parsedConfig;
|
|
2575
2652
|
}
|
|
2576
2653
|
|
|
2654
|
+
// src/config/normalizeConnectionsConfig.ts
|
|
2655
|
+
function mergeConnectionMaps(transports, connections) {
|
|
2656
|
+
return { ...transports, ...connections };
|
|
2657
|
+
}
|
|
2658
|
+
function normalizeProviderBinding(binding) {
|
|
2659
|
+
const connectionName = binding.connection ?? binding.transport;
|
|
2660
|
+
if (connectionName === void 0 || connectionName === "") {
|
|
2661
|
+
return binding;
|
|
2662
|
+
}
|
|
2663
|
+
return {
|
|
2664
|
+
...binding,
|
|
2665
|
+
connection: connectionName,
|
|
2666
|
+
transport: connectionName
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
function normalizeProviderBindings(bindings) {
|
|
2670
|
+
const normalized = {};
|
|
2671
|
+
for (const [moniker, binding] of Object.entries(bindings)) {
|
|
2672
|
+
if (binding === void 0) continue;
|
|
2673
|
+
normalized[moniker] = normalizeProviderBinding(binding);
|
|
2674
|
+
}
|
|
2675
|
+
return normalized;
|
|
2676
|
+
}
|
|
2677
|
+
function normalizeConnectionsConfig(config) {
|
|
2678
|
+
const transports = config.transports ?? {};
|
|
2679
|
+
const connections = config.connections ?? {};
|
|
2680
|
+
const merged = mergeConnectionMaps(transports, connections);
|
|
2681
|
+
return {
|
|
2682
|
+
...config,
|
|
2683
|
+
connections: merged,
|
|
2684
|
+
providerBindings: normalizeProviderBindings(config.providerBindings ?? {}),
|
|
2685
|
+
transports: merged
|
|
2686
|
+
};
|
|
2687
|
+
}
|
|
2688
|
+
function hasDeclaredConnectionProfiles(config) {
|
|
2689
|
+
return Object.keys(config.transports ?? {}).length > 0 || Object.keys(config.connections ?? {}).length > 0;
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2577
2692
|
// src/config/adaptLegacyConfig.ts
|
|
2578
2693
|
var DEFAULT_LMDB_TRANSPORT = "local-store";
|
|
2579
2694
|
var DEFAULT_RPC_TRANSPORT = "default-rpc";
|
|
@@ -2597,7 +2712,7 @@ function rpcTransportFromRemote(rpc) {
|
|
|
2597
2712
|
};
|
|
2598
2713
|
}
|
|
2599
2714
|
function s3TransportFromBucket(shared, entry, fallbackBucket) {
|
|
2600
|
-
if (!
|
|
2715
|
+
if (!isDefined16(entry?.bucket) && !isDefined16(entry?.readUrl)) {
|
|
2601
2716
|
return void 0;
|
|
2602
2717
|
}
|
|
2603
2718
|
return {
|
|
@@ -2636,34 +2751,79 @@ function synthesizeS3Transports(s3) {
|
|
|
2636
2751
|
function hasTransport(transports, key) {
|
|
2637
2752
|
return Object.hasOwn(transports, key) && transports[key] !== void 0;
|
|
2638
2753
|
}
|
|
2754
|
+
function bindMoniker2(bindings, moniker, connectionName) {
|
|
2755
|
+
bindings[moniker] = { connection: connectionName, transport: connectionName };
|
|
2756
|
+
}
|
|
2757
|
+
var LMDB_MONIKERS = [
|
|
2758
|
+
"AccountBalanceViewer",
|
|
2759
|
+
"BlockRewardViewer",
|
|
2760
|
+
"BlockRunner",
|
|
2761
|
+
"BlockValidationViewer",
|
|
2762
|
+
"BlockViewer",
|
|
2763
|
+
"ChainContractViewer",
|
|
2764
|
+
"DeadLetterQueueRunner",
|
|
2765
|
+
"DeadLetterQueueViewer",
|
|
2766
|
+
"FinalizationRunner",
|
|
2767
|
+
"FinalizationViewer",
|
|
2768
|
+
"MempoolRunner",
|
|
2769
|
+
"MempoolViewer",
|
|
2770
|
+
"StakeEventsViewer",
|
|
2771
|
+
"StakeTotalsViewer",
|
|
2772
|
+
"StakeViewer",
|
|
2773
|
+
"TimeSyncViewer",
|
|
2774
|
+
"TransactionValidationViewer",
|
|
2775
|
+
"TransactionViewer",
|
|
2776
|
+
"WindowedBlockViewer",
|
|
2777
|
+
"XyoConnection",
|
|
2778
|
+
"XyoGateway",
|
|
2779
|
+
"XyoRunner",
|
|
2780
|
+
"XyoViewer"
|
|
2781
|
+
];
|
|
2782
|
+
function synthesizeLmdbProviderBindings(transports) {
|
|
2783
|
+
const bindings = {};
|
|
2784
|
+
if (!hasTransport(transports, DEFAULT_LMDB_TRANSPORT)) {
|
|
2785
|
+
return bindings;
|
|
2786
|
+
}
|
|
2787
|
+
for (const moniker of LMDB_MONIKERS) {
|
|
2788
|
+
bindMoniker2(bindings, moniker, DEFAULT_LMDB_TRANSPORT);
|
|
2789
|
+
}
|
|
2790
|
+
return bindings;
|
|
2791
|
+
}
|
|
2639
2792
|
function synthesizeProviderBindings(transports) {
|
|
2640
2793
|
const bindings = {};
|
|
2641
2794
|
if (hasTransport(transports, DEFAULT_RPC_TRANSPORT)) {
|
|
2642
|
-
bindings
|
|
2643
|
-
bindings
|
|
2644
|
-
bindings
|
|
2645
|
-
bindings
|
|
2646
|
-
bindings
|
|
2795
|
+
bindMoniker2(bindings, "BlockViewer", DEFAULT_RPC_TRANSPORT);
|
|
2796
|
+
bindMoniker2(bindings, "MempoolViewer", DEFAULT_RPC_TRANSPORT);
|
|
2797
|
+
bindMoniker2(bindings, "FinalizationViewer", DEFAULT_RPC_TRANSPORT);
|
|
2798
|
+
bindMoniker2(bindings, "TransactionViewer", DEFAULT_RPC_TRANSPORT);
|
|
2799
|
+
bindMoniker2(bindings, "AccountBalanceViewer", DEFAULT_RPC_TRANSPORT);
|
|
2647
2800
|
}
|
|
2648
2801
|
if (hasTransport(transports, S3_FINALIZED_TRANSPORT)) {
|
|
2649
|
-
bindings
|
|
2802
|
+
bindMoniker2(bindings, "BlockPublishRunner", S3_FINALIZED_TRANSPORT);
|
|
2650
2803
|
}
|
|
2651
2804
|
if (hasTransport(transports, S3_CHAIN_STATE_TRANSPORT)) {
|
|
2652
|
-
bindings
|
|
2653
|
-
bindings
|
|
2805
|
+
bindMoniker2(bindings, "ChainStateViewer", S3_CHAIN_STATE_TRANSPORT);
|
|
2806
|
+
bindMoniker2(bindings, "ChainStatePublishRunner", S3_CHAIN_STATE_TRANSPORT);
|
|
2654
2807
|
}
|
|
2655
2808
|
if (hasTransport(transports, S3_INDEX_TRANSPORT)) {
|
|
2656
|
-
bindings
|
|
2809
|
+
bindMoniker2(bindings, "IndexPublishRunner", S3_INDEX_TRANSPORT);
|
|
2810
|
+
}
|
|
2811
|
+
if (hasTransport(transports, DEFAULT_EVM_RPC_TRANSPORT)) {
|
|
2812
|
+
bindMoniker2(bindings, "ChainContractViewer", DEFAULT_EVM_RPC_TRANSPORT);
|
|
2813
|
+
bindMoniker2(bindings, "StakeEventsViewer", DEFAULT_EVM_RPC_TRANSPORT);
|
|
2814
|
+
bindMoniker2(bindings, "StakeTotalsViewer", DEFAULT_EVM_RPC_TRANSPORT);
|
|
2815
|
+
bindMoniker2(bindings, "StakeViewer", DEFAULT_EVM_RPC_TRANSPORT);
|
|
2816
|
+
bindMoniker2(bindings, "TimeSyncViewer", DEFAULT_EVM_RPC_TRANSPORT);
|
|
2657
2817
|
}
|
|
2658
2818
|
return bindings;
|
|
2659
2819
|
}
|
|
2660
2820
|
function adaptLegacyConfig(config) {
|
|
2661
2821
|
const parsed = ConfigZod.parse(config);
|
|
2662
|
-
if (
|
|
2663
|
-
return parsed;
|
|
2822
|
+
if (hasDeclaredConnectionProfiles(parsed)) {
|
|
2823
|
+
return ConfigZod.parse(normalizeConnectionsConfig(parsed));
|
|
2664
2824
|
}
|
|
2665
|
-
const transports = { ...parsed.transports };
|
|
2666
|
-
if (
|
|
2825
|
+
const transports = { ...parsed.transports, ...parsed.connections };
|
|
2826
|
+
if (isDefined16(parsed.storage?.root) && parsed.storage.root !== "") {
|
|
2667
2827
|
transports[DEFAULT_LMDB_TRANSPORT] = { type: "lmdb", root: parsed.storage.root };
|
|
2668
2828
|
}
|
|
2669
2829
|
if (hasMongoConfig(parsed.storage?.mongo)) {
|
|
@@ -2676,24 +2836,26 @@ function adaptLegacyConfig(config) {
|
|
|
2676
2836
|
username: parsed.storage.mongo.username
|
|
2677
2837
|
};
|
|
2678
2838
|
}
|
|
2679
|
-
if (
|
|
2839
|
+
if (isDefined16(parsed.remote?.rpc)) {
|
|
2680
2840
|
transports[DEFAULT_RPC_TRANSPORT] = rpcTransportFromRemote(parsed.remote.rpc);
|
|
2681
2841
|
}
|
|
2682
|
-
if (
|
|
2842
|
+
if (isDefined16(parsed.evm?.jsonRpc?.url)) {
|
|
2683
2843
|
transports[DEFAULT_EVM_RPC_TRANSPORT] = { type: "evm-rpc", url: parsed.evm.jsonRpc.url };
|
|
2684
2844
|
}
|
|
2685
|
-
if (
|
|
2845
|
+
if (isDefined16(parsed.storage?.s3)) {
|
|
2686
2846
|
Object.assign(transports, synthesizeS3Transports(parsed.storage.s3));
|
|
2687
2847
|
}
|
|
2688
2848
|
const providerBindings = {
|
|
2849
|
+
...synthesizeLmdbProviderBindings(transports),
|
|
2689
2850
|
...synthesizeProviderBindings(transports),
|
|
2690
2851
|
...parsed.providerBindings
|
|
2691
2852
|
};
|
|
2692
|
-
return ConfigZod.parse({
|
|
2853
|
+
return ConfigZod.parse(normalizeConnectionsConfig({
|
|
2693
2854
|
...parsed,
|
|
2855
|
+
connections: transports,
|
|
2694
2856
|
providerBindings,
|
|
2695
2857
|
transports
|
|
2696
|
-
});
|
|
2858
|
+
}));
|
|
2697
2859
|
}
|
|
2698
2860
|
|
|
2699
2861
|
// src/config/HostActor.ts
|
|
@@ -2898,7 +3060,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
2898
3060
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
2899
3061
|
import {
|
|
2900
3062
|
delay,
|
|
2901
|
-
isDefined as
|
|
3063
|
+
isDefined as isDefined17,
|
|
2902
3064
|
isNumber
|
|
2903
3065
|
} from "@xylabs/sdk-js";
|
|
2904
3066
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
@@ -2920,7 +3082,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
|
|
|
2920
3082
|
let attempts = 0;
|
|
2921
3083
|
while (true) {
|
|
2922
3084
|
const tx = await viewer.transaction.byHash(txHash) ?? void 0;
|
|
2923
|
-
if (
|
|
3085
|
+
if (isDefined17(tx)) {
|
|
2924
3086
|
options?.logger?.debug("Transaction confirmed", txHash);
|
|
2925
3087
|
return tx;
|
|
2926
3088
|
}
|
|
@@ -3637,13 +3799,13 @@ var asHostActorConfigContext = zodAsFactory7(HostActorConfigContext, "asHostActo
|
|
|
3637
3799
|
var toHostActorConfigContext = zodToFactory6(HostActorConfigContext, "toHostActorConfigContext");
|
|
3638
3800
|
|
|
3639
3801
|
// src/createDeclarationPayload.ts
|
|
3640
|
-
import { isDefined as
|
|
3802
|
+
import { isDefined as isDefined18 } from "@xylabs/sdk-js";
|
|
3641
3803
|
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/sdk-js";
|
|
3642
3804
|
import {
|
|
3643
3805
|
ChainStakeIntentSchema
|
|
3644
3806
|
} from "@xyo-network/xl1-protocol-lib";
|
|
3645
3807
|
var createDeclarationIntent = (address, intent, nbf, exp) => {
|
|
3646
|
-
const expiration =
|
|
3808
|
+
const expiration = isDefined18(exp) ? exp : nbf + 1e4;
|
|
3647
3809
|
const payloadBuilder = new PayloadBuilder13({ schema: ChainStakeIntentSchema });
|
|
3648
3810
|
const builder = payloadBuilder.fields({
|
|
3649
3811
|
from: address,
|
|
@@ -3827,7 +3989,7 @@ import {
|
|
|
3827
3989
|
asHash as asHash4,
|
|
3828
3990
|
assertEx as assertEx33,
|
|
3829
3991
|
exists as exists3,
|
|
3830
|
-
isDefined as
|
|
3992
|
+
isDefined as isDefined19,
|
|
3831
3993
|
ZERO_ADDRESS
|
|
3832
3994
|
} from "@xylabs/sdk-js";
|
|
3833
3995
|
import {
|
|
@@ -4326,7 +4488,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4326
4488
|
block[1].find((p) => p._hash === hash),
|
|
4327
4489
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4328
4490
|
);
|
|
4329
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4491
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined19(t.transfers[address]));
|
|
4330
4492
|
if (transfers.length === 0) {
|
|
4331
4493
|
continue;
|
|
4332
4494
|
}
|
|
@@ -4445,7 +4607,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4445
4607
|
return await this.spanAsync("qualifiedAccountBalanceHistory", async () => {
|
|
4446
4608
|
const range = asRange(headOrRange);
|
|
4447
4609
|
const headHash = asHash4(headOrRange);
|
|
4448
|
-
const [head] = assertEx33(
|
|
4610
|
+
const [head] = assertEx33(isDefined19(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
|
|
4449
4611
|
const startingRange = asXL1BlockRange10(range ?? [0, head.block], true);
|
|
4450
4612
|
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
4451
4613
|
const blockResults = await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)));
|
|
@@ -4459,7 +4621,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4459
4621
|
block[1].find((p) => p._hash === hash),
|
|
4460
4622
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4461
4623
|
);
|
|
4462
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4624
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined19(t.transfers[address]));
|
|
4463
4625
|
if (transfers.length === 0) {
|
|
4464
4626
|
continue;
|
|
4465
4627
|
}
|
|
@@ -5341,7 +5503,7 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
|
|
|
5341
5503
|
import {
|
|
5342
5504
|
assertEx as assertEx39,
|
|
5343
5505
|
BigIntToJsonZod,
|
|
5344
|
-
isDefined as
|
|
5506
|
+
isDefined as isDefined20
|
|
5345
5507
|
} from "@xylabs/sdk-js";
|
|
5346
5508
|
import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/sdk-js";
|
|
5347
5509
|
import {
|
|
@@ -5379,9 +5541,9 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
5379
5541
|
chain,
|
|
5380
5542
|
fees
|
|
5381
5543
|
} = options ?? {};
|
|
5382
|
-
const resolvedChainId =
|
|
5383
|
-
const resolvedNbf = asXL1BlockNumber10(
|
|
5384
|
-
const resolvedExp = asXL1BlockNumber10(
|
|
5544
|
+
const resolvedChainId = isDefined20(chain) ? chain : await viewer.chainId();
|
|
5545
|
+
const resolvedNbf = asXL1BlockNumber10(isDefined20(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
5546
|
+
const resolvedExp = asXL1BlockNumber10(isDefined20(exp) ? exp : resolvedNbf + 10, true);
|
|
5385
5547
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
5386
5548
|
return await this.addTransactionToChain(tx, await PayloadBuilder20.addHashMeta(offChain));
|
|
5387
5549
|
}
|
|
@@ -5873,7 +6035,7 @@ SimpleMempoolRunner = __decorateClass([
|
|
|
5873
6035
|
// src/simple/mempool/SimpleMempoolViewer.ts
|
|
5874
6036
|
import {
|
|
5875
6037
|
exists as exists9,
|
|
5876
|
-
isDefined as
|
|
6038
|
+
isDefined as isDefined21,
|
|
5877
6039
|
isHash as isHash2
|
|
5878
6040
|
} from "@xylabs/sdk-js";
|
|
5879
6041
|
import { isHashMeta as isHashMeta2, isPayloadBundle as isPayloadBundle2 } from "@xyo-network/sdk-js";
|
|
@@ -5934,7 +6096,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
5934
6096
|
let cursor = void 0;
|
|
5935
6097
|
if (isHash2(providedCursor)) {
|
|
5936
6098
|
const [p] = await this.pendingBlocksArchivist.get([providedCursor]);
|
|
5937
|
-
if (
|
|
6099
|
+
if (isDefined21(p)) {
|
|
5938
6100
|
cursor = p._sequence;
|
|
5939
6101
|
}
|
|
5940
6102
|
}
|
|
@@ -5954,7 +6116,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
5954
6116
|
let cursor = void 0;
|
|
5955
6117
|
if (isHash2(providedCursor)) {
|
|
5956
6118
|
const [p] = await this.pendingTransactionsArchivist.get([providedCursor]);
|
|
5957
|
-
if (
|
|
6119
|
+
if (isDefined21(p)) {
|
|
5958
6120
|
cursor = p._sequence;
|
|
5959
6121
|
}
|
|
5960
6122
|
}
|
|
@@ -6027,7 +6189,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
6027
6189
|
const hydratedResults = await Promise.all(
|
|
6028
6190
|
filteredBundles.map(async (bundle3) => {
|
|
6029
6191
|
const tx = await bundledPayloadToHydratedTransaction(bundle3);
|
|
6030
|
-
return
|
|
6192
|
+
return isDefined21(tx) ? { bundle: bundle3, tx } : void 0;
|
|
6031
6193
|
})
|
|
6032
6194
|
);
|
|
6033
6195
|
return hydratedResults.filter(exists9);
|
|
@@ -6327,7 +6489,7 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
|
6327
6489
|
};
|
|
6328
6490
|
|
|
6329
6491
|
// src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts
|
|
6330
|
-
import { isDefined as
|
|
6492
|
+
import { isDefined as isDefined22 } from "@xylabs/sdk-js";
|
|
6331
6493
|
import { StakeEventsViewerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
6332
6494
|
var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
6333
6495
|
moniker = SimpleStakeEventsViewer.defaultMoniker;
|
|
@@ -6340,7 +6502,7 @@ var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
|
6340
6502
|
stakeEvents(range, { name } = {}) {
|
|
6341
6503
|
const positions = this.positionsFromRange(range);
|
|
6342
6504
|
const events = this.eventsFromPositions(positions);
|
|
6343
|
-
if (
|
|
6505
|
+
if (isDefined22(name)) {
|
|
6344
6506
|
return events.filter((event) => event.name === name);
|
|
6345
6507
|
}
|
|
6346
6508
|
return events;
|
|
@@ -6688,7 +6850,7 @@ RestSyncViewer = __decorateClass([
|
|
|
6688
6850
|
import {
|
|
6689
6851
|
asHash as asHash5,
|
|
6690
6852
|
assertEx as assertEx45,
|
|
6691
|
-
isDefined as
|
|
6853
|
+
isDefined as isDefined23
|
|
6692
6854
|
} from "@xylabs/sdk-js";
|
|
6693
6855
|
import {
|
|
6694
6856
|
asTimePayload as asTimePayload2,
|
|
@@ -6712,7 +6874,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6712
6874
|
const [block, payloads] = assertEx45(await this.blockViewer.blockByNumber(asXL1BlockNumber11(from, true)), () => "Block not found");
|
|
6713
6875
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
6714
6876
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
6715
|
-
const timePayload = asTimePayload2(
|
|
6877
|
+
const timePayload = asTimePayload2(isDefined23(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
6716
6878
|
if (timePayload === void 0) return 0;
|
|
6717
6879
|
switch (toDomain) {
|
|
6718
6880
|
case "xl1": {
|
|
@@ -6786,7 +6948,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6786
6948
|
xl1Hash: assertEx45(xl1Hash, () => "No xl1 hash available from time sync service"),
|
|
6787
6949
|
epoch: Date.now()
|
|
6788
6950
|
};
|
|
6789
|
-
if (
|
|
6951
|
+
if (isDefined23(this.ethProvider)) {
|
|
6790
6952
|
const [ethereum, ethHashOrNull] = await this.currentTimeAndHash("ethereum");
|
|
6791
6953
|
const ethereumHash = asHash5(ethHashOrNull, () => "No ethereum hash available from time sync service");
|
|
6792
6954
|
timePayload.ethereum = ethereum;
|
|
@@ -7283,7 +7445,7 @@ import {
|
|
|
7283
7445
|
} from "@xyo-network/xl1-protocol-lib";
|
|
7284
7446
|
|
|
7285
7447
|
// src/test/buildBlock.ts
|
|
7286
|
-
import { assertEx as assertEx49, isDefined as
|
|
7448
|
+
import { assertEx as assertEx49, isDefined as isDefined24 } from "@xylabs/sdk-js";
|
|
7287
7449
|
import {
|
|
7288
7450
|
asAnyPayload as asAnyPayload5,
|
|
7289
7451
|
BoundWitnessBuilder as BoundWitnessBuilder3,
|
|
@@ -7367,7 +7529,7 @@ function buildStepHashes(blockNumber, inStepHashes, previousBlockHash, chainStep
|
|
|
7367
7529
|
completedStepRewardTransfers.push(createTransferPayload(chainStepRewardAddress2, { [completedStepRewardHolderAddress]: completedStepReward }));
|
|
7368
7530
|
}
|
|
7369
7531
|
step_hashes.push(assertEx49(previousBlockHash, () => `Previous block hash is required for step ${step} at block ${blockNumber}`));
|
|
7370
|
-
} else if (
|
|
7532
|
+
} else if (isDefined24(inStepHashes.at(i))) {
|
|
7371
7533
|
step_hashes.push(inStepHashes[i]);
|
|
7372
7534
|
}
|
|
7373
7535
|
}
|
|
@@ -7703,6 +7865,7 @@ export {
|
|
|
7703
7865
|
ActorConfigZod,
|
|
7704
7866
|
ActorsConfigZod,
|
|
7705
7867
|
AddressPairSchema,
|
|
7868
|
+
AmbiguousProviderError,
|
|
7706
7869
|
BalancesStepSummarySchema,
|
|
7707
7870
|
BaseConfigContextZod,
|
|
7708
7871
|
BaseConfigZod,
|
|
@@ -7712,6 +7875,8 @@ export {
|
|
|
7712
7875
|
COIN_TYPES,
|
|
7713
7876
|
ChainIndexingServiceStateSchema,
|
|
7714
7877
|
ConfigZod,
|
|
7878
|
+
TransportConfigZod as ConnectionConfigZod,
|
|
7879
|
+
TransportsConfigZod as ConnectionsConfigZod,
|
|
7715
7880
|
CreatableProviderContextZod,
|
|
7716
7881
|
DEFAULT_BACKOFF_MS,
|
|
7717
7882
|
DEFAULT_MAX_ATTEMPTS,
|
|
@@ -7725,6 +7890,7 @@ export {
|
|
|
7725
7890
|
EIP712DataPayloadSchema,
|
|
7726
7891
|
EIP712SignaturePayloadFieldsZod,
|
|
7727
7892
|
EIP712SignaturePayloadSchema,
|
|
7893
|
+
EvmRpcTransportConfigZod as EvmConnectionConfigZod,
|
|
7728
7894
|
EvmRpcTransportConfigZod,
|
|
7729
7895
|
GlobalMetaSchema,
|
|
7730
7896
|
HostActorConfigContext,
|
|
@@ -7733,11 +7899,13 @@ export {
|
|
|
7733
7899
|
HydratedBoundWitnessWithStorageMetaZod,
|
|
7734
7900
|
HydratedCache,
|
|
7735
7901
|
JSONSchemaMetaSchema,
|
|
7902
|
+
LmdbTransportConfigZod as LmdbConnectionConfigZod,
|
|
7736
7903
|
LmdbTransportConfigZod,
|
|
7737
7904
|
LoggerStatusReporter,
|
|
7738
7905
|
MemoryPermissionsStore,
|
|
7739
7906
|
MissingCapabilityError,
|
|
7740
7907
|
MnemonicStringZod,
|
|
7908
|
+
MongoTransportConfigZod as MongoConnectionConfigZod,
|
|
7741
7909
|
MongoTransportConfigZod,
|
|
7742
7910
|
PRODUCER_DIVERSITY_BONUS,
|
|
7743
7911
|
PayloadLocator,
|
|
@@ -7750,6 +7918,7 @@ export {
|
|
|
7750
7918
|
ProviderFactoryLocatorZod,
|
|
7751
7919
|
ProvidersConfigZod,
|
|
7752
7920
|
RemoteConfigZod,
|
|
7921
|
+
RestTransportConfigZod as RestConnectionConfigZod,
|
|
7753
7922
|
RestDataLakeConfigZod,
|
|
7754
7923
|
RestDataLakeRunner,
|
|
7755
7924
|
RestDataLakeViewer,
|
|
@@ -7757,11 +7926,13 @@ export {
|
|
|
7757
7926
|
RestTransportConfigZod,
|
|
7758
7927
|
RewardMultipliers,
|
|
7759
7928
|
RouterDataLakeConfigZod,
|
|
7929
|
+
RpcTransportConfigZod as RpcConnectionConfigZod,
|
|
7760
7930
|
RpcRemoteConfigBaseZod,
|
|
7761
7931
|
RpcRemoteConfigZod,
|
|
7762
7932
|
RpcTransportConfigZod,
|
|
7763
7933
|
RuntimeStatusMonitor,
|
|
7764
7934
|
RuntimeStatusMonitorZod,
|
|
7935
|
+
S3TransportConfigZod as S3ConnectionConfigZod,
|
|
7765
7936
|
S3TransportConfigZod,
|
|
7766
7937
|
SchemasStepSummarySchema,
|
|
7767
7938
|
ShiftedBigInt,
|
|
@@ -7800,6 +7971,8 @@ export {
|
|
|
7800
7971
|
TypedDataFieldZod,
|
|
7801
7972
|
TypedDataTypesZod,
|
|
7802
7973
|
TypedDataValueZod,
|
|
7974
|
+
UnboundProviderError,
|
|
7975
|
+
UnknownConnectionError,
|
|
7803
7976
|
UsageMetaSchema,
|
|
7804
7977
|
VIEWER_BRANCH_KEYS,
|
|
7805
7978
|
WALLET_COMPLIANCE,
|
|
@@ -7875,6 +8048,8 @@ export {
|
|
|
7875
8048
|
createTransactionHydrator,
|
|
7876
8049
|
createTransferPayload,
|
|
7877
8050
|
deepCalculateFramesFromRange,
|
|
8051
|
+
descriptorConnectionTypes,
|
|
8052
|
+
descriptorMatchesConnectionType,
|
|
7878
8053
|
externalBlockNumberFromXL1BlockNumber,
|
|
7879
8054
|
externalBlockRangeFromStep,
|
|
7880
8055
|
externalBlockRangeFromXL1BlockRange,
|
|
@@ -7896,6 +8071,7 @@ export {
|
|
|
7896
8071
|
getTimeConfigInMilliseconds,
|
|
7897
8072
|
getUrl,
|
|
7898
8073
|
getWindowedChain,
|
|
8074
|
+
hasDeclaredConnectionProfiles,
|
|
7899
8075
|
hasLabels,
|
|
7900
8076
|
hasMongoConfig,
|
|
7901
8077
|
hasS3Config,
|
|
@@ -7942,6 +8118,7 @@ export {
|
|
|
7942
8118
|
netTransfersForPayloads,
|
|
7943
8119
|
networkBackedFactory,
|
|
7944
8120
|
networkStakeStepRewardPositionWeight,
|
|
8121
|
+
normalizeConnectionsConfig,
|
|
7945
8122
|
parseSignedBigInt,
|
|
7946
8123
|
payloadMapFromStore,
|
|
7947
8124
|
prettifyZodError,
|