@xyo-network/xl1-network-model 2.1.9 → 2.2.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/index.d.ts +1 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +213 -1
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/staticRest/index.d.ts +10 -0
- package/dist/neutral/staticRest/index.d.ts.map +1 -0
- package/dist/neutral/staticRest/layout/chainManifest.d.ts +101 -0
- package/dist/neutral/staticRest/layout/chainManifest.d.ts.map +1 -0
- package/dist/neutral/staticRest/layout/index.d.ts +3 -0
- package/dist/neutral/staticRest/layout/index.d.ts.map +1 -0
- package/dist/neutral/staticRest/layout/indexManifest.d.ts +263 -0
- package/dist/neutral/staticRest/layout/indexManifest.d.ts.map +1 -0
- package/dist/neutral/staticRest/paths/chainState.d.ts +8 -0
- package/dist/neutral/staticRest/paths/chainState.d.ts.map +1 -0
- package/dist/neutral/staticRest/paths/finalized.d.ts +14 -0
- package/dist/neutral/staticRest/paths/finalized.d.ts.map +1 -0
- package/dist/neutral/staticRest/paths/index.d.ts +4 -0
- package/dist/neutral/staticRest/paths/index.d.ts.map +1 -0
- package/dist/neutral/staticRest/paths/indexPaths.d.ts +14 -0
- package/dist/neutral/staticRest/paths/indexPaths.d.ts.map +1 -0
- package/dist/neutral/staticRest/templates.d.ts +27 -0
- package/dist/neutral/staticRest/templates.d.ts.map +1 -0
- package/package.json +2 -4
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -106,6 +106,179 @@ var initNetworkNode = async (activeNetwork, wallet) => {
|
|
|
106
106
|
return activeNetworkNode;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
// src/staticRest/layout/chainManifest.ts
|
|
110
|
+
import {
|
|
111
|
+
zodAsFactory,
|
|
112
|
+
zodIsFactory,
|
|
113
|
+
zodToFactory
|
|
114
|
+
} from "@xylabs/sdk-js";
|
|
115
|
+
import { z } from "zod";
|
|
116
|
+
|
|
117
|
+
// src/staticRest/paths/chainState.ts
|
|
118
|
+
var headPath = () => "chain/head.json";
|
|
119
|
+
|
|
120
|
+
// src/staticRest/paths/finalized.ts
|
|
121
|
+
var manifestPath = () => "manifest.json";
|
|
122
|
+
var blockNumberPath = (block) => `block/number/${block}.json`;
|
|
123
|
+
var blockHashPath = (hash) => `block/hash/${hash}.json`;
|
|
124
|
+
var payloadPath = (hash) => `payload/${hash}.json`;
|
|
125
|
+
|
|
126
|
+
// src/staticRest/paths/indexPaths.ts
|
|
127
|
+
var indexSummaryPath = (family, stepLevel, stepIndex) => `${family}/${stepLevel}/${stepIndex}.json`;
|
|
128
|
+
var indexManifestPath = () => "manifest.json";
|
|
129
|
+
var indexHeadPath = () => "head.json";
|
|
130
|
+
|
|
131
|
+
// src/staticRest/templates.ts
|
|
132
|
+
var TEMPLATE_SLOTS = {
|
|
133
|
+
block: 0,
|
|
134
|
+
hash: "0".repeat(64),
|
|
135
|
+
index: 99,
|
|
136
|
+
level: 42
|
|
137
|
+
};
|
|
138
|
+
function toPathTemplate(path, slots) {
|
|
139
|
+
let result = path;
|
|
140
|
+
for (const { literal, name } of slots) {
|
|
141
|
+
if (!result.includes(literal)) {
|
|
142
|
+
throw new Error(`Template slot "${literal}" not found in path "${path}"`);
|
|
143
|
+
}
|
|
144
|
+
result = result.replace(literal, `{${name}}`);
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
function interpolatePathTemplate(template, values) {
|
|
149
|
+
let result = template;
|
|
150
|
+
for (const [key, value] of Object.entries(values)) {
|
|
151
|
+
result = result.replaceAll(`{${key}}`, String(value));
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
var blockNumberPathTemplate = () => toPathTemplate(blockNumberPath(TEMPLATE_SLOTS.block), [{ literal: String(TEMPLATE_SLOTS.block), name: "block" }]);
|
|
156
|
+
var blockHashPathTemplate = () => toPathTemplate(blockHashPath(TEMPLATE_SLOTS.hash), [{ literal: TEMPLATE_SLOTS.hash, name: "hash" }]);
|
|
157
|
+
var payloadPathTemplate = () => toPathTemplate(payloadPath(TEMPLATE_SLOTS.hash), [{ literal: TEMPLATE_SLOTS.hash, name: "hash" }]);
|
|
158
|
+
function chainManifestPathTemplates() {
|
|
159
|
+
return {
|
|
160
|
+
blockByHash: blockHashPathTemplate(),
|
|
161
|
+
blockByNumber: blockNumberPathTemplate(),
|
|
162
|
+
head: headPath(),
|
|
163
|
+
payload: payloadPathTemplate()
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function indexSummaryPathTemplate(family) {
|
|
167
|
+
const path = indexSummaryPath(family, TEMPLATE_SLOTS.level, TEMPLATE_SLOTS.index);
|
|
168
|
+
return toPathTemplate(path, [
|
|
169
|
+
{ literal: String(TEMPLATE_SLOTS.level), name: "level" },
|
|
170
|
+
{ literal: String(TEMPLATE_SLOTS.index), name: "index" }
|
|
171
|
+
]);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/staticRest/layout/chainManifest.ts
|
|
175
|
+
var CHAIN_LAYOUT_VERSION = 1;
|
|
176
|
+
var ChainManifestSchema = "network.xyo.s3.chain.manifest";
|
|
177
|
+
var ChainManifestPathsZod = z.object({
|
|
178
|
+
blockByHash: z.string(),
|
|
179
|
+
blockByNumber: z.string(),
|
|
180
|
+
head: z.string(),
|
|
181
|
+
payload: z.string()
|
|
182
|
+
});
|
|
183
|
+
var ChainManifestZod = z.object({
|
|
184
|
+
/** Lowest block number available in the bucket (genesis until pruning exists). */
|
|
185
|
+
earliestBlock: z.int().nonnegative(),
|
|
186
|
+
/** Storage/wire encoding of the published files (also on each object's Content-Encoding). */
|
|
187
|
+
encoding: z.string(),
|
|
188
|
+
paths: ChainManifestPathsZod,
|
|
189
|
+
schema: z.literal(ChainManifestSchema),
|
|
190
|
+
version: z.int().positive()
|
|
191
|
+
});
|
|
192
|
+
var isChainManifest = zodIsFactory(ChainManifestZod);
|
|
193
|
+
var asChainManifest = zodAsFactory(ChainManifestZod, "asChainManifest");
|
|
194
|
+
var toChainManifest = zodToFactory(ChainManifestZod, "toChainManifest");
|
|
195
|
+
function createChainManifest(encoding, earliestBlock = 0) {
|
|
196
|
+
return asChainManifest({
|
|
197
|
+
earliestBlock,
|
|
198
|
+
encoding,
|
|
199
|
+
paths: chainManifestPathTemplates(),
|
|
200
|
+
schema: ChainManifestSchema,
|
|
201
|
+
version: CHAIN_LAYOUT_VERSION
|
|
202
|
+
}, true);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/staticRest/layout/indexManifest.ts
|
|
206
|
+
import {
|
|
207
|
+
zodAsFactory as zodAsFactory2,
|
|
208
|
+
zodIsFactory as zodIsFactory2,
|
|
209
|
+
zodToFactory as zodToFactory2
|
|
210
|
+
} from "@xylabs/sdk-js";
|
|
211
|
+
import { z as z2 } from "zod";
|
|
212
|
+
var INDEX_LAYOUT_VERSION = 1;
|
|
213
|
+
var IndexManifestSchema = "network.xyo.s3.index.manifest";
|
|
214
|
+
var IndexHeadSchema = "network.xyo.s3.index.head";
|
|
215
|
+
var IndexManifestFamilyZod = z2.object({
|
|
216
|
+
/** Highest step level published for this family. */
|
|
217
|
+
maxStep: z2.int().nonnegative(),
|
|
218
|
+
/** Path template for the family's frames, e.g. `blocks/{level}/{index}.json`. */
|
|
219
|
+
path: z2.string()
|
|
220
|
+
});
|
|
221
|
+
var indexFamiliesZod = z2.object({
|
|
222
|
+
balances: IndexManifestFamilyZod,
|
|
223
|
+
blocks: IndexManifestFamilyZod,
|
|
224
|
+
schemas: IndexManifestFamilyZod,
|
|
225
|
+
transfers: IndexManifestFamilyZod
|
|
226
|
+
});
|
|
227
|
+
var IndexManifestZod = z2.object({
|
|
228
|
+
families: indexFamiliesZod,
|
|
229
|
+
schema: z2.literal(IndexManifestSchema),
|
|
230
|
+
version: z2.int().positive()
|
|
231
|
+
});
|
|
232
|
+
var isIndexManifest = zodIsFactory2(IndexManifestZod);
|
|
233
|
+
var asIndexManifest = zodAsFactory2(IndexManifestZod, "asIndexManifest");
|
|
234
|
+
var toIndexManifest = zodToFactory2(IndexManifestZod, "toIndexManifest");
|
|
235
|
+
var IndexHeadFamiliesZod = z2.object({
|
|
236
|
+
balances: z2.int().nonnegative(),
|
|
237
|
+
blocks: z2.int().nonnegative(),
|
|
238
|
+
schemas: z2.int().nonnegative(),
|
|
239
|
+
transfers: z2.int().nonnegative()
|
|
240
|
+
});
|
|
241
|
+
var IndexHeadZod = z2.object({
|
|
242
|
+
/** Highest block the index is complete through. */
|
|
243
|
+
block: z2.int().nonnegative(),
|
|
244
|
+
/** Completed frame counts per family. */
|
|
245
|
+
families: IndexHeadFamiliesZod,
|
|
246
|
+
/** Hash of that block. */
|
|
247
|
+
hash: z2.string(),
|
|
248
|
+
schema: z2.literal(IndexHeadSchema),
|
|
249
|
+
/** ISO-8601 timestamp of the last update. */
|
|
250
|
+
updatedAt: z2.string(),
|
|
251
|
+
version: z2.int().positive()
|
|
252
|
+
});
|
|
253
|
+
var isIndexHead = zodIsFactory2(IndexHeadZod);
|
|
254
|
+
var asIndexHead = zodAsFactory2(IndexHeadZod, "asIndexHead");
|
|
255
|
+
var toIndexHead = zodToFactory2(IndexHeadZod, "toIndexHead");
|
|
256
|
+
function createIndexManifestFamilies(maxSteps) {
|
|
257
|
+
return {
|
|
258
|
+
balances: { maxStep: maxSteps.balances, path: indexSummaryPathTemplate("balances") },
|
|
259
|
+
blocks: { maxStep: maxSteps.blocks, path: indexSummaryPathTemplate("blocks") },
|
|
260
|
+
schemas: { maxStep: maxSteps.schemas, path: indexSummaryPathTemplate("schemas") },
|
|
261
|
+
transfers: { maxStep: maxSteps.transfers, path: indexSummaryPathTemplate("transfers") }
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function createIndexManifest(maxSteps) {
|
|
265
|
+
return asIndexManifest({
|
|
266
|
+
families: createIndexManifestFamilies(maxSteps),
|
|
267
|
+
schema: IndexManifestSchema,
|
|
268
|
+
version: INDEX_LAYOUT_VERSION
|
|
269
|
+
}, true);
|
|
270
|
+
}
|
|
271
|
+
function createIndexHead(watermark, updatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
272
|
+
return asIndexHead({
|
|
273
|
+
block: watermark.block,
|
|
274
|
+
families: watermark.families,
|
|
275
|
+
hash: watermark.hash,
|
|
276
|
+
schema: IndexHeadSchema,
|
|
277
|
+
updatedAt,
|
|
278
|
+
version: INDEX_LAYOUT_VERSION
|
|
279
|
+
}, true);
|
|
280
|
+
}
|
|
281
|
+
|
|
109
282
|
// src/utils/ExplorerLinks.ts
|
|
110
283
|
var ExplorerLinks = class {
|
|
111
284
|
explorerUrl;
|
|
@@ -158,8 +331,19 @@ var ExplorerLinks = class {
|
|
|
158
331
|
}
|
|
159
332
|
};
|
|
160
333
|
export {
|
|
334
|
+
CHAIN_LAYOUT_VERSION,
|
|
335
|
+
ChainManifestPathsZod,
|
|
336
|
+
ChainManifestSchema,
|
|
337
|
+
ChainManifestZod,
|
|
161
338
|
DefaultNetworks,
|
|
162
339
|
ExplorerLinks,
|
|
340
|
+
INDEX_LAYOUT_VERSION,
|
|
341
|
+
IndexHeadFamiliesZod,
|
|
342
|
+
IndexHeadSchema,
|
|
343
|
+
IndexHeadZod,
|
|
344
|
+
IndexManifestFamilyZod,
|
|
345
|
+
IndexManifestSchema,
|
|
346
|
+
IndexManifestZod,
|
|
163
347
|
LocalNetwork,
|
|
164
348
|
local_default as LocalNetworkIconString,
|
|
165
349
|
MainNetwork,
|
|
@@ -168,10 +352,38 @@ export {
|
|
|
168
352
|
NetworkDataLakeUrls,
|
|
169
353
|
SequenceNetwork,
|
|
170
354
|
testnet_default as SequenceNetworkIconString,
|
|
355
|
+
asChainManifest,
|
|
356
|
+
asIndexHead,
|
|
357
|
+
asIndexManifest,
|
|
171
358
|
asOptionalNetwork,
|
|
359
|
+
blockHashPath,
|
|
360
|
+
blockHashPathTemplate,
|
|
361
|
+
blockNumberPath,
|
|
362
|
+
blockNumberPathTemplate,
|
|
363
|
+
chainManifestPathTemplates,
|
|
364
|
+
createChainManifest,
|
|
365
|
+
createIndexHead,
|
|
366
|
+
createIndexManifest,
|
|
367
|
+
createIndexManifestFamilies,
|
|
172
368
|
getNetworkNode,
|
|
173
369
|
getNetworkNodes,
|
|
370
|
+
headPath,
|
|
371
|
+
indexHeadPath,
|
|
372
|
+
indexManifestPath,
|
|
373
|
+
indexSummaryPath,
|
|
374
|
+
indexSummaryPathTemplate,
|
|
174
375
|
initNetworkNode,
|
|
175
|
-
|
|
376
|
+
interpolatePathTemplate,
|
|
377
|
+
isChainManifest,
|
|
378
|
+
isIndexHead,
|
|
379
|
+
isIndexManifest,
|
|
380
|
+
isNetworkBootstrap,
|
|
381
|
+
manifestPath,
|
|
382
|
+
payloadPath,
|
|
383
|
+
payloadPathTemplate,
|
|
384
|
+
toChainManifest,
|
|
385
|
+
toIndexHead,
|
|
386
|
+
toIndexManifest,
|
|
387
|
+
toPathTemplate
|
|
176
388
|
};
|
|
177
389
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/icons/local/local.svg", "../../src/icons/mainnet/mainnet.svg", "../../src/icons/sequence/testnet.svg", "../../src/lib/Networks.ts", "../../src/models/Bootstrap.ts", "../../src/lib/NetworkDataLakeUrls.ts", "../../src/modules/node/getNetworkNode.ts", "../../src/manifest/network.json", "../../src/manifest/networkManifest.ts", "../../src/modules/node/getNetworkNodes.ts", "../../src/modules/node/initNetworkNode.ts", "../../src/utils/ExplorerLinks.ts"],
|
|
4
|
-
"sourcesContent": ["<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#f47f00;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f47f00;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#f47f00;\"/></svg>", "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#8d8fc6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#eb407a;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f27046;\"/><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#572aff;\"/></svg>", "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#579fd6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#579fd6;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#579fd6;\"/></svg>", "import { asHex } from '@xylabs/sdk-js'\n\nimport {\n LocalNetworkIconString, MainNetworkIconString, SequenceNetworkIconString,\n} from '../icons/index.ts'\nimport type { NetworkBootstrap, NetworkId } from '../models/index.ts'\nimport { NetworkBootstrapSchema } from '../models/index.ts'\n\n/** Bootstrap configuration for the XYO Layer 1 mainnet. */\nexport const MainNetwork: NetworkBootstrap = {\n chain: asHex('319e667ced10452a117472811130444ded357f26', true),\n description: 'Main Network for XYO Layer 1',\n icon: MainNetworkIconString,\n id: 'mainnet' as NetworkId,\n name: 'Mainnet',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://api.chain.xyo.network',\n explorerUrl: 'https://explore.xyo.network',\n}\n\n/** Bootstrap configuration for the XYO Layer 1 sequence (test) network. */\nexport const SequenceNetwork: NetworkBootstrap = {\n chain: asHex('4b43a753c8024c0e5000e8ac948ac0063ac624bc', true),\n description: 'Test Network for XYO Layer 1',\n icon: SequenceNetworkIconString,\n id: 'sequence' as NetworkId,\n name: 'Sequence',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://beta.api.chain.xyo.network',\n explorerUrl: 'https://beta.explore.xyo.network',\n}\n\n/** Bootstrap configuration for a local development network. */\nexport const LocalNetwork: NetworkBootstrap = {\n description: 'Local Node',\n icon: LocalNetworkIconString,\n id: 'local' as NetworkId,\n name: 'Local',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'http://localhost:8080',\n explorerUrl: 'http://localhost:3000',\n}\n\n/** Default set of available XYO Layer 1 networks (mainnet, sequence, local). */\nexport const DefaultNetworks: NetworkBootstrap[] = [MainNetwork, SequenceNetwork, LocalNetwork]\n", "import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload } from '@xyo-network/sdk-js'\nimport { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'\nimport type { ChainId } from '@xyo-network/xl1-protocol-lib'\n\nimport type { NetworkId } from './NetworkId.ts'\n\n/** Connection details for accessing a chain endpoint. */\nexport interface ChainConnection {\n /** Chain Identifier - can be a hex (eth contract address) or a string */\n chain?: ChainId\n /** Name of the chain */\n name: string\n /** Url for accessing the network */\n url: string\n}\n\n/** Schema identifier for network bootstrap payloads. */\nexport const NetworkBootstrapSchema = asSchema('network.xyo.network.bootstrap', true)\n/** Schema type for network bootstrap payloads. */\nexport type NetworkBootstrapSchema = typeof NetworkBootstrapSchema\n\n/** Fields describing a chain fork origin. */\nexport interface ChainForkFields {\n /** Block Number at which the chain was forked from */\n forkedAtLastBlockNumber?: string\n /** Hash in the last block the chain was forked from */\n forkedAtLastHash?: string\n /** Address of the forked chain */\n forkedChainId?: Address\n}\n\n/** Core fields describing an XYO network. */\nexport interface NetworkFields {\n /** Description of the network */\n description: string\n /** Url for accessing the network explorer */\n explorerUrl?: string\n /** string representation of the icon (svg) */\n icon?: string\n /** Machine-readable identifier */\n id: NetworkId\n schema: NetworkBootstrapSchema\n /** Symbol of the network */\n symbol?: string\n}\n\n/** Optional Properties can be found walking the chain to the genesis block */\nexport interface NetworkBootstrapFields extends NetworkFields, ChainForkFields, ChainConnection {}\n\n/** A network bootstrap extended with a flag indicating whether it is a custom network. */\nexport interface Network extends NetworkBootstrap {\n custom: boolean\n}\n\n/** Payload type containing all network bootstrap configuration fields. */\nexport type NetworkBootstrap = Payload<NetworkBootstrapFields, NetworkBootstrapSchema>\n\n/** Type guard that checks whether a payload is a NetworkBootstrap. */\nexport const isNetworkBootstrap = isPayloadOfSchemaType<NetworkBootstrap>(NetworkBootstrapSchema)\n\n/** Optionally casts a value to a Network if it is a valid NetworkBootstrap. */\nexport const asOptionalNetwork = AsObjectFactory.createOptional(isNetworkBootstrap)\n", "import type { GatewayName } from '@xyo-network/xl1-protocol-lib'\n\nimport {\n LocalNetwork, MainNetwork, SequenceNetwork,\n} from './Networks.ts'\n\n/** Map of network IDs to their corresponding Data Lake API URLs. */\nexport const NetworkDataLakeUrls = {\n [MainNetwork.id]: 'https://api.archivist.xyo.network/dataLake',\n [SequenceNetwork.id]: 'https://beta.api.archivist.xyo.network/dataLake',\n [LocalNetwork.id]: 'http://localhost:8080/dataLake',\n} as const satisfies Record<GatewayName, string>\n", "import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\nimport { ManifestWrapper, ModuleFactoryLocator } from '@xyo-network/sdk-js'\n\nimport { NetworkNodeManifest } from '../../manifest/index.ts'\n\n/** Creates a network node from the network manifest using the provided wallet. */\nexport const getNetworkNode = async (wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const wrapper = new ManifestWrapper(NetworkNodeManifest, wallet, new ModuleFactoryLocator())\n const [node] = await wrapper.loadNodes()\n return node\n}\n", "{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"Network\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}", "import type { PackageManifestPayload } from '@xyo-network/sdk-js'\n\nimport node from './network.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NetworkNodeManifest = node as unknown as PackageManifestPayload\n", "import type { AttachableNodeInstance } from '@xyo-network/sdk-js'\n\nconst networkNodeMap = new Map<string, AttachableNodeInstance>()\n\n/** Returns the global map of network URL to node instance. */\nexport const getNetworkNodes = () => {\n return networkNodeMap\n}\n", "import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\n\nimport type { NetworkBootstrap } from '../../models/index.ts'\nimport { getNetworkNode } from './getNetworkNode.ts'\nimport { getNetworkNodes } from './getNetworkNodes.ts'\n\n/** Initializes or retrieves a cached network node for the given network and wallet. */\nexport const initNetworkNode = async (activeNetwork: NetworkBootstrap, wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const networkNodeMap = getNetworkNodes()\n if (networkNodeMap.has(activeNetwork.url)) return networkNodeMap.get(activeNetwork.url)!\n\n const activeNetworkNode = await getNetworkNode(wallet)\n networkNodeMap.set(activeNetwork.url, activeNetworkNode)\n\n return activeNetworkNode\n}\n", "import type { NetworkId } from '../models/index.ts'\n\n/** Builds URLs to pages on an XL1 chain explorer for a specific network. */\nexport class ExplorerLinks {\n readonly explorerUrl: string\n readonly networkId: NetworkId\n\n constructor(explorerUrl: string, networkId: NetworkId) {\n this.explorerUrl = explorerUrl.replace(/\\/+$/, '')\n this.networkId = networkId\n }\n\n /** `{explorerUrl}/xl1/{networkId}/address/{address}` */\n address(address: string): string {\n return `${this.network()}/address/${address}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/addresses` */\n addresses(): string {\n return `${this.network()}/addresses`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/{blockHash}` */\n block(blockHash: string): string {\n return `${this.network()}/block/${blockHash}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/number/{blockNumber}` */\n blockByNumber(blockNumber: number | string): string {\n return `${this.network()}/block/number/${blockNumber}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/{blockHash}/payload/{payloadHash}[/{render}]` */\n blockPayload(blockHash: string, payloadHash: string, render?: string): string {\n const base = `${this.network()}/block/${blockHash}/payload/${payloadHash}`\n return render === undefined ? base : `${base}/${render}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/blocks` */\n blocks(): string {\n return `${this.network()}/blocks`\n }\n\n /** `{explorerUrl}/xl1/{networkId}` */\n network(): string {\n return `${this.explorerUrl}/xl1/${this.networkId}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transaction/{txHash}` */\n transaction(txHash: string): string {\n return `${this.network()}/transaction/${txHash}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transaction/{txHash}/payload/{payloadHash}[/{render}]` */\n transactionPayload(txHash: string, payloadHash: string, render?: string): string {\n const base = `${this.network()}/transaction/${txHash}/payload/${payloadHash}`\n return render === undefined ? base : `${base}/${render}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transactions` */\n transactions(): string {\n return `${this.network()}/transactions`\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAAA;;;ACAA;;;ACAA;;;ACAA,SAAS,aAAa;;;ACCtB,SAAS,uBAAuB;AAEhC,SAAS,UAAU,6BAA6B;AAgBzC,IAAM,yBAAyB,SAAS,iCAAiC,IAAI;AAyC7E,IAAM,qBAAqB,sBAAwC,sBAAsB;AAGzF,IAAM,oBAAoB,gBAAgB,eAAe,kBAAkB;;;ADtD3E,IAAM,cAAgC;AAAA,EAC3C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAA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iC,WAA4D;AACjI,QAAMA,kBAAiB,gBAAgB;AACvC,MAAIA,gBAAe,IAAI,cAAc,GAAG,EAAG,QAAOA,gBAAe,IAAI,cAAc,GAAG;AAEtF,QAAM,oBAAoB,MAAM,eAAe,MAAM;AACrD,EAAAA,gBAAe,IAAI,cAAc,KAAK,iBAAiB;AAEvD,SAAO;AACT;;;
|
|
6
|
-
"names": ["networkNodeMap"]
|
|
3
|
+
"sources": ["../../src/icons/local/local.svg", "../../src/icons/mainnet/mainnet.svg", "../../src/icons/sequence/testnet.svg", "../../src/lib/Networks.ts", "../../src/models/Bootstrap.ts", "../../src/lib/NetworkDataLakeUrls.ts", "../../src/modules/node/getNetworkNode.ts", "../../src/manifest/network.json", "../../src/manifest/networkManifest.ts", "../../src/modules/node/getNetworkNodes.ts", "../../src/modules/node/initNetworkNode.ts", "../../src/staticRest/layout/chainManifest.ts", "../../src/staticRest/paths/chainState.ts", "../../src/staticRest/paths/finalized.ts", "../../src/staticRest/paths/indexPaths.ts", "../../src/staticRest/templates.ts", "../../src/staticRest/layout/indexManifest.ts", "../../src/utils/ExplorerLinks.ts"],
|
|
4
|
+
"sourcesContent": ["<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#f47f00;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f47f00;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#f47f00;\"/></svg>", "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#8d8fc6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#eb407a;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f27046;\"/><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#572aff;\"/></svg>", "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#579fd6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#579fd6;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#579fd6;\"/></svg>", "import { asHex } from '@xylabs/sdk-js'\n\nimport {\n LocalNetworkIconString, MainNetworkIconString, SequenceNetworkIconString,\n} from '../icons/index.ts'\nimport type { NetworkBootstrap, NetworkId } from '../models/index.ts'\nimport { NetworkBootstrapSchema } from '../models/index.ts'\n\n/** Bootstrap configuration for the XYO Layer 1 mainnet. */\nexport const MainNetwork: NetworkBootstrap = {\n chain: asHex('319e667ced10452a117472811130444ded357f26', true),\n description: 'Main Network for XYO Layer 1',\n icon: MainNetworkIconString,\n id: 'mainnet' as NetworkId,\n name: 'Mainnet',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://api.chain.xyo.network',\n explorerUrl: 'https://explore.xyo.network',\n}\n\n/** Bootstrap configuration for the XYO Layer 1 sequence (test) network. */\nexport const SequenceNetwork: NetworkBootstrap = {\n chain: asHex('4b43a753c8024c0e5000e8ac948ac0063ac624bc', true),\n description: 'Test Network for XYO Layer 1',\n icon: SequenceNetworkIconString,\n id: 'sequence' as NetworkId,\n name: 'Sequence',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://beta.api.chain.xyo.network',\n explorerUrl: 'https://beta.explore.xyo.network',\n}\n\n/** Bootstrap configuration for a local development network. */\nexport const LocalNetwork: NetworkBootstrap = {\n description: 'Local Node',\n icon: LocalNetworkIconString,\n id: 'local' as NetworkId,\n name: 'Local',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'http://localhost:8080',\n explorerUrl: 'http://localhost:3000',\n}\n\n/** Default set of available XYO Layer 1 networks (mainnet, sequence, local). */\nexport const DefaultNetworks: NetworkBootstrap[] = [MainNetwork, SequenceNetwork, LocalNetwork]\n", "import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload } from '@xyo-network/sdk-js'\nimport { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'\nimport type { ChainId } from '@xyo-network/xl1-protocol-lib'\n\nimport type { NetworkId } from './NetworkId.ts'\n\n/** Connection details for accessing a chain endpoint. */\nexport interface ChainConnection {\n /** Chain Identifier - can be a hex (eth contract address) or a string */\n chain?: ChainId\n /** Name of the chain */\n name: string\n /** Url for accessing the network */\n url: string\n}\n\n/** Schema identifier for network bootstrap payloads. */\nexport const NetworkBootstrapSchema = asSchema('network.xyo.network.bootstrap', true)\n/** Schema type for network bootstrap payloads. */\nexport type NetworkBootstrapSchema = typeof NetworkBootstrapSchema\n\n/** Fields describing a chain fork origin. */\nexport interface ChainForkFields {\n /** Block Number at which the chain was forked from */\n forkedAtLastBlockNumber?: string\n /** Hash in the last block the chain was forked from */\n forkedAtLastHash?: string\n /** Address of the forked chain */\n forkedChainId?: Address\n}\n\n/** Core fields describing an XYO network. */\nexport interface NetworkFields {\n /** Description of the network */\n description: string\n /** Url for accessing the network explorer */\n explorerUrl?: string\n /** string representation of the icon (svg) */\n icon?: string\n /** Machine-readable identifier */\n id: NetworkId\n schema: NetworkBootstrapSchema\n /** Symbol of the network */\n symbol?: string\n}\n\n/** Optional Properties can be found walking the chain to the genesis block */\nexport interface NetworkBootstrapFields extends NetworkFields, ChainForkFields, ChainConnection {}\n\n/** A network bootstrap extended with a flag indicating whether it is a custom network. */\nexport interface Network extends NetworkBootstrap {\n custom: boolean\n}\n\n/** Payload type containing all network bootstrap configuration fields. */\nexport type NetworkBootstrap = Payload<NetworkBootstrapFields, NetworkBootstrapSchema>\n\n/** Type guard that checks whether a payload is a NetworkBootstrap. */\nexport const isNetworkBootstrap = isPayloadOfSchemaType<NetworkBootstrap>(NetworkBootstrapSchema)\n\n/** Optionally casts a value to a Network if it is a valid NetworkBootstrap. */\nexport const asOptionalNetwork = AsObjectFactory.createOptional(isNetworkBootstrap)\n", "import type { GatewayName } from '@xyo-network/xl1-protocol-lib'\n\nimport {\n LocalNetwork, MainNetwork, SequenceNetwork,\n} from './Networks.ts'\n\n/** Map of network IDs to their corresponding Data Lake API URLs. */\nexport const NetworkDataLakeUrls = {\n [MainNetwork.id]: 'https://api.archivist.xyo.network/dataLake',\n [SequenceNetwork.id]: 'https://beta.api.archivist.xyo.network/dataLake',\n [LocalNetwork.id]: 'http://localhost:8080/dataLake',\n} as const satisfies Record<GatewayName, string>\n", "import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\nimport { ManifestWrapper, ModuleFactoryLocator } from '@xyo-network/sdk-js'\n\nimport { NetworkNodeManifest } from '../../manifest/index.ts'\n\n/** Creates a network node from the network manifest using the provided wallet. */\nexport const getNetworkNode = async (wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const wrapper = new ManifestWrapper(NetworkNodeManifest, wallet, new ModuleFactoryLocator())\n const [node] = await wrapper.loadNodes()\n return node\n}\n", "{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"Network\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}", "import type { PackageManifestPayload } from '@xyo-network/sdk-js'\n\nimport node from './network.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NetworkNodeManifest = node as unknown as PackageManifestPayload\n", "import type { AttachableNodeInstance } from '@xyo-network/sdk-js'\n\nconst networkNodeMap = new Map<string, AttachableNodeInstance>()\n\n/** Returns the global map of network URL to node instance. */\nexport const getNetworkNodes = () => {\n return networkNodeMap\n}\n", "import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\n\nimport type { NetworkBootstrap } from '../../models/index.ts'\nimport { getNetworkNode } from './getNetworkNode.ts'\nimport { getNetworkNodes } from './getNetworkNodes.ts'\n\n/** Initializes or retrieves a cached network node for the given network and wallet. */\nexport const initNetworkNode = async (activeNetwork: NetworkBootstrap, wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const networkNodeMap = getNetworkNodes()\n if (networkNodeMap.has(activeNetwork.url)) return networkNodeMap.get(activeNetwork.url)!\n\n const activeNetworkNode = await getNetworkNode(wallet)\n networkNodeMap.set(activeNetwork.url, activeNetworkNode)\n\n return activeNetworkNode\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport { z } from 'zod'\n\nimport { chainManifestPathTemplates } from '../templates.ts'\n\n/** Bumped when the finalized layout changes shape, so readers can detect a mismatch. */\nexport const CHAIN_LAYOUT_VERSION = 1\n\n/** Schema id for the finalized layout manifest document. */\nexport const ChainManifestSchema = 'network.xyo.s3.chain.manifest' as const\n/** Type literal for the chain manifest schema. */\nexport type ChainManifestSchema = typeof ChainManifestSchema\n\n/** Path templates for the finalized + chain-state files. */\nexport const ChainManifestPathsZod = z.object({\n blockByHash: z.string(),\n blockByNumber: z.string(),\n head: z.string(),\n payload: z.string(),\n})\n\n/** Type for chain manifest path templates. */\nexport type ChainManifestPaths = z.infer<typeof ChainManifestPathsZod>\n\n/** Zod schema for the finalized layout descriptor at `manifestPath()`. */\nexport const ChainManifestZod = z.object({\n /** Lowest block number available in the bucket (genesis until pruning exists). */\n earliestBlock: z.int().nonnegative(),\n /** Storage/wire encoding of the published files (also on each object's Content-Encoding). */\n encoding: z.string(),\n paths: ChainManifestPathsZod,\n schema: z.literal(ChainManifestSchema),\n version: z.int().positive(),\n})\n\n/** The finalized layout descriptor at `manifestPath()`. */\nexport type ChainManifest = z.infer<typeof ChainManifestZod>\n\n/** Type guard that checks if a value is a valid ChainManifest. */\nexport const isChainManifest = zodIsFactory(ChainManifestZod)\n/** Converts a value to ChainManifest, throwing if invalid. */\nexport const asChainManifest = zodAsFactory(ChainManifestZod, 'asChainManifest')\n/** Non-validating cast to ChainManifest. */\nexport const toChainManifest = zodToFactory(ChainManifestZod, 'toChainManifest')\n\n/** Builds a validated chain manifest with path templates derived from the path builders. */\nexport function createChainManifest(encoding: string, earliestBlock = 0): ChainManifest {\n return asChainManifest({\n earliestBlock,\n encoding,\n paths: chainManifestPathTemplates(),\n schema: ChainManifestSchema,\n version: CHAIN_LAYOUT_VERSION,\n }, true)\n}\n", "/**\n * Path builders for the chain-state (mutable) bucket.\n *\n * Paths are relative \u2014 no leading slash \u2014 and joined to a base URL by the consumer.\n */\n\n/** The mutable head pointer: the current head SignedHydratedBlockWithHashMeta. */\nexport const headPath = (): string => 'chain/head.json'\n", "/**\n * Path builders for the finalized (immutable) bucket.\n *\n * Paths are relative \u2014 no leading slash \u2014 and joined to a base URL by the consumer.\n */\n\n/** The finalized layout descriptor (path templates, encoding, version, earliest block). */\nexport const manifestPath = (): string => 'manifest.json'\n\n/** A block by number: SignedHydratedBlockWithHashMeta. */\nexport const blockNumberPath = (block: number): string => `block/number/${block}.json`\n\n/** A block by hash: the same content as its by-number twin. */\nexport const blockHashPath = (hash: string): string => `block/hash/${hash}.json`\n\n/** A payload by hash: WithHashMeta<Payload>. */\nexport const payloadPath = (hash: string): string => `payload/${hash}.json`\n", "import type { IndexSummaryFamily } from '@xyo-network/xl1-protocol-lib'\n\n/**\n * Path builders for the index bucket.\n *\n * The index is a separate, single-writer bucket holding completed step summaries for several\n * families. Paths are relative \u2014 no leading slash \u2014 and joined to a base URL by the consumer.\n */\n\n/** A completed frame's summary for a family, e.g. `blocks/2/5.json`. Immutable once written. */\nexport const indexSummaryPath = (family: IndexSummaryFamily, stepLevel: number, stepIndex: number): string =>\n `${family}/${stepLevel}/${stepIndex}.json`\n\n/** The index layout descriptor (families, max step, encoding, version). */\nexport const indexManifestPath = (): string => 'manifest.json'\n\n/** The indexer's progress watermark (highest block the index is complete through). */\nexport const indexHeadPath = (): string => 'head.json'\n", "import type { IndexSummaryFamily } from '@xyo-network/xl1-protocol-lib'\n\nimport { headPath } from './paths/chainState.ts'\nimport {\n blockHashPath, blockNumberPath, payloadPath,\n} from './paths/finalized.ts'\nimport { indexSummaryPath } from './paths/indexPaths.ts'\n\n/** Sentinel values used when deriving self-describing path templates from concrete builders. */\nconst TEMPLATE_SLOTS = {\n block: 0,\n hash: '0'.repeat(64),\n index: 99,\n level: 42,\n} as const\n\n/**\n * Replaces concrete slot literals in a path with named `{placeholder}` segments.\n * Used to derive manifest path templates from the path builders so the two cannot drift.\n */\nexport function toPathTemplate(path: string, slots: { literal: string; name: string }[]): string {\n let result = path\n for (const { literal, name } of slots) {\n if (!result.includes(literal)) {\n throw new Error(`Template slot \"${literal}\" not found in path \"${path}\"`)\n }\n result = result.replace(literal, `{${name}}`)\n }\n return result\n}\n\n/** Fills `{placeholder}` segments in a manifest path template. Used in conformance tests. */\nexport function interpolatePathTemplate(template: string, values: Record<string, string | number>): string {\n let result = template\n for (const [key, value] of Object.entries(values)) {\n result = result.replaceAll(`{${key}}`, String(value))\n }\n return result\n}\n\n/** Self-describing template for `blockNumberPath`. */\nexport const blockNumberPathTemplate = (): string =>\n toPathTemplate(blockNumberPath(TEMPLATE_SLOTS.block), [{ literal: String(TEMPLATE_SLOTS.block), name: 'block' }])\n\n/** Self-describing template for `blockHashPath`. */\nexport const blockHashPathTemplate = (): string =>\n toPathTemplate(blockHashPath(TEMPLATE_SLOTS.hash), [{ literal: TEMPLATE_SLOTS.hash, name: 'hash' }])\n\n/** Self-describing template for `payloadPath`. */\nexport const payloadPathTemplate = (): string =>\n toPathTemplate(payloadPath(TEMPLATE_SLOTS.hash), [{ literal: TEMPLATE_SLOTS.hash, name: 'hash' }])\n\n/** Self-describing templates for finalized + chain-state files carried in the chain manifest. */\nexport function chainManifestPathTemplates(): {\n blockByHash: string\n blockByNumber: string\n head: string\n payload: string\n} {\n return {\n blockByHash: blockHashPathTemplate(),\n blockByNumber: blockNumberPathTemplate(),\n head: headPath(),\n payload: payloadPathTemplate(),\n }\n}\n\n/** Self-describing template for one index summary family, e.g. `blocks/{level}/{index}.json`. */\nexport function indexSummaryPathTemplate(family: IndexSummaryFamily): string {\n const path = indexSummaryPath(family, TEMPLATE_SLOTS.level, TEMPLATE_SLOTS.index)\n return toPathTemplate(path, [\n { literal: String(TEMPLATE_SLOTS.level), name: 'level' },\n { literal: String(TEMPLATE_SLOTS.index), name: 'index' },\n ])\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { IndexSummaryFamily, IndexWatermark } from '@xyo-network/xl1-protocol-lib'\nimport { z } from 'zod'\n\nimport { indexSummaryPathTemplate } from '../templates.ts'\n\n/** Bumped when the on-disk index layout changes shape, so readers can detect a mismatch. */\nexport const INDEX_LAYOUT_VERSION = 1\n\n/** Schema id for the index manifest document (the static layout descriptor). */\nexport const IndexManifestSchema = 'network.xyo.s3.index.manifest' as const\n/** Type literal for the index manifest schema. */\nexport type IndexManifestSchema = typeof IndexManifestSchema\n\n/** Schema id for the index head document (the progress watermark). */\nexport const IndexHeadSchema = 'network.xyo.s3.index.head' as const\n/** Type literal for the index head schema. */\nexport type IndexHeadSchema = typeof IndexHeadSchema\n\n/** Per-family descriptor carried in the manifest. */\nexport const IndexManifestFamilyZod = z.object({\n /** Highest step level published for this family. */\n maxStep: z.int().nonnegative(),\n /** Path template for the family's frames, e.g. `blocks/{level}/{index}.json`. */\n path: z.string(),\n})\n\n/** Type for one index manifest family descriptor. */\nexport type IndexManifestFamily = z.infer<typeof IndexManifestFamilyZod>\n\nconst indexFamiliesZod = z.object({\n balances: IndexManifestFamilyZod,\n blocks: IndexManifestFamilyZod,\n schemas: IndexManifestFamilyZod,\n transfers: IndexManifestFamilyZod,\n})\n\n/** Zod schema for the static index layout descriptor at `indexManifestPath()`. */\nexport const IndexManifestZod = z.object({\n families: indexFamiliesZod,\n schema: z.literal(IndexManifestSchema),\n version: z.int().positive(),\n})\n\n/** The static index layout descriptor at `indexManifestPath()`. */\nexport type IndexManifest = z.infer<typeof IndexManifestZod>\n\n/** Type guard that checks if a value is a valid IndexManifest. */\nexport const isIndexManifest = zodIsFactory(IndexManifestZod)\n/** Converts a value to IndexManifest, throwing if invalid. */\nexport const asIndexManifest = zodAsFactory(IndexManifestZod, 'asIndexManifest')\n/** Non-validating cast to IndexManifest. */\nexport const toIndexManifest = zodToFactory(IndexManifestZod, 'toIndexManifest')\n\n/** Completed frame counts per family in the index head watermark. */\nexport const IndexHeadFamiliesZod = z.object({\n balances: z.int().nonnegative(),\n blocks: z.int().nonnegative(),\n schemas: z.int().nonnegative(),\n transfers: z.int().nonnegative(),\n})\n\n/** Zod schema for the index progress watermark at `indexHeadPath()`. */\nexport const IndexHeadZod = z.object({\n /** Highest block the index is complete through. */\n block: z.int().nonnegative(),\n /** Completed frame counts per family. */\n families: IndexHeadFamiliesZod,\n /** Hash of that block. */\n hash: z.string(),\n schema: z.literal(IndexHeadSchema),\n /** ISO-8601 timestamp of the last update. */\n updatedAt: z.string(),\n version: z.int().positive(),\n})\n\n/** The index progress watermark at `indexHeadPath()`. */\nexport type IndexHead = z.infer<typeof IndexHeadZod>\n\n/** Type guard that checks if a value is a valid IndexHead. */\nexport const isIndexHead = zodIsFactory(IndexHeadZod)\n/** Converts a value to IndexHead, throwing if invalid. */\nexport const asIndexHead = zodAsFactory(IndexHeadZod, 'asIndexHead')\n/** Non-validating cast to IndexHead. */\nexport const toIndexHead = zodToFactory(IndexHeadZod, 'toIndexHead')\n\n/** Builds per-family manifest descriptors with path templates derived from the path builders. */\nexport function createIndexManifestFamilies(\n maxSteps: Record<IndexSummaryFamily, number>,\n): Record<IndexSummaryFamily, IndexManifestFamily> {\n return {\n balances: { maxStep: maxSteps.balances, path: indexSummaryPathTemplate('balances') },\n blocks: { maxStep: maxSteps.blocks, path: indexSummaryPathTemplate('blocks') },\n schemas: { maxStep: maxSteps.schemas, path: indexSummaryPathTemplate('schemas') },\n transfers: { maxStep: maxSteps.transfers, path: indexSummaryPathTemplate('transfers') },\n }\n}\n\n/** Builds a validated index manifest with path templates derived from the path builders. */\nexport function createIndexManifest(maxSteps: Record<IndexSummaryFamily, number>): IndexManifest {\n return asIndexManifest({\n families: createIndexManifestFamilies(maxSteps),\n schema: IndexManifestSchema,\n version: INDEX_LAYOUT_VERSION,\n }, true)\n}\n\n/** Builds a validated index head watermark from an indexer progress snapshot. */\nexport function createIndexHead(watermark: IndexWatermark, updatedAt = new Date().toISOString()): IndexHead {\n return asIndexHead({\n block: watermark.block,\n families: watermark.families,\n hash: watermark.hash,\n schema: IndexHeadSchema,\n updatedAt,\n version: INDEX_LAYOUT_VERSION,\n }, true)\n}\n", "import type { NetworkId } from '../models/index.ts'\n\n/** Builds URLs to pages on an XL1 chain explorer for a specific network. */\nexport class ExplorerLinks {\n readonly explorerUrl: string\n readonly networkId: NetworkId\n\n constructor(explorerUrl: string, networkId: NetworkId) {\n this.explorerUrl = explorerUrl.replace(/\\/+$/, '')\n this.networkId = networkId\n }\n\n /** `{explorerUrl}/xl1/{networkId}/address/{address}` */\n address(address: string): string {\n return `${this.network()}/address/${address}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/addresses` */\n addresses(): string {\n return `${this.network()}/addresses`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/{blockHash}` */\n block(blockHash: string): string {\n return `${this.network()}/block/${blockHash}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/number/{blockNumber}` */\n blockByNumber(blockNumber: number | string): string {\n return `${this.network()}/block/number/${blockNumber}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/block/{blockHash}/payload/{payloadHash}[/{render}]` */\n blockPayload(blockHash: string, payloadHash: string, render?: string): string {\n const base = `${this.network()}/block/${blockHash}/payload/${payloadHash}`\n return render === undefined ? base : `${base}/${render}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/blocks` */\n blocks(): string {\n return `${this.network()}/blocks`\n }\n\n /** `{explorerUrl}/xl1/{networkId}` */\n network(): string {\n return `${this.explorerUrl}/xl1/${this.networkId}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transaction/{txHash}` */\n transaction(txHash: string): string {\n return `${this.network()}/transaction/${txHash}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transaction/{txHash}/payload/{payloadHash}[/{render}]` */\n transactionPayload(txHash: string, payloadHash: string, render?: string): string {\n const base = `${this.network()}/transaction/${txHash}/payload/${payloadHash}`\n return render === undefined ? base : `${base}/${render}`\n }\n\n /** `{explorerUrl}/xl1/{networkId}/transactions` */\n transactions(): string {\n return `${this.network()}/transactions`\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA;;;ACAA;;;ACAA;;;ACAA,SAAS,aAAa;;;ACCtB,SAAS,uBAAuB;AAEhC,SAAS,UAAU,6BAA6B;AAgBzC,IAAM,yBAAyB,SAAS,iCAAiC,IAAI;AAyC7E,IAAM,qBAAqB,sBAAwC,sBAAsB;AAGzF,IAAM,oBAAoB,gBAAgB,eAAe,kBAAkB;;;ADtD3E,IAAM,cAAgC;AAAA,EAC3C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAoC;AAAA,EAC/C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,eAAiC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAsC,CAAC,aAAa,iBAAiB,YAAY;;;AExCvF,IAAM,sBAAsB;AAAA,EACjC,CAAC,YAAY,EAAE,GAAG;AAAA,EAClB,CAAC,gBAAgB,EAAE,GAAG;AAAA,EACtB,CAAC,aAAa,EAAE,GAAG;AACrB;;;ACVA,SAAS,iBAAiB,4BAA4B;;;ACDtD;AAAA,EACE,SAAW;AAAA,EACX,OAAS;AAAA,IACP;AAAA,MACE,QAAU;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AQ,CAAC,gBAAgB,MAAM;AAAA,EAChD;AAAA;AAAA,EAGA,mBAAmB,QAAgB,aAAqB,QAAyB;AAC/E,UAAM,OAAO,GAAG,KAAK,QAAQ,CAAC,gBAAgB,MAAM,YAAY,WAAW;AAC3E,WAAO,WAAW,SAAY,OAAO,GAAG,IAAI,IAAI,MAAM;AAAA,EACxD;AAAA;AAAA,EAGA,eAAuB;AACrB,WAAO,GAAG,KAAK,QAAQ,CAAC;AAAA,EAC1B;AACF;",
|
|
6
|
+
"names": ["networkNodeMap", "zodAsFactory", "zodIsFactory", "zodToFactory", "z", "z", "zodIsFactory", "zodAsFactory", "zodToFactory"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static REST layout protocol for XL1 chain data.
|
|
3
|
+
*
|
|
4
|
+
* Path builders, manifest schemas, and derived path templates shared by static file publishers
|
|
5
|
+
* (S3 runners) and HTTP readers (Rest viewers). See `packages/protocol/STATIC_REST_LAYOUT.md`.
|
|
6
|
+
*/
|
|
7
|
+
export * from './layout/index.ts';
|
|
8
|
+
export * from './paths/index.ts';
|
|
9
|
+
export * from './templates.ts';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/staticRest/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Bumped when the finalized layout changes shape, so readers can detect a mismatch. */
|
|
3
|
+
export declare const CHAIN_LAYOUT_VERSION = 1;
|
|
4
|
+
/** Schema id for the finalized layout manifest document. */
|
|
5
|
+
export declare const ChainManifestSchema: "network.xyo.s3.chain.manifest";
|
|
6
|
+
/** Type literal for the chain manifest schema. */
|
|
7
|
+
export type ChainManifestSchema = typeof ChainManifestSchema;
|
|
8
|
+
/** Path templates for the finalized + chain-state files. */
|
|
9
|
+
export declare const ChainManifestPathsZod: z.ZodObject<{
|
|
10
|
+
blockByHash: z.ZodString;
|
|
11
|
+
blockByNumber: z.ZodString;
|
|
12
|
+
head: z.ZodString;
|
|
13
|
+
payload: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/** Type for chain manifest path templates. */
|
|
16
|
+
export type ChainManifestPaths = z.infer<typeof ChainManifestPathsZod>;
|
|
17
|
+
/** Zod schema for the finalized layout descriptor at `manifestPath()`. */
|
|
18
|
+
export declare const ChainManifestZod: z.ZodObject<{
|
|
19
|
+
earliestBlock: z.ZodInt;
|
|
20
|
+
encoding: z.ZodString;
|
|
21
|
+
paths: z.ZodObject<{
|
|
22
|
+
blockByHash: z.ZodString;
|
|
23
|
+
blockByNumber: z.ZodString;
|
|
24
|
+
head: z.ZodString;
|
|
25
|
+
payload: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
schema: z.ZodLiteral<"network.xyo.s3.chain.manifest">;
|
|
28
|
+
version: z.ZodInt;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
/** The finalized layout descriptor at `manifestPath()`. */
|
|
31
|
+
export type ChainManifest = z.infer<typeof ChainManifestZod>;
|
|
32
|
+
/** Type guard that checks if a value is a valid ChainManifest. */
|
|
33
|
+
export declare const isChainManifest: <T>(value: T) => value is T & {
|
|
34
|
+
earliestBlock: number;
|
|
35
|
+
encoding: string;
|
|
36
|
+
paths: {
|
|
37
|
+
blockByHash: string;
|
|
38
|
+
blockByNumber: string;
|
|
39
|
+
head: string;
|
|
40
|
+
payload: string;
|
|
41
|
+
};
|
|
42
|
+
schema: "network.xyo.s3.chain.manifest";
|
|
43
|
+
version: number;
|
|
44
|
+
};
|
|
45
|
+
/** Converts a value to ChainManifest, throwing if invalid. */
|
|
46
|
+
export declare const asChainManifest: {
|
|
47
|
+
<T>(value: T): (T & {
|
|
48
|
+
earliestBlock: number;
|
|
49
|
+
encoding: string;
|
|
50
|
+
paths: {
|
|
51
|
+
blockByHash: string;
|
|
52
|
+
blockByNumber: string;
|
|
53
|
+
head: string;
|
|
54
|
+
payload: string;
|
|
55
|
+
};
|
|
56
|
+
schema: "network.xyo.s3.chain.manifest";
|
|
57
|
+
version: number;
|
|
58
|
+
}) | undefined;
|
|
59
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
60
|
+
earliestBlock: number;
|
|
61
|
+
encoding: string;
|
|
62
|
+
paths: {
|
|
63
|
+
blockByHash: string;
|
|
64
|
+
blockByNumber: string;
|
|
65
|
+
head: string;
|
|
66
|
+
payload: string;
|
|
67
|
+
};
|
|
68
|
+
schema: "network.xyo.s3.chain.manifest";
|
|
69
|
+
version: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** Non-validating cast to ChainManifest. */
|
|
73
|
+
export declare const toChainManifest: {
|
|
74
|
+
<T>(value: T): (T & {
|
|
75
|
+
earliestBlock: number;
|
|
76
|
+
encoding: string;
|
|
77
|
+
paths: {
|
|
78
|
+
blockByHash: string;
|
|
79
|
+
blockByNumber: string;
|
|
80
|
+
head: string;
|
|
81
|
+
payload: string;
|
|
82
|
+
};
|
|
83
|
+
schema: "network.xyo.s3.chain.manifest";
|
|
84
|
+
version: number;
|
|
85
|
+
}) | undefined;
|
|
86
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
87
|
+
earliestBlock: number;
|
|
88
|
+
encoding: string;
|
|
89
|
+
paths: {
|
|
90
|
+
blockByHash: string;
|
|
91
|
+
blockByNumber: string;
|
|
92
|
+
head: string;
|
|
93
|
+
payload: string;
|
|
94
|
+
};
|
|
95
|
+
schema: "network.xyo.s3.chain.manifest";
|
|
96
|
+
version: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/** Builds a validated chain manifest with path templates derived from the path builders. */
|
|
100
|
+
export declare function createChainManifest(encoding: string, earliestBlock?: number): ChainManifest;
|
|
101
|
+
//# sourceMappingURL=chainManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainManifest.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/layout/chainManifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,EAAG,+BAAwC,CAAA;AAC3E,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAA;AAEF,8CAA8C;AAC9C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEtE,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAQ3B,CAAA;AAEF,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE5D,kEAAkE;AAClE,eAAO,MAAM,eAAe;;;;;;;;;;;CAAiC,CAAA;AAC7D,8DAA8D;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAAoD,CAAA;AAChF,4CAA4C;AAC5C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAAoD,CAAA;AAEhF,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,SAAI,GAAG,aAAa,CAQtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import type { IndexSummaryFamily, IndexWatermark } from '@xyo-network/xl1-protocol-lib';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Bumped when the on-disk index layout changes shape, so readers can detect a mismatch. */
|
|
4
|
+
export declare const INDEX_LAYOUT_VERSION = 1;
|
|
5
|
+
/** Schema id for the index manifest document (the static layout descriptor). */
|
|
6
|
+
export declare const IndexManifestSchema: "network.xyo.s3.index.manifest";
|
|
7
|
+
/** Type literal for the index manifest schema. */
|
|
8
|
+
export type IndexManifestSchema = typeof IndexManifestSchema;
|
|
9
|
+
/** Schema id for the index head document (the progress watermark). */
|
|
10
|
+
export declare const IndexHeadSchema: "network.xyo.s3.index.head";
|
|
11
|
+
/** Type literal for the index head schema. */
|
|
12
|
+
export type IndexHeadSchema = typeof IndexHeadSchema;
|
|
13
|
+
/** Per-family descriptor carried in the manifest. */
|
|
14
|
+
export declare const IndexManifestFamilyZod: z.ZodObject<{
|
|
15
|
+
maxStep: z.ZodInt;
|
|
16
|
+
path: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
/** Type for one index manifest family descriptor. */
|
|
19
|
+
export type IndexManifestFamily = z.infer<typeof IndexManifestFamilyZod>;
|
|
20
|
+
/** Zod schema for the static index layout descriptor at `indexManifestPath()`. */
|
|
21
|
+
export declare const IndexManifestZod: z.ZodObject<{
|
|
22
|
+
families: z.ZodObject<{
|
|
23
|
+
balances: z.ZodObject<{
|
|
24
|
+
maxStep: z.ZodInt;
|
|
25
|
+
path: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
blocks: z.ZodObject<{
|
|
28
|
+
maxStep: z.ZodInt;
|
|
29
|
+
path: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
schemas: z.ZodObject<{
|
|
32
|
+
maxStep: z.ZodInt;
|
|
33
|
+
path: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
transfers: z.ZodObject<{
|
|
36
|
+
maxStep: z.ZodInt;
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
schema: z.ZodLiteral<"network.xyo.s3.index.manifest">;
|
|
41
|
+
version: z.ZodInt;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
/** The static index layout descriptor at `indexManifestPath()`. */
|
|
44
|
+
export type IndexManifest = z.infer<typeof IndexManifestZod>;
|
|
45
|
+
/** Type guard that checks if a value is a valid IndexManifest. */
|
|
46
|
+
export declare const isIndexManifest: <T>(value: T) => value is T & {
|
|
47
|
+
families: {
|
|
48
|
+
balances: {
|
|
49
|
+
maxStep: number;
|
|
50
|
+
path: string;
|
|
51
|
+
};
|
|
52
|
+
blocks: {
|
|
53
|
+
maxStep: number;
|
|
54
|
+
path: string;
|
|
55
|
+
};
|
|
56
|
+
schemas: {
|
|
57
|
+
maxStep: number;
|
|
58
|
+
path: string;
|
|
59
|
+
};
|
|
60
|
+
transfers: {
|
|
61
|
+
maxStep: number;
|
|
62
|
+
path: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
schema: "network.xyo.s3.index.manifest";
|
|
66
|
+
version: number;
|
|
67
|
+
};
|
|
68
|
+
/** Converts a value to IndexManifest, throwing if invalid. */
|
|
69
|
+
export declare const asIndexManifest: {
|
|
70
|
+
<T>(value: T): (T & {
|
|
71
|
+
families: {
|
|
72
|
+
balances: {
|
|
73
|
+
maxStep: number;
|
|
74
|
+
path: string;
|
|
75
|
+
};
|
|
76
|
+
blocks: {
|
|
77
|
+
maxStep: number;
|
|
78
|
+
path: string;
|
|
79
|
+
};
|
|
80
|
+
schemas: {
|
|
81
|
+
maxStep: number;
|
|
82
|
+
path: string;
|
|
83
|
+
};
|
|
84
|
+
transfers: {
|
|
85
|
+
maxStep: number;
|
|
86
|
+
path: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
schema: "network.xyo.s3.index.manifest";
|
|
90
|
+
version: number;
|
|
91
|
+
}) | undefined;
|
|
92
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
93
|
+
families: {
|
|
94
|
+
balances: {
|
|
95
|
+
maxStep: number;
|
|
96
|
+
path: string;
|
|
97
|
+
};
|
|
98
|
+
blocks: {
|
|
99
|
+
maxStep: number;
|
|
100
|
+
path: string;
|
|
101
|
+
};
|
|
102
|
+
schemas: {
|
|
103
|
+
maxStep: number;
|
|
104
|
+
path: string;
|
|
105
|
+
};
|
|
106
|
+
transfers: {
|
|
107
|
+
maxStep: number;
|
|
108
|
+
path: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
schema: "network.xyo.s3.index.manifest";
|
|
112
|
+
version: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
/** Non-validating cast to IndexManifest. */
|
|
116
|
+
export declare const toIndexManifest: {
|
|
117
|
+
<T>(value: T): (T & {
|
|
118
|
+
families: {
|
|
119
|
+
balances: {
|
|
120
|
+
maxStep: number;
|
|
121
|
+
path: string;
|
|
122
|
+
};
|
|
123
|
+
blocks: {
|
|
124
|
+
maxStep: number;
|
|
125
|
+
path: string;
|
|
126
|
+
};
|
|
127
|
+
schemas: {
|
|
128
|
+
maxStep: number;
|
|
129
|
+
path: string;
|
|
130
|
+
};
|
|
131
|
+
transfers: {
|
|
132
|
+
maxStep: number;
|
|
133
|
+
path: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
schema: "network.xyo.s3.index.manifest";
|
|
137
|
+
version: number;
|
|
138
|
+
}) | undefined;
|
|
139
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
140
|
+
families: {
|
|
141
|
+
balances: {
|
|
142
|
+
maxStep: number;
|
|
143
|
+
path: string;
|
|
144
|
+
};
|
|
145
|
+
blocks: {
|
|
146
|
+
maxStep: number;
|
|
147
|
+
path: string;
|
|
148
|
+
};
|
|
149
|
+
schemas: {
|
|
150
|
+
maxStep: number;
|
|
151
|
+
path: string;
|
|
152
|
+
};
|
|
153
|
+
transfers: {
|
|
154
|
+
maxStep: number;
|
|
155
|
+
path: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
schema: "network.xyo.s3.index.manifest";
|
|
159
|
+
version: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
/** Completed frame counts per family in the index head watermark. */
|
|
163
|
+
export declare const IndexHeadFamiliesZod: z.ZodObject<{
|
|
164
|
+
balances: z.ZodInt;
|
|
165
|
+
blocks: z.ZodInt;
|
|
166
|
+
schemas: z.ZodInt;
|
|
167
|
+
transfers: z.ZodInt;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
/** Zod schema for the index progress watermark at `indexHeadPath()`. */
|
|
170
|
+
export declare const IndexHeadZod: z.ZodObject<{
|
|
171
|
+
block: z.ZodInt;
|
|
172
|
+
families: z.ZodObject<{
|
|
173
|
+
balances: z.ZodInt;
|
|
174
|
+
blocks: z.ZodInt;
|
|
175
|
+
schemas: z.ZodInt;
|
|
176
|
+
transfers: z.ZodInt;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
hash: z.ZodString;
|
|
179
|
+
schema: z.ZodLiteral<"network.xyo.s3.index.head">;
|
|
180
|
+
updatedAt: z.ZodString;
|
|
181
|
+
version: z.ZodInt;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
/** The index progress watermark at `indexHeadPath()`. */
|
|
184
|
+
export type IndexHead = z.infer<typeof IndexHeadZod>;
|
|
185
|
+
/** Type guard that checks if a value is a valid IndexHead. */
|
|
186
|
+
export declare const isIndexHead: <T>(value: T) => value is T & {
|
|
187
|
+
block: number;
|
|
188
|
+
families: {
|
|
189
|
+
balances: number;
|
|
190
|
+
blocks: number;
|
|
191
|
+
schemas: number;
|
|
192
|
+
transfers: number;
|
|
193
|
+
};
|
|
194
|
+
hash: string;
|
|
195
|
+
schema: "network.xyo.s3.index.head";
|
|
196
|
+
updatedAt: string;
|
|
197
|
+
version: number;
|
|
198
|
+
};
|
|
199
|
+
/** Converts a value to IndexHead, throwing if invalid. */
|
|
200
|
+
export declare const asIndexHead: {
|
|
201
|
+
<T>(value: T): (T & {
|
|
202
|
+
block: number;
|
|
203
|
+
families: {
|
|
204
|
+
balances: number;
|
|
205
|
+
blocks: number;
|
|
206
|
+
schemas: number;
|
|
207
|
+
transfers: number;
|
|
208
|
+
};
|
|
209
|
+
hash: string;
|
|
210
|
+
schema: "network.xyo.s3.index.head";
|
|
211
|
+
updatedAt: string;
|
|
212
|
+
version: number;
|
|
213
|
+
}) | undefined;
|
|
214
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
215
|
+
block: number;
|
|
216
|
+
families: {
|
|
217
|
+
balances: number;
|
|
218
|
+
blocks: number;
|
|
219
|
+
schemas: number;
|
|
220
|
+
transfers: number;
|
|
221
|
+
};
|
|
222
|
+
hash: string;
|
|
223
|
+
schema: "network.xyo.s3.index.head";
|
|
224
|
+
updatedAt: string;
|
|
225
|
+
version: number;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
/** Non-validating cast to IndexHead. */
|
|
229
|
+
export declare const toIndexHead: {
|
|
230
|
+
<T>(value: T): (T & {
|
|
231
|
+
block: number;
|
|
232
|
+
families: {
|
|
233
|
+
balances: number;
|
|
234
|
+
blocks: number;
|
|
235
|
+
schemas: number;
|
|
236
|
+
transfers: number;
|
|
237
|
+
};
|
|
238
|
+
hash: string;
|
|
239
|
+
schema: "network.xyo.s3.index.head";
|
|
240
|
+
updatedAt: string;
|
|
241
|
+
version: number;
|
|
242
|
+
}) | undefined;
|
|
243
|
+
<T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
|
|
244
|
+
block: number;
|
|
245
|
+
families: {
|
|
246
|
+
balances: number;
|
|
247
|
+
blocks: number;
|
|
248
|
+
schemas: number;
|
|
249
|
+
transfers: number;
|
|
250
|
+
};
|
|
251
|
+
hash: string;
|
|
252
|
+
schema: "network.xyo.s3.index.head";
|
|
253
|
+
updatedAt: string;
|
|
254
|
+
version: number;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
/** Builds per-family manifest descriptors with path templates derived from the path builders. */
|
|
258
|
+
export declare function createIndexManifestFamilies(maxSteps: Record<IndexSummaryFamily, number>): Record<IndexSummaryFamily, IndexManifestFamily>;
|
|
259
|
+
/** Builds a validated index manifest with path templates derived from the path builders. */
|
|
260
|
+
export declare function createIndexManifest(maxSteps: Record<IndexSummaryFamily, number>): IndexManifest;
|
|
261
|
+
/** Builds a validated index head watermark from an indexer progress snapshot. */
|
|
262
|
+
export declare function createIndexHead(watermark: IndexWatermark, updatedAt?: string): IndexHead;
|
|
263
|
+
//# sourceMappingURL=indexManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexManifest.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/layout/indexManifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACvF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,EAAG,+BAAwC,CAAA;AAC3E,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,sEAAsE;AACtE,eAAO,MAAM,eAAe,EAAG,2BAAoC,CAAA;AACnE,8CAA8C;AAC9C,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAA;AAEpD,qDAAqD;AACrD,eAAO,MAAM,sBAAsB;;;iBAKjC,CAAA;AAEF,qDAAqD;AACrD,MAAM,MAAM,mBAAm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AAa,CAM/F;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,SAA2B,GAAG,SAAS,CAS1G"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path builders for the chain-state (mutable) bucket.
|
|
3
|
+
*
|
|
4
|
+
* Paths are relative — no leading slash — and joined to a base URL by the consumer.
|
|
5
|
+
*/
|
|
6
|
+
/** The mutable head pointer: the current head SignedHydratedBlockWithHashMeta. */
|
|
7
|
+
export declare const headPath: () => string;
|
|
8
|
+
//# sourceMappingURL=chainState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainState.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/paths/chainState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,kFAAkF;AAClF,eAAO,MAAM,QAAQ,QAAO,MAA2B,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path builders for the finalized (immutable) bucket.
|
|
3
|
+
*
|
|
4
|
+
* Paths are relative — no leading slash — and joined to a base URL by the consumer.
|
|
5
|
+
*/
|
|
6
|
+
/** The finalized layout descriptor (path templates, encoding, version, earliest block). */
|
|
7
|
+
export declare const manifestPath: () => string;
|
|
8
|
+
/** A block by number: SignedHydratedBlockWithHashMeta. */
|
|
9
|
+
export declare const blockNumberPath: (block: number) => string;
|
|
10
|
+
/** A block by hash: the same content as its by-number twin. */
|
|
11
|
+
export declare const blockHashPath: (hash: string) => string;
|
|
12
|
+
/** A payload by hash: WithHashMeta<Payload>. */
|
|
13
|
+
export declare const payloadPath: (hash: string) => string;
|
|
14
|
+
//# sourceMappingURL=finalized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalized.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/paths/finalized.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2FAA2F;AAC3F,eAAO,MAAM,YAAY,QAAO,MAAyB,CAAA;AAEzD,0DAA0D;AAC1D,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,MAAsC,CAAA;AAEtF,+DAA+D;AAC/D,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAmC,CAAA;AAEhF,gDAAgD;AAChD,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAAgC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/paths/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IndexSummaryFamily } from '@xyo-network/xl1-protocol-lib';
|
|
2
|
+
/**
|
|
3
|
+
* Path builders for the index bucket.
|
|
4
|
+
*
|
|
5
|
+
* The index is a separate, single-writer bucket holding completed step summaries for several
|
|
6
|
+
* families. Paths are relative — no leading slash — and joined to a base URL by the consumer.
|
|
7
|
+
*/
|
|
8
|
+
/** A completed frame's summary for a family, e.g. `blocks/2/5.json`. Immutable once written. */
|
|
9
|
+
export declare const indexSummaryPath: (family: IndexSummaryFamily, stepLevel: number, stepIndex: number) => string;
|
|
10
|
+
/** The index layout descriptor (families, max step, encoding, version). */
|
|
11
|
+
export declare const indexManifestPath: () => string;
|
|
12
|
+
/** The indexer's progress watermark (highest block the index is complete through). */
|
|
13
|
+
export declare const indexHeadPath: () => string;
|
|
14
|
+
//# sourceMappingURL=indexPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexPaths.d.ts","sourceRoot":"","sources":["../../../../src/staticRest/paths/indexPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE;;;;;GAKG;AAEH,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,GAAI,QAAQ,kBAAkB,EAAE,WAAW,MAAM,EAAE,WAAW,MAAM,KAAG,MACxD,CAAA;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,QAAO,MAAyB,CAAA;AAE9D,sFAAsF;AACtF,eAAO,MAAM,aAAa,QAAO,MAAqB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IndexSummaryFamily } from '@xyo-network/xl1-protocol-lib';
|
|
2
|
+
/**
|
|
3
|
+
* Replaces concrete slot literals in a path with named `{placeholder}` segments.
|
|
4
|
+
* Used to derive manifest path templates from the path builders so the two cannot drift.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toPathTemplate(path: string, slots: {
|
|
7
|
+
literal: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}[]): string;
|
|
10
|
+
/** Fills `{placeholder}` segments in a manifest path template. Used in conformance tests. */
|
|
11
|
+
export declare function interpolatePathTemplate(template: string, values: Record<string, string | number>): string;
|
|
12
|
+
/** Self-describing template for `blockNumberPath`. */
|
|
13
|
+
export declare const blockNumberPathTemplate: () => string;
|
|
14
|
+
/** Self-describing template for `blockHashPath`. */
|
|
15
|
+
export declare const blockHashPathTemplate: () => string;
|
|
16
|
+
/** Self-describing template for `payloadPath`. */
|
|
17
|
+
export declare const payloadPathTemplate: () => string;
|
|
18
|
+
/** Self-describing templates for finalized + chain-state files carried in the chain manifest. */
|
|
19
|
+
export declare function chainManifestPathTemplates(): {
|
|
20
|
+
blockByHash: string;
|
|
21
|
+
blockByNumber: string;
|
|
22
|
+
head: string;
|
|
23
|
+
payload: string;
|
|
24
|
+
};
|
|
25
|
+
/** Self-describing template for one index summary family, e.g. `blocks/{level}/{index}.json`. */
|
|
26
|
+
export declare function indexSummaryPathTemplate(family: IndexSummaryFamily): string;
|
|
27
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/staticRest/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAgBvE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAS/F;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAMzG;AAED,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,QAAO,MACwE,CAAA;AAEnH,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,QAAO,MAC6D,CAAA;AAEtG,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,QAAO,MAC6D,CAAA;AAEpG,iGAAiG;AACjG,wBAAgB,0BAA0B,IAAI;IAC5C,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAOA;AAED,iGAAiG;AACjG,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAM3E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/xl1-network-model",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "XYO Layer One API",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xyo-network/xl1-protocol-lib": "~2.
|
|
46
|
+
"@xyo-network/xl1-protocol-lib": "~2.2.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@bitauth/libauth": "~3.0.0",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"@xylabs/threads": "^6.1.3",
|
|
59
59
|
"@xylabs/toolchain": "~8.1.21",
|
|
60
60
|
"@xylabs/tsconfig": "~8.1.21",
|
|
61
|
-
"@xyo-network/address": "^6.1.1",
|
|
62
61
|
"@xyo-network/sdk-js": "^6.1.0",
|
|
63
62
|
"@xyo-network/sdk-protocol-js": "~6.1.1",
|
|
64
63
|
"ajv": "^8.20.0",
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
"@xylabs/geo": "^6.0",
|
|
89
88
|
"@xylabs/sdk-js": "^6.0",
|
|
90
89
|
"@xylabs/threads": "^6.1",
|
|
91
|
-
"@xyo-network/address": "^6.0",
|
|
92
90
|
"@xyo-network/sdk-js": "^6.0",
|
|
93
91
|
"@xyo-network/sdk-protocol-js": "~6.1",
|
|
94
92
|
"ajv": "^8.20",
|