altiusjs-lib
This is an extend lib for bitcoinjs-lib. It extends the network type of bitcoinjs-lib. It also provides an useful lib to help you building ALTS transactions.
Installation
npm install altiusjs-lib
Setup
Node.js
var altiusjs =
New features
Network
{
altius: {
messagePrefix: '\x18Altius Signed Message:\n',
bech32: 'fg',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4
},
pubKeyHash: 0x11,
scriptHash: 0x32,
wif: 0x80
},
altius_testnet: {
messagePrefix: '\x18Altius Signed Message:\n',
bech32: 'tf',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4
},
pubKeyHash: 0x11,
scriptHash: 0x32,
wif: 0x80
}
}
Utils
Utils.selectTxs
/** * This is a function for selecting ALTS utxos to build transactions * the transaction object takes at least 3 fields, value(unit is 1e-8 ALTS) , confirmations and isStake * * @param [transaction] unspentTransactions * @param Number amount(unit: ALTS) * @param Number fee(unit: ALTS) * @returns [transaction] */
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 ALTS), confirmations, isStake, hash and pos * * @param bitcoinjs-lib.KeyPair keyPair * @param String to * @param Number amount(unit: ALTS) * @param Number fee(unit: ALTS) * @param [transaction] utxoList * @returns String the built tx */
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 ALTS), 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 ALTS/gas) * @param Number fee(unit: ALTS) * @param [transaction] utxoList * @returns String the built tx */
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 ALTS), 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 ALTS/gas) * @param Number fee(unit: ALTS) * @param [transaction] utxoList * @returns String the built tx */