pay method

Future<String> pay({
  1. required String recipient,
  2. required double amount,
  3. String? dewif,
  4. String? password,
  5. String? mnemonic,
  6. String? cesiumId,
  7. String? cesiumPwd,
  8. Uint8List? cesiumSeed,
  9. String lang = 'english',
  10. int? derivation,
  11. String comment = '',
  12. bool ud = false,
  13. bool useMempool = false,
  14. bool raiseException = false,
})

Pay a given pubkey. This automatically recognizes whether it is an HD wallet or a Cesium wallet. Return 'success' string if the transaction has been successfuly proced, or the specified error

Implementation

Future<String> pay(
    {required String recipient,
    required double amount,
    String? dewif,
    String? password,
    String? mnemonic,
    String? cesiumId,
    String? cesiumPwd,
    Uint8List? cesiumSeed,
    String lang = 'english',
    int? derivation,
    String comment = '',
    bool ud = false,
    bool useMempool = false,
    bool raiseException = false}) async {
  Transaction transaction;

  if (ud) {
    final currentUd = await getCurrentUd();
    amount = amount * currentUd;
  }

  transaction = Transaction(
      recipient: recipient,
      amount: (amount.toPrecision(2) * 100).toInt(),
      dewif: dewif,
      password: password,
      mnemonic: mnemonic,
      cesiumId: cesiumId,
      cesiumPwd: cesiumPwd,
      cesiumSeed: cesiumSeed,
      derivation: derivation ?? -1,
      comment: comment,
      useMempool: useMempool,
      lang: lang,
      client: _client);

  // Execute transaction
  return await transaction.process(raiseException);
}