Skip to content

Commit

Permalink
fix: encodeAsset was not being exported
Browse files Browse the repository at this point in the history
  • Loading branch information
0xneves committed May 19, 2024
1 parent 7fb7743 commit b4b46cc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/utils/SwapFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ export async function encodeAsset(
}

const uint16Max = 65535;
const uint120Max = BigInt(2) ** BigInt(120) - BigInt(1);

if (tokenId > uint120Max || tokenAmount > uint120Max) {
throw new Error(
"Maxium bits exceeded for tokenId or tokenAmount. Max: 120 bits.",
);
}

return BigInt(
(BigInt(uint16Max) << BigInt(240)) |
Expand Down Expand Up @@ -203,4 +210,5 @@ module.exports = {
composeSwap,
encodeConfig,
decodeConfig,
encodeAsset,
};

0 comments on commit b4b46cc

Please sign in to comment.