drift-labs / example-bots

simple tutorial and example bots using drift protocol
54 stars 40 forks source link

Error: Account does not exist #1

Closed krazzarkov closed 2 years ago

krazzarkov commented 2 years ago

Hello,

I am trying to set up and test the example liquidator bot.

I created a new dummy wallet and added a small amount of USDC to my Drift account.

Unfortunately, when I run the liquidator bot I get the following error:

SOL balance: 0.084567455
(node:6808) UnhandledPromiseRejectionWarning: Error: Account does not exist Ak7DzaacxWwKLUFaKfntbcdcoKXzDk56aseSbqYT5MSy
    at AccountClient.fetch (C:\Users\zarko\Desktop\Drift Bot\example-bots\node_modules\@project-serum\anchor\src\program\namespace\account.ts:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6808) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6808) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I am not sure where it's getting this Ak7DzaacxWwKLUFaKfntbcdcoKXzDk56aseSbqYT5MSy account from but it seems to be the cause of the issue.

I am trying to run and test this on mainnet so I'm not sure if that could be the issue.

Any help would be greatly appreciated! :)

crispheaney commented 2 years ago

Hey great to hear you are trying to test out the example liquidator bot!

What network are you connecting to (rpc url) and what program id are you using?

krazzarkov commented 2 years ago

Hey great to hear you are trying to test out the example liquidator bot!

What network are you connecting to (rpc url) and what program id are you using?

Thanks for the quick reply.

I've tried using both https://api.mainnet-beta.solana.com and https://solana-api.projectserum.com for the RPC.

As for the program id, could you slightly elaborate on this? I think this is where the issue is coming from but I'm just too inexperienced with Solana to understand what I need to fix.

In the code I see TOKEN_PROGRAM_ID referenced as well as PublicKey on Lines 14-24 of liquidator-bot.ts

I'm assuming you are referring to this? If you are, I have not edited this as I wasn't sure what needed to be done for it.

Thank you

crispheaney commented 2 years ago

Hey so I'm assuming you changed the rpc url. Since you are using a mainnet rpc connection, you just need to change the sdk to use the mainnet-beta config instead of devnet.

I think you're getting Account does not exist because you're connecting to mainnet but using the devnet sdk config

krazzarkov commented 2 years ago

Hi @crispheaney,

I can't believe I missed that, I must have not been paying attention! Thank you for the help, that fixed my issue :)

crispheaney commented 2 years ago

Awesome, lemme know if you need anything else :)