From d650e6f367baa452e336ae6893a3ac2456c99a93 Mon Sep 17 00:00:00 2001 From: jagdeep sidhu Date: Fri, 26 Mar 2021 12:13:03 -0700 Subject: [PATCH] add networks accesible from txjs so we dont have to pull in sjs lib for just the network settings, useful for notary server --- package-lock.json | 4 ++-- package.json | 2 +- utils.js | 30 ++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94597f7..c968751 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "syscointx-js", - "version": "1.0.81", + "version": "1.0.82", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.81", + "version": "1.0.82", "license": "MIT", "dependencies": { "bitcoin-ops": "^1.4.1", diff --git a/package.json b/package.json index 264d815..ecc92f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "syscointx-js", - "version": "1.0.81", + "version": "1.0.82", "description": "A transaction creation library interfacing with coin selection for Syscoin.", "keywords": [ "coinselect", diff --git a/utils.js b/utils.js index 1e86731..1bff0ec 100644 --- a/utils.js +++ b/utils.js @@ -22,6 +22,31 @@ const ASSET_UPDATE_AUXFEE = 32 // can you update aux fees? const ASSET_UPDATE_CAPABILITYFLAGS = 64 // can you update capability flags? const ASSET_CAPABILITY_ALL = 127 const ASSET_INIT = 128 // upon asset creation +const bitcoinNetworks = { mainnet: bitcoin.networks.bitcoin, testnet: bitcoin.networks.testnet } +const syscoinNetworks = { + mainnet: { + messagePrefix: '\x18Syscoin Signed Message:\n', + bech32: 'sys', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4 + }, + pubKeyHash: 0x3f, + scriptHash: 0x05, + wif: 0x80 + }, + testnet: { + messagePrefix: '\x18Syscoin Signed Message:\n', + bech32: 'tsys', + bip32: { + public: 0x043587cf, + private: 0x04358394 + }, + pubKeyHash: 0x41, + scriptHash: 0xc4, + wif: 0xef + } +} function isNonAssetFunded (txVersion) { return txVersion === SYSCOIN_TX_VERSION_ASSET_ACTIVATE || txVersion === SYSCOIN_TX_VERSION_SYSCOIN_BURN_TO_ALLOCATION || txVersion === SYSCOIN_TX_VERSION_ALLOCATION_MINT } @@ -184,6 +209,7 @@ module.exports = { isAssetAllocationTx: isAssetAllocationTx, isSyscoinTx: isSyscoinTx, signHash: signHash, - MAX_BIP125_RBF_SEQUENCE: MAX_BIP125_RBF_SEQUENCE - + MAX_BIP125_RBF_SEQUENCE: MAX_BIP125_RBF_SEQUENCE, + syscoinNetworks: syscoinNetworks, + bitcoinNetworks: bitcoinNetworks }