@@ -25,7 +25,6 @@ import (
2525 "strings"
2626 "time"
2727
28- "github.com/Fantom-foundation/lachesis-base/hash"
2928 "github.com/davecgh/go-spew/spew"
3029 "github.com/ethereum/go-ethereum/accounts"
3130 "github.com/ethereum/go-ethereum/accounts/abi"
@@ -47,7 +46,6 @@ import (
4746 "github.com/tyler-smith/go-bip39"
4847
4948 "github.com/Fantom-foundation/go-opera/evmcore"
50- "github.com/Fantom-foundation/go-opera/inter"
5149 "github.com/Fantom-foundation/go-opera/opera"
5250 "github.com/Fantom-foundation/go-opera/utils/gsignercache"
5351)
@@ -1143,73 +1141,6 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {
11431141 return formatted
11441142}
11451143
1146- // RPCMarshalEventHeader converts the given header to the RPC output .
1147- func RPCMarshalEventHeader (header inter.EventI ) map [string ]interface {} {
1148- return map [string ]interface {}{
1149- "epoch" : hexutil .Uint64 (header .Epoch ()),
1150- "seq" : hexutil .Uint64 (header .Seq ()),
1151- "id" : hexutil .Bytes (header .ID ().Bytes ()),
1152- "frame" : hexutil .Uint64 (header .Frame ()),
1153- "creator" : hexutil .Uint64 (header .Creator ()),
1154- "prevEpochHash" : header .PrevEpochHash (),
1155- "parents" : eventIDsToHex (header .Parents ()),
1156- "lamport" : hexutil .Uint64 (header .Lamport ()),
1157- "creationTime" : hexutil .Uint64 (header .CreationTime ()),
1158- "medianTime" : hexutil .Uint64 (header .MedianTime ()),
1159- "extraData" : hexutil .Bytes (header .Extra ()),
1160- "transactionsRoot" : hexutil .Bytes (header .TxHash ().Bytes ()),
1161- "gasPowerLeft" : map [string ]interface {}{
1162- "shortTerm" : hexutil .Uint64 (header .GasPowerLeft ().Gas [inter .ShortTermGas ]),
1163- "longTerm" : hexutil .Uint64 (header .GasPowerLeft ().Gas [inter .LongTermGas ]),
1164- },
1165- "gasPowerUsed" : hexutil .Uint64 (header .GasPowerUsed ()),
1166- }
1167- }
1168-
1169- // RPCMarshalEvent converts the given event to the RPC output which depends on fullTx. If inclTx is true transactions are
1170- // returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
1171- // transaction hashes.
1172- func RPCMarshalEvent (event inter.EventPayloadI , inclTx bool , fullTx bool ) (map [string ]interface {}, error ) {
1173- fields := RPCMarshalEventHeader (event )
1174- fields ["size" ] = hexutil .Uint64 (event .Size ())
1175-
1176- if inclTx {
1177- formatTx := func (tx * types.Transaction ) (interface {}, error ) {
1178- return tx .Hash (), nil
1179- }
1180- if fullTx {
1181- // TODO full txs for events API
1182- //formatTx = func(tx *types.Transaction) (interface{}, error) {
1183- // return newRPCTransactionFromBlockHash(event, tx.Hash()), nil
1184- //}
1185- }
1186- txs := event .Txs ()
1187- transactions := make ([]interface {}, len (txs ))
1188- var err error
1189- for i , tx := range txs {
1190- if transactions [i ], err = formatTx (tx ); err != nil {
1191- return nil , err
1192- }
1193- }
1194-
1195- fields ["transactions" ] = transactions
1196- }
1197-
1198- return fields , nil
1199- }
1200-
1201- func eventIDsToHex (ids hash.Events ) []hexutil.Bytes {
1202- res := make ([]hexutil.Bytes , len (ids ))
1203- for i , id := range ids {
1204- res [i ] = eventIDToHex (id )
1205- }
1206- return res
1207- }
1208-
1209- func eventIDToHex (id hash.Event ) hexutil.Bytes {
1210- return hexutil .Bytes (id .Bytes ())
1211- }
1212-
12131144// RPCMarshalHeader converts the given header to the RPC output .
12141145func RPCMarshalHeader (head * evmcore.EvmHeader , bloom types.Bloom ) map [string ]interface {} {
12151146 return map [string ]interface {}{
0 commit comments