Skip to content

enthusiastmartin/hydradx-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HydraDX interface for python

Description

Simple API for interacting with HydraDX chain in python. Mostly support for easy storage querying. Other features might be added in the future.

Installation

pip install hydradx-api

Usage

RPC = "ws://127.0.0.1:9944"

from hydradxapi import HydraDX

chain = HydraDX(RPC)
chain.connect()
state = chain.api.omnipool.asset_state(0)
print(state)
# Asset: 0
#	Reserve: 0
#	LRNA: 20220634396578953
#	Shares: 40600077930826935893
#	Protocol: 3694884494247885459
chain.close()

or taking advantage of context manager:

RPC = "ws://127.0.0.1:9944"

from hydradxapi import HydraDX

with HydraDX(RPC) as chain:
    state = chain.api.omnipool.asset_state(0)
    print(state)
    # Asset: 0
    #	Reserve: 0
    #	LRNA: 20220634396578953
    #	Shares: 40600077930826935893
    #	Protocol: 3694884494247885459

Omnipool support

API currently supports the following:

  • asset_state(asset_id) - retrieves state of an asset
  • position(position_id) - retrieves details of a position
  • lrna_reserve() - returns lrna reserve in the omnipool

...more to be added.

About

Simple python API for HydraDX project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages