parseSendRequest method
Parse a ZIP-321 zcash: payment URI (a scanned QR, a deep link — HOSTILE
input) into a WalletSendRequest for the FR-25 prefilled-send seam — the
DECODE inverse of composePaymentUri. SYNCHRONOUS, no money movement: the
adapter runs it through the audited core payment_uri parser against the
wallet's OWN network (so a cross-network URI is the SDK's typed
NetworkMismatch, never a host-supplied-network footgun), and applies the
single-recipient / text-memo seam policy. The bridge crossing
(parsePaymentUri) lives in the adapter — never in the UI layer — so the
prefill flow stays host-VM testable behind a fake. Throws a typed
WalletSendRequestException (malformed / wrong-network / multi-leg /
unsupported-memo) so the host rejects at the seam, never a half-filled
form. WalletSendRequest.fromUri is the public sugar over this.
Implementation
@override
WalletSendRequest parseSendRequest(String uri) {
// The bridge crossing — `parsePaymentUri` is the audited ZIP-321 parser (the
// inverse of the encoder `composePaymentUri` lowers with, the DRY single
// validator). The wallet's OWN network is supplied here, never by the host,
// so a cross-network URI fails typed exactly as a compose would. The
// malformed / wrong-network faults are mapped from the bridge's typed
// `WalletApiError`; the single-leg / text-memo seam policy is enforced by
// the pure mapper (host-VM tested without the native parser).
final List<ParsedPayment> legs;
try {
legs = parsePaymentUri(uri: uri, network: _network);
} on WalletApiError catch (error) {
throw walletSendRequestFaultFromApiError(error);
}
return walletSendRequestFromParsedLegs(legs);
}