m.Handle("/submit-transaction", jsonHandler(a.submit))
m.Handle("/estimate-transaction-gas", jsonHandler(a.estimateTxGas))
- //m.Handle("/get-unconfirmed-transaction", jsonHandler(a.getUnconfirmedTx))
- //m.Handle("/list-unconfirmed-transactions", jsonHandler(a.listUnconfirmedTxs))
m.Handle("/decode-raw-transaction", jsonHandler(a.decodeRawTransaction))
m.Handle("/get-block", jsonHandler(a.getBlock))
return NewSuccessResponse(transactions[start:end])
}
-// POST /get-unconfirmed-transaction
-//func (a *API) getUnconfirmedTx(ctx context.Context, filter struct {
-// TxID chainjson.HexBytes `json:"tx_id"`
-//}) Response {
-// var tmpTxID [32]byte
-// copy(tmpTxID[:], filter.TxID[:])
-//
-// txHash := bc.NewHash(tmpTxID)
-// txPool := a.chain.GetTxPool()
-// txDesc, err := txPool.GetTransaction(&txHash)
-// if err != nil {
-// return NewErrorResponse(err)
-// }
-//
-// tx := &BlockTx{
-// ID: txDesc.Tx.ID,
-// Version: txDesc.Tx.Version,
-// Size: txDesc.Tx.SerializedSize,
-// TimeRange: txDesc.Tx.TimeRange,
-// Inputs: []*query.AnnotatedInput{},
-// Outputs: []*query.AnnotatedOutput{},
-// StatusFail: false,
-// }
-//
-// for i := range txDesc.Tx.Inputs {
-// tx.Inputs = append(tx.Inputs, a.wallet.BuildAnnotatedInput(txDesc.Tx, uint32(i)))
-// }
-// for i := range txDesc.Tx.Outputs {
-// tx.Outputs = append(tx.Outputs, a.wallet.BuildAnnotatedOutput(txDesc.Tx, i))
-// }
-//
-// return NewSuccessResponse(tx)
-//}
-
type unconfirmedTxsResp struct {
Total uint64 `json:"total"`
TxIDs []bc.Hash `json:"tx_ids"`
}
-// POST /list-unconfirmed-transactions
-//func (a *API) listUnconfirmedTxs(ctx context.Context) Response {
-// txIDs := []bc.Hash{}
-//
-// txPool := a.chain.GetTxPool()
-// txs := txPool.GetTransactions()
-// for _, txDesc := range txs {
-// txIDs = append(txIDs, bc.Hash(txDesc.Tx.ID))
-// }
-//
-// return NewSuccessResponse(&unconfirmedTxsResp{
-// Total: uint64(len(txIDs)),
-// TxIDs: txIDs,
-// })
-//}
-
// RawTx is the tx struct for getRawTransaction
type RawTx struct {
ID bc.Hash `json:"tx_id"`