### GET /getting-started/quickstart.md Source: https://docs.nextblock.io/getting-started/quickstart.md Queries the documentation dynamically by providing a question and an optional goal. ```APIDOC ## GET /getting-started/quickstart.md ### Description Performs a dynamic query against the documentation to retrieve answers and relevant excerpts. ### Method GET ### Endpoint https://docs.nextblock.io/getting-started/quickstart.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the answer. ``` -------------------------------- ### Tip Floor Streaming Usage Example Source: https://docs.nextblock.io/api/examples/rust/tip-floor-stream.md Demonstrates starting a background task for streaming tip floor data and retrieving optimal tip values for transaction submission. ```rust #[tokio::main] async fn main() -> Result<(), Box> { // Connect to NextBlock (see connection.md) // let config = NextBlockConfig::default(); // let mut nextblock_client = create_nextblock_client(config).await?; // Start tip floor streaming in background let stream_handle = tokio::spawn(async move { if let Err(e) = stream_tip_floor( // &mut nextblock_client, "1m".to_string(), // Update every minute ).await { eprintln!("Tip floor streaming error: {}", e); } }); // Example: Use dynamic tips in transaction submission tokio::time::sleep(Duration::from_secs(5)).await; // Wait for initial data let conservative_tip = get_optimal_tip(TipPriority::Conservative).await; let normal_tip = get_optimal_tip(TipPriority::Normal).await; let aggressive_tip = get_optimal_tip(TipPriority::Aggressive).await; println!("Current optimal tips:"); println!(" Conservative: {} lamports", conservative_tip); println!(" Normal: {} lamports", normal_tip); println!(" Aggressive: {} lamports", aggressive_tip); // Use these tips in your transaction submissions // submit_transaction_with_tip(normal_tip).await?; // Keep the stream running stream_handle.await??; Ok(()) } ``` -------------------------------- ### GET /getting-started/contact.md Source: https://docs.nextblock.io/getting-started/contact.md Queries the documentation dynamically by providing a question and an optional goal. ```APIDOC ## GET /getting-started/contact.md ### Description Perform an HTTP GET request on the documentation page URL to query information dynamically. This is useful when specific information is not explicitly present in the page content. ### Method GET ### Endpoint https://docs.nextblock.io/getting-started/contact.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask, written in natural language. - **goal** (string) - Optional - Describes the broader end goal to help tailor the response. ### Response #### Success Response (200) - **answer** (string) - A direct answer to the question. - **excerpts** (array) - Relevant excerpts and sources from the documentation. ``` -------------------------------- ### GET /api/examples/python/connection.md Source: https://docs.nextblock.io/api/examples/python/connection.md Query the documentation dynamically by performing an HTTP GET request on the documentation page URL. ```APIDOC ## GET https://docs.nextblock.io/api/examples/python/connection.md ### Description Perform a query against the documentation to retrieve specific information or context. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/python/connection.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask the documentation. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/golang/tip-floor-stream.md Source: https://docs.nextblock.io/api/examples/golang/tip-floor-stream.md Queries the documentation for specific information by providing a question and an optional goal. ```APIDOC ## GET /api/examples/golang/tip-floor-stream.md ### Description Perform a query against the documentation to retrieve answers, excerpts, or context regarding the documentation content. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/golang/tip-floor-stream.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask the documentation. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### Install Dependencies Source: https://docs.nextblock.io/api/examples/javascript.md Required packages for gRPC communication and Solana blockchain interaction. ```bash npm install @grpc/grpc-js @grpc/proto-loader npm install @solana/web3.js @solana/spl-token npm install typescript @types/node # For TypeScript support # Generate JavaScript gRPC client from nextblock-proto # See https://github.com/nextblock-ag/nextblock-proto for instructions ``` -------------------------------- ### GET /api/examples/golang/connection.md Source: https://docs.nextblock.io/api/examples/golang/connection.md Queries the documentation page dynamically using a natural language question and an optional goal. ```APIDOC ## GET /api/examples/golang/connection.md ### Description Perform an HTTP GET request on the current page URL to retrieve answers to specific questions based on the documentation content. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/golang/connection.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### Usage example for gRPC connection Source: https://docs.nextblock.io/api/examples/golang/connection.md Demonstrates how to invoke the connection helper and manage the connection lifecycle in a main function. ```go func main() { const FrankfurtEndpoint = "frankfurt.nextblock.io:443" apiKey := "" // Prefer TLS by default. conn, err := ConnectToNextblock(FrankfurtEndpoint, apiKey, true) if err != nil { panic(err) } defer conn.Close() // Replace this with your generated client type. // nextblockApiClient := api.NewApiClient(conn) // You can now use the generated client for API calls. } ``` -------------------------------- ### Initialize Go Project Dependencies Source: https://docs.nextblock.io/api/tx-stream/golang.md Commands to initialize the Go module and install required dependencies for the TX Stream client. ```bash go mod init nextblock-tx-stream-example go get github.com/gagliardetto/binary github.com/gagliardetto/solana-go go get google.golang.org/grpc # Generate the TX Stream proto client from the proto specification # In the example repo, dependencies and the generated .go files are already available ``` -------------------------------- ### GET /api/examples/rust/tip-floor-stream.md Source: https://docs.nextblock.io/api/examples/rust/tip-floor-stream.md Perform a query against the documentation to retrieve answers and relevant excerpts based on a specific question and optional goal. ```APIDOC ## GET /api/examples/rust/tip-floor-stream.md ### Description Queries the documentation for specific information by providing a natural language question and an optional end goal. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/rust/tip-floor-stream.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific, self-contained question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/python/tip-floor-stream.md Source: https://docs.nextblock.io/api/examples/python/tip-floor-stream.md Queries the documentation page for specific information using natural language questions. ```APIDOC ## GET /api/examples/python/tip-floor-stream.md ### Description Perform an HTTP GET request on the current page URL to query the documentation dynamically for information not explicitly present in the page. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/python/tip-floor-stream.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask, written in natural language. - **goal** (string) - Optional - Describes the broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/golang/submit-batched-transactions.md Source: https://docs.nextblock.io/api/examples/golang/submit-batched-transactions.md Queries the documentation for specific information by providing a question and an optional goal. ```APIDOC ## GET /api/examples/golang/submit-batched-transactions.md ### Description Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a natural language question. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/golang/submit-batched-transactions.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask the documentation. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/golang/submit-single-transactions.md Source: https://docs.nextblock.io/api/examples/golang/submit-single-transactions.md Queries the documentation page for specific information using natural language. ```APIDOC ## GET /api/examples/golang/submit-single-transactions.md ### Description Queries the current documentation page to retrieve answers, excerpts, or sources based on a natural language question. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/golang/submit-single-transactions.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### Install TX Stream Dependencies Source: https://docs.nextblock.io/api/tx-stream/typescript.md Required packages for gRPC communication and Solana transaction handling. ```bash bun add @grpc/grpc-js @grpc/proto-loader bun add @solana/addresses @solana/codec-strings @solana/kit # Generate the TX Stream proto client from the proto specification # In the example repo, dependencies and the generated .ts files are already available ``` -------------------------------- ### GET /api/examples/javascript/connection.md Source: https://docs.nextblock.io/api/examples/javascript/connection.md Queries the documentation page dynamically to retrieve answers, excerpts, and sources based on a natural language question. ```APIDOC ## GET /api/examples/javascript/connection.md ### Description Queries the documentation page dynamically to retrieve answers, excerpts, and sources based on a natural language question. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/javascript/connection.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask, written in natural language. - **goal** (string) - Optional - Describes the broader end goal to help tailor the response. ``` -------------------------------- ### Basic Keepalive Implementation Source: https://docs.nextblock.io/api/examples/javascript/keepalive.md A simple example of starting a keepalive task with specific ping intervals and failure thresholds. ```typescript // Basic keepalive example async function basicKeepaliveExample(): Promise { console.log('Starting basic keepalive example...'); // Connect to NextBlock (see connection.md) // const config = configFromEnv(); // const connection = await createNextBlockClient(config); // Start keepalive task const keepalivePromise = startKeepaliveTask( // connection.client, { pingInterval: 30000, // Ping every 30 seconds maxConsecutiveFailures: 3, reconnectDelay: 5000, healthCheckEnabled: true, timeout: 15000, } ); console.log('Application running with keepalive...'); // Simulate application work setTimeout(() => { console.log('Application work completed, stopping...'); process.exit(0); }, 300000); // Run for 5 minutes await keepalivePromise; } ``` -------------------------------- ### GET /getting-started.md Source: https://docs.nextblock.io/getting-started Performs a dynamic query against the documentation to retrieve answers and relevant excerpts based on a specific question and optional goal. ```APIDOC ## GET /getting-started.md ### Description Queries the documentation dynamically to receive a direct answer and relevant sources based on the provided question. ### Method GET ### Endpoint https://docs.nextblock.io/getting-started.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask the documentation. - **goal** (string) - Optional - Describes the broader end goal to help tailor the response. ### Response #### Success Response (200) - **answer** (string) - The direct answer to the question. - **excerpts** (array) - Relevant documentation excerpts and sources. ``` -------------------------------- ### GET /api/submit-batched-transactions.md Source: https://docs.nextblock.io/api/submit-batched-transactions.md Query the documentation dynamically by performing a GET request on the page URL. ```APIDOC ## GET /api/submit-batched-transactions.md ### Description Query the documentation dynamically by asking a question. ### Method GET ### Endpoint /api/submit-batched-transactions.md ### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to tailor the answer. ``` -------------------------------- ### Initialize Client and Submit Transaction Source: https://docs.nextblock.io/api/examples/golang/submit-single-transactions.md Sets up the RPC client and demonstrates the main execution flow for building and submitting a transaction with a dynamic tip. ```go func main() { // Initialize random seed rand.Seed(time.Now().UnixNano()) // Set up your configuration signerPrivateKey := solana.MustPrivateKeyFromBase58("your-private-key-here") recipientPubkey := solana.MustPublicKeyFromBase58("recipient-public-key-here") rpcEndpoint := "https://api.mainnet-beta.solana.com" // Use your preferred RPC // Initialize RPC client rpcClient := rpc.New(rpcEndpoint) // Connect to NextBlock (see connection.md for full setup) // conn, err := ConnectToNextblock("frankfurt.nextblock.io:443", "your-api-key", true) // if err != nil { // log.Fatal(err) // } // defer conn.Close() // nextblockApiClient := api.NewApiClient(conn) // Submit transaction with dynamic tip based on priority err := BuildAndSubmitTransaction( nil, // nextblockApiClient, rpcClient, signerPrivateKey, recipientPubkey, 10000, // Transfer amount calculateOptimalTip("normal"), // Dynamic tip based on tip floor ) if err != nil { log.Fatal(err) } } ``` -------------------------------- ### GET https://docs.nextblock.io/api/tx-stream/typescript.md Source: https://docs.nextblock.io/api/tx-stream/typescript.md Query the documentation dynamically by performing an HTTP GET request on the page URL. ```APIDOC ## GET https://docs.nextblock.io/api/tx-stream/typescript.md ### Description Perform an HTTP GET request on the current page URL to retrieve information or answers from the documentation. ### Method GET ### Endpoint https://docs.nextblock.io/api/tx-stream/typescript.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific, self-contained question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the answer. ``` -------------------------------- ### Initialize Go project and dependencies Source: https://docs.nextblock.io/api/examples/golang/connection.md Commands to initialize a Go module and fetch necessary gRPC and Solana dependencies. ```bash go mod init nextblock-example go get google.golang.org/grpc go get github.com/gagliardetto/solana-go # Clone the proto specs and generate the Go client git clone https://github.com/nextblock-ag/nextblock-proto # Follow the Go generation instructions in that repository ``` -------------------------------- ### Initialize Client Configuration Source: https://docs.nextblock.io/api/examples/golang/submit-batched-transactions.md Sets up the Solana RPC client and private key configuration required for transaction building. ```go func main() { // Initialize random seed rand.Seed(time.Now().UnixNano()) // Configuration signerPrivateKey := solana.MustPrivateKeyFromBase58("your-private-key-here") rpcEndpoint := "https://api.mainnet-beta.solana.com" // Initialize RPC client rpcClient := rpc.New(rpcEndpoint) // Connect to NextBlock (see connection.md for full setup) // conn, err := ConnectToNextblock("frankfurt.nextblock.io:443", "your-api-key", true) // if err != nil { // log.Fatal(err) // } // defer conn.Close() // nextblockApiClient := api.NewApiClient(conn) ``` -------------------------------- ### GET https://docs.nextblock.io/api/tx-stream/rust.md Source: https://docs.nextblock.io/api/tx-stream/rust.md Query the documentation dynamically by performing an HTTP GET request on the documentation page URL. ```APIDOC ## GET https://docs.nextblock.io/api/tx-stream/rust.md ### Description Query the documentation dynamically to retrieve information not explicitly present on the page. ### Method GET ### Endpoint https://docs.nextblock.io/api/tx-stream/rust.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to tailor the answer. ``` -------------------------------- ### Initialize dependencies Source: https://docs.nextblock.io/api/examples/golang/tip-floor-stream.md Commands to initialize the Go module, fetch gRPC dependencies, and clone the proto definitions. ```bash go mod init nextblock-tip-floor-example go get google.golang.org/grpc go get github.com/gagliardetto/solana-go # Clone and generate the proto client git clone https://github.com/nextblock-ag/nextblock-proto # Follow the Go generation instructions in the proto repo ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.nextblock.io/api/examples/golang/connection.md Perform an HTTP GET request to the documentation URL with query parameters to retrieve specific information. ```http GET https://docs.nextblock.io/api/examples/golang/connection.md?ask=&goal= ``` -------------------------------- ### Dynamic Tip Strategy and Main Execution Source: https://docs.nextblock.io/api/examples/golang/tip-floor-stream.md Demonstrates how to retrieve dynamic tips based on priority levels and initialize the tip floor stream within a main execution loop. ```go // Example of using dynamic tips in transaction submission func exampleTransactionWithDynamicTip(tipStrategy *TipStrategy) { // Get current optimal tip based on desired priority level currentTip := tipStrategy.GetTip("normal") fmt.Printf("\nExample: Using dynamic tip based on current tip floor data\n") fmt.Printf("Current tip for normal priority: %d lamports\n", currentTip) fmt.Printf("Tip automatically adapts to network conditions\n") fmt.Printf("Higher tips = higher transaction priority\n") // Here you would use this tip amount in your transaction building // See submit-single-transactions.md for complete transaction examples } // Main function demonstrating complete usage func main() { // Configuration apiKey := "<your-api-key-here>" // Replace with your actual API key endpoint := FrankfurtEndpoint // Choose your preferred endpoint if apiKey == "<your-api-key-here>" { log.Fatal("Please set your API key in the code") } // Initialize tip strategy tipStrategy := NewTipStrategy() // Start a goroutine to demonstrate using dynamic tips go func() { ticker := time.NewTicker(2 * time.Minute) defer ticker.Stop() for range ticker.C { exampleTransactionWithDynamicTip(tipStrategy) } }() // Start streaming tip floor data if err := streamTipFloor(endpoint, apiKey, tipStrategy); err != nil { log.Fatalf("Tip floor streaming failed: %v", err) } } ``` -------------------------------- ### GET /api/v2/tipfloor Source: https://docs.nextblock.io/api/examples/http.md Retrieves current tip floor statistics. ```APIDOC ## GET /api/v2/tipfloor ### Description Retrieves the current landed tip percentiles and EMA data. ### Method GET ### Endpoint /api/v2/tipfloor ### Response #### Success Response (200) - **time** (string) - Timestamp of the data. - **landed_tips_25th_percentile** (number) - 25th percentile of landed tips. - **landed_tips_50th_percentile** (number) - 50th percentile of landed tips. - **landed_tips_75th_percentile** (number) - 75th percentile of landed tips. - **landed_tips_95th_percentile** (number) - 95th percentile of landed tips. - **landed_tips_99th_percentile** (number) - 99th percentile of landed tips. - **ema_landed_tips_50th_percentile** (number) - EMA of the 50th percentile landed tips. ### Response Example { "time": "2025-05-13T10:41:45Z", "landed_tips_25th_percentile": 0.0011, "landed_tips_50th_percentile": 0.005000001, "landed_tips_75th_percentile": 0.01555, "landed_tips_95th_percentile": 0.09339195639999975, "landed_tips_99th_percentile": 0.4846427910400001, "ema_landed_tips_50th_percentile": 0.005989477267191758 } ``` -------------------------------- ### Build and Submit Batched Transactions in Golang Source: https://docs.nextblock.io/api/examples/golang/submit-batched-transactions.md This example provides the logic for selecting a random tip wallet, building individual transactions with tips, and preparing them for bundle submission. Replace the placeholder API client type with your generated proto client. ```go package main import ( "context" "fmt" "log" "math/rand" "time" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/programs/system" "github.com/gagliardetto/solana-go/rpc" // Import your generated proto client // "path/to/your/generated/api" ) // NextBlock tip wallets - use these for tipping var NextblockTipWallets = []solana.PublicKey{ solana.MustPublicKeyFromBase58("NEXTbLoCkB51HpLBLojQfpyVAMorm3zzKg7w9NFdqid"), solana.MustPublicKeyFromBase58("nextBLoCkPMgmG8ZgJtABeScP35qLa2AMCNKntAP7Xc"), solana.MustPublicKeyFromBase58("NextbLoCkVtMGcV47JzewQdvBpLqT9TxQFozQkN98pE"), solana.MustPublicKeyFromBase58("NexTbLoCkWykbLuB1NkjXgFWkX9oAtcoagQegygXXA2"), solana.MustPublicKeyFromBase58("NeXTBLoCKs9F1y5PJS9CKrFNNLU1keHW71rfh7KgA1X"), solana.MustPublicKeyFromBase58("NexTBLockJYZ7QD7p2byrUa6df8ndV2WSd8GkbWqfbb"), solana.MustPublicKeyFromBase58("neXtBLock1LeC67jYd1QdAa32kbVeubsfPNTJC1V5At"), solana.MustPublicKeyFromBase58("nEXTBLockYgngeRmRrjDV31mGSekVPqZoMGhQEZtPVG"), } // GetRandomNextblockTipWallet returns a random tip wallet for load balancing func GetRandomNextblockTipWallet() solana.PublicKey { randVal := rand.IntN(len(NextblockTipWallets)) return NextblockTipWallets[randVal] } // BuildTransaction creates a single transaction with tip and instructions func BuildTransaction( rpcClient *rpc.Client, signerPrivateKey solana.PrivateKey, blockhash solana.Hash, tipAmount uint64, instructions []solana.Instruction, ) (*solana.Transaction, error) { txBuilder := solana.NewTransactionBuilder() txBuilder.SetFeePayer(signerPrivateKey.PublicKey()) txBuilder.SetRecentBlockHash(blockhash) // Add tip instruction first (recommended practice) tipInstruction := system.NewTransferInstruction( tipAmount, signerPrivateKey.PublicKey(), GetRandomNextblockTipWallet(), ).Build() txBuilder.AddInstruction(tipInstruction) // Add all provided instructions for _, instruction := range instructions { txBuilder.AddInstruction(instruction) } // Build and sign transaction tx, err := txBuilder.Build() if err != nil { return nil, fmt.Errorf("failed to build transaction: %w", err) } _, err = tx.Sign(func(key solana.PublicKey) *solana.PrivateKey { if key.Equals(signerPrivateKey.PublicKey()) { return &signerPrivateKey } return nil }) if err != nil { return nil, fmt.Errorf("failed to sign transaction: %w", err) } return tx, nil } // BuildAndSubmitBatchTransactions creates and submits multiple transactions as a bundle func BuildAndSubmitBatchTransactions( nextblockApiClient interface{}, // Replace with your generated API client type rpcClient *rpc.Client, signerPrivateKey solana.PrivateKey, ) error { // Get latest blockhash (same for all transactions in bundle) bh, err := rpcClient.GetLatestBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { return fmt.Errorf("failed to get latest blockhash: %w", err) } var transactions []*solana.Transaction // Transaction 1: Setup transaction setupInstructions := []solana.Instruction{ system.NewTransferInstruction( 100000, // 0.0001 SOL signerPrivateKey.PublicKey(), solana.MustPublicKeyFromBase58("recipient1-public-key-here"), ).Build(), } tx1, err := BuildTransaction( rpcClient, signerPrivateKey, bh.Value.Blockhash, 500000, // 0.0005 SOL tip setupInstructions, ) if err != nil { return fmt.Errorf("failed to build transaction 1: %w", err) } transactions = append(transactions, tx1) ``` -------------------------------- ### GET /api/quic-transaction-submission.md Source: https://docs.nextblock.io/api/quic-transaction-submission.md Query the documentation dynamically using natural language. ```APIDOC ## GET /api/quic-transaction-submission.md ### Description Perform a query against the documentation to retrieve specific information or clarification. ### Method GET ### Endpoint `https://docs.nextblock.io/api/quic-transaction-submission.md` ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### Install Dependencies Source: https://docs.nextblock.io/api/examples/javascript/connection.md Required packages for gRPC communication and TypeScript support. ```bash npm install @grpc/grpc-js @grpc/proto-loader npm install @solana/web3.js npm install typescript @types/node # For TypeScript ``` -------------------------------- ### GET /api/examples/rust/submit-single-transactions.md Source: https://docs.nextblock.io/api/examples/rust/submit-single-transactions.md Queries the documentation for specific information by providing a question and an optional goal. ```APIDOC ## GET /api/examples/rust/submit-single-transactions.md ### Description Queries the documentation dynamically by asking a question related to the content. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/rust/submit-single-transactions.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/golang/quic.md Source: https://docs.nextblock.io/api/examples/golang/quic.md Queries the documentation page dynamically to retrieve answers, excerpts, and sources based on a specific question and optional goal. ```APIDOC ## GET /api/examples/golang/quic.md ### Description Performs a dynamic query on the current documentation page to retrieve information not explicitly found in the static content. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/golang/quic.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific, self-contained question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response context. ``` -------------------------------- ### GET /api/tx-stream/http.md?ask= Source: https://docs.nextblock.io/api/tx-stream/http.md Queries the documentation dynamically using natural language. ```APIDOC ## GET /api/tx-stream/http.md?ask= ### Description Performs a query against the documentation to retrieve answers or context not explicitly found on the current page. ### Method GET ### Query Parameters - **ask** (string) - Required - The specific question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### Establish a basic connection Source: https://docs.nextblock.io/api/examples/javascript/connection.md Demonstrates manual client creation with a configuration object. Ensure the channel is closed after use to prevent resource leaks. ```typescript // Basic connection example async function basicConnectionExample() { const config: NextBlockConfig = { endpoint: 'frankfurt.nextblock.io:443', apiKey: '', useTLS: true, timeout: 30000, keepaliveTimeMs: 60000, keepaliveTimeoutMs: 15000, }; try { const connection = await createNextBlockClient(config); console.log('Connected to NextBlock!'); // Your API calls would go here // const response = await connection.client.ping({}); // Clean up connection.channel.close(); } catch (error) { console.error('Connection failed:', error); } } ``` -------------------------------- ### Get Optimal Tip Amount Source: https://docs.nextblock.io/api/examples/rust/submit-single-transactions.md Retrieves the current tip floor value from the API. ```rust async fn get_optimal_tip_amount() -> Result> { // This should call the tip floor API to get current percentiles // For now, return a reasonable default Ok(1_000_000) // 0.001 SOL } ``` -------------------------------- ### Constructing and Signing Batched Transactions in Rust Source: https://docs.nextblock.io/api/examples/rust/submit-batched-transactions.md This example provides the structure for building a transaction bundle, including tip wallet selection and base64 serialization for API submission. ```rust use solana_sdk::{ instruction::Instruction, message::Message, pubkey::Pubkey, signature::{Keypair, Signature, Signer}, system_instruction, transaction::Transaction, hash::Hash, }; use solana_client::rpc_client::RpcClient; use rand::seq::SliceRandom; use std::str::FromStr; // NextBlock tip wallets const NEXTBLOCK_TIP_WALLETS: [&str; 8] = [ "NEXTbLoCkB51HpLBLojQfpyVAMorm3zzKg7w9NFdqid", "nextBLoCkPMgmG8ZgJtABeScP35qLa2AMCNKntAP7Xc", "NextbLoCkVtMGcV47JzewQdvBpLqT9TxQFozQkN98pE", "NexTbLoCkWykbLuB1NkjXgFWkX9oAtcoagQegygXXA2", "NeXTBLoCKs9F1y5PJS9CKrFNNLU1keHW71rfh7KgA1X", "NexTBLockJYZ7QD7p2byrUa6df8ndV2WSd8GkbWqfbb", "neXtBLock1LeC67jYd1QdAa32kbVeubsfPNTJC1V5At", "nEXTBLockYgngeRmRrjDV31mGSekVPqZoMGhQEZtPVG", ]; // Transaction builder for bundle struct TransactionBundle { transactions: Vec, } impl TransactionBundle { fn new() -> Self { Self { transactions: Vec::new(), } } // Add transaction to bundle fn add_transaction(&mut self, transaction: Transaction) -> Self { self.transactions.push(transaction); self } // Get transactions as base64 strings fn to_base64_transactions(&self) -> Result, Box> { self.transactions .iter() .map(|tx| { let serialized = bincode::serialize(tx)?; Ok(base64::encode(serialized)) }) .collect() } } // Build single transaction with tip fn build_transaction_with_tip( payer: &Keypair, recent_blockhash: Hash, tip_amount: u64, instructions: Vec, ) -> Result> { let mut rng = rand::thread_rng(); let tip_wallet_str = NEXTBLOCK_TIP_WALLETS.choose(&mut rng) .ok_or("No tip wallets available")?; let tip_wallet = Pubkey::from_str(tip_wallet_str)?; // Create tip instruction (should be first) let tip_instruction = system_instruction::transfer( &payer.pubkey(), &tip_wallet, tip_amount, ); // Combine instructions let mut all_instructions = vec![tip_instruction]; all_instructions.extend(instructions); // Build and sign transaction let message = Message::new(&all_instructions, Some(&payer.pubkey())); let mut transaction = Transaction::new_unsigned(message); transaction.sign(&[payer], recent_blockhash); Ok(transaction) } ``` -------------------------------- ### Build Arbitrage Bundle Source: https://docs.nextblock.io/api/examples/golang/submit-batched-transactions.md Demonstrates creating a bundle of transactions specifically for arbitrage scenarios with higher tips. ```go // Example: Arbitrage Bundle func BuildArbitrageBundleExample( nextblockApiClient interface{}, rpcClient *rpc.Client, signerPrivateKey solana.PrivateKey, ) error { // Get blockhash bh, err := rpcClient.GetLatestBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { return fmt.Errorf("failed to get latest blockhash: %w", err) } var transactions []*solana.Transaction // Transaction 1: Buy on DEX A buyInstructions := []solana.Instruction{ // Add your DEX buy instructions here system.NewTransferInstruction( 1000000, // Placeholder instruction signerPrivateKey.PublicKey(), solana.MustPublicKeyFromBase58("dex-a-address"), ).Build(), } buyTx, err := BuildTransaction( rpcClient, signerPrivateKey, bh.Value.Blockhash, 2000000, // Higher tip for arbitrage buyInstructions, ) if err != nil { return err } transactions = append(transactions, buyTx) // Transaction 2: Sell on DEX B sellInstructions := []solana.Instruction{ // Add your DEX sell instructions here system.NewTransferInstruction( 1000000, // Placeholder instruction signerPrivateKey.PublicKey(), solana.MustPublicKeyFromBase58("dex-b-address"), ).Build(), } sellTx, err := BuildTransaction( rpcClient, signerPrivateKey, bh.Value.Blockhash, 2000000, // Higher tip for arbitrage sellInstructions, ) if err != nil { return err } transactions = append(transactions, sellTx) fmt.Printf("Arbitrage bundle with %d transactions prepared\n", len(transactions)) // Submit logic similar to above... return nil } ``` -------------------------------- ### GET /api/examples/javascript/submit-single-transactions.md Source: https://docs.nextblock.io/api/examples/javascript/submit-single-transactions.md Perform a query against the documentation to retrieve information or clarification regarding the content. ```APIDOC ## GET /api/examples/javascript/submit-single-transactions.md ### Description Queries the documentation dynamically to retrieve answers, excerpts, or sources based on a specific question. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/javascript/submit-single-transactions.md ### Parameters #### Query Parameters - **ask** (string) - Required - The specific, self-contained question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/examples/javascript/tip-floor-stream.md Source: https://docs.nextblock.io/api/examples/javascript/tip-floor-stream.md Queries the documentation page dynamically to retrieve answers, excerpts, and sources based on a specific question and optional goal. ```APIDOC ## GET /api/examples/javascript/tip-floor-stream.md ### Description Perform an HTTP GET request on the current page URL to query the documentation dynamically for information not explicitly present in the page. ### Method GET ### Endpoint https://docs.nextblock.io/api/examples/javascript/tip-floor-stream.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask, written in natural language. - **goal** (string) - Optional - Describes the broader end goal to help tailor the response. ``` -------------------------------- ### GET /api/authentication.md Source: https://docs.nextblock.io/api/authentication.md Query the documentation dynamically by sending a question to the documentation page URL. ```APIDOC ## GET /api/authentication.md ### Description Perform an HTTP GET request on the current page URL to query the documentation dynamically. ### Method GET ### Endpoint https://docs.nextblock.io/api/authentication.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask. - **goal** (string) - Optional - The broader end goal to help tailor the answer. ``` -------------------------------- ### GET /readme.md Source: https://docs.nextblock.io/readme.md Queries the documentation for information by providing a specific question and an optional end goal. ```APIDOC ## GET /readme.md ### Description Perform an HTTP GET request on the documentation page URL to retrieve answers to specific questions based on the documentation content. ### Method GET ### Endpoint https://docs.nextblock.io/readme.md ### Parameters #### Query Parameters - **ask** (string) - Required - The immediate question to ask, written in natural language. - **goal** (string) - Optional - Describes the broader end goal to help tailor the answer. ```