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.
An API client for Filecoin
🧩 Currently compatible with Filecoin 0.3.2
npm i filecoin-api-client
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
<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>
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"]'
- actor.ls
- address.default
- address.lookup
- address.ls
- address.new
- bootstrap.ls
- chain.head
- chain.ls
- client.cat
- client.import
- client.listAsks
- client.payments
- client.proposeStorageDeal
- client.queryStorageDeal
- config.get
- config.set
- dag.get
- dht.findPeer
- dht.findProvs
- dht.query
- id
- log.level
- log.ls
- log.tail
- message.send
- message.status
- message.wait
- miner.addAsk
- miner.create
- miner.owner
- miner.pledge
- miner.power
- miner.setPrice
- miner.updatePeerId
- mining.once
- mining.start
- mining.stop
- mpool.ls
- mpool.rm
- mpool.show
- paych.close
- paych.create
- paych.extend
- paych.ls
- paych.reclaim
- paych.redeem
- paych.voucher
- ping
- retrievalClient.retrievePiece
- show.block
- stats.bandwidth
- swarm.connect
- swarm.peers
- version
- wallet.balance
- wallet.export
- wallet.import
Status: 35/57 61%
Feel free to dive in! Open an issue or submit PRs.
The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)