@cmdcode/core-orm
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

Core ORM

An ORM for Bitcoin Core

Example code:

import { Address }    from '@scrow/tapscript'
import { CoreDaemon } from '@cmdcode/core-orm'

const core = new CoreDaemon()

core.on('ready', async (client) => {
  
  const wallet = await client.get_wallet('test_wallet')
  const addr   = await wallet.newaddress

  console.log('addr:', addr)

  const template = {
    vout : [{
      value : 800_000,
      scriptPubKey : Address.parse(addr).script
    }]
  }

  await wallet.ensure_funds(1_000_000)

  const txdata = await wallet.fund_tx(template)

  console.log(txdata)

  const txid = await wallet.publish_tx(txdata)

  console.log('txid:', txid)

  await core.shutdown()
})

await core.startup()

Readme

Keywords

none

Package Sidebar

Install

npm i @cmdcode/core-orm

Weekly Downloads

9

Version

0.0.10

License

MIT

Unpacked Size

65.4 kB

Total Files

69

Last publish

Collaborators

  • cmd-code