Skip to content

Commit

Permalink
chore: don't hash hashed source
Browse files Browse the repository at this point in the history
  • Loading branch information
krboktv committed May 2, 2024
1 parent 2fbad1e commit 29d45e4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/fusion-order/source-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ import {isHexString} from '../validations'
const TRACK_CODE_MASK = new BitMask(224n, 256n)

function getTrackCodeForSource(source: string): bigint {
if (isHexString(source) && source.length === 10) {
if (!isHexString(source)) {
return createId(source)
}

if (source.length === 10) {
return BigInt(source)
}

if (source.length === 66) {
return BigInt(source.substring(0, 10))
}

return createId(source)
}

function createId(source: string): bigint {
return BigInt(add0x(id(source).slice(0, 10)))
}

Expand Down

0 comments on commit 29d45e4

Please sign in to comment.