Skip to content

Commit

Permalink
fix: make toBytes actually return the type it's typehint claims
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptopapi997 committed Dec 17, 2022
1 parent d1722b7 commit 032e3a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web3.js/src/publickey.ts
Expand Up @@ -112,7 +112,8 @@ export class PublicKey extends Struct {
* Return the byte array representation of the public key in big endian
*/
toBytes(): Uint8Array {
return this.toBuffer();
const buf = this.toBuffer();
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
}

/**
Expand Down

0 comments on commit 032e3a2

Please sign in to comment.