-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from casper-ecosystem/feature/ed25519-hd-wallet
Implement Ed25519 HD Wallet
- Loading branch information
Showing
19 changed files
with
746 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect } from 'chai'; | ||
import { wordlist as chiWordlist } from '@scure/bip39/wordlists/simplified-chinese'; | ||
|
||
import { CasperHDKey } from './CasperHDKey'; | ||
|
||
describe('CasperHDKey', () => { | ||
it('should generate mnemonic', () => { | ||
const mn = CasperHDKey.newMnemonic(); | ||
|
||
expect(CasperHDKey.validateMnemonic(mn)); | ||
}); | ||
|
||
it('should set user specific wordlist', () => { | ||
CasperHDKey.setWordlist(chiWordlist); | ||
expect(CasperHDKey.getWordlist()).eq(chiWordlist); | ||
}); | ||
|
||
it('should generate 24 length mnemonic', () => { | ||
const mn = CasperHDKey.newMnemonic(24); | ||
|
||
expect(mn.split(' ').length === 24); | ||
}); | ||
|
||
it('should generate 12 length mnemonic', () => { | ||
const mn = CasperHDKey.newMnemonic(12); | ||
|
||
expect(mn.split(' ').length === 12); | ||
}); | ||
|
||
it('should throw error if invalid mnemonic length is provided', () => { | ||
expect(() => CasperHDKey.newMnemonic(10)).to.throw('Invalid word length'); | ||
}); | ||
}); |
Oops, something went wrong.