receiveBip321 method

Future<ReceiveResponse> receiveBip321({
  1. String? walletId,
  2. int? amountMsat,
  3. String? description,
  4. Map<String, dynamic>? metadata,
  5. Duration? timeout,
})

Creates a BIP-321 URI using the selected receiving wallet.

Implementation

Future<ReceiveResponse> receiveBip321({
  String? walletId,
  int? amountMsat,
  String? description,
  Map<String, dynamic>? metadata,
  Duration? timeout,
}) async {
  await _initializationFuture;
  walletId ??= _repository.getDefaultWalletIdForReceiving();
  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.receiveBip321(
    wallet,
    amountMsat: amountMsat,
    description: description,
    metadata: metadata,
    timeout: timeout,
  );
}