buildTransaction method
Transaction
buildTransaction(
- Transaction transaction,
- String serviceName,
- int index, {
- String? curve = 'ed25519',
- String? hashAlgo = 'sha256',
Implementation
Transaction buildTransaction(
Transaction transaction, String serviceName, int index,
{String? curve = 'ed25519', String? hashAlgo = 'sha256'}) {
final KeyPair keypair = deriveKeypair(serviceName, index: index);
transaction.address =
uint8ListToHex(deriveAddress(serviceName, index: index + 1));
final Uint8List payloadForPreviousSignature =
transaction.previousSignaturePayload();
final Uint8List previousSignature =
crypto.sign(payloadForPreviousSignature, keypair.privateKey);
transaction.setPreviousSignatureAndPreviousPublicKey(
previousSignature, keypair.publicKey);
return transaction;
}