// Code generated by abigen. DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.

package contracts

import (
	"fmt"
	"math/big"
	"reflect"
	"strings"

	ethereum "github.com/erigontech/erigon"
	"github.com/erigontech/erigon/common"
	"github.com/erigontech/erigon/execution/abi"
	"github.com/erigontech/erigon/execution/abi/bind"
	"github.com/erigontech/erigon/execution/types"
	"github.com/erigontech/erigon/p2p/event"
)

// Reference imports to suppress errors if they are not otherwise used.
var (
	_ = big.NewInt
	_ = strings.NewReader
	_ = ethereum.NotFound
	_ = bind.Bind
	_ = common.Big1
	_ = types.BloomLookup
	_ = event.NewSubscription
	_ = fmt.Errorf
	_ = reflect.ValueOf
)

// SequencerABI is the input ABI used to generate the binding from.
const SequencerABI = "[{\"inputs\":[],\"name\":\"InsufficientFee\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"DecryptionProgressSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"eon\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"txIndex\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"identityPrefix\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"encryptedTransaction\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"TransactionSubmitted\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"eon\",\"type\":\"uint64\"}],\"name\":\"getTxCountForEon\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"submitDecryptionProgress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"eon\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"identityPrefix\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"encryptedTransaction\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"submitEncryptedTransaction\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]"

// SequencerBin is the compiled bytecode used for deploying new contracts.
var SequencerBin = "0x6080604052348015600e575f5ffd5b506104528061001c5f395ff3fe608060405260043610610033575f3560e01c80632d32522e146100375780636a69d2e1146100585780637bbd164b1461006b575b5f5ffd5b348015610042575f5ffd5b50610056610051366004610261565b6100c0565b005b6100566100663660046102b7565b6100fa565b348015610076575f5ffd5b506100a3610085366004610312565b67ffffffffffffffff9081165f908152602081905260409020541690565b60405167ffffffffffffffff909116815260200160405180910390f35b7fa9a0645b33a70f18b8d490681d637cb46a859ec51707787e6f46b942f90e8f59816040516100ef9190610360565b60405180910390a150565b6101048148610386565b3410156101235760405162976f7560e21b815260040160405180910390fd5b67ffffffffffffffff8085165f90815260208190526040902054166101498160016103a3565b67ffffffffffffffff8681165f9081526020819052604090819020805467ffffffffffffffff191693909216929092179055517fa7f1b5467be46c45249fb93063cceef96c63ddad03819246bc7770e32d4f5b7d906101b3908790849088903390899089906103c3565b60405180910390a15050505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126101e5575f5ffd5b813567ffffffffffffffff8111156101ff576101ff6101c2565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561022e5761022e6101c2565b604052818152838201602001851015610245575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215610271575f5ffd5b813567ffffffffffffffff811115610287575f5ffd5b610293848285016101d6565b949350505050565b803567ffffffffffffffff811681146102b2575f5ffd5b919050565b5f5f5f5f608085870312156102ca575f5ffd5b6102d38561029b565b935060208501359250604085013567ffffffffffffffff8111156102f5575f5ffd5b610301878288016101d6565b949793965093946060013593505050565b5f60208284031215610322575f5ffd5b61032b8261029b565b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61032b6020830184610332565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761039d5761039d610372565b92915050565b67ffffffffffffffff818116838216019081111561039d5761039d610372565b67ffffffffffffffff8716815267ffffffffffffffff8616602082015284604082015260018060a01b038416606082015260c060808201525f61040960c0830185610332565b90508260a083015297965050505050505056fea2646970667358221220ce87ab2b1c8698571a6f44ca2e1b58f338fc3669ec8333291ae9c9e21b2815a864736f6c634300081c0033"

// DeploySequencer deploys a new Ethereum contract, binding an instance of Sequencer to it.
func DeploySequencer(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, types.Transaction, *Sequencer, error) {
	parsed, err := abi.JSON(strings.NewReader(SequencerABI))
	if err != nil {
		return common.Address{}, nil, nil, err
	}

	address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(SequencerBin), backend)
	if err != nil {
		return common.Address{}, nil, nil, err
	}
	return address, tx, &Sequencer{SequencerCaller: SequencerCaller{contract: contract}, SequencerTransactor: SequencerTransactor{contract: contract}, SequencerFilterer: SequencerFilterer{contract: contract}}, nil
}

// Sequencer is an auto generated Go binding around an Ethereum contract.
type Sequencer struct {
	SequencerCaller     // Read-only binding to the contract
	SequencerTransactor // Write-only binding to the contract
	SequencerFilterer   // Log filterer for contract events
}

// SequencerCaller is an auto generated read-only Go binding around an Ethereum contract.
type SequencerCaller struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// SequencerTransactor is an auto generated write-only Go binding around an Ethereum contract.
type SequencerTransactor struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// SequencerFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type SequencerFilterer struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// SequencerSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type SequencerSession struct {
	Contract     *Sequencer        // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

// SequencerCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type SequencerCallerSession struct {
	Contract *SequencerCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts    // Call options to use throughout this session
}

// SequencerTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type SequencerTransactorSession struct {
	Contract     *SequencerTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts    // Transaction auth options to use throughout this session
}

// SequencerRaw is an auto generated low-level Go binding around an Ethereum contract.
type SequencerRaw struct {
	Contract *Sequencer // Generic contract binding to access the raw methods on
}

// SequencerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type SequencerCallerRaw struct {
	Contract *SequencerCaller // Generic read-only contract binding to access the raw methods on
}

// SequencerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type SequencerTransactorRaw struct {
	Contract *SequencerTransactor // Generic write-only contract binding to access the raw methods on
}

// NewSequencer creates a new instance of Sequencer, bound to a specific deployed contract.
func NewSequencer(address common.Address, backend bind.ContractBackend) (*Sequencer, error) {
	contract, err := bindSequencer(address, backend, backend, backend)
	if err != nil {
		return nil, err
	}
	return &Sequencer{SequencerCaller: SequencerCaller{contract: contract}, SequencerTransactor: SequencerTransactor{contract: contract}, SequencerFilterer: SequencerFilterer{contract: contract}}, nil
}

// NewSequencerCaller creates a new read-only instance of Sequencer, bound to a specific deployed contract.
func NewSequencerCaller(address common.Address, caller bind.ContractCaller) (*SequencerCaller, error) {
	contract, err := bindSequencer(address, caller, nil, nil)
	if err != nil {
		return nil, err
	}
	return &SequencerCaller{contract: contract}, nil
}

// NewSequencerTransactor creates a new write-only instance of Sequencer, bound to a specific deployed contract.
func NewSequencerTransactor(address common.Address, transactor bind.ContractTransactor) (*SequencerTransactor, error) {
	contract, err := bindSequencer(address, nil, transactor, nil)
	if err != nil {
		return nil, err
	}
	return &SequencerTransactor{contract: contract}, nil
}

// NewSequencerFilterer creates a new log filterer instance of Sequencer, bound to a specific deployed contract.
func NewSequencerFilterer(address common.Address, filterer bind.ContractFilterer) (*SequencerFilterer, error) {
	contract, err := bindSequencer(address, nil, nil, filterer)
	if err != nil {
		return nil, err
	}
	return &SequencerFilterer{contract: contract}, nil
}

// bindSequencer binds a generic wrapper to an already deployed contract.
func bindSequencer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
	parsed, err := abi.JSON(strings.NewReader(SequencerABI))
	if err != nil {
		return nil, err
	}
	return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}

// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Sequencer *SequencerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
	return _Sequencer.Contract.SequencerCaller.contract.Call(opts, result, method, params...)
}

// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Sequencer *SequencerRaw) Transfer(opts *bind.TransactOpts) (types.Transaction, error) {
	return _Sequencer.Contract.SequencerTransactor.contract.Transfer(opts)
}

// Transact invokes the (paid) contract method with params as input values.
func (_Sequencer *SequencerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (types.Transaction, error) {
	return _Sequencer.Contract.SequencerTransactor.contract.Transact(opts, method, params...)
}

// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Sequencer *SequencerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
	return _Sequencer.Contract.contract.Call(opts, result, method, params...)
}

// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Sequencer *SequencerTransactorRaw) Transfer(opts *bind.TransactOpts) (types.Transaction, error) {
	return _Sequencer.Contract.contract.Transfer(opts)
}

// Transact invokes the (paid) contract method with params as input values.
func (_Sequencer *SequencerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (types.Transaction, error) {
	return _Sequencer.Contract.contract.Transact(opts, method, params...)
}

// GetTxCountForEon is a free data retrieval call binding the contract method 0x7bbd164b.
//
// Solidity: function getTxCountForEon(uint64 eon) view returns(uint64)
func (_Sequencer *SequencerCaller) GetTxCountForEon(opts *bind.CallOpts, eon uint64) (uint64, error) {
	var out []interface{}
	err := _Sequencer.contract.Call(opts, &out, "getTxCountForEon", eon)

	if err != nil {
		return *new(uint64), err
	}

	out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)

	return out0, err

}

// GetTxCountForEon is a free data retrieval call binding the contract method 0x7bbd164b.
//
// Solidity: function getTxCountForEon(uint64 eon) view returns(uint64)
func (_Sequencer *SequencerSession) GetTxCountForEon(eon uint64) (uint64, error) {
	return _Sequencer.Contract.GetTxCountForEon(&_Sequencer.CallOpts, eon)
}

// GetTxCountForEon is a free data retrieval call binding the contract method 0x7bbd164b.
//
// Solidity: function getTxCountForEon(uint64 eon) view returns(uint64)
func (_Sequencer *SequencerCallerSession) GetTxCountForEon(eon uint64) (uint64, error) {
	return _Sequencer.Contract.GetTxCountForEon(&_Sequencer.CallOpts, eon)
}

// SubmitDecryptionProgress is a paid mutator transaction binding the contract method 0x2d32522e.
//
// Solidity: function submitDecryptionProgress(bytes message) returns()
func (_Sequencer *SequencerTransactor) SubmitDecryptionProgress(opts *bind.TransactOpts, message []byte) (types.Transaction, error) {
	return _Sequencer.contract.Transact(opts, "submitDecryptionProgress", message)
}

// SubmitDecryptionProgress is a paid mutator transaction binding the contract method 0x2d32522e.
//
// Solidity: function submitDecryptionProgress(bytes message) returns()
func (_Sequencer *SequencerSession) SubmitDecryptionProgress(message []byte) (types.Transaction, error) {
	return _Sequencer.Contract.SubmitDecryptionProgress(&_Sequencer.TransactOpts, message)
}

// SubmitDecryptionProgress is a paid mutator transaction binding the contract method 0x2d32522e.
//
// Solidity: function submitDecryptionProgress(bytes message) returns()
func (_Sequencer *SequencerTransactorSession) SubmitDecryptionProgress(message []byte) (types.Transaction, error) {
	return _Sequencer.Contract.SubmitDecryptionProgress(&_Sequencer.TransactOpts, message)
}

// SubmitEncryptedTransaction is a paid mutator transaction binding the contract method 0x6a69d2e1.
//
// Solidity: function submitEncryptedTransaction(uint64 eon, bytes32 identityPrefix, bytes encryptedTransaction, uint256 gasLimit) payable returns()
func (_Sequencer *SequencerTransactor) SubmitEncryptedTransaction(opts *bind.TransactOpts, eon uint64, identityPrefix [32]byte, encryptedTransaction []byte, gasLimit *big.Int) (types.Transaction, error) {
	return _Sequencer.contract.Transact(opts, "submitEncryptedTransaction", eon, identityPrefix, encryptedTransaction, gasLimit)
}

// SubmitEncryptedTransaction is a paid mutator transaction binding the contract method 0x6a69d2e1.
//
// Solidity: function submitEncryptedTransaction(uint64 eon, bytes32 identityPrefix, bytes encryptedTransaction, uint256 gasLimit) payable returns()
func (_Sequencer *SequencerSession) SubmitEncryptedTransaction(eon uint64, identityPrefix [32]byte, encryptedTransaction []byte, gasLimit *big.Int) (types.Transaction, error) {
	return _Sequencer.Contract.SubmitEncryptedTransaction(&_Sequencer.TransactOpts, eon, identityPrefix, encryptedTransaction, gasLimit)
}

// SubmitEncryptedTransaction is a paid mutator transaction binding the contract method 0x6a69d2e1.
//
// Solidity: function submitEncryptedTransaction(uint64 eon, bytes32 identityPrefix, bytes encryptedTransaction, uint256 gasLimit) payable returns()
func (_Sequencer *SequencerTransactorSession) SubmitEncryptedTransaction(eon uint64, identityPrefix [32]byte, encryptedTransaction []byte, gasLimit *big.Int) (types.Transaction, error) {
	return _Sequencer.Contract.SubmitEncryptedTransaction(&_Sequencer.TransactOpts, eon, identityPrefix, encryptedTransaction, gasLimit)
}

// SequencerSubmitDecryptionProgressParams is an auto generated read-only Go binding of transcaction calldata params
type SequencerSubmitDecryptionProgressParams struct {
	Param_message []byte
}

// Parse SubmitDecryptionProgress method from calldata of a transaction
//
// Solidity: function submitDecryptionProgress(bytes message) returns()
func ParseSequencerSubmitDecryptionProgressParams(calldata []byte) (*SequencerSubmitDecryptionProgressParams, error) {
	if len(calldata) <= 4 {
		return nil, fmt.Errorf("invalid calldata input")
	}

	_abi, err := abi.JSON(strings.NewReader(SequencerABI))
	if err != nil {
		return nil, fmt.Errorf("failed to get abi of registry metadata: %w", err)
	}

	out, err := _abi.Methods["submitDecryptionProgress"].Inputs.Unpack(calldata[4:])
	if err != nil {
		return nil, fmt.Errorf("failed to unpack submitDecryptionProgress params data: %w", err)
	}

	var paramsResult = new(SequencerSubmitDecryptionProgressParams)
	value := reflect.ValueOf(paramsResult).Elem()

	if value.NumField() != len(out) {
		return nil, fmt.Errorf("failed to match calldata with param field number")
	}

	out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte)

	return &SequencerSubmitDecryptionProgressParams{
		Param_message: out0,
	}, nil
}

// SequencerSubmitEncryptedTransactionParams is an auto generated read-only Go binding of transcaction calldata params
type SequencerSubmitEncryptedTransactionParams struct {
	Param_eon                  uint64
	Param_identityPrefix       [32]byte
	Param_encryptedTransaction []byte
	Param_gasLimit             *big.Int
}

// Parse SubmitEncryptedTransaction method from calldata of a transaction
//
// Solidity: function submitEncryptedTransaction(uint64 eon, bytes32 identityPrefix, bytes encryptedTransaction, uint256 gasLimit) payable returns()
func ParseSequencerSubmitEncryptedTransactionParams(calldata []byte) (*SequencerSubmitEncryptedTransactionParams, error) {
	if len(calldata) <= 4 {
		return nil, fmt.Errorf("invalid calldata input")
	}

	_abi, err := abi.JSON(strings.NewReader(SequencerABI))
	if err != nil {
		return nil, fmt.Errorf("failed to get abi of registry metadata: %w", err)
	}

	out, err := _abi.Methods["submitEncryptedTransaction"].Inputs.Unpack(calldata[4:])
	if err != nil {
		return nil, fmt.Errorf("failed to unpack submitEncryptedTransaction params data: %w", err)
	}

	var paramsResult = new(SequencerSubmitEncryptedTransactionParams)
	value := reflect.ValueOf(paramsResult).Elem()

	if value.NumField() != len(out) {
		return nil, fmt.Errorf("failed to match calldata with param field number")
	}

	out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
	out1 := *abi.ConvertType(out[1], new([32]byte)).(*[32]byte)
	out2 := *abi.ConvertType(out[2], new([]byte)).(*[]byte)
	out3 := *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)

	return &SequencerSubmitEncryptedTransactionParams{
		Param_eon: out0, Param_identityPrefix: out1, Param_encryptedTransaction: out2, Param_gasLimit: out3,
	}, nil
}

// SequencerDecryptionProgressSubmittedIterator is returned from FilterDecryptionProgressSubmitted and is used to iterate over the raw logs and unpacked data for DecryptionProgressSubmitted events raised by the Sequencer contract.
type SequencerDecryptionProgressSubmittedIterator struct {
	Event *SequencerDecryptionProgressSubmitted // Event containing the contract specifics and raw log

	contract *bind.BoundContract // Generic contract to use for unpacking event data
	event    string              // Event name to use for unpacking event data

	logs chan types.Log        // Log channel receiving the found contract events
	sub  ethereum.Subscription // Subscription for errors, completion and termination
	done bool                  // Whether the subscription completed delivering logs
	fail error                 // Occurred error to stop iteration
}

// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *SequencerDecryptionProgressSubmittedIterator) Next() bool {
	// If the iterator failed, stop iterating
	if it.fail != nil {
		return false
	}
	// If the iterator completed, deliver directly whatever's available
	if it.done {
		select {
		case log := <-it.logs:
			it.Event = new(SequencerDecryptionProgressSubmitted)
			if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
				it.fail = err
				return false
			}
			it.Event.Raw = log
			return true

		default:
			return false
		}
	}
	// Iterator still in progress, wait for either a data or an error event
	select {
	case log := <-it.logs:
		it.Event = new(SequencerDecryptionProgressSubmitted)
		if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
			it.fail = err
			return false
		}
		it.Event.Raw = log
		return true

	case err := <-it.sub.Err():
		it.done = true
		it.fail = err
		return it.Next()
	}
}

// Error returns any retrieval or parsing error occurred during filtering.
func (it *SequencerDecryptionProgressSubmittedIterator) Error() error {
	return it.fail
}

// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *SequencerDecryptionProgressSubmittedIterator) Close() error {
	it.sub.Unsubscribe()
	return nil
}

// SequencerDecryptionProgressSubmitted represents a DecryptionProgressSubmitted event raised by the Sequencer contract.
type SequencerDecryptionProgressSubmitted struct {
	Message []byte
	Raw     types.Log // Blockchain specific contextual infos
}

func (_Sequencer *SequencerFilterer) DecryptionProgressSubmittedEventID() common.Hash {
	return common.HexToHash("0xa9a0645b33a70f18b8d490681d637cb46a859ec51707787e6f46b942f90e8f59")
}

// FilterDecryptionProgressSubmitted is a free log retrieval operation binding the contract event 0xa9a0645b33a70f18b8d490681d637cb46a859ec51707787e6f46b942f90e8f59.
//
// Solidity: event DecryptionProgressSubmitted(bytes message)
func (_Sequencer *SequencerFilterer) FilterDecryptionProgressSubmitted(opts *bind.FilterOpts) (*SequencerDecryptionProgressSubmittedIterator, error) {

	logs, sub, err := _Sequencer.contract.FilterLogs(opts, "DecryptionProgressSubmitted")
	if err != nil {
		return nil, err
	}
	return &SequencerDecryptionProgressSubmittedIterator{contract: _Sequencer.contract, event: "DecryptionProgressSubmitted", logs: logs, sub: sub}, nil
}

// WatchDecryptionProgressSubmitted is a free log subscription operation binding the contract event 0xa9a0645b33a70f18b8d490681d637cb46a859ec51707787e6f46b942f90e8f59.
//
// Solidity: event DecryptionProgressSubmitted(bytes message)
func (_Sequencer *SequencerFilterer) WatchDecryptionProgressSubmitted(opts *bind.WatchOpts, sink chan<- *SequencerDecryptionProgressSubmitted) (event.Subscription, error) {

	logs, sub, err := _Sequencer.contract.WatchLogs(opts, "DecryptionProgressSubmitted")
	if err != nil {
		return nil, err
	}
	return event.NewSubscription(func(quit <-chan struct{}) error {
		defer sub.Unsubscribe()
		for {
			select {
			case log := <-logs:
				// New log arrived, parse the event and forward to the user
				event := new(SequencerDecryptionProgressSubmitted)
				if err := _Sequencer.contract.UnpackLog(event, "DecryptionProgressSubmitted", log); err != nil {
					return err
				}
				event.Raw = log

				select {
				case sink <- event:
				case err := <-sub.Err():
					return err
				case <-quit:
					return nil
				}
			case err := <-sub.Err():
				return err
			case <-quit:
				return nil
			}
		}
	}), nil
}

// ParseDecryptionProgressSubmitted is a log parse operation binding the contract event 0xa9a0645b33a70f18b8d490681d637cb46a859ec51707787e6f46b942f90e8f59.
//
// Solidity: event DecryptionProgressSubmitted(bytes message)
func (_Sequencer *SequencerFilterer) ParseDecryptionProgressSubmitted(log types.Log) (*SequencerDecryptionProgressSubmitted, error) {
	event := new(SequencerDecryptionProgressSubmitted)
	if err := _Sequencer.contract.UnpackLog(event, "DecryptionProgressSubmitted", log); err != nil {
		return nil, err
	}
	event.Raw = log
	return event, nil
}

// SequencerTransactionSubmittedIterator is returned from FilterTransactionSubmitted and is used to iterate over the raw logs and unpacked data for TransactionSubmitted events raised by the Sequencer contract.
type SequencerTransactionSubmittedIterator struct {
	Event *SequencerTransactionSubmitted // Event containing the contract specifics and raw log

	contract *bind.BoundContract // Generic contract to use for unpacking event data
	event    string              // Event name to use for unpacking event data

	logs chan types.Log        // Log channel receiving the found contract events
	sub  ethereum.Subscription // Subscription for errors, completion and termination
	done bool                  // Whether the subscription completed delivering logs
	fail error                 // Occurred error to stop iteration
}

// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *SequencerTransactionSubmittedIterator) Next() bool {
	// If the iterator failed, stop iterating
	if it.fail != nil {
		return false
	}
	// If the iterator completed, deliver directly whatever's available
	if it.done {
		select {
		case log := <-it.logs:
			it.Event = new(SequencerTransactionSubmitted)
			if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
				it.fail = err
				return false
			}
			it.Event.Raw = log
			return true

		default:
			return false
		}
	}
	// Iterator still in progress, wait for either a data or an error event
	select {
	case log := <-it.logs:
		it.Event = new(SequencerTransactionSubmitted)
		if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
			it.fail = err
			return false
		}
		it.Event.Raw = log
		return true

	case err := <-it.sub.Err():
		it.done = true
		it.fail = err
		return it.Next()
	}
}

// Error returns any retrieval or parsing error occurred during filtering.
func (it *SequencerTransactionSubmittedIterator) Error() error {
	return it.fail
}

// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *SequencerTransactionSubmittedIterator) Close() error {
	it.sub.Unsubscribe()
	return nil
}

// SequencerTransactionSubmitted represents a TransactionSubmitted event raised by the Sequencer contract.
type SequencerTransactionSubmitted struct {
	Eon                  uint64
	TxIndex              uint64
	IdentityPrefix       [32]byte
	Sender               common.Address
	EncryptedTransaction []byte
	GasLimit             *big.Int
	Raw                  types.Log // Blockchain specific contextual infos
}

func (_Sequencer *SequencerFilterer) TransactionSubmittedEventID() common.Hash {
	return common.HexToHash("0xa7f1b5467be46c45249fb93063cceef96c63ddad03819246bc7770e32d4f5b7d")
}

// FilterTransactionSubmitted is a free log retrieval operation binding the contract event 0xa7f1b5467be46c45249fb93063cceef96c63ddad03819246bc7770e32d4f5b7d.
//
// Solidity: event TransactionSubmitted(uint64 eon, uint64 txIndex, bytes32 identityPrefix, address sender, bytes encryptedTransaction, uint256 gasLimit)
func (_Sequencer *SequencerFilterer) FilterTransactionSubmitted(opts *bind.FilterOpts) (*SequencerTransactionSubmittedIterator, error) {

	logs, sub, err := _Sequencer.contract.FilterLogs(opts, "TransactionSubmitted")
	if err != nil {
		return nil, err
	}
	return &SequencerTransactionSubmittedIterator{contract: _Sequencer.contract, event: "TransactionSubmitted", logs: logs, sub: sub}, nil
}

// WatchTransactionSubmitted is a free log subscription operation binding the contract event 0xa7f1b5467be46c45249fb93063cceef96c63ddad03819246bc7770e32d4f5b7d.
//
// Solidity: event TransactionSubmitted(uint64 eon, uint64 txIndex, bytes32 identityPrefix, address sender, bytes encryptedTransaction, uint256 gasLimit)
func (_Sequencer *SequencerFilterer) WatchTransactionSubmitted(opts *bind.WatchOpts, sink chan<- *SequencerTransactionSubmitted) (event.Subscription, error) {

	logs, sub, err := _Sequencer.contract.WatchLogs(opts, "TransactionSubmitted")
	if err != nil {
		return nil, err
	}
	return event.NewSubscription(func(quit <-chan struct{}) error {
		defer sub.Unsubscribe()
		for {
			select {
			case log := <-logs:
				// New log arrived, parse the event and forward to the user
				event := new(SequencerTransactionSubmitted)
				if err := _Sequencer.contract.UnpackLog(event, "TransactionSubmitted", log); err != nil {
					return err
				}
				event.Raw = log

				select {
				case sink <- event:
				case err := <-sub.Err():
					return err
				case <-quit:
					return nil
				}
			case err := <-sub.Err():
				return err
			case <-quit:
				return nil
			}
		}
	}), nil
}

// ParseTransactionSubmitted is a log parse operation binding the contract event 0xa7f1b5467be46c45249fb93063cceef96c63ddad03819246bc7770e32d4f5b7d.
//
// Solidity: event TransactionSubmitted(uint64 eon, uint64 txIndex, bytes32 identityPrefix, address sender, bytes encryptedTransaction, uint256 gasLimit)
func (_Sequencer *SequencerFilterer) ParseTransactionSubmitted(log types.Log) (*SequencerTransactionSubmitted, error) {
	event := new(SequencerTransactionSubmitted)
	if err := _Sequencer.contract.UnpackLog(event, "TransactionSubmitted", log); err != nil {
		return nil, err
	}
	event.Raw = log
	return event, nil
}
