0.4.17 • Published 2 years ago
@gandlaf21/cashu-js v0.4.17
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:
- connect to mint (load keys)
- request minting tokens
- minting tokens
- sending tokens (get encoded token for chosen value)
- receiving tokens
- melting tokens
- 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.
0.4.9
2 years ago
0.4.8
2 years ago
0.4.17
2 years ago
0.4.15
2 years ago
0.4.16
2 years ago
0.4.13
2 years ago
0.4.14
2 years ago
0.4.11
2 years ago
0.4.12
2 years ago
0.4.5
2 years ago
0.3.6
2 years ago
0.4.4
2 years ago
0.2.6
2 years ago
0.4.7
2 years ago
0.3.7
2 years ago
0.4.1
2 years ago
0.4.0
2 years ago
0.4.3
2 years ago
0.4.2
2 years ago
0.2.5
2 years ago
0.2.4
2 years ago
0.2.3
2 years ago
0.2.2
2 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.0.1
3 years ago