@hazbase/simplicity 0.0.5 → 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.
Files changed (61) hide show
  1. package/README.md +140 -1038
  2. package/dist/cli.js +3341 -269
  3. package/dist/client/SimplicityClient.d.ts +91 -290
  4. package/dist/client/SimplicityClient.js +93 -23
  5. package/dist/core/executor.js +67 -92
  6. package/dist/core/lineage.d.ts +18 -0
  7. package/dist/core/lineage.js +30 -0
  8. package/dist/core/outputBinding.d.ts +61 -0
  9. package/dist/core/outputBinding.js +552 -0
  10. package/dist/core/reporting.d.ts +22 -0
  11. package/dist/core/reporting.js +40 -0
  12. package/dist/core/schnorr.d.ts +5 -0
  13. package/dist/core/schnorr.js +46 -0
  14. package/dist/core/types.d.ts +799 -1
  15. package/dist/docs/definitions/bond-anchor.simf +19 -0
  16. package/dist/docs/definitions/bond-definition.json +10 -0
  17. package/dist/docs/definitions/bond-descriptor-bound-settlement-machine.simf +144 -0
  18. package/dist/docs/definitions/bond-issuance-anchor.simf +26 -0
  19. package/dist/docs/definitions/bond-issuance-state-partial-redemption.json +18 -0
  20. package/dist/docs/definitions/bond-issuance-state-redeemed.json +18 -0
  21. package/dist/docs/definitions/bond-issuance-state.json +12 -0
  22. package/dist/docs/definitions/bond-redemption-state-machine.simf +118 -0
  23. package/dist/docs/definitions/bond-redemption-transition.simf +41 -0
  24. package/dist/docs/definitions/bond-script-bound-settlement-machine.simf +142 -0
  25. package/dist/docs/definitions/fund-capital-call-open.simf +82 -0
  26. package/dist/docs/definitions/fund-capital-call-refund-only.simf +67 -0
  27. package/dist/docs/definitions/fund-capital-call-state.json +11 -0
  28. package/dist/docs/definitions/fund-definition.json +8 -0
  29. package/dist/docs/definitions/fund-distribution-claim.simf +57 -0
  30. package/dist/docs/definitions/receivable-definition.json +9 -0
  31. package/dist/docs/definitions/receivable-funding-claim.json +13 -0
  32. package/dist/docs/definitions/receivable-funding-claim.simf +58 -0
  33. package/dist/docs/definitions/receivable-repayment-claim.json +13 -0
  34. package/dist/docs/definitions/receivable-repayment-claim.simf +59 -0
  35. package/dist/docs/definitions/receivable-state-funded.json +20 -0
  36. package/dist/docs/definitions/receivable-state-originated.json +19 -0
  37. package/dist/docs/definitions/receivable-state-repaid.json +20 -0
  38. package/dist/docs/definitions/recursive-delay-direct-next.simf +60 -0
  39. package/dist/docs/definitions/recursive-delay-optional.simf +88 -0
  40. package/dist/docs/definitions/recursive-delay-required.simf +72 -0
  41. package/dist/docs/definitions/recursive-delay.simf +83 -0
  42. package/dist/docs/definitions/recursive-policy-transfer-machine.simf +65 -0
  43. package/dist/domain/bond.d.ts +8649 -720
  44. package/dist/domain/bond.js +1398 -8
  45. package/dist/domain/bondSettlementValidation.d.ts +2 -0
  46. package/dist/domain/bondSettlementValidation.js +28 -0
  47. package/dist/domain/bondValidation.d.ts +37 -1
  48. package/dist/domain/bondValidation.js +137 -11
  49. package/dist/domain/fund.d.ts +2452 -0
  50. package/dist/domain/fund.js +1756 -0
  51. package/dist/domain/fundValidation.d.ts +152 -0
  52. package/dist/domain/fundValidation.js +767 -0
  53. package/dist/domain/policies.d.ts +1064 -0
  54. package/dist/domain/policies.js +1625 -0
  55. package/dist/domain/receivable.d.ts +824 -0
  56. package/dist/domain/receivable.js +1375 -0
  57. package/dist/domain/receivableValidation.d.ts +147 -0
  58. package/dist/domain/receivableValidation.js +831 -0
  59. package/dist/index.d.ts +8 -2
  60. package/dist/index.js +137 -21
  61. package/package.json +20 -2
@@ -153,8 +153,46 @@ export interface ArtifactStateMetadata {
153
153
  sourceVerified: boolean;
154
154
  };
155
155
  }
156
- export type BondIssuanceStatus = "ISSUED" | "PARTIALLY_REDEEMED" | "REDEEMED";
156
+ export type BondIssuanceStatus = "ISSUED" | "PARTIALLY_REDEEMED" | "REDEEMED" | "CLOSED";
157
157
  export type BondTransitionType = "ISSUE" | "REDEEM";
158
+ export type BondOutputBindingMode = "none" | "script-bound" | "descriptor-bound";
159
+ export type PropagationMode = "required" | "optional" | "none";
160
+ export type OutputBindingReasonCode = "OK_EXPLICIT" | "OK_RAW_OUTPUT" | "OK_MANUAL_HASH" | "OK_SCRIPT_BOUND" | "OK_NONE" | "FALLBACK_UNSUPPORTED_ASSET" | "FALLBACK_UNSUPPORTED_OUTPUT_FORM" | "FALLBACK_MISSING_HASH_INPUT" | "FALLBACK_INCOMPLETE_RAW_OUTPUT" | "FALLBACK_INVALID_RAW_OUTPUT";
161
+ export type OutputBindingSupportedForm = "explicit-v1" | "raw-output-v1" | "unsupported";
162
+ export type OutputAssetForm = "explicit" | "confidential";
163
+ export type OutputAmountForm = "explicit" | "confidential";
164
+ export type OutputNonceForm = "null" | "confidential";
165
+ export type OutputRangeProofForm = "empty" | "non-empty";
166
+ export interface OutputForm {
167
+ assetForm: OutputAssetForm;
168
+ amountForm: OutputAmountForm;
169
+ nonceForm: OutputNonceForm;
170
+ rangeProofForm: OutputRangeProofForm;
171
+ }
172
+ export interface OutputRawFields {
173
+ assetBytesHex: string;
174
+ amountBytesHex: string;
175
+ nonceBytesHex: string;
176
+ scriptPubKeyHex?: string;
177
+ scriptPubKeyHashHex?: string;
178
+ rangeProofHex?: string;
179
+ rangeProofHashHex?: string;
180
+ }
181
+ export interface OutputBindingInputs {
182
+ assetId: string;
183
+ assetForm: OutputAssetForm;
184
+ amountForm: OutputAmountForm;
185
+ nonceForm: OutputNonceForm;
186
+ rangeProofForm: OutputRangeProofForm;
187
+ nextAmountSat: number;
188
+ nextOutputIndex: number;
189
+ feeIndex: number;
190
+ maxFeeSat: number;
191
+ rawOutputComponents?: {
192
+ scriptPubKey: "raw-bytes" | "hash";
193
+ rangeProof: "raw-bytes" | "hash";
194
+ };
195
+ }
158
196
  export interface BondStateTransition {
159
197
  type: BondTransitionType;
160
198
  amount: number;
@@ -201,6 +239,7 @@ export interface CallBaseInput {
201
239
  periodId?: string;
202
240
  bondDefinitionId?: string;
203
241
  sequence?: number;
242
+ locktimeHeight?: number;
204
243
  witness?: WitnessConfig;
205
244
  }
206
245
  export interface InspectCallInput extends CallBaseInput {
@@ -287,6 +326,7 @@ export interface GaslessExecuteInput {
287
326
  contractChangeAddress?: string;
288
327
  sponsorChangeAddress?: string;
289
328
  utxoPolicy?: UtxoPolicy;
329
+ locktimeHeight?: number;
290
330
  broadcast?: boolean;
291
331
  }
292
332
  export interface GaslessExecuteResult {
@@ -352,6 +392,9 @@ export interface BondIssuanceState {
352
392
  status: BondIssuanceStatus;
353
393
  previousStateHash?: string | null;
354
394
  lastTransition?: BondStateTransition;
395
+ closedAt?: string;
396
+ closingReason?: "REDEEMED" | "CANCELLED" | "MATURED_OUT";
397
+ finalSettlementDescriptorHash?: string;
355
398
  }
356
399
  export interface BondSettlementDescriptor {
357
400
  settlementId: string;
@@ -369,6 +412,8 @@ export interface BondSettlementDescriptor {
369
412
  nextContractAddress: string;
370
413
  nextAmountSat: number;
371
414
  maxFeeSat: number;
415
+ expectedOutputDescriptorHash?: string;
416
+ outputBindingMode?: BondOutputBindingMode;
372
417
  principal: {
373
418
  issued: number;
374
419
  previousOutstanding: number;
@@ -377,6 +422,759 @@ export interface BondSettlementDescriptor {
377
422
  nextRedeemed: number;
378
423
  };
379
424
  }
425
+ export interface BondExpectedOutputDescriptor {
426
+ nextContractAddress: string;
427
+ nextOutputHash?: string;
428
+ nextOutputScriptHash?: string;
429
+ nextAmountSat: number;
430
+ assetId: string;
431
+ requestedOutputBindingMode?: BondOutputBindingMode;
432
+ outputForm?: OutputForm;
433
+ rawOutput?: Partial<OutputRawFields>;
434
+ feeIndex: number;
435
+ nextOutputIndex: number;
436
+ maxFeeSat: number;
437
+ outputBindingMode?: BondOutputBindingMode;
438
+ }
439
+ export interface BondClosingDescriptor {
440
+ closingId: string;
441
+ bondId: string;
442
+ issuanceId: string;
443
+ previousStateHash: string;
444
+ closedStateHash: string;
445
+ finalStatus: "CLOSED";
446
+ closingReason: "REDEEMED" | "CANCELLED" | "MATURED_OUT";
447
+ closedAt: string;
448
+ definitionHash: string;
449
+ stateHash: string;
450
+ finalSettlementDescriptorHash: string;
451
+ }
452
+ export interface LineageTrustBase<LineageKind extends string> {
453
+ lineageKind: LineageKind;
454
+ chainLength: number;
455
+ latestOrdinal: number;
456
+ allHashLinksVerified: boolean;
457
+ identityConsistent: boolean;
458
+ fullLineageVerified: boolean;
459
+ }
460
+ export interface BondIssuanceLineageTrust extends LineageTrustBase<"state-history"> {
461
+ latestStatus?: BondIssuanceStatus;
462
+ startsAtGenesis: boolean;
463
+ previousStateHashLinked: boolean;
464
+ issuanceIdConsistent: boolean;
465
+ bondIdConsistent: boolean;
466
+ currencyConsistent: boolean;
467
+ controllerConsistent: boolean;
468
+ issuerEntityConsistent: boolean;
469
+ issuedPrincipalConsistent: boolean;
470
+ allPreviousStateHashMatch: boolean;
471
+ allRedemptionArithmeticValid: boolean;
472
+ allStatusProgressionValid: boolean;
473
+ allTransitionIdentitiesMatch: boolean;
474
+ fullHistoryVerified: boolean;
475
+ }
476
+ export interface BondVerificationReport {
477
+ artifactTrust: {
478
+ definition: DefinitionVerificationResult["trust"];
479
+ state: StateVerificationResult["trust"];
480
+ };
481
+ stateTrust: StateVerificationResult["trust"];
482
+ issuanceLineageTrust?: BondIssuanceLineageTrust;
483
+ settlementTrust?: {
484
+ descriptorHashMatch: boolean;
485
+ outputBindingMode: BondOutputBindingMode;
486
+ };
487
+ outputBindingTrust?: {
488
+ mode: BondOutputBindingMode;
489
+ requestedMode?: BondOutputBindingMode;
490
+ supportedForm?: OutputBindingSupportedForm;
491
+ nextContractAddressCommitted: boolean;
492
+ expectedOutputDescriptorCommitted: boolean;
493
+ settlementDescriptorCommitted?: boolean;
494
+ outputCountRuntimeBound: boolean;
495
+ feeIndexRuntimeBound: boolean;
496
+ nextOutputHashRuntimeBound?: boolean;
497
+ nextOutputScriptRuntimeBound: boolean;
498
+ amountRuntimeBound: boolean;
499
+ reasonCode?: OutputBindingReasonCode;
500
+ autoDerived?: boolean;
501
+ fallbackReason?: string;
502
+ bindingInputs?: OutputBindingInputs;
503
+ };
504
+ arithmeticTrust?: {
505
+ principalArithmeticCommitted: boolean;
506
+ principalArithmeticValid: boolean;
507
+ statusProgressionCommitted: boolean;
508
+ statusProgressionValid: boolean;
509
+ };
510
+ closingTrust?: {
511
+ finalStatusValid: boolean;
512
+ finalSettlementDescriptorHashMatch: boolean;
513
+ };
514
+ }
515
+ export interface BondEvidenceBundle {
516
+ artifact: SimplicityArtifact;
517
+ definition: {
518
+ canonicalJson: string;
519
+ hash: string;
520
+ };
521
+ issuance: {
522
+ canonicalJson: string;
523
+ hash: string;
524
+ };
525
+ transition?: {
526
+ canonicalJson: string;
527
+ hash: string;
528
+ };
529
+ settlement?: {
530
+ canonicalJson: string;
531
+ hash: string;
532
+ };
533
+ closing?: {
534
+ canonicalJson: string;
535
+ hash: string;
536
+ };
537
+ trust: BondVerificationReport;
538
+ trustSummary: VerificationTrustSummary;
539
+ renderedSourceHash?: string;
540
+ sourceVerificationMode: "source-reloaded" | "artifact-only";
541
+ compiled: {
542
+ program: string;
543
+ cmr: string;
544
+ contractAddress: string;
545
+ };
546
+ }
547
+ export type ReceivableStatus = "ORIGINATED" | "FUNDED" | "PARTIALLY_REPAID" | "REPAID" | "DEFAULTED";
548
+ export type ReceivableTransitionType = "ORIGINATE" | "FUND" | "REPAY" | "WRITE_OFF";
549
+ export type ReceivableClosingReason = "REPAID" | "DEFAULTED" | "CANCELLED";
550
+ export type ReceivableClaimKind = "FUNDING" | "REPAYMENT";
551
+ export type ReceivableVerificationReportSchemaVersion = "receivable-verification-report/v1";
552
+ export type ReceivableEvidenceBundleSchemaVersion = "receivable-evidence-bundle/v1";
553
+ export type ReceivableFinalityPayloadSchemaVersion = "receivable-finality-payload/v1";
554
+ export interface ReceivableDefinition {
555
+ receivableId: string;
556
+ originatorEntityId: string;
557
+ debtorEntityId: string;
558
+ currencyAssetId: string;
559
+ faceValue: number;
560
+ dueDate: string;
561
+ controllerXonly: string;
562
+ }
563
+ export interface ReceivableStateTransition {
564
+ type: ReceivableTransitionType;
565
+ amount: number;
566
+ at: string;
567
+ }
568
+ export interface ReceivableState {
569
+ stateId: string;
570
+ receivableId: string;
571
+ originatorEntityId: string;
572
+ debtorEntityId: string;
573
+ holderEntityId: string;
574
+ currencyAssetId: string;
575
+ controllerXonly: string;
576
+ faceValue: number;
577
+ outstandingAmount: number;
578
+ repaidAmount: number;
579
+ status: ReceivableStatus;
580
+ createdAt: string;
581
+ previousStateHash?: string | null;
582
+ lastTransition?: ReceivableStateTransition;
583
+ }
584
+ export interface ReceivableClosingDescriptor {
585
+ closingId: string;
586
+ receivableId: string;
587
+ latestStateHash: string;
588
+ latestStatus: ReceivableStatus;
589
+ holderEntityId: string;
590
+ closedAt: string;
591
+ closingReason: ReceivableClosingReason;
592
+ }
593
+ export interface ReceivableClaimDescriptorBase<ClaimKind extends ReceivableClaimKind> {
594
+ claimId: string;
595
+ claimKind: ClaimKind;
596
+ receivableId: string;
597
+ currentStateHash: string;
598
+ currentStatus: ReceivableStatus;
599
+ payerEntityId: string;
600
+ payeeEntityId: string;
601
+ claimantXonly: string;
602
+ currencyAssetId: string;
603
+ amountSat: number;
604
+ eventTimestamp: string;
605
+ }
606
+ export interface ReceivableFundingClaimDescriptor extends ReceivableClaimDescriptorBase<"FUNDING"> {
607
+ }
608
+ export interface ReceivableRepaymentClaimDescriptor extends ReceivableClaimDescriptorBase<"REPAYMENT"> {
609
+ }
610
+ export interface ReceivableTransitionTrust {
611
+ transitionType: ReceivableTransitionType;
612
+ previousStateHashMatch: boolean;
613
+ participantConsistencyValid: boolean;
614
+ statusProgressionValid: boolean;
615
+ arithmeticDeltaValid: boolean;
616
+ createdAtMonotonic: boolean;
617
+ transitionAmountValid: boolean;
618
+ fullTransitionVerified: boolean;
619
+ }
620
+ export interface ReceivableClosingTrust {
621
+ terminalStatusEligible: boolean;
622
+ latestStateHashMatch: boolean;
623
+ closingReasonMatchesStatus: boolean;
624
+ historyTipMatches: boolean;
625
+ lineageProvided: boolean;
626
+ fullClosingVerified: boolean;
627
+ }
628
+ export interface ReceivableClaimTrust {
629
+ claimKind: ReceivableClaimKind;
630
+ generated: boolean;
631
+ stateStatusEligible: boolean;
632
+ receivableIdMatch: boolean;
633
+ currentStateHashMatch: boolean;
634
+ currentStatusMatch: boolean;
635
+ payerEntityMatch: boolean;
636
+ payeeEntityMatch: boolean;
637
+ claimantXonlyMatch: boolean;
638
+ claimantXonlyCommitted: boolean;
639
+ currencyAssetMatch: boolean;
640
+ amountMatch: boolean;
641
+ eventTimestampMatch: boolean;
642
+ bindingMode: BondOutputBindingMode;
643
+ requestedMode?: BondOutputBindingMode;
644
+ supportedForm: OutputBindingSupportedForm;
645
+ reasonCode: OutputBindingReasonCode;
646
+ nextReceiverRuntimeCommitted: boolean;
647
+ nextOutputHashRuntimeBound: boolean;
648
+ nextOutputScriptRuntimeBound: boolean;
649
+ amountRuntimeBound: boolean;
650
+ autoDerived?: boolean;
651
+ fallbackReason?: string;
652
+ bindingInputs?: OutputBindingInputs;
653
+ fullClaimVerified: boolean;
654
+ }
655
+ export interface ReceivableVerificationReport {
656
+ schemaVersion: ReceivableVerificationReportSchemaVersion;
657
+ receivableTrust: {
658
+ receivableIdMatch: boolean;
659
+ originatorMatch: boolean;
660
+ debtorMatch: boolean;
661
+ currencyMatch: boolean;
662
+ controllerMatch: boolean;
663
+ faceValueMatch: boolean;
664
+ arithmeticValid: boolean;
665
+ statusValid: boolean;
666
+ };
667
+ transitionTrust?: ReceivableTransitionTrust;
668
+ closingTrust?: ReceivableClosingTrust;
669
+ fundingClaimTrust?: ReceivableClaimTrust;
670
+ repaymentClaimTrust?: ReceivableClaimTrust;
671
+ stateLineageTrust?: ReceivableStateLineageTrust;
672
+ }
673
+ export interface ReceivableStateLineageTrust extends LineageTrustBase<"state-history"> {
674
+ latestStatus: ReceivableStatus;
675
+ startsAtGenesis: boolean;
676
+ receivableIdConsistent: boolean;
677
+ originatorConsistent: boolean;
678
+ debtorConsistent: boolean;
679
+ currencyConsistent: boolean;
680
+ controllerConsistent: boolean;
681
+ faceValueConsistent: boolean;
682
+ allPreviousStateHashMatch: boolean;
683
+ allArithmeticValid: boolean;
684
+ allStatusProgressionValid: boolean;
685
+ fullHistoryVerified: boolean;
686
+ }
687
+ export interface ReceivableEvidenceBundle {
688
+ schemaVersion: ReceivableEvidenceBundleSchemaVersion;
689
+ definition: {
690
+ canonicalJson: string;
691
+ hash: string;
692
+ };
693
+ state: {
694
+ canonicalJson: string;
695
+ hash: string;
696
+ };
697
+ stateHistory?: Array<{
698
+ canonicalJson: string;
699
+ hash: string;
700
+ }>;
701
+ fundingClaim?: {
702
+ canonicalJson: string;
703
+ hash: string;
704
+ };
705
+ repaymentClaim?: {
706
+ canonicalJson: string;
707
+ hash: string;
708
+ };
709
+ closing?: {
710
+ canonicalJson: string;
711
+ hash: string;
712
+ };
713
+ trust: ReceivableVerificationReport;
714
+ trustSummary: VerificationTrustSummary;
715
+ }
716
+ export interface ReceivableFinalityPayload {
717
+ schemaVersion: ReceivableFinalityPayloadSchemaVersion;
718
+ receivableId: string;
719
+ holderEntityId: string;
720
+ definitionHash: string;
721
+ latestStateHash: string;
722
+ stateHistoryHashes?: string[] | null;
723
+ fundingClaimHash?: string | null;
724
+ repaymentClaimHash?: string | null;
725
+ closingHash?: string | null;
726
+ closingReason?: ReceivableClosingReason | null;
727
+ trust: ReceivableVerificationReport;
728
+ trustSummary: VerificationTrustSummary;
729
+ }
730
+ export type CapitalCallStatus = "OPEN" | "CLAIMED" | "REFUND_ONLY" | "REFUNDED";
731
+ export type CapitalCallStage = "open" | "claimed" | "refund-only" | "refunded";
732
+ export type CapitalCallCutoffMode = "rollover-window";
733
+ export type LPPositionReceiptStatus = "ACTIVE" | "PARTIALLY_DISTRIBUTED" | "FULLY_DISTRIBUTED" | "CLOSED";
734
+ export type FundClosingReason = "LIQUIDATED" | "CANCELLED" | "WRITTEN_OFF";
735
+ export type FundVerificationReportSchemaVersion = "fund-verification-report/v1";
736
+ export type FundEvidenceBundleSchemaVersion = "fund-evidence-bundle/v1";
737
+ export type FundFinalityPayloadSchemaVersion = "fund-finality-payload/v1";
738
+ export type LPPositionReceiptSchemaVersion = "lp-position-receipt/v2";
739
+ export type LPPositionReceiptAttestationScheme = "bip340-sha256";
740
+ export interface FundDefinition {
741
+ fundId: string;
742
+ managerEntityId: string;
743
+ managerXonly: string;
744
+ currencyAssetId: string;
745
+ jurisdiction?: string;
746
+ vintage?: string;
747
+ }
748
+ export interface CapitalCallState {
749
+ callId: string;
750
+ fundId: string;
751
+ lpId: string;
752
+ currencyAssetId: string;
753
+ amount: number;
754
+ lpXonly: string;
755
+ managerXonly: string;
756
+ status: CapitalCallStatus;
757
+ fundedAt?: string;
758
+ claimedAt?: string;
759
+ refundedAt?: string;
760
+ previousStateHash?: string | null;
761
+ claimCutoffHeight: number;
762
+ }
763
+ export interface LPPositionReceipt {
764
+ schemaVersion: LPPositionReceiptSchemaVersion;
765
+ positionId: string;
766
+ fundId: string;
767
+ lpId: string;
768
+ callId: string;
769
+ currencyAssetId: string;
770
+ lpXonly: string;
771
+ sequence: number;
772
+ committedAmount: number;
773
+ fundedAmount: number;
774
+ distributedAmount: number;
775
+ distributionCount: number;
776
+ effectiveAt: string;
777
+ lastDistributedAt?: string;
778
+ status: LPPositionReceiptStatus;
779
+ previousReceiptHash?: string | null;
780
+ }
781
+ export interface LPPositionReceiptAttestation {
782
+ positionReceiptHash: string;
783
+ sequence: number;
784
+ managerXonly: string;
785
+ signedAt: string;
786
+ signature: string;
787
+ scheme: LPPositionReceiptAttestationScheme;
788
+ }
789
+ export interface LPPositionReceiptEnvelope {
790
+ receipt: LPPositionReceipt;
791
+ attestation: LPPositionReceiptAttestation;
792
+ }
793
+ export interface DistributionDescriptor {
794
+ distributionId: string;
795
+ positionId: string;
796
+ fundId: string;
797
+ lpId: string;
798
+ assetId: string;
799
+ amountSat: number;
800
+ approvedAt: string;
801
+ positionReceiptHash: string;
802
+ }
803
+ export interface FundPayoutDescriptor {
804
+ receiverAddress: string;
805
+ nextOutputHash?: string;
806
+ nextOutputScriptHash?: string;
807
+ amountSat: number;
808
+ assetId: string;
809
+ requestedOutputBindingMode?: BondOutputBindingMode;
810
+ outputForm?: OutputForm;
811
+ rawOutput?: Partial<OutputRawFields>;
812
+ feeIndex: number;
813
+ nextOutputIndex: number;
814
+ maxFeeSat: number;
815
+ outputBindingMode: BondOutputBindingMode;
816
+ }
817
+ export interface FundClosingDescriptor {
818
+ closingId: string;
819
+ fundId: string;
820
+ lpId: string;
821
+ positionId: string;
822
+ positionReceiptHash: string;
823
+ finalDistributionHashes: string[];
824
+ closedAt: string;
825
+ closingReason: FundClosingReason;
826
+ }
827
+ export interface FundVerificationReport {
828
+ schemaVersion: FundVerificationReportSchemaVersion;
829
+ artifactTrust?: {
830
+ definition: DefinitionVerificationResult["trust"];
831
+ state: StateVerificationResult["trust"];
832
+ };
833
+ stateTrust?: StateVerificationResult["trust"];
834
+ capitalCallTrust?: {
835
+ capitalCallStage: CapitalCallStage;
836
+ cutoffMode: CapitalCallCutoffMode;
837
+ fundIdMatch: boolean;
838
+ currencyMatch: boolean;
839
+ managerMatch: boolean;
840
+ claimCutoffCommitted: boolean;
841
+ lpCommitted: boolean;
842
+ managerCommitted: boolean;
843
+ claimPathRuntimeAvailable: boolean;
844
+ refundPathRuntimeAvailable: boolean;
845
+ statusValid: boolean;
846
+ };
847
+ distributionTrust?: {
848
+ fundIdMatch: boolean;
849
+ lpIdMatch: boolean;
850
+ positionIdMatch: boolean;
851
+ positionReceiptHashMatch: boolean;
852
+ positionStatusEligible: boolean;
853
+ };
854
+ outputBindingTrust?: {
855
+ mode: BondOutputBindingMode;
856
+ requestedMode?: BondOutputBindingMode;
857
+ supportedForm?: OutputBindingSupportedForm;
858
+ nextReceiverRuntimeCommitted: boolean;
859
+ outputCountRuntimeBound: boolean;
860
+ feeIndexRuntimeBound: boolean;
861
+ nextOutputHashRuntimeBound?: boolean;
862
+ nextOutputScriptRuntimeBound: boolean;
863
+ amountRuntimeBound: boolean;
864
+ reasonCode?: OutputBindingReasonCode;
865
+ autoDerived?: boolean;
866
+ fallbackReason?: string;
867
+ bindingInputs?: OutputBindingInputs;
868
+ };
869
+ receiptTrust?: {
870
+ generated: boolean;
871
+ positionReceiptHash?: string;
872
+ positionStatus: LPPositionReceiptStatus;
873
+ attested: boolean;
874
+ attestationVerified: boolean;
875
+ sequence?: number;
876
+ sequenceMonotonic?: boolean;
877
+ attestingSignerMatch?: boolean;
878
+ previousEnvelopeProvided?: boolean;
879
+ previousReceiptHashMatch?: boolean;
880
+ previousSequenceMatch?: boolean;
881
+ continuityVerified?: boolean;
882
+ };
883
+ receiptChainTrust?: FundReceiptChainTrust;
884
+ closingTrust?: {
885
+ positionReceiptHashMatch: boolean;
886
+ finalDistributionHashesPresent: boolean;
887
+ positionStatusEligible: boolean;
888
+ };
889
+ }
890
+ export interface FundReceiptChainTrust extends LineageTrustBase<"receipt-chain"> {
891
+ latestSequence?: number;
892
+ startsAtGenesis: boolean;
893
+ latestSequenceCovered: boolean;
894
+ sequenceContiguous: boolean;
895
+ fundConsistent: boolean;
896
+ positionConsistent: boolean;
897
+ lpConsistent: boolean;
898
+ callConsistent: boolean;
899
+ currencyConsistent: boolean;
900
+ lpXonlyConsistent: boolean;
901
+ attestingSignerConsistent: boolean;
902
+ allPositionReceiptHashMatch: boolean;
903
+ allSequenceMatch: boolean;
904
+ allSequenceMonotonic: boolean;
905
+ allAttestingSignerMatch: boolean;
906
+ allAttestationVerified: boolean;
907
+ allContinuityVerified: boolean;
908
+ fullChainVerified: boolean;
909
+ }
910
+ export type DomainLineageTrust = BondIssuanceLineageTrust | FundReceiptChainTrust | ReceivableStateLineageTrust;
911
+ export interface DomainLineageTrustSummary {
912
+ lineageKind: DomainLineageTrust["lineageKind"];
913
+ latestOrdinal: number;
914
+ allHashLinksVerified: boolean;
915
+ identityConsistent: boolean;
916
+ fullLineageVerified: boolean;
917
+ }
918
+ export interface VerificationTrustSummary {
919
+ definition?: DefinitionVerificationResult["trust"];
920
+ state?: StateVerificationResult["trust"];
921
+ bindingMode: BondOutputBindingMode;
922
+ lineage?: DomainLineageTrustSummary;
923
+ }
924
+ export interface FundEvidenceBundle {
925
+ schemaVersion: FundEvidenceBundleSchemaVersion;
926
+ artifact?: SimplicityArtifact;
927
+ definition: {
928
+ canonicalJson: string;
929
+ hash: string;
930
+ };
931
+ capitalCall?: {
932
+ canonicalJson: string;
933
+ hash: string;
934
+ };
935
+ positionReceipt?: {
936
+ canonicalJson: string;
937
+ hash: string;
938
+ };
939
+ positionReceiptEnvelope?: {
940
+ canonicalJson: string;
941
+ hash: string;
942
+ };
943
+ distribution?: {
944
+ canonicalJson: string;
945
+ hash: string;
946
+ };
947
+ distributions?: Array<{
948
+ canonicalJson: string;
949
+ hash: string;
950
+ }>;
951
+ closing?: {
952
+ canonicalJson: string;
953
+ hash: string;
954
+ };
955
+ trust: FundVerificationReport;
956
+ trustSummary: VerificationTrustSummary;
957
+ renderedSourceHash?: string;
958
+ sourceVerificationMode: "source-reloaded" | "artifact-only";
959
+ compiled?: {
960
+ program: string;
961
+ cmr: string;
962
+ contractAddress: string;
963
+ };
964
+ }
965
+ export interface FundFinalityPayload {
966
+ schemaVersion: FundFinalityPayloadSchemaVersion;
967
+ fundId: string;
968
+ lpId: string;
969
+ callId?: string;
970
+ positionId?: string;
971
+ definitionHash: string;
972
+ capitalCallStateHash?: string | null;
973
+ positionReceiptHash?: string | null;
974
+ positionReceiptEnvelopeHash?: string | null;
975
+ distributionHash?: string | null;
976
+ distributionHashes?: string[] | null;
977
+ closingHash?: string | null;
978
+ bindingMode: BondOutputBindingMode;
979
+ trust: FundVerificationReport;
980
+ trustSummary: VerificationTrustSummary;
981
+ }
982
+ export interface PolicyReceiver {
983
+ mode: "plain" | "policy";
984
+ address?: string;
985
+ recipientXonly?: string;
986
+ defaultPolicyTemplateId?: string;
987
+ defaultParams?: Record<string, string | number | boolean>;
988
+ }
989
+ export interface PolicyTemplateDocument {
990
+ policyTemplateId: string;
991
+ description?: string;
992
+ metadata?: Record<string, unknown>;
993
+ }
994
+ export type PolicyTemplateManifestVersion = "policy-template-manifest/v1";
995
+ export type PolicyVerificationReportSchemaVersion = "policy-verification-report/v1";
996
+ export type PolicyEvidenceBundleSchemaVersion = "policy-evidence-bundle/v1";
997
+ export type PolicyOutputBindingReasonCode = OutputBindingReasonCode;
998
+ export type PolicyOutputBindingSupportedForm = OutputBindingSupportedForm;
999
+ export type PolicyOutputAssetForm = OutputAssetForm;
1000
+ export type PolicyOutputAmountForm = OutputAmountForm;
1001
+ export type PolicyOutputNonceForm = OutputNonceForm;
1002
+ export type PolicyOutputRangeProofForm = OutputRangeProofForm;
1003
+ export type PolicyTemplateManifestValidationReasonCode = "OK" | "MANIFEST_VERSION_UNSUPPORTED" | "MANIFEST_FIELD_REQUIRED" | "MANIFEST_FIELD_INVALID" | "MANIFEST_PARAMETER_SCHEMA_INVALID" | "MANIFEST_BINDING_MODE_INVALID" | "MANIFEST_PROPAGATION_MODE_INVALID";
1004
+ export interface PolicyTemplateManifest {
1005
+ templateId: string;
1006
+ manifestVersion: PolicyTemplateManifestVersion;
1007
+ title: string;
1008
+ description: string;
1009
+ stateSimfPath: string;
1010
+ directStateSimfPath?: string;
1011
+ parameterSchema: Record<string, "string" | "number" | "boolean">;
1012
+ supportedBindingModes: BondOutputBindingMode[];
1013
+ supportsPlainExit: boolean;
1014
+ defaultPropagationMode: PropagationMode;
1015
+ }
1016
+ export interface PolicyTemplateInput {
1017
+ templateId?: string;
1018
+ manifestPath?: string;
1019
+ manifestValue?: PolicyTemplateManifest;
1020
+ jsonPath?: string;
1021
+ value?: unknown;
1022
+ stateSimfPath?: string;
1023
+ directStateSimfPath?: string;
1024
+ transferMachineSimfPath?: string;
1025
+ }
1026
+ export interface PolicyState {
1027
+ policyTemplateId: string;
1028
+ policyHash: string;
1029
+ recipient: string;
1030
+ amountSat: number;
1031
+ assetId: string;
1032
+ params: Record<string, string | number | boolean>;
1033
+ propagationMode: PropagationMode;
1034
+ previousStateHash?: string | null;
1035
+ hop: number;
1036
+ status: "LOCKED" | "SPENT";
1037
+ }
1038
+ export interface PolicyOutputDescriptor {
1039
+ nextContractAddress: string;
1040
+ nextOutputHash?: string;
1041
+ nextOutputScriptHash?: string;
1042
+ nextAmountSat: number;
1043
+ assetId: string;
1044
+ requestedOutputBindingMode?: BondOutputBindingMode;
1045
+ outputForm?: OutputForm;
1046
+ rawOutput?: Partial<OutputRawFields>;
1047
+ feeIndex: number;
1048
+ nextOutputIndex: number;
1049
+ maxFeeSat: number;
1050
+ outputBindingMode: BondOutputBindingMode;
1051
+ }
1052
+ export interface PolicyTransferDescriptor {
1053
+ policyTemplateId: string;
1054
+ previousPolicyHash: string;
1055
+ nextPolicyHash?: string | null;
1056
+ previousStateHash: string;
1057
+ nextStateHash?: string | null;
1058
+ propagationMode: PropagationMode;
1059
+ plainExitAddress?: string | null;
1060
+ outputDescriptor?: PolicyOutputDescriptor;
1061
+ }
1062
+ export interface PolicyVerificationReport {
1063
+ schemaVersion: PolicyVerificationReportSchemaVersion;
1064
+ templateTrust?: DefinitionVerificationResult["trust"];
1065
+ stateTrust: StateVerificationResult["trust"];
1066
+ propagationMode: PropagationMode;
1067
+ nextPolicyRequired: boolean;
1068
+ nextPolicyPresent: boolean;
1069
+ plainExitAllowed: boolean;
1070
+ outputBinding?: {
1071
+ mode: BondOutputBindingMode;
1072
+ supportedForm: PolicyOutputBindingSupportedForm;
1073
+ committed: boolean;
1074
+ runtimeBound: boolean;
1075
+ sdkVerified: boolean;
1076
+ amountRuntimeBound: boolean;
1077
+ nextOutputHashRuntimeBound: boolean;
1078
+ nextOutputScriptRuntimeBound: boolean;
1079
+ reasonCode: PolicyOutputBindingReasonCode;
1080
+ nextOutputHash?: string;
1081
+ autoDerived?: boolean;
1082
+ fallbackReason?: string;
1083
+ bindingInputs?: OutputBindingInputs;
1084
+ };
1085
+ enforcement: "sdk-path" | "conditional-hop" | "direct-hop";
1086
+ }
1087
+ export interface PolicyEvidenceBundle {
1088
+ schemaVersion: PolicyEvidenceBundleSchemaVersion;
1089
+ artifact: SimplicityArtifact;
1090
+ template: {
1091
+ canonicalJson: string;
1092
+ hash: string;
1093
+ };
1094
+ state: {
1095
+ canonicalJson: string;
1096
+ hash: string;
1097
+ };
1098
+ transfer?: {
1099
+ canonicalJson: string;
1100
+ hash: string;
1101
+ };
1102
+ report: PolicyVerificationReport;
1103
+ trustSummary: VerificationTrustSummary;
1104
+ renderedSourceHash?: string;
1105
+ sourceVerificationMode: "source-reloaded" | "artifact-only";
1106
+ compiled: {
1107
+ program: string;
1108
+ cmr: string;
1109
+ contractAddress: string;
1110
+ };
1111
+ }
1112
+ export interface OutputBindingSupportMatrix {
1113
+ supportedForms: Array<{
1114
+ form: OutputBindingSupportedForm;
1115
+ description: string;
1116
+ autoDerived: boolean;
1117
+ }>;
1118
+ unsupportedOutputFeatures: Array<{
1119
+ feature: string;
1120
+ description: string;
1121
+ fallbackReasonCode: Extract<OutputBindingReasonCode, "FALLBACK_UNSUPPORTED_ASSET" | "FALLBACK_UNSUPPORTED_OUTPUT_FORM">;
1122
+ manualHashSupported: boolean;
1123
+ }>;
1124
+ outputBindingModes: Record<BondOutputBindingMode, {
1125
+ description: string;
1126
+ runtimeBinding: "none" | "script-hash" | "output-hash";
1127
+ fallbackBehavior: string;
1128
+ }>;
1129
+ autoDeriveConditions: {
1130
+ assetInput: string[];
1131
+ amountForm: string;
1132
+ nonceForm: string;
1133
+ rangeProofForm: string;
1134
+ rawOutputFields?: string[];
1135
+ rawOutputFieldAlternatives?: Record<string, string[]>;
1136
+ outputHashExclusions?: string[];
1137
+ };
1138
+ manualHashPath: {
1139
+ supported: boolean;
1140
+ description: string;
1141
+ };
1142
+ fallbackBehavior: {
1143
+ defaultMode: BondOutputBindingMode;
1144
+ reasonCodes: OutputBindingReasonCode[];
1145
+ };
1146
+ publicValidationMatrix: {
1147
+ local: string[];
1148
+ testnet: string[];
1149
+ };
1150
+ nonGoals: string[];
1151
+ }
1152
+ export type PolicyBindingSupportMatrix = OutputBindingSupportMatrix;
1153
+ export interface OutputBindingSupportEvaluation {
1154
+ requestedBindingMode: BondOutputBindingMode;
1155
+ resolvedBindingMode: BondOutputBindingMode;
1156
+ supportedForm: OutputBindingSupportedForm;
1157
+ reasonCode: OutputBindingReasonCode;
1158
+ autoDerived: boolean;
1159
+ fallbackReason?: string;
1160
+ assetId: string;
1161
+ outputForm: OutputForm;
1162
+ unsupportedFeatures: string[];
1163
+ explicitAssetInputSupported: boolean;
1164
+ manualHashSupplied: boolean;
1165
+ nextOutputScriptAvailable: boolean;
1166
+ rawOutputProvided?: boolean;
1167
+ rawOutputComponents?: {
1168
+ scriptPubKey: "raw-bytes" | "hash";
1169
+ rangeProof: "raw-bytes" | "hash";
1170
+ };
1171
+ }
1172
+ export interface PolicyTemplateManifestValidationResult {
1173
+ ok: boolean;
1174
+ reasonCode: PolicyTemplateManifestValidationReasonCode;
1175
+ reason?: string;
1176
+ manifest?: PolicyTemplateManifest;
1177
+ }
380
1178
  export interface WaitForFundingInput {
381
1179
  minAmountSat?: number;
382
1180
  pollIntervalMs?: number;