@cashu/cashu-ts
Version:
cashu library for communicating with a cashu mint
19 lines (15 loc) • 700 B
Markdown
```typescript
import { getEncodedToken } from '@cashu/cashu-ts';
// we assume that `wallet` already minted `proofs`, as above
// or you fetched existing proofs from your app database
const proofs = [...]; // array of proofs
const { keep, send } = await wallet.send(32, proofs);
const token = getEncodedToken({ mint: mintUrl, proofs: send });
console.log(token);
const wallet2 = new Wallet(mintUrl); // receiving wallet
await wallet2.loadMint(); // wallet2 is now ready to use
const receiveProofs = await wallet2.receive(token);
// store receiveProofs in your app ..
```