Created
February 17, 2020 14:36
-
-
Save DylanVerstraete/423f56f4db1331a0ce973e8a563ea68b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Jumpscale import j | |
class transactions(j.baseclasses.threebot_actor): | |
def _init(self, **kwargs): | |
self.unlockhash_transaction_model = j.threebot.packages.stellar_unlock_service.bcdb.model_get( | |
url="threefoldfoundation.stellar_unlock_service.unlockhash_transaction.1" | |
) | |
@j.baseclasses.actor_method | |
def create_unlockhash_transaction(self, unlockhash_transaction, schema_out, user_session): | |
""" | |
```in | |
unlockhash_transaction = (O) !threefoldfoundation.stellar_unlock_service.unlockhash_transaction.1 | |
``` | |
```out | |
unlockhash_transaction = (O) !threefoldfoundation.stellar_unlock_service.unlockhash_transaction.1 | |
``` | |
""" | |
unlockhash_transaction = self.unlockhash_transaction_model.new(unlockhash_transaction).save() | |
return unlockhash_transaction | |
@j.baseclasses.actor_method | |
def unlockhash_transaction_get(self, unlockhash, schema_out, user_session): | |
""" | |
```in | |
unlockhash = (S) | |
``` | |
```out | |
!threefoldfoundation.stellar_unlock_service.unlockhash_transaction.1 | |
``` | |
""" | |
try: | |
transactions = self.unlockhash_transaction_model.find(unlockhash=unlockhash) | |
if not transactions: | |
raise j.exceptions.NotFound() | |
return transactions[0] | |
except j.exceptions.NotFound: | |
raise j.exceptions.NotFound("unlocktransaction with hash %s not found" % unlockhash) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment