[wip] ironing out bugs in tx signing procedure

this time learned
- need to have tag and version for the return data
- i think i need to sign the hash of the transaction rather than the transaction
This commit is contained in:
2023-08-14 11:57:20 -06:00
parent 85c42bf136
commit b055d7d137
4 changed files with 42 additions and 4 deletions
+31 -1
View File
@@ -19,9 +19,13 @@ export {
decoded_data,
decode_result,
decode,
encode
encode,
encode_uint,
encode_biguint
}
import * as vdk_binary from './jex_include/local-vdk_binary-0.1.0/dist/vdk_binary.js';
//=============================================================================
//=============================================================================
@@ -519,3 +523,29 @@ is_list
{
return (x instanceof Array);
}
/**
* Encode an non-negative integer into RLP
*/
function
encode_uint
(n: number)
: Uint8Array
{
return encode_biguint(BigInt(n));
}
/**
* Encode an unsigned BigInt into RLP
*/
function
encode_biguint
(n: bigint)
: Uint8Array
{
let bytes : Uint8Array = vdk_binary.bigint_to_bytes(n);
return encode(bytes);
}