WalletSendRequest.fromUri constructor
- WalletSession session,
- String uri, {
- bool lockRecipient = false,
- String? correlationId,
Parse a ZIP-321 zcash: payment URI (a scanned QR, a deep link — HOSTILE
input) into a prefill request, validated against THIS wallet's own network
(the session is the sole network authority — a host can NOT coerce a
wrong-network send; the same network-hiding seam as
WalletSession.composePaymentUri). The audited core payment_uri parser
is the single validator (DRY) — this never re-parses ZIP-321 in Dart.
Throws WalletSendRequestException (typed, payload-free — §5.4) at the SEAM, never a half-filled form:
- WalletSendRequestFault.malformed — not a valid
zcash:request URI. - WalletSendRequestFault.wrongNetwork — valid, but for the other network.
- WalletSendRequestFault.multiplePayments — a multi-leg request; the send form is single-recipient and cannot hold it.
- WalletSendRequestFault.unsupportedMemo — a machine/reserved memo the editable field cannot represent.
The lockRecipient argument is AUTHORITATIVE in both directions (a
scanned pay-a-contact URI often wants the recipient locked; false
overrides even a lock a custom port implementation set on its returned
request). SYNCHRONOUS (the parse is local + sync).
Implementation
factory WalletSendRequest.fromUri(
WalletSession session,
String uri, {
bool lockRecipient = false,
String? correlationId,
}) {
final request = session.parseSendRequest(uri);
return WalletSendRequest(
address: request.address,
amountZat: request.amountZat,
memo: request.memo,
label: request.label,
lockRecipient: lockRecipient,
// The host's own token, never anything read out of the (untrusted) URI.
correlationId: correlationId,
);
}