Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

fix: pretty print PublicKey objects in node and in the browser #29062

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions web3.js/src/publickey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export class PublicKey extends Struct {
return zeroPad;
}

get [Symbol.toStringTag](): string {
return `PublicKey(${this.toString()})`;
}

/**
* Return the base-58 representation of the public key
*/
Expand Down
3 changes: 2 additions & 1 deletion web3.js/test/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4472,7 +4472,8 @@ describe('Connection', function () {

expect(largestAccounts).to.have.length(2);
const largestAccount = largestAccounts[0];
expect(largestAccount.address).to.eql(testTokenAccountPubkey);
expect(largestAccount.address.equals(testTokenAccountPubkey)).to.be
.true;
expect(largestAccount.amount).to.eq('11110');
expect(largestAccount.decimals).to.eq(2);
expect(largestAccount.uiAmount).to.eq(111.1);
Expand Down