Creates an XDR Memo object for a transaction with MEMO_HASH.
321409
def to_xdr_object(self):
        """"""
        return Xdr.types.Memo(type=Xdr.const.MEMO_HASH, hash=self.memo_hash)
97536
def to_h
      copied_object.each_with_object({}) do |pair, memo|
        value = pair.last
        if value.is_a?(Footing::Hash)
          memo[pair.first] = value.to_h
        elsif value.is_a?(::Array)
          memo[pair.first] = value.map do |val|
            if val.is_a?(Footing::Hash)
              val.to_h
            else
              val
            end
          end
        else
          memo[pair.first] = value
        end
      end
    end
1136912
def from_xdr_object(cls, op_xdr_object):
        
        if not op_xdr_object.sourceAccount:
            source = None
        else:
            source = encode_check(
                'account', op_xdr_object.sourceAccount[0].ed25519).decode()

        selling = Asset.from_xdr_object(
            op_xdr_object.body.createPassiveOfferOp.selling)
        buying = Asset.from_xdr_object(
            op_xdr_object.body.createPassiveOfferOp.buying)
        amount = Operation.from_xdr_amount(
            op_xdr_object.body.createPassiveOfferOp.amount)

        n = op_xdr_object.body.createPassiveOfferOp.price.n
        d = op_xdr_object.body.createPassiveOfferOp.price.d
        price = division(n, d)
        return cls(
            source=source,
            selling=selling,
            buying=buying,
            amount=amount,
            price=price)
1259367
def add_transaction(self,
                        block_header: BlockHeader,
                        index_key: int,
                        transaction: 'BaseTransaction') -> Hash32:
        
        transaction_db = HexaryTrie(self.db, root_hash=block_header.transaction_root)
        transaction_db[index_key] = rlp.encode(transaction)
        return transaction_db.root_hash
547171
def symbolize_hash(hash)
      return hash unless hash.is_a?(Hash)

      hash.inject({}){ |memo,(key,value)| memo[key.to_sym] = symbolize_hash(value); memo }
    end
1087585
function _createIndex(indexName, indexData, value, ex, cb) {
    var callback = cb;
    var expiry = ex;
    if(!callback) {
      expiry = null;
      callback = ex;
    }

    // generate the index value
    var index = indexName + '-' +
      crypto.createHash('sha256').update(indexData).digest('hex');

    client.set(index, value, function(err, reply) {
      if(err) {
        return callback(err);
      }
      if(expiry) {
        return client.expire(index, expiry, function(err) {
          callback(err, reply);
        });
      }
      callback(err, reply);
    });
  }
620691
def from_xdr_object(cls, tx_xdr_object):
        
        source = encode_check('account', tx_xdr_object.sourceAccount.ed25519)
        sequence = tx_xdr_object.seqNum - 1
        time_bounds_in_xdr = tx_xdr_object.timeBounds  # TODO test
        if time_bounds_in_xdr:
            time_bounds = {
                'maxTime': time_bounds_in_xdr[0].maxTime,
                'minTime': time_bounds_in_xdr[0].minTime
            }
        else:
            time_bounds = None

        memo = xdr_to_memo(tx_xdr_object.memo)

        operations = list(map(
            Operation.from_xdr_object, tx_xdr_object.operations
        ))
        return cls(
            source=source,
            sequence=sequence,
            time_bounds=time_bounds,
            memo=memo,
            fee=tx_xdr_object.fee,
            operations=operations)
41725
def from_xdr(cls, xdr):
        
        xdr_decoded = base64.b64decode(xdr)
        te = Xdr.StellarXDRUnpacker(xdr_decoded)
        te_xdr_object = te.unpack_TransactionEnvelope()
        signatures = te_xdr_object.signatures
        tx_xdr_object = te_xdr_object.tx
        tx = Transaction.from_xdr_object(tx_xdr_object)
        te = TransactionEnvelope(tx, signatures=signatures)
        # te = TransactionEnvelope(
        #     tx, {'signatures': signatures, 'network_id': 'PUBLIC'})
        return te
1200826
def _hash(x, elementType, relicHashFunc):
    
    # Combine all inputs into a single bytearray
    barray = bytearray()
    map(barray.extend, bytes(x))

    # Create an element of the correct type to hold the hash result
    result = elementType()

    # Convert barray into a modifiable ctypes buffer, hash using the provided
    # function, and return the result.
    buf = getBuffer(barray)
    relicHashFunc(byref(result), byref(buf), sizeof(buf))
    return result
71687
function TXRecord(tx, block) {
  if (!(this instanceof TXRecord))
    return new TXRecord(tx, block);

  this.tx = null;
  this.hash = null;
  this.mtime = util.now();
  this.height = -1;
  this.block = null;
  this.index = -1;
  this.time = 0;

  if (tx)
    this.fromTX(tx, block);
}
9591
def xdr(self):
        
        tx = Xdr.StellarXDRPacker()
        tx.pack_Transaction(self.to_xdr_object())
        return base64.b64encode(tx.get_buffer())
713791
def make_snapshot_from_ops_hash( cls, record_root_hash, prev_consensus_hashes ):
        
        # mix into previous consensus hashes...
        all_hashes = prev_consensus_hashes[:] + [record_root_hash]
        all_hashes.sort()
        all_hashes_merkle_tree = MerkleTree( all_hashes )
        root_hash = all_hashes_merkle_tree.root()

        consensus_hash = StateEngine.calculate_consensus_hash( root_hash )
        return consensus_hash
51370
def _generate_doc(ret):
    '''
    
    '''

    # Create a copy of the object that we will return.
    retc = ret.copy()

    # Set the ID of the document to be the JID.
    retc["_id"] = ret["jid"]

    # Add a timestamp field to the document
    retc["timestamp"] = time.time()

    return retc
1257072
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) :
        """"""
        data = {
            "type" : "hash",
            "fields" : fields,
            "unique" : unique,
            "sparse" : sparse,
            "deduplicate": deduplicate
        }
        ind = Index(self, creationData = data)
        self.indexes["hash"][ind.infos["id"]] = ind
        return ind
1297484
function(transaction_hash) {
    const oThis = this
      , timeInterval = 5000
      , proposeSteps = {is_proposal_done: 0, is_registered_on_uc: 0, is_registered_on_vc: 0}
    ;

    return new Promise(function(onResolve, onReject){

      logger.step("** Monitoring BT proposal status");
      const statusObj = new getRegistrationStatus({transaction_hash: transaction_hash});
      var statusTimer = setInterval(async function () {
        var statusResponse = await statusObj.perform();
        if (statusResponse.isFailure()) {
          logger.error(statusResponse);
          clearInterval(statusTimer);
          process.exit(1);
        } else {
          var registrationStatus = statusResponse.data.registration_status;
          if (proposeSteps['is_proposal_done'] != registrationStatus['is_proposal_done']) {
            logger.info('* BT proposal done on utility chain. Waiting for registration utility and value chain.');
            proposeSteps['is_proposal_done'] = registrationStatus['is_proposal_done'];
          }
          if (proposeSteps['is_registered_on_uc'] != registrationStatus['is_registered_on_uc']) {
            logger.info('* BT registration done on utility chain. Waiting for registration on value chain.');
            proposeSteps['is_registered_on_uc'] = registrationStatus['is_registered_on_uc'];
          }
          if (proposeSteps['is_registered_on_vc'] != registrationStatus['is_registered_on_vc']) {
            logger.info('* BT registration done on value chain.');
            proposeSteps['is_registered_on_vc'] = registrationStatus['is_registered_on_vc'];

            clearInterval(statusTimer);
            return onResolve(statusResponse);
          }
        }
      }, timeInterval);

    });

  }
1322248
def to_xdr_object(self):
        
        selling = self.selling.to_xdr_object()
        buying = self.buying.to_xdr_object()

        price = Operation.to_xdr_price(self.price)
        price = Xdr.types.Price(price['n'], price['d'])

        amount = Operation.to_xdr_amount(self.amount)

        create_passive_offer_op = Xdr.types.CreatePassiveOfferOp(
            selling, buying, amount, price)
        self.body.type = Xdr.const.CREATE_PASSIVE_OFFER
        self.body.createPassiveOfferOp = create_passive_offer_op
        return super(CreatePassiveOffer, self).to_xdr_object()
659983
def prepare_regions_hash(rdo)
      res = {}
      rdo.each do |region|
        region.dealers.each do |dealer|
          dealer.offices.each do |office|
            if res[region.id].nil?
              res[region.id] = { id:region.id, title:region.title }
            else
              break
            end
          end
        end
      end
      res
    end