0

@solana/web3.js has 2 ways to convert a public key to string. what's the difference between PublicKey.toString() and PublicKey.toBase58()

1 Answer 1

2

They are absolutely identical. In the source code, the toString() method simply returns a call to toBase58(), as seen here:

/**
 * Return the base-58 representation of the public key
 */
toString(): string {
  return this.toBase58();
}

Here is the source for that on GitHub on line 134 in the referenced commit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.