dapp-client
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -1,2 +0,2 @@ | ||
import { GetInfo, GetTableRows, GetTableByScope, Package, Accountext, GetCurrencyStats } from "../types"; | ||
import { GetInfo, GetTableRow, GetTableRows, GetTableByScope, Package, Accountext, GetCurrencyStats } from "../types"; | ||
import { HttpClient, Fetch } from "./HttpClient"; | ||
@@ -100,4 +100,4 @@ /** | ||
* @param {string} code The name of the smart contract that controls the provided table | ||
* @param {string} scope The account to which this data belongs | ||
* @param {string} table The name of the table to query | ||
* @param {string} scope The account to which this data belongs | ||
* @param {object} [options={}] optional params | ||
@@ -131,2 +131,38 @@ * @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
/** | ||
* [GET /v1/dsp/ipfsservice1/get_table_row](https://docs.liquidapps.io) | ||
* | ||
* Returns an object containing row from the specified table. | ||
* | ||
* @param {string} contract The name of the smart contract that controls the provided table | ||
* @param {string} scope The account to which this data belongs | ||
* @param {string} table The name of the table to query | ||
* @param {string} key The key value to query | ||
* @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 | ||
* @param {boolean} [options.json=true] JSON response | ||
* @param {number} [options.index_position=1] Position of the index used | ||
* @param {string} [options.key_type] Type of key specified by index_position (for example - uint64_t or name) | ||
* @param {string} [options.table_key] Table Key | ||
* @param {string} [options.encode_type] Encode type | ||
* @returns {Promise<GetTableRows>} table rows | ||
* @example | ||
* | ||
* const response = await rpc.dsp_get_table_row("<contract>", "<scope>", "<table>", "<key>"); | ||
* console.log(response); | ||
*/ | ||
dsp_get_table_row<T = unknown>(contract: string, scope: string, table: string, key: string, options?: { | ||
index_position?: number; | ||
json?: boolean; | ||
key_type?: string; | ||
lower_bound?: string; | ||
upper_bound?: string; | ||
table_key?: string; | ||
encode_type?: string; | ||
show_payer?: boolean; | ||
limit?: number; | ||
}): Promise<GetTableRow<T>>; | ||
/** | ||
* [GET /v1/chain/get_table_by_scope](https://developers.eos.io/eosio-nodeos/reference#get_table_by_scope) | ||
@@ -133,0 +169,0 @@ * |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const endpoints_1 = require("../types/endpoints"); | ||
const endpoints = __importStar(require("../types/endpoints")); | ||
const types_1 = require("../types"); | ||
@@ -97,4 +104,4 @@ const HttpClient_1 = require("./HttpClient"); | ||
* @param {string} code The name of the smart contract that controls the provided table | ||
* @param {string} scope The account to which this data belongs | ||
* @param {string} table The name of the table to query | ||
* @param {string} scope The account to which this data belongs | ||
* @param {object} [options={}] optional params | ||
@@ -127,3 +134,3 @@ * @param {string} [options.lower_bound] Filters results to return the first element that is not less than provided value in set | ||
const show_payer = options.show_payer === true ? true : false; | ||
return this.post(endpoints_1.V1_GET_TABLE_ROWS, { | ||
return this.post(endpoints.V1_GET_TABLE_ROWS, { | ||
code, | ||
@@ -144,2 +151,54 @@ table, | ||
/** | ||
* [GET /v1/dsp/ipfsservice1/get_table_row](https://docs.liquidapps.io) | ||
* | ||
* Returns an object containing row from the specified table. | ||
* | ||
* @param {string} contract The name of the smart contract that controls the provided table | ||
* @param {string} scope The account to which this data belongs | ||
* @param {string} table The name of the table to query | ||
* @param {string} key The key value to query | ||
* @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 | ||
* @param {boolean} [options.json=true] JSON response | ||
* @param {number} [options.index_position=1] Position of the index used | ||
* @param {string} [options.key_type] Type of key specified by index_position (for example - uint64_t or name) | ||
* @param {string} [options.table_key] Table Key | ||
* @param {string} [options.encode_type] Encode type | ||
* @returns {Promise<GetTableRows>} table rows | ||
* @example | ||
* | ||
* const response = await rpc.dsp_get_table_row("<contract>", "<scope>", "<table>", "<key>"); | ||
* console.log(response); | ||
*/ | ||
dsp_get_table_row(contract, scope, table, key, options = {}) { | ||
// Optional params | ||
const json = options.json === false ? false : true; | ||
const index_position = options.index_position || 1; | ||
const limit = options.limit || 10; | ||
const key_type = options.key_type || ""; | ||
const table_key = options.table_key || ""; | ||
const lower_bound = options.lower_bound || ""; | ||
const upper_bound = options.upper_bound || ""; | ||
const encode_type = options.encode_type || ""; | ||
const show_payer = options.show_payer === true ? true : false; | ||
return this.post(endpoints.V1_DSP_GET_TABLE_ROW, { | ||
contract, | ||
table, | ||
scope, | ||
key, | ||
json, | ||
index_position, | ||
key_type, | ||
table_key, | ||
lower_bound, | ||
upper_bound, | ||
encode_type, | ||
show_payer, | ||
limit, | ||
}); | ||
} | ||
/** | ||
* [GET /v1/chain/get_table_by_scope](https://developers.eos.io/eosio-nodeos/reference#get_table_by_scope) | ||
@@ -169,3 +228,3 @@ * | ||
const reverse = options.reverse === true ? true : false; | ||
return this.post(endpoints_1.V1_GET_TABLE_BY_SCOPE, { | ||
return this.post(endpoints.V1_GET_TABLE_BY_SCOPE, { | ||
code, | ||
@@ -194,3 +253,3 @@ table, | ||
get_currency_balance(code, account, symbol) { | ||
return this.post(endpoints_1.V1_GET_CURRENCY_BALANCE, { | ||
return this.post(endpoints.V1_GET_CURRENCY_BALANCE, { | ||
code, | ||
@@ -215,3 +274,3 @@ account, | ||
get_currency_stats(code, symbol) { | ||
return this.post(endpoints_1.V1_GET_CURRENCY_STATS, { | ||
return this.post(endpoints.V1_GET_CURRENCY_STATS, { | ||
code, | ||
@@ -233,3 +292,3 @@ symbol, | ||
get_info() { | ||
return this.post(endpoints_1.V1_GET_INFO); | ||
return this.post(endpoints.V1_GET_INFO); | ||
} | ||
@@ -236,0 +295,0 @@ } |
@@ -6,1 +6,2 @@ export declare const V1_GET_INFO = "/v1/chain/get_info"; | ||
export declare const V1_GET_CURRENCY_BALANCE = "/v1/chain/get_currency_balance"; | ||
export declare const V1_DSP_GET_TABLE_ROW = "/v1/dsp/ipfsservice1/get_table_row"; |
@@ -9,2 +9,4 @@ "use strict"; | ||
exports.V1_GET_CURRENCY_BALANCE = "/v1/chain/get_currency_balance"; | ||
// DSP | ||
exports.V1_DSP_GET_TABLE_ROW = "/v1/dsp/ipfsservice1/get_table_row"; | ||
//# sourceMappingURL=endpoints.js.map |
export { GetTableRows } from "./chain/get_table_rows"; | ||
export { GetTableRow } from "./chain/get_table_row"; | ||
export { GetTableByScope } from "./chain/get_table_by_scope"; | ||
@@ -3,0 +4,0 @@ export { GetInfo } from "./chain/get_info"; |
{ | ||
"name": "dapp-client", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "DAPP JavaScript/TypeScript Client Library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -47,2 +47,5 @@ # DAPP JavaScript/TypeScript Client Library | ||
/v1/chain/get_table_rows | ||
# DSP | ||
/v1/dsp/ipfsservice1/get_table_row | ||
``` | ||
@@ -70,34 +73,37 @@ | ||
- [Examples](#examples-4) | ||
- [get_table_by_scope](#get_table_by_scope) | ||
- [dsp_get_table_row](#dsp_get_table_row) | ||
- [Parameters](#parameters-4) | ||
- [Examples](#examples-5) | ||
- [get_currency_balance](#get_currency_balance) | ||
- [get_table_by_scope](#get_table_by_scope) | ||
- [Parameters](#parameters-5) | ||
- [Examples](#examples-6) | ||
- [get_currency_stats](#get_currency_stats) | ||
- [get_currency_balance](#get_currency_balance) | ||
- [Parameters](#parameters-6) | ||
- [Examples](#examples-7) | ||
- [get_currency_stats](#get_currency_stats) | ||
- [Parameters](#parameters-7) | ||
- [Examples](#examples-8) | ||
- [get_info](#get_info) | ||
- [Examples](#examples-8) | ||
- [Examples](#examples-9) | ||
- [claimrewards](#claimrewards) | ||
- [Parameters](#parameters-7) | ||
- [Examples](#examples-9) | ||
- [closeprv](#closeprv) | ||
- [Parameters](#parameters-8) | ||
- [Examples](#examples-10) | ||
- [closeprv](#closeprv) | ||
- [Parameters](#parameters-9) | ||
- [Examples](#examples-11) | ||
- [modifypkg](#modifypkg) | ||
- [Parameters](#parameters-9) | ||
- [Parameters](#parameters-10) | ||
- [refund](#refund) | ||
- [Parameters](#parameters-10) | ||
- [Examples](#examples-11) | ||
- [Parameters](#parameters-11) | ||
- [Examples](#examples-12) | ||
- [regpkg](#regpkg) | ||
- [Parameters](#parameters-11) | ||
- [Parameters](#parameters-12) | ||
- [selectpkg](#selectpkg) | ||
- [Parameters](#parameters-12) | ||
- [Parameters](#parameters-13) | ||
- [stake](#stake) | ||
- [Parameters](#parameters-13) | ||
- [Parameters](#parameters-14) | ||
- [transfer](#transfer) | ||
- [Parameters](#parameters-14) | ||
- [Parameters](#parameters-15) | ||
- [unstake](#unstake) | ||
- [Parameters](#parameters-15) | ||
- [Parameters](#parameters-16) | ||
@@ -237,2 +243,34 @@ ### DAPP | ||
#### dsp_get_table_row | ||
[GET /v1/dsp/ipfsservice1/get_table_row](https://docs.liquidapps.io) | ||
Returns an object containing row from the specified table. | ||
##### Parameters | ||
- `contract` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the smart contract that controls the provided table | ||
- `scope` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The account to which this data belongs | ||
- `table` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the table to query | ||
- `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The key value to query | ||
- `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`) | ||
- `options.json` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** JSON response (optional, default `true`) | ||
- `options.index_position` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Position of the index used (optional, default `1`) | ||
- `options.key_type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Type of key specified by index_position (for example - uint64_t or name) | ||
- `options.table_key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Table Key | ||
- `options.encode_type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Encode type | ||
##### Examples | ||
```javascript | ||
const response = await rpc.dsp_get_table_row("<contract>", "<scope>", "<table>", "<key>"); | ||
console.log(response); | ||
``` | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<GetTableRows>** table rows | ||
#### get_table_by_scope | ||
@@ -239,0 +277,0 @@ |
Sorry, the diff of this file is not supported yet
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
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
86728
57
1673
482