dapp-client
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { Package, Accountext } from "./types/dappservices"; | ||
import { Package, Accountext, Staking, Refunds } from "./types/dappservices"; | ||
import { GetInfo, GetTableRow, GetTableRows, GetTableByScope, GetCurrencyStats } from "./types"; | ||
@@ -64,2 +64,63 @@ import { HttpClient, Fetch } from "./HttpClient"; | ||
/** | ||
* Get TABLE staking | ||
* | ||
* @param {string} scope dsp account | ||
* @param {object} [options={}] optional params | ||
* @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
* @param {string} [options.upper_bound] Filters results to return the first element that is greater than provided value in set | ||
* @param {number} [options.limit=10] Limit the result amount | ||
* @param {boolean} [options.show_payer=false] Show Payer | ||
* @example | ||
* | ||
* const response = await client.get_table_staking('eosnationdsp', {limit: 500}); | ||
* | ||
* for (const row of response.rows) { | ||
* console.log(row); | ||
* // { | ||
* // id: 0, | ||
* // account: 'eosnationdsp', | ||
* // balance: '0.0000 DAPP', | ||
* // provider: 'eosnationdsp', | ||
* // service: 'ipfsservice1' | ||
* // } | ||
* } | ||
*/ | ||
get_table_staking(scope: string, options?: { | ||
lower_bound?: string; | ||
upper_bound?: string; | ||
limit?: number; | ||
show_payer?: boolean; | ||
}): Promise<GetTableRows<Staking>>; | ||
/** | ||
* Get TABLE refunds | ||
* | ||
* @param {string} scope dsp account | ||
* @param {object} [options={}] optional params | ||
* @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
* @param {string} [options.upper_bound] Filters results to return the first element that is greater than provided value in set | ||
* @param {number} [options.limit=10] Limit the result amount | ||
* @param {boolean} [options.show_payer=false] Show Payer | ||
* @example | ||
* | ||
* const response = await client.get_table_refunds('eosnationdsp', {limit: 500}); | ||
* | ||
* for (const row of response.rows) { | ||
* console.log(row); | ||
* // { | ||
* // id: 0, | ||
* // account: 'eosnationdsp', | ||
* // amount: '10.0000 DAPP', | ||
* // unstake_time: 12345678 | ||
* // provider: 'eosnationdsp', | ||
* // service: 'ipfsservice1' | ||
* // } | ||
* } | ||
*/ | ||
get_table_refunds(scope: string, options?: { | ||
lower_bound?: string; | ||
upper_bound?: string; | ||
limit?: number; | ||
show_payer?: boolean; | ||
}): Promise<GetTableRows<Refunds>>; | ||
/** | ||
* Get TABLE accountext | ||
@@ -66,0 +127,0 @@ * |
@@ -79,2 +79,57 @@ "use strict"; | ||
/** | ||
* Get TABLE staking | ||
* | ||
* @param {string} scope dsp account | ||
* @param {object} [options={}] optional params | ||
* @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
* @param {string} [options.upper_bound] Filters results to return the first element that is greater than provided value in set | ||
* @param {number} [options.limit=10] Limit the result amount | ||
* @param {boolean} [options.show_payer=false] Show Payer | ||
* @example | ||
* | ||
* const response = await client.get_table_staking('eosnationdsp', {limit: 500}); | ||
* | ||
* for (const row of response.rows) { | ||
* console.log(row); | ||
* // { | ||
* // id: 0, | ||
* // account: 'eosnationdsp', | ||
* // balance: '0.0000 DAPP', | ||
* // provider: 'eosnationdsp', | ||
* // service: 'ipfsservice1' | ||
* // } | ||
* } | ||
*/ | ||
get_table_staking(scope, options = {}) { | ||
return this.get_table_rows(this.dappservices, scope, "staking", options); | ||
} | ||
/** | ||
* Get TABLE refunds | ||
* | ||
* @param {string} scope dsp account | ||
* @param {object} [options={}] optional params | ||
* @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
* @param {string} [options.upper_bound] Filters results to return the first element that is greater than provided value in set | ||
* @param {number} [options.limit=10] Limit the result amount | ||
* @param {boolean} [options.show_payer=false] Show Payer | ||
* @example | ||
* | ||
* const response = await client.get_table_refunds('eosnationdsp', {limit: 500}); | ||
* | ||
* for (const row of response.rows) { | ||
* console.log(row); | ||
* // { | ||
* // id: 0, | ||
* // account: 'eosnationdsp', | ||
* // amount: '10.0000 DAPP', | ||
* // unstake_time: 12345678 | ||
* // provider: 'eosnationdsp', | ||
* // service: 'ipfsservice1' | ||
* // } | ||
* } | ||
*/ | ||
get_table_refunds(scope, options = {}) { | ||
return this.get_table_rows(this.dappservices, scope, "refunds", options); | ||
} | ||
/** | ||
* Get TABLE accountext | ||
@@ -81,0 +136,0 @@ * |
@@ -8,8 +8,8 @@ export interface Accountext { | ||
balance: string; | ||
last_usage: string; | ||
last_reward: string; | ||
last_usage: number; | ||
last_reward: number; | ||
package: string; | ||
pending_package: string; | ||
package_started: string; | ||
package_end: string; | ||
package_started: number; | ||
package_end: number; | ||
} | ||
@@ -29,1 +29,16 @@ export interface Package { | ||
} | ||
export interface Staking { | ||
id: number; | ||
account: string; | ||
balance: string; | ||
service: string; | ||
provider: string; | ||
} | ||
export interface Refunds { | ||
id: number; | ||
account: string; | ||
amount: string; | ||
unstake_time: number; | ||
service: string; | ||
provider: string; | ||
} |
@@ -11,1 +11,11 @@ /** | ||
export declare const DAPP = "......2ke1.o4"; | ||
/** | ||
* DAPPHDL | ||
* | ||
* @example | ||
* | ||
* import { names } from "dapp-client" | ||
* | ||
* names.DAPPHDL // => ".1a4cm2ke1.o4" | ||
*/ | ||
export declare const DAPPHDL = ".1a4cm2ke1.o4"; |
@@ -13,2 +13,12 @@ "use strict"; | ||
exports.DAPP = "......2ke1.o4"; | ||
/** | ||
* DAPPHDL | ||
* | ||
* @example | ||
* | ||
* import { names } from "dapp-client" | ||
* | ||
* names.DAPPHDL // => ".1a4cm2ke1.o4" | ||
*/ | ||
exports.DAPPHDL = ".1a4cm2ke1.o4"; | ||
//# sourceMappingURL=names.js.map |
{ | ||
"name": "dapp-client", | ||
"version": "0.6.0", | ||
"version": "0.7.1", | ||
"description": "DAPP JavaScript/TypeScript Client Library", | ||
@@ -19,3 +19,4 @@ "license": "MIT", | ||
"contributors": [ | ||
"Denis Carriere <denis@eosnation.io>" | ||
"Denis Carriere <denis@eosnation.io>", | ||
"Jan Langheimer <jan@eosindex.io>" | ||
], | ||
@@ -22,0 +23,0 @@ "directories": { |
103
README.md
@@ -64,30 +64,38 @@ # DAPP JavaScript/TypeScript Client Library | ||
- [Examples](#examples-1) | ||
- [get_table_accountext](#get_table_accountext) | ||
- [get_table_staking](#get_table_staking) | ||
- [Parameters](#parameters-2) | ||
- [Examples](#examples-2) | ||
- [get_table_rows](#get_table_rows) | ||
- [get_table_refunds](#get_table_refunds) | ||
- [Parameters](#parameters-3) | ||
- [Examples](#examples-3) | ||
- [get_all_table_rows](#get_all_table_rows) | ||
- [get_table_accountext](#get_table_accountext) | ||
- [Parameters](#parameters-4) | ||
- [Examples](#examples-4) | ||
- [dsp_get_table_row](#dsp_get_table_row) | ||
- [get_table_rows](#get_table_rows) | ||
- [Parameters](#parameters-5) | ||
- [Examples](#examples-5) | ||
- [get_table_by_scope](#get_table_by_scope) | ||
- [get_all_table_rows](#get_all_table_rows) | ||
- [Parameters](#parameters-6) | ||
- [Examples](#examples-6) | ||
- [get_currency_balance](#get_currency_balance) | ||
- [dsp_get_table_row](#dsp_get_table_row) | ||
- [Parameters](#parameters-7) | ||
- [Examples](#examples-7) | ||
- [get_currency_stats](#get_currency_stats) | ||
- [get_table_by_scope](#get_table_by_scope) | ||
- [Parameters](#parameters-8) | ||
- [Examples](#examples-8) | ||
- [get_currency_balance](#get_currency_balance) | ||
- [Parameters](#parameters-9) | ||
- [Examples](#examples-9) | ||
- [get_currency_stats](#get_currency_stats) | ||
- [Parameters](#parameters-10) | ||
- [Examples](#examples-10) | ||
- [get_info](#get_info) | ||
- [Examples](#examples-9) | ||
- [Examples](#examples-11) | ||
- [DAPP](#dapp) | ||
- [Examples](#examples-10) | ||
- [Examples](#examples-12) | ||
- [DAPPHDL](#dapphdl) | ||
- [Examples](#examples-13) | ||
- [delay](#delay) | ||
- [Parameters](#parameters-9) | ||
- [Examples](#examples-11) | ||
- [Parameters](#parameters-11) | ||
- [Examples](#examples-14) | ||
@@ -150,2 +158,63 @@ ### DappClient | ||
#### get_table_staking | ||
Get TABLE staking | ||
##### Parameters | ||
- `scope` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** dsp account | ||
- `options` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** optional params (optional, default `{}`) | ||
- `options.lower_bound` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filters results to return the first element that is not less than provided value in set | ||
- `options.upper_bound` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filters results to return the first element that is greater than provided value in set | ||
- `options.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Limit the result amount (optional, default `10`) | ||
- `options.show_payer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Show Payer (optional, default `false`) | ||
##### Examples | ||
```javascript | ||
const response = await client.get_table_staking('eosnationdsp', {limit: 500}); | ||
for (const row of response.rows) { | ||
console.log(row); | ||
// { | ||
// id: 0, | ||
// account: 'eosnationdsp', | ||
// balance: '0.0000 DAPP', | ||
// provider: 'eosnationdsp', | ||
// service: 'ipfsservice1' | ||
// } | ||
} | ||
``` | ||
#### get_table_refunds | ||
Get TABLE refunds | ||
##### Parameters | ||
- `scope` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** dsp account | ||
- `options` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** optional params (optional, default `{}`) | ||
- `options.lower_bound` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filters results to return the first element that is not less than provided value in set | ||
- `options.upper_bound` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filters results to return the first element that is greater than provided value in set | ||
- `options.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Limit the result amount (optional, default `10`) | ||
- `options.show_payer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Show Payer (optional, default `false`) | ||
##### Examples | ||
```javascript | ||
const response = await client.get_table_refunds('eosnationdsp', {limit: 500}); | ||
for (const row of response.rows) { | ||
console.log(row); | ||
// { | ||
// id: 0, | ||
// account: 'eosnationdsp', | ||
// amount: '10.0000 DAPP', | ||
// unstake_time: 12345678 | ||
// provider: 'eosnationdsp', | ||
// service: 'ipfsservice1' | ||
// } | ||
} | ||
``` | ||
#### get_table_accountext | ||
@@ -376,2 +445,14 @@ | ||
### DAPPHDL | ||
DAPPHDL | ||
#### Examples | ||
```javascript | ||
import { names } from "dapp-client" | ||
names.DAPPHDL // => ".1a4cm2ke1.o4" | ||
``` | ||
### delay | ||
@@ -378,0 +459,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
146708
6.54%2817
5.66%470
20.82%