sendMorpheusTx method

Future<String> sendMorpheusTx(
  1. String senderAddress,
  2. MorpheusAsset morpheusAsset,
  3. HydraPrivate hydraPrivate, {
  4. int? nonce,
})

Implementation

Future<String> sendMorpheusTx(
  String senderAddress,
  MorpheusAsset morpheusAsset,
  HydraPrivate hydraPrivate, {
  int? nonce,
}) async {
  final senderBip44PubKey = hydraPrivate.public.keyByAddress(senderAddress);
  nonce ??= (await getWalletNonce(senderAddress)) + 1;

  final morpheusTx = MorpheusTxBuilder.build(
    _networkConfig.network,
    morpheusAsset,
    senderBip44PubKey.publicKey(),
    nonce,
  );

  final signedTx =
      hydraPrivate.signHydraTransaction(senderAddress, morpheusTx);

  return await sendTx(signedTx.toString());
}