npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ganache/filecoin

v0.9.2

Published

Ganache's Filecoin client implementation

Downloads

177

Readme

@ganache/filecoin

This package provides Ganache's Filecoin client implementation.

Table of Contents

  1. CLI Usage
  2. NodeJS Usage
  3. Startup Options
  4. Supported RPC Methods

CLI Usage

To use Filecoin-flavored Ganache via the CLI, follow the below instructions:

  1. Remove any existing version of Ganache CLI

    npm uninstall --global ganache-cli
    npm uninstall --global ganache
  2. Install the ganache package globally

    npm install --global ganache
  3. Install the @ganache/filecoin globally

    npm install --global @ganache/filecoin
  4. Run Filecoin-flavored Ganache

    ganache --flavor @ganache/filecoin
  5. See available options

    ganache --flavor @ganache/filecoin --help
  6. You can use Ethereum-flavored Ganache still

    # Running "ganache" defaults to Ethereum
    ganache
    
    # or you can specify ethereum as the flavor
    ganache ethereum

NodeJS Usage

Install

If you're using Filecoin-flavored Ganache as a NodeJS dependency, you need to make sure you install both the ganache package (with the filecoin tag) and the @ganache/filecoin package.

# install the base Ganache package
npm install ganache

# install the Filecoin peer dependency package
npm install @ganache/filecoin

Usage

In your code, you will use the ganache package directly to instantiate the Filecoin flavor. Below is an example on how to do that with the default options.

import Ganache from "ganache";

const startupOptions = {
  flavor: "@ganache/filecoin";
}

// Provider usage
const provider = Ganache.provider(startupOptions);
const result = await provider.send({
  jsonrpc: "2.0",
  id: "0",
  method: "Filecoin.Version",
  params: []
});

// Server usage (starts up a HTTP and WebSocket server)
const server = Ganache.server(startupOptions);
server.listen(7777, () => {
  console.log("Lotus RPC endpoint listening at http://localhost:7777/rpc/v0");
});

Startup Options

See available startup options in @ganache/filecoin-options.

Supported RPC Methods

@ganache/filecoin does not support all of the RPC methods implemented within Lotus; further, it implements some custom methods. Below is a list of each method.

Ganache Specific RPC Methods

  • Ganache.MineTipset: Manually mine a tipset immediately. Mines even if the miner is disabled. No parameters.
  • Ganache.EnableMiner: Enables the miner. No parameters.
  • Ganache.DisableMiner: Disables the miner. No parameters.
  • Ganache.MinerEnabled: The current status on whether or not the miner is enabled. The initial value is determined by the option miner.mine. If true, then auto-mining (miner.blockTime = 0) and interval mining (miner.blockTime > 0) will be processed. If false, tipsets/blocks will only be mined with Ganache.MineTipset. No parameters.
  • Ganache.MinerEnabledNotify: A subscription method that provides an update whenever the miner is enabled or disabled. No parameters.
  • Ganache.GetDealById: Retrieves an internal DealInfo by its DealID. Takes a single parameter, DealID, of type number.

Supported Lotus RPC methods

  • Filecoin.ChainGetBlock
  • Filecoin.ChainGetBlockMessages
  • Filecoin.ChainGetGenesis
  • Filecoin.ChainGetMessage
  • Filecoin.ChainGetTipSet
  • Filecoin.ChainGetTipSetByHeight
  • Filecoin.ChainHead
  • Filecoin.ChainNotify
  • Filecoin.ClientFindData
  • Filecoin.ClientGetDealInfo
  • Filecoin.ClientGetDealStatus
  • Filecoin.ClientGetDealUpdates
  • Filecoin.ClientListDeals
  • Filecoin.ClientRetrieve
  • Filecoin.ClientStartDeal
  • Filecoin.ID - Returns a hardcoded ID of bafzkbzaced47iu7qygeshb3jamzkh2cqcmlxzcpxrnqsj6yoipuidor523jyg
  • Filecoin.MpoolBatchPush - FIL transfer only (Method = 0)
  • Filecoin.MpoolBatchPushMessage - FIL transfer only (Method = 0)
  • Filecoin.MpoolClear
  • Filecoin.MpoolGetNonce
  • Filecoin.MpoolPending
  • Filecoin.MpoolPush - FIL transfer only (Method = 0)
  • Filecoin.MpoolPushMessage - FIL transfer only (Method = 0)
  • Filecoin.MpoolSelect
  • Filecoin.StateListMiners
  • Filecoin.StateMinerInfo
  • Filecoin.StateMinerPower
  • Filecoin.WalletBalance
  • Filecoin.WalletDefaultAddress
  • Filecoin.WalletDelete
  • Filecoin.WalletExport
  • Filecoin.WalletHas
  • Filecoin.WalletImport - KeyInfo.Type of type secpk1-ledger is not supported
  • Filecoin.WalletList
  • Filecoin.WalletNew - KeyInfo.Type of type secpk1-ledger is not supported
  • Filecoin.WalletSetDefault
  • Filecoin.WalletSign
  • Filecoin.WalletSignMessage
  • Filecoin.WalletValidateAddress
  • Filecoin.WalletVerify
  • Filecoin.ActorAddress
  • Filecoin.Version