44using HDWallet . Core ;
55
66
7- namespace HDWallet . Algorand . Tests ;
8-
9- public class Tests
7+ namespace HDWallet . Algorand . Tests
108{
11- [ SetUp ]
12- public void Setup ( )
13- {
14- }
15-
169
17- [ Test ]
18- public void ShouldGeneratedFromMnemonic ( )
10+ public class Tests
1911 {
20- var mnemonic = "segment inhale symptom olive cheese tissue vacuum lazy sketch salt enroll wink oyster hen glory food weasel comic glow legal cute diet fun real" ;
21- var hdWallet = new AlgorandHDWallet ( mnemonic , "" ) ;
22-
23- // var wallet = hdWallet.GetWalletFromPath<AlgorandWallet>("m/44'/283'/0'");
24- var wallet = hdWallet . GetAccount ( 0 ) . GetExternalWallet ( 1 ) ;
25- Console . WriteLine ( "Path: {0}" , wallet . Path ) ;
26- Console . WriteLine ( "Address: {0}" , wallet . Address ) ;
27- Console . WriteLine ( "PublicKey: {0}" , wallet . PublicKeyBytes . ToHexString ( ) ) ;
28- Console . WriteLine ( "PrivateKey: {0}" , wallet . PrivateKeyBytes . ToHexString ( ) ) ;
29-
30- Assert . AreEqual ( expected : "m/44'/283'/0'/0'/1'" , wallet . Path ) ;
31- Assert . AreEqual ( expected : "5RKLKOVRU4WRWEKKI5I5Z6HTRNYA3XD6HGU34ZDRCDLJJ3DYQEOAOEWODY" , wallet . Address ) ;
32- Assert . AreEqual ( expected : "ec54b53ab1a72d1b114a4751dcf8f38b700ddc7e39a9be647110d694ec78811c" , wallet . PublicKeyBytes . ToHexString ( ) ) ;
33- Assert . AreEqual ( expected : "12c1a9991a216b2c8c86110e3bb6813920562e21090126b7813c525906f32f5f" , wallet . PrivateKeyBytes . ToHexString ( ) ) ;
34-
35-
36- // Check Signature agains the one produced by go library.
37- var helloBytes = System . Text . Encoding . ASCII . GetBytes ( "Hello Dear World!" ) ;
38- var sig = wallet . Sign ( helloBytes ) ;
39- var sighex = sig . R . ToHexString ( ) + sig . S . ToHexString ( ) ;
40- Console . WriteLine ( "Signature: {0}" , sighex ) ;
41- Assert . AreEqual ( expected : "9db2f34d61c94d5c5cf84e3cc8f63203319ca827dd7d26071f298f93c8465e4665c83effdccc2db72839a02d812b4ab1c38fbdd662d42e7d4a15ff307abb1303" , sighex ) ;
12+ [ SetUp ]
13+ public void Setup ( )
14+ {
15+ }
16+
17+
18+ [ Test ]
19+ public void ShouldGeneratedFromMnemonic ( )
20+ {
21+ var mnemonic = "segment inhale symptom olive cheese tissue vacuum lazy sketch salt enroll wink oyster hen glory food weasel comic glow legal cute diet fun real" ;
22+ var hdWallet = new AlgorandHDWallet ( mnemonic , "" ) ;
23+
24+ // var wallet = hdWallet.GetWalletFromPath<AlgorandWallet>("m/44'/283'/0'");
25+ var wallet = hdWallet . GetAccount ( 0 ) . GetExternalWallet ( 1 ) ;
26+ Console . WriteLine ( "Path: {0}" , wallet . Path ) ;
27+ Console . WriteLine ( "Address: {0}" , wallet . Address ) ;
28+ Console . WriteLine ( "PublicKey: {0}" , wallet . PublicKeyBytes . ToHexString ( ) ) ;
29+ Console . WriteLine ( "PrivateKey: {0}" , wallet . PrivateKeyBytes . ToHexString ( ) ) ;
30+
31+ Assert . AreEqual ( expected : "m/44'/283'/0'/0'/1'" , wallet . Path ) ;
32+ Assert . AreEqual ( expected : "5RKLKOVRU4WRWEKKI5I5Z6HTRNYA3XD6HGU34ZDRCDLJJ3DYQEOAOEWODY" , wallet . Address ) ;
33+ Assert . AreEqual ( expected : "ec54b53ab1a72d1b114a4751dcf8f38b700ddc7e39a9be647110d694ec78811c" , wallet . PublicKeyBytes . ToHexString ( ) ) ;
34+ Assert . AreEqual ( expected : "12c1a9991a216b2c8c86110e3bb6813920562e21090126b7813c525906f32f5f" , wallet . PrivateKeyBytes . ToHexString ( ) ) ;
35+
36+
37+ // Check Signature agains the one produced by go library.
38+ var helloBytes = System . Text . Encoding . ASCII . GetBytes ( "Hello Dear World!" ) ;
39+ var sig = wallet . Sign ( helloBytes ) ;
40+ var sighex = sig . R . ToHexString ( ) + sig . S . ToHexString ( ) ;
41+ Console . WriteLine ( "Signature: {0}" , sighex ) ;
42+ Assert . AreEqual ( expected : "9db2f34d61c94d5c5cf84e3cc8f63203319ca827dd7d26071f298f93c8465e4665c83effdccc2db72839a02d812b4ab1c38fbdd662d42e7d4a15ff307abb1303" , sighex ) ;
43+ }
4244 }
4345}
0 commit comments