diff --git a/Makefile b/Makefile index 423f5391..49aeb0cd 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ xdr/Stellar-internal.x \ xdr/Stellar-contract-config-setting.x XDRGEN_REPO=overcat/xdrgen -XDRGEN_COMMIT=3a25689ac881fd9370b45ac2e98908cea86ddaf3 +XDRGEN_COMMIT=904ac3c9925902fa892fbfd4883e20b056f71712 XDRNEXT_COMMIT=e372df9f677961aac04c5a4cc80a3667f310b29f UNAME := $(shell uname) @@ -61,6 +61,7 @@ clean: format: autoflake --in-place --ignore-init-module-imports --remove-all-unused-imports --recursive . isort . + black . .PHONY: format replace-xdr-keywords: diff --git a/stellar_sdk/xdr/account_entry.py b/stellar_sdk/xdr/account_entry.py index 4bfc03e5..5dcb08e7 100644 --- a/stellar_sdk/xdr/account_entry.py +++ b/stellar_sdk/xdr/account_entry.py @@ -148,6 +148,22 @@ def from_xdr(cls, xdr: str) -> AccountEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.balance, + self.seq_num, + self.num_sub_entries, + self.inflation_dest, + self.flags, + self.home_domain, + self.thresholds, + self.signers, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_ext.py b/stellar_sdk/xdr/account_entry_ext.py index 49915b48..f88df932 100644 --- a/stellar_sdk/xdr/account_entry_ext.py +++ b/stellar_sdk/xdr/account_entry_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> AccountEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_extension_v1.py b/stellar_sdk/xdr/account_entry_extension_v1.py index 8f87c20a..e0d3ce5c 100644 --- a/stellar_sdk/xdr/account_entry_extension_v1.py +++ b/stellar_sdk/xdr/account_entry_extension_v1.py @@ -71,6 +71,14 @@ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liabilities, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_extension_v1_ext.py b/stellar_sdk/xdr/account_entry_extension_v1_ext.py index d78a7fd1..fb9244b8 100644 --- a/stellar_sdk/xdr/account_entry_extension_v1_ext.py +++ b/stellar_sdk/xdr/account_entry_extension_v1_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV1Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v2, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_extension_v2.py b/stellar_sdk/xdr/account_entry_extension_v2.py index c2054df5..d1097a81 100644 --- a/stellar_sdk/xdr/account_entry_extension_v2.py +++ b/stellar_sdk/xdr/account_entry_extension_v2.py @@ -96,6 +96,16 @@ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV2: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.num_sponsored, + self.num_sponsoring, + self.signer_sponsoring_i_ds, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_extension_v2_ext.py b/stellar_sdk/xdr/account_entry_extension_v2_ext.py index 394f6300..4fc18ea0 100644 --- a/stellar_sdk/xdr/account_entry_extension_v2_ext.py +++ b/stellar_sdk/xdr/account_entry_extension_v2_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV2Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v3, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_entry_extension_v3.py b/stellar_sdk/xdr/account_entry_extension_v3.py index 309c5d9d..94b6579d 100644 --- a/stellar_sdk/xdr/account_entry_extension_v3.py +++ b/stellar_sdk/xdr/account_entry_extension_v3.py @@ -76,6 +76,15 @@ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV3: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.seq_ledger, + self.seq_time, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_id.py b/stellar_sdk/xdr/account_id.py index c722f039..eddbbfad 100644 --- a/stellar_sdk/xdr/account_id.py +++ b/stellar_sdk/xdr/account_id.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> AccountID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.account_id) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/account_merge_result.py b/stellar_sdk/xdr/account_merge_result.py index cd01317e..239796ba 100644 --- a/stellar_sdk/xdr/account_merge_result.py +++ b/stellar_sdk/xdr/account_merge_result.py @@ -139,6 +139,14 @@ def from_xdr(cls, xdr: str) -> AccountMergeResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.source_account_balance, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/allow_trust_op.py b/stellar_sdk/xdr/allow_trust_op.py index 30438dfe..2c46d32e 100644 --- a/stellar_sdk/xdr/allow_trust_op.py +++ b/stellar_sdk/xdr/allow_trust_op.py @@ -72,6 +72,15 @@ def from_xdr(cls, xdr: str) -> AllowTrustOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.trustor, + self.asset, + self.authorize, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/allow_trust_result.py b/stellar_sdk/xdr/allow_trust_result.py index ce6b7d38..6a3c8609 100644 --- a/stellar_sdk/xdr/allow_trust_result.py +++ b/stellar_sdk/xdr/allow_trust_result.py @@ -118,6 +118,9 @@ def from_xdr(cls, xdr: str) -> AllowTrustResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/alpha_num12.py b/stellar_sdk/xdr/alpha_num12.py index 9c275a7a..ec5192f8 100644 --- a/stellar_sdk/xdr/alpha_num12.py +++ b/stellar_sdk/xdr/alpha_num12.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> AlphaNum12: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.asset_code, + self.issuer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/alpha_num4.py b/stellar_sdk/xdr/alpha_num4.py index ff36aa4d..6ee0afb2 100644 --- a/stellar_sdk/xdr/alpha_num4.py +++ b/stellar_sdk/xdr/alpha_num4.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> AlphaNum4: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.asset_code, + self.issuer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/asset.py b/stellar_sdk/xdr/asset.py index 933c4bbc..ec317ee2 100644 --- a/stellar_sdk/xdr/asset.py +++ b/stellar_sdk/xdr/asset.py @@ -101,6 +101,15 @@ def from_xdr(cls, xdr: str) -> Asset: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.alpha_num4, + self.alpha_num12, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/asset_code.py b/stellar_sdk/xdr/asset_code.py index d91ca060..3cbf1b9d 100644 --- a/stellar_sdk/xdr/asset_code.py +++ b/stellar_sdk/xdr/asset_code.py @@ -90,6 +90,15 @@ def from_xdr(cls, xdr: str) -> AssetCode: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.asset_code4, + self.asset_code12, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/asset_code12.py b/stellar_sdk/xdr/asset_code12.py index 0c934f8f..f90d0fb3 100644 --- a/stellar_sdk/xdr/asset_code12.py +++ b/stellar_sdk/xdr/asset_code12.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> AssetCode12: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.asset_code12) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/asset_code4.py b/stellar_sdk/xdr/asset_code4.py index 215d1d2b..fc439031 100644 --- a/stellar_sdk/xdr/asset_code4.py +++ b/stellar_sdk/xdr/asset_code4.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> AssetCode4: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.asset_code4) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/auth.py b/stellar_sdk/xdr/auth.py index a7a96f59..26e39510 100644 --- a/stellar_sdk/xdr/auth.py +++ b/stellar_sdk/xdr/auth.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> Auth: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.flags,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/auth_cert.py b/stellar_sdk/xdr/auth_cert.py index ad51fc9b..85c3e55d 100644 --- a/stellar_sdk/xdr/auth_cert.py +++ b/stellar_sdk/xdr/auth_cert.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> AuthCert: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.pubkey, + self.expiration, + self.sig, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/authenticated_message.py b/stellar_sdk/xdr/authenticated_message.py index e62728e1..8f5c2677 100644 --- a/stellar_sdk/xdr/authenticated_message.py +++ b/stellar_sdk/xdr/authenticated_message.py @@ -71,6 +71,14 @@ def from_xdr(cls, xdr: str) -> AuthenticatedMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/authenticated_message_v0.py b/stellar_sdk/xdr/authenticated_message_v0.py index d4784715..db99e6e0 100644 --- a/stellar_sdk/xdr/authenticated_message_v0.py +++ b/stellar_sdk/xdr/authenticated_message_v0.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> AuthenticatedMessageV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.sequence, + self.message, + self.mac, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/base.py b/stellar_sdk/xdr/base.py index f3161499..65179b8f 100644 --- a/stellar_sdk/xdr/base.py +++ b/stellar_sdk/xdr/base.py @@ -24,6 +24,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> int: return unpacker.unpack_int() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -44,6 +47,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> int: return unpacker.unpack_uint() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -64,6 +70,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> float: return unpacker.unpack_float() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -84,6 +93,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> float: return unpacker.unpack_double() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -104,6 +116,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> int: return unpacker.unpack_hyper() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -124,6 +139,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> int: return unpacker.unpack_uhyper() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -144,6 +162,9 @@ def pack(self, packer: Packer) -> None: def unpack(unpacker: Unpacker) -> bool: return unpacker.unpack_bool() + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -172,6 +193,9 @@ def unpack(unpacker: Unpacker) -> bytes: size = unpacker.unpack_uint() return unpacker.unpack_fopaque(size) + def __hash__(self): + return hash((self.value, self.size)) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented @@ -212,6 +236,9 @@ def unpack(unpacker: Unpacker, size: int, fixed: bool) -> bytes: size = unpacker.unpack_uint() return unpacker.unpack_fopaque(size) + def __hash__(self): + return hash((self.value, self.size, self.fixed)) + def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py b/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py index 5b8b032e..f05a5d2a 100644 --- a/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py +++ b/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> BeginSponsoringFutureReservesOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.sponsored_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py index a700542a..287064ec 100644 --- a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py +++ b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py @@ -134,6 +134,9 @@ def from_xdr(cls, xdr: str) -> BeginSponsoringFutureReservesResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bucket_entry.py b/stellar_sdk/xdr/bucket_entry.py index fd527df3..34570dc0 100644 --- a/stellar_sdk/xdr/bucket_entry.py +++ b/stellar_sdk/xdr/bucket_entry.py @@ -118,6 +118,16 @@ def from_xdr(cls, xdr: str) -> BucketEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.live_entry, + self.dead_entry, + self.meta_entry, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bucket_metadata.py b/stellar_sdk/xdr/bucket_metadata.py index f676fff8..a3a00431 100644 --- a/stellar_sdk/xdr/bucket_metadata.py +++ b/stellar_sdk/xdr/bucket_metadata.py @@ -71,6 +71,14 @@ def from_xdr(cls, xdr: str) -> BucketMetadata: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_version, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bucket_metadata_ext.py b/stellar_sdk/xdr/bucket_metadata_ext.py index ebc7fa7c..c102c532 100644 --- a/stellar_sdk/xdr/bucket_metadata_ext.py +++ b/stellar_sdk/xdr/bucket_metadata_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> BucketMetadataExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bump_footprint_expiration_op.py b/stellar_sdk/xdr/bump_footprint_expiration_op.py index ed25b003..b3c48ef1 100644 --- a/stellar_sdk/xdr/bump_footprint_expiration_op.py +++ b/stellar_sdk/xdr/bump_footprint_expiration_op.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> BumpFootprintExpirationOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.ledgers_to_expire, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bump_footprint_expiration_result.py b/stellar_sdk/xdr/bump_footprint_expiration_result.py index 7a0660e2..78d408cb 100644 --- a/stellar_sdk/xdr/bump_footprint_expiration_result.py +++ b/stellar_sdk/xdr/bump_footprint_expiration_result.py @@ -103,6 +103,9 @@ def from_xdr(cls, xdr: str) -> BumpFootprintExpirationResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bump_sequence_op.py b/stellar_sdk/xdr/bump_sequence_op.py index e27e2a13..ea331d5b 100644 --- a/stellar_sdk/xdr/bump_sequence_op.py +++ b/stellar_sdk/xdr/bump_sequence_op.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> BumpSequenceOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.bump_to,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/bump_sequence_result.py b/stellar_sdk/xdr/bump_sequence_result.py index 7a367332..4ae99870 100644 --- a/stellar_sdk/xdr/bump_sequence_result.py +++ b/stellar_sdk/xdr/bump_sequence_result.py @@ -73,6 +73,9 @@ def from_xdr(cls, xdr: str) -> BumpSequenceResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/change_trust_asset.py b/stellar_sdk/xdr/change_trust_asset.py index 58ba206c..f5de7944 100644 --- a/stellar_sdk/xdr/change_trust_asset.py +++ b/stellar_sdk/xdr/change_trust_asset.py @@ -125,6 +125,16 @@ def from_xdr(cls, xdr: str) -> ChangeTrustAsset: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.alpha_num4, + self.alpha_num12, + self.liquidity_pool, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/change_trust_op.py b/stellar_sdk/xdr/change_trust_op.py index 38118c18..21f4cd35 100644 --- a/stellar_sdk/xdr/change_trust_op.py +++ b/stellar_sdk/xdr/change_trust_op.py @@ -65,6 +65,14 @@ def from_xdr(cls, xdr: str) -> ChangeTrustOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.line, + self.limit, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/change_trust_result.py b/stellar_sdk/xdr/change_trust_result.py index e36d84ab..6861ae13 100644 --- a/stellar_sdk/xdr/change_trust_result.py +++ b/stellar_sdk/xdr/change_trust_result.py @@ -139,6 +139,9 @@ def from_xdr(cls, xdr: str) -> ChangeTrustResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_atom.py b/stellar_sdk/xdr/claim_atom.py index 67e6f61b..c5ff27aa 100644 --- a/stellar_sdk/xdr/claim_atom.py +++ b/stellar_sdk/xdr/claim_atom.py @@ -108,6 +108,16 @@ def from_xdr(cls, xdr: str) -> ClaimAtom: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.v0, + self.order_book, + self.liquidity_pool, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_claimable_balance_op.py b/stellar_sdk/xdr/claim_claimable_balance_op.py index 470c0e7b..b624af65 100644 --- a/stellar_sdk/xdr/claim_claimable_balance_op.py +++ b/stellar_sdk/xdr/claim_claimable_balance_op.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> ClaimClaimableBalanceOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.balance_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_claimable_balance_result.py b/stellar_sdk/xdr/claim_claimable_balance_result.py index 385dfd2e..d8e16ed7 100644 --- a/stellar_sdk/xdr/claim_claimable_balance_result.py +++ b/stellar_sdk/xdr/claim_claimable_balance_result.py @@ -134,6 +134,9 @@ def from_xdr(cls, xdr: str) -> ClaimClaimableBalanceResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_liquidity_atom.py b/stellar_sdk/xdr/claim_liquidity_atom.py index 9d237ff1..26649dc7 100644 --- a/stellar_sdk/xdr/claim_liquidity_atom.py +++ b/stellar_sdk/xdr/claim_liquidity_atom.py @@ -86,6 +86,17 @@ def from_xdr(cls, xdr: str) -> ClaimLiquidityAtom: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liquidity_pool_id, + self.asset_sold, + self.amount_sold, + self.asset_bought, + self.amount_bought, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_offer_atom.py b/stellar_sdk/xdr/claim_offer_atom.py index 032bab82..72cabc81 100644 --- a/stellar_sdk/xdr/claim_offer_atom.py +++ b/stellar_sdk/xdr/claim_offer_atom.py @@ -93,6 +93,18 @@ def from_xdr(cls, xdr: str) -> ClaimOfferAtom: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.seller_id, + self.offer_id, + self.asset_sold, + self.amount_sold, + self.asset_bought, + self.amount_bought, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_offer_atom_v0.py b/stellar_sdk/xdr/claim_offer_atom_v0.py index 3cf3ea8e..ce6efbb4 100644 --- a/stellar_sdk/xdr/claim_offer_atom_v0.py +++ b/stellar_sdk/xdr/claim_offer_atom_v0.py @@ -93,6 +93,18 @@ def from_xdr(cls, xdr: str) -> ClaimOfferAtomV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.seller_ed25519, + self.offer_id, + self.asset_sold, + self.amount_sold, + self.asset_bought, + self.amount_bought, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claim_predicate.py b/stellar_sdk/xdr/claim_predicate.py index 625ea0a5..3bdead99 100644 --- a/stellar_sdk/xdr/claim_predicate.py +++ b/stellar_sdk/xdr/claim_predicate.py @@ -190,6 +190,18 @@ def from_xdr(cls, xdr: str) -> ClaimPredicate: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.and_predicates, + self.or_predicates, + self.not_predicate, + self.abs_before, + self.rel_before, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimable_balance_entry.py b/stellar_sdk/xdr/claimable_balance_entry.py index b9b5d2e7..6897e14f 100644 --- a/stellar_sdk/xdr/claimable_balance_entry.py +++ b/stellar_sdk/xdr/claimable_balance_entry.py @@ -111,6 +111,17 @@ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.balance_id, + self.claimants, + self.asset, + self.amount, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimable_balance_entry_ext.py b/stellar_sdk/xdr/claimable_balance_entry_ext.py index 9683fc1e..f11d0556 100644 --- a/stellar_sdk/xdr/claimable_balance_entry_ext.py +++ b/stellar_sdk/xdr/claimable_balance_entry_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py b/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py index c85576be..7f79abbd 100644 --- a/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py +++ b/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py @@ -71,6 +71,14 @@ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExtensionV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.flags, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py b/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py index e4852df8..f4886533 100644 --- a/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py +++ b/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExtensionV1Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimable_balance_id.py b/stellar_sdk/xdr/claimable_balance_id.py index 5176007e..57ed46b7 100644 --- a/stellar_sdk/xdr/claimable_balance_id.py +++ b/stellar_sdk/xdr/claimable_balance_id.py @@ -70,6 +70,14 @@ def from_xdr(cls, xdr: str) -> ClaimableBalanceID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimant.py b/stellar_sdk/xdr/claimant.py index a268b31b..778942e4 100644 --- a/stellar_sdk/xdr/claimant.py +++ b/stellar_sdk/xdr/claimant.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> Claimant: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/claimant_v0.py b/stellar_sdk/xdr/claimant_v0.py index 3e7e565c..35fb46b9 100644 --- a/stellar_sdk/xdr/claimant_v0.py +++ b/stellar_sdk/xdr/claimant_v0.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> ClaimantV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.destination, + self.predicate, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/clawback_claimable_balance_op.py b/stellar_sdk/xdr/clawback_claimable_balance_op.py index 540b25d3..c498628e 100644 --- a/stellar_sdk/xdr/clawback_claimable_balance_op.py +++ b/stellar_sdk/xdr/clawback_claimable_balance_op.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> ClawbackClaimableBalanceOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.balance_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/clawback_claimable_balance_result.py b/stellar_sdk/xdr/clawback_claimable_balance_result.py index 2484e912..d178353c 100644 --- a/stellar_sdk/xdr/clawback_claimable_balance_result.py +++ b/stellar_sdk/xdr/clawback_claimable_balance_result.py @@ -130,6 +130,9 @@ def from_xdr(cls, xdr: str) -> ClawbackClaimableBalanceResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/clawback_op.py b/stellar_sdk/xdr/clawback_op.py index 429491fc..f202878e 100644 --- a/stellar_sdk/xdr/clawback_op.py +++ b/stellar_sdk/xdr/clawback_op.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> ClawbackOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.asset, + self.from_, + self.amount, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/clawback_result.py b/stellar_sdk/xdr/clawback_result.py index f915238c..b4969b05 100644 --- a/stellar_sdk/xdr/clawback_result.py +++ b/stellar_sdk/xdr/clawback_result.py @@ -100,6 +100,9 @@ def from_xdr(cls, xdr: str) -> ClawbackResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py b/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py index 09b825df..ab71f244 100644 --- a/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py @@ -73,6 +73,15 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractBandwidthV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_max_propagate_size_bytes, + self.tx_max_size_bytes, + self.fee_propagate_data1_kb, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_compute_v0.py b/stellar_sdk/xdr/config_setting_contract_compute_v0.py index 0fa55e82..40c0490c 100644 --- a/stellar_sdk/xdr/config_setting_contract_compute_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_compute_v0.py @@ -81,6 +81,16 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractComputeV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_max_instructions, + self.tx_max_instructions, + self.fee_rate_per_instructions_increment, + self.tx_memory_limit, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py b/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py index fb781292..49c3f79c 100644 --- a/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py @@ -57,6 +57,9 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractExecutionLanesV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.ledger_max_tx_count,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py b/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py index cf651295..5dbe4924 100644 --- a/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractHistoricalDataV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.fee_historical1_kb,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py b/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py index e7a0216d..541f7a96 100644 --- a/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py @@ -163,6 +163,28 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractLedgerCostV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_max_read_ledger_entries, + self.ledger_max_read_bytes, + self.ledger_max_write_ledger_entries, + self.ledger_max_write_bytes, + self.tx_max_read_ledger_entries, + self.tx_max_read_bytes, + self.tx_max_write_ledger_entries, + self.tx_max_write_bytes, + self.fee_read_ledger_entry, + self.fee_write_ledger_entry, + self.fee_read1_kb, + self.fee_write1_kb, + self.bucket_list_size_bytes, + self.bucket_list_fee_rate_low, + self.bucket_list_fee_rate_high, + self.bucket_list_growth_factor, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_contract_meta_data_v0.py b/stellar_sdk/xdr/config_setting_contract_meta_data_v0.py index 109154e6..105edbc8 100644 --- a/stellar_sdk/xdr/config_setting_contract_meta_data_v0.py +++ b/stellar_sdk/xdr/config_setting_contract_meta_data_v0.py @@ -65,6 +65,14 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractMetaDataV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx_max_extended_meta_data_size_bytes, + self.fee_extended_meta_data1_kb, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_setting_entry.py b/stellar_sdk/xdr/config_setting_entry.py index 458159db..d6cdc465 100644 --- a/stellar_sdk/xdr/config_setting_entry.py +++ b/stellar_sdk/xdr/config_setting_entry.py @@ -444,6 +444,26 @@ def from_xdr(cls, xdr: str) -> ConfigSettingEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.config_setting_id, + self.contract_max_size_bytes, + self.contract_compute, + self.contract_ledger_cost, + self.contract_historical_data, + self.contract_meta_data, + self.contract_bandwidth, + self.contract_cost_params_cpu_insns, + self.contract_cost_params_mem_bytes, + self.contract_data_key_size_bytes, + self.contract_data_entry_size_bytes, + self.state_expiration_settings, + self.contract_execution_lanes, + self.bucket_list_size_window, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_upgrade_set.py b/stellar_sdk/xdr/config_upgrade_set.py index c4dfe3d2..a0e0b35e 100644 --- a/stellar_sdk/xdr/config_upgrade_set.py +++ b/stellar_sdk/xdr/config_upgrade_set.py @@ -66,6 +66,9 @@ def from_xdr(cls, xdr: str) -> ConfigUpgradeSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.updated_entry,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/config_upgrade_set_key.py b/stellar_sdk/xdr/config_upgrade_set_key.py index ccca6aa0..c1eb49b7 100644 --- a/stellar_sdk/xdr/config_upgrade_set_key.py +++ b/stellar_sdk/xdr/config_upgrade_set_key.py @@ -61,6 +61,14 @@ def from_xdr(cls, xdr: str) -> ConfigUpgradeSetKey: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.contract_id, + self.content_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_code_entry.py b/stellar_sdk/xdr/contract_code_entry.py index 7654b0e4..fc697dfb 100644 --- a/stellar_sdk/xdr/contract_code_entry.py +++ b/stellar_sdk/xdr/contract_code_entry.py @@ -84,6 +84,16 @@ def from_xdr(cls, xdr: str) -> ContractCodeEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.hash, + self.body, + self.expiration_ledger_seq, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_code_entry_body.py b/stellar_sdk/xdr/contract_code_entry_body.py index c0085e70..a84bbd3a 100644 --- a/stellar_sdk/xdr/contract_code_entry_body.py +++ b/stellar_sdk/xdr/contract_code_entry_body.py @@ -80,6 +80,14 @@ def from_xdr(cls, xdr: str) -> ContractCodeEntryBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.body_type, + self.code, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_cost_param_entry.py b/stellar_sdk/xdr/contract_cost_param_entry.py index 9172de08..2d3a68a4 100644 --- a/stellar_sdk/xdr/contract_cost_param_entry.py +++ b/stellar_sdk/xdr/contract_cost_param_entry.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> ContractCostParamEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.const_term, + self.linear_term, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_cost_params.py b/stellar_sdk/xdr/contract_cost_params.py index 832928c3..e7411691 100644 --- a/stellar_sdk/xdr/contract_cost_params.py +++ b/stellar_sdk/xdr/contract_cost_params.py @@ -60,6 +60,9 @@ def from_xdr(cls, xdr: str) -> ContractCostParams: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.contract_cost_params) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_data_entry.py b/stellar_sdk/xdr/contract_data_entry.py index 6964054f..f288a517 100644 --- a/stellar_sdk/xdr/contract_data_entry.py +++ b/stellar_sdk/xdr/contract_data_entry.py @@ -95,6 +95,17 @@ def from_xdr(cls, xdr: str) -> ContractDataEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.contract, + self.key, + self.durability, + self.body, + self.expiration_ledger_seq, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_data_entry_body.py b/stellar_sdk/xdr/contract_data_entry_body.py index 5dd65de0..87f00b47 100644 --- a/stellar_sdk/xdr/contract_data_entry_body.py +++ b/stellar_sdk/xdr/contract_data_entry_body.py @@ -84,6 +84,14 @@ def from_xdr(cls, xdr: str) -> ContractDataEntryBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.body_type, + self.data, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_data_entry_data.py b/stellar_sdk/xdr/contract_data_entry_data.py index e20b30de..86dfd5f7 100644 --- a/stellar_sdk/xdr/contract_data_entry_data.py +++ b/stellar_sdk/xdr/contract_data_entry_data.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> ContractDataEntryData: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.flags, + self.val, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_event.py b/stellar_sdk/xdr/contract_event.py index 57193fd4..0da1b34a 100644 --- a/stellar_sdk/xdr/contract_event.py +++ b/stellar_sdk/xdr/contract_event.py @@ -95,6 +95,16 @@ def from_xdr(cls, xdr: str) -> ContractEvent: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.contract_id, + self.type, + self.body, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_event_body.py b/stellar_sdk/xdr/contract_event_body.py index 305d176e..95a0ada4 100644 --- a/stellar_sdk/xdr/contract_event_body.py +++ b/stellar_sdk/xdr/contract_event_body.py @@ -70,6 +70,14 @@ def from_xdr(cls, xdr: str) -> ContractEventBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_event_v0.py b/stellar_sdk/xdr/contract_event_v0.py index f6e90d49..7e4bff0f 100644 --- a/stellar_sdk/xdr/contract_event_v0.py +++ b/stellar_sdk/xdr/contract_event_v0.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> ContractEventV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.topics, + self.data, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_executable.py b/stellar_sdk/xdr/contract_executable.py index a3dad101..55dfafda 100644 --- a/stellar_sdk/xdr/contract_executable.py +++ b/stellar_sdk/xdr/contract_executable.py @@ -80,6 +80,14 @@ def from_xdr(cls, xdr: str) -> ContractExecutable: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.wasm_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_id_preimage.py b/stellar_sdk/xdr/contract_id_preimage.py index 3abba194..8f6f8610 100644 --- a/stellar_sdk/xdr/contract_id_preimage.py +++ b/stellar_sdk/xdr/contract_id_preimage.py @@ -101,6 +101,15 @@ def from_xdr(cls, xdr: str) -> ContractIDPreimage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.from_address, + self.from_asset, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/contract_id_preimage_from_address.py b/stellar_sdk/xdr/contract_id_preimage_from_address.py index 3867d02b..2a06df0b 100644 --- a/stellar_sdk/xdr/contract_id_preimage_from_address.py +++ b/stellar_sdk/xdr/contract_id_preimage_from_address.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> ContractIDPreimageFromAddress: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.address, + self.salt, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_account_op.py b/stellar_sdk/xdr/create_account_op.py index cdba2a35..fa9df0df 100644 --- a/stellar_sdk/xdr/create_account_op.py +++ b/stellar_sdk/xdr/create_account_op.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> CreateAccountOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.destination, + self.starting_balance, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_account_result.py b/stellar_sdk/xdr/create_account_result.py index 176430ea..b3556bbe 100644 --- a/stellar_sdk/xdr/create_account_result.py +++ b/stellar_sdk/xdr/create_account_result.py @@ -100,6 +100,9 @@ def from_xdr(cls, xdr: str) -> CreateAccountResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_claimable_balance_op.py b/stellar_sdk/xdr/create_claimable_balance_op.py index 5810c5b2..78ee4a82 100644 --- a/stellar_sdk/xdr/create_claimable_balance_op.py +++ b/stellar_sdk/xdr/create_claimable_balance_op.py @@ -81,6 +81,15 @@ def from_xdr(cls, xdr: str) -> CreateClaimableBalanceOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.asset, + self.amount, + self.claimants, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_claimable_balance_result.py b/stellar_sdk/xdr/create_claimable_balance_result.py index 7aed1b93..2cea9526 100644 --- a/stellar_sdk/xdr/create_claimable_balance_result.py +++ b/stellar_sdk/xdr/create_claimable_balance_result.py @@ -157,6 +157,14 @@ def from_xdr(cls, xdr: str) -> CreateClaimableBalanceResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.balance_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_contract_args.py b/stellar_sdk/xdr/create_contract_args.py index 9b6d6af4..df8cd36e 100644 --- a/stellar_sdk/xdr/create_contract_args.py +++ b/stellar_sdk/xdr/create_contract_args.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> CreateContractArgs: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.contract_id_preimage, + self.executable, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/create_passive_sell_offer_op.py b/stellar_sdk/xdr/create_passive_sell_offer_op.py index 8e57282d..fcfadf61 100644 --- a/stellar_sdk/xdr/create_passive_sell_offer_op.py +++ b/stellar_sdk/xdr/create_passive_sell_offer_op.py @@ -76,6 +76,16 @@ def from_xdr(cls, xdr: str) -> CreatePassiveSellOfferOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.selling, + self.buying, + self.amount, + self.price, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/curve25519_public.py b/stellar_sdk/xdr/curve25519_public.py index 851f8825..c8b902e0 100644 --- a/stellar_sdk/xdr/curve25519_public.py +++ b/stellar_sdk/xdr/curve25519_public.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> Curve25519Public: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.key,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/curve25519_secret.py b/stellar_sdk/xdr/curve25519_secret.py index f63e99fb..53087b60 100644 --- a/stellar_sdk/xdr/curve25519_secret.py +++ b/stellar_sdk/xdr/curve25519_secret.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> Curve25519Secret: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.key,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/data_entry.py b/stellar_sdk/xdr/data_entry.py index 9910083c..8ba863ca 100644 --- a/stellar_sdk/xdr/data_entry.py +++ b/stellar_sdk/xdr/data_entry.py @@ -84,6 +84,16 @@ def from_xdr(cls, xdr: str) -> DataEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.data_name, + self.data_value, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/data_entry_ext.py b/stellar_sdk/xdr/data_entry_ext.py index 7daacbdf..d2e86e66 100644 --- a/stellar_sdk/xdr/data_entry_ext.py +++ b/stellar_sdk/xdr/data_entry_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> DataEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/data_value.py b/stellar_sdk/xdr/data_value.py index 0b480aab..64d2cef7 100644 --- a/stellar_sdk/xdr/data_value.py +++ b/stellar_sdk/xdr/data_value.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> DataValue: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.data_value) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/decorated_signature.py b/stellar_sdk/xdr/decorated_signature.py index 5ffa8f59..b997b36a 100644 --- a/stellar_sdk/xdr/decorated_signature.py +++ b/stellar_sdk/xdr/decorated_signature.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> DecoratedSignature: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hint, + self.signature, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/diagnostic_event.py b/stellar_sdk/xdr/diagnostic_event.py index cca6193e..dd1accf8 100644 --- a/stellar_sdk/xdr/diagnostic_event.py +++ b/stellar_sdk/xdr/diagnostic_event.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> DiagnosticEvent: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.in_successful_contract_call, + self.event, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/dont_have.py b/stellar_sdk/xdr/dont_have.py index 23401ce8..c420b5c0 100644 --- a/stellar_sdk/xdr/dont_have.py +++ b/stellar_sdk/xdr/dont_have.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> DontHave: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.req_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/duration.py b/stellar_sdk/xdr/duration.py index 53da975b..4ea0bdd0 100644 --- a/stellar_sdk/xdr/duration.py +++ b/stellar_sdk/xdr/duration.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Duration: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.duration) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/encrypted_body.py b/stellar_sdk/xdr/encrypted_body.py index 1222c77e..95aa7101 100644 --- a/stellar_sdk/xdr/encrypted_body.py +++ b/stellar_sdk/xdr/encrypted_body.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> EncryptedBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.encrypted_body) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py b/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py index 76b7b71c..e53a311d 100644 --- a/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py +++ b/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py @@ -96,6 +96,9 @@ def from_xdr(cls, xdr: str) -> EndSponsoringFutureReservesResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/error.py b/stellar_sdk/xdr/error.py index 414779df..8e29da1b 100644 --- a/stellar_sdk/xdr/error.py +++ b/stellar_sdk/xdr/error.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> Error: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.msg, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/extension_point.py b/stellar_sdk/xdr/extension_point.py index e70a9032..be4a343e 100644 --- a/stellar_sdk/xdr/extension_point.py +++ b/stellar_sdk/xdr/extension_point.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> ExtensionPoint: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/fee_bump_transaction.py b/stellar_sdk/xdr/fee_bump_transaction.py index 5c0ee4aa..bebc8b72 100644 --- a/stellar_sdk/xdr/fee_bump_transaction.py +++ b/stellar_sdk/xdr/fee_bump_transaction.py @@ -87,6 +87,16 @@ def from_xdr(cls, xdr: str) -> FeeBumpTransaction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.fee_source, + self.fee, + self.inner_tx, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/fee_bump_transaction_envelope.py b/stellar_sdk/xdr/fee_bump_transaction_envelope.py index a24fb3cd..892c7ff2 100644 --- a/stellar_sdk/xdr/fee_bump_transaction_envelope.py +++ b/stellar_sdk/xdr/fee_bump_transaction_envelope.py @@ -76,6 +76,14 @@ def from_xdr(cls, xdr: str) -> FeeBumpTransactionEnvelope: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx, + self.signatures, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/fee_bump_transaction_ext.py b/stellar_sdk/xdr/fee_bump_transaction_ext.py index 4356324c..5bbb7079 100644 --- a/stellar_sdk/xdr/fee_bump_transaction_ext.py +++ b/stellar_sdk/xdr/fee_bump_transaction_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> FeeBumpTransactionExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py b/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py index 225697e3..f3a3a92c 100644 --- a/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py +++ b/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> FeeBumpTransactionInnerTx: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/flood_advert.py b/stellar_sdk/xdr/flood_advert.py index d426b8eb..ece034b9 100644 --- a/stellar_sdk/xdr/flood_advert.py +++ b/stellar_sdk/xdr/flood_advert.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> FloodAdvert: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.tx_hashes,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/flood_demand.py b/stellar_sdk/xdr/flood_demand.py index 608922e1..0d9f1b66 100644 --- a/stellar_sdk/xdr/flood_demand.py +++ b/stellar_sdk/xdr/flood_demand.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> FloodDemand: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.tx_hashes,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/generalized_transaction_set.py b/stellar_sdk/xdr/generalized_transaction_set.py index e1b1f0a8..c1908798 100644 --- a/stellar_sdk/xdr/generalized_transaction_set.py +++ b/stellar_sdk/xdr/generalized_transaction_set.py @@ -67,6 +67,14 @@ def from_xdr(cls, xdr: str) -> GeneralizedTransactionSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1_tx_set, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash.py b/stellar_sdk/xdr/hash.py index e7b4205f..f7e17215 100644 --- a/stellar_sdk/xdr/hash.py +++ b/stellar_sdk/xdr/hash.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Hash: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.hash) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash_id_preimage.py b/stellar_sdk/xdr/hash_id_preimage.py index f5e2be2c..3b390378 100644 --- a/stellar_sdk/xdr/hash_id_preimage.py +++ b/stellar_sdk/xdr/hash_id_preimage.py @@ -154,6 +154,17 @@ def from_xdr(cls, xdr: str) -> HashIDPreimage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.operation_id, + self.revoke_id, + self.contract_id, + self.soroban_authorization, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash_id_preimage_contract_id.py b/stellar_sdk/xdr/hash_id_preimage_contract_id.py index 15d0053c..45c4203a 100644 --- a/stellar_sdk/xdr/hash_id_preimage_contract_id.py +++ b/stellar_sdk/xdr/hash_id_preimage_contract_id.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> HashIDPreimageContractID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.network_id, + self.contract_id_preimage, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash_id_preimage_operation_id.py b/stellar_sdk/xdr/hash_id_preimage_operation_id.py index 9ed42f70..19c4301e 100644 --- a/stellar_sdk/xdr/hash_id_preimage_operation_id.py +++ b/stellar_sdk/xdr/hash_id_preimage_operation_id.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> HashIDPreimageOperationID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.source_account, + self.seq_num, + self.op_num, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash_id_preimage_revoke_id.py b/stellar_sdk/xdr/hash_id_preimage_revoke_id.py index bd177232..e265db0e 100644 --- a/stellar_sdk/xdr/hash_id_preimage_revoke_id.py +++ b/stellar_sdk/xdr/hash_id_preimage_revoke_id.py @@ -84,6 +84,17 @@ def from_xdr(cls, xdr: str) -> HashIDPreimageRevokeID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.source_account, + self.seq_num, + self.op_num, + self.liquidity_pool_id, + self.asset, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py b/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py index 7524f1f3..30587a84 100644 --- a/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py +++ b/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py @@ -77,6 +77,16 @@ def from_xdr(cls, xdr: str) -> HashIDPreimageSorobanAuthorization: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.network_id, + self.nonce, + self.signature_expiration_ledger, + self.invocation, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hello.py b/stellar_sdk/xdr/hello.py index b87a0fd8..8f771f6a 100644 --- a/stellar_sdk/xdr/hello.py +++ b/stellar_sdk/xdr/hello.py @@ -109,6 +109,21 @@ def from_xdr(cls, xdr: str) -> Hello: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_version, + self.overlay_version, + self.overlay_min_version, + self.network_id, + self.version_str, + self.listening_port, + self.peer_id, + self.cert, + self.nonce, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hmac_sha256_key.py b/stellar_sdk/xdr/hmac_sha256_key.py index 32f9e255..9e39459a 100644 --- a/stellar_sdk/xdr/hmac_sha256_key.py +++ b/stellar_sdk/xdr/hmac_sha256_key.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> HmacSha256Key: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.key,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/hmac_sha256_mac.py b/stellar_sdk/xdr/hmac_sha256_mac.py index 575e12b7..548868c1 100644 --- a/stellar_sdk/xdr/hmac_sha256_mac.py +++ b/stellar_sdk/xdr/hmac_sha256_mac.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> HmacSha256Mac: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.mac,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/host_function.py b/stellar_sdk/xdr/host_function.py index 71a96956..447785ad 100644 --- a/stellar_sdk/xdr/host_function.py +++ b/stellar_sdk/xdr/host_function.py @@ -114,6 +114,16 @@ def from_xdr(cls, xdr: str) -> HostFunction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.invoke_contract, + self.create_contract, + self.wasm, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inflation_payout.py b/stellar_sdk/xdr/inflation_payout.py index 6e8b438d..0d9dcf4a 100644 --- a/stellar_sdk/xdr/inflation_payout.py +++ b/stellar_sdk/xdr/inflation_payout.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> InflationPayout: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.destination, + self.amount, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inflation_result.py b/stellar_sdk/xdr/inflation_result.py index 17ef912e..f58e42e8 100644 --- a/stellar_sdk/xdr/inflation_result.py +++ b/stellar_sdk/xdr/inflation_result.py @@ -91,6 +91,14 @@ def from_xdr(cls, xdr: str) -> InflationResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.payouts, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inner_transaction_result.py b/stellar_sdk/xdr/inner_transaction_result.py index 18d25a8a..f073b2ef 100644 --- a/stellar_sdk/xdr/inner_transaction_result.py +++ b/stellar_sdk/xdr/inner_transaction_result.py @@ -103,6 +103,15 @@ def from_xdr(cls, xdr: str) -> InnerTransactionResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.fee_charged, + self.result, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inner_transaction_result_ext.py b/stellar_sdk/xdr/inner_transaction_result_ext.py index 33a952d5..810134ac 100644 --- a/stellar_sdk/xdr/inner_transaction_result_ext.py +++ b/stellar_sdk/xdr/inner_transaction_result_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> InnerTransactionResultExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inner_transaction_result_pair.py b/stellar_sdk/xdr/inner_transaction_result_pair.py index c3c57da2..b36c05ba 100644 --- a/stellar_sdk/xdr/inner_transaction_result_pair.py +++ b/stellar_sdk/xdr/inner_transaction_result_pair.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> InnerTransactionResultPair: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.transaction_hash, + self.result, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/inner_transaction_result_result.py b/stellar_sdk/xdr/inner_transaction_result_result.py index 6731aeb3..9f7caace 100644 --- a/stellar_sdk/xdr/inner_transaction_result_result.py +++ b/stellar_sdk/xdr/inner_transaction_result_result.py @@ -241,6 +241,14 @@ def from_xdr(cls, xdr: str) -> InnerTransactionResultResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.results, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/int128_parts.py b/stellar_sdk/xdr/int128_parts.py index 0daa82b5..e63eaef0 100644 --- a/stellar_sdk/xdr/int128_parts.py +++ b/stellar_sdk/xdr/int128_parts.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> Int128Parts: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hi, + self.lo, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/int256_parts.py b/stellar_sdk/xdr/int256_parts.py index 7ebc52fd..4500ec35 100644 --- a/stellar_sdk/xdr/int256_parts.py +++ b/stellar_sdk/xdr/int256_parts.py @@ -74,6 +74,16 @@ def from_xdr(cls, xdr: str) -> Int256Parts: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hi_hi, + self.hi_lo, + self.lo_hi, + self.lo_lo, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/int32.py b/stellar_sdk/xdr/int32.py index 064d3ae4..b19d5dac 100644 --- a/stellar_sdk/xdr/int32.py +++ b/stellar_sdk/xdr/int32.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Int32: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.int32) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/int64.py b/stellar_sdk/xdr/int64.py index 781569a7..78352c57 100644 --- a/stellar_sdk/xdr/int64.py +++ b/stellar_sdk/xdr/int64.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Int64: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.int64) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/invoke_host_function_op.py b/stellar_sdk/xdr/invoke_host_function_op.py index d522ba9b..7bf8165a 100644 --- a/stellar_sdk/xdr/invoke_host_function_op.py +++ b/stellar_sdk/xdr/invoke_host_function_op.py @@ -76,6 +76,14 @@ def from_xdr(cls, xdr: str) -> InvokeHostFunctionOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.host_function, + self.auth, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/invoke_host_function_result.py b/stellar_sdk/xdr/invoke_host_function_result.py index 54b4dda2..1bec2f22 100644 --- a/stellar_sdk/xdr/invoke_host_function_result.py +++ b/stellar_sdk/xdr/invoke_host_function_result.py @@ -112,6 +112,14 @@ def from_xdr(cls, xdr: str) -> InvokeHostFunctionResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.success, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/invoke_host_function_success_pre_image.py b/stellar_sdk/xdr/invoke_host_function_success_pre_image.py index ba098edc..db533ea4 100644 --- a/stellar_sdk/xdr/invoke_host_function_success_pre_image.py +++ b/stellar_sdk/xdr/invoke_host_function_success_pre_image.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> InvokeHostFunctionSuccessPreImage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.return_value, + self.events, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_bounds.py b/stellar_sdk/xdr/ledger_bounds.py index c15280bd..81fe0e11 100644 --- a/stellar_sdk/xdr/ledger_bounds.py +++ b/stellar_sdk/xdr/ledger_bounds.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> LedgerBounds: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.min_ledger, + self.max_ledger, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_close_meta.py b/stellar_sdk/xdr/ledger_close_meta.py index 3a6856ab..6424cee9 100644 --- a/stellar_sdk/xdr/ledger_close_meta.py +++ b/stellar_sdk/xdr/ledger_close_meta.py @@ -92,6 +92,16 @@ def from_xdr(cls, xdr: str) -> LedgerCloseMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0, + self.v1, + self.v2, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_close_meta_v0.py b/stellar_sdk/xdr/ledger_close_meta_v0.py index a2811ff9..c199861a 100644 --- a/stellar_sdk/xdr/ledger_close_meta_v0.py +++ b/stellar_sdk/xdr/ledger_close_meta_v0.py @@ -124,6 +124,17 @@ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_header, + self.tx_set, + self.tx_processing, + self.upgrades_processing, + self.scp_info, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_close_meta_v1.py b/stellar_sdk/xdr/ledger_close_meta_v1.py index ad5e408b..91fc79b9 100644 --- a/stellar_sdk/xdr/ledger_close_meta_v1.py +++ b/stellar_sdk/xdr/ledger_close_meta_v1.py @@ -124,6 +124,17 @@ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_header, + self.tx_set, + self.tx_processing, + self.upgrades_processing, + self.scp_info, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_close_meta_v2.py b/stellar_sdk/xdr/ledger_close_meta_v2.py index f3e6fd45..8eafb67c 100644 --- a/stellar_sdk/xdr/ledger_close_meta_v2.py +++ b/stellar_sdk/xdr/ledger_close_meta_v2.py @@ -191,6 +191,21 @@ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV2: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.ledger_header, + self.tx_set, + self.tx_processing, + self.upgrades_processing, + self.scp_info, + self.total_byte_size_of_bucket_list, + self.evicted_temporary_ledger_keys, + self.evicted_persistent_ledger_entries, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_close_value_signature.py b/stellar_sdk/xdr/ledger_close_value_signature.py index 93b38a21..5de4c0b1 100644 --- a/stellar_sdk/xdr/ledger_close_value_signature.py +++ b/stellar_sdk/xdr/ledger_close_value_signature.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> LedgerCloseValueSignature: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.node_id, + self.signature, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry.py b/stellar_sdk/xdr/ledger_entry.py index 5814567a..bfc03fc6 100644 --- a/stellar_sdk/xdr/ledger_entry.py +++ b/stellar_sdk/xdr/ledger_entry.py @@ -101,6 +101,15 @@ def from_xdr(cls, xdr: str) -> LedgerEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.last_modified_ledger_seq, + self.data, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_change.py b/stellar_sdk/xdr/ledger_entry_change.py index e38250c7..9eee3586 100644 --- a/stellar_sdk/xdr/ledger_entry_change.py +++ b/stellar_sdk/xdr/ledger_entry_change.py @@ -119,6 +119,17 @@ def from_xdr(cls, xdr: str) -> LedgerEntryChange: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.created, + self.updated, + self.removed, + self.state, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_changes.py b/stellar_sdk/xdr/ledger_entry_changes.py index f9171f2c..6b963009 100644 --- a/stellar_sdk/xdr/ledger_entry_changes.py +++ b/stellar_sdk/xdr/ledger_entry_changes.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> LedgerEntryChanges: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.ledger_entry_changes) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_data.py b/stellar_sdk/xdr/ledger_entry_data.py index 2f037016..90777b46 100644 --- a/stellar_sdk/xdr/ledger_entry_data.py +++ b/stellar_sdk/xdr/ledger_entry_data.py @@ -210,6 +210,22 @@ def from_xdr(cls, xdr: str) -> LedgerEntryData: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.account, + self.trust_line, + self.offer, + self.data, + self.claimable_balance, + self.liquidity_pool, + self.contract_data, + self.contract_code, + self.config_setting, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_ext.py b/stellar_sdk/xdr/ledger_entry_ext.py index b9f2357f..1cdf5eaf 100644 --- a/stellar_sdk/xdr/ledger_entry_ext.py +++ b/stellar_sdk/xdr/ledger_entry_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> LedgerEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_extension_v1.py b/stellar_sdk/xdr/ledger_entry_extension_v1.py index 8390a216..60537421 100644 --- a/stellar_sdk/xdr/ledger_entry_extension_v1.py +++ b/stellar_sdk/xdr/ledger_entry_extension_v1.py @@ -69,6 +69,14 @@ def from_xdr(cls, xdr: str) -> LedgerEntryExtensionV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.sponsoring_id, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py b/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py index 386ed46e..d1d06760 100644 --- a/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py +++ b/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> LedgerEntryExtensionV1Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_footprint.py b/stellar_sdk/xdr/ledger_footprint.py index 44e5c4a8..67de4c5c 100644 --- a/stellar_sdk/xdr/ledger_footprint.py +++ b/stellar_sdk/xdr/ledger_footprint.py @@ -83,6 +83,14 @@ def from_xdr(cls, xdr: str) -> LedgerFootprint: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.read_only, + self.read_write, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header.py b/stellar_sdk/xdr/ledger_header.py index 7ba57589..0c1384e2 100644 --- a/stellar_sdk/xdr/ledger_header.py +++ b/stellar_sdk/xdr/ledger_header.py @@ -176,6 +176,27 @@ def from_xdr(cls, xdr: str) -> LedgerHeader: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_version, + self.previous_ledger_hash, + self.scp_value, + self.tx_set_result_hash, + self.bucket_list_hash, + self.ledger_seq, + self.total_coins, + self.fee_pool, + self.inflation_seq, + self.id_pool, + self.base_fee, + self.base_reserve, + self.max_tx_set_size, + self.skip_list, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header_ext.py b/stellar_sdk/xdr/ledger_header_ext.py index b3d0822f..9cb13e4e 100644 --- a/stellar_sdk/xdr/ledger_header_ext.py +++ b/stellar_sdk/xdr/ledger_header_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> LedgerHeaderExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header_extension_v1.py b/stellar_sdk/xdr/ledger_header_extension_v1.py index 9b6d90d8..f2432013 100644 --- a/stellar_sdk/xdr/ledger_header_extension_v1.py +++ b/stellar_sdk/xdr/ledger_header_extension_v1.py @@ -69,6 +69,14 @@ def from_xdr(cls, xdr: str) -> LedgerHeaderExtensionV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.flags, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header_extension_v1_ext.py b/stellar_sdk/xdr/ledger_header_extension_v1_ext.py index c36959e4..af7b4d02 100644 --- a/stellar_sdk/xdr/ledger_header_extension_v1_ext.py +++ b/stellar_sdk/xdr/ledger_header_extension_v1_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> LedgerHeaderExtensionV1Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header_history_entry.py b/stellar_sdk/xdr/ledger_header_history_entry.py index cbac56a7..de3b6008 100644 --- a/stellar_sdk/xdr/ledger_header_history_entry.py +++ b/stellar_sdk/xdr/ledger_header_history_entry.py @@ -77,6 +77,15 @@ def from_xdr(cls, xdr: str) -> LedgerHeaderHistoryEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hash, + self.header, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_header_history_entry_ext.py b/stellar_sdk/xdr/ledger_header_history_entry_ext.py index ef027e82..e73d62e4 100644 --- a/stellar_sdk/xdr/ledger_header_history_entry_ext.py +++ b/stellar_sdk/xdr/ledger_header_history_entry_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> LedgerHeaderHistoryEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key.py b/stellar_sdk/xdr/ledger_key.py index 92cf2a45..056f8d76 100644 --- a/stellar_sdk/xdr/ledger_key.py +++ b/stellar_sdk/xdr/ledger_key.py @@ -249,6 +249,22 @@ def from_xdr(cls, xdr: str) -> LedgerKey: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.account, + self.trust_line, + self.offer, + self.data, + self.claimable_balance, + self.liquidity_pool, + self.contract_data, + self.contract_code, + self.config_setting, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_account.py b/stellar_sdk/xdr/ledger_key_account.py index df4733d7..f45fdda6 100644 --- a/stellar_sdk/xdr/ledger_key_account.py +++ b/stellar_sdk/xdr/ledger_key_account.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> LedgerKeyAccount: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.account_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_claimable_balance.py b/stellar_sdk/xdr/ledger_key_claimable_balance.py index 11161708..8eb9c835 100644 --- a/stellar_sdk/xdr/ledger_key_claimable_balance.py +++ b/stellar_sdk/xdr/ledger_key_claimable_balance.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> LedgerKeyClaimableBalance: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.balance_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_config_setting.py b/stellar_sdk/xdr/ledger_key_config_setting.py index 5ea4b752..ee0f6181 100644 --- a/stellar_sdk/xdr/ledger_key_config_setting.py +++ b/stellar_sdk/xdr/ledger_key_config_setting.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> LedgerKeyConfigSetting: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.config_setting_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_contract_code.py b/stellar_sdk/xdr/ledger_key_contract_code.py index 72994d1b..a5746293 100644 --- a/stellar_sdk/xdr/ledger_key_contract_code.py +++ b/stellar_sdk/xdr/ledger_key_contract_code.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> LedgerKeyContractCode: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hash, + self.body_type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_contract_data.py b/stellar_sdk/xdr/ledger_key_contract_data.py index 59c68e20..6b3ef992 100644 --- a/stellar_sdk/xdr/ledger_key_contract_data.py +++ b/stellar_sdk/xdr/ledger_key_contract_data.py @@ -77,6 +77,16 @@ def from_xdr(cls, xdr: str) -> LedgerKeyContractData: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.contract, + self.key, + self.durability, + self.body_type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_data.py b/stellar_sdk/xdr/ledger_key_data.py index 0fbf453e..8e311b42 100644 --- a/stellar_sdk/xdr/ledger_key_data.py +++ b/stellar_sdk/xdr/ledger_key_data.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> LedgerKeyData: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.data_name, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_liquidity_pool.py b/stellar_sdk/xdr/ledger_key_liquidity_pool.py index f6e19ed0..b3a33a8b 100644 --- a/stellar_sdk/xdr/ledger_key_liquidity_pool.py +++ b/stellar_sdk/xdr/ledger_key_liquidity_pool.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> LedgerKeyLiquidityPool: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.liquidity_pool_id,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_offer.py b/stellar_sdk/xdr/ledger_key_offer.py index c640ee97..84903857 100644 --- a/stellar_sdk/xdr/ledger_key_offer.py +++ b/stellar_sdk/xdr/ledger_key_offer.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> LedgerKeyOffer: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.seller_id, + self.offer_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_key_trust_line.py b/stellar_sdk/xdr/ledger_key_trust_line.py index 4ee5dca0..2774c171 100644 --- a/stellar_sdk/xdr/ledger_key_trust_line.py +++ b/stellar_sdk/xdr/ledger_key_trust_line.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> LedgerKeyTrustLine: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.asset, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_scp_messages.py b/stellar_sdk/xdr/ledger_scp_messages.py index d757512b..6aba5de6 100644 --- a/stellar_sdk/xdr/ledger_scp_messages.py +++ b/stellar_sdk/xdr/ledger_scp_messages.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> LedgerSCPMessages: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_seq, + self.messages, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/ledger_upgrade.py b/stellar_sdk/xdr/ledger_upgrade.py index c5703247..9e8d0bf3 100644 --- a/stellar_sdk/xdr/ledger_upgrade.py +++ b/stellar_sdk/xdr/ledger_upgrade.py @@ -166,6 +166,19 @@ def from_xdr(cls, xdr: str) -> LedgerUpgrade: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.new_ledger_version, + self.new_base_fee, + self.new_max_tx_set_size, + self.new_base_reserve, + self.new_flags, + self.new_config, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liabilities.py b/stellar_sdk/xdr/liabilities.py index d359deff..bcf862b4 100644 --- a/stellar_sdk/xdr/liabilities.py +++ b/stellar_sdk/xdr/liabilities.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> Liabilities: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.buying, + self.selling, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py b/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py index 7a1615af..38e37302 100644 --- a/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py +++ b/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py @@ -69,6 +69,15 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolConstantProductParameters: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.asset_a, + self.asset_b, + self.fee, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_deposit_op.py b/stellar_sdk/xdr/liquidity_pool_deposit_op.py index e3b4c6c9..820313ad 100644 --- a/stellar_sdk/xdr/liquidity_pool_deposit_op.py +++ b/stellar_sdk/xdr/liquidity_pool_deposit_op.py @@ -82,6 +82,17 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolDepositOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liquidity_pool_id, + self.max_amount_a, + self.max_amount_b, + self.min_price, + self.max_price, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_deposit_result.py b/stellar_sdk/xdr/liquidity_pool_deposit_result.py index dd44e816..a7b45cda 100644 --- a/stellar_sdk/xdr/liquidity_pool_deposit_result.py +++ b/stellar_sdk/xdr/liquidity_pool_deposit_result.py @@ -133,6 +133,9 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolDepositResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_entry.py b/stellar_sdk/xdr/liquidity_pool_entry.py index 24e1c9e7..fbf0e7ca 100644 --- a/stellar_sdk/xdr/liquidity_pool_entry.py +++ b/stellar_sdk/xdr/liquidity_pool_entry.py @@ -78,6 +78,14 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liquidity_pool_id, + self.body, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_entry_body.py b/stellar_sdk/xdr/liquidity_pool_entry_body.py index 91a4d4a6..daad578a 100644 --- a/stellar_sdk/xdr/liquidity_pool_entry_body.py +++ b/stellar_sdk/xdr/liquidity_pool_entry_body.py @@ -84,6 +84,14 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolEntryBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.constant_product, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py b/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py index 4c9f36bb..0e57f186 100644 --- a/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py +++ b/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py @@ -85,6 +85,17 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolEntryConstantProduct: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.params, + self.reserve_a, + self.reserve_b, + self.total_pool_shares, + self.pool_shares_trust_line_count, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_parameters.py b/stellar_sdk/xdr/liquidity_pool_parameters.py index 207ae685..8e3442cf 100644 --- a/stellar_sdk/xdr/liquidity_pool_parameters.py +++ b/stellar_sdk/xdr/liquidity_pool_parameters.py @@ -77,6 +77,14 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolParameters: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.constant_product, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_withdraw_op.py b/stellar_sdk/xdr/liquidity_pool_withdraw_op.py index feede68a..daf02451 100644 --- a/stellar_sdk/xdr/liquidity_pool_withdraw_op.py +++ b/stellar_sdk/xdr/liquidity_pool_withdraw_op.py @@ -75,6 +75,16 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolWithdrawOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liquidity_pool_id, + self.amount, + self.min_amount_a, + self.min_amount_b, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/liquidity_pool_withdraw_result.py b/stellar_sdk/xdr/liquidity_pool_withdraw_result.py index 575a6aa5..d1fd23ba 100644 --- a/stellar_sdk/xdr/liquidity_pool_withdraw_result.py +++ b/stellar_sdk/xdr/liquidity_pool_withdraw_result.py @@ -129,6 +129,9 @@ def from_xdr(cls, xdr: str) -> LiquidityPoolWithdrawResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_buy_offer_op.py b/stellar_sdk/xdr/manage_buy_offer_op.py index 2db8ea35..87a328dc 100644 --- a/stellar_sdk/xdr/manage_buy_offer_op.py +++ b/stellar_sdk/xdr/manage_buy_offer_op.py @@ -85,6 +85,17 @@ def from_xdr(cls, xdr: str) -> ManageBuyOfferOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.selling, + self.buying, + self.buy_amount, + self.price, + self.offer_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_buy_offer_result.py b/stellar_sdk/xdr/manage_buy_offer_result.py index d3f565b7..c0980843 100644 --- a/stellar_sdk/xdr/manage_buy_offer_result.py +++ b/stellar_sdk/xdr/manage_buy_offer_result.py @@ -181,6 +181,14 @@ def from_xdr(cls, xdr: str) -> ManageBuyOfferResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.success, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_data_op.py b/stellar_sdk/xdr/manage_data_op.py index 23c1d441..092861b7 100644 --- a/stellar_sdk/xdr/manage_data_op.py +++ b/stellar_sdk/xdr/manage_data_op.py @@ -68,6 +68,14 @@ def from_xdr(cls, xdr: str) -> ManageDataOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.data_name, + self.data_value, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_data_result.py b/stellar_sdk/xdr/manage_data_result.py index 9f7f050f..2f74aa63 100644 --- a/stellar_sdk/xdr/manage_data_result.py +++ b/stellar_sdk/xdr/manage_data_result.py @@ -100,6 +100,9 @@ def from_xdr(cls, xdr: str) -> ManageDataResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_offer_success_result.py b/stellar_sdk/xdr/manage_offer_success_result.py index 975a897f..b337a1aa 100644 --- a/stellar_sdk/xdr/manage_offer_success_result.py +++ b/stellar_sdk/xdr/manage_offer_success_result.py @@ -84,6 +84,14 @@ def from_xdr(cls, xdr: str) -> ManageOfferSuccessResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.offers_claimed, + self.offer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_offer_success_result_offer.py b/stellar_sdk/xdr/manage_offer_success_result_offer.py index df432c5d..f07e03ac 100644 --- a/stellar_sdk/xdr/manage_offer_success_result_offer.py +++ b/stellar_sdk/xdr/manage_offer_success_result_offer.py @@ -97,6 +97,14 @@ def from_xdr(cls, xdr: str) -> ManageOfferSuccessResultOffer: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.effect, + self.offer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_sell_offer_op.py b/stellar_sdk/xdr/manage_sell_offer_op.py index 2b0d0f5c..6a8e2d55 100644 --- a/stellar_sdk/xdr/manage_sell_offer_op.py +++ b/stellar_sdk/xdr/manage_sell_offer_op.py @@ -84,6 +84,17 @@ def from_xdr(cls, xdr: str) -> ManageSellOfferOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.selling, + self.buying, + self.amount, + self.price, + self.offer_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/manage_sell_offer_result.py b/stellar_sdk/xdr/manage_sell_offer_result.py index ffa28e93..aefcb174 100644 --- a/stellar_sdk/xdr/manage_sell_offer_result.py +++ b/stellar_sdk/xdr/manage_sell_offer_result.py @@ -181,6 +181,14 @@ def from_xdr(cls, xdr: str) -> ManageSellOfferResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.success, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/memo.py b/stellar_sdk/xdr/memo.py index 3a7f0fdb..986a0a81 100644 --- a/stellar_sdk/xdr/memo.py +++ b/stellar_sdk/xdr/memo.py @@ -130,6 +130,17 @@ def from_xdr(cls, xdr: str) -> Memo: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.text, + self.id, + self.hash, + self.ret_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/muxed_account.py b/stellar_sdk/xdr/muxed_account.py index 5a6ed1a4..d6299ce2 100644 --- a/stellar_sdk/xdr/muxed_account.py +++ b/stellar_sdk/xdr/muxed_account.py @@ -93,6 +93,15 @@ def from_xdr(cls, xdr: str) -> MuxedAccount: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.ed25519, + self.med25519, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/muxed_account_med25519.py b/stellar_sdk/xdr/muxed_account_med25519.py index 8cd55af0..f3cb085b 100644 --- a/stellar_sdk/xdr/muxed_account_med25519.py +++ b/stellar_sdk/xdr/muxed_account_med25519.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> MuxedAccountMed25519: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.id, + self.ed25519, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/node_id.py b/stellar_sdk/xdr/node_id.py index df96dc64..65c60eb1 100644 --- a/stellar_sdk/xdr/node_id.py +++ b/stellar_sdk/xdr/node_id.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> NodeID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.node_id) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/offer_entry.py b/stellar_sdk/xdr/offer_entry.py index e6815e98..96808d15 100644 --- a/stellar_sdk/xdr/offer_entry.py +++ b/stellar_sdk/xdr/offer_entry.py @@ -116,6 +116,20 @@ def from_xdr(cls, xdr: str) -> OfferEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.seller_id, + self.offer_id, + self.selling, + self.buying, + self.amount, + self.price, + self.flags, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/offer_entry_ext.py b/stellar_sdk/xdr/offer_entry_ext.py index b325f366..985d02d9 100644 --- a/stellar_sdk/xdr/offer_entry_ext.py +++ b/stellar_sdk/xdr/offer_entry_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> OfferEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/operation.py b/stellar_sdk/xdr/operation.py index 6d1f5bc9..f6331ea7 100644 --- a/stellar_sdk/xdr/operation.py +++ b/stellar_sdk/xdr/operation.py @@ -131,6 +131,14 @@ def from_xdr(cls, xdr: str) -> Operation: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.source_account, + self.body, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/operation_body.py b/stellar_sdk/xdr/operation_body.py index 6107b5ce..f506db36 100644 --- a/stellar_sdk/xdr/operation_body.py +++ b/stellar_sdk/xdr/operation_body.py @@ -594,6 +594,38 @@ def from_xdr(cls, xdr: str) -> OperationBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.create_account_op, + self.payment_op, + self.path_payment_strict_receive_op, + self.manage_sell_offer_op, + self.create_passive_sell_offer_op, + self.set_options_op, + self.change_trust_op, + self.allow_trust_op, + self.destination, + self.manage_data_op, + self.bump_sequence_op, + self.manage_buy_offer_op, + self.path_payment_strict_send_op, + self.create_claimable_balance_op, + self.claim_claimable_balance_op, + self.begin_sponsoring_future_reserves_op, + self.revoke_sponsorship_op, + self.clawback_op, + self.clawback_claimable_balance_op, + self.set_trust_line_flags_op, + self.liquidity_pool_deposit_op, + self.liquidity_pool_withdraw_op, + self.invoke_host_function_op, + self.bump_footprint_expiration_op, + self.restore_footprint_op, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/operation_meta.py b/stellar_sdk/xdr/operation_meta.py index 686bd1f6..eb207451 100644 --- a/stellar_sdk/xdr/operation_meta.py +++ b/stellar_sdk/xdr/operation_meta.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> OperationMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.changes,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/operation_result.py b/stellar_sdk/xdr/operation_result.py index b83a7c26..ae639bf5 100644 --- a/stellar_sdk/xdr/operation_result.py +++ b/stellar_sdk/xdr/operation_result.py @@ -182,6 +182,14 @@ def from_xdr(cls, xdr: str) -> OperationResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.tr, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/operation_result_tr.py b/stellar_sdk/xdr/operation_result_tr.py index 019c7e97..0dc9f350 100644 --- a/stellar_sdk/xdr/operation_result_tr.py +++ b/stellar_sdk/xdr/operation_result_tr.py @@ -679,6 +679,40 @@ def from_xdr(cls, xdr: str) -> OperationResultTr: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.create_account_result, + self.payment_result, + self.path_payment_strict_receive_result, + self.manage_sell_offer_result, + self.create_passive_sell_offer_result, + self.set_options_result, + self.change_trust_result, + self.allow_trust_result, + self.account_merge_result, + self.inflation_result, + self.manage_data_result, + self.bump_seq_result, + self.manage_buy_offer_result, + self.path_payment_strict_send_result, + self.create_claimable_balance_result, + self.claim_claimable_balance_result, + self.begin_sponsoring_future_reserves_result, + self.end_sponsoring_future_reserves_result, + self.revoke_sponsorship_result, + self.clawback_result, + self.clawback_claimable_balance_result, + self.set_trust_line_flags_result, + self.liquidity_pool_deposit_result, + self.liquidity_pool_withdraw_result, + self.invoke_host_function_result, + self.bump_footprint_expiration_result, + self.restore_footprint_result, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_receive_op.py b/stellar_sdk/xdr/path_payment_strict_receive_op.py index 46bae4a7..ed7a9048 100644 --- a/stellar_sdk/xdr/path_payment_strict_receive_op.py +++ b/stellar_sdk/xdr/path_payment_strict_receive_op.py @@ -103,6 +103,18 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.send_asset, + self.send_max, + self.destination, + self.dest_asset, + self.dest_amount, + self.path, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_receive_result.py b/stellar_sdk/xdr/path_payment_strict_receive_result.py index ec5b387f..2e6db579 100644 --- a/stellar_sdk/xdr/path_payment_strict_receive_result.py +++ b/stellar_sdk/xdr/path_payment_strict_receive_result.py @@ -327,6 +327,15 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.success, + self.no_issuer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_receive_result_success.py b/stellar_sdk/xdr/path_payment_strict_receive_result_success.py index 2da5fe36..69dc965b 100644 --- a/stellar_sdk/xdr/path_payment_strict_receive_result_success.py +++ b/stellar_sdk/xdr/path_payment_strict_receive_result_success.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveResultSuccess: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.offers, + self.last, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_send_op.py b/stellar_sdk/xdr/path_payment_strict_send_op.py index 94b33061..8234e5ae 100644 --- a/stellar_sdk/xdr/path_payment_strict_send_op.py +++ b/stellar_sdk/xdr/path_payment_strict_send_op.py @@ -103,6 +103,18 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.send_asset, + self.send_amount, + self.destination, + self.dest_asset, + self.dest_min, + self.path, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_send_result.py b/stellar_sdk/xdr/path_payment_strict_send_result.py index 2032fea9..1f91135d 100644 --- a/stellar_sdk/xdr/path_payment_strict_send_result.py +++ b/stellar_sdk/xdr/path_payment_strict_send_result.py @@ -286,6 +286,15 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.success, + self.no_issuer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/path_payment_strict_send_result_success.py b/stellar_sdk/xdr/path_payment_strict_send_result_success.py index 4f3a34df..51d70d77 100644 --- a/stellar_sdk/xdr/path_payment_strict_send_result_success.py +++ b/stellar_sdk/xdr/path_payment_strict_send_result_success.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendResultSuccess: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.offers, + self.last, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/payment_op.py b/stellar_sdk/xdr/payment_op.py index 508b21bd..aea398ff 100644 --- a/stellar_sdk/xdr/payment_op.py +++ b/stellar_sdk/xdr/payment_op.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> PaymentOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.destination, + self.asset, + self.amount, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/payment_result.py b/stellar_sdk/xdr/payment_result.py index 9fd283f9..cb9f2b5e 100644 --- a/stellar_sdk/xdr/payment_result.py +++ b/stellar_sdk/xdr/payment_result.py @@ -145,6 +145,9 @@ def from_xdr(cls, xdr: str) -> PaymentResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/peer_address.py b/stellar_sdk/xdr/peer_address.py index b2bfc276..21a223f3 100644 --- a/stellar_sdk/xdr/peer_address.py +++ b/stellar_sdk/xdr/peer_address.py @@ -76,6 +76,15 @@ def from_xdr(cls, xdr: str) -> PeerAddress: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ip, + self.port, + self.num_failures, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/peer_address_ip.py b/stellar_sdk/xdr/peer_address_ip.py index a69aab0a..bc9c4de4 100644 --- a/stellar_sdk/xdr/peer_address_ip.py +++ b/stellar_sdk/xdr/peer_address_ip.py @@ -86,6 +86,15 @@ def from_xdr(cls, xdr: str) -> PeerAddressIp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.ipv4, + self.ipv6, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/peer_stat_list.py b/stellar_sdk/xdr/peer_stat_list.py index 73c26aef..b07c35f9 100644 --- a/stellar_sdk/xdr/peer_stat_list.py +++ b/stellar_sdk/xdr/peer_stat_list.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> PeerStatList: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.peer_stat_list) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/peer_stats.py b/stellar_sdk/xdr/peer_stats.py index 33e640d0..21d1183c 100644 --- a/stellar_sdk/xdr/peer_stats.py +++ b/stellar_sdk/xdr/peer_stats.py @@ -144,6 +144,27 @@ def from_xdr(cls, xdr: str) -> PeerStats: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.id, + self.version_str, + self.messages_read, + self.messages_written, + self.bytes_read, + self.bytes_written, + self.seconds_connected, + self.unique_flood_bytes_recv, + self.duplicate_flood_bytes_recv, + self.unique_fetch_bytes_recv, + self.duplicate_fetch_bytes_recv, + self.unique_flood_message_recv, + self.duplicate_flood_message_recv, + self.unique_fetch_message_recv, + self.duplicate_fetch_message_recv, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/persisted_scp_state.py b/stellar_sdk/xdr/persisted_scp_state.py index 5ec1bdc8..df600642 100644 --- a/stellar_sdk/xdr/persisted_scp_state.py +++ b/stellar_sdk/xdr/persisted_scp_state.py @@ -79,6 +79,15 @@ def from_xdr(cls, xdr: str) -> PersistedSCPState: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/persisted_scp_state_v0.py b/stellar_sdk/xdr/persisted_scp_state_v0.py index 2bfa5331..e676d7db 100644 --- a/stellar_sdk/xdr/persisted_scp_state_v0.py +++ b/stellar_sdk/xdr/persisted_scp_state_v0.py @@ -101,6 +101,15 @@ def from_xdr(cls, xdr: str) -> PersistedSCPStateV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.scp_envelopes, + self.quorum_sets, + self.tx_sets, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/persisted_scp_state_v1.py b/stellar_sdk/xdr/persisted_scp_state_v1.py index 3b7ae4d8..41a2f411 100644 --- a/stellar_sdk/xdr/persisted_scp_state_v1.py +++ b/stellar_sdk/xdr/persisted_scp_state_v1.py @@ -85,6 +85,14 @@ def from_xdr(cls, xdr: str) -> PersistedSCPStateV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.scp_envelopes, + self.quorum_sets, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/pool_id.py b/stellar_sdk/xdr/pool_id.py index 1dbe6c67..20986ca7 100644 --- a/stellar_sdk/xdr/pool_id.py +++ b/stellar_sdk/xdr/pool_id.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> PoolID: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.pool_id) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/preconditions.py b/stellar_sdk/xdr/preconditions.py index 4c55c152..192447ea 100644 --- a/stellar_sdk/xdr/preconditions.py +++ b/stellar_sdk/xdr/preconditions.py @@ -97,6 +97,15 @@ def from_xdr(cls, xdr: str) -> Preconditions: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.time_bounds, + self.v2, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/preconditions_v2.py b/stellar_sdk/xdr/preconditions_v2.py index be481745..04a17b33 100644 --- a/stellar_sdk/xdr/preconditions_v2.py +++ b/stellar_sdk/xdr/preconditions_v2.py @@ -141,6 +141,18 @@ def from_xdr(cls, xdr: str) -> PreconditionsV2: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.time_bounds, + self.ledger_bounds, + self.min_seq_num, + self.min_seq_age, + self.min_seq_ledger_gap, + self.extra_signers, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/price.py b/stellar_sdk/xdr/price.py index 56639820..a1a478bc 100644 --- a/stellar_sdk/xdr/price.py +++ b/stellar_sdk/xdr/price.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> Price: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.n, + self.d, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/public_key.py b/stellar_sdk/xdr/public_key.py index ba66bd52..1de41ea6 100644 --- a/stellar_sdk/xdr/public_key.py +++ b/stellar_sdk/xdr/public_key.py @@ -70,6 +70,14 @@ def from_xdr(cls, xdr: str) -> PublicKey: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.ed25519, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/restore_footprint_op.py b/stellar_sdk/xdr/restore_footprint_op.py index d490a8b5..6b20bc7a 100644 --- a/stellar_sdk/xdr/restore_footprint_op.py +++ b/stellar_sdk/xdr/restore_footprint_op.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> RestoreFootprintOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.ext,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/restore_footprint_result.py b/stellar_sdk/xdr/restore_footprint_result.py index c53a9120..25c250f9 100644 --- a/stellar_sdk/xdr/restore_footprint_result.py +++ b/stellar_sdk/xdr/restore_footprint_result.py @@ -85,6 +85,9 @@ def from_xdr(cls, xdr: str) -> RestoreFootprintResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/revoke_sponsorship_op.py b/stellar_sdk/xdr/revoke_sponsorship_op.py index 842dac2c..ebb3ec88 100644 --- a/stellar_sdk/xdr/revoke_sponsorship_op.py +++ b/stellar_sdk/xdr/revoke_sponsorship_op.py @@ -97,6 +97,15 @@ def from_xdr(cls, xdr: str) -> RevokeSponsorshipOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.ledger_key, + self.signer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/revoke_sponsorship_op_signer.py b/stellar_sdk/xdr/revoke_sponsorship_op_signer.py index 2dd16f83..a9a8996d 100644 --- a/stellar_sdk/xdr/revoke_sponsorship_op_signer.py +++ b/stellar_sdk/xdr/revoke_sponsorship_op_signer.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> RevokeSponsorshipOpSigner: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.signer_key, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/revoke_sponsorship_result.py b/stellar_sdk/xdr/revoke_sponsorship_result.py index 6b767230..f5e916af 100644 --- a/stellar_sdk/xdr/revoke_sponsorship_result.py +++ b/stellar_sdk/xdr/revoke_sponsorship_result.py @@ -112,6 +112,9 @@ def from_xdr(cls, xdr: str) -> RevokeSponsorshipResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_address.py b/stellar_sdk/xdr/sc_address.py index 46d1aba1..279b3262 100644 --- a/stellar_sdk/xdr/sc_address.py +++ b/stellar_sdk/xdr/sc_address.py @@ -87,6 +87,15 @@ def from_xdr(cls, xdr: str) -> SCAddress: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.account_id, + self.contract_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_bytes.py b/stellar_sdk/xdr/sc_bytes.py index c6f618aa..ea12b406 100644 --- a/stellar_sdk/xdr/sc_bytes.py +++ b/stellar_sdk/xdr/sc_bytes.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> SCBytes: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sc_bytes) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_contract_instance.py b/stellar_sdk/xdr/sc_contract_instance.py index 5089c5cf..13f61960 100644 --- a/stellar_sdk/xdr/sc_contract_instance.py +++ b/stellar_sdk/xdr/sc_contract_instance.py @@ -67,6 +67,14 @@ def from_xdr(cls, xdr: str) -> SCContractInstance: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.executable, + self.storage, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_env_meta_entry.py b/stellar_sdk/xdr/sc_env_meta_entry.py index 8f39bbfb..2306b392 100644 --- a/stellar_sdk/xdr/sc_env_meta_entry.py +++ b/stellar_sdk/xdr/sc_env_meta_entry.py @@ -75,6 +75,14 @@ def from_xdr(cls, xdr: str) -> SCEnvMetaEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.kind, + self.interface_version, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_error.py b/stellar_sdk/xdr/sc_error.py index fd337dc4..113d0276 100644 --- a/stellar_sdk/xdr/sc_error.py +++ b/stellar_sdk/xdr/sc_error.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SCError: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.code, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_map.py b/stellar_sdk/xdr/sc_map.py index 7d635f51..bae37e96 100644 --- a/stellar_sdk/xdr/sc_map.py +++ b/stellar_sdk/xdr/sc_map.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> SCMap: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sc_map) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_map_entry.py b/stellar_sdk/xdr/sc_map_entry.py index 894bd8f8..d8fb15ae 100644 --- a/stellar_sdk/xdr/sc_map_entry.py +++ b/stellar_sdk/xdr/sc_map_entry.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> SCMapEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.key, + self.val, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_meta_entry.py b/stellar_sdk/xdr/sc_meta_entry.py index dba733a7..65023cee 100644 --- a/stellar_sdk/xdr/sc_meta_entry.py +++ b/stellar_sdk/xdr/sc_meta_entry.py @@ -70,6 +70,14 @@ def from_xdr(cls, xdr: str) -> SCMetaEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.kind, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_meta_v0.py b/stellar_sdk/xdr/sc_meta_v0.py index e6b6ae22..ed1a9e49 100644 --- a/stellar_sdk/xdr/sc_meta_v0.py +++ b/stellar_sdk/xdr/sc_meta_v0.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> SCMetaV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.key, + self.val, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_nonce_key.py b/stellar_sdk/xdr/sc_nonce_key.py index 9b1c1f4e..da3ca6ac 100644 --- a/stellar_sdk/xdr/sc_nonce_key.py +++ b/stellar_sdk/xdr/sc_nonce_key.py @@ -55,6 +55,9 @@ def from_xdr(cls, xdr: str) -> SCNonceKey: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.nonce,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_entry.py b/stellar_sdk/xdr/sc_spec_entry.py index 049b2926..4e2a35d5 100644 --- a/stellar_sdk/xdr/sc_spec_entry.py +++ b/stellar_sdk/xdr/sc_spec_entry.py @@ -155,6 +155,18 @@ def from_xdr(cls, xdr: str) -> SCSpecEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.kind, + self.function_v0, + self.udt_struct_v0, + self.udt_union_v0, + self.udt_enum_v0, + self.udt_error_enum_v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_function_input_v0.py b/stellar_sdk/xdr/sc_spec_function_input_v0.py index 32ee0420..ab2e36f5 100644 --- a/stellar_sdk/xdr/sc_spec_function_input_v0.py +++ b/stellar_sdk/xdr/sc_spec_function_input_v0.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SCSpecFunctionInputV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_function_v0.py b/stellar_sdk/xdr/sc_spec_function_v0.py index 13fab416..fd370fa4 100644 --- a/stellar_sdk/xdr/sc_spec_function_v0.py +++ b/stellar_sdk/xdr/sc_spec_function_v0.py @@ -99,6 +99,16 @@ def from_xdr(cls, xdr: str) -> SCSpecFunctionV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.inputs, + self.outputs, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_bytes_n.py b/stellar_sdk/xdr/sc_spec_type_bytes_n.py index 635021e6..3a65330f 100644 --- a/stellar_sdk/xdr/sc_spec_type_bytes_n.py +++ b/stellar_sdk/xdr/sc_spec_type_bytes_n.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeBytesN: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.n,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_def.py b/stellar_sdk/xdr/sc_spec_type_def.py index 377066fd..0a0e1d8b 100644 --- a/stellar_sdk/xdr/sc_spec_type_def.py +++ b/stellar_sdk/xdr/sc_spec_type_def.py @@ -370,6 +370,21 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeDef: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.option, + self.result, + self.vec, + self.map, + self.set, + self.tuple, + self.bytes_n, + self.udt, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_map.py b/stellar_sdk/xdr/sc_spec_type_map.py index adc1886e..cb126577 100644 --- a/stellar_sdk/xdr/sc_spec_type_map.py +++ b/stellar_sdk/xdr/sc_spec_type_map.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeMap: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.key_type, + self.value_type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_option.py b/stellar_sdk/xdr/sc_spec_type_option.py index f669245e..29a68bca 100644 --- a/stellar_sdk/xdr/sc_spec_type_option.py +++ b/stellar_sdk/xdr/sc_spec_type_option.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeOption: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.value_type,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_result.py b/stellar_sdk/xdr/sc_spec_type_result.py index 000cffb6..94fdc985 100644 --- a/stellar_sdk/xdr/sc_spec_type_result.py +++ b/stellar_sdk/xdr/sc_spec_type_result.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ok_type, + self.error_type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_set.py b/stellar_sdk/xdr/sc_spec_type_set.py index 3bf6b72f..3f5b5508 100644 --- a/stellar_sdk/xdr/sc_spec_type_set.py +++ b/stellar_sdk/xdr/sc_spec_type_set.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.element_type,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_tuple.py b/stellar_sdk/xdr/sc_spec_type_tuple.py index df39d27b..4e4c14d5 100644 --- a/stellar_sdk/xdr/sc_spec_type_tuple.py +++ b/stellar_sdk/xdr/sc_spec_type_tuple.py @@ -67,6 +67,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeTuple: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.value_types,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_udt.py b/stellar_sdk/xdr/sc_spec_type_udt.py index 6a704bba..e67a19ed 100644 --- a/stellar_sdk/xdr/sc_spec_type_udt.py +++ b/stellar_sdk/xdr/sc_spec_type_udt.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeUDT: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.name,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_type_vec.py b/stellar_sdk/xdr/sc_spec_type_vec.py index 2bc599ed..4dbbb443 100644 --- a/stellar_sdk/xdr/sc_spec_type_vec.py +++ b/stellar_sdk/xdr/sc_spec_type_vec.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SCSpecTypeVec: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.element_type,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py index 2b73aaf7..730f4e1d 100644 --- a/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTEnumCaseV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.value, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_enum_v0.py b/stellar_sdk/xdr/sc_spec_udt_enum_v0.py index b62ad204..86ef6393 100644 --- a/stellar_sdk/xdr/sc_spec_udt_enum_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_enum_v0.py @@ -87,6 +87,16 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTEnumV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.lib, + self.name, + self.cases, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py index 6ffa00fc..e2df585a 100644 --- a/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTErrorEnumCaseV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.value, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py b/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py index 8987f6ff..fe1d8e25 100644 --- a/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py @@ -87,6 +87,16 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTErrorEnumV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.lib, + self.name, + self.cases, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py b/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py index 954ea1fa..c23621d6 100644 --- a/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTStructFieldV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_struct_v0.py b/stellar_sdk/xdr/sc_spec_udt_struct_v0.py index aa2e641d..223f174b 100644 --- a/stellar_sdk/xdr/sc_spec_udt_struct_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_struct_v0.py @@ -87,6 +87,16 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTStructV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.lib, + self.name, + self.fields, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py index a3fb50a3..26296634 100644 --- a/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py @@ -81,6 +81,15 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseTupleV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + self.type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py index 39907eeb..96b71f8f 100644 --- a/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py @@ -96,6 +96,15 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.kind, + self.void_case, + self.tuple_case, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py index dfcea2cd..4439a16e 100644 --- a/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseVoidV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.name, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_spec_udt_union_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_v0.py index 7da8c9ab..e7b6b3a7 100644 --- a/stellar_sdk/xdr/sc_spec_udt_union_v0.py +++ b/stellar_sdk/xdr/sc_spec_udt_union_v0.py @@ -87,6 +87,16 @@ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.doc, + self.lib, + self.name, + self.cases, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_string.py b/stellar_sdk/xdr/sc_string.py index 947a7d33..300a94ae 100644 --- a/stellar_sdk/xdr/sc_string.py +++ b/stellar_sdk/xdr/sc_string.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> SCString: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sc_string) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_symbol.py b/stellar_sdk/xdr/sc_symbol.py index 942a43d2..44ca5574 100644 --- a/stellar_sdk/xdr/sc_symbol.py +++ b/stellar_sdk/xdr/sc_symbol.py @@ -49,6 +49,9 @@ def from_xdr(cls, xdr: str) -> SCSymbol: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sc_symbol) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_val.py b/stellar_sdk/xdr/sc_val.py index 7df9592c..68fc5e4b 100644 --- a/stellar_sdk/xdr/sc_val.py +++ b/stellar_sdk/xdr/sc_val.py @@ -475,6 +475,33 @@ def from_xdr(cls, xdr: str) -> SCVal: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.b, + self.error, + self.u32, + self.i32, + self.u64, + self.i64, + self.timepoint, + self.duration, + self.u128, + self.i128, + self.u256, + self.i256, + self.bytes, + self.str, + self.sym, + self.vec, + self.map, + self.address, + self.nonce_key, + self.instance, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sc_vec.py b/stellar_sdk/xdr/sc_vec.py index 8cd3cd4a..37390f08 100644 --- a/stellar_sdk/xdr/sc_vec.py +++ b/stellar_sdk/xdr/sc_vec.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> SCVec: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sc_vec) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_ballot.py b/stellar_sdk/xdr/scp_ballot.py index 9e5aa00d..333b5590 100644 --- a/stellar_sdk/xdr/scp_ballot.py +++ b/stellar_sdk/xdr/scp_ballot.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SCPBallot: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.counter, + self.value, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_envelope.py b/stellar_sdk/xdr/scp_envelope.py index d0cf4ed2..7460ddba 100644 --- a/stellar_sdk/xdr/scp_envelope.py +++ b/stellar_sdk/xdr/scp_envelope.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SCPEnvelope: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.statement, + self.signature, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_history_entry.py b/stellar_sdk/xdr/scp_history_entry.py index 6af3bcba..69d2a89b 100644 --- a/stellar_sdk/xdr/scp_history_entry.py +++ b/stellar_sdk/xdr/scp_history_entry.py @@ -66,6 +66,14 @@ def from_xdr(cls, xdr: str) -> SCPHistoryEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_history_entry_v0.py b/stellar_sdk/xdr/scp_history_entry_v0.py index 2e36b1b4..a93e64bf 100644 --- a/stellar_sdk/xdr/scp_history_entry_v0.py +++ b/stellar_sdk/xdr/scp_history_entry_v0.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> SCPHistoryEntryV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.quorum_sets, + self.ledger_messages, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_nomination.py b/stellar_sdk/xdr/scp_nomination.py index d05a4aa2..8147ec7d 100644 --- a/stellar_sdk/xdr/scp_nomination.py +++ b/stellar_sdk/xdr/scp_nomination.py @@ -90,6 +90,15 @@ def from_xdr(cls, xdr: str) -> SCPNomination: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.quorum_set_hash, + self.votes, + self.accepted, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_quorum_set.py b/stellar_sdk/xdr/scp_quorum_set.py index a2f97da6..87f6298b 100644 --- a/stellar_sdk/xdr/scp_quorum_set.py +++ b/stellar_sdk/xdr/scp_quorum_set.py @@ -90,6 +90,15 @@ def from_xdr(cls, xdr: str) -> SCPQuorumSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.threshold, + self.validators, + self.inner_sets, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_statement.py b/stellar_sdk/xdr/scp_statement.py index 40665389..8316c1cf 100644 --- a/stellar_sdk/xdr/scp_statement.py +++ b/stellar_sdk/xdr/scp_statement.py @@ -102,6 +102,15 @@ def from_xdr(cls, xdr: str) -> SCPStatement: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.node_id, + self.slot_index, + self.pledges, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_statement_confirm.py b/stellar_sdk/xdr/scp_statement_confirm.py index 84ce6370..001524a9 100644 --- a/stellar_sdk/xdr/scp_statement_confirm.py +++ b/stellar_sdk/xdr/scp_statement_confirm.py @@ -82,6 +82,17 @@ def from_xdr(cls, xdr: str) -> SCPStatementConfirm: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ballot, + self.n_prepared, + self.n_commit, + self.n_h, + self.quorum_set_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_statement_externalize.py b/stellar_sdk/xdr/scp_statement_externalize.py index 2c4cc35e..f2ab8a2c 100644 --- a/stellar_sdk/xdr/scp_statement_externalize.py +++ b/stellar_sdk/xdr/scp_statement_externalize.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SCPStatementExternalize: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.commit, + self.n_h, + self.commit_quorum_set_hash, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_statement_pledges.py b/stellar_sdk/xdr/scp_statement_pledges.py index 4d358a0b..7419dacb 100644 --- a/stellar_sdk/xdr/scp_statement_pledges.py +++ b/stellar_sdk/xdr/scp_statement_pledges.py @@ -143,6 +143,17 @@ def from_xdr(cls, xdr: str) -> SCPStatementPledges: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.prepare, + self.confirm, + self.externalize, + self.nominate, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/scp_statement_prepare.py b/stellar_sdk/xdr/scp_statement_prepare.py index 98d92605..ef997f0f 100644 --- a/stellar_sdk/xdr/scp_statement_prepare.py +++ b/stellar_sdk/xdr/scp_statement_prepare.py @@ -97,6 +97,18 @@ def from_xdr(cls, xdr: str) -> SCPStatementPrepare: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.quorum_set_hash, + self.ballot, + self.prepared, + self.prepared_prime, + self.n_c, + self.n_h, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/send_more.py b/stellar_sdk/xdr/send_more.py index 42af417b..58093dd7 100644 --- a/stellar_sdk/xdr/send_more.py +++ b/stellar_sdk/xdr/send_more.py @@ -56,6 +56,9 @@ def from_xdr(cls, xdr: str) -> SendMore: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.num_messages,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/send_more_extended.py b/stellar_sdk/xdr/send_more_extended.py index b019fcfe..8cd5b7ce 100644 --- a/stellar_sdk/xdr/send_more_extended.py +++ b/stellar_sdk/xdr/send_more_extended.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> SendMoreExtended: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.num_messages, + self.num_bytes, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sequence_number.py b/stellar_sdk/xdr/sequence_number.py index d195d668..e06b3f6d 100644 --- a/stellar_sdk/xdr/sequence_number.py +++ b/stellar_sdk/xdr/sequence_number.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> SequenceNumber: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sequence_number) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/set_options_op.py b/stellar_sdk/xdr/set_options_op.py index 040fc477..84696d3f 100644 --- a/stellar_sdk/xdr/set_options_op.py +++ b/stellar_sdk/xdr/set_options_op.py @@ -151,6 +151,21 @@ def from_xdr(cls, xdr: str) -> SetOptionsOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.inflation_dest, + self.clear_flags, + self.set_flags, + self.master_weight, + self.low_threshold, + self.med_threshold, + self.high_threshold, + self.home_domain, + self.signer, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/set_options_result.py b/stellar_sdk/xdr/set_options_result.py index 61155984..2c372f6a 100644 --- a/stellar_sdk/xdr/set_options_result.py +++ b/stellar_sdk/xdr/set_options_result.py @@ -154,6 +154,9 @@ def from_xdr(cls, xdr: str) -> SetOptionsResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/set_trust_line_flags_op.py b/stellar_sdk/xdr/set_trust_line_flags_op.py index f7f15f0b..3ecac851 100644 --- a/stellar_sdk/xdr/set_trust_line_flags_op.py +++ b/stellar_sdk/xdr/set_trust_line_flags_op.py @@ -77,6 +77,16 @@ def from_xdr(cls, xdr: str) -> SetTrustLineFlagsOp: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.trustor, + self.asset, + self.clear_flags, + self.set_flags, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/set_trust_line_flags_result.py b/stellar_sdk/xdr/set_trust_line_flags_result.py index cad02132..30ea0d60 100644 --- a/stellar_sdk/xdr/set_trust_line_flags_result.py +++ b/stellar_sdk/xdr/set_trust_line_flags_result.py @@ -109,6 +109,9 @@ def from_xdr(cls, xdr: str) -> SetTrustLineFlagsResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.code,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signature.py b/stellar_sdk/xdr/signature.py index cd14e58d..7a52fce8 100644 --- a/stellar_sdk/xdr/signature.py +++ b/stellar_sdk/xdr/signature.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Signature: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.signature) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signature_hint.py b/stellar_sdk/xdr/signature_hint.py index 2f73d4db..482db43b 100644 --- a/stellar_sdk/xdr/signature_hint.py +++ b/stellar_sdk/xdr/signature_hint.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> SignatureHint: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.signature_hint) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signed_survey_request_message.py b/stellar_sdk/xdr/signed_survey_request_message.py index c158b347..66d7cefb 100644 --- a/stellar_sdk/xdr/signed_survey_request_message.py +++ b/stellar_sdk/xdr/signed_survey_request_message.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SignedSurveyRequestMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.request_signature, + self.request, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signed_survey_response_message.py b/stellar_sdk/xdr/signed_survey_response_message.py index 24544248..8a6fa961 100644 --- a/stellar_sdk/xdr/signed_survey_response_message.py +++ b/stellar_sdk/xdr/signed_survey_response_message.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SignedSurveyResponseMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.response_signature, + self.response, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signer.py b/stellar_sdk/xdr/signer.py index c1c7d4d9..66a0ca12 100644 --- a/stellar_sdk/xdr/signer.py +++ b/stellar_sdk/xdr/signer.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> Signer: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.key, + self.weight, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signer_key.py b/stellar_sdk/xdr/signer_key.py index a413f1cb..16572a72 100644 --- a/stellar_sdk/xdr/signer_key.py +++ b/stellar_sdk/xdr/signer_key.py @@ -132,6 +132,17 @@ def from_xdr(cls, xdr: str) -> SignerKey: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.ed25519, + self.pre_auth_tx, + self.hash_x, + self.ed25519_signed_payload, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py b/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py index 5cc2b881..219b31ee 100644 --- a/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py +++ b/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py @@ -65,6 +65,14 @@ def from_xdr(cls, xdr: str) -> SignerKeyEd25519SignedPayload: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ed25519, + self.payload, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/simple_payment_result.py b/stellar_sdk/xdr/simple_payment_result.py index 7902e69a..075f948b 100644 --- a/stellar_sdk/xdr/simple_payment_result.py +++ b/stellar_sdk/xdr/simple_payment_result.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SimplePaymentResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.destination, + self.asset, + self.amount, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_address_credentials.py b/stellar_sdk/xdr/soroban_address_credentials.py index a004c3aa..38f1de68 100644 --- a/stellar_sdk/xdr/soroban_address_credentials.py +++ b/stellar_sdk/xdr/soroban_address_credentials.py @@ -77,6 +77,16 @@ def from_xdr(cls, xdr: str) -> SorobanAddressCredentials: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.address, + self.nonce, + self.signature_expiration_ledger, + self.signature_args, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_authorization_entry.py b/stellar_sdk/xdr/soroban_authorization_entry.py index b5e2a1c2..7ea04b55 100644 --- a/stellar_sdk/xdr/soroban_authorization_entry.py +++ b/stellar_sdk/xdr/soroban_authorization_entry.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> SorobanAuthorizationEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.credentials, + self.root_invocation, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_authorized_contract_function.py b/stellar_sdk/xdr/soroban_authorized_contract_function.py index a0c9a38e..73e02fa0 100644 --- a/stellar_sdk/xdr/soroban_authorized_contract_function.py +++ b/stellar_sdk/xdr/soroban_authorized_contract_function.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> SorobanAuthorizedContractFunction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.contract_address, + self.function_name, + self.args, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_authorized_function.py b/stellar_sdk/xdr/soroban_authorized_function.py index d4fc5f13..4af0d948 100644 --- a/stellar_sdk/xdr/soroban_authorized_function.py +++ b/stellar_sdk/xdr/soroban_authorized_function.py @@ -109,6 +109,15 @@ def from_xdr(cls, xdr: str) -> SorobanAuthorizedFunction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.contract_fn, + self.create_contract_host_fn, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_authorized_invocation.py b/stellar_sdk/xdr/soroban_authorized_invocation.py index 028b1dbd..9b90d64e 100644 --- a/stellar_sdk/xdr/soroban_authorized_invocation.py +++ b/stellar_sdk/xdr/soroban_authorized_invocation.py @@ -73,6 +73,14 @@ def from_xdr(cls, xdr: str) -> SorobanAuthorizedInvocation: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.function, + self.sub_invocations, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_credentials.py b/stellar_sdk/xdr/soroban_credentials.py index 3945f1bd..1d4ccbb5 100644 --- a/stellar_sdk/xdr/soroban_credentials.py +++ b/stellar_sdk/xdr/soroban_credentials.py @@ -82,6 +82,14 @@ def from_xdr(cls, xdr: str) -> SorobanCredentials: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.address, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_resources.py b/stellar_sdk/xdr/soroban_resources.py index 6751cfef..67446219 100644 --- a/stellar_sdk/xdr/soroban_resources.py +++ b/stellar_sdk/xdr/soroban_resources.py @@ -89,6 +89,17 @@ def from_xdr(cls, xdr: str) -> SorobanResources: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.footprint, + self.instructions, + self.read_bytes, + self.write_bytes, + self.extended_meta_data_size_bytes, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_transaction_data.py b/stellar_sdk/xdr/soroban_transaction_data.py index 765d6e8f..2fd42875 100644 --- a/stellar_sdk/xdr/soroban_transaction_data.py +++ b/stellar_sdk/xdr/soroban_transaction_data.py @@ -71,6 +71,15 @@ def from_xdr(cls, xdr: str) -> SorobanTransactionData: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.resources, + self.refundable_fee, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/soroban_transaction_meta.py b/stellar_sdk/xdr/soroban_transaction_meta.py index e6be47cc..307a06f9 100644 --- a/stellar_sdk/xdr/soroban_transaction_meta.py +++ b/stellar_sdk/xdr/soroban_transaction_meta.py @@ -104,6 +104,16 @@ def from_xdr(cls, xdr: str) -> SorobanTransactionMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.events, + self.return_value, + self.diagnostic_events, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/sponsorship_descriptor.py b/stellar_sdk/xdr/sponsorship_descriptor.py index 3c736089..cd95c088 100644 --- a/stellar_sdk/xdr/sponsorship_descriptor.py +++ b/stellar_sdk/xdr/sponsorship_descriptor.py @@ -55,6 +55,9 @@ def from_xdr(cls, xdr: str) -> SponsorshipDescriptor: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.sponsorship_descriptor) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/state_expiration_settings.py b/stellar_sdk/xdr/state_expiration_settings.py index c8ef65c4..d2a6b461 100644 --- a/stellar_sdk/xdr/state_expiration_settings.py +++ b/stellar_sdk/xdr/state_expiration_settings.py @@ -113,6 +113,21 @@ def from_xdr(cls, xdr: str) -> StateExpirationSettings: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.max_entry_expiration, + self.min_temp_entry_expiration, + self.min_persistent_entry_expiration, + self.auto_bump_ledgers, + self.persistent_rent_rate_denominator, + self.temp_rent_rate_denominator, + self.max_entries_to_expire, + self.bucket_list_size_window_sample_size, + self.eviction_scan_size, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/stellar_message.py b/stellar_sdk/xdr/stellar_message.py index 1a0abe6c..2f5383b5 100644 --- a/stellar_sdk/xdr/stellar_message.py +++ b/stellar_sdk/xdr/stellar_message.py @@ -428,6 +428,32 @@ def from_xdr(cls, xdr: str) -> StellarMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.error, + self.hello, + self.auth, + self.dont_have, + self.peers, + self.tx_set_hash, + self.tx_set, + self.generalized_tx_set, + self.transaction, + self.signed_survey_request_message, + self.signed_survey_response_message, + self.q_set_hash, + self.q_set, + self.envelope, + self.get_scp_ledger_seq, + self.send_more_message, + self.send_more_extended_message, + self.flood_advert, + self.flood_demand, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/stellar_value.py b/stellar_sdk/xdr/stellar_value.py index bd13d484..3f7b80ab 100644 --- a/stellar_sdk/xdr/stellar_value.py +++ b/stellar_sdk/xdr/stellar_value.py @@ -103,6 +103,16 @@ def from_xdr(cls, xdr: str) -> StellarValue: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx_set_hash, + self.close_time, + self.upgrades, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/stellar_value_ext.py b/stellar_sdk/xdr/stellar_value_ext.py index d48a82b4..341b520f 100644 --- a/stellar_sdk/xdr/stellar_value_ext.py +++ b/stellar_sdk/xdr/stellar_value_ext.py @@ -84,6 +84,14 @@ def from_xdr(cls, xdr: str) -> StellarValueExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.lc_value_signature, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/stored_transaction_set.py b/stellar_sdk/xdr/stored_transaction_set.py index 311bb3ee..68000726 100644 --- a/stellar_sdk/xdr/stored_transaction_set.py +++ b/stellar_sdk/xdr/stored_transaction_set.py @@ -79,6 +79,15 @@ def from_xdr(cls, xdr: str) -> StoredTransactionSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.tx_set, + self.generalized_tx_set, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/string32.py b/stellar_sdk/xdr/string32.py index 6f6e78b1..386eb468 100644 --- a/stellar_sdk/xdr/string32.py +++ b/stellar_sdk/xdr/string32.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> String32: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.string32) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/string64.py b/stellar_sdk/xdr/string64.py index 31e57a2a..06248e56 100644 --- a/stellar_sdk/xdr/string64.py +++ b/stellar_sdk/xdr/string64.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> String64: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.string64) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/survey_request_message.py b/stellar_sdk/xdr/survey_request_message.py index 23f61609..b5ddf130 100644 --- a/stellar_sdk/xdr/survey_request_message.py +++ b/stellar_sdk/xdr/survey_request_message.py @@ -83,6 +83,17 @@ def from_xdr(cls, xdr: str) -> SurveyRequestMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.surveyor_peer_id, + self.surveyed_peer_id, + self.ledger_num, + self.encryption_key, + self.command_type, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/survey_response_body.py b/stellar_sdk/xdr/survey_response_body.py index 1b338a19..691453ce 100644 --- a/stellar_sdk/xdr/survey_response_body.py +++ b/stellar_sdk/xdr/survey_response_body.py @@ -97,6 +97,15 @@ def from_xdr(cls, xdr: str) -> SurveyResponseBody: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.topology_response_body_v0, + self.topology_response_body_v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/survey_response_message.py b/stellar_sdk/xdr/survey_response_message.py index 3d9e2ebd..b80b229e 100644 --- a/stellar_sdk/xdr/survey_response_message.py +++ b/stellar_sdk/xdr/survey_response_message.py @@ -83,6 +83,17 @@ def from_xdr(cls, xdr: str) -> SurveyResponseMessage: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.surveyor_peer_id, + self.surveyed_peer_id, + self.ledger_num, + self.command_type, + self.encrypted_body, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/thresholds.py b/stellar_sdk/xdr/thresholds.py index ce90252a..42860cf7 100644 --- a/stellar_sdk/xdr/thresholds.py +++ b/stellar_sdk/xdr/thresholds.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Thresholds: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.thresholds) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/time_bounds.py b/stellar_sdk/xdr/time_bounds.py index db46f669..28238c59 100644 --- a/stellar_sdk/xdr/time_bounds.py +++ b/stellar_sdk/xdr/time_bounds.py @@ -62,6 +62,14 @@ def from_xdr(cls, xdr: str) -> TimeBounds: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.min_time, + self.max_time, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/time_point.py b/stellar_sdk/xdr/time_point.py index f06bd79c..07c61291 100644 --- a/stellar_sdk/xdr/time_point.py +++ b/stellar_sdk/xdr/time_point.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> TimePoint: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.time_point) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/topology_response_body_v0.py b/stellar_sdk/xdr/topology_response_body_v0.py index 693648c1..bbdc3898 100644 --- a/stellar_sdk/xdr/topology_response_body_v0.py +++ b/stellar_sdk/xdr/topology_response_body_v0.py @@ -76,6 +76,16 @@ def from_xdr(cls, xdr: str) -> TopologyResponseBodyV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.inbound_peers, + self.outbound_peers, + self.total_inbound_peer_count, + self.total_outbound_peer_count, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/topology_response_body_v1.py b/stellar_sdk/xdr/topology_response_body_v1.py index 396c8662..c9c72ffc 100644 --- a/stellar_sdk/xdr/topology_response_body_v1.py +++ b/stellar_sdk/xdr/topology_response_body_v1.py @@ -89,6 +89,18 @@ def from_xdr(cls, xdr: str) -> TopologyResponseBodyV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.inbound_peers, + self.outbound_peers, + self.total_inbound_peer_count, + self.total_outbound_peer_count, + self.max_inbound_peer_count, + self.max_outbound_peer_count, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction.py b/stellar_sdk/xdr/transaction.py index 00ca7e6f..bdb0a187 100644 --- a/stellar_sdk/xdr/transaction.py +++ b/stellar_sdk/xdr/transaction.py @@ -128,6 +128,19 @@ def from_xdr(cls, xdr: str) -> Transaction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.source_account, + self.fee, + self.seq_num, + self.cond, + self.memo, + self.operations, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_envelope.py b/stellar_sdk/xdr/transaction_envelope.py index 5b253d72..99f6983a 100644 --- a/stellar_sdk/xdr/transaction_envelope.py +++ b/stellar_sdk/xdr/transaction_envelope.py @@ -106,6 +106,16 @@ def from_xdr(cls, xdr: str) -> TransactionEnvelope: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.v0, + self.v1, + self.fee_bump, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_ext.py b/stellar_sdk/xdr/transaction_ext.py index a4fed176..f2842472 100644 --- a/stellar_sdk/xdr/transaction_ext.py +++ b/stellar_sdk/xdr/transaction_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> TransactionExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.soroban_data, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_history_entry.py b/stellar_sdk/xdr/transaction_history_entry.py index d5dbb676..58ad6140 100644 --- a/stellar_sdk/xdr/transaction_history_entry.py +++ b/stellar_sdk/xdr/transaction_history_entry.py @@ -79,6 +79,15 @@ def from_xdr(cls, xdr: str) -> TransactionHistoryEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_seq, + self.tx_set, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_history_entry_ext.py b/stellar_sdk/xdr/transaction_history_entry_ext.py index 2357e67d..f0d0a92e 100644 --- a/stellar_sdk/xdr/transaction_history_entry_ext.py +++ b/stellar_sdk/xdr/transaction_history_entry_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> TransactionHistoryEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.generalized_tx_set, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_history_result_entry.py b/stellar_sdk/xdr/transaction_history_result_entry.py index 160701b6..17e3e7a9 100644 --- a/stellar_sdk/xdr/transaction_history_result_entry.py +++ b/stellar_sdk/xdr/transaction_history_result_entry.py @@ -77,6 +77,15 @@ def from_xdr(cls, xdr: str) -> TransactionHistoryResultEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ledger_seq, + self.tx_result_set, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_history_result_entry_ext.py b/stellar_sdk/xdr/transaction_history_result_entry_ext.py index c1b96cf5..e90aa656 100644 --- a/stellar_sdk/xdr/transaction_history_result_entry_ext.py +++ b/stellar_sdk/xdr/transaction_history_result_entry_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> TransactionHistoryResultEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_meta.py b/stellar_sdk/xdr/transaction_meta.py index 351e9434..0c2cc5f4 100644 --- a/stellar_sdk/xdr/transaction_meta.py +++ b/stellar_sdk/xdr/transaction_meta.py @@ -116,6 +116,17 @@ def from_xdr(cls, xdr: str) -> TransactionMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.operations, + self.v1, + self.v2, + self.v3, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_meta_v1.py b/stellar_sdk/xdr/transaction_meta_v1.py index 19de0fa0..25001752 100644 --- a/stellar_sdk/xdr/transaction_meta_v1.py +++ b/stellar_sdk/xdr/transaction_meta_v1.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> TransactionMetaV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx_changes, + self.operations, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_meta_v2.py b/stellar_sdk/xdr/transaction_meta_v2.py index 4ab8c598..1aae1054 100644 --- a/stellar_sdk/xdr/transaction_meta_v2.py +++ b/stellar_sdk/xdr/transaction_meta_v2.py @@ -82,6 +82,15 @@ def from_xdr(cls, xdr: str) -> TransactionMetaV2: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx_changes_before, + self.operations, + self.tx_changes_after, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_meta_v3.py b/stellar_sdk/xdr/transaction_meta_v3.py index 1c17c36a..547052c0 100644 --- a/stellar_sdk/xdr/transaction_meta_v3.py +++ b/stellar_sdk/xdr/transaction_meta_v3.py @@ -104,6 +104,17 @@ def from_xdr(cls, xdr: str) -> TransactionMetaV3: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.ext, + self.tx_changes_before, + self.operations, + self.tx_changes_after, + self.soroban_meta, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_phase.py b/stellar_sdk/xdr/transaction_phase.py index 4179a4fa..cf67bc51 100644 --- a/stellar_sdk/xdr/transaction_phase.py +++ b/stellar_sdk/xdr/transaction_phase.py @@ -77,6 +77,14 @@ def from_xdr(cls, xdr: str) -> TransactionPhase: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v0_components, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result.py b/stellar_sdk/xdr/transaction_result.py index 9da1196a..862f2ae0 100644 --- a/stellar_sdk/xdr/transaction_result.py +++ b/stellar_sdk/xdr/transaction_result.py @@ -104,6 +104,15 @@ def from_xdr(cls, xdr: str) -> TransactionResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.fee_charged, + self.result, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result_ext.py b/stellar_sdk/xdr/transaction_result_ext.py index 4d4a9bc5..81078c6f 100644 --- a/stellar_sdk/xdr/transaction_result_ext.py +++ b/stellar_sdk/xdr/transaction_result_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> TransactionResultExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result_meta.py b/stellar_sdk/xdr/transaction_result_meta.py index e3bdc6b7..dc9aa635 100644 --- a/stellar_sdk/xdr/transaction_result_meta.py +++ b/stellar_sdk/xdr/transaction_result_meta.py @@ -70,6 +70,15 @@ def from_xdr(cls, xdr: str) -> TransactionResultMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.result, + self.fee_processing, + self.tx_apply_processing, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result_pair.py b/stellar_sdk/xdr/transaction_result_pair.py index be749682..93fe0122 100644 --- a/stellar_sdk/xdr/transaction_result_pair.py +++ b/stellar_sdk/xdr/transaction_result_pair.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> TransactionResultPair: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.transaction_hash, + self.result, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result_result.py b/stellar_sdk/xdr/transaction_result_result.py index 8b6d67a0..5291c5d6 100644 --- a/stellar_sdk/xdr/transaction_result_result.py +++ b/stellar_sdk/xdr/transaction_result_result.py @@ -276,6 +276,15 @@ def from_xdr(cls, xdr: str) -> TransactionResultResult: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.code, + self.inner_result_pair, + self.results, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_result_set.py b/stellar_sdk/xdr/transaction_result_set.py index 188832d1..b769ea47 100644 --- a/stellar_sdk/xdr/transaction_result_set.py +++ b/stellar_sdk/xdr/transaction_result_set.py @@ -67,6 +67,9 @@ def from_xdr(cls, xdr: str) -> TransactionResultSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.results,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_set.py b/stellar_sdk/xdr/transaction_set.py index 6532f74c..c1054da3 100644 --- a/stellar_sdk/xdr/transaction_set.py +++ b/stellar_sdk/xdr/transaction_set.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> TransactionSet: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.previous_ledger_hash, + self.txs, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_set_v1.py b/stellar_sdk/xdr/transaction_set_v1.py index 8dd79149..8666a95d 100644 --- a/stellar_sdk/xdr/transaction_set_v1.py +++ b/stellar_sdk/xdr/transaction_set_v1.py @@ -74,6 +74,14 @@ def from_xdr(cls, xdr: str) -> TransactionSetV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.previous_ledger_hash, + self.phases, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_signature_payload.py b/stellar_sdk/xdr/transaction_signature_payload.py index bd5cc40b..c7e50605 100644 --- a/stellar_sdk/xdr/transaction_signature_payload.py +++ b/stellar_sdk/xdr/transaction_signature_payload.py @@ -75,6 +75,14 @@ def from_xdr(cls, xdr: str) -> TransactionSignaturePayload: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.network_id, + self.tagged_transaction, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_signature_payload_tagged_transaction.py b/stellar_sdk/xdr/transaction_signature_payload_tagged_transaction.py index 501fe0f7..fd99e85c 100644 --- a/stellar_sdk/xdr/transaction_signature_payload_tagged_transaction.py +++ b/stellar_sdk/xdr/transaction_signature_payload_tagged_transaction.py @@ -92,6 +92,15 @@ def from_xdr(cls, xdr: str) -> TransactionSignaturePayloadTaggedTransaction: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.tx, + self.fee_bump, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_v0.py b/stellar_sdk/xdr/transaction_v0.py index dc101c4a..57ebb9a6 100644 --- a/stellar_sdk/xdr/transaction_v0.py +++ b/stellar_sdk/xdr/transaction_v0.py @@ -119,6 +119,19 @@ def from_xdr(cls, xdr: str) -> TransactionV0: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.source_account_ed25519, + self.fee, + self.seq_num, + self.time_bounds, + self.memo, + self.operations, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_v0_envelope.py b/stellar_sdk/xdr/transaction_v0_envelope.py index d627fce3..9440ac4d 100644 --- a/stellar_sdk/xdr/transaction_v0_envelope.py +++ b/stellar_sdk/xdr/transaction_v0_envelope.py @@ -76,6 +76,14 @@ def from_xdr(cls, xdr: str) -> TransactionV0Envelope: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx, + self.signatures, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_v0_ext.py b/stellar_sdk/xdr/transaction_v0_ext.py index 15e522bf..a6e7a436 100644 --- a/stellar_sdk/xdr/transaction_v0_ext.py +++ b/stellar_sdk/xdr/transaction_v0_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> TransactionV0Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/transaction_v1_envelope.py b/stellar_sdk/xdr/transaction_v1_envelope.py index e92f9c57..a10ca877 100644 --- a/stellar_sdk/xdr/transaction_v1_envelope.py +++ b/stellar_sdk/xdr/transaction_v1_envelope.py @@ -76,6 +76,14 @@ def from_xdr(cls, xdr: str) -> TransactionV1Envelope: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.tx, + self.signatures, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_asset.py b/stellar_sdk/xdr/trust_line_asset.py index 82d6b7ec..484589c0 100644 --- a/stellar_sdk/xdr/trust_line_asset.py +++ b/stellar_sdk/xdr/trust_line_asset.py @@ -121,6 +121,16 @@ def from_xdr(cls, xdr: str) -> TrustLineAsset: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.alpha_num4, + self.alpha_num12, + self.liquidity_pool_id, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry.py b/stellar_sdk/xdr/trust_line_entry.py index b4c144de..ffa7c021 100644 --- a/stellar_sdk/xdr/trust_line_entry.py +++ b/stellar_sdk/xdr/trust_line_entry.py @@ -113,6 +113,18 @@ def from_xdr(cls, xdr: str) -> TrustLineEntry: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.account_id, + self.asset, + self.balance, + self.limit, + self.flags, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry_ext.py b/stellar_sdk/xdr/trust_line_entry_ext.py index 59b3f120..36e8fb7d 100644 --- a/stellar_sdk/xdr/trust_line_entry_ext.py +++ b/stellar_sdk/xdr/trust_line_entry_ext.py @@ -84,6 +84,14 @@ def from_xdr(cls, xdr: str) -> TrustLineEntryExt: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v1, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry_extension_v2.py b/stellar_sdk/xdr/trust_line_entry_extension_v2.py index 762fe7d0..55744e0d 100644 --- a/stellar_sdk/xdr/trust_line_entry_extension_v2.py +++ b/stellar_sdk/xdr/trust_line_entry_extension_v2.py @@ -69,6 +69,14 @@ def from_xdr(cls, xdr: str) -> TrustLineEntryExtensionV2: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liquidity_pool_use_count, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry_extension_v2_ext.py b/stellar_sdk/xdr/trust_line_entry_extension_v2_ext.py index 03dbb0e4..ab001c1b 100644 --- a/stellar_sdk/xdr/trust_line_entry_extension_v2_ext.py +++ b/stellar_sdk/xdr/trust_line_entry_extension_v2_ext.py @@ -59,6 +59,9 @@ def from_xdr(cls, xdr: str) -> TrustLineEntryExtensionV2Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash((self.v,)) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry_v1.py b/stellar_sdk/xdr/trust_line_entry_v1.py index 5973fb48..8f323a62 100644 --- a/stellar_sdk/xdr/trust_line_entry_v1.py +++ b/stellar_sdk/xdr/trust_line_entry_v1.py @@ -71,6 +71,14 @@ def from_xdr(cls, xdr: str) -> TrustLineEntryV1: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.liabilities, + self.ext, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/trust_line_entry_v1_ext.py b/stellar_sdk/xdr/trust_line_entry_v1_ext.py index aacfa7d2..932cb24f 100644 --- a/stellar_sdk/xdr/trust_line_entry_v1_ext.py +++ b/stellar_sdk/xdr/trust_line_entry_v1_ext.py @@ -72,6 +72,14 @@ def from_xdr(cls, xdr: str) -> TrustLineEntryV1Ext: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.v, + self.v2, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/tx_advert_vector.py b/stellar_sdk/xdr/tx_advert_vector.py index ecda8326..ed1dec38 100644 --- a/stellar_sdk/xdr/tx_advert_vector.py +++ b/stellar_sdk/xdr/tx_advert_vector.py @@ -60,6 +60,9 @@ def from_xdr(cls, xdr: str) -> TxAdvertVector: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.tx_advert_vector) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/tx_demand_vector.py b/stellar_sdk/xdr/tx_demand_vector.py index 0f3c6e55..07c662fe 100644 --- a/stellar_sdk/xdr/tx_demand_vector.py +++ b/stellar_sdk/xdr/tx_demand_vector.py @@ -60,6 +60,9 @@ def from_xdr(cls, xdr: str) -> TxDemandVector: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.tx_demand_vector) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/tx_set_component.py b/stellar_sdk/xdr/tx_set_component.py index ddb27feb..5308ac9c 100644 --- a/stellar_sdk/xdr/tx_set_component.py +++ b/stellar_sdk/xdr/tx_set_component.py @@ -83,6 +83,14 @@ def from_xdr(cls, xdr: str) -> TxSetComponent: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.type, + self.txs_maybe_discounted_fee, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/tx_set_component_txs_maybe_discounted_fee.py b/stellar_sdk/xdr/tx_set_component_txs_maybe_discounted_fee.py index 07b950e2..def82b77 100644 --- a/stellar_sdk/xdr/tx_set_component_txs_maybe_discounted_fee.py +++ b/stellar_sdk/xdr/tx_set_component_txs_maybe_discounted_fee.py @@ -78,6 +78,14 @@ def from_xdr(cls, xdr: str) -> TxSetComponentTxsMaybeDiscountedFee: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.base_fee, + self.txs, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/u_int128_parts.py b/stellar_sdk/xdr/u_int128_parts.py index 9c878287..44def556 100644 --- a/stellar_sdk/xdr/u_int128_parts.py +++ b/stellar_sdk/xdr/u_int128_parts.py @@ -61,6 +61,14 @@ def from_xdr(cls, xdr: str) -> UInt128Parts: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hi, + self.lo, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/u_int256_parts.py b/stellar_sdk/xdr/u_int256_parts.py index 589b408e..1a86c5a6 100644 --- a/stellar_sdk/xdr/u_int256_parts.py +++ b/stellar_sdk/xdr/u_int256_parts.py @@ -73,6 +73,16 @@ def from_xdr(cls, xdr: str) -> UInt256Parts: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.hi_hi, + self.hi_lo, + self.lo_hi, + self.lo_lo, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/uint256.py b/stellar_sdk/xdr/uint256.py index a25c99f4..759b14c9 100644 --- a/stellar_sdk/xdr/uint256.py +++ b/stellar_sdk/xdr/uint256.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Uint256: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.uint256) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/uint32.py b/stellar_sdk/xdr/uint32.py index 8f3ae7fb..4b9c0ee2 100644 --- a/stellar_sdk/xdr/uint32.py +++ b/stellar_sdk/xdr/uint32.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Uint32: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.uint32) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/uint64.py b/stellar_sdk/xdr/uint64.py index 24768a0f..ec2fc3d3 100644 --- a/stellar_sdk/xdr/uint64.py +++ b/stellar_sdk/xdr/uint64.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Uint64: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.uint64) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/upgrade_entry_meta.py b/stellar_sdk/xdr/upgrade_entry_meta.py index 1bd7dc3e..7db02728 100644 --- a/stellar_sdk/xdr/upgrade_entry_meta.py +++ b/stellar_sdk/xdr/upgrade_entry_meta.py @@ -63,6 +63,14 @@ def from_xdr(cls, xdr: str) -> UpgradeEntryMeta: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash( + ( + self.upgrade, + self.changes, + ) + ) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/upgrade_type.py b/stellar_sdk/xdr/upgrade_type.py index 007ece3b..4574e8e8 100644 --- a/stellar_sdk/xdr/upgrade_type.py +++ b/stellar_sdk/xdr/upgrade_type.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> UpgradeType: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.upgrade_type) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented diff --git a/stellar_sdk/xdr/value.py b/stellar_sdk/xdr/value.py index 5b44e51d..890df944 100644 --- a/stellar_sdk/xdr/value.py +++ b/stellar_sdk/xdr/value.py @@ -48,6 +48,9 @@ def from_xdr(cls, xdr: str) -> Value: xdr_bytes = base64.b64decode(xdr.encode()) return cls.from_xdr_bytes(xdr_bytes) + def __hash__(self): + return hash(self.value) + def __eq__(self, other: object): if not isinstance(other, self.__class__): return NotImplemented