fix(script.js): Trying to satisfy ESM, linter, and minify packager at the same time

This commit is contained in:
Chris Troutner
2025-11-26 13:15:07 -08:00
parent 13a7917d9b
commit cc1809b242
2 changed files with 10 additions and 5 deletions
-2
View File
@@ -534,8 +534,6 @@ class ElectrumX {
*/ */
async txData (txid) { async txData (txid) {
try { try {
console.log('bch-js txData() restURL: ', this.restURL)
// Handle single transaction. // Handle single transaction.
if (typeof txid === 'string') { if (typeof txid === 'string') {
const response = await this.axios.get( const response = await this.axios.get(
+10 -3
View File
@@ -1,7 +1,14 @@
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import Bitcoin from '@psf/bitcoincashjs-lib' import Bitcoin from '@psf/bitcoincashjs-lib'
import { createRequire } from 'module'
const require = createRequire(import.meta.url) // Import the bitcoincash-ops library using ESM methods that don't piss off
const opcodes = require('@psf/bitcoincash-ops') // the standard linter.
const __dirname = dirname(fileURLToPath(import.meta.url))
const opcodes = JSON.parse(
readFileSync(join(__dirname, '../node_modules/@psf/bitcoincash-ops/index.json'), 'utf8')
)
class Script { class Script {
constructor () { constructor () {