-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,430 additions
and
1,297 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import bs58check from 'bs58check'; | ||
import { Buffer } from 'buffer'; | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
export function toBase58Check(ethAddress: string, version: number) { | ||
const hash = Buffer.from(ethAddress.slice(2), 'hex'); | ||
const payload = Buffer.allocUnsafe(21); | ||
payload.writeUInt8(version, 0); | ||
hash.copy(payload, 1); | ||
return bs58check.encode(payload); | ||
} | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
export function fromBase58Check(qtumAddress: string) { | ||
const payload = bs58check.decode(qtumAddress); | ||
const buffer = Buffer.from(payload); | ||
return `0x${buffer.toString('hex').slice(2)}`; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './snap'; | ||
export * from './promise'; | ||
export * from './error-helper'; | ||
export * from './address'; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "0.1.0" | ||
"version": "0.2.0-rc.0" | ||
} |
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