import { get, post, TransactionHash } from '@tatumio/tatum-core'
import { AdaBlock, AdaBlockChainInfo, AdaTransaction, AdaUtxo, AdaAccount } from '../model'
/**
* Broadcasts signed transaction to the Ada blockchain.
* For more details, see Tatum API documentation
*
* @param txData
* @param signatureId
*/
export const adaBroadcast = async (txData: string, signatureId?: string): Promise =>
post(`/v3/ada/broadcast`, { txData, signatureId })
/**
* Returns information about Ada blockchain.
* For more details, see Tatum API documentation
*/
export const adaGetBlockChainInfo = async (): Promise => get(`/v3/ada/info`)
/**
* Returns block by its hash from Ada blockchain.
* For more details, see Tatum API documentation
*/
export const adaGetBlock = async (hash: string): Promise => get(`/v3/ada/block/${hash}`)
/**
* Returns transaction by hash from Ada blockchain.
* For more details, see Tatum API documentation
*/
export const adaGetTransaction = async (hash: string): Promise => get(`/v3/ada/transaction/${hash}`)
/**
* Returns transactions by address from Ada blockchain.
*
* @param address For which address will be transactions returned.
* @param limit How many transactions will be returned. Max number of transactions per page is 50.
* @param offset Offset to obtain the next page of data.
*
* For more details, see Tatum API documentation
*/
export const adaGetTransactionsByAccount = async (address: string, pageSize = 50, offset = 0): Promise =>
get(`/v3/ada/transaction/address/${address}?pageSize=${pageSize}&offset=${offset}`)
/**
* Returns UTXOs by address from Ada blockchain.
* For more details, see Tatum API documentation
*/
export const adaGetUtxos = async (address: string): Promise => get(`/v3/ada/${address}/utxos`)
/**
* Returns account balances for a given address
*
* For more details, see Tatum API documentation
*/
export const adaGetAccountsByAddress = async (address: string): Promise => get(`/v3/ada/account/${address}`)