Skip to main content
Version: 11.x

Class: HttpTransport

Defined in: src/channel/transport/http.ts:56

The default transport: one POST per request, no connection to keep alive.

nodeUrl, headers and baseFetch are read once at construction, as BatchClient has always done.

You rarely build one yourself — RpcProvider does it from its own options. Pass it explicitly only to share it, or to give several providers the same configured fetch.

Example

const transport = new HttpTransport({
nodeUrl: 'https://starknet-sepolia.public.blastapi.io/rpc/v0_10',
baseFetch: fetch,
});
const myProvider = new RpcProvider({ transport });

Implements

Constructors

Constructor

new HttpTransport(options): HttpTransport

Defined in: src/channel/transport/http.ts:59

Parameters

options

HttpTransportOptions

Returns

HttpTransport

Methods

request()

Call Signature

request(body): Promise<ResponseBody>

Defined in: src/channel/transport/http.ts:69

POSTs the envelope and resolves with the parsed answer. See RpcTransport.request for the contract every transport honours.

Parameters
body

RequestBody

A request envelope, or an array of them for a batch.

Returns

Promise<ResponseBody>

The response envelope, or an array of them.

Implementation of

RpcTransport.request

Call Signature

request(body): Promise<ResponseBody[]>

Defined in: src/channel/transport/http.ts:70

POSTs the envelope and resolves with the parsed answer. See RpcTransport.request for the contract every transport honours.

Parameters
body

RequestBody[]

A request envelope, or an array of them for a batch.

Returns

Promise<ResponseBody[]>

The response envelope, or an array of them.

Implementation of

RpcTransport.request