Instead of passing a Helia instance, you can pass a list of gateways and routers, and a HeliaHTTP instance will be created for you.

interface CreateVerifiedFetchInit {
    allowInsecure?: boolean;
    allowLocal?: boolean;
    dnsResolvers?: DNSResolver[] | DNSResolvers;
    gateways: string[];
    hashers?: MultihashHasher<number>[];
    libp2pConfig?: Partial<Libp2pOptions<ServiceMap>>;
    routers?: string[];
}

Properties

allowInsecure?: boolean

By default we will not connect to any gateways over HTTP addresses, requring HTTPS connections instead. This is because it will cause "mixed-content" errors to appear in the console when running in secure browser contexts.

Pass true here to connect to insecure Gateways as well, this may be useful in testing environments.

Default

false
allowLocal?: boolean

By default we will not connect to any HTTP Gateways providers over local or loopback addresses, this is because they are typically running on remote peers that have published private addresses by mistate.

Pass true here to connect to local Gateways as well, this may be useful in testing environments.

Default

false
dnsResolvers?: DNSResolver[] | DNSResolvers

In order to parse DNSLink records, we need to resolve DNS queries. You can pass a list of DNS resolvers that we will provide to the @helia/ipns instance for you. You must construct them using the dnsJsonOverHttps or dnsOverHttps functions exported from @helia/ipns/dns-resolvers.

We use cloudflare and google's dnsJsonOverHttps resolvers by default.

Default

[dnsJsonOverHttps('https://cloudflare-dns.com/dns-query'),dnsJsonOverHttps('https://dns.google/resolve')]
gateways: string[]
hashers?: MultihashHasher<number>[]

By default sha256, sha512 and identity hashes are supported for retrieval operations. To retrieve blocks by CIDs using other hashes pass appropriate MultihashHashers here.

We will instantiate a libp2p node for you, but if you want to override the libp2p configuration, you can pass it here.

WARNING: We use Object.assign to merge the default libp2p configuration from Helia with the one you pass here, which results in a shallow merge. If you need a deep merge, you should do it yourself before passing the configuration here.

routers?: string[]