signTransaction method

Future<Uint8List> signTransaction(
  1. int accountId,
  2. int wallet,
  3. int? signatureId,
  4. List<int> message,
  5. String context,
)

Method to sign a transaction. It's called from rust

Implementation

Future<Uint8List> signTransaction(
  int accountId,
  int wallet,
  int? signatureId,
  List<int> message,
  String context,
) async {
  try {
    return await _handler.signTransaction(
      accountId: accountId,
      wallet: wallet,
      message: message,
      context: LedgerSignatureContext.fromJson(jsonDecode(context)),
      signatureId: signatureId,
    );
  } on LedgerOperationCancelledException {
    throw ErrorCode.cancelled;
  } catch (error) {
    throw ErrorCode.generic;
  }
}