0.1.15 • Published 3 years ago

htmlcoinjs-lib v0.1.15

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

htmlcoinjs-lib

This is an extend library called htmlcoinjs-lib, it supports two networks; htmlcoin-mainnet and htmlcoin-testnet It can generate contracts and creating and send transactions

Installation

npm install htmlcoinjs-lib

Setup

Node.js

var htmlcoinjs = require('htmlcoinjs-lib')

New features

Network

https://en.bitcoin.it/wiki/List_of_address_prefixes

{
    htmlcoin: {
            messagePrefix: '\x15HTMLCOIN Signed Message:\n',
            bech32: 'hc',
            bip32: {
                public: 0x1397c10d,
                private: 0x1397BCF3
            },
            pubKeyHash: 0x29,
            scriptHash: 0x64,
            wif: 0xa9
        },
        htmlcoin_testnet: {
            messagePrefix: '\x15HTMLCOIN Signed Message:\n',
            bech32: 'tq',
            bip32: {
                public: 0x043587cf,
                private: 0x04358394
            },
            pubKeyHash: 0x64,
            scriptHash: 0x6e,
            wif: 0xef
    }
}

Utils

Utils.selectTxs

/**
 * This is a function for selecting HTML utxos to build transactions
 * the transaction object takes at least 3 fields, value(unit is 1e-8 HTML) , confirmations and isStake
 *
 * @param [transaction] unspentTransactions
 * @param Number amount(unit: HTML)
 * @param Number fee(unit: HTML)
 * @returns [transaction]
 */
function selectTxs(unspentTransactions, amount, fee)

Utils.buildPubKeyHashTransaction

/**
 * This is a helper function to build a pubkeyhash transaction
 * the transaction object takes at least 5 fields, value(unit is 1e-8 HTML), confirmations, isStake, hash and pos
 *
 * @param bitcoinjs-lib.KeyPair keyPair
 * @param String to
 * @param Number amount(unit: HTML)
 * @param Number fee(unit: HTML)
 * @param [transaction] utxoList
 * @returns String the built tx
 */
function buildPubKeyHashTransaction(keyPair, to, amount, fee, utxoList)

Utils.buildCreateContractTransaction

/**
 * This is a helper function to build a create-contract transaction
 * the transaction object takes at least 5 fields, value(unit is 1e-8 HTML), confirmations, isStake, hash and pos
 *
 * @param bitcoinjs-lib.KeyPair keyPair
 * @param String code The contract byte code
 * @param Number gasLimit
 * @param Number gasPrice(unit: 1e-8 HTML/gas)
 * @param Number fee(unit: HTML)
 * @param [transaction] utxoList
 * @returns String the built tx
 */
function buildCreateContractTransaction(keyPair, code, gasLimit, gasPrice, fee, utxoList)

Utils.buildSendToContractTransaction

/**
 * This is a helper function to build a send-to-contract transaction
 * the transaction object takes at least 5 fields, value(unit is 1e-8 HTML), confirmations, isStake, hash and pos
 *
 * @param bitcoinjs-lib.KeyPair keyPair
 * @param String contractAddress The contract address
 * @param String encodedData The encoded abi data
 * @param Number gasLimit
 * @param Number gasPrice(unit: 1e-8 HTML/gas)
 * @param Number fee(unit: HTML)
 * @param [transaction] utxoList
 * @returns String the built tx
 */
function buildSendToContractTransaction(keyPair, contractAddress, encodedData, gasLimit, gasPrice, fee, utxoList)
0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

4 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago