-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallet.py
27 lines (23 loc) · 881 Bytes
/
wallet.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
from stellar_base.keypair import Keypair
import urllib3
class Create:
"""Create a new wallet.
:param name: name of the user (Optional).
:param amount: Amount to be deposited when the wallet is created.
"""
def __init__(self, amount, name=None):
self.name = name
self.amount = amount
self.keyPair = Keypair.random()
self.publicKey = self.keyPair.address().decode()
print(self.publicKey)
self.secret = self.keyPair.seed().decode()
self.builder = None
self.url = 'https://friendbot.stellar.org'
self.http = urllib3.PoolManager()
def create(self):
request = self.http.request('GET', '{}?addr={}'.format(self.url, self.publicKey))
if request.status == 200:
return self.publicKey
else:
return False