@@ -335,6 +335,20 @@ func NewEth(cluster []*config.NodeCluster, blockchain int64, xlog *xlog.XLog) bl
335335 return e
336336}
337337
338+ func NewEth2 (cluster []* config.NodeCluster , blockchain int64 , xlog * xlog.XLog ) blockchain.ExApi {
339+ blockChainClient := chain .NewChain (blockchain , xlog )
340+ if blockChainClient == nil {
341+ return nil
342+ }
343+ e := & Ether {
344+ log : xlog ,
345+ nodeCluster : cluster ,
346+ blockChainClient : blockChainClient ,
347+ }
348+ e .StartWDT ()
349+ return e
350+ }
351+
338352func (e * Ether ) StartWDT () {
339353 go func () {
340354 t := time .NewTicker (10 * time .Minute )
@@ -431,6 +445,53 @@ func (e *Ether) SendRawTransaction(chainCode int64, signedTx string) (string, er
431445 return e .SendReq (chainCode , req )
432446}
433447
448+ func (e * Ether ) GetAccountResourceForTron (chainCode int64 , address string ) (string , error ) {
449+ return "" , nil
450+ }
451+
452+ func (e * Ether ) EstimateGasForTron (chainCode int64 , from , to , functionSelector , parameter string ) (string , error ) {
453+ return "" , nil
454+ }
455+
456+ func (e * Ether ) EstimateGas (chainCode int64 , from , to , data string ) (string , error ) {
457+ req := `
458+ {
459+ "id": 1,
460+ "jsonrpc": "2.0",
461+ "method": "eth_estimateGas",
462+ "params": [
463+ {
464+ "from":"%v",
465+ "to": "%v",
466+ "data": "%v"
467+ }
468+ ]
469+ }`
470+ req = fmt .Sprintf (req , from , to , data )
471+ res , err := e .SendJsonRpc (chainCode , req )
472+ if err != nil {
473+ return "" , err
474+ }
475+ return res , nil
476+ }
477+
478+ func (e * Ether ) GasPrice (chainCode int64 ) (string , error ) {
479+ req := `
480+ {
481+ "id": 1,
482+ "jsonrpc": "2.0",
483+ "method": "eth_gasPrice"
484+ }
485+ `
486+
487+ //req = fmt.Sprintf(req, from, to, functionSelector, parameter)
488+ res , err := e .SendJsonRpc (chainCode , req )
489+ if err != nil {
490+ return "" , err
491+ }
492+ return res , nil
493+ }
494+
434495func (e * Ether ) SendReqByWs (blockChain int64 , receiverCh chan string , sendCh chan string ) (string , error ) {
435496 cluster := e .BalanceCluster ()
436497 if cluster == nil {
0 commit comments