morphit/node_modules/@beblurt/dblurt/lib/helpers/database.d.ts
Morphit Team 24240cef4c
Some checks failed
morphit-release / Build + publish release tarball (push) Has been cancelled
Reputation flags clearable across all four signals; names and avatars stop vanishing
2026-07-23 14:28:04 -07:00

80 lines
3.7 KiB
TypeScript

/**
* @file Blurt Database API helpers.
* @author BeBlurt <https://beblurt.com/@beblurt>
* @description adaptation from Johan Nordberg <code@johan-nordberg.com> Database API helpers.
* @license
* Copyright (c) 2017 Johan Nordberg. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You acknowledge that this software is not designed, licensed or intended for use
* in the design, construction, operation or maintenance of any military facility.
*/
import { Account } from '../chain/account';
import { RpcNodeConfig } from '../chain/misc';
import { Client } from './../client';
export interface WitnessVotes {
id: number;
witness: string;
account: string;
}
export declare class DatabaseAPI {
readonly client: Client;
constructor(client: Client);
/** Convenience for calling `database_api`. */
call(method: string, params?: any[] | {
[key: string]: any;
}): Promise<any>;
/** Return server config. */
getConfig(): Promise<RpcNodeConfig>;
/**
* Return a list of accounts.
* @param start String or array for pagination
* @param limit Number of results, max 1000
* @param order by_next_vesting_withdrawal: in this case start is a date eg: ["1970-01-01T00:00:00", ""]
* @param delayed_votes_active Default true (optional)
*/
getListAccounts(start: string | string[], limit: number, order: 'by_name' | 'by_proxy' | 'by_next_vesting_withdrawal', delayed_votes_active?: boolean): Promise<{
accounts: Account[];
}>;
/**
* Returns a list of witness votes.
* @param start Depends on order (see below)
* @param limit Number of results, max 1000
* @param order by_account_witness: start is an array of two values: account, witness |
* by_witness_account: start is an array of two values: witness, account
* @example
* Voters of a witness
* ```typescript
* const accounts = await client.database.getListWitnessVotes(['nalexadre', null], 10, 'by_witness_account')
* ```
*/
getListWitnessVotes(start: [string | null, string | null], limit: number, order: 'by_account_witness' | 'by_witness_account'): Promise<{
votes: WitnessVotes[];
}>;
/** return rpc node version */
getVersion(): Promise<object>;
}