mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-26 22:55:49 +00:00
Add sample python code for DIDs and Price Oracles (#2932)
* Create create_price_oracle.py * Create README.md * Update README.md * Update create_price_oracle.py * Create delete_price_oracle.py * Update delete_price_oracle.py * Create account_price_oracles.py * Create did_set.py * Create did_delete.py * Create account_did.py * Create requirements.txt * Create README.md * Create requirements.txt * Update README.md * Update README.md * Create README.md * Create README.md * Update did_set.py * Update did_set.py * Update did_set.py * Update did_delete.py * Update README.md * Update create_price_oracle.py * Update did_set.py * Update README.md * Update README.md * Update delete_price_oracle.py * Update README.md
This commit is contained in:
36
_code-samples/did/py/did_delete.py
Normal file
36
_code-samples/did/py/did_delete.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# neccasary imports
|
||||
from xrpl.models import DIDDelete
|
||||
from xrpl.clients import JsonRpcClient
|
||||
from xrpl.wallet import Wallet
|
||||
from xrpl.transaction import submit_and_wait
|
||||
|
||||
|
||||
# connect to the xrpl via a client
|
||||
print("Connecting to client")
|
||||
client = JsonRpcClient("https://s.altnet.rippletest.net:51234")
|
||||
print("connected!!!")
|
||||
|
||||
|
||||
# input the seed that was generated from running the did_set.py
|
||||
seed = input("now, enter the seed of the account that has a DID object to delete: ")
|
||||
|
||||
# restore an account that has an existing DID
|
||||
account_did_creator = Wallet.from_seed(seed=seed)
|
||||
|
||||
# define the account DIDDelete transaction
|
||||
did_delete_txn = DIDDelete(account=account_did_creator.address)
|
||||
|
||||
# sign, submit the did delete transaction and wait for result
|
||||
print("signed and submitting did delete transaction. awaiting response...")
|
||||
did_delete_response = submit_and_wait(
|
||||
transaction=did_delete_txn,
|
||||
wallet=account_did_creator,
|
||||
client=client,
|
||||
)
|
||||
|
||||
# Parse response for result
|
||||
did_delete_result = did_delete_response.result
|
||||
|
||||
# Print result and transaction hash
|
||||
print(did_delete_result["meta"]["TransactionResult"])
|
||||
print(did_delete_result["hash"])
|
||||
Reference in New Issue
Block a user