Socket
Socket
Sign inDemoInstall

minercraft

Package Overview
Dependencies
23
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

demo/feerateverbose.js

28

fee.js

@@ -10,2 +10,3 @@ const bsv = require('bsv')

}
this.validate = o.validate;
}

@@ -15,15 +16,20 @@ rate(options) {

let u = this.url + (this.ratePath ? this.ratePath : "")
console.log(u)
return axios.get(u, { headers: this.headers }).then((res) => {
let response = JSON.parse(res.data.payload)
if (options && options.verbose) {
res.data.payload = response
return res.data;
let isvalid = this.validate(res.data)
if (isvalid) {
let response = JSON.parse(res.data.payload)
if (options && options.verbose) {
res.data.payload = response
res.data.valid = isvalid
return res.data;
} else {
let fees = { expires: response.expiryTime, mine: {}, relay: {} }
response.fees.forEach((f) => {
fees.mine[f.feeType] = f.miningFee.satoshis/f.miningFee.bytes
fees.relay[f.feeType] = f.relayFee.satoshis/f.relayFee.bytes
})
return fees
}
} else {
let fees = { mine: {}, relay: {} }
response.fees.forEach((f) => {
fees.mine[f.feeType] = f.miningFee.satoshis/f.miningFee.bytes
fees.relay[f.feeType] = f.relayFee.satoshis/f.relayFee.bytes
})
return fees
throw new Error("the merchant API signature doesn't match the publickey and the response")
}

@@ -30,0 +36,0 @@ })

const Fee = require('./fee')
const Transaction = require('./transaction')
const Validate = require('./validate')
/***************************************

@@ -13,6 +14,9 @@ new Minercraft({

constructor(o) {
o = Object.assign(o, { validate: Validate })
this.fee = new Fee(o)
this.tx = new Transaction(o)
this.validate = Validate
}
}
Minercraft.validate = Validate
module.exports = Minercraft
{
"name": "minercraft",
"version": "0.0.4",
"version": "0.0.5",
"description": "interact with bitcoin miner apis",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,2 +10,3 @@ const axios = require('axios')

}
this.validate = o.validate;
}

@@ -33,7 +34,13 @@ push(rawtx, options) {

return axios.get(u, { headers: this.headers }).then((res) => {
if (options && options.verbose) {
res.data.payload = JSON.parse(res.data.payload)
return res.data
let isvalid = this.validate(res.data)
if (isvalid) {
if (options && options.verbose) {
res.data.payload = JSON.parse(res.data.payload)
res.data.valid = isvalid
return res.data
} else {
return JSON.parse(res.data.payload)
}
} else {
return JSON.parse(res.data.payload)
throw new Error("the merchant API signature doesn't match the publickey and the response")
}

@@ -40,0 +47,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc