@harmoniclabs/buildooor 0.1.18 → 0.1.20
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.
|
@@ -379,7 +379,7 @@ var TxBuilder = /** @class */ (function () {
|
|
|
379
379
|
_isScriptValid = onEvaluationResult(i, totExBudget, rdmr, result, budgetSpent, logs, isV2OrLess ? [
|
|
380
380
|
rdmrData,
|
|
381
381
|
ctxData
|
|
382
|
-
] : [ctxData], rdmrs, onScriptResult, onScriptInvalid);
|
|
382
|
+
] : [ctxData], rdmrs, script.hash.toString(), onScriptResult, onScriptInvalid);
|
|
383
383
|
};
|
|
384
384
|
if (tag === cardano_ledger_ts_1.TxRedeemerTag.Spend) {
|
|
385
385
|
var entry = spendScriptsToExec.find(function (_a) {
|
|
@@ -403,7 +403,7 @@ var TxBuilder = /** @class */ (function () {
|
|
|
403
403
|
datum,
|
|
404
404
|
rdmrData,
|
|
405
405
|
ctxData
|
|
406
|
-
] : [ctxData], rdmrs, onScriptResult, onScriptInvalid);
|
|
406
|
+
] : [ctxData], rdmrs, script.hash.toString(), onScriptResult, onScriptInvalid);
|
|
407
407
|
}
|
|
408
408
|
else if (tag === cardano_ledger_ts_1.TxRedeemerTag.Mint)
|
|
409
409
|
onlyRedeemerArg(mintScriptsToExec);
|
|
@@ -1238,15 +1238,10 @@ function getCtx(scriptType, spendingPurpose, scriptInfo, redeemerData, txInfosV1
|
|
|
1238
1238
|
else
|
|
1239
1239
|
throw new Error("unexpected native script execution");
|
|
1240
1240
|
}
|
|
1241
|
-
function onEvaluationResult(i, totExBudget, rdmr, result, budgetSpent, logs, callArgs, rdmrs, onScriptResult, onScriptInvalid) {
|
|
1241
|
+
function onEvaluationResult(i, totExBudget, rdmr, result, budgetSpent, logs, callArgs, rdmrs, scritHashStr, onScriptResult, onScriptInvalid) {
|
|
1242
1242
|
var _isScriptValid = true;
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
// budgetSpent.add({
|
|
1246
|
-
// cpu: 100_000,
|
|
1247
|
-
// mem: 10_000
|
|
1248
|
-
// });
|
|
1249
|
-
onScriptResult && onScriptResult(rdmr.clone(), result, budgetSpent.clone(), logs.slice(), callArgs.map(function (d) { return d.clone(); }));
|
|
1243
|
+
if (typeof onScriptResult === "function")
|
|
1244
|
+
onScriptResult(rdmr.clone(), result, budgetSpent.clone(), logs.slice(), callArgs.map(function (d) { return d.clone(); }), scritHashStr);
|
|
1250
1245
|
if (result instanceof uplc_1.ErrorUPLC ||
|
|
1251
1246
|
(function (resultKeys) {
|
|
1252
1247
|
return resultKeys.includes("msg") &&
|
|
@@ -1254,25 +1249,32 @@ function onEvaluationResult(i, totExBudget, rdmr, result, budgetSpent, logs, cal
|
|
|
1254
1249
|
})(Object.keys(result))) {
|
|
1255
1250
|
if (typeof onScriptInvalid === "function") {
|
|
1256
1251
|
onScriptInvalid(rdmr.clone(), logs.slice(), callArgs.map(function (d) { return d.clone(); }));
|
|
1257
|
-
_isScriptValid = false;
|
|
1252
|
+
// _isScriptValid = false;
|
|
1258
1253
|
}
|
|
1259
1254
|
else {
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
"
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
"additional infos: ".concat((0, stringify_1.stringify)(result.addInfos, function (k, v) {
|
|
1255
|
+
var callArgsStr = (callArgs
|
|
1256
|
+
.map(function (d, i) {
|
|
1257
|
+
return i.toString() + ": " + (0, plutus_data_1.dataToCbor)(d).toString();
|
|
1258
|
+
})
|
|
1259
|
+
.join("\n"));
|
|
1260
|
+
var errorMsg = result === null || result === void 0 ? void 0 : result.msg;
|
|
1261
|
+
var addInfosStr = "<error while serializing additional infos>";
|
|
1262
|
+
try {
|
|
1263
|
+
addInfosStr = (0, stringify_1.stringify)(result === null || result === void 0 ? void 0 : result.addInfos, function (k, v) {
|
|
1270
1264
|
if ((0, uint8array_utils_1.isUint8Array)(v))
|
|
1271
1265
|
return (0, uint8array_utils_1.toHex)(v);
|
|
1272
1266
|
if (typeof v === "bigint")
|
|
1273
1267
|
return v.toString();
|
|
1274
1268
|
return v;
|
|
1275
|
-
})
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
catch (_a) { }
|
|
1272
|
+
throw new Error("script '".concat(scritHashStr, "' consumed with ").concat((0, cardano_ledger_ts_1.txRedeemerTagToString)(rdmr.tag), " redemer ") +
|
|
1273
|
+
"and index '".concat(rdmr.index.toString(), "'\n\n") +
|
|
1274
|
+
"called with data arguments:\n".concat(callArgsStr, "\n\n") +
|
|
1275
|
+
"failed with \n" +
|
|
1276
|
+
"error message: ".concat(errorMsg, "\n") +
|
|
1277
|
+
"additional infos: ".concat(addInfosStr, "\n") +
|
|
1276
1278
|
"script execution logs: [".concat(logs.toString(), "]\n"));
|
|
1277
1279
|
}
|
|
1278
1280
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function mkReplacer(replacer?: (key: string, value: any) => any | null,
|
|
1
|
+
export declare function mkReplacer(replacer?: (key: string, value: any) => any | null, seen?: WeakSet<any>): (key: string, value: any) => any;
|
|
2
2
|
export declare function stringify(value: any, replacer?: (key: string, value: any) => any | null | (number | string)[], space?: string | number): string;
|
package/dist/utils/stringify.js
CHANGED
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stringify = exports.mkReplacer = void 0;
|
|
4
4
|
var obj_utils_1 = require("@harmoniclabs/obj-utils");
|
|
5
5
|
var uint8array_utils_1 = require("@harmoniclabs/uint8array-utils");
|
|
6
|
-
function mkReplacer(replacer,
|
|
7
|
-
if (
|
|
6
|
+
function mkReplacer(replacer, seen) {
|
|
7
|
+
if (seen === void 0) { seen = new WeakSet(); }
|
|
8
8
|
if (typeof replacer !== "function")
|
|
9
9
|
replacer = function (k, v) { return v; };
|
|
10
10
|
return function (key, value) {
|
|
11
11
|
value = replacer(key, value);
|
|
12
12
|
if ((0, obj_utils_1.isObject)(value)) {
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
13
|
+
if (seen.has(value)) {
|
|
14
|
+
return undefined;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
seen.add(value);
|
|
17
17
|
if (typeof value.buffer === "object" && value.buffer instanceof ArrayBuffer) {
|
|
18
18
|
value = new Uint8Array(value.buffer);
|
|
19
19
|
}
|
|
@@ -30,9 +30,6 @@ function mkReplacer(replacer, map) {
|
|
|
30
30
|
exports.mkReplacer = mkReplacer;
|
|
31
31
|
function stringify(value, replacer, space) {
|
|
32
32
|
if (space === void 0) { space = 0; }
|
|
33
|
-
|
|
34
|
-
return JSON.stringify(value, replacer, space);
|
|
35
|
-
}
|
|
36
|
-
return JSON.stringify(value, mkReplacer(replacer, new WeakMap()), space);
|
|
33
|
+
return JSON.stringify(value, mkReplacer(replacer, new WeakSet()), space);
|
|
37
34
|
}
|
|
38
35
|
exports.stringify = stringify;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harmoniclabs/buildooor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Cardano transaction builder in typescript",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@harmoniclabs/bip32_ed25519": "^0.1.3",
|
|
52
52
|
"@harmoniclabs/bytestring": "^1.0.0",
|
|
53
53
|
"@harmoniclabs/cardano-costmodels-ts": "^1.3.0",
|
|
54
|
-
"@harmoniclabs/cardano-ledger-ts": "^0.4.0-
|
|
54
|
+
"@harmoniclabs/cardano-ledger-ts": "^0.4.0-dev14",
|
|
55
55
|
"@harmoniclabs/cbor": "^1.6.6",
|
|
56
56
|
"@harmoniclabs/pair": "^1.0.0",
|
|
57
57
|
"@harmoniclabs/plutus-data": "^1.2.6",
|