Skip to content

Commit 0ed89a8

Browse files
authored
Merge pull request #36 from rmrk-team/add-emote-to-nft
Return emote remark from NFT class
2 parents 7459d2b + 4d01531 commit 0ed89a8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/rmrk1.0.0/classes/nft.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,19 @@ export class NFT {
146146
separate instance as the block number is an important part of an NFT's ID.`
147147
);
148148
}
149-
return `RMRK::CONSUME::${VERSION}::${this.getId()}`;
149+
return `${PREFIX}::${OP_TYPES.CONSUME}::${VERSION}::${this.getId()}`;
150+
}
151+
152+
public emote(unicode: string): string {
153+
if (!this.block) {
154+
throw new Error(
155+
`You can only emote on an existing NFT. If you just minted this, please load a new,
156+
separate instance as the block number is an important part of an NFT's ID.`
157+
);
158+
}
159+
return `${PREFIX}::${
160+
OP_TYPES.EMOTE
161+
}::${VERSION}::${this.getId()}::${unicode}`;
150162
}
151163

152164
/**

0 commit comments

Comments
 (0)