payBip321 method

Future<PayResponse> payBip321({
  1. String? walletId,
  2. required String payment,
  3. int? amountMsat,
  4. String? payerNote,
  5. Map<String, dynamic>? metadata,
  6. Duration? timeout,
})

Pays an instruction from a BIP-321 URI using the selected wallet.

Implementation

Future<PayResponse> payBip321({
  String? walletId,
  required String payment,
  int? amountMsat,
  String? payerNote,
  Map<String, dynamic>? metadata,
  Duration? timeout,
}) async {
  await _initializationFuture;
  walletId ??= _repository.getDefaultWalletIdForSending();
  if (walletId == null) {
    throw StateError('No default wallet set');
  }
  final wallet = await _getWalletForOperation(walletId);
  final provider = _providers[wallet.type];
  if (provider == null) {
    throw ArgumentError('No provider for wallet type: ${wallet.type}');
  }
  return provider.payBip321(
    wallet,
    payment: payment,
    amountMsat: amountMsat,
    payerNote: payerNote,
    metadata: metadata,
    timeout: timeout,
  );
}