starknet_client

package
v0.0.0-...-5fbed63 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddressFelt

func GetAddressFelt(address string) *felt.Felt

func GetAdressFormatFromFelt

func GetAdressFormatFromFelt(fl *felt.Felt) string

func GetAdressFormatFromStr

func GetAdressFormatFromStr(s string) string

func GetUniqueEkuboHash

func GetUniqueEkuboHash(i, j, k, q string) string

Get a unique pool identifier for the Ekubo pools with given data: TokenA, TokenB, Fee, TickSpacing

Types

type Client

type Client interface {
	Call(fc rpc.FunctionCall) ([]*felt.Felt, error)
	GetEvents(from, to uint64, address string, c_token string, keys []string) ([]rpc.EmittedEvent, string, error)
	GetEventsWithID(from, to rpc.BlockID, address string, c_token string, keys []string) ([]rpc.EmittedEvent, string, error)
	LastBlock() (*rpc.BlockHashAndNumberOutput, error)
	NewDex(amm_id int) (Dex, error)
}

func NewStarknetClient

func NewStarknetClient(cnfg config.Config) Client

type Dex

type Dex interface {
	SyncPoolFromFn(pool PoolInfo, store db.Store, client Client) error
	SyncPoolFromEvent(pool PoolInfo, store db.Store) error
	SyncFee(pool PoolInfo, store db.Store, client Client) error
}

type EkuboData

type EkuboData struct {
	TickSpacing   string `json:"tick_spacing"`
	SqrtPriceLow  string `json:"sqrt_price_low,omitempty"`
	SqrtPriceHigh string `json:"sqrt_price_high,omitempty"`
	CurrentTick   string `json:"current_tick,omitempty"`
	TickSign      string `json:"tick_sign,omitempty"`
	Liqudity      string `json:"liqudity,omitempty"`
	KeyExtension  string `json:"key_extension"`
}

type PoolInfo

type PoolInfo struct {
	Address          string
	ReserveA         decimal.Decimal
	ReserveB         decimal.Decimal
	ExtraData        string
	GeneralExtraData string
	Fee              string
	Event            rpc.Event
	Block            *big.Int
}

Jump to

Keyboard shortcuts

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