fix: support creating a PublicKey from a base58 string

This commit is contained in:
Michael Vines
2018-09-30 21:27:55 -07:00
parent 4b2305434e
commit 95efc7c3b0
3 changed files with 21 additions and 7 deletions

View File

@ -23,9 +23,11 @@ test('equals', () => {
]);
const hexKey = new PublicKey('0x300000000000000000000000000000000000000000000000000000000000000');
const decimalKey = new PublicKey('1356938545749799165119972480570561420155507632800475359837393562592731987968');
const base56Key = new PublicKey('CiDwVBFgWV9E5MvXWoLgnEgn2hK7rJikbvfWavzAQz3');
expect(arrayKey.equals(hexKey)).toBeTruthy();
expect(arrayKey.equals(decimalKey)).toBeTruthy();
expect(arrayKey.equals(base56Key)).toBeTruthy();
});
test('isPublicKey', () => {
@ -40,7 +42,6 @@ test('toBase58', () => {
const key2 = new PublicKey('123456789');
expect(key2.toBase58()).toBe('Vj3WURvtMv1mii1vhTqLhcSwVWDRs2E135KtTYUXtTq');
console.log(key2.toBuffer());
});
test('toBuffer', () => {