build method

Transaction build(
  1. String seed,
  2. int index, {
  3. String? curve = 'ed25519',
  4. String? hashAlgo = 'sha256',
})

Generate the transaction address, keys and signatures @param {String} seed Transaction chain seed (hexadecimal or binary buffer) @param {int} index Number of transaction on the chain @param {String} curve Elliptic curve to use for the key generation @param {String} hashAlgo Hash algorithm to use for the address generation

Implementation

Transaction build(
  String seed,
  int index, {
  String? curve = 'ed25519',
  String? hashAlgo = 'sha256',
}) {
  final keypair = crypto.deriveKeyPair(seed, index, curve: curve!);
  address = crypto.deriveAddress(
    seed,
    index + 1,
    curve: curve,
    hashAlgo: hashAlgo!,
  );
  previousPublicKey = uint8ListToHex(keypair.publicKey);
  previousSignature = uint8ListToHex(
    crypto.sign(previousSignaturePayload(), keypair.privateKey),
  );

  return this;
}