I am new to the xrpl and working through the python tutorials. yesterday I got to set up three trustlines and today I tried without success to delete them.
In my online research I found these two threads in the xrpchat website:
https://www.xrpchat.com/topic/2338-how-to-totally-remove-trustlines/
https://www.xrpchat.com/topic/16834-is-there-a-way-to-totally-remove-trust-lines/
Both of threads provide the same answer:
If a trustline is in its default state on your side, it will not be counted against your reserve. If a trustline is in its default state on both sides, it will be removed. Default state means:
- Balance is zero.
- Limit is zero.
- Line is not authed or frozen.
- Line does not allow rippling, unless account has "DefaultRipple" flag set, in which case it must allow rippling.
imo the three trustlines I am triing to remove fulfil the four mentioned points... The trasactions finished successfully "Trustline removed" but the trustlines are still being showed and the reserve for them locked (see screen shot from https://test.bithomp.com/).
I can not figure out what I am missing or doing wrong. So I would really appreciate, if someone could point out what is my mistake and how to solve it.
[enter image description here][1]
This is the address I am using: rf84on2iJ41Dy67M6ZdMCJzBA9rVZynos4
these are the three trustlines I created:
token_currency_code = "ZAP"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "47.61678015"
token_currency_code = "WAN"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "1.17096019"
token_currency_code = "MXN"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "17.8441"
when deleting I used:
token_currency_code = "ZAP"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "0"
token_currency_code = "WAN"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "0"
token_currency_code = "MXN"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "0"
I have being playing around with these flags without results
flags= 262144, # Disable the No Ripple flag, allowing rippling on this trust line. flags= 131072, # Enable the No Ripple flag flags= 1048576, # Freeze the trust line.
This is the code I have been using:
client = JsonRpcClient(JSON_RPC_URL)
My_Wallet_Address = "rf84on2iJ41Dy67M6ZdMCJzBA9rVZynos4"
My_Wallet_seed = "<myseed>"
# flags= 262144, # Disable the No Ripple flag, allowing rippling on this trust line.
# flags= 131072, # Enable the No Ripple flag
# flags= 1048576, # Freeze the trust line.
tx_flags= 1048576
# -----------------
token_currency_code = "ZAP"
token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
token_value = "0"
# -----------------
#token_currency_code = "WAN"
#token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
#token_value = "0"
# -----------------
#token_currency_code = "MXN"
#token_issuer = "rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X"
#token_value = "0"
# ------------------
from xrpl.core import keypairs
public, private = keypairs.derive_keypair(My_Wallet_seed)
My_Wallet_account = keypairs.derive_classic_address(public)
from xrpl.wallet import Wallet
My_Wallet_wallet: Wallet = xrpl.wallet.Wallet(My_Wallet_seed, 0)
from xrpl.ledger import get_fee
# Delete trust line -----------------------------------
trust_set_tx = xrpl.models.transactions.TrustSet(
account=My_Wallet_wallet.classic_address,
fee=get_fee(client),
flags= tx_flags,
limit_amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
currency=token_currency_code,
issuer=token_issuer,
value=token_value,
)
)
ts_prepared = xrpl.transaction.safe_sign_and_autofill_transaction(
transaction=trust_set_tx,
wallet=My_Wallet_wallet,
client=client,
)
print("Delete trust line ...")
response = xrpl.transaction.send_reliable_submission(ts_prepared, client)
print(response)
``
and this is the output:
Delete trust line ...
Response(status=<ResponseStatus.SUCCESS: 'success'>, result={'Account': 'rf84on2iJ41Dy67M6ZdMCJzBA9rVZynos4', 'Fee': '10', 'Flags': 1048576, 'LastLedgerSequence': 24145712, 'LimitAmount': {'currency': 'ZAP', 'issuer': 'rpswrb1mVCtahne4R2NHGe1eTemwAg3Y7X', 'value': '0'}, 'Sequence': 24095419, 'SigningPubKey': 'ED6D46333BBAB91D539FEA52E1129FAB0F52DCA72BD681F5952B0C408D27A4C9F1', 'TransactionType': 'TrustSet', 'TxnSignature': '12653F1536ABB39346F8172A2B1DAC6D1FEA17C1AA12212C845134A937FE74CDC91224F880C4010B487D073F756F736904819E33DE4CF284DF2E8EF7C675B30A', 'date': 694613911, 'hash': '0ED99BDB7A1D6D44AE519407C9154BCC80DA448AF0C1D4B56473383D7DB4DCA4', 'inLedger': 24145695, 'ledger_index': 24145695, 'meta': {'AffectedNodes': [{'ModifiedNode': {'FinalFields': {'Account': 'rf84on2iJ41Dy67M6ZdMCJzBA9rVZynos4', 'Balance': '21999840', 'Flags': 0, 'OwnerCount': 3, 'Sequence': 24095420}, 'LedgerEntryType': 'AccountRoot', 'LedgerIndex': 'B4F90BF9B121813B822C4473F30E5CCCC4BE798E74CD55C0B15A77E644BE7D9C', 'PreviousFields': {'Balance': '21999850', 'Sequence': 24095419}, 'PreviousTxnID': '2458A55EBDCD918E8C067305B93D3FDD56824EC26608FD475F3A6E25115F9E67', 'PreviousTxnLgrSeq': 24124624}}], 'TransactionIndex': 0, 'TransactionResult': 'tesSUCCESS'}, 'validated': True}, id=None, type=<ResponseType.RESPONSE: 'response'>)
``
Any Idea, what my mistake is?
Many thanks in advance.
[1]: https://i.stack.imgur.com/vusZe.png