File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ var sjcl = require('./utils').sjcl;
2
2
3
3
var UInt160 = require ( './uint160' ) . UInt160 ;
4
4
var UInt256 = require ( './uint256' ) . UInt256 ;
5
+ var Base = require ( './base' ) . Base ;
5
6
6
7
function KeyPair ( ) {
7
8
this . _curve = sjcl . ecc . curves [ 'c256' ] ;
@@ -82,7 +83,9 @@ KeyPair.prototype.get_address = function () {
82
83
83
84
var hash = SHA256_RIPEMD160 ( bits ) ;
84
85
85
- return UInt160 . from_bits ( hash ) ;
86
+ var address = UInt160 . from_bits ( hash ) ;
87
+ address . set_version ( Base . VER_ACCOUNT_ID ) ;
88
+ return address ;
86
89
} ;
87
90
88
91
KeyPair . prototype . sign = function ( hash ) {
Original file line number Diff line number Diff line change
1
+ var assert = require ( 'assert' ) ;
2
+ var utils = require ( './testutils' ) ;
3
+ var Seed = utils . load_module ( 'seed' ) . Seed ;
4
+ var config = require ( './testutils' ) . get_config ( ) ;
5
+
6
+ describe ( 'KeyPair' , function ( ) {
7
+ it ( 'can generate an address' , function ( ) {
8
+ var seed = Seed . from_json ( "masterpassphrase" ) ;
9
+ var address = seed . get_key ( ) . get_address ( ) ;
10
+ assert . strictEqual ( address . to_json ( ) , 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh' ) ;
11
+ } ) ;
12
+ } ) ;
13
+
14
+ // vim:sw=2:sts=2:ts=8:et
You can’t perform that action at this time.
0 commit comments