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

Found a bug when calculating NFT inputs and outputs #149

Closed
wafeishushu opened this issue Jun 13, 2023 · 1 comment
Closed

Found a bug when calculating NFT inputs and outputs #149

wafeishushu opened this issue Jun 13, 2023 · 1 comment

Comments

@wafeishushu
Copy link

wafeishushu commented Jun 13, 2023

File: .../node_modules/cashscript/dist/Transaction.js
Function: setInputsAndOutputs()
Line: 224

if (JSON.stringify(listNftsOutputs[i]) === JSON.stringify(nftInput)) {
    listNftsOutputs.splice(i, 1);
    unusedNfts = unusedNfts.filter((nft) => nft !== nftInput);
    break;
}

Although I wrote the correct inputs and outputs, the inputs are judged to be unusedNfts in this condition,
like:

1: listNftsInputs [
  {
    commitment: '05',
    capability: 'none',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  },
  {
    commitment: '00',
    capability: 'none',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  }
]
2: listNftsOutputs [
  {
    capability: 'none',
    commitment: '05',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  },
  {
    capability: 'none',
    commitment: '00',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  }
]
3: unusedNfts [
  {
    commitment: '05',
    capability: 'none',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  },
  {
    commitment: '00',
    capability: 'none',
    category: 'a7c25f1713935dbe5024339abe4e6b33b9b8e510fda4ae2bdef6e8de8be019ba'
  }
]
@rkalis
Copy link
Member

rkalis commented Jun 13, 2023

Hi @wafeishushu, thank you for reporting this bug. I was able to reproduce it locally and I pushed a fix in the new version 0.8.1. This new version should fix the bug. If the issue still persists for you, please feel free to re-open.

@rkalis rkalis closed this as completed Jun 13, 2023
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

2 participants