Comparing version 0.0.14 to 0.0.15
@@ -7,3 +7,3 @@ /* prettier-ignore-start */ | ||
import DB from '../../DB'; | ||
import { DB } from '../../DB'; | ||
@@ -10,0 +10,0 @@ jest.setTimeout(30000); |
@@ -13,3 +13,16 @@ import axios, { AxiosInstance, AxiosResponse } from 'axios'; | ||
export default class { | ||
export class DB { | ||
/** | ||
* @description Query blocks | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getBlock | ||
* @param {string} height | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getBlock(height: string = 'latest'): Promise<any> { | ||
@@ -19,2 +32,15 @@ return request.get(`/blocks/${height}`).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Query transactions | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getTransaction | ||
* @param {string} hash | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getTransaction(hash: string): Promise<any> { | ||
@@ -24,2 +50,15 @@ return request.get(`/txs/${hash}`).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Query last "N" transactions | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getLatestTransactions | ||
* @param {number} count | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getLatestTransactions(count: number): Promise<any> { | ||
@@ -29,2 +68,15 @@ return request.get(`/txs/last`, { params: { count } }).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Search transactions | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method searchTxs | ||
* @param {any} params | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async searchTxs(params: any): Promise<any> { | ||
@@ -34,2 +86,15 @@ return request.get(`/search`, { params }).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Request tokens | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method requestTokens | ||
* @param {string} address | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async requestTokens(address: string): Promise<any> { | ||
@@ -39,2 +104,14 @@ return request.get(`/faucet/${address}`).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Query last block | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getCurrentBlock | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getCurrentBlock(): Promise<any> { | ||
@@ -44,2 +121,15 @@ return this.getBlock('latest'); | ||
/** | ||
* @description Get total blocks/transactions | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getTotal | ||
* @param {string} type - blocks or txs | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getTotal(type: string): Promise<any> { | ||
@@ -49,2 +139,15 @@ return request.get(`/total/${type}`).then(({ data }: AxiosResponse): any => data); | ||
/** | ||
* @description Query price history | ||
* <pre> | ||
* 200 - OK | ||
* 500 - Internal Server Error | ||
* </pre> | ||
* | ||
* @public | ||
* @method getPriceHistory | ||
* @param {string} ticker | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
static async getPriceHistory(ticker: string): Promise<any> { | ||
@@ -51,0 +154,0 @@ const limit: number = 100; |
{ | ||
"name": "dfin-jsdk", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"license": "MIT", | ||
@@ -31,3 +31,3 @@ "files": [ | ||
"typedoc:serve": "cd documentation && ws", | ||
"deploy": "npm-run-all --sequential make format && cp package.json src/services/sdk && concat-md --toc --decrease-title-levels --dir-name-as-title markdown > src/services/sdk/README.md && cd src/services/sdk && npm publish" | ||
"deploy": "npm-run-all --sequential make && cp package.json src/services/sdk && concat-md --toc --decrease-title-levels --dir-name-as-title markdown > src/services/sdk/README.md && cd src/services/sdk && npm publish" | ||
}, | ||
@@ -50,3 +50,3 @@ "dependencies": { | ||
"multimatch": "^4.0.0", | ||
"prettier": "^2.0.5", | ||
"prettier": "^2.1.1", | ||
"secp256k1": "^4.0.2", | ||
@@ -65,3 +65,3 @@ "sha.js": "^2.4.11" | ||
"@types/js-yaml": "^3.12.5", | ||
"@types/lodash": "^4.14.159", | ||
"@types/lodash": "^4.14.160", | ||
"@types/multimatch": "^4.0.0", | ||
@@ -85,7 +85,7 @@ "@types/node": "^14.6.0", | ||
"showdown": "^1.9.1", | ||
"ts-jest": "^26.2.0", | ||
"ts-loader": "^8.0.2", | ||
"ts-jest": "^26.3.0", | ||
"ts-loader": "^8.0.3", | ||
"tslint": "^6.1.3", | ||
"typedoc": "^0.18.0", | ||
"typedoc-plugin-markdown": "^2.4.1", | ||
"typedoc-plugin-markdown": "^2.4.2", | ||
"typescript": "^4.0.2", | ||
@@ -96,4 +96,4 @@ "uglifyjs-webpack-plugin": "^2.2.0", | ||
"webpack-dev-server": "^3.11.0", | ||
"webpack-node-externals": "^2.5.1" | ||
"webpack-node-externals": "^2.5.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
2424919
47312
10915
Updatedprettier@^2.1.1