diff --git a/src/dto/rpc/EosRpcSuite.ts b/src/dto/rpc/EosRpcSuite.ts index ea1dd512ba..eea5ff9f31 100644 --- a/src/dto/rpc/EosRpcSuite.ts +++ b/src/dto/rpc/EosRpcSuite.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { BigNumber } from 'bignumber.js' import { AbstractRpcInterface } from './AbstractJsonRpcInterface' -interface GetProducersI { +interface GetProducers { json?: boolean lowerBound?: string limit?: number @@ -19,14 +18,17 @@ interface Action { // Definition for Authority interface Authority { - // Fill in the fields for Authority based on your needs + actor: 'NamePrivileged' | 'NameBasic' | 'NameBid' | 'NameCatchAll' + permission: 'NamePrivileged' | 'NameBasic' | 'NameBid' | 'NameCatchAll' } // Definition for Extension type Extension = Array +type PublicKeys = string[] + // Main Transaction interface -interface TransactionI { +interface Transaction { expiration: string // DateTime in string format refBlockNum: number refBlockPrefix: number @@ -35,33 +37,152 @@ interface TransactionI { delaySec: number contextFreeActions: Action[] actions: Action[] - transactionExtensions: Extension[] + transactionExtensions?: Extension[] +} + +interface GetRequiredKeys { + transaction: Transaction + availableKeys: PublicKeys +} + +interface PushTransaction { + signatures: string[] + compression: boolean + packedContextFreeData: string + packedTrx: string +} + +interface BlockNumOrId { + blockNumOrId: string +} + +interface BlockNum { + blockNum: number +} + +interface AccountName { + accountName: string +} + +interface GetCurrencyBalance { + code: string + account: string + symbol: string } -interface GetRequiredKeysI { - transaction: TransactionI - availableKeys: string[] +interface GetCurrencyStats { + code: string + symbol: string } export interface EosRpcSuite extends AbstractRpcInterface { /** - * Validates a Tron address. + * Returns an object containing various details about a specific account on the blockchain. + * + * @param body - The name of the account to retrieve. + * @return {Promise} - A promise that resolves with the account information. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_account + */ + getAccount(body: AccountName): Promise + + /** + * Returns an object containing various details about a specific block on the blockchain. + * + * @param body - The number or ID of the block to retrieve. + * @return {Promise} - A promise that resolves with the block information. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_block + */ + getBlock(body: BlockNumOrId): Promise + + /** + * Similar to get_block but returns a fixed-size smaller subset of the block data. + * + * @param body - The number or ID of the block to retrieve. + * @return {Promise} - A promise that resolves with the block information. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_block_info + */ + getBlockInfo(body: BlockNum): Promise + + /** + * Returns an object containing various details about the blockchain. * - * @param {string} address - The Tron address to be validated. - * @param {VisibleOption} [options] - The options for validation. - * @returns {Promise} - Returns a Promise that resolves with validation result. - * https://docs.tatum.com/docs/rpc-api-reference/tron-rpc-documentation/api-calls-for-address-utility-methods/validateaddress + * @return {Promise} - A promise that resolves with the blockchain information. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_info */ - validateAddress(address: string, options?: VisibleOption): Promise + getInfo(): Promise /** - * Broadcasts a raw Tron transaction. + * This method expects a transaction in JSON format and will attempt to apply it to the blockchain. + * @param body - The transaction to push. + * @return {Promise} - Returns nothing on success. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/push_transaction + */ + pushTransaction(body: PushTransaction): Promise + + /** + * This method expects a transaction in JSON format and will attempt to apply it to the blockchain. + * @param body - The transaction to push. + * @return {Promise} - Returns nothing on success. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/send_transaction + */ + sendTransaction(body: PushTransaction): Promise + + /** + * This method expects a transaction in JSON format and will attempt to apply it to the blockchain. + * @param transactions + * @return {Promise} - Returns nothing on success. + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/push_transactions + */ + pushTransactions(transactions: Transaction[]): Promise + + /** + * Retrieves the block header state + * + * @param body - The block number or ID to retrieve. + * @return {Promise} - block header state + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_block_header_state + */ + getBlockHeaderState(body: BlockNumOrId): Promise + + /** + * Retrieves the ABI for a contract based on its account name * - * @param {TronTxRawBody} rawBody - The raw body of the transaction to be broadcasted. - * @returns {Promise} - Returns a Promise that resolves with the broadcast result. - * https://docs.tatum.com/docs/rpc-api-reference/tron-rpc-documentation/api-calls-for-transaction-methods/broadcasttransaction + * @param body - The account name to retrieve the ABI for. + * @return {Promise} - ABI for a contract + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_abi */ - broadcastTransaction(rawBody: TronTxRawBody): Promise + getAbi(body: AccountName): Promise - getProducers(body: GetProducersI): Promise + /** + * Retrieves the current balance + * + * @param body - The currency balance to retrieve. + * @return {Promise} - current balance + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_currency_balance + */ + getCurrencyBalance(body: GetCurrencyBalance): Promise + + /** + * Retrieves currency stats + * @param body - The currency stats to retrieve. + * @return {Promise} - currency stats + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_currency_stats + */ + getCurrencyStats(body: GetCurrencyStats): Promise + + /** + * Returns the required keys needed to sign a transaction. + * @param body - The transaction to retrieve required keys for. + * @return {Promise} - required keys + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_required_keys + */ + getRequiredKeys(body: GetRequiredKeys): Promise + + /** + * Retrieves producers list + * @param body - The producers list to retrieve. + * @return {Promise} - producers list + * https://developers.eos.io/manuals/eos/v2.2/nodeos/plugins/chain_api_plugin/api-reference/index#operation/get_producers + */ + getProducers(body: GetProducers): Promise }