rpcpool / yellowstone-vixen

Solana program parsing toolkit
MIT License
55 stars 15 forks source link

Mock: optional RPC endpoint passed into macro #43

Closed tomjohn1028 closed 2 weeks ago

tomjohn1028 commented 2 weeks ago

Looking at the code here: https://github.com/rpcpool/yellowstone-vixen/blob/main/crates/mock/src/lib.rs#L40

I've actually come across a case where I pull some accounts from devnet and some from mainnet for a backend that's dealing with multiple third party smart contracts. In this case, I'm wondering if it would be better for fetch fixture to accept an RPC endpoint as an argument, and then match that pattern on the macro.

kespinola commented 2 weeks ago

@tomjohn1028 correct. With the additions of streams the config was refactored.

# Vixen.toml

[mock]
endpoint = "..."

However you are wanting a mix of devnet and mainnet. The single endpoint would work because once the response is fetched its saved to disk. If you fetch a set from devnet then switch to mainnet the devnet file fixtures are still valid since looked up by address only.

Thoughts?

tomjohn1028 commented 2 weeks ago

If you fetch a set from devnet then switch to mainnet the devnet file fixtures are still valid since looked up by address only.

Fair point and definitely works. Devs will just need to remember to do that