Skip to content

Commit

Permalink
Merge branch 'ENG-1981-collection-library-uploads' into 'develop'
Browse files Browse the repository at this point in the history
ENG-1981 Fix error when uploading first library file

See merge request origyn/engineering/opensource/mintjs!44
  • Loading branch information
James Trefry committed Oct 7, 2023
2 parents a581421 + 33f03a4 commit 4c9fd24
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/methods/nft/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,17 @@ const buildLibraryMetadata = async (

// get highest sort value
let maxSort = 0n;
for (const library of nftLibraries) {
const sortAttrib = getAttribute(library, 'sort');
if (sortAttrib) {
const sort = (sortAttrib.value as NatValue)?.Nat || 0n;
maxSort = sort > maxSort ? sort : maxSort;
if (nftLibraries?.length) {
for (const library of nftLibraries) {
const sortAttrib = getAttribute(library, 'sort');
if (sortAttrib) {
const sort = (sortAttrib.value as NatValue)?.Nat || 0n;
maxSort = sort > maxSort ? sort : maxSort;
}
}
if (maxSort < nftLibraries.length + 1) {
maxSort = BigInt(nftLibraries.length + 1);
}
}
if (maxSort < nftLibraries.length + 1) {
maxSort = BigInt(nftLibraries.length + 1);
}

const attribs: PropertyShared[] = [];
Expand Down

0 comments on commit 4c9fd24

Please sign in to comment.