Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: failed to get info about account <MSOL/USDC address> #196

Open
pra-dan opened this issue Dec 16, 2021 · 4 comments
Open

Error: failed to get info about account <MSOL/USDC address> #196

pra-dan opened this issue Dec 16, 2021 · 4 comments

Comments

@pra-dan
Copy link

pra-dan commented Dec 16, 2021

I am trying to fetch the orderbook just as a starting point to start playing with the project and interact more with serum.

On running

import { Account, Connection, PublicKey } from '@solana/web3.js';
import { Market } from '@project-serum/serum';

let connection = new Connection('https://testnet.solana.com');
// token address: for MSOL/USDC
let marketAddress = new PublicKey('6oGsL2puUgySccKzn9XA9afqF217LfxP5ocq4B3LWsjy');
// program address/PID (IDK) 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
let programAddress = new PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin");
let market = await Market.load(connection, marketAddress, {}, programAddress);
let mainAcc = '6QneB2NPPhBwZWuKxBWnvUCwBY1vFgYrz746PWk';

// Fetching orderbooks
let bids = await market.loadBids(connection);
let asks = await market.loadAsks(connection);
// L2 orderbook data
for (let [price, size] of bids.getL2(20)) {
  console.log(price, size);
}
// Full orderbook data
for (let order of asks) {
  console.log(
    order.orderId,
    order.price,
    order.size,
    order.side, // 'buy' or 'sell'
  );
}

To which I get

/Users/prashantdandriyal/Desktop/Home/github/solidity/serum-interactions/node_modules/@solana/web3.js/lib/index.cjs.js:5459
      throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
            ^

Error: failed to get info about account 6oGsL2puUgySccKzn9XA9afqF217LfxP5ocq4B3LWsjy: FetchError: request to https://testnet.solana.com/ failed, reason: connect ETIMEDOUT 139.178.68.207:443
    at Connection.getAccountInfo (/Users/prashantdandriyal/Desktop/Home/github/solidity/serum-interactions/node_modules/@solana/web3.js/lib/index.cjs.js:5459:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Function.load (/Users/prashantdandriyal/Desktop/Home/github/solidity/serum-interactions/node_modules/@project-serum/serum/lib/market.js:133:45)
    at async file:///Users/prashantdandriyal/Desktop/Home/github/solidity/serum-interactions/src/getOrderbook.js:9:14

I got the address 6oGsL2puUgySccKzn9XA9afqF217LfxP5ocq4B3LWsjy from one of the issues that posted a page to all the pair addresses on Github. I doubt the addresses aren't correct.

@GiveMeSomething
Copy link

The Connection is set to the wrong Solana Cluster

Please try to change it to new Connection('https://solana-api.projectserum.com') as the programAddress is the Serum DEX V3 on Mainnet

Here is a list of public RPC endpoints that you can use:

# Mainnet (recommended): https://solana-api.projectserum.com
# Mainnet (can be unstable): https://api.mainnet-beta.solana.com
# Testnet: https://api.testnet.solana.com
# Devnet: https://api.devnet.solana.com

@TandK8600
Copy link

The Connection is set to the wrong Solana Cluster

Please try to change it to new Connection('https://solana-api.projectserum.com') as the programAddress is the Serum DEX V3 on Mainnet

Here is a list of public RPC endpoints that you can use:

# Mainnet (recommended): https://solana-api.projectserum.com
# Mainnet (can be unstable): https://api.mainnet-beta.solana.com
# Testnet: https://api.testnet.solana.com
# Devnet: https://api.devnet.solana.com

I have the same problem by using the devnet, when I excute the step here:

image

this is the error message:

(node:11984) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
D:\metaplex\code\metaplex\js\node_modules\@solana\web3.js\src\connection.ts:2548
      throw new Error(
            ^
Error: failed to get info about account CggtNXgCye2qk7fLohonNftqaKT35GkuZJwHrRghEvSF: FetchError: request to https://api.devnet.solana.com/ failed, reason: connect ETIMEDOUT 182.50.139.56:443
    at Connection.getAccountInfo (D:\metaplex\code\metaplex\js\node_modules\@solana\web3.js\src\connection.ts:2548:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Function.fetchIdl (D:\metaplex\code\metaplex\js\node_modules\@project-serum\anchor\src\program\index.ts:311:25)
    at async loadCandyProgramV2 (D:\metaplex\code\metaplex\js\packages\cli\src\helpers\accounts.ts:578:15)
    at async Command.<anonymous> (D:\metaplex\code\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:134:27)

I'm Chinese user, but I changed my command line's proxy, I can visit google in my command line, but this error is still exist, could you give me some tips if you have any idea?

thanks!

@GiveMeSomething
Copy link

@TandK8600 Look like your error is a network error, not library related. Maybe try to test the connection using cURL and then solve the network problems before doing anything with your program

curl https://api.devnet.solana.com/haproxy_status
  • From what I experienced in the last few days, Solana public cluster seem to be kind of unstable, sometime returning 502 Bad Gateway or 503 Service Unavailable. And it's specified in your captured document that what you are doing is a network-intensive command. Give it a retry when you see those error codes 😅

@TandK8600
Copy link

Alright, thanks, I've solved it by using AWS but not my computer, and it works.
My friends meet the same problem with me, maybe it is because we are in China, but actually we can visit Google in our command line.
Anyway, I solved my problem, thanks!😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants