This repository was archived by the owner on Oct 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ interface V3ParamsStrict {
71
71
p : number
72
72
}
73
73
74
+ // helpers
75
+ function keyExists ( k : Buffer | undefined | null ) : k is Buffer {
76
+ return k !== undefined && k !== null
77
+ }
78
+
74
79
function validateHexString ( paramName : string , str : string , length ?: number ) {
75
80
if ( str . toLowerCase ( ) . startsWith ( '0x' ) ) {
76
81
str = str . slice ( 2 )
@@ -288,7 +293,7 @@ export default class Wallet {
288
293
public static generate ( icapDirect : boolean = false ) : Wallet {
289
294
if ( icapDirect ) {
290
295
const max = BigInt ( '0x088f924eeceeda7fe92e1f5b0fffffffffffffff' )
291
- while ( true ) {
296
+ for ( ; ; ) {
292
297
const privateKey = randomBytes ( 32 ) as Buffer
293
298
const hex = privateToAddress ( privateKey ) . toString ( 'hex' )
294
299
if ( BigInt ( '0x' + hex ) <= max ) {
@@ -308,7 +313,7 @@ export default class Wallet {
308
313
pattern = new RegExp ( pattern )
309
314
}
310
315
311
- while ( true ) {
316
+ for ( ; ; ) {
312
317
const privateKey = randomBytes ( 32 ) as Buffer
313
318
const address = privateToAddress ( privateKey )
314
319
@@ -665,8 +670,3 @@ export default class Wallet {
665
670
return privateToPublic ( this . privateKey as Buffer ) . equals ( publicKey )
666
671
}
667
672
}
668
-
669
- // helpers
670
- function keyExists ( k : Buffer | undefined | null ) : k is Buffer {
671
- return k !== undefined && k !== null
672
- }
You can’t perform that action at this time.
0 commit comments