filecoin-api-client
v0.5.2
Published
API client for Filecoin
Downloads
41
Readme
filecoin-api-client
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
- 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%
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:
- 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)