Skip to main content

HttpClient

Struct HttpClient 

Source
pub struct HttpClient { /* private fields */ }
Expand description

HTTP client for making API requests

Implementations§

Source§

impl HttpClient

Source

pub fn new() -> Self

Create a new HTTP client with default configuration

Source

pub fn with_config(enable_tracing: bool) -> Self

Create a new HTTP client with custom configuration

Source

pub fn with_base_url(self, base_url: impl Into<String>) -> Self

Set the base URL for all requests

Source

pub fn with_api_key(self, api_key: impl Into<String>) -> Self

Set the API key for authentication

Source

pub fn with_max_response_body_bytes(self, limit: usize) -> Self

Set the maximum number of response-body bytes buffered in memory.

Source

pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Add a custom header to all requests

Source

pub fn with_headers(self, headers: BTreeMap<String, String>) -> Self

Add multiple custom headers

Source§

impl HttpClient

Source

pub async fn send_transaction( &self, request: Option<SendTransactionRequest>, ) -> Result<SendTransactionResponse, ApiOpError<SendTransactionApiError>>

Send a transaction

tx.jup.ag is a Solana RPC-compatible endpoint (compatible where possible) that forwards signed transactions to the Solana cluster through Jupiter’s landing infrastructure. It implements the standard Solana sendTransaction method, so any Solana client can point at it. A success response means the transaction was accepted and forwarded, not that it landed; confirm landing on your own RPC.

It is send-only: getLatestBlockhash, simulateTransaction, and confirmation queries are not served. Keep your own RPC for those.

Authentication: requires your Jupiter API key in the x-api-key header.

Validation:

  • Transaction must be a valid signed Solana transaction with all required signatures
  • Transaction must contain a SOL transfer of >= 1,000,000 lamports (0.001 SOL) to one of the 16 tip receiver accounts
  • Transaction must not exceed the Solana transaction size limit

Tip receiver accounts (16 Jupiter V6 program authorities):

GGztQqQ6pCPaJQnNpXBgELr5cs3WwDakRbh1iEMzjgSJ, 2MFoS3MPtvyQ4Wh4M9pdfPjz6UhVoNbFbGJAskCPCj3h, BQ72nSv9f3PRyRKCBnHLVrerrv37CYTHm5h3s9VSGQDV, 6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB, 4xDsmeTWPNjgSVSS1VTfzFq3iHZhp77ffPkAmkZkdu71, CapuXNQoDviLvU1PxFiizLgPNQCxrsag1uMeyk6zLVps, 9nnLbotNTcUhvbrsA6Mdkx45Sm82G35zo28AqUvjExn8, 6LXutJvKUw8Q5ue2gCgKHQdAN4suWW8awzFVC6XCguFx, HFqp6ErWHY6Uzhj8rFyjYuDya2mXUpYEk8VW75K9PSiY, DSN3j1ykL3obAVNv7ZX49VsFCPe4LqzxHnmtLiPwY6xg, 69yhtoJR4JYPPABZcSNkzuqbaFbwHsCkja1sP1Q2aVT5, HU23r7UoZbqTUuh3vA7emAGztFtqwTeVips789vqxxBw, 3LoAYHuSd7Gh8d7RTFnhvYtiTiefdZ5ByamU42vkzd76, 3CgvbiM3op4vjrrjH2zcrQUwsqh5veNVRjFCB9N6sRoD, GP8StUXNYSZjPikyRsvkTbvRV1GBxMErb59cpeCJnDf1, 7iWnBRRhBCiNXXPhqiGzvvBkKrvFSWqqmxRyu9VyYBxE

Randomise which account you send to across transactions to reduce write-lock contention.

POST /

Source

pub fn send_transaction_builder(&self) -> SendTransactionBuilder<'_>

Start an additive builder for sendTransaction.

Trait Implementations§

Source§

impl Clone for HttpClient

Source§

fn clone(&self) -> HttpClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for HttpClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more