filecoin-api-client

0.5.2 • Public • Published

filecoin-api-client

CircleCI branch dependencies Status JavaScript Style Guide

An API client for Filecoin

⚠️ WARNING: Filecoin is under heavy development and breaking changes are highly likely between versions. This library is experimental, incomplete and unsupported by the Filecoin team. It may be broken in part or in entirety.

🧩 Currently compatible with Filecoin 0.3.2

Install

npm i filecoin-api-client

Usage

Node.js

const Filecoin = require('filecoin-api-client')
 
const fc = Filecoin({
  apiAddr: '/ip4/127.0.0.1/tcp/3453/http' // (optional, default)
})
 
// see API below for usage

Browser

<script src="https://unpkg.com/filecoin-api-client/dist/Filecoin.js"></script>
<script>
  const fc = Filecoin({
    apiAddr: '/ip4/127.0.0.1/tcp/3453/http' // (optional, default)
  })
 
  // see API below for usage
</script> 

CORS

In a web browser, the Filecoin API client might encounter an error saying that the origin is not allowed. This is a CORS ("Cross Origin Resource Sharing") failure: Filecoin servers send HTTP headers allowing access to only certain origins by default. You can whitelist the origins that you are calling from by changing your Filecoin config like this:

$ filecoin config api.accessControlAllowOrigin '["http://example.com"]'

API

Status: 35/57 61%

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms:

Package Sidebar

Install

npm i filecoin-api-client

Weekly Downloads

2

Version

0.5.2

License

(Apache-2.0 OR MIT)

Unpacked Size

47.5 kB

Total Files

45

Last publish

Collaborators

  • alanshaw