@harmoniclabs/buildooor 0.2.2 → 0.2.3

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.
@@ -15,7 +15,10 @@ export declare class TxBuilder {
15
15
  readonly genesisInfos?: NormalizedGenesisInfos;
16
16
  setGenesisInfos: (geneisInfos: GenesisInfos) => void;
17
17
  runWithProvider(provider: Partial<ITxRunnerProvider>): TxBuilderRunner;
18
+ private cek;
19
+ private pp;
18
20
  constructor(protocolParamters?: Readonly<TxBuilderProtocolParams>, genesisInfos?: GenesisInfos);
21
+ resetMachine(): void;
19
22
  keepRelevant(requestedOutputSet: Value | ValueUnits, initialUTxOSet: ITxBuildInput[], minimumLovelaceRequired?: CanBeUInteger): ITxBuildInput[];
20
23
  private calcLinearFee;
21
24
  calcMinFee(tx: Tx, minimum?: CanBeUInteger | undefined): bigint;
@@ -145,24 +145,22 @@ var TxBuilder = /** @class */ (function () {
145
145
  }
146
146
  });
147
147
  var pp = (0, TxBuilderProtocolParams_1.completeTxBuilderProtocolParams)(protocolParamters);
148
+ this.pp = pp;
148
149
  (0, obj_utils_1.defineReadOnlyProperty)(this, "protocolParamters", (0, obj_utils_1.freezeAll)(protocolParamters));
149
150
  var costmdls = pp.costModels;
150
151
  var costs = (0, cardano_costmodels_ts_1.isCostModelsV3)(costmdls.PlutusScriptV3) ? costmdls.PlutusScriptV3 :
151
152
  (0, cardano_costmodels_ts_1.isCostModelsV2)(costmdls.PlutusScriptV2) ? costmdls.PlutusScriptV2 :
152
153
  (0, cardano_costmodels_ts_1.isCostModelsV1)(costmdls.PlutusScriptV1) ? costmdls.PlutusScriptV1 :
153
154
  cardano_costmodels_ts_1.defaultV3Costs;
154
- (0, obj_utils_1.definePropertyIfNotPresent)(this, "cek", {
155
- // define as getter so that it can be reused without messing around things
156
- get: function () { return new plutus_machine_1.Machine(__assign({}, costs)); },
157
- // set does nothing ( aka. readonly )
158
- set: function () { },
159
- enumerable: false,
160
- configurable: false
161
- });
155
+ this.cek = new plutus_machine_1.Machine(__assign({}, costs), pp.maxTxExecutionUnits);
162
156
  }
163
157
  TxBuilder.prototype.runWithProvider = function (provider) {
164
158
  return new TxBuilderRunner_1.TxBuilderRunner(this, provider);
165
159
  };
160
+ TxBuilder.prototype.resetMachine = function () {
161
+ this.cek.resetBudget(this.pp.maxTxExecutionUnits);
162
+ this.cek.resetLogs();
163
+ };
166
164
  TxBuilder.prototype.keepRelevant = function (requestedOutputSet, initialUTxOSet, minimumLovelaceRequired) {
167
165
  if (minimumLovelaceRequired === void 0) { minimumLovelaceRequired = 5000000; }
168
166
  return (0, keepRelevant_1.keepRelevant)(requestedOutputSet, initialUTxOSet, minimumLovelaceRequired);
@@ -318,6 +316,7 @@ var TxBuilder = /** @class */ (function () {
318
316
  }
319
317
  ;
320
318
  var txOuts = new Array(outs.length + 1);
319
+ this.resetMachine();
321
320
  var cek = this.cek;
322
321
  if (!(cek instanceof plutus_machine_1.Machine))
323
322
  throw new Error("unable to construct transaction including scripts " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmoniclabs/buildooor",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Cardano transaction builder in typescript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",