mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
feat(ESM): Converted code base to ESM format, away from CommonJS
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
A Mocha test file for running end-to-end (e2e) tests.
|
||||
*/
|
||||
|
||||
// const mocha = require("mocha")
|
||||
const assert = require('chai').assert
|
||||
// import mocha from "mocha"
|
||||
import chai from 'chai'
|
||||
|
||||
const sendToken = require('./send-token/send-token')
|
||||
import sendToken from './send-token/send-token.js'
|
||||
const { assert } = chai
|
||||
|
||||
describe('#end-to-end tests', () => {
|
||||
describe('#send-tokens', () => {
|
||||
|
||||
@@ -3,12 +3,18 @@
|
||||
IPFS is working.
|
||||
*/
|
||||
|
||||
process.env.IPFS_API = 'http://localhost:5001'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { dirname } from 'path'
|
||||
// process.env.IPFS_API = `https://ipfs-api.fullstack.cash`
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
|
||||
process.env.IPFS_API = 'http://localhost:5001'
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = dirname(__filename)
|
||||
|
||||
describe('#IPFS', () => {
|
||||
it('should upload a file to the server', async () => {
|
||||
const path = `${__dirname.toString()}/ipfs-e2e.js`
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
mocha --timeout=30000 anonymous-rate-limits.js
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
// const RESTURL = `http://localhost:3000/v5/`
|
||||
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
|
||||
// const RESTURL = `https://abc.fullstack.cash/v5/`
|
||||
const RESTURL = 'https://bchn.fullstack.cash/v5/'
|
||||
// const RESTURL = `http://localhost:3000/v5/`
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
const bchjs = new BCHJS({ restURL: RESTURL })
|
||||
|
||||
describe('#anonymous rate limits', () => {
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
- Update the PRO_PASS value with a current PRO_PASSES string used by bch-api.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
|
||||
const PRO_PASS = 'testpassword'
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
const bchjs = new BCHJS({
|
||||
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||
restURL: 'https://abc.fullstack.cash/v5/',
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
- Update the JWT_TOKEN value with a current free-level JWT token.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
|
||||
const JWT_TOKEN =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODhhY2YyMDIyMWMxMDAxMmFkOTQwMSIsImVtYWlsIjoiZGVtb0BkZW1vLmNvbSIsImFwaUxldmVsIjoxMCwicmF0ZUxpbWl0IjozLCJpYXQiOjE2MDQ4NTQ2OTEsImV4cCI6MTYwNzQ0NjY5MX0.iwse0z0KDKHx9graCxcOwj6lSlfKQAb1zLhmjvygvts'
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
const bchjs = new BCHJS({
|
||||
restURL: 'https://api.fullstack.cash/v5/',
|
||||
// restURL: `http://localhost:3000/v5/`,
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
- Update the JWT_TOKEN value with a paid tier JWT token.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
|
||||
const JWT_TOKEN =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODhhY2JmMDIyMWMxMDAxMmFkOTNmZiIsImVtYWlsIjoiY2hyaXMudHJvdXRuZXJAZ21haWwuY29tIiwiYXBpTGV2ZWwiOjQwLCJyYXRlTGltaXQiOjMsImlhdCI6MTYwMzIyNzEwNCwiZXhwIjoxNjA1ODE5MTA0fQ.CV36grzdD36Ht3BwZGHG4XU40CVDzMRw9Ars1x1r27M'
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
const bchjs = new BCHJS({
|
||||
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||
restURL: 'https:/abc.fullstack.cash/v5/',
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
- Update the JWT_TOKEN value with a current indexer-level JWT token.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
|
||||
const JWT_TOKEN =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODhhY2JmMDIyMWMxMDAxMmFkOTNmZiIsImVtYWlsIjoiY2hyaXMudHJvdXRuZXJAZ21haWwuY29tIiwiYXBpTGV2ZWwiOjQwLCJyYXRlTGltaXQiOjMsImlhdCI6MTYwMzIyNzEwNCwiZXhwIjoxNjA1ODE5MTA0fQ.CV36grzdD36Ht3BwZGHG4XU40CVDzMRw9Ars1x1r27M'
|
||||
|
||||
const BCHJS = require('../../../src/bch-js')
|
||||
const bchjs = new BCHJS({
|
||||
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||
restURL: 'https://abc.fullstack.cash/v5/',
|
||||
|
||||
@@ -18,26 +18,33 @@ const RECV_ADDR2 = 'bchtest:qz6yw0kqgfkknfy6jh2jvlfnkzmre3lt2u0pgcckdk'
|
||||
const SATOSHIS_TO_SEND = 1000
|
||||
|
||||
// Instantiate BITBOX.
|
||||
const bitboxLib = '../../../lib/BITBOX'
|
||||
const BITBOXSDK = require(bitboxLib)
|
||||
const BITBOX = new BITBOXSDK({ restURL: 'https://trest.bitcoin.com/v2/' })
|
||||
// const BITBOX = new BITBOXSDK({ restURL: "http://localhost:3000/v2/" })
|
||||
|
||||
// const util = require('util')
|
||||
// Note: Dynamic require with variable - use dynamic import in ESM
|
||||
const bitboxLib = '../../../lib/BITBOX.js'
|
||||
let BITBOXSDK, BITBOX, walletInfo
|
||||
|
||||
// Open the wallet generated with create-wallet.
|
||||
let walletInfo = {}
|
||||
try {
|
||||
walletInfo = require('./wallet.json')
|
||||
} catch (err) {
|
||||
console.log(
|
||||
'Could not open wallet.json. Generate a wallet with create-wallet first.'
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
let SEND_ADDR, SEND_MNEMONIC
|
||||
|
||||
const SEND_ADDR = walletInfo.cashAddress
|
||||
const SEND_MNEMONIC = walletInfo.mnemonic
|
||||
// Load dependencies asynchronously
|
||||
async function loadDependencies () {
|
||||
BITBOXSDK = (await import(bitboxLib)).default
|
||||
BITBOX = new BITBOXSDK({ restURL: 'https://trest.bitcoin.com/v2/' })
|
||||
// const BITBOX = new BITBOXSDK({ restURL: "http://localhost:3000/v2/" })
|
||||
|
||||
try {
|
||||
/* eslint-disable */
|
||||
walletInfo = (await import('./wallet.json', { with: { type: 'json' } })).default
|
||||
/* eslint-enable */
|
||||
} catch (err) {
|
||||
console.log(
|
||||
'Could not open wallet.json. Generate a wallet with create-wallet first.'
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
SEND_ADDR = walletInfo.cashAddress
|
||||
SEND_MNEMONIC = walletInfo.mnemonic
|
||||
}
|
||||
|
||||
async function testSend () {
|
||||
try {
|
||||
@@ -57,7 +64,10 @@ async function testSend () {
|
||||
console.log('Error in testSend: ', err)
|
||||
}
|
||||
}
|
||||
testSend()
|
||||
// Load dependencies then run test
|
||||
loadDependencies().then(() => {
|
||||
testSend()
|
||||
})
|
||||
|
||||
// Build a TX hex with the largest UTXO.
|
||||
async function buildTx1 (recAddr) {
|
||||
|
||||
@@ -17,26 +17,33 @@ const RECV_ADDR1 = 'bchtest:qzfn2mly05t6fjsh5kjj0dqq0jjtct27ng089dgg05'
|
||||
const SATOSHIS_TO_SEND = 1000
|
||||
|
||||
// Instantiate BITBOX.
|
||||
const bitboxLib = '../../../lib/BITBOX'
|
||||
const BITBOXSDK = require(bitboxLib)
|
||||
const BITBOX = new BITBOXSDK({ restURL: 'https://trest.bitcoin.com/v2/' })
|
||||
// const BITBOX = new BITBOXSDK({ restURL: "http://localhost:3000/v2/" })
|
||||
|
||||
// const util = require('util')
|
||||
// Note: Dynamic require with variable - use dynamic import in ESM
|
||||
const bitboxLib = '../../../lib/BITBOX.js'
|
||||
let BITBOXSDK, BITBOX, walletInfo
|
||||
|
||||
// Open the wallet generated with create-wallet.
|
||||
let walletInfo = {}
|
||||
try {
|
||||
walletInfo = require('./wallet.json')
|
||||
} catch (err) {
|
||||
console.log(
|
||||
'Could not open wallet.json. Generate a wallet with create-wallet first.'
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
let SEND_ADDR, SEND_MNEMONIC
|
||||
|
||||
const SEND_ADDR = walletInfo.cashAddress
|
||||
const SEND_MNEMONIC = walletInfo.mnemonic
|
||||
// Load dependencies asynchronously
|
||||
async function loadDependencies () {
|
||||
BITBOXSDK = (await import(bitboxLib)).default
|
||||
BITBOX = new BITBOXSDK({ restURL: 'https://trest.bitcoin.com/v2/' })
|
||||
// const BITBOX = new BITBOXSDK({ restURL: "http://localhost:3000/v2/" })
|
||||
|
||||
try {
|
||||
/* eslint-disable */
|
||||
walletInfo = (await import('./wallet.json', { with: { type: 'json' } })).default
|
||||
/* eslint-enable */
|
||||
} catch (err) {
|
||||
console.log(
|
||||
'Could not open wallet.json. Generate a wallet with create-wallet first.'
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
SEND_ADDR = walletInfo.cashAddress
|
||||
SEND_MNEMONIC = walletInfo.mnemonic
|
||||
}
|
||||
|
||||
async function testSend () {
|
||||
try {
|
||||
@@ -54,7 +61,10 @@ async function testSend () {
|
||||
console.log('Error in testSend: ', err)
|
||||
}
|
||||
}
|
||||
testSend()
|
||||
// Load dependencies then run test
|
||||
loadDependencies().then(() => {
|
||||
testSend()
|
||||
})
|
||||
|
||||
// Build a TX hex with the largest UTXO.
|
||||
async function buildTx1 (recAddr) {
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
|
||||
import lib from '../util/e2e-util.js'
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
@@ -21,8 +23,6 @@ util.inspect.defaultOptions = {
|
||||
const WALLET1 = '../wallet1.json'
|
||||
const WALLET2 = '../wallet2.json'
|
||||
|
||||
const lib = require('../util/e2e-util')
|
||||
|
||||
// The main test function.
|
||||
// Sends a token and reports on how long it takes to show up in SLPDB production.
|
||||
async function sendTokenTest () {
|
||||
@@ -95,6 +95,6 @@ function sleep (ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
sendTokenTest
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
tests.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
openWallet,
|
||||
sendToken,
|
||||
getTestTokenBalance,
|
||||
threeDecimals
|
||||
}
|
||||
|
||||
const SLPSDK = require('../../../lib/SLP')
|
||||
import SLPSDK from '../../../lib/SLP.js'
|
||||
const slpsdk = new SLPSDK()
|
||||
|
||||
const testTokenId =
|
||||
@@ -20,7 +20,11 @@ const testTokenId =
|
||||
// token balance.
|
||||
async function openWallet (filename) {
|
||||
try {
|
||||
const walletInfo = require(filename)
|
||||
// Note: Dynamic imports for JSON files - use createRequire or import with assert
|
||||
// For ESM, we need to handle dynamic JSON imports differently
|
||||
/* eslint-disable */
|
||||
const walletInfo = await import(filename, { with: { type: 'json' } }).then(m => m.default)
|
||||
/* eslint-enable */
|
||||
|
||||
// const walletBalance = await getBalance(walletInfo)
|
||||
// const walletBalance = await slpsdk.Utils.balancesForAddress(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- Start a local copy of bch-api
|
||||
*/
|
||||
|
||||
const BCHJS = require('../../../src/bch-js.js')
|
||||
import BCHJS from '../../../src/bch-js.js'
|
||||
const bchjs = new BCHJS({
|
||||
restURL: 'http://localhost:3000/v5/'
|
||||
})
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
of an e2e test to be properly tested.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS()
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*/
|
||||
|
||||
// Global npm libraries
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
// Local libraries
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
let bchjs
|
||||
|
||||
describe('#psf-slp-indexer', () => {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
TODO
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
const bchjs = new BCHJS({ restURL: process.env.RESTURL })
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS({ restURL: process.env.RESTURL })
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Integration tests for the utxo.js library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#UTXO', () => {
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Integration tests for bchjs dsproof library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#DSProof', () => {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*/
|
||||
|
||||
// Global npm libraries
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
// Local libraries
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
let bchjs
|
||||
|
||||
describe('#psf-slp-indexer', () => {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
TODO
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS()
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
These tests are specific to the ABC chain.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
let bchjs
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
let bchjs
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
Integration tests for the transaction.js library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#Transaction', () => {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
rest.bitcoin.com.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS()
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Integration tests for the utxo.js library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
// const bchjs = new BCHJS({ restURL: 'http://192.168.2.129:3000/v5/' })
|
||||
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
of an e2e test to be properly tested.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
Integration tests for bchjs control library.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const assert = chai.assert
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
describe('#control', () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import util from 'util'
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
const assert = chai.assert
|
||||
const sinon = require('sinon')
|
||||
const util = require('util')
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
describe('#ElectrumX', () => {
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
TODO
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
Integration tests for the bchjs covering SLP tokens.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
rest.bitcoin.com.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
import BCHJS from '../../../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
|
||||
const RESTURL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://testnet3.fullstack.cash/v5/'
|
||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||
|
||||
const BCHJS = require('../../../../src/bch-js')
|
||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Integration tests for bchjs control library.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#control', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const sinon = require('sinon')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#ElectrumX', () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const assert = require('chai').assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#price', () => {
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
TODO
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
const bchjs = new BCHJS()
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
Integration tests for the bchjs covering SLP tokens.
|
||||
*/
|
||||
|
||||
const chai = require('chai')
|
||||
const assert = chai.assert
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
let bchjs
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
// Inspect utility used for debugging.
|
||||
const util = require('util')
|
||||
import util from 'util'
|
||||
const assert = chai.assert
|
||||
let bchjs
|
||||
util.inspect.defaultOptions = {
|
||||
showHidden: true,
|
||||
colors: true,
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
Integration tests for the transaction.js library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#Transaction', () => {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
// Public npm libraries.
|
||||
const assert = require('assert')
|
||||
const Bitcoin = require('@psf/bitcoincashjs-lib')
|
||||
import assert from 'assert'
|
||||
// import { assert } from 'chai'
|
||||
import Bitcoin from '@psf/bitcoincashjs-lib'
|
||||
|
||||
// Mocks
|
||||
const fixtures = require('./fixtures/address.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/address.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
let bchjs
|
||||
|
||||
function flatten (arrays) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
import assert from 'assert'
|
||||
|
||||
// Mocks
|
||||
const fixtures = require('./fixtures/bitcoincash.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/bitcoincash.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
const assert = require('assert')
|
||||
const assert2 = require('chai').assert
|
||||
const axios = require('axios')
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
const sinon = require('sinon')
|
||||
import assert from 'assert'
|
||||
import chai from 'chai'
|
||||
import axios from 'axios'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
import sinon from 'sinon'
|
||||
|
||||
const mockData = require('./fixtures/blockchain-mock')
|
||||
import mockData from './fixtures/blockchain-mock.js'
|
||||
const { assert: assert2 } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#Blockchain', () => {
|
||||
describe('#getBestBlockHash', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const assert = require('assert')
|
||||
const axios = require('axios')
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import assert from 'assert'
|
||||
import axios from 'axios'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
import sinon from 'sinon'
|
||||
const bchjs = new BCHJS()
|
||||
const sinon = require('sinon')
|
||||
|
||||
describe('#Control', () => {
|
||||
let sandbox
|
||||
|
||||
+6
-4
@@ -1,8 +1,10 @@
|
||||
const fixtures = require('./fixtures/crypto.json')
|
||||
const assert = require('assert')
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/crypto.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
import assert from 'assert'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const bchjs = new BCHJS()
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
import { Buffer } from 'safe-buffer'
|
||||
|
||||
describe('#Crypto', () => {
|
||||
describe('#sha256', () => {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Public npm libraries
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const mockData = require('./fixtures/dsproof-mock')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
import mockData from './fixtures/dsproof-mock.js'
|
||||
const { assert } = chai
|
||||
|
||||
let bchjs
|
||||
const txid = 'ee0df780b58f6f24467605b2589c44c3a50fc849fb8f91b89669a4ae0d86bc7e'
|
||||
|
||||
+3
-2
@@ -3,8 +3,9 @@
|
||||
*/
|
||||
|
||||
// Global npm libraries
|
||||
const assert = require('chai').assert
|
||||
const Ecash = require('../../src/ecash')
|
||||
import chai from 'chai'
|
||||
import Ecash from '../../src/ecash.js'
|
||||
const { assert } = chai
|
||||
const uut = new Ecash()
|
||||
|
||||
describe('#eCash', () => {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// Public npm libraries.
|
||||
const assert = require('assert')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
import assert from 'assert'
|
||||
import { Buffer } from 'safe-buffer'
|
||||
|
||||
// Mocks
|
||||
const fixtures = require('./fixtures/ecpair.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/ecpair.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
import axios from 'axios'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
import mockData from './fixtures/electrumx-mock.js'
|
||||
const assert = chai.assert
|
||||
const axios = require('axios')
|
||||
const sinon = require('sinon')
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
const mockData = require('./fixtures/electrumx-mock')
|
||||
|
||||
describe('#ElectrumX', () => {
|
||||
let sandbox
|
||||
beforeEach(() => (sandbox = sinon.createSandbox()))
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
import mockData from './fixtures/encryption-mock.js'
|
||||
const { assert } = chai
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
|
||||
const mockData = require('./fixtures/encryption-mock')
|
||||
|
||||
describe('#Encryption', () => {
|
||||
let sandbox
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ const utxo = [
|
||||
}
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
balance,
|
||||
utxo
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Mock data used for unit testing.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
details: {
|
||||
hash: '000000001c6aeec19265e9cc3ded8ba5ef5e63fae7747f30bf9c02c7bc8883f0',
|
||||
size: 216,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Mock data used for unit testing.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
bestBlockHash:
|
||||
'0000000000000000008e1f65f875703872544aa888c7ca6587f055f8f5fbd4bf',
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@ const dsproof = {
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
dsproof
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ const txHistoryWithUnconfirmed = {
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
utxo,
|
||||
utxos,
|
||||
balance,
|
||||
|
||||
@@ -13,7 +13,7 @@ const failureMock = {
|
||||
publicKey: 'not found'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
successMock,
|
||||
failureMock
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ const paidFileData = {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
uploadData,
|
||||
paymentInfo,
|
||||
mockNewFileModel,
|
||||
|
||||
@@ -77,7 +77,7 @@ const tx = {
|
||||
'0200000001ac1e2e38764f9b81f3ff4317b4bd1a381dbdf311277a736f375d4ce217d3095f010000006a473044022000dd11c41a472f2e54348db996e60864d489429f12d1e044d49ff600b880c9590220715a926404bb0e2731a3795afb341ec1dad3f84ead7d27cd31fcc59abb14738c4121038476128287ac37c7a3cf7e8625fd5f024db1bc3d8e37395abe7bf42fda78d0d9ffffffff02e8030000000000001976a9142fe2c4c5ef359bb2fe1a849f891cecffbcfb4f7788acb0b40000000000001976a9142dbf5e1804c39a497b908c876097d63210c8490288ac00000000'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
balance,
|
||||
utxo,
|
||||
tx
|
||||
|
||||
@@ -209,6 +209,6 @@ const mockRates = {
|
||||
ZWL: '80215.03'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
mockRates
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ const tokenMedia01 = {
|
||||
ps002Compatible: true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
tokenStats,
|
||||
txData,
|
||||
balance,
|
||||
|
||||
@@ -55,7 +55,7 @@ const mockGetInputAddrsOutput = [
|
||||
}
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
mockTx,
|
||||
mockParentTx1,
|
||||
mockGetInputAddrsOutput
|
||||
|
||||
@@ -1411,7 +1411,7 @@ mock503Error.response = {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
mockList,
|
||||
mockToken,
|
||||
mockTokens,
|
||||
|
||||
@@ -769,7 +769,7 @@ const genesisTestOpReturn03 = {
|
||||
qty: '100000000000000000'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
nonSlpTxDetails,
|
||||
slpTxDetails,
|
||||
mockOpReturnData01,
|
||||
|
||||
@@ -476,7 +476,7 @@ const noUtxoErr = {
|
||||
'Key not found in database [bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7]'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
mockUtxoData,
|
||||
mockHydratedUtxos,
|
||||
mockTwoHydratedAddrs,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
const axios = require('axios')
|
||||
const sinon = require('sinon')
|
||||
import assert from 'assert'
|
||||
import axios from 'axios'
|
||||
import sinon from 'sinon'
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
|
||||
|
||||
+7
-5
@@ -1,13 +1,15 @@
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
import assert from 'assert'
|
||||
import { Buffer } from 'safe-buffer'
|
||||
|
||||
// Mocks
|
||||
const fixtures = require('./fixtures/hdnode.json')
|
||||
// const slpFixtures = require('./fixtures/slp/address.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/hdnode.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
// import slpFixtures from './fixtures/slp/address.json' with { type: 'json' }
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
let bchjs
|
||||
|
||||
describe('#HDNode', () => {
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
const axios = require('axios')
|
||||
const sinon = require('sinon')
|
||||
import assert from 'assert'
|
||||
import axios from 'axios'
|
||||
import sinon from 'sinon'
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
let bchjs
|
||||
|
||||
describe('#Mining', () => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const fixtures = require('./fixtures/mnemonic.json')
|
||||
const assert = require('assert')
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/mnemonic.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
import assert from 'assert'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
describe('#Mnemonic', () => {
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
const assert = require('chai').assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const sinon = require('sinon')
|
||||
import chai from 'chai'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
import sinon from 'sinon'
|
||||
|
||||
const mockDataLib = require('./fixtures/price-mocks')
|
||||
import mockDataLib from './fixtures/price-mocks.js'
|
||||
const { assert } = chai
|
||||
let mockData
|
||||
|
||||
describe('#price', () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const chai = require('chai')
|
||||
import chai from 'chai'
|
||||
import axios from 'axios'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
import mockData from './fixtures/psf-slp-indexer-mock.js'
|
||||
const assert = chai.assert
|
||||
const axios = require('axios')
|
||||
const sinon = require('sinon')
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
const mockData = require('./fixtures/psf-slp-indexer-mock')
|
||||
|
||||
describe('#PsfSlpIndexer', () => {
|
||||
let sandbox
|
||||
beforeEach(() => (sandbox = sinon.createSandbox()))
|
||||
|
||||
@@ -3,22 +3,23 @@
|
||||
*/
|
||||
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
const assert2 = require('chai').assert
|
||||
const axios = require('axios')
|
||||
const sinon = require('sinon')
|
||||
// const nock = require("nock") // HTTP mocking
|
||||
import assert from 'assert'
|
||||
import chai from 'chai'
|
||||
import axios from 'axios'
|
||||
import sinon from 'sinon'
|
||||
// import nock from "nock" // HTTP mocking
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
// Used for debugging
|
||||
// const util = require("util")
|
||||
// util.inspect.defaultOptions = { depth: 1 }
|
||||
|
||||
const mockData = require('./fixtures/rawtransaction-mock')
|
||||
import mockData from './fixtures/rawtransaction-mock.js'
|
||||
const { assert: assert2 } = chai
|
||||
// const bchjs = new BCHJS()
|
||||
let bchjs
|
||||
|
||||
describe('#RawTransactions', () => {
|
||||
let sandbox
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// Public npm libraries
|
||||
const assert = require('assert')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
import assert from 'assert'
|
||||
import { Buffer } from 'safe-buffer'
|
||||
|
||||
// Mocks
|
||||
const fixtures = require('./fixtures/script.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/script.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
|
||||
// Unit under test (uut)
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
let bchjs
|
||||
|
||||
describe('#Script', () => {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
const assert = require('assert')
|
||||
import assert from 'assert'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
// const SLP = require("../../src/slp/slp")
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
// import SLP from "../../src/slp/slp.js"
|
||||
// const SLP = new slp({ restURL: "http://fakeurl.com/" })
|
||||
let slp
|
||||
|
||||
const fixtures = require('./fixtures/slp/address.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/slp/address.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
// const axios = require("axios")
|
||||
// const sinon = require("sinon")
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
const assert = require('assert')
|
||||
import assert from 'assert'
|
||||
|
||||
const fixtures = require('./fixtures/slp/ecpair.json')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/slp/ecpair.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
let slp
|
||||
|
||||
// const SLP = require("../../src/slp/slp")
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
Unit tests for the TokenType1 library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
// const axios = require('axios')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
// const SERVER = bchjs.restURL
|
||||
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
// import axios from 'axios'
|
||||
|
||||
// Default to unit tests unless some other value for TEST is passed.
|
||||
if (!process.env.TEST) process.env.TEST = 'unit'
|
||||
// const SERVER = bchjs.restURL
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
// Mock data used for unit tests
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
Unit tests for the TokenType1 library.
|
||||
*/
|
||||
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
// const axios = require("axios")
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
// const SERVER = bchjs.restURL
|
||||
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
// import axios from "axios"
|
||||
|
||||
// Default to unit tests unless some other value for TEST is passed.
|
||||
if (!process.env.TEST) process.env.TEST = 'unit'
|
||||
// const SERVER = bchjs.restURL
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
// Mock data used for unit tests
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
// Public npm libraries
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
const cloneDeep = require('lodash.clonedeep')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import cloneDeep from 'lodash.clonedeep'
|
||||
|
||||
// Unit under test
|
||||
const SLP = require('../../src/slp/slp')
|
||||
import SLP from '../../src/slp/slp.js'
|
||||
|
||||
// Mock data used for unit tests
|
||||
import mockDataLib from './fixtures/slp/mock-utils.js'
|
||||
const { assert } = chai
|
||||
let uut
|
||||
// let SERVER
|
||||
|
||||
const REST_URL = process.env.RESTURL
|
||||
? process.env.RESTURL
|
||||
: 'https://bchn.fullstack.cash/v5/'
|
||||
|
||||
// Mock data used for unit tests
|
||||
const mockDataLib = require('./fixtures/slp/mock-utils')
|
||||
let mockData
|
||||
|
||||
// Default to unit tests unless some other value for TEST is passed.
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
const fixtures = require('./fixtures/transaction-builder.json')
|
||||
const assert = require('assert')
|
||||
const assert2 = require('chai').assert
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
/* eslint-disable */
|
||||
import fixtures from './fixtures/transaction-builder.json' with { type: 'json' }
|
||||
/* eslint-enable */
|
||||
import assert from 'assert'
|
||||
import chai from 'chai'
|
||||
const { assert: assert2 } = chai
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const bchjs = new BCHJS()
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
import { Buffer } from 'safe-buffer'
|
||||
|
||||
describe('#TransactionBuilder', () => {
|
||||
describe('#hashTypes', () => {
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
*/
|
||||
|
||||
// Public npm libraries
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
// const cloneDeep = require('lodash.clonedeep')
|
||||
import chai from 'chai'
|
||||
import sinon from 'sinon'
|
||||
// import cloneDeep from 'lodash.clonedeep'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
// const mockDataLib = require('./fixtures/transaction-mock.js')
|
||||
|
||||
+6
-5
@@ -1,9 +1,10 @@
|
||||
const assert = require('assert')
|
||||
const assert2 = require('chai').assert
|
||||
const axios = require('axios')
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import assert from 'assert'
|
||||
import chai from 'chai'
|
||||
import axios from 'axios'
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
import sinon from 'sinon'
|
||||
const { assert: assert2 } = chai
|
||||
const bchjs = new BCHJS()
|
||||
const sinon = require('sinon')
|
||||
|
||||
describe('#Util', () => {
|
||||
describe('#validateAddress', () => {
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
Unit tests for the utxo.js library.
|
||||
*/
|
||||
|
||||
const sinon = require('sinon')
|
||||
const assert = require('chai').assert
|
||||
import sinon from 'sinon'
|
||||
import chai from 'chai'
|
||||
|
||||
const BCHJS = require('../../src/bch-js')
|
||||
import BCHJS from '../../src/bch-js.js'
|
||||
|
||||
import mockData from './fixtures/utxo-mocks.js'
|
||||
const { assert } = chai
|
||||
const bchjs = new BCHJS()
|
||||
|
||||
const mockData = require('./fixtures/utxo-mocks')
|
||||
|
||||
describe('#utxo', () => {
|
||||
let sandbox
|
||||
beforeEach(() => (sandbox = sinon.createSandbox()))
|
||||
|
||||
Reference in New Issue
Block a user