Skip to content

jmwalletd.send

jmwalletd.send

Direct-send helper for jmwalletd.

Thin wrapper around :func:jmwallet.wallet.spend.direct_send that adapts the result for the jmwalletd HTTP API response format.

Attributes

Classes

Functions:

do_direct_send(*, wallet_service: WalletService, mixdepth: int, amount_sats: int, destination: str, max_fee_rate_sat_vb: float = DEFAULT_MAX_FEE_RATE_SAT_VB) -> DirectSendResult async

Build and broadcast a direct (non-coinjoin) transaction.

Delegates entirely to :func:jmwallet.wallet.spend.direct_send. max_fee_rate_sat_vb is forwarded so the daemon can apply the operator's configured cap (settings.wallet.max_fee_rate_sat_vb).

Source code in jmwalletd/src/jmwalletd/send.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
async def do_direct_send(
    *,
    wallet_service: WalletService,
    mixdepth: int,
    amount_sats: int,
    destination: str,
    max_fee_rate_sat_vb: float = DEFAULT_MAX_FEE_RATE_SAT_VB,
) -> DirectSendResult:
    """Build and broadcast a direct (non-coinjoin) transaction.

    Delegates entirely to :func:`jmwallet.wallet.spend.direct_send`.
    ``max_fee_rate_sat_vb`` is forwarded so the daemon can apply the
    operator's configured cap (``settings.wallet.max_fee_rate_sat_vb``).
    """
    from jmcore.paths import get_default_data_dir
    from jmwalletd._backend import get_backend

    data_dir: Path = wallet_service.data_dir or get_default_data_dir()
    backend = await get_backend(data_dir, wallet_service=wallet_service)

    # Ensure the wallet is synced before sending.
    await wallet_service.sync()

    logger.info(
        "Direct send: {} sats from mixdepth {} to {} (max fee rate {:.2f} sat/vB)",
        amount_sats or "sweep",
        mixdepth,
        destination,
        max_fee_rate_sat_vb,
    )

    return await direct_send(
        wallet=wallet_service,
        backend=backend,
        mixdepth=mixdepth,
        amount_sats=amount_sats,
        destination=destination,
        max_fee_rate_sat_vb=max_fee_rate_sat_vb,
    )