Skip to content

Commit

Permalink
Merge pull request #2593 from build-5/impr/2591-metadata-nft-api
Browse files Browse the repository at this point in the history
Only include metadata if there was an actual change
  • Loading branch information
adamunchained authored Sep 16, 2023
2 parents 35c263f + d8e44d0 commit 6f65aa1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/api/src/metadataNft/getNftMutableMetadataHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TransactionHelper,
} from '@iota/iota.js-next';
import Joi from 'joi';
import { isEqual, last } from 'lodash';
import { of } from 'rxjs';
import { CommonJoi, getQueryParams } from '../common';
import { EMPTY_NFT_ID, getMutableMetadata, getShimmerClient } from './wallet';
Expand All @@ -27,7 +28,10 @@ export const getNftMutableMetadataHistory = async (url: string) => {
const outputId = (await indexer.nft(body.nftId)).items[0];
let outputResponse: IOutputResponse | undefined = await client.output(outputId);
do {
history.push(getMutableMetadata(outputResponse.output as INftOutput));
const metadata = getMutableMetadata(outputResponse.output as INftOutput);
if (!isEqual(metadata, last(history))) {
history.push(metadata);
}
outputResponse = await getPrevNftOutput(client, outputResponse);
} while (outputResponse !== undefined);

Expand Down

0 comments on commit 6f65aa1

Please sign in to comment.