@harmoniclabs/buildooor 0.2.3 → 0.2.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.
@@ -345,6 +345,8 @@ var TxBuilder = /** @class */ (function () {
345
345
  Math.max(0, Math.min(otps.nScriptExecitionRounds, maxRound))
346
346
  : defaultRounds);
347
347
  var _loop_1 = function (round) {
348
+ cek.resetBudget();
349
+ cek.resetLogs();
348
350
  prevFee = fee;
349
351
  var _d = (0, toOnChain_1.getTxInfos)(tx, this_1.genesisInfos), txInfosV1 = _d.v1, txInfosV2 = _d.v2, txInfosV3 = _d.v3;
350
352
  var totExBudget = new plutus_machine_1.ExBudget({ mem: 0, cpu: 0 });
@@ -445,6 +447,7 @@ var TxBuilder = /** @class */ (function () {
445
447
  tx = new cardano_ledger_ts_1.Tx(__assign(__assign({}, tx), { body: new cardano_ledger_ts_1.TxBody(__assign(__assign({}, tx.body), { outputs: txOuts.slice(), fee: fee, scriptDataHash: getScriptDataHash(nextWitnesses, languageViews) })), witnesses: nextWitnesses, isScriptValid: _isScriptValid }));
446
448
  _isScriptValid = true;
447
449
  totExBudget = new plutus_machine_1.ExBudget({ mem: 0, cpu: 0 });
450
+ cek.resetBudget();
448
451
  };
449
452
  var this_1 = this;
450
453
  for (var round = 0; round < nRounds; round++) {
@@ -15,7 +15,7 @@ function sortUTxO(a, b) {
15
15
  return ord;
16
16
  }
17
17
  function getTxInfos(transaction, genesisInfos) {
18
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
18
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
19
19
  var tx = transaction.body, witnesses = transaction.witnesses;
20
20
  function redeemerToDataPair(rdmr, version) {
21
21
  return new plutus_data_1.DataPair((0, getSpendingPurposeData_1.getSpendingPurposeData)(rdmr, tx, version), rdmr.data.clone());
@@ -58,7 +58,7 @@ function getTxInfos(transaction, genesisInfos) {
58
58
  ]);
59
59
  }
60
60
  catch ( // input or output can't be v1 (inline datums etc...)
61
- _0) { // input or output can't be v1 (inline datums etc...)
61
+ _5) { // input or output can't be v1 (inline datums etc...)
62
62
  v1 = undefined;
63
63
  }
64
64
  var v2 = undefined;
@@ -91,7 +91,7 @@ function getTxInfos(transaction, genesisInfos) {
91
91
  new plutus_data_1.DataConstr(0, [txIdData.clone()])
92
92
  ]);
93
93
  }
94
- catch (_1) {
94
+ catch (_6) {
95
95
  v2 = undefined;
96
96
  }
97
97
  var v3 = new plutus_data_1.DataConstr(0, // PTxInfo; only costructor
@@ -120,14 +120,24 @@ function getTxInfos(transaction, genesisInfos) {
120
120
  datumsData,
121
121
  // id
122
122
  txIdData,
123
- // TODO: votes (TODO)
124
- new plutus_data_1.DataMap([]),
125
- // TODO: proposals (TODO)
126
- new plutus_data_1.DataList([]),
127
- // TODO: currentTreasury
128
- new plutus_data_1.DataConstr(1, []),
129
- // TODO: treasuryDonation
130
- new plutus_data_1.DataConstr(1, []) // nothing
123
+ // votes
124
+ new plutus_data_1.DataMap((_2 = (_1 = (_0 = tx.votingProcedures) === null || _0 === void 0 ? void 0 : _0.procedures) === null || _1 === void 0 ? void 0 : _1.map(function (_a) {
125
+ var voter = _a.voter, votes = _a.votes;
126
+ return new plutus_data_1.DataPair(voter.toData("v3"), new plutus_data_1.DataMap(votes.map(function (_a) {
127
+ var govActionId = _a.govActionId, vote = _a.vote;
128
+ return new plutus_data_1.DataPair(govActionId.toData("v3"), new plutus_data_1.DataConstr(vote.vote, []));
129
+ })));
130
+ })) !== null && _2 !== void 0 ? _2 : []),
131
+ // proposals
132
+ new plutus_data_1.DataList((_4 = (_3 = tx.proposalProcedures) === null || _3 === void 0 ? void 0 : _3.map(function (prop) { return prop.toData("v3"); })) !== null && _4 !== void 0 ? _4 : []),
133
+ // currentTreasury
134
+ tx.currentTreasuryValue !== undefined
135
+ ? new plutus_data_1.DataConstr(0, [new plutus_data_1.DataI(tx.currentTreasuryValue)])
136
+ : new plutus_data_1.DataConstr(1, []),
137
+ // treasuryDonation
138
+ tx.donation !== undefined
139
+ ? new plutus_data_1.DataConstr(0, [new plutus_data_1.DataI(tx.donation)])
140
+ : new plutus_data_1.DataConstr(1, [])
131
141
  ]);
132
142
  return { v1: v1, v2: v2, v3: v3 };
133
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmoniclabs/buildooor",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Cardano transaction builder in typescript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "@harmoniclabs/obj-utils": "^1.0.0",
55
55
  "@harmoniclabs/pair": "^1.0.0",
56
56
  "@harmoniclabs/plutus-data": "^2.0.1",
57
- "@harmoniclabs/plutus-machine": "^3.0.1",
57
+ "@harmoniclabs/plutus-machine": "^3.0.2",
58
58
  "@harmoniclabs/uint8array-utils": "^1.0.4",
59
59
  "@harmoniclabs/uplc": "^2.0.6"
60
60
  },