-
Notifications
You must be signed in to change notification settings - Fork 39
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
Error while signing transaction: nft_commitment #130
Comments
@yashasvi-ranawat would you have an idea? |
Also, @dinno-invis1ble would you be able to give a minimal reproducible example? |
That should not happen. Unspent class is slotted, so Unspent will always have "nft_commitment". When Unspent.to_dict() is used, the dictionary will have "nft_commitment" as None if its not defined. I'm not sure how you managed to feed a dictionary with undefined "nft_commitment". Perhaps in an extended use-case there's a bug which causes it!
would be much appreciated. |
I am fetching UTXO from bitcore and then signing inputs using bitcash.
Example of 'tx_data' variable:
|
In the code, I noticed that Unspent.from_dict expects a second argument. However, based on the references I initially mentioned, this second argument isn't provided. |
bitcash, since version 1.0, has different Unspent format. The Unspents also have cashtokens. You'll need to append the missing cashtoken data to your "unspents": def unspent_core2cash(tx_data):
unspents = tx_data["unspents"]
for unspent in unspents:
for i in ["category_id", "nft_capability", "nft_commitment", "token_amount"]:
unspent[i] = unspent.get(i)
return tx_data
tx_data = unspent_core2cash(tx_data)
signed_hex = private_key.sign_transaction(tx_data)
That's a class function construct, the first argument is the class itself (like "self", but You may ask further, but close the issue if this resolves it. :) |
Thanks for addressing this! Closing. |
Hello,
I encountered an "nft_commitment" error while signing a transaction.
The issue arises from this specific line in the package:
https://github.com/pybitcash/bitcash/blob/b5217302b60e9714da28977662c6933c8bb028ca/bitcash/wallet.py#L480C12-L480C12
There isn't a second parameter provided for Unspent.from_dict(). Therefore, when it attempts to access nft_commitment from an undefined object, it seems to throw an error.
This is reference to Unspent.from_dict:
https://github.com/pybitcash/bitcash/blob/b5217302b60e9714da28977662c6933c8bb028ca/bitcash/network/meta.py#L76C7-L76C8
Could you clarify if this is a known issue, or perhaps I've overlooked something?
Thanks in advance!
The text was updated successfully, but these errors were encountered: