1

i've made custom cluster of solana.

I'm trying to connect to it with web3.js like this:

const url = solanaWeb3.clusterApiUrl('http://x.x.x.x:8899/', false);
const solanaConnection = new solanaWeb3.Connection(url, 'confirmed');

but i'm getting this error:

Error: Unknown http cluster: http://x.x.x.x:8899/

Looking at the clusterApiUrl this only accepts :

export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';

is it possibile to change it?

Singh
  • 783
  • 1
  • 6
  • 24

1 Answers1

4

The line

const url = solanaWeb3.clusterApiUrl('testnet', false);

return a string represents your url. please try just line below without using clusterApiUrl()

const solanaConnection = new solanaWeb3.Connection('http://x.x.x.x:8899/');

btw where do you want to use this