A typescript wrapper package to use the cardano-cli

Overview

Coti cardano-cli

A package to run cardano-cli commands from nodejs, if you hold a blockfrost API-KEY you could add while creating a cardano-cli instance and get the data directly from there without running a cardano node.

npm package Downloads Issues

Install binaries

  1. Download the binaries from the cardano website (version 1.35.0) https://hydra.iohk.io/build/16934881
  2. Copy the cardano-cli to the bin dir, if it not exists create a bin dir in /bin
  3. run the following command on the cardano-cli file chmod +x cardano-cli

Install

npm install @coti-io/coti-cardano-cli

Usage

import { CardanoCli } from '@coti-io/coti-cardano-cli';
const options: ConstructorOptions = {
    network: 'testnet',
    testnetMagic: '1097911063',
    blockfrostApiKey: '<API_KEY>'
};
const cardanoCli = new CardanoCli(options);

cardanoCli.queryTip()
    .then( tip => console.log(tip))
    .catch(error => console.log(error));

cardanoCli.queryProtocolParameters()
  .then( protocolParameters => console.log(protocolParameters))
  .catch(error => console.log(error));

// Build raw transaction
const buildRawTransactionRequest = {
  "txsIn": [
    {
      "txHash": "<txHash>",
      "utxoIndex": 1 // txIndex
    }
  ],
  "txsOut": [
    {
      "address": "<address>",
      "amount": 100000000 // amount
    },

    {
      "address": "<address>",
      "amount": 798000000 // amount
    }
  ],
  "hereAfter": 63700063, // current slot number + x
  "fee": 1000000 // minmum transaction fee
}

cardanoCli.transactionBuildRaw(buildRawTransactionRequest).then(rawTx => {
  console.log(rawTx);
}).catch(error => {
  console.log(error)
})

const signTransactionRequest = {
  "rawTransaction": {
    "type": "TxBodyBabbage",
    "description": "",
    "cborHex": "<cborHex>"
  },
  "paymentKeys": [
    {
      "type": "PaymentExtendedSigningKeyShelley_ed25519_bip32",
      "description": "",
      "cborHex": "<cborHex>"
    }
  ]
}

cardanoCli.transactionSign(signTransactionRequest).then(signTx => {
  console.log(signTx);
}).catch(error => {
  console.log(error)
})

const submitTransactionRequest = {
  "signedTransaction": {
    "type": "Tx BabbageEra",
    "description": "",
    "cborHex": "<cborHex>"
  }
}


cardanoCli.submitTransaction(submitTransactionRequest).then(signTx => {
  console.log(signTx);
}).catch(error => {
  console.log(error)
})
You might also like...

TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers, v2022.10.23 is ready on NPM

TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers, v2022.10.23 is ready on NPM

TSCI CLI TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers. Installation npm i -g tsci Usage Want to contribute? You

Dec 14, 2022

CLI to package your LÖVE projects

LÖVE Packager CLI to package your LÖVE projects Targets Alias Supported LOVE File love ✔️ Windows (32 bit) win32 ✔️ Windows (64 bit) win64 ✔️ MacOS ma

Sep 14, 2022

A CLI tool to make Taobao's npm mirror sync your package immediately.

npm-mirror-sync A CLI tool to make Taobao's npm mirror sync your package immediately. 让淘宝的 NPM 镜像立即收录你的包的新版本。 背景 相信国内小伙伴都在用淘宝的 NPM 镜像(npmmirror.com)作为

Jun 9, 2022

This package is for developers to be able to easily integrate bad word checking into their projects.\r This package can return bad words in array or regular expression (regex) form.

Vietnamese Bad Words This package is for developers to be able to easily integrate bad word checking into their projects. This package can return bad

Nov 3, 2022

Multi-platform node package bundle to a package.json.

dmpc Multi-platform node package bundle to a package.json. install ### npm mode npm i -g @kingsword/dmpc ### yarn mode yarn global add @kingsword/dmp

Oct 16, 2022

A nuxt 2 wrapper around derrickreimer/fathom-client to be able to use usefathom.com in all its glory

A nuxt 2 wrapper around derrickreimer/fathom-client to be able to use usefathom.com in all its glory

This package is a nuxt 2 wrapper around derrickreimer/fathom-client to be able to use usefathom.com in all its glory. Thanks to @derrickreimer for this framework agnostic library ❤️‍🔥.

Aug 18, 2022

A simple, easy to use wrapper for Hypixel API.

A simple, easy to use wrapper for Hypixel API.

An easy to use Hypixel API wrapper. About hypixel.ts is a NodeJS module which allows you to interact with the Hypixel API easily. Written in Typescrip

Dec 18, 2022

A lightweight, performant, and simple-to-use wrapper component to stick section headers to the top when scrolling brings them to top

A lightweight, performant, and simple-to-use wrapper component to stick section headers to the top when scrolling brings them to top

Jun 27, 2022

A Roblox OpenCloud API wrapper for Deno (and NodeJS) written in TypeScript.

Active Development This module is currently in active development. Nothing is going to stay consistent as it reaches a stable release. Dynablox Docs |

Oct 28, 2022
Owner
Coti
Currency Of The Internet - DAG-based infrastructure optimized for payment networks and stable coins
Coti
How to create an NFT on the Cardano blockchain using JavaScript

How to create an NFT on the Cardano blockchain using JavaScript Youtube Video: https://www.youtube.com/watch?v=OeOliguGn7Y Who is this guide for? For

Armada Alliance 117 Dec 31, 2022
Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain.

Nami Wallet Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain. It's an open-source project and built by Berry Po

Berry 335 Dec 29, 2022
Cardano DApp Wallet Connector

Cardano DApp Wallet Connector This project was bootstrapped with Create React App. React JS demo In the project directory, you can run: npm start run

null 105 Dec 18, 2022
Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

Berry 243 Jan 8, 2023
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022
Convenient wrapper for launching CLI applications for Deno.

deno_cliwrap Convenient wrapper for launching CLI applications in Deno. Module link: https://deno.land/x/cliwrap Usage In the following examples, we'l

null 2 Jul 2, 2022
A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all.

pi A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all. Stargazers over t

tick 11 Nov 1, 2022
Template TypeScript Node.js package with all the CI bells & whistles I commonly use. ✨

Template TypeScript Node Package Template TypeScript Node.js package with all the CI bells & whistles I commonly use. ✨ Usage npm i template-typescrip

Josh Goldberg 26 Jan 2, 2023