src/js-ipfs-api/index.js
async function maybeApi ({ apiAddress, apiOpts, ipfsConnectionTest, IpfsApi }) {
  try {
    const ipfs = new IpfsApi(apiAddress, apiOpts)
    await ipfsConnectionTest(ipfs)
    return { ipfs, provider, apiAddress }
  } catch (error) {
    console.log('Failed to connect to ipfs-api', apiAddress)
  }
}
async function maybeApi ({ apiAddress, apiOpts, ipfsConnectionTest, IpfsApi }) {
  try {
    const ipfs = new IpfsApi(apiAddress, apiOpts)
    await ipfsConnectionTest(ipfs)
    return { ipfs, provider, apiAddress }
  } catch (error) {
    console.log('Failed to connect to ipfs-api', apiAddress)
  }
}
async function maybeApi ( { apiAddress , apiOpts , ipfsConnectionTest , IpfsApi } ) { try { const ipfs = new IpfsApi ( apiAddress , apiOpts ) await ipfsConnectionTest ( ipfs ) return { ipfs , provider , apiAddress } } catch ( error ) { console . log ( 'Failed to connect to ipfs-api' , apiAddress ) } }
Helper to construct and test an api client. Returns an js-ipfs-api instance or null
Helper to construct and test an api client . Returns an js - ipfs - api instance or null