-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
// MerkleTree building options | ||
export type MerkleTreeOptions = Partial<{ | ||
// Enable or disable sorted leaves. Sorting is strongly recommended for multiproofs. | ||
sortLeaves: boolean; | ||
}>; | ||
|
||
// For backward compatibility reasons, leaves are sorted by default. | ||
// This can be disabled for usecases where leaves ordering needs to be preserved | ||
// Recommended (default) options. | ||
// - leaves are sorted by default to facilitate onchain verification of multiproofs. | ||
export const defaultOptions: Required<MerkleTreeOptions> = { | ||
sortLeaves: true, | ||
}; | ||
|
||
export function withDefault(options: MerkleTreeOptions) : Required<MerkleTreeOptions> { | ||
return { ...defaultOptions, ...options }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters