func (s *HttpService) GetWithdrawTransactionByHash(param http.Params) (interface{}, error) {
str, ok := param.String("txid")
return nil, http.NewError(int(InvalidParams), "txid not found")
hex, err := FromReversedString(str)
return nil, http.NewError(int(InvalidParams), "txid reverse failed")
err = hash.Deserialize(bytes.NewReader(hex))
return nil, http.NewError(int(InvalidTransaction), "txid deserialize failed")
tx, _, err := s.cfg.Chain.GetTransaction(hash)
return nil, http.NewError(int(UnknownTransaction), "get tx by txid failed")
payload, ok := tx.Payload.(*types.PayloadTransferCrossChainAsset)
return nil, http.NewError(int(UnknownTransaction), "get tx by txid failed")
var txOuputsInfo []*WithdrawOutputInfo
for i := 0; i < len(payload.CrossChainAmounts); i++ {
txOuputsInfo = append(txOuputsInfo, &WithdrawOutputInfo{
CrossChainAddress: payload.CrossChainAddresses[i],
CrossChainAmount: payload.CrossChainAmounts[i].String(),
OutputAmount: tx.Outputs[payload.OutputIndexes[i]].Value.String(),
txWithdraw := WithdrawTxInfo{
TxID: ToReversedString(tx.Hash()),
CrossChainAssets: txOuputsInfo,