@hardkas/artifacts 0.5.5-alpha → 0.6.0-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/dist/index.d.ts +278 -32
- package/dist/index.js +197 -61
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ArtifactType, NetworkId, ExecutionMode, ContentHash, WorkflowId, ArtifactId, LineageId, EventSequence, TxId, KaspaAddress, CorruptionCode, CorruptionSeverity, EventEnvelope } from '@hardkas/core';
|
|
1
|
+
import { ArtifactType, NetworkId, ExecutionMode, ContentHash, WorkflowId, ArtifactId, LineageId, EventSequence, TxId, KaspaAddress, CorruptionCode, CorruptionSeverity, EventEnvelope, RuntimeContext } from '@hardkas/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { TxOutput, Utxo, TxPlan as TxPlan$1 } from '@hardkas/tx-builder';
|
|
4
4
|
|
|
5
|
-
declare const HARDKAS_VERSION
|
|
5
|
+
declare const HARDKAS_VERSION: string;
|
|
6
6
|
declare const ARTIFACT_SCHEMAS: {
|
|
7
7
|
readonly LOCALNET_STATE: "hardkas.localnetState.v1";
|
|
8
8
|
readonly REAL_ACCOUNT_STORE: "hardkas.realAccountStore.v1";
|
|
@@ -19,6 +19,7 @@ type HardkasArtifactSchema = typeof ARTIFACT_SCHEMAS[keyof typeof ARTIFACT_SCHEM
|
|
|
19
19
|
type HardkasArtifactMode = "simulated" | "node" | "rpc" | "l2-rpc" | "real";
|
|
20
20
|
|
|
21
21
|
declare const ARTIFACT_VERSION = "1.0.0-alpha";
|
|
22
|
+
type DraftArtifact<TFinal, THashFields extends keyof TFinal> = Omit<TFinal, THashFields> & Partial<Pick<TFinal, THashFields>>;
|
|
22
23
|
declare const ArtifactLineageSchema: z.ZodObject<{
|
|
23
24
|
artifactId: z.ZodString;
|
|
24
25
|
lineageId: z.ZodString;
|
|
@@ -43,7 +44,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
|
|
|
43
44
|
hardkasVersion: z.ZodString;
|
|
44
45
|
version: z.ZodLiteral<"1.0.0-alpha">;
|
|
45
46
|
hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
46
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
47
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
47
48
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
48
49
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
49
50
|
createdAt: z.ZodString;
|
|
@@ -70,7 +71,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
|
|
|
70
71
|
schema: string;
|
|
71
72
|
hardkasVersion: string;
|
|
72
73
|
version: "1.0.0-alpha";
|
|
73
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
74
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
74
75
|
mode: "simulated" | "real" | "readonly";
|
|
75
76
|
createdAt: string;
|
|
76
77
|
hashVersion?: string | number | undefined;
|
|
@@ -86,7 +87,7 @@ declare const BaseArtifactSchema: z.ZodObject<{
|
|
|
86
87
|
schema: string;
|
|
87
88
|
hardkasVersion: string;
|
|
88
89
|
version: "1.0.0-alpha";
|
|
89
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
90
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
90
91
|
mode: "simulated" | "real" | "readonly";
|
|
91
92
|
createdAt: string;
|
|
92
93
|
hashVersion?: string | number | undefined;
|
|
@@ -139,7 +140,7 @@ declare const TxPlanSchema: z.ZodObject<{
|
|
|
139
140
|
}>>;
|
|
140
141
|
} & {
|
|
141
142
|
schema: z.ZodLiteral<"hardkas.txPlan">;
|
|
142
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
143
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
143
144
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
144
145
|
planId: z.ZodString;
|
|
145
146
|
from: z.ZodObject<{
|
|
@@ -221,7 +222,7 @@ declare const TxPlanSchema: z.ZodObject<{
|
|
|
221
222
|
schema: "hardkas.txPlan";
|
|
222
223
|
hardkasVersion: string;
|
|
223
224
|
version: "1.0.0-alpha";
|
|
224
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
225
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
225
226
|
mode: "simulated" | "real" | "readonly";
|
|
226
227
|
createdAt: string;
|
|
227
228
|
planId: string;
|
|
@@ -267,7 +268,7 @@ declare const TxPlanSchema: z.ZodObject<{
|
|
|
267
268
|
schema: "hardkas.txPlan";
|
|
268
269
|
hardkasVersion: string;
|
|
269
270
|
version: "1.0.0-alpha";
|
|
270
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
271
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
271
272
|
mode: "simulated" | "real" | "readonly";
|
|
272
273
|
createdAt: string;
|
|
273
274
|
planId: string;
|
|
@@ -381,7 +382,7 @@ declare const SnapshotSchema: z.ZodObject<{
|
|
|
381
382
|
hardkasVersion: z.ZodString;
|
|
382
383
|
version: z.ZodLiteral<"1.0.0-alpha">;
|
|
383
384
|
hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
384
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
385
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
385
386
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
386
387
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
387
388
|
createdAt: z.ZodString;
|
|
@@ -444,7 +445,7 @@ declare const SnapshotSchema: z.ZodObject<{
|
|
|
444
445
|
schema: "hardkas.snapshot";
|
|
445
446
|
hardkasVersion: string;
|
|
446
447
|
version: "1.0.0-alpha";
|
|
447
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
448
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
448
449
|
mode: "simulated" | "real" | "readonly";
|
|
449
450
|
createdAt: string;
|
|
450
451
|
daaScore: string;
|
|
@@ -476,7 +477,7 @@ declare const SnapshotSchema: z.ZodObject<{
|
|
|
476
477
|
schema: "hardkas.snapshot";
|
|
477
478
|
hardkasVersion: string;
|
|
478
479
|
version: "1.0.0-alpha";
|
|
479
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
480
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
480
481
|
mode: "simulated" | "real" | "readonly";
|
|
481
482
|
createdAt: string;
|
|
482
483
|
daaScore: string;
|
|
@@ -535,7 +536,7 @@ declare const TxReceiptSchema: z.ZodObject<{
|
|
|
535
536
|
txId: z.ZodString;
|
|
536
537
|
status: z.ZodEnum<["pending", "submitted", "accepted", "confirmed", "failed"]>;
|
|
537
538
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
538
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
539
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
539
540
|
from: z.ZodObject<{
|
|
540
541
|
address: z.ZodString;
|
|
541
542
|
accountName: z.ZodOptional<z.ZodString>;
|
|
@@ -624,13 +625,14 @@ declare const TxReceiptSchema: z.ZodObject<{
|
|
|
624
625
|
tracePath: z.ZodOptional<z.ZodString>;
|
|
625
626
|
rpcUrl: z.ZodOptional<z.ZodString>;
|
|
626
627
|
sourceSignedId: z.ZodOptional<z.ZodString>;
|
|
628
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
627
629
|
metadata: z.ZodOptional<z.ZodAny>;
|
|
628
630
|
}, "strip", z.ZodTypeAny, {
|
|
629
631
|
status: "pending" | "submitted" | "accepted" | "confirmed" | "failed";
|
|
630
632
|
schema: "hardkas.txReceipt";
|
|
631
633
|
hardkasVersion: string;
|
|
632
634
|
version: "1.0.0-alpha";
|
|
633
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
635
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
634
636
|
mode: "simulated" | "real" | "readonly";
|
|
635
637
|
createdAt: string;
|
|
636
638
|
from: {
|
|
@@ -681,13 +683,14 @@ declare const TxReceiptSchema: z.ZodObject<{
|
|
|
681
683
|
} | undefined;
|
|
682
684
|
tracePath?: string | undefined;
|
|
683
685
|
sourceSignedId?: string | undefined;
|
|
686
|
+
errors?: string[] | undefined;
|
|
684
687
|
metadata?: any;
|
|
685
688
|
}, {
|
|
686
689
|
status: "pending" | "submitted" | "accepted" | "confirmed" | "failed";
|
|
687
690
|
schema: "hardkas.txReceipt";
|
|
688
691
|
hardkasVersion: string;
|
|
689
692
|
version: "1.0.0-alpha";
|
|
690
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
693
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
691
694
|
mode: "simulated" | "real" | "readonly";
|
|
692
695
|
createdAt: string;
|
|
693
696
|
from: {
|
|
@@ -738,6 +741,7 @@ declare const TxReceiptSchema: z.ZodObject<{
|
|
|
738
741
|
} | undefined;
|
|
739
742
|
tracePath?: string | undefined;
|
|
740
743
|
sourceSignedId?: string | undefined;
|
|
744
|
+
errors?: string[] | undefined;
|
|
741
745
|
metadata?: any;
|
|
742
746
|
}>;
|
|
743
747
|
declare const SignedTxSchema: z.ZodObject<{
|
|
@@ -770,7 +774,7 @@ declare const SignedTxSchema: z.ZodObject<{
|
|
|
770
774
|
status: z.ZodLiteral<"signed">;
|
|
771
775
|
signedId: z.ZodString;
|
|
772
776
|
sourcePlanId: z.ZodString;
|
|
773
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
777
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
774
778
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
775
779
|
from: z.ZodObject<{
|
|
776
780
|
address: z.ZodString;
|
|
@@ -816,7 +820,7 @@ declare const SignedTxSchema: z.ZodObject<{
|
|
|
816
820
|
schema: "hardkas.signedTx";
|
|
817
821
|
hardkasVersion: string;
|
|
818
822
|
version: "1.0.0-alpha";
|
|
819
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
823
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
820
824
|
mode: "simulated" | "real" | "readonly";
|
|
821
825
|
createdAt: string;
|
|
822
826
|
from: {
|
|
@@ -852,7 +856,7 @@ declare const SignedTxSchema: z.ZodObject<{
|
|
|
852
856
|
schema: "hardkas.signedTx";
|
|
853
857
|
hardkasVersion: string;
|
|
854
858
|
version: "1.0.0-alpha";
|
|
855
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
859
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
856
860
|
mode: "simulated" | "real" | "readonly";
|
|
857
861
|
createdAt: string;
|
|
858
862
|
from: {
|
|
@@ -912,7 +916,7 @@ declare const TxTraceSchema: z.ZodObject<{
|
|
|
912
916
|
} & {
|
|
913
917
|
schema: z.ZodLiteral<"hardkas.txTrace">;
|
|
914
918
|
txId: z.ZodString;
|
|
915
|
-
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
919
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
916
920
|
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
917
921
|
steps: z.ZodArray<z.ZodObject<{
|
|
918
922
|
phase: z.ZodString;
|
|
@@ -982,7 +986,7 @@ declare const TxTraceSchema: z.ZodObject<{
|
|
|
982
986
|
schema: "hardkas.txTrace";
|
|
983
987
|
hardkasVersion: string;
|
|
984
988
|
version: "1.0.0-alpha";
|
|
985
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
989
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
986
990
|
mode: "simulated" | "real" | "readonly";
|
|
987
991
|
createdAt: string;
|
|
988
992
|
txId: string;
|
|
@@ -1019,7 +1023,7 @@ declare const TxTraceSchema: z.ZodObject<{
|
|
|
1019
1023
|
schema: "hardkas.txTrace";
|
|
1020
1024
|
hardkasVersion: string;
|
|
1021
1025
|
version: "1.0.0-alpha";
|
|
1022
|
-
networkId: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
1026
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
1023
1027
|
mode: "simulated" | "real" | "readonly";
|
|
1024
1028
|
createdAt: string;
|
|
1025
1029
|
txId: string;
|
|
@@ -1053,12 +1057,218 @@ declare const TxTraceSchema: z.ZodObject<{
|
|
|
1053
1057
|
nonSelectedContext?: boolean | undefined;
|
|
1054
1058
|
} | undefined;
|
|
1055
1059
|
}>;
|
|
1060
|
+
declare const WorkflowSchema: z.ZodObject<{
|
|
1061
|
+
hardkasVersion: z.ZodString;
|
|
1062
|
+
version: z.ZodLiteral<"1.0.0-alpha">;
|
|
1063
|
+
hashVersion: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
1064
|
+
networkId: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
1065
|
+
mode: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
1066
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
1067
|
+
createdAt: z.ZodString;
|
|
1068
|
+
lineage: z.ZodOptional<z.ZodObject<{
|
|
1069
|
+
artifactId: z.ZodString;
|
|
1070
|
+
lineageId: z.ZodString;
|
|
1071
|
+
parentArtifactId: z.ZodOptional<z.ZodString>;
|
|
1072
|
+
rootArtifactId: z.ZodString;
|
|
1073
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
1074
|
+
}, "strip", z.ZodTypeAny, {
|
|
1075
|
+
artifactId: string;
|
|
1076
|
+
lineageId: string;
|
|
1077
|
+
rootArtifactId: string;
|
|
1078
|
+
parentArtifactId?: string | undefined;
|
|
1079
|
+
sequence?: number | undefined;
|
|
1080
|
+
}, {
|
|
1081
|
+
artifactId: string;
|
|
1082
|
+
lineageId: string;
|
|
1083
|
+
rootArtifactId: string;
|
|
1084
|
+
parentArtifactId?: string | undefined;
|
|
1085
|
+
sequence?: number | undefined;
|
|
1086
|
+
}>>;
|
|
1087
|
+
} & {
|
|
1088
|
+
schema: z.ZodLiteral<"hardkas.workflow.v1">;
|
|
1089
|
+
workflowId: z.ZodString;
|
|
1090
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed"]>;
|
|
1091
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1092
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
1093
|
+
type: z.ZodString;
|
|
1094
|
+
status: z.ZodEnum<["pending", "success", "failed", "skipped"]>;
|
|
1095
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
1096
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
1097
|
+
producedArtifactId: z.ZodOptional<z.ZodString>;
|
|
1098
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1099
|
+
}, "strip", z.ZodTypeAny, {
|
|
1100
|
+
type: string;
|
|
1101
|
+
status: "pending" | "failed" | "success" | "skipped";
|
|
1102
|
+
startedAt?: string | undefined;
|
|
1103
|
+
completedAt?: string | undefined;
|
|
1104
|
+
producedArtifactId?: string | undefined;
|
|
1105
|
+
error?: string | undefined;
|
|
1106
|
+
}, {
|
|
1107
|
+
type: string;
|
|
1108
|
+
status: "pending" | "failed" | "success" | "skipped";
|
|
1109
|
+
startedAt?: string | undefined;
|
|
1110
|
+
completedAt?: string | undefined;
|
|
1111
|
+
producedArtifactId?: string | undefined;
|
|
1112
|
+
error?: string | undefined;
|
|
1113
|
+
}>, "many">;
|
|
1114
|
+
parentArtifacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1115
|
+
producedArtifacts: z.ZodArray<z.ZodString, "many">;
|
|
1116
|
+
generationRange: z.ZodOptional<z.ZodObject<{
|
|
1117
|
+
start: z.ZodOptional<z.ZodString>;
|
|
1118
|
+
end: z.ZodOptional<z.ZodString>;
|
|
1119
|
+
}, "strip", z.ZodTypeAny, {
|
|
1120
|
+
start?: string | undefined;
|
|
1121
|
+
end?: string | undefined;
|
|
1122
|
+
}, {
|
|
1123
|
+
start?: string | undefined;
|
|
1124
|
+
end?: string | undefined;
|
|
1125
|
+
}>>;
|
|
1126
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
1127
|
+
allowNetwork: z.ZodBoolean;
|
|
1128
|
+
allowMainnet: z.ZodBoolean;
|
|
1129
|
+
allowExternalWallet: z.ZodBoolean;
|
|
1130
|
+
requireDryRun: z.ZodBoolean;
|
|
1131
|
+
}, "strip", z.ZodTypeAny, {
|
|
1132
|
+
allowNetwork: boolean;
|
|
1133
|
+
allowMainnet: boolean;
|
|
1134
|
+
allowExternalWallet: boolean;
|
|
1135
|
+
requireDryRun: boolean;
|
|
1136
|
+
}, {
|
|
1137
|
+
allowNetwork: boolean;
|
|
1138
|
+
allowMainnet: boolean;
|
|
1139
|
+
allowExternalWallet: boolean;
|
|
1140
|
+
requireDryRun: boolean;
|
|
1141
|
+
}>>;
|
|
1142
|
+
generationId: z.ZodOptional<z.ZodString>;
|
|
1143
|
+
replayResult: z.ZodOptional<z.ZodObject<{
|
|
1144
|
+
verified: z.ZodBoolean;
|
|
1145
|
+
stateHash: z.ZodOptional<z.ZodString>;
|
|
1146
|
+
}, "strip", z.ZodTypeAny, {
|
|
1147
|
+
verified: boolean;
|
|
1148
|
+
stateHash?: string | undefined;
|
|
1149
|
+
}, {
|
|
1150
|
+
verified: boolean;
|
|
1151
|
+
stateHash?: string | undefined;
|
|
1152
|
+
}>>;
|
|
1153
|
+
errorEnvelope: z.ZodOptional<z.ZodObject<{
|
|
1154
|
+
code: z.ZodString;
|
|
1155
|
+
message: z.ZodString;
|
|
1156
|
+
redacted: z.ZodBoolean;
|
|
1157
|
+
}, "strip", z.ZodTypeAny, {
|
|
1158
|
+
code: string;
|
|
1159
|
+
message: string;
|
|
1160
|
+
redacted: boolean;
|
|
1161
|
+
}, {
|
|
1162
|
+
code: string;
|
|
1163
|
+
message: string;
|
|
1164
|
+
redacted: boolean;
|
|
1165
|
+
}>>;
|
|
1166
|
+
}, "strip", z.ZodTypeAny, {
|
|
1167
|
+
status: "pending" | "failed" | "running" | "completed";
|
|
1168
|
+
schema: "hardkas.workflow.v1";
|
|
1169
|
+
hardkasVersion: string;
|
|
1170
|
+
version: "1.0.0-alpha";
|
|
1171
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
1172
|
+
mode: "simulated" | "real" | "readonly";
|
|
1173
|
+
createdAt: string;
|
|
1174
|
+
steps: {
|
|
1175
|
+
type: string;
|
|
1176
|
+
status: "pending" | "failed" | "success" | "skipped";
|
|
1177
|
+
startedAt?: string | undefined;
|
|
1178
|
+
completedAt?: string | undefined;
|
|
1179
|
+
producedArtifactId?: string | undefined;
|
|
1180
|
+
error?: string | undefined;
|
|
1181
|
+
}[];
|
|
1182
|
+
workflowId: string;
|
|
1183
|
+
producedArtifacts: string[];
|
|
1184
|
+
hashVersion?: string | number | undefined;
|
|
1185
|
+
contentHash?: string | undefined;
|
|
1186
|
+
lineage?: {
|
|
1187
|
+
artifactId: string;
|
|
1188
|
+
lineageId: string;
|
|
1189
|
+
rootArtifactId: string;
|
|
1190
|
+
parentArtifactId?: string | undefined;
|
|
1191
|
+
sequence?: number | undefined;
|
|
1192
|
+
} | undefined;
|
|
1193
|
+
inputs?: Record<string, any> | undefined;
|
|
1194
|
+
parentArtifacts?: string[] | undefined;
|
|
1195
|
+
generationRange?: {
|
|
1196
|
+
start?: string | undefined;
|
|
1197
|
+
end?: string | undefined;
|
|
1198
|
+
} | undefined;
|
|
1199
|
+
policy?: {
|
|
1200
|
+
allowNetwork: boolean;
|
|
1201
|
+
allowMainnet: boolean;
|
|
1202
|
+
allowExternalWallet: boolean;
|
|
1203
|
+
requireDryRun: boolean;
|
|
1204
|
+
} | undefined;
|
|
1205
|
+
generationId?: string | undefined;
|
|
1206
|
+
replayResult?: {
|
|
1207
|
+
verified: boolean;
|
|
1208
|
+
stateHash?: string | undefined;
|
|
1209
|
+
} | undefined;
|
|
1210
|
+
errorEnvelope?: {
|
|
1211
|
+
code: string;
|
|
1212
|
+
message: string;
|
|
1213
|
+
redacted: boolean;
|
|
1214
|
+
} | undefined;
|
|
1215
|
+
}, {
|
|
1216
|
+
status: "pending" | "failed" | "running" | "completed";
|
|
1217
|
+
schema: "hardkas.workflow.v1";
|
|
1218
|
+
hardkasVersion: string;
|
|
1219
|
+
version: "1.0.0-alpha";
|
|
1220
|
+
networkId: "simulated" | "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
1221
|
+
mode: "simulated" | "real" | "readonly";
|
|
1222
|
+
createdAt: string;
|
|
1223
|
+
steps: {
|
|
1224
|
+
type: string;
|
|
1225
|
+
status: "pending" | "failed" | "success" | "skipped";
|
|
1226
|
+
startedAt?: string | undefined;
|
|
1227
|
+
completedAt?: string | undefined;
|
|
1228
|
+
producedArtifactId?: string | undefined;
|
|
1229
|
+
error?: string | undefined;
|
|
1230
|
+
}[];
|
|
1231
|
+
workflowId: string;
|
|
1232
|
+
producedArtifacts: string[];
|
|
1233
|
+
hashVersion?: string | number | undefined;
|
|
1234
|
+
contentHash?: string | undefined;
|
|
1235
|
+
lineage?: {
|
|
1236
|
+
artifactId: string;
|
|
1237
|
+
lineageId: string;
|
|
1238
|
+
rootArtifactId: string;
|
|
1239
|
+
parentArtifactId?: string | undefined;
|
|
1240
|
+
sequence?: number | undefined;
|
|
1241
|
+
} | undefined;
|
|
1242
|
+
inputs?: Record<string, any> | undefined;
|
|
1243
|
+
parentArtifacts?: string[] | undefined;
|
|
1244
|
+
generationRange?: {
|
|
1245
|
+
start?: string | undefined;
|
|
1246
|
+
end?: string | undefined;
|
|
1247
|
+
} | undefined;
|
|
1248
|
+
policy?: {
|
|
1249
|
+
allowNetwork: boolean;
|
|
1250
|
+
allowMainnet: boolean;
|
|
1251
|
+
allowExternalWallet: boolean;
|
|
1252
|
+
requireDryRun: boolean;
|
|
1253
|
+
} | undefined;
|
|
1254
|
+
generationId?: string | undefined;
|
|
1255
|
+
replayResult?: {
|
|
1256
|
+
verified: boolean;
|
|
1257
|
+
stateHash?: string | undefined;
|
|
1258
|
+
} | undefined;
|
|
1259
|
+
errorEnvelope?: {
|
|
1260
|
+
code: string;
|
|
1261
|
+
message: string;
|
|
1262
|
+
redacted: boolean;
|
|
1263
|
+
} | undefined;
|
|
1264
|
+
}>;
|
|
1056
1265
|
type TxPlan = z.infer<typeof TxPlanSchema>;
|
|
1057
1266
|
type Snapshot = z.infer<typeof SnapshotSchema>;
|
|
1058
1267
|
type TxReceipt = z.infer<typeof TxReceiptSchema>;
|
|
1059
1268
|
type SignedTx = z.infer<typeof SignedTxSchema>;
|
|
1060
1269
|
type TxTrace = z.infer<typeof TxTraceSchema>;
|
|
1061
1270
|
type DagContext$1 = z.infer<typeof DagContextSchema>;
|
|
1271
|
+
type Workflow = z.infer<typeof WorkflowSchema>;
|
|
1062
1272
|
|
|
1063
1273
|
interface ArtifactValidationResult {
|
|
1064
1274
|
ok: boolean;
|
|
@@ -1133,10 +1343,10 @@ declare function validateIgraSignedTxArtifact(value: unknown): ArtifactValidatio
|
|
|
1133
1343
|
declare function assertValidIgraSignedTxArtifact(value: unknown): asserts value is IgraSignedTxArtifact;
|
|
1134
1344
|
declare function validateIgraTxReceiptArtifact(value: unknown): ArtifactValidationResult;
|
|
1135
1345
|
declare function assertValidIgraTxReceiptArtifact(value: unknown): asserts value is IgraTxReceiptArtifact;
|
|
1136
|
-
declare function assertDecimalBigIntString(value:
|
|
1137
|
-
declare function assertHexData(value:
|
|
1138
|
-
declare function assertEvmAddress(value:
|
|
1139
|
-
declare function assertEvmTxHash(value:
|
|
1346
|
+
declare function assertDecimalBigIntString(value: unknown, field: string, errors: string[]): void;
|
|
1347
|
+
declare function assertHexData(value: unknown, field: string, errors: string[]): void;
|
|
1348
|
+
declare function assertEvmAddress(value: unknown, field: string, errors: string[]): void;
|
|
1349
|
+
declare function assertEvmTxHash(value: unknown, field: string, errors: string[]): void;
|
|
1140
1350
|
declare function createIgraPlanId(hash: string): string;
|
|
1141
1351
|
declare function createIgraSignedId(hash: string): string;
|
|
1142
1352
|
declare function createIgraDeployPlanId(hash: string): string;
|
|
@@ -1386,6 +1596,41 @@ interface TxTraceArtifact extends BaseArtifact<"txTrace"> {
|
|
|
1386
1596
|
dagContext?: DagContext | undefined;
|
|
1387
1597
|
}
|
|
1388
1598
|
|
|
1599
|
+
interface WorkflowArtifact extends BaseArtifact<"workflow.v1"> {
|
|
1600
|
+
workflowId: WorkflowId;
|
|
1601
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
1602
|
+
inputs?: Record<string, any>;
|
|
1603
|
+
steps: Array<{
|
|
1604
|
+
type: string;
|
|
1605
|
+
status: "pending" | "success" | "failed" | "skipped";
|
|
1606
|
+
startedAt?: string;
|
|
1607
|
+
completedAt?: string;
|
|
1608
|
+
producedArtifactId?: string;
|
|
1609
|
+
error?: string;
|
|
1610
|
+
}>;
|
|
1611
|
+
parentArtifacts?: string[];
|
|
1612
|
+
producedArtifacts: string[];
|
|
1613
|
+
generationRange?: {
|
|
1614
|
+
start?: string;
|
|
1615
|
+
end?: string;
|
|
1616
|
+
};
|
|
1617
|
+
policy?: {
|
|
1618
|
+
allowNetwork: boolean;
|
|
1619
|
+
allowMainnet: boolean;
|
|
1620
|
+
allowExternalWallet: boolean;
|
|
1621
|
+
requireDryRun: boolean;
|
|
1622
|
+
};
|
|
1623
|
+
generationId?: string;
|
|
1624
|
+
replayResult?: {
|
|
1625
|
+
verified: boolean;
|
|
1626
|
+
stateHash?: string;
|
|
1627
|
+
};
|
|
1628
|
+
errorEnvelope?: {
|
|
1629
|
+
code: string;
|
|
1630
|
+
message: string;
|
|
1631
|
+
redacted: boolean;
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1389
1634
|
interface DeploymentRecord extends HardkasArtifactBase {
|
|
1390
1635
|
schema: "hardkas.deployment.v1";
|
|
1391
1636
|
/** Human-readable label (e.g., "initial-funding", "vault-covenant-v1") */
|
|
@@ -1444,12 +1689,12 @@ declare const CURRENT_HASH_VERSION = 3;
|
|
|
1444
1689
|
* Excludes fields in SEMANTIC_EXCLUSIONS during serialization.
|
|
1445
1690
|
* Skips keys with undefined values (matching JSON.stringify behavior).
|
|
1446
1691
|
*/
|
|
1447
|
-
declare function canonicalStringify(obj:
|
|
1692
|
+
declare function canonicalStringify(obj: unknown, version?: number): string;
|
|
1448
1693
|
/**
|
|
1449
1694
|
* Calculates a SHA-256 hash of the canonical JSON representation.
|
|
1450
1695
|
* Always excludes fields in SEMANTIC_EXCLUSIONS from the calculation.
|
|
1451
1696
|
*/
|
|
1452
|
-
declare function calculateContentHash(obj:
|
|
1697
|
+
declare function calculateContentHash(obj: unknown, version?: number): string;
|
|
1453
1698
|
|
|
1454
1699
|
interface Clock {
|
|
1455
1700
|
now(): number;
|
|
@@ -1635,10 +1880,10 @@ declare class InvariantWatcher {
|
|
|
1635
1880
|
*/
|
|
1636
1881
|
declare function migrateToCanonical(v1Artifact: any): any;
|
|
1637
1882
|
|
|
1638
|
-
declare const bigIntReplacer: (_key: string, value:
|
|
1883
|
+
declare const bigIntReplacer: (_key: string, value: unknown) => unknown;
|
|
1639
1884
|
declare function writeArtifact(filePath: string, artifact: unknown): Promise<void>;
|
|
1640
1885
|
declare function getDefaultReceiptPath(txId: string, cwd?: string): string;
|
|
1641
|
-
declare function readArtifact(filePath: string): Promise<
|
|
1886
|
+
declare function readArtifact(filePath: string): Promise<unknown>;
|
|
1642
1887
|
declare function readTxPlanArtifact(filePath: string): Promise<TxPlan>;
|
|
1643
1888
|
declare function readSignedTxArtifact(filePath: string): Promise<SignedTx>;
|
|
1644
1889
|
declare function readTxReceiptArtifact(filePath: string): Promise<TxReceipt>;
|
|
@@ -1688,6 +1933,7 @@ interface CreateTxPlanArtifactOptions {
|
|
|
1688
1933
|
amountSompi: bigint;
|
|
1689
1934
|
plan: TxPlan$1;
|
|
1690
1935
|
rpcUrl?: string;
|
|
1936
|
+
ctx: RuntimeContext;
|
|
1691
1937
|
}
|
|
1692
1938
|
/**
|
|
1693
1939
|
* Creates a canonical TxPlan artifact from a TxBuilder plan.
|
|
@@ -1697,11 +1943,11 @@ declare function createTxPlanArtifact(options: CreateTxPlanArtifactOptions): TxP
|
|
|
1697
1943
|
/**
|
|
1698
1944
|
* Creates a canonical simulated signed transaction artifact.
|
|
1699
1945
|
*/
|
|
1700
|
-
declare function createSimulatedSignedTxArtifact(plan: TxPlan, payload: string): SignedTx;
|
|
1946
|
+
declare function createSimulatedSignedTxArtifact(plan: TxPlan, payload: string, ctx: RuntimeContext): SignedTx;
|
|
1701
1947
|
/**
|
|
1702
1948
|
* Creates a canonical simulated receipt.
|
|
1703
1949
|
*/
|
|
1704
|
-
declare function createSimulatedTxReceipt(plan: TxPlan, txId: string, extra?: {
|
|
1950
|
+
declare function createSimulatedTxReceipt(plan: TxPlan, txId: string, ctx: RuntimeContext, extra?: {
|
|
1705
1951
|
spentUtxoIds?: string[];
|
|
1706
1952
|
createdUtxoIds?: string[];
|
|
1707
1953
|
daaScore?: string;
|
|
@@ -1766,7 +2012,7 @@ interface ArtifactExplanation {
|
|
|
1766
2012
|
/**
|
|
1767
2013
|
* Generates a deep operational explanation of a HardKAS artifact.
|
|
1768
2014
|
*/
|
|
1769
|
-
declare function explainArtifact(
|
|
2015
|
+
declare function explainArtifact(artifactUnknown: unknown): Promise<ArtifactExplanation>;
|
|
1770
2016
|
|
|
1771
2017
|
declare function getDefaultL2ReceiptsDir(cwd?: string): string;
|
|
1772
2018
|
declare function getL2ReceiptPath(txHash: string, options?: {
|
|
@@ -1854,4 +2100,4 @@ declare function listDeployments(rootDir: string, networkId?: string): Promise<D
|
|
|
1854
2100
|
declare function updateDeployment(rootDir: string, networkId: string, label: string, update: Partial<DeploymentRecord>): Promise<DeploymentRecord>;
|
|
1855
2101
|
declare function deleteDeployment(rootDir: string, networkId: string, label: string): Promise<boolean>;
|
|
1856
2102
|
|
|
1857
|
-
export { ARTIFACT_SCHEMAS, ARTIFACT_VERSION, AccountRefSchema, type ArtifactDiff, type ArtifactExplanation, ArtifactLineageSchema, type ArtifactLookup, type ArtifactValidationResult, type ArtifactVerificationResult, type AssumptionLevel, type BaseArtifact, BaseArtifactSchema, BasicCorrelationInvariant, BasicLineageInvariant, CURRENT_HASH_VERSION, type Clock, type CreateTxPlanArtifactOptions, type DagContext, DagContextSchema, type DeploymentIndex, type DeploymentRecord, type DeploymentSummary, type DiffEntry, type FeeAuditResult, HARDKAS_VERSION, type HardkasArtifactBase, type HardkasArtifactMode, type HardkasArtifactSchema, HashInvariant, type IgraSignedTxArtifact, type IgraTxPlanArtifact, type IgraTxReceiptArtifact, type IgraTxRequestArtifact, type Invariant, type InvariantContext, type InvariantViolation, InvariantWatcher, LifecycleInvariant, type LineageOptions, type LineageValidationResult, LocalnetUtxoSchemaV2, NetworkInvariant, ReplayInvariant, SEMANTIC_EXCLUSIONS, SchemaInvariant, type SignedTx, type SignedTxArtifact, type SignedTxArtifactV1, SignedTxSchema, type Snapshot, type SnapshotArtifact, SnapshotSchema, type TxOutputArtifact, type TxPlan, type TxPlanArtifact, type TxPlanArtifactV1, TxPlanSchema, type TxReceipt, type TxReceiptArtifact, type TxReceiptArtifactV1, TxReceiptSchema, type TxTrace, type TxTraceArtifact, type TxTraceArtifactV1, TxTraceSchema, type UtxoArtifact, type VerificationContext, type VerificationIssue, type VerificationSeverity, type WatcherOptions, assertDecimalBigIntString, assertEvmAddress, assertEvmTxHash, assertHexData, assertValidIgraSignedTxArtifact, assertValidIgraTxPlanArtifact, assertValidIgraTxReceiptArtifact, assertValidSignedTxArtifact, assertValidTxPlanArtifact, assertValidTxReceiptArtifact, bigIntReplacer, calculateContentHash, canonicalStringify, createDeploymentRecord, createIgraDeployPlanId, createIgraPlanId, createIgraSignedId, createSimulatedSignedTxArtifact, createSimulatedTxReceipt, createTxPlanArtifact, defaultClock, deleteDeployment, diffArtifacts, explainArtifact, formatSignedTxArtifact, formatTxPlanArtifact, formatTxReceiptArtifact, getBroadcastableSignedTransaction, getDefaultL2ReceiptsDir, getDefaultReceiptPath, getL2ReceiptPath, isIgraTxPlanArtifact, listDeployments, listIgraTxReceiptArtifacts, loadDeployment, loadIgraTxReceiptArtifact, migrateToCanonical, readArtifact, readSignedTxArtifact, readTxPlanArtifact, readTxReceiptArtifact, recomputeMass, saveDeployment, saveIgraTxReceiptArtifact, sortUtxosByOutpoint, txOutputFromArtifact, txOutputToArtifact, updateDeployment, updateDeploymentStatus, utxoFromArtifact, utxoToArtifact, validateArtifact, validateIgraSignedTxArtifact, validateIgraTxPlanArtifact, validateIgraTxReceiptArtifact, validateSignedTxArtifact, validateTxPlanArtifact, validateTxReceiptArtifact, verifyArtifact, verifyArtifactFile, verifyArtifactIntegrity, verifyArtifactReplay, verifyArtifactSemantics, verifyFeeSemantics, verifyLineage, writeArtifact };
|
|
2103
|
+
export { ARTIFACT_SCHEMAS, ARTIFACT_VERSION, AccountRefSchema, type ArtifactDiff, type ArtifactExplanation, ArtifactLineageSchema, type ArtifactLookup, type ArtifactValidationResult, type ArtifactVerificationResult, type AssumptionLevel, type BaseArtifact, BaseArtifactSchema, BasicCorrelationInvariant, BasicLineageInvariant, CURRENT_HASH_VERSION, type Clock, type CreateTxPlanArtifactOptions, type DagContext, DagContextSchema, type DeploymentIndex, type DeploymentRecord, type DeploymentSummary, type DiffEntry, type DraftArtifact, type FeeAuditResult, HARDKAS_VERSION, type HardkasArtifactBase, type HardkasArtifactMode, type HardkasArtifactSchema, HashInvariant, type IgraSignedTxArtifact, type IgraTxPlanArtifact, type IgraTxReceiptArtifact, type IgraTxRequestArtifact, type Invariant, type InvariantContext, type InvariantViolation, InvariantWatcher, LifecycleInvariant, type LineageOptions, type LineageValidationResult, LocalnetUtxoSchemaV2, NetworkInvariant, ReplayInvariant, SEMANTIC_EXCLUSIONS, SchemaInvariant, type SignedTx, type SignedTxArtifact, type SignedTxArtifactV1, SignedTxSchema, type Snapshot, type SnapshotArtifact, SnapshotSchema, type TxOutputArtifact, type TxPlan, type TxPlanArtifact, type TxPlanArtifactV1, TxPlanSchema, type TxReceipt, type TxReceiptArtifact, type TxReceiptArtifactV1, TxReceiptSchema, type TxTrace, type TxTraceArtifact, type TxTraceArtifactV1, TxTraceSchema, type UtxoArtifact, type VerificationContext, type VerificationIssue, type VerificationSeverity, type WatcherOptions, type Workflow, type WorkflowArtifact, WorkflowSchema, assertDecimalBigIntString, assertEvmAddress, assertEvmTxHash, assertHexData, assertValidIgraSignedTxArtifact, assertValidIgraTxPlanArtifact, assertValidIgraTxReceiptArtifact, assertValidSignedTxArtifact, assertValidTxPlanArtifact, assertValidTxReceiptArtifact, bigIntReplacer, calculateContentHash, canonicalStringify, createDeploymentRecord, createIgraDeployPlanId, createIgraPlanId, createIgraSignedId, createSimulatedSignedTxArtifact, createSimulatedTxReceipt, createTxPlanArtifact, defaultClock, deleteDeployment, diffArtifacts, explainArtifact, formatSignedTxArtifact, formatTxPlanArtifact, formatTxReceiptArtifact, getBroadcastableSignedTransaction, getDefaultL2ReceiptsDir, getDefaultReceiptPath, getL2ReceiptPath, isIgraTxPlanArtifact, listDeployments, listIgraTxReceiptArtifacts, loadDeployment, loadIgraTxReceiptArtifact, migrateToCanonical, readArtifact, readSignedTxArtifact, readTxPlanArtifact, readTxReceiptArtifact, recomputeMass, saveDeployment, saveIgraTxReceiptArtifact, sortUtxosByOutpoint, txOutputFromArtifact, txOutputToArtifact, updateDeployment, updateDeploymentStatus, utxoFromArtifact, utxoToArtifact, validateArtifact, validateIgraSignedTxArtifact, validateIgraTxPlanArtifact, validateIgraTxReceiptArtifact, validateSignedTxArtifact, validateTxPlanArtifact, validateTxReceiptArtifact, verifyArtifact, verifyArtifactFile, verifyArtifactIntegrity, verifyArtifactReplay, verifyArtifactSemantics, verifyFeeSemantics, verifyLineage, writeArtifact };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var package_default = {
|
|
3
|
+
name: "@hardkas/artifacts",
|
|
4
|
+
version: "0.6.0-alpha",
|
|
5
|
+
type: "module",
|
|
6
|
+
license: "MIT",
|
|
7
|
+
author: "Javier Rodriguez",
|
|
8
|
+
repository: {
|
|
9
|
+
type: "git",
|
|
10
|
+
url: "git+https://github.com/KasLabDevs/HardKas.git",
|
|
11
|
+
directory: "packages/artifacts"
|
|
12
|
+
},
|
|
13
|
+
homepage: "https://github.com/KasLabDevs/HardKas/tree/main/packages/artifacts#readme",
|
|
14
|
+
bugs: {
|
|
15
|
+
url: "https://github.com/KasLabDevs/HardKas/issues"
|
|
16
|
+
},
|
|
17
|
+
files: [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
exports: {
|
|
23
|
+
".": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
types: "./dist/index.d.ts",
|
|
26
|
+
scripts: {
|
|
27
|
+
build: "tsup src/index.ts --format esm --dts --clean",
|
|
28
|
+
dev: "tsup src/index.ts --format esm --watch --dts",
|
|
29
|
+
test: "vitest run",
|
|
30
|
+
lint: "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
dependencies: {
|
|
33
|
+
"@hardkas/core": "workspace:*",
|
|
34
|
+
"@hardkas/tx-builder": "workspace:*",
|
|
35
|
+
zod: "^3.24.1"
|
|
36
|
+
},
|
|
37
|
+
devDependencies: {
|
|
38
|
+
tsup: "^8.3.5",
|
|
39
|
+
typescript: "^5.6.3",
|
|
40
|
+
vitest: "^2.1.4"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
1
44
|
// src/constants.ts
|
|
2
|
-
var HARDKAS_VERSION =
|
|
45
|
+
var HARDKAS_VERSION = package_default.version;
|
|
3
46
|
var ARTIFACT_SCHEMAS = {
|
|
4
47
|
LOCALNET_STATE: "hardkas.localnetState.v1",
|
|
5
48
|
REAL_ACCOUNT_STORE: "hardkas.realAccountStore.v1",
|
|
@@ -133,6 +176,7 @@ function createIgraDeployPlanId(hash) {
|
|
|
133
176
|
|
|
134
177
|
// src/canonical.ts
|
|
135
178
|
import { createHash } from "crypto";
|
|
179
|
+
import { deterministicCompare } from "@hardkas/core";
|
|
136
180
|
var SEMANTIC_EXCLUSIONS = /* @__PURE__ */ new Set([
|
|
137
181
|
"contentHash",
|
|
138
182
|
"artifactId",
|
|
@@ -140,6 +184,8 @@ var SEMANTIC_EXCLUSIONS = /* @__PURE__ */ new Set([
|
|
|
140
184
|
"lineage",
|
|
141
185
|
"createdAt",
|
|
142
186
|
"rpcUrl",
|
|
187
|
+
"rpcHost",
|
|
188
|
+
"latencyMs",
|
|
143
189
|
"indexedAt",
|
|
144
190
|
"file_path",
|
|
145
191
|
"file_mtime_ms",
|
|
@@ -148,7 +194,15 @@ var SEMANTIC_EXCLUSIONS = /* @__PURE__ */ new Set([
|
|
|
148
194
|
// Exclude hash version from hash
|
|
149
195
|
"parentArtifactId",
|
|
150
196
|
"signedId",
|
|
151
|
-
"deployedAt"
|
|
197
|
+
"deployedAt",
|
|
198
|
+
"tracePath",
|
|
199
|
+
"receiptPath",
|
|
200
|
+
"events",
|
|
201
|
+
"status",
|
|
202
|
+
"sourceSignedId",
|
|
203
|
+
"submittedAt",
|
|
204
|
+
"confirmedAt",
|
|
205
|
+
"dagContext"
|
|
152
206
|
]);
|
|
153
207
|
var CURRENT_HASH_VERSION = 3;
|
|
154
208
|
function canonicalStringify(obj, version = CURRENT_HASH_VERSION) {
|
|
@@ -168,9 +222,22 @@ function canonicalStringify(obj, version = CURRENT_HASH_VERSION) {
|
|
|
168
222
|
if (Array.isArray(obj)) {
|
|
169
223
|
return "[" + obj.map((item) => canonicalStringify(item, version)).join(",") + "]";
|
|
170
224
|
}
|
|
225
|
+
if (obj instanceof Map) {
|
|
226
|
+
throw new Error("Map is not canonicalizable. Use a plain object.");
|
|
227
|
+
}
|
|
228
|
+
if (obj instanceof Set) {
|
|
229
|
+
throw new Error("Set is not canonicalizable. Use an array.");
|
|
230
|
+
}
|
|
231
|
+
if (obj instanceof Date) {
|
|
232
|
+
throw new Error("Date must be serialized explicitly.");
|
|
233
|
+
}
|
|
234
|
+
const proto = Object.getPrototypeOf(obj);
|
|
235
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
236
|
+
throw new Error("Non-plain object encountered in canonicalizer.");
|
|
237
|
+
}
|
|
171
238
|
const sortedKeys = Object.keys(obj).filter(
|
|
172
239
|
(key) => !SEMANTIC_EXCLUSIONS.has(key) && obj[key] !== void 0
|
|
173
|
-
).sort();
|
|
240
|
+
).sort(deterministicCompare);
|
|
174
241
|
const result = sortedKeys.map((key) => {
|
|
175
242
|
const value = obj[key];
|
|
176
243
|
return JSON.stringify(key) + ":" + canonicalStringify(value, version);
|
|
@@ -293,6 +360,7 @@ var TxReceiptSchema = BaseArtifactSchema.extend({
|
|
|
293
360
|
tracePath: z.string().optional(),
|
|
294
361
|
rpcUrl: z.string().optional(),
|
|
295
362
|
sourceSignedId: z.string().optional(),
|
|
363
|
+
errors: z.array(z.string()).optional(),
|
|
296
364
|
metadata: z.any().optional()
|
|
297
365
|
});
|
|
298
366
|
var SignedTxSchema = BaseArtifactSchema.extend({
|
|
@@ -325,6 +393,42 @@ var TxTraceSchema = BaseArtifactSchema.extend({
|
|
|
325
393
|
})),
|
|
326
394
|
dagContext: DagContextSchema.optional()
|
|
327
395
|
});
|
|
396
|
+
var WorkflowSchema = BaseArtifactSchema.extend({
|
|
397
|
+
schema: z.literal("hardkas.workflow.v1"),
|
|
398
|
+
workflowId: z.string(),
|
|
399
|
+
status: z.enum(["pending", "running", "completed", "failed"]),
|
|
400
|
+
inputs: z.record(z.any()).optional(),
|
|
401
|
+
steps: z.array(z.object({
|
|
402
|
+
type: z.string(),
|
|
403
|
+
status: z.enum(["pending", "success", "failed", "skipped"]),
|
|
404
|
+
startedAt: z.string().datetime().optional(),
|
|
405
|
+
completedAt: z.string().datetime().optional(),
|
|
406
|
+
producedArtifactId: z.string().optional(),
|
|
407
|
+
error: z.string().optional()
|
|
408
|
+
})),
|
|
409
|
+
parentArtifacts: z.array(z.string()).optional(),
|
|
410
|
+
producedArtifacts: z.array(z.string()),
|
|
411
|
+
generationRange: z.object({
|
|
412
|
+
start: z.string().optional(),
|
|
413
|
+
end: z.string().optional()
|
|
414
|
+
}).optional(),
|
|
415
|
+
policy: z.object({
|
|
416
|
+
allowNetwork: z.boolean(),
|
|
417
|
+
allowMainnet: z.boolean(),
|
|
418
|
+
allowExternalWallet: z.boolean(),
|
|
419
|
+
requireDryRun: z.boolean()
|
|
420
|
+
}).optional(),
|
|
421
|
+
generationId: z.string().optional(),
|
|
422
|
+
replayResult: z.object({
|
|
423
|
+
verified: z.boolean(),
|
|
424
|
+
stateHash: z.string().optional()
|
|
425
|
+
}).optional(),
|
|
426
|
+
errorEnvelope: z.object({
|
|
427
|
+
code: z.string(),
|
|
428
|
+
message: z.string(),
|
|
429
|
+
redacted: z.boolean()
|
|
430
|
+
}).optional()
|
|
431
|
+
});
|
|
328
432
|
|
|
329
433
|
// src/verify.ts
|
|
330
434
|
import fs from "fs";
|
|
@@ -414,8 +518,11 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
414
518
|
};
|
|
415
519
|
const lineage = artifact.lineage;
|
|
416
520
|
if (!lineage) {
|
|
417
|
-
const
|
|
418
|
-
|
|
521
|
+
const isWorkflow = artifact.schema === "hardkas.workflow.v1";
|
|
522
|
+
const severity = options.strict && !isWorkflow ? "error" : "warning";
|
|
523
|
+
if (!isWorkflow || options.strict) {
|
|
524
|
+
addIssue("MISSING_LINEAGE", "Artifact has no lineage metadata", severity);
|
|
525
|
+
}
|
|
419
526
|
return {
|
|
420
527
|
ok: issues.every((i) => i.severity !== "error"),
|
|
421
528
|
issues
|
|
@@ -489,11 +596,18 @@ function verifyLineage(artifact, parent, options = {}) {
|
|
|
489
596
|
var defaultClock = {
|
|
490
597
|
now: () => Date.now()
|
|
491
598
|
};
|
|
599
|
+
function deterministicCompare2(a, b) {
|
|
600
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
601
|
+
}
|
|
492
602
|
function sortUtxosByOutpoint(utxos) {
|
|
493
603
|
return [...utxos].sort((a, b) => {
|
|
494
|
-
const
|
|
495
|
-
const
|
|
496
|
-
|
|
604
|
+
const aRec = a;
|
|
605
|
+
const bRec = b;
|
|
606
|
+
const aOutpoint = aRec.outpoint;
|
|
607
|
+
const bOutpoint = bRec.outpoint;
|
|
608
|
+
const aId = aRec.id || (aOutpoint ? `${aOutpoint.transactionId}:${aOutpoint.index}` : "");
|
|
609
|
+
const bId = bRec.id || (bOutpoint ? `${bOutpoint.transactionId}:${bOutpoint.index}` : "");
|
|
610
|
+
return deterministicCompare2(aId, bId);
|
|
497
611
|
});
|
|
498
612
|
}
|
|
499
613
|
async function verifyArtifactIntegrity(artifactOrPath) {
|
|
@@ -525,6 +639,10 @@ async function verifyArtifactIntegrity(artifactOrPath) {
|
|
|
525
639
|
result.artifactType = v.schema;
|
|
526
640
|
result.version = v.version;
|
|
527
641
|
result.expectedHash = v.contentHash;
|
|
642
|
+
if (v.schema === "hardkas.replayReport.v1") {
|
|
643
|
+
result.ok = true;
|
|
644
|
+
return result;
|
|
645
|
+
}
|
|
528
646
|
if (!v.version || !v.schema) {
|
|
529
647
|
addError("ARTIFACT_SCHEMA_MISSING", "Missing version or schema (Artifact might be v1 or legacy)");
|
|
530
648
|
return result;
|
|
@@ -560,6 +678,9 @@ async function verifyArtifactIntegrity(artifactOrPath) {
|
|
|
560
678
|
case "hardkas.signedTx":
|
|
561
679
|
schema = SignedTxSchema;
|
|
562
680
|
break;
|
|
681
|
+
case "hardkas.workflow.v1":
|
|
682
|
+
schema = WorkflowSchema;
|
|
683
|
+
break;
|
|
563
684
|
}
|
|
564
685
|
if (schema) {
|
|
565
686
|
const validation = schema.safeParse(v);
|
|
@@ -577,8 +698,10 @@ async function verifyArtifactIntegrity(artifactOrPath) {
|
|
|
577
698
|
} catch (e) {
|
|
578
699
|
if (e instanceof SyntaxError) {
|
|
579
700
|
addError("ARTIFACT_JSON_INVALID", `Invalid JSON: ${e.message}`);
|
|
580
|
-
} else {
|
|
701
|
+
} else if (e instanceof Error) {
|
|
581
702
|
addError("ARTIFACT_ID_INVALID", `Unexpected verification error: ${e.message}`);
|
|
703
|
+
} else {
|
|
704
|
+
addError("ARTIFACT_ID_INVALID", `Unexpected verification error: ${String(e)}`);
|
|
582
705
|
}
|
|
583
706
|
return result;
|
|
584
707
|
}
|
|
@@ -626,19 +749,19 @@ function verifyArtifactSemantics(artifact, context = {}) {
|
|
|
626
749
|
}
|
|
627
750
|
}
|
|
628
751
|
const lineageAudit = verifyLineage(v, context.parent, { strict });
|
|
629
|
-
if (!lineageAudit.ok || strict && !v.lineage) {
|
|
752
|
+
if (!lineageAudit.ok || strict && !v.lineage && v.schema !== "hardkas.workflow.v1") {
|
|
630
753
|
lineageAudit.issues.forEach((issue) => {
|
|
631
754
|
addIssue(issue);
|
|
632
755
|
});
|
|
633
756
|
}
|
|
634
757
|
if (strict) {
|
|
635
758
|
if (!v.workflowId) addIssue({ code: "MISSING_WORKFLOW_ID", severity: "error", message: "Strict mode requires workflowId" });
|
|
636
|
-
if (!v.assumptionLevel) addIssue({ code: "MISSING_ASSUMPTION_LEVEL", severity: "error", message: "Strict mode requires assumptionLevel" });
|
|
637
|
-
if (!v.executionMode) addIssue({ code: "MISSING_EXECUTION_MODE", severity: "error", message: "Strict mode requires executionMode" });
|
|
759
|
+
if (!v.assumptionLevel && v.schema !== "hardkas.workflow.v1") addIssue({ code: "MISSING_ASSUMPTION_LEVEL", severity: "error", message: "Strict mode requires assumptionLevel" });
|
|
760
|
+
if (!v.executionMode && !v.mode) addIssue({ code: "MISSING_EXECUTION_MODE", severity: "error", message: "Strict mode requires executionMode" });
|
|
638
761
|
} else {
|
|
639
762
|
if (!v.workflowId) addIssue({ code: "MISSING_WORKFLOW_ID", severity: "warning", message: "Missing workflowId" });
|
|
640
|
-
if (!v.assumptionLevel) addIssue({ code: "MISSING_ASSUMPTION_LEVEL", severity: "warning", message: "Missing assumptionLevel" });
|
|
641
|
-
if (!v.executionMode) addIssue({ code: "MISSING_EXECUTION_MODE", severity: "warning", message: "Missing executionMode" });
|
|
763
|
+
if (!v.assumptionLevel && v.schema !== "hardkas.workflow.v1") addIssue({ code: "MISSING_ASSUMPTION_LEVEL", severity: "warning", message: "Missing assumptionLevel" });
|
|
764
|
+
if (!v.executionMode && !v.mode) addIssue({ code: "MISSING_EXECUTION_MODE", severity: "warning", message: "Missing executionMode" });
|
|
642
765
|
}
|
|
643
766
|
const networkId = context.networkId || v.networkId;
|
|
644
767
|
const networkIdStr = networkId;
|
|
@@ -800,7 +923,7 @@ var ReplayInvariant = class {
|
|
|
800
923
|
};
|
|
801
924
|
|
|
802
925
|
// src/invariants/watcher.ts
|
|
803
|
-
import { createEventEnvelope } from "@hardkas/core";
|
|
926
|
+
import { createEventEnvelope, asWorkflowId, asCorrelationId, asNetworkId, asEventSequence } from "@hardkas/core";
|
|
804
927
|
var InvariantWatcher = class {
|
|
805
928
|
invariants;
|
|
806
929
|
eventBus;
|
|
@@ -853,9 +976,12 @@ var InvariantWatcher = class {
|
|
|
853
976
|
const integrityEvent = createEventEnvelope({
|
|
854
977
|
kind: "integrity.violation",
|
|
855
978
|
domain: "integrity",
|
|
856
|
-
workflowId:
|
|
857
|
-
correlationId: sourceEvent.correlationId,
|
|
858
|
-
networkId: sourceEvent.networkId,
|
|
979
|
+
workflowId: asWorkflowId("system-watcher"),
|
|
980
|
+
correlationId: asCorrelationId(sourceEvent.correlationId),
|
|
981
|
+
networkId: asNetworkId(sourceEvent.networkId),
|
|
982
|
+
sequenceNumber: asEventSequence(0),
|
|
983
|
+
// Root event for watcher
|
|
984
|
+
sourceSubsystem: "artifact_watcher",
|
|
859
985
|
payload: {
|
|
860
986
|
violationCode: violation.code,
|
|
861
987
|
severity: violation.severity,
|
|
@@ -968,6 +1094,17 @@ function formatTxPlanArtifact(artifact) {
|
|
|
968
1094
|
lines.push(`Outputs: ${artifact.outputs.length}`);
|
|
969
1095
|
lines.push(`Fee: ${formatSompi(BigInt(artifact.estimatedFeeSompi))}`);
|
|
970
1096
|
lines.push(`Mass: ${artifact.estimatedMass}`);
|
|
1097
|
+
lines.push("");
|
|
1098
|
+
lines.push("Deterministic Planning Specifications:");
|
|
1099
|
+
lines.push(" Coin Selection:");
|
|
1100
|
+
lines.push(" deterministic canonical ordering enabled");
|
|
1101
|
+
lines.push(" Input Ordering:");
|
|
1102
|
+
lines.push(" amountSompi ASC");
|
|
1103
|
+
lines.push(" txid ASC");
|
|
1104
|
+
lines.push(" index ASC");
|
|
1105
|
+
lines.push(" Output Ordering:");
|
|
1106
|
+
lines.push(" amountSompi ASC");
|
|
1107
|
+
lines.push(" address ASC");
|
|
971
1108
|
return lines.join("\n");
|
|
972
1109
|
}
|
|
973
1110
|
function formatTxReceiptArtifact(artifact) {
|
|
@@ -1006,40 +1143,30 @@ function formatSignedTxArtifact(artifact) {
|
|
|
1006
1143
|
|
|
1007
1144
|
// src/conversions.ts
|
|
1008
1145
|
function utxoToArtifact(utxo) {
|
|
1009
|
-
|
|
1146
|
+
return {
|
|
1010
1147
|
outpoint: {
|
|
1011
1148
|
transactionId: utxo.outpoint.transactionId,
|
|
1012
1149
|
index: utxo.outpoint.index
|
|
1013
1150
|
},
|
|
1014
1151
|
address: utxo.address,
|
|
1015
1152
|
amountSompi: utxo.amountSompi.toString(),
|
|
1016
|
-
scriptPublicKey: utxo.scriptPublicKey
|
|
1153
|
+
scriptPublicKey: utxo.scriptPublicKey,
|
|
1154
|
+
...utxo.blockDaaScore !== void 0 ? { blockDaaScore: utxo.blockDaaScore.toString() } : {},
|
|
1155
|
+
...utxo.isCoinbase !== void 0 ? { isCoinbase: utxo.isCoinbase } : {}
|
|
1017
1156
|
};
|
|
1018
|
-
if (utxo.blockDaaScore !== void 0) {
|
|
1019
|
-
artifact.blockDaaScore = utxo.blockDaaScore.toString();
|
|
1020
|
-
}
|
|
1021
|
-
if (utxo.isCoinbase !== void 0) {
|
|
1022
|
-
artifact.isCoinbase = utxo.isCoinbase;
|
|
1023
|
-
}
|
|
1024
|
-
return artifact;
|
|
1025
1157
|
}
|
|
1026
1158
|
function utxoFromArtifact(artifact) {
|
|
1027
|
-
|
|
1159
|
+
return {
|
|
1028
1160
|
outpoint: {
|
|
1029
1161
|
transactionId: artifact.outpoint.transactionId,
|
|
1030
1162
|
index: artifact.outpoint.index
|
|
1031
1163
|
},
|
|
1032
1164
|
address: artifact.address,
|
|
1033
1165
|
amountSompi: safeParseBigInt(artifact.amountSompi, "UtxoArtifact.amountSompi"),
|
|
1034
|
-
scriptPublicKey: artifact.scriptPublicKey
|
|
1166
|
+
scriptPublicKey: artifact.scriptPublicKey,
|
|
1167
|
+
...artifact.blockDaaScore !== void 0 ? { blockDaaScore: safeParseBigInt(artifact.blockDaaScore, "UtxoArtifact.blockDaaScore") } : {},
|
|
1168
|
+
...artifact.isCoinbase !== void 0 ? { isCoinbase: artifact.isCoinbase } : {}
|
|
1035
1169
|
};
|
|
1036
|
-
if (artifact.blockDaaScore !== void 0) {
|
|
1037
|
-
utxo.blockDaaScore = safeParseBigInt(artifact.blockDaaScore, "UtxoArtifact.blockDaaScore");
|
|
1038
|
-
}
|
|
1039
|
-
if (artifact.isCoinbase !== void 0) {
|
|
1040
|
-
utxo.isCoinbase = artifact.isCoinbase;
|
|
1041
|
-
}
|
|
1042
|
-
return utxo;
|
|
1043
1170
|
}
|
|
1044
1171
|
function txOutputToArtifact(output) {
|
|
1045
1172
|
return {
|
|
@@ -1068,7 +1195,7 @@ function createTxPlanArtifact(options) {
|
|
|
1068
1195
|
hardkasVersion: HARDKAS_VERSION,
|
|
1069
1196
|
version: ARTIFACT_VERSION,
|
|
1070
1197
|
hashVersion: CURRENT_HASH_VERSION,
|
|
1071
|
-
createdAt:
|
|
1198
|
+
createdAt: new Date(options.ctx.clock.now()).toISOString(),
|
|
1072
1199
|
networkId: options.networkId,
|
|
1073
1200
|
mode: options.mode,
|
|
1074
1201
|
from: {
|
|
@@ -1109,13 +1236,13 @@ function createTxPlanArtifact(options) {
|
|
|
1109
1236
|
}
|
|
1110
1237
|
|
|
1111
1238
|
// src/signed-tx.ts
|
|
1112
|
-
function createSimulatedSignedTxArtifact(plan, payload) {
|
|
1239
|
+
function createSimulatedSignedTxArtifact(plan, payload, ctx) {
|
|
1113
1240
|
const artifact = {
|
|
1114
1241
|
schema: "hardkas.signedTx",
|
|
1115
1242
|
hardkasVersion: HARDKAS_VERSION,
|
|
1116
1243
|
version: ARTIFACT_VERSION,
|
|
1117
1244
|
hashVersion: CURRENT_HASH_VERSION,
|
|
1118
|
-
createdAt:
|
|
1245
|
+
createdAt: new Date(ctx.clock.now()).toISOString(),
|
|
1119
1246
|
status: "signed",
|
|
1120
1247
|
sourcePlanId: plan.planId,
|
|
1121
1248
|
networkId: plan.networkId,
|
|
@@ -1134,13 +1261,13 @@ function createSimulatedSignedTxArtifact(plan, payload) {
|
|
|
1134
1261
|
artifact.contentHash = hash;
|
|
1135
1262
|
return artifact;
|
|
1136
1263
|
}
|
|
1137
|
-
function createSimulatedTxReceipt(plan, txId, extra) {
|
|
1264
|
+
function createSimulatedTxReceipt(plan, txId, ctx, extra) {
|
|
1138
1265
|
const artifact = {
|
|
1139
1266
|
schema: "hardkas.txReceipt",
|
|
1140
1267
|
hardkasVersion: HARDKAS_VERSION,
|
|
1141
1268
|
version: ARTIFACT_VERSION,
|
|
1142
1269
|
hashVersion: CURRENT_HASH_VERSION,
|
|
1143
|
-
createdAt:
|
|
1270
|
+
createdAt: new Date(ctx.clock.now()).toISOString(),
|
|
1144
1271
|
txId,
|
|
1145
1272
|
status: "accepted",
|
|
1146
1273
|
mode: "simulated",
|
|
@@ -1203,7 +1330,8 @@ function validateSignedTxArtifact(value) {
|
|
|
1203
1330
|
if (!v.signedTransaction) {
|
|
1204
1331
|
errors.push("Missing signedTransaction object");
|
|
1205
1332
|
} else {
|
|
1206
|
-
|
|
1333
|
+
const st = v.signedTransaction;
|
|
1334
|
+
if (!["kaspa-sdk", "hex", "simulated", "unknown"].includes(st.format)) {
|
|
1207
1335
|
errors.push("Invalid signedTransaction.format");
|
|
1208
1336
|
}
|
|
1209
1337
|
}
|
|
@@ -1265,7 +1393,8 @@ function assertDecimalBigIntString2(value, field, errors) {
|
|
|
1265
1393
|
}
|
|
1266
1394
|
|
|
1267
1395
|
// src/explain.ts
|
|
1268
|
-
async function explainArtifact(
|
|
1396
|
+
async function explainArtifact(artifactUnknown) {
|
|
1397
|
+
const artifact = artifactUnknown;
|
|
1269
1398
|
const schema = artifact.schema || "unknown";
|
|
1270
1399
|
const type = schema.split(".")[1] || "unknown";
|
|
1271
1400
|
const integrity = await verifyArtifactIntegrity(artifact);
|
|
@@ -1336,6 +1465,7 @@ async function explainArtifact(artifact) {
|
|
|
1336
1465
|
// src/igra-io.ts
|
|
1337
1466
|
import fs3 from "fs/promises";
|
|
1338
1467
|
import path2 from "path";
|
|
1468
|
+
import { deterministicCompare as deterministicCompare3 } from "@hardkas/core";
|
|
1339
1469
|
function getDefaultL2ReceiptsDir(cwd = process.cwd()) {
|
|
1340
1470
|
return path2.join(cwd, ".hardkas", "l2-receipts");
|
|
1341
1471
|
}
|
|
@@ -1371,7 +1501,7 @@ async function listIgraTxReceiptArtifacts(options) {
|
|
|
1371
1501
|
} catch (e) {
|
|
1372
1502
|
}
|
|
1373
1503
|
}
|
|
1374
|
-
return receipts.sort((a, b) => b.createdAt
|
|
1504
|
+
return receipts.sort((a, b) => deterministicCompare3(b.createdAt, a.createdAt));
|
|
1375
1505
|
} catch (e) {
|
|
1376
1506
|
if (e.code === "ENOENT") return [];
|
|
1377
1507
|
throw e;
|
|
@@ -1440,7 +1570,7 @@ function isPrimitive(val) {
|
|
|
1440
1570
|
|
|
1441
1571
|
// src/deployment.ts
|
|
1442
1572
|
function createDeploymentRecord(opts) {
|
|
1443
|
-
const
|
|
1573
|
+
const recordDraft = {
|
|
1444
1574
|
schema: "hardkas.deployment.v1",
|
|
1445
1575
|
label: opts.label,
|
|
1446
1576
|
networkId: opts.networkId,
|
|
@@ -1449,28 +1579,33 @@ function createDeploymentRecord(opts) {
|
|
|
1449
1579
|
hardkasVersion: HARDKAS_VERSION,
|
|
1450
1580
|
version: ARTIFACT_VERSION,
|
|
1451
1581
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1452
|
-
mode: "real"
|
|
1582
|
+
mode: "real",
|
|
1583
|
+
...opts.txId ? { txId: opts.txId } : {},
|
|
1584
|
+
...opts.planArtifactId ? { planArtifactId: opts.planArtifactId } : {},
|
|
1585
|
+
...opts.receiptArtifactId ? { receiptArtifactId: opts.receiptArtifactId } : {},
|
|
1586
|
+
...opts.deployedAddresses ? { deployedAddresses: opts.deployedAddresses } : {},
|
|
1587
|
+
...opts.deployer ? { deployer: opts.deployer } : {},
|
|
1588
|
+
...opts.payloadHash ? { payloadHash: opts.payloadHash } : {},
|
|
1589
|
+
...opts.notes ? { notes: opts.notes } : {}
|
|
1590
|
+
};
|
|
1591
|
+
const contentHash = calculateContentHash(recordDraft, CURRENT_HASH_VERSION);
|
|
1592
|
+
return {
|
|
1593
|
+
...recordDraft,
|
|
1594
|
+
contentHash
|
|
1453
1595
|
};
|
|
1454
|
-
if (opts.txId) record.txId = opts.txId;
|
|
1455
|
-
if (opts.planArtifactId) record.planArtifactId = opts.planArtifactId;
|
|
1456
|
-
if (opts.receiptArtifactId) record.receiptArtifactId = opts.receiptArtifactId;
|
|
1457
|
-
if (opts.deployedAddresses) record.deployedAddresses = opts.deployedAddresses;
|
|
1458
|
-
if (opts.deployer) record.deployer = opts.deployer;
|
|
1459
|
-
if (opts.payloadHash) record.payloadHash = opts.payloadHash;
|
|
1460
|
-
if (opts.notes) record.notes = opts.notes;
|
|
1461
|
-
record.contentHash = calculateContentHash(record, CURRENT_HASH_VERSION);
|
|
1462
|
-
return record;
|
|
1463
1596
|
}
|
|
1464
1597
|
function updateDeploymentStatus(record, newStatus, txId) {
|
|
1465
|
-
const
|
|
1598
|
+
const updatedDraft = {
|
|
1466
1599
|
...record,
|
|
1467
1600
|
status: newStatus,
|
|
1468
|
-
deployedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1601
|
+
deployedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1602
|
+
...txId ? { txId } : {}
|
|
1603
|
+
};
|
|
1604
|
+
const contentHash = calculateContentHash(updatedDraft, CURRENT_HASH_VERSION);
|
|
1605
|
+
return {
|
|
1606
|
+
...updatedDraft,
|
|
1607
|
+
contentHash
|
|
1469
1608
|
};
|
|
1470
|
-
if (txId) updated.txId = txId;
|
|
1471
|
-
delete updated.contentHash;
|
|
1472
|
-
updated.contentHash = calculateContentHash(updated, CURRENT_HASH_VERSION);
|
|
1473
|
-
return updated;
|
|
1474
1609
|
}
|
|
1475
1610
|
|
|
1476
1611
|
// src/deployment-store.ts
|
|
@@ -1562,6 +1697,7 @@ export {
|
|
|
1562
1697
|
TxPlanSchema,
|
|
1563
1698
|
TxReceiptSchema,
|
|
1564
1699
|
TxTraceSchema,
|
|
1700
|
+
WorkflowSchema,
|
|
1565
1701
|
assertDecimalBigIntString,
|
|
1566
1702
|
assertEvmAddress,
|
|
1567
1703
|
assertEvmTxHash,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardkas/artifacts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Javier Rodriguez",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"zod": "^3.24.1",
|
|
27
|
-
"@hardkas/core": "0.
|
|
28
|
-
"@hardkas/tx-builder": "0.
|
|
27
|
+
"@hardkas/core": "0.6.0-alpha",
|
|
28
|
+
"@hardkas/tx-builder": "0.6.0-alpha"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"tsup": "^8.3.5",
|