Documentation Index
Fetch the complete documentation index at: https://mintlify.com/1inch/cross-chain-sdk/llms.txt
Use this file to discover all available pages before exploring further.
HashLock
Represents a hash lock used in cross-chain atomic swaps. Supports both single-fill and multiple-fill orders using Merkle trees.Constructor
32-byte hex-encoded hash value
Use static factory methods (
forSingleFill, forMultipleFills) instead of calling the constructor directly.Static Properties
Returns “bytes32” - the Solidity type for hash locks
Static Methods
forSingleFill
Create a HashLock for a single-fill order by hashing a secret.32-byte hex-encoded secret value
forMultipleFills
Create a HashLock for multiple-fill orders using a Merkle tree.Array of Merkle leaves (must be greater than 2)
hashSecret
Hash a secret using keccak256.32-byte hex-encoded secret value
getMerkleLeaves
Convert secrets to Merkle leaves by hashing and indexing them.Array of 32-byte hex-encoded secrets
getMerkleLeavesFromSecretHashes
Convert pre-hashed secrets to Merkle leaves.Array of already-hashed secrets
getProof
Generate a Merkle proof for a specific leaf index.Array of Merkle leaves
Index of the leaf to prove
fromString
Create a HashLock from a hex string.32-byte hex-encoded hash value
fromBuffer
Create a HashLock from a Buffer.Buffer containing 32 bytes of hash data
Instance Methods
getPartsCount
Get the number of parts (fills) for a multiple-fill order.toString
Convert hash lock to hex string.toBuffer
Convert hash lock to Buffer.eq
Check if this hash lock equals another.HashLock to compare with