frontblock
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -5,4 +5,3 @@ import { SubscriptionResponse, ErrorResponse, SuccessResponse } from "frontblock-generic/Service"; | ||
import { Payment, PaymentService } from "./PaymentService"; | ||
import { DollarValueProvider, FrontblockConf } from "./Types"; | ||
export declare const CryptocompareDollarValueProvider: DollarValueProvider; | ||
import { FrontblockConf } from "./Types"; | ||
export declare class Frontblock implements PaymentService, FrontblockApi { | ||
@@ -16,3 +15,2 @@ private subscriptionUIDs; | ||
private conf; | ||
private io; | ||
private socket; | ||
@@ -19,0 +17,0 @@ constructor(conf: FrontblockConf); |
@@ -6,15 +6,6 @@ "use strict"; | ||
const Types_1 = require("./Types"); | ||
const Utils_1 = require("./Utils"); | ||
const bsock = require('bsock'); | ||
const fetch = require("node-fetch"); | ||
const uuid = require("uuid/v4"); | ||
exports.CryptocompareDollarValueProvider = async (coins) => { | ||
const ret = new Map(); | ||
const request = await fetch("https://min-api.cryptocompare.com/data/pricemultifull?fsyms=" + coins.join(",") + "&tsyms=USD"); | ||
const result = await request.json(); | ||
const values = result["RAW"]; | ||
Types_1.CoinList.forEach(coin => { | ||
ret.set(coin, values[coin]["USD"]["PRICE"]); | ||
}); | ||
return ret; | ||
}; | ||
class Frontblock { | ||
@@ -26,5 +17,4 @@ constructor(conf) { | ||
this.dollarValues = new Map(); | ||
this.dollarValueProvider = exports.CryptocompareDollarValueProvider; | ||
this.dollarValueProvider = Utils_1.CryptocompareDollarValueProvider; | ||
this.apikey = ""; | ||
this.io = bsock.createServer(); | ||
this.conf = conf; | ||
@@ -194,6 +184,9 @@ if (conf.apiKey != null) | ||
async unsubscribe(apikey, uid) { | ||
const res = await this.socket.call('unsubscribe', apikey, uid); | ||
return Service_1.parseResponse(res); | ||
const r = await this.socket.call('unsubscribe', apikey, uid); | ||
const res = Service_1.parseResponse(r); | ||
if (res instanceof Service_1.SuccessResponse) | ||
this.socket.unhook(uid); | ||
return res; | ||
} | ||
} | ||
exports.Frontblock = Frontblock; |
{ | ||
"name": "frontblock", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "frontblock shop-side library ", | ||
@@ -17,5 +17,7 @@ "scripts": { | ||
"@types/node": "^11.13.10", | ||
"bitcoinjs-lib": "^5.0.4", | ||
"bsock": "^0.1.9", | ||
"express": "^4.16.4", | ||
"frontblock-generic": "latest", | ||
"hdkey": "^1.1.1", | ||
"log4js": "^4.2.0", | ||
@@ -22,0 +24,0 @@ "minimist": "^1.2.0", |
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
22838
11
489
10
+ Addedbitcoinjs-lib@^5.0.4
+ Addedhdkey@^1.1.1
+ Added@types/node@10.12.18(transitive)
+ Addedbase-x@3.0.10(transitive)
+ Addedbech32@1.1.4(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbip174@2.1.1(transitive)
+ Addedbip32@2.0.6(transitive)
+ Addedbip66@1.1.5(transitive)
+ Addedbitcoin-ops@1.4.1(transitive)
+ Addedbitcoinjs-lib@5.2.0(transitive)
+ Addedbn.js@4.12.1(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbrowserify-aes@1.2.0(transitive)
+ Addedbs58@4.0.1(transitive)
+ Addedbs58check@2.1.2(transitive)
+ Addedbuffer-xor@1.0.3(transitive)
+ Addedcipher-base@1.0.4(transitive)
+ Addedcreate-hash@1.2.0(transitive)
+ Addedcreate-hmac@1.1.7(transitive)
+ Addeddrbg.js@1.0.1(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedevp_bytestokey@1.0.3(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedhash-base@3.1.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhdkey@1.1.2(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedmd5.js@1.3.5(transitive)
+ Addedmerkle-lib@2.0.10(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addednan@2.22.0(transitive)
+ Addedpushdata-bitcoin@1.0.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedripemd160@2.0.2(transitive)
+ Addedsecp256k1@3.8.1(transitive)
+ Addedsha.js@2.4.11(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtiny-secp256k1@1.1.7(transitive)
+ Addedtypeforce@1.18.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedvaruint-bitcoin@1.1.2(transitive)
+ Addedwif@2.0.6(transitive)