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

Commit 78ee8ef

Browse files
authored
Merge pull request #270 from aeternity/release/6.0.0
Release/6.0.0
2 parents c75d5c8 + 419a6b8 commit 78ee8ef

26 files changed

+399
-260
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# this is used by docker-compose.yml to for the node image tag
2-
NODE_TAG=v5.0.0-rc.3
2+
NODE_TAG=v5.0.0-rc.5
33
COMPILER_TAG=v3.2.0

CHANGELOG.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,54 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
56
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
67

8+
## [6.0.0](https://github.com/aeternity/aepp-sdk-python/releases/tag/6.0.0) ([compare](https://github.com/aeternity/aepp-sdk-python/compare/5.0.1...6.0.0)) - 2019-10-17
9+
10+
### Bug Fixes
11+
12+
- fix(cli): name claim and update commands (#257) ([84988f9](https://github.com/aeternity/aepp-sdk-python/commit/84988f97f96983d683a37bd58c6e01ec2cb9efde)). Related issues/PRs: #256
13+
- fix(hashing): fix typo in hash function name ([af06d36](https://github.com/aeternity/aepp-sdk-python/commit/af06d36f3475fd80b7b7af08981e2366c9351038)).
14+
15+
### Features
16+
17+
- feat(aens): allow to set multiple and custom pointers for a name ([0e60389](https://github.com/aeternity/aepp-sdk-python/commit/0e6038994ce3034c8192c6bf60d1fd83a7719051)). Related issues/PRs: #244, #244
18+
- feat(aens): use .chain instead of .aet as TLD after Lima HF ([e02b92c](https://github.com/aeternity/aepp-sdk-python/commit/e02b92c81afc60b44d570ecd76f725268c333f07)). Related issues/PRs: #266
19+
- feat(contracts): enable contracts compile, deploy, generate aci using cli ([1c0e21d](https://github.com/aeternity/aepp-sdk-python/commit/1c0e21deb2ed34e10782b69c4b190521b9eee85a)).
20+
- feat(node): add spend_by_name ([72d4a95](https://github.com/aeternity/aepp-sdk-python/commit/72d4a9547ad1574c56fb6dd79e8ae4eba9e816c8)).
21+
22+
### BREAKING CHANGES
23+
24+
- remove legacy parameters and add the required ones. Removed address from the contract object
25+
- the `init_calldata` used to have a default. That is not allowed anymore the user need to be provide `init_calldata`.
26+
- changes in the signature of the contract call in contract and transaction module
27+
- the encode-calldata and decode-data commands have been removed
28+
- rename cli name contracts to contract
29+
- unify parameters related to calldata to `--calldata` in cli
30+
- unify parameters related to calldata to `calldata` in programmatic api
31+
- `encode-calldata` arguments parameter is now varidic instead of a list
32+
- account_basic_to_ga param `init_calldata` renamed to calldata
33+
- account_basic_to_ga param calldata is mandatory
34+
- it is not possible anymore to use `.address` to retrieve the contract address, instead it can be retrieved from the deploy transaction
35+
736
## [5.0.1](https://github.com/aeternity/aepp-sdk-python/releases/tag/5.0.1) ([compare](https://github.com/aeternity/aepp-sdk-python/compare/5.0.0...5.0.1)) - 2019-10-06
837

938
### Bug Fixes
1039
- fix: compatibility range for node version (#251) ([a1b273e](https://github.com/aeternity/aepp-sdk-python/commit/a1b273eb73b093c81c8ef3e8de3dcfe24989a8d5)).
1140
- fix: inspect oracle (#252) ([9daf5ef](https://github.com/aeternity/aepp-sdk-python/commit/9daf5efae9a6abb2a312667078c1f76ccf21be39)).
1241

13-
14-
1542
## [5.0.0](https://github.com/aeternity/aepp-sdk-python/releases/tag/5.0.0) ([compare](https://github.com/aeternity/aepp-sdk-python/compare/4.3.0...5.0.0)) - 2019-10-04
1643

17-
1844
This version is cross compatible with Fortuna and Lima versions of the node
1945

2046
### Code Refactoring
47+
2148
- refactor(tx): tx management consolidation (#230) ([542beb6](https://github.com/aeternity/aepp-sdk-python/commit/542beb64d4198b036d62b3b30014da02801ffac5)). Related issues/PRs: #237, #238
2249

2350
### Features
51+
2452
- feat(aens): support lima aens model (#241) ([1ffae14](https://github.com/aeternity/aepp-sdk-python/commit/1ffae147c8f666c8a4674608246c2b7ca5be82be)). Related issues/PRs: #233, #236, #235
2553
- feat(cli): auto select the network-id for high level cli command (#246) ([e512d15](https://github.com/aeternity/aepp-sdk-python/commit/e512d15be29e3140a869d2ec8872c86a1db1fe6b)).
2654
- feat(compiler): support for compiler series v4 / FATE (#229) ([3276eec](https://github.com/aeternity/aepp-sdk-python/commit/3276eeca31c989ec6afa13f9eb48706eb555abee)).
@@ -31,13 +59,15 @@ This version is cross compatible with Fortuna and Lima versions of the node
3159
- namehash function is deprecated and will be removed after Lima HF
3260

3361
### BREAKING CHANGES
34-
- `sign_transaction(str)` has been changed to `broadcast_transaction(TxObject)` where TxObject is the default transaction object troughout the sdk
62+
63+
- `sign_transaction(str)` has been changed to `broadcast_transaction(TxObject)` where TxObject is the default transaction object throughout the sdk
3564
- `broadcast_transaction(str)` has been changed to `broadcast_transaction(TxObject)`
3665
changes the max length for auction from 32 to 12
3766
- `wait_for_transaction` drops the optional (and unused) parameter `confirm_transaction`.
3867
- `wait_for_confirmation` returns height where the transaction has been found (if any)
3968

4069
For the CLI, the parameter `--network-id` has been dropped for the commands:
70+
4171
- `aecli account spend`
4272
- `aecli name claim`
4373
- `aecli name revoke`
@@ -47,6 +77,17 @@ For the CLI, the parameter `--network-id` has been dropped for the commands:
4777
- `aecli contract deploy`
4878
- `aecli contract call`
4979

80+
In the name claim function, the first param is pre-claim tx hash and not the Account.
81+
example:
82+
83+
```python
84+
# PREVIOUS
85+
name.claim(account, claim_tx.hash,...)
86+
87+
#NEW
88+
name.claim(claim_tx.hash, account,...)
89+
```
90+
5091
more details can be found at the relevant commit: [542beb6](https://github.com/aeternity/aepp-sdk-python/commit/542beb64d4198b036d62b3b30014da02801ffac5), [e512d15](https://github.com/aeternity/aepp-sdk-python/commit/e512d15be29e3140a869d2ec8872c86a1db1fe6b),
5192
[b5f3a08](https://github.com/aeternity/aepp-sdk-python/commit/b5f3a0871cf98b8b3fedd8a67fd4c1b12cacad01)
5293

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# build output folder
22
DIST_FOLDER = dist
33
BUILD_FOLDER = build
4+
# extra test options
5+
TEST_OPTS = ''
46

57
.PHONY: list
68
list:
@@ -19,7 +21,7 @@ test: test-all
1921

2022
test-all:
2123
@echo run pytest
22-
pytest -v --junitxml test-results.xml tests --cov=aeternity --cov-config .coveragerc --cov-report xml:coverage.xml
24+
pytest -v --junitxml test-results.xml tests --cov=aeternity --cov-config .coveragerc --cov-report xml:coverage.xml $(TEST_OPTS)
2325
@echo done
2426

2527
lint: lint-all

aeternity/__main__.py

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def name_claim(keystore_name, domain, name_ttl, name_salt, preclaim_tx_hash, ttl
531531
print("Domain not available")
532532
exit(0)
533533
# claim
534-
tx = name.claim(account, name_salt, preclaim_tx_hash, fee=fee, tx_ttl=ttl)
534+
tx = name.claim(preclaim_tx_hash, account, name_salt, fee=fee, tx_ttl=ttl)
535535
_print_object(tx, title=f'Name {domain} claim transaction')
536536
except ValueError as e:
537537
_print_error(e, exit_code=1)
@@ -542,13 +542,13 @@ def name_claim(keystore_name, domain, name_ttl, name_salt, preclaim_tx_hash, ttl
542542
@name.command('bid', help="Bid on a name auction")
543543
@click.argument('keystore_name', required=True)
544544
@click.argument('domain', required=True)
545-
@click.argument('name_fee', required=True)
545+
@click.argument('name_fee', required=True, type=int)
546546
@click.option("--name-ttl", default=defaults.NAME_TTL, help=f'Lifetime of the name in blocks', show_default=True, type=int)
547547
@global_options
548548
@account_options
549549
@online_options
550550
@transaction_options
551-
def name_bid(keystore_name, domain, name_fee, ttl, fee, nonce, password, force, wait, json_):
551+
def name_bid(keystore_name, domain, name_ttl, name_fee, ttl, fee, nonce, password, force, wait, json_):
552552
try:
553553
set_global_options(json_, force, wait)
554554
account, _ = _account(keystore_name, password=password)
@@ -676,8 +676,8 @@ def contract_compile(contract_file, compiler_url, json_):
676676

677677

678678
@compiler.command('aci', help="Get the aci of a contract")
679-
@click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
680679
@click.argument("contract_file")
680+
@click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
681681
@global_options
682682
def contract_aci(contract_file, compiler_url, json_):
683683
try:
@@ -686,17 +686,20 @@ def contract_aci(contract_file, compiler_url, json_):
686686
code = fp.read()
687687
c = CompilerClient(compiler_url=compiler_url)
688688
result = c.aci(code)
689+
if click.confirm(f'Save contract ACI to file ({contract_file}.aci.json) ?', default=True, show_default=True):
690+
with open(f"{contract_file}.aci.json", "w") as fp:
691+
fp.write(json.dumps(namedtupled.reduce(result), indent=2))
689692
_print_object(result, title="contract")
690693
except Exception as e:
691694
_print_error(e, exit_code=1)
692695

693696

694-
@compiler.command('encode-calldata', help="Encode the calldata to invoke a contract")
695-
@click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
696-
@click.argument("contract_file")
697-
@click.argument("function_name")
698-
@click.option("--arguments", default=None, help="Argument of the function if any, comma separated")
699-
@global_options
697+
# @compiler.command('encode-calldata', help="Encode the calldata to invoke a contract")
698+
# @click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
699+
# @click.argument("contract_file")
700+
# @click.argument("function_name")
701+
# @click.option("--arguments", default=None, help="Argument of the function if any, comma separated")
702+
# @global_options
700703
def contract_encode_calldata(contract_file, function_name, arguments, compiler_url, json_):
701704
try:
702705
set_global_options(json_, False, False)
@@ -706,17 +709,15 @@ def contract_encode_calldata(contract_file, function_name, arguments, compiler_u
706709
arguments = [] if arguments is None else arguments.split(",")
707710
result = c.encode_calldata(code, function_name, arguments=arguments)
708711
_print_object(result, title="contract")
709-
# except Exception as e:
710-
# _print_error(e, exit_code=1)
711-
finally:
712-
pass
712+
except Exception as e:
713+
_print_error(e, exit_code=1)
713714

714715

715-
@compiler.command('decode-data', help="Decode the data retrieve from a contract")
716-
@click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
717-
@click.argument("sophia_type")
718-
@click.argument("encoded_data")
719-
@global_options
716+
# @compiler.command('decode-data', help="Decode the data retrieve from a contract")
717+
# @click.option('--compiler-url', '-c', default='http://localhost:3080', envvar='COMPILER_URL', help='Aeternity compiler url', metavar='URL')
718+
# @click.argument("sophia_type")
719+
# @click.argument("encoded_data")
720+
# @global_options
720721
def contract_decode_data(contract_file, encoded_data, sophia_type, compiler_url, json_):
721722
try:
722723
set_global_options(json_, False, False)
@@ -727,24 +728,24 @@ def contract_decode_data(contract_file, encoded_data, sophia_type, compiler_url,
727728
_print_error(e, exit_code=1)
728729

729730

730-
@cli.group(help='Deploy and execute contracts on the chain')
731-
def contracts():
731+
@cli.group(help='Deploy and execute a contract on chain')
732+
def contract():
732733
pass
733734

734735

735-
@contracts.command('deploy', help='Deploy a contract on the chain')
736+
@contract.command('deploy', help='Deploy a contract on the chain')
736737
@click.argument('keystore_name', required=True)
737738
@click.argument("bytecode_file", required=True)
738-
@click.option("--init-calldata", default=defaults.CONTRACT_INIT_CALLDATA, help="The calldata for the init function", show_default=True)
739-
@click.option("--gas", default=defaults.CONTRACT_GAS, help='Amount of gas to deploy the contract', show_default=True)
740-
@click.option("--amount", default=defaults.CONTRACT_AMOUNT, help='Amount of tokens to transfer to the contract', show_default=True)
741-
@click.option("--gas-price", default=defaults.CONTRACT_GAS_PRICE, help='The gas price used to execute the contract init function', show_default=True)
742-
@click.option("--deposit", default=defaults.CONTRACT_AMOUNT, help='A initial deposit to the contract', show_default=True)
739+
@click.option("--calldata", help="The calldata for the init function", required=True)
740+
@click.option("--gas", default=defaults.CONTRACT_GAS, help='Amount of gas to deploy the contract', show_default=True, type=int)
741+
@click.option("--amount", default=defaults.CONTRACT_AMOUNT, help='Amount of tokens to transfer to the contract', show_default=True, type=int)
742+
@click.option("--gas-price", default=defaults.CONTRACT_GAS_PRICE, help='The gas price used to execute the contract init function', show_default=True, type=int)
743+
@click.option("--deposit", default=defaults.CONTRACT_AMOUNT, help='A initial deposit to the contract', show_default=True, type=int)
743744
@global_options
744745
@account_options
745746
@online_options
746747
@transaction_options
747-
def contract_deploy(keystore_name, bytecode_file, init_calldata, gas, gas_price, amount, deposit, password, ttl, fee, nonce, force, wait, json_):
748+
def contract_deploy(keystore_name, bytecode_file, calldata, gas, gas_price, amount, deposit, password, ttl, fee, nonce, force, wait, json_):
748749
"""
749750
Deploy a contract to the chain and create a deploy descriptor
750751
with the contract informations that can be use to invoke the contract
@@ -754,59 +755,58 @@ def contract_deploy(keystore_name, bytecode_file, init_calldata, gas, gas_price,
754755
source file. Multiple deploy of the same contract file will generate different
755756
deploy descriptor
756757
"""
757-
print("Not yet implemented")
758-
return
759758
try:
760759
with open(bytecode_file) as fp:
761760
set_global_options(json_, force, wait)
762761
account, _ = _account(keystore_name, password=password)
763762
bytecode = fp.read()
764763
contract = _node_cli().Contract()
765-
tx = contract.create(account, bytecode, init_calldata=init_calldata, gas=gas, amount=amount,
766-
gas_price=gas_price, deposit=deposit, tx_ttl=ttl, fee=fee)
764+
tx = contract.create(account, bytecode, calldata,
765+
gas=gas,
766+
amount=amount,
767+
gas_price=gas_price,
768+
deposit=deposit,
769+
tx_ttl=ttl,
770+
fee=fee)
767771
_print_object(tx, title="contract create")
768772
except Exception as e:
769773
_print_error(e, exit_code=1)
770774

771775

772-
@contracts.command('call', help='Execute a function of the contract')
776+
@contract.command('call', help='Execute a function of the contract')
773777
@click.argument('keystore_name', required=True)
774-
@click.argument("deploy_descriptor", required=True)
775-
@click.argument("function", required=True)
776-
@click.argument("params", required=True)
777-
@click.argument("return_type", required=True)
778-
@click.option("--gas", default=defaults.CONTRACT_GAS, help='Amount of gas to deploy the contract', show_default=True)
778+
@click.argument('contract_id', required=True)
779+
@click.argument("function_name")
780+
@click.option("--calldata", help="The encoded calldata of the function to call", required=True)
781+
@click.option("--gas", default=defaults.CONTRACT_GAS, help='Gas limit for the contract call', show_default=True)
782+
@click.option("--gas-price", default=defaults.CONTRACT_GAS_PRICE, help='Gas unit price for the contract call', show_default=True)
783+
@click.option("--amount", default=defaults.CONTRACT_AMOUNT, help='Amount of token (only for payable contracts)', show_default=True)
779784
@global_options
780785
@account_options
781786
@online_options
782787
@transaction_options
783-
def contract_call(keystore_name, deploy_descriptor, function, params, return_type, gas, password, force, wait, json_):
784-
print("Not yet implemented")
785-
return
788+
def contract_call(keystore_name, contract_id, function_name, calldata, gas, gas_price, amount,
789+
password, ttl, fee, nonce, force, wait, json_):
786790
try:
787-
with open(deploy_descriptor) as fp:
788-
contract = json.load(fp)
789-
source = contract.get('source')
790-
bytecode = contract.get('bytecode')
791-
address = contract.get('address')
792-
793-
set_global_options(json_, force, wait)
794-
account, _ = _account(keystore_name, password=password)
795-
796-
contract = _node_cli().Contract(source, bytecode=bytecode, address=address)
797-
tx = contract.tx_call(account, function, params, gas=gas)
798-
_print_object(tx, "contract call")
791+
set_global_options(json_, force, wait)
792+
account, _ = _account(keystore_name, password=password)
793+
contract = _node_cli().Contract()
794+
tx = contract.call(contract_id, account, function_name, calldata,
795+
amount=amount,
796+
gas=gas,
797+
gas_price=gas_price,
798+
fee=fee,
799+
tx_ttl=ttl)
800+
_print_object(tx, "contract call")
799801
except Exception as e:
800802
_print_error(e, exit_code=1)
801803

802804

803-
@contracts.command('call-info', help='Retrieve the result of a contract call if any')
805+
@contract.command('call-info', help='Retrieve the result of a contract call if any')
804806
@click.argument('tx_hash', required=True)
805807
@global_options
806808
@online_options
807809
def contract_call_info(tx_hash, force, wait, json_):
808-
print("Not yet implemented")
809-
return
810810
try:
811811
contract = _node_cli().Contract()
812812
call_object = contract.get_call_object(tx_hash)
@@ -833,7 +833,7 @@ def contract_call_info(tx_hash, force, wait, json_):
833833
def inspect(obj, height, force, wait, json_):
834834
try:
835835
set_global_options(json_, force, wait)
836-
if obj.endswith(".test") or obj.endswith(".aet"):
836+
if obj.endswith(".test") or obj.endswith(".chain"):
837837
data = _node_cli().get_name_entry_by_name(name=obj)
838838
_print_object(data, title="name")
839839
elif obj.startswith("kh_") or obj.startswith("mh_"):

0 commit comments

Comments
 (0)