Giter VIP home page Giter VIP logo

js-lotus-client's People

Contributors

alanshaw avatar dependabot[bot] avatar jimpick avatar rvagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

js-lotus-client's Issues

Docs: Production - reverse proxy setups

Reverse-proxies are handy due to browser single-origin policies and for exposing endpoints through firewalls.

I have some configurations to share for nginx and Caddy server that might be useful.

CORS headers are useful for the HTTP endpoint so the API endpoint can be on a separate origin from the app's website. (I think they are not required for Websockets).

Readme Tutorial Link Bug

The link to the official tutorial is resolving as follows:

ipfs resolve -r /ipfs/bafybeifhcj3uvtajrn23zzcdb7vh3dnd6grszu2x4owq5as7j33iigix6q/build/examples/network-inspector/overview/: no link named "examples" under QmbYziR7JMhitn9LcYyQosYZq8VeAjmkdQYuXAvWpFonPB

Filecoin.ClientRetrieve DataSelector

I updated the schema following the instructions in the repo which resulted in a new param becoming available labeled 'DataSelector' . I attempted to use the param to perform a partial retrieval and I was unable to successfully perform the partial retrieval. The Lotus Client instead performed a full retrieval. Execution via CLI works fine. Any assistance would be appreciated.

{ "jsonrpc": "2.0", "id": 1, "method": "Filecoin.ClientRetrieve", "params": [ { "Root": { "/": "QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm" }, "Piece": null, "DataSelector": "Links/0/Hash/Links/0/Hash/5", "Size": 133169152, "Total": "0", "UnsealPrice": "0", "PaymentInterval": 1048576, "PaymentIntervalIncrease": 1048576, "Client": "f1yhlxpl7lg3krlbwqcgtvkyecus5arqpobujfkoy", "Miner": "f08530", "MinerPeer": { "Address": "f010088", "ID": "12D3KooWRDb9V7e5WsHHSZHUtVcR9XgY3BBJSDDYr9YBncXfCjgY", "PieceCID": null } }, null ] }

StorageDealTransferring

If I used clientStartDeal, and this deal keep 'StorageDealTransferring' state for a long time. How can I stop it?:slightly_smiling_face:

Investigate deal failure: publishing deal failed

This happened on the second attempt to store a deal on the miner. A previous attempt succeeded.

2020-04-10T17:28:08.013Z	INFO	provideradapter	storageadapter/provider.go:57	publishing deal
2020-04-10T17:28:08.013Z	INFO	provideradapter	storageadapter/provider.go:93	Jim message&{t05 t3sxk3wbrtf2mvyi3cw6fkqarv2mmkqdnmfd5pqemou2jthuxopljyjzj67ziitotfvrir3foxk527htz2obha 0 0 0 1000000 5 [129 129 130 137 216 42 88 38 0 1 85 193 31 32 134 69 240 28 118 44 76 135 234 37 138 150 11 157 155 1 206 231 235 181 112 146 199 147 43 60 23 177 0 214 20 28 25 2 0 88 49 3 138 34 215 158 101 247 38 87 173 97 18 167 166 49 63 50 104 66 16 43 54 65 28 219 20 233 103 132 222 103 40 96 193 31 64 115 112 28 16 110 113 59 37 21 134 21 114 115 67 0 235 7 25 39 225 25 40 69 67 0 1 244 67 0 1 252 64 88 97 2 134 72 29 43 13 45 148 167 74 196 14 80 134 206 229 51 98 98 71 210 209 87 179 247 83 195 84 116 41 113 58 13 239 129 44 139 15 76 90 82 247 242 102 172 178 85 67 38 0 163 212 199 100 26 175 109 20 250 32 31 128 24 227 175 89 168 111 172 135 107 140 59 122 190 28 248 201 205 185 186 5 249 55 102 109 5 231 190 50 203 202 122 24 18 153 125]}
2020-04-10T17:28:08.020Z	INFO	provideradapter	storageadapter/provider.go:98	Jim message cidbafy2bzaceaper4vvd37e6pltmdfhr6ejnu2bb3m4mdlb7ipwdnsho2sb62ya4
2020-04-10T17:28:20.059Z	WARN	providerstates	providerstates/provider_states.go:294	deal bafyreicchptmul6ydocvjgknege2elglojcx25zx3xvxo5nabwhdzcalzu failed: error calling node: publishing deal: publishing deal failed: exit 1

Lotus version:

0.3.0+gite4b5f1df.dirty+api0.2.0
lotus version 0.3.0+gite4b5f1df.dirty

(April 7th, running in Testground with 2048 byte sectors)

Docs: Intro to the JSON-RPC API

Purpose: demystify the API

Potential topics / sections:

  • node vs. miner
  • HTTP vs. WebSockets
  • tokens
  • curl example
  • wscat example

Docs: Select provider for live examples

The examples in the docs could have an option to select a provider. We could provide the following providers:

  • Mock responses
  • Local net (testground)
  • Testnet
  • Mainnet
  • Bring your own (needs some way to connect)

Q: claim your node use case

Hello, team!

Wondering if js-lotus-client is currently supporting the use case of claim your node? Like claim your node on blockchain explorer where user signs a message using lotus wallet sign fxxxxx xxxxxxxx and some how the js library could verify (lotus wallet verify fxxxxx xxxxxxxxxx) the result without connecting to an actual RPC endpoint? Is this doable?

Docs: Intro to JSON-RPC API

Ideas:

  • describe what the JSON-RPC is ... how it's used in Lotus, Pond
  • show curl examples
  • websocket examples with wscat
  • how to use tokens

Experiment with adding Typescript type declarations

We want to build the library with vanilla javascript so it runs in web browsers without a compile step, but many applications will want to use TypeScript for stronger types. We can add a declaration file:

https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

The @filecoin-shipyard/js-lotus-client-rpc library dynamically handles the method invocations... one approach might be to do some code generation from the schema in order to generate the declarations.

Docs: Investigate MDX for interactive docs

For generated API method documentation, having plain markdown is desirable as the documentation can be read directly on GitHub in the repo.

For a full documentation site, it is common these days for API docs to have interactive examples where it's easy to see the arguments and output.

MDX is a combination of React JSX and Markdown, so it might be useful for this:

https://mdxjs.com/

I've previously used mdx-deck for presentations, and was happy with it.

Advanced example: Using within a Dapp

This would require some research, but it would be interesting to many people to have an example of how to use Filecoin + Ethereum together (or potentially another blockchain).

Docs: Link to JSON-RPC method documentation

The low-level Lotus JS Client RPC library method calls with have a 1:1 relationship with the exported JSON-RPC methods, so will shared much documentation in common (description, parameters, output, etc.). It would be good to link from the JS Client Docs to the documentation for the JSON-RPC methods.

Open Work Labs has done some preliminary work using Postman to document a subset of the JSON-RPC methods:

https://documenter.getpostman.com/view/4872192/SWLh5mUd?version=latest

Survey methods in Lotus API

Make a list of all the methods.

Also cross-reference against Go API, usage in the Lotus CLI, external code examples.

Docs: Link to Go Client documentation

All of the JSON-RPC methods callable from the Go client are listed here:

https://github.com/filecoin-project/lotus/blob/master/api/apistruct/struct.go

Godoc.org automatically publishes any inline documentation, for example:

The methods are currently lacking the comments that godoc uses. Here is a blog post describing how to document go code:

https://blog.golang.org/godoc

The JS Client documentation will probably share many descriptions with the go and JSON-RPC documentation. Ideally there would be an easy way to jump to the go documentation for a particular method from the JS documentation. This might be particularly helpful in the beginning before the entire API has been wrapped.

Docs: Collect ideas for onboarding "quest" progression

In the docs, there will be a "Getting Started" section, which should help people to "get their feet wet" with the JS Client in the easiest way possible.

Beyond that, there should be a series of exercises (aka "quests") that guide the developers through various parts of the API that they'll need to learn in order to build things. As they proceed through the progression, they will learn the basics of the API plus gain knowledge about how Filecoin is organized. Later exercises will require prerequisite knowledge from earlier exercises. Earlier quests will be things that most developers will want to do, whereas later quests might only appeal to a smaller audience that is trying to do advanced, niche things.

Planning out the progression will assist efforts to prioritize where to spend development time as we build the Lotus JS Client. A fully developed quest will have good support in the library, unit tests, documentation and example code / demos.

I'll add some ideas for quests in follow-on comments.

API calls for "Make a deal" quest

Description

  • Add arguments for the calls below into JSON schema

Acceptance criteria

JS API client calls exist for:

  • Import data (returns CID)
  • Get default wallet address
  • Get Asks
  • Send DealProposal
  • ListDeals (to check for deal state)

Hi,I used lotus JSONRPC,Can not do send transaction

I used the MpoolPushMessage ,But it throw an error,

{
    "id": 1,
    "jsonrpc": "2.0",
    "params": [
        {
            "Version": 9,
            "To": "",
            "From": "",
            "Nonce": 0,
            "Value": "1",
            "GasPrice": "0",
            "GasLimit": 9,
            "Method": 1,
            "Params": ""
        }
    ],
    "method": "Filecoin.MpoolPushMessage"
}

Error:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"wrong param count (method 'Filecoin.MpoolPushMessage'): 1 != 2"}}

Docs: Web Framework Guides

Have some guides to show how to get started with some popular frameworks, possibly:

  • Vanilla JS
  • React (with create-react-app)
  • React (with snowpack, publish on IPFS)
  • Vue
  • React Native

Docs: Target environments

Provide a support/compatibility grid for various target environments:

  • Web + script tags + CDN
  • Web + various bundlers
    • Webpack
    • Parcel
    • Browserify
    • Rollup
  • Web + ES modules
    • Snowpack
  • Node.js + npm w/ES modules (import)
  • Node.js + npm w/legacy CommonJS modules (require)
  • Deno
  • React Native
  • Phonegap / Cordova
  • Electron
  • Web Extensions

Docs: Make an awesome-lotus-js-client repo

Make an "awesome list" for modules and projects related to the JS Client:

https://github.com/sindresorhus/awesome

It would be a good place to find modules that implement interfaces that work the JS Client core libraries and reference implementations.

It would also be great to list libraries that are complementary, and also list applications that use or extend the libraries.

Subscribing to WalletBalance

It would be great to have the possibility to subscribe to wallet balance change, as this is a pretty common use case.

I saw inside the schema definition for testnet that subscription is possible for the method ChainNotify, so I am interested if same is possible for method WalletBalance?

Investigate deal failure: clientMarketBalance.Available too small

The t01003 miner logged: providerstates providerstates/provider_states.go:286 deal bafyreigtq2gxj7h6ijizd5ra2ku2nyiwvgja6g4dxa3psxz67g7h3xdneu failed: deal rejected: clientMarketBalance.Available too small

Including introducing wrappers for debugging if useful
Spend no more than 2 hours

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.