@starport/client-js
Advanced tools
Comparing version 0.1.47 to 0.1.48-beta.0
@@ -22,3 +22,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -25,0 +25,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
100
package.json
{ | ||
"name": "@starport/client-js", | ||
"version": "0.1.47", | ||
"description": "A generic JS client for the Websocket, high-level (Cosmos) and low-level (Tendermint) APIs", | ||
"author": "Tendermint, Inc <hello@tendermint.com>", | ||
"homepage": "https://github.com/tendermint/vue", | ||
"license": "Apache-2.0", | ||
"licenses": [ | ||
{ | ||
"type": "Apache-2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0" | ||
} | ||
], | ||
"main": "lib/SPClient.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"watch": "babel src --out-dir lib --extensions \".ts,.tsx\" --watch --source-maps", | ||
"build": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps", | ||
"tsc": "tsc", | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.13.10", | ||
"@babel/core": "7.13.10", | ||
"@babel/plugin-proposal-class-properties": "7.13.0", | ||
"@babel/preset-env": "7.13.10", | ||
"@babel/preset-typescript": "7.13.0", | ||
"@cosmjs/proto-signing": "0.25.0-alpha.2", | ||
"@types/node": "12.20.5", | ||
"@types/reconnectingwebsocket": "1.0.6", | ||
"@typescript-eslint/eslint-plugin": "4.18.0", | ||
"@typescript-eslint/parser": "4.18.0", | ||
"babel-loader": "8.2.2", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-plugin-prettier": "3.3.1", | ||
"prettier": "2.2.1", | ||
"typescript": "4.1.5" | ||
}, | ||
"dependencies": { | ||
"@cosmjs/stargate": "0.25.0-alpha.2", | ||
"@types/reconnectingwebsocket": "1.0.6", | ||
"axios": "0.21.1", | ||
"reconnecting-websocket": "4.4.0" | ||
}, | ||
"gitHead": "ca731429d0417bd03755e707f6d103d2c8866d75" | ||
"name": "@starport/client-js", | ||
"version": "0.1.48-beta.0+842aa9f", | ||
"description": "A generic JS client for the Websocket, high-level (Cosmos) and low-level (Tendermint) APIs", | ||
"author": "Tendermint, Inc <hello@tendermint.com>", | ||
"homepage": "https://github.com/tendermint/vue", | ||
"license": "Apache-2.0", | ||
"licenses": [ | ||
{ | ||
"type": "Apache-2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0" | ||
} | ||
], | ||
"main": "lib/SPClient.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"watch": "babel src --out-dir lib --extensions \".ts,.tsx\" --watch --source-maps", | ||
"build": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps", | ||
"tsc": "tsc", | ||
"lint": "eslint 'src/**/*.ts'", | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.16", | ||
"@babel/core": "^7.14.0", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/preset-env": "^7.14.1", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@types/node": "^12.20.5", | ||
"@types/reconnectingwebsocket": "^1.0.6", | ||
"@typescript-eslint/eslint-plugin": "^4.22.1", | ||
"@typescript-eslint/parser": "^4.22.1", | ||
"babel-loader": "^8.2.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"prettier": "^2.2.1", | ||
"typescript": "^4.2.4" | ||
}, | ||
"dependencies": { | ||
"@cosmjs/amino": "^0.25.0-alpha.3", | ||
"@cosmjs/crypto": "^0.25.0-alpha.3", | ||
"@cosmjs/launchpad": "^0.25.0-alpha.3", | ||
"@cosmjs/proto-signing": "^0.25.0-alpha.3", | ||
"@cosmjs/stargate": "^0.25.0-alpha.3", | ||
"@cosmjs/tendermint-rpc": "^0.25.0-alpha.3", | ||
"@cosmjs/utils": "^0.25.0-alpha.3", | ||
"@types/reconnectingwebsocket": "^1.0.6", | ||
"axios": "^0.21.1", | ||
"reconnecting-websocket": "^4.4.0" | ||
}, | ||
"gitHead": "842aa9f3a6f55ba68783f7bc84697304f7adf659" | ||
} |
@@ -12,3 +12,3 @@ import { EventEmitter } from 'events'; | ||
} | ||
export type QueryParamsType = Record<string | number, any>; | ||
export type QueryParamsType = Record<string | number, unknown>; | ||
export interface IFullRequestParams { | ||
@@ -20,3 +20,14 @@ body?: unknown; | ||
} | ||
export interface IResponse { | ||
data: string | ||
} | ||
export interface ITypedResponse { | ||
type: string | ||
} | ||
export interface IAPIResponse { | ||
data:unknown | ||
} | ||
export interface IParsedResponse { | ||
data: ITypedResponse | ||
} | ||
export default class SPClient extends EventEmitter { | ||
@@ -38,3 +49,3 @@ private apiAddr: string; | ||
this.wsAddr = wsAddr; | ||
const poll: any = this.connectivityTest.bind(this); | ||
const poll: () =>Promise<void> = this.connectivityTest.bind(this); | ||
this.timer = setInterval(poll, 5000); | ||
@@ -130,4 +141,4 @@ this.connectivityTest(); | ||
} | ||
private onMessageWS(msg: any): void { | ||
const result: any = JSON.parse(msg.data).result; | ||
private onMessageWS(msg: IResponse): void { | ||
const result: IParsedResponse = JSON.parse(msg.data).result; | ||
if (result.data && result.data.type === 'tendermint/event/NewBlock') { | ||
@@ -137,5 +148,5 @@ this.emit('newblock', JSON.parse(msg.data).result); | ||
} | ||
public async query(url: string, params = ''): Promise<any> { | ||
public async query(url: string, params = ''): Promise<unknown> { | ||
try { | ||
const response: any = await axios.get(this.apiAddr + url + params); | ||
const response: IAPIResponse = await axios.get(this.apiAddr + url + params); | ||
return response.data; | ||
@@ -150,3 +161,3 @@ } catch (e) { | ||
private addQueryParam(query: QueryParamsType, key: string): string { | ||
const value: any = query[key]; | ||
const value: unknown = query[key]; | ||
@@ -182,3 +193,3 @@ return ( | ||
} | ||
public async request<T = any>({ | ||
public async request<T = unknown>({ | ||
body, | ||
@@ -191,3 +202,3 @@ path, | ||
try { | ||
const response: AxiosPromise<any> = axios({ | ||
const response: AxiosPromise<T> = axios({ | ||
url, | ||
@@ -201,3 +212,3 @@ method, | ||
}); | ||
const data: AxiosResponse<any> = await response; | ||
const data: AxiosResponse<T> = await response; | ||
return data; | ||
@@ -204,0 +215,0 @@ } catch (e) { |
@@ -7,3 +7,4 @@ { | ||
"declaration": true, | ||
"allowSyntheticDefaultImports":true | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
58018
15
601
10
1
+ Added@cosmjs/launchpad@0.25.6(transitive)
+ Added@cosmjs/stargate@0.25.6(transitive)
+ Added@types/reconnectingwebsocket@1.0.10(transitive)
+ Addedaxios@0.21.4(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
- Removed@cosmjs/stargate@0.25.0-alpha.2(transitive)
- Removed@types/reconnectingwebsocket@1.0.6(transitive)
- Removedaxios@0.21.1(transitive)
Updatedaxios@^0.21.1