Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Sep 30, 2020
1 parent 72461d5 commit 25bc8c2
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/en/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@ RevokeSponsorship
.. autoclass:: stellar_sdk.operation.RevokeSponsorship
:members: to_xdr_object, from_xdr_object

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.RevokeSponsorshipType
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.TrustLine
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Offer
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Data
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Signer
:members:

Price
^^^^^

Expand Down
15 changes: 15 additions & 0 deletions docs/zh_CN/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@ RevokeSponsorship
.. autoclass:: stellar_sdk.operation.RevokeSponsorship
:members: to_xdr_object, from_xdr_object

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.RevokeSponsorshipType
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.TrustLine
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Offer
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Data
:members:

.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Signer
:members:

Price
^^^^^

Expand Down
59 changes: 59 additions & 0 deletions tests/test_transaction_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,62 @@ def test_add_memo(self):
source, Network.TESTNET_NETWORK_PASSPHRASE, base_fee=150
).add_return_hash_memo(memo_hash)
assert builder.memo == ReturnHashMemo(memo_hash)

def test_to_xdr_sponsored_reserves(self):
sequence = 1
source = Account(
"GDF5O4OWEMVBY5FLDHWA5RZTYSV2U276XGKZZ6VSHDDR3THSQ6OQS7UM", sequence
)
builder = TransactionBuilder(
source, Network.TESTNET_NETWORK_PASSPHRASE, base_fee=150, v1=False
)
builder.add_text_memo("Stellar Python SDK")
builder.add_time_bounds(1565590000, 1565600000)
op_source = "GDF5O4OWEMVBY5FLDHWA5RZTYSV2U276XGKZZ6VSHDDR3THSQ6OQS7UM"
op_account_id = "GCWWANEIF3Z4DMOE4LDRCS22HLLHOEQCOF3QKAC2XWTSYR2AEEQ3P5FW"
te = (
builder.append_begin_sponsoring_future_reserves_op(
sponsored_id="GCEYOF66NL73LL6RIPSIP34WOCESQ3GKJOAYXOEVNKRWRNQRYUILCQWC",
source=op_source,
)
.append_end_sponsoring_future_reserves_op(source=op_source)
.append_revoke_account_sponsorship_op(
account_id=op_account_id, source=op_source
)
.append_revoke_trustline_sponsorship_op(
account_id=op_account_id, asset=Asset.native(), source=op_source
)
.append_revoke_offer_sponsorship_op(
seller_id=op_account_id, offer_id=12315, source=op_source
)
.append_revoke_data_sponsorship_op(
account_id=op_account_id, data_name="stellar", source=op_source
)
.append_revoke_claimable_balance_sponsorship_op(
claimable_balance_id="00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
source=op_source,
)
.append_revoke_ed25519_public_key_signer_sponsorship_op(
account_id=op_account_id,
signer_key="GBWYVWA2PZBTRRBNZI55OG4EFDJSDNL6ASP2VAQKHORNUSSXP2NCV4N2",
source=op_source,
)
.append_revoke_hashx_signer_sponsorship_op(
account_id=op_account_id,
signer_key="da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
source=op_source,
)
.append_revoke_pre_auth_tx_signer_sponsorship_op(
account_id=op_account_id,
signer_key="da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
source=op_source,
)
.build()
)

xdr = "AAAAAMvXcdYjKhx0qxnsDsczxKuqa/65lZz6sjjHHczyh50JAAAF3AAAAAAAAAACAAAAAQAAAABdUQHwAAAAAF1RKQAAAAABAAA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EhtwAAAALaDVfafUhQ5/wQ0qnQ68cx96+0BXTAM5WxfUkUm5H1vgAAAAEAAAAAy9dx1iMqHHSrGewOxzPEq6pr/rmVnPqyOMcdzPKHnQkAAAASAAAAAQAAAACtYDSILvPBscTixxFLWjrWdxICcXcFAFq9pyxHQCEhtwAAAAHaDVfafUhQ5/wQ0qnQ68cx96+0BXTAM5WxfUkUm5H1vgAAAAAAAAAA"
assert te.to_xdr() == xdr
restore_te = TransactionBuilder.from_xdr(
xdr, Network.TESTNET_NETWORK_PASSPHRASE
).build()
assert restore_te.to_xdr() == xdr

0 comments on commit 25bc8c2

Please sign in to comment.