transferCombine function

Future<CombineSignedTransactionResult> transferCombine(
  1. Ed25519KeyIdentity identity,
  2. SignablePayload payloadsRes
)

Implementation

Future<CombineSignedTransactionResult> transferCombine(
    Ed25519KeyIdentity identity, rosetta.SignablePayload payloadsRes) async {
  var signatures = [];
  for (var p in payloadsRes.payloads) {
    var hexBytes = blobToHex(await identity.sign(blobFromHex(p.hex_bytes)));

    var signedPayload = {
      "signing_payload": p.toJson(),
      "public_key": {
        "hex_bytes": identity.getPublicKey().rawKey.toHex(),
        "curve_type": "edwards25519",
      },
      "signature_type": "ed25519",
      "hex_bytes": hexBytes,
    };
    signatures.add(signedPayload);
  }
  return combine(rosetta.ConstructionCombineRequestPart.fromMap({
    "signatures": signatures,
    "unsigned_transaction": payloadsRes.unsigned_transaction,
  }));
}