[wip] added networkid prefix, still doesn't work
This commit is contained in:
+8
-1
@@ -384,9 +384,16 @@ tx_sign
|
||||
: Promise<{signedTransaction : string}>
|
||||
{
|
||||
let tx_bytes : Uint8Array = (await vdk_aeser.unbaseNcheck(tx_str)).bytes;
|
||||
// thank you ulf
|
||||
// https://github.com/aeternity/protocol/tree/fd179822fc70241e79cbef7636625cf344a08109/consensus#transaction-signature
|
||||
// we sign <<NetworkId, SerializedObject>>
|
||||
// SerializedObject can either be the object or the hash of the object
|
||||
// let's stick with hash for now
|
||||
let network_id : Uint8Array = vdk_binary.encode_utf8('ae_uat');
|
||||
let tx_hash_bytes : Uint8Array = hash(tx_bytes);
|
||||
let sign_data : Uint8Array = vdk_binary.bytes_concat(network_id, tx_hash_bytes);
|
||||
// @ts-ignore yes nacl is stupid
|
||||
let signature : Uint8Array = nacl.sign.detached(tx_hash_bytes, secret_key);
|
||||
let signature : Uint8Array = nacl.sign.detached(sign_data, secret_key);
|
||||
let signed_tx_bytes : Uint8Array = vdk_aeser.signed_tx([signature], tx_bytes);
|
||||
let signed_tx_str : string = await vdk_aeser.baseNcheck('tx', signed_tx_bytes);
|
||||
return {signedTransaction: signed_tx_str};
|
||||
|
||||
Reference in New Issue
Block a user