frontblock
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -25,3 +25,4 @@ import { SubscriptionResponse, ErrorResponse, SuccessResponse } from "frontblock-generic/Service"; | ||
stop(): void; | ||
resume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>; | ||
consume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>; | ||
quit(apikey: string, consumerUid: string): Promise<ErrorResponse | SuccessResponse>; | ||
subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>; | ||
@@ -28,0 +29,0 @@ unsubscribe(apikey: string, uid: string): Promise<ErrorResponse | SuccessResponse>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const Logger = require("log4js"); | ||
const logger = Logger.getLogger(); // logs to STDOUT | ||
const logger = Logger.getLogger(); // logs to STDOUT | ||
logger.level = 'debug'; | ||
@@ -49,3 +49,3 @@ const bsock = require('bsock'); | ||
name: 'resume', | ||
rpc: async (apikey, uid, callback) => { return await this.resume(this.apikey, uid, callback); }, | ||
rpc: async (apikey, uid, callback) => { return await this.consume(this.apikey, uid, callback); }, | ||
type: 'hook', | ||
@@ -73,4 +73,4 @@ unhook: unhookFn, | ||
} | ||
async resume(apikey, uid, callback) { | ||
const r = await this.socket.call("resume", apikey, uid); | ||
async consume(apikey, uid, callback) { | ||
const r = await this.socket.call("consume", apikey, uid); | ||
const res = Service_1.parseSubResponse(r); | ||
@@ -82,2 +82,7 @@ if (res instanceof Service_1.SubscriptionResponse) { | ||
} | ||
async quit(apikey, consumerUid) { | ||
const r = await this.socket.call("quit", apikey); | ||
const res = Service_1.parseResponse(r); | ||
return res; | ||
} | ||
async subscribe(apikey, coin, account, callback) { | ||
@@ -84,0 +89,0 @@ const r = await this.socket.call("subscribe", apikey, coin, account); |
@@ -6,3 +6,3 @@ import { SubscriptionResponse, ErrorResponse, SuccessResponse, parseResponse, parseSubResponse } from "frontblock-generic/Service" | ||
import * as Logger from 'log4js' | ||
const logger = Logger.getLogger() // logs to STDOUT | ||
const logger = Logger.getLogger() // logs to STDOUT | ||
logger.level = 'debug' | ||
@@ -21,7 +21,7 @@ const bsock = require('bsock') | ||
* Frontblock api connection lib | ||
* | ||
* | ||
* Can be used solo and also is a valid frontblock plugin on the customer-side | ||
*/ | ||
export default class FrontblockApiClient implements FrontblockApi, Plugin{ | ||
protected apikey:string = "" | ||
@@ -42,3 +42,3 @@ protected conf:FrontblockApiConf; | ||
}else{ | ||
if(conf.apiKey != null) | ||
if(conf.apiKey != null) | ||
this.apikey = conf.apiKey | ||
@@ -65,3 +65,3 @@ this.conf = conf | ||
name: 'resume', | ||
rpc: async<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void) => {return await this.resume(this.apikey, uid, callback)}, | ||
rpc: async<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void) => {return await this.consume(this.apikey, uid, callback)}, | ||
type: 'hook', | ||
@@ -90,6 +90,6 @@ unhook: unhookFn, | ||
this.socket.close() | ||
} | ||
} | ||
async resume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> { | ||
const r = await this.socket.call("resume", apikey, uid) | ||
async consume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> { | ||
const r = await this.socket.call("consume", apikey, uid) | ||
const res = parseSubResponse(r); | ||
@@ -102,2 +102,8 @@ if(res instanceof SubscriptionResponse){ | ||
async quit(apikey: string, consumerUid: string): Promise<ErrorResponse | SuccessResponse> { | ||
const r = await this.socket.call("quit", apikey) | ||
const res = parseResponse(r); | ||
return res | ||
} | ||
async subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> { | ||
@@ -123,2 +129,2 @@ const r = await this.socket.call("subscribe", apikey, coin, account) | ||
} | ||
} | ||
} |
{ | ||
"name": "frontblock", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "frontblock shop-side library ", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
9995
242