diff --git a/src/electrumx.js b/src/electrumx.js index df37dfb..e6a876d 100644 --- a/src/electrumx.js +++ b/src/electrumx.js @@ -534,8 +534,6 @@ class ElectrumX { */ async txData (txid) { try { - console.log('bch-js txData() restURL: ', this.restURL) - // Handle single transaction. if (typeof txid === 'string') { const response = await this.axios.get( diff --git a/src/script.js b/src/script.js index 2f039fc..d2e7bc7 100644 --- a/src/script.js +++ b/src/script.js @@ -1,7 +1,14 @@ +import { readFileSync } from 'fs' +import { fileURLToPath } from 'url' +import { dirname, join } from 'path' import Bitcoin from '@psf/bitcoincashjs-lib' -import { createRequire } from 'module' -const require = createRequire(import.meta.url) -const opcodes = require('@psf/bitcoincash-ops') + +// Import the bitcoincash-ops library using ESM methods that don't piss off +// 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 { constructor () {