@hazbase/simplicity 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -1534
- package/dist/cli.js +1107 -1
- package/dist/client/SimplicityClient.d.ts +30 -3
- package/dist/client/SimplicityClient.js +28 -0
- package/dist/core/lineage.d.ts +18 -0
- package/dist/core/lineage.js +30 -0
- package/dist/core/reporting.d.ts +22 -0
- package/dist/core/reporting.js +40 -0
- package/dist/core/schnorr.d.ts +3 -3
- package/dist/core/schnorr.js +19 -7
- package/dist/core/types.d.ts +251 -5
- package/dist/docs/definitions/fund-capital-call-refund-only.simf +36 -2
- package/dist/docs/definitions/receivable-definition.json +9 -0
- package/dist/docs/definitions/receivable-funding-claim.json +13 -0
- package/dist/docs/definitions/receivable-funding-claim.simf +58 -0
- package/dist/docs/definitions/receivable-repayment-claim.json +13 -0
- package/dist/docs/definitions/receivable-repayment-claim.simf +59 -0
- package/dist/docs/definitions/receivable-state-funded.json +20 -0
- package/dist/docs/definitions/receivable-state-originated.json +19 -0
- package/dist/docs/definitions/receivable-state-repaid.json +20 -0
- package/dist/domain/bond.d.ts +82 -15
- package/dist/domain/bond.js +159 -10
- package/dist/domain/bondValidation.d.ts +31 -1
- package/dist/domain/bondValidation.js +73 -9
- package/dist/domain/fund.d.ts +451 -68
- package/dist/domain/fund.js +460 -88
- package/dist/domain/fundValidation.d.ts +33 -3
- package/dist/domain/fundValidation.js +137 -5
- package/dist/domain/policies.d.ts +13 -0
- package/dist/domain/policies.js +50 -30
- package/dist/domain/receivable.d.ts +824 -0
- package/dist/domain/receivable.js +1375 -0
- package/dist/domain/receivableValidation.d.ts +147 -0
- package/dist/domain/receivableValidation.js +831 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +55 -3
- package/package.json +6 -1
package/dist/cli.js
CHANGED
|
@@ -35,6 +35,13 @@ function getMultiArgs(name) {
|
|
|
35
35
|
function hasFlag(name) {
|
|
36
36
|
return process.argv.includes(`--${name}`);
|
|
37
37
|
}
|
|
38
|
+
function parseJsonArg(name) {
|
|
39
|
+
const value = getArg(name);
|
|
40
|
+
return value ? JSON.parse(value) : undefined;
|
|
41
|
+
}
|
|
42
|
+
function parseJsonArgs(name) {
|
|
43
|
+
return getMultiArgs(name).map((value) => JSON.parse(value));
|
|
44
|
+
}
|
|
38
45
|
function requireArg(name) {
|
|
39
46
|
const value = getArg(name);
|
|
40
47
|
if (!value)
|
|
@@ -545,6 +552,20 @@ function formatBondEvidenceSummary(input) {
|
|
|
545
552
|
input.closingHash ? `closingHash=${input.closingHash}` : undefined,
|
|
546
553
|
input.renderedSourceHash ? `renderedSourceHash=${input.renderedSourceHash}` : undefined,
|
|
547
554
|
input.sourceVerificationMode ? `sourceVerificationMode=${input.sourceVerificationMode}` : undefined,
|
|
555
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
556
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
557
|
+
input.allHashLinksVerified !== undefined && input.allHashLinksVerified !== null
|
|
558
|
+
? `allHashLinksVerified=${input.allHashLinksVerified}`
|
|
559
|
+
: undefined,
|
|
560
|
+
input.identityConsistent !== undefined && input.identityConsistent !== null
|
|
561
|
+
? `identityConsistent=${input.identityConsistent}`
|
|
562
|
+
: undefined,
|
|
563
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
564
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
565
|
+
: undefined,
|
|
566
|
+
input.fullHistoryVerified !== undefined && input.fullHistoryVerified !== null
|
|
567
|
+
? `fullHistoryVerified=${input.fullHistoryVerified}`
|
|
568
|
+
: undefined,
|
|
548
569
|
]
|
|
549
570
|
.filter(Boolean)
|
|
550
571
|
.join("\n");
|
|
@@ -560,6 +581,36 @@ function formatBondFinalityPayloadSummary(input) {
|
|
|
560
581
|
`contractAddress=${input.contractAddress}`,
|
|
561
582
|
`cmr=${input.cmr}`,
|
|
562
583
|
`bindingMode=${input.bindingMode}`,
|
|
584
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
585
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
586
|
+
input.allHashLinksVerified !== undefined && input.allHashLinksVerified !== null
|
|
587
|
+
? `allHashLinksVerified=${input.allHashLinksVerified}`
|
|
588
|
+
: undefined,
|
|
589
|
+
input.identityConsistent !== undefined && input.identityConsistent !== null
|
|
590
|
+
? `identityConsistent=${input.identityConsistent}`
|
|
591
|
+
: undefined,
|
|
592
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
593
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
594
|
+
: undefined,
|
|
595
|
+
input.fullHistoryVerified !== undefined && input.fullHistoryVerified !== null
|
|
596
|
+
? `fullHistoryVerified=${input.fullHistoryVerified}`
|
|
597
|
+
: undefined,
|
|
598
|
+
]
|
|
599
|
+
.filter(Boolean)
|
|
600
|
+
.join("\n");
|
|
601
|
+
}
|
|
602
|
+
function formatBondIssuanceHistorySummary(input) {
|
|
603
|
+
return [
|
|
604
|
+
input.verified !== undefined ? `verified=${input.verified}` : undefined,
|
|
605
|
+
`issuanceId=${input.issuanceId}`,
|
|
606
|
+
`chainLength=${input.chainLength}`,
|
|
607
|
+
input.latestStatus ? `latestStatus=${input.latestStatus}` : undefined,
|
|
608
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
609
|
+
`startsAtGenesis=${input.startsAtGenesis}`,
|
|
610
|
+
input.allHashLinksVerified !== undefined ? `allHashLinksVerified=${input.allHashLinksVerified}` : undefined,
|
|
611
|
+
input.identityConsistent !== undefined ? `identityConsistent=${input.identityConsistent}` : undefined,
|
|
612
|
+
input.fullLineageVerified !== undefined ? `fullLineageVerified=${input.fullLineageVerified}` : undefined,
|
|
613
|
+
`fullHistoryVerified=${input.fullHistoryVerified}`,
|
|
563
614
|
]
|
|
564
615
|
.filter(Boolean)
|
|
565
616
|
.join("\n");
|
|
@@ -660,11 +711,40 @@ function formatFundClosingSummary(input) {
|
|
|
660
711
|
`closingReason=${input.closingReason}`,
|
|
661
712
|
`positionId=${input.positionId}`,
|
|
662
713
|
`distributionCount=${input.distributionCount}`,
|
|
714
|
+
input.continuityVerified !== undefined ? `continuityVerified=${input.continuityVerified}` : undefined,
|
|
715
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
716
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
717
|
+
input.allHashLinksVerified !== undefined && input.allHashLinksVerified !== null
|
|
718
|
+
? `allHashLinksVerified=${input.allHashLinksVerified}`
|
|
719
|
+
: undefined,
|
|
720
|
+
input.identityConsistent !== undefined && input.identityConsistent !== null
|
|
721
|
+
? `identityConsistent=${input.identityConsistent}`
|
|
722
|
+
: undefined,
|
|
723
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
724
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
725
|
+
: undefined,
|
|
726
|
+
input.fullChainVerified !== undefined ? `fullChainVerified=${input.fullChainVerified}` : undefined,
|
|
663
727
|
input.reason ? `reason=${input.reason}` : undefined,
|
|
664
728
|
]
|
|
665
729
|
.filter(Boolean)
|
|
666
730
|
.join("\n");
|
|
667
731
|
}
|
|
732
|
+
function formatFundReceiptChainSummary(input) {
|
|
733
|
+
return [
|
|
734
|
+
input.verified !== undefined ? `verified=${input.verified}` : undefined,
|
|
735
|
+
`positionId=${input.positionId}`,
|
|
736
|
+
`chainLength=${input.chainLength}`,
|
|
737
|
+
input.latestSequence !== undefined && input.latestSequence !== null ? `latestSequence=${input.latestSequence}` : undefined,
|
|
738
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
739
|
+
`startsAtGenesis=${input.startsAtGenesis}`,
|
|
740
|
+
input.allHashLinksVerified !== undefined ? `allHashLinksVerified=${input.allHashLinksVerified}` : undefined,
|
|
741
|
+
input.identityConsistent !== undefined ? `identityConsistent=${input.identityConsistent}` : undefined,
|
|
742
|
+
input.fullLineageVerified !== undefined ? `fullLineageVerified=${input.fullLineageVerified}` : undefined,
|
|
743
|
+
`fullChainVerified=${input.fullChainVerified}`,
|
|
744
|
+
]
|
|
745
|
+
.filter(Boolean)
|
|
746
|
+
.join("\n");
|
|
747
|
+
}
|
|
668
748
|
function formatFundEvidenceSummary(input) {
|
|
669
749
|
return [
|
|
670
750
|
`definitionHash=${input.definitionHash}`,
|
|
@@ -674,6 +754,20 @@ function formatFundEvidenceSummary(input) {
|
|
|
674
754
|
input.distributionHash ? `distributionHash=${input.distributionHash}` : undefined,
|
|
675
755
|
input.closingHash ? `closingHash=${input.closingHash}` : undefined,
|
|
676
756
|
`sourceVerificationMode=${input.sourceVerificationMode}`,
|
|
757
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
758
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
759
|
+
input.allHashLinksVerified !== undefined && input.allHashLinksVerified !== null
|
|
760
|
+
? `allHashLinksVerified=${input.allHashLinksVerified}`
|
|
761
|
+
: undefined,
|
|
762
|
+
input.identityConsistent !== undefined && input.identityConsistent !== null
|
|
763
|
+
? `identityConsistent=${input.identityConsistent}`
|
|
764
|
+
: undefined,
|
|
765
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
766
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
767
|
+
: undefined,
|
|
768
|
+
input.fullChainVerified !== undefined && input.fullChainVerified !== null
|
|
769
|
+
? `fullChainVerified=${input.fullChainVerified}`
|
|
770
|
+
: undefined,
|
|
677
771
|
]
|
|
678
772
|
.filter(Boolean)
|
|
679
773
|
.join("\n");
|
|
@@ -691,6 +785,110 @@ function formatFundFinalitySummary(input) {
|
|
|
691
785
|
input.distributionHash ? `distributionHash=${input.distributionHash}` : undefined,
|
|
692
786
|
input.closingHash ? `closingHash=${input.closingHash}` : undefined,
|
|
693
787
|
`bindingMode=${input.bindingMode}`,
|
|
788
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
789
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
790
|
+
input.allHashLinksVerified !== undefined && input.allHashLinksVerified !== null
|
|
791
|
+
? `allHashLinksVerified=${input.allHashLinksVerified}`
|
|
792
|
+
: undefined,
|
|
793
|
+
input.identityConsistent !== undefined && input.identityConsistent !== null
|
|
794
|
+
? `identityConsistent=${input.identityConsistent}`
|
|
795
|
+
: undefined,
|
|
796
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
797
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
798
|
+
: undefined,
|
|
799
|
+
input.fullChainVerified !== undefined && input.fullChainVerified !== null
|
|
800
|
+
? `fullChainVerified=${input.fullChainVerified}`
|
|
801
|
+
: undefined,
|
|
802
|
+
]
|
|
803
|
+
.filter(Boolean)
|
|
804
|
+
.join("\n");
|
|
805
|
+
}
|
|
806
|
+
function formatReceivableDefinitionSummary(input) {
|
|
807
|
+
return [
|
|
808
|
+
input.ok !== undefined ? `ok=${input.ok}` : undefined,
|
|
809
|
+
`receivableId=${input.receivableId}`,
|
|
810
|
+
`originatorEntityId=${input.originatorEntityId}`,
|
|
811
|
+
`debtorEntityId=${input.debtorEntityId}`,
|
|
812
|
+
`currencyAssetId=${input.currencyAssetId}`,
|
|
813
|
+
`faceValue=${input.faceValue}`,
|
|
814
|
+
`dueDate=${input.dueDate}`,
|
|
815
|
+
]
|
|
816
|
+
.filter(Boolean)
|
|
817
|
+
.join("\n");
|
|
818
|
+
}
|
|
819
|
+
function formatReceivableTransitionSummary(input) {
|
|
820
|
+
return [
|
|
821
|
+
`phase=${input.phase}`,
|
|
822
|
+
`verified=${input.verified}`,
|
|
823
|
+
`transitionType=${input.transitionType}`,
|
|
824
|
+
`receivableId=${input.receivableId}`,
|
|
825
|
+
`nextStateId=${input.nextStateId}`,
|
|
826
|
+
`holderEntityId=${input.holderEntityId}`,
|
|
827
|
+
`status=${input.status}`,
|
|
828
|
+
`outstandingAmount=${input.outstandingAmount}`,
|
|
829
|
+
`repaidAmount=${input.repaidAmount}`,
|
|
830
|
+
`stateHash=${input.stateHash}`,
|
|
831
|
+
].join("\n");
|
|
832
|
+
}
|
|
833
|
+
function formatReceivableClaimSummary(input) {
|
|
834
|
+
return [
|
|
835
|
+
`phase=${input.phase}`,
|
|
836
|
+
`verified=${input.verified}`,
|
|
837
|
+
`claimKind=${input.claimKind}`,
|
|
838
|
+
`receivableId=${input.receivableId}`,
|
|
839
|
+
`claimId=${input.claimId}`,
|
|
840
|
+
`currentStatus=${input.currentStatus}`,
|
|
841
|
+
`payerEntityId=${input.payerEntityId}`,
|
|
842
|
+
`payeeEntityId=${input.payeeEntityId}`,
|
|
843
|
+
`amountSat=${input.amountSat}`,
|
|
844
|
+
input.bindingMode ? `bindingMode=${input.bindingMode}` : undefined,
|
|
845
|
+
input.reasonCode ? `reasonCode=${input.reasonCode}` : undefined,
|
|
846
|
+
input.supportedForm ? `supportedForm=${input.supportedForm}` : undefined,
|
|
847
|
+
input.fullLineageVerified !== undefined ? `fullLineageVerified=${input.fullLineageVerified}` : undefined,
|
|
848
|
+
]
|
|
849
|
+
.filter(Boolean)
|
|
850
|
+
.join("\n");
|
|
851
|
+
}
|
|
852
|
+
function formatReceivableHistorySummary(input) {
|
|
853
|
+
return [
|
|
854
|
+
`verified=${input.verified}`,
|
|
855
|
+
`receivableId=${input.receivableId}`,
|
|
856
|
+
`chainLength=${input.chainLength}`,
|
|
857
|
+
`latestStatus=${input.latestStatus}`,
|
|
858
|
+
input.latestOrdinal !== null ? `latestOrdinal=${input.latestOrdinal}` : undefined,
|
|
859
|
+
`fullLineageVerified=${input.fullLineageVerified}`,
|
|
860
|
+
]
|
|
861
|
+
.filter(Boolean)
|
|
862
|
+
.join("\n");
|
|
863
|
+
}
|
|
864
|
+
function formatReceivableClosingSummary(input) {
|
|
865
|
+
return [
|
|
866
|
+
`verified=${input.verified}`,
|
|
867
|
+
`receivableId=${input.receivableId}`,
|
|
868
|
+
`latestStatus=${input.latestStatus}`,
|
|
869
|
+
`closingReason=${input.closingReason}`,
|
|
870
|
+
`closingHash=${input.closingHash}`,
|
|
871
|
+
input.fullLineageVerified !== undefined ? `fullLineageVerified=${input.fullLineageVerified}` : undefined,
|
|
872
|
+
]
|
|
873
|
+
.filter(Boolean)
|
|
874
|
+
.join("\n");
|
|
875
|
+
}
|
|
876
|
+
function formatReceivableEvidenceOrFinalitySummary(input) {
|
|
877
|
+
return [
|
|
878
|
+
`kind=${input.kind}`,
|
|
879
|
+
`receivableId=${input.receivableId}`,
|
|
880
|
+
`holderEntityId=${input.holderEntityId}`,
|
|
881
|
+
`definitionHash=${input.definitionHash}`,
|
|
882
|
+
`latestStateHash=${input.latestStateHash}`,
|
|
883
|
+
input.closingHash ? `closingHash=${input.closingHash}` : undefined,
|
|
884
|
+
input.closingReason ? `closingReason=${input.closingReason}` : undefined,
|
|
885
|
+
input.lineageKind ? `lineageKind=${input.lineageKind}` : undefined,
|
|
886
|
+
input.latestOrdinal !== undefined && input.latestOrdinal !== null
|
|
887
|
+
? `latestOrdinal=${input.latestOrdinal}`
|
|
888
|
+
: undefined,
|
|
889
|
+
input.fullLineageVerified !== undefined && input.fullLineageVerified !== null
|
|
890
|
+
? `fullLineageVerified=${input.fullLineageVerified}`
|
|
891
|
+
: undefined,
|
|
694
892
|
]
|
|
695
893
|
.filter(Boolean)
|
|
696
894
|
.join("\n");
|
|
@@ -1051,7 +1249,7 @@ async function main() {
|
|
|
1051
1249
|
const subcommand = process.argv[3];
|
|
1052
1250
|
const sdk = (0, SimplicityClient_1.createSimplicityClient)(resolveConfig());
|
|
1053
1251
|
if (!command) {
|
|
1054
|
-
throw new Error("Usage: simplicity-cli <compile|presets|preset|contract|artifact|definition|state|binding|policy|bond|fund|gasless> ...");
|
|
1252
|
+
throw new Error("Usage: simplicity-cli <compile|presets|preset|contract|artifact|definition|state|binding|policy|bond|fund|receivable|gasless> ...");
|
|
1055
1253
|
}
|
|
1056
1254
|
if (command === "compile") {
|
|
1057
1255
|
const result = await sdk.compileFromFile({
|
|
@@ -1684,6 +1882,44 @@ async function main() {
|
|
|
1684
1882
|
});
|
|
1685
1883
|
return;
|
|
1686
1884
|
}
|
|
1885
|
+
if (command === "bond" && subcommand === "verify-issuance-history") {
|
|
1886
|
+
const issuanceHistoryPaths = getMultiArgs("issuance-history-json");
|
|
1887
|
+
const issuanceHistoryValues = getMultiArgs("issuance-history-value").map((value) => JSON.parse(value));
|
|
1888
|
+
const result = await sdk.bonds.verifyIssuanceHistory({
|
|
1889
|
+
definitionPath: getArg("definition-json"),
|
|
1890
|
+
definitionValue: getArg("definition-value") ? JSON.parse(getArg("definition-value")) : undefined,
|
|
1891
|
+
issuanceHistoryPaths: issuanceHistoryPaths.length > 0 ? issuanceHistoryPaths : undefined,
|
|
1892
|
+
issuanceHistoryValues: issuanceHistoryValues.length > 0 ? issuanceHistoryValues : undefined,
|
|
1893
|
+
});
|
|
1894
|
+
printJson({
|
|
1895
|
+
summary: {
|
|
1896
|
+
verified: result.verified,
|
|
1897
|
+
issuanceId: result.issuanceHistoryValues.at(-1)?.issuanceId ?? null,
|
|
1898
|
+
chainLength: result.report.issuanceLineageTrust?.chainLength ?? 0,
|
|
1899
|
+
latestStatus: result.report.issuanceLineageTrust?.latestStatus ?? null,
|
|
1900
|
+
latestOrdinal: result.report.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
1901
|
+
startsAtGenesis: result.report.issuanceLineageTrust?.startsAtGenesis ?? false,
|
|
1902
|
+
allHashLinksVerified: result.report.issuanceLineageTrust?.allHashLinksVerified ?? false,
|
|
1903
|
+
identityConsistent: result.report.issuanceLineageTrust?.identityConsistent ?? false,
|
|
1904
|
+
fullLineageVerified: result.report.issuanceLineageTrust?.fullLineageVerified ?? false,
|
|
1905
|
+
fullHistoryVerified: result.report.issuanceLineageTrust?.fullHistoryVerified ?? false,
|
|
1906
|
+
},
|
|
1907
|
+
summaryText: formatBondIssuanceHistorySummary({
|
|
1908
|
+
verified: result.verified,
|
|
1909
|
+
issuanceId: result.issuanceHistoryValues.at(-1)?.issuanceId ?? "unknown",
|
|
1910
|
+
chainLength: result.report.issuanceLineageTrust?.chainLength ?? 0,
|
|
1911
|
+
latestStatus: result.report.issuanceLineageTrust?.latestStatus ?? null,
|
|
1912
|
+
latestOrdinal: result.report.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
1913
|
+
startsAtGenesis: result.report.issuanceLineageTrust?.startsAtGenesis ?? false,
|
|
1914
|
+
allHashLinksVerified: result.report.issuanceLineageTrust?.allHashLinksVerified ?? false,
|
|
1915
|
+
identityConsistent: result.report.issuanceLineageTrust?.identityConsistent ?? false,
|
|
1916
|
+
fullLineageVerified: result.report.issuanceLineageTrust?.fullLineageVerified ?? false,
|
|
1917
|
+
fullHistoryVerified: result.report.issuanceLineageTrust?.fullHistoryVerified ?? false,
|
|
1918
|
+
}),
|
|
1919
|
+
...result,
|
|
1920
|
+
});
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1687
1923
|
if (command === "bond" && subcommand === "prepare-redemption") {
|
|
1688
1924
|
const result = await sdk.bonds.prepareRedemption({
|
|
1689
1925
|
definitionPath: getArg("definition-json"),
|
|
@@ -2138,6 +2374,8 @@ async function main() {
|
|
|
2138
2374
|
return;
|
|
2139
2375
|
}
|
|
2140
2376
|
if (command === "bond" && subcommand === "export-evidence") {
|
|
2377
|
+
const issuanceHistoryPaths = getMultiArgs("issuance-history-json");
|
|
2378
|
+
const issuanceHistoryValues = getMultiArgs("issuance-history-value").map((value) => JSON.parse(value));
|
|
2141
2379
|
const settlementDescriptorValue = getArg("settlement-descriptor-value")
|
|
2142
2380
|
? JSON.parse(getArg("settlement-descriptor-value"))
|
|
2143
2381
|
: undefined;
|
|
@@ -2148,6 +2386,8 @@ async function main() {
|
|
|
2148
2386
|
artifactPath: requireArg("artifact"),
|
|
2149
2387
|
definitionPath: getArg("definition-json"),
|
|
2150
2388
|
issuancePath: getArg("issuance-json"),
|
|
2389
|
+
issuanceHistoryPaths: issuanceHistoryPaths.length > 0 ? issuanceHistoryPaths : undefined,
|
|
2390
|
+
issuanceHistoryValues: issuanceHistoryValues.length > 0 ? issuanceHistoryValues : undefined,
|
|
2151
2391
|
settlementDescriptorValue,
|
|
2152
2392
|
transitionValue,
|
|
2153
2393
|
});
|
|
@@ -2160,6 +2400,12 @@ async function main() {
|
|
|
2160
2400
|
closingHash: result.closing?.hash ?? null,
|
|
2161
2401
|
renderedSourceHash: result.renderedSourceHash ?? null,
|
|
2162
2402
|
sourceVerificationMode: result.sourceVerificationMode,
|
|
2403
|
+
lineageKind: result.trust.issuanceLineageTrust?.lineageKind ?? null,
|
|
2404
|
+
latestOrdinal: result.trust.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
2405
|
+
allHashLinksVerified: result.trust.issuanceLineageTrust?.allHashLinksVerified ?? null,
|
|
2406
|
+
identityConsistent: result.trust.issuanceLineageTrust?.identityConsistent ?? null,
|
|
2407
|
+
fullLineageVerified: result.trust.issuanceLineageTrust?.fullLineageVerified ?? null,
|
|
2408
|
+
fullHistoryVerified: result.trust.issuanceLineageTrust?.fullHistoryVerified ?? null,
|
|
2163
2409
|
},
|
|
2164
2410
|
summaryText: formatBondEvidenceSummary({
|
|
2165
2411
|
definitionHash: result.definition.hash,
|
|
@@ -2168,11 +2414,19 @@ async function main() {
|
|
|
2168
2414
|
closingHash: result.closing?.hash ?? null,
|
|
2169
2415
|
renderedSourceHash: result.renderedSourceHash ?? null,
|
|
2170
2416
|
sourceVerificationMode: result.sourceVerificationMode,
|
|
2417
|
+
lineageKind: result.trust.issuanceLineageTrust?.lineageKind ?? null,
|
|
2418
|
+
latestOrdinal: result.trust.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
2419
|
+
allHashLinksVerified: result.trust.issuanceLineageTrust?.allHashLinksVerified ?? null,
|
|
2420
|
+
identityConsistent: result.trust.issuanceLineageTrust?.identityConsistent ?? null,
|
|
2421
|
+
fullLineageVerified: result.trust.issuanceLineageTrust?.fullLineageVerified ?? null,
|
|
2422
|
+
fullHistoryVerified: result.trust.issuanceLineageTrust?.fullHistoryVerified ?? null,
|
|
2171
2423
|
}),
|
|
2172
2424
|
});
|
|
2173
2425
|
return;
|
|
2174
2426
|
}
|
|
2175
2427
|
if (command === "bond" && subcommand === "export-finality-payload") {
|
|
2428
|
+
const issuanceHistoryPaths = getMultiArgs("issuance-history-json");
|
|
2429
|
+
const issuanceHistoryValues = getMultiArgs("issuance-history-value").map((value) => JSON.parse(value));
|
|
2176
2430
|
const settlementDescriptorValue = getArg("settlement-descriptor-value")
|
|
2177
2431
|
? JSON.parse(getArg("settlement-descriptor-value"))
|
|
2178
2432
|
: undefined;
|
|
@@ -2183,6 +2437,8 @@ async function main() {
|
|
|
2183
2437
|
artifactPath: requireArg("artifact"),
|
|
2184
2438
|
definitionPath: getArg("definition-json"),
|
|
2185
2439
|
issuancePath: getArg("issuance-json"),
|
|
2440
|
+
issuanceHistoryPaths: issuanceHistoryPaths.length > 0 ? issuanceHistoryPaths : undefined,
|
|
2441
|
+
issuanceHistoryValues: issuanceHistoryValues.length > 0 ? issuanceHistoryValues : undefined,
|
|
2186
2442
|
settlementDescriptorValue,
|
|
2187
2443
|
closingDescriptorValue,
|
|
2188
2444
|
});
|
|
@@ -2198,6 +2454,12 @@ async function main() {
|
|
|
2198
2454
|
contractAddress: result.payload.contractAddress,
|
|
2199
2455
|
cmr: result.payload.cmr,
|
|
2200
2456
|
bindingMode: result.bindingMode,
|
|
2457
|
+
lineageKind: result.trust.issuanceLineageTrust?.lineageKind ?? null,
|
|
2458
|
+
latestOrdinal: result.trust.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
2459
|
+
allHashLinksVerified: result.trust.issuanceLineageTrust?.allHashLinksVerified ?? null,
|
|
2460
|
+
identityConsistent: result.trust.issuanceLineageTrust?.identityConsistent ?? null,
|
|
2461
|
+
fullLineageVerified: result.trust.issuanceLineageTrust?.fullLineageVerified ?? null,
|
|
2462
|
+
fullHistoryVerified: result.trust.issuanceLineageTrust?.fullHistoryVerified ?? null,
|
|
2201
2463
|
},
|
|
2202
2464
|
summaryText: formatBondFinalityPayloadSummary({
|
|
2203
2465
|
bondId: result.payload.bondId,
|
|
@@ -2209,6 +2471,12 @@ async function main() {
|
|
|
2209
2471
|
contractAddress: result.payload.contractAddress,
|
|
2210
2472
|
cmr: result.payload.cmr,
|
|
2211
2473
|
bindingMode: result.bindingMode,
|
|
2474
|
+
lineageKind: result.trust.issuanceLineageTrust?.lineageKind ?? null,
|
|
2475
|
+
latestOrdinal: result.trust.issuanceLineageTrust?.latestOrdinal ?? null,
|
|
2476
|
+
allHashLinksVerified: result.trust.issuanceLineageTrust?.allHashLinksVerified ?? null,
|
|
2477
|
+
identityConsistent: result.trust.issuanceLineageTrust?.identityConsistent ?? null,
|
|
2478
|
+
fullLineageVerified: result.trust.issuanceLineageTrust?.fullLineageVerified ?? null,
|
|
2479
|
+
fullHistoryVerified: result.trust.issuanceLineageTrust?.fullHistoryVerified ?? null,
|
|
2212
2480
|
}),
|
|
2213
2481
|
});
|
|
2214
2482
|
return;
|
|
@@ -2483,6 +2751,10 @@ async function main() {
|
|
|
2483
2751
|
capitalCallValue: getArg("capital-call-value") ? JSON.parse(getArg("capital-call-value")) : undefined,
|
|
2484
2752
|
refundAddress: requireArg("refund-address"),
|
|
2485
2753
|
refundedAt: getArg("refunded-at"),
|
|
2754
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
2755
|
+
outputForm: parsePolicyOutputForm(),
|
|
2756
|
+
rawOutput: parseRawOutputFields(),
|
|
2757
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
2486
2758
|
wallet: requireArg("wallet"),
|
|
2487
2759
|
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
2488
2760
|
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
@@ -2495,6 +2767,7 @@ async function main() {
|
|
|
2495
2767
|
amount: result.verified.capitalCallValue.amount,
|
|
2496
2768
|
assetId: result.verified.capitalCallValue.currencyAssetId,
|
|
2497
2769
|
summaryHash: result.inspect.summaryHash,
|
|
2770
|
+
outputBinding: result.report.outputBindingTrust ?? null,
|
|
2498
2771
|
},
|
|
2499
2772
|
summaryText: formatFundCapitalCallSummary({
|
|
2500
2773
|
phase: "inspect-refund",
|
|
@@ -2503,6 +2776,7 @@ async function main() {
|
|
|
2503
2776
|
amount: result.verified.capitalCallValue.amount,
|
|
2504
2777
|
assetId: result.verified.capitalCallValue.currencyAssetId,
|
|
2505
2778
|
summaryHash: result.inspect.summaryHash,
|
|
2779
|
+
outputBinding: result.report.outputBindingTrust,
|
|
2506
2780
|
}),
|
|
2507
2781
|
...result,
|
|
2508
2782
|
});
|
|
@@ -2517,6 +2791,10 @@ async function main() {
|
|
|
2517
2791
|
capitalCallValue: getArg("capital-call-value") ? JSON.parse(getArg("capital-call-value")) : undefined,
|
|
2518
2792
|
refundAddress: requireArg("refund-address"),
|
|
2519
2793
|
refundedAt: getArg("refunded-at"),
|
|
2794
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
2795
|
+
outputForm: parsePolicyOutputForm(),
|
|
2796
|
+
rawOutput: parseRawOutputFields(),
|
|
2797
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
2520
2798
|
wallet: requireArg("wallet"),
|
|
2521
2799
|
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
2522
2800
|
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
@@ -2531,6 +2809,7 @@ async function main() {
|
|
|
2531
2809
|
assetId: result.verified.capitalCallValue.currencyAssetId,
|
|
2532
2810
|
txId: result.execution.txId ?? null,
|
|
2533
2811
|
broadcasted: result.execution.broadcasted,
|
|
2812
|
+
outputBinding: result.report.outputBindingTrust ?? null,
|
|
2534
2813
|
},
|
|
2535
2814
|
summaryText: formatFundCapitalCallSummary({
|
|
2536
2815
|
phase: "execute-refund",
|
|
@@ -2540,6 +2819,7 @@ async function main() {
|
|
|
2540
2819
|
assetId: result.verified.capitalCallValue.currencyAssetId,
|
|
2541
2820
|
txId: result.execution.txId,
|
|
2542
2821
|
broadcasted: result.execution.broadcasted,
|
|
2822
|
+
outputBinding: result.report.outputBindingTrust,
|
|
2543
2823
|
}),
|
|
2544
2824
|
...result,
|
|
2545
2825
|
});
|
|
@@ -2607,11 +2887,19 @@ async function main() {
|
|
|
2607
2887
|
return;
|
|
2608
2888
|
}
|
|
2609
2889
|
if (command === "fund" && subcommand === "verify-position-receipt") {
|
|
2890
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
2891
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2610
2892
|
const result = await sdk.funds.verifyPositionReceipt({
|
|
2611
2893
|
definitionPath: getArg("definition-json"),
|
|
2612
2894
|
definitionValue: getArg("definition-value") ? JSON.parse(getArg("definition-value")) : undefined,
|
|
2613
2895
|
positionReceiptPath: getArg("position-receipt-json"),
|
|
2614
2896
|
positionReceiptValue: getArg("position-receipt-value") ? JSON.parse(getArg("position-receipt-value")) : undefined,
|
|
2897
|
+
previousPositionReceiptPath: getArg("previous-position-receipt-json"),
|
|
2898
|
+
previousPositionReceiptValue: getArg("previous-position-receipt-value")
|
|
2899
|
+
? JSON.parse(getArg("previous-position-receipt-value"))
|
|
2900
|
+
: undefined,
|
|
2901
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
2902
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2615
2903
|
});
|
|
2616
2904
|
printJson({
|
|
2617
2905
|
summary: {
|
|
@@ -2620,6 +2908,14 @@ async function main() {
|
|
|
2620
2908
|
sequence: result.positionReceiptValue.receipt.sequence,
|
|
2621
2909
|
receiptHash: result.positionReceiptSummary.hash,
|
|
2622
2910
|
envelopeHash: result.positionReceiptEnvelopeSummary.hash,
|
|
2911
|
+
continuityVerified: result.report.receiptTrust?.continuityVerified ?? null,
|
|
2912
|
+
lineageKind: result.report.receiptChainTrust?.lineageKind ?? null,
|
|
2913
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
2914
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
2915
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? null,
|
|
2916
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? null,
|
|
2917
|
+
chainLength: result.report.receiptChainTrust?.chainLength ?? null,
|
|
2918
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? null,
|
|
2623
2919
|
},
|
|
2624
2920
|
summaryText: [
|
|
2625
2921
|
`verified=${result.verified}`,
|
|
@@ -2627,11 +2923,57 @@ async function main() {
|
|
|
2627
2923
|
`sequence=${result.positionReceiptValue.receipt.sequence}`,
|
|
2628
2924
|
`receiptHash=${result.positionReceiptSummary.hash}`,
|
|
2629
2925
|
`envelopeHash=${result.positionReceiptEnvelopeSummary.hash}`,
|
|
2926
|
+
`continuityVerified=${result.report.receiptTrust?.continuityVerified ?? false}`,
|
|
2927
|
+
`lineageKind=${result.report.receiptChainTrust?.lineageKind ?? "receipt-chain"}`,
|
|
2928
|
+
`latestOrdinal=${result.report.receiptChainTrust?.latestOrdinal ?? result.positionReceiptValue.receipt.sequence}`,
|
|
2929
|
+
`allHashLinksVerified=${result.report.receiptChainTrust?.allHashLinksVerified ?? false}`,
|
|
2930
|
+
`identityConsistent=${result.report.receiptChainTrust?.identityConsistent ?? false}`,
|
|
2931
|
+
`fullLineageVerified=${result.report.receiptChainTrust?.fullLineageVerified ?? false}`,
|
|
2932
|
+
`chainLength=${result.report.receiptChainTrust?.chainLength ?? 0}`,
|
|
2933
|
+
`fullChainVerified=${result.report.receiptChainTrust?.fullChainVerified ?? false}`,
|
|
2630
2934
|
].join("\n"),
|
|
2631
2935
|
...result,
|
|
2632
2936
|
});
|
|
2633
2937
|
return;
|
|
2634
2938
|
}
|
|
2939
|
+
if (command === "fund" && subcommand === "verify-position-receipt-chain") {
|
|
2940
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
2941
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2942
|
+
const result = await sdk.funds.verifyPositionReceiptChain({
|
|
2943
|
+
definitionPath: getArg("definition-json"),
|
|
2944
|
+
definitionValue: getArg("definition-value") ? JSON.parse(getArg("definition-value")) : undefined,
|
|
2945
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
2946
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2947
|
+
});
|
|
2948
|
+
printJson({
|
|
2949
|
+
summary: {
|
|
2950
|
+
verified: result.verified,
|
|
2951
|
+
positionId: result.positionReceiptValue.receipt.positionId,
|
|
2952
|
+
chainLength: result.report.receiptChainTrust?.chainLength ?? 0,
|
|
2953
|
+
latestSequence: result.report.receiptChainTrust?.latestSequence ?? null,
|
|
2954
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
2955
|
+
startsAtGenesis: result.report.receiptChainTrust?.startsAtGenesis ?? false,
|
|
2956
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? false,
|
|
2957
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? false,
|
|
2958
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? false,
|
|
2959
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? false,
|
|
2960
|
+
},
|
|
2961
|
+
summaryText: formatFundReceiptChainSummary({
|
|
2962
|
+
verified: result.verified,
|
|
2963
|
+
positionId: result.positionReceiptValue.receipt.positionId,
|
|
2964
|
+
chainLength: result.report.receiptChainTrust?.chainLength ?? 0,
|
|
2965
|
+
latestSequence: result.report.receiptChainTrust?.latestSequence ?? null,
|
|
2966
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
2967
|
+
startsAtGenesis: result.report.receiptChainTrust?.startsAtGenesis ?? false,
|
|
2968
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? false,
|
|
2969
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? false,
|
|
2970
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? false,
|
|
2971
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? false,
|
|
2972
|
+
}),
|
|
2973
|
+
...result,
|
|
2974
|
+
});
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2635
2977
|
if (command === "fund" && subcommand === "reconcile-position") {
|
|
2636
2978
|
const distributionJsons = getMultiArgs("distribution-json");
|
|
2637
2979
|
const distributionValues = getMultiArgs("distribution-value").map((value) => JSON.parse(value));
|
|
@@ -2788,9 +3130,19 @@ async function main() {
|
|
|
2788
3130
|
return;
|
|
2789
3131
|
}
|
|
2790
3132
|
if (command === "fund" && subcommand === "prepare-closing") {
|
|
3133
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
3134
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2791
3135
|
const result = await sdk.funds.prepareClosing({
|
|
3136
|
+
definitionPath: getArg("definition-json"),
|
|
3137
|
+
definitionValue: getArg("definition-value") ? JSON.parse(getArg("definition-value")) : undefined,
|
|
2792
3138
|
positionReceiptPath: getArg("position-receipt-json"),
|
|
2793
3139
|
positionReceiptValue: getArg("position-receipt-value") ? JSON.parse(getArg("position-receipt-value")) : undefined,
|
|
3140
|
+
previousPositionReceiptPath: getArg("previous-position-receipt-json"),
|
|
3141
|
+
previousPositionReceiptValue: getArg("previous-position-receipt-value")
|
|
3142
|
+
? JSON.parse(getArg("previous-position-receipt-value"))
|
|
3143
|
+
: undefined,
|
|
3144
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
3145
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2794
3146
|
closingPath: getArg("closing-json"),
|
|
2795
3147
|
closingValue: getArg("closing-value") ? JSON.parse(getArg("closing-value")) : undefined,
|
|
2796
3148
|
closingId: getArg("closing-id"),
|
|
@@ -2805,6 +3157,13 @@ async function main() {
|
|
|
2805
3157
|
closingReason: result.closingValue.closingReason,
|
|
2806
3158
|
positionId: result.closingValue.positionId,
|
|
2807
3159
|
distributionCount: result.closingValue.finalDistributionHashes.length,
|
|
3160
|
+
continuityVerified: result.report.receiptTrust?.continuityVerified ?? null,
|
|
3161
|
+
lineageKind: result.report.receiptChainTrust?.lineageKind ?? null,
|
|
3162
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
3163
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3164
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? null,
|
|
3165
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3166
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? null,
|
|
2808
3167
|
},
|
|
2809
3168
|
summaryText: formatFundClosingSummary({
|
|
2810
3169
|
closingHash: result.closingHash,
|
|
@@ -2812,15 +3171,32 @@ async function main() {
|
|
|
2812
3171
|
closingReason: result.closingValue.closingReason,
|
|
2813
3172
|
positionId: result.closingValue.positionId,
|
|
2814
3173
|
distributionCount: result.closingValue.finalDistributionHashes.length,
|
|
3174
|
+
continuityVerified: result.report.receiptTrust?.continuityVerified ?? false,
|
|
3175
|
+
lineageKind: result.report.receiptChainTrust?.lineageKind ?? null,
|
|
3176
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
3177
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3178
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? null,
|
|
3179
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3180
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? false,
|
|
2815
3181
|
}),
|
|
2816
3182
|
...result,
|
|
2817
3183
|
});
|
|
2818
3184
|
return;
|
|
2819
3185
|
}
|
|
2820
3186
|
if (command === "fund" && subcommand === "verify-closing") {
|
|
3187
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
3188
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2821
3189
|
const result = await sdk.funds.verifyClosing({
|
|
3190
|
+
definitionPath: getArg("definition-json"),
|
|
3191
|
+
definitionValue: getArg("definition-value") ? JSON.parse(getArg("definition-value")) : undefined,
|
|
2822
3192
|
positionReceiptPath: getArg("position-receipt-json"),
|
|
2823
3193
|
positionReceiptValue: getArg("position-receipt-value") ? JSON.parse(getArg("position-receipt-value")) : undefined,
|
|
3194
|
+
previousPositionReceiptPath: getArg("previous-position-receipt-json"),
|
|
3195
|
+
previousPositionReceiptValue: getArg("previous-position-receipt-value")
|
|
3196
|
+
? JSON.parse(getArg("previous-position-receipt-value"))
|
|
3197
|
+
: undefined,
|
|
3198
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
3199
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2824
3200
|
closingPath: getArg("closing-json"),
|
|
2825
3201
|
closingValue: getArg("closing-value") ? JSON.parse(getArg("closing-value")) : undefined,
|
|
2826
3202
|
});
|
|
@@ -2832,6 +3208,13 @@ async function main() {
|
|
|
2832
3208
|
closingReason: result.closingValue.closingReason,
|
|
2833
3209
|
positionId: result.closingValue.positionId,
|
|
2834
3210
|
distributionCount: result.closingValue.finalDistributionHashes.length,
|
|
3211
|
+
continuityVerified: result.report.receiptTrust?.continuityVerified ?? null,
|
|
3212
|
+
lineageKind: result.report.receiptChainTrust?.lineageKind ?? null,
|
|
3213
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
3214
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3215
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? null,
|
|
3216
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3217
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? null,
|
|
2835
3218
|
},
|
|
2836
3219
|
summaryText: formatFundClosingSummary({
|
|
2837
3220
|
ok: result.verified,
|
|
@@ -2840,12 +3223,21 @@ async function main() {
|
|
|
2840
3223
|
closingReason: result.closingValue.closingReason,
|
|
2841
3224
|
positionId: result.closingValue.positionId,
|
|
2842
3225
|
distributionCount: result.closingValue.finalDistributionHashes.length,
|
|
3226
|
+
continuityVerified: result.report.receiptTrust?.continuityVerified ?? false,
|
|
3227
|
+
lineageKind: result.report.receiptChainTrust?.lineageKind ?? null,
|
|
3228
|
+
latestOrdinal: result.report.receiptChainTrust?.latestOrdinal ?? null,
|
|
3229
|
+
allHashLinksVerified: result.report.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3230
|
+
identityConsistent: result.report.receiptChainTrust?.identityConsistent ?? null,
|
|
3231
|
+
fullLineageVerified: result.report.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3232
|
+
fullChainVerified: result.report.receiptChainTrust?.fullChainVerified ?? false,
|
|
2843
3233
|
}),
|
|
2844
3234
|
...result,
|
|
2845
3235
|
});
|
|
2846
3236
|
return;
|
|
2847
3237
|
}
|
|
2848
3238
|
if (command === "fund" && subcommand === "export-evidence") {
|
|
3239
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
3240
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2849
3241
|
const result = await sdk.funds.exportEvidence({
|
|
2850
3242
|
artifactPath: getArg("artifact"),
|
|
2851
3243
|
definitionPath: getArg("definition-json"),
|
|
@@ -2854,6 +3246,12 @@ async function main() {
|
|
|
2854
3246
|
capitalCallValue: getArg("capital-call-value") ? JSON.parse(getArg("capital-call-value")) : undefined,
|
|
2855
3247
|
positionReceiptPath: getArg("position-receipt-json"),
|
|
2856
3248
|
positionReceiptValue: getArg("position-receipt-value") ? JSON.parse(getArg("position-receipt-value")) : undefined,
|
|
3249
|
+
previousPositionReceiptPath: getArg("previous-position-receipt-json"),
|
|
3250
|
+
previousPositionReceiptValue: getArg("previous-position-receipt-value")
|
|
3251
|
+
? JSON.parse(getArg("previous-position-receipt-value"))
|
|
3252
|
+
: undefined,
|
|
3253
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
3254
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2857
3255
|
distributionPath: getArg("distribution-json"),
|
|
2858
3256
|
distributionValue: getArg("distribution-value") ? JSON.parse(getArg("distribution-value")) : undefined,
|
|
2859
3257
|
closingPath: getArg("closing-json"),
|
|
@@ -2868,20 +3266,35 @@ async function main() {
|
|
|
2868
3266
|
distributionHash: result.distribution?.hash ?? null,
|
|
2869
3267
|
closingHash: result.closing?.hash ?? null,
|
|
2870
3268
|
sourceVerificationMode: result.sourceVerificationMode,
|
|
3269
|
+
lineageKind: result.trust.receiptChainTrust?.lineageKind ?? null,
|
|
3270
|
+
latestOrdinal: result.trust.receiptChainTrust?.latestOrdinal ?? null,
|
|
3271
|
+
allHashLinksVerified: result.trust.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3272
|
+
identityConsistent: result.trust.receiptChainTrust?.identityConsistent ?? null,
|
|
3273
|
+
fullLineageVerified: result.trust.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3274
|
+
fullChainVerified: result.trust.receiptChainTrust?.fullChainVerified ?? null,
|
|
2871
3275
|
},
|
|
2872
3276
|
summaryText: formatFundEvidenceSummary({
|
|
2873
3277
|
definitionHash: result.definition.hash,
|
|
2874
3278
|
capitalCallHash: result.capitalCall?.hash ?? null,
|
|
2875
3279
|
positionReceiptHash: result.positionReceipt?.hash ?? null,
|
|
3280
|
+
positionReceiptEnvelopeHash: result.positionReceiptEnvelope?.hash ?? null,
|
|
2876
3281
|
distributionHash: result.distribution?.hash ?? null,
|
|
2877
3282
|
closingHash: result.closing?.hash ?? null,
|
|
2878
3283
|
sourceVerificationMode: result.sourceVerificationMode,
|
|
3284
|
+
lineageKind: result.trust.receiptChainTrust?.lineageKind ?? null,
|
|
3285
|
+
latestOrdinal: result.trust.receiptChainTrust?.latestOrdinal ?? null,
|
|
3286
|
+
allHashLinksVerified: result.trust.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3287
|
+
identityConsistent: result.trust.receiptChainTrust?.identityConsistent ?? null,
|
|
3288
|
+
fullLineageVerified: result.trust.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3289
|
+
fullChainVerified: result.trust.receiptChainTrust?.fullChainVerified ?? null,
|
|
2879
3290
|
}),
|
|
2880
3291
|
...result,
|
|
2881
3292
|
});
|
|
2882
3293
|
return;
|
|
2883
3294
|
}
|
|
2884
3295
|
if (command === "fund" && subcommand === "export-finality-payload") {
|
|
3296
|
+
const positionReceiptChainPaths = getMultiArgs("position-receipt-chain-json");
|
|
3297
|
+
const positionReceiptChainValues = getMultiArgs("position-receipt-chain-value").map((value) => JSON.parse(value));
|
|
2885
3298
|
const result = await sdk.funds.exportFinalityPayload({
|
|
2886
3299
|
artifactPath: getArg("artifact"),
|
|
2887
3300
|
definitionPath: getArg("definition-json"),
|
|
@@ -2890,6 +3303,12 @@ async function main() {
|
|
|
2890
3303
|
capitalCallValue: getArg("capital-call-value") ? JSON.parse(getArg("capital-call-value")) : undefined,
|
|
2891
3304
|
positionReceiptPath: getArg("position-receipt-json"),
|
|
2892
3305
|
positionReceiptValue: getArg("position-receipt-value") ? JSON.parse(getArg("position-receipt-value")) : undefined,
|
|
3306
|
+
previousPositionReceiptPath: getArg("previous-position-receipt-json"),
|
|
3307
|
+
previousPositionReceiptValue: getArg("previous-position-receipt-value")
|
|
3308
|
+
? JSON.parse(getArg("previous-position-receipt-value"))
|
|
3309
|
+
: undefined,
|
|
3310
|
+
positionReceiptChainPaths: positionReceiptChainPaths.length > 0 ? positionReceiptChainPaths : undefined,
|
|
3311
|
+
positionReceiptChainValues: positionReceiptChainValues.length > 0 ? positionReceiptChainValues : undefined,
|
|
2893
3312
|
distributionPath: getArg("distribution-json"),
|
|
2894
3313
|
distributionValue: getArg("distribution-value") ? JSON.parse(getArg("distribution-value")) : undefined,
|
|
2895
3314
|
closingPath: getArg("closing-json"),
|
|
@@ -2908,6 +3327,12 @@ async function main() {
|
|
|
2908
3327
|
distributionHash: result.distributionHash ?? null,
|
|
2909
3328
|
closingHash: result.closingHash ?? null,
|
|
2910
3329
|
bindingMode: result.bindingMode,
|
|
3330
|
+
lineageKind: result.trust.receiptChainTrust?.lineageKind ?? null,
|
|
3331
|
+
latestOrdinal: result.trust.receiptChainTrust?.latestOrdinal ?? null,
|
|
3332
|
+
allHashLinksVerified: result.trust.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3333
|
+
identityConsistent: result.trust.receiptChainTrust?.identityConsistent ?? null,
|
|
3334
|
+
fullLineageVerified: result.trust.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3335
|
+
fullChainVerified: result.trust.receiptChainTrust?.fullChainVerified ?? null,
|
|
2911
3336
|
},
|
|
2912
3337
|
summaryText: formatFundFinalitySummary({
|
|
2913
3338
|
fundId: result.fundId,
|
|
@@ -2917,9 +3342,690 @@ async function main() {
|
|
|
2917
3342
|
definitionHash: result.definitionHash,
|
|
2918
3343
|
capitalCallStateHash: result.capitalCallStateHash,
|
|
2919
3344
|
positionReceiptHash: result.positionReceiptHash,
|
|
3345
|
+
positionReceiptEnvelopeHash: result.positionReceiptEnvelopeHash,
|
|
2920
3346
|
distributionHash: result.distributionHash,
|
|
2921
3347
|
closingHash: result.closingHash,
|
|
2922
3348
|
bindingMode: result.bindingMode,
|
|
3349
|
+
lineageKind: result.trust.receiptChainTrust?.lineageKind ?? null,
|
|
3350
|
+
latestOrdinal: result.trust.receiptChainTrust?.latestOrdinal ?? null,
|
|
3351
|
+
allHashLinksVerified: result.trust.receiptChainTrust?.allHashLinksVerified ?? null,
|
|
3352
|
+
identityConsistent: result.trust.receiptChainTrust?.identityConsistent ?? null,
|
|
3353
|
+
fullLineageVerified: result.trust.receiptChainTrust?.fullLineageVerified ?? null,
|
|
3354
|
+
fullChainVerified: result.trust.receiptChainTrust?.fullChainVerified ?? null,
|
|
3355
|
+
}),
|
|
3356
|
+
...result,
|
|
3357
|
+
});
|
|
3358
|
+
return;
|
|
3359
|
+
}
|
|
3360
|
+
if (command === "receivable" && subcommand === "define") {
|
|
3361
|
+
const result = await sdk.receivables.define({
|
|
3362
|
+
definitionPath: getArg("definition-json"),
|
|
3363
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3364
|
+
});
|
|
3365
|
+
printJson({
|
|
3366
|
+
summaryText: formatReceivableDefinitionSummary({
|
|
3367
|
+
ok: result.ok,
|
|
3368
|
+
receivableId: result.definitionValue.receivableId,
|
|
3369
|
+
originatorEntityId: result.definitionValue.originatorEntityId,
|
|
3370
|
+
debtorEntityId: result.definitionValue.debtorEntityId,
|
|
3371
|
+
currencyAssetId: result.definitionValue.currencyAssetId,
|
|
3372
|
+
faceValue: result.definitionValue.faceValue,
|
|
3373
|
+
dueDate: result.definitionValue.dueDate,
|
|
3374
|
+
}),
|
|
3375
|
+
...result,
|
|
3376
|
+
});
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
if (command === "receivable" && subcommand === "verify") {
|
|
3380
|
+
const result = await sdk.receivables.verify({
|
|
3381
|
+
definitionPath: getArg("definition-json"),
|
|
3382
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3383
|
+
statePath: getArg("state-json"),
|
|
3384
|
+
stateValue: parseJsonArg("state-value"),
|
|
3385
|
+
});
|
|
3386
|
+
printJson({
|
|
3387
|
+
summaryText: formatReceivableDefinitionSummary({
|
|
3388
|
+
ok: result.verified,
|
|
3389
|
+
receivableId: result.definitionValue.receivableId,
|
|
3390
|
+
originatorEntityId: result.definitionValue.originatorEntityId,
|
|
3391
|
+
debtorEntityId: result.definitionValue.debtorEntityId,
|
|
3392
|
+
currencyAssetId: result.definitionValue.currencyAssetId,
|
|
3393
|
+
faceValue: result.definitionValue.faceValue,
|
|
3394
|
+
dueDate: result.definitionValue.dueDate,
|
|
3395
|
+
}),
|
|
3396
|
+
...result,
|
|
3397
|
+
});
|
|
3398
|
+
return;
|
|
3399
|
+
}
|
|
3400
|
+
if (command === "receivable" && subcommand === "load") {
|
|
3401
|
+
const result = await sdk.receivables.load({
|
|
3402
|
+
definitionPath: getArg("definition-json"),
|
|
3403
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3404
|
+
statePath: getArg("state-json"),
|
|
3405
|
+
stateValue: parseJsonArg("state-value"),
|
|
3406
|
+
});
|
|
3407
|
+
printJson({
|
|
3408
|
+
summaryText: formatReceivableDefinitionSummary({
|
|
3409
|
+
receivableId: result.definitionValue.receivableId,
|
|
3410
|
+
originatorEntityId: result.definitionValue.originatorEntityId,
|
|
3411
|
+
debtorEntityId: result.definitionValue.debtorEntityId,
|
|
3412
|
+
currencyAssetId: result.definitionValue.currencyAssetId,
|
|
3413
|
+
faceValue: result.definitionValue.faceValue,
|
|
3414
|
+
dueDate: result.definitionValue.dueDate,
|
|
3415
|
+
}),
|
|
3416
|
+
...result,
|
|
3417
|
+
});
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
if (command === "receivable" && subcommand === "prepare-funding") {
|
|
3421
|
+
const result = await sdk.receivables.prepareFunding({
|
|
3422
|
+
definitionPath: getArg("definition-json"),
|
|
3423
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3424
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3425
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3426
|
+
nextStatePath: getArg("next-state-json"),
|
|
3427
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3428
|
+
stateId: getArg("state-id"),
|
|
3429
|
+
holderEntityId: getArg("holder-entity-id"),
|
|
3430
|
+
fundedAt: getArg("funded-at"),
|
|
3431
|
+
});
|
|
3432
|
+
printJson({
|
|
3433
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3434
|
+
phase: "prepare-funding",
|
|
3435
|
+
verified: result.verified,
|
|
3436
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "FUND",
|
|
3437
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3438
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3439
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3440
|
+
status: result.nextStateValue.status,
|
|
3441
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3442
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3443
|
+
stateHash: result.nextStateSummary.hash,
|
|
3444
|
+
}),
|
|
3445
|
+
...result,
|
|
3446
|
+
});
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
if (command === "receivable" && subcommand === "verify-funding") {
|
|
3450
|
+
const result = await sdk.receivables.verifyFunding({
|
|
3451
|
+
definitionPath: getArg("definition-json"),
|
|
3452
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3453
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3454
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3455
|
+
nextStatePath: getArg("next-state-json"),
|
|
3456
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3457
|
+
});
|
|
3458
|
+
printJson({
|
|
3459
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3460
|
+
phase: "verify-funding",
|
|
3461
|
+
verified: result.verified,
|
|
3462
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "FUND",
|
|
3463
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3464
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3465
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3466
|
+
status: result.nextStateValue.status,
|
|
3467
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3468
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3469
|
+
stateHash: result.nextStateSummary.hash,
|
|
3470
|
+
}),
|
|
3471
|
+
...result,
|
|
3472
|
+
});
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
if (command === "receivable" && subcommand === "prepare-funding-claim") {
|
|
3476
|
+
const result = await sdk.receivables.prepareFundingClaim({
|
|
3477
|
+
definitionPath: getArg("definition-json"),
|
|
3478
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3479
|
+
currentStatePath: getArg("current-state-json"),
|
|
3480
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3481
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3482
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3483
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
3484
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
3485
|
+
claimId: getArg("claim-id"),
|
|
3486
|
+
payerEntityId: getArg("payer-entity-id"),
|
|
3487
|
+
payeeEntityId: getArg("payee-entity-id"),
|
|
3488
|
+
claimantXonly: getArg("claimant-xonly"),
|
|
3489
|
+
amountSat: getArg("amount-sat") ? Number(getArg("amount-sat")) : undefined,
|
|
3490
|
+
eventTimestamp: getArg("event-timestamp"),
|
|
3491
|
+
simfPath: getArg("simf"),
|
|
3492
|
+
artifactPath: getArg("artifact"),
|
|
3493
|
+
});
|
|
3494
|
+
printJson({
|
|
3495
|
+
summaryText: formatReceivableClaimSummary({
|
|
3496
|
+
phase: "prepare-funding-claim",
|
|
3497
|
+
verified: result.verified,
|
|
3498
|
+
claimKind: result.claimValue.claimKind,
|
|
3499
|
+
receivableId: result.claimValue.receivableId,
|
|
3500
|
+
claimId: result.claimValue.claimId,
|
|
3501
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3502
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3503
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3504
|
+
amountSat: result.claimValue.amountSat,
|
|
3505
|
+
bindingMode: result.report.fundingClaimTrust?.bindingMode,
|
|
3506
|
+
reasonCode: result.report.fundingClaimTrust?.reasonCode,
|
|
3507
|
+
supportedForm: result.report.fundingClaimTrust?.supportedForm,
|
|
3508
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3509
|
+
}),
|
|
3510
|
+
...result,
|
|
3511
|
+
});
|
|
3512
|
+
return;
|
|
3513
|
+
}
|
|
3514
|
+
if (command === "receivable" && subcommand === "verify-funding-claim") {
|
|
3515
|
+
const result = await sdk.receivables.verifyFundingClaim({
|
|
3516
|
+
artifactPath: getArg("artifact"),
|
|
3517
|
+
definitionPath: getArg("definition-json"),
|
|
3518
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3519
|
+
currentStatePath: getArg("current-state-json"),
|
|
3520
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3521
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3522
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3523
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
3524
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
3525
|
+
});
|
|
3526
|
+
printJson({
|
|
3527
|
+
summaryText: formatReceivableClaimSummary({
|
|
3528
|
+
phase: "verify-funding-claim",
|
|
3529
|
+
verified: result.verified,
|
|
3530
|
+
claimKind: result.claimValue.claimKind,
|
|
3531
|
+
receivableId: result.claimValue.receivableId,
|
|
3532
|
+
claimId: result.claimValue.claimId,
|
|
3533
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3534
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3535
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3536
|
+
amountSat: result.claimValue.amountSat,
|
|
3537
|
+
bindingMode: result.report.fundingClaimTrust?.bindingMode,
|
|
3538
|
+
reasonCode: result.report.fundingClaimTrust?.reasonCode,
|
|
3539
|
+
supportedForm: result.report.fundingClaimTrust?.supportedForm,
|
|
3540
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3541
|
+
}),
|
|
3542
|
+
...result,
|
|
3543
|
+
});
|
|
3544
|
+
return;
|
|
3545
|
+
}
|
|
3546
|
+
if (command === "receivable" && subcommand === "inspect-funding-claim") {
|
|
3547
|
+
const result = await sdk.receivables.inspectFundingClaim({
|
|
3548
|
+
artifactPath: requireArg("artifact"),
|
|
3549
|
+
definitionPath: getArg("definition-json"),
|
|
3550
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3551
|
+
currentStatePath: getArg("current-state-json"),
|
|
3552
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3553
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3554
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3555
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
3556
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
3557
|
+
payoutAddress: requireArg("payout-address"),
|
|
3558
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
3559
|
+
outputForm: parsePolicyOutputForm(),
|
|
3560
|
+
rawOutput: parseRawOutputFields(),
|
|
3561
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
3562
|
+
wallet: requireArg("wallet"),
|
|
3563
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
3564
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
3565
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
3566
|
+
});
|
|
3567
|
+
printJson({
|
|
3568
|
+
summaryText: formatReceivableClaimSummary({
|
|
3569
|
+
phase: "inspect-funding-claim",
|
|
3570
|
+
verified: result.verified,
|
|
3571
|
+
claimKind: result.claimValue.claimKind,
|
|
3572
|
+
receivableId: result.claimValue.receivableId,
|
|
3573
|
+
claimId: result.claimValue.claimId,
|
|
3574
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3575
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3576
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3577
|
+
amountSat: result.claimValue.amountSat,
|
|
3578
|
+
bindingMode: result.report.fundingClaimTrust?.bindingMode,
|
|
3579
|
+
reasonCode: result.report.fundingClaimTrust?.reasonCode,
|
|
3580
|
+
supportedForm: result.report.fundingClaimTrust?.supportedForm,
|
|
3581
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3582
|
+
}),
|
|
3583
|
+
...result,
|
|
3584
|
+
});
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
if (command === "receivable" && subcommand === "execute-funding-claim") {
|
|
3588
|
+
const result = await sdk.receivables.executeFundingClaim({
|
|
3589
|
+
artifactPath: requireArg("artifact"),
|
|
3590
|
+
definitionPath: getArg("definition-json"),
|
|
3591
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3592
|
+
currentStatePath: getArg("current-state-json"),
|
|
3593
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3594
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3595
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3596
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
3597
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
3598
|
+
payoutAddress: requireArg("payout-address"),
|
|
3599
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
3600
|
+
outputForm: parsePolicyOutputForm(),
|
|
3601
|
+
rawOutput: parseRawOutputFields(),
|
|
3602
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
3603
|
+
wallet: requireArg("wallet"),
|
|
3604
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
3605
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
3606
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
3607
|
+
broadcast: hasFlag("broadcast"),
|
|
3608
|
+
});
|
|
3609
|
+
printJson({
|
|
3610
|
+
summaryText: formatReceivableClaimSummary({
|
|
3611
|
+
phase: "execute-funding-claim",
|
|
3612
|
+
verified: result.verified,
|
|
3613
|
+
claimKind: result.claimValue.claimKind,
|
|
3614
|
+
receivableId: result.claimValue.receivableId,
|
|
3615
|
+
claimId: result.claimValue.claimId,
|
|
3616
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3617
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3618
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3619
|
+
amountSat: result.claimValue.amountSat,
|
|
3620
|
+
bindingMode: result.report.fundingClaimTrust?.bindingMode,
|
|
3621
|
+
reasonCode: result.report.fundingClaimTrust?.reasonCode,
|
|
3622
|
+
supportedForm: result.report.fundingClaimTrust?.supportedForm,
|
|
3623
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3624
|
+
}),
|
|
3625
|
+
...result,
|
|
3626
|
+
});
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
if (command === "receivable" && subcommand === "prepare-repayment") {
|
|
3630
|
+
const result = await sdk.receivables.prepareRepayment({
|
|
3631
|
+
definitionPath: getArg("definition-json"),
|
|
3632
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3633
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3634
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3635
|
+
nextStatePath: getArg("next-state-json"),
|
|
3636
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3637
|
+
stateId: getArg("state-id"),
|
|
3638
|
+
amount: getArg("amount") ? Number(getArg("amount")) : undefined,
|
|
3639
|
+
repaidAt: getArg("repaid-at"),
|
|
3640
|
+
});
|
|
3641
|
+
printJson({
|
|
3642
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3643
|
+
phase: "prepare-repayment",
|
|
3644
|
+
verified: result.verified,
|
|
3645
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "REPAY",
|
|
3646
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3647
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3648
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3649
|
+
status: result.nextStateValue.status,
|
|
3650
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3651
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3652
|
+
stateHash: result.nextStateSummary.hash,
|
|
3653
|
+
}),
|
|
3654
|
+
...result,
|
|
3655
|
+
});
|
|
3656
|
+
return;
|
|
3657
|
+
}
|
|
3658
|
+
if (command === "receivable" && subcommand === "prepare-repayment-claim") {
|
|
3659
|
+
const result = await sdk.receivables.prepareRepaymentClaim({
|
|
3660
|
+
definitionPath: getArg("definition-json"),
|
|
3661
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3662
|
+
currentStatePath: getArg("current-state-json"),
|
|
3663
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3664
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3665
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3666
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
3667
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
3668
|
+
claimId: getArg("claim-id"),
|
|
3669
|
+
payerEntityId: getArg("payer-entity-id"),
|
|
3670
|
+
payeeEntityId: getArg("payee-entity-id"),
|
|
3671
|
+
claimantXonly: getArg("claimant-xonly"),
|
|
3672
|
+
amountSat: getArg("amount-sat") ? Number(getArg("amount-sat")) : undefined,
|
|
3673
|
+
eventTimestamp: getArg("event-timestamp"),
|
|
3674
|
+
simfPath: getArg("simf"),
|
|
3675
|
+
artifactPath: getArg("artifact"),
|
|
3676
|
+
});
|
|
3677
|
+
printJson({
|
|
3678
|
+
summaryText: formatReceivableClaimSummary({
|
|
3679
|
+
phase: "prepare-repayment-claim",
|
|
3680
|
+
verified: result.verified,
|
|
3681
|
+
claimKind: result.claimValue.claimKind,
|
|
3682
|
+
receivableId: result.claimValue.receivableId,
|
|
3683
|
+
claimId: result.claimValue.claimId,
|
|
3684
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3685
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3686
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3687
|
+
amountSat: result.claimValue.amountSat,
|
|
3688
|
+
bindingMode: result.report.repaymentClaimTrust?.bindingMode,
|
|
3689
|
+
reasonCode: result.report.repaymentClaimTrust?.reasonCode,
|
|
3690
|
+
supportedForm: result.report.repaymentClaimTrust?.supportedForm,
|
|
3691
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3692
|
+
}),
|
|
3693
|
+
...result,
|
|
3694
|
+
});
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3697
|
+
if (command === "receivable" && subcommand === "verify-repayment-claim") {
|
|
3698
|
+
const result = await sdk.receivables.verifyRepaymentClaim({
|
|
3699
|
+
artifactPath: getArg("artifact"),
|
|
3700
|
+
definitionPath: getArg("definition-json"),
|
|
3701
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3702
|
+
currentStatePath: getArg("current-state-json"),
|
|
3703
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3704
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3705
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3706
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
3707
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
3708
|
+
});
|
|
3709
|
+
printJson({
|
|
3710
|
+
summaryText: formatReceivableClaimSummary({
|
|
3711
|
+
phase: "verify-repayment-claim",
|
|
3712
|
+
verified: result.verified,
|
|
3713
|
+
claimKind: result.claimValue.claimKind,
|
|
3714
|
+
receivableId: result.claimValue.receivableId,
|
|
3715
|
+
claimId: result.claimValue.claimId,
|
|
3716
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3717
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3718
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3719
|
+
amountSat: result.claimValue.amountSat,
|
|
3720
|
+
bindingMode: result.report.repaymentClaimTrust?.bindingMode,
|
|
3721
|
+
reasonCode: result.report.repaymentClaimTrust?.reasonCode,
|
|
3722
|
+
supportedForm: result.report.repaymentClaimTrust?.supportedForm,
|
|
3723
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3724
|
+
}),
|
|
3725
|
+
...result,
|
|
3726
|
+
});
|
|
3727
|
+
return;
|
|
3728
|
+
}
|
|
3729
|
+
if (command === "receivable" && subcommand === "inspect-repayment-claim") {
|
|
3730
|
+
const result = await sdk.receivables.inspectRepaymentClaim({
|
|
3731
|
+
artifactPath: requireArg("artifact"),
|
|
3732
|
+
definitionPath: getArg("definition-json"),
|
|
3733
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3734
|
+
currentStatePath: getArg("current-state-json"),
|
|
3735
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3736
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3737
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3738
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
3739
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
3740
|
+
payoutAddress: requireArg("payout-address"),
|
|
3741
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
3742
|
+
outputForm: parsePolicyOutputForm(),
|
|
3743
|
+
rawOutput: parseRawOutputFields(),
|
|
3744
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
3745
|
+
wallet: requireArg("wallet"),
|
|
3746
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
3747
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
3748
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
3749
|
+
});
|
|
3750
|
+
printJson({
|
|
3751
|
+
summaryText: formatReceivableClaimSummary({
|
|
3752
|
+
phase: "inspect-repayment-claim",
|
|
3753
|
+
verified: result.verified,
|
|
3754
|
+
claimKind: result.claimValue.claimKind,
|
|
3755
|
+
receivableId: result.claimValue.receivableId,
|
|
3756
|
+
claimId: result.claimValue.claimId,
|
|
3757
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3758
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3759
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3760
|
+
amountSat: result.claimValue.amountSat,
|
|
3761
|
+
bindingMode: result.report.repaymentClaimTrust?.bindingMode,
|
|
3762
|
+
reasonCode: result.report.repaymentClaimTrust?.reasonCode,
|
|
3763
|
+
supportedForm: result.report.repaymentClaimTrust?.supportedForm,
|
|
3764
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3765
|
+
}),
|
|
3766
|
+
...result,
|
|
3767
|
+
});
|
|
3768
|
+
return;
|
|
3769
|
+
}
|
|
3770
|
+
if (command === "receivable" && subcommand === "execute-repayment-claim") {
|
|
3771
|
+
const result = await sdk.receivables.executeRepaymentClaim({
|
|
3772
|
+
artifactPath: requireArg("artifact"),
|
|
3773
|
+
definitionPath: getArg("definition-json"),
|
|
3774
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3775
|
+
currentStatePath: getArg("current-state-json"),
|
|
3776
|
+
currentStateValue: parseJsonArg("current-state-value"),
|
|
3777
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3778
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3779
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
3780
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
3781
|
+
payoutAddress: requireArg("payout-address"),
|
|
3782
|
+
nextOutputHash: getArg("next-output-hash") || undefined,
|
|
3783
|
+
outputForm: parsePolicyOutputForm(),
|
|
3784
|
+
rawOutput: parseRawOutputFields(),
|
|
3785
|
+
outputBindingMode: getArg("output-binding-mode"),
|
|
3786
|
+
wallet: requireArg("wallet"),
|
|
3787
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
3788
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
3789
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
3790
|
+
broadcast: hasFlag("broadcast"),
|
|
3791
|
+
});
|
|
3792
|
+
printJson({
|
|
3793
|
+
summaryText: formatReceivableClaimSummary({
|
|
3794
|
+
phase: "execute-repayment-claim",
|
|
3795
|
+
verified: result.verified,
|
|
3796
|
+
claimKind: result.claimValue.claimKind,
|
|
3797
|
+
receivableId: result.claimValue.receivableId,
|
|
3798
|
+
claimId: result.claimValue.claimId,
|
|
3799
|
+
currentStatus: result.claimValue.currentStatus,
|
|
3800
|
+
payerEntityId: result.claimValue.payerEntityId,
|
|
3801
|
+
payeeEntityId: result.claimValue.payeeEntityId,
|
|
3802
|
+
amountSat: result.claimValue.amountSat,
|
|
3803
|
+
bindingMode: result.report.repaymentClaimTrust?.bindingMode,
|
|
3804
|
+
reasonCode: result.report.repaymentClaimTrust?.reasonCode,
|
|
3805
|
+
supportedForm: result.report.repaymentClaimTrust?.supportedForm,
|
|
3806
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3807
|
+
}),
|
|
3808
|
+
...result,
|
|
3809
|
+
});
|
|
3810
|
+
return;
|
|
3811
|
+
}
|
|
3812
|
+
if (command === "receivable" && subcommand === "verify-repayment") {
|
|
3813
|
+
const result = await sdk.receivables.verifyRepayment({
|
|
3814
|
+
definitionPath: getArg("definition-json"),
|
|
3815
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3816
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3817
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3818
|
+
nextStatePath: getArg("next-state-json"),
|
|
3819
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3820
|
+
});
|
|
3821
|
+
printJson({
|
|
3822
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3823
|
+
phase: "verify-repayment",
|
|
3824
|
+
verified: result.verified,
|
|
3825
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "REPAY",
|
|
3826
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3827
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3828
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3829
|
+
status: result.nextStateValue.status,
|
|
3830
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3831
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3832
|
+
stateHash: result.nextStateSummary.hash,
|
|
3833
|
+
}),
|
|
3834
|
+
...result,
|
|
3835
|
+
});
|
|
3836
|
+
return;
|
|
3837
|
+
}
|
|
3838
|
+
if (command === "receivable" && subcommand === "prepare-write-off") {
|
|
3839
|
+
const result = await sdk.receivables.prepareWriteOff({
|
|
3840
|
+
definitionPath: getArg("definition-json"),
|
|
3841
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3842
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3843
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3844
|
+
nextStatePath: getArg("next-state-json"),
|
|
3845
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3846
|
+
stateId: getArg("state-id"),
|
|
3847
|
+
defaultedAt: getArg("defaulted-at"),
|
|
3848
|
+
writeOffAmount: getArg("write-off-amount") ? Number(getArg("write-off-amount")) : undefined,
|
|
3849
|
+
});
|
|
3850
|
+
printJson({
|
|
3851
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3852
|
+
phase: "prepare-write-off",
|
|
3853
|
+
verified: result.verified,
|
|
3854
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "WRITE_OFF",
|
|
3855
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3856
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3857
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3858
|
+
status: result.nextStateValue.status,
|
|
3859
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3860
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3861
|
+
stateHash: result.nextStateSummary.hash,
|
|
3862
|
+
}),
|
|
3863
|
+
...result,
|
|
3864
|
+
});
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
if (command === "receivable" && subcommand === "verify-write-off") {
|
|
3868
|
+
const result = await sdk.receivables.verifyWriteOff({
|
|
3869
|
+
definitionPath: getArg("definition-json"),
|
|
3870
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3871
|
+
previousStatePath: getArg("previous-state-json"),
|
|
3872
|
+
previousStateValue: parseJsonArg("previous-state-value"),
|
|
3873
|
+
nextStatePath: getArg("next-state-json"),
|
|
3874
|
+
nextStateValue: parseJsonArg("next-state-value"),
|
|
3875
|
+
});
|
|
3876
|
+
printJson({
|
|
3877
|
+
summaryText: formatReceivableTransitionSummary({
|
|
3878
|
+
phase: "verify-write-off",
|
|
3879
|
+
verified: result.verified,
|
|
3880
|
+
transitionType: result.report.transitionTrust?.transitionType ?? "WRITE_OFF",
|
|
3881
|
+
receivableId: result.nextStateValue.receivableId,
|
|
3882
|
+
nextStateId: result.nextStateValue.stateId,
|
|
3883
|
+
holderEntityId: result.nextStateValue.holderEntityId,
|
|
3884
|
+
status: result.nextStateValue.status,
|
|
3885
|
+
outstandingAmount: result.nextStateValue.outstandingAmount,
|
|
3886
|
+
repaidAmount: result.nextStateValue.repaidAmount,
|
|
3887
|
+
stateHash: result.nextStateSummary.hash,
|
|
3888
|
+
}),
|
|
3889
|
+
...result,
|
|
3890
|
+
});
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
if (command === "receivable" && subcommand === "prepare-closing") {
|
|
3894
|
+
const result = await sdk.receivables.prepareClosing({
|
|
3895
|
+
definitionPath: getArg("definition-json"),
|
|
3896
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3897
|
+
latestStatePath: getArg("latest-state-json"),
|
|
3898
|
+
latestStateValue: parseJsonArg("latest-state-value"),
|
|
3899
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3900
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3901
|
+
closingPath: getArg("closing-json"),
|
|
3902
|
+
closingValue: parseJsonArg("closing-value"),
|
|
3903
|
+
closingId: getArg("closing-id"),
|
|
3904
|
+
closedAt: getArg("closed-at"),
|
|
3905
|
+
closingReason: getArg("closing-reason"),
|
|
3906
|
+
});
|
|
3907
|
+
printJson({
|
|
3908
|
+
summaryText: formatReceivableClosingSummary({
|
|
3909
|
+
verified: result.verified,
|
|
3910
|
+
receivableId: result.closingValue.receivableId,
|
|
3911
|
+
latestStatus: result.closingValue.latestStatus,
|
|
3912
|
+
closingReason: result.closingValue.closingReason,
|
|
3913
|
+
closingHash: result.closingSummary.hash,
|
|
3914
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3915
|
+
}),
|
|
3916
|
+
...result,
|
|
3917
|
+
});
|
|
3918
|
+
return;
|
|
3919
|
+
}
|
|
3920
|
+
if (command === "receivable" && subcommand === "verify-closing") {
|
|
3921
|
+
const result = await sdk.receivables.verifyClosing({
|
|
3922
|
+
definitionPath: getArg("definition-json"),
|
|
3923
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3924
|
+
latestStatePath: getArg("latest-state-json"),
|
|
3925
|
+
latestStateValue: parseJsonArg("latest-state-value"),
|
|
3926
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3927
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3928
|
+
closingPath: getArg("closing-json"),
|
|
3929
|
+
closingValue: parseJsonArg("closing-value"),
|
|
3930
|
+
});
|
|
3931
|
+
printJson({
|
|
3932
|
+
summaryText: formatReceivableClosingSummary({
|
|
3933
|
+
verified: result.verified,
|
|
3934
|
+
receivableId: result.closingValue.receivableId,
|
|
3935
|
+
latestStatus: result.closingValue.latestStatus,
|
|
3936
|
+
closingReason: result.closingValue.closingReason,
|
|
3937
|
+
closingHash: result.closingSummary.hash,
|
|
3938
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified,
|
|
3939
|
+
}),
|
|
3940
|
+
...result,
|
|
3941
|
+
});
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
if (command === "receivable" && subcommand === "verify-state-history") {
|
|
3945
|
+
const result = await sdk.receivables.verifyStateHistory({
|
|
3946
|
+
definitionPath: getArg("definition-json"),
|
|
3947
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3948
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3949
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3950
|
+
});
|
|
3951
|
+
printJson({
|
|
3952
|
+
summaryText: formatReceivableHistorySummary({
|
|
3953
|
+
verified: result.verified,
|
|
3954
|
+
receivableId: result.latestStateValue.receivableId,
|
|
3955
|
+
chainLength: result.report.stateLineageTrust?.chainLength ?? 0,
|
|
3956
|
+
latestStatus: result.report.stateLineageTrust?.latestStatus ?? result.latestStateValue.status,
|
|
3957
|
+
latestOrdinal: result.report.stateLineageTrust?.latestOrdinal ?? null,
|
|
3958
|
+
fullLineageVerified: result.report.stateLineageTrust?.fullLineageVerified ?? false,
|
|
3959
|
+
}),
|
|
3960
|
+
...result,
|
|
3961
|
+
});
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3964
|
+
if (command === "receivable" && subcommand === "export-evidence") {
|
|
3965
|
+
const result = await sdk.receivables.exportEvidence({
|
|
3966
|
+
definitionPath: getArg("definition-json"),
|
|
3967
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
3968
|
+
statePath: getArg("state-json"),
|
|
3969
|
+
stateValue: parseJsonArg("state-value"),
|
|
3970
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
3971
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
3972
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
3973
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
3974
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
3975
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
3976
|
+
closingPath: getArg("closing-json"),
|
|
3977
|
+
closingValue: parseJsonArg("closing-value"),
|
|
3978
|
+
verificationReportValue: parseJsonArg("verification-report-value"),
|
|
3979
|
+
});
|
|
3980
|
+
const evidenceStateValue = JSON.parse(result.state.canonicalJson);
|
|
3981
|
+
const evidenceClosingValue = result.closing
|
|
3982
|
+
? JSON.parse(result.closing.canonicalJson)
|
|
3983
|
+
: undefined;
|
|
3984
|
+
printJson({
|
|
3985
|
+
summaryText: formatReceivableEvidenceOrFinalitySummary({
|
|
3986
|
+
kind: "evidence",
|
|
3987
|
+
receivableId: evidenceStateValue.receivableId,
|
|
3988
|
+
holderEntityId: evidenceStateValue.holderEntityId,
|
|
3989
|
+
definitionHash: result.definition.hash,
|
|
3990
|
+
latestStateHash: result.state.hash,
|
|
3991
|
+
closingHash: result.closing?.hash ?? null,
|
|
3992
|
+
closingReason: evidenceClosingValue?.closingReason ?? null,
|
|
3993
|
+
lineageKind: result.trust.stateLineageTrust?.lineageKind ?? null,
|
|
3994
|
+
latestOrdinal: result.trust.stateLineageTrust?.latestOrdinal ?? null,
|
|
3995
|
+
fullLineageVerified: result.trust.stateLineageTrust?.fullLineageVerified ?? null,
|
|
3996
|
+
}),
|
|
3997
|
+
...result,
|
|
3998
|
+
});
|
|
3999
|
+
return;
|
|
4000
|
+
}
|
|
4001
|
+
if (command === "receivable" && subcommand === "export-finality-payload") {
|
|
4002
|
+
const result = await sdk.receivables.exportFinalityPayload({
|
|
4003
|
+
definitionPath: getArg("definition-json"),
|
|
4004
|
+
definitionValue: parseJsonArg("definition-value"),
|
|
4005
|
+
statePath: getArg("state-json"),
|
|
4006
|
+
stateValue: parseJsonArg("state-value"),
|
|
4007
|
+
stateHistoryPaths: getMultiArgs("state-history-json"),
|
|
4008
|
+
stateHistoryValues: parseJsonArgs("state-history-value"),
|
|
4009
|
+
fundingClaimPath: getArg("funding-claim-json"),
|
|
4010
|
+
fundingClaimValue: parseJsonArg("funding-claim-value"),
|
|
4011
|
+
repaymentClaimPath: getArg("repayment-claim-json"),
|
|
4012
|
+
repaymentClaimValue: parseJsonArg("repayment-claim-value"),
|
|
4013
|
+
closingPath: getArg("closing-json"),
|
|
4014
|
+
closingValue: parseJsonArg("closing-value"),
|
|
4015
|
+
verificationReportValue: parseJsonArg("verification-report-value"),
|
|
4016
|
+
});
|
|
4017
|
+
printJson({
|
|
4018
|
+
summaryText: formatReceivableEvidenceOrFinalitySummary({
|
|
4019
|
+
kind: "finality",
|
|
4020
|
+
receivableId: result.receivableId,
|
|
4021
|
+
holderEntityId: result.holderEntityId,
|
|
4022
|
+
definitionHash: result.definitionHash,
|
|
4023
|
+
latestStateHash: result.latestStateHash,
|
|
4024
|
+
closingHash: result.closingHash,
|
|
4025
|
+
closingReason: result.closingReason,
|
|
4026
|
+
lineageKind: result.trust.stateLineageTrust?.lineageKind ?? null,
|
|
4027
|
+
latestOrdinal: result.trust.stateLineageTrust?.latestOrdinal ?? null,
|
|
4028
|
+
fullLineageVerified: result.trust.stateLineageTrust?.fullLineageVerified ?? null,
|
|
2923
4029
|
}),
|
|
2924
4030
|
...result,
|
|
2925
4031
|
});
|