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

This commit is contained in:
Steven Luscher 2022-12-09 11:27:14 -08:00 committed by GitHub
parent ecea802fe6
commit ffcebbbd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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
*/

View File

@ -4518,7 +4518,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);