Git Product home page Git Product logo

aepp-sdk-python's Introduction

aepp-sdk-python's People

Contributors

and1 avatar andi-apeunit avatar delimitry avatar dependabot-preview[bot] avatar devsnd avatar emil-apeunit avatar johnsnewby avatar jsnewby avatar noandrea avatar ricricucit avatar shekhar-shubhendu avatar thecaliconoire avatar tillkolter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aepp-sdk-python's Issues

Name claim does not work

Name clain fails
Preclaim worked: th_2uf1posv6NshWtUC5Uva4QH7sMnAkUogQKfjQE5v5ZjZndJRq8

but then it crashed with

Traceback (most recent call last):
  File "./aecli", line 3, in <module>
    from aeternity import __main__
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 856, in <module>
    cli(obj={})
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 473, in name_register
    tx, tx_signed, sig, tx_hash = name.claim(account, fee, ttl)
  File "/opt/aepp-sdk-python/aeternity/aens.py", line 180, in claim
    self.client.broadcast_transaction(tx_signed, tx_hash)
  File "/opt/aepp-sdk-python/aeternity/epoch.py", line 143, in broadcast_transaction
    reply = self.post_transaction(body={"tx": tx})
  File "/opt/aepp-sdk-python/aeternity/openapi.py", line 207, in api_method
    raise OpenAPIClientException(f"Error: {api_response.desc}", code=http_reply.status_code)
aeternity.openapi.OpenAPIClientException: Error: Invalid transaction

I tried running it again, and it said this:
Traceback (most recent call last):
File "/opt/aepp-sdk-python/aeternity/openapi.py", line 53, in init
self.api_def = requests.get(f"{url}/api").json()
File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./aecli", line 3, in <module>
    from aeternity import __main__
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 856, in <module>
    cli(obj={})
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/aepp-sdk-python/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 458, in name_register
    name = _epoch_cli(network_id=network_id).AEName(domain)
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 54, in _epoch_cli
    native=native)
  File "/opt/aepp-sdk-python/aeternity/epoch.py", line 57, in __init__
    force_compatibility=force_compatibility)
  File "/opt/aepp-sdk-python/aeternity/openapi.py", line 65, in __init__
    raise UnsupportedEpochVersion(f"Unable to connect to the node: {e}")
aeternity.exceptions.UnsupportedEpochVersion: Unable to connect to the node: Expecting value: line 1 column 1 (char 0)
payload
None

Using the 405d7dd commit

Refactor init configuration

Remove defaults settings, and add them to the NodeClient init function:

  • node_url
    _ node_url_internal (optional)
    _ gas_price (optional)
    _ ttl (optional)

Getting error 500 when trying to spend

When trying to call spend I get an error message and it fails

Expected Behavior

I was hopping the transaction went on without issues

Current Behavior

it returns
Message ____________________________ Unknown error 500

Possible Solution

None found so far

Steps to Reproduce

install aepp-sdk-python
install dependencies
call
/usr/local/bin/python3 /opt/aepp-sdk-python/aecli -u http://ae.criesca.net:3013 -d http://ae.criesca.net:3013 account spend wallet ak_8KhtR5q1XWBz6VSFK1HynbKBYxXxJyVmD5EzE8EAx3oeXBwKB 2000000000000000000 --password reallyweirdpasswordhex --network-id ae_mainnet

Environment / Context

This issue affects the aeternity tipping bot directly because it can only retry for a few seconds before continuing or expecting an answer, also the error is not clear at all

Aeternity Node Version

"genesis_key_block_hash": "kh_pbtwgLrNu23k9PA6XCZnUbtsvEFeQGgavY4FS2do3QP8kcp2z",
"network_id": "ae_mainnet",
"node_revision": "368fba92972db352426c5b7ce49a682aacd3cab8",
"node_version": "2.0.0",
Python version 3.6.8

Troubleshooting done

I pointed it to another node (namely the one used by the explorer ( roma-net.mdw.aepps.com ) and it failed in the same exact way. This error was not here before. I tried several versions of the aepp-sdk-python, starting with the roma supported one up to and including current develop branch

spend is not working

I tried the
aecli account spend mywallet ak_XXXXXXXXXXXXXXXXXXXXXXXX 5000
and I get an error saying:
"Error: Sender account not found"

And I don't understand what is going on.

Using tag 0.25.0.1b1

Not ready for epoch 1.0.0?

Since ae has released v1.0.0, I just wonder will this sdk support it? I tried ./aecli chain top and got an error Unable to understand node reply, perhaps is not an epoch node or is too old?

Spend is not working with the current release, returns invalid transaction

Support requests with a tag that doesn't even exist?
That's just mean.

Expected Behavior

Send transaction to succeed as it says in the documentation

Current Behavior

It returns a Error: Invalid transaction

Steps to Reproduce

  • install the aepp-sdk-python
  • create an account
  • use a faucet to send you aettos
  • try sending it to another account

Environment / Context

ubuntu server 18.04.1
epoch v1.1.0 / docker aeternity/epoc:v1.1.0
aepps-sdk-python v1.1.2 / commit 302c8ec

Automatically detect the network id

Version 1.2.0 and above of the aeternity node provide the network_id in the node status:
it can be used to select automatically the correct network id.

In case the network id is not present it should use the mainnet one or raise an error

ValueError: Public key and private account mismatch

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from aeternity import signing


account = signing.Account.generate()
account.save_to_folder("./test_keys", "aeternity")
account = signing.Account.read_from_dir("./test_keys", "aeternity")

print(account)

name claim is not working

##Using version

commit 22e77952a1666d67b4dc2094b92fd33a3089f114
Merge: bce24f0 6f3ee1b
Author: Andrea Giacobino <[email protected]>
Date:   Tue Nov 6 17:51:29 2018 +0100

    Merge pull request #73 from aeternity/release/0.25.0.1b1

    Release/0.25.0.1b1

##Executing

(venv)# aecli account balance wallet
Enter the account password []:
<none>
  Balance ___________________________________________ 20000000000000000000
  Id ________________________________________________ ak_e8YApvLq9JyEWVg5KuyBo2gChWVwzD3g4oMHoVCSqg7VpZsw7
  Nonce _____________________________________________ 0
</none>

##This fails

(venv)# aecli name claim wallet kryztoval.test
Enter the account password []:
Traceback (most recent call last):
  File "/usr/bin/aecli", line 3, in <module>
    from aeternity import __main__
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 702, in <module>
    cli(obj={})
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/aepp-sdk-python/venv/lib64/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/aepp-sdk-python/aeternity/__main__.py", line 343, in name_register
    txs = name.full_claim_blocking(account, name_ttl=name_ttl, tx_ttl=ttl)
  File "/opt/aepp-sdk-python/aeternity/aens.py", line 125, in full_claim_blocking
    h = self.preclaim(account, fee=preclaim_fee, tx_ttl=tx_ttl)
  File "/opt/aepp-sdk-python/aeternity/aens.py", line 151, in preclaim
    tx, sg, tx_hash = txb.tx_name_preclaim(commitment_hash, fee, tx_ttl)
  File "/opt/aepp-sdk-python/aeternity/transactions.py", line 266, in tx_name_preclaim
    tx = self.epoch.post_name_preclaim(body=body)
  File "/opt/aepp-sdk-python/aeternity/openapi.py", line 188, in api_method
    raise OpenAPIClientException(f"Error: {api_response.desc}", code=http_reply.status_code)
aeternity.openapi.OpenAPIClientException: Error: Account not found

Substract fee from spend amount

+Feature request

Would it make sense to use this to sweep and account?

Or to spend the total amount in the account without having to perform a balance and withdraway independantly?

Update CLI

Update cli with separation from offline and online sets of commands

Error: Invalid public key, just does NOT work

Hello,

Here is what I just did with 1.1.1 freshly installed:

aecli account create test
Enter the account password []: 
<account>
  Address ___________________________________________ ak_b'EnvNWbub5PJAF6M4UiY7HbZymtaWkr1dU5gfxLLCxNWFV54zz'
  Path ______________________________________________ /data/cryptowallets/aeternity/wallet/test
</account>

Then I try to check my balance:

aecli account balance test
Enter the account password []: 
Error: Invalid public key

Problem is the same is happening with a real account I have with token owned by the address, so I'm still wondering if the coin are lost or not......

That's a serious issue...

Incorrect balance shown

Currently balance returns a string that does not match the value returned by the node.

for example it returns 9109999999999999744 when the node shows 9110000000000000000
This is a rounding issue in python's long int implementation that the aepp-sdk-python is not prevending or working around

Allow --force to skip interactive messages

When requesting the private key from a script, there are some prompts that make it unusable, it would be great if there was an option you can use to prevent the command from stopping to ask for validation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.