Cashu-TS - v4.0.0-rc3
    Preparing search index...

    DocumentsWallet OperationsReceive

    Receive

    wallet.ops.receive(...) accepts an encoded token string, a decoded Token, or raw Proof[].

    const proofs = await wallet.ops.receive(token).run();

    // Or use prepare() instead of run() to do a dry run preview first
    const preview = await wallet.ops.receive(token).prepare();
    const { keep } = await wallet.completeSwap(preview);

    You can also receive an array of raw proofs directly:

    const oldProofs: Proof[] = [proof1, proof2, proof3, ...];
    const freshProofs = await wallet.ops.receive(oldProofs).run();
    const proofs = await wallet.ops
    .receive(token)
    .asDeterministic() // counter=0 => auto-reserve
    .requireDleq(true) // reject incoming proofs without DLEQ for the selected keyset
    .keyset('0123456')
    .onCountersReserved((c) => console.log('RX counters', c))
    .run();
    const proofs = await wallet.ops
    .receive(token)
    .asP2PK({ pubkey, locktime }) // NUT-11 options for new proofs
    .privkey(['k1', 'k2', 'k3']) // sign incoming P2PK proofs
    .proofsWeHave(myExistingProofs) // helps denomination selection
    .run();
    const proofsA = await wallet.ops
    .receive(tokenA)
    .asFactory(makeOutputData, [8, 4, 16]) // split must include these denoms
    .run();

    const proofsB = await wallet.ops
    .receive(tokenB)
    .asCustom(prebuiltRxOutputs) // amounts must sum to final received amount after fees
    .run();