Kit
Functions

createHttpTransport

createHttpTransport(config): RpcTransport

Creates a function you can use to make POST requests with headers suitable for sending JSON data to a server.

Parameters

ParameterType
configConfig

Returns

RpcTransport

Example

import { createHttpTransport } from '@solana/rpc-transport-http';
 
const transport = createHttpTransport({ url: 'https://api.mainnet-beta.solana.com' });
const response = await transport({
    payload: { id: 1, jsonrpc: '2.0', method: 'getSlot' },
});
const data = await response.json();

On this page