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:
Obiajulu
2025-01-10 02:54:27 +01:00
committed by GitHub
parent 8d0ff29595
commit 78c33074ec
12 changed files with 345 additions and 0 deletions

View 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"])