From 3d0393b7a24c3d473f614bb4b6db49f765ad60e8 Mon Sep 17 00:00:00 2001 From: Fiiranek Date: Mon, 28 Oct 2024 15:50:54 +0100 Subject: [PATCH] Add `==` in `MerkleNode` --- Sources/Starknet/Data/StorageProof/MerkleNode.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/Starknet/Data/StorageProof/MerkleNode.swift b/Sources/Starknet/Data/StorageProof/MerkleNode.swift index 42fea19e..00a34b2b 100644 --- a/Sources/Starknet/Data/StorageProof/MerkleNode.swift +++ b/Sources/Starknet/Data/StorageProof/MerkleNode.swift @@ -37,6 +37,17 @@ public enum MerkleNode: Codable, Equatable { try container.encode(edgeNode) } } + + public static func == (lhs: MerkleNode, rhs: MerkleNode) -> Bool { + switch (lhs, rhs) { + case let (.binaryNode(lhsBinaryNode), .binaryNode(rhsBinaryNode)): + lhsBinaryNode == rhsBinaryNode + case let (.edgeNode(lhsEdgeNode), .edgeNode(rhsEdgeNode)): + lhsEdgeNode == rhsEdgeNode + default: + false + } + } } public struct BinaryNode: Codable, Equatable {