Documents › Wallet Operations › Send
const { keep, send } = await wallet.ops.send(5, myProofs).run();
// Or use prepare() instead of run() to do a dry run preview first
const preview = await wallet.ops.send(5, myProofs).prepare();
const { keep, send } = await wallet.completeSwap(preview);
send and keep.keep is omitted so the wallet may still attempt an offline exact match where possible. This avoids mint fees.const { keep, send } = await wallet.ops
.send(15, myProofs)
.asDeterministic(0, [4, 4]) // counter=0 => auto-reserve; split must include 2x 4's
.keepAsRandom() // change proofs must have random secrets
.run();
Note Passing
counter=0means "reserve counters automatically" using wallet CounterSource.
const { keep, send } = await wallet.ops
.send(10, myProofs)
.asP2PK({ pubkey, locktime: 1712345678 })
.includeFees(true) // sender covers receiver’s future spend fee
.run();
const { keep, send } = await wallet.ops
.send(20, myProofs)
.asFactory(makeOutputData, [4, 8, 8]) // makeOutputData: OutputDataFactory
.keepAsDeterministic() // deterministic change, auto-reserve
.keyset('0123456')
.onCountersReserved((info) => {
console.log('Reserved counters', info);
})
.run();
const mySendData: OutputData[] = [
/* amounts must sum to 15 */
];
const { keep, send } = await wallet.ops.send(15, myProofs).asCustom(mySendData).run();
Exact match only (throws on no exact match):
const { keep, send } = await wallet.ops
.send(7, myProofs)
.offlineExactOnly(/* requireDleq? */ false)
.includeFees(true) // optional; applied to the offline selection rules
.run();
Close match allowed (overspend permitted by wallet RGLI):
const { keep, send } = await wallet.ops
.send(7, myProofs)
.offlineCloseMatch(/* requireDleq? */ true) // only proofs with valid DLEQ
.run();
Important Offline modes cannot be combined with custom output types (
asXXXX/keepAsXXXX). The builder will throw:Offline selection cannot be combined with custom output types. Remove send/keep output configuration, or use an online swap.