diff --git a/build/lib/koios_python/__init__.py b/build/lib/koios_python/__init__.py deleted file mode 100644 index f5edf6b..0000000 --- a/build/lib/koios_python/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Provides all modules -""" -from .block import * -from .epoch import * -from .network import * -from .transactions import * -from .address import * -from .account import * -from .asset import * -from .pool import * -from .scripts import * -from .urls import * diff --git a/build/lib/koios_python/account.py b/build/lib/koios_python/account.py deleted file mode 100644 index 4528ae1..0000000 --- a/build/lib/koios_python/account.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python -""" -Provides all account functions -""" -import json -import requests - -def get_account_list(self): - """ - Get a list of all accounts. - - :return: string list of account (stake address: stake1... bech32 format) IDs. - :rtype: list. - """ - address_list = requests.get(self.ACCOUNT_LIST_URL, timeout=20) - address_list = json.loads(address_list.content) - return address_list - - -def get_account_info(self, *args): - """ - Get the account information for given stake addresses (accounts). - - :param str args: staking address/es in bech32 format (stake1...). - :return: list with all address data. - :rtype: list. - """ - get_format = {"_stake_addresses": [args] } - accounts_info = requests.post(self.ACCOUNT_INFO_URL, json= get_format , timeout=15) - accounts_info = json.loads(accounts_info.content) - return accounts_info - -def get_account_info_cached(self, *args): - """ - Get the account information for given stake addresses (accounts). - - :param str args: staking address/es in bech32 format (stake1...). - :return: list with all address data. - :rtype: list. - """ - get_format = {"_stake_addresses": [args] } - accounts_info = requests.post(self.ACCOUNT_INFO_URL_CACHED, json= get_format , timeout=15) - accounts_info = json.loads(accounts_info.content) - return accounts_info - - -def get_account_rewards(self, *args): - """ - Get the full rewards history (including MIR) for given stake addresses (accounts). - - :param str args: Cardano staking address (reward account) in bech32 format (stake1...) - :param int args: Epoch Number, has to be last parameter (optional). - return: list with all account rewards. - :rtype: list. - """ - epoch = args[len(args)-1] - - if not isinstance(epoch, int): - get_format = {"_stake_addresses": [args] } - rewards = requests.post(self.ACCOUNT_REWARDS_URL, json= get_format , timeout=20) - rewards = json.loads(rewards.content) - else: - get_format = {"_stake_addresses": [args], "_epoch_no": epoch} - rewards = requests.post(self.ACCOUNT_REWARDS_URL, json= get_format , timeout=10) - rewards = json.loads(rewards.content) - return rewards - - -def get_account_updates(self, *args): - """ - Get the account updates (registration, deregistration, delegation and withdrawals) for given \ - stake addresses (accounts) - - :param str args: staking address/es in bech32 format (stake1...) - :return: list with all account updates. - :rtype: list. - """ - get_format = {"_stake_addresses": [args]} - updates = requests.post(self.ACCOUNT_UPDATES_URL, json= get_format, timeout=10) - updates = json.loads(updates.content) - return updates - - -def get_account_addresses(self, *args): - """ - Get all addresses associated with given staking accounts. - - :param str args: staking address/es in bech32 format (stake1...) - :return: list with all account addresses. - :rtype: list. - """ - get_format = {"_stake_addresses": [args]} - addresses = requests.post(self.ACCOUNT_ADDRESSES_URL, json= get_format, timeout=10) - addresses = json.loads(addresses.content) - return addresses - - -def get_account_assets(self, *args): - """ - Get the native asset balance of given accounts. - - :param str args: staking address/es in bech32 format (stake1...) - :return: list with all account assets. - :rtype: list. - """ - get_format = {"_stake_addresses": [args]} - assets = requests.post(self.ACCOUNT_ASSETS_URL, json= get_format, timeout=10) - assets = json.loads(assets.content) - return assets - - -def get_account_history(self, *args): - """ - Get the staking history of given stake addresses (accounts). - - :param str address: staking address in bech32 format (stake1...) - return: list with all account history. - :rtype: list. - """ - epoch = args[len(args)-1] - - if not isinstance(epoch, int): - get_format = {"_stake_addresses": [args] } - history = requests.post(self.ACCOUNT_HISTORY_URL, json= get_format , timeout=10) - history = json.loads(history.content) - else: - get_format = {"_stake_addresses": [args], "_epoch_no": epoch} - history = requests.post(self.ACCOUNT_HISTORY_URL, json= get_format , timeout=10) - history = json.loads(history.content) - return history diff --git a/build/lib/koios_python/address.py b/build/lib/koios_python/address.py deleted file mode 100644 index b01a08a..0000000 --- a/build/lib/koios_python/address.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -""" -Provides all address functions -""" -import json -import requests - - -def get_address_info(self, *args): - """ - Get address info - balance, associated stake address (if any) and UTxO set. - - :param str address: wallet used public address(es). - return: list with data of this used public address. - :rtype: list. - """ - get_format = {"_addresses": [args] } - addresses = requests.post(self.ADDRESS_INFO_URL, json= get_format, timeout=10) - addresses = json.loads(addresses.content) - return addresses - - -def get_address_txs(self, address_tx, after_block=0): - """ - Get the transaction hash list of input address array, optionally filtering after specified - block height (inclusive) - - :param tx_hash: list or single transaction hash to search and read utxos data - :param after_block: filtering after block (inclusive) defaul is 0, from the beginning - :return: hash list of address transactions - """ - get_format = {"_addresses": [address_tx], "_after_block_height": str(after_block)} - hash_list = requests.post(self.ADDRESS_TXS_URL, json = get_format, timeout=10) - hash_list = json.loads(hash_list.content) - return hash_list - - -def get_address_assets(self, *args): - """ - Get the list of all the assets (policy, name and quantity) for a given address. - - :param str address: wallet used public address - return: list of all the assets - :rtype: list. - """ - get_format = {"_addresses": [args] } - addresses = requests.post(self.ADDRESS_ASSETS_URL, json= get_format , timeout=10) - addresses = json.loads(addresses.content) - return addresses - - -def get_credential_txs(self, payment_credentials, after_block=0): - """ - Get the transaction hash list of input payment credential array (stake key), optionally - filtering after specified block height (inclusive). - - :param str payment_credentials: list address payment credential array (stake key) - :param int after_block: filtering after block (inclusive) defaul is 0, from the beginning - :return: hash list of address transactions. - :rtype: list. - """ - get_format = {"_payment_credentials":[payment_credentials], "_after_block_height": after_block} - hash_list = requests.post(self.CREDENTIAL_TXS_URL, json = get_format, timeout=10) - hash_list = json.loads(hash_list.content) - return hash_list diff --git a/build/lib/koios_python/asset.py b/build/lib/koios_python/asset.py deleted file mode 100644 index f57c9a7..0000000 --- a/build/lib/koios_python/asset.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -""" -Provides all asset functions -""" -import json -import requests - -def get_asset_list(self): - """ - Get the list of all native assets (paginated) - - :return: list with all asset list. - :rtype: list. - """ - - asset_list = requests.get(self.ASSET_LIST_URL, timeout=10) - asset_list = json.loads(asset_list.content) - return asset_list - - -def get_asset_address_list(self, asset_policy, asset_name): - """ - Get the list of all addresses holding a given asset. - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :param str asset_name: string with Asset Name in hexadecimal format (hex). - :return: list of all addresses. - :rtype: list. - """ - - info = requests.get(f"{self.ASSET_ADDRESS_LIST_URL}{asset_policy}&_asset_name={asset_name}", timeout=10) - info = json.loads(info.content) - return info - - -def get_asset_info(self, asset_policy, asset_name): - """ - Get the information of an asset including first minting & token registry metadata. - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :param str asset_name: string with Asset Name in hexadecimal format (hex). - :return: list of all asset info. - :rtype: list. - """ - - info = requests.get(f"{self.ASSET_INFO_URL}{asset_policy}&_asset_name={asset_name}", timeout=10) - info = json.loads(info.content) - return info - - -def get_asset_history(self, asset_policy, asset_name): - """ - Get the mint/burn history of an asset. - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :param str asset_name: string with Asset Name in hexadecimal format (hex). - :return: list of asset mint/burn history. - :rtype: list. - """ - - history = requests.get(f"{self.ASSET_HISTORY_URL}{asset_policy}&_asset_name={asset_name}", timeout=10) - history = json.loads(history.content) - return history - - -def get_asset_policy_info(self, asset_policy): - """ - Get the information for all assets under the same policy. - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :return: list of all mint/burn transactions for an asset - :rtype: list. - """ - - info = requests.get(f"{self.ASSET_POLICY_INFO_URL}{asset_policy}", timeout=10) - info = json.loads(info.content) - return info - - -def get_asset_summary(self, asset_policy, asset_name): - """ - Get the summary of an asset (total transactions exclude minting/total wallets include only - wallets with asset balance). - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :param str asset_name: string with Asset Name in hexadecimal format (hex). - :return: list of asset summary information. - :rtype: list. - """ - summary = requests.get(f"{self.ASSET_SUMMARY_URL}{asset_policy}&_asset_name={asset_name}", timeout=10) - summary = json.loads(summary.content) - return summary - - -def get_asset_txs(self, asset_policy, asset_name, after_block_height=0): - """ - Get the list of all asset transaction hashes (newest first). - - :param str asset_policy: asset Policy ID in hexadecimal format (hex). - :param str asset_name: string with Asset Name in hexadecimal format (hex). - :param int after_block_height: Block height for specifying time delta, if not data start from 0 - :return: list of all asset hashes transactions. - :rtype: list. - """ - - txs = requests.get(f"{self.ASSET_TXS_URL}{asset_policy}&_asset_name={asset_name}&_after_block_height={after_block_height}", timeout=10) - txs = json.loads(txs.content) - return txs - \ No newline at end of file diff --git a/build/lib/koios_python/block.py b/build/lib/koios_python/block.py deleted file mode 100644 index 08f98f4..0000000 --- a/build/lib/koios_python/block.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -""" -Provides all block functions -""" -import json -import requests - - -def get_blocks(self,content_range="0-999"): - """ - Get summarised details about all blocks (paginated - latest first). - - :param str range: paginated content range, up to 1000 records. - :return: list of all blocks. - :rtype: list - """ - custom_headers = {"Range": str(content_range)} - blocks = requests.get(self.BLOCKS_URL, headers = custom_headers, timeout=10) - blocks = json.loads(blocks.content) - return blocks - - -def get_block_info(self,*block_hash): - """ - Get detailed information about a specific block or blocks - - :param str block_hash: block/s hash ID. - :return: list of detailed block information. - :rtype: list - """ - get_format = {"_block_hashes":[block_hash]} - block = requests.post(self.BLOCK_INFO_URL, json = get_format, timeout=10) - block = json.loads(block.content) - return block - - -def get_block_txs(self,*block_hash): - """ - Get a list of all transactions included in a provided block. - - :param str block_hash: block hash ID. - :return: list of transactions hashes. - :rtype: list - """ - get_format = {"_block_hashes":[block_hash]} - txs = requests.post(self.BLOCK_TXS_URL, json = get_format, timeout=10) - txs = json.loads(txs.content) - return txs diff --git a/build/lib/koios_python/epoch.py b/build/lib/koios_python/epoch.py deleted file mode 100644 index a0c70f9..0000000 --- a/build/lib/koios_python/epoch.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -""" -Provides all epoch functions -""" -import json -import requests - -def get_epoch_info(self, epoch_no=None): - """ - Get the epoch information, all epochs if no epoch specified. - - :param int epoch_no: epoch number to fetch details for. - :return: list of detailed summary for each epoch. - :rtype: list - """ - if epoch_no is None: - info = requests.get(self.EPOCH_INFO_URL, timeout=10) - print(self.EPOCH_INFO_URL) - info = json.loads(info.content) - else: - info = requests.get(f"{self.EPOCH_INFO_URL}?_epoch_no={epoch_no}", timeout=10) - print(self.EPOCH_INFO_URL) - info = json.loads(info.content) - return info - - -def get_epoch_params(self, epoch_no=None): - """ - Get the protocol parameters for specific epoch, returns information about all epochs - if no epoch specified. - - :param int epoch_no: epoch number to fetch details for. - :return: list of protocol parameters for each epoch. - :rtype: list - """ - if epoch_no is None: - info = requests.get(self.EPOCH_PARAMS_URL, timeout=10) - info = json.loads(info.content) - else: - info = requests.get(f"{self.EPOCH_PARAMS_URL}?_epoch_no={epoch_no}", timeout=10) - info = json.loads(info.content) - return info - -def get_epoch_block_protocols(self, epoch_no=None): - """ - Get the information about block protocol distribution in epoch - - :param int epoch_no: epoch number to fetch details for. - :return: list of distinct block protocol versions counts in epoch - :rtype: list - """ - if epoch_no is None: - info = requests.get(self.EPOCH_BLOCKS_URL, timeout=10) - info = json.loads(info.content) - else: - info = requests.get(f"{self.EPOCH_BLOCKS_URL}?_epoch_no={epoch_no}", timeout=10) - info = json.loads(info.content) - return info - diff --git a/build/lib/koios_python/network.py b/build/lib/koios_python/network.py deleted file mode 100644 index d999a32..0000000 --- a/build/lib/koios_python/network.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -""" -Provides all network functions -""" -import json -import requests -# from .urls import GENESIS_URL, TIP_URL, TOTALS_URL - -def get_tip(self): - """ - Get the tip info about the latest block seen by chain. - - :return: list of block summary (limit+paginated). - :rtype: list. - """ - tip = requests.get(self.TIP_URL, timeout=10) - tip = json.loads(tip.content) - return tip - - -def get_genesis(self): - """ - Get the Genesis parameters used to start specific era on chain. - - :return: list of genesis parameters used to start each era on chain. - :rtype: list. - """ - genesis = requests.get(self.GENESIS_URL, timeout=10) - genesis = json.loads(genesis.content) - return genesis - - -def get_totals(self, epoch_no=None): - """ - Get the circulating utxo, treasury, rewards, supply and reserves in lovelace for specified - epoch, all epochs if empty. - - :param int epoch_no: Epoch Number to fetch details for. - :return: list of of supply/reserves/utxo/fees/treasury stats. - :rtype: list. - """ - if epoch_no is None: - totals = requests.get(self.TOTALS_URL, timeout=10) - totals = json.loads(totals.content) - else: - totals = requests.get(f"{self.TOTALS_URL}?_epoch_no={epoch_no}", timeout=10) - totals = json.loads(totals.content) - return totals - \ No newline at end of file diff --git a/build/lib/koios_python/pool.py b/build/lib/koios_python/pool.py deleted file mode 100644 index 1127749..0000000 --- a/build/lib/koios_python/pool.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env python -""" -Provides all pool functions -""" -import json -import requests - - -def get_pool_list(self, content_range="0-999"): - """ - Get a list of all currently registered/retiring (not retired) pools. - - :param str range: paginated content range, up to 1000 records. - :return: list of all registered/retiring pools. - :rtype: list. - """ - custom_headers = {"Range": str(content_range)} - pool_list = requests.get(self.POOL_LIST_URL, headers = custom_headers, timeout=10) - pool_list = json.loads(pool_list.content) - return pool_list - - -def get_pool_info(self, *args): - """ - Get current pool status and details for a specified pool. - - :param str args: pool IDs in bech32 format (pool1...) - :return: list of pool information. - :rtype: list. - """ - get_format = {"_pool_bech32_ids": [args] } - pool_list = requests.post(self.POOL_INFO_URL, json = get_format, timeout=10) - pool_list = json.loads(pool_list.content) - return pool_list - - -def get_pool_stake_snapshot(self, pool_bech32): - """ - Returns Mark, Set and Go stake snapshots for the selected pool, useful for leaderlog calculation - - :param str pool_bech32: Pool IDs in bech32 format (pool1...) - :return: Array of pool stake information for 3 snapshots - :rtype: list. - """ - snapshot = requests.get(self.POOL_STAKE_SNAPSHOT + pool_bech32, timeout=10) - snapshot = json.loads(snapshot.content) - return snapshot - - -def get_pool_delegators(self, pool_bech32): - """ - Return information about live delegators for a given pool. - - :param str pool_bech32: pool IDs in bech32 format (pool1...). - :param str epoch_no: epoch number to get info (current if omitted). - :return: list of pool delegators information. - :rtype: list. - """ - info = requests.get(self.POOL_DELEGATORS_URL + pool_bech32, timeout=10) - info = json.loads(info.content) - return info - - -def get_pool_delegators_history(self, pool_bech32, epoch_no=None): - """ - Return information about active delegators (incl. history) for a given pool and epoch number \ - (all epochs if not specified). - - :param str pool_bech32: pool IDs in bech32 format (pool1...). - :param str epoch_no: epoch number to get info (current if omitted). - :return: list of pool delegators information. - :rtype: list. - """ - if epoch_no is None: - info = requests.get(self.POOL_DELEGATORS_HISTORY_URL + pool_bech32, timeout=10) - info = json.loads(info.content) - else: - info = requests.get(f"{self.POOL_DELEGATORS_HISTORY_URL}{pool_bech32}&_epoch_no={epoch_no}", timeout=10) - info = json.loads(info.content) - return info - - -def get_pool_blocks(self, pool_bech32, epoch_no=None): - """ - Return information about blocks minted by a given pool for all epochs (or _epoch_no if provided) - - :param str pool_bech32: pool IDs in bech32 format (pool1...). - :param str epoch_no: epoch number to get info (from the beginning if omitted). - :return: list of blocks created by pool. - :rtype: list.s - """ - if epoch_no is None: - info = requests.get(self.POOL_BLOCKS_URL + pool_bech32, timeout=10) - info = json.loads(info.content) - else: - info = requests.get(f"{self.POOL_BLOCKS_URL}{pool_bech32}&_epoch_no={epoch_no}", timeout=10) - info = json.loads(info.content) - return info - - -def get_pool_history(self, pool_bech32, epoch_no="history"): - """ - Return information about pool stake, block and reward history in a given epoch _epoch_no \ - (or all epochs that pool existed for, in descending order if no _epoch_no was provided) - - :param str pool_bech32: pool IDs in bech32 format (pool1...). - :param str epoch_no: epoch number to get info (from the beginning if omitted). - :return: list of blocks created by pool. - :rtype: list. - """ - if epoch_no == "history": - info = requests.get(f"{self.POOL_HISTORY_URL}{pool_bech32}", timeout=10) - info = json.loads(info.content) - else: - info = requests.get(f"{self.POOL_HISTORY_URL}{pool_bech32}&_epoch_no={epoch_no}", timeout=10) - info = json.loads(info.content) - return info - - -def get_pool_updates(self, pool_bech32=None): - """ - Get all pool updates for all pools or only updates for specific pool if specified. - - :param str pool_bech32: pool IDs in bech32 format (pool1...). - :return: list of historical pool updates. - :rtype: list. - """ - if pool_bech32 is None: - pool_list = requests.get(self.POOL_UPDATES_URL, timeout=10) - pool_list = json.loads(pool_list.content) - else: - pool_list = requests.get(f"{self.POOL_UPDATES_URL}?_pool_bech32={pool_bech32}", timeout=10) - pool_list = json.loads(pool_list.content) - return pool_list - - -def get_pool_relays(self, content_range="0-999"): - """ - Get a list of registered relays for all currently registered/retiring (not retired) pools. - - :param str range: paginated content range, up to 1000 records. - :return: list of pool relay information. - :rtype: list. - """ - custom_headers = {"Range": str(content_range)} - pool_list = requests.get(self.POOL_RELAYS_URL, headers = custom_headers, timeout=10) - pool_list = json.loads(pool_list.content) - return pool_list - - -def get_pool_metadata(self, *args): - """ - Get Metadata (on & off-chain) for all currently registered/retiring (not retired) pools. - - :param str args: pool IDs in bech32 format (pool1...). - :return: list of pool metadata. - :rtype: list. - """ - if len(args) == 0: - pool_list = requests.post(self.POOL_METADATA_URL, timeout=10) - pool_list = json.loads(pool_list.content) - else: - get_format = {"_pool_bech32_ids": [args]} - pool_list = requests.post(self.POOL_METADATA_URL, json = get_format, timeout=10) - pool_list = json.loads(pool_list.content) - return pool_list diff --git a/build/lib/koios_python/scripts.py b/build/lib/koios_python/scripts.py deleted file mode 100644 index 3605bbc..0000000 --- a/build/lib/koios_python/scripts.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -""" -Provides all scripts functions -""" -import json -import requests - - -def get_native_script_list(self, content_range="0-999"): - """ - Get list of all existing native script hashes along with their creation transaction hashes - - :param str range: paginated content range, up to 1000 records. - return: list of native script and creation tx hash pairs. - :rtype: list. - """ - custom_headers = {"Range": str(content_range)} - get_format = requests.post(self.NATIVE_SCRIPT_LIST_URL, headers = custom_headers, timeout=35) - get_format = json.loads(get_format.content) - return get_format - - -def get_plutus_script_list(self, content_range="0-999"): - """ - Get list of all existing Plutus script hashes along with their creation transaction hashes. - - :param str range: paginated content range, up to 1000 records. - return: list of Plutus script and creation tx hash pairs. - :rtype: list. - """ - custom_headers = {"Range": str(content_range)} - get_format = requests.post(self.PLUTUS_SCRIPT_LIST_URL, headers = custom_headers, timeout=30) - get_format = json.loads(get_format.content) - return get_format - - -def get_script_redeemers(self, script_hash): - """ - Get list of all redeemers for a given script hash. - - :params string script_hash: script hash in hexadecimal format (hex) to search and read data. - :return: list of all redeemers for a given script hash. - :rtype: list. - """ - query = requests.get(self.SCRIPT_REDEEMERS_URL + script_hash, timeout=30) - query = json.loads(query.content) - return query - - -def get_datum_info(self, *datum_hash): - ''' - Get list of datum information for given datum hashes - - :params string datum_hash: The Hash of the Plutus Data. - :return: the actual data in json form. - :rtype: list. - ''' - custom_headers = {"_datum_hashes": [datum_hash]} - get_format = requests.post(self.DATUM_INFO_URL, json = custom_headers, timeout=30) - get_format = json.loads(get_format.content) - return get_format \ No newline at end of file diff --git a/build/lib/koios_python/transactions.py b/build/lib/koios_python/transactions.py deleted file mode 100644 index 723c659..0000000 --- a/build/lib/koios_python/transactions.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -""" -Provides all transactions functions -""" -import json -import requests - - -def get_tx_info(self, *args): - """ - Get detailed information about transaction(s). - - :param list tx_hash: list of transaction(s) hash to search and read data. - :return: list of all info about transaction(s). - :rtype: list. - """ - get_format = {"_tx_hashes": [args]} - tx_info = requests.post(self.TX_INFO_URL, json = get_format, timeout=10) - tx_info = json.loads(tx_info.content) - return tx_info - - -def get_tx_utxos(self, *args): - """ - Get UTxO set (inputs/outputs) of transactions. - - :param list tx_hash: list of transaction(s) hash to search and read utxos data. - :return: all info about utxos in transaction(s) - :rtype: list. - """ - get_format = {"_tx_hashes": [args]} - tx_utxos = requests.post(self.TX_UTXOS_URL, json = get_format, timeout=10) - tx_utxos = json.loads(tx_utxos.content) - return tx_utxos - - -def get_tx_metadata(self, *args): - """ - Get metadata information (if any) for given transaction(s). - - :param list tx_hash: list strings of transaction(s) hash to search and read utxos data. - :return: list of all info about utxos in transaction(s) - :rtype: list. - """ - get_format = {"_tx_hashes": [args]} - tx_metadata = requests.post(self.TX_METADATA_URL, json = get_format, timeout=10) - tx_metadata = json.loads(tx_metadata.content) - return tx_metadata - - -def get_tx_metalabels(self, content_range="0-999"): - """ - Get a list of all transaction metalabels. - - :param str range: paginated content range, up to 1000 records. - :return: list of metalabels transactions - """ - custom_headers = {"Range": str(content_range)} - tx_metalabels = requests.get(self.TX_METALABELS_URL, headers \ - = custom_headers, timeout=10) - tx_metalabels = json.loads(tx_metalabels.content) - return tx_metalabels - - -def submit_tx(self, file): - """ - Submit an already serialized transaction to the network. You have to serialized the transaction - file with: xxd -r -p <<< $(jq .cborHex signed.txt) > signed.cbor - - :param file: a file with raw binary serialized transaction on the file-system. - :return: hex transaction ID (if is successful ) - """ - with open(file, "rb") as cbor_tx: - cbor_tx = cbor_tx.read() - cbor_header = {'Content-Type': 'application/cbor'} - submit = requests.post(self.SUBMIT_TX_URL, headers = cbor_header, \ - data = cbor_tx, timeout=25) - submit = json.loads(submit.content) - return submit - - -def get_tx_status(self, *args): - """ - Get the number of block confirmations for a given transaction hash list. - - :param list tx_hash: list of transaction(s) hash to search and read utxos data. - :return: list of all info about utxos in transaction(s) - :rtype: list. - """ - get_format = {"_tx_hashes": [args]} - tx_status = requests.post(self.TX_STATUS_URL, json = get_format, timeout=10) - tx_status = json.loads(tx_status.content) - return tx_status - \ No newline at end of file diff --git a/build/lib/koios_python/urls.py b/build/lib/koios_python/urls.py deleted file mode 100644 index 03bab1d..0000000 --- a/build/lib/koios_python/urls.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -""" -Provides all urls used in the library -""" - -class URLs: - # imported like class methods - from .epoch import get_epoch_info, get_epoch_params, get_epoch_block_protocols - from .network import get_tip, get_genesis, get_totals - from .block import get_blocks, get_block_info, get_block_txs - from .address import get_address_info, get_address_txs, get_address_assets, get_credential_txs - from .account import get_account_info, get_account_info_cached, get_account_list, get_account_rewards, get_account_updates, get_account_addresses, get_account_assets, get_account_history - from .asset import get_asset_list, get_asset_address_list, get_asset_info, get_asset_history, get_asset_policy_info, get_asset_summary, get_asset_txs - from .pool import get_pool_list, get_pool_info, get_pool_stake_snapshot, get_pool_delegators, get_pool_delegators_history, get_pool_blocks, get_pool_history, get_pool_updates, get_pool_relays, get_pool_metadata - from .scripts import get_native_script_list, get_plutus_script_list, get_script_redeemers, get_datum_info - from .transactions import get_tx_info, get_tx_utxos, get_tx_metadata, get_tx_metalabels, submit_tx, get_tx_status - - - def __init__(self, url='https://api.koios.rest/api/v0/', network='mainnet'): - - self.url = url - self.network = network - - # change subdomain to network name then change the rest of urls to use the new subdomain - if self.network == 'testnet': - # replace mainnet subdomain with "testnet" subdomain - self.url = self.url.replace(self.url.split('.')[0], self.network) - # add https:// to the url - self.url = 'https://' + self.url - elif self.network == 'mainnet': - self.url = url - - - # Network URLs - self.TIP_URL = self.url + "tip" - self.GENESIS_URL = self.url + "genesis" - self.TOTALS_URL = self.url + "totals" - # Epoch URLs - self.EPOCH_INFO_URL = self.url + "epoch_info" - self.EPOCH_PARAMS_URL = self.url + "epoch_params" - self.EPOCH_BLOCKS_URL = self.url + "epoch_block_protocols" - # Block URLs - self.BLOCKS_URL = self.url + "blocks" - self.BLOCK_INFO_URL = self.url + "block_info" - self.BLOCK_TXS_URL = self.url + "block_txs" - # Transaction URLs - self.TX_INFO_URL = self.url + "tx_info" - self.TX_UTXOS_URL = self.url + "tx_utxos" - self.TX_METADATA_URL = self.url + "tx_metadata" - self.TX_METALABELS_URL = self.url + "tx_metalabels" - self.SUBMIT_TX_URL = self.url + "submittx" - self.TX_STATUS_URL = self.url + "tx_status" - # Address URLs - self.ADDRESS_INFO_URL = self.url + "address_info" - self.ADDRESS_TXS_URL = self.url + "address_txs" - self.ADDRESS_ASSETS_URL = self.url + "address_assets" - self.CREDENTIAL_TXS_URL = self.url + "credential_txs" - # Account URLs - self.ACCOUNT_LIST_URL = self.url + "account_list" - self.ACCOUNT_INFO_URL = self.url + "account_info" - self.ACCOUNT_INFO_URL_CACHED = self.url + "account_info_cached" - self.ACCOUNT_REWARDS_URL = self.url + "account_rewards" - self.ACCOUNT_UPDATES_URL = self.url + "account_updates" - self.ACCOUNT_ADDRESSES_URL = self.url + "account_addresses" - self.ACCOUNT_ASSETS_URL = self.url + "account_assets" - self.ACCOUNT_HISTORY_URL = self.url + "account_history" - # Asset URLs - self.ASSET_LIST_URL = self.url + "asset_list" - self.ASSET_ADDRESS_LIST_URL = self.url + "asset_address_list?_asset_policy=" - self.ASSET_INFO_URL = self.url + "asset_info?_asset_policy=" - self.ASSET_HISTORY_URL = self.url + "asset_history?_asset_policy=" - self.ASSET_POLICY_INFO_URL = self.url + "asset_policy_info?_asset_policy=" - self.ASSET_SUMMARY_URL = self.url + "asset_summary?_asset_policy=" - self.ASSET_TXS_URL = self.url + "asset_txs?_asset_policy=" - - # Pool URLs - self.POOL_LIST_URL = self.url + "pool_list" - self.POOL_INFO_URL = self.url + "pool_info" - self.POOL_STAKE_SNAPSHOT = self.url + "pool_stake_snapshot?_pool_bech32=" - self.POOL_DELEGATORS_URL = self.url + "pool_delegators?_pool_bech32=" - self.POOL_DELEGATORS_HISTORY_URL = self.url + "pool_delegators_history?_pool_bech32=" - self.POOL_BLOCKS_URL = self.url + "pool_blocks?_pool_bech32=" - self.POOL_HISTORY_URL = self.url + "pool_history?_pool_bech32=" - self.POOL_UPDATES_URL = self.url + "pool_updates" - self.POOL_RELAYS_URL = self.url + "pool_relays" - self.POOL_METADATA_URL = self.url + "pool_metadata" - - # Scripts URLs - self.NATIVE_SCRIPT_LIST_URL = self.url + "native_script_list" - self.PLUTUS_SCRIPT_LIST_URL = self.url + "plutus_script_list" - self.SCRIPT_REDEEMERS_URL = self.url + "script_redeemers?_script_hash=" - self.DATUM_INFO_URL = self.url + "datum_info" diff --git a/dist/koios-python-1.0.0.tar.gz b/dist/koios-python-1.0.0.tar.gz deleted file mode 100644 index c50b5f5..0000000 Binary files a/dist/koios-python-1.0.0.tar.gz and /dev/null differ diff --git a/dist/koios_python-1.0.0-py3-none-any.whl b/dist/koios_python-1.0.0-py3-none-any.whl deleted file mode 100644 index df15bb3..0000000 Binary files a/dist/koios_python-1.0.0-py3-none-any.whl and /dev/null differ