@xyo-network/xl1-protocol-sdk 1.10.2 → 1.12.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/config/Api.d.ts +5 -13
- package/dist/neutral/config/Api.d.ts.map +1 -1
- package/dist/neutral/config/App.d.ts +4 -7
- package/dist/neutral/config/App.d.ts.map +1 -1
- package/dist/neutral/config/Chain.d.ts +3 -6
- package/dist/neutral/config/Chain.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +39 -225
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Evm.d.ts +11 -49
- package/dist/neutral/config/Evm.d.ts.map +1 -1
- package/dist/neutral/config/Log.d.ts +12 -7
- package/dist/neutral/config/Log.d.ts.map +1 -1
- package/dist/neutral/config/Producer.d.ts +7 -20
- package/dist/neutral/config/Producer.d.ts.map +1 -1
- package/dist/neutral/config/Telemetry.d.ts +8 -24
- package/dist/neutral/config/Telemetry.d.ts.map +1 -1
- package/dist/neutral/config/UsageMeta.d.ts +27 -0
- package/dist/neutral/config/UsageMeta.d.ts.map +1 -0
- package/dist/neutral/config/index.d.ts +1 -0
- package/dist/neutral/config/index.d.ts.map +1 -1
- package/dist/neutral/config/storage/Storage.d.ts +4 -34
- package/dist/neutral/config/storage/Storage.d.ts.map +1 -1
- package/dist/neutral/config/storage/driver/Mongo.d.ts +3 -15
- package/dist/neutral/config/storage/driver/Mongo.d.ts.map +1 -1
- package/dist/neutral/index.mjs +215 -72
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/instances/transaction/HydratedTransaction.d.ts +2 -2
- package/dist/neutral/instances/transaction/HydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/payload/netBalancesForPayloads.d.ts +5 -2
- package/dist/neutral/payload/netBalancesForPayloads.d.ts.map +1 -1
- package/dist/neutral/transaction/buildTransaction.d.ts +3 -3
- package/dist/neutral/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts +3 -3
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts +2 -2
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/hydrateTransaction.d.ts +7 -7
- package/dist/neutral/transaction/hydrateTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionBlockByteCount.d.ts +2 -2
- package/dist/neutral/transaction/primitives/transactionBlockByteCount.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts +2 -2
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionRequiredGas.d.ts +3 -3
- package/dist/neutral/transaction/primitives/transactionRequiredGas.d.ts.map +1 -1
- package/dist/neutral/transaction/script.d.ts +3 -3
- package/dist/neutral/transaction/script.d.ts.map +1 -1
- package/dist/neutral/transaction/signTransaction.d.ts +1 -1
- package/dist/neutral/transaction/signTransaction.d.ts.map +1 -1
- package/dist/neutral/validation/schema/Mnemonic.d.ts +2 -2
- package/dist/neutral/validation/schema/Mnemonic.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/config/Api.ts +21 -7
- package/src/config/App.ts +11 -2
- package/src/config/Chain.ts +10 -3
- package/src/config/Config.ts +19 -25
- package/src/config/Evm.ts +29 -12
- package/src/config/Log.ts +18 -2
- package/src/config/Producer.ts +36 -9
- package/src/config/Telemetry.ts +10 -6
- package/src/config/UsageMeta.ts +41 -0
- package/src/config/index.ts +1 -0
- package/src/config/storage/Storage.ts +10 -6
- package/src/config/storage/driver/Mongo.ts +28 -8
- package/src/instances/transaction/HydratedTransaction.ts +2 -2
- package/src/transaction/buildTransaction.ts +5 -4
- package/src/transaction/buildUnsignedTransaction.ts +5 -4
- package/src/transaction/confirmSubmittedTransaction.ts +2 -2
- package/src/transaction/hydrateTransaction.ts +12 -12
- package/src/transaction/primitives/spec/transactionBlockByteCount.spec.ts +7 -7
- package/src/transaction/primitives/transactionBlockByteCount.ts +2 -2
- package/src/transaction/primitives/transactionElevatedPayloads.ts +2 -2
- package/src/transaction/primitives/transactionRequiredGas.ts +3 -3
- package/src/transaction/script.ts +3 -3
- package/src/transaction/signTransaction.ts +5 -5
- package/src/validation/schema/Mnemonic.ts +2 -2
|
@@ -7,24 +7,12 @@ import z from 'zod';
|
|
|
7
7
|
* establishing a connection
|
|
8
8
|
*/
|
|
9
9
|
export declare const hasMongoConfig: (config?: MongoConfig) => config is Required<MongoConfig>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const MongoConfigZod: z.ZodObject<{
|
|
11
11
|
connectionString: z.ZodOptional<z.ZodString>;
|
|
12
12
|
database: z.ZodOptional<z.ZodString>;
|
|
13
13
|
domain: z.ZodOptional<z.ZodString>;
|
|
14
14
|
password: z.ZodOptional<z.ZodString>;
|
|
15
15
|
username: z.ZodOptional<z.ZodString>;
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
database?: string | undefined;
|
|
19
|
-
domain?: string | undefined;
|
|
20
|
-
password?: string | undefined;
|
|
21
|
-
username?: string | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
connectionString?: string | undefined;
|
|
24
|
-
database?: string | undefined;
|
|
25
|
-
domain?: string | undefined;
|
|
26
|
-
password?: string | undefined;
|
|
27
|
-
username?: string | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
export type MongoConfig = z.infer<typeof MongoConfigSchema>;
|
|
16
|
+
}, z.z.core.$strip>;
|
|
17
|
+
export type MongoConfig = z.infer<typeof MongoConfigZod>;
|
|
30
18
|
//# sourceMappingURL=Mongo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mongo.d.ts","sourceRoot":"","sources":["../../../../../src/config/storage/driver/Mongo.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Mongo.d.ts","sourceRoot":"","sources":["../../../../../src/config/storage/driver/Mongo.ts"],"names":[],"mappings":"AACA,OAAO,CAAqB,MAAM,KAAK,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,KAAG,MAAM,IAAI,QAAQ,CAAC,WAAW,CASnF,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;mBA2BzB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -289,11 +289,10 @@ async function balanceSummary(context) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/config/Config.ts
|
|
292
|
-
import
|
|
293
|
-
import z10 from "zod";
|
|
292
|
+
import z11 from "zod";
|
|
294
293
|
|
|
295
294
|
// src/config/Api.ts
|
|
296
|
-
import z2 from "zod";
|
|
295
|
+
import z2, { globalRegistry } from "zod";
|
|
297
296
|
|
|
298
297
|
// src/validation/lib/isLocalhost.ts
|
|
299
298
|
var isLocalhost = (hostname) => {
|
|
@@ -311,110 +310,250 @@ var TODO = true;
|
|
|
311
310
|
|
|
312
311
|
// src/validation/schema/Mnemonic.ts
|
|
313
312
|
import { z } from "zod";
|
|
314
|
-
var
|
|
313
|
+
var MnemonicStringZod = z.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
315
314
|
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
316
315
|
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
317
316
|
).describe("BIP-39 mnemonic string");
|
|
318
317
|
|
|
319
318
|
// src/config/Api.ts
|
|
320
|
-
var
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
var ApiConfigZod = z2.object({
|
|
320
|
+
host: z2.string().default("localhost").register(globalRegistry, {
|
|
321
|
+
default: "localhost",
|
|
322
|
+
description: "Host for the API",
|
|
323
|
+
title: "api.host",
|
|
324
|
+
type: "string"
|
|
325
|
+
}),
|
|
326
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry, {
|
|
327
|
+
description: "Mnemonic for the API wallet",
|
|
328
|
+
title: "api.mnemonic",
|
|
329
|
+
type: "string"
|
|
330
|
+
}),
|
|
331
|
+
port: z2.coerce.number().default(8080).register(globalRegistry, {
|
|
332
|
+
default: 8080,
|
|
333
|
+
description: "Port for the API",
|
|
334
|
+
title: "api.port",
|
|
335
|
+
type: "number"
|
|
336
|
+
})
|
|
324
337
|
});
|
|
325
338
|
|
|
326
339
|
// src/config/App.ts
|
|
327
|
-
import z3 from "zod";
|
|
328
|
-
var
|
|
340
|
+
import z3, { globalRegistry as globalRegistry2 } from "zod";
|
|
341
|
+
var AppConfigZod = z3.object({
|
|
342
|
+
port: z3.coerce.number().default(3e3).register(globalRegistry2, {
|
|
343
|
+
default: 3e3,
|
|
344
|
+
description: "Port for the application",
|
|
345
|
+
title: "app.port",
|
|
346
|
+
type: "number"
|
|
347
|
+
})
|
|
348
|
+
});
|
|
329
349
|
|
|
330
350
|
// src/config/Chain.ts
|
|
331
|
-
import z4 from "zod";
|
|
332
|
-
var
|
|
333
|
-
id: z4.string().optional().
|
|
351
|
+
import z4, { globalRegistry as globalRegistry3 } from "zod";
|
|
352
|
+
var ChainConfigZod = z4.object({
|
|
353
|
+
id: z4.string().optional().register(globalRegistry3, {
|
|
354
|
+
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
355
|
+
title: "chain.id",
|
|
356
|
+
type: "string"
|
|
357
|
+
})
|
|
334
358
|
});
|
|
335
359
|
|
|
336
360
|
// src/config/Evm.ts
|
|
337
|
-
import z5 from "zod";
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
361
|
+
import z5, { globalRegistry as globalRegistry4 } from "zod";
|
|
362
|
+
var EvmInfuraConfigZod = z5.object({
|
|
363
|
+
projectId: z5.string().optional().register(globalRegistry4, {
|
|
364
|
+
description: "Infura project ID",
|
|
365
|
+
title: "evm.infura.projectId",
|
|
366
|
+
type: "string"
|
|
367
|
+
}),
|
|
368
|
+
projectSecret: z5.string().optional().register(globalRegistry4, {
|
|
369
|
+
description: "Infura project secret",
|
|
370
|
+
title: "evm.infura.projectSecret",
|
|
371
|
+
type: "string"
|
|
372
|
+
})
|
|
341
373
|
});
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
374
|
+
var EvmJsonRpcConfigZod = z5.object({
|
|
375
|
+
url: z5.url().optional().register(globalRegistry4, {
|
|
376
|
+
description: "JSON-RPC URL",
|
|
377
|
+
title: "evm.jsonRpc.url",
|
|
378
|
+
type: "string"
|
|
379
|
+
})
|
|
345
380
|
});
|
|
346
|
-
var
|
|
347
|
-
chainId: z5.string().optional().
|
|
348
|
-
|
|
349
|
-
|
|
381
|
+
var EvmConfigZod = z5.object({
|
|
382
|
+
chainId: z5.string().optional().register(globalRegistry4, {
|
|
383
|
+
description: "EVM chain ID",
|
|
384
|
+
title: "evm.chainId",
|
|
385
|
+
type: "string"
|
|
386
|
+
}),
|
|
387
|
+
infura: EvmInfuraConfigZod.optional().describe("Infura Provider configuration"),
|
|
388
|
+
jsonRpc: EvmJsonRpcConfigZod.optional().describe("JSON-RPC Provider configuration")
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// src/config/Log.ts
|
|
392
|
+
import { LogLevel } from "@xylabs/logger";
|
|
393
|
+
import z6, { globalRegistry as globalRegistry5 } from "zod";
|
|
394
|
+
var LogLevels = Object.keys(LogLevel);
|
|
395
|
+
var LogConfigZod = z6.object({
|
|
396
|
+
logLevel: z6.enum(LogLevels).default("info").register(globalRegistry5, {
|
|
397
|
+
choices: LogLevels,
|
|
398
|
+
default: "info",
|
|
399
|
+
description: "Desired process verbosity",
|
|
400
|
+
title: "logLevel",
|
|
401
|
+
type: "string"
|
|
402
|
+
}),
|
|
403
|
+
silent: z6.boolean().default(false).register(globalRegistry5, {
|
|
404
|
+
default: false,
|
|
405
|
+
description: "Whether to run in silent mode",
|
|
406
|
+
title: "silent",
|
|
407
|
+
type: "boolean"
|
|
408
|
+
})
|
|
350
409
|
});
|
|
351
410
|
|
|
352
411
|
// src/config/Producer.ts
|
|
353
|
-
import
|
|
354
|
-
var
|
|
412
|
+
import z7, { globalRegistry as globalRegistry6 } from "zod";
|
|
413
|
+
var ProducerConfigZod = z7.object({
|
|
414
|
+
disableIntentRedeclaration: z7.boolean().optional().register(globalRegistry6, {
|
|
415
|
+
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
416
|
+
title: "producer.disableIntentRedeclaration",
|
|
417
|
+
type: "boolean"
|
|
418
|
+
}),
|
|
355
419
|
// TODO: Port schema
|
|
356
|
-
healthCheckPort:
|
|
420
|
+
healthCheckPort: z7.coerce.number().optional().register(globalRegistry6, {
|
|
421
|
+
description: "Port for the Producer health checks",
|
|
422
|
+
title: "producer.healthCheckPort",
|
|
423
|
+
type: "number"
|
|
424
|
+
}),
|
|
357
425
|
// TODO: BigInt schema
|
|
358
|
-
minStake:
|
|
359
|
-
|
|
426
|
+
minStake: z7.coerce.number().default(1).register(globalRegistry6, {
|
|
427
|
+
description: "Minimum stake required to be a Producer",
|
|
428
|
+
title: "producer.minStake",
|
|
429
|
+
type: "number"
|
|
430
|
+
}),
|
|
431
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry6, {
|
|
432
|
+
description: "Mnemonic for the Producer wallet",
|
|
433
|
+
title: "producer.mnemonic",
|
|
434
|
+
type: "string"
|
|
435
|
+
}),
|
|
360
436
|
// TODO: Port schema
|
|
361
|
-
port:
|
|
362
|
-
|
|
437
|
+
port: z7.coerce.number().default(8081).register(globalRegistry6, {
|
|
438
|
+
default: 8081,
|
|
439
|
+
description: "Port for the Producer",
|
|
440
|
+
title: "producer.port",
|
|
441
|
+
type: "number"
|
|
442
|
+
}),
|
|
363
443
|
// TODO: Address schema
|
|
364
|
-
rewardAddress:
|
|
444
|
+
rewardAddress: z7.string().optional().register(globalRegistry6, {
|
|
445
|
+
description: "Address to receive block rewards",
|
|
446
|
+
title: "producer.rewardAddress",
|
|
447
|
+
type: "string"
|
|
448
|
+
})
|
|
365
449
|
});
|
|
366
450
|
|
|
367
451
|
// src/config/storage/driver/Mongo.ts
|
|
368
452
|
import { isDefined as isDefined2, isUndefined } from "@xylabs/typeof";
|
|
369
|
-
import
|
|
453
|
+
import z8, { globalRegistry as globalRegistry7 } from "zod";
|
|
370
454
|
var hasMongoConfig = (config) => {
|
|
371
455
|
if (isUndefined(config)) return false;
|
|
372
456
|
return isDefined2(config.connectionString) && isDefined2(config.database) && isDefined2(config.domain) && isDefined2(config.password) && isDefined2(config.username);
|
|
373
457
|
};
|
|
374
|
-
var
|
|
458
|
+
var MongoConfigZod = z8.object({
|
|
375
459
|
// TODO: Create from other arguments
|
|
376
|
-
connectionString:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
460
|
+
connectionString: z8.string().min(1).optional().register(globalRegistry7, {
|
|
461
|
+
description: "MongoDB connection string",
|
|
462
|
+
title: "storage.mongo.connectionString",
|
|
463
|
+
type: "string"
|
|
464
|
+
}),
|
|
465
|
+
database: z8.string().min(1).optional().register(globalRegistry7, {
|
|
466
|
+
description: "MongoDB database name",
|
|
467
|
+
title: "storage.mongo.database",
|
|
468
|
+
type: "string"
|
|
469
|
+
}),
|
|
470
|
+
domain: z8.string().min(1).optional().register(globalRegistry7, {
|
|
471
|
+
description: "MongoDB domain",
|
|
472
|
+
title: "storage.mongo.domain",
|
|
473
|
+
type: "string"
|
|
474
|
+
}),
|
|
475
|
+
password: z8.string().min(1).optional().register(globalRegistry7, {
|
|
476
|
+
description: "MongoDB password",
|
|
477
|
+
title: "storage.mongo.password",
|
|
478
|
+
type: "string"
|
|
479
|
+
}),
|
|
480
|
+
username: z8.string().min(1).optional().register(globalRegistry7, {
|
|
481
|
+
description: "MongoDB username",
|
|
482
|
+
title: "storage.mongo.username",
|
|
483
|
+
type: "string"
|
|
484
|
+
})
|
|
381
485
|
});
|
|
382
486
|
|
|
383
487
|
// src/config/storage/Storage.ts
|
|
384
|
-
import
|
|
385
|
-
var
|
|
386
|
-
mongo:
|
|
387
|
-
root:
|
|
488
|
+
import z9, { globalRegistry as globalRegistry8 } from "zod";
|
|
489
|
+
var StorageConfigZod = z9.object({
|
|
490
|
+
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
491
|
+
root: z9.string().optional().register(globalRegistry8, {
|
|
492
|
+
description: "Root directory for local storage",
|
|
493
|
+
title: "storage.root",
|
|
494
|
+
type: "string"
|
|
495
|
+
})
|
|
388
496
|
}).describe("Storage configuration options");
|
|
389
497
|
|
|
390
498
|
// src/config/Telemetry.ts
|
|
391
|
-
import
|
|
392
|
-
var
|
|
499
|
+
import z10, { globalRegistry as globalRegistry9 } from "zod";
|
|
500
|
+
var OpenTelemetryConfigZod = z10.object({
|
|
393
501
|
// OpenTelemetry options
|
|
394
|
-
otlpEndpoint:
|
|
502
|
+
otlpEndpoint: z10.url().optional().register(globalRegistry9, {
|
|
503
|
+
description: "OTLP endpoint for exporting telemetry data",
|
|
504
|
+
title: "telemetry.otel.otlpEndpoint",
|
|
505
|
+
type: "string"
|
|
506
|
+
})
|
|
395
507
|
});
|
|
396
|
-
var
|
|
508
|
+
var TelemetryConfigZod = z10.object({
|
|
397
509
|
// OpenTelemetry configuration
|
|
398
|
-
otel:
|
|
510
|
+
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
399
511
|
}).describe("Telemetry configuration options");
|
|
400
512
|
|
|
401
513
|
// src/config/Config.ts
|
|
402
|
-
var
|
|
403
|
-
var
|
|
404
|
-
silent: z10.boolean().default(false).describe("Whether to run in silent mode"),
|
|
405
|
-
logLevel: z10.enum(LogLevels).default("info").describe("Desired process verbosity")
|
|
406
|
-
}).describe("XL1 common configuration options");
|
|
407
|
-
var ConfigSchema = z10.object({
|
|
514
|
+
var Xl1CommonConfigSchema = z11.object({ ...LogConfigZod.shape }).describe("XL1 common configuration options");
|
|
515
|
+
var ConfigZod = z11.object({
|
|
408
516
|
...Xl1CommonConfigSchema.shape,
|
|
409
|
-
api:
|
|
410
|
-
app:
|
|
411
|
-
chain:
|
|
412
|
-
evm:
|
|
413
|
-
producer:
|
|
414
|
-
storage:
|
|
415
|
-
telemetry:
|
|
517
|
+
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
518
|
+
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
519
|
+
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
520
|
+
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
521
|
+
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
522
|
+
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
523
|
+
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry")
|
|
416
524
|
});
|
|
417
|
-
var getDefaultConfig = () =>
|
|
525
|
+
var getDefaultConfig = () => ConfigZod.parse({});
|
|
526
|
+
|
|
527
|
+
// src/config/UsageMeta.ts
|
|
528
|
+
import z12 from "zod";
|
|
529
|
+
var DescriptionSchema = z12.string();
|
|
530
|
+
var TitleSchema = z12.string();
|
|
531
|
+
var JSONSchemaMetaSchema = z12.object({
|
|
532
|
+
id: z12.string().optional(),
|
|
533
|
+
title: TitleSchema.optional(),
|
|
534
|
+
description: DescriptionSchema.optional(),
|
|
535
|
+
deprecated: z12.boolean().optional()
|
|
536
|
+
}).catchall(z12.unknown());
|
|
537
|
+
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
538
|
+
var ChoicesSchema = z12.array(z12.union([z12.string(), z12.number(), z12.literal(true), z12.undefined()])).readonly();
|
|
539
|
+
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
540
|
+
choices: ChoicesSchema.optional(),
|
|
541
|
+
default: z12.unknown().optional(),
|
|
542
|
+
description: DescriptionSchema,
|
|
543
|
+
group: z12.string().optional(),
|
|
544
|
+
hidden: z12.boolean().optional(),
|
|
545
|
+
title: TitleSchema,
|
|
546
|
+
type: z12.union([
|
|
547
|
+
z12.literal("array"),
|
|
548
|
+
z12.literal("count"),
|
|
549
|
+
z12.literal("boolean"),
|
|
550
|
+
z12.literal("number"),
|
|
551
|
+
z12.literal("string")
|
|
552
|
+
])
|
|
553
|
+
});
|
|
554
|
+
function isUsageMeta(v) {
|
|
555
|
+
return UsageMetaSchema.safeParse(v).success;
|
|
556
|
+
}
|
|
418
557
|
|
|
419
558
|
// src/transaction/buildTransaction.ts
|
|
420
559
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
@@ -518,19 +657,19 @@ var confirmSubmittedTransaction = async (viewer, transaction, options) => {
|
|
|
518
657
|
// src/transaction/hydrateTransaction.ts
|
|
519
658
|
import { assertEx as assertEx4 } from "@xylabs/assert";
|
|
520
659
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
521
|
-
import { isAllowedBlockPayload,
|
|
660
|
+
import { isAllowedBlockPayload, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
522
661
|
var tryHydrateTransaction = async (archivist, hash) => {
|
|
523
662
|
return await tryHydrateTypedBoundWitness(
|
|
524
663
|
archivist,
|
|
525
664
|
hash,
|
|
526
|
-
|
|
665
|
+
isSignedTransactionBoundWitnessWithStorageMeta
|
|
527
666
|
);
|
|
528
667
|
};
|
|
529
668
|
var hydrateTransaction = async (archivist, hash) => {
|
|
530
669
|
return await hydrateTypedBoundWitness(
|
|
531
670
|
archivist,
|
|
532
671
|
hash,
|
|
533
|
-
|
|
672
|
+
isSignedTransactionBoundWitnessWithStorageMeta
|
|
534
673
|
);
|
|
535
674
|
};
|
|
536
675
|
var flattenHydratedTransaction = (hydratedTransaction) => {
|
|
@@ -647,14 +786,14 @@ import { toArrayBuffer } from "@xylabs/arraybuffer";
|
|
|
647
786
|
import { assertEx as assertEx6 } from "@xylabs/assert";
|
|
648
787
|
import { hexFromArrayBuffer } from "@xylabs/hex";
|
|
649
788
|
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
650
|
-
async function signTransaction(tx,
|
|
651
|
-
assertEx6(tx.from ===
|
|
789
|
+
async function signTransaction(tx, account) {
|
|
790
|
+
assertEx6(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
652
791
|
const signedTx = structuredClone(tx);
|
|
653
|
-
signedTx.addresses = [
|
|
654
|
-
signedTx.previous_hashes = [
|
|
792
|
+
signedTx.addresses = [account.address];
|
|
793
|
+
signedTx.previous_hashes = [account.previousHash ?? null];
|
|
655
794
|
const hash = await PayloadBuilder6.hash(signedTx);
|
|
656
795
|
const hashBytes = toArrayBuffer(hash);
|
|
657
|
-
const [signature] = await
|
|
796
|
+
const [signature] = await account.sign(hashBytes);
|
|
658
797
|
signedTx.$signatures = [hexFromArrayBuffer(signature)];
|
|
659
798
|
return signedTx;
|
|
660
799
|
}
|
|
@@ -681,11 +820,14 @@ export {
|
|
|
681
820
|
BalancesStepSummarySchema,
|
|
682
821
|
CHANGE_ADDRESS,
|
|
683
822
|
COIN_TYPES,
|
|
684
|
-
|
|
823
|
+
ConfigZod,
|
|
685
824
|
DEFAULT_WALLET_PATH,
|
|
686
|
-
|
|
825
|
+
GlobalMetaSchema,
|
|
826
|
+
JSONSchemaMetaSchema,
|
|
827
|
+
MnemonicStringZod,
|
|
687
828
|
StepSummarySchema,
|
|
688
829
|
TODO,
|
|
830
|
+
UsageMetaSchema,
|
|
689
831
|
WALLET_COMPLIANCE,
|
|
690
832
|
Xl1CommonConfigSchema,
|
|
691
833
|
allHashesPresent,
|
|
@@ -720,6 +862,7 @@ export {
|
|
|
720
862
|
isLocalhost,
|
|
721
863
|
isNegativeBigInt,
|
|
722
864
|
isPositiveBigInt,
|
|
865
|
+
isUsageMeta,
|
|
723
866
|
netBalancesForPayloads,
|
|
724
867
|
parseSignedBigInt,
|
|
725
868
|
signTransaction,
|