WalletSendRequest constructor

const WalletSendRequest({
  1. required String address,
  2. int? amountZat,
  3. String? memo,
  4. String? label,
  5. bool lockRecipient = false,
  6. String? correlationId,
  7. WalletMachineMemo? machineMemo,
})

Implementation

const WalletSendRequest({
  required this.address,
  this.amountZat,
  this.memo,
  this.label,
  this.lockRecipient = false,
  this.correlationId,
  this.machineMemo,
}) : // ONE memo per payment. A request carrying both a text memo and machine
     // bytes has no honest resolution — something would have to pick, and
     // whichever it picked would be a memo the caller did not choose, written
     // once to a permanent ledger.
     //
     // THE BINDING REFUSAL IS THE ENCODER'S, and this is only its early copy.
     // `convert.rs::encode_payment_uri` rejects both-set typed before any URI
     // exists; that runs in every build and is what actually stops a memo the
     // caller did not choose from reaching a permanent ledger.
     //
     // This assert buys ONE thing: it fires at the construction site, in the
     // host's own debug build, instead of at compose time. It is stripped in
     // release, so it is a developer aid and nothing more.
     //
     // The comment here used to justify the assert-over-throw choice by "this
     // stays a CONST value type". That was vacuous: `WalletMachineMemo`'s
     // constructor is non-const and throwing, so a request carrying one can
     // never be const anyway — precisely the branch the assert exists for
     // (post-build review; corrected).
     assert(
       machineMemo == null || memo == null || memo.length == 0,
       'a payment carries ONE memo: set either `memo` (text the user can '
       'read and edit) or `machineMemo` (opaque host bytes), never both',
     );