### Dynamic Documentation Query Example Source: https://docs.shyft.to/solana-apis/transactions/parsed-transaction-structure Perform an HTTP GET request to query documentation dynamically. Include your question as the value for the `ask` query parameter. ```http GET https://docs.shyft.to/solana-apis/transactions/parsed-transaction-structure.md?ask= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://docs.shyft.to/solana/rpc-calls/http/gethighestsnapshotslot This example shows how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter. Replace with your specific query. ```http GET https://docs.shyft.to/solana/rpc-calls/http/gethighestsnapshotslot.md?ask= ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.shyft.to/solana-indexers/case-studies/drift To get information not directly on the page, make a GET request to the page URL with an 'ask' query parameter containing your question. ```http GET https://docs.shyft.to/solana-indexers/case-studies/drift.md?ask= ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.shyft.to/solana-shredstreaming/yellowstone-vs-rabbitstream-comparison Perform an HTTP GET request to query documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language. ```http GET https://docs.shyft.to/solana-shredstreaming/yellowstone-vs-rabbitstream-comparison.md?ask= ``` -------------------------------- ### API Query Example Source: https://docs.shyft.to/tutorials/build-nft-gated-dapp Demonstrates how to query documentation dynamically using an HTTP GET request with the `ask` query parameter. This is useful for retrieving specific information or clarifications not explicitly present on the page. ```http GET https://docs.shyft.to/tutorials/build-nft-gated-dapp.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.shyft.to/solana/rpc-calls/solana-websockets/slotupdatessubscribe This example shows how to query the documentation dynamically using an HTTP GET request with the `ask` query parameter. This is useful for retrieving specific information not explicitly present on the page. ```http GET https://docs.shyft.to/solana/rpc-calls/solana-websockets/slotupdatessubscribe.md?ask= ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.shyft.to/solana-indexers/case-studies/raydium-launchpad/get-all-pools-for-a-creator Perform an HTTP GET request to the current page URL with the `ask` query parameter to dynamically query documentation. The question should be specific and in natural language. ```http GET https://docs.shyft.to/solana-indexers/case-studies/raydium-launchpad/get-all-pools-for-a-creator.md?ask= ``` -------------------------------- ### Get Token Account Balance with Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/gettokenaccountbalance This Web3.js example demonstrates how to fetch a token account's balance using the Connection object. It requires the token account's public key and establishes a connection to the Solana cluster. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let tokenAddress = new PublicKey( "48gpnn8nsmkvkgso7462Z1nFhUrprGQ71u1YLBPzizbY", ); let tokenBalance = await connection.getTokenAccountBalance(tokenAddress); console.log(tokenBalance); ``` -------------------------------- ### Get Signatures for Address (Web3.js) Source: https://docs.shyft.to/solana/rpc-calls/http/getsignaturesforaddress This example shows how to use the Solana Web3.js library to fetch transaction signatures for a given address. It configures the connection and specifies options like the limit for the number of signatures. ```javascript import { Connection, PublicKey, clusterApiUrl, type SignaturesForAddressOptions, } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let signaturesOptions: SignaturesForAddressOptions = { limit: 1, }; let address = new PublicKey("Vote111111111111111111111111111111111111111"); let signatures = await connection.getSignaturesForAddress( address, signaturesOptions, ); console.log(signatures); ``` -------------------------------- ### Initialize API Key and Fetch URL Parameters Source: https://docs.shyft.to/dev-guides/solana/fungible-tokens/how-to-get-token-balances Set up your API key and retrieve URL parameters for the API request. Ensure you replace 'YOUR_X_API_KEY' with your actual key. ```javascript const xAPIKey = 'YOUR_X_API_KEY'; //enter your X-API-KEY here const ApiParams = window.location.search.substring(1); //fetching the url params ``` -------------------------------- ### Get Solana Version with Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/isblockhashvalid This Web3.js example demonstrates how to connect to a Solana RPC endpoint and retrieve the current Solana core version. Ensure you have the '@solana/web3.js' library installed. Replace 'YOUR-API-KEY' with your actual API key. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let version = await connection.getVersion(); console.log(version); ``` -------------------------------- ### Candy Machine Monitor Start Response Source: https://docs.shyft.to/solana-apis/candy-machine Example response upon successfully starting a monitor for a Candy Machine. It confirms the monitoring has started and provides the address and network for the monitored Candy Machine. ```json { "success": true, "message": "Monitor started for candy machine", "result": { "address": "8UeV17qdr9pCXB8mMssWnAWUiYVpaaDZVgvZzmE2KMrA", "network": "devnet", "type": "CANDY_MACHINE" } } ``` -------------------------------- ### Create React App Source: https://docs.shyft.to/tutorials/read-all-nfts-from-a-wallet Use this command to set up a new React project for your Dapp. Ensure you have Node.js and npx installed. ```bash npx create-react-app my-first-nft-dapp ``` -------------------------------- ### Setup React Project for NFT Dapp Source: https://docs.shyft.to/tutorials/build-your-first-nft-dapp Creates a new React application using npx. This command sets up the basic boilerplate and file structure for the Dapp. ```bash $ npx create-react-app my-first-nft-dapp ``` -------------------------------- ### Get Signatures Response Example Source: https://docs.shyft.to/solana/rpc-calls/http/getsignaturesforaddress This is an example of the JSON response structure returned by the getSignaturesForAddress RPC call, including signature, slot, and confirmation status. ```json { "jsonrpc": "2.0", "result": [ { "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", "slot": 114, "err": null, "memo": null, "blockTime": null, "confirmationStatus": "finalized" } ], "id": 1 } ``` -------------------------------- ### Install Wallet Adapter and Axios Source: https://docs.shyft.to/tutorials/build-nft-gated-dapp Install necessary packages for wallet connection and network requests. Ensure these are installed before proceeding with the DApp development. ```bash npm install @solana/web3.js @solana/wallet-adapter-phantom ``` ```bash npm install axios ``` -------------------------------- ### Get Signatures For Address (cURL) Source: https://docs.shyft.to/solana/rpc-calls/http/getsignaturesforaddress Example of how to call the getSignaturesForAddress RPC method using cURL. ```APIDOC ## GET /?api_key=YOUR-API-KEY ### Description Returns signatures for confirmed transactions that include the given address in their `accountKeys` list. Returns signatures backwards in time from the provided signature or most recent confirmed block. ### Method POST ### Endpoint https://rpc.shyft.to ### Parameters #### Request Body - **jsonrpc** (string) - Required - The JSON-RPC version. - **id** (number) - Required - The ID of the request. - **method** (string) - Required - The method name, must be `getSignaturesForAddress`. - **params** (array) - Required - An array containing the parameters for the method. - **address** (string) - Required - Account address as base-58 encoded string. - **configuration** (object) - Optional - Configuration object for the query. - **commitment** (string) - Optional - The commitment describes how finalized a block is. Supported values: `confirmed`, `finalized`. Defaults to `finalized`. - **minContextSlot** (number) - Optional - The minimum slot that the request can be evaluated at. - **limit** (number) - Optional - Maximum transaction signatures to return (between 1 and 1,000). - **before** (string) - Optional - Start searching backwards from this transaction signature. - **until** (string) - Optional - Search until this transaction signature. ### Request Example ```json { "jsonrpc": "2.0", "id": 1, "method": "getSignaturesForAddress", "params": [ "Vote111111111111111111111111111111111111111", { "commitment": "finalized", "limit": 1 } ] } ``` ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC version. - **result** (array) - An array of transaction signatures. - **signature** (string) - The transaction signature. - **slot** (number) - The slot in which the transaction was confirmed. - **err** (null) - Error, if any. - **memo** (null) - Memo associated with the transaction, if any. - **blockTime** (null) - The block time, if available. - **confirmationStatus** (string) - The confirmation status of the transaction. - **id** (number) - The ID of the request. #### Response Example ```json { "jsonrpc": "2.0", "result": [ { "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", "slot": 114, "err": null, "memo": null, "blockTime": null, "confirmationStatus": "finalized" } ], "id": 1 } ``` ``` -------------------------------- ### Create a new React App Source: https://docs.shyft.to/tutorials/mint-and-reward-users-with-edition-nfts Use this command to initialize a new React project for building the NFT minting application. Ensure Node.js is installed. ```bash npx create-react-app mint-detach ``` -------------------------------- ### Get Signatures For Address (Web3.js) Source: https://docs.shyft.to/solana/rpc-calls/http/getsignaturesforaddress Example of how to call the getSignaturesForAddress method using the Solana Web3.js library. ```APIDOC ## connection.getSignaturesForAddress() ### Description Retrieves signatures for confirmed transactions that include the specified address. This method is part of the Solana Web3.js library. ### Parameters - **address** (PublicKey) - Required - The public key of the account for which to fetch signatures. - **options** (SignaturesForAddressOptions) - Optional - Configuration options for fetching signatures. - **commitment** (string) - Optional - The commitment level for the query. Defaults to `finalized`. - **limit** (number) - Optional - The maximum number of signatures to return. Must be between 1 and 1,000. - **before** (string) - Optional - Fetch signatures before this signature. - **until** (string) - Optional - Fetch signatures until this signature. ### Request Example ```javascript import { Connection, PublicKey, clusterApiUrl, type SignaturesForAddressOptions, } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let signaturesOptions: SignaturesForAddressOptions = { limit: 1, }; let address = new PublicKey("Vote111111111111111111111111111111111111111"); let signatures = await connection.getSignaturesForAddress( address, signaturesOptions, ); console.log(signatures); ``` ### Response The method returns an array of signature statuses, each containing: - **signature** (string): The transaction signature. - **slot** (number): The slot in which the transaction was confirmed. - **err** (null | object): An error object if the transaction failed, otherwise null. - **memo** (string | null): The memo associated with the transaction, if any. - **blockTime** (number | null): The timestamp of the block, if available. - **confirmationStatus** (string): The confirmation status of the transaction. ``` -------------------------------- ### Get Largest Accounts (Web3.js) Source: https://docs.shyft.to/solana/rpc-calls/http/getlargestaccounts This Web3.js example demonstrates how to fetch the largest accounts using the connection object. It includes configuration for commitment and filtering. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let config: GetLargestAccountsConfig = { commitment: "finalized", filter: "circulating", }; let largestAccounts = await connection.getLargestAccounts(config); console.log(largestAccounts); ``` -------------------------------- ### Get Slot Leaders with Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/getslotleaders This JavaScript snippet demonstrates how to use the web3.js library to call the getSlotLeaders RPC method. Ensure you have the @solana/web3.js package installed. ```javascript import { Connection, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let startSlot = 378037836; let limit = 10; let slotLeaders = await connection.getSlotLeaders(startSlot, limit); console.log(slotLeaders); ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.shyft.to/solana/solana-rpc-limits Perform an HTTP GET request with an 'ask' query parameter to get direct answers and relevant excerpts from the documentation. ```http GET https://docs.shyft.to/solana/solana-rpc-limits.md?ask= ``` -------------------------------- ### Get Signatures for Address (cURL) Source: https://docs.shyft.to/solana/rpc-calls/http/getsignaturesforaddress This example demonstrates how to call the getSignaturesForAddress RPC method using cURL. It specifies the target address and a limit for the number of signatures to retrieve. ```bash curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \ POST -H "Content-Type: application/json" -d ' { "jsonrpc": "2.0", "id": 1, "method": "getSignaturesForAddress", "params": [ "Vote111111111111111111111111111111111111111", { "commitment": "finalized", "limit": 1 } ] } ' ``` -------------------------------- ### Import Solana Web3 and Wallet Adapter Source: https://docs.shyft.to/dev-guides/solana/fungible-tokens/how-to-get-token-balances Import necessary modules from `@solana/web3.js` and `@solana/wallet-adapter-phantom` for wallet connection and network interactions. ```javascript import { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js"; import { PhantomWalletAdapter } from '@solana/wallet-adapter-phantom'; ``` -------------------------------- ### Set up Routes with react-router-dom Source: https://docs.shyft.to/dev-guides/solana/fungible-tokens/how-to-get-token-balances Configure routes for your application using BrowserRouter, Routes, and Route components from react-router-dom. This example sets up a home route for listing all tokens and a view-details route for individual token information. ```javascript import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; ``` ```jsx import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; import ListAll from "./ListAll"; import Details from "./Details"; function App() { return (
} /> } />
); } export default App; ``` -------------------------------- ### Get Highest Snapshot Slot Response Source: https://docs.shyft.to/solana/rpc-calls/http/gethighestsnapshotslot This is an example JSON response for the getHighestSnapshotSlot RPC call. It indicates the highest slot number for both full and incremental snapshots available on the node. ```json { "jsonrpc": "2.0", "result": { "full": 100, "incremental": 110 }, "id": 1 } ``` -------------------------------- ### Get First Available Block with Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/getfirstavailableblock This example shows how to fetch the first available block using the Solana Web3.js library. It initializes a connection and then calls the getFirstAvailableBlock method. ```javascript import { Connection, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let firstAvailableBlock = await connection.getFirstAvailableBlock(); console.log(firstAvailableBlock); ``` -------------------------------- ### Install Node.js and npx on Mac Source: https://docs.shyft.to/tutorials/build-your-first-nft-dapp Installs Node.js using Homebrew and then installs npx globally. Verifies Node.js installation. ```bash $ brew update $ brew install node ``` ```bash $ node -v v18.0.0 // if installed properly, should output the node installed version ``` ```bash $ npm i -g npx ``` -------------------------------- ### Get Inflation Reward using Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/getinfationreward This JavaScript snippet demonstrates how to fetch inflation rewards using the Web3.js library. It requires connection setup and an array of Solana PublicKeys. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let addresses = [ new PublicKey("6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu"), new PublicKey("BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"), ]; let epoch = 2; let inflationReward = await connection.getInflationReward(addresses, epoch); console.log(inflationReward); ``` -------------------------------- ### Example Usage: Fetching DAO Proposals Source: https://docs.shyft.to/solana-indexers/case-studies/solana-governance-realms/get-all-proposals-for-dao Demonstrates how to use the `fetchGovernanceAccounts` and `fetchProposals` functions to retrieve all proposals for a specific DAO realm. Replace 'By2sVGZXwfQq6rAiAM3rNPJ9iQfb5e2QhnF4YjJ4Bip' with the actual realm ID. ```javascript //Fetch governance accounts for Grape DAO realm const govAccounts = await fetchGovernanceAccounts("By2sVGZXwfQq6rAiAM3rNPJ9iQfb5e2QhnF4YjJ4Bip") //Fetch all proposals for the goverance accounts const proposals = await fetchProposals(govAccounts); console.log(proposals); ``` -------------------------------- ### Get Epoch Schedule via Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/getepochschedule Use the Web3.js library to programmatically retrieve the epoch schedule from a Solana cluster. This example demonstrates connecting to the cluster and calling the getEpochSchedule method. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); let epochSchedule = await connection.getEpochSchedule(); console.log(epochSchedule); ``` -------------------------------- ### Get Block Data with Web3.js Source: https://docs.shyft.to/solana/rpc-calls/http/getblock Utilize the Web3.js library to programmatically fetch block details. This example demonstrates connecting to the RPC endpoint and calling the getBlock method with specific parameters. ```javascript import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed"); const slot_number = 377261141; const block = await connection.getBlock( slot_number, { commitment: "finalized", transactionDetails: "full", maxSupportedTransactionVersion: 0, rewards: false, }, ); console.log("block:", block); ```