Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@muirglacier/testcontainers
Advanced tools
A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance for Bitcoin
Similar to testcontainers in the Java ecosystem, this package provides a lightweight,
throwaway instances of regtest
, testnet
or mainnet
provisioned automatically in Docker container.
@muirglacier/testcontainers
encapsulate on top of defi/defichain:v1.x
and directly interface with the Docker REST API.
With @muirglacier/testcontainers
, it allows the JS developers to:
@muirglacier/jellyfish-*
implementation with 100% day 1 compatibility (mono repo!)Install as dev only as you don't need this in production. Please don't use this in production!
npm i defichain
npm i -D @muirglacier/testcontainers
Use your favourite jest runner and start building dApps!
RegTestContainer
setupimport { RegTestDocker } from '@muirglacier/testcontainers'
describe('reg test container', () => {
const container = new RegTestContainer()
beforeEach(async () => {
await container.start()
await container.waitForReady()
})
afterEach(async () => {
await container.stop()
})
it('should getmininginfo and chain should be regtest', async () => {
// Using node.call('method', []), the built-in minimalistic rpc call
const result = await container.call('getmininginfo', [])
expect(result.chain).toStrictEqual('regtest')
})
})
MasterNodeRegTestContainer
with auto-mintingimport { MasterNodeRegTestContainer } from '@muirglacier/testcontainers'
import waitForExpect from "wait-for-expect";
describe('master node pos minting', () => {
const container = new MasterNodeRegTestContainer()
beforeEach(async () => {
await container.start()
await container.waitForReady()
})
afterEach(async () => {
await container.stop()
})
it('should wait until coinbase maturity with spendable balance', async () => {
await container.waitForWalletCoinbaseMaturity()
await waitForExpect(async () => {
const info = await container.getMiningInfo()
expect(info.blocks).toBeGreaterThan(100)
})
// perform utxostoaccount rpc
const address = await container.getNewAddress()
const payload: { [key: string]: string } = {}
payload[address] = "100@0"
await container.call("utxostoaccount", [payload])
})
})
const container = new MasterNodeRegTestContainer()
const rpcURL = await container.getCachedRpcUrl()
// they are dynmaically assigned to host, you can run multiple concurrent tests!
const port = await container.getPort('8555/tcp')
container.call('method', [])
for convenience RPC callsconst container = new MasterNodeRegTestContainer()
await container.start()
await container.waitForReady()
// raw universal calls
const { blocks } = await container.call('getmininginfo')
const address = await container.call('getnewaddress', ['label', 'legacy'])
// basic included types
const count = await container.getBlockCount()
const info = await container.getMiningInfo()
const newAddress = await container.getNewAddress()
FAQs
A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance for Bitcoin
The npm package @muirglacier/testcontainers receives a total of 1 weekly downloads. As such, @muirglacier/testcontainers popularity was classified as not popular.
We found that @muirglacier/testcontainers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.