Documentation
¶
Index ¶
- Constants
- Variables
- func IsValidPubKeyLength(bytes []byte) bool
- func IsZeroByteSlice(bytes []byte) bool
- type L2BurnSharesTxInfo
- func (txInfo *L2BurnSharesTxInfo) GetTxHash() string
- func (txInfo *L2BurnSharesTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2BurnSharesTxInfo) GetTxType() uint8
- func (txInfo *L2BurnSharesTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2BurnSharesTxInfo) Validate() error
- type L2CancelAllOrdersTxInfo
- func (txInfo *L2CancelAllOrdersTxInfo) GetTxHash() string
- func (txInfo *L2CancelAllOrdersTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CancelAllOrdersTxInfo) GetTxType() uint8
- func (txInfo *L2CancelAllOrdersTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CancelAllOrdersTxInfo) Validate() error
- type L2CancelOrderTxInfo
- func (txInfo *L2CancelOrderTxInfo) GetTxHash() string
- func (txInfo *L2CancelOrderTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CancelOrderTxInfo) GetTxType() uint8
- func (txInfo *L2CancelOrderTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CancelOrderTxInfo) Validate() error
- type L2ChangePubKeyTxInfo
- func (txInfo *L2ChangePubKeyTxInfo) GetL1AddressBySignature() common.Address
- func (txInfo *L2ChangePubKeyTxInfo) GetL1SignatureBody() string
- func (txInfo *L2ChangePubKeyTxInfo) GetTxHash() string
- func (txInfo *L2ChangePubKeyTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2ChangePubKeyTxInfo) GetTxType() uint8
- func (txInfo *L2ChangePubKeyTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2ChangePubKeyTxInfo) MarshalJSON() ([]byte, error)
- func (txInfo *L2ChangePubKeyTxInfo) SetL1Sig(sig string)
- func (txInfo *L2ChangePubKeyTxInfo) Validate() error
- type L2CreateGroupedOrdersTxInfo
- func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxHash() string
- func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxType() uint8
- func (txInfo *L2CreateGroupedOrdersTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CreateGroupedOrdersTxInfo) Validate() error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateChildOrder(order *OrderInfo) error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOCO() error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOTO() error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOTOCO() error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateParentOrder(order *OrderInfo) error
- func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateSiblingOrders(orders []*OrderInfo) error
- type L2CreateOrderTxInfo
- func (txInfo *L2CreateOrderTxInfo) GetTxHash() string
- func (txInfo *L2CreateOrderTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CreateOrderTxInfo) GetTxType() uint8
- func (txInfo *L2CreateOrderTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CreateOrderTxInfo) Validate() error
- type L2CreatePublicPoolTxInfo
- func (txInfo *L2CreatePublicPoolTxInfo) GetTxHash() string
- func (txInfo *L2CreatePublicPoolTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CreatePublicPoolTxInfo) GetTxType() uint8
- func (txInfo *L2CreatePublicPoolTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CreatePublicPoolTxInfo) Validate() error
- type L2CreateSubAccountTxInfo
- func (txInfo *L2CreateSubAccountTxInfo) GetTxHash() string
- func (txInfo *L2CreateSubAccountTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2CreateSubAccountTxInfo) GetTxType() uint8
- func (txInfo *L2CreateSubAccountTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2CreateSubAccountTxInfo) Validate() error
- type L2MintSharesTxInfo
- func (txInfo *L2MintSharesTxInfo) GetTxHash() string
- func (txInfo *L2MintSharesTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2MintSharesTxInfo) GetTxType() uint8
- func (txInfo *L2MintSharesTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2MintSharesTxInfo) Validate() error
- type L2ModifyOrderTxInfo
- func (txInfo *L2ModifyOrderTxInfo) GetTxHash() string
- func (txInfo *L2ModifyOrderTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2ModifyOrderTxInfo) GetTxType() uint8
- func (txInfo *L2ModifyOrderTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2ModifyOrderTxInfo) Validate() error
- type L2TransferTxInfo
- func (txInfo *L2TransferTxInfo) GetL1AddressBySignature(chainId uint32) common.Address
- func (txInfo *L2TransferTxInfo) GetL1SignatureBody(chainId uint32) string
- func (txInfo *L2TransferTxInfo) GetTxHash() string
- func (txInfo *L2TransferTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2TransferTxInfo) GetTxType() uint8
- func (txInfo *L2TransferTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2TransferTxInfo) SetL1Sig(sig string)
- func (txInfo *L2TransferTxInfo) Validate() error
- type L2UpdateLeverageTxInfo
- func (txInfo *L2UpdateLeverageTxInfo) GetTxHash() string
- func (txInfo *L2UpdateLeverageTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2UpdateLeverageTxInfo) GetTxType() uint8
- func (txInfo *L2UpdateLeverageTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2UpdateLeverageTxInfo) Validate() error
- type L2UpdateMarginTxInfo
- func (txInfo *L2UpdateMarginTxInfo) GetTxHash() string
- func (txInfo *L2UpdateMarginTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2UpdateMarginTxInfo) GetTxType() uint8
- func (txInfo *L2UpdateMarginTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2UpdateMarginTxInfo) Validate() error
- type L2UpdatePublicPoolTxInfo
- func (txInfo *L2UpdatePublicPoolTxInfo) GetTxHash() string
- func (txInfo *L2UpdatePublicPoolTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2UpdatePublicPoolTxInfo) GetTxType() uint8
- func (txInfo *L2UpdatePublicPoolTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2UpdatePublicPoolTxInfo) Validate() error
- type L2WithdrawTxInfo
- func (txInfo *L2WithdrawTxInfo) GetTxHash() string
- func (txInfo *L2WithdrawTxInfo) GetTxInfo() (string, error)
- func (txInfo *L2WithdrawTxInfo) GetTxType() uint8
- func (txInfo *L2WithdrawTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
- func (txInfo *L2WithdrawTxInfo) Validate() error
- type OrderInfo
- type PrivateKey
- type Signature
- type TxInfo
Constants ¶
View Source
const ( TxTypeEmpty = 0 TxTypeL1Deposit = 1 TxTypeL1ChangePubKey = 2 TxTypeL1CreateMarket = 3 TxTypeL1UpdateMarket = 4 TxTypeL1CancelAllOrders = 5 TxTypeL1Withdraw = 6 TxTypeL1CreateOrder = 7 TxTypeL2ChangePubKey = 8 TxTypeL2CreateSubAccount = 9 TxTypeL2CreatePublicPool = 10 TxTypeL2UpdatePublicPool = 11 TxTypeL2Transfer = 12 TxTypeL2Withdraw = 13 TxTypeL2CreateOrder = 14 TxTypeL2CancelOrder = 15 TxTypeL2CancelAllOrders = 16 TxTypeL2ModifyOrder = 17 TxTypeL2UpdateLeverage = 20 TxTypeInternalClaimOrder = 21 TxTypeInternalCancelOrder = 22 TxTypeInternalDeleverage = 23 TxTypeInternalExitPosition = 24 TxTypeInternalCancelAllOrders = 25 TxTypeInternalLiquidatePosition = 26 TxTypeInternalCreateOrder = 27 TxTypeL2CreateGroupedOrders = 28 TxTypeL2UpdateMargin = 29 )
View Source
const ( // User set order types LimitOrder = iota MarketOrder = 1 StopLossOrder = 2 StopLossLimitOrder = 3 TakeProfitOrder = 4 TakeProfitLimitOrder = 5 TWAPOrder = 6 // Internal order types TWAPSubOrder = 7 LiquidationOrder = 8 ApiMaxOrderType = TWAPOrder )
Order Type
View Source
const ( ImmediateOrCancel = iota GoodTillTime = 1 PostOnly = 2 )
Order Time-In-Force
View Source
const ( GroupingType = 0 GroupingType_OneTriggersTheOther = 1 GroupingType_OneCancelsTheOther = 2 GroupingType_OneTriggersAOneCancelsTheOther = 3 )
Grouping Type
View Source
const ( ImmediateCancelAll = iota ScheduledCancelAll = 1 AbortScheduledCancelAll = 2 )
Cancel All Orders Time-In-Force
View Source
const ( AssetMarginMode_Disabled = 0 AssetMarginMode_Enabled = 1 AssetMarginMode_Max = AssetMarginMode_Enabled )
Asset Margin Mode
View Source
const ( AssetRouteType_Perps = 0 AssetRouteType_Spot = 1 )
Asset Route Type
View Source
const ( CrossMargin = iota IsolatedMargin = 1 )
Position Margin Mode
View Source
const ( RemoveFromIsolatedMargin = iota AddToIsolatedMargin = 1 )
Margin Update Direction
View Source
const ( OneUSDC = 1000000 FeeTick int64 = 1_000_000 MarginFractionTick int64 = 10_000 MinAccountIndex int64 = 0 MaxAccountIndex int64 = 281474976710654 // (1 << 48) - 2 MaxMasterAccountIndex int64 = 140737488355327 // (1 << 47) - 1 MinSubAccountIndex int64 = 140737488355328 // (1 << 47) MinApiKeyIndex uint8 = 0 MaxApiKeyIndex uint8 = 254 // (1 << 8) - 2 MinMarketIndex int16 = 0 MinPerpsMarketIndex int16 = 0 MaxPerpsMarketIndex int16 = 254 // (1 << 8) - 2 NilMarketIndex int16 = 255 MinSpotMarketIndex int16 = 2048 // (1 << 11) MaxSpotMarketIndex int16 = 4094 // (1 << 12) - 2 NativeAssetIndex = uint16(1) USDCAssetIndex = uint16(3) MinAssetIndex = 1 MaxAssetIndex = (1 << 6) - 2 NilAssetIndex = 0 MaxInvestedPublicPoolCount int64 = 16 MaxPoolEntryUSDC = (1 << 56) - 1 // 2^56 - 1 max USDC to invest in a pool MinNonce int64 = 0 MinOrderNonce int64 = 0 MaxOrderNonce int64 = (1 << 48) - 1 NilClientOrderIndex int64 = 0 NilOrderIndex int64 = 0 MinClientOrderIndex int64 = 1 MaxClientOrderIndex int64 = (1 << 48) - 1 MinOrderIndex int64 = MaxClientOrderIndex + 1 MaxOrderIndex int64 = (1 << 60) - 1 MinOrderBaseAmount int64 = 1 MaxOrderBaseAmount int64 = (1 << 48) - 1 NilOrderBaseAmount int64 = 0 NilOrderPrice uint32 = 0 MinOrderPrice uint32 = 1 MaxOrderPrice uint32 = (1 << 32) - 1 MinOrderCancelAllPeriod int64 = 1000 * 60 * 5 // 5 minutes MaxOrderCancelAllPeriod int64 = 1000 * 60 * 60 * 24 * 15 // 15 days NilOrderExpiry int64 = 0 MinOrderExpiry int64 = 1 MaxOrderExpiry int64 = math.MaxInt64 MinOrderExpiryPeriod int64 = 1000 * 60 * 5 // 5 minutes MaxOrderExpiryPeriod int64 = 1000 * 60 * 60 * 24 * 30 // 30 days NilOrderTriggerPrice uint32 = 0 MinOrderTriggerPrice uint32 = 1 MaxOrderTriggerPrice uint32 = (1 << 32) - 1 MaxGroupedOrderCount int64 = 3 MaxTimestamp = (1 << 48) - 1 )
View Source
const ( MaxExchangeUSDC = (1 << 60) - 1 MinTransferAmount int64 = 1 MaxTransferAmount int64 = MaxExchangeUSDC MinWithdrawalAmount uint64 = 1 MaxWithdrawalAmount uint64 = MaxExchangeUSDC )
View Source
const ( TemplateChangePubKey = "" /* 135-byte string literal not displayed */ TemplateTransfer = "Transfer\n\nnonce: %s\nfrom: %s (route %s)\napi key: %s\nto: %s (route %s)\nasset: %s\namount: %s\nfee: %s" + "\nchainId: %s\nmemo: %s\nOnly sign this message for a trusted client!" TemplateSubAccount = "Create Lighter Sub Account\n\nmaster account index: %s\nOnly sign this message for a trusted client!" )
View Source
const HashLength = gFp5.Bytes
View Source
const L1SignatureLength = 65
View Source
const (
NilApiKeyIndex = MaxApiKeyIndex + 1
)
View Source
const PubKeyLength = gFp5.Bytes
View Source
const SignatureLength = 80
Variables ¶
View Source
var ( ErrAssetIndexTooLow = fmt.Errorf("AssetIndex should not be less than %d", MinAssetIndex) ErrAssetIndexTooHigh = fmt.Errorf("AssetIndex should not be larger than %d", MaxAssetIndex) ErrRouteTypeInvalid = fmt.Errorf("RouteType is invalid") ErrAccountIndexTooLow = fmt.Errorf("AccountIndex should not be less than %d", MinAccountIndex) ErrAccountIndexTooHigh = fmt.Errorf("AccountIndex should not be larger than %d", MaxAccountIndex) ErrNonceTooLow = fmt.Errorf("AccountNonce should not be less than %d", MinNonce) ErrInvalidCancelAllTimeInForce = fmt.Errorf("CancelAllTimeInForce is invalid") ErrOrderReduceOnlyInvalid = fmt.Errorf("ReduceOnly is invalid") ErrOrderTriggerPriceInvalid = fmt.Errorf("TriggerPrice is invalid") ErrOrderExpiryInvalid = fmt.Errorf("OrderExpiry is invalid") ErrExpiredAtInvalid = fmt.Errorf("ExpiredAt is invalid") ErrCancelAllTimeIsNotInRange = fmt.Errorf("CancelAllTime should be larger than 0 and not larger than %d", MaxOrderExpiry) ErrCancelAllTimeisNotNill = fmt.Errorf("CancelAllTime should be nil") ErrPubKeyInvalid = fmt.Errorf("PubKey is invalid") ErrToAccountIndexTooLow = fmt.Errorf("ToAccountIndex should not be less than %d", MinAccountIndex) ErrToAccountIndexTooHigh = fmt.Errorf("ToAccountIndex should not be larger than %d", MaxAccountIndex) ErrFromAccountIndexTooLow = fmt.Errorf("FromAccountIndex should not be less than %d", MinAccountIndex) ErrFromAccountIndexTooHigh = fmt.Errorf("FromAccountIndex should not be larger than %d", MaxAccountIndex) ErrApiKeyIndexTooLow = fmt.Errorf("ApiKeyIndex should not be less than %d", MinApiKeyIndex) ErrApiKeyIndexTooHigh = fmt.Errorf("ApiKeyIndex should not be larger than %d", MaxApiKeyIndex) ErrPublicPoolIndexTooLow = fmt.Errorf("PublicPoolIndex should not be less than %d", MinAccountIndex) ErrPublicPoolIndexTooHigh = fmt.Errorf("PublicPoolIndex should not be larger than %d", MaxAccountIndex) ErrInvalidPoolOperatorFee = fmt.Errorf("PoolOperatorFee should be larger than 0 and not larger than %d", FeeTick) ErrInvalidPoolStatus = fmt.Errorf("PoolStatus should be either 0 or 1") ErrWithdrawalAmountTooLow = fmt.Errorf("WithdrawalAmount should be larger than %d", MinWithdrawalAmount) ErrWithdrawalAmountTooHigh = fmt.Errorf("WithdrawalAmount should not be larger than %d", MaxWithdrawalAmount) ErrTransferAmountTooLow = fmt.Errorf("TransferAmount should be larger than %d", MinTransferAmount) ErrTransferAmountTooHigh = fmt.Errorf("TransferAmount should not be larger than %d", MaxTransferAmount) ErrTransferFeeNegative = fmt.Errorf("TransferFee should not be negative") ErrTransferFeeTooHigh = fmt.Errorf("TransferFee should not be larger than %d", MaxTransferAmount) ErrMarketIndexTooLow = fmt.Errorf("MarketIndex should not be less than %d", MinMarketIndex) ErrMarketIndexTooHigh = fmt.Errorf("MarketIndex should not be larger than %d", MaxSpotMarketIndex) ErrMarketIndexMismatch = fmt.Errorf("MarketIndex should match the market index of the order") ErrInvalidMarketIndex = fmt.Errorf("MarketIndex is not valid") ErrInitialMarginFractionTooLow = fmt.Errorf("InitialMarginFraction should not be less than %d", 0) ErrInitialMarginFractionTooHigh = fmt.Errorf("InitialMarginFraction should not be larger than %d", MarginFractionTick) ErrClientOrderIndexTooLow = fmt.Errorf("ClientOrderIndex should not be less than %d", MinClientOrderIndex) ErrClientOrderIndexTooHigh = fmt.Errorf("ClientOrderIndex should not be larger than %d", MaxClientOrderIndex) ErrClientOrderIndexNotNil = fmt.Errorf("ClientOrderIndex should be nil") ErrOrderIndexTooLow = fmt.Errorf("OrderIndex should not be less than %d", MinOrderIndex) ErrOrderIndexTooHigh = fmt.Errorf("OrderIndex should not be larger than %d", MaxOrderIndex) ErrBaseAmountTooLow = fmt.Errorf("BaseAmount should not be less than %d", MinOrderBaseAmount) ErrBaseAmountTooHigh = fmt.Errorf("BaseAmount should not be larger than %d", MaxOrderBaseAmount) ErrBaseAmountsNotEqual = fmt.Errorf("BaseAmounts should be equal") ErrBaseAmountNotNil = fmt.Errorf("BaseAmount should be nil") ErrPriceTooLow = fmt.Errorf("OrderPrice should not be less than %d", MinOrderPrice) ErrPriceTooHigh = fmt.Errorf("OrderPrice should not be larger than %d", MaxOrderPrice) ErrIsAskInvalid = fmt.Errorf("IsAsk should be 0 or 1") ErrOrderTypeInvalid = fmt.Errorf("OrderType is not valid") ErrOrderTimeInForceInvalid = fmt.Errorf("OrderTimeInForce is not valid") ErrGroupingTypeInvalid = fmt.Errorf("GroupingType is not valid") ErrOrderGroupSizeInvalid = fmt.Errorf("OrderGroupSize is not valid") ErrInvalidSignature = fmt.Errorf("TxSignature is invalid") ErrInvalidMarginMode = fmt.Errorf("MarginMode is not valid") ErrCancelModeInvalid = fmt.Errorf("CancelMode is not valid") ErrInvalidUpdateMarginDirection = fmt.Errorf("margin movement direction is not valid") )
Functions ¶
func IsValidPubKeyLength ¶
func IsZeroByteSlice ¶
Types ¶
type L2BurnSharesTxInfo ¶
type L2BurnSharesTxInfo struct {
}
func (*L2BurnSharesTxInfo) GetTxHash ¶
func (txInfo *L2BurnSharesTxInfo) GetTxHash() string
func (*L2BurnSharesTxInfo) GetTxInfo ¶
func (txInfo *L2BurnSharesTxInfo) GetTxInfo() (string, error)
func (*L2BurnSharesTxInfo) GetTxType ¶
func (txInfo *L2BurnSharesTxInfo) GetTxType() uint8
func (*L2BurnSharesTxInfo) Validate ¶
func (txInfo *L2BurnSharesTxInfo) Validate() error
type L2CancelAllOrdersTxInfo ¶
type L2CancelAllOrdersTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
TimeInForce uint8
Time int64
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2CancelAllOrdersTxInfo) GetTxHash ¶
func (txInfo *L2CancelAllOrdersTxInfo) GetTxHash() string
func (*L2CancelAllOrdersTxInfo) GetTxInfo ¶
func (txInfo *L2CancelAllOrdersTxInfo) GetTxInfo() (string, error)
func (*L2CancelAllOrdersTxInfo) GetTxType ¶
func (txInfo *L2CancelAllOrdersTxInfo) GetTxType() uint8
func (*L2CancelAllOrdersTxInfo) Validate ¶
func (txInfo *L2CancelAllOrdersTxInfo) Validate() error
type L2CancelOrderTxInfo ¶
type L2CancelOrderTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
MarketIndex int16
Index int64 // Client Order Index or Order Index of the order to cancel
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2CancelOrderTxInfo) GetTxHash ¶
func (txInfo *L2CancelOrderTxInfo) GetTxHash() string
func (*L2CancelOrderTxInfo) GetTxInfo ¶
func (txInfo *L2CancelOrderTxInfo) GetTxInfo() (string, error)
func (*L2CancelOrderTxInfo) GetTxType ¶
func (txInfo *L2CancelOrderTxInfo) GetTxType() uint8
func (*L2CancelOrderTxInfo) Validate ¶
func (txInfo *L2CancelOrderTxInfo) Validate() error
type L2ChangePubKeyTxInfo ¶
type L2ChangePubKeyTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
PubKey []byte
L1Sig string
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2ChangePubKeyTxInfo) GetL1AddressBySignature ¶
func (txInfo *L2ChangePubKeyTxInfo) GetL1AddressBySignature() common.Address
func (*L2ChangePubKeyTxInfo) GetL1SignatureBody ¶
func (txInfo *L2ChangePubKeyTxInfo) GetL1SignatureBody() string
func (*L2ChangePubKeyTxInfo) GetTxHash ¶
func (txInfo *L2ChangePubKeyTxInfo) GetTxHash() string
func (*L2ChangePubKeyTxInfo) GetTxInfo ¶
func (txInfo *L2ChangePubKeyTxInfo) GetTxInfo() (string, error)
func (*L2ChangePubKeyTxInfo) GetTxType ¶
func (txInfo *L2ChangePubKeyTxInfo) GetTxType() uint8
func (*L2ChangePubKeyTxInfo) MarshalJSON ¶
func (txInfo *L2ChangePubKeyTxInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling to encode PubKey and Sig as hex strings
func (*L2ChangePubKeyTxInfo) SetL1Sig ¶
func (txInfo *L2ChangePubKeyTxInfo) SetL1Sig(sig string)
SetL1Sig sets the L1 (Ethereum) signature on the transaction
func (*L2ChangePubKeyTxInfo) Validate ¶
func (txInfo *L2ChangePubKeyTxInfo) Validate() error
type L2CreateGroupedOrdersTxInfo ¶
type L2CreateGroupedOrdersTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
GroupingType uint8
Orders []*OrderInfo
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
!!! Ensure that if primary order is reduce only, all child orders are also reduce only !!! Otherwise CancelPositionTiedAccountOrders flow breaks
func (*L2CreateGroupedOrdersTxInfo) GetTxHash ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxHash() string
func (*L2CreateGroupedOrdersTxInfo) GetTxInfo ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxInfo() (string, error)
func (*L2CreateGroupedOrdersTxInfo) GetTxType ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) GetTxType() uint8
func (*L2CreateGroupedOrdersTxInfo) Validate ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) Validate() error
func (*L2CreateGroupedOrdersTxInfo) ValidateChildOrder ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateChildOrder(order *OrderInfo) error
func (*L2CreateGroupedOrdersTxInfo) ValidateOCO ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOCO() error
func (*L2CreateGroupedOrdersTxInfo) ValidateOTO ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOTO() error
func (*L2CreateGroupedOrdersTxInfo) ValidateOTOCO ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateOTOCO() error
func (*L2CreateGroupedOrdersTxInfo) ValidateParentOrder ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateParentOrder(order *OrderInfo) error
func (*L2CreateGroupedOrdersTxInfo) ValidateSiblingOrders ¶
func (txInfo *L2CreateGroupedOrdersTxInfo) ValidateSiblingOrders(orders []*OrderInfo) error
type L2CreateOrderTxInfo ¶
type L2CreateOrderTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
*OrderInfo
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2CreateOrderTxInfo) GetTxHash ¶
func (txInfo *L2CreateOrderTxInfo) GetTxHash() string
func (*L2CreateOrderTxInfo) GetTxInfo ¶
func (txInfo *L2CreateOrderTxInfo) GetTxInfo() (string, error)
func (*L2CreateOrderTxInfo) GetTxType ¶
func (txInfo *L2CreateOrderTxInfo) GetTxType() uint8
func (*L2CreateOrderTxInfo) Validate ¶
func (txInfo *L2CreateOrderTxInfo) Validate() error
type L2CreatePublicPoolTxInfo ¶
type L2CreatePublicPoolTxInfo struct {
AccountIndex int64 // Master account index
ApiKeyIndex uint8
OperatorFee int64
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2CreatePublicPoolTxInfo) GetTxHash ¶
func (txInfo *L2CreatePublicPoolTxInfo) GetTxHash() string
func (*L2CreatePublicPoolTxInfo) GetTxInfo ¶
func (txInfo *L2CreatePublicPoolTxInfo) GetTxInfo() (string, error)
func (*L2CreatePublicPoolTxInfo) GetTxType ¶
func (txInfo *L2CreatePublicPoolTxInfo) GetTxType() uint8
func (*L2CreatePublicPoolTxInfo) Validate ¶
func (txInfo *L2CreatePublicPoolTxInfo) Validate() error
type L2CreateSubAccountTxInfo ¶
type L2CreateSubAccountTxInfo struct {
AccountIndex int64 // Master account index
ApiKeyIndex uint8
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2CreateSubAccountTxInfo) GetTxHash ¶
func (txInfo *L2CreateSubAccountTxInfo) GetTxHash() string
func (*L2CreateSubAccountTxInfo) GetTxInfo ¶
func (txInfo *L2CreateSubAccountTxInfo) GetTxInfo() (string, error)
func (*L2CreateSubAccountTxInfo) GetTxType ¶
func (txInfo *L2CreateSubAccountTxInfo) GetTxType() uint8
func (*L2CreateSubAccountTxInfo) Validate ¶
func (txInfo *L2CreateSubAccountTxInfo) Validate() error
type L2MintSharesTxInfo ¶
type L2MintSharesTxInfo struct {
}
func (*L2MintSharesTxInfo) GetTxHash ¶
func (txInfo *L2MintSharesTxInfo) GetTxHash() string
func (*L2MintSharesTxInfo) GetTxInfo ¶
func (txInfo *L2MintSharesTxInfo) GetTxInfo() (string, error)
func (*L2MintSharesTxInfo) GetTxType ¶
func (txInfo *L2MintSharesTxInfo) GetTxType() uint8
func (*L2MintSharesTxInfo) Validate ¶
func (txInfo *L2MintSharesTxInfo) Validate() error
type L2ModifyOrderTxInfo ¶
type L2ModifyOrderTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
MarketIndex int16
Index int64 // Client Order Index or Order Index of the order to modify
BaseAmount int64
Price uint32
TriggerPrice uint32
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2ModifyOrderTxInfo) GetTxHash ¶
func (txInfo *L2ModifyOrderTxInfo) GetTxHash() string
func (*L2ModifyOrderTxInfo) GetTxInfo ¶
func (txInfo *L2ModifyOrderTxInfo) GetTxInfo() (string, error)
func (*L2ModifyOrderTxInfo) GetTxType ¶
func (txInfo *L2ModifyOrderTxInfo) GetTxType() uint8
func (*L2ModifyOrderTxInfo) Validate ¶
func (txInfo *L2ModifyOrderTxInfo) Validate() error
type L2TransferTxInfo ¶
type L2TransferTxInfo struct {
FromAccountIndex int64
ApiKeyIndex uint8
ToAccountIndex int64
AssetIndex int16
FromRouteType uint8
ToRouteType uint8
Amount int64
USDCFee int64
Memo [32]byte
ExpiredAt int64
Nonce int64
Sig []byte
L1Sig string
SignedHash string `json:"-"`
}
func (*L2TransferTxInfo) GetL1AddressBySignature ¶
func (txInfo *L2TransferTxInfo) GetL1AddressBySignature(chainId uint32) common.Address
func (*L2TransferTxInfo) GetL1SignatureBody ¶
func (txInfo *L2TransferTxInfo) GetL1SignatureBody(chainId uint32) string
func (*L2TransferTxInfo) GetTxHash ¶
func (txInfo *L2TransferTxInfo) GetTxHash() string
func (*L2TransferTxInfo) GetTxInfo ¶
func (txInfo *L2TransferTxInfo) GetTxInfo() (string, error)
func (*L2TransferTxInfo) GetTxType ¶
func (txInfo *L2TransferTxInfo) GetTxType() uint8
func (*L2TransferTxInfo) SetL1Sig ¶
func (txInfo *L2TransferTxInfo) SetL1Sig(sig string)
SetL1Sig sets the L1 (Ethereum) signature on the transaction
func (*L2TransferTxInfo) Validate ¶
func (txInfo *L2TransferTxInfo) Validate() error
type L2UpdateLeverageTxInfo ¶
type L2UpdateLeverageTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
MarketIndex int16
InitialMarginFraction uint16
MarginMode uint8
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2UpdateLeverageTxInfo) GetTxHash ¶
func (txInfo *L2UpdateLeverageTxInfo) GetTxHash() string
func (*L2UpdateLeverageTxInfo) GetTxInfo ¶
func (txInfo *L2UpdateLeverageTxInfo) GetTxInfo() (string, error)
func (*L2UpdateLeverageTxInfo) GetTxType ¶
func (txInfo *L2UpdateLeverageTxInfo) GetTxType() uint8
func (*L2UpdateLeverageTxInfo) Validate ¶
func (txInfo *L2UpdateLeverageTxInfo) Validate() error
type L2UpdateMarginTxInfo ¶
type L2UpdateMarginTxInfo struct {
AccountIndex int64
ApiKeyIndex uint8
MarketIndex int16
USDCAmount int64
Direction uint8
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2UpdateMarginTxInfo) GetTxHash ¶
func (txInfo *L2UpdateMarginTxInfo) GetTxHash() string
func (*L2UpdateMarginTxInfo) GetTxInfo ¶
func (txInfo *L2UpdateMarginTxInfo) GetTxInfo() (string, error)
func (*L2UpdateMarginTxInfo) GetTxType ¶
func (txInfo *L2UpdateMarginTxInfo) GetTxType() uint8
func (*L2UpdateMarginTxInfo) Validate ¶
func (txInfo *L2UpdateMarginTxInfo) Validate() error
type L2UpdatePublicPoolTxInfo ¶
type L2UpdatePublicPoolTxInfo struct {
AccountIndex int64 // Master account index
ApiKeyIndex uint8
PublicPoolIndex int64
Status uint8
OperatorFee int64
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2UpdatePublicPoolTxInfo) GetTxHash ¶
func (txInfo *L2UpdatePublicPoolTxInfo) GetTxHash() string
func (*L2UpdatePublicPoolTxInfo) GetTxInfo ¶
func (txInfo *L2UpdatePublicPoolTxInfo) GetTxInfo() (string, error)
func (*L2UpdatePublicPoolTxInfo) GetTxType ¶
func (txInfo *L2UpdatePublicPoolTxInfo) GetTxType() uint8
func (*L2UpdatePublicPoolTxInfo) Validate ¶
func (txInfo *L2UpdatePublicPoolTxInfo) Validate() error
type L2WithdrawTxInfo ¶
type L2WithdrawTxInfo struct {
FromAccountIndex int64
ApiKeyIndex uint8
AssetIndex int16
RouteType uint8
Amount uint64
ExpiredAt int64
Nonce int64
Sig []byte
SignedHash string `json:"-"`
}
func (*L2WithdrawTxInfo) GetTxHash ¶
func (txInfo *L2WithdrawTxInfo) GetTxHash() string
func (*L2WithdrawTxInfo) GetTxInfo ¶
func (txInfo *L2WithdrawTxInfo) GetTxInfo() (string, error)
func (*L2WithdrawTxInfo) GetTxType ¶
func (txInfo *L2WithdrawTxInfo) GetTxType() uint8
func (*L2WithdrawTxInfo) Validate ¶
func (txInfo *L2WithdrawTxInfo) Validate() error
type PrivateKey ¶
type PrivateKey = curve.ECgFp5Scalar
type TxInfo ¶
type TxInfo interface {
GetTxType() uint8
GetTxInfo() (string, error)
// GetTxHash returns the hash that was signed when creating this transaction.
// The hash coincides with the TxHash received from Lighter after submitting this Tx.
// It can be used to get the TxHash in advance, or to double-check the correctness of the SDK.
// As this hash is signed by the ApiKey, if the value differs than the one computed by the server,
// it'll result in an invalid signature.
// Returns empty string if the Tx is not signed.
GetTxHash() string
Validate() error
Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.