@hyperscale0/hsx 1.0.0-alpha.3 → 1.0.0-alpha.5
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/CHANGELOG.md +94 -2
- package/README.md +5 -5
- package/dist/src/archetypes.d.ts +17 -0
- package/dist/src/archetypes.d.ts.map +1 -0
- package/dist/src/archetypes.js +327 -0
- package/dist/src/archetypes.js.map +1 -0
- package/dist/src/ast.d.ts +2 -3
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/check.d.ts +1 -0
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +805 -109
- package/dist/src/check.js.map +1 -1
- package/dist/src/entry-overrides.d.ts +44 -0
- package/dist/src/entry-overrides.d.ts.map +1 -0
- package/dist/src/entry-overrides.js +139 -0
- package/dist/src/entry-overrides.js.map +1 -0
- package/dist/src/index.d.ts +2 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/lex.d.ts +1 -0
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lex.js +1 -1
- package/dist/src/lex.js.map +1 -1
- package/dist/src/lower.d.ts +57 -4
- package/dist/src/lower.d.ts.map +1 -1
- package/dist/src/lower.js +2581 -100
- package/dist/src/lower.js.map +1 -1
- package/dist/src/model.d.ts +167 -7
- package/dist/src/model.d.ts.map +1 -1
- package/dist/src/model.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/spec/hsx-ir.schema.json +407 -9
- package/src/archetypes.ts +340 -0
- package/src/ast.ts +2 -3
- package/src/check.ts +1363 -124
- package/src/entry-overrides.ts +213 -0
- package/src/index.ts +7 -12
- package/src/lex.ts +1 -1
- package/src/lower.ts +2914 -127
- package/src/model.ts +187 -8
- package/src/version.ts +1 -1
package/dist/src/lower.d.ts
CHANGED
|
@@ -35,10 +35,11 @@ type Json = Record<string, unknown>;
|
|
|
35
35
|
/**
|
|
36
36
|
* The most money events one program may mint. The Business Frame contract caps
|
|
37
37
|
* its moneyEvents array at the same number, and a runtime spec pins the two
|
|
38
|
-
* against each other, so neither can drift alone.
|
|
39
|
-
*
|
|
38
|
+
* against each other, so neither can drift alone. A repeatable schedule costs
|
|
39
|
+
* one event declaration. Fee legs, cancellation legs, refunds, and forwards
|
|
40
|
+
* each count when they emit their own event declaration.
|
|
40
41
|
*/
|
|
41
|
-
export declare const MONEY_EVENT_BUDGET =
|
|
42
|
+
export declare const MONEY_EVENT_BUDGET = 20;
|
|
42
43
|
interface LoweredPiece {
|
|
43
44
|
/** Exact width of this piece in basis points of the held amount. */
|
|
44
45
|
readonly bps: number;
|
|
@@ -60,7 +61,7 @@ interface LoweredSettlement {
|
|
|
60
61
|
readonly field: string;
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
|
-
interface LoweringIssue {
|
|
64
|
+
export interface LoweringIssue {
|
|
64
65
|
readonly message: string;
|
|
65
66
|
readonly span: Span;
|
|
66
67
|
}
|
|
@@ -88,6 +89,58 @@ export type LowerResult = {
|
|
|
88
89
|
export declare function pieceAmounts(pieces: readonly {
|
|
89
90
|
readonly bps: number;
|
|
90
91
|
}[], amountMinor: bigint, remainderIndex?: number): bigint[];
|
|
92
|
+
export type FrameActorRole = "beneficiary" | "guardian" | "holder" | "payer" | "provider";
|
|
93
|
+
/** One role whose account endpoint repeats within one settlement. */
|
|
94
|
+
export interface RepeatableCounterpartyRole {
|
|
95
|
+
readonly key: string;
|
|
96
|
+
readonly label: string;
|
|
97
|
+
readonly maxCount: number;
|
|
98
|
+
readonly minCount: number;
|
|
99
|
+
readonly origin: Span;
|
|
100
|
+
readonly role: FrameActorRole;
|
|
101
|
+
}
|
|
102
|
+
export type AmountDependencyExpression = {
|
|
103
|
+
readonly kind: "bounded_by_reference";
|
|
104
|
+
readonly reference: string;
|
|
105
|
+
} | {
|
|
106
|
+
readonly kind: "net_of_offsets";
|
|
107
|
+
readonly offsets: readonly string[];
|
|
108
|
+
readonly source: string;
|
|
109
|
+
} | {
|
|
110
|
+
readonly bps: number;
|
|
111
|
+
readonly kind: "percent_of_reference";
|
|
112
|
+
readonly reference: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly consumed: readonly string[];
|
|
115
|
+
readonly kind: "remainder";
|
|
116
|
+
readonly source: string;
|
|
117
|
+
};
|
|
118
|
+
interface EventAmountFields {
|
|
119
|
+
readonly amountDependencies: readonly string[];
|
|
120
|
+
readonly amountMode: "fixed" | "remaining_balance" | "runtime_bounded";
|
|
121
|
+
}
|
|
122
|
+
/** Lower one arithmetic dependency into the Business Frame's existing keys. */
|
|
123
|
+
export declare function lowerAmountDependency(expression?: AmountDependencyExpression): EventAmountFields;
|
|
124
|
+
export interface EventSpec {
|
|
125
|
+
readonly amount: string;
|
|
126
|
+
readonly amountDependency?: AmountDependencyExpression;
|
|
127
|
+
readonly fromActor: string;
|
|
128
|
+
readonly key: string;
|
|
129
|
+
readonly kind: string;
|
|
130
|
+
readonly occurrence?: "once" | "repeatable";
|
|
131
|
+
readonly timing?: "external_schedule" | "on_lifecycle";
|
|
132
|
+
readonly toActor: string;
|
|
133
|
+
readonly trigger: string;
|
|
134
|
+
}
|
|
135
|
+
export declare function mintEvent(spec: EventSpec): Json;
|
|
91
136
|
export declare function lowerProgram(program: CheckedProgram): LowerResult;
|
|
137
|
+
/** Lower fixed parties plus future settlement-declared repeating roles. */
|
|
138
|
+
export interface FrameActorLoweringResult {
|
|
139
|
+
readonly actors: readonly Record<string, unknown>[];
|
|
140
|
+
readonly issues: readonly LoweringIssue[];
|
|
141
|
+
}
|
|
142
|
+
export declare function lowerFrameActors(program: Pick<CheckedProgram, "parties" | "settlements">, repeatableCounterparties?: readonly RepeatableCounterpartyRole[]): FrameActorLoweringResult;
|
|
143
|
+
/** Validate the completed event graph before HSX returns a frame. */
|
|
144
|
+
export declare function validateAmountDependencyGraph(events: readonly Record<string, unknown>[], origin: Span): readonly LoweringIssue[];
|
|
92
145
|
export {};
|
|
93
146
|
//# sourceMappingURL=lower.d.ts.map
|
package/dist/src/lower.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAeV,cAAc,EAWf,MAAM,YAAY,CAAC;AAGpB,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAKrC,UAAU,YAAY;IACpB,oEAAoE;IACpE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,C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