@hardkas/artifacts 0.9.0-alpha → 0.9.2-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -44
- package/dist/index.d.ts +763 -12
- package/dist/index.js +309 -131
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@hardkas/artifacts",
|
|
4
|
-
version: "0.9.
|
|
4
|
+
version: "0.9.2-alpha",
|
|
5
5
|
type: "module",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
author: "Javier Rodriguez",
|
|
@@ -47,32 +47,42 @@ var package_default = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
// src/constants.ts
|
|
50
|
+
import { HardkasSchemas } from "@hardkas/core";
|
|
50
51
|
var HARDKAS_VERSION = package_default.version;
|
|
51
52
|
var ARTIFACT_SCHEMAS = {
|
|
52
|
-
LOCALNET_STATE:
|
|
53
|
-
REAL_ACCOUNT_STORE:
|
|
54
|
-
TX_PLAN:
|
|
55
|
-
SIGNED_TX:
|
|
56
|
-
TX_RECEIPT:
|
|
57
|
-
TX_TRACE:
|
|
58
|
-
SNAPSHOT:
|
|
59
|
-
IGRA_TX_PLAN:
|
|
60
|
-
IGRA_SIGNED_TX:
|
|
61
|
-
IGRA_TX_RECEIPT:
|
|
62
|
-
POLICY:
|
|
63
|
-
NETWORK_PROFILE:
|
|
64
|
-
ASSUMPTION:
|
|
65
|
-
MIGRATION_RECEIPT:
|
|
66
|
-
SILVER_COMPILE:
|
|
67
|
-
SILVER_TEST:
|
|
68
|
-
SILVER_DEPLOY_PLAN:
|
|
69
|
-
SILVER_DEPLOY:
|
|
70
|
-
SILVER_SPEND_PLAN:
|
|
71
|
-
SILVER_SPEND_RECEIPT:
|
|
72
|
-
SILVER_DEPLOY_SIMULATION:
|
|
73
|
-
SILVER_SPEND_SIMULATION:
|
|
53
|
+
LOCALNET_STATE: HardkasSchemas.LocalnetStateV1,
|
|
54
|
+
REAL_ACCOUNT_STORE: HardkasSchemas.RealAccountStoreV1,
|
|
55
|
+
TX_PLAN: HardkasSchemas.TxPlan,
|
|
56
|
+
SIGNED_TX: HardkasSchemas.SignedTx,
|
|
57
|
+
TX_RECEIPT: HardkasSchemas.TxReceipt,
|
|
58
|
+
TX_TRACE: HardkasSchemas.TxTrace,
|
|
59
|
+
SNAPSHOT: HardkasSchemas.Snapshot,
|
|
60
|
+
IGRA_TX_PLAN: HardkasSchemas.IgraTxPlanV1,
|
|
61
|
+
IGRA_SIGNED_TX: HardkasSchemas.IgraSignedTxV1,
|
|
62
|
+
IGRA_TX_RECEIPT: HardkasSchemas.IgraTxReceiptV1,
|
|
63
|
+
POLICY: HardkasSchemas.PolicyV1,
|
|
64
|
+
NETWORK_PROFILE: HardkasSchemas.NetworkProfileV1,
|
|
65
|
+
ASSUMPTION: HardkasSchemas.AssumptionV1,
|
|
66
|
+
MIGRATION_RECEIPT: HardkasSchemas.MigrationReceiptV1,
|
|
67
|
+
SILVER_COMPILE: HardkasSchemas.SilverCompile,
|
|
68
|
+
SILVER_TEST: HardkasSchemas.SilverTest,
|
|
69
|
+
SILVER_DEPLOY_PLAN: HardkasSchemas.SilverDeployPlan,
|
|
70
|
+
SILVER_DEPLOY: HardkasSchemas.SilverDeploy,
|
|
71
|
+
SILVER_SPEND_PLAN: HardkasSchemas.SilverSpendPlan,
|
|
72
|
+
SILVER_SPEND_RECEIPT: HardkasSchemas.SilverSpendReceipt,
|
|
73
|
+
SILVER_DEPLOY_SIMULATION: HardkasSchemas.SilverDeploySimulation,
|
|
74
|
+
SILVER_SPEND_SIMULATION: HardkasSchemas.SilverSpendSimulation,
|
|
75
|
+
PROGRAMMABILITY_CAPABILITIES: HardkasSchemas.ProgrammabilityCapabilitiesV1,
|
|
76
|
+
PROGRAMMABILITY_INSPECT: HardkasSchemas.ProgrammabilityInspectV1,
|
|
77
|
+
PROGRAMMABILITY_VERIFY: HardkasSchemas.ProgrammabilityVerifyV1,
|
|
78
|
+
PROGRAMMABILITY_CORPUS_REPORT: HardkasSchemas.ProgrammabilityCorpusReportV1,
|
|
79
|
+
PROGRAMMABILITY_APP_PLAN: HardkasSchemas.ProgrammabilityAppPlanV1,
|
|
80
|
+
TOCCATA_PROGRAMMABILITY_CORPUS: HardkasSchemas.ToccataProgrammabilityCorpusV1
|
|
74
81
|
};
|
|
75
82
|
|
|
83
|
+
// src/index.ts
|
|
84
|
+
import { HardkasSchemas as HardkasSchemas11, ArtifactTypes, isKnownArtifactType, assertKnownArtifactType, describeArtifactType } from "@hardkas/core";
|
|
85
|
+
|
|
76
86
|
// src/igra-artifacts.ts
|
|
77
87
|
function isIgraTxPlanArtifact(value) {
|
|
78
88
|
return validateIgraTxPlanArtifact(value).ok;
|
|
@@ -348,6 +358,7 @@ function calculateContentHash(obj, version = CURRENT_HASH_VERSION) {
|
|
|
348
358
|
|
|
349
359
|
// src/schemas.ts
|
|
350
360
|
import { z } from "zod";
|
|
361
|
+
import { HardkasSchemas as HardkasSchemas2 } from "@hardkas/core";
|
|
351
362
|
import {
|
|
352
363
|
kaspaNetworkIdSchema,
|
|
353
364
|
executionModeSchema
|
|
@@ -400,7 +411,7 @@ var AccountRefSchema = z.object({
|
|
|
400
411
|
input: z.string().optional()
|
|
401
412
|
});
|
|
402
413
|
var PolicySchema = BaseArtifactSchema.extend({
|
|
403
|
-
schema: z.literal(
|
|
414
|
+
schema: z.literal(HardkasSchemas2.PolicyV1),
|
|
404
415
|
decision: z.enum(["ALLOW", "DENY"]),
|
|
405
416
|
rules: z.array(
|
|
406
417
|
z.object({
|
|
@@ -411,13 +422,13 @@ var PolicySchema = BaseArtifactSchema.extend({
|
|
|
411
422
|
)
|
|
412
423
|
});
|
|
413
424
|
var NetworkProfileSchema = BaseArtifactSchema.extend({
|
|
414
|
-
schema: z.literal(
|
|
425
|
+
schema: z.literal(HardkasSchemas2.NetworkProfileV1),
|
|
415
426
|
networkProfileId: z.string(),
|
|
416
427
|
layer: z.string(),
|
|
417
428
|
capabilities: z.record(z.any())
|
|
418
429
|
});
|
|
419
430
|
var AssumptionSchema = BaseArtifactSchema.extend({
|
|
420
|
-
schema: z.literal(
|
|
431
|
+
schema: z.literal(HardkasSchemas2.AssumptionV1),
|
|
421
432
|
settlement: z.string().optional(),
|
|
422
433
|
securityModel: z.string().optional(),
|
|
423
434
|
bridgePhase: z.string().optional(),
|
|
@@ -425,7 +436,7 @@ var AssumptionSchema = BaseArtifactSchema.extend({
|
|
|
425
436
|
customAssumptions: z.record(z.any()).optional()
|
|
426
437
|
});
|
|
427
438
|
var MigrationReceiptSchema = BaseArtifactSchema.extend({
|
|
428
|
-
schema: z.literal(
|
|
439
|
+
schema: z.literal(HardkasSchemas2.MigrationReceiptV1),
|
|
429
440
|
oldHash: z.string(),
|
|
430
441
|
newHash: z.string(),
|
|
431
442
|
fromSchema: z.string(),
|
|
@@ -435,7 +446,7 @@ var MigrationReceiptSchema = BaseArtifactSchema.extend({
|
|
|
435
446
|
decision: z.literal("MIGRATED_WITH_PROOF")
|
|
436
447
|
});
|
|
437
448
|
var TxPlanSchema = BaseArtifactSchema.extend({
|
|
438
|
-
schema: z.literal(
|
|
449
|
+
schema: z.literal(HardkasSchemas2.TxPlan),
|
|
439
450
|
networkId: kaspaNetworkIdSchema,
|
|
440
451
|
mode: executionModeSchema,
|
|
441
452
|
planId: z.string(),
|
|
@@ -497,7 +508,7 @@ var LocalnetUtxoSchemaV2 = z.object({
|
|
|
497
508
|
createdAtDaaScore: z.string()
|
|
498
509
|
});
|
|
499
510
|
var SnapshotSchema = BaseArtifactSchema.extend({
|
|
500
|
-
schema: z.literal(
|
|
511
|
+
schema: z.literal(HardkasSchemas2.Snapshot),
|
|
501
512
|
name: z.string().optional(),
|
|
502
513
|
daaScore: z.string(),
|
|
503
514
|
accountsHash: z.string().optional(),
|
|
@@ -512,7 +523,7 @@ var SnapshotSchema = BaseArtifactSchema.extend({
|
|
|
512
523
|
utxos: z.array(LocalnetUtxoSchemaV2)
|
|
513
524
|
});
|
|
514
525
|
var TxReceiptSchema = BaseArtifactSchema.extend({
|
|
515
|
-
schema: z.literal(
|
|
526
|
+
schema: z.literal(HardkasSchemas2.TxReceipt),
|
|
516
527
|
txId: z.string(),
|
|
517
528
|
status: z.enum(["pending", "submitted", "accepted", "confirmed", "failed"]),
|
|
518
529
|
mode: executionModeSchema,
|
|
@@ -546,7 +557,7 @@ var SignatureMetadataEntrySchema = z.object({
|
|
|
546
557
|
signedAt: z.string().datetime()
|
|
547
558
|
});
|
|
548
559
|
var SignedTxSchema = BaseArtifactSchema.extend({
|
|
549
|
-
schema: z.literal(
|
|
560
|
+
schema: z.literal(HardkasSchemas2.SignedTx),
|
|
550
561
|
status: z.enum(["partially_signed", "signed"]),
|
|
551
562
|
signedId: z.string(),
|
|
552
563
|
sourcePlanId: z.string(),
|
|
@@ -570,7 +581,7 @@ var SignedTxSchema = BaseArtifactSchema.extend({
|
|
|
570
581
|
metadata: z.any().optional()
|
|
571
582
|
});
|
|
572
583
|
var TxTraceSchema = BaseArtifactSchema.extend({
|
|
573
|
-
schema: z.literal(
|
|
584
|
+
schema: z.literal(HardkasSchemas2.TxTrace),
|
|
574
585
|
txId: z.string(),
|
|
575
586
|
networkId: kaspaNetworkIdSchema,
|
|
576
587
|
mode: executionModeSchema,
|
|
@@ -585,7 +596,7 @@ var TxTraceSchema = BaseArtifactSchema.extend({
|
|
|
585
596
|
dagContext: DagContextSchema.optional()
|
|
586
597
|
});
|
|
587
598
|
var WorkflowSchema = BaseArtifactSchema.extend({
|
|
588
|
-
schema: z.literal(
|
|
599
|
+
schema: z.literal(HardkasSchemas2.WorkflowV1),
|
|
589
600
|
workflowId: z.string(),
|
|
590
601
|
status: z.enum(["pending", "running", "completed", "failed"]),
|
|
591
602
|
inputs: z.record(z.any()).optional(),
|
|
@@ -634,7 +645,7 @@ var RuntimeSessionSchema = BaseArtifactSchema.extend({
|
|
|
634
645
|
notes: z.string().optional()
|
|
635
646
|
});
|
|
636
647
|
var SilverCompileArtifactSchema = BaseArtifactSchema.extend({
|
|
637
|
-
schema: z.literal(
|
|
648
|
+
schema: z.literal(HardkasSchemas2.SilverCompile),
|
|
638
649
|
sourcePath: z.string(),
|
|
639
650
|
sourceHash: z.string(),
|
|
640
651
|
compilerName: z.string(),
|
|
@@ -648,7 +659,7 @@ var SilverCompileArtifactSchema = BaseArtifactSchema.extend({
|
|
|
648
659
|
assumptions: z.array(z.string()).optional()
|
|
649
660
|
});
|
|
650
661
|
var SilverDeployPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
651
|
-
schema: z.literal(
|
|
662
|
+
schema: z.literal(HardkasSchemas2.SilverDeployPlan),
|
|
652
663
|
compileArtifactHash: z.string(),
|
|
653
664
|
compiledScriptHash: z.string(),
|
|
654
665
|
redeemScriptHex: z.string(),
|
|
@@ -661,7 +672,7 @@ var SilverDeployPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
|
661
672
|
deployerAddress: z.string()
|
|
662
673
|
});
|
|
663
674
|
var SilverDeployArtifactSchema = BaseArtifactSchema.extend({
|
|
664
|
-
schema: z.literal(
|
|
675
|
+
schema: z.literal(HardkasSchemas2.SilverDeploy),
|
|
665
676
|
deployPlanHash: z.string(),
|
|
666
677
|
compileArtifactHash: z.string(),
|
|
667
678
|
compiledScriptHash: z.string(),
|
|
@@ -680,7 +691,7 @@ var SilverScriptArgSchema = z.object({
|
|
|
680
691
|
value: z.string()
|
|
681
692
|
});
|
|
682
693
|
var SilverSpendPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
683
|
-
schema: z.literal(
|
|
694
|
+
schema: z.literal(HardkasSchemas2.SilverSpendPlan),
|
|
684
695
|
deployArtifactHash: z.string(),
|
|
685
696
|
compileArtifactHash: z.string(),
|
|
686
697
|
redeemScriptHash: z.string(),
|
|
@@ -692,16 +703,18 @@ var SilverSpendPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
|
692
703
|
args: z.array(SilverScriptArgSchema),
|
|
693
704
|
argsHash: z.string(),
|
|
694
705
|
signatureScriptHex: z.string(),
|
|
695
|
-
expectedOutputs: z.array(
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
706
|
+
expectedOutputs: z.array(
|
|
707
|
+
z.object({
|
|
708
|
+
address: z.string(),
|
|
709
|
+
amountSompi: z.string(),
|
|
710
|
+
scriptHash: z.string().optional()
|
|
711
|
+
})
|
|
712
|
+
),
|
|
700
713
|
networkId: kaspaNetworkIdSchema,
|
|
701
714
|
assumptionLevel: z.string().optional()
|
|
702
715
|
});
|
|
703
716
|
var SilverSpendReceiptArtifactSchema = BaseArtifactSchema.extend({
|
|
704
|
-
schema: z.literal(
|
|
717
|
+
schema: z.literal(HardkasSchemas2.SilverSpendReceipt),
|
|
705
718
|
spendPlanHash: z.string(),
|
|
706
719
|
deployArtifactHash: z.string().optional(),
|
|
707
720
|
redeemScriptHash: z.string().optional(),
|
|
@@ -711,16 +724,18 @@ var SilverSpendReceiptArtifactSchema = BaseArtifactSchema.extend({
|
|
|
711
724
|
transactionId: z.string(),
|
|
712
725
|
index: z.number()
|
|
713
726
|
}).optional(),
|
|
714
|
-
expectedOutputs: z.array(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
727
|
+
expectedOutputs: z.array(
|
|
728
|
+
z.object({
|
|
729
|
+
address: z.string(),
|
|
730
|
+
amountSompi: z.string(),
|
|
731
|
+
scriptHash: z.string().optional()
|
|
732
|
+
})
|
|
733
|
+
).optional(),
|
|
719
734
|
txId: z.string(),
|
|
720
735
|
status: z.enum(["simulated", "submitted", "accepted", "rejected"])
|
|
721
736
|
});
|
|
722
737
|
var SilverDeploySimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
723
|
-
schema: z.literal(
|
|
738
|
+
schema: z.literal(HardkasSchemas2.SilverDeploySimulation),
|
|
724
739
|
deployPlanHash: z.string(),
|
|
725
740
|
compileArtifactHash: z.string(),
|
|
726
741
|
compiledScriptHash: z.string(),
|
|
@@ -738,7 +753,7 @@ var SilverDeploySimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
|
738
753
|
status: z.literal("SIMULATED_ACCEPTED")
|
|
739
754
|
});
|
|
740
755
|
var SilverSpendSimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
741
|
-
schema: z.literal(
|
|
756
|
+
schema: z.literal(HardkasSchemas2.SilverSpendSimulation),
|
|
742
757
|
deploySimulationHash: z.string(),
|
|
743
758
|
spendPlanHash: z.string(),
|
|
744
759
|
redeemScriptHash: z.string(),
|
|
@@ -749,27 +764,37 @@ var SilverSpendSimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
|
749
764
|
transactionId: z.string(),
|
|
750
765
|
index: z.number()
|
|
751
766
|
}),
|
|
752
|
-
expectedOutputs: z.array(
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
767
|
+
expectedOutputs: z.array(
|
|
768
|
+
z.object({
|
|
769
|
+
address: z.string(),
|
|
770
|
+
amountSompi: z.string(),
|
|
771
|
+
scriptHash: z.string().optional()
|
|
772
|
+
})
|
|
773
|
+
),
|
|
757
774
|
feeSompi: z.string(),
|
|
758
775
|
status: z.literal("SIMULATED_ACCEPTED")
|
|
759
776
|
});
|
|
760
777
|
var SilverTestArtifactSchema = BaseArtifactSchema.extend({
|
|
761
|
-
schema: z.literal(
|
|
778
|
+
schema: z.literal(HardkasSchemas2.SilverTest),
|
|
762
779
|
compileArtifactHash: z.string(),
|
|
763
780
|
sourceHash: z.string(),
|
|
764
781
|
compiledScriptHash: z.string(),
|
|
765
782
|
testVectorsHash: z.string().optional().nullable(),
|
|
766
783
|
compilerName: z.string(),
|
|
767
784
|
compilerVersion: z.string(),
|
|
768
|
-
results: z.array(
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
785
|
+
results: z.array(
|
|
786
|
+
z.object({
|
|
787
|
+
name: z.string(),
|
|
788
|
+
status: z.enum([
|
|
789
|
+
"PASS",
|
|
790
|
+
"FAIL",
|
|
791
|
+
"SKIPPED",
|
|
792
|
+
"EXPECTED_COMPILER_FAILURE",
|
|
793
|
+
"PARTIAL_TEST_VECTOR_SUPPORT"
|
|
794
|
+
]),
|
|
795
|
+
reason: z.string().optional()
|
|
796
|
+
})
|
|
797
|
+
),
|
|
773
798
|
status: z.enum([
|
|
774
799
|
"PASS",
|
|
775
800
|
"FAIL",
|
|
@@ -777,17 +802,138 @@ var SilverTestArtifactSchema = BaseArtifactSchema.extend({
|
|
|
777
802
|
"EXPECTED_COMPILER_FAILURE"
|
|
778
803
|
])
|
|
779
804
|
});
|
|
805
|
+
var ProgrammabilityClaimsSchema = z.object({
|
|
806
|
+
artifactCoherence: z.literal("READY_MATCH"),
|
|
807
|
+
silverScriptBuilder: z.literal("SILVERSCRIPT_BUILDER_READY"),
|
|
808
|
+
zkCorpusSurface: z.literal("ZK_CORPUS_SURFACE_READY"),
|
|
809
|
+
zkLocalVerification: z.literal("READY_GROTH16_FIXTURE_COHERENCE"),
|
|
810
|
+
risc0InspectSurface: z.literal("RISC0_INSPECT_SURFACE_READY"),
|
|
811
|
+
vProgsInspectSurface: z.literal("VPROGS_INSPECT_SURFACE_READY"),
|
|
812
|
+
runtimeOutcome: z.literal("PARTIAL"),
|
|
813
|
+
vmConsensusEquivalence: z.literal("NOT_CLAIMED"),
|
|
814
|
+
zkOnchainVerification: z.literal("NOT_CLAIMED"),
|
|
815
|
+
vProgsRuntime: z.literal("NOT_CLAIMED"),
|
|
816
|
+
vProgsStableApi: z.literal("NOT_CLAIMED"),
|
|
817
|
+
mainnet: z.literal("BLOCKED_BY_POLICY")
|
|
818
|
+
});
|
|
819
|
+
var ProgrammabilityCapabilitiesSchema = z.object({
|
|
820
|
+
schema: z.literal(HardkasSchemas2.ProgrammabilityCapabilitiesV1),
|
|
821
|
+
ok: z.literal(true),
|
|
822
|
+
status: z.literal("PROGRAMMABILITY_SURFACE_READY"),
|
|
823
|
+
surfaces: z.object({
|
|
824
|
+
silverScript: z.literal("SILVERSCRIPT_BUILDER_READY"),
|
|
825
|
+
zkCorpus: z.literal("ZK_CORPUS_SURFACE_READY"),
|
|
826
|
+
groth16FixtureCoherence: z.literal("READY_GROTH16_FIXTURE_COHERENCE"),
|
|
827
|
+
risc0Inspect: z.literal("RISC0_INSPECT_SURFACE_READY"),
|
|
828
|
+
vProgsInspect: z.literal("VPROGS_INSPECT_SURFACE_READY")
|
|
829
|
+
}),
|
|
830
|
+
claims: ProgrammabilityClaimsSchema,
|
|
831
|
+
nonClaims: z.array(z.string())
|
|
832
|
+
});
|
|
833
|
+
var ProgrammabilityInspectSchema = z.object({
|
|
834
|
+
schema: z.literal(HardkasSchemas2.ProgrammabilityInspectV1),
|
|
835
|
+
ok: z.boolean(),
|
|
836
|
+
status: z.enum([
|
|
837
|
+
"PROGRAMMABILITY_ARTIFACT_INSPECTED",
|
|
838
|
+
"PROGRAMMABILITY_ARTIFACT_INVALID"
|
|
839
|
+
]),
|
|
840
|
+
kind: z.enum(["silver", "zk", "vprog"]),
|
|
841
|
+
path: z.string(),
|
|
842
|
+
artifactSchema: z.string().optional(),
|
|
843
|
+
contentHash: z.string().optional(),
|
|
844
|
+
sourceStatus: z.string().optional(),
|
|
845
|
+
claims: ProgrammabilityClaimsSchema,
|
|
846
|
+
issues: z.array(
|
|
847
|
+
z.object({
|
|
848
|
+
code: z.string(),
|
|
849
|
+
message: z.string(),
|
|
850
|
+
file: z.string().optional()
|
|
851
|
+
})
|
|
852
|
+
)
|
|
853
|
+
});
|
|
854
|
+
var ProgrammabilityVerifySchema = z.object({
|
|
855
|
+
schema: z.literal(HardkasSchemas2.ProgrammabilityVerifyV1),
|
|
856
|
+
ok: z.boolean(),
|
|
857
|
+
status: z.enum([
|
|
858
|
+
"PROGRAMMABILITY_VERIFY_PASS",
|
|
859
|
+
"PROGRAMMABILITY_VERIFY_FAIL",
|
|
860
|
+
"PROGRAMMABILITY_VERIFY_PARTIAL"
|
|
861
|
+
]),
|
|
862
|
+
kind: z.enum(["silver", "zk", "vprog"]),
|
|
863
|
+
path: z.string(),
|
|
864
|
+
sourceStatus: z.string().optional(),
|
|
865
|
+
claims: ProgrammabilityClaimsSchema,
|
|
866
|
+
issues: z.array(
|
|
867
|
+
z.object({
|
|
868
|
+
code: z.string(),
|
|
869
|
+
message: z.string(),
|
|
870
|
+
file: z.string().optional()
|
|
871
|
+
})
|
|
872
|
+
)
|
|
873
|
+
});
|
|
874
|
+
var ProgrammabilityCorpusReportSchema = z.object({
|
|
875
|
+
schema: z.literal(HardkasSchemas2.ProgrammabilityCorpusReportV1),
|
|
876
|
+
ok: z.boolean(),
|
|
877
|
+
path: z.string(),
|
|
878
|
+
status: z.enum(["PROGRAMMABILITY_CORPUS_PASS", "PROGRAMMABILITY_CORPUS_FAIL"]),
|
|
879
|
+
summary: z.object({
|
|
880
|
+
silver: z.enum(["PASS", "FAIL", "SKIPPED"]),
|
|
881
|
+
zk: z.enum(["PASS", "FAIL", "SKIPPED"]),
|
|
882
|
+
vprogs: z.enum(["PASS", "FAIL", "SKIPPED"]),
|
|
883
|
+
rootManifest: z.enum(["PASS", "FAIL"]),
|
|
884
|
+
knownLimitations: z.array(z.string())
|
|
885
|
+
}),
|
|
886
|
+
claims: ProgrammabilityClaimsSchema,
|
|
887
|
+
issues: z.array(
|
|
888
|
+
z.object({
|
|
889
|
+
code: z.string(),
|
|
890
|
+
message: z.string(),
|
|
891
|
+
file: z.string().optional()
|
|
892
|
+
})
|
|
893
|
+
)
|
|
894
|
+
});
|
|
895
|
+
var ProgrammabilityAppPlanSchema = z.object({
|
|
896
|
+
schema: z.literal(HardkasSchemas2.ProgrammabilityAppPlanV1),
|
|
897
|
+
ok: z.literal(true),
|
|
898
|
+
status: z.literal("PROGRAMMABILITY_APP_PLAN_READY"),
|
|
899
|
+
kind: z.enum(["silver", "zk", "vprog", "full-lab"]),
|
|
900
|
+
template: z.string(),
|
|
901
|
+
commands: z.array(z.string()),
|
|
902
|
+
sdkSurfaces: z.array(z.string()),
|
|
903
|
+
claims: ProgrammabilityClaimsSchema,
|
|
904
|
+
nonClaims: z.array(z.string())
|
|
905
|
+
});
|
|
906
|
+
var ToccataProgrammabilityCorpusSchema = z.object({
|
|
907
|
+
schema: z.literal(HardkasSchemas2.ToccataProgrammabilityCorpusV1),
|
|
908
|
+
version: z.string(),
|
|
909
|
+
network: z.literal("simnet"),
|
|
910
|
+
profile: z.literal("toccata-v2"),
|
|
911
|
+
status: z.literal("PROGRAMMABILITY_SURFACE_READY"),
|
|
912
|
+
components: z.record(z.any()),
|
|
913
|
+
claims: z.object({
|
|
914
|
+
artifactCoherence: z.literal("READY_MATCH"),
|
|
915
|
+
runtimeOutcome: z.literal("PARTIAL"),
|
|
916
|
+
vmConsensusEquivalence: z.literal("NOT_CLAIMED"),
|
|
917
|
+
zkOnchainVerification: z.literal("NOT_CLAIMED"),
|
|
918
|
+
vProgsRuntime: z.literal("NOT_CLAIMED"),
|
|
919
|
+
vProgsStableApi: z.literal("NOT_CLAIMED"),
|
|
920
|
+
mainnet: z.literal("BLOCKED_BY_POLICY")
|
|
921
|
+
}),
|
|
922
|
+
expectedKnownLimitations: z.array(z.string())
|
|
923
|
+
});
|
|
780
924
|
|
|
781
925
|
// src/verify.ts
|
|
782
926
|
import fs from "fs";
|
|
783
927
|
import path from "path";
|
|
928
|
+
import { HardkasSchemas as HardkasSchemas5 } from "@hardkas/core";
|
|
784
929
|
|
|
785
930
|
// src/feeVerify.ts
|
|
786
931
|
import {
|
|
787
932
|
estimateTransactionMass
|
|
788
933
|
} from "@hardkas/tx-builder";
|
|
934
|
+
import { HardkasSchemas as HardkasSchemas3 } from "@hardkas/core";
|
|
789
935
|
function recomputeMass(artifact) {
|
|
790
|
-
if (artifact.schema ===
|
|
936
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
791
937
|
const plan = artifact;
|
|
792
938
|
const result = estimateTransactionMass({
|
|
793
939
|
inputCount: (plan.inputs || []).length,
|
|
@@ -798,7 +944,7 @@ function recomputeMass(artifact) {
|
|
|
798
944
|
});
|
|
799
945
|
return result.mass;
|
|
800
946
|
}
|
|
801
|
-
if (artifact.schema ===
|
|
947
|
+
if (artifact.schema === HardkasSchemas3.TxReceipt) {
|
|
802
948
|
const receipt = artifact;
|
|
803
949
|
return BigInt(receipt.mass || 0);
|
|
804
950
|
}
|
|
@@ -811,7 +957,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
811
957
|
let inputTotal = 0n;
|
|
812
958
|
let outputTotal = 0n;
|
|
813
959
|
let feeRate = 1n;
|
|
814
|
-
if (artifact.schema ===
|
|
960
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
815
961
|
const plan = artifact;
|
|
816
962
|
artifactMass = BigInt(plan.estimatedMass || 0);
|
|
817
963
|
artifactFee = BigInt(plan.estimatedFeeSompi || 0);
|
|
@@ -824,7 +970,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
824
970
|
0n
|
|
825
971
|
);
|
|
826
972
|
if (plan.change) outputTotal += BigInt(plan.change.amountSompi || 0);
|
|
827
|
-
} else if (artifact.schema ===
|
|
973
|
+
} else if (artifact.schema === HardkasSchemas3.TxReceipt) {
|
|
828
974
|
const receipt = artifact;
|
|
829
975
|
artifactMass = BigInt(receipt.mass || 0);
|
|
830
976
|
artifactFee = BigInt(receipt.feeSompi);
|
|
@@ -851,7 +997,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
851
997
|
if (artifactFee < 0n) {
|
|
852
998
|
issues.push("Economic violation: Negative fee detected");
|
|
853
999
|
}
|
|
854
|
-
if (artifact.schema ===
|
|
1000
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
855
1001
|
const plan = artifact;
|
|
856
1002
|
(plan.outputs || []).forEach((o, i) => {
|
|
857
1003
|
if (BigInt(o.amountSompi || 0) < 600n) {
|
|
@@ -872,6 +1018,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
872
1018
|
}
|
|
873
1019
|
|
|
874
1020
|
// src/lineage.ts
|
|
1021
|
+
import { HardkasSchemas as HardkasSchemas4 } from "@hardkas/core";
|
|
875
1022
|
function verifyLineage(artifact, parent, options = {}) {
|
|
876
1023
|
const issues = [];
|
|
877
1024
|
const addIssue = (code, message, severity = "error") => {
|
|
@@ -879,7 +1026,7 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
879
1026
|
};
|
|
880
1027
|
const lineage = artifact.lineage;
|
|
881
1028
|
if (!lineage) {
|
|
882
|
-
const isWorkflow = artifact.schema ===
|
|
1029
|
+
const isWorkflow = artifact.schema === HardkasSchemas4.WorkflowV1;
|
|
883
1030
|
const severity = options.strict && !isWorkflow ? "error" : "warning";
|
|
884
1031
|
if (!isWorkflow || options.strict) {
|
|
885
1032
|
addIssue("MISSING_LINEAGE", "Artifact has no lineage metadata", severity);
|
|
@@ -969,15 +1116,19 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
969
1116
|
}
|
|
970
1117
|
if (parent) {
|
|
971
1118
|
const validTransitions = {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1119
|
+
[HardkasSchemas4.Snapshot]: [HardkasSchemas4.TxPlan, HardkasSchemas4.MigrationReceiptV1],
|
|
1120
|
+
[HardkasSchemas4.TxPlan]: [HardkasSchemas4.SignedTx, HardkasSchemas4.MigrationReceiptV1],
|
|
1121
|
+
[HardkasSchemas4.SignedTx]: [
|
|
1122
|
+
HardkasSchemas4.TxReceipt,
|
|
1123
|
+
HardkasSchemas4.SignedTx,
|
|
1124
|
+
HardkasSchemas4.MigrationReceiptV1
|
|
1125
|
+
],
|
|
1126
|
+
[HardkasSchemas4.TxReceipt]: [HardkasSchemas4.TxTrace, HardkasSchemas4.MigrationReceiptV1]
|
|
976
1127
|
};
|
|
977
1128
|
let isValidTransition = false;
|
|
978
|
-
if (parent.schema ===
|
|
1129
|
+
if (parent.schema === HardkasSchemas4.MigrationReceiptV1) {
|
|
979
1130
|
isValidTransition = parent.toSchema === artifact.schema;
|
|
980
|
-
} else if (artifact.schema ===
|
|
1131
|
+
} else if (artifact.schema === HardkasSchemas4.MigrationReceiptV1) {
|
|
981
1132
|
isValidTransition = artifact.fromSchema === parent.schema;
|
|
982
1133
|
} else {
|
|
983
1134
|
const allowed = validTransitions[parent.schema] || [];
|
|
@@ -1063,7 +1214,7 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
1063
1214
|
result.artifactType = v.schema;
|
|
1064
1215
|
result.version = v.version;
|
|
1065
1216
|
result.expectedHash = v.contentHash;
|
|
1066
|
-
if (v.schema ===
|
|
1217
|
+
if (v.schema === HardkasSchemas5.ReplayReportV1) {
|
|
1067
1218
|
result.ok = true;
|
|
1068
1219
|
return result;
|
|
1069
1220
|
}
|
|
@@ -1109,58 +1260,58 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
1109
1260
|
}
|
|
1110
1261
|
let schema;
|
|
1111
1262
|
switch (v.schema) {
|
|
1112
|
-
case
|
|
1263
|
+
case HardkasSchemas5.Snapshot:
|
|
1113
1264
|
schema = SnapshotSchema;
|
|
1114
1265
|
break;
|
|
1115
|
-
case
|
|
1266
|
+
case HardkasSchemas5.TxPlan:
|
|
1116
1267
|
schema = TxPlanSchema;
|
|
1117
1268
|
break;
|
|
1118
|
-
case
|
|
1269
|
+
case HardkasSchemas5.TxReceipt:
|
|
1119
1270
|
schema = TxReceiptSchema;
|
|
1120
1271
|
break;
|
|
1121
|
-
case
|
|
1272
|
+
case HardkasSchemas5.TxTrace:
|
|
1122
1273
|
schema = TxTraceSchema;
|
|
1123
1274
|
break;
|
|
1124
|
-
case
|
|
1275
|
+
case HardkasSchemas5.SignedTx:
|
|
1125
1276
|
schema = SignedTxSchema;
|
|
1126
1277
|
break;
|
|
1127
|
-
case
|
|
1278
|
+
case HardkasSchemas5.WorkflowV1:
|
|
1128
1279
|
schema = WorkflowSchema;
|
|
1129
1280
|
break;
|
|
1130
|
-
case
|
|
1281
|
+
case HardkasSchemas5.PolicyV1:
|
|
1131
1282
|
schema = PolicySchema;
|
|
1132
1283
|
break;
|
|
1133
|
-
case
|
|
1284
|
+
case HardkasSchemas5.NetworkProfileV1:
|
|
1134
1285
|
schema = NetworkProfileSchema;
|
|
1135
1286
|
break;
|
|
1136
|
-
case
|
|
1287
|
+
case HardkasSchemas5.AssumptionV1:
|
|
1137
1288
|
schema = AssumptionSchema;
|
|
1138
1289
|
break;
|
|
1139
|
-
case
|
|
1290
|
+
case HardkasSchemas5.MigrationReceiptV1:
|
|
1140
1291
|
schema = MigrationReceiptSchema;
|
|
1141
1292
|
break;
|
|
1142
|
-
case
|
|
1293
|
+
case HardkasSchemas5.SilverCompile:
|
|
1143
1294
|
schema = SilverCompileArtifactSchema;
|
|
1144
1295
|
break;
|
|
1145
|
-
case
|
|
1296
|
+
case HardkasSchemas5.SilverDeployPlan:
|
|
1146
1297
|
schema = SilverDeployPlanArtifactSchema;
|
|
1147
1298
|
break;
|
|
1148
|
-
case
|
|
1299
|
+
case HardkasSchemas5.SilverDeploy:
|
|
1149
1300
|
schema = SilverDeployArtifactSchema;
|
|
1150
1301
|
break;
|
|
1151
|
-
case
|
|
1302
|
+
case HardkasSchemas5.SilverTest:
|
|
1152
1303
|
schema = SilverTestArtifactSchema;
|
|
1153
1304
|
break;
|
|
1154
|
-
case
|
|
1305
|
+
case HardkasSchemas5.SilverSpendPlan:
|
|
1155
1306
|
schema = SilverSpendPlanArtifactSchema;
|
|
1156
1307
|
break;
|
|
1157
|
-
case
|
|
1308
|
+
case HardkasSchemas5.SilverSpendReceipt:
|
|
1158
1309
|
schema = SilverSpendReceiptArtifactSchema;
|
|
1159
1310
|
break;
|
|
1160
|
-
case
|
|
1311
|
+
case HardkasSchemas5.SilverDeploySimulation:
|
|
1161
1312
|
schema = SilverDeploySimulationArtifactSchema;
|
|
1162
1313
|
break;
|
|
1163
|
-
case
|
|
1314
|
+
case HardkasSchemas5.SilverSpendSimulation:
|
|
1164
1315
|
schema = SilverSpendSimulationArtifactSchema;
|
|
1165
1316
|
break;
|
|
1166
1317
|
}
|
|
@@ -1174,11 +1325,11 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
1174
1325
|
result.issues.push({
|
|
1175
1326
|
code: "ARTIFACT_SCHEMA_INVALID",
|
|
1176
1327
|
severity: zodSeverity,
|
|
1177
|
-
message: `${pathStr}: ${e.message}`,
|
|
1328
|
+
message: `${pathStr}: ${e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)}`,
|
|
1178
1329
|
...pathStr ? { path: pathStr } : {}
|
|
1179
1330
|
});
|
|
1180
1331
|
} else {
|
|
1181
|
-
addError("ARTIFACT_SCHEMA_INVALID", `${pathStr}: ${e.message}`, pathStr);
|
|
1332
|
+
addError("ARTIFACT_SCHEMA_INVALID", `${pathStr}: ${e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)}`, pathStr);
|
|
1182
1333
|
}
|
|
1183
1334
|
});
|
|
1184
1335
|
}
|
|
@@ -1194,9 +1345,9 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
1194
1345
|
return result;
|
|
1195
1346
|
} catch (e) {
|
|
1196
1347
|
if (e instanceof SyntaxError) {
|
|
1197
|
-
addError("ARTIFACT_JSON_INVALID", `Invalid JSON: ${e.message}`);
|
|
1348
|
+
addError("ARTIFACT_JSON_INVALID", `Invalid JSON: ${e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)}`);
|
|
1198
1349
|
} else if (e instanceof Error) {
|
|
1199
|
-
addError("ARTIFACT_ID_INVALID", `Unexpected verification error: ${e.message}`);
|
|
1350
|
+
addError("ARTIFACT_ID_INVALID", `Unexpected verification error: ${e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)}`);
|
|
1200
1351
|
} else {
|
|
1201
1352
|
addError("ARTIFACT_ID_INVALID", `Unexpected verification error: ${String(e)}`);
|
|
1202
1353
|
}
|
|
@@ -1312,7 +1463,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1312
1463
|
message: `Policy reference mismatch: expected ${ref}, got ${refObj.contentHash}`
|
|
1313
1464
|
});
|
|
1314
1465
|
} else {
|
|
1315
|
-
if (refObj.schema ===
|
|
1466
|
+
if (refObj.schema === HardkasSchemas5.PolicyV1) {
|
|
1316
1467
|
if (refObj.decision === "DENY") {
|
|
1317
1468
|
addIssue({
|
|
1318
1469
|
code: "POLICY_VIOLATION",
|
|
@@ -1435,9 +1586,9 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1435
1586
|
const lineage = v.lineage;
|
|
1436
1587
|
if (lineage?.parentArtifactId && lineage?.parentArtifactId !== lineage?.artifactId) {
|
|
1437
1588
|
parentId = lineage?.parentArtifactId;
|
|
1438
|
-
} else if (v.schema ===
|
|
1589
|
+
} else if (v.schema === HardkasSchemas5.SignedTx) {
|
|
1439
1590
|
parentId = v.sourcePlanId;
|
|
1440
|
-
} else if (v.schema ===
|
|
1591
|
+
} else if (v.schema === HardkasSchemas5.TxReceipt) {
|
|
1441
1592
|
parentId = v.sourceSignedId || lineage?.parentArtifactId;
|
|
1442
1593
|
}
|
|
1443
1594
|
if (parentId) {
|
|
@@ -1464,7 +1615,10 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1464
1615
|
});
|
|
1465
1616
|
} else {
|
|
1466
1617
|
try {
|
|
1467
|
-
const parentSem = verifyArtifactSemantics(parentObj, {
|
|
1618
|
+
const parentSem = verifyArtifactSemantics(parentObj, {
|
|
1619
|
+
...context,
|
|
1620
|
+
strict: true
|
|
1621
|
+
});
|
|
1468
1622
|
if (!parentSem.ok) {
|
|
1469
1623
|
parentSem.issues.forEach((issue) => addIssue(issue));
|
|
1470
1624
|
}
|
|
@@ -1497,7 +1651,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1497
1651
|
}
|
|
1498
1652
|
}
|
|
1499
1653
|
const lineageAudit = verifyLineage(v, parentObj || context.parent, { strict });
|
|
1500
|
-
if (!lineageAudit.ok || strict && !v.lineage && v.schema !==
|
|
1654
|
+
if (!lineageAudit.ok || strict && !v.lineage && v.schema !== HardkasSchemas5.WorkflowV1) {
|
|
1501
1655
|
lineageAudit.issues.forEach((issue) => {
|
|
1502
1656
|
addIssue(issue);
|
|
1503
1657
|
});
|
|
@@ -1511,7 +1665,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1511
1665
|
severity: "error",
|
|
1512
1666
|
message: "Strict mode requires workflowId"
|
|
1513
1667
|
});
|
|
1514
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1668
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1515
1669
|
addIssue({
|
|
1516
1670
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1517
1671
|
severity: "error",
|
|
@@ -1530,7 +1684,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1530
1684
|
severity: "warning",
|
|
1531
1685
|
message: "Missing workflowId"
|
|
1532
1686
|
});
|
|
1533
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1687
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1534
1688
|
addIssue({
|
|
1535
1689
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1536
1690
|
severity: "warning",
|
|
@@ -1544,7 +1698,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1544
1698
|
severity: "warning",
|
|
1545
1699
|
message: "Missing workflowId"
|
|
1546
1700
|
});
|
|
1547
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1701
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1548
1702
|
addIssue({
|
|
1549
1703
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1550
1704
|
severity: "warning",
|
|
@@ -1736,7 +1890,8 @@ import {
|
|
|
1736
1890
|
asWorkflowId,
|
|
1737
1891
|
asCorrelationId,
|
|
1738
1892
|
asNetworkId,
|
|
1739
|
-
asEventSequence
|
|
1893
|
+
asEventSequence,
|
|
1894
|
+
getTelemetry
|
|
1740
1895
|
} from "@hardkas/core";
|
|
1741
1896
|
var InvariantWatcher = class {
|
|
1742
1897
|
invariants;
|
|
@@ -1766,7 +1921,15 @@ var InvariantWatcher = class {
|
|
|
1766
1921
|
this.emitViolation(event, violation);
|
|
1767
1922
|
}
|
|
1768
1923
|
} catch (e) {
|
|
1769
|
-
|
|
1924
|
+
try {
|
|
1925
|
+
getTelemetry().logAnomaly(
|
|
1926
|
+
"EXTERNAL_MUTATION",
|
|
1927
|
+
"low",
|
|
1928
|
+
"unknown",
|
|
1929
|
+
`Invariant ${invariant.id} failed with error: ${String(e)}`
|
|
1930
|
+
);
|
|
1931
|
+
} catch (telemetryError) {
|
|
1932
|
+
}
|
|
1770
1933
|
}
|
|
1771
1934
|
}
|
|
1772
1935
|
});
|
|
@@ -1809,9 +1972,12 @@ var InvariantWatcher = class {
|
|
|
1809
1972
|
};
|
|
1810
1973
|
|
|
1811
1974
|
// src/migration.ts
|
|
1975
|
+
import { HardkasSchemas as HardkasSchemas6 } from "@hardkas/core";
|
|
1812
1976
|
var MigrationRequiredError = class extends Error {
|
|
1813
1977
|
constructor(oldVersion, targetVersion) {
|
|
1814
|
-
super(
|
|
1978
|
+
super(
|
|
1979
|
+
`MIGRATION_REQUIRED: Artifact requires explicit migration from ${oldVersion} to ${targetVersion}`
|
|
1980
|
+
);
|
|
1815
1981
|
this.oldVersion = oldVersion;
|
|
1816
1982
|
this.targetVersion = targetVersion;
|
|
1817
1983
|
this.name = "MigrationRequiredError";
|
|
@@ -1844,16 +2010,16 @@ registerMigrationStep({
|
|
|
1844
2010
|
migrated.lineage = { ...migrated.lineage };
|
|
1845
2011
|
}
|
|
1846
2012
|
if (typeof migrated.schema === "string" && migrated.schema.endsWith(".v1")) {
|
|
1847
|
-
if (migrated.schema !==
|
|
2013
|
+
if (migrated.schema !== HardkasSchemas6.WorkflowV1) {
|
|
1848
2014
|
migrated.schema = migrated.schema.replace(/\.v1$/, "");
|
|
1849
2015
|
}
|
|
1850
2016
|
}
|
|
1851
2017
|
migrated.version = ARTIFACT_VERSION;
|
|
1852
|
-
if (migrated.schema ===
|
|
2018
|
+
if (migrated.schema === HardkasSchemas6.TxPlan && migrated.selectedUtxos !== void 0) {
|
|
1853
2019
|
migrated.inputs = migrated.selectedUtxos;
|
|
1854
2020
|
delete migrated.selectedUtxos;
|
|
1855
2021
|
}
|
|
1856
|
-
if (migrated.schema ===
|
|
2022
|
+
if (migrated.schema === HardkasSchemas6.Snapshot && Array.isArray(migrated.utxos)) {
|
|
1857
2023
|
migrated.utxos = sortUtxosByOutpoint(migrated.utxos);
|
|
1858
2024
|
}
|
|
1859
2025
|
if (!migrated.hardkasVersion) {
|
|
@@ -1978,7 +2144,7 @@ function generateMigrationReceipt(oldArtifact, newArtifact, migrationId) {
|
|
|
1978
2144
|
const oldHash = oldArtifact.contentHash || calculateContentHash(oldArtifact, CURRENT_HASH_VERSION);
|
|
1979
2145
|
const newHash = newArtifact.contentHash || calculateContentHash(newArtifact, CURRENT_HASH_VERSION);
|
|
1980
2146
|
const receipt = {
|
|
1981
|
-
schema:
|
|
2147
|
+
schema: HardkasSchemas6.MigrationReceiptV1,
|
|
1982
2148
|
hardkasVersion: HARDKAS_VERSION,
|
|
1983
2149
|
version: ARTIFACT_VERSION,
|
|
1984
2150
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -2018,10 +2184,6 @@ async function writeArtifact(filePath, artifact) {
|
|
|
2018
2184
|
const id = artifactObj.planId || artifactObj.signedId || artifactObj.txId || Date.now().toString(36);
|
|
2019
2185
|
const prefix = artifactObj.schema ? artifactObj.schema.split(".")[1] || "artifact" : "artifact";
|
|
2020
2186
|
targetPath = path2.join(filePath, `${prefix}-${id}.json`);
|
|
2021
|
-
console.log(
|
|
2022
|
-
`
|
|
2023
|
-
Note: Provided path is a directory. Auto-generating artifact filename: ${path2.basename(targetPath)}`
|
|
2024
|
-
);
|
|
2025
2187
|
}
|
|
2026
2188
|
} catch (e) {
|
|
2027
2189
|
if (filePath.endsWith("/") || filePath.endsWith("\\")) {
|
|
@@ -2079,7 +2241,7 @@ async function readTxReceiptArtifact(filePath) {
|
|
|
2079
2241
|
}
|
|
2080
2242
|
|
|
2081
2243
|
// src/format.ts
|
|
2082
|
-
import {
|
|
2244
|
+
import { formatSompiToKas } from "@hardkas/core";
|
|
2083
2245
|
function formatTxPlanArtifact(artifact) {
|
|
2084
2246
|
const lines = [];
|
|
2085
2247
|
lines.push("HardKAS Transaction Plan Artifact (v2)");
|
|
@@ -2094,11 +2256,11 @@ function formatTxPlanArtifact(artifact) {
|
|
|
2094
2256
|
lines.push("");
|
|
2095
2257
|
lines.push(`From: ${artifact.from.accountName || artifact.from.address}`);
|
|
2096
2258
|
lines.push(`To: ${artifact.to.address}`);
|
|
2097
|
-
lines.push(`Amount: ${
|
|
2259
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
2098
2260
|
lines.push("");
|
|
2099
2261
|
lines.push(`Inputs: ${artifact.inputs.length}`);
|
|
2100
2262
|
lines.push(`Outputs: ${artifact.outputs.length}`);
|
|
2101
|
-
lines.push(`Fee: ${
|
|
2263
|
+
lines.push(`Fee: ${formatSompiToKas(BigInt(artifact.estimatedFeeSompi))}`);
|
|
2102
2264
|
lines.push(`Mass: ${artifact.estimatedMass}`);
|
|
2103
2265
|
lines.push("");
|
|
2104
2266
|
lines.push("Deterministic Planning Specifications:");
|
|
@@ -2123,8 +2285,8 @@ function formatTxReceiptArtifact(artifact) {
|
|
|
2123
2285
|
lines.push("");
|
|
2124
2286
|
lines.push(`From: ${artifact.from.address}`);
|
|
2125
2287
|
lines.push(`To: ${artifact.to.address}`);
|
|
2126
|
-
lines.push(`Amount: ${
|
|
2127
|
-
lines.push(`Fee: ${
|
|
2288
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
2289
|
+
lines.push(`Fee: ${formatSompiToKas(BigInt(artifact.feeSompi))}`);
|
|
2128
2290
|
return lines.join("\n");
|
|
2129
2291
|
}
|
|
2130
2292
|
function formatSignedTxArtifact(artifact) {
|
|
@@ -2141,7 +2303,7 @@ function formatSignedTxArtifact(artifact) {
|
|
|
2141
2303
|
lines.push("");
|
|
2142
2304
|
lines.push(`From: ${artifact.from.address}`);
|
|
2143
2305
|
lines.push(`To: ${artifact.to.address}`);
|
|
2144
|
-
lines.push(`Amount: ${
|
|
2306
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
2145
2307
|
lines.push("");
|
|
2146
2308
|
if (artifact.signedTransaction) {
|
|
2147
2309
|
lines.push(`Format: ${artifact.signedTransaction.format}`);
|
|
@@ -2207,11 +2369,12 @@ function safeParseBigInt(val, context) {
|
|
|
2207
2369
|
}
|
|
2208
2370
|
|
|
2209
2371
|
// src/tx-plan.ts
|
|
2372
|
+
import { HardkasSchemas as HardkasSchemas7 } from "@hardkas/core";
|
|
2210
2373
|
function createTxPlanArtifact(options) {
|
|
2211
2374
|
const artifact = {
|
|
2212
|
-
schema:
|
|
2375
|
+
schema: HardkasSchemas7.TxPlan,
|
|
2213
2376
|
hardkasVersion: HARDKAS_VERSION,
|
|
2214
|
-
schemaVersion:
|
|
2377
|
+
schemaVersion: HardkasSchemas7.ArtifactV1,
|
|
2215
2378
|
version: ARTIFACT_VERSION,
|
|
2216
2379
|
hashVersion: CURRENT_HASH_VERSION,
|
|
2217
2380
|
createdAt: new Date(options.ctx.clock.now()).toISOString(),
|
|
@@ -2283,10 +2446,11 @@ function createTxPlanArtifact(options) {
|
|
|
2283
2446
|
}
|
|
2284
2447
|
|
|
2285
2448
|
// src/signed-tx.ts
|
|
2449
|
+
import { HardkasSchemas as HardkasSchemas8 } from "@hardkas/core";
|
|
2286
2450
|
function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
2287
2451
|
const artifact = {
|
|
2288
|
-
schema:
|
|
2289
|
-
schemaVersion:
|
|
2452
|
+
schema: HardkasSchemas8.SignedTx,
|
|
2453
|
+
schemaVersion: HardkasSchemas8.ArtifactV1,
|
|
2290
2454
|
hardkasVersion: HARDKAS_VERSION,
|
|
2291
2455
|
version: ARTIFACT_VERSION,
|
|
2292
2456
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -2303,7 +2467,7 @@ function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
|
2303
2467
|
format: "simulated",
|
|
2304
2468
|
payload
|
|
2305
2469
|
},
|
|
2306
|
-
lineage: createLineageTransition(plan,
|
|
2470
|
+
lineage: createLineageTransition(plan, HardkasSchemas8.SignedTx),
|
|
2307
2471
|
...plan.workflowId ? { workflowId: plan.workflowId } : {},
|
|
2308
2472
|
...plan.assumptionLevel ? { assumptionLevel: plan.assumptionLevel } : {}
|
|
2309
2473
|
};
|
|
@@ -2317,8 +2481,8 @@ function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
|
2317
2481
|
}
|
|
2318
2482
|
function createSimulatedTxReceipt(plan, txId, ctx, extra) {
|
|
2319
2483
|
const artifact = {
|
|
2320
|
-
schema:
|
|
2321
|
-
schemaVersion:
|
|
2484
|
+
schema: HardkasSchemas8.TxReceipt,
|
|
2485
|
+
schemaVersion: HardkasSchemas8.TxReceiptV1,
|
|
2322
2486
|
hardkasVersion: HARDKAS_VERSION,
|
|
2323
2487
|
version: ARTIFACT_VERSION,
|
|
2324
2488
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -2338,7 +2502,7 @@ function createSimulatedTxReceipt(plan, txId, ctx, extra) {
|
|
|
2338
2502
|
preStateHash: extra?.preStateHash,
|
|
2339
2503
|
postStateHash: extra?.postStateHash,
|
|
2340
2504
|
dagContext: extra?.dagContext,
|
|
2341
|
-
lineage: createLineageTransition(plan,
|
|
2505
|
+
lineage: createLineageTransition(plan, HardkasSchemas8.TxReceipt),
|
|
2342
2506
|
...plan.workflowId ? { workflowId: plan.workflowId } : {},
|
|
2343
2507
|
...plan.assumptionLevel ? { assumptionLevel: plan.assumptionLevel } : {}
|
|
2344
2508
|
};
|
|
@@ -2568,6 +2732,7 @@ async function explainArtifact(artifactUnknown) {
|
|
|
2568
2732
|
import fs3 from "fs/promises";
|
|
2569
2733
|
import path3 from "path";
|
|
2570
2734
|
import { deterministicCompare as deterministicCompare3 } from "@hardkas/core";
|
|
2735
|
+
import { HardkasSchemas as HardkasSchemas9 } from "@hardkas/core";
|
|
2571
2736
|
function getDefaultL2ReceiptsDir(cwd = process.cwd()) {
|
|
2572
2737
|
return path3.join(cwd, ".hardkas", "l2-receipts");
|
|
2573
2738
|
}
|
|
@@ -2597,7 +2762,7 @@ async function listIgraTxReceiptArtifacts(options) {
|
|
|
2597
2762
|
for (const file of receiptFiles) {
|
|
2598
2763
|
try {
|
|
2599
2764
|
const data = await readArtifact(path3.join(dir, file));
|
|
2600
|
-
if (data && typeof data === "object" && data.schema ===
|
|
2765
|
+
if (data && typeof data === "object" && data.schema === HardkasSchemas9.IgraTxReceiptV1) {
|
|
2601
2766
|
receipts.push(data);
|
|
2602
2767
|
}
|
|
2603
2768
|
} catch (e) {
|
|
@@ -2673,9 +2838,10 @@ function isPrimitive(val) {
|
|
|
2673
2838
|
}
|
|
2674
2839
|
|
|
2675
2840
|
// src/deployment.ts
|
|
2841
|
+
import { HardkasSchemas as HardkasSchemas10 } from "@hardkas/core";
|
|
2676
2842
|
function createDeploymentRecord(opts) {
|
|
2677
2843
|
const recordDraft = {
|
|
2678
|
-
schema:
|
|
2844
|
+
schema: HardkasSchemas10.DeploymentV1,
|
|
2679
2845
|
label: opts.label,
|
|
2680
2846
|
networkId: opts.networkId,
|
|
2681
2847
|
status: opts.status || "planned",
|
|
@@ -2802,6 +2968,7 @@ export {
|
|
|
2802
2968
|
ARTIFACT_VERSION,
|
|
2803
2969
|
AccountRefSchema,
|
|
2804
2970
|
ArtifactLineageSchema,
|
|
2971
|
+
ArtifactTypes,
|
|
2805
2972
|
AssumptionSchema,
|
|
2806
2973
|
BaseArtifactSchema,
|
|
2807
2974
|
BasicCorrelationInvariant,
|
|
@@ -2809,6 +2976,7 @@ export {
|
|
|
2809
2976
|
CURRENT_HASH_VERSION,
|
|
2810
2977
|
DagContextSchema,
|
|
2811
2978
|
HARDKAS_VERSION,
|
|
2979
|
+
HardkasSchemas11 as HardkasSchemas,
|
|
2812
2980
|
HashInvariant,
|
|
2813
2981
|
InvariantWatcher,
|
|
2814
2982
|
LifecycleInvariant,
|
|
@@ -2818,6 +2986,12 @@ export {
|
|
|
2818
2986
|
NetworkInvariant,
|
|
2819
2987
|
NetworkProfileSchema,
|
|
2820
2988
|
PolicySchema,
|
|
2989
|
+
ProgrammabilityAppPlanSchema,
|
|
2990
|
+
ProgrammabilityCapabilitiesSchema,
|
|
2991
|
+
ProgrammabilityClaimsSchema,
|
|
2992
|
+
ProgrammabilityCorpusReportSchema,
|
|
2993
|
+
ProgrammabilityInspectSchema,
|
|
2994
|
+
ProgrammabilityVerifySchema,
|
|
2821
2995
|
ReplayInvariant,
|
|
2822
2996
|
RuntimeSessionSchema,
|
|
2823
2997
|
SEMANTIC_EXCLUSIONS,
|
|
@@ -2838,6 +3012,7 @@ export {
|
|
|
2838
3012
|
SilverSpendSimulationArtifactSchema,
|
|
2839
3013
|
SilverTestArtifactSchema,
|
|
2840
3014
|
SnapshotSchema,
|
|
3015
|
+
ToccataProgrammabilityCorpusSchema,
|
|
2841
3016
|
TxPlanSchema,
|
|
2842
3017
|
TxReceiptSchema,
|
|
2843
3018
|
TxTraceSchema,
|
|
@@ -2847,6 +3022,7 @@ export {
|
|
|
2847
3022
|
assertEvmAddress,
|
|
2848
3023
|
assertEvmTxHash,
|
|
2849
3024
|
assertHexData,
|
|
3025
|
+
assertKnownArtifactType,
|
|
2850
3026
|
assertValidIgraSignedTxArtifact,
|
|
2851
3027
|
assertValidIgraTxPlanArtifact,
|
|
2852
3028
|
assertValidIgraTxReceiptArtifact,
|
|
@@ -2867,6 +3043,7 @@ export {
|
|
|
2867
3043
|
createTxPlanArtifact,
|
|
2868
3044
|
defaultClock,
|
|
2869
3045
|
deleteDeployment,
|
|
3046
|
+
describeArtifactType,
|
|
2870
3047
|
detectArtifactVersion,
|
|
2871
3048
|
diffArtifacts,
|
|
2872
3049
|
explainArtifact,
|
|
@@ -2881,6 +3058,7 @@ export {
|
|
|
2881
3058
|
getMigrationPath,
|
|
2882
3059
|
getRegisteredMigrationSteps,
|
|
2883
3060
|
isIgraTxPlanArtifact,
|
|
3061
|
+
isKnownArtifactType,
|
|
2884
3062
|
listDeployments,
|
|
2885
3063
|
listIgraTxReceiptArtifacts,
|
|
2886
3064
|
loadDeployment,
|