@hardkas/artifacts 0.8.20-alpha → 0.9.1-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 +2220 -12
- package/dist/index.js +448 -85
- 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.
|
|
4
|
+
version: "0.9.1-alpha",
|
|
5
5
|
type: "module",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
author: "Javier Rodriguez",
|
|
@@ -34,8 +34,8 @@ var package_default = {
|
|
|
34
34
|
lint: "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
dependencies: {
|
|
37
|
-
"@hardkas/core": "
|
|
38
|
-
"@hardkas/tx-builder": "
|
|
37
|
+
"@hardkas/core": "workspace:*",
|
|
38
|
+
"@hardkas/tx-builder": "workspace:*",
|
|
39
39
|
zod: "^3.24.1"
|
|
40
40
|
},
|
|
41
41
|
devDependencies: {
|
|
@@ -47,24 +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:
|
|
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
|
|
66
81
|
};
|
|
67
82
|
|
|
83
|
+
// src/index.ts
|
|
84
|
+
import { HardkasSchemas as HardkasSchemas11, ArtifactTypes, isKnownArtifactType, assertKnownArtifactType, describeArtifactType } from "@hardkas/core";
|
|
85
|
+
|
|
68
86
|
// src/igra-artifacts.ts
|
|
69
87
|
function isIgraTxPlanArtifact(value) {
|
|
70
88
|
return validateIgraTxPlanArtifact(value).ok;
|
|
@@ -340,6 +358,7 @@ function calculateContentHash(obj, version = CURRENT_HASH_VERSION) {
|
|
|
340
358
|
|
|
341
359
|
// src/schemas.ts
|
|
342
360
|
import { z } from "zod";
|
|
361
|
+
import { HardkasSchemas as HardkasSchemas2 } from "@hardkas/core";
|
|
343
362
|
import {
|
|
344
363
|
kaspaNetworkIdSchema,
|
|
345
364
|
executionModeSchema
|
|
@@ -392,7 +411,7 @@ var AccountRefSchema = z.object({
|
|
|
392
411
|
input: z.string().optional()
|
|
393
412
|
});
|
|
394
413
|
var PolicySchema = BaseArtifactSchema.extend({
|
|
395
|
-
schema: z.literal(
|
|
414
|
+
schema: z.literal(HardkasSchemas2.PolicyV1),
|
|
396
415
|
decision: z.enum(["ALLOW", "DENY"]),
|
|
397
416
|
rules: z.array(
|
|
398
417
|
z.object({
|
|
@@ -403,13 +422,13 @@ var PolicySchema = BaseArtifactSchema.extend({
|
|
|
403
422
|
)
|
|
404
423
|
});
|
|
405
424
|
var NetworkProfileSchema = BaseArtifactSchema.extend({
|
|
406
|
-
schema: z.literal(
|
|
425
|
+
schema: z.literal(HardkasSchemas2.NetworkProfileV1),
|
|
407
426
|
networkProfileId: z.string(),
|
|
408
427
|
layer: z.string(),
|
|
409
428
|
capabilities: z.record(z.any())
|
|
410
429
|
});
|
|
411
430
|
var AssumptionSchema = BaseArtifactSchema.extend({
|
|
412
|
-
schema: z.literal(
|
|
431
|
+
schema: z.literal(HardkasSchemas2.AssumptionV1),
|
|
413
432
|
settlement: z.string().optional(),
|
|
414
433
|
securityModel: z.string().optional(),
|
|
415
434
|
bridgePhase: z.string().optional(),
|
|
@@ -417,7 +436,7 @@ var AssumptionSchema = BaseArtifactSchema.extend({
|
|
|
417
436
|
customAssumptions: z.record(z.any()).optional()
|
|
418
437
|
});
|
|
419
438
|
var MigrationReceiptSchema = BaseArtifactSchema.extend({
|
|
420
|
-
schema: z.literal(
|
|
439
|
+
schema: z.literal(HardkasSchemas2.MigrationReceiptV1),
|
|
421
440
|
oldHash: z.string(),
|
|
422
441
|
newHash: z.string(),
|
|
423
442
|
fromSchema: z.string(),
|
|
@@ -427,7 +446,7 @@ var MigrationReceiptSchema = BaseArtifactSchema.extend({
|
|
|
427
446
|
decision: z.literal("MIGRATED_WITH_PROOF")
|
|
428
447
|
});
|
|
429
448
|
var TxPlanSchema = BaseArtifactSchema.extend({
|
|
430
|
-
schema: z.literal(
|
|
449
|
+
schema: z.literal(HardkasSchemas2.TxPlan),
|
|
431
450
|
networkId: kaspaNetworkIdSchema,
|
|
432
451
|
mode: executionModeSchema,
|
|
433
452
|
planId: z.string(),
|
|
@@ -489,7 +508,7 @@ var LocalnetUtxoSchemaV2 = z.object({
|
|
|
489
508
|
createdAtDaaScore: z.string()
|
|
490
509
|
});
|
|
491
510
|
var SnapshotSchema = BaseArtifactSchema.extend({
|
|
492
|
-
schema: z.literal(
|
|
511
|
+
schema: z.literal(HardkasSchemas2.Snapshot),
|
|
493
512
|
name: z.string().optional(),
|
|
494
513
|
daaScore: z.string(),
|
|
495
514
|
accountsHash: z.string().optional(),
|
|
@@ -504,7 +523,7 @@ var SnapshotSchema = BaseArtifactSchema.extend({
|
|
|
504
523
|
utxos: z.array(LocalnetUtxoSchemaV2)
|
|
505
524
|
});
|
|
506
525
|
var TxReceiptSchema = BaseArtifactSchema.extend({
|
|
507
|
-
schema: z.literal(
|
|
526
|
+
schema: z.literal(HardkasSchemas2.TxReceipt),
|
|
508
527
|
txId: z.string(),
|
|
509
528
|
status: z.enum(["pending", "submitted", "accepted", "confirmed", "failed"]),
|
|
510
529
|
mode: executionModeSchema,
|
|
@@ -538,7 +557,7 @@ var SignatureMetadataEntrySchema = z.object({
|
|
|
538
557
|
signedAt: z.string().datetime()
|
|
539
558
|
});
|
|
540
559
|
var SignedTxSchema = BaseArtifactSchema.extend({
|
|
541
|
-
schema: z.literal(
|
|
560
|
+
schema: z.literal(HardkasSchemas2.SignedTx),
|
|
542
561
|
status: z.enum(["partially_signed", "signed"]),
|
|
543
562
|
signedId: z.string(),
|
|
544
563
|
sourcePlanId: z.string(),
|
|
@@ -562,7 +581,7 @@ var SignedTxSchema = BaseArtifactSchema.extend({
|
|
|
562
581
|
metadata: z.any().optional()
|
|
563
582
|
});
|
|
564
583
|
var TxTraceSchema = BaseArtifactSchema.extend({
|
|
565
|
-
schema: z.literal(
|
|
584
|
+
schema: z.literal(HardkasSchemas2.TxTrace),
|
|
566
585
|
txId: z.string(),
|
|
567
586
|
networkId: kaspaNetworkIdSchema,
|
|
568
587
|
mode: executionModeSchema,
|
|
@@ -577,7 +596,7 @@ var TxTraceSchema = BaseArtifactSchema.extend({
|
|
|
577
596
|
dagContext: DagContextSchema.optional()
|
|
578
597
|
});
|
|
579
598
|
var WorkflowSchema = BaseArtifactSchema.extend({
|
|
580
|
-
schema: z.literal(
|
|
599
|
+
schema: z.literal(HardkasSchemas2.WorkflowV1),
|
|
581
600
|
workflowId: z.string(),
|
|
582
601
|
status: z.enum(["pending", "running", "completed", "failed"]),
|
|
583
602
|
inputs: z.record(z.any()).optional(),
|
|
@@ -625,17 +644,296 @@ var RuntimeSessionSchema = BaseArtifactSchema.extend({
|
|
|
625
644
|
parentSessionId: z.string().optional(),
|
|
626
645
|
notes: z.string().optional()
|
|
627
646
|
});
|
|
647
|
+
var SilverCompileArtifactSchema = BaseArtifactSchema.extend({
|
|
648
|
+
schema: z.literal(HardkasSchemas2.SilverCompile),
|
|
649
|
+
sourcePath: z.string(),
|
|
650
|
+
sourceHash: z.string(),
|
|
651
|
+
compilerName: z.string(),
|
|
652
|
+
compilerVersion: z.string(),
|
|
653
|
+
compilerCommand: z.string(),
|
|
654
|
+
compiledScriptHex: z.string(),
|
|
655
|
+
compiledScriptHash: z.string(),
|
|
656
|
+
// semantic hash
|
|
657
|
+
abi: z.any().optional(),
|
|
658
|
+
network: z.string(),
|
|
659
|
+
assumptions: z.array(z.string()).optional()
|
|
660
|
+
});
|
|
661
|
+
var SilverDeployPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
662
|
+
schema: z.literal(HardkasSchemas2.SilverDeployPlan),
|
|
663
|
+
compileArtifactHash: z.string(),
|
|
664
|
+
compiledScriptHash: z.string(),
|
|
665
|
+
redeemScriptHex: z.string(),
|
|
666
|
+
redeemScriptHash: z.string(),
|
|
667
|
+
// blake2b32 of raw bytes
|
|
668
|
+
lockingScriptHex: z.string(),
|
|
669
|
+
scriptPublicKeyVersion: z.number(),
|
|
670
|
+
amountSompi: z.string(),
|
|
671
|
+
networkId: kaspaNetworkIdSchema,
|
|
672
|
+
deployerAddress: z.string()
|
|
673
|
+
});
|
|
674
|
+
var SilverDeployArtifactSchema = BaseArtifactSchema.extend({
|
|
675
|
+
schema: z.literal(HardkasSchemas2.SilverDeploy),
|
|
676
|
+
deployPlanHash: z.string(),
|
|
677
|
+
compileArtifactHash: z.string(),
|
|
678
|
+
compiledScriptHash: z.string(),
|
|
679
|
+
redeemScriptHex: z.string(),
|
|
680
|
+
redeemScriptHash: z.string(),
|
|
681
|
+
lockingScriptHex: z.string(),
|
|
682
|
+
scriptPublicKeyVersion: z.number(),
|
|
683
|
+
deployTxId: z.string(),
|
|
684
|
+
outputIndex: z.number(),
|
|
685
|
+
amountSompi: z.string(),
|
|
686
|
+
networkId: kaspaNetworkIdSchema,
|
|
687
|
+
nodeVersion: z.string()
|
|
688
|
+
});
|
|
689
|
+
var SilverScriptArgSchema = z.object({
|
|
690
|
+
type: z.literal("hex"),
|
|
691
|
+
value: z.string()
|
|
692
|
+
});
|
|
693
|
+
var SilverSpendPlanArtifactSchema = BaseArtifactSchema.extend({
|
|
694
|
+
schema: z.literal(HardkasSchemas2.SilverSpendPlan),
|
|
695
|
+
deployArtifactHash: z.string(),
|
|
696
|
+
compileArtifactHash: z.string(),
|
|
697
|
+
redeemScriptHash: z.string(),
|
|
698
|
+
lockingScriptHex: z.string(),
|
|
699
|
+
contractUtxoRef: z.object({
|
|
700
|
+
transactionId: z.string(),
|
|
701
|
+
index: z.number()
|
|
702
|
+
}),
|
|
703
|
+
args: z.array(SilverScriptArgSchema),
|
|
704
|
+
argsHash: z.string(),
|
|
705
|
+
signatureScriptHex: z.string(),
|
|
706
|
+
expectedOutputs: z.array(
|
|
707
|
+
z.object({
|
|
708
|
+
address: z.string(),
|
|
709
|
+
amountSompi: z.string(),
|
|
710
|
+
scriptHash: z.string().optional()
|
|
711
|
+
})
|
|
712
|
+
),
|
|
713
|
+
networkId: kaspaNetworkIdSchema,
|
|
714
|
+
assumptionLevel: z.string().optional()
|
|
715
|
+
});
|
|
716
|
+
var SilverSpendReceiptArtifactSchema = BaseArtifactSchema.extend({
|
|
717
|
+
schema: z.literal(HardkasSchemas2.SilverSpendReceipt),
|
|
718
|
+
spendPlanHash: z.string(),
|
|
719
|
+
deployArtifactHash: z.string().optional(),
|
|
720
|
+
redeemScriptHash: z.string().optional(),
|
|
721
|
+
lockingScriptHex: z.string().optional(),
|
|
722
|
+
signatureScriptHex: z.string().optional(),
|
|
723
|
+
spentOutpoint: z.object({
|
|
724
|
+
transactionId: z.string(),
|
|
725
|
+
index: z.number()
|
|
726
|
+
}).optional(),
|
|
727
|
+
expectedOutputs: z.array(
|
|
728
|
+
z.object({
|
|
729
|
+
address: z.string(),
|
|
730
|
+
amountSompi: z.string(),
|
|
731
|
+
scriptHash: z.string().optional()
|
|
732
|
+
})
|
|
733
|
+
).optional(),
|
|
734
|
+
txId: z.string(),
|
|
735
|
+
status: z.enum(["simulated", "submitted", "accepted", "rejected"])
|
|
736
|
+
});
|
|
737
|
+
var SilverDeploySimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
738
|
+
schema: z.literal(HardkasSchemas2.SilverDeploySimulation),
|
|
739
|
+
deployPlanHash: z.string(),
|
|
740
|
+
compileArtifactHash: z.string(),
|
|
741
|
+
compiledScriptHash: z.string(),
|
|
742
|
+
redeemScriptHex: z.string(),
|
|
743
|
+
redeemScriptHash: z.string(),
|
|
744
|
+
lockingScriptHex: z.string(),
|
|
745
|
+
scriptPublicKeyVersion: z.literal(0),
|
|
746
|
+
simulatedDeployTxId: z.string(),
|
|
747
|
+
syntheticOutpoint: z.object({
|
|
748
|
+
transactionId: z.string(),
|
|
749
|
+
index: z.number()
|
|
750
|
+
}),
|
|
751
|
+
amountSompi: z.string(),
|
|
752
|
+
feeSompi: z.string(),
|
|
753
|
+
status: z.literal("SIMULATED_ACCEPTED")
|
|
754
|
+
});
|
|
755
|
+
var SilverSpendSimulationArtifactSchema = BaseArtifactSchema.extend({
|
|
756
|
+
schema: z.literal(HardkasSchemas2.SilverSpendSimulation),
|
|
757
|
+
deploySimulationHash: z.string(),
|
|
758
|
+
spendPlanHash: z.string(),
|
|
759
|
+
redeemScriptHash: z.string(),
|
|
760
|
+
lockingScriptHex: z.string(),
|
|
761
|
+
signatureScriptHex: z.string(),
|
|
762
|
+
simulatedSpendTxId: z.string(),
|
|
763
|
+
spentOutpoint: z.object({
|
|
764
|
+
transactionId: z.string(),
|
|
765
|
+
index: z.number()
|
|
766
|
+
}),
|
|
767
|
+
expectedOutputs: z.array(
|
|
768
|
+
z.object({
|
|
769
|
+
address: z.string(),
|
|
770
|
+
amountSompi: z.string(),
|
|
771
|
+
scriptHash: z.string().optional()
|
|
772
|
+
})
|
|
773
|
+
),
|
|
774
|
+
feeSompi: z.string(),
|
|
775
|
+
status: z.literal("SIMULATED_ACCEPTED")
|
|
776
|
+
});
|
|
777
|
+
var SilverTestArtifactSchema = BaseArtifactSchema.extend({
|
|
778
|
+
schema: z.literal(HardkasSchemas2.SilverTest),
|
|
779
|
+
compileArtifactHash: z.string(),
|
|
780
|
+
sourceHash: z.string(),
|
|
781
|
+
compiledScriptHash: z.string(),
|
|
782
|
+
testVectorsHash: z.string().optional().nullable(),
|
|
783
|
+
compilerName: z.string(),
|
|
784
|
+
compilerVersion: z.string(),
|
|
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
|
+
),
|
|
798
|
+
status: z.enum([
|
|
799
|
+
"PASS",
|
|
800
|
+
"FAIL",
|
|
801
|
+
"PARTIAL_TEST_VECTOR_SUPPORT",
|
|
802
|
+
"EXPECTED_COMPILER_FAILURE"
|
|
803
|
+
])
|
|
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
|
+
});
|
|
628
924
|
|
|
629
925
|
// src/verify.ts
|
|
630
926
|
import fs from "fs";
|
|
631
927
|
import path from "path";
|
|
928
|
+
import { HardkasSchemas as HardkasSchemas5 } from "@hardkas/core";
|
|
632
929
|
|
|
633
930
|
// src/feeVerify.ts
|
|
634
931
|
import {
|
|
635
932
|
estimateTransactionMass
|
|
636
933
|
} from "@hardkas/tx-builder";
|
|
934
|
+
import { HardkasSchemas as HardkasSchemas3 } from "@hardkas/core";
|
|
637
935
|
function recomputeMass(artifact) {
|
|
638
|
-
if (artifact.schema ===
|
|
936
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
639
937
|
const plan = artifact;
|
|
640
938
|
const result = estimateTransactionMass({
|
|
641
939
|
inputCount: (plan.inputs || []).length,
|
|
@@ -646,7 +944,7 @@ function recomputeMass(artifact) {
|
|
|
646
944
|
});
|
|
647
945
|
return result.mass;
|
|
648
946
|
}
|
|
649
|
-
if (artifact.schema ===
|
|
947
|
+
if (artifact.schema === HardkasSchemas3.TxReceipt) {
|
|
650
948
|
const receipt = artifact;
|
|
651
949
|
return BigInt(receipt.mass || 0);
|
|
652
950
|
}
|
|
@@ -659,7 +957,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
659
957
|
let inputTotal = 0n;
|
|
660
958
|
let outputTotal = 0n;
|
|
661
959
|
let feeRate = 1n;
|
|
662
|
-
if (artifact.schema ===
|
|
960
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
663
961
|
const plan = artifact;
|
|
664
962
|
artifactMass = BigInt(plan.estimatedMass || 0);
|
|
665
963
|
artifactFee = BigInt(plan.estimatedFeeSompi || 0);
|
|
@@ -672,7 +970,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
672
970
|
0n
|
|
673
971
|
);
|
|
674
972
|
if (plan.change) outputTotal += BigInt(plan.change.amountSompi || 0);
|
|
675
|
-
} else if (artifact.schema ===
|
|
973
|
+
} else if (artifact.schema === HardkasSchemas3.TxReceipt) {
|
|
676
974
|
const receipt = artifact;
|
|
677
975
|
artifactMass = BigInt(receipt.mass || 0);
|
|
678
976
|
artifactFee = BigInt(receipt.feeSompi);
|
|
@@ -699,7 +997,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
699
997
|
if (artifactFee < 0n) {
|
|
700
998
|
issues.push("Economic violation: Negative fee detected");
|
|
701
999
|
}
|
|
702
|
-
if (artifact.schema ===
|
|
1000
|
+
if (artifact.schema === HardkasSchemas3.TxPlan) {
|
|
703
1001
|
const plan = artifact;
|
|
704
1002
|
(plan.outputs || []).forEach((o, i) => {
|
|
705
1003
|
if (BigInt(o.amountSompi || 0) < 600n) {
|
|
@@ -720,6 +1018,7 @@ function verifyFeeSemantics(artifact) {
|
|
|
720
1018
|
}
|
|
721
1019
|
|
|
722
1020
|
// src/lineage.ts
|
|
1021
|
+
import { HardkasSchemas as HardkasSchemas4 } from "@hardkas/core";
|
|
723
1022
|
function verifyLineage(artifact, parent, options = {}) {
|
|
724
1023
|
const issues = [];
|
|
725
1024
|
const addIssue = (code, message, severity = "error") => {
|
|
@@ -727,7 +1026,7 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
727
1026
|
};
|
|
728
1027
|
const lineage = artifact.lineage;
|
|
729
1028
|
if (!lineage) {
|
|
730
|
-
const isWorkflow = artifact.schema ===
|
|
1029
|
+
const isWorkflow = artifact.schema === HardkasSchemas4.WorkflowV1;
|
|
731
1030
|
const severity = options.strict && !isWorkflow ? "error" : "warning";
|
|
732
1031
|
if (!isWorkflow || options.strict) {
|
|
733
1032
|
addIssue("MISSING_LINEAGE", "Artifact has no lineage metadata", severity);
|
|
@@ -817,15 +1116,19 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
817
1116
|
}
|
|
818
1117
|
if (parent) {
|
|
819
1118
|
const validTransitions = {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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]
|
|
824
1127
|
};
|
|
825
1128
|
let isValidTransition = false;
|
|
826
|
-
if (parent.schema ===
|
|
1129
|
+
if (parent.schema === HardkasSchemas4.MigrationReceiptV1) {
|
|
827
1130
|
isValidTransition = parent.toSchema === artifact.schema;
|
|
828
|
-
} else if (artifact.schema ===
|
|
1131
|
+
} else if (artifact.schema === HardkasSchemas4.MigrationReceiptV1) {
|
|
829
1132
|
isValidTransition = artifact.fromSchema === parent.schema;
|
|
830
1133
|
} else {
|
|
831
1134
|
const allowed = validTransitions[parent.schema] || [];
|
|
@@ -911,7 +1214,7 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
911
1214
|
result.artifactType = v.schema;
|
|
912
1215
|
result.version = v.version;
|
|
913
1216
|
result.expectedHash = v.contentHash;
|
|
914
|
-
if (v.schema ===
|
|
1217
|
+
if (v.schema === HardkasSchemas5.ReplayReportV1) {
|
|
915
1218
|
result.ok = true;
|
|
916
1219
|
return result;
|
|
917
1220
|
}
|
|
@@ -957,36 +1260,60 @@ function verifyArtifactIntegritySync(artifactOrPath, context = {}) {
|
|
|
957
1260
|
}
|
|
958
1261
|
let schema;
|
|
959
1262
|
switch (v.schema) {
|
|
960
|
-
case
|
|
1263
|
+
case HardkasSchemas5.Snapshot:
|
|
961
1264
|
schema = SnapshotSchema;
|
|
962
1265
|
break;
|
|
963
|
-
case
|
|
1266
|
+
case HardkasSchemas5.TxPlan:
|
|
964
1267
|
schema = TxPlanSchema;
|
|
965
1268
|
break;
|
|
966
|
-
case
|
|
1269
|
+
case HardkasSchemas5.TxReceipt:
|
|
967
1270
|
schema = TxReceiptSchema;
|
|
968
1271
|
break;
|
|
969
|
-
case
|
|
1272
|
+
case HardkasSchemas5.TxTrace:
|
|
970
1273
|
schema = TxTraceSchema;
|
|
971
1274
|
break;
|
|
972
|
-
case
|
|
1275
|
+
case HardkasSchemas5.SignedTx:
|
|
973
1276
|
schema = SignedTxSchema;
|
|
974
1277
|
break;
|
|
975
|
-
case
|
|
1278
|
+
case HardkasSchemas5.WorkflowV1:
|
|
976
1279
|
schema = WorkflowSchema;
|
|
977
1280
|
break;
|
|
978
|
-
case
|
|
1281
|
+
case HardkasSchemas5.PolicyV1:
|
|
979
1282
|
schema = PolicySchema;
|
|
980
1283
|
break;
|
|
981
|
-
case
|
|
1284
|
+
case HardkasSchemas5.NetworkProfileV1:
|
|
982
1285
|
schema = NetworkProfileSchema;
|
|
983
1286
|
break;
|
|
984
|
-
case
|
|
1287
|
+
case HardkasSchemas5.AssumptionV1:
|
|
985
1288
|
schema = AssumptionSchema;
|
|
986
1289
|
break;
|
|
987
|
-
case
|
|
1290
|
+
case HardkasSchemas5.MigrationReceiptV1:
|
|
988
1291
|
schema = MigrationReceiptSchema;
|
|
989
1292
|
break;
|
|
1293
|
+
case HardkasSchemas5.SilverCompile:
|
|
1294
|
+
schema = SilverCompileArtifactSchema;
|
|
1295
|
+
break;
|
|
1296
|
+
case HardkasSchemas5.SilverDeployPlan:
|
|
1297
|
+
schema = SilverDeployPlanArtifactSchema;
|
|
1298
|
+
break;
|
|
1299
|
+
case HardkasSchemas5.SilverDeploy:
|
|
1300
|
+
schema = SilverDeployArtifactSchema;
|
|
1301
|
+
break;
|
|
1302
|
+
case HardkasSchemas5.SilverTest:
|
|
1303
|
+
schema = SilverTestArtifactSchema;
|
|
1304
|
+
break;
|
|
1305
|
+
case HardkasSchemas5.SilverSpendPlan:
|
|
1306
|
+
schema = SilverSpendPlanArtifactSchema;
|
|
1307
|
+
break;
|
|
1308
|
+
case HardkasSchemas5.SilverSpendReceipt:
|
|
1309
|
+
schema = SilverSpendReceiptArtifactSchema;
|
|
1310
|
+
break;
|
|
1311
|
+
case HardkasSchemas5.SilverDeploySimulation:
|
|
1312
|
+
schema = SilverDeploySimulationArtifactSchema;
|
|
1313
|
+
break;
|
|
1314
|
+
case HardkasSchemas5.SilverSpendSimulation:
|
|
1315
|
+
schema = SilverSpendSimulationArtifactSchema;
|
|
1316
|
+
break;
|
|
990
1317
|
}
|
|
991
1318
|
if (schema) {
|
|
992
1319
|
const validation = schema.safeParse(v);
|
|
@@ -1136,7 +1463,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1136
1463
|
message: `Policy reference mismatch: expected ${ref}, got ${refObj.contentHash}`
|
|
1137
1464
|
});
|
|
1138
1465
|
} else {
|
|
1139
|
-
if (refObj.schema ===
|
|
1466
|
+
if (refObj.schema === HardkasSchemas5.PolicyV1) {
|
|
1140
1467
|
if (refObj.decision === "DENY") {
|
|
1141
1468
|
addIssue({
|
|
1142
1469
|
code: "POLICY_VIOLATION",
|
|
@@ -1259,9 +1586,9 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1259
1586
|
const lineage = v.lineage;
|
|
1260
1587
|
if (lineage?.parentArtifactId && lineage?.parentArtifactId !== lineage?.artifactId) {
|
|
1261
1588
|
parentId = lineage?.parentArtifactId;
|
|
1262
|
-
} else if (v.schema ===
|
|
1589
|
+
} else if (v.schema === HardkasSchemas5.SignedTx) {
|
|
1263
1590
|
parentId = v.sourcePlanId;
|
|
1264
|
-
} else if (v.schema ===
|
|
1591
|
+
} else if (v.schema === HardkasSchemas5.TxReceipt) {
|
|
1265
1592
|
parentId = v.sourceSignedId || lineage?.parentArtifactId;
|
|
1266
1593
|
}
|
|
1267
1594
|
if (parentId) {
|
|
@@ -1288,7 +1615,10 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1288
1615
|
});
|
|
1289
1616
|
} else {
|
|
1290
1617
|
try {
|
|
1291
|
-
const parentSem = verifyArtifactSemantics(parentObj, {
|
|
1618
|
+
const parentSem = verifyArtifactSemantics(parentObj, {
|
|
1619
|
+
...context,
|
|
1620
|
+
strict: true
|
|
1621
|
+
});
|
|
1292
1622
|
if (!parentSem.ok) {
|
|
1293
1623
|
parentSem.issues.forEach((issue) => addIssue(issue));
|
|
1294
1624
|
}
|
|
@@ -1321,7 +1651,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1321
1651
|
}
|
|
1322
1652
|
}
|
|
1323
1653
|
const lineageAudit = verifyLineage(v, parentObj || context.parent, { strict });
|
|
1324
|
-
if (!lineageAudit.ok || strict && !v.lineage && v.schema !==
|
|
1654
|
+
if (!lineageAudit.ok || strict && !v.lineage && v.schema !== HardkasSchemas5.WorkflowV1) {
|
|
1325
1655
|
lineageAudit.issues.forEach((issue) => {
|
|
1326
1656
|
addIssue(issue);
|
|
1327
1657
|
});
|
|
@@ -1335,7 +1665,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1335
1665
|
severity: "error",
|
|
1336
1666
|
message: "Strict mode requires workflowId"
|
|
1337
1667
|
});
|
|
1338
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1668
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1339
1669
|
addIssue({
|
|
1340
1670
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1341
1671
|
severity: "error",
|
|
@@ -1354,7 +1684,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1354
1684
|
severity: "warning",
|
|
1355
1685
|
message: "Missing workflowId"
|
|
1356
1686
|
});
|
|
1357
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1687
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1358
1688
|
addIssue({
|
|
1359
1689
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1360
1690
|
severity: "warning",
|
|
@@ -1368,7 +1698,7 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
1368
1698
|
severity: "warning",
|
|
1369
1699
|
message: "Missing workflowId"
|
|
1370
1700
|
});
|
|
1371
|
-
if (!v.assumptionLevel && v.schema !==
|
|
1701
|
+
if (!v.assumptionLevel && v.schema !== HardkasSchemas5.WorkflowV1)
|
|
1372
1702
|
addIssue({
|
|
1373
1703
|
code: "MISSING_ASSUMPTION_LEVEL",
|
|
1374
1704
|
severity: "warning",
|
|
@@ -1560,7 +1890,8 @@ import {
|
|
|
1560
1890
|
asWorkflowId,
|
|
1561
1891
|
asCorrelationId,
|
|
1562
1892
|
asNetworkId,
|
|
1563
|
-
asEventSequence
|
|
1893
|
+
asEventSequence,
|
|
1894
|
+
getTelemetry
|
|
1564
1895
|
} from "@hardkas/core";
|
|
1565
1896
|
var InvariantWatcher = class {
|
|
1566
1897
|
invariants;
|
|
@@ -1590,7 +1921,15 @@ var InvariantWatcher = class {
|
|
|
1590
1921
|
this.emitViolation(event, violation);
|
|
1591
1922
|
}
|
|
1592
1923
|
} catch (e) {
|
|
1593
|
-
|
|
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
|
+
}
|
|
1594
1933
|
}
|
|
1595
1934
|
}
|
|
1596
1935
|
});
|
|
@@ -1633,9 +1972,12 @@ var InvariantWatcher = class {
|
|
|
1633
1972
|
};
|
|
1634
1973
|
|
|
1635
1974
|
// src/migration.ts
|
|
1975
|
+
import { HardkasSchemas as HardkasSchemas6 } from "@hardkas/core";
|
|
1636
1976
|
var MigrationRequiredError = class extends Error {
|
|
1637
1977
|
constructor(oldVersion, targetVersion) {
|
|
1638
|
-
super(
|
|
1978
|
+
super(
|
|
1979
|
+
`MIGRATION_REQUIRED: Artifact requires explicit migration from ${oldVersion} to ${targetVersion}`
|
|
1980
|
+
);
|
|
1639
1981
|
this.oldVersion = oldVersion;
|
|
1640
1982
|
this.targetVersion = targetVersion;
|
|
1641
1983
|
this.name = "MigrationRequiredError";
|
|
@@ -1668,16 +2010,16 @@ registerMigrationStep({
|
|
|
1668
2010
|
migrated.lineage = { ...migrated.lineage };
|
|
1669
2011
|
}
|
|
1670
2012
|
if (typeof migrated.schema === "string" && migrated.schema.endsWith(".v1")) {
|
|
1671
|
-
if (migrated.schema !==
|
|
2013
|
+
if (migrated.schema !== HardkasSchemas6.WorkflowV1) {
|
|
1672
2014
|
migrated.schema = migrated.schema.replace(/\.v1$/, "");
|
|
1673
2015
|
}
|
|
1674
2016
|
}
|
|
1675
2017
|
migrated.version = ARTIFACT_VERSION;
|
|
1676
|
-
if (migrated.schema ===
|
|
2018
|
+
if (migrated.schema === HardkasSchemas6.TxPlan && migrated.selectedUtxos !== void 0) {
|
|
1677
2019
|
migrated.inputs = migrated.selectedUtxos;
|
|
1678
2020
|
delete migrated.selectedUtxos;
|
|
1679
2021
|
}
|
|
1680
|
-
if (migrated.schema ===
|
|
2022
|
+
if (migrated.schema === HardkasSchemas6.Snapshot && Array.isArray(migrated.utxos)) {
|
|
1681
2023
|
migrated.utxos = sortUtxosByOutpoint(migrated.utxos);
|
|
1682
2024
|
}
|
|
1683
2025
|
if (!migrated.hardkasVersion) {
|
|
@@ -1802,7 +2144,7 @@ function generateMigrationReceipt(oldArtifact, newArtifact, migrationId) {
|
|
|
1802
2144
|
const oldHash = oldArtifact.contentHash || calculateContentHash(oldArtifact, CURRENT_HASH_VERSION);
|
|
1803
2145
|
const newHash = newArtifact.contentHash || calculateContentHash(newArtifact, CURRENT_HASH_VERSION);
|
|
1804
2146
|
const receipt = {
|
|
1805
|
-
schema:
|
|
2147
|
+
schema: HardkasSchemas6.MigrationReceiptV1,
|
|
1806
2148
|
hardkasVersion: HARDKAS_VERSION,
|
|
1807
2149
|
version: ARTIFACT_VERSION,
|
|
1808
2150
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -1842,10 +2184,6 @@ async function writeArtifact(filePath, artifact) {
|
|
|
1842
2184
|
const id = artifactObj.planId || artifactObj.signedId || artifactObj.txId || Date.now().toString(36);
|
|
1843
2185
|
const prefix = artifactObj.schema ? artifactObj.schema.split(".")[1] || "artifact" : "artifact";
|
|
1844
2186
|
targetPath = path2.join(filePath, `${prefix}-${id}.json`);
|
|
1845
|
-
console.log(
|
|
1846
|
-
`
|
|
1847
|
-
Note: Provided path is a directory. Auto-generating artifact filename: ${path2.basename(targetPath)}`
|
|
1848
|
-
);
|
|
1849
2187
|
}
|
|
1850
2188
|
} catch (e) {
|
|
1851
2189
|
if (filePath.endsWith("/") || filePath.endsWith("\\")) {
|
|
@@ -1903,7 +2241,7 @@ async function readTxReceiptArtifact(filePath) {
|
|
|
1903
2241
|
}
|
|
1904
2242
|
|
|
1905
2243
|
// src/format.ts
|
|
1906
|
-
import {
|
|
2244
|
+
import { formatSompiToKas } from "@hardkas/core";
|
|
1907
2245
|
function formatTxPlanArtifact(artifact) {
|
|
1908
2246
|
const lines = [];
|
|
1909
2247
|
lines.push("HardKAS Transaction Plan Artifact (v2)");
|
|
@@ -1918,11 +2256,11 @@ function formatTxPlanArtifact(artifact) {
|
|
|
1918
2256
|
lines.push("");
|
|
1919
2257
|
lines.push(`From: ${artifact.from.accountName || artifact.from.address}`);
|
|
1920
2258
|
lines.push(`To: ${artifact.to.address}`);
|
|
1921
|
-
lines.push(`Amount: ${
|
|
2259
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
1922
2260
|
lines.push("");
|
|
1923
2261
|
lines.push(`Inputs: ${artifact.inputs.length}`);
|
|
1924
2262
|
lines.push(`Outputs: ${artifact.outputs.length}`);
|
|
1925
|
-
lines.push(`Fee: ${
|
|
2263
|
+
lines.push(`Fee: ${formatSompiToKas(BigInt(artifact.estimatedFeeSompi))}`);
|
|
1926
2264
|
lines.push(`Mass: ${artifact.estimatedMass}`);
|
|
1927
2265
|
lines.push("");
|
|
1928
2266
|
lines.push("Deterministic Planning Specifications:");
|
|
@@ -1947,8 +2285,8 @@ function formatTxReceiptArtifact(artifact) {
|
|
|
1947
2285
|
lines.push("");
|
|
1948
2286
|
lines.push(`From: ${artifact.from.address}`);
|
|
1949
2287
|
lines.push(`To: ${artifact.to.address}`);
|
|
1950
|
-
lines.push(`Amount: ${
|
|
1951
|
-
lines.push(`Fee: ${
|
|
2288
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
2289
|
+
lines.push(`Fee: ${formatSompiToKas(BigInt(artifact.feeSompi))}`);
|
|
1952
2290
|
return lines.join("\n");
|
|
1953
2291
|
}
|
|
1954
2292
|
function formatSignedTxArtifact(artifact) {
|
|
@@ -1965,7 +2303,7 @@ function formatSignedTxArtifact(artifact) {
|
|
|
1965
2303
|
lines.push("");
|
|
1966
2304
|
lines.push(`From: ${artifact.from.address}`);
|
|
1967
2305
|
lines.push(`To: ${artifact.to.address}`);
|
|
1968
|
-
lines.push(`Amount: ${
|
|
2306
|
+
lines.push(`Amount: ${formatSompiToKas(BigInt(artifact.amountSompi))}`);
|
|
1969
2307
|
lines.push("");
|
|
1970
2308
|
if (artifact.signedTransaction) {
|
|
1971
2309
|
lines.push(`Format: ${artifact.signedTransaction.format}`);
|
|
@@ -2031,11 +2369,12 @@ function safeParseBigInt(val, context) {
|
|
|
2031
2369
|
}
|
|
2032
2370
|
|
|
2033
2371
|
// src/tx-plan.ts
|
|
2372
|
+
import { HardkasSchemas as HardkasSchemas7 } from "@hardkas/core";
|
|
2034
2373
|
function createTxPlanArtifact(options) {
|
|
2035
2374
|
const artifact = {
|
|
2036
|
-
schema:
|
|
2375
|
+
schema: HardkasSchemas7.TxPlan,
|
|
2037
2376
|
hardkasVersion: HARDKAS_VERSION,
|
|
2038
|
-
schemaVersion:
|
|
2377
|
+
schemaVersion: HardkasSchemas7.ArtifactV1,
|
|
2039
2378
|
version: ARTIFACT_VERSION,
|
|
2040
2379
|
hashVersion: CURRENT_HASH_VERSION,
|
|
2041
2380
|
createdAt: new Date(options.ctx.clock.now()).toISOString(),
|
|
@@ -2107,10 +2446,11 @@ function createTxPlanArtifact(options) {
|
|
|
2107
2446
|
}
|
|
2108
2447
|
|
|
2109
2448
|
// src/signed-tx.ts
|
|
2449
|
+
import { HardkasSchemas as HardkasSchemas8 } from "@hardkas/core";
|
|
2110
2450
|
function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
2111
2451
|
const artifact = {
|
|
2112
|
-
schema:
|
|
2113
|
-
schemaVersion:
|
|
2452
|
+
schema: HardkasSchemas8.SignedTx,
|
|
2453
|
+
schemaVersion: HardkasSchemas8.ArtifactV1,
|
|
2114
2454
|
hardkasVersion: HARDKAS_VERSION,
|
|
2115
2455
|
version: ARTIFACT_VERSION,
|
|
2116
2456
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -2127,7 +2467,7 @@ function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
|
2127
2467
|
format: "simulated",
|
|
2128
2468
|
payload
|
|
2129
2469
|
},
|
|
2130
|
-
lineage: createLineageTransition(plan,
|
|
2470
|
+
lineage: createLineageTransition(plan, HardkasSchemas8.SignedTx),
|
|
2131
2471
|
...plan.workflowId ? { workflowId: plan.workflowId } : {},
|
|
2132
2472
|
...plan.assumptionLevel ? { assumptionLevel: plan.assumptionLevel } : {}
|
|
2133
2473
|
};
|
|
@@ -2141,8 +2481,8 @@ function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
|
2141
2481
|
}
|
|
2142
2482
|
function createSimulatedTxReceipt(plan, txId, ctx, extra) {
|
|
2143
2483
|
const artifact = {
|
|
2144
|
-
schema:
|
|
2145
|
-
schemaVersion:
|
|
2484
|
+
schema: HardkasSchemas8.TxReceipt,
|
|
2485
|
+
schemaVersion: HardkasSchemas8.TxReceiptV1,
|
|
2146
2486
|
hardkasVersion: HARDKAS_VERSION,
|
|
2147
2487
|
version: ARTIFACT_VERSION,
|
|
2148
2488
|
hashVersion: CURRENT_HASH_VERSION,
|
|
@@ -2162,7 +2502,7 @@ function createSimulatedTxReceipt(plan, txId, ctx, extra) {
|
|
|
2162
2502
|
preStateHash: extra?.preStateHash,
|
|
2163
2503
|
postStateHash: extra?.postStateHash,
|
|
2164
2504
|
dagContext: extra?.dagContext,
|
|
2165
|
-
lineage: createLineageTransition(plan,
|
|
2505
|
+
lineage: createLineageTransition(plan, HardkasSchemas8.TxReceipt),
|
|
2166
2506
|
...plan.workflowId ? { workflowId: plan.workflowId } : {},
|
|
2167
2507
|
...plan.assumptionLevel ? { assumptionLevel: plan.assumptionLevel } : {}
|
|
2168
2508
|
};
|
|
@@ -2392,6 +2732,7 @@ async function explainArtifact(artifactUnknown) {
|
|
|
2392
2732
|
import fs3 from "fs/promises";
|
|
2393
2733
|
import path3 from "path";
|
|
2394
2734
|
import { deterministicCompare as deterministicCompare3 } from "@hardkas/core";
|
|
2735
|
+
import { HardkasSchemas as HardkasSchemas9 } from "@hardkas/core";
|
|
2395
2736
|
function getDefaultL2ReceiptsDir(cwd = process.cwd()) {
|
|
2396
2737
|
return path3.join(cwd, ".hardkas", "l2-receipts");
|
|
2397
2738
|
}
|
|
@@ -2421,7 +2762,7 @@ async function listIgraTxReceiptArtifacts(options) {
|
|
|
2421
2762
|
for (const file of receiptFiles) {
|
|
2422
2763
|
try {
|
|
2423
2764
|
const data = await readArtifact(path3.join(dir, file));
|
|
2424
|
-
if (data && typeof data === "object" && data.schema ===
|
|
2765
|
+
if (data && typeof data === "object" && data.schema === HardkasSchemas9.IgraTxReceiptV1) {
|
|
2425
2766
|
receipts.push(data);
|
|
2426
2767
|
}
|
|
2427
2768
|
} catch (e) {
|
|
@@ -2497,9 +2838,10 @@ function isPrimitive(val) {
|
|
|
2497
2838
|
}
|
|
2498
2839
|
|
|
2499
2840
|
// src/deployment.ts
|
|
2841
|
+
import { HardkasSchemas as HardkasSchemas10 } from "@hardkas/core";
|
|
2500
2842
|
function createDeploymentRecord(opts) {
|
|
2501
2843
|
const recordDraft = {
|
|
2502
|
-
schema:
|
|
2844
|
+
schema: HardkasSchemas10.DeploymentV1,
|
|
2503
2845
|
label: opts.label,
|
|
2504
2846
|
networkId: opts.networkId,
|
|
2505
2847
|
status: opts.status || "planned",
|
|
@@ -2626,6 +2968,7 @@ export {
|
|
|
2626
2968
|
ARTIFACT_VERSION,
|
|
2627
2969
|
AccountRefSchema,
|
|
2628
2970
|
ArtifactLineageSchema,
|
|
2971
|
+
ArtifactTypes,
|
|
2629
2972
|
AssumptionSchema,
|
|
2630
2973
|
BaseArtifactSchema,
|
|
2631
2974
|
BasicCorrelationInvariant,
|
|
@@ -2633,6 +2976,7 @@ export {
|
|
|
2633
2976
|
CURRENT_HASH_VERSION,
|
|
2634
2977
|
DagContextSchema,
|
|
2635
2978
|
HARDKAS_VERSION,
|
|
2979
|
+
HardkasSchemas11 as HardkasSchemas,
|
|
2636
2980
|
HashInvariant,
|
|
2637
2981
|
InvariantWatcher,
|
|
2638
2982
|
LifecycleInvariant,
|
|
@@ -2642,6 +2986,12 @@ export {
|
|
|
2642
2986
|
NetworkInvariant,
|
|
2643
2987
|
NetworkProfileSchema,
|
|
2644
2988
|
PolicySchema,
|
|
2989
|
+
ProgrammabilityAppPlanSchema,
|
|
2990
|
+
ProgrammabilityCapabilitiesSchema,
|
|
2991
|
+
ProgrammabilityClaimsSchema,
|
|
2992
|
+
ProgrammabilityCorpusReportSchema,
|
|
2993
|
+
ProgrammabilityInspectSchema,
|
|
2994
|
+
ProgrammabilityVerifySchema,
|
|
2645
2995
|
ReplayInvariant,
|
|
2646
2996
|
RuntimeSessionSchema,
|
|
2647
2997
|
SEMANTIC_EXCLUSIONS,
|
|
@@ -2652,7 +3002,17 @@ export {
|
|
|
2652
3002
|
SignatureEntrySchema,
|
|
2653
3003
|
SignatureMetadataEntrySchema,
|
|
2654
3004
|
SignedTxSchema,
|
|
3005
|
+
SilverCompileArtifactSchema,
|
|
3006
|
+
SilverDeployArtifactSchema,
|
|
3007
|
+
SilverDeployPlanArtifactSchema,
|
|
3008
|
+
SilverDeploySimulationArtifactSchema,
|
|
3009
|
+
SilverScriptArgSchema,
|
|
3010
|
+
SilverSpendPlanArtifactSchema,
|
|
3011
|
+
SilverSpendReceiptArtifactSchema,
|
|
3012
|
+
SilverSpendSimulationArtifactSchema,
|
|
3013
|
+
SilverTestArtifactSchema,
|
|
2655
3014
|
SnapshotSchema,
|
|
3015
|
+
ToccataProgrammabilityCorpusSchema,
|
|
2656
3016
|
TxPlanSchema,
|
|
2657
3017
|
TxReceiptSchema,
|
|
2658
3018
|
TxTraceSchema,
|
|
@@ -2662,6 +3022,7 @@ export {
|
|
|
2662
3022
|
assertEvmAddress,
|
|
2663
3023
|
assertEvmTxHash,
|
|
2664
3024
|
assertHexData,
|
|
3025
|
+
assertKnownArtifactType,
|
|
2665
3026
|
assertValidIgraSignedTxArtifact,
|
|
2666
3027
|
assertValidIgraTxPlanArtifact,
|
|
2667
3028
|
assertValidIgraTxReceiptArtifact,
|
|
@@ -2682,6 +3043,7 @@ export {
|
|
|
2682
3043
|
createTxPlanArtifact,
|
|
2683
3044
|
defaultClock,
|
|
2684
3045
|
deleteDeployment,
|
|
3046
|
+
describeArtifactType,
|
|
2685
3047
|
detectArtifactVersion,
|
|
2686
3048
|
diffArtifacts,
|
|
2687
3049
|
explainArtifact,
|
|
@@ -2696,6 +3058,7 @@ export {
|
|
|
2696
3058
|
getMigrationPath,
|
|
2697
3059
|
getRegisteredMigrationSteps,
|
|
2698
3060
|
isIgraTxPlanArtifact,
|
|
3061
|
+
isKnownArtifactType,
|
|
2699
3062
|
listDeployments,
|
|
2700
3063
|
listIgraTxReceiptArtifacts,
|
|
2701
3064
|
loadDeployment,
|