@trezor/blockchain-link
Advanced tools
Comparing version 2.1.15 to 2.1.16
@@ -0,1 +1,8 @@ | ||
# 2.1.16 | ||
- feat(blockchain-link): ipv6 electrum support (1d4b5471c) | ||
- fix(blockchain-link): WsWrapper default export (0c5297e56) | ||
- feat(blockchain-link): return tx hex in blockbook transactions (6aba6f094) | ||
- feat(blockchain-link): add baseWebsocket options (951bd3e29) | ||
# 2.1.14 | ||
@@ -2,0 +9,0 @@ |
@@ -14,3 +14,3 @@ /// <reference types="node" /> | ||
} | ||
export = WSWrapper; | ||
export default WSWrapper; | ||
//# sourceMappingURL=ws.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const events_1 = require("events"); | ||
@@ -36,3 +37,3 @@ class WSWrapper extends events_1.EventEmitter { | ||
WSWrapper.CLOSED = 3; | ||
module.exports = WSWrapper; | ||
exports.default = WSWrapper; | ||
//# sourceMappingURL=ws.js.map |
@@ -7,5 +7,7 @@ import WebSocket from 'ws'; | ||
pingTimeout?: number; | ||
connectionTimeout?: number; | ||
keepAlive?: boolean; | ||
agent?: WebSocket.ClientOptions['agent']; | ||
headers?: WebSocket.ClientOptions['headers']; | ||
onSending?: (message: Record<string, any>) => void; | ||
} | ||
@@ -12,0 +14,0 @@ type EventMap = { |
@@ -22,5 +22,5 @@ "use strict"; | ||
} | ||
setConnectionTimeout() { | ||
setConnectionTimeout(timeout) { | ||
this.clearConnectionTimeout(); | ||
this.connectionTimeout = setTimeout(this.onTimeout.bind(this), this.options.timeout || DEFAULT_TIMEOUT); | ||
this.connectionTimeout = setTimeout(this.onTimeout.bind(this), timeout || this.options.timeout || DEFAULT_TIMEOUT); | ||
} | ||
@@ -78,2 +78,3 @@ clearConnectionTimeout() { | ||
sendMessage(message) { | ||
var _a, _b; | ||
const { ws } = this; | ||
@@ -89,2 +90,3 @@ if (!ws) | ||
this.setPingTimeout(); | ||
(_b = (_a = this.options).onSending) === null || _b === void 0 ? void 0 : _b.call(_a, message); | ||
ws.send(JSON.stringify(req)); | ||
@@ -140,3 +142,3 @@ return dfd.promise; | ||
} | ||
this.setConnectionTimeout(); | ||
this.setConnectionTimeout(this.options.connectionTimeout); | ||
const dfd = (0, createDeferred_1.createDeferred)(-1); | ||
@@ -143,0 +145,0 @@ this.connectPromise = dfd.promise; |
@@ -11,2 +11,3 @@ "use strict"; | ||
const TLS_CONFIG = 'bitcoin.aranguren.org:50002:s'; | ||
const IPv6_CONFIG = '[2401:d002:3902:700:d72c:5e22:4e95:389d]:50001:t'; | ||
const TOR_CONFIG = ''; | ||
@@ -13,0 +14,0 @@ const ADDR_REGTEST = 'bcrt1qx4009e2mpuch20p3uwvwmplaxgnjqwjmenrcfu'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSocket = void 0; | ||
const utils_1 = require("@trezor/utils"); | ||
const errors_1 = require("@trezor/blockchain-link-types/lib/constants/errors"); | ||
@@ -9,8 +10,6 @@ const tcp_1 = require("./tcp"); | ||
const createSocket = (url, options) => { | ||
const [host, portString, protocol] = url.replace(/.*:\/\//, '').split(':'); | ||
if (!host) | ||
throw new errors_1.CustomError('Missing host'); | ||
const port = Number.parseInt(portString, 10); | ||
if (!port) | ||
throw new errors_1.CustomError('Invalid port'); | ||
const parsed = (0, utils_1.parseElectrumUrl)(url); | ||
if (!parsed) | ||
throw new errors_1.CustomError('Invalid electrum url'); | ||
const { host, port, protocol } = parsed; | ||
const { timeout, keepAlive, proxyAgent } = options || {}; | ||
@@ -26,11 +25,11 @@ if (proxyAgent) { | ||
} | ||
if (protocol === 't') { | ||
return new tcp_1.TcpSocket({ host, port, timeout, keepAlive }); | ||
switch (protocol) { | ||
case 't': | ||
return new tcp_1.TcpSocket({ host, port, timeout, keepAlive }); | ||
case 's': | ||
default: | ||
return new tls_1.TlsSocket({ host, port, timeout, keepAlive }); | ||
} | ||
if (!protocol || protocol === 's') { | ||
return new tls_1.TlsSocket({ host, port, timeout, keepAlive }); | ||
} | ||
throw new errors_1.CustomError('Invalid protocol'); | ||
}; | ||
exports.createSocket = createSocket; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@trezor/blockchain-link", | ||
"version": "2.1.15", | ||
"version": "2.1.16", | ||
"author": "Trezor <info@trezor.io>", | ||
@@ -70,6 +70,6 @@ "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/blockchain-link", | ||
"dependencies": { | ||
"@trezor/blockchain-link-types": "1.0.4", | ||
"@trezor/blockchain-link-utils": "1.0.5", | ||
"@trezor/utils": "9.0.11", | ||
"@trezor/utxo-lib": "1.0.9", | ||
"@trezor/blockchain-link-types": "1.0.5", | ||
"@trezor/blockchain-link-utils": "1.0.6", | ||
"@trezor/utils": "9.0.12", | ||
"@trezor/utxo-lib": "1.0.10", | ||
"@types/web": "^0.0.100", | ||
@@ -76,0 +76,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
177262
4173
+ Added@trezor/blockchain-link-types@1.0.5(transitive)
+ Added@trezor/blockchain-link-utils@1.0.6(transitive)
+ Added@trezor/utils@9.0.12(transitive)
+ Added@trezor/utxo-lib@1.0.10(transitive)
- Removed@trezor/blockchain-link-types@1.0.4(transitive)
- Removed@trezor/blockchain-link-utils@1.0.5(transitive)
- Removed@trezor/utils@9.0.11(transitive)
- Removed@trezor/utxo-lib@1.0.9(transitive)
Updated@trezor/utils@9.0.12
Updated@trezor/utxo-lib@1.0.10