Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 79a3a0a

Browse files
authored
Merge pull request #89 from aeternity/release/1.1.0
Release/1.1.0
2 parents e320c4e + a2478a4 commit 79a3a0a

File tree

5 files changed

+87
-18
lines changed

5 files changed

+87
-18
lines changed

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
55

66
## [Unreleased]
77

8-
## [1.0.0b1]
8+
## [1.1.0]
9+
10+
### Changed
11+
12+
- CLI default node changed to [sdk-mainnet.aepp.com](https://sdk-mainnet.aepp.com/v2/status)
13+
14+
### Added
15+
16+
- Native transactions for contracts
17+
18+
## [1.0.0]
919

1020
### Changed
1121

@@ -17,7 +27,7 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
1727

1828
## [0.25.0.1]
1929

20-
⚠️ KEYSTORE FORMAT CHANGE INCOMPATIBLE WITH PREVIOUS FORMAT ⚠️
30+
⚠️ KEYSTORE FORMAT CHANGE INCOMPATIBLE WITH PREVIOUS FORMAT ⚠️
2131

2232
refer to the [documentation](docs/keystore_format_change.md) about how to update existing keystores
2333

@@ -41,7 +51,6 @@ refer to the [documentation](docs/keystore_format_change.md) about how to update
4151
- Compatibility with epoch nodes version < [0.25.0](https://github.com/aeternity/epoch/blob/v0.25.0/docs/release-notes/RELEASE-NOTES-0.25.0.md)
4252
- Support for .aet tld for aens
4353

44-
4554
## [0.24.0.2]
4655

4756
### Fixed

aeternity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.1.0'
22

33
__compatibility__ = [
44
'1.0.0',

aeternity/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def set_global_options(force, wait, json_):
208208
@click.group()
209209
@click.pass_context
210210
@click.version_option()
211-
@click.option('--url', '-u', default='https://sdk-testnet.aepps.com', envvar='EPOCH_URL', help='Epoch node url', metavar='URL')
211+
@click.option('--url', '-u', default='https://sdk-mainnet.aepps.com', envvar='EPOCH_URL', help='Epoch node url', metavar='URL')
212212
@click.option('--debug-url', '-d', default=None, envvar='EPOCH_URL_DEBUG', metavar='URL')
213213
@global_options
214214
@click.version_option(version=__version__)

aeternity/transactions.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aeternity.hashing import _int, _binary, _id, encode, decode, encode_rlp, hash_encode
1+
from aeternity.hashing import _int, _binary, _id, encode, decode, encode_rlp, hash_encode, contract_id
22
from aeternity.openapi import OpenAPICli
33
from aeternity.config import ORACLE_DEFAULT_TTL_TYPE_DELTA
44

@@ -353,7 +353,20 @@ def tx_contract_create(self, account_id, code, call_data, amount, deposit, gas,
353353
"""
354354

355355
if self.native_transactions:
356-
raise NotImplementedError("Native transaction for contract creation not implemented")
356+
tx = [
357+
_id(account_id),
358+
_int(nonce),
359+
_binary(code),
360+
_int(vm_version),
361+
_int(fee),
362+
_int(ttl),
363+
_int(deposit),
364+
_int(amount),
365+
_int(gas),
366+
_int(gas_price),
367+
_binary(call_data),
368+
]
369+
return encode_rlp("tx", tx), contract_id(account_id, nonce)
357370
# use internal endpoints transaction
358371
body = dict(
359372
owner_id=account_id,
@@ -372,9 +385,35 @@ def tx_contract_create(self, account_id, code, call_data, amount, deposit, gas,
372385
return tx.tx, tx.contract_id
373386

374387
def tx_contract_call(self, account_id, contract_id, call_data, function, arg, amount, gas, gas_price, vm_version, fee, ttl, nonce)-> str:
375-
# compute the absolute ttl and the nonce
388+
"""
389+
Create a contract call
390+
:param account_id: the account creating the contract
391+
:param contract_id: the contract to call
392+
:param call_data: the call data for the contract
393+
:param function: the function to execute
394+
:param arg: the function arguments
395+
:param amount: TODO: add definition
396+
:param gas: TODO: add definition
397+
:param gas_price: TODO: add definition
398+
:param vm_version: TODO: add definition
399+
:param fee: the transaction fee
400+
:param ttl: the ttl of the transaction
401+
:param nonce: the nonce of the account for the transaction
402+
"""
376403
if self.native_transactions:
377-
raise NotImplementedError("Native transaction for contract calls not implemented")
404+
tx = [
405+
_id(account_id),
406+
_int(nonce),
407+
_id(contract_id),
408+
_int(vm_version),
409+
_int(fee),
410+
_int(ttl),
411+
_int(amount),
412+
_int(gas),
413+
_int(gas_price),
414+
_binary(call_data),
415+
]
416+
return encode_rlp("tx", tx)
378417
# use internal endpoints transaction
379418
body = dict(
380419
call_data=call_data,

tests/test_contract.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,16 @@
2222
#
2323

2424

25-
def test_sophia_contract_tx_create_online():
26-
# save settings and go online
27-
original = EPOCH_CLI.set_native(False)
28-
25+
def _sophia_contract_tx_create_online():
2926
# runt tests
3027
contract = EPOCH_CLI.Contract(aer_identity_contract)
3128
contract.tx_create(ACCOUNT, gas=100000, fee=150000)
3229
assert contract.address is not None
3330
assert len(contract.address) > 0
3431
assert contract.address.startswith('ct')
35-
# restore settings
36-
EPOCH_CLI.set_native(original)
3732

3833

39-
def test_sophia_contract_tx_call_online():
40-
# save settings and go online
41-
original = EPOCH_CLI.set_native(False)
34+
def _sophia_contract_tx_call_online():
4235

4336
contract = EPOCH_CLI.Contract(aer_identity_contract)
4437
tx = contract.tx_create(ACCOUNT, gas=100000, fee=150000)
@@ -56,10 +49,38 @@ def test_sophia_contract_tx_call_online():
5649
assert val == 42
5750
assert remote_type == 'word'
5851

52+
53+
def test_sophia_contract_tx_create_native():
54+
# save settings and go online
55+
original = EPOCH_CLI.set_native(False)
56+
_sophia_contract_tx_create_online()
5957
# restore settings
6058
EPOCH_CLI.set_native(original)
6159

6260

61+
def test_sophia_contract_tx_call_native():
62+
# save settings and go online
63+
original = EPOCH_CLI.set_native(False)
64+
_sophia_contract_tx_call_online()
65+
# restore settings
66+
EPOCH_CLI.set_native(original)
67+
68+
69+
def test_sophia_contract_tx_create_debug():
70+
# save settings and go online
71+
original = EPOCH_CLI.set_native(False)
72+
_sophia_contract_tx_create_online()
73+
# restore settings
74+
EPOCH_CLI.set_native(original)
75+
76+
77+
def test_sophia_contract_tx_call_debug():
78+
# save settings and go online
79+
original = EPOCH_CLI.set_native(False)
80+
_sophia_contract_tx_call_online()
81+
# restore settings
82+
EPOCH_CLI.set_native(original)
83+
6384
# test contracts
6485

6586

0 commit comments

Comments
 (0)