receive method

Future<String> receive({
  1. String? walletId,
  2. required int amountSats,
})

Create a Lightning invoice to receive funds Returns the invoice string

Implementation

Future<String> receive({String? walletId, required int amountSats}) 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.receive(wallet, amountSats);
}