slimcoin-project / pacli

Simple CLI PeerAssets client (extended version).
GNU General Public License v3.0
0 stars 0 forks source link

dex lock testing #174

Closed buhtignew closed 3 months ago

buhtignew commented 3 months ago

I've run token balances -a and have picked the following deck to test with:

    (
        'johns_attoken2 '
        '(8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012)'
    ): 2.0,

since there was 2 tokens on my current address, n3MtPoPaAREU5GEhAErBPuju83bVog2opz.

Then I've run token balances mxuqE6UWREDuWuMkBWoz1F8jfZur5CM3ZH -t 8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012 to check whether my chosen lock address (mxuqE6UWREDuWuMkBWoz1F8jfZur5CM3ZH) doesn't have tokens of that deck and it was empty.

I've also checked whether my main address had coins and my balance was 760.96.

Then following the dex lock -h Usage hint (dex lock DECK AMOUNT LOCK_BLOCKS LOCK_ADDRESS) I've run dex lock 8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012 1 200 mxuqE6UWREDuWuMkBWoz1F8jfZur5CM3ZH and got:

    General error raised by PeerAssets. Check if your input is correct.

        If you gave a deck as an argument, a possible reason for this error is that you need to initialize the deck.

        To initialize the default decks, use:

        pacli deck init

        To initialize a single deck, use:

        pacli deck init DECKID

I've checked whether the deck was initialized on my side (token list | grep 8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012) and it was.

However I've initialized it again.

Then I've run

What am I doing wrong here?

d5000 commented 3 months ago

That was a bug. Fixed the problem in commit 520d3b5 and tested fix. There was another bug I fixed too. I also added a debug option, so in the case of a "red error" more info will be printed out.

buhtignew commented 3 months ago

I've run dex lock 8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012 1 200 mxuqE6UWREDuWuMkBWoz1F8jfZur5CM3ZH again after upgrade and got the same error. The dex lock 8d91514b31e9c134ae96cfc3837239200b66383bcac7924d981618f0c7895012 1 200 mxuqE6UWREDuWuMkBWoz1F8jfZur5CM3ZH -d output in my side is:

  File "~/.local/bin/pacli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/__main__.py", line 479, in main
    fire.Fire({
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/dex_classes.py", line 56, in lock
    return ei.run_command(dxu.card_lock, deckid=deckid, amount=amount, lock=lock, lockaddr=lock_address, addrtype=addrtype, absolute=blockheight, change=change_address, receiver=receiver_address, sign=sign, send=send, confirm=wait_for_confirmation, txhex=quiet, debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/extended_interface.py", line 34, in run_command
    result = c(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/dex_utils.py", line 75, in card_lock
    return ei.output_tx(eu.finalize_tx(issue, verify=False, sign=sign, send=send, confirm=confirm), txhex=txhex)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/extended_utils.py", line 253, in finalize_tx
    store_checkpoint(quiet=quiet)
  File "~/.local/lib/python3.12/site-packages/pacli/extended_checkpoints.py", line 111, in store_checkpoint
    ce.setcfg("checkpoint", label=height, value=blockhash, quiet=quiet)
  File "~/.local/lib/python3.12/site-packages/pacli/config_extended.py", line 230, in setcfg
    return write_item(category=category, key=label, value=value, modify=modify, replace=replace, quiet=quiet, debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/config_extended.py", line 54, in write_item
    if not ALLOWED_CHARACTERS.match(key):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'int'
d5000 commented 3 months ago

That bug was already fixed for another command. Should work now if you're up to date.

buhtignew commented 3 months ago

Everything works now.