ecTransferCombine function

Future<CombineSignedTransactionResult> ecTransferCombine(
  1. Secp256k1KeyIdentity identity,
  2. SignablePayload payloadsRes
)

Implementation

Future<CombineSignedTransactionResult> ecTransferCombine(
  Secp256k1KeyIdentity identity,
  rosetta.SignablePayload payloadsRes,
) async {
  final signatures = [];
  for (final p in payloadsRes.payloads) {
    final hexBytes = blobToHex(await identity.sign(blobFromHex(p.hexBytes)));
    final signedPayload = {
      'signing_payload': p.toJson(),
      'public_key': {
        'hex_bytes': identity.getPublicKey().rawKey.toHex(),
        'curve_type': 'secp256k1',
      },
      'signature_type': 'ecdsa',
      'hex_bytes': hexBytes,
    };
    signatures.add(signedPayload);
  }
  return combine(
    rosetta.ConstructionCombineRequestPart.fromJson({
      'signatures': signatures,
      'unsigned_transaction': payloadsRes.unsignedTransaction,
    }),
  );
}