Exemplo n.º 1
0
 def value_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's value.
 """
     # Note that we are padding to 81 _trits_.
     return TryteString.from_trits(trits_from_int(self.value, pad=81))
Exemplo n.º 2
0
    def test_zero(self):
        """
    Zero is represented as ``[0]`` by default.

    https://github.com/iotaledger/iota.py/issues/49
    """
        self.assertEqual(trits_from_int(0), [0])
Exemplo n.º 3
0
  def test_zero(self):
    """
    Zero is represented as ``[0]`` by default.

    https://github.com/iotaledger/iota.lib.py/issues/49
    """
    self.assertEqual(trits_from_int(0), [0])
Exemplo n.º 4
0
 def last_index_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's
 ``last_index`` value.
 """
     # Note that we are padding to 27 _trits_.
     return TryteString.from_trits(trits_from_int(self.last_index, pad=27))
Exemplo n.º 5
0
 def timestamp_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's
 timestamp.
 """
     # Note that we are padding to 27 _trits_.
     return TryteString.from_trits(trits_from_int(self.timestamp, pad=27))
Exemplo n.º 6
0
 def test_zero_unpadded(self):
     """
 Converting zero to trits, without padding.
 """
     self.assertEqual(trits_from_int(0, pad=None), [])
Exemplo n.º 7
0
def int_to_trytestring(int_input, length):
    trits = trits_from_int(int(int_input))
    trytes = TryteString.from_trits(trits)
    if len(trytes) < length:
        trytes += '9' * (length - len(trytes))
    return trytes
Exemplo n.º 8
0
 def test_zero_unpadded(self):
   """
   Converting zero to trits, without padding.
   """
   self.assertEqual(trits_from_int(0, pad=None), [])