Skip to content

Commit

Permalink
refactor(crypto)!: remove unused addressToHex function
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jun 16, 2021
1 parent ed1cfb5 commit 93f9def
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/utils/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@ export function isAddressValid (address, prefix = 'ak') {
}
}

/**
* Convert base58Check address to hex string
* @rtype (base58CheckAddress: String) => hexAddress: String
* @param {String} base58CheckAddress - Address
* @return {String} Hex string
*/
export function addressToHex (base58CheckAddress) {
return `0x${decodeBase58Check(assertedType(base58CheckAddress, 'ak')).toString('hex')}`
}

/**
* Parse decimal address and return base58Check encoded address with prefix 'ak'
* @rtype (input: String) => address: String
Expand Down
6 changes: 0 additions & 6 deletions test/unit/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ describe('crypto', () => {
salt2.should.be.a('Number')
salt1.should.not.be.equal(salt2)
})
it('Convert base58Check address to hex', () => {
const address = 'ak_Gd6iMVsoonGuTF8LeswwDDN2NF5wYHAoTRtzwdEcfS32LWoxm'
const hex = Crypto.addressToHex(address)
const fromHexAddress = 'ak_' + Crypto.encodeBase58Check(Buffer.from(hex.slice(2), 'hex'))
fromHexAddress.should.be.equal(address)
})
it('Can produce tx hash', () => {
const rlpEncodedTx = unpackTx(txRaw).rlpEncoded
buildTxHash(txRaw).should.be.equal(expectedHash)
Expand Down

0 comments on commit 93f9def

Please sign in to comment.