Giter Club home page Giter Club logo

raydium-swap's People

Contributors

0xcrust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raydium-swap's Issues

Keypair e amount

how is supposed to be the keypair file?
and whats is the amount in ? It is in token? usd? sol?
thanks

Swap : Error processing Instruction 0 : custom program error : 0x2a

Hi,
After numerous swap tests, this error still appears:

Error processing Instruction 0: custom program error: 0x2a
User token input does not match amm

My command (I want to buy the WIF token, EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm, with SOL) :
RUST_LOG=info cargo run swap --keypair ./provider.json --in-token EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm --out-token So11111111111111111111111111111111111111112 --amount-in 1 --pool-cache pools.json --price-cache prices.json

Result :
[2024-07-02T05:44:29Z INFO swap] Read keypair from ./provider.json successfully. Address: GAQCNda9VnJ2B85R6mQriMc6GHuFNx1FgYGQgdrxnHRn
[2024-07-02T05:44:29Z INFO swap] Input token mint=EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm. Output token mint=So11111111111111111111111111111111111111112
[2024-07-02T05:44:29Z INFO swap::api] Fetching liq-pool-infos from pool-cache. path=pools_light.json
[2024-07-02T05:44:29Z INFO swap] User input-tokens ATA balance=0
[2024-07-02T05:44:29Z INFO swap::api] Fetching price-information from price-cache. path=prices.json
[2024-07-02T05:44:29Z INFO swap::api] Fetching price-information from price-cache. path=prices.json
[2024-07-02T05:44:29Z INFO swap] Current price of 1 input token=2.3142282190534473 USD
[2024-07-02T05:44:29Z INFO swap] Current price of 1 output token=148.94342037522634 USD
[2024-07-02T05:44:29Z INFO swap] decimals: 6
[2024-07-02T05:44:29Z INFO swap] min_expected_out =0.09275967007574965
[2024-07-02T05:44:29Z INFO swap] Initiating swap of 1 input tokens for 0.09275967007574965 output. Rate=64.35986699537625 input-tokens/1 output-token
[2024-07-02T05:44:29Z INFO swap] Initializing swap with input tokens as pool base token
[2024-07-02T05:44:32Z INFO swap] Error processing Instruction 0: custom program error: 0x2a

On solscan :
Result / Fail / Program Error: "Instruction #1 Failed - User token input does not match amm"
Instruction Details : #1 - Raydium Liquidity Pool V4: SwapBaseIn (Program Error: "User token input does not match amm")
#1 Unknown Program instruction

Program log: Error: User token input does not match amm
Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 12336 of 200000 compute units
Program returned error: custom program error: 0x2a

I've tested swaps with several tokens and I always get this error.
Any ideas?

Changing pool api

As I see it works with raydiumv2 pool. Is it compatible with raydiumv3 and v4 also?

How to run?

Hi,
thanks for the code.
could you please add a readme file and provide instructions on how to run this code?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.