ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
811 stars 81 forks source link

fix!: trustless gateway brokers no longer take a gateways arg #530

Closed achingbrain closed 1 month ago

achingbrain commented 1 month ago

The trustless gateway block broker should be used with a http gateway router which will supply a default set of gateways in a way usable by other consumers of the Helia routing.

This was mistakenly released in @helia/block-brokers@2.1.2 which has been reverted, this PR will cause @helia/block-brokers@3.0.0 to be released.

Before:

import { createHelia } from 'helia'
import { trustlessGateway } from '@helia/block-brokers'
import { delegatedHTTPRouting } from '@helia/routers'

await createHelia({
  blockBrokers: [
    trustlessGateway({
      gateways: [
        'http://example.com'
      ]
    })
  ],
  routers: [
    delegatedHTTPRouting('https://delegated-ipfs.dev')
  ],
  //... other settings
})

After:

import { createHelia } from 'helia'
import { trustlessGateway } from '@helia/block-brokers'
import { delegatedHTTPRouting, httpGatewayRouting } from '@helia/routers'

await createHelia({
  blockBrokers: [
    trustlessGateway()
  ],
  routers: [
    delegatedHTTPRouting('https://delegated-ipfs.dev'),
    httpGatewayRouting({
      gateways: [
        'http://example.com'
      ]
    })
  ],
  //... other settings
})

BREAKING CHANGE: the gateways init option has been removed from trustless gateway block brokers

Change checklist