yangjian102621 / js-filecoin-api-client

An API client for Filecoin

Home Page:https://npm.im/filecoin-api-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filecoin-api-client

CircleCI branch dependencies Status JavaScript Style Guide

An API client for Filecoin

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: 34/57 60%

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:

About

An API client for Filecoin

https://npm.im/filecoin-api-client

License:Other


Languages

Language:JavaScript 100.0%