Skip to main content

A simple way to get different DEXs abis for block chains.

Project description

Many Abis

Version Pypi

GitHub Org's stars GitHub forks


Get different DEX abis easily for blockchain developers.


Now we support dex:



Installation

  • Download
pip install many-abis

# pypi
pip install -i https://pypi.org/simple many-abis

# update
pip install -U many-abis
# or
pip install -U -i https://pypi.org/simple many-abis

Usage

import many_abis as ma

# ======================================================================
# get all abi names
print(ma.ALL_ABIS_NAME)

# get all abis
print(ma.ABIS)

# you can access ABI by dot name
print(ma.ABIS.ERC20)


# ======================================================================
# get abi from address using etherscan api
ma.get_abi_from_address(
    "0x0841BD0B734E4F5853f0dD8d7Ea041c241fb0Da6",
    "YOUR API KEY",
    ma.CHAIN_CONTRACT_API.BSC
)

# ======================================================================
# chains
chains = ma.all_chains()
print(chains)
# ['arbitrum', 'avalanche', 'bsc', 'bsc-test', 'cronos', 'eth', 'fantom', 'heco', 'kcc', 'moonriver', 'okx', 'polygon', 'optimism']

# different methods to get chain
bsc = ma.get_chain_by_id(chain_id=56)
bsc = ma.get_chain_by_name(name="bsc")
bsc = ma.get_chain(name="bsc")
bsc = ma.get_chain(chain_id=56)
bsc = ma.chain(name="bsc")
bsc = ma.chain(chain_id=56)
print(bsc)

# use ['key'] or dot key name to access chain info
print(bsc['chain_id'])
# 56
print(bsc.name)
# Binance Smart Chain Mainnet
print(bsc.dex.pancake_v2.router_address)
# 0x10ED43C718714eb63d5aA57B78B54704E256024E

# to get some items from chain
eth_weth = ma.get('eth', 'weth')
print(eth_weth)
# {'address': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 'name': 'Wrapped ETH', 'symbol': 'WETH'}

ds = ma.get('bsc', 'dex', 'pancake_v2')
print(ds)
# {'factory_address': '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', 'name': 'PancakeSwap v2', 'router_address': '0x10ED43C718714eb63d5aA57B78B54704E256024E', 'website': 'https://pancakeswap.finance/swap'}

# print all dex
ma.print_all_dex()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

many_abis-0.1.8.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

many_abis-0.1.8-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file many_abis-0.1.8.tar.gz.

File metadata

  • Download URL: many_abis-0.1.8.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for many_abis-0.1.8.tar.gz
Algorithm Hash digest
SHA256 e9ce4f990c716333bfb67e36a7d67735382c52a35435e62f22438092b1fd1fcc
MD5 306447bb6408dc0631aa564969a1eb23
BLAKE2b-256 fa4278edae3d0015349a9ba1a7f0c396bac0dee3658ee2f3dd91f12146999ed7

See more details on using hashes here.

File details

Details for the file many_abis-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: many_abis-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for many_abis-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e1bfe724f4d9fff7598086dea2fbcc403b26023e0b23a95d42ed8d24d4e4409e
MD5 be948ed3262dba261028618eeb79a905
BLAKE2b-256 69f0ac1b82ebb1b31f94125723fde51b86a6a84833aa581e6b65bd5e00f7b35e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page