Skip to content

Commit

Permalink
fix: setPublicKey failed with hex key
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenLiuxt committed Mar 9, 2022
1 parent eda2296 commit bd95eac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/accountBlock/accountBlock.ts
Expand Up @@ -326,11 +326,11 @@ class AccountBlockClass {
throw err;
}

const publicKeyBase64 = isBase64String(publicKey)
const publicKeyHex = isHexString(publicKey)
? publicKey
: Buffer.from(`${ publicKey }`, 'hex').toString('base64');
const publicKeyHex = isBase64String(publicKey)
? Buffer.from(`${ publicKey }`, 'base64').toString('hex')
: Buffer.from(`${ publicKey }`, 'base64').toString('hex');
const publicKeyBase64 = isHexString(publicKey)
? Buffer.from(`${ publicKey }`, 'hex').toString('base64')
: publicKey;

const address = getAddressFromPublicKey(publicKeyHex);
Expand Down

0 comments on commit bd95eac

Please sign in to comment.