Skip to content
This repository was archived by the owner on Aug 23, 2021. It is now read-only.

filecoin-shipyard/js-filecoin-api-client

Folders and files

NameName
Last commit message
Last commit date
Aug 10, 2019
Aug 30, 2019
Sep 14, 2019
Oct 13, 2018
Feb 11, 2019
Sep 14, 2019
Feb 25, 2019
Feb 25, 2019
Feb 25, 2019
Aug 23, 2021
Sep 14, 2019
Sep 14, 2019
Feb 25, 2019
Feb 25, 2019

Repository files navigation

filecoin-api-client

Status

This repository is in a frozen state. It is not being maintained or kept in sync with the libraries it depends on. This library was designed for an early version of go-filecoin, which is now known as Venus. An API client for Lotus can be found at https://github.com/filecoin-shipyard/js-lotus-client-rpc. Even though work on this repository has been shelved, anyone interested in updating or maintaining this library should express their interest on one Filecoin community conversation mediums: https://github.com/filecoin-project/community#join-the-community.


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: