@hyperscale0/hsx 1.0.251 → 1.0.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +10 -1
- package/dist/src/compile.js.map +1 -1
- package/examples/cost-table.json +0 -492
- package/package.json +4 -4
- package/src/compile.ts +20 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAiBL,KAAK,WAAW,EAQjB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EAIL,KAAK,UAAU,EAKf,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;CACpC;AACD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,aAAa,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E;AACD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAClE;AACD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,WAAW,CAAC;QACtB,YAAY,EAAE,eAAe,CAAC;QAC9B,SAAS,EAAE,qBAAqB,EAAE,CAAC;KACpC,CAAC;CACH;AAqTD,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAq8Hf"}
|
package/dist/src/compile.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompileFailure, didYouMean, fail, failWithCode, } from "./diagnostics.js";
|
|
2
2
|
import { hash as sha256 } from "fast-sha256";
|
|
3
3
|
import { buildUdlCostManifest } from "./cost.js";
|
|
4
|
-
import { validateUdl, resolveField, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
|
|
4
|
+
import { validateUdl, resolveField, sameAccount, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
|
|
5
5
|
import { bindingDependencies, parameterDiagnostics, BindingContractError, } from "./binding-contract.js";
|
|
6
6
|
import { tunableBounds } from "./tunables.js";
|
|
7
7
|
import { parseProgram } from "./parse.js";
|
|
@@ -414,6 +414,7 @@ export function compile(source, options = {}) {
|
|
|
414
414
|
// Lowered objects lose their spans, so each keeps the expression that
|
|
415
415
|
// produced it for the name check after lowering.
|
|
416
416
|
const authored = new WeakMap();
|
|
417
|
+
const splitMoves = new WeakSet();
|
|
417
418
|
const declarations = new WeakMap();
|
|
418
419
|
const exposures = [];
|
|
419
420
|
const refundBindings = new Map();
|
|
@@ -1944,6 +1945,7 @@ export function compile(source, options = {}) {
|
|
|
1944
1945
|
from: moneyPath(from),
|
|
1945
1946
|
to: `party.${recipient.value}`,
|
|
1946
1947
|
});
|
|
1948
|
+
splitMoves.add(a.moves.at(-1));
|
|
1947
1949
|
}
|
|
1948
1950
|
if (total !== 10000)
|
|
1949
1951
|
fail(move, "split percentages must sum to 100%", "give the recipients exactly 100% together");
|
|
@@ -3114,6 +3116,13 @@ export function compile(source, options = {}) {
|
|
|
3114
3116
|
fail(objects.get(kind.id), `entry action ${name} must create an attachment as actor`, "expose its create action and bind its acting party to actor");
|
|
3115
3117
|
}
|
|
3116
3118
|
}
|
|
3119
|
+
// Resolve account bindings after lowering, keeping all share calculations
|
|
3120
|
+
// and original leg keys even when a split allocation stays in its source.
|
|
3121
|
+
for (const instrument of document.instruments)
|
|
3122
|
+
for (const action of Object.values(instrument.actions))
|
|
3123
|
+
action.moves = action.moves.filter((move) => !splitMoves.has(move) ||
|
|
3124
|
+
!("amount" in move) ||
|
|
3125
|
+
!sameAccount(document, instrument, move.from, move.to, action.input, action));
|
|
3117
3126
|
const validated = validateUdl(document);
|
|
3118
3127
|
if (!validated.ok)
|
|
3119
3128
|
return {
|