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 4
4
class Contract (Client ):
5
5
def __init__ (self , address = Client .dao_address , api_key = 'YourApiKeyToken' ):
6
6
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'
16
8
17
9
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 ( )
20
12
req = self .connect ()
21
- return req ['result' ]
13
+ return req ['result' ]
Original file line number Diff line number Diff line change 4
4
class Stats (Client ):
5
5
def __init__ (self , api_key = 'YourApiKeyToken' ):
6
6
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'
15
8
16
9
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 ( )
19
12
req = self .connect ()
20
13
return req ['result' ]
21
14
22
15
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 ( )
25
18
req = self .connect ()
26
19
return req ['result' ]
Original file line number Diff line number Diff line change @@ -19,4 +19,4 @@ def get_token_balance(self, address):
19
19
self .url_dict [self .ACTION ] = 'tokenbalance'
20
20
self .build_url ()
21
21
req = self .connect ()
22
- return req ['result' ]
22
+ return req ['result' ]
You can’t perform that action at this time.
0 commit comments