File tree 4 files changed +30
-32
lines changed
4 files changed +30
-32
lines changed Original file line number Diff line number Diff line change
1
+ import { readFileSync , writeFileSync } from "fs" ;
2
+ import { resolve } from "./utils.mjs" ;
3
+
4
+ const words = readFileSync ( resolve ( "lang-en.txt" ) ) . toString ( ) . trim ( ) . split ( "\n" ) ;
5
+ if ( words . length !== 2048 ) { throw new Error ( "bad list!" ) ; }
6
+
7
+ const lines = [ ] ;
8
+ lines . push ( "#ifndef __BIP39_EN_H__" ) ;
9
+ lines . push ( "#define __BIP39_EN_H__" ) ;
10
+ lines . push ( "" ) ;
11
+ lines . push ( "#ifdef __cplusplus" ) ;
12
+ lines . push ( 'extern "C" {' ) ;
13
+ lines . push ( "#endif /* __cplusplus */" ) ;
14
+ lines . push ( "" ) ;
15
+
16
+ lines . push ( "const char* wordlist_en = " ) ;
17
+ for ( let i = 0 ; i < words . length ; i ++ ) {
18
+ lines . push ( ` "${ words [ i ] } \\0"` ) ;
19
+ }
20
+ lines . push ( " ;" ) ;
21
+
22
+ lines . push ( "" ) ;
23
+ lines . push ( "#ifdef __cplusplus" ) ;
24
+ lines . push ( "}" ) ;
25
+ lines . push ( "#endif /* __cplusplus */" ) ;
26
+ lines . push ( "" ) ;
27
+ lines . push ( "#endif /* __BIP39_EN_H__ */" ) ;
28
+
29
+ writeFileSync ( resolve ( "../src/bip39-en.h" ) , lines . join ( "\n" ) ) ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -2060,4 +2060,4 @@ const char* wordlist_en =
2060
2060
}
2061
2061
#endif /* __cplusplus */
2062
2062
2063
- #endif /* __BIP39_EN_H__ */
2063
+ #endif /* __BIP39_EN_H__ */
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments