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

  • Get dex and eth from default settings.
import many_abis as ma

# ===================================
# chain, use upper str to access
chain = ma.get('BSC')

# for now, we collect this chains
support_chains = ma.SUPPORT_CHAIN
print(support_chains)
# ['BSC', 'ETH', 'AVAX', 'FANTOM', 'POLYGON', 'HECO', 'KCC', 'OKEX', 'MOONRIVER', 'ARBITRUM', 'BSC_TEST']

# print basic chain information
print(chain)
# Chain Name: Binance Smart Chain, Explorer: https://bscscan.com/, DEX: dict_keys(['pancake_v2', 'mdex_bsc', 'apeswap', 'biswap', 'jul'])

# all chain keys
print(chain.keys())
# dict_keys(['name', 'explorer', 'weth', 'coins', 'charts', 'rpcs', 'chain_id', 'dex'])

# you can use "." to access value
print(chain.coins)
# {'BUSD': '0xe9e7cea3dedca5984780bafc599bd69add087d56', 'USDT': '0x55d398326f99059ff775485246999027b3197955', 'USDC': '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'}

# you can also use dict like format
print(chain['weth'])
# {'name': 'Wrapped BNB', 'symbol': 'WBNB', 'address': '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 'abi': xxxx}

# ===================================
# dex, you should use upper str chain name, an lower str dex name
joe = ma.get('AVAX', 'joe')

# print basic dex information
print(joe)
# DEX Name: traderjoexyz, Website: https://traderjoexyz.com/#/home, Router: 0x60ae616a2155ee3d9a68541ba4544862310933d4, Factory: 0x9ad6c38be94206ca50bb0d90783181662f0cfa10

# all dex keys
print(joe.keys())
# dict_keys(['name', 'router_address', 'router_abi', 'factory_address', 'factory_abi', 'lp_abi', 'website'])

# use "." to access value
print(joe.router_address)

# use dict like format
print(joe['factory_address'])
  • Print all supported chains and dexs.
ma.print_all_dex()

# output
----------------------
- BSC:
  - [1] [PancakeSwap v2](https://exchange.pancakeswap.finance/#/swap)
  - [2] [MDEX (BSC)](https://bsc.mdex.co/#/swap/)
  - [3] [ApeSwap Finance](https://app.apeswap.finance/swap)
  - [4] [BiSwap](https://exchange.biswap.org/#/swap)
  - [5] [Just Liquidity](https://dexbeta.julswap.com/)
- ETH:
  - [1] [Uniswap V2](https://app.uniswap.org/)
- AVAX:
  - [1] [traderjoexyz](https://traderjoexyz.com/#/home)
- FANTOM:
  - [1] [SpookySwap](https://spookyswap.finance/)
  - [2] [SpiritSwap](https://www.spiritswap.finance/)
- POLYGON:
  - [1] [QuickSwap](https://quickswap.exchange/)
- CRONOS:
  - [1] [Mad Meerkat Finance](https://mm.finance/swap)
- HECO:
  - [1] [MDEX (HECO)](https://ht.mdex.co/#/swap/)
- KCC:
  - [1] [KoffeeSwap](https://koffeeswap.exchange/)
- OKEX:
  - [1] [CherrySwap](https://www.cherryswap.net/)
  - [2] [JSwap](https://app.jswap.finance/)
  - [3] [PandaSwap](https://app.pandaex.org/)
- MOONRIVER:
  - [1] [Solarbeam](https://app.solarbeam.io/exchange/swap)
- ARBITRUM:
  - [1] [SushiSwap](https://app.sushi.com/en/swap)
- BSC_TEST:
  - [1] [PancakeSwap v2 (TEST)]()
  • If one DEX contract is not in the default settings, we can get abis from the contract address.

  • you need to specify your api_key from the Block Explorer.

  • KCC is not supported!

Here is an example to access open source dex abi from address.

from many_abis.utils.enums.chain_rpc_enum import CHAIN_RPC_API as rpc
from many_abis.utils.enums.contract_api_enum import CHAIN_CONTRACT_API as contract_api
from many_abis.utils.tools import get_factory_from_router, get_abi_from_address, create_dex_router

# get router
pancake = create_dex_router('BSC', 'pancake-v2')
print(pancake)

# get router abi
abi = get_abi_from_address('0x10ED43C718714eb63d5aA57B78B54704E256024E', 'YOUR_API_KEY', chain_api=contract_api.BSC)

# get factory abi
factory_address, factory_abi = get_factory_from_router('0x10ED43C718714eb63d5aA57B78B54704E256024E', 'YOUR_API_KEY',
                                                       chain_api=contract_api.BSC, rpc=rpc.BSC)

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.4.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

many_abis-0.1.4-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for many_abis-0.1.4.tar.gz
Algorithm Hash digest
SHA256 18fc778e35fe2c0126c49ca180dd77fc4e18245b8dd9509c34b7a8ea86c71c97
MD5 3f0cd484292dca90908accbdd50580b0
BLAKE2b-256 dc7ec2577158a46600733c6f2b1a60ed38d0825e7bf2fbe2b4a7e33b005f5ba3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for many_abis-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 85383ab5ae3d4afe192cafe343c5c48045f0f62772a2cbda021de3d4b0dc9c12
MD5 cd0264e616640bfaa0064c19cec2376f
BLAKE2b-256 0264fa196b1d8058d5902228dc6d0fe9ad017e5412d41af50ea2d52e8e2493a8

See more details on using hashes here.

Supported by

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