@trezor/blockchain-link
Advanced tools
Comparing version 2.1.12 to 2.1.13
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { TypedEmitter } from '@trezor/utils/lib/typedEventEmitter'; | ||
import { Deferred } from '@trezor/utils/lib/createDeferred'; | ||
@@ -8,8 +7,3 @@ import type { BlockchainSettings } from '@trezor/blockchain-link-types'; | ||
import type { Events } from '@trezor/blockchain-link-types/lib/events'; | ||
declare interface BlockchainLink { | ||
on<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): this; | ||
off<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): this; | ||
emit<K extends keyof Events>(type: K, ...args: Events[K][]): boolean; | ||
} | ||
declare class BlockchainLink extends EventEmitter { | ||
declare class BlockchainLink extends TypedEmitter<Events> { | ||
settings: BlockchainSettings; | ||
@@ -16,0 +10,0 @@ messageId: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const events_1 = require("events"); | ||
const typedEventEmitter_1 = require("@trezor/utils/lib/typedEventEmitter"); | ||
const createDeferred_1 = require("@trezor/utils/lib/createDeferred"); | ||
@@ -52,3 +52,3 @@ const errors_1 = require("@trezor/blockchain-link-types/lib/constants/errors"); | ||
}; | ||
class BlockchainLink extends events_1.EventEmitter { | ||
class BlockchainLink extends typedEventEmitter_1.TypedEmitter { | ||
constructor(settings) { | ||
@@ -55,0 +55,0 @@ super(); |
@@ -1,5 +0,4 @@ | ||
/// <reference types="node" /> | ||
import WebSocket from 'ws'; | ||
import { EventEmitter } from 'events'; | ||
import { Deferred } from '@trezor/utils'; | ||
import { Deferred } from '@trezor/utils/lib/createDeferred'; | ||
import { TypedEmitter } from '@trezor/utils/lib/typedEventEmitter'; | ||
import type { BlockNotification, MempoolTransactionNotification, AddressNotification, Send, FiatRatesNotification } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
@@ -21,12 +20,11 @@ import type { GetFiatRatesForTimestamps, GetFiatRatesTickersList, GetCurrentFiatRates } from '@trezor/blockchain-link-types/lib/messages'; | ||
} | ||
export declare interface BlockbookAPI { | ||
on(event: 'block', listener: (event: BlockNotification) => void): this; | ||
on(event: 'mempool', listener: (event: MempoolTransactionNotification) => void): this; | ||
on(event: 'notification', listener: (event: AddressNotification) => void): this; | ||
on(event: 'fiatRates', listener: (event: FiatRatesNotification) => void): this; | ||
on(event: 'error', listener: (error: string) => void): this; | ||
on(event: 'disconnected', listener: () => void): this; | ||
on(event: string, listener: any): this; | ||
interface BlockbookEvents { | ||
block: BlockNotification; | ||
mempool: MempoolTransactionNotification; | ||
notification: AddressNotification; | ||
fiatRates: FiatRatesNotification; | ||
error: string; | ||
disconnected: undefined; | ||
} | ||
export declare class BlockbookAPI extends EventEmitter { | ||
export declare class BlockbookAPI extends TypedEmitter<BlockbookEvents> { | ||
options: Options; | ||
@@ -33,0 +31,0 @@ ws: WebSocket | undefined; |
@@ -8,4 +8,4 @@ "use strict"; | ||
const ws_1 = __importDefault(require("ws")); | ||
const events_1 = require("events"); | ||
const utils_1 = require("@trezor/utils"); | ||
const createDeferred_1 = require("@trezor/utils/lib/createDeferred"); | ||
const typedEventEmitter_1 = require("@trezor/utils/lib/typedEventEmitter"); | ||
const errors_1 = require("@trezor/blockchain-link-types/lib/constants/errors"); | ||
@@ -15,3 +15,3 @@ const NOT_INITIALIZED = new errors_1.CustomError('websocket_not_initialized'); | ||
const DEFAULT_PING_TIMEOUT = 50 * 1000; | ||
class BlockbookAPI extends events_1.EventEmitter { | ||
class BlockbookAPI extends typedEventEmitter_1.TypedEmitter { | ||
constructor(options) { | ||
@@ -27,3 +27,3 @@ super(); | ||
const id = this.messageID.toString(); | ||
const dfd = (0, utils_1.createDeferred)(id); | ||
const dfd = (0, createDeferred_1.createDeferred)(id); | ||
const req = { | ||
@@ -145,3 +145,3 @@ id, | ||
this.setConnectionTimeout(); | ||
const dfd = (0, utils_1.createDeferred)(-1); | ||
const dfd = (0, createDeferred_1.createDeferred)(-1); | ||
this.connectPromise = dfd.promise; | ||
@@ -148,0 +148,0 @@ const ws = new ws_1.default(url, { |
@@ -181,3 +181,3 @@ "use strict"; | ||
if (subscribed.length < 1) { | ||
socket.removeListener('notification', onTransaction); | ||
socket.removeAllListeners('notification'); | ||
state.removeSubscription('notification'); | ||
@@ -184,0 +184,0 @@ return socket.unsubscribeAddresses(); |
@@ -1,5 +0,4 @@ | ||
/// <reference types="node" /> | ||
import WebSocket from 'ws'; | ||
import { EventEmitter } from 'events'; | ||
import { Deferred } from '@trezor/utils/lib/createDeferred'; | ||
import { TypedEmitter } from '@trezor/utils/lib/typedEventEmitter'; | ||
import type { Send, BlockContent, BlockfrostTransaction } from '@trezor/blockchain-link-types/lib/blockfrost'; | ||
@@ -19,10 +18,9 @@ import type { AccountInfoParams, EstimateFeeParams, AccountBalanceHistoryParams } from '@trezor/blockchain-link-types/lib/params'; | ||
} | ||
export declare interface BlockfrostAPI { | ||
on(event: 'block', listener: (event: BlockContent) => void): this; | ||
on(event: 'notification', listener: (event: BlockfrostTransaction) => void): this; | ||
on(event: 'error', listener: (error: string) => void): this; | ||
on(event: 'disconnected', listener: () => void): this; | ||
on(event: string, listener: any): this; | ||
export declare interface BlockfrostEvents { | ||
block: BlockContent; | ||
notification: BlockfrostTransaction; | ||
error: string; | ||
disconnected: undefined; | ||
} | ||
export declare class BlockfrostAPI extends EventEmitter { | ||
export declare class BlockfrostAPI extends TypedEmitter<BlockfrostEvents> { | ||
options: Options; | ||
@@ -29,0 +27,0 @@ ws: WebSocket | undefined; |
@@ -8,4 +8,4 @@ "use strict"; | ||
const ws_1 = __importDefault(require("ws")); | ||
const events_1 = require("events"); | ||
const createDeferred_1 = require("@trezor/utils/lib/createDeferred"); | ||
const typedEventEmitter_1 = require("@trezor/utils/lib/typedEventEmitter"); | ||
const errors_1 = require("@trezor/blockchain-link-types/lib/constants/errors"); | ||
@@ -15,3 +15,3 @@ const NOT_INITIALIZED = new errors_1.CustomError('websocket_not_initialized'); | ||
const DEFAULT_PING_TIMEOUT = 50 * 1000; | ||
class BlockfrostAPI extends events_1.EventEmitter { | ||
class BlockfrostAPI extends typedEventEmitter_1.TypedEmitter { | ||
constructor(options) { | ||
@@ -18,0 +18,0 @@ super(); |
{ | ||
"name": "@trezor/blockchain-link", | ||
"version": "2.1.12", | ||
"version": "2.1.13", | ||
"author": "Trezor <info@trezor.io>", | ||
@@ -70,4 +70,4 @@ "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/blockchain-link", | ||
"@trezor/blockchain-link-utils": "1.0.3", | ||
"@trezor/utils": "9.0.8", | ||
"@trezor/utxo-lib": "1.0.6", | ||
"@trezor/utils": "9.0.9", | ||
"@trezor/utxo-lib": "1.0.7", | ||
"@types/web": "^0.0.99", | ||
@@ -74,0 +74,0 @@ "bignumber.js": "^9.1.1", |
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
182029
4402
+ Added@trezor/utils@9.0.9(transitive)
+ Added@trezor/utxo-lib@1.0.7(transitive)
- Removed@trezor/utxo-lib@1.0.6(transitive)
Updated@trezor/utils@9.0.9
Updated@trezor/utxo-lib@1.0.7