opnet 1.8.3 → 1.8.4

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.
@@ -1,10 +1,8 @@
1
- // Browser shim for worker_threads - not used in browser context
2
- // WorkerCreator.ts uses Web Workers directly in browser via isNode check
3
-
4
- class Worker {
5
- constructor() {
6
- throw new Error('worker_threads is not available in browser. Use Web Workers instead.');
7
- }
8
- }
9
-
1
+ //#region src/shims/worker_threads-browser.js
2
+ var Worker = class {
3
+ constructor() {
4
+ throw new Error("worker_threads is not available in browser. Use Web Workers instead.");
5
+ }
6
+ };
7
+ //#endregion
10
8
  export { Worker };
@@ -1 +1 @@
1
- export declare const version = "1.8.3";
1
+ export declare const version = "1.8.4";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.8.3';
1
+ export const version = '1.8.4';
@@ -107,6 +107,7 @@ export declare class CallResult<T extends ContractDecodedObjectResult = {}, U ex
107
107
  setEvents(events: U): void;
108
108
  setCalldata(calldata: Uint8Array): void;
109
109
  toOfflineBuffer(refundAddress: string, amount: bigint): Promise<Uint8Array>;
110
+ private max;
110
111
  private acquire;
111
112
  private bigintMax;
112
113
  private getValuesFromAccessList;
@@ -427,6 +427,9 @@ export class CallResult {
427
427
  }
428
428
  }
429
429
  }
430
+ max(a, b) {
431
+ return a > b ? a : b;
432
+ }
430
433
  async acquire(interactionParams, amountAddition = 0n) {
431
434
  if (!this.calldata) {
432
435
  throw new Error('Calldata not set');
@@ -439,21 +442,12 @@ export class CallResult {
439
442
  const addedOuts = interactionParams.extraOutputs ?? [];
440
443
  const totalOuts = addedOuts.reduce((s, o) => s + BigInt(o.value), 0n);
441
444
  const gasFee = this.bigintMax(this.estimatedSatGas, interactionParams.minGas ?? 0n);
442
- const preWant = gasFee +
443
- priority +
444
- amountAddition +
445
- totalOuts +
446
- interactionParams.maximumAllowedSatToSpend;
445
+ const preWant = this.max(gasFee + priority + amountAddition + totalOuts, interactionParams.maximumAllowedSatToSpend);
447
446
  let utxos = interactionParams.utxos ?? (await this.#fetchUTXOs(preWant, interactionParams));
448
447
  let refetched = false;
449
448
  while (true) {
450
449
  const miningCost = TransactionHelper.estimateMiningCost(utxos, addedOuts, this.calldata.length + 200, interactionParams.network, feeRate);
451
- const want = gasFee +
452
- priority +
453
- amountAddition +
454
- totalOuts +
455
- miningCost +
456
- interactionParams.maximumAllowedSatToSpend;
450
+ const want = this.max(gasFee + priority + amountAddition + totalOuts + miningCost, interactionParams.maximumAllowedSatToSpend);
457
451
  const have = utxos.reduce((s, u) => s + u.value, 0n);
458
452
  if (have >= want)
459
453
  break;