A simple way to get different DEXs abis for block chains.
Project description
Many Abis
Get different DEX abis easily for blockchain developers.
Now we support dex:
- BSC:
- [1] PancakeSwap v2
- [2] MDEX (BSC)
- [3] ApeSwap Finance
- [4] BiSwap
- [5] Just Liquidity
- ETH:
- [1] Uniswap V2
- AVAX:
- [1] traderjoexyz
- FANTOM:
- [1] SpookySwap
- [2] SpiritSwap
- POLYGON:
- [1] QuickSwap
- CRONOS:
- HECO:
- [1] MDEX (HECO)
- KCC:
- [1] KoffeeSwap
- OKEX:
- [1] CherrySwap
- [2] JSwap
- [3] PandaSwap
- MOONRIVER:
- [1] Solarbeam
- ARBITRUM:
- [1] SushiSwap
- BSC_TEST:
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
Release history Release notifications | RSS feed
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.1.tar.gz
(21.9 kB
view hashes)
Built Distribution
Close
Hashes for many_abis-0.1.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31cee275fca1fec7b8f2844b33132293cab779d47fffd765c2b31521efbc1a6 |
|
MD5 | c2f9dc65690cf168e2d4d4ea1656240d |
|
BLAKE2b-256 | 6d988bf09faf4e00fbb10312e50f55e69c9ccf9283f13598483bbda15502e8ff |