build method Null safety
Generate the transaction address, keys and signatures @param {String | Uint8List} seed Transaction chain seed (hexadecimal or binary buffer) @param {Integer} 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
TransactionBuilder build(seed, int index, String curve,
{String hashAlgo = 'sha256'}) {
final KeyPair keypair = crypto.deriveKeyPair(seed, index, curve: curve);
final KeyPair nextKeypair =
crypto.deriveKeyPair(seed, index + 1, curve: curve);
final Uint8List address =
crypto.hash(nextKeypair.publicKey, algo: hashAlgo);
this.address = address;
previousPublicKey = keypair.publicKey;
validationStamp = DateTime.now().millisecondsSinceEpoch;
previousSignature =
crypto.sign(previousSignaturePayload(), keypair.privateKey);
return this;
}