@continuumdao/ctm-mpc-defi 0.2.58 → 0.2.59

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,8 +1,6 @@
1
1
  import { getAddress, parseAbi, zeroAddress, encodeFunctionData, defineChain, createPublicClient, parseGwei, serializeTransaction, keccak256, hashMessage, stringToHex, http } from 'viem';
2
2
  import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
3
3
  import { TXIDVersion, calculateGasPrice, ChainType, EVMGasType, RailgunWalletBalanceBucket } from '@railgun-community/shared-models';
4
- import { createRequire } from 'module';
5
- import { join, dirname } from 'path';
6
4
 
7
5
  // src/core/registry.ts
8
6
  var modules = [];
@@ -541,7 +539,8 @@ async function buildEvmMultisignBatch(args) {
541
539
  }
542
540
  return result;
543
541
  }
544
- var require2 = createRequire(import.meta.url);
542
+
543
+ // src/protocols/evm/railgun/engine.ts
545
544
  var artifacts = /* @__PURE__ */ new Map();
546
545
  var started = false;
547
546
  var loadedProviders = /* @__PURE__ */ new Set();
@@ -578,17 +577,26 @@ var artifactStore = {
578
577
  return artifacts.has(path);
579
578
  }
580
579
  };
581
- async function ensureRailgunEngine() {
582
- if (started) return;
583
- const wallet = await walletModule();
580
+ async function attachEngineErrorLogger() {
581
+ if (typeof window !== "undefined") return;
582
+ if (typeof process === "undefined" || !process.versions?.node) return;
583
+ const load = new Function("id", "return import(id)");
584
+ const nodeModule = await load("node:module");
585
+ const nodePath = await load("node:path");
586
+ const require2 = nodeModule.createRequire(import.meta.url);
584
587
  const walletEntry = require2.resolve("@railgun-community/wallet");
585
- const { setLoggers } = require2(join(dirname(walletEntry), "utils/logger.js"));
588
+ const { setLoggers } = require2(nodePath.join(nodePath.dirname(walletEntry), "utils/logger.js"));
586
589
  setLoggers(
587
590
  () => void 0,
588
591
  (err) => {
589
592
  lastEngineError = errorChain(err);
590
593
  }
591
594
  );
595
+ }
596
+ async function ensureRailgunEngine() {
597
+ if (started) return;
598
+ const wallet = await walletModule();
599
+ await attachEngineErrorLogger();
592
600
  const memdown = (await import('memdown')).default;
593
601
  const store = new wallet.ArtifactStore(
594
602
  (path) => artifactStore.get(path),