Install Packages
pip install hashflow-python
Example Usage
Initialize the client
from hashflow.client import Client
hflow = Client(
private_key='0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
network_id = 1,
node='https://mainnet.infura.io/v3/00000000000000000000000000000000'
)
Interacting with the protocol
options = { 'maxFeePerGas' : 500000000000, 'maxPriorityFeePerGas': 5000000000, 'nonce': 11}
hflow.main.factory.create_pool(name='hash42', signer=signer, admin=admin, options=options)
hflow.main.factory.pools(operations, options)
hflow.main.erc20.set_maximum_allowance(token, options)
hflow.main.erc20.allowance(token, owner,spender, options)
hflow.main.router.add_liquidity_private_pool(pool, token, amount, options)
hflow.main.router.add_liquidity_public_pool(pool, token, amount, options)
hflow.main.router.remove_liquidity_private_pool(pool, token, amount, recipient=binance, options)
hflow.main.router.remove_liquidity_public_pool(pool, token, burn_amount, options)
hflow.main.pool.transfer_assets(pool, token, recipient, amount, options)
quote = utils.Quote(pool,eoa, trader, effective_trader, base_token_address, quote_token_address, base_token_amount, quote_token_amount, fees, expiry, flag, txid, k_value, trade_eoa)
quote_digest = hflow.main.hash_quote(quote)
quote_digest = hflow.main.hash_quote_eoa(quote)
signed_quote = utils.sign_digest(quote_digest, signer_private_key)
hflow.main.router.trade_single_hop(quote, signed_quote, effective_base_token_amount, options)