File tree Expand file tree Collapse file tree 3 files changed +10
-25
lines changed Expand file tree Collapse file tree 3 files changed +10
-25
lines changed Original file line number Diff line number Diff line change 44class Contract (Client ):
55 def __init__ (self , address = Client .dao_address , api_key = 'YourApiKeyToken' ):
66 Client .__init__ (self , address = address , api_key = api_key )
7- self .module = self .URL_BASES ['module' ] + 'contract'
8-
9- def make_url (self , call_type = '' ):
10- if call_type == 'getabi' :
11- self .url = self .URL_BASES ['prefix' ] \
12- + self .module \
13- + self .action \
14- + self .address \
15- + self .key
7+ self .url_dict [self .MODULE ] = 'contract'
168
179 def get_abi (self ):
18- self .action = self .URL_BASES [ 'action' ] + 'getabi'
19- self .make_url ( call_type = 'getabi' )
10+ self .url_dict [ self .ACTION ] = 'getabi'
11+ self .build_url ( )
2012 req = self .connect ()
21- return req ['result' ]
13+ return req ['result' ]
Original file line number Diff line number Diff line change 44class Stats (Client ):
55 def __init__ (self , api_key = 'YourApiKeyToken' ):
66 Client .__init__ (self , address = '' , api_key = api_key )
7- self .module = self .URL_BASES ['module' ] + 'stats'
8-
9- def make_url (self , call_type = '' ):
10- if call_type == 'stats' :
11- self .url = self .URL_BASES ['prefix' ] \
12- + self .module \
13- + self .action \
14- + self .key
7+ self .url_dict [self .MODULE ] = 'stats'
158
169 def get_total_ether_supply (self ):
17- self .action = self .URL_BASES [ 'action' ] + 'ethsupply'
18- self .make_url ( call_type = 'stats' )
10+ self .url_dict [ self .ACTION ] = 'ethsupply'
11+ self .build_url ( )
1912 req = self .connect ()
2013 return req ['result' ]
2114
2215 def get_ether_last_price (self ):
23- self .action = self .URL_BASES [ 'action' ] + 'ethprice'
24- self .make_url ( call_type = 'stats' )
16+ self .url_dict [ self .ACTION ] = 'ethprice'
17+ self .build_url ( )
2518 req = self .connect ()
2619 return req ['result' ]
Original file line number Diff line number Diff line change @@ -19,4 +19,4 @@ def get_token_balance(self, address):
1919 self .url_dict [self .ACTION ] = 'tokenbalance'
2020 self .build_url ()
2121 req = self .connect ()
22- return req ['result' ]
22+ return req ['result' ]
You can’t perform that action at this time.
0 commit comments