melis-api-js
Advanced tools
Comparing version 0.12.3 to 0.12.4
@@ -6,3 +6,3 @@ { | ||
"license": "ISC", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"main": "src/index.js", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"bitcoinjs-message": "^2.0.0", | ||
"cashaddrjs": "^0.3.3", | ||
"cashaddrjs": "^0.3.6", | ||
"detect-node": "^2.0.4", | ||
@@ -34,3 +34,3 @@ "ecurve": "^1.0.6", | ||
"webstomp-client": "^1.2.6", | ||
"ws": "^7.0.0" | ||
"ws": "^7.1.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "optionalDependencies": { |
var C = {} | ||
C.CLIENT_API_VERSION = "0.9.3" | ||
C.CLIENT_API_VERSION = "0.10.0" | ||
@@ -277,6 +277,6 @@ // Websocket official urls | ||
C.MELIS_USER_AGENT = "/melis-api/" | ||
C.MELIS_USER_AGENT = "/melis-api-js/" | ||
C.VALID_BASE58_CHARS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" | ||
C.VALID_PUB_ID_REGEX = new RegExp("^((CM)|(M[01ZzYyXxWw]))[" + C.VALID_BASE58_CHARS + "]{26,28}$") | ||
C.VALID_PUB_ID_REGEX = new RegExp("^((CM)|(M[0-5U-Zu-z]))[" + C.VALID_BASE58_CHARS + "]{26,28}$") | ||
C.VALID_ALIAS_REGEX = new RegExp(/^[a-z0-9][a-z0-9-\\.]{2,61}$/) | ||
@@ -283,0 +283,0 @@ C.LEGACY_BITCOIN_REGEX = new RegExp(/^[132mn][a-km-zA-HJ-NP-Z0-9]{25,34}$/) |
@@ -34,2 +34,24 @@ require('isomorphic-fetch'); | ||
function getNetworkFeesEarnCom() { | ||
return fetch("https://bitcoinfees.earn.com/api/v1/fees/recommended").then(res => { | ||
if (res && res.status === 200) | ||
return res.json() | ||
else | ||
return null | ||
}).then(val => { | ||
if (!val || !val.fastestFee) | ||
return null | ||
return prepareMelisFees({ | ||
provider: "earn.com", | ||
fastestFee: val.fastestFee, | ||
mediumFee: val.halfHourFee, | ||
slowFee: val.hourFee | ||
}) | ||
}).catch(err => { | ||
logger.log("Error reading fees from earn.com:", err) | ||
return Q(null) | ||
}) | ||
} | ||
// Stopped working | ||
function getNetworkFees21() { | ||
@@ -57,3 +79,3 @@ return fetch("https://bitcoinfees.21.co/api/v1/fees/recommended").then(res => { | ||
function getNetworkFeesBlockCypher(coin) { | ||
var symbol | ||
let symbol | ||
if (coin === C.COIN_PROD_LTC) | ||
@@ -63,5 +85,8 @@ symbol = "ltc" | ||
symbol = "btc" | ||
else if (coin === C.COIN_PROD_DOGE) | ||
symbol = "doge" | ||
else | ||
return null | ||
return fetch("https://api.blockcypher.com/v1/btc/main").then(res => { | ||
return null | ||
const url = "https://api.blockcypher.com/v1/"+symbol+"/main" | ||
return fetch(url).then(res => { | ||
if (res && res.status === 200) | ||
@@ -98,3 +123,3 @@ return res.json() | ||
return prepareMelisFees({ | ||
provider: "bitgo", | ||
provider: "bitgo.com", | ||
fastestFee: Math.round(val.feePerKb / 1024), | ||
@@ -132,5 +157,6 @@ mediumFee: Math.round((val.feePerKb * 0.8) / 1024), | ||
'melis': () => getNetworkFeesMelis(C.COIN_PROD_BTC), | ||
'21.co': getNetworkFees21, | ||
'blockcypher': getNetworkFeesBlockCypher, | ||
'bitgo': getNetworkFeesBitgo | ||
//'21.co': getNetworkFees21, | ||
'earn.com': getNetworkFeesEarnCom, | ||
'blockcypher.com': () => getNetworkFeesBlockCypher(C.COIN_PROD_BTC), | ||
'bitgo.com': getNetworkFeesBitgo | ||
} | ||
@@ -150,3 +176,2 @@ feeProviders[C.COIN_TEST_BTC] = { | ||
'melis': () => getNetworkFeesMelis(C.COIN_PROD_BCH), | ||
'blockcypher': () => getNetworkFeesBlockCypher(C.COIN_PROD_BCH) | ||
} | ||
@@ -165,3 +190,4 @@ feeProviders[C.COIN_TEST_BCH] = { | ||
'hardcoded': () => Q(HARDCODED_LTC_FEES), | ||
'melis': () => getNetworkFeesMelis(C.COIN_PROD_LTC) | ||
'melis': () => getNetworkFeesMelis(C.COIN_PROD_LTC), | ||
'blockcypher.com': () => getNetworkFeesBlockCypher(C.COIN_PROD_LTC) | ||
} | ||
@@ -168,0 +194,0 @@ feeProviders[C.COIN_TEST_LTC] = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173695
4129
17
Updatedcashaddrjs@^0.3.6
Updatedws@^7.1.0