MCPcopy Create free account
hub / github.com/wevm/viem / getSourceHash

Function getSourceHash

src/op-stack/utils/getSourceHash.ts:49–61  ·  view source on GitHub ↗
({
  domain,
  l1LogIndex,
  l1BlockHash,
  sequenceNumber,
}: GetSourceHashParameters)

Source from the content-addressed store, hash-verified

47} as const
48
49export function getSourceHash({
50 domain,
51 l1LogIndex,
52 l1BlockHash,
53 sequenceNumber,
54}: GetSourceHashParameters) {
55 const marker = toHex(l1LogIndex! ?? sequenceNumber!)
56 const input = concat([l1BlockHash, pad(marker, { size: 32 })])
57 const depositIdHash = keccak256(input)
58 const domainHex = toHex(sourceHashDomainMap[domain])
59 const domainInput = concat([pad(domainHex, { size: 32 }), depositIdHash])
60 return keccak256(domainInput)
61}

Callers 2

getL2TransactionHashFunction · 0.85

Calls 4

toHexFunction · 0.85
concatFunction · 0.85
padFunction · 0.85
keccak256Function · 0.85

Tested by

no test coverage detected