Skip to content

Commit

Permalink
allow NFTs with 0 id (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannbarbie authored and troggy committed Jan 17, 2020
1 parent 48453d2 commit e4cb95e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class Output {
this.data = data;
}
}
if (lessThan(this.value, BigInt(1))) {
if (!this.isNFT() && !this.isNST() && lessThan(this.value, BigInt(1))) {
throw new Error('Output value is < 1');
}
if (this.color < 0 || this.color > MAX_COLOR) {
Expand Down
4 changes: 4 additions & 0 deletions lib/output.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ describe('Output', () => {
expect(() => (new Output({ address: ADDR, value: 0, color: 1337 }))).to.throw();
});

it('from json, should not disalow 0 for NFT', () => {
verifyOutput(new Output({ address: ADDR, value: 0, color: ERC721color }), BigInt(0), ERC721color, ADDR);
});

it('from json (NFT)', () => {
const output = new Output({ address: ADDR, value: longTokenId, color: ERC721color });
verifyOutput(output, BigInt(longTokenId), ERC721color, ADDR);
Expand Down

0 comments on commit e4cb95e

Please sign in to comment.