[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:
@@ -2,4 +2,4 @@
|
||||
{realm, local}.
|
||||
{name, vdk_rlp}.
|
||||
{version, "0.1.0"}.
|
||||
{deps, []}.
|
||||
{deps, ["local-vdk_binary-0.1.0"]}.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user