diff --git a/lib/output.js b/lib/output.js index 984d43b..c4c2f6e 100644 --- a/lib/output.js +++ b/lib/output.js @@ -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) { diff --git a/lib/output.spec.js b/lib/output.spec.js index 09df900..6dfc016 100644 --- a/lib/output.spec.js +++ b/lib/output.spec.js @@ -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);