Skip to content

Commit

Permalink
ENG-1981 fix error when uploading first library file
Browse files Browse the repository at this point in the history
  • Loading branch information
Motokoder committed Oct 7, 2023
1 parent a581421 commit 33f03a4
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 33f03a4

Please sign in to comment.