Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

http Transport

http(url?) creates an HTTP transport.

import { http } from '@ivem/core'
 
const transport = http()

Default URL Behavior

  • http() with no argument: uses chain.rpcUrls[0] from client config.
  • http('https://your-rpc.example'): overrides the default URL.

For mainnet, the default URL is https://api.iost.io, so passing a URL is optional.

Request Injection

transport.request = async (method, path, data) => {
  const res = await fetch(`https://rpc-proxy.example/${path}`, {
    method,
    body: data ? JSON.stringify(data) : undefined,
    headers: { 'Content-Type': 'application/json' },
  })
  if (!res.ok) throw new Error(await res.text())
  return res.json()
}

Resolution order:

  1. use transport.request when provided
  2. otherwise use SDK built-in fetcher with url or chain.rpcUrls[0]