I am trying to create an account on the stellar Test Network. But whenever I make a request and pass in the public key, I always get this error:
I am using the Javascript documentation from here
1 Answer
As you can see in the URL, you pass "${encodeURIComponent...}" as a string, not as evaluated value. Your code is probably something like:
url = 'https://friendbot(...)?addr=${encodeURIComponent...}';
but should be like:
url = 'https://friendbot(...)?addr=' + encodeURIComponent...;
// or as a template string
url = `https://friendbot(...)?addr=${encodeURIComponent...}`;
...and since the public keys do not contain special characters, it's not neccessary to escape it.
url = 'https://friendbot(...)?addr=' + pair.publicKey();