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))
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])
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])
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))
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))
def test_zero_unpadded(self): """ Converting zero to trits, without padding. """ self.assertEqual(trits_from_int(0, pad=None), [])
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