types

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexEncodeBig added in v0.0.4

func HexEncodeBig(bigint *big.Int) string

HexEncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.

func IsHexValid added in v0.0.4

func IsHexValid(s string) bool

IsHexValid checks if the provided string is a valid hexadecimal value

Types

type ArgBig added in v0.0.4

type ArgBig big.Int

ArgBig helps to marshal big number values provided in the RPC requests

func (ArgBig) Hex added in v0.0.4

func (a ArgBig) Hex() string

Hex returns a hexadecimal representation

func (ArgBig) MarshalText added in v0.0.4

func (a ArgBig) MarshalText() ([]byte, error)

MarshalText marshals an array of bytes into an instance of ArgBig

func (*ArgBig) UnmarshalText added in v0.0.4

func (a *ArgBig) UnmarshalText(input []byte) error

UnmarshalText unmarshals an instance of ArgBig into an array of bytes

type ArgBytes added in v0.0.4

type ArgBytes []byte

ArgBytes helps to marshal byte array values provided in the RPC requests

func ArgBytesPtr added in v0.0.4

func ArgBytesPtr(b []byte) *ArgBytes

ArgBytesPtr helps to marshal byte array values provided in the RPC requests

func (ArgBytes) Hex added in v0.0.4

func (b ArgBytes) Hex() string

Hex returns a hexadecimal representation

func (ArgBytes) MarshalText added in v0.0.4

func (b ArgBytes) MarshalText() ([]byte, error)

MarshalText marshals into text

func (*ArgBytes) UnmarshalText added in v0.0.4

func (b *ArgBytes) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type ArgHash added in v0.0.4

type ArgHash common.Hash

ArgHash represents a common.Hash that accepts strings shorter than 64 bytes, like 0x00

func (*ArgHash) Hash added in v0.0.4

func (arg *ArgHash) Hash() common.Hash

Hash returns an instance of common.Hash

func (*ArgHash) UnmarshalText added in v0.0.4

func (arg *ArgHash) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type ArgUint64 added in v0.0.4

type ArgUint64 uint64

ArgUint64 helps to marshal uint64 values provided in the RPC requests

func (ArgUint64) Hex added in v0.0.4

func (b ArgUint64) Hex() string

Hex returns a hexadecimal representation

func (ArgUint64) MarshalText added in v0.0.4

func (b ArgUint64) MarshalText() ([]byte, error)

MarshalText marshals into text

func (*ArgUint64) UnmarshalText added in v0.0.4

func (b *ArgUint64) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type BatchKey added in v0.0.6

type BatchKey struct {
	Number uint64
	Hash   common.Hash
}

BatchKey is the pairing of batch number and data hash of a batch

type EthClient added in v0.0.4

type EthClient interface {
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
}

EthClient defines functions that an ethereum rpc client should implement

type EthClientFactory added in v0.0.4

type EthClientFactory interface {
	CreateEthClient(ctx context.Context, url string) (EthClient, error)
}

EthClientFactory defines functions for a EthClient factory

func NewEthClientFactory added in v0.0.4

func NewEthClientFactory() EthClientFactory

NewEthClientFactory is the constructor of ethClientFactory

type OffChainData

type OffChainData struct {
	Key   common.Hash
	Value []byte
}

OffChainData represents some data that is not stored on chain and should be preserved

type Sequence

type Sequence []ArgBytes

Sequence represents the data that the sequencer will send to L1 and other metadata needed to build the accumulated input hash aka accInputHash

func (*Sequence) HashToSign

func (s *Sequence) HashToSign() []byte

HashToSign returns the accumulated input hash of the sequence. Note that this is equivalent to what happens on the smart contract

func (*Sequence) OffChainData

func (s *Sequence) OffChainData() []OffChainData

OffChainData returns the data that needs to be stored off chain from a given sequence

func (*Sequence) Sign

func (s *Sequence) Sign(privateKey *ecdsa.PrivateKey) (*SignedSequence, error)

Sign returns a signed sequence by the private key. Note that what's being signed is the accumulated input hash

type SignedSequence

type SignedSequence struct {
	Sequence  Sequence `json:"sequence"`
	Signature ArgBytes `json:"signature"`
}

SignedSequence is a sequence but signed

func (*SignedSequence) Signer

func (s *SignedSequence) Signer() (common.Address, error)

Signer returns the address of the signer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL