Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 22x 11x 11x 11x 10x 11x 11x 11x | import { OP_TYPES } from "../../constants";
import { Remark } from "../remark";
import { Emote } from "../../../rmrk1.0.0/classes/emote";
import { NFT } from "../../..";
export const emoteInteraction = (
remark: Remark,
emoteEntity: Emote,
nft?: NFT
): void => {
if (!nft) {
throw new Error(
`[${OP_TYPES.EMOTE}] Attempting to emote on non-existant NFT ${emoteEntity.id}`
);
}
Iif (nft.burned != "") {
throw new Error(
`[${OP_TYPES.EMOTE}] Cannot emote to a burned NFT ${emoteEntity.id}`
);
}
if (!nft.reactions[emoteEntity.unicode]) {
nft.reactions[emoteEntity.unicode] = [];
}
const index = nft.reactions[emoteEntity.unicode].indexOf(remark.caller, 0);
Iif (index > -1) {
nft.reactions[emoteEntity.unicode].splice(index, 1);
} else {
nft.reactions[emoteEntity.unicode].push(remark.caller);
}
};
|