mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
updated getters and write fns for contextual data
This commit is contained in:
parent
844106b8d7
commit
a7af9c9255
11 changed files with 94 additions and 74 deletions
|
|
@ -16,7 +16,6 @@ import (
|
||||||
func GetTransaction(w http.ResponseWriter, r *http.Request) {
|
func GetTransaction(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
txHash := vars["txHash"]
|
txHash := vars["txHash"]
|
||||||
fmt.Println(txHash)
|
|
||||||
connStr := "user=postgres dbname=shyftdb sslmode=disable"
|
connStr := "user=postgres dbname=shyftdb sslmode=disable"
|
||||||
blockExplorerDb, err := sql.Open("postgres", connStr)
|
blockExplorerDb, err := sql.Open("postgres", connStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -24,7 +23,6 @@ func GetTransaction(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getTxResponse := shyftdb.GetTransaction(blockExplorerDb, txHash)
|
getTxResponse := shyftdb.GetTransaction(blockExplorerDb, txHash)
|
||||||
fmt.Println(getTxResponse)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class BlocksTable extends Component {
|
||||||
render() {
|
render() {
|
||||||
const table = this.state.data.map((data, i) => {
|
const table = this.state.data.map((data, i) => {
|
||||||
return <BlockTable
|
return <BlockTable
|
||||||
key={data.Hash[i]}
|
key={`${data.TxHash}${i}`}
|
||||||
Hash={data.Hash}
|
Hash={data.Hash}
|
||||||
Number={data.Number}
|
Number={data.Number}
|
||||||
Coinbase={data.Coinbase}
|
Coinbase={data.Coinbase}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
const BlockTable = (props) => {
|
const BlockTable = (props) => {
|
||||||
return (
|
return (
|
||||||
<tbody key={props.key}>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><Link to="/blocks/detail" onClick={() => props.detailBlockHandler(props.Number)}>
|
<td><Link to="/blocks/detail" onClick={() => props.detailBlockHandler(props.Number)}>
|
||||||
{props.Number}
|
{props.Number}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ class DetailBlockTable extends Component {
|
||||||
let combinedClasses = ['responsive-table', classes.table];
|
let combinedClasses = ['responsive-table', classes.table];
|
||||||
return (
|
return (
|
||||||
<table className={combinedClasses.join(' ')}>
|
<table className={combinedClasses.join(' ')}>
|
||||||
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Height:</th>
|
<th scope="col">Height:</th>
|
||||||
<td>{data.Number}</td>
|
<td>{data.Number}</td>
|
||||||
|
|
@ -68,6 +69,7 @@ class DetailBlockTable extends Component {
|
||||||
<th scope="col">Reward:</th>
|
<th scope="col">Reward:</th>
|
||||||
<td>TBD</td>
|
<td>TBD</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ th {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding-left: 5px;
|
||||||
|
font-size: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.addressTag {
|
.addressTag {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
|
|
|
||||||
|
|
@ -5,69 +5,64 @@ class DetailTransactionTable extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let data = this.props.data
|
let data = this.props.data
|
||||||
|
console.log(data)
|
||||||
let combinedClasses = ['responsive-table', classes.table];
|
let combinedClasses = ['responsive-table', classes.table];
|
||||||
return (
|
return (
|
||||||
<table className={combinedClasses.join(' ')}>
|
<table className={combinedClasses.join(' ')}>
|
||||||
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">TxHash:</th>
|
<th scope="col">TxHash:</th>
|
||||||
<td>{data.TxHash}</td>
|
<td>{data.TxHash}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Age:</th>
|
<th scope="col">TxReceipt Status:</th>
|
||||||
|
<td>{data.Status}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Block Height:</th>
|
||||||
|
<td>{data.BlockNumber}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">TimeStamp:</th>
|
||||||
<td>{data.Age}</td>
|
<td>{data.Age}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Txn:</th>
|
<th scope="col">From:</th>
|
||||||
<td>{data.TxCount} transactions</td>
|
<td>{data.From}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Block Hash:</th>
|
<th scope="col">To:</th>
|
||||||
<td>{data.Hash}</td>
|
<td>{ `${data.IsContract}` ? `${data.To} (Contract)` : `${data.To}` }</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Parent Hash:</th>
|
<th scope="col">Value:</th>
|
||||||
<td>{data.ParentHash}</td>
|
<td>{data.Amount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Uncle Hash:</th>
|
<th scope="col">Gas Limit:</th>
|
||||||
<td>{data.UncleHash}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Uncle Count:</th>
|
|
||||||
<td>{data.UncleCount}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Coinbase:</th>
|
|
||||||
<td>{data.Coinbase}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Difficulty:</th>
|
|
||||||
<td>{data.Difficulty}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">GasUsed:</th>
|
|
||||||
<td>{data.GasUsed}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Size:</th>
|
|
||||||
<td>{data.Size}ytes</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">GasUsed:</th>
|
|
||||||
<td>{data.GasUsed}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">GasLimit:</th>
|
|
||||||
<td>{data.GasLimit}</td>
|
<td>{data.GasLimit}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Gas Used By Txn:</th>
|
||||||
|
<td>{data.Gas}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Gas Price:</th>
|
||||||
|
<td>{data.GasPrice}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Actual Tx Cost/Fee:</th>
|
||||||
|
<td>{data.Cost}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Nonce:</th>
|
<th scope="col">Nonce:</th>
|
||||||
<td>{data.Nonce}</td>
|
<td>{data.Nonce}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Reward:</th>
|
<th scope="col">Input Data:</th>
|
||||||
<td>TBD</td>
|
<td>{data.Data}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,28 @@ class TransactionTable extends Component {
|
||||||
|
|
||||||
const table = this.state.data.map((data, i) => {
|
const table = this.state.data.map((data, i) => {
|
||||||
return <TransactionsTable
|
return <TransactionsTable
|
||||||
key={data.TxHash[i]}
|
key={`${data.TxHash}${i}`}
|
||||||
|
age={data.Age}
|
||||||
txHash={data.TxHash}
|
txHash={data.TxHash}
|
||||||
blockNumber={data.BlockNumber}
|
blockNumber={data.BlockNumber}
|
||||||
to={data.To}
|
to={data.To}
|
||||||
from={data.From}
|
from={data.From}
|
||||||
value={data.Amount}
|
value={data.Amount}
|
||||||
cost={data.Cost}
|
cost={data.Cost}
|
||||||
|
detailTransactionHandler={this.props.detailTransactionHandler}
|
||||||
/>
|
/>
|
||||||
})
|
})
|
||||||
|
|
||||||
let combinedClasses = ['responsive-table', classes.table];
|
let combinedClasses = ['responsive-table', classes.table];
|
||||||
return (
|
return (
|
||||||
<table className={combinedClasses.join(' ')}>
|
<table key={this.state.data.TxHash} className={combinedClasses.join(' ')}>
|
||||||
<thead className={classes.tHead}>
|
<thead className={classes.tHead}>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">TxHash</th>
|
<th scope="col">TxHash</th>
|
||||||
<th scope="col">Block</th>
|
<th scope="col">Block</th>
|
||||||
<th scope="col">Age</th>
|
<th scope="col">Age</th>
|
||||||
<th scope="col">From</th>
|
<th scope="col">From</th>
|
||||||
|
<th scope="col"></th>
|
||||||
<th scope="col">To</th>
|
<th scope="col">To</th>
|
||||||
<th scope="col">Value</th>
|
<th scope="col">Value</th>
|
||||||
<th scope="col">TxFee</th>
|
<th scope="col">TxFee</th>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import arrow from '../../assets/arrow_right.png';
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
const TransactionTable = (props) => {
|
const TransactionTable = (props) => {
|
||||||
|
console.log(props)
|
||||||
return (
|
return (
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -12,10 +13,10 @@ const TransactionTable = (props) => {
|
||||||
{props.txHash}</Link>
|
{props.txHash}</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>{props.blockNumber}</td>
|
<td>{props.blockNumber}</td>
|
||||||
<td>30 secs ago</td>
|
<td>{props.age}</td>
|
||||||
<td className={classes.fromTag}>{props.from}</td>
|
<td className={classes.fromTag}>{props.from}</td>
|
||||||
<img className={classes.arrow} src={arrow}/>
|
<td><img className={classes.arrow} src={arrow}/></td>
|
||||||
<td>{props.to}</td>
|
<td className={classes.toTag}>{props.to}</td>
|
||||||
<td>{props.value}</td>
|
<td>{props.value}</td>
|
||||||
<td>{props.cost}</td>
|
<td>{props.cost}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ class App extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
detailTransactionHandler = async(txHash) => {
|
detailTransactionHandler = async(txHash) => {
|
||||||
|
console.log("THIS RAN")
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`http://localhost:8080/api/get_transaction/${txHash}`)
|
const response = await axios.get(`http://localhost:8080/api/get_transaction/${txHash}`)
|
||||||
|
console.log("THIS IS RESPONSE", response)
|
||||||
await this.setState({ transactionDetailData: response.data })
|
await this.setState({ transactionDetailData: response.data })
|
||||||
}
|
}
|
||||||
catch(error) {
|
catch(error) {
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,12 @@ CREATE TABLE IF NOT EXISTS txs (
|
||||||
amount numeric,
|
amount numeric,
|
||||||
gasprice numeric,
|
gasprice numeric,
|
||||||
gas numeric,
|
gas numeric,
|
||||||
|
gasLimit numeric,
|
||||||
txFee numeric,
|
txFee numeric,
|
||||||
nonce numeric,
|
nonce numeric,
|
||||||
txStatus text,
|
txStatus text,
|
||||||
isContract bool,
|
isContract bool,
|
||||||
|
age timestamp,
|
||||||
data bytea
|
data bytea
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,12 @@ type ShyftTxEntryPretty struct {
|
||||||
Amount uint64
|
Amount uint64
|
||||||
GasPrice uint64
|
GasPrice uint64
|
||||||
Gas uint64
|
Gas uint64
|
||||||
|
GasLimit uint64
|
||||||
Cost uint64
|
Cost uint64
|
||||||
Nonce uint64
|
Nonce uint64
|
||||||
Status string
|
Status string
|
||||||
IsContract bool
|
IsContract bool
|
||||||
|
Age time.Time
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,13 +102,7 @@ type SendAndReceive struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
//WriteBlock writes to block info to sql db
|
//WriteBlock writes to block info to sql db
|
||||||
func WriteBlock(sqldb *sql.DB, block *types.Block, receipts []*types.Receipt) error {
|
func WriteBlock(sqldb *sql.DB, block *types.Block, receipts []*types.Receipt) error {
|
||||||
//Need to create field in postgres db isContract : True || False
|
|
||||||
//Need to fix nonce numeric issue (attempt to reproduce and record)
|
|
||||||
//Need to update tx To Field where null with Contract Address
|
|
||||||
//Need to update account table with that Contract Address
|
|
||||||
//Need to update AccountNonce and Balance of Tx To field || Contract Address
|
|
||||||
|
|
||||||
coinbase := block.Header().Coinbase.String()
|
coinbase := block.Header().Coinbase.String()
|
||||||
number := block.Header().Number.String()
|
number := block.Header().Number.String()
|
||||||
gasUsed := block.Header().GasUsed
|
gasUsed := block.Header().GasUsed
|
||||||
|
|
@ -134,7 +130,7 @@ type SendAndReceive struct {
|
||||||
if block.Transactions().Len() > 0 {
|
if block.Transactions().Len() > 0 {
|
||||||
for _, tx := range block.Transactions() {
|
for _, tx := range block.Transactions() {
|
||||||
//WriteMinerRewards(sqldb, block)
|
//WriteMinerRewards(sqldb, block)
|
||||||
WriteTransactions(sqldb, tx, block.Header().Hash(), block.Header().Number.String(), receipts)
|
WriteTransactions(sqldb, tx, block.Header().Hash(), block.Header().Number.String(), receipts, age, gasLimit)
|
||||||
if block.Transactions()[0].To() != nil {
|
if block.Transactions()[0].To() != nil {
|
||||||
WriteFromBalance(sqldb, tx)
|
WriteFromBalance(sqldb, tx)
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +144,7 @@ type SendAndReceive struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
//WriteTransactions writes to sqldb
|
//WriteTransactions writes to sqldb
|
||||||
func WriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.Hash, blockNumber string, receipts []*types.Receipt) error {
|
func WriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.Hash, blockNumber string, receipts []*types.Receipt, age time.Time, gasLimit uint64) error {
|
||||||
txData := ShyftTxEntry{
|
txData := ShyftTxEntry{
|
||||||
TxHash: tx.Hash(),
|
TxHash: tx.Hash(),
|
||||||
From: tx.From(),
|
From: tx.From(),
|
||||||
|
|
@ -161,7 +157,8 @@ func WriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.Ha
|
||||||
Nonce: tx.Nonce(),
|
Nonce: tx.Nonce(),
|
||||||
Data: tx.Data(),
|
Data: tx.Data(),
|
||||||
}
|
}
|
||||||
|
fmt.Println("THIS IS AGE", age)
|
||||||
|
fmt.Println("THIS IS GAS LIMIT", gasLimit)
|
||||||
txHash := txData.TxHash.Hex()
|
txHash := txData.TxHash.Hex()
|
||||||
from := txData.From.Hex()
|
from := txData.From.Hex()
|
||||||
blockHasher := txData.BlockHash
|
blockHasher := txData.BlockHash
|
||||||
|
|
@ -190,8 +187,8 @@ func WriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.Ha
|
||||||
|
|
||||||
var retNonce string
|
var retNonce string
|
||||||
isContract = true
|
isContract = true
|
||||||
sqlStatement := `INSERT INTO txs(txhash, from_addr, to_addr, blockhash, blockNumber, amount, gasprice, gas, txfee, nonce, isContract, txStatus, data) VALUES(($1), ($2), ($3), ($4), ($5), ($6), ($7), ($8), ($9), ($10), ($11), ($12), ($13)) RETURNING nonce`
|
sqlStatement := `INSERT INTO txs(txhash, from_addr, to_addr, blockhash, blockNumber, amount, gasprice, gas, gasLimit,txfee, nonce, isContract, txStatus, age, data) VALUES(($1), ($2), ($3), ($4), ($5), ($6), ($7), ($8), ($9), ($10), ($11), ($12), ($13), ($14), ($15)) RETURNING nonce`
|
||||||
qerr := sqldb.QueryRow(sqlStatement, txHash, from, contractAddressFromReciept, blockHasher, blockNumber, amount, gasPrice, gas, txFee, nonce, isContract, statusFromReciept, data).Scan(&retNonce)
|
qerr := sqldb.QueryRow(sqlStatement, txHash, from, contractAddressFromReciept, blockHasher, blockNumber, amount, gasPrice, gas, gasLimit, txFee, nonce, isContract, statusFromReciept, age,data).Scan(&retNonce)
|
||||||
|
|
||||||
if qerr != nil {
|
if qerr != nil {
|
||||||
panic(qerr)
|
panic(qerr)
|
||||||
|
|
@ -209,8 +206,8 @@ func WriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.Ha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlStatement := `INSERT INTO txs(txhash, from_addr, to_addr, blockhash, blockNumber, amount, gasprice, gas, txfee, nonce, isContract, txStatus, data) VALUES(($1), ($2), ($3), ($4), ($5), ($6), ($7), ($8), ($9), ($10), ($11), ($12), ($13)) RETURNING nonce`
|
sqlStatement := `INSERT INTO txs(txhash, from_addr, to_addr, blockhash, blockNumber, amount, gasprice, gas, gasLimit, txfee, nonce, isContract, txStatus, age, data) VALUES(($1), ($2), ($3), ($4), ($5), ($6), ($7), ($8), ($9), ($10), ($11), ($12), ($13), ($14), ($15)) RETURNING nonce`
|
||||||
qerr := sqldb.QueryRow(sqlStatement, txHash, from, to.Hex(), blockHasher, blockNumber, amount, gasPrice, gas, txFee, nonce, isContract, statusFromReciept, data).Scan(&retNonce)
|
qerr := sqldb.QueryRow(sqlStatement, txHash, from, to.Hex(), blockHasher, blockNumber, amount, gasPrice, gas, gasLimit, txFee, nonce, isContract, statusFromReciept, age,data).Scan(&retNonce)
|
||||||
|
|
||||||
if qerr != nil {
|
if qerr != nil {
|
||||||
panic(qerr)
|
panic(qerr)
|
||||||
|
|
@ -612,10 +609,12 @@ func GetAllTransactions(sqldb *sql.DB) string {
|
||||||
var amount uint64
|
var amount uint64
|
||||||
var gasprice uint64
|
var gasprice uint64
|
||||||
var gas uint64
|
var gas uint64
|
||||||
|
var gasLimit uint64
|
||||||
var txfee uint64
|
var txfee uint64
|
||||||
var nonce uint64
|
var nonce uint64
|
||||||
var status string
|
var status string
|
||||||
var isContract bool
|
var isContract bool
|
||||||
|
var age time.Time
|
||||||
var data []byte
|
var data []byte
|
||||||
err = rows.Scan(
|
err = rows.Scan(
|
||||||
&txhash,
|
&txhash,
|
||||||
|
|
@ -626,10 +625,12 @@ func GetAllTransactions(sqldb *sql.DB) string {
|
||||||
&amount,
|
&amount,
|
||||||
&gasprice,
|
&gasprice,
|
||||||
&gas,
|
&gas,
|
||||||
|
&gasLimit,
|
||||||
&txfee,
|
&txfee,
|
||||||
&nonce,
|
&nonce,
|
||||||
&status,
|
&status,
|
||||||
&isContract,
|
&isContract,
|
||||||
|
&age,
|
||||||
&data,
|
&data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -642,10 +643,12 @@ func GetAllTransactions(sqldb *sql.DB) string {
|
||||||
Amount: amount,
|
Amount: amount,
|
||||||
GasPrice: gasprice,
|
GasPrice: gasprice,
|
||||||
Gas: gas,
|
Gas: gas,
|
||||||
|
GasLimit: gasLimit,
|
||||||
Cost: txfee,
|
Cost: txfee,
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
Status: status,
|
Status: status,
|
||||||
IsContract: isContract,
|
IsContract: isContract,
|
||||||
|
Age: age,
|
||||||
Data: data,
|
Data: data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -660,32 +663,39 @@ func GetAllTransactions(sqldb *sql.DB) string {
|
||||||
func GetTransaction(sqldb *sql.DB, txHash string) string {
|
func GetTransaction(sqldb *sql.DB, txHash string) string {
|
||||||
sqlStatement := `SELECT * FROM txs WHERE txhash=$1;`
|
sqlStatement := `SELECT * FROM txs WHERE txhash=$1;`
|
||||||
row := sqldb.QueryRow(sqlStatement, txHash)
|
row := sqldb.QueryRow(sqlStatement, txHash)
|
||||||
var txhash string
|
var txhash string
|
||||||
var to_addr string
|
var to_addr string
|
||||||
var from_addr string
|
var from_addr string
|
||||||
var blockhash string
|
var blockhash string
|
||||||
var blocknumber string
|
var blocknumber string
|
||||||
var amount uint64
|
var amount uint64
|
||||||
var gasprice uint64
|
var gasprice uint64
|
||||||
var gas uint64
|
var gas uint64
|
||||||
var txfee uint64
|
var gasLimit uint64
|
||||||
var nonce uint64
|
var txfee uint64
|
||||||
var status string
|
var nonce uint64
|
||||||
var isContract bool
|
var status string
|
||||||
var data []byte
|
var isContract bool
|
||||||
|
var age time.Time
|
||||||
|
var data []byte
|
||||||
|
|
||||||
row.Scan(
|
row.Scan(
|
||||||
&txhash,
|
&txhash,
|
||||||
&to_addr,
|
&to_addr,
|
||||||
&from_addr,
|
&from_addr,
|
||||||
&blockhash,
|
&blockhash,
|
||||||
|
&blocknumber,
|
||||||
&amount,
|
&amount,
|
||||||
&gasprice,
|
&gasprice,
|
||||||
&gas,
|
&gas,
|
||||||
|
&gasLimit,
|
||||||
&txfee,
|
&txfee,
|
||||||
&nonce,
|
&nonce,
|
||||||
&status,
|
&status,
|
||||||
&isContract,
|
&isContract,
|
||||||
|
&age,
|
||||||
&data)
|
&data)
|
||||||
|
|
||||||
tx := ShyftTxEntryPretty{
|
tx := ShyftTxEntryPretty{
|
||||||
TxHash: txhash,
|
TxHash: txhash,
|
||||||
To: to_addr,
|
To: to_addr,
|
||||||
|
|
@ -695,10 +705,12 @@ func GetTransaction(sqldb *sql.DB, txHash string) string {
|
||||||
Amount: amount,
|
Amount: amount,
|
||||||
GasPrice: gasprice,
|
GasPrice: gasprice,
|
||||||
Gas: gas,
|
Gas: gas,
|
||||||
|
GasLimit: gasLimit,
|
||||||
Cost: txfee,
|
Cost: txfee,
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
Status: status,
|
Status: status,
|
||||||
IsContract: isContract,
|
IsContract: isContract,
|
||||||
|
Age: age,
|
||||||
Data: data,
|
Data: data,
|
||||||
}
|
}
|
||||||
json, _ := json.Marshal(tx)
|
json, _ := json.Marshal(tx)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue