3 Add template string
source | link

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();

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...};

...and since the public keys do not contain special characters, it's not neccessary to escape it.

url = 'https://friendbot(...)?addr=' + pair.publicKey();

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();
2 added 164 characters in body
source | link

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...};

...and since the public keys do not contain special characters, it's not neccessary to escape it.

url = 'https://friendbot(...)?addr=' + pair.publicKey();

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...};

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...};

...and since the public keys do not contain special characters, it's not neccessary to escape it.

url = 'https://friendbot(...)?addr=' + pair.publicKey();
1
source | link

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...};