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

getBalance (query utxo) returning undefined: NaN on V1.29.0 (Alonzo) #13

Closed
abdellahaski opened this issue Sep 3, 2021 · 4 comments
Closed

Comments

@abdellahaski
Copy link

Hello,
Apparently, this library needs an update for the Alonzo update, getting the balance input an undefined: NaN on the output:
image

here is the output of cardano-cli shelley query utxo:
image

I think that it's "TxOutDatumHashNone" that's resulting into the undefined: NaN

This does break also building transaction and so on

@jamu85
Copy link

jamu85 commented Sep 7, 2021

I could workaround it by skipping "TxOutDatumHashNone" when the values from the UTXO's lists are parsed.
In cardanocli-js/index.js i wrapped the assignment of the assets values like bellow.

Should be in l225 or near there (I made some more hacks for testing purposes)

    valueList.forEach((v) => {
      if (v != " TxOutDatumHashNone") {
        let [quantity, asset] = v.trim().split(" ");
        quantity = parseInt(quantity);
        value[asset] = quantity;
      };
    });

The leading whitespace is important!

Not sure, if this is the right solution but at least I can proceed minting with my v1.29 node

@gabacode
Copy link

The way I did it was to simply remove the undefined property from the object, like this:

let current = wallet.balance().amount
delete current.undefined
console.log(current)

@javiergradiche
Copy link
Contributor

@alessandrokonrad fixed in PR #23, take a look and merge it, please.

@miguelaeh
Copy link
Owner

The PR was merged, I guess we can close the issue right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants