This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@gandlaf21/cashu-js
TypeScript icon, indicating that this package has built-in type declarations

0.4.17 • Public • Published

Cashu JS

⚠️ Don't be reckless: This project is in early development, it does however work with real sats! Always use amounts you don't mind loosing.

Cashu JS is a JavaScript library for Cashu wallets written in Typescript.

Wallet Features:

  • [x] connect to mint (load keys)
  • [x] request minting tokens
  • [x] minting tokens
  • [x] sending tokens (get encoded token for chosen value)
  • [x] receiving tokens
  • [x] melting tokens
  • [x] check if tokens are spent
  • [ ] ...

Usage

Install

npm i @gandlaf21/cashu-js

Import

import { CashuMint, CashuWallet } from "@gandlaf21/cashu-js";

const mint = new CashuMint("{MINT_HOST}","{/path/to/api/root/}, {MINT_PORT}")
const keys = await mint.getKeys()
const wallet = new CashuWallet(keys,mint)

const {pr, hash} = await wallet.requestMint(200)

//pay this LN invoice
console.log(pr)

async function invoiceHasBeenPaid() {
const proofs = await wallet.requestTokens(200,hash)
//Encoded proofs can be spent at the mint
const encoded = wallet.getEncodedProofs(proofs)
console.log(encoded)
}

Contribute

Contributions are very welcome.

If you want to contribute, please open an Issue or a PR.

Readme

Keywords

Package Sidebar

Install

npm i @gandlaf21/cashu-js

Weekly Downloads

0

Version

0.4.17

License

ISC

Unpacked Size

115 kB

Total Files

72

Last publish

Collaborators

  • gandlaf21