Giter Site home page Giter Site logo

gridcoin-rpc's Introduction

gridcoin-rpc โ€“ Promise based Gridcoin RPC client

TS library for the interactions with gridcoin RPC api

NPM Version CI build SNYK report semantic-release Commitzen Friendly

This library is intended to be the simple proxy for those who want to use JS/TS to tinker with Gridcoin RPC library. Library won't do validation by itself, it relies on the RPC validation. It will just help you with a typings.

Installation

npm install gridcoin-rpc

Usage

const { GridcoinRPC } = require('gridcoin-rpc');

const rpc = new GridcoinRPC({
  port: 6553,
  host: '127.0.0.1',
  username: 'username',
  password: 'very-strong-password',
});

async main = () => {
  // Get wallet info
  try {
    const walletInfo = await rpc.getWalletInfo();
    console.log(JSON.stringify(res, null, 2))
  } catch (e) {
    console.log(err.message)
  }
}

main();


// {
//   "walletversion": 60000,
//   "balance": 121.12304127,
//   "newmint": 0,
//   "stake": 0,
//   "keypoololdest": 1508531912,
//   "keypoolsize": 101,
//   "unlocked_until": 0
// }

Documentation

API documentation

Donate

GRC: SJVaQcJriv7N8Py8eWjNUtWPTPBtDZashD

Follow me

keybase

steemit

gridcoin-rpc's People

Contributors

dependabot[bot] avatar gridcat avatar semantic-release-bot avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wilkart

gridcoin-rpc's Issues

Unable to import due to camelcase-keys

Importing [email protected] from an ESM script fails with this error, but [email protected] works correctly.

/home/benn/code/barney/node_modules/gridcoin-rpc/dist/RPCBase.js:16
const camelcase_keys_1 = __importDefault(require("camelcase-keys"));
                                         ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/benn/code/barney/node_modules/camelcase-keys/index.js from /home/benn/code/barney/node_modules/gridcoin-rpc/dist/RPCBase.js not supported.
Instead change the require of index.js in /home/benn/code/barney/node_modules/gridcoin-rpc/dist/RPCBase.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/benn/code/barney/node_modules/gridcoin-rpc/dist/RPCBase.js:16:42)
    at Object.<anonymous> (/home/benn/code/barney/node_modules/gridcoin-rpc/dist/RPC/Developer.js:13:19)
    at Object.<anonymous> (/home/benn/code/barney/node_modules/gridcoin-rpc/dist/GridcoinRPC.js:5:21)
    at async file:///home/benn/code/barney/bin/barney.mjs:7:25 {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.6.1

It looks like [email protected] moved away from commonjs but typescript is still trying to require() it. I think your tsconfig.json should set "module": "node16" as recommended by the typescript handbook. As far as I can tell, this will automatically detect each module type and emit the appropriate require() or import.

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.