eos-detective
Advanced tools
Comparing version 0.3.0 to 0.4.0
import { Profile } from "../types/Profile"; | ||
export interface GetTableRows<T = Account> { | ||
rows: T[]; | ||
more: boolean; | ||
} | ||
export interface Account { | ||
account: string; | ||
score: number; | ||
metadata: string; | ||
timestamp: string; | ||
} | ||
/** | ||
* Get Report | ||
* | ||
* @example | ||
* | ||
* detective.reports.get("eosnationftw").then(data => { | ||
* console.log(data) | ||
* }) | ||
*/ | ||
export declare function get(account: string): Promise<Account>; | ||
/** | ||
* Post Report | ||
@@ -4,0 +24,0 @@ */ |
@@ -14,2 +14,33 @@ "use strict"; | ||
/** | ||
* Get Report | ||
* | ||
* @example | ||
* | ||
* detective.reports.get("eosnationftw").then(data => { | ||
* console.log(data) | ||
* }) | ||
*/ | ||
function get(account) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!account) { | ||
throw new Error("[account] is required"); | ||
} | ||
if (!config_1.settings.contract) { | ||
throw new Error("[settings.contract] is required"); | ||
} | ||
const code = config_1.settings.contract; | ||
const scope = config_1.settings.contract; | ||
const table = "accounts"; | ||
const lower_bound = account; | ||
const upper_bound = account; | ||
const json = true; | ||
const rows = yield config_1.settings.rpc.get_table_rows({ code, scope, table, lower_bound, upper_bound, json }); | ||
if (!rows.rows.length) { | ||
throw new Error(`[account::${account}] does not exist`); | ||
} | ||
return rows.rows[0]; | ||
}); | ||
} | ||
exports.get = get; | ||
/** | ||
* Post Report | ||
@@ -16,0 +47,0 @@ */ |
@@ -43,3 +43,3 @@ import { ApiResponse, TransfersData } from "../types/ApiResponse"; | ||
* | ||
* @default `["eosio.stake", "eosio.ram", "eosio.ramfee"]` | ||
* @default `[]` | ||
*/ | ||
@@ -46,0 +46,0 @@ excludes?: string[]; |
@@ -33,3 +33,3 @@ "use strict"; | ||
queryParams.accumulated = options.accumulated === undefined ? true : options.accumulated; | ||
queryParams.excludes = options.excludes || ["eosio.ram", "eosio.ramfee", "eosio.stake"]; | ||
queryParams.excludes = options.excludes || []; | ||
queryParams.quantity_min = options.quantity_min === undefined ? 1000 : Math.round(options.quantity_min * 10000); | ||
@@ -36,0 +36,0 @@ queryParams.time_min = options.time_min === undefined ? yesterday.toISOString() : options.time_min.toISOString(); |
@@ -15,3 +15,2 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const eosjs_1 = require("eosjs"); | ||
@@ -33,4 +32,4 @@ const eosjs_jssig_1 = __importDefault(require("eosjs/dist/eosjs-jssig")); | ||
this.actor = ""; | ||
this.permission = "active"; | ||
this.contract = "eosdetective"; | ||
this.permission = ""; | ||
this.contract = ""; | ||
} | ||
@@ -76,3 +75,3 @@ get signatureProvider() { | ||
} | ||
require('dotenv').config(path.join(__dirname, "..", ".env")); | ||
require('dotenv').config(token); | ||
exports.settings.token = process.env.DETECTIVE_TOKEN || exports.settings.token; | ||
@@ -79,0 +78,0 @@ exports.settings.contract = process.env.DETECTIVE_CONTRACT || exports.settings.contract; |
{ | ||
"name": "eos-detective", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "EOS Detective", | ||
@@ -19,18 +19,11 @@ "main": "dist/index.js", | ||
"docs": "typedoc --out docs src", | ||
"test": "tsc && nyc ava -v", | ||
"test": "jest --coverage", | ||
"posttest": "tslint --project ." | ||
}, | ||
"ava": { | ||
"compileEnhancements": false, | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"@types/jest": "*", | ||
"husky": "*", | ||
"jest": "*", | ||
"nyc": "*", | ||
"ts-jest": "*", | ||
"ts-node": "*", | ||
@@ -37,0 +30,0 @@ "tslint": "*", |
@@ -119,6 +119,16 @@ # EOS Detective | ||
``` | ||
```js | ||
detective.reports.remove("eosnationftw").then((trx_id) => { | ||
console.log("removed report", trx_id); | ||
}); | ||
``` | ||
``` | ||
## Get Report | ||
Fetches a single the report of a single account from the contract table data. | ||
```js | ||
detective.reports.get("altcoinomysa").then(data => { | ||
console.log(data) | ||
}) | ||
``` |
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
134
1
60220
10
39
1216