hive-nectar 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hive-nectar might be problematic. Click here for more details.

Files changed (47) hide show
  1. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/METADATA +5 -3
  2. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/RECORD +46 -47
  3. nectar/account.py +43 -47
  4. nectar/amount.py +6 -11
  5. nectar/block.py +8 -9
  6. nectar/blockchain.py +4 -5
  7. nectar/blockchaininstance.py +4 -4
  8. nectar/blockchainobject.py +5 -6
  9. nectar/blurt.py +3 -4
  10. nectar/cli.py +14 -14
  11. nectar/comment.py +10 -11
  12. nectar/community.py +4 -5
  13. nectar/conveyor.py +3 -4
  14. nectar/exceptions.py +30 -24
  15. nectar/hive.py +3 -4
  16. nectar/hivesigner.py +2 -2
  17. nectar/imageuploader.py +2 -3
  18. nectar/price.py +6 -13
  19. nectar/rc.py +1 -2
  20. nectar/steem.py +3 -4
  21. nectar/transactionbuilder.py +12 -3
  22. nectar/version.py +1 -1
  23. nectar/vote.py +8 -9
  24. nectar/wallet.py +1 -1
  25. nectarapi/exceptions.py +20 -14
  26. nectarapi/version.py +1 -1
  27. nectarbase/ledgertransactions.py +2 -3
  28. nectarbase/memo.py +9 -10
  29. nectarbase/objects.py +4 -5
  30. nectarbase/operations.py +3 -7
  31. nectarbase/version.py +1 -1
  32. nectargraphenebase/__init__.py +0 -1
  33. nectargraphenebase/account.py +16 -37
  34. nectargraphenebase/base58.py +5 -8
  35. nectargraphenebase/bip32.py +5 -11
  36. nectargraphenebase/bip38.py +6 -7
  37. nectargraphenebase/ecdsasig.py +32 -37
  38. nectargraphenebase/objects.py +6 -7
  39. nectargraphenebase/signedtransactions.py +10 -9
  40. nectargraphenebase/types.py +9 -19
  41. nectargraphenebase/unsignedtransactions.py +21 -28
  42. nectargraphenebase/version.py +1 -1
  43. nectarstorage/masterpassword.py +2 -3
  44. nectargraphenebase/py23.py +0 -38
  45. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/WHEEL +0 -0
  46. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/entry_points.txt +0 -0
  47. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/licenses/LICENSE.txt +0 -0
@@ -8,12 +8,9 @@ from collections import OrderedDict
8
8
  import ecdsa
9
9
  from asn1crypto.core import OctetString
10
10
 
11
- from nectargraphenebase.py23 import py23_bytes
12
-
13
11
  from .bip32 import parse_path
14
12
  from .chains import known_chains
15
13
  from .objects import Operation, isArgsThisClass
16
- from .py23 import py23_chr, string_types
17
14
  from .types import (
18
15
  Array,
19
16
  JsonObj,
@@ -46,22 +43,22 @@ class GrapheneObjectASN1(object):
46
43
 
47
44
  def __bytes__(self):
48
45
  if self.data is None:
49
- return py23_bytes()
46
+ return bytes()
50
47
  b = b""
51
48
  output = b""
52
49
  for name, value in list(self.data.items()):
53
50
  if name == "operations":
54
51
  for operation in value:
55
- if isinstance(value, string_types):
56
- b = py23_bytes(operation, "utf-8")
52
+ if isinstance(value, str):
53
+ b = bytes(operation, "utf-8")
57
54
  else:
58
- b = py23_bytes(operation)
55
+ b = bytes(operation)
59
56
  output += OctetString(b).dump()
60
57
  elif name != "signatures":
61
- if isinstance(value, string_types):
62
- b = py23_bytes(value, "utf-8")
58
+ if isinstance(value, str):
59
+ b = bytes(value, "utf-8")
63
60
  else:
64
- b = py23_bytes(value)
61
+ b = bytes(value)
65
62
  output += OctetString(b).dump()
66
63
  return output
67
64
 
@@ -123,7 +120,7 @@ class Unsigned_Transaction(GrapheneObjectASN1):
123
120
  operations_count = len(kwargs["operations"])
124
121
  # opklass = self.getOperationKlass()
125
122
  # if all([not isinstance(a, opklass) for a in kwargs["operations"]]):
126
- # kwargs['operations'] = Array([opklass(a, prefix=prefix) for a in kwargs["operations"]])
123
+ # kwargs['operations'] = Array([opklass(a, ) for a in kwargs["operations"]])
127
124
  # else:
128
125
  # kwargs['operations'] = (kwargs["operations"])
129
126
 
@@ -150,7 +147,7 @@ class Unsigned_Transaction(GrapheneObjectASN1):
150
147
  self.data.pop("signatures", None)
151
148
 
152
149
  # Generage Hash of the seriliazed version
153
- h = hashlib.sha256(py23_bytes(self)).digest()
150
+ h = hashlib.sha256(bytes(self)).digest()
154
151
 
155
152
  # recover signatures
156
153
  self.data["signatures"] = sigs
@@ -204,16 +201,16 @@ class Unsigned_Transaction(GrapheneObjectASN1):
204
201
  for name, value in list(self.data.items()):
205
202
  if name == "operations":
206
203
  for operation in value:
207
- if isinstance(value, string_types):
208
- b = py23_bytes(operation, "utf-8")
204
+ if isinstance(value, str):
205
+ b = bytes(operation, "utf-8")
209
206
  else:
210
- b = py23_bytes(operation)
207
+ b = bytes(operation)
211
208
  self.message += OctetString(b).dump()
212
209
  elif name != "signatures":
213
- if isinstance(value, string_types):
214
- b = py23_bytes(value, "utf-8")
210
+ if isinstance(value, str):
211
+ b = bytes(value, "utf-8")
215
212
  else:
216
- b = py23_bytes(value)
213
+ b = bytes(value)
217
214
  self.message += OctetString(b).dump()
218
215
 
219
216
  self.digest = hashlib.sha256(self.message).digest()
@@ -251,16 +248,12 @@ class Unsigned_Transaction(GrapheneObjectASN1):
251
248
  if first:
252
249
  total_size = int(len(path)) + 1 + len(chunk)
253
250
  apdu = (
254
- unhexlify("d4040000")
255
- + py23_chr(total_size)
256
- + py23_chr(path_size)
257
- + path
258
- + chunk
251
+ unhexlify("d4040000") + bytes([total_size]) + bytes([path_size]) + path + chunk
259
252
  )
260
253
  first = False
261
254
  else:
262
255
  total_size = len(chunk)
263
- apdu = unhexlify("d4048000") + py23_chr(total_size) + chunk
256
+ apdu = unhexlify("d4048000") + bytes([total_size]) + chunk
264
257
  result.append(apdu)
265
258
  offset += len(chunk)
266
259
  return result
@@ -270,14 +263,14 @@ class Unsigned_Transaction(GrapheneObjectASN1):
270
263
  if not request_screen_approval:
271
264
  return (
272
265
  unhexlify("d4020001")
273
- + py23_chr(int(len(path)) + 1)
274
- + py23_chr(int(len(path) / 4))
266
+ + bytes([int(len(path)) + 1])
267
+ + bytes([int(len(path) / 4)])
275
268
  + path
276
269
  )
277
270
  else:
278
271
  return (
279
272
  unhexlify("d4020101")
280
- + py23_chr(int(len(path)) + 1)
281
- + py23_chr(int(len(path) / 4))
273
+ + bytes([int(len(path)) + 1])
274
+ + bytes([int(len(path) / 4)])
282
275
  + path
283
276
  )
@@ -1,3 +1,3 @@
1
1
  """THIS FILE IS GENERATED FROM nectar PYPROJECT.TOML."""
2
2
 
3
- version = "0.0.6"
3
+ version = "0.0.7"
@@ -8,7 +8,6 @@ from binascii import hexlify
8
8
 
9
9
  from nectargraphenebase import bip38
10
10
  from nectargraphenebase.aes import AESCipher
11
- from nectargraphenebase.py23 import py23_bytes
12
11
 
13
12
  from .exceptions import WalletLocked, WrongMasterPasswordException
14
13
 
@@ -192,7 +191,7 @@ class MasterPassword(object):
192
191
 
193
192
  def deriveChecksum(self, s):
194
193
  """Derive the checksum"""
195
- checksum = hashlib.sha256(py23_bytes(s, "ascii")).hexdigest()
194
+ checksum = hashlib.sha256(bytes(s, "ascii")).hexdigest()
196
195
  return checksum[:4]
197
196
 
198
197
  def encrypt_text(self, txt):
@@ -216,7 +215,7 @@ class MasterPassword(object):
216
215
  checksum, encrypted_text = enctxt.split("$")
217
216
  try:
218
217
  decrypted_text = aes.decrypt(encrypted_text)
219
- except:
218
+ except Exception:
220
219
  raise WrongMasterPasswordException
221
220
  if checksum != self.deriveChecksum(decrypted_text):
222
221
  raise WrongMasterPasswordException
@@ -1,38 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import sys
3
-
4
- PY2 = sys.version_info[0] == 2
5
- PY3 = sys.version_info[0] == 3
6
-
7
-
8
- if PY3:
9
- bytes_types = (bytes,)
10
- string_types = (str,)
11
- integer_types = (int,)
12
- text_type = str
13
- binary_type = bytes
14
- else:
15
- bytes_types = (bytes,)
16
- string_types = (basestring,) # noqa: F821
17
- integer_types = (int, long) # noqa: F821
18
- text_type = unicode # noqa: F821
19
- binary_type = str
20
-
21
-
22
- def py23_bytes(item=None, encoding=None):
23
- if item is None:
24
- return b""
25
- if hasattr(item, "__bytes__"):
26
- return item.__bytes__()
27
- else:
28
- if encoding:
29
- return bytes(item, encoding)
30
- else:
31
- return bytes(item)
32
-
33
-
34
- def py23_chr(item):
35
- if PY2:
36
- return chr(item)
37
- else:
38
- return bytes([item])