build method
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 transaction, KeyPair keyPair}) build(
String seed,
int index, {
String? curve = 'ed25519',
String? hashAlgo = 'sha256',
bool isSeedHexa = true,
}) {
final keypair = crypto.deriveKeyPair(
seed,
index,
curve: curve!,
isSeedHexa: isSeedHexa,
);
final transactionWithAddressAndPPK = copyWith(
address: Address(
address: crypto.deriveAddress(
seed,
index + 1,
curve: curve,
hashAlgo: hashAlgo!,
isSeedHexa: isSeedHexa,
),
),
previousPublicKey: uint8ListToHex(
Uint8List.fromList(
keypair.publicKey!,
),
),
);
return (
transaction: transactionWithAddressAndPPK.copyWith(
previousSignature: uint8ListToHex(
crypto.sign(
transactionWithAddressAndPPK.previousSignaturePayload(),
keypair.privateKey,
),
),
),
keyPair: keypair
);
}