-
Notifications
You must be signed in to change notification settings - Fork 0
/
transaction.py
28 lines (23 loc) · 970 Bytes
/
transaction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from stellar_base.builder import Builder
from account import Details
class Build:
"""Creates a transaction between the sender and receiver.
:param: sender: Account that sends the money (seed).
:param: receiver: Account that receives the money (Account ID).
:param: amount: Amount that needs to be sent.
"""
def __init__(self, sender, receiver, amount=0):
self.sender, self.receiver, self.amount = sender, receiver, amount
self.builder = None
def send(self):
"""Text Memo needs to be added."""
if self.check_account_validity:
self.builder = Builder(secret=self.sender, horizon='https://horizon-testnet.stellar.org')
self.builder.append_payment_op(self.receiver, self.amount)
self.builder.sign()
self.builder.submit()
return True
return False
@property
def check_account_validity(self):
return Details(self.receiver).check