// ReplyTxStatus creates a reply with a batch of transaction status records, corresponding to the ones requested.
160792
func (p *peer) ReplyTxStatus(reqID uint64, stats []txStatus) *reply {
	data, _ := rlp.EncodeToBytes(stats)
	return &reply{p.rw, TxStatusMsg, reqID, data}
}
929272
func (e ServerErrorUnauthorized) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorUnauthorized
	s.Name = "SESSION_UNAUTHORIZED"
	s.Desc = e.Msg
	return
}
997312
func (trans *Transactor) CheckTxSync(ctx context.Context, txEnv *txs.Envelope) (*txs.Receipt, error) {
	trans.logger.Trace.Log("method", "CheckTxSync",
		structure.TxHashKey, txEnv.Tx.Hash(),
		"tx", txEnv.String())
	// Sign unless already signed
	unlock, err := trans.MaybeSignTxMempool(txEnv)
	if err != nil {
		return nil, err
	}
	defer unlock()
	err = txEnv.Validate()
	if err != nil {
		return nil, err
	}
	txBytes, err := trans.txEncoder.EncodeTx(txEnv)
	if err != nil {
		return nil, err
	}
	return trans.CheckTxSyncRaw(ctx, txBytes)
}
570072
func (c *ctx) WithStatus(code int) Context {
	c.code = code
	return c
}
375845
func (s *Http) SetHttpStatus(v int64) *Http {
	s.HttpStatus = &v
	return s
}
21112
func (u NoSessionError) ToStatus() (s keybase1.Status) {
	s.Code = SCNoSession
	s.Name = "NO_SESSION"
	return
}
484290
func (sp *SendText) ReplyToMessage(rm int) *SendText {
	sp.ReplyToMessageID = &rm
	return sp
}
128352
func Reply(w http.ResponseWriter, response interface{}, status int) {
	// marshal the body of the response
	marshalledResponse, err := json.Marshal(response)
	if err != nil {
		marshalledResponse = []byte(fmt.Sprintf(`{"message": "Failed to marshal response: %v %v"}`, response, err))
		status = http.StatusInternalServerError
		LogRequest(nil, status, time.Nanosecond, err)
	}

	// write JSON response
	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	w.WriteHeader(status)
	w.Write(marshalledResponse)
}
159028
func (sp *SendDocument) ReplyToMessage(rm int) *SendDocument {
	sp.ReplyToMessageID = &rm
	return sp
}
939380
func (h *Handler) paymentStatus(mctx libkb.MetaContext, cli gregor1.IncomingInterface, category string, item gregor.Item) {
	mctx.Debug("%v: %v received IBM, ignoring it", h.Name(), category)

	// We will locally dismiss for now so that each client only plays them once:
	if err := h.G().GregorState.LocalDismissItem(mctx.Ctx(), item.Metadata().MsgID()); err != nil {
		h.G().Log.CDebugf(mctx.Ctx(), "failed to local dismiss payment_status: %s", err)
	}
}
227886
func NewTxStateChange(c *Connection) *TxStateChange {
	return &TxStateChange{
		c:  c,
		tx: c.TransactionActive(),
	}
}
912813
func (bot *TgBot) ReplyFn(f func(TgBot, Message, Message)) *TgBot {
	bot.addToConditionalFuncs(RepliedConditionalCall{f})
	return bot
}
1338482
func (wsh *WebsocketHub) MaybeSendTxns(tx *exptypes.MempoolTx) (someReadyToSend bool) {
	// addTxToBuffer adds the transaction to each client's tx buffer, and
	// indicates if at least one client has a buffer at or above the send limit.
	someReadyToSend = wsh.addTxToBuffer(tx)
	if someReadyToSend {
		// Reset the "time to send" ticker since the event loop is about send.
		wsh.bufferTickerChan <- tickerSigReset
	}
	return
}
875565
func (e ServerErrorBlockNonExistent) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorBlockNonExistent
	s.Name = "BLOCK_NONEXISTENT"
	s.Desc = e.Msg
	return
}
469880
func (r *vstResponse) CheckStatus(validStatusCodes ...int) error {
	for _, x := range validStatusCodes {
		if x == r.ResponseCode {
			// Found valid status code
			return nil
		}
	}
	// Invalid status code, try to parse arango error response.
	var aerr driver.ArangoError
	if err := r.ParseBody("", &aerr); err == nil {
		// Found correct arango error.
		return aerr
	}

	// We do not have a valid error code, so we can only create one based on the HTTP status code.
	return driver.ArangoError{
		HasError:     true,
		Code:         r.ResponseCode,
		ErrorMessage: fmt.Sprintf("Unexpected status code %d", r.ResponseCode),
	}
}
151316
func (e simpleFSError) ToStatus() keybase1.Status {
	return keybase1.Status{
		Name: e.reason,
		Code: int(keybase1.StatusCode_SCGeneric),
		Desc: e.Error(),
	}
}
429407
func (ui *CommandlineUI) ApproveTx(request *SignTxRequest) (SignTxResponse, error) {
	ui.mu.Lock()
	defer ui.mu.Unlock()
	weival := request.Transaction.Value.ToInt()
	fmt.Printf("--------- Transaction request-------------\n")
	if to := request.Transaction.To; to != nil {
		fmt.Printf("to:    %v\n", to.Original())
		if !to.ValidChecksum() {
			fmt.Printf("\nWARNING: Invalid checksum on to-address!\n\n")
		}
	} else {
		fmt.Printf("to:    <contact creation>\n")
	}
	fmt.Printf("from:     %v\n", request.Transaction.From.String())
	fmt.Printf("value:    %v wei\n", weival)
	fmt.Printf("gas:      %v (%v)\n", request.Transaction.Gas, uint64(request.Transaction.Gas))
	fmt.Printf("gasprice: %v wei\n", request.Transaction.GasPrice.ToInt())
	fmt.Printf("nonce:    %v (%v)\n", request.Transaction.Nonce, uint64(request.Transaction.Nonce))
	if request.Transaction.Data != nil {
		d := *request.Transaction.Data
		if len(d) > 0 {

			fmt.Printf("data:     %v\n", hexutil.Encode(d))
		}
	}
	if request.Callinfo != nil {
		fmt.Printf("\nTransaction validation:\n")
		for _, m := range request.Callinfo {
			fmt.Printf("  * %s : %s\n", m.Typ, m.Message)
		}
		fmt.Println()

	}
	fmt.Printf("\n")
	showMetadata(request.Meta)
	fmt.Printf("-------------------------------------------\n")
	if !ui.confirm() {
		return SignTxResponse{request.Transaction, false}, nil
	}
	return SignTxResponse{request.Transaction, true}, nil
}