lighter

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIGHTER_URL             = "https://mainnet.zklighter.elliot.ai/api"
	TX_NOT_FOUND_RETRIES    = 3
	TX_NOT_FOUND_RETRY_WAIT = 500 * time.Millisecond
	TX_NOT_FOUND_ERROR_CODE = 21500
	TX_FOUND_STATUS_CODE    = 200
)

Variables

This section is empty.

Functions

func LighterCheckRetry added in v0.5.10

func LighterCheckRetry(ctx context.Context, resp *http.Response, err error) (bool, error)

LighterCheckRetry checks if we should retry the request. Retries when: error code is TX_NOT_FOUND_ERROR_CODE (21500) or response has code 200 but missing/empty info.

Types

type LighterAPI

type LighterAPI struct {
	HTTPClient *http.Client
}

func NewLighterAPI

func NewLighterAPI() *LighterAPI

func (*LighterAPI) GetTx

func (a *LighterAPI) GetTx(hash string) (*LighterTx, error)

GetTx fetches transaction from the lighter API

type LighterError added in v0.5.9

type LighterError struct {
	Code    uint64 `json:"code"`
	Message string `json:"message"`
}

func (*LighterError) Error added in v0.5.9

func (e *LighterError) Error() string

type LighterTx

type LighterTx struct {
	Code      uint64 `json:"code"`
	Hash      string `json:"hash"`
	Type      TxType `json:"type"`
	Info      string `json:"info"`
	L1Address string `json:"l1_address"`
	Transfer  *Transfer
}

func (*LighterTx) UnmarshalJSON

func (tx *LighterTx) UnmarshalJSON(data []byte) error

type Transfer

type Transfer struct {
	USDCAmount       uint64
	FromAccountIndex uint64
	ToAccountIndex   int
	Fee              uint64
	Memo             []byte
}

type TxType

type TxType uint64
const (
	TxTypeL2Transfer TxType = 12
	TxTypeL2Withdraw TxType = 13
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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