@@ -3,9 +3,7 @@ package api
33import (
44 "math/big"
55
6- "github.com/ethereum/go-ethereum/common"
76 "github.com/snowfork/go-substrate-rpc-client/v4/types"
8- beaconjson "github.com/snowfork/snowbridge/relayer/relays/beacon/header/syncer/json"
97 "github.com/snowfork/snowbridge/relayer/relays/beacon/header/syncer/scale"
108 "github.com/snowfork/snowbridge/relayer/relays/beacon/state"
119 "github.com/snowfork/snowbridge/relayer/relays/util"
@@ -55,49 +53,3 @@ func DenebExecutionPayloadToScale(e *state.ExecutionPayloadDeneb) (scale.Executi
5553 }, nil
5654}
5755
58- func DenebJsonExecutionPayloadHeaderToScale (e * beaconjson.FullExecutionPayloadHeaderJson ) (scale.ExecutionPayloadHeaderDeneb , error ) {
59- var executionPayloadHeader scale.ExecutionPayloadHeaderDeneb
60- var baseFeePerGas big.Int
61- baseFeePerGasU64 , err := util .ToUint64 (e .BaseFeePerGas )
62- if err != nil {
63- return executionPayloadHeader , err
64- }
65- blockNumber , err := util .ToUint64 (e .BlockNumber )
66- if err != nil {
67- return executionPayloadHeader , err
68- }
69- baseFeePerGas .SetUint64 (baseFeePerGasU64 )
70- gasLimit , err := util .ToUint64 (e .GasLimit )
71- if err != nil {
72- return executionPayloadHeader , err
73- }
74- gasUsed , err := util .ToUint64 (e .GasUsed )
75- if err != nil {
76- return executionPayloadHeader , err
77- }
78- timestamp , err := util .ToUint64 (e .Timestamp )
79- if err != nil {
80- return executionPayloadHeader , err
81- }
82- blobGasUsed , _ := util .ToUint64 (e .BlobGasUsed )
83- excessBlobGas , _ := util .ToUint64 (e .ExcessBlobGas )
84- return scale.ExecutionPayloadHeaderDeneb {
85- ParentHash : types .NewH256 (common .HexToHash (e .ParentHash ).Bytes ()),
86- FeeRecipient : types .NewH160 (common .HexToAddress (e .FeeRecipient ).Bytes ()),
87- StateRoot : types .NewH256 (common .HexToHash (e .StateRoot ).Bytes ()),
88- ReceiptsRoot : types .NewH256 (common .HexToHash (e .ReceiptsRoot ).Bytes ()),
89- LogsBloom : common .FromHex (e .LogsBloom ),
90- PrevRandao : types .NewH256 (common .HexToHash (e .PrevRandao ).Bytes ()),
91- BlockNumber : types .NewU64 (blockNumber ),
92- GasLimit : types .NewU64 (gasLimit ),
93- GasUsed : types .NewU64 (gasUsed ),
94- Timestamp : types .NewU64 (timestamp ),
95- ExtraData : common .FromHex (e .ExtraData ),
96- BaseFeePerGas : types .NewU256 (baseFeePerGas ),
97- BlockHash : types .NewH256 (common .HexToHash (e .BlockHash ).Bytes ()),
98- TransactionsRoot : types .NewH256 (common .HexToHash (e .TransactionsRoot ).Bytes ()),
99- WithdrawalsRoot : types .NewH256 (common .HexToHash (e .WithdrawalsRoot ).Bytes ()),
100- BlobGasUsed : types .NewU64 (blobGasUsed ),
101- ExcessBlobGas : types .NewU64 (excessBlobGas ),
102- }, nil
103- }
0 commit comments