Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECHOT-298] Up library patch version >> 0.1.51: Update - Node version 0.14.0-rc.0 #3

Merged
merged 11 commits into from
Dec 10, 2019
20 changes: 10 additions & 10 deletions echopy/echoapi/ws_api/database_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ def get_block_virtual_ops(self, block_num):
[block_num]
)

def get_block_rewards(self, block_num):
return self.db.rpcexec(
'get_block_rewards',
[block_num]
)

def get_transaction(self, block_num, trx_in_block):
return self.db.rpcexec(
'get_transaction',
Expand Down Expand Up @@ -196,7 +190,7 @@ def get_contracts(self, contract_ids):
[contract_ids]
)

def get_contract_logs(self, contracts=None, topics=None, from_block=None, to_block=None):
def get_contract_logs(self, callback, contracts=None, topics=None, from_block=None, to_block=None):
opts = {}
if contracts is not None:
opts["contracts"] = contracts
Expand All @@ -209,7 +203,7 @@ def get_contract_logs(self, contracts=None, topics=None, from_block=None, to_blo

return self.db.rpcexec(
'get_contract_logs',
[opts]
[callback, opts]
)

def subscribe_contracts(self, contracts_ids):
Expand All @@ -218,10 +212,16 @@ def subscribe_contracts(self, contracts_ids):
[contracts_ids]
)

def subscribe_contract_logs(self, callback, contract_id):
def subscribe_contract_logs(self, callback_id, callback, contract_id):
return self.db.rpcexec(
'subscribe_contract_logs',
[callback, contract_id]
[callback_id, callback, contract_id]
)

def unsubscribe_contract_logs(self, callback_id):
return self.db.rpcexec(
'unsubscribe_contract_logs',
[callback_id]
)

def get_contract_result(self, contract_result_id):
Expand Down
6 changes: 6 additions & 0 deletions echopy/echoapi/ws_api/history_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ def get_contract_history(self, contract, stop='1.6.0', limit=100, start='1.6.0')
'get_contract_history',
[contract, stop, limit, start]
)

def get_relative_contract_history(self, contract, stop=0, limit=100, start=0):
return self.db.rpcexec(
'get_relative_contract_history',
[contract, stop, limit, start]
)
8 changes: 4 additions & 4 deletions echopy/echobase/config/object_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def __init__(self):
self.CONTRACT = 11
self.CONTRACT_RESULT = 12
self.ETH_ADDRESS = 13
self.DEPOSIT_ETH = 14
self.WITHDRAW_ETH = 15
self.ETH_DEPOSIT = 14
self.ETH_WITHDRAW = 15
self.ERC20_TOKEN = 16
self.DEPOSIT_ERC20_TOKEN = 17
self.WITHDRAW_ERC20_TOKEN = 18
self.ERC20_DEPOSIT_TOKEN = 17
self.ERC20_WITHDRAW_TOKEN = 18
self.BTC_ADDRESS = 19
self.BTC_INTERMEDIATE_DEPOSIT = 20
self.BTC_DEPOSIT = 21
Expand Down
41 changes: 23 additions & 18 deletions echopy/echobase/config/operations_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,26 @@ def __init__(self):
self.SIDECHAIN_ETH_CREATE_ADDRESS = 39
self.SIDECHAIN_ETH_APPROVE_ADDRESS = 40
self.SIDECHAIN_ETH_DEPOSIT = 41
self.SIDECHAIN_ETH_WITHDRAW = 42
self.SIDECHAIN_ETH_APPROVE_WITHDRAW = 43
self.SIDECHAIN_ISSUE = 44
self.SIDECHAIN_BURN = 45
self.SIDECHAIN_ERC20_REGISTER_TOKEN = 46
self.SIDECHAIN_ERC20_DEPOSIT_TOKEN = 47
self.SIDECHAIN_ERC20_WITHDRAW_TOKEN = 48
self.SIDECHAIN_ERC20_APPROVE_TOKEN_WITHDRAW = 49
self.SIDECHAIN_ERC20_ISSUE = 50
self.SIDECHAIN_ERC20_BURN = 51
self.SIDECHAIN_BTC_CREATE_ADDRESS = 52
self.SIDECHAIN_BTC_CREATE_INTERMEDIATE_DEPOSIT = 53
self.SIDECHAIN_BTC_INTERMEDIATE_DEPOSIT = 54
self.SIDECHAIN_BTC_DEPOSIT = 55
self.SIDECHAIN_BTC_WITHDRAW = 56
self.SIDECHAIN_BTC_AGGREGATE = 57
self.SIDECHAIN_BTC_APPROVE_AGGREGATE = 58
self.BLOCK_REWARD = 59
self.SIDECHAIN_ETH_SEND_DEPOSIT = 42
self.SIDECHAIN_ETH_WITHDRAW = 43
self.SIDECHAIN_ETH_SEND_WITHDRAW = 44
self.SIDECHAIN_ETH_APPROVE_WITHDRAW = 45
self.SIDECHAIN_ETH_UPDATE_CONTRACT_ADDRESS = 46
self.SIDECHAIN_ISSUE = 47
self.SIDECHAIN_BURN = 48
self.SIDECHAIN_ERC20_REGISTER_TOKEN = 49
self.SIDECHAIN_ERC20_DEPOSIT_TOKEN = 50
self.SIDECHAIN_ERC20_SEND_DEPOSIT_TOKEN = 51
self.SIDECHAIN_ERC20_WITHDRAW_TOKEN = 52
self.SIDECHAIN_ERC20_SEND_WITHDRAW_TOKEN = 53
self.SIDECHAIN_ERC20_APPROVE_TOKEN_WITHDRAW = 54
self.SIDECHAIN_ERC20_ISSUE = 55
self.SIDECHAIN_ERC20_BURN = 56
self.SIDECHAIN_BTC_CREATE_ADDRESS = 57
self.SIDECHAIN_BTC_CREATE_INTERMEDIATE_DEPOSIT = 58
self.SIDECHAIN_BTC_INTERMEDIATE_DEPOSIT = 59
self.SIDECHAIN_BTC_DEPOSIT = 60
self.SIDECHAIN_BTC_WITHDRAW = 61
self.SIDECHAIN_BTC_AGGREGATE = 62
self.SIDECHAIN_BTC_APPROVE_AGGREGATE = 63
self.BLOCK_REWARD = 64
8 changes: 6 additions & 2 deletions echopy/echobase/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ def __init__(self, *args, **kwargs):
("eth_gen_address_method", EthMethod(kwargs["eth_gen_address_method"])),
("eth_withdraw_method", EthMethod(kwargs["eth_withdraw_method"])),
("eth_update_addr_method", EthMethod(kwargs["eth_update_addr_method"])),
("eth_update_contract_address", EthMethod(kwargs["eth_update_contract_address"])),
("eth_withdraw_token_method", EthMethod(kwargs["eth_withdraw_token_method"])),
("eth_collect_tokens_method", EthMethod(kwargs["eth_collect_tokens_method"])),
("eth_committee_updated_topic", Bytes(kwargs["eth_committee_updated_topic"], 32)),
Expand All @@ -465,7 +466,9 @@ def __init__(self, *args, **kwargs):
("fines", EthAddress(kwargs["fines"])),
("gas_price", Uint64(kwargs["gas_price"])),
("satoshis_per_byte", Uint32(kwargs["satoshis_per_byte"])),
("coefficient_waiting_blocks", Uint32(kwargs["coefficient_waiting_blocks"]))
("coefficient_waiting_blocks", Uint32(kwargs["coefficient_waiting_blocks"])),
("btc_deposit_withdrawal_min", Uint64(kwargs["btc_deposit_withdrawal_min"])),
("btc_deposit_withdrawal_fee", Uint64(kwargs["btc_deposit_withdrawal_fee"]))
]
)
)
Expand Down Expand Up @@ -558,7 +561,8 @@ def __init__(self, *args, **kwargs):
Uint64(kwargs["committee_frozen_balance_to_activate"])),
("committee_maintenance_intervals_to_deposit",
Uint64(kwargs["committee_maintenance_intervals_to_deposit"])),
("committee_freeze_duration_seconds", Uint32(kwargs["committee_freeze_duration_seconds"])),
("committee_balance_unfreeze_duration_seconds",
Uint32(kwargs["committee_balance_unfreeze_duration_seconds"])),

("x86_64_maximum_contract_size", Uint64(kwargs["x86_64_maximum_contract_size"])),

Expand Down
8 changes: 4 additions & 4 deletions echopy/echobase/objecttypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
object_type["contract"] = 11
object_type["contract_result"] = 12
object_type["eth_address"] = 13
object_type["deposit_eth"] = 14
object_type["withdraw_eth"] = 15
object_type["eth_deposit"] = 14
object_type["eth_withdraw"] = 15
object_type["erc20_token"] = 16
object_type["deposit_erc20_token"] = 17
object_type["withdraw_erc20_token"] = 18
object_type["erc20_deposit_token"] = 17
object_type["erc20_withdraw_token"] = 18
object_type["btc_address"] = 19
object_type["btc_intermediate_deposit"] = 20
object_type["btc_deposit"] = 21
Expand Down
5 changes: 5 additions & 0 deletions echopy/echobase/operationids.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@
"sidechain_eth_create_address",
"sidechain_eth_approve_address",
"sidechain_eth_deposit",
"sidechain_eth_send_deposit",
"sidechain_eth_withdraw",
"sidechain_eth_send_withdraw",
"sidechain_eth_approve_withdraw",
"sidechain_eth_update_contract_address",
"sidechain_issue",
"sidechain_burn",
"sidechain_erc20_register_token",
"sidechain_erc20_deposit_token",
"sidechain_erc20_send_deposit_token",
"sidechain_erc20_withdraw_token",
"sidechain_erc20_send_withdraw_token",
"sidechain_erc20_approve_token_withdraw",
"sidechain_erc20_issue",
"sidechain_erc20_burn",
Expand Down
7 changes: 1 addition & 6 deletions echopy/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,9 @@ def iso_to_seconds(iso):
timeformat = "%Y-%m-%dT%H:%M:%S%Z"
return ceil(timegm(time.strptime((iso + "UTC"), timeformat)))

head_block_time_iso = dynamic_global_chain_data['time']
head_block_time_seconds = iso_to_seconds(head_block_time_iso)
now_iso = seconds_to_iso(datetime.now(timezone.utc).timestamp())
now_seconds = iso_to_seconds(now_iso)
expired = now_seconds - head_block_time_seconds > 30
self.expiration = seconds_to_iso(head_block_time_seconds + 3) if expired\
else (seconds_to_iso(now_seconds + 3) if now_seconds > head_block_time_seconds
else seconds_to_iso(head_block_time_seconds + 3))
self.expiration = seconds_to_iso(now_seconds + 300)

_transaction = TransactionType(
ref_block_num=self.ref_block_num,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import setup, find_packages

VERSION = "0.1.50"
VERSION = "0.1.51"
packages = find_packages()
packages.remove('test')

Expand Down