@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.
- package/README.md +140 -1038
- package/dist/cli.js +3341 -269
- package/dist/client/SimplicityClient.d.ts +91 -290
- package/dist/client/SimplicityClient.js +93 -23
- package/dist/core/executor.js +67 -92
- package/dist/core/lineage.d.ts +18 -0
- package/dist/core/lineage.js +30 -0
- package/dist/core/outputBinding.d.ts +61 -0
- package/dist/core/outputBinding.js +552 -0
- package/dist/core/reporting.d.ts +22 -0
- package/dist/core/reporting.js +40 -0
- package/dist/core/schnorr.d.ts +5 -0
- package/dist/core/schnorr.js +46 -0
- package/dist/core/types.d.ts +799 -1
- package/dist/docs/definitions/bond-anchor.simf +19 -0
- package/dist/docs/definitions/bond-definition.json +10 -0
- package/dist/docs/definitions/bond-descriptor-bound-settlement-machine.simf +144 -0
- package/dist/docs/definitions/bond-issuance-anchor.simf +26 -0
- package/dist/docs/definitions/bond-issuance-state-partial-redemption.json +18 -0
- package/dist/docs/definitions/bond-issuance-state-redeemed.json +18 -0
- package/dist/docs/definitions/bond-issuance-state.json +12 -0
- package/dist/docs/definitions/bond-redemption-state-machine.simf +118 -0
- package/dist/docs/definitions/bond-redemption-transition.simf +41 -0
- package/dist/docs/definitions/bond-script-bound-settlement-machine.simf +142 -0
- package/dist/docs/definitions/fund-capital-call-open.simf +82 -0
- package/dist/docs/definitions/fund-capital-call-refund-only.simf +67 -0
- package/dist/docs/definitions/fund-capital-call-state.json +11 -0
- package/dist/docs/definitions/fund-definition.json +8 -0
- package/dist/docs/definitions/fund-distribution-claim.simf +57 -0
- 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/docs/definitions/recursive-delay-direct-next.simf +60 -0
- package/dist/docs/definitions/recursive-delay-optional.simf +88 -0
- package/dist/docs/definitions/recursive-delay-required.simf +72 -0
- package/dist/docs/definitions/recursive-delay.simf +83 -0
- package/dist/docs/definitions/recursive-policy-transfer-machine.simf +65 -0
- package/dist/domain/bond.d.ts +8649 -720
- package/dist/domain/bond.js +1398 -8
- package/dist/domain/bondSettlementValidation.d.ts +2 -0
- package/dist/domain/bondSettlementValidation.js +28 -0
- package/dist/domain/bondValidation.d.ts +37 -1
- package/dist/domain/bondValidation.js +137 -11
- package/dist/domain/fund.d.ts +2452 -0
- package/dist/domain/fund.js +1756 -0
- package/dist/domain/fundValidation.d.ts +152 -0
- package/dist/domain/fundValidation.js +767 -0
- package/dist/domain/policies.d.ts +1064 -0
- package/dist/domain/policies.js +1625 -0
- 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 +8 -2
- package/dist/index.js +137 -21
- package/package.json +20 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ReceivableClosingDescriptor, ReceivableClosingReason, ReceivableClaimTrust, ReceivableDefinition, ReceivableFundingClaimDescriptor, ReceivableRepaymentClaimDescriptor, ReceivableState, ReceivableStatus } from "../core/types";
|
|
2
|
+
export declare function summarizeReceivableDefinition(definition: ReceivableDefinition): {
|
|
3
|
+
canonicalJson: string;
|
|
4
|
+
hash: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function summarizeReceivableState(state: ReceivableState): {
|
|
7
|
+
canonicalJson: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function summarizeReceivableClosingDescriptor(closing: ReceivableClosingDescriptor): {
|
|
11
|
+
canonicalJson: string;
|
|
12
|
+
hash: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function summarizeReceivableFundingClaimDescriptor(claim: ReceivableFundingClaimDescriptor): {
|
|
15
|
+
canonicalJson: string;
|
|
16
|
+
hash: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function summarizeReceivableRepaymentClaimDescriptor(claim: ReceivableRepaymentClaimDescriptor): {
|
|
19
|
+
canonicalJson: string;
|
|
20
|
+
hash: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function validateReceivableDefinition(value: unknown): ReceivableDefinition;
|
|
23
|
+
export declare function validateReceivableState(value: unknown): ReceivableState;
|
|
24
|
+
export declare function validateReceivableClosingDescriptor(value: unknown): ReceivableClosingDescriptor;
|
|
25
|
+
export declare function validateReceivableFundingClaimDescriptor(value: unknown): ReceivableFundingClaimDescriptor;
|
|
26
|
+
export declare function validateReceivableRepaymentClaimDescriptor(value: unknown): ReceivableRepaymentClaimDescriptor;
|
|
27
|
+
export declare function validateReceivableCrossChecks(definition: ReceivableDefinition, state: ReceivableState): {
|
|
28
|
+
receivableIdMatch: boolean;
|
|
29
|
+
originatorMatch: boolean;
|
|
30
|
+
debtorMatch: boolean;
|
|
31
|
+
currencyMatch: boolean;
|
|
32
|
+
controllerMatch: boolean;
|
|
33
|
+
faceValueMatch: boolean;
|
|
34
|
+
arithmeticValid: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function buildFundedReceivableState(input: {
|
|
37
|
+
previous: ReceivableState;
|
|
38
|
+
stateId: string;
|
|
39
|
+
holderEntityId: string;
|
|
40
|
+
fundedAt: string;
|
|
41
|
+
}): ReceivableState;
|
|
42
|
+
export declare function applyReceivableRepayment(input: {
|
|
43
|
+
previous: ReceivableState;
|
|
44
|
+
stateId: string;
|
|
45
|
+
amount: number;
|
|
46
|
+
repaidAt: string;
|
|
47
|
+
}): ReceivableState;
|
|
48
|
+
export declare function buildDefaultedReceivableState(input: {
|
|
49
|
+
previous: ReceivableState;
|
|
50
|
+
stateId: string;
|
|
51
|
+
defaultedAt: string;
|
|
52
|
+
writeOffAmount?: number;
|
|
53
|
+
}): ReceivableState;
|
|
54
|
+
export declare function buildReceivableClosingDescriptor(input: {
|
|
55
|
+
closingId: string;
|
|
56
|
+
latestState: ReceivableState;
|
|
57
|
+
closedAt: string;
|
|
58
|
+
closingReason?: ReceivableClosingReason;
|
|
59
|
+
}): ReceivableClosingDescriptor;
|
|
60
|
+
export declare function buildReceivableFundingClaimDescriptor(input: {
|
|
61
|
+
claimId: string;
|
|
62
|
+
currentState: ReceivableState;
|
|
63
|
+
payerEntityId?: string;
|
|
64
|
+
payeeEntityId?: string;
|
|
65
|
+
claimantXonly?: string;
|
|
66
|
+
amountSat?: number;
|
|
67
|
+
eventTimestamp?: string;
|
|
68
|
+
}): ReceivableFundingClaimDescriptor;
|
|
69
|
+
export declare function buildReceivableRepaymentClaimDescriptor(input: {
|
|
70
|
+
claimId: string;
|
|
71
|
+
currentState: ReceivableState;
|
|
72
|
+
payerEntityId?: string;
|
|
73
|
+
payeeEntityId?: string;
|
|
74
|
+
claimantXonly?: string;
|
|
75
|
+
amountSat?: number;
|
|
76
|
+
eventTimestamp?: string;
|
|
77
|
+
}): ReceivableRepaymentClaimDescriptor;
|
|
78
|
+
export declare function validateReceivableFundingClaimAgainstState(input: {
|
|
79
|
+
currentState: ReceivableState;
|
|
80
|
+
claim: ReceivableFundingClaimDescriptor;
|
|
81
|
+
}): Omit<ReceivableClaimTrust, "generated" | "bindingMode" | "requestedMode" | "supportedForm" | "reasonCode" | "nextReceiverRuntimeCommitted" | "nextOutputHashRuntimeBound" | "nextOutputScriptRuntimeBound" | "amountRuntimeBound" | "autoDerived" | "fallbackReason" | "bindingInputs" | "claimantXonlyCommitted">;
|
|
82
|
+
export declare function validateReceivableRepaymentClaimAgainstState(input: {
|
|
83
|
+
currentState: ReceivableState;
|
|
84
|
+
claim: ReceivableRepaymentClaimDescriptor;
|
|
85
|
+
}): Omit<ReceivableClaimTrust, "generated" | "bindingMode" | "requestedMode" | "supportedForm" | "reasonCode" | "nextReceiverRuntimeCommitted" | "nextOutputHashRuntimeBound" | "nextOutputScriptRuntimeBound" | "amountRuntimeBound" | "autoDerived" | "fallbackReason" | "bindingInputs" | "claimantXonlyCommitted">;
|
|
86
|
+
export declare function validateReceivableFundingTransition(previousValue: ReceivableState, nextValue: ReceivableState): {
|
|
87
|
+
transitionType: "FUND";
|
|
88
|
+
previousStateHashMatch: true;
|
|
89
|
+
participantConsistencyValid: true;
|
|
90
|
+
statusProgressionValid: true;
|
|
91
|
+
arithmeticDeltaValid: true;
|
|
92
|
+
createdAtMonotonic: true;
|
|
93
|
+
transitionAmountValid: true;
|
|
94
|
+
fullTransitionVerified: boolean;
|
|
95
|
+
};
|
|
96
|
+
export declare function validateReceivableRepaymentTransition(previousValue: ReceivableState, nextValue: ReceivableState): {
|
|
97
|
+
transitionType: "REPAY";
|
|
98
|
+
previousStateHashMatch: true;
|
|
99
|
+
participantConsistencyValid: true;
|
|
100
|
+
statusProgressionValid: true;
|
|
101
|
+
arithmeticDeltaValid: true;
|
|
102
|
+
createdAtMonotonic: true;
|
|
103
|
+
transitionAmountValid: true;
|
|
104
|
+
fullTransitionVerified: boolean;
|
|
105
|
+
};
|
|
106
|
+
export declare function validateReceivableWriteOffTransition(previousValue: ReceivableState, nextValue: ReceivableState): {
|
|
107
|
+
transitionType: "WRITE_OFF";
|
|
108
|
+
previousStateHashMatch: true;
|
|
109
|
+
participantConsistencyValid: true;
|
|
110
|
+
statusProgressionValid: true;
|
|
111
|
+
arithmeticDeltaValid: true;
|
|
112
|
+
createdAtMonotonic: true;
|
|
113
|
+
transitionAmountValid: true;
|
|
114
|
+
fullTransitionVerified: boolean;
|
|
115
|
+
};
|
|
116
|
+
export declare function validateReceivableClosingAgainstState(input: {
|
|
117
|
+
latestState: ReceivableState;
|
|
118
|
+
closing: ReceivableClosingDescriptor;
|
|
119
|
+
history?: ReceivableState[];
|
|
120
|
+
}): {
|
|
121
|
+
terminalStatusEligible: true;
|
|
122
|
+
latestStateHashMatch: true;
|
|
123
|
+
closingReasonMatchesStatus: true;
|
|
124
|
+
historyTipMatches: true;
|
|
125
|
+
lineageProvided: boolean;
|
|
126
|
+
fullClosingVerified: boolean;
|
|
127
|
+
};
|
|
128
|
+
export declare function verifyReceivableStateHistory(input: {
|
|
129
|
+
history: ReceivableState[];
|
|
130
|
+
}): {
|
|
131
|
+
chainLength: number;
|
|
132
|
+
startsAtGenesis: boolean;
|
|
133
|
+
latestStatus: ReceivableStatus;
|
|
134
|
+
allPreviousStateHashMatch: boolean;
|
|
135
|
+
receivableIdConsistent: boolean;
|
|
136
|
+
originatorConsistent: boolean;
|
|
137
|
+
debtorConsistent: boolean;
|
|
138
|
+
currencyConsistent: boolean;
|
|
139
|
+
controllerConsistent: boolean;
|
|
140
|
+
faceValueConsistent: boolean;
|
|
141
|
+
allArithmeticValid: boolean;
|
|
142
|
+
allStatusProgressionValid: boolean;
|
|
143
|
+
fullHistoryVerified: boolean;
|
|
144
|
+
summaries: {
|
|
145
|
+
hash: string;
|
|
146
|
+
}[];
|
|
147
|
+
};
|