Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverted support for SEP-0023. #319

Merged
merged 8 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/en/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ ReturnHashMemo
.. autoclass:: stellar_sdk.memo.ReturnHashMemo
:members:

MuxedAccount
^^^^^^^^^^^^

.. autoclass:: stellar_sdk.muxed_account.MuxedAccount
:members:

Network
^^^^^^^

Expand Down
6 changes: 0 additions & 6 deletions docs/zh_CN/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ ReturnHashMemo
.. autoclass:: stellar_sdk.memo.ReturnHashMemo
:members:

MuxedAccount
^^^^^^^^^^^^

.. autoclass:: stellar_sdk.muxed_account.MuxedAccount
:members:

Network
^^^^^^^

Expand Down
30 changes: 0 additions & 30 deletions examples/payment_muxed_account.py

This file was deleted.

2 changes: 0 additions & 2 deletions stellar_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
from .keypair import Keypair
from .memo import Memo, NoneMemo, TextMemo, IdMemo, HashMemo, ReturnHashMemo
from .muxed_account import MuxedAccount
from .network import Network
from .price import Price
from .server import Server
Expand Down Expand Up @@ -50,7 +49,6 @@
"IdMemo",
"HashMemo",
"ReturnHashMemo",
"MuxedAccount",
"Network",
"Price",
"Server",
Expand Down
15 changes: 6 additions & 9 deletions stellar_sdk/account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Optional, List, Union
from typing import Optional, List

from .muxed_account import MuxedAccount
from .sep.ed25519_public_key_signer import Ed25519PublicKeySigner
from .strkey import StrKey

Expand All @@ -17,9 +16,8 @@ class Account:
See `Accounts`_ For more information about the formats used for asset codes and how issuers
work on Stellar's network,

:param account_id: MuxedAccount or Account ID of the
:param account_id: Account ID of the
account (ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`)
or muxed account (ex. `MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY`)
:param sequence: sequence current sequence number of the account
:raises:
:exc:`Ed25519PublicKeyInvalidError <stellar_sdk.exceptions.Ed25519PublicKeyInvalidError>`: if ``account_id``
Expand All @@ -29,11 +27,10 @@ class Account:
https://stellar.org/developers/learn/concepts/accounts.html
"""

def __init__(self, account_id: Union[str, MuxedAccount], sequence: int) -> None:
if isinstance(account_id, str):
account_id = MuxedAccount.from_account(account_id)
self.account_id: MuxedAccount = account_id
self.sequence: int = sequence
def __init__(self, account_id: str, sequence: int) -> None:
StrKey.decode_ed25519_public_key(account_id)
self.account_id: str = account_id
self.sequence = sequence

# The following properties will change in 3.0
self.signers: Optional[dict] = None
Expand Down
8 changes: 1 addition & 7 deletions stellar_sdk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"BadResponseError",
"UnknownRequestError",
"NotPageableError",
"StreamClientError"
"StreamClientError",
]


Expand Down Expand Up @@ -65,12 +65,6 @@ class Ed25519PublicKeyInvalidError(ValueError):
"""


class MuxedEd25519AccountInvalidError(ValueError):
"""Muxed Ed25519 public key is incorrect.

"""


class Ed25519SecretSeedInvalidError(ValueError):
"""Ed25519 secret seed is incorrect.

Expand Down
17 changes: 8 additions & 9 deletions stellar_sdk/fee_bump_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from .exceptions import ValueError
from .keypair import Keypair
from .strkey import StrKey
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
from .utils import parse_ed25519_account_id_from_muxed_account_xdr_object
from .xdr import Xdr
from .muxed_account import MuxedAccount

BASE_FEE = 100

Expand All @@ -26,7 +25,7 @@ class FeeBumpTransaction:

def __init__(
self,
fee_source: Union[Keypair, MuxedAccount, str],
fee_source: Union[Keypair, str],
base_fee: int,
inner_transaction_envelope: TransactionEnvelope,
) -> None:
Expand All @@ -37,11 +36,9 @@ def __init__(
raise ValueError("Invalid `inner_transaction`, it should be TransactionV1.")

if isinstance(fee_source, str):
fee_source = MuxedAccount.from_account(fee_source)
if isinstance(fee_source, Keypair):
fee_source = MuxedAccount.from_account(fee_source.public_key)
fee_source = Keypair.from_public_key(fee_source)

self.fee_source: MuxedAccount = fee_source
self.fee_source: Keypair = fee_source
self.base_fee = base_fee
self.inner_transaction_envelope = inner_transaction_envelope
self._inner_transaction = inner_transaction_envelope.transaction
Expand All @@ -63,7 +60,7 @@ def to_xdr_object(self) -> Xdr.types.FeeBumpTransaction:

:return: XDR Transaction object
"""
fee_source = self.fee_source.to_xdr_object()
fee_source = self.fee_source.xdr_muxed_account()
fee = self.base_fee * (len(self._inner_transaction.operations) + 1)
ext = Xdr.nullclass()
ext.v = 0
Expand All @@ -85,7 +82,9 @@ def from_xdr_object(

:return: A new :class:`FeeBumpTransaction` object from the given XDR Transaction object.
"""
source = MuxedAccount.from_xdr_object(tx_xdr_object.feeSource)
source = parse_ed25519_account_id_from_muxed_account_xdr_object(
tx_xdr_object.feeSource
)
inner_transaction_envelope = TransactionEnvelope.from_xdr_object(
tx_xdr_object.innerTx, network_passphrase
)
Expand Down
112 changes: 0 additions & 112 deletions stellar_sdk/muxed_account.py

This file was deleted.

21 changes: 9 additions & 12 deletions stellar_sdk/operation/account_merge.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Union

from .operation import Operation
from .utils import parse_mux_account_from_account
from ..muxed_account import MuxedAccount
from .utils import check_ed25519_public_key
from ..keypair import Keypair
from ..utils import parse_ed25519_account_id_from_muxed_account_xdr_object
from ..xdr import Xdr


Expand All @@ -20,13 +19,10 @@ class AccountMerge(Operation):

"""

def __init__(
self,
destination: Union[MuxedAccount, str],
source: Union[MuxedAccount, str] = None,
) -> None:
def __init__(self, destination: str, source: str = None,) -> None:
super().__init__(source)
self.destination: MuxedAccount = parse_mux_account_from_account(destination)
check_ed25519_public_key(destination)
self.destination: str = destination

@classmethod
def type_code(cls) -> int:
Expand All @@ -35,7 +31,7 @@ def type_code(cls) -> int:
def _to_operation_body(self) -> Xdr.nullclass:
body = Xdr.nullclass()
body.type = Xdr.const.ACCOUNT_MERGE
body.destination = self.destination.to_xdr_object()
body.destination = Keypair.from_public_key(self.destination).xdr_muxed_account()
return body

@classmethod
Expand All @@ -47,7 +43,8 @@ def from_xdr_object(

"""
source = Operation.get_source_from_xdr_obj(operation_xdr_object)
destination = MuxedAccount.from_xdr_object(
destination = parse_ed25519_account_id_from_muxed_account_xdr_object(
operation_xdr_object.body.destination
)

return cls(source=source, destination=destination)
3 changes: 1 addition & 2 deletions stellar_sdk/operation/allow_trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .utils import check_ed25519_public_key, check_asset_code
from ..asset import Asset
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
from ..xdr import Xdr

Expand Down Expand Up @@ -53,7 +52,7 @@ def __init__(
trustor: str,
asset_code: str,
authorize: Union[TrustLineEntryFlag, bool],
source: Union[MuxedAccount, str] = None,
source: str = None,
) -> None:
super().__init__(source)
check_ed25519_public_key(trustor)
Expand Down
5 changes: 1 addition & 4 deletions stellar_sdk/operation/bump_sequence.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from typing import Union

from .operation import Operation
from ..muxed_account import MuxedAccount
from ..xdr import Xdr


Expand All @@ -21,7 +18,7 @@ class BumpSequence(Operation):

"""

def __init__(self, bump_to: int, source: Union[MuxedAccount, str] = None) -> None:
def __init__(self, bump_to: int, source: str = None) -> None:
super().__init__(source)
self.bump_to: int = bump_to

Expand Down
Loading