@ergoplatform/ergo-js

1.6.0 • Public • Published

Ergo-js

codecov Build Status

Installing

import in body

<script src='path_to/dist/ergo.js'></script> 

With npm:

npm install @ergoplatform/ergo-js

Or yarn:

yarn add @ergoplatform/ergo-js

Usage

In body:

<script src='path_to/ergo.js'></script>
<script>
  ergo.sendTransaction(...)
</script> 

In Node.js:

const ergo = require('@ergoplatform/ergo-js');

ergo.sendTransaction(...)

Import syntax:

import * as ergo from '@ergoplatform/ergo-js'

ergo.sendTransaction(...)

// or destructuring assignment

import { sendTransaction } from '@ergoplatform/ergo-js'

sendTransaction(...)

Documentation

Default send transaction

import { sendTransaction } from '@ergoplatform/ergo-js'

* @param  {String} recipient
* @param  {Number} amount
* @param  {Number} fee
* @param  {Array[Object({ id: number, amount: number, sk(hex): string })]}} boxesToSpend
* @param  {String} chargeAddress
* @param  {Number} height
* @param  {Boolean} testNet = false

sendTransaction(recipient, amount, fee, boxesToSpend, chargeAddress, height, testNet)

Send transaction only with sk

import { sendWithoutBoxId } from '@ergoplatform/ergo-js'

* @param  {String} recipient
* @param  {Number} amount
* @param  {Number} fee
* @param  {String || Array[String]} sk
* @param  {Boolean} testNet = false

sendWithoutBoxId(recipient, amount, fee, sk, testNet) 

Form transaction and returns it

import { formTransaction } from '@ergoplatform/ergo-js'

* @param  {String} recipient
* @param  {Number} amount
* @param  {Number} fee
* @param  {Array[Object({ id: number, amount: number, sk(hex): string })]} boxesToSpend
* @param  {String} chargeAddress
* @param  {Number} height

formTransaction(recipient, amount, fee, boxesToSpend, chargeAddress, height)

Generate charge address from public key

import { addressFromPK } from '@ergoplatform/ergo-js'

* @param  {string} pk
* @param  {boolean} testNet

addressFromPK(pk, testNet)

Generate charge address from private key

import { addressFromSK } from '@ergoplatform/ergo-js'

* @param  {string} sk
* @param  {boolean} testNet

addressFromSK(pk, testNet)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.6.01latest

Version History

VersionDownloads (Last 7 Days)Published
1.6.01
1.5.010
1.4.20
1.4.10
1.4.00
1.2.80
1.2.70
1.2.60
1.1.60
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @ergoplatform/ergo-js

Weekly Downloads

11

Version

1.6.0

License

MIT

Unpacked Size

2.51 MB

Total Files

11

Last publish

Collaborators