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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.