import { getEncodedToken } from'@cashu/cashu-ts'; // we assume that `wallet` already minted `proofs`, as above // or you fetched existing proofs from your app database constproofs = [...]; // array of proofs constpubkey = '02...'; // Your public key const { keep, send } = awaitwallet.ops.send(32, proofs).asP2PK({pubkey}).run(); consttoken = getEncodedToken({ mint:mintUrl, proofs:send }); console.log(token);
constwallet2 = newWallet(mintUrl); // receiving wallet awaitwallet2.loadMint(); // wallet2 is now ready to use constprivkey = '5d...'; // private key for pubkey constreceiveProofs = awaitwallet2.receive(token, {privkey}); // store receiveProofs in your app ..