hyperliquid

package module
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 37 Imported by: 8

README

go-hyperliquid

Go Reference Go Report Card CI Coverage Status Go Version

Unofficial Go client for the Hyperliquid exchange API. This implementation follows the same philosophy and patterns as the official Python SDK.

Installation

go get github.com/sonirico/go-hyperliquid

Features

This Go SDK provides full feature parity with the official Python SDK, including:

Trading Features
  • Order Management: Limit orders, market orders, trigger orders, order modifications
  • Position Management: Leverage updates, isolated margin, position closing
  • Bulk Operations: Bulk orders, bulk cancellations, bulk modifications
  • Advanced Trading: Market open/close with slippage protection, scheduled cancellations
  • Builder Support: Order routing through builders with fee structures
Account Management
  • Referral System: Set referral codes, track referral state
  • Sub-Accounts: Create and manage sub-accounts, transfer funds
  • Multi-Signature: Convert to multi-sig, execute multi-sig actions
  • Vault Operations: Vault deposits, withdrawals, and transfers
Asset Management
  • USD Transfers: Cross-chain USD transfers, spot transfers
  • Class Transfers: USD class transfers (perp ↔ spot), perp dex transfers
  • Bridge Operations: Withdraw from bridge with fee management
  • Token Delegation: Stake tokens with validators
  • Spot Trading: Full spot market support
Advanced Features
  • Agent Approval: Approve trading agents with permissions
  • Builder Fee Management: Approve and manage builder fees
  • Big Blocks: Enable/disable big block usage
Deployment Features (Advanced)
  • Spot Deployment: Token registration, genesis, freeze privileges
  • Perp Deployment: Asset registration, oracle management
  • Hyperliquidity: Register hyperliquidity assets
Consensus Layer (Validators)
  • Validator Operations: Register, unregister, profile management
  • Signer Operations: Jail/unjail self, inner actions
  • Consensus Actions: Full consensus layer interaction
WebSocket Features
  • Market Data: Real-time L2 book, trades, candles, mid prices
  • User Events: Order updates, fills, funding, ledger updates
  • Advanced Streams: BBO, active asset context, web data v2

Usage

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/crypto"
    hyperliquid "github.com/sonirico/go-hyperliquid"
)

func main() {
    // For trading, create an Exchange with your private key
    privateKey, _ := crypto.HexToECDSA("your-private-key")
    exchange := hyperliquid.NewExchange(
        context.Background(),
        privateKey,
        hyperliquid.MainnetAPIURL,
        nil,    // Meta will be fetched automatically
        "vault-address",
        "account-address",
        nil,    // SpotMeta will be fetched automatically
        nil,    // PerpDexs will be fetched automatically
    )

    // Place a limit order
    order := hyperliquid.OrderRequest{
        Coin:    "BTC",
        IsBuy:   true,
        Size:    0.1,
        LimitPx: 40000.0,
        OrderType: hyperliquid.OrderType{
            Limit: &hyperliquid.LimitOrderType{
                Tif: "Gtc",
            },
        },
    }

    resp, err := exchange.Order(context.Background(), order, nil)
    if err != nil {
        log.Fatal(err)
    }

    // Subscribe to WebSocket updates
    ws := hyperliquid.NewWebsocketClient(hyperliquid.MainnetAPIURL)
    if err := ws.Connect(context.Background()); err != nil {
        log.Fatal(err)
    }
    defer ws.Close()

    // Subscribe to BTC trades
    _, err = ws.Subscribe(hyperliquid.Subscription{
        Type: "trades",
        Coin: "BTC",
    }, func(msg hyperliquid.wsMessage) {
        fmt.Printf("Trade: %+v\n", msg)
    })
}

Documentation

For detailed API documentation, please refer to:

Examples

Check the examples/ directory for more usage examples:

  • WebSocket subscriptions
  • Order management
  • Position handling
  • Market data retrieval

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Contributors

Thanks to all the people who have contributed to this project! 🎉

sonirico
Marquitos
terwey
Yorick Terweijden
standrd
Stan
prasiman
Prasetyo Iman Nugroho
coder-ishan
Ishan Singh
KILLY000
Vernon Stokes
Debuggedd
Alex
MarcSky
Levan
ivaaaan
Ivan
hail100
hail100
vyomshm
Vyom
tpkeeper
tpkeeper
feeeei
feeeei
corverroos
corver
boyi
boyi
aaltergot
Alexander Altergot
07Vaishnavi-Singh
Vaiz_07
freeeverett
Everett
andrew-malikov
Andrew Malikov
Quick Start for Contributors
# Clone the repository
git clone https://github.com/sonirico/go-hyperliquid.git
cd go-hyperliquid

# Install dependencies and tools
make deps install-tools

# Run all checks
make ci-full

# Run tests (excluding examples)
make ci-test

Roadmap

✅ Completed Features
  • Complete WebSocket API implementation
  • REST API client
  • All trading operations (orders, positions, leverage)
  • Market data (L2 book, trades, candles, all mids)
  • User account management
  • Referral system implementation
  • Sub-account management
  • Vault operations
  • USD and spot transfers
  • Bridge operations
  • Agent approval system
  • Builder fee management
  • Multi-signature support
  • Token delegation/staking
  • Spot deployment features
  • Perp deployment features
  • Consensus layer (validator operations)
  • Full feature parity with Python SDK
🚀 Future Enhancements
  • Enhanced documentation with more examples
  • Performance optimizations
  • Additional testing and edge case coverage
  • Rate limiting and retry mechanisms
  • Monitoring and observability features
  • Order management
  • User account operations
  • Advanced order types
  • Historical data API
  • Rate limiting improvements
  • Connection pooling

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Overview

Package hyperliquid provides a Go client library for the Hyperliquid exchange API. It includes support for both REST API and WebSocket connections, allowing users to access market data, manage orders, and handle user account operations.

Index

Constants

View Source
const (
	MainnetAPIURL = "https://api.hyperliquid.xyz"
	TestnetAPIURL = "https://api.hyperliquid-testnet.xyz"
	LocalAPIURL   = "http://localhost:3001"
)
View Source
const (
	ChannelPong               string = "pong"
	ChannelTrades             string = "trades"
	ChannelActiveAssetCtx     string = "activeAssetCtx"
	ChannelL2Book             string = "l2Book"
	ChannelCandle             string = "candle"
	ChannelAllMids            string = "allMids"
	ChannelNotification       string = "notification"
	ChannelOrderUpdates       string = "orderUpdates"
	ChannelUserFills          string = "userFills"
	ChannelWebData2           string = "webData2"
	ChannelBbo                string = "bbo"
	ChannelSubResponse        string = "subscriptionResponse"
	ChannelClearinghouseState string = "clearinghouseState"
	ChannelOpenOrders         string = "openOrders"
	ChannelTwapStates         string = "twapStates"
	ChannelWebData3           string = "webData3"
)
View Source
const (
	DefaultSlippage = 0.05 // 5%
)

Constants for default values

Variables

This section is empty.

Functions

func FloatToUsdInt added in v0.4.0

func FloatToUsdInt(value float64) int

FloatToUsdInt converts float to USD integer representation

func GetTimestampMs added in v0.4.0

func GetTimestampMs() int64

GetTimestampMs returns current timestamp in milliseconds

func IsWalletDoesNotExistError added in v0.16.3

func IsWalletDoesNotExistError(err error) bool

IsWalletDoesNotExistError checks if the error is a "wallet does not exist" error from the API

func NewMsgDispatcher added in v0.7.0

func NewMsgDispatcher[T subscriptable](channel string) msgDispatcher

func NewNoopDispatcher added in v0.7.0

func NewNoopDispatcher() msgDispatcher

func NewPongDispatcher added in v0.8.0

func NewPongDispatcher() msgDispatcher

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"msg"`
	Data    any    `json:"data,omitempty"`
}

func (APIError) Error

func (e APIError) Error() string

func (APIError) MarshalEasyJSON added in v0.6.0

func (v APIError) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (APIError) MarshalJSON added in v0.6.0

func (v APIError) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*APIError) UnmarshalEasyJSON added in v0.6.0

func (v *APIError) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*APIError) UnmarshalJSON added in v0.6.0

func (v *APIError) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type APIResponse added in v0.4.2

type APIResponse[T any] struct {
	Status string
	Data   T
	Type   string
	Err    string
	Ok     bool
}

func (*APIResponse[T]) UnmarshalJSON added in v0.4.2

func (r *APIResponse[T]) UnmarshalJSON(data []byte) error

type AccountHistory added in v0.35.0

type AccountHistory struct {
	AccountValueHistory []MixedArray `json:"accountValueHistory"` // [timestamp, value]
	PnlHistory          []MixedArray `json:"pnlHistory"`          // [timestamp, value]
	Vlm                 string       `json:"vlm"`
}

AccountHistory represents historical portfolio data for a specific time range

func (AccountHistory) MarshalEasyJSON added in v0.35.0

func (v AccountHistory) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AccountHistory) MarshalJSON added in v0.35.0

func (v AccountHistory) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AccountHistory) UnmarshalEasyJSON added in v0.35.0

func (v *AccountHistory) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AccountHistory) UnmarshalJSON added in v0.35.0

func (v *AccountHistory) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ActiveAssetCtx added in v0.20.0

type ActiveAssetCtx struct {
	Coin string         `json:"coin"`
	Ctx  SharedAssetCtx `json:"ctx"`
}

func (ActiveAssetCtx) Key added in v0.20.0

func (a ActiveAssetCtx) Key() string

func (ActiveAssetCtx) MarshalEasyJSON added in v0.20.0

func (v ActiveAssetCtx) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ActiveAssetCtx) MarshalJSON added in v0.20.0

func (v ActiveAssetCtx) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ActiveAssetCtx) UnmarshalEasyJSON added in v0.20.0

func (v *ActiveAssetCtx) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ActiveAssetCtx) UnmarshalJSON added in v0.20.0

func (v *ActiveAssetCtx) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ActiveAssetCtxSubscriptionParams added in v0.20.0

type ActiveAssetCtxSubscriptionParams struct {
	Coin string
}

type AgentApprovalResponse added in v0.4.1

type AgentApprovalResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (AgentApprovalResponse) MarshalEasyJSON added in v0.4.1

func (v AgentApprovalResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AgentApprovalResponse) MarshalJSON added in v0.4.1

func (v AgentApprovalResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AgentApprovalResponse) UnmarshalEasyJSON added in v0.4.1

func (v *AgentApprovalResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AgentApprovalResponse) UnmarshalJSON added in v0.4.1

func (v *AgentApprovalResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AgentSigner added in v0.34.0

type AgentSigner interface {
	SignAgent(
		ctx context.Context,
		agentAddress, agentName string,
		nonce int64,
		isMainnet bool,
	) (SignatureResult, error)
}

AgentSigner signs agent approval actions. When nil on Exchange, the default ECDSA implementation is used.

func ECDSAAgentSigner added in v0.34.0

func ECDSAAgentSigner(pk *ecdsa.PrivateKey) AgentSigner

ECDSAAgentSigner implements AgentSigner using an ECDSA private key.

type AllMids added in v0.8.0

type AllMids struct {
	Mids map[string]string `json:"mids"`
}

func (AllMids) Key added in v0.8.0

func (a AllMids) Key() string

func (AllMids) MarshalEasyJSON added in v0.8.0

func (v AllMids) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AllMids) MarshalJSON added in v0.8.0

func (v AllMids) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AllMids) UnmarshalEasyJSON added in v0.8.0

func (v *AllMids) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AllMids) UnmarshalJSON added in v0.8.0

func (v *AllMids) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AllMidsSubscriptionParams added in v0.8.0

type AllMidsSubscriptionParams struct {
	Dex *string
}

type ApprovalResponse added in v0.4.1

type ApprovalResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (ApprovalResponse) MarshalEasyJSON added in v0.4.1

func (v ApprovalResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ApprovalResponse) MarshalJSON added in v0.4.1

func (v ApprovalResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ApprovalResponse) UnmarshalEasyJSON added in v0.4.1

func (v *ApprovalResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ApprovalResponse) UnmarshalJSON added in v0.4.1

func (v *ApprovalResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ApproveAgentAction added in v0.4.5

type ApproveAgentAction struct {
	Type             string  `json:"type"                msgpack:"type"`
	SignatureChainId string  `json:"signatureChainId"    msgpack:"signatureChainId"`
	HyperliquidChain string  `json:"hyperliquidChain"    msgpack:"hyperliquidChain"`
	AgentAddress     string  `json:"agentAddress"        msgpack:"agentAddress"`
	AgentName        *string `json:"agentName,omitempty" msgpack:"agentName,omitempty"`
	Nonce            int64   `json:"nonce"               msgpack:"nonce"`
}

ApproveAgentAction represents approve agent action

func (ApproveAgentAction) MarshalEasyJSON added in v0.6.0

func (v ApproveAgentAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ApproveAgentAction) MarshalJSON added in v0.6.0

func (v ApproveAgentAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ApproveAgentAction) UnmarshalEasyJSON added in v0.6.0

func (v *ApproveAgentAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ApproveAgentAction) UnmarshalJSON added in v0.6.0

func (v *ApproveAgentAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ApproveBuilderFeeAction added in v0.4.5

type ApproveBuilderFeeAction struct {
	Type       string `json:"type"       msgpack:"type"`
	Builder    string `json:"builder"    msgpack:"builder"`
	MaxFeeRate string `json:"maxFeeRate" msgpack:"maxFeeRate"`
	Nonce      int64  `json:"nonce"      msgpack:"nonce"`
}

ApproveBuilderFeeAction represents approve builder fee action

func (ApproveBuilderFeeAction) MarshalEasyJSON added in v0.6.0

func (v ApproveBuilderFeeAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ApproveBuilderFeeAction) MarshalJSON added in v0.6.0

func (v ApproveBuilderFeeAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ApproveBuilderFeeAction) UnmarshalEasyJSON added in v0.6.0

func (v *ApproveBuilderFeeAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ApproveBuilderFeeAction) UnmarshalJSON added in v0.6.0

func (v *ApproveBuilderFeeAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AssetCtx added in v0.6.2

type AssetCtx struct {
	Funding      string   `json:"funding"`
	OpenInterest string   `json:"openInterest"`
	PrevDayPx    string   `json:"prevDayPx"`
	DayNtlVlm    string   `json:"dayNtlVlm"`
	Premium      string   `json:"premium"`
	OraclePx     string   `json:"oraclePx"`
	MarkPx       string   `json:"markPx"`
	MidPx        string   `json:"midPx,omitempty"`
	ImpactPxs    []string `json:"impactPxs"`
	DayBaseVlm   string   `json:"dayBaseVlm,omitempty"`
}

func (AssetCtx) MarshalEasyJSON added in v0.6.2

func (v AssetCtx) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AssetCtx) MarshalJSON added in v0.6.2

func (v AssetCtx) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AssetCtx) UnmarshalEasyJSON added in v0.6.2

func (v *AssetCtx) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AssetCtx) UnmarshalJSON added in v0.6.2

func (v *AssetCtx) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AssetInfo

type AssetInfo struct {
	Name          string `json:"name"`
	SzDecimals    int    `json:"szDecimals"`
	MaxLeverage   int    `json:"maxLeverage"`
	MarginTableId int    `json:"marginTableId"`
	OnlyIsolated  bool   `json:"onlyIsolated"`
	IsDelisted    bool   `json:"isDelisted"`
}

func (AssetInfo) MarshalEasyJSON added in v0.2.0

func (v AssetInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AssetInfo) MarshalJSON added in v0.2.0

func (v AssetInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AssetInfo) UnmarshalEasyJSON added in v0.2.0

func (v *AssetInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AssetInfo) UnmarshalJSON added in v0.2.0

func (v *AssetInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AssetPosition

type AssetPosition struct {
	Position Position `json:"position"`
	Type     string   `json:"type"`
}

func (AssetPosition) MarshalEasyJSON added in v0.2.0

func (v AssetPosition) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AssetPosition) MarshalJSON added in v0.2.0

func (v AssetPosition) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AssetPosition) UnmarshalEasyJSON added in v0.2.0

func (v *AssetPosition) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AssetPosition) UnmarshalJSON added in v0.2.0

func (v *AssetPosition) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AssetRequest added in v0.31.0

type AssetRequest struct {
	Coin          string `json:"coin"          msgpack:"coin"`
	SzDecimals    int    `json:"szDecimals"    msgpack:"szDecimals"`
	OraclePx      string `json:"oraclePx"      msgpack:"oraclePx"`
	MarginTableID int    `json:"marginTableId" msgpack:"marginTableId"`
	OnlyIsolated  bool   `json:"onlyIsolated"  msgpack:"onlyIsolated"`
}

func (AssetRequest) MarshalEasyJSON added in v0.31.0

func (v AssetRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AssetRequest) MarshalJSON added in v0.31.0

func (v AssetRequest) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AssetRequest) UnmarshalEasyJSON added in v0.31.0

func (v *AssetRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AssetRequest) UnmarshalJSON added in v0.31.0

func (v *AssetRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AssetRequest2 added in v0.31.0

type AssetRequest2 struct {
	Coin          string `json:"coin"          msgpack:"coin"`
	SzDecimals    int    `json:"szDecimals"    msgpack:"szDecimals"`
	OraclePx      string `json:"oraclePx"      msgpack:"oraclePx"`
	MarginTableID int    `json:"marginTableId" msgpack:"marginTableId"`
	MarginMode    string `json:"marginMode"    msgpack:"marginMode"`
}

func (AssetRequest2) MarshalEasyJSON added in v0.31.0

func (v AssetRequest2) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AssetRequest2) MarshalJSON added in v0.31.0

func (v AssetRequest2) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AssetRequest2) UnmarshalEasyJSON added in v0.31.0

func (v *AssetRequest2) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AssetRequest2) UnmarshalJSON added in v0.31.0

func (v *AssetRequest2) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BatchModifyAction added in v0.4.5

type BatchModifyAction struct {
	Type     string         `json:"type"          msgpack:"type"`
	Dex      string         `json:"dex,omitempty" msgpack:"dex,omitempty"`
	Modifies []ModifyAction `json:"modifies"      msgpack:"modifies"`
}

BatchModifyAction represents multiple order modifications

func (BatchModifyAction) MarshalEasyJSON added in v0.6.0

func (v BatchModifyAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BatchModifyAction) MarshalJSON added in v0.6.0

func (v BatchModifyAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BatchModifyAction) UnmarshalEasyJSON added in v0.6.0

func (v *BatchModifyAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BatchModifyAction) UnmarshalJSON added in v0.6.0

func (v *BatchModifyAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Bbo added in v0.10.0

type Bbo struct {
	Coin string  `json:"coin"`
	Time int64   `json:"time"`
	Bbo  []Level `json:"bbo"`
}

func (Bbo) Key added in v0.10.0

func (w Bbo) Key() string

func (Bbo) MarshalEasyJSON added in v0.10.0

func (v Bbo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Bbo) MarshalJSON added in v0.10.0

func (v Bbo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Bbo) UnmarshalEasyJSON added in v0.10.0

func (v *Bbo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Bbo) UnmarshalJSON added in v0.10.0

func (v *Bbo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BboSubscriptionParams added in v0.10.0

type BboSubscriptionParams struct {
	Coin string
}

type BuilderInfo

type BuilderInfo struct {
	Builder string `json:"b" msgpack:"b"`
	Fee     int    `json:"f" msgpack:"f"`
}

func (BuilderInfo) MarshalEasyJSON added in v0.2.0

func (v BuilderInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BuilderInfo) MarshalJSON added in v0.2.0

func (v BuilderInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BuilderInfo) UnmarshalEasyJSON added in v0.2.0

func (v *BuilderInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BuilderInfo) UnmarshalJSON added in v0.2.0

func (v *BuilderInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BulkCancelResponse added in v0.4.1

type BulkCancelResponse struct {
	Status string      `json:"status"`
	Data   []OpenOrder `json:"data,omitempty"`
	Error  string      `json:"error,omitempty"`
}

func (BulkCancelResponse) MarshalEasyJSON added in v0.4.1

func (v BulkCancelResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BulkCancelResponse) MarshalJSON added in v0.4.1

func (v BulkCancelResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BulkCancelResponse) UnmarshalEasyJSON added in v0.4.1

func (v *BulkCancelResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BulkCancelResponse) UnmarshalJSON added in v0.4.1

func (v *BulkCancelResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BulkOrderResponse added in v0.4.1

type BulkOrderResponse struct {
	Status string        `json:"status"`
	Data   []OrderStatus `json:"data,omitempty"`
	Error  string        `json:"error,omitempty"`
}

func (BulkOrderResponse) MarshalEasyJSON added in v0.4.1

func (v BulkOrderResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BulkOrderResponse) MarshalJSON added in v0.4.1

func (v BulkOrderResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BulkOrderResponse) UnmarshalEasyJSON added in v0.4.1

func (v *BulkOrderResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BulkOrderResponse) UnmarshalJSON added in v0.4.1

func (v *BulkOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelAction added in v0.4.5

type CancelAction struct {
	Type    string            `json:"type"          msgpack:"type"`
	Dex     string            `json:"dex,omitempty" msgpack:"dex,omitempty"`
	Cancels []CancelOrderWire `json:"cancels"       msgpack:"cancels"`
}

CancelAction represents the cancel action

func (CancelAction) MarshalEasyJSON added in v0.6.0

func (v CancelAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelAction) MarshalJSON added in v0.6.0

func (v CancelAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelAction) UnmarshalEasyJSON added in v0.6.0

func (v *CancelAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelAction) UnmarshalJSON added in v0.6.0

func (v *CancelAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelByCloidAction added in v0.4.5

type CancelByCloidAction struct {
	Type    string              `json:"type"          msgpack:"type"`
	Dex     string              `json:"dex,omitempty" msgpack:"dex,omitempty"`
	Cancels []CancelByCloidWire `json:"cancels"       msgpack:"cancels"`
}

CancelByCloidAction represents the cancel by cloid action

func (CancelByCloidAction) MarshalEasyJSON added in v0.6.0

func (v CancelByCloidAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelByCloidAction) MarshalJSON added in v0.6.0

func (v CancelByCloidAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelByCloidAction) UnmarshalEasyJSON added in v0.6.0

func (v *CancelByCloidAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelByCloidAction) UnmarshalJSON added in v0.6.0

func (v *CancelByCloidAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelByCloidRequest added in v0.4.0

type CancelByCloidRequest struct {
	Coin  string `json:"coin"`
	Cloid string `json:"cloid"`
}

func (CancelByCloidRequest) MarshalEasyJSON added in v0.4.0

func (v CancelByCloidRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelByCloidRequest) MarshalJSON added in v0.4.0

func (v CancelByCloidRequest) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelByCloidRequest) UnmarshalEasyJSON added in v0.4.0

func (v *CancelByCloidRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelByCloidRequest) UnmarshalJSON added in v0.4.0

func (v *CancelByCloidRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelByCloidWire added in v0.4.5

type CancelByCloidWire struct {
	Asset    int    `json:"asset" msgpack:"asset"`
	ClientID string `json:"cloid" msgpack:"cloid"`
}

CancelByCloidWire represents cancel by cloid item wire format NB: the CancelByCloidWire MUST have `asset` and not `o` like CancelOrderWire has See: https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/f19056ca1b65cc15a019d92dffa9ada887b3d808/hyperliquid/exchange.py#L305-L310

func (CancelByCloidWire) MarshalEasyJSON added in v0.6.0

func (v CancelByCloidWire) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelByCloidWire) MarshalJSON added in v0.6.0

func (v CancelByCloidWire) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelByCloidWire) UnmarshalEasyJSON added in v0.6.0

func (v *CancelByCloidWire) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelByCloidWire) UnmarshalJSON added in v0.6.0

func (v *CancelByCloidWire) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelOrderRequest added in v0.4.3

type CancelOrderRequest struct {
	Coin    string
	OrderID int64
}

type CancelOrderRequestByCloid added in v0.4.3

type CancelOrderRequestByCloid struct {
	Coin  string
	Cloid string
}

type CancelOrderResponse added in v0.4.2

type CancelOrderResponse struct {
	Statuses MixedArray
}

type CancelOrderWire added in v0.4.5

type CancelOrderWire struct {
	Asset   int   `json:"a" msgpack:"a"`
	OrderID int64 `json:"o" msgpack:"o"`
}

CancelOrderWire represents cancel order item wire format

func (CancelOrderWire) MarshalEasyJSON added in v0.6.0

func (v CancelOrderWire) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelOrderWire) MarshalJSON added in v0.6.0

func (v CancelOrderWire) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelOrderWire) UnmarshalEasyJSON added in v0.6.0

func (v *CancelOrderWire) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelOrderWire) UnmarshalJSON added in v0.6.0

func (v *CancelOrderWire) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelRequest added in v0.4.0

type CancelRequest struct {
	Coin string `json:"coin"`
	Oid  int64  `json:"oid"`
}

func (CancelRequest) MarshalEasyJSON added in v0.4.0

func (v CancelRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelRequest) MarshalJSON added in v0.4.0

func (v CancelRequest) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelRequest) UnmarshalEasyJSON added in v0.4.0

func (v *CancelRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelRequest) UnmarshalJSON added in v0.4.0

func (v *CancelRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CancelResponse added in v0.4.1

type CancelResponse struct {
	Status string     `json:"status"`
	Data   *OpenOrder `json:"data,omitempty"`
	Error  string     `json:"error,omitempty"`
}

func (CancelResponse) MarshalEasyJSON added in v0.4.1

func (v CancelResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CancelResponse) MarshalJSON added in v0.4.1

func (v CancelResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CancelResponse) UnmarshalEasyJSON added in v0.4.1

func (v *CancelResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CancelResponse) UnmarshalJSON added in v0.4.1

func (v *CancelResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Candle

type Candle struct {
	TimeOpen    int64  `json:"t"` // open millis
	TimeClose   int64  `json:"T"` // close millis
	Interval    string `json:"i"` // interval
	TradesCount int    `json:"n"` // number of trades
	Open        string `json:"o"` // open price
	High        string `json:"h"` // high price
	Low         string `json:"l"` // low price
	Close       string `json:"c"` // close price
	Symbol      string `json:"s"` // coin
	Volume      string `json:"v"` // volume (base unit)
}

func (Candle) Key added in v0.19.0

func (c Candle) Key() string

func (Candle) MarshalEasyJSON added in v0.2.0

func (v Candle) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Candle) MarshalJSON added in v0.2.0

func (v Candle) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Candle) UnmarshalEasyJSON added in v0.2.0

func (v *Candle) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Candle) UnmarshalJSON added in v0.2.0

func (v *Candle) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CandlesSubscriptionParams added in v0.7.0

type CandlesSubscriptionParams struct {
	Coin     string
	Interval string
}

type ClearinghouseState added in v0.8.0

type ClearinghouseState struct {
	MarginSummary              *MarginSummary  `json:"marginSummary,omitempty"`
	CrossMarginSummary         *MarginSummary  `json:"crossMarginSummary,omitempty"`
	CrossMaintenanceMarginUsed string          `json:"crossMaintenanceMarginUsed,omitempty"`
	Withdrawable               string          `json:"withdrawable,omitempty"`
	AssetPositions             []AssetPosition `json:"assetPositions,omitempty"`
	Time                       int64           `json:"time,omitempty"`
}

func (ClearinghouseState) Key added in v0.25.0

func (c ClearinghouseState) Key() string

func (ClearinghouseState) MarshalEasyJSON added in v0.8.0

func (v ClearinghouseState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ClearinghouseState) MarshalJSON added in v0.8.0

func (v ClearinghouseState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ClearinghouseState) UnmarshalEasyJSON added in v0.8.0

func (v *ClearinghouseState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ClearinghouseState) UnmarshalJSON added in v0.8.0

func (v *ClearinghouseState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ClearinghouseStateMessage added in v0.27.0

type ClearinghouseStateMessage struct {
	Dex                string             `json:"dex,omitempty"`
	User               string             `json:"user,omitempty"`
	ClearinghouseState ClearinghouseState `json:"clearinghouseState"`
}

func (ClearinghouseStateMessage) Key added in v0.27.0

func (ClearinghouseStateMessage) MarshalEasyJSON added in v0.27.0

func (v ClearinghouseStateMessage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ClearinghouseStateMessage) MarshalJSON added in v0.27.0

func (v ClearinghouseStateMessage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ClearinghouseStateMessage) UnmarshalEasyJSON added in v0.27.0

func (v *ClearinghouseStateMessage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ClearinghouseStateMessage) UnmarshalJSON added in v0.27.0

func (v *ClearinghouseStateMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ClearinghouseStateSubscriptionParams added in v0.25.0

type ClearinghouseStateSubscriptionParams struct {
	User string
	Dex  *string
}

type ClientOpt added in v0.9.0

type ClientOpt = Opt[client]

func ClientOptHTTPClient added in v0.30.0

func ClientOptHTTPClient(httpClient *http.Client) ClientOpt

ClientOptHTTPClient allows setting a custom http.Client

type Cloid added in v0.4.0

type Cloid struct {
	Value string
}

func (Cloid) MarshalEasyJSON added in v0.4.0

func (v Cloid) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Cloid) MarshalJSON added in v0.4.0

func (v Cloid) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Cloid) ToRaw added in v0.4.0

func (c Cloid) ToRaw() string

func (*Cloid) UnmarshalEasyJSON added in v0.4.0

func (v *Cloid) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Cloid) UnmarshalJSON added in v0.4.0

func (v *Cloid) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ConvertToMultiSigUserAction added in v0.4.5

type ConvertToMultiSigUserAction struct {
	Type    string `json:"type"    msgpack:"type"`
	Signers string `json:"signers" msgpack:"signers"`
	Nonce   int64  `json:"nonce"   msgpack:"nonce"`
}

ConvertToMultiSigUserAction represents convert to multi-sig user action

func (ConvertToMultiSigUserAction) MarshalEasyJSON added in v0.6.0

func (v ConvertToMultiSigUserAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ConvertToMultiSigUserAction) MarshalJSON added in v0.6.0

func (v ConvertToMultiSigUserAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ConvertToMultiSigUserAction) UnmarshalEasyJSON added in v0.6.0

func (v *ConvertToMultiSigUserAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ConvertToMultiSigUserAction) UnmarshalJSON added in v0.6.0

func (v *ConvertToMultiSigUserAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CreateOrderRequest added in v0.4.2

type CreateOrderRequest struct {
	Coin          string
	IsBuy         bool
	Price         float64
	Size          float64
	ReduceOnly    bool
	OrderType     OrderType
	ClientOrderID *string
}

func (*CreateOrderRequest) String added in v0.11.0

func (s *CreateOrderRequest) String() string

type CreateSubAccountAction added in v0.4.5

type CreateSubAccountAction struct {
	Type string `json:"type" msgpack:"type"`
	Name string `json:"name" msgpack:"name"`
}

CreateSubAccountAction represents create sub-account action

func (CreateSubAccountAction) MarshalEasyJSON added in v0.6.0

func (v CreateSubAccountAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CreateSubAccountAction) MarshalJSON added in v0.6.0

func (v CreateSubAccountAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CreateSubAccountAction) UnmarshalEasyJSON added in v0.6.0

func (v *CreateSubAccountAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateSubAccountAction) UnmarshalJSON added in v0.6.0

func (v *CreateSubAccountAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CreateSubAccountResponse added in v0.4.1

type CreateSubAccountResponse struct {
	Status string      `json:"status"`
	Data   *SubAccount `json:"data,omitempty"`
	Error  string      `json:"error,omitempty"`
}

func (CreateSubAccountResponse) MarshalEasyJSON added in v0.4.1

func (v CreateSubAccountResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CreateSubAccountResponse) MarshalJSON added in v0.4.1

func (v CreateSubAccountResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CreateSubAccountResponse) UnmarshalEasyJSON added in v0.4.1

func (v *CreateSubAccountResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateSubAccountResponse) UnmarshalJSON added in v0.4.1

func (v *CreateSubAccountResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CreateVaultAction added in v0.6.0

type CreateVaultAction struct {
	Type        string `json:"type"        msgpack:"type"`
	Name        string `json:"name"        msgpack:"name"`
	Description string `json:"description" msgpack:"description"`
	InitialUsd  int    `json:"initialUsd"  msgpack:"initialUsd"`
}

CreateVaultAction represents create vault action

func (CreateVaultAction) MarshalEasyJSON added in v0.6.0

func (v CreateVaultAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CreateVaultAction) MarshalJSON added in v0.6.0

func (v CreateVaultAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CreateVaultAction) UnmarshalEasyJSON added in v0.6.0

func (v *CreateVaultAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateVaultAction) UnmarshalJSON added in v0.6.0

func (v *CreateVaultAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CreateVaultResponse added in v0.6.0

type CreateVaultResponse struct {
	Status string `json:"status"`
	Data   string `json:"data,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (CreateVaultResponse) MarshalEasyJSON added in v0.6.0

func (v CreateVaultResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CreateVaultResponse) MarshalJSON added in v0.6.0

func (v CreateVaultResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CreateVaultResponse) UnmarshalEasyJSON added in v0.6.0

func (v *CreateVaultResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CreateVaultResponse) UnmarshalJSON added in v0.6.0

func (v *CreateVaultResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CumFunding added in v0.24.0

type CumFunding struct {
	AllTime     string `json:"allTime"`
	SinceChange string `json:"sinceChange"`
	SinceOpen   string `json:"sinceOpen"`
}

func (CumFunding) MarshalEasyJSON added in v0.24.0

func (v CumFunding) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CumFunding) MarshalJSON added in v0.24.0

func (v CumFunding) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CumFunding) UnmarshalEasyJSON added in v0.24.0

func (v *CumFunding) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CumFunding) UnmarshalJSON added in v0.24.0

func (v *CumFunding) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Delta added in v0.25.0

type Delta struct {
	Coin        string `json:"coin"`
	FundingRate string `json:"fundingRate"`
	Size        string `json:"size"`
	Type        string `json:"type"`
	USDC        string `json:"usdc"`
}

func (Delta) MarshalEasyJSON added in v0.25.0

func (v Delta) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Delta) MarshalJSON added in v0.25.0

func (v Delta) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Delta) UnmarshalEasyJSON added in v0.25.0

func (v *Delta) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Delta) UnmarshalJSON added in v0.25.0

func (v *Delta) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type EvmContract added in v0.2.0

type EvmContract struct {
	Address             string `json:"address"`
	EvmExtraWeiDecimals int    `json:"evm_extra_wei_decimals"`
}

func (EvmContract) MarshalEasyJSON added in v0.2.0

func (v EvmContract) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EvmContract) MarshalJSON added in v0.2.0

func (v EvmContract) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EvmContract) UnmarshalEasyJSON added in v0.2.0

func (v *EvmContract) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EvmContract) UnmarshalJSON added in v0.2.0

func (v *EvmContract) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Exchange

type Exchange struct {
	// contains filtered or unexported fields
}

func NewExchange

func NewExchange(
	ctx context.Context,
	privateKey *ecdsa.PrivateKey,
	baseURL string,
	meta *Meta,
	vaultAddr, accountAddr string,
	spotMeta *SpotMeta,
	perpDexs *MixedArray,
	opts ...ExchangeOpt,
) *Exchange

func (*Exchange) ApproveAgent added in v0.4.0

func (e *Exchange) ApproveAgent(
	ctx context.Context,
	name *string,
) (*AgentApprovalResponse, string, error)

ApproveAgent approves an agent to trade on behalf of the user Returns the result and the generated agent private key

func (*Exchange) ApproveBuilderFee added in v0.4.0

func (e *Exchange) ApproveBuilderFee(
	ctx context.Context,
	builder string,
	maxFeeRate string,
) (*ApprovalResponse, error)

ApproveBuilderFee approves builder fee payment

func (*Exchange) BulkCancel added in v0.4.0

func (e *Exchange) BulkCancel(
	ctx context.Context,
	requests []CancelOrderRequest,
) (res *APIResponse[CancelOrderResponse], err error)

func (*Exchange) BulkCancelByCloids added in v0.4.3

func (e *Exchange) BulkCancelByCloids(
	ctx context.Context,
	requests []CancelOrderRequestByCloid,
) (res *APIResponse[CancelOrderResponse], err error)

func (*Exchange) BulkModifyOrders added in v0.4.0

func (e *Exchange) BulkModifyOrders(
	ctx context.Context,
	modifyRequests []ModifyOrderRequest,
) ([]OrderStatus, error)

BulkModifyOrders modifies multiple orders

func (*Exchange) BulkOrders

func (e *Exchange) BulkOrders(
	ctx context.Context,
	orders []CreateOrderRequest,
	builder *BuilderInfo,
) (result *APIResponse[OrderResponse], err error)

func (*Exchange) CSignerInner added in v0.4.0

func (e *Exchange) CSignerInner(
	ctx context.Context,
	innerAction map[string]any,
) (*ValidatorResponse, error)

CSignerInner executes inner consensus signer action

func (*Exchange) CSignerJailSelf added in v0.4.0

func (e *Exchange) CSignerJailSelf(ctx context.Context) (*ValidatorResponse, error)

CSignerJailSelf jails self as consensus signer

func (*Exchange) CSignerUnjailSelf added in v0.4.0

func (e *Exchange) CSignerUnjailSelf(ctx context.Context) (*ValidatorResponse, error)

CSignerUnjailSelf unjails self as consensus signer

func (*Exchange) CValidatorChangeProfile added in v0.4.0

func (e *Exchange) CValidatorChangeProfile(
	ctx context.Context,
	newProfile map[string]any,
) (*ValidatorResponse, error)

CValidatorChangeProfile changes validator profile

func (*Exchange) CValidatorRegister added in v0.4.0

func (e *Exchange) CValidatorRegister(
	ctx context.Context,
	validatorProfile map[string]any,
) (*ValidatorResponse, error)

CValidatorRegister registers as consensus validator

func (*Exchange) CValidatorUnregister added in v0.4.0

func (e *Exchange) CValidatorUnregister(ctx context.Context) (*ValidatorResponse, error)

CValidatorUnregister unregisters as consensus validator

func (*Exchange) Cancel

func (e *Exchange) Cancel(
	ctx context.Context,
	coin string,
	oid int64,
) (res *APIResponse[CancelOrderResponse], err error)

func (*Exchange) CancelByCloid

func (e *Exchange) CancelByCloid(
	ctx context.Context,
	coin, cloid string,
) (res *APIResponse[CancelOrderResponse], err error)

func (*Exchange) ConvertToMultiSigUser added in v0.4.0

func (e *Exchange) ConvertToMultiSigUser(
	ctx context.Context,
	authorizedUsers []string,
	threshold int,
) (*MultiSigConversionResponse, error)

ConvertToMultiSigUser converts account to multi-signature user

func (*Exchange) CreateSubAccount added in v0.4.0

func (e *Exchange) CreateSubAccount(
	ctx context.Context,
	name string,
) (*CreateSubAccountResponse, error)

CreateSubAccount creates a new sub-account

func (*Exchange) CreateVault added in v0.6.0

func (e *Exchange) CreateVault(
	ctx context.Context,
	name string,
	description string,
	initialUsd int,
) (*CreateVaultResponse, error)

CreateVault creates a new vault

func (*Exchange) Info added in v0.16.3

func (e *Exchange) Info() *Info

func (*Exchange) MarketClose added in v0.4.0

func (e *Exchange) MarketClose(
	ctx context.Context,
	coin string,
	sz *float64,
	px *float64,
	slippage float64,
	cloid *string,
	builder *BuilderInfo,
) (OrderStatus, error)

MarketClose closes a position

func (*Exchange) MarketOpen added in v0.4.0

func (e *Exchange) MarketOpen(
	ctx context.Context,
	name string,
	isBuy bool,
	sz float64,
	px *float64,
	slippage float64,
	cloid *string,
	builder *BuilderInfo,
) (res OrderStatus, err error)

MarketOpen opens a market position

func (*Exchange) ModifyOrder added in v0.4.0

func (e *Exchange) ModifyOrder(
	ctx context.Context,
	req ModifyOrderRequest,
) (result OrderStatus, err error)

ModifyOrder modifies an existing order

func (*Exchange) MultiSig added in v0.4.0

func (e *Exchange) MultiSig(
	ctx context.Context,
	action map[string]any,
	signers []string,
	signatures []string,
) (*MultiSigResponse, error)

func (*Exchange) Order

func (e *Exchange) Order(
	ctx context.Context,
	req CreateOrderRequest,
	builder *BuilderInfo,
) (result OrderStatus, err error)

func (*Exchange) PerpDeployHaltTrading added in v0.26.0

func (e *Exchange) PerpDeployHaltTrading(
	ctx context.Context,
	coin string,
	isHalted bool,
) (*PerpDeployResponse, error)

PerpHaltTrading halts or unhalts trading for a builder-deployed DEX

func (*Exchange) PerpDeployRegisterAsset added in v0.4.0

func (e *Exchange) PerpDeployRegisterAsset(
	ctx context.Context,
	dex string,
	maxGas *int,
	assetRequest AssetRequest,
	schema *PerpDexSchemaInput,
) (*PerpDeployResponse, error)

PerpDeployRegisterAsset registers a new perpetual asset on a builder-deployed DEX. Provide schema to also initialize a new dex alongside the asset registration.

func (*Exchange) PerpDeployRegisterAsset2 added in v0.31.0

func (e *Exchange) PerpDeployRegisterAsset2(
	ctx context.Context,
	dex string,
	maxGas *int,
	assetRequest AssetRequest2,
	schema *PerpDexSchemaInput,
) (*PerpDeployResponse, error)

PerpDeployRegisterAsset2 registers a new perpetual asset on a builder-deployed DEX using marginMode instead of onlyIsolated. Provide schema to also initialize a new dex.

func (*Exchange) PerpDeploySetOracle added in v0.4.0

func (e *Exchange) PerpDeploySetOracle(
	ctx context.Context,
	dex string,
	oraclePxs map[string]string,
	allMarkPxs []map[string]string,
	externalPerpPxs map[string]string,
) (*PerpDeployResponse, error)

PerpDeploySetOracle sets oracle prices for a builder-deployed DEX This matches the Python SDK's perp_deploy_set_oracle method oraclePxs: map of coin to oracle price string allMarkPxs: list of maps, each map contains coin to mark price string externalPerpPxs: map of coin to external perp price string

func (*Exchange) PerpDex added in v0.27.0

func (e *Exchange) PerpDex() string

PerpDex returns the configured builder perp dex name (e.g. "flx"), or empty string for default dex.

func (*Exchange) PerpDexClassTransfer added in v0.4.0

func (e *Exchange) PerpDexClassTransfer(
	ctx context.Context,
	dex, token string,
	amount float64,
	toPerp bool,
) (*TransferResponse, error)

PerpDexClassTransfer transfers tokens between perp dex classes

func (*Exchange) Reserve added in v0.33.0

func (e *Exchange) Reserve(ctx context.Context, weight int) (*ReserveRequestWeightResponse, error)

Reserve reserves request weight capacity on the exchange. Each weight unit costs 0.0005 USDC from Perps balance. This increases address-based rate limits without requiring trading volume.

func (*Exchange) ScheduleCancel added in v0.4.0

func (e *Exchange) ScheduleCancel(
	ctx context.Context,
	scheduleTime *int64,
) (*ScheduleCancelResponse, error)

ScheduleCancel schedules cancellation of all open orders

func (*Exchange) SetExpiresAfter added in v0.4.0

func (e *Exchange) SetExpiresAfter(expiresAfter *int64)

SetExpiresAfter sets the expiration time for actions If expiresAfter is nil, actions will not have an expiration time If expiresAfter is set, actions will include this expiration nonce

func (*Exchange) SetLastNonce added in v0.11.0

func (e *Exchange) SetLastNonce(n int64)

SetLastNonce allows for resuming from a persisted nonce, e.g. the nonce was stored before a restart Only useful if a lot of increments happen for unique nonces. Most users do not need this.

func (*Exchange) SetReferrer added in v0.4.0

func (e *Exchange) SetReferrer(ctx context.Context, code string) (*SetReferrerResponse, error)

SetReferrer sets a referral code

func (*Exchange) SlippagePrice added in v0.4.0

func (e *Exchange) SlippagePrice(
	ctx context.Context,
	name string,
	isBuy bool,
	slippage float64,
	px *float64,
) (float64, error)

SlippagePrice calculates the slippage price for market orders

func (*Exchange) SpotDeployEnableFreezePrivilege added in v0.4.0

func (e *Exchange) SpotDeployEnableFreezePrivilege(
	ctx context.Context,
) (*SpotDeployResponse, error)

SpotDeployEnableFreezePrivilege enables freeze privilege for spot deployer

func (*Exchange) SpotDeployFreezeUser added in v0.4.0

func (e *Exchange) SpotDeployFreezeUser(
	ctx context.Context,
	userAddress string,
) (*SpotDeployResponse, error)

SpotDeployFreezeUser freezes a user in spot trading

func (*Exchange) SpotDeployGenesis added in v0.4.0

func (e *Exchange) SpotDeployGenesis(
	ctx context.Context,
	deployer string,
	dexName string,
) (*SpotDeployResponse, error)

SpotDeployGenesis initializes spot genesis

func (*Exchange) SpotDeployRegisterHyperliquidity added in v0.4.0

func (e *Exchange) SpotDeployRegisterHyperliquidity(
	ctx context.Context,
	name string,
	tokens []string,
) (*SpotDeployResponse, error)

SpotDeployRegisterHyperliquidity registers hyperliquidity spot

func (*Exchange) SpotDeployRegisterSpot added in v0.4.0

func (e *Exchange) SpotDeployRegisterSpot(
	ctx context.Context,
	baseToken string,
	quoteToken string,
) (*SpotDeployResponse, error)

SpotDeployRegisterSpot registers spot market

func (*Exchange) SpotDeployRegisterToken added in v0.4.0

func (e *Exchange) SpotDeployRegisterToken(
	ctx context.Context,
	tokenName string,
	szDecimals int,
	weiDecimals int,
	maxGas int,
	fullName string,
) (*SpotDeployResponse, error)

SpotDeployRegisterToken registers a new spot token

func (*Exchange) SpotDeployRevokeFreezePrivilege added in v0.4.0

func (e *Exchange) SpotDeployRevokeFreezePrivilege(
	ctx context.Context,
) (*SpotDeployResponse, error)

SpotDeployRevokeFreezePrivilege revokes freeze privilege for spot deployer

func (*Exchange) SpotDeploySetDeployerTradingFeeShare added in v0.4.0

func (e *Exchange) SpotDeploySetDeployerTradingFeeShare(
	ctx context.Context,
	feeShare float64,
) (*SpotDeployResponse, error)

SpotDeploySetDeployerTradingFeeShare sets deployer trading fee share

func (*Exchange) SpotDeployUserGenesis added in v0.4.0

func (e *Exchange) SpotDeployUserGenesis(
	ctx context.Context,
	balances map[string]float64,
) (*SpotDeployResponse, error)

SpotDeployUserGenesis initializes user genesis for spot trading

func (*Exchange) SpotTransfer added in v0.4.0

func (e *Exchange) SpotTransfer(
	ctx context.Context,
	amount float64,
	destination, token string,
) (*TransferResponse, error)

SpotTransfer transfers spot tokens to another address

func (*Exchange) SubAccountSpotTransfer added in v0.4.0

func (e *Exchange) SubAccountSpotTransfer(
	ctx context.Context,
	subAccountUser string,
	isDeposit bool,
	token string,
	amount float64,
) (*TransferResponse, error)

SubAccountSpotTransfer transfers spot tokens to/from sub-account

func (*Exchange) SubAccountTransfer added in v0.4.0

func (e *Exchange) SubAccountTransfer(
	ctx context.Context,
	subAccountUser string,
	isDeposit bool,
	usd int,
) (*TransferResponse, error)

SubAccountTransfer transfers funds to/from sub-account

func (*Exchange) TokenDelegate added in v0.4.0

func (e *Exchange) TokenDelegate(
	ctx context.Context,
	validator string,
	wei int,
	isUndelegate bool,
) (*TransferResponse, error)

TokenDelegate delegates tokens for staking

func (*Exchange) UpdateIsolatedMargin

func (e *Exchange) UpdateIsolatedMargin(
	ctx context.Context,
	amount float64,
	name string,
) (*UserState, error)

func (*Exchange) UpdateLeverage

func (e *Exchange) UpdateLeverage(
	ctx context.Context,
	leverage int,
	name string,
	isCross bool,
) (*UserState, error)

func (*Exchange) UsdClassTransfer added in v0.4.0

func (e *Exchange) UsdClassTransfer(
	ctx context.Context,
	amount float64,
	toPerp bool,
) (*TransferResponse, error)

UsdClassTransfer transfers between USD classes

func (*Exchange) UsdTransfer added in v0.4.0

func (e *Exchange) UsdTransfer(
	ctx context.Context,
	amount float64,
	destination string,
) (*TransferResponse, error)

UsdTransfer transfers USD to another address

func (*Exchange) UseBigBlocks added in v0.4.0

func (e *Exchange) UseBigBlocks(ctx context.Context, enable bool) (*ApprovalResponse, error)

UseBigBlocks enables or disables big blocks

func (*Exchange) VaultDistribute added in v0.6.0

func (e *Exchange) VaultDistribute(
	ctx context.Context,
	vaultAddress string,
	usd int,
) (*TransferResponse, error)

func (*Exchange) VaultModify added in v0.6.0

func (e *Exchange) VaultModify(
	ctx context.Context,
	vaultAddress string,
	allowDeposits bool,
	alwaysCloseOnWithdraw bool,
) (*TransferResponse, error)

func (*Exchange) VaultUsdTransfer added in v0.4.0

func (e *Exchange) VaultUsdTransfer(
	ctx context.Context,
	vaultAddress string,
	isDeposit bool,
	usd int,
) (*TransferResponse, error)

VaultUsdTransfer transfers to/from vault

func (*Exchange) WithdrawFromBridge added in v0.4.0

func (e *Exchange) WithdrawFromBridge(
	ctx context.Context,
	amount float64,
	destination string,
) (*TransferResponse, error)

WithdrawFromBridge withdraws tokens from bridge

type ExchangeOpt added in v0.9.0

type ExchangeOpt = Opt[Exchange]

func ExchangeOptAgentSigner added in v0.34.0

func ExchangeOptAgentSigner(s AgentSigner) ExchangeOpt

ExchangeOptAgentSigner injects an AgentSigner. When nil, the default ECDSA implementation with privateKey is used.

func ExchangeOptClientOptions added in v0.13.0

func ExchangeOptClientOptions(opts ...ClientOpt) ExchangeOpt

ExchangeOptClientOptions allows passing of ClientOpt to Client

func ExchangeOptDebugMode added in v0.9.0

func ExchangeOptDebugMode() ExchangeOpt

func ExchangeOptInfoOptions added in v0.13.0

func ExchangeOptInfoOptions(opts ...InfoOpt) ExchangeOpt

ExchangeOptInfoOptions allows passing of InfoOpt to Info

func ExchangeOptL1Signer added in v0.34.0

func ExchangeOptL1Signer(s L1ActionSigner) ExchangeOpt

ExchangeOptL1Signer injects an L1ActionSigner. When nil, the default ECDSA implementation with privateKey is used.

func ExchangeOptPerpDex added in v0.27.0

func ExchangeOptPerpDex(dex string) ExchangeOpt

func ExchangeOptUserSignedSigner added in v0.34.0

func ExchangeOptUserSignedSigner(s UserSignedActionSigner) ExchangeOpt

ExchangeOptUserSignedSigner injects a UserSignedActionSigner. When nil, the default ECDSA implementation with privateKey is used.

type FeeSchedule

type FeeSchedule struct {
	Add              string `json:"add"`
	Cross            string `json:"cross"`
	ReferralDiscount string `json:"referralDiscount"`
	Tiers            Tiers  `json:"tiers"`
}

func (FeeSchedule) MarshalEasyJSON added in v0.2.0

func (v FeeSchedule) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FeeSchedule) MarshalJSON added in v0.2.0

func (v FeeSchedule) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FeeSchedule) UnmarshalEasyJSON added in v0.2.0

func (v *FeeSchedule) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FeeSchedule) UnmarshalJSON added in v0.2.0

func (v *FeeSchedule) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Fill

type Fill struct {
	ClosedPnl     string `json:"closedPnl"`
	Coin          string `json:"coin"`
	Crossed       bool   `json:"crossed"`
	Dir           string `json:"dir"`
	Hash          string `json:"hash"`
	Oid           int64  `json:"oid"`
	Price         string `json:"px"`
	Side          string `json:"side"`
	StartPosition string `json:"startPosition"`
	Size          string `json:"sz"`
	Time          int64  `json:"time"`
	Fee           string `json:"fee"`
	FeeToken      string `json:"feeToken"`
	BuilderFee    string `json:"builderFee,omitempty"`
	Tid           int64  `json:"tid"`
}

func (Fill) MarshalEasyJSON added in v0.2.0

func (v Fill) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Fill) MarshalJSON added in v0.2.0

func (v Fill) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Fill) UnmarshalEasyJSON added in v0.2.0

func (v *Fill) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Fill) UnmarshalJSON added in v0.2.0

func (v *Fill) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FillLiquidation added in v0.15.0

type FillLiquidation struct {
	LiquidatedUser *string `json:"liquidatedUser,omitempty"`
	MarkPx         string  `json:"markPx"`
	Method         string  `json:"method"`
}

func (FillLiquidation) MarshalEasyJSON added in v0.15.0

func (v FillLiquidation) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FillLiquidation) MarshalJSON added in v0.15.0

func (v FillLiquidation) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FillLiquidation) UnmarshalEasyJSON added in v0.15.0

func (v *FillLiquidation) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FillLiquidation) UnmarshalJSON added in v0.15.0

func (v *FillLiquidation) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FrontendOpenOrder added in v0.15.0

type FrontendOpenOrder struct {
	Coin             string    `json:"coin"`
	IsPositionTpSl   bool      `json:"isPositionTpsl"`
	IsTrigger        bool      `json:"isTrigger"`
	LimitPx          float64   `json:"limitPx,string"`
	Oid              int64     `json:"oid"`
	OrderType        string    `json:"orderType"`
	OrigSz           float64   `json:"origSz,string"`
	ReduceOnly       bool      `json:"reduceOnly"`
	Side             OrderSide `json:"side"`
	Sz               float64   `json:"sz,string"`
	Timestamp        int64     `json:"timestamp"`
	TriggerCondition string    `json:"triggerCondition"`
	TriggerPx        float64   `json:"triggerPx,string"`
}

func (FrontendOpenOrder) MarshalEasyJSON added in v0.15.0

func (v FrontendOpenOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FrontendOpenOrder) MarshalJSON added in v0.15.0

func (v FrontendOpenOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FrontendOpenOrder) UnmarshalEasyJSON added in v0.15.0

func (v *FrontendOpenOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FrontendOpenOrder) UnmarshalJSON added in v0.15.0

func (v *FrontendOpenOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FundingHistory

type FundingHistory struct {
	Coin        string `json:"coin"`
	FundingRate string `json:"fundingRate"`
	Premium     string `json:"premium"`
	Time        int64  `json:"time"`
}

func (FundingHistory) MarshalEasyJSON added in v0.2.0

func (v FundingHistory) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FundingHistory) MarshalJSON added in v0.2.0

func (v FundingHistory) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FundingHistory) UnmarshalEasyJSON added in v0.2.0

func (v *FundingHistory) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FundingHistory) UnmarshalJSON added in v0.2.0

func (v *FundingHistory) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Grouping added in v0.4.2

type Grouping string
const (
	GroupingNA           Grouping = "na"
	GroupingNormalTpsl   Grouping = "normalTpsl"
	GroupingPositionTpls Grouping = "positionTpsl"
)

type HaltTrading added in v0.31.0

type HaltTrading struct {
	Coin     string `json:"coin"     msgpack:"coin"`
	IsHalted bool   `json:"isHalted" msgpack:"isHalted"`
}

func (HaltTrading) MarshalEasyJSON added in v0.31.0

func (v HaltTrading) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (HaltTrading) MarshalJSON added in v0.31.0

func (v HaltTrading) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*HaltTrading) UnmarshalEasyJSON added in v0.31.0

func (v *HaltTrading) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*HaltTrading) UnmarshalJSON added in v0.31.0

func (v *HaltTrading) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Handler added in v0.7.0

type Handler[T subscriptable] func(wsMessage) (T, error)

type Info

type Info struct {
	// contains filtered or unexported fields
}

func NewInfo

func NewInfo(
	ctx context.Context,
	baseURL string,
	skipWS bool,
	meta *Meta,
	spotMeta *SpotMeta,
	perpDexs *MixedArray,
	opts ...InfoOpt,
) *Info

func (*Info) AllMids

func (i *Info) AllMids(ctx context.Context, dex ...string) (map[string]string, error)

AllMids retrieves mids for all coins If dex is empty string, returns mids for the first perp dex (default) Note: Spot mids are only included with the first perp dex

func (*Info) CandlesSnapshot

func (i *Info) CandlesSnapshot(
	ctx context.Context,
	name, interval string,
	startTime, endTime int64,
) ([]Candle, error)

func (*Info) CoinToAsset added in v0.27.0

func (i *Info) CoinToAsset(coin string) (int, bool)

func (*Info) FrontendOpenOrders

func (i *Info) FrontendOpenOrders(
	ctx context.Context,
	address string,
	dex ...string,
) ([]FrontendOpenOrder, error)

FrontendOpenOrders retrieves user's open orders with frontend info If dex is empty string, returns orders for the first perp dex (default) Note: Spot open orders are only included with the first perp dex

func (*Info) FundingHistory

func (i *Info) FundingHistory(
	ctx context.Context,
	name string,
	startTime int64,
	endTime *int64,
) ([]FundingHistory, error)

func (*Info) HistoricalOrders added in v0.17.0

func (i *Info) HistoricalOrders(ctx context.Context, address string) ([]OrderQueryResponse, error)

func (*Info) L2Snapshot

func (i *Info) L2Snapshot(ctx context.Context, name string) (*L2Book, error)

func (*Info) Meta

func (i *Info) Meta(ctx context.Context, dex ...string) (*Meta, error)

Meta retrieves perpetuals metadata If dex is empty string, returns metadata for the first perp dex (default)

func (*Info) MetaAndAssetCtxs

func (i *Info) MetaAndAssetCtxs(
	ctx context.Context,
	params MetaAndAssetCtxsParams,
) (*MetaAndAssetCtxs, error)

MetaAndAssetCtxs retrieves perpetuals metadata and asset contexts If params.Dex is nil or empty string, returns data for the first perp dex (default)

func (*Info) OpenOrders

func (i *Info) OpenOrders(ctx context.Context, address string, dex ...string) ([]OpenOrder, error)

OpenOrders retrieves user's open orders If dex is empty string, returns orders for the first perp dex (default) Note: Spot open orders are only included with the first perp dex

func (*Info) PerpDeployAuctionStatus added in v0.25.0

func (i *Info) PerpDeployAuctionStatus(ctx context.Context) (*PerpDeployAuctionStatus, error)

PerpDeployAuctionStatus retrieves information about the Perp Deploy Auction

func (*Info) PerpDexLimits added in v0.25.0

func (i *Info) PerpDexLimits(ctx context.Context, dex string) (*PerpDexLimits, error)

PerpDexLimits retrieves builder-deployed perp market limits dex must be a non-empty string (the empty string is not allowed for this endpoint)

func (*Info) PerpDexStatus added in v0.25.0

func (i *Info) PerpDexStatus(ctx context.Context, dex string) (*PerpDexStatus, error)

PerpDexStatus retrieves perp market status If dex is empty string, returns status for the first perp dex (default)

func (*Info) PerpDexs added in v0.4.0

func (i *Info) PerpDexs(ctx context.Context) (MixedArray, error)

PerpDexs returns the list of available perpetual dexes Returns an array where each element can be nil (for the default dex) or a PerpDex object The first element is always null (representing the default dex)

func (*Info) Portfolio added in v0.35.0

func (i *Info) Portfolio(ctx context.Context, user string) ([]Portfolio, error)

portfolio returns the user's portfolio

func (*Info) QueryOrderByCloid

func (i *Info) QueryOrderByCloid(
	ctx context.Context,
	user, cloid string,
) (*OrderQueryResult, error)

func (*Info) QueryOrderByOid

func (i *Info) QueryOrderByOid(
	ctx context.Context,
	user string,
	oid int64,
) (*OrderQueryResult, error)

func (*Info) QueryReferralState

func (i *Info) QueryReferralState(ctx context.Context, user string) (*ReferralState, error)

func (*Info) QuerySubAccounts

func (i *Info) QuerySubAccounts(ctx context.Context, user string) ([]SubAccount, error)

func (*Info) QueryUserToMultiSigSigners

func (i *Info) QueryUserToMultiSigSigners(
	ctx context.Context,
	multiSigUser string,
) ([]MultiSigSigner, error)

func (*Info) SpotMeta

func (i *Info) SpotMeta(ctx context.Context) (*SpotMeta, error)

func (*Info) SpotMetaAndAssetCtxs

func (i *Info) SpotMetaAndAssetCtxs(ctx context.Context) (*SpotMetaAndAssetCtxs, error)

func (*Info) SpotUserState

func (i *Info) SpotUserState(ctx context.Context, address string) (*SpotUserState, error)

func (*Info) TokenDetails added in v0.23.0

func (i *Info) TokenDetails(ctx context.Context, tokenId string) (*TokenDetail, error)

func (*Info) UserActiveAssetData added in v0.7.0

func (i *Info) UserActiveAssetData(
	ctx context.Context,
	address string,
	coin string,
) (*UserActiveAssetData, error)

func (*Info) UserFees

func (i *Info) UserFees(ctx context.Context, address string) (*UserFees, error)

func (*Info) UserFills

func (i *Info) UserFills(ctx context.Context, params UserFillsParams) ([]Fill, error)

func (*Info) UserFillsByTime

func (i *Info) UserFillsByTime(
	ctx context.Context,
	address string,
	startTime int64,
	endTime *int64,
	aggregateByTime *bool,
) ([]Fill, error)

func (*Info) UserFundingHistory

func (i *Info) UserFundingHistory(
	ctx context.Context,
	user string,
	startTime int64,
	endTime *int64,
) ([]UserFundingHistory, error)

func (*Info) UserNonFundingLedgerUpdates added in v0.29.0

func (i *Info) UserNonFundingLedgerUpdates(
	ctx context.Context,
	user string,
	startTime int64,
	endTime *int64,
) ([]UserNonFundingLedgerUpdates, error)

func (*Info) UserStakingDelegations

func (i *Info) UserStakingDelegations(
	ctx context.Context,
	address string,
) ([]StakingDelegation, error)

func (*Info) UserStakingRewards

func (i *Info) UserStakingRewards(ctx context.Context, address string) ([]StakingReward, error)

func (*Info) UserStakingSummary

func (i *Info) UserStakingSummary(ctx context.Context, address string) (*StakingSummary, error)

func (*Info) UserState

func (i *Info) UserState(ctx context.Context, address string, dex ...string) (*UserState, error)

UserState retrieves user's perpetuals account summary If dex is empty string, returns state for the first perp dex (default)

type InfoOpt added in v0.9.0

type InfoOpt = Opt[Info]

func InfoOptClientOptions added in v0.13.0

func InfoOptClientOptions(opts ...ClientOpt) InfoOpt

InfoOptClientOptions allows passing of ClientOpt to Info

func InfoOptDebugMode added in v0.9.0

func InfoOptDebugMode() InfoOpt

func InfoOptPerpDexName added in v0.27.0

func InfoOptPerpDexName(dex string) InfoOpt

type L1ActionSigner added in v0.34.0

type L1ActionSigner interface {
	SignL1Action(
		ctx context.Context,
		action any,
		vaultAddress string,
		timestamp int64,
		expiresAfter *int64,
		isMainnet bool,
	) (SignatureResult, error)
}

L1ActionSigner signs L1 actions (msgpack + phantom agent EIP-712). When nil on Exchange, the default ECDSA implementation is used.

func ECDSAL1Signer added in v0.34.0

func ECDSAL1Signer(pk *ecdsa.PrivateKey) L1ActionSigner

ECDSAL1Signer implements L1ActionSigner using an ECDSA private key.

type L2Book

type L2Book struct {
	Coin   string    `json:"coin"`
	Levels [][]Level `json:"levels"`
	Time   int64     `json:"time"`
}

func (L2Book) Key added in v0.7.0

func (c L2Book) Key() string

func (L2Book) MarshalEasyJSON added in v0.2.0

func (v L2Book) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (L2Book) MarshalJSON added in v0.2.0

func (v L2Book) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*L2Book) UnmarshalEasyJSON added in v0.2.0

func (v *L2Book) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*L2Book) UnmarshalJSON added in v0.2.0

func (v *L2Book) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type L2BookSubscriptionParams added in v0.7.0

type L2BookSubscriptionParams struct {
	Coin     string
	NSigFigs int
	Mantissa int
}

type LeadingVault added in v0.25.0

type LeadingVault struct {
	Address string `json:"address"`
	Name    string `json:"name"`
}

func (LeadingVault) MarshalEasyJSON added in v0.25.0

func (v LeadingVault) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LeadingVault) MarshalJSON added in v0.25.0

func (v LeadingVault) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LeadingVault) UnmarshalEasyJSON added in v0.25.0

func (v *LeadingVault) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LeadingVault) UnmarshalJSON added in v0.25.0

func (v *LeadingVault) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LedgerDelta added in v0.29.0

type LedgerDelta struct {
	Type        string `json:"type"`
	USDC        string `json:"usdc"`
	User        string `json:"user"`
	Destination string `json:"destination"`
	Fee         string `json:"fee"`
}

func (LedgerDelta) MarshalEasyJSON added in v0.29.0

func (v LedgerDelta) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LedgerDelta) MarshalJSON added in v0.29.0

func (v LedgerDelta) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LedgerDelta) UnmarshalEasyJSON added in v0.29.0

func (v *LedgerDelta) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LedgerDelta) UnmarshalJSON added in v0.29.0

func (v *LedgerDelta) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Level

type Level struct {
	N  int     `json:"n"`
	Px float64 `json:"px,string"`
	Sz float64 `json:"sz,string"`
}

func (Level) MarshalEasyJSON added in v0.2.0

func (v Level) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Level) MarshalJSON added in v0.2.0

func (v Level) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Level) UnmarshalEasyJSON added in v0.2.0

func (v *Level) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Level) UnmarshalJSON added in v0.2.0

func (v *Level) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Leverage

type Leverage struct {
	Type   string  `json:"type"`
	Value  int     `json:"value"`
	RawUsd *string `json:"rawUsd,omitempty"`
}

func (Leverage) MarshalEasyJSON added in v0.2.0

func (v Leverage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Leverage) MarshalJSON added in v0.2.0

func (v Leverage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Leverage) UnmarshalEasyJSON added in v0.2.0

func (v *Leverage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Leverage) UnmarshalJSON added in v0.2.0

func (v *Leverage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LimitOrderType

type LimitOrderType struct {
	Tif Tif `json:"tif"` // TifAlo, TifIoc, TifGtc
}

func (LimitOrderType) MarshalEasyJSON added in v0.2.0

func (v LimitOrderType) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LimitOrderType) MarshalJSON added in v0.2.0

func (v LimitOrderType) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LimitOrderType) UnmarshalEasyJSON added in v0.2.0

func (v *LimitOrderType) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LimitOrderType) UnmarshalJSON added in v0.2.0

func (v *LimitOrderType) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MMTier

type MMTier struct {
	Add                 string `json:"add"`
	MakerFractionCutoff string `json:"makerFractionCutoff"`
}

func (MMTier) MarshalEasyJSON added in v0.2.0

func (v MMTier) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MMTier) MarshalJSON added in v0.2.0

func (v MMTier) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MMTier) UnmarshalEasyJSON added in v0.2.0

func (v *MMTier) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MMTier) UnmarshalJSON added in v0.2.0

func (v *MMTier) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MarginSummary

type MarginSummary struct {
	AccountValue    string `json:"accountValue"`
	TotalMarginUsed string `json:"totalMarginUsed"`
	TotalNtlPos     string `json:"totalNtlPos"`
	TotalRawUsd     string `json:"totalRawUsd"`
}

func (MarginSummary) MarshalEasyJSON added in v0.2.0

func (v MarginSummary) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MarginSummary) MarshalJSON added in v0.2.0

func (v MarginSummary) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MarginSummary) UnmarshalEasyJSON added in v0.2.0

func (v *MarginSummary) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MarginSummary) UnmarshalJSON added in v0.2.0

func (v *MarginSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MarginTable added in v0.6.2

type MarginTable struct {
	ID          int
	Description string       `json:"description"`
	MarginTiers []MarginTier `json:"marginTiers"`
}

func (MarginTable) MarshalEasyJSON added in v0.6.2

func (v MarginTable) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MarginTable) MarshalJSON added in v0.6.2

func (v MarginTable) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MarginTable) UnmarshalEasyJSON added in v0.6.2

func (v *MarginTable) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MarginTable) UnmarshalJSON added in v0.6.2

func (v *MarginTable) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MarginTier added in v0.6.2

type MarginTier struct {
	LowerBound  string `json:"lowerBound"`
	MaxLeverage int    `json:"maxLeverage"`
}

func (MarginTier) MarshalEasyJSON added in v0.6.2

func (v MarginTier) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MarginTier) MarshalJSON added in v0.6.2

func (v MarginTier) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MarginTier) UnmarshalEasyJSON added in v0.6.2

func (v *MarginTier) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MarginTier) UnmarshalJSON added in v0.6.2

func (v *MarginTier) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Meta

type Meta struct {
	Universe        []AssetInfo   `json:"universe"`
	MarginTables    []MarginTable `json:"marginTables"`
	CollateralToken int           `json:"collateralToken"`
}

func (Meta) MarshalEasyJSON added in v0.2.0

func (v Meta) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Meta) MarshalJSON added in v0.2.0

func (v Meta) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Meta) UnmarshalEasyJSON added in v0.2.0

func (v *Meta) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Meta) UnmarshalJSON added in v0.2.0

func (v *Meta) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MetaAndAssetCtxs added in v0.6.2

type MetaAndAssetCtxs struct {
	Meta
	Ctxs []AssetCtx
}

This type has no JSON annotation because it cannot be directly unmarshalled from the response

func (MetaAndAssetCtxs) MarshalEasyJSON added in v0.6.2

func (v MetaAndAssetCtxs) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MetaAndAssetCtxs) MarshalJSON added in v0.6.2

func (v MetaAndAssetCtxs) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MetaAndAssetCtxs) UnmarshalEasyJSON added in v0.6.2

func (v *MetaAndAssetCtxs) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MetaAndAssetCtxs) UnmarshalJSON added in v0.6.2

func (v *MetaAndAssetCtxs) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MetaAndAssetCtxsParams added in v0.32.0

type MetaAndAssetCtxsParams struct {
	// Dex specifies the DEX to query. If nil or empty string, queries the default (first) perp dex.
	Dex *string
}

MetaAndAssetCtxsParams contains optional parameters for MetaAndAssetCtxs request

func (MetaAndAssetCtxsParams) MarshalEasyJSON added in v0.32.0

func (v MetaAndAssetCtxsParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MetaAndAssetCtxsParams) MarshalJSON added in v0.32.0

func (v MetaAndAssetCtxsParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MetaAndAssetCtxsParams) UnmarshalEasyJSON added in v0.32.0

func (v *MetaAndAssetCtxsParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MetaAndAssetCtxsParams) UnmarshalJSON added in v0.32.0

func (v *MetaAndAssetCtxsParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MixedArray added in v0.4.2

type MixedArray []MixedValue

func (MixedArray) FirstError added in v0.5.1

func (ma MixedArray) FirstError() error

func (*MixedArray) UnmarshalJSON added in v0.4.2

func (ma *MixedArray) UnmarshalJSON(data []byte) error

type MixedValue added in v0.4.2

type MixedValue json.RawMessage

func (*MixedValue) Array added in v0.4.2

func (mv *MixedValue) Array() ([]json.RawMessage, bool)

func (MixedValue) MarshalJSON added in v0.4.2

func (mv MixedValue) MarshalJSON() ([]byte, error)

func (*MixedValue) Object added in v0.4.2

func (mv *MixedValue) Object() (map[string]any, bool)

func (*MixedValue) Parse added in v0.4.2

func (mv *MixedValue) Parse(v any) error

func (*MixedValue) String added in v0.4.2

func (mv *MixedValue) String() (string, bool)

func (*MixedValue) Type added in v0.4.2

func (mv *MixedValue) Type() string

func (*MixedValue) UnmarshalJSON added in v0.4.2

func (mv *MixedValue) UnmarshalJSON(data []byte) error

type ModifyAction added in v0.4.5

type ModifyAction struct {
	Type  string    `json:"type,omitempty" msgpack:"type,omitempty"`
	Dex   string    `json:"dex,omitempty"  msgpack:"dex,omitempty"`
	Oid   any       `json:"oid"            msgpack:"oid"`
	Order OrderWire `json:"order"          msgpack:"order"`
}

ModifyAction represents a single order modification

func (ModifyAction) MarshalEasyJSON added in v0.6.0

func (v ModifyAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ModifyAction) MarshalJSON added in v0.6.0

func (v ModifyAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ModifyAction) UnmarshalEasyJSON added in v0.6.0

func (v *ModifyAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ModifyAction) UnmarshalJSON added in v0.6.0

func (v *ModifyAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ModifyOrderRequest added in v0.4.2

type ModifyOrderRequest struct {
	Oid   *int64
	Cloid *Cloid
	Order CreateOrderRequest
}

ModifyOrderRequest identifies an order by either exchange-provided Oid or client-provided Cloid. Exactly one of Oid or Cloid must be non-nil.

type ModifyResponse added in v0.4.1

type ModifyResponse struct {
	Status string        `json:"status"`
	Data   []OrderStatus `json:"data,omitempty"`
	Error  string        `json:"error,omitempty"`
}

func (ModifyResponse) MarshalEasyJSON added in v0.4.1

func (v ModifyResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ModifyResponse) MarshalJSON added in v0.4.1

func (v ModifyResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ModifyResponse) UnmarshalEasyJSON added in v0.4.1

func (v *ModifyResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ModifyResponse) UnmarshalJSON added in v0.4.1

func (v *ModifyResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MultiSigAction added in v0.4.5

type MultiSigAction struct {
	Type       string         `json:"type"       msgpack:"type"`
	Action     map[string]any `json:"action"     msgpack:"action"`
	Signers    []string       `json:"signers"    msgpack:"signers"`
	Signatures []string       `json:"signatures" msgpack:"signatures"`
}

MultiSigAction represents multi-signature action

func (MultiSigAction) MarshalEasyJSON added in v0.6.0

func (v MultiSigAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MultiSigAction) MarshalJSON added in v0.6.0

func (v MultiSigAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MultiSigAction) UnmarshalEasyJSON added in v0.6.0

func (v *MultiSigAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MultiSigAction) UnmarshalJSON added in v0.6.0

func (v *MultiSigAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MultiSigConversionResponse added in v0.4.1

type MultiSigConversionResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (MultiSigConversionResponse) MarshalEasyJSON added in v0.4.1

func (v MultiSigConversionResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MultiSigConversionResponse) MarshalJSON added in v0.4.1

func (v MultiSigConversionResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MultiSigConversionResponse) UnmarshalEasyJSON added in v0.4.1

func (v *MultiSigConversionResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MultiSigConversionResponse) UnmarshalJSON added in v0.4.1

func (v *MultiSigConversionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MultiSigResponse added in v0.4.1

type MultiSigResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (MultiSigResponse) MarshalEasyJSON added in v0.4.1

func (v MultiSigResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MultiSigResponse) MarshalJSON added in v0.4.1

func (v MultiSigResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MultiSigResponse) UnmarshalEasyJSON added in v0.4.1

func (v *MultiSigResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MultiSigResponse) UnmarshalJSON added in v0.4.1

func (v *MultiSigResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MultiSigSigner

type MultiSigSigner struct {
	User      string `json:"user"`
	Threshold int    `json:"threshold"`
}

func (MultiSigSigner) MarshalEasyJSON added in v0.2.0

func (v MultiSigSigner) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MultiSigSigner) MarshalJSON added in v0.2.0

func (v MultiSigSigner) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MultiSigSigner) UnmarshalEasyJSON added in v0.2.0

func (v *MultiSigSigner) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MultiSigSigner) UnmarshalJSON added in v0.2.0

func (v *MultiSigSigner) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Notification added in v0.8.0

type Notification struct {
	Notification string `json:"notification"`
}

func (Notification) Key added in v0.8.0

func (n Notification) Key() string

func (Notification) MarshalEasyJSON added in v0.8.0

func (v Notification) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Notification) MarshalJSON added in v0.8.0

func (v Notification) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Notification) UnmarshalEasyJSON added in v0.8.0

func (v *Notification) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Notification) UnmarshalJSON added in v0.8.0

func (v *Notification) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type NotificationSubscriptionParams added in v0.8.0

type NotificationSubscriptionParams struct {
	User string
}

type OpenOrder

type OpenOrder struct {
	Coin      string  `json:"coin"`
	Cloid     *string `json:"cloid,omitempty"`
	LimitPx   float64 `json:"limitPx,string"`
	Oid       int64   `json:"oid"`
	OrigSz    float64 `json:"origSz,string"`
	Side      string  `json:"side"`
	Size      float64 `json:"sz,string"`
	Timestamp int64   `json:"timestamp"`
}

func (OpenOrder) MarshalEasyJSON added in v0.2.0

func (v OpenOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OpenOrder) MarshalJSON added in v0.2.0

func (v OpenOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OpenOrder) UnmarshalEasyJSON added in v0.2.0

func (v *OpenOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OpenOrder) UnmarshalJSON added in v0.2.0

func (v *OpenOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OpenOrders added in v0.25.0

type OpenOrders struct {
	Dex    string         `json:"dex"`
	User   string         `json:"user"`
	Orders []WsBasicOrder `json:"orders"`
}

func (OpenOrders) Key added in v0.25.0

func (o OpenOrders) Key() string

func (OpenOrders) MarshalEasyJSON added in v0.25.0

func (v OpenOrders) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OpenOrders) MarshalJSON added in v0.25.0

func (v OpenOrders) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OpenOrders) UnmarshalEasyJSON added in v0.25.0

func (v *OpenOrders) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OpenOrders) UnmarshalJSON added in v0.25.0

func (v *OpenOrders) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OpenOrdersSubscriptionParams added in v0.25.0

type OpenOrdersSubscriptionParams struct {
	User string
	Dex  *string
}

type Opt added in v0.9.0

type Opt[T any] func(*T)

func (Opt[T]) Apply added in v0.9.0

func (o Opt[T]) Apply(opt *T)

type OrderAction added in v0.4.5

type OrderAction struct {
	Type     string       `json:"type"              msgpack:"type"`
	Dex      string       `json:"dex,omitempty"     msgpack:"dex,omitempty"`
	Orders   []OrderWire  `json:"orders"            msgpack:"orders"`
	Grouping string       `json:"grouping"          msgpack:"grouping"`
	Builder  *BuilderInfo `json:"builder,omitempty" msgpack:"builder,omitempty"`
}

OrderAction represents the order action with deterministic field ordering CRITICAL: Field order MUST match Python SDK insertion order for msgpack hash consistency

func (OrderAction) MarshalEasyJSON added in v0.6.0

func (v OrderAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderAction) MarshalJSON added in v0.6.0

func (v OrderAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderAction) UnmarshalEasyJSON added in v0.6.0

func (v *OrderAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderAction) UnmarshalJSON added in v0.6.0

func (v *OrderAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderFillsSubscriptionParams added in v0.15.0

type OrderFillsSubscriptionParams struct {
	User string
}

type OrderQueryResponse added in v0.6.3

type OrderQueryResponse struct {
	Order           QueriedOrder     `json:"order"`
	Status          OrderStatusValue `json:"status"`
	StatusTimestamp int64            `json:"statusTimestamp"`
}

func (OrderQueryResponse) MarshalEasyJSON added in v0.6.3

func (v OrderQueryResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderQueryResponse) MarshalJSON added in v0.6.3

func (v OrderQueryResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderQueryResponse) UnmarshalEasyJSON added in v0.6.3

func (v *OrderQueryResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderQueryResponse) UnmarshalJSON added in v0.6.3

func (v *OrderQueryResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderQueryResult added in v0.6.3

type OrderQueryResult struct {
	Status OrderQueryStatus   `json:"status"`
	Order  OrderQueryResponse `json:"order,omitempty"`
}

func (OrderQueryResult) MarshalEasyJSON added in v0.6.3

func (v OrderQueryResult) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderQueryResult) MarshalJSON added in v0.6.3

func (v OrderQueryResult) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderQueryResult) UnmarshalEasyJSON added in v0.6.3

func (v *OrderQueryResult) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderQueryResult) UnmarshalJSON added in v0.6.3

func (v *OrderQueryResult) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderQueryStatus added in v0.6.3

type OrderQueryStatus string
const (
	OrderQueryStatusSuccess OrderQueryStatus = "order"
	OrderQueryStatusError   OrderQueryStatus = "unknownOid"
)

type OrderResponse added in v0.4.1

type OrderResponse struct {
	Statuses []OrderStatus
}

type OrderSide added in v0.6.3

type OrderSide string
const (
	OrderSideAsk OrderSide = "A"
	OrderSideBid OrderSide = "B"
)

type OrderStatus added in v0.4.0

type OrderStatus struct {
	Resting *OrderStatusResting `json:"resting,omitempty"`
	Filled  *OrderStatusFilled  `json:"filled,omitempty"`
	Error   *string             `json:"error,omitempty"`
}

func (*OrderStatus) String added in v0.4.7

func (s *OrderStatus) String() string

type OrderStatusFilled added in v0.4.2

type OrderStatusFilled struct {
	TotalSz string `json:"totalSz"`
	AvgPx   string `json:"avgPx"`
	Oid     int    `json:"oid"`
}

type OrderStatusResting added in v0.4.2

type OrderStatusResting struct {
	Oid      int64   `json:"oid"`
	ClientID *string `json:"cloid"`
	Status   string  `json:"status"`
}

type OrderStatusValue added in v0.6.3

type OrderStatusValue string
const (
	// Placed successfully
	OrderStatusValueOpen OrderStatusValue = "open"
	// Filled
	OrderStatusValueFilled OrderStatusValue = "filled"
	// Canceled by user
	OrderStatusValueCanceled OrderStatusValue = "canceled"
	// Trigger order triggered
	OrderStatusValueTriggered OrderStatusValue = "triggered"
	// Rejected at time of placement
	OrderStatusValueRejected OrderStatusValue = "rejected"
	// Canceled because insufficient margin to fill
	OrderStatusValueMarginCanceled OrderStatusValue = "marginCanceled"
	// Vaults only. Canceled due to a user's withdrawal from vault
	OrderStatusValueVaultWithdrawalCanceled OrderStatusValue = "vaultWithdrawalCanceled"
	// Canceled due to order being too aggressive when open interest was at cap
	OrderStatusValueOpenInterestCapCanceled OrderStatusValue = "openInterestCapCanceled"
	// Canceled due to self-trade prevention
	OrderStatusValueSelfTradeCanceled OrderStatusValue = "selfTradeCanceled"
	// Canceled reduced-only order that does not reduce position
	OrderStatusValueReduceOnlyCanceled OrderStatusValue = "reduceOnlyCanceled"
	// TP/SL only. Canceled due to sibling ordering being filled
	OrderStatusValueSiblingFilledCanceled OrderStatusValue = "siblingFilledCanceled"
	// Canceled due to asset delisting
	OrderStatusValueDelistedCanceled OrderStatusValue = "delistedCanceled"
	// Canceled due to liquidation
	OrderStatusValueLiquidatedCanceled OrderStatusValue = "liquidatedCanceled"
	// API only. Canceled due to exceeding scheduled cancel deadline (dead man's switch)
	OrderStatusValueScheduledCancel OrderStatusValue = "scheduledCancel"
	// Rejected due to invalid tick price
	OrderStatusValueTickRejected OrderStatusValue = "tickRejected"
	// Rejected due to order notional below minimum
	OrderStatusValueMinTradeNtlRejected OrderStatusValue = "minTradeNtlRejected"
	// Rejected due to insufficient margin
	OrderStatusValuePerpMarginRejected OrderStatusValue = "perpMarginRejected"
	// Rejected due to reduce only
	OrderStatusValueReduceOnlyRejected OrderStatusValue = "reduceOnlyRejected"
	// Rejected due to post-only immediate match
	OrderStatusValueBadAloPxRejected OrderStatusValue = "badAloPxRejected"
	// Rejected due to IOC not able to match
	OrderStatusValueIocCancelRejected OrderStatusValue = "iocCancelRejected"
	// Rejected due to invalid TP/SL price
	OrderStatusValueBadTriggerPxRejected OrderStatusValue = "badTriggerPxRejected"
	// Rejected due to lack of liquidity for market order
	OrderStatusValueMarketOrderNoLiquidityRejected OrderStatusValue = "marketOrderNoLiquidityRejected"
	// Rejected due to open interest cap
	OrderStatusValuePositionIncreaseAtOpenInterestCapRejected OrderStatusValue = "positionIncreaseAtOpenInterestCapRejected"
	// Rejected due to open interest cap
	OrderStatusValuePositionFlipAtOpenInterestCapRejected OrderStatusValue = "positionFlipAtOpenInterestCapRejected"
	// Rejected due to price too aggressive at open interest cap
	OrderStatusValueTooAggressiveAtOpenInterestCapRejected OrderStatusValue = "tooAggressiveAtOpenInterestCapRejected"
	// Rejected due to open interest cap
	OrderStatusValueOpenInterestIncreaseRejected OrderStatusValue = "openInterestIncreaseRejected"
	// Rejected due to insufficient spot balance
	OrderStatusValueInsufficientSpotBalanceRejected OrderStatusValue = "insufficientSpotBalanceRejected"
	// Rejected due to price too far from oracle
	OrderStatusValueOracleRejected OrderStatusValue = "oracleRejected"
	// Rejected due to exceeding margin tier limit at current leverage
	OrderStatusValuePerpMaxPositionRejected OrderStatusValue = "perpMaxPositionRejected"
)

type OrderType

type OrderType struct {
	Limit   *LimitOrderType   `json:"limit,omitempty"`
	Trigger *TriggerOrderType `json:"trigger,omitempty"`
}

func (OrderType) MarshalEasyJSON added in v0.2.0

func (v OrderType) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderType) MarshalJSON added in v0.2.0

func (v OrderType) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderType) UnmarshalEasyJSON added in v0.2.0

func (v *OrderType) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderType) UnmarshalJSON added in v0.2.0

func (v *OrderType) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderUpdatesSubscriptionParams added in v0.8.0

type OrderUpdatesSubscriptionParams struct {
	User string
}

type OrderWire

type OrderWire struct {
	Asset      int           `json:"a"           msgpack:"a"`           // 1st
	IsBuy      bool          `json:"b"           msgpack:"b"`           // 2nd
	LimitPx    string        `json:"p"           msgpack:"p"`           // 3rd
	Size       string        `json:"s"           msgpack:"s"`           // 4th
	ReduceOnly bool          `json:"r"           msgpack:"r"`           // 5th
	OrderType  OrderWireType `json:"t"           msgpack:"t"`           // 6th
	Cloid      *string       `json:"c,omitempty" msgpack:"c,omitempty"` // 7th (optional)
}

OrderWire represents the wire format for orders with deterministic field ordering CRITICAL: Field order MUST exactly match Python SDK insertion order: a, b, p, s, r, t, c See hyperliquid-python-sdk/hyperliquid/utils/signing.py:order_request_to_order_wire

func (OrderWire) MarshalEasyJSON added in v0.2.0

func (v OrderWire) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderWire) MarshalJSON added in v0.2.0

func (v OrderWire) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderWire) UnmarshalEasyJSON added in v0.2.0

func (v *OrderWire) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderWire) UnmarshalJSON added in v0.2.0

func (v *OrderWire) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderWireType added in v0.22.0

type OrderWireType struct {
	Limit   *OrderWireTypeLimit   `json:"limit,omitempty"   msgpack:"limit,omitempty"`
	Trigger *OrderWireTypeTrigger `json:"trigger,omitempty" msgpack:"trigger,omitempty"`
}

OrderWireType represents the type of order (limit or trigger).

func (OrderWireType) MarshalEasyJSON added in v0.22.0

func (v OrderWireType) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderWireType) MarshalJSON added in v0.22.0

func (v OrderWireType) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderWireType) UnmarshalEasyJSON added in v0.22.0

func (v *OrderWireType) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderWireType) UnmarshalJSON added in v0.22.0

func (v *OrderWireType) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderWireTypeLimit added in v0.22.0

type OrderWireTypeLimit struct {
	Tif Tif `json:"tif,string" msgpack:"tif"`
}

OrderWireTypeLimit represents a limit order with time-in-force.

func (OrderWireTypeLimit) MarshalEasyJSON added in v0.22.0

func (v OrderWireTypeLimit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderWireTypeLimit) MarshalJSON added in v0.22.0

func (v OrderWireTypeLimit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderWireTypeLimit) UnmarshalEasyJSON added in v0.22.0

func (v *OrderWireTypeLimit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderWireTypeLimit) UnmarshalJSON added in v0.22.0

func (v *OrderWireTypeLimit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderWireTypeTrigger added in v0.22.0

type OrderWireTypeTrigger struct {
	// CRITICAL: Field order MUST match Python SDK insertion order: isMarket, triggerPx, tpsl
	// See hyperliquid-python-sdk/hyperliquid/utils/signing.py:order_type_to_wire (lines 151-154)
	IsMarket  bool   `json:"isMarket"  msgpack:"isMarket"`  // 1st
	TriggerPx string `json:"triggerPx" msgpack:"triggerPx"` // 2nd - Must be string for msgpack serialization
	Tpsl      Tpsl   `json:"tpsl"      msgpack:"tpsl"`      // 3rd - "tp" or "sl"
}

OrderWireTypeTrigger represents a trigger order (stop-loss/take-profit).

func (OrderWireTypeTrigger) MarshalEasyJSON added in v0.22.0

func (v OrderWireTypeTrigger) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderWireTypeTrigger) MarshalJSON added in v0.22.0

func (v OrderWireTypeTrigger) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderWireTypeTrigger) UnmarshalEasyJSON added in v0.22.0

func (v *OrderWireTypeTrigger) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderWireTypeTrigger) UnmarshalJSON added in v0.22.0

func (v *OrderWireTypeTrigger) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeployAuctionStatus added in v0.25.0

type PerpDeployAuctionStatus struct {
	StartTimeSeconds int64   `json:"startTimeSeconds"`
	DurationSeconds  int64   `json:"durationSeconds"`
	StartGas         string  `json:"startGas"`
	CurrentGas       string  `json:"currentGas"`
	EndGas           *string `json:"endGas"`
}

PerpDeployAuctionStatus represents the status of a perp deploy auction

func (PerpDeployAuctionStatus) MarshalEasyJSON added in v0.25.0

func (v PerpDeployAuctionStatus) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeployAuctionStatus) MarshalJSON added in v0.25.0

func (v PerpDeployAuctionStatus) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeployAuctionStatus) UnmarshalEasyJSON added in v0.25.0

func (v *PerpDeployAuctionStatus) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeployAuctionStatus) UnmarshalJSON added in v0.25.0

func (v *PerpDeployAuctionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeployHaltTradingAction added in v0.31.0

type PerpDeployHaltTradingAction struct {
	Type        string      `json:"type"        msgpack:"type"`
	HaltTrading HaltTrading `json:"haltTrading" msgpack:"haltTrading"`
}

func (PerpDeployHaltTradingAction) MarshalEasyJSON added in v0.31.0

func (v PerpDeployHaltTradingAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeployHaltTradingAction) MarshalJSON added in v0.31.0

func (v PerpDeployHaltTradingAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeployHaltTradingAction) UnmarshalEasyJSON added in v0.31.0

func (v *PerpDeployHaltTradingAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeployHaltTradingAction) UnmarshalJSON added in v0.31.0

func (v *PerpDeployHaltTradingAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeployRegisterAsset2Action added in v0.31.0

type PerpDeployRegisterAsset2Action struct {
	Type           string         `json:"type"           msgpack:"type"`
	RegisterAsset2 RegisterAsset2 `json:"registerAsset2" msgpack:"registerAsset2"`
}

func (PerpDeployRegisterAsset2Action) MarshalEasyJSON added in v0.31.0

func (v PerpDeployRegisterAsset2Action) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeployRegisterAsset2Action) MarshalJSON added in v0.31.0

func (v PerpDeployRegisterAsset2Action) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeployRegisterAsset2Action) UnmarshalEasyJSON added in v0.31.0

func (v *PerpDeployRegisterAsset2Action) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeployRegisterAsset2Action) UnmarshalJSON added in v0.31.0

func (v *PerpDeployRegisterAsset2Action) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeployRegisterAssetAction added in v0.31.0

type PerpDeployRegisterAssetAction struct {
	Type          string        `json:"type"          msgpack:"type"`
	RegisterAsset RegisterAsset `json:"registerAsset" msgpack:"registerAsset"`
}

func (PerpDeployRegisterAssetAction) MarshalEasyJSON added in v0.31.0

func (v PerpDeployRegisterAssetAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeployRegisterAssetAction) MarshalJSON added in v0.31.0

func (v PerpDeployRegisterAssetAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeployRegisterAssetAction) UnmarshalEasyJSON added in v0.31.0

func (v *PerpDeployRegisterAssetAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeployRegisterAssetAction) UnmarshalJSON added in v0.31.0

func (v *PerpDeployRegisterAssetAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeployResponse added in v0.4.1

type PerpDeployResponse struct {
	Status string `json:"status"`
	// Response is either a string or object `{"type": "...", ...}`
	Response json.RawMessage `json:"response,omitempty"`
	Data     struct {
		Statuses []TxStatus `json:"statuses"`
	} `json:"data"`
}

func (PerpDeployResponse) MarshalEasyJSON added in v0.4.1

func (v PerpDeployResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeployResponse) MarshalJSON added in v0.4.1

func (v PerpDeployResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeployResponse) UnmarshalEasyJSON added in v0.4.1

func (v *PerpDeployResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeployResponse) UnmarshalJSON added in v0.4.1

func (v *PerpDeployResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDeploySetOracleAction added in v0.31.0

type PerpDeploySetOracleAction struct {
	Type      string    `json:"type"      msgpack:"type"`
	SetOracle SetOracle `json:"setOracle" msgpack:"setOracle"`
}

func (PerpDeploySetOracleAction) MarshalEasyJSON added in v0.31.0

func (v PerpDeploySetOracleAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDeploySetOracleAction) MarshalJSON added in v0.31.0

func (v PerpDeploySetOracleAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDeploySetOracleAction) UnmarshalEasyJSON added in v0.31.0

func (v *PerpDeploySetOracleAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDeploySetOracleAction) UnmarshalJSON added in v0.31.0

func (v *PerpDeploySetOracleAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDex added in v0.25.0

type PerpDex struct {
	Name                     string     `json:"name"`
	FullName                 string     `json:"fullName"`
	Deployer                 string     `json:"deployer"`
	OracleUpdater            *string    `json:"oracleUpdater"`
	FeeRecipient             *string    `json:"feeRecipient"`
	AssetToStreamingOiCap    [][]string `json:"assetToStreamingOiCap"`    // Array of [coin, cap] tuples
	AssetToFundingMultiplier [][]string `json:"assetToFundingMultiplier"` // Array of [coin, multiplier] tuples
}

PerpDex represents a perpetual DEX

func (PerpDex) MarshalEasyJSON added in v0.25.0

func (v PerpDex) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDex) MarshalJSON added in v0.25.0

func (v PerpDex) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDex) UnmarshalEasyJSON added in v0.25.0

func (v *PerpDex) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDex) UnmarshalJSON added in v0.25.0

func (v *PerpDex) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDexClassTransferAction added in v0.4.5

type PerpDexClassTransferAction struct {
	Type   string  `json:"type"   msgpack:"type"`
	Dex    string  `json:"dex"    msgpack:"dex"`
	Token  string  `json:"token"  msgpack:"token"`
	Amount float64 `json:"amount" msgpack:"amount"`
	ToPerp bool    `json:"toPerp" msgpack:"toPerp"`
}

PerpDexClassTransferAction represents perp dex class transfer

func (PerpDexClassTransferAction) MarshalEasyJSON added in v0.6.0

func (v PerpDexClassTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDexClassTransferAction) MarshalJSON added in v0.6.0

func (v PerpDexClassTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDexClassTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *PerpDexClassTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDexClassTransferAction) UnmarshalJSON added in v0.6.0

func (v *PerpDexClassTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDexLimits added in v0.25.0

type PerpDexLimits struct {
	TotalOiCap     string     `json:"totalOiCap"`
	OiSzCapPerPerp string     `json:"oiSzCapPerPerp"`
	MaxTransferNtl string     `json:"maxTransferNtl"`
	CoinToOiCap    [][]string `json:"coinToOiCap"` // Array of [coin, cap] tuples
}

PerpDexLimits represents limits for a builder-deployed perp DEX

func (PerpDexLimits) MarshalEasyJSON added in v0.25.0

func (v PerpDexLimits) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDexLimits) MarshalJSON added in v0.25.0

func (v PerpDexLimits) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDexLimits) UnmarshalEasyJSON added in v0.25.0

func (v *PerpDexLimits) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDexLimits) UnmarshalJSON added in v0.25.0

func (v *PerpDexLimits) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDexSchemaInput added in v0.4.0

type PerpDexSchemaInput struct {
	FullName        string  `json:"fullName"`
	CollateralToken int     `json:"collateralToken"`
	OracleUpdater   *string `json:"oracleUpdater"`
}

func (PerpDexSchemaInput) MarshalEasyJSON added in v0.4.0

func (v PerpDexSchemaInput) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDexSchemaInput) MarshalJSON added in v0.4.0

func (v PerpDexSchemaInput) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDexSchemaInput) UnmarshalEasyJSON added in v0.4.0

func (v *PerpDexSchemaInput) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDexSchemaInput) UnmarshalJSON added in v0.4.0

func (v *PerpDexSchemaInput) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDexState added in v0.25.0

type PerpDexState struct {
	TotalVaultEquity       float64         `json:"totalVaultEquity,string"`
	PerpsAtOpenInterestCap *[]string       `json:"perpsAtOpenInterestCap,omitempty"`
	LeadingVaults          *[]LeadingVault `json:"leadingVaults,omitempty"`
}

func (PerpDexState) MarshalEasyJSON added in v0.25.0

func (v PerpDexState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDexState) MarshalJSON added in v0.25.0

func (v PerpDexState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDexState) UnmarshalEasyJSON added in v0.25.0

func (v *PerpDexState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDexState) UnmarshalJSON added in v0.25.0

func (v *PerpDexState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PerpDexStatus added in v0.25.0

type PerpDexStatus struct {
	TotalNetDeposit string `json:"totalNetDeposit"`
}

PerpDexStatus represents status for a builder-deployed perp DEX

func (PerpDexStatus) MarshalEasyJSON added in v0.25.0

func (v PerpDexStatus) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PerpDexStatus) MarshalJSON added in v0.25.0

func (v PerpDexStatus) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PerpDexStatus) UnmarshalEasyJSON added in v0.25.0

func (v *PerpDexStatus) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PerpDexStatus) UnmarshalJSON added in v0.25.0

func (v *PerpDexStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Portfolio added in v0.35.0

type Portfolio []MixedValue // [string, AccountHistory]

Portfolio represents a user's portfolio

type Position

type Position struct {
	Coin           string      `json:"coin"`
	EntryPx        *string     `json:"entryPx"`
	Leverage       Leverage    `json:"leverage"`
	LiquidationPx  *string     `json:"liquidationPx"`
	MarginUsed     string      `json:"marginUsed"`
	PositionValue  string      `json:"positionValue"`
	ReturnOnEquity string      `json:"returnOnEquity"`
	Szi            string      `json:"szi"`
	UnrealizedPnl  string      `json:"unrealizedPnl"`
	CumFunding     *CumFunding `json:"cumFunding,omitempty"`
}

func (Position) MarshalEasyJSON added in v0.2.0

func (v Position) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Position) MarshalJSON added in v0.2.0

func (v Position) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Position) UnmarshalEasyJSON added in v0.2.0

func (v *Position) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Position) UnmarshalJSON added in v0.2.0

func (v *Position) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type QueriedOrder added in v0.6.3

type QueriedOrder struct {
	Coin             string         `json:"coin"`
	Side             OrderSide      `json:"side"`
	LimitPx          string         `json:"limitPx"`
	Sz               string         `json:"sz"`
	Oid              int64          `json:"oid"`
	Timestamp        int64          `json:"timestamp"`
	TriggerCondition string         `json:"triggerCondition"`
	IsTrigger        bool           `json:"isTrigger"`
	TriggerPx        string         `json:"triggerPx"`
	Children         []QueriedOrder `json:"children"`
	IsPositionTpsl   bool           `json:"isPositionTpsl"`
	ReduceOnly       bool           `json:"reduceOnly"`
	OrderType        string         `json:"orderType"`
	OrigSz           string         `json:"origSz"`
	Tif              Tif            `json:"tif"`
	Cloid            *string        `json:"cloid"`
}

func (QueriedOrder) MarshalEasyJSON added in v0.6.3

func (v QueriedOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (QueriedOrder) MarshalJSON added in v0.6.3

func (v QueriedOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*QueriedOrder) UnmarshalEasyJSON added in v0.6.3

func (v *QueriedOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*QueriedOrder) UnmarshalJSON added in v0.6.3

func (v *QueriedOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ReferralState

type ReferralState struct {
	ReferralCode string   `json:"referralCode"`
	Referrer     string   `json:"referrer"`
	Referred     []string `json:"referred"`
}

func (ReferralState) MarshalEasyJSON added in v0.2.0

func (v ReferralState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ReferralState) MarshalJSON added in v0.2.0

func (v ReferralState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ReferralState) UnmarshalEasyJSON added in v0.2.0

func (v *ReferralState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ReferralState) UnmarshalJSON added in v0.2.0

func (v *ReferralState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RegisterAsset added in v0.31.0

type RegisterAsset struct {
	MaxGas       *int                 `json:"maxGas"       msgpack:"maxGas"`
	AssetRequest AssetRequest         `json:"assetRequest" msgpack:"assetRequest"`
	Dex          string               `json:"dex"          msgpack:"dex"`
	Schema       *RegisterAssetSchema `json:"schema"       msgpack:"schema"`
}

func (RegisterAsset) MarshalEasyJSON added in v0.31.0

func (v RegisterAsset) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RegisterAsset) MarshalJSON added in v0.31.0

func (v RegisterAsset) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RegisterAsset) UnmarshalEasyJSON added in v0.31.0

func (v *RegisterAsset) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RegisterAsset) UnmarshalJSON added in v0.31.0

func (v *RegisterAsset) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RegisterAsset2 added in v0.31.0

type RegisterAsset2 struct {
	MaxGas       *int                 `json:"maxGas"       msgpack:"maxGas"`
	AssetRequest AssetRequest2        `json:"assetRequest" msgpack:"assetRequest"`
	Dex          string               `json:"dex"          msgpack:"dex"`
	Schema       *RegisterAssetSchema `json:"schema"       msgpack:"schema"`
}

func (RegisterAsset2) MarshalEasyJSON added in v0.31.0

func (v RegisterAsset2) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RegisterAsset2) MarshalJSON added in v0.31.0

func (v RegisterAsset2) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RegisterAsset2) UnmarshalEasyJSON added in v0.31.0

func (v *RegisterAsset2) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RegisterAsset2) UnmarshalJSON added in v0.31.0

func (v *RegisterAsset2) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RegisterAssetSchema added in v0.31.0

type RegisterAssetSchema struct {
	FullName        string  `json:"fullName"        msgpack:"fullName"`
	CollateralToken int     `json:"collateralToken" msgpack:"collateralToken"`
	OracleUpdater   *string `json:"oracleUpdater"   msgpack:"oracleUpdater"`
}

func (RegisterAssetSchema) MarshalEasyJSON added in v0.31.0

func (v RegisterAssetSchema) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RegisterAssetSchema) MarshalJSON added in v0.31.0

func (v RegisterAssetSchema) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RegisterAssetSchema) UnmarshalEasyJSON added in v0.31.0

func (v *RegisterAssetSchema) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RegisterAssetSchema) UnmarshalJSON added in v0.31.0

func (v *RegisterAssetSchema) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ReserveRequestWeightAction added in v0.33.0

type ReserveRequestWeightAction struct {
	Type   string `json:"type"   msgpack:"type"`
	Weight int    `json:"weight" msgpack:"weight"`
}

ReserveRequestWeightAction reserves request weight capacity Weight reservation costs 0.0005 USDC per weight unit

func (ReserveRequestWeightAction) MarshalEasyJSON added in v0.33.0

func (v ReserveRequestWeightAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ReserveRequestWeightAction) MarshalJSON added in v0.33.0

func (v ReserveRequestWeightAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ReserveRequestWeightAction) UnmarshalEasyJSON added in v0.33.0

func (v *ReserveRequestWeightAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ReserveRequestWeightAction) UnmarshalJSON added in v0.33.0

func (v *ReserveRequestWeightAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ReserveRequestWeightResponse added in v0.33.0

type ReserveRequestWeightResponse struct {
	Status   string               `json:"status"`
	Response *ReserveResponseData `json:"response,omitempty"`
	Error    string               `json:"error,omitempty"`
}

func (ReserveRequestWeightResponse) MarshalEasyJSON added in v0.33.0

func (v ReserveRequestWeightResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ReserveRequestWeightResponse) MarshalJSON added in v0.33.0

func (v ReserveRequestWeightResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ReserveRequestWeightResponse) UnmarshalEasyJSON added in v0.33.0

func (v *ReserveRequestWeightResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ReserveRequestWeightResponse) UnmarshalJSON added in v0.33.0

func (v *ReserveRequestWeightResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ReserveResponseData added in v0.33.1

type ReserveResponseData struct {
	Type string `json:"type"`
}

ReserveResponseData represents the parsed success data from a reserve request weight action.

func (ReserveResponseData) MarshalEasyJSON added in v0.33.1

func (v ReserveResponseData) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ReserveResponseData) MarshalJSON added in v0.33.1

func (v ReserveResponseData) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ReserveResponseData) UnmarshalEasyJSON added in v0.33.1

func (v *ReserveResponseData) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ReserveResponseData) UnmarshalJSON added in v0.33.1

func (v *ReserveResponseData) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ScheduleCancelAction added in v0.4.0

type ScheduleCancelAction struct {
	Type string `json:"type"           msgpack:"type"`
	Time *int64 `json:"time,omitempty" msgpack:"time,omitempty"`
}

ScheduleCancelAction represents schedule cancel action

func (ScheduleCancelAction) MarshalEasyJSON added in v0.4.0

func (v ScheduleCancelAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ScheduleCancelAction) MarshalJSON added in v0.4.0

func (v ScheduleCancelAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ScheduleCancelAction) UnmarshalEasyJSON added in v0.4.0

func (v *ScheduleCancelAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ScheduleCancelAction) UnmarshalJSON added in v0.4.0

func (v *ScheduleCancelAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ScheduleCancelResponse added in v0.4.1

type ScheduleCancelResponse struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

func (ScheduleCancelResponse) MarshalEasyJSON added in v0.4.1

func (v ScheduleCancelResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ScheduleCancelResponse) MarshalJSON added in v0.4.1

func (v ScheduleCancelResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ScheduleCancelResponse) UnmarshalEasyJSON added in v0.4.1

func (v *ScheduleCancelResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ScheduleCancelResponse) UnmarshalJSON added in v0.4.1

func (v *ScheduleCancelResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SetOracle added in v0.31.0

type SetOracle struct {
	Dex             string       `json:"dex"             msgpack:"dex"`
	OraclePxs       [][]string   `json:"oraclePxs"       msgpack:"oraclePxs"`
	MarkPxs         [][][]string `json:"markPxs"         msgpack:"markPxs"`
	ExternalPerpPxs [][]string   `json:"externalPerpPxs" msgpack:"externalPerpPxs"`
}

func (SetOracle) MarshalEasyJSON added in v0.31.0

func (v SetOracle) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SetOracle) MarshalJSON added in v0.31.0

func (v SetOracle) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SetOracle) UnmarshalEasyJSON added in v0.31.0

func (v *SetOracle) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SetOracle) UnmarshalJSON added in v0.31.0

func (v *SetOracle) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SetReferrerAction added in v0.4.5

type SetReferrerAction struct {
	Type string `json:"type" msgpack:"type"`
	Code string `json:"code" msgpack:"code"`
}

SetReferrerAction represents set referrer action

func (SetReferrerAction) MarshalEasyJSON added in v0.6.0

func (v SetReferrerAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SetReferrerAction) MarshalJSON added in v0.6.0

func (v SetReferrerAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SetReferrerAction) UnmarshalEasyJSON added in v0.6.0

func (v *SetReferrerAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SetReferrerAction) UnmarshalJSON added in v0.6.0

func (v *SetReferrerAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SetReferrerResponse added in v0.4.1

type SetReferrerResponse struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

func (SetReferrerResponse) MarshalEasyJSON added in v0.4.1

func (v SetReferrerResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SetReferrerResponse) MarshalJSON added in v0.4.1

func (v SetReferrerResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SetReferrerResponse) UnmarshalEasyJSON added in v0.4.1

func (v *SetReferrerResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SetReferrerResponse) UnmarshalJSON added in v0.4.1

func (v *SetReferrerResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SharedAssetCtx added in v0.20.0

type SharedAssetCtx struct {
	DayNtlVlm float64 `json:"dayNtlVlm,string"`
	PrevDayPx float64 `json:"prevDayPx,string"`
	MarkPx    float64 `json:"markPx,string"`
	MidPx     float64 `json:"midPx,string"`

	// PerpsAssetCtx
	Funding      float64 `json:"funding,string,omitempty"`
	OpenInterest float64 `json:"openInterest,string,omitempty"`
	OraclePx     float64 `json:"oraclePx,string,omitempty"`

	// SpotAssetCtx
	CirculatingSupply float64 `json:"circulatingSupply,string,omitempty"`
}

func (SharedAssetCtx) MarshalEasyJSON added in v0.20.0

func (v SharedAssetCtx) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SharedAssetCtx) MarshalJSON added in v0.20.0

func (v SharedAssetCtx) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SharedAssetCtx) UnmarshalEasyJSON added in v0.20.0

func (v *SharedAssetCtx) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SharedAssetCtx) UnmarshalJSON added in v0.20.0

func (v *SharedAssetCtx) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Side

type Side string
const (
	SideAsk Side = "A"
	SideBid Side = "B"
)

type SignatureResult added in v0.4.2

type SignatureResult struct {
	R string `json:"r"`
	S string `json:"s"`
	V int    `json:"v"`
}

SignatureResult represents the structured signature result

func SignAgent added in v0.4.0

func SignAgent(
	privateKey *ecdsa.PrivateKey,
	agentAddress, agentName string,
	nonce int64,
	isMainnet bool,
) (SignatureResult, error)

SignAgent signs agent approval action using EIP-712 direct signing

func SignApproveBuilderFee added in v0.4.0

func SignApproveBuilderFee(
	privateKey *ecdsa.PrivateKey,
	builderAddress string,
	maxFeeRate float64,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignApproveBuilderFee signs approve builder fee action

func SignConvertToMultiSigUserAction added in v0.4.0

func SignConvertToMultiSigUserAction(
	privateKey *ecdsa.PrivateKey,
	signers []string,
	threshold int,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignConvertToMultiSigUserAction signs convert to multi-sig user action

func SignL1Action

func SignL1Action(
	privateKey *ecdsa.PrivateKey,
	action any,
	vaultAddress string,
	timestamp int64,
	expiresAfter *int64,
	isMainnet bool,
) (SignatureResult, error)

func SignMultiSigAction added in v0.4.0

func SignMultiSigAction(
	privateKey *ecdsa.PrivateKey,
	innerAction map[string]any,
	signers []string,
	signatures []string,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignMultiSigAction signs multi-signature action

func SignPerpDexClassTransferAction added in v0.4.0

func SignPerpDexClassTransferAction(
	privateKey *ecdsa.PrivateKey,
	dex, token string,
	amount float64,
	toPerp bool,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignPerpDexClassTransferAction signs perp dex class transfer action

func SignSpotTransferAction added in v0.4.0

func SignSpotTransferAction(
	privateKey *ecdsa.PrivateKey,
	amount float64,
	destination, token string,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignSpotTransferAction signs spot transfer action

func SignTokenDelegateAction added in v0.4.0

func SignTokenDelegateAction(
	privateKey *ecdsa.PrivateKey,
	token string,
	amount float64,
	validatorAddress string,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignTokenDelegateAction signs token delegate action

func SignUsdClassTransferAction added in v0.4.0

func SignUsdClassTransferAction(
	privateKey *ecdsa.PrivateKey,
	amount float64,
	toPerp bool,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignUsdClassTransferAction signs USD class transfer action

func SignUsdTransferAction added in v0.4.0

func SignUsdTransferAction(
	privateKey *ecdsa.PrivateKey,
	amount float64,
	destination string,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignUsdTransferAction signs USD transfer action

func SignUserSignedAction added in v0.16.3

func SignUserSignedAction(
	privateKey *ecdsa.PrivateKey,
	action map[string]any,
	payloadTypes []apitypes.Type,
	primaryType string,
	isMainnet bool,
) (SignatureResult, error)

SignUserSignedAction signs actions that require direct EIP-712 signing (e.g., approveAgent, approveBuilderFee, convertToMultiSigUser)

IMPORTANT: The message will contain MORE fields than declared in payloadTypes to avoid the error "422 Failed to deserialize the JSON body" and "User or API Wallet 0x123... does not exist". This matches Python SDK behavior where the field order doesn't matter and extra fields (type, signatureChainId) are present in the message but ignored during EIP-712 hashing via hashStructLenient.

func SignWithdrawFromBridgeAction added in v0.4.0

func SignWithdrawFromBridgeAction(
	privateKey *ecdsa.PrivateKey,
	destination string,
	amount, fee float64,
	timestamp int64,
	isMainnet bool,
) (SignatureResult, error)

SignWithdrawFromBridgeAction signs withdraw from bridge action

type SpotAssetCtx

type SpotAssetCtx struct {
	DayNtlVlm         string  `json:"dayNtlVlm"`
	MarkPx            string  `json:"markPx"`
	MidPx             *string `json:"midPx"`
	PrevDayPx         string  `json:"prevDayPx"`
	CirculatingSupply string  `json:"circulatingSupply"`
	Coin              string  `json:"coin"`
}

func (SpotAssetCtx) MarshalEasyJSON added in v0.2.0

func (v SpotAssetCtx) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotAssetCtx) MarshalJSON added in v0.2.0

func (v SpotAssetCtx) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotAssetCtx) UnmarshalEasyJSON added in v0.2.0

func (v *SpotAssetCtx) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotAssetCtx) UnmarshalJSON added in v0.2.0

func (v *SpotAssetCtx) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotAssetInfo

type SpotAssetInfo struct {
	Name        string `json:"name"`
	Tokens      []int  `json:"tokens"`
	Index       int    `json:"index"`
	IsCanonical bool   `json:"isCanonical"`
}

func (SpotAssetInfo) MarshalEasyJSON added in v0.2.0

func (v SpotAssetInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotAssetInfo) MarshalJSON added in v0.2.0

func (v SpotAssetInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotAssetInfo) UnmarshalEasyJSON added in v0.2.0

func (v *SpotAssetInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotAssetInfo) UnmarshalJSON added in v0.2.0

func (v *SpotAssetInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotBalance added in v0.7.0

type SpotBalance struct {
	Coin     string `json:"coin"`
	Token    int    `json:"token"`
	Hold     string `json:"hold"`
	Total    string `json:"total"`
	EntryNtl string `json:"entryNtl"`
}

func (SpotBalance) MarshalEasyJSON added in v0.7.0

func (v SpotBalance) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotBalance) MarshalJSON added in v0.7.0

func (v SpotBalance) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotBalance) UnmarshalEasyJSON added in v0.7.0

func (v *SpotBalance) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotBalance) UnmarshalJSON added in v0.7.0

func (v *SpotBalance) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotDeployResponse added in v0.4.1

type SpotDeployResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (SpotDeployResponse) MarshalEasyJSON added in v0.4.1

func (v SpotDeployResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotDeployResponse) MarshalJSON added in v0.4.1

func (v SpotDeployResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotDeployResponse) UnmarshalEasyJSON added in v0.4.1

func (v *SpotDeployResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotDeployResponse) UnmarshalJSON added in v0.4.1

func (v *SpotDeployResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotMeta

type SpotMeta struct {
	Universe []SpotAssetInfo `json:"universe"`
	Tokens   []SpotTokenInfo `json:"tokens"`
}

func (SpotMeta) MarshalEasyJSON added in v0.2.0

func (v SpotMeta) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotMeta) MarshalJSON added in v0.2.0

func (v SpotMeta) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotMeta) UnmarshalEasyJSON added in v0.2.0

func (v *SpotMeta) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotMeta) UnmarshalJSON added in v0.2.0

func (v *SpotMeta) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotMetaAndAssetCtxs added in v0.6.2

type SpotMetaAndAssetCtxs struct {
	Meta SpotMeta
	Ctxs []SpotAssetCtx
}

This type has no JSON annotation because it cannot be directly unmarshalled from the response

func (SpotMetaAndAssetCtxs) MarshalEasyJSON added in v0.6.2

func (v SpotMetaAndAssetCtxs) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotMetaAndAssetCtxs) MarshalJSON added in v0.6.2

func (v SpotMetaAndAssetCtxs) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotMetaAndAssetCtxs) UnmarshalEasyJSON added in v0.6.2

func (v *SpotMetaAndAssetCtxs) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotMetaAndAssetCtxs) UnmarshalJSON added in v0.6.2

func (v *SpotMetaAndAssetCtxs) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotState added in v0.8.0

type SpotState struct {
	Balances []SpotBalance `json:"balances,omitempty"`
}

func (SpotState) MarshalEasyJSON added in v0.8.0

func (v SpotState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotState) MarshalJSON added in v0.8.0

func (v SpotState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotState) UnmarshalEasyJSON added in v0.8.0

func (v *SpotState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotState) UnmarshalJSON added in v0.8.0

func (v *SpotState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotTokenInfo

type SpotTokenInfo struct {
	Name        string       `json:"name"`
	SzDecimals  int          `json:"szDecimals"`
	WeiDecimals int          `json:"weiDecimals"`
	Index       int          `json:"index"`
	TokenID     string       `json:"tokenId"`
	IsCanonical bool         `json:"isCanonical"`
	EvmContract *EvmContract `json:"evmContract"`
	FullName    *string      `json:"fullName"`
}

func (SpotTokenInfo) MarshalEasyJSON added in v0.2.0

func (v SpotTokenInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotTokenInfo) MarshalJSON added in v0.2.0

func (v SpotTokenInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotTokenInfo) UnmarshalEasyJSON added in v0.2.0

func (v *SpotTokenInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotTokenInfo) UnmarshalJSON added in v0.2.0

func (v *SpotTokenInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotTransferAction added in v0.4.5

type SpotTransferAction struct {
	Type        string `json:"type"        msgpack:"type"`
	Destination string `json:"destination" msgpack:"destination"`
	Amount      string `json:"amount"      msgpack:"amount"`
	Token       string `json:"token"       msgpack:"token"`
	Time        int64  `json:"time"        msgpack:"time"`
}

SpotTransferAction represents spot transfer

func (SpotTransferAction) MarshalEasyJSON added in v0.6.0

func (v SpotTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotTransferAction) MarshalJSON added in v0.6.0

func (v SpotTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *SpotTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotTransferAction) UnmarshalJSON added in v0.6.0

func (v *SpotTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SpotUserState added in v0.7.0

type SpotUserState struct {
	Balances []SpotBalance `json:"balances"`
}

func (SpotUserState) MarshalEasyJSON added in v0.7.0

func (v SpotUserState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SpotUserState) MarshalJSON added in v0.7.0

func (v SpotUserState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SpotUserState) UnmarshalEasyJSON added in v0.7.0

func (v *SpotUserState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SpotUserState) UnmarshalJSON added in v0.7.0

func (v *SpotUserState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StakingDelegation

type StakingDelegation struct {
	Validator            string `json:"validator"`
	Amount               string `json:"amount"`
	LockedUntilTimestamp int64  `json:"lockedUntilTimestamp"`
}

func (StakingDelegation) MarshalEasyJSON added in v0.2.0

func (v StakingDelegation) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StakingDelegation) MarshalJSON added in v0.2.0

func (v StakingDelegation) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StakingDelegation) UnmarshalEasyJSON added in v0.2.0

func (v *StakingDelegation) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StakingDelegation) UnmarshalJSON added in v0.2.0

func (v *StakingDelegation) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StakingReward

type StakingReward struct {
	Time        int64  `json:"time"`
	Source      string `json:"source"`
	TotalAmount string `json:"totalAmount"`
}

func (StakingReward) MarshalEasyJSON added in v0.2.0

func (v StakingReward) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StakingReward) MarshalJSON added in v0.2.0

func (v StakingReward) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StakingReward) UnmarshalEasyJSON added in v0.2.0

func (v *StakingReward) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StakingReward) UnmarshalJSON added in v0.2.0

func (v *StakingReward) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StakingSummary

type StakingSummary struct {
	Delegated              string `json:"delegated"`
	Undelegated            string `json:"undelegated"`
	TotalPendingWithdrawal string `json:"totalPendingWithdrawal"`
	NPendingWithdrawals    int    `json:"nPendingWithdrawals"`
}

func (StakingSummary) MarshalEasyJSON added in v0.2.0

func (v StakingSummary) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StakingSummary) MarshalJSON added in v0.2.0

func (v StakingSummary) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StakingSummary) UnmarshalEasyJSON added in v0.2.0

func (v *StakingSummary) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StakingSummary) UnmarshalJSON added in v0.2.0

func (v *StakingSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SubAccount

type SubAccount struct {
	Name        string   `json:"name"`
	User        string   `json:"user"`
	Permissions []string `json:"permissions"`
}

func (SubAccount) MarshalEasyJSON added in v0.2.0

func (v SubAccount) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SubAccount) MarshalJSON added in v0.2.0

func (v SubAccount) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SubAccount) UnmarshalEasyJSON added in v0.2.0

func (v *SubAccount) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SubAccount) UnmarshalJSON added in v0.2.0

func (v *SubAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SubAccountSpotTransferAction added in v0.4.5

type SubAccountSpotTransferAction struct {
	Type           string  `json:"type"           msgpack:"type"`
	SubAccountUser string  `json:"subAccountUser" msgpack:"subAccountUser"`
	IsDeposit      bool    `json:"isDeposit"      msgpack:"isDeposit"`
	Token          string  `json:"token"          msgpack:"token"`
	Amount         float64 `json:"amount"         msgpack:"amount"`
}

SubAccountSpotTransferAction represents sub-account spot transfer

func (SubAccountSpotTransferAction) MarshalEasyJSON added in v0.6.0

func (v SubAccountSpotTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SubAccountSpotTransferAction) MarshalJSON added in v0.6.0

func (v SubAccountSpotTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SubAccountSpotTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *SubAccountSpotTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SubAccountSpotTransferAction) UnmarshalJSON added in v0.6.0

func (v *SubAccountSpotTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SubAccountTransferAction added in v0.4.5

type SubAccountTransferAction struct {
	Type           string `json:"type"           msgpack:"type"`
	SubAccountUser string `json:"subAccountUser" msgpack:"subAccountUser"`
	IsDeposit      bool   `json:"isDeposit"      msgpack:"isDeposit"`
	Usd            int    `json:"usd"            msgpack:"usd"`
}

SubAccountTransferAction represents sub-account transfer

func (SubAccountTransferAction) MarshalEasyJSON added in v0.6.0

func (v SubAccountTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SubAccountTransferAction) MarshalJSON added in v0.6.0

func (v SubAccountTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SubAccountTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *SubAccountTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SubAccountTransferAction) UnmarshalJSON added in v0.6.0

func (v *SubAccountTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Subscription

type Subscription struct {
	ID      string
	Payload any
	Close   func()
}

type Tiers

type Tiers struct {
	MM  []MMTier  `json:"mm"`
	VIP []VIPTier `json:"vip"`
}

func (Tiers) MarshalEasyJSON added in v0.2.0

func (v Tiers) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Tiers) MarshalJSON added in v0.2.0

func (v Tiers) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Tiers) UnmarshalEasyJSON added in v0.2.0

func (v *Tiers) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Tiers) UnmarshalJSON added in v0.2.0

func (v *Tiers) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Tif added in v0.6.3

type Tif string
const (
	// Add Liquidity Only
	TifAlo Tif = "Alo"
	// Immediate or Cancel
	TifIoc Tif = "Ioc"
	// Good Till Cancel
	TifGtc Tif = "Gtc"
)

Order Time-in-Force constants

type TokenDelegateAction added in v0.4.5

type TokenDelegateAction struct {
	Type         string `json:"type"         msgpack:"type"`
	Validator    string `json:"validator"    msgpack:"validator"`
	Wei          int    `json:"wei"          msgpack:"wei"`
	IsUndelegate bool   `json:"isUndelegate" msgpack:"isUndelegate"`
	Nonce        int64  `json:"nonce"        msgpack:"nonce"`
}

TokenDelegateAction represents token delegate action

func (TokenDelegateAction) MarshalEasyJSON added in v0.6.0

func (v TokenDelegateAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TokenDelegateAction) MarshalJSON added in v0.6.0

func (v TokenDelegateAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TokenDelegateAction) UnmarshalEasyJSON added in v0.6.0

func (v *TokenDelegateAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TokenDelegateAction) UnmarshalJSON added in v0.6.0

func (v *TokenDelegateAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TokenDetail added in v0.23.0

type TokenDetail struct {
	Name                       string              `json:"name"`
	MaxSupply                  string              `json:"maxSupply"`
	TotalSupply                string              `json:"totalSupply"`
	CirculatingSupply          string              `json:"circulatingSupply"`
	SzDecimals                 int                 `json:"szDecimals"`
	WeiDecimals                int                 `json:"weiDecimals"`
	MidPx                      string              `json:"midPx"`
	MarkPx                     string              `json:"markPx"`
	PrevDayPx                  string              `json:"prevDayPx"`
	Genesis                    *TokenDetailGenesis `json:"genesis"`
	Deployer                   *string             `json:"deployer"`
	DeployGas                  *string             `json:"deployGas"`
	DeployTime                 *string             `json:"deployTime"`
	SeededUsdc                 string              `json:"seededUsdc"`
	NonCirculatingUserBalances [][]string          `json:"nonCirculatingUserBalances"`
	FutureEmissions            string              `json:"futureEmissions"`
}

func (TokenDetail) MarshalEasyJSON added in v0.23.0

func (v TokenDetail) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TokenDetail) MarshalJSON added in v0.23.0

func (v TokenDetail) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TokenDetail) UnmarshalEasyJSON added in v0.23.0

func (v *TokenDetail) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TokenDetail) UnmarshalJSON added in v0.23.0

func (v *TokenDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TokenDetailGenesis added in v0.23.0

type TokenDetailGenesis struct {
	UserBalances          [][]string   `json:"userBalances"`
	ExistingTokenBalances []MixedArray `json:"existingTokenBalances"`
}

func (TokenDetailGenesis) MarshalEasyJSON added in v0.23.0

func (v TokenDetailGenesis) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TokenDetailGenesis) MarshalJSON added in v0.23.0

func (v TokenDetailGenesis) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TokenDetailGenesis) UnmarshalEasyJSON added in v0.23.0

func (v *TokenDetailGenesis) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TokenDetailGenesis) UnmarshalJSON added in v0.23.0

func (v *TokenDetailGenesis) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Tpsl added in v0.8.1

type Tpsl string // Advanced order type
const (
	TakeProfit Tpsl = "tp"
	StopLoss   Tpsl = "sl"
)

type Trade

type Trade struct {
	Coin  string   `json:"coin"`
	Side  string   `json:"side"`
	Px    string   `json:"px"`
	Sz    string   `json:"sz"`
	Time  int64    `json:"time"`
	Hash  string   `json:"hash"`
	Tid   int64    `json:"tid"`
	Users []string `json:"users"`
}

func (Trade) MarshalEasyJSON added in v0.2.0

func (v Trade) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Trade) MarshalJSON added in v0.2.0

func (v Trade) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Trade) UnmarshalEasyJSON added in v0.2.0

func (v *Trade) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Trade) UnmarshalJSON added in v0.2.0

func (v *Trade) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Trades added in v0.7.0

type Trades []Trade

func (Trades) Key added in v0.7.0

func (t Trades) Key() string

type TradesSubscriptionParams added in v0.7.0

type TradesSubscriptionParams struct {
	Coin string
}

type TransferResponse added in v0.4.1

type TransferResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (TransferResponse) MarshalEasyJSON added in v0.4.1

func (v TransferResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TransferResponse) MarshalJSON added in v0.4.1

func (v TransferResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TransferResponse) UnmarshalEasyJSON added in v0.4.1

func (v *TransferResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TransferResponse) UnmarshalJSON added in v0.4.1

func (v *TransferResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TriggerOrderType

type TriggerOrderType struct {
	TriggerPx float64 `json:"triggerPx" msgpack:"triggerPx"`
	IsMarket  bool    `json:"isMarket"  msgpack:"isMarket"`
	Tpsl      Tpsl    `json:"tpsl"      msgpack:"tpsl"` // "tp" or "sl"
}

func (TriggerOrderType) MarshalEasyJSON added in v0.2.0

func (v TriggerOrderType) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TriggerOrderType) MarshalJSON added in v0.2.0

func (v TriggerOrderType) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TriggerOrderType) UnmarshalEasyJSON added in v0.2.0

func (v *TriggerOrderType) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TriggerOrderType) UnmarshalJSON added in v0.2.0

func (v *TriggerOrderType) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Tuple2 added in v0.8.0

type Tuple2[E1 any, E2 any] struct {
	First  E1
	Second E2
}

func (Tuple2[E1, E2]) MarshalJSON added in v0.8.0

func (t Tuple2[E1, E2]) MarshalJSON() ([]byte, error)

func (*Tuple2[E1, E2]) UnmarshalJSON added in v0.8.0

func (t *Tuple2[E1, E2]) UnmarshalJSON(data []byte) error

type TwapState added in v0.25.0

type TwapState struct {
	Coin        string  `json:"coin"`
	User        string  `json:"user"`
	Side        string  `json:"side"`
	Sz          float64 `json:"sz,string"`
	ExecutedSz  float64 `json:"executedSz,string"`
	ExecutedNtl float64 `json:"executedNtl,string"`
	Minutes     int     `json:"minutes"`
	ReduceOnly  bool    `json:"reduceOnly"`
	Randomize   bool    `json:"randomize"`
	Timestamp   int64   `json:"timestamp"`
}

func (TwapState) MarshalEasyJSON added in v0.25.0

func (v TwapState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TwapState) MarshalJSON added in v0.25.0

func (v TwapState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TwapState) UnmarshalEasyJSON added in v0.25.0

func (v *TwapState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TwapState) UnmarshalJSON added in v0.25.0

func (v *TwapState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TwapStates added in v0.25.0

type TwapStates struct {
	Dex    string                   `json:"dex"`
	User   string                   `json:"user"`
	States []Tuple2[int, TwapState] `json:"states"`
}

func (TwapStates) Key added in v0.25.0

func (t TwapStates) Key() string

type TwapStatesSubscriptionParams added in v0.25.0

type TwapStatesSubscriptionParams struct {
	User string
	Dex  *string
}

type TxStatus added in v0.4.1

type TxStatus struct {
	Coin   string `json:"coin"`
	Status string `json:"status"`
}

func (TxStatus) MarshalEasyJSON added in v0.4.1

func (v TxStatus) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TxStatus) MarshalJSON added in v0.4.1

func (v TxStatus) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TxStatus) UnmarshalEasyJSON added in v0.4.1

func (v *TxStatus) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TxStatus) UnmarshalJSON added in v0.4.1

func (v *TxStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UpdateIsolatedMarginAction added in v0.4.5

type UpdateIsolatedMarginAction struct {
	Type  string  `json:"type"  msgpack:"type"`
	Asset int     `json:"asset" msgpack:"asset"`
	IsBuy bool    `json:"isBuy" msgpack:"isBuy"`
	Ntli  float64 `json:"ntli"  msgpack:"ntli"`
}

UpdateIsolatedMarginAction represents isolated margin update

func (UpdateIsolatedMarginAction) MarshalEasyJSON added in v0.6.0

func (v UpdateIsolatedMarginAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UpdateIsolatedMarginAction) MarshalJSON added in v0.6.0

func (v UpdateIsolatedMarginAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UpdateIsolatedMarginAction) UnmarshalEasyJSON added in v0.6.0

func (v *UpdateIsolatedMarginAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UpdateIsolatedMarginAction) UnmarshalJSON added in v0.6.0

func (v *UpdateIsolatedMarginAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UpdateLeverageAction added in v0.4.5

type UpdateLeverageAction struct {
	Type     string `json:"type"     msgpack:"type"`
	Asset    int    `json:"asset"    msgpack:"asset"`
	IsCross  bool   `json:"isCross"  msgpack:"isCross"`
	Leverage int    `json:"leverage" msgpack:"leverage"`
}

UpdateLeverageAction represents leverage update

func (UpdateLeverageAction) MarshalEasyJSON added in v0.6.0

func (v UpdateLeverageAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UpdateLeverageAction) MarshalJSON added in v0.6.0

func (v UpdateLeverageAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UpdateLeverageAction) UnmarshalEasyJSON added in v0.6.0

func (v *UpdateLeverageAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UpdateLeverageAction) UnmarshalJSON added in v0.6.0

func (v *UpdateLeverageAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UsdClassTransferAction added in v0.4.5

type UsdClassTransferAction struct {
	Type   string `json:"type"   msgpack:"type"`
	Amount string `json:"amount" msgpack:"amount"`
	ToPerp bool   `json:"toPerp" msgpack:"toPerp"`
	Nonce  int64  `json:"nonce"  msgpack:"nonce"`
}

UsdClassTransferAction represents USD class transfer

func (UsdClassTransferAction) MarshalEasyJSON added in v0.6.0

func (v UsdClassTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UsdClassTransferAction) MarshalJSON added in v0.6.0

func (v UsdClassTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UsdClassTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *UsdClassTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UsdClassTransferAction) UnmarshalJSON added in v0.6.0

func (v *UsdClassTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UsdTransferAction added in v0.4.5

type UsdTransferAction struct {
	Type        string `json:"type"        msgpack:"type"`
	Destination string `json:"destination" msgpack:"destination"`
	Amount      string `json:"amount"      msgpack:"amount"`
	Time        int64  `json:"time"        msgpack:"time"`
}

UsdTransferAction represents USD transfer

func (UsdTransferAction) MarshalEasyJSON added in v0.6.0

func (v UsdTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UsdTransferAction) MarshalJSON added in v0.6.0

func (v UsdTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UsdTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *UsdTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UsdTransferAction) UnmarshalJSON added in v0.6.0

func (v *UsdTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UseBigBlocksAction added in v0.4.5

type UseBigBlocksAction struct {
	Type           string `json:"type"           msgpack:"type"`
	UsingBigBlocks bool   `json:"usingBigBlocks" msgpack:"usingBigBlocks"`
}

UseBigBlocksAction represents use big blocks action

func (UseBigBlocksAction) MarshalEasyJSON added in v0.6.0

func (v UseBigBlocksAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UseBigBlocksAction) MarshalJSON added in v0.6.0

func (v UseBigBlocksAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UseBigBlocksAction) UnmarshalEasyJSON added in v0.6.0

func (v *UseBigBlocksAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UseBigBlocksAction) UnmarshalJSON added in v0.6.0

func (v *UseBigBlocksAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserActiveAssetData added in v0.7.0

type UserActiveAssetData struct {
	User             string   `json:"user"`
	Coin             string   `json:"coin"`
	Leverage         Leverage `json:"leverage"`
	MaxTradeSzs      []string `json:"maxTradeSzs"`
	AvailableToTrade []string `json:"availableToTrade"`
	MarkPx           string   `json:"markPx"`
}

func (UserActiveAssetData) MarshalEasyJSON added in v0.7.0

func (v UserActiveAssetData) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserActiveAssetData) MarshalJSON added in v0.7.0

func (v UserActiveAssetData) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserActiveAssetData) UnmarshalEasyJSON added in v0.7.0

func (v *UserActiveAssetData) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserActiveAssetData) UnmarshalJSON added in v0.7.0

func (v *UserActiveAssetData) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserFees

type UserFees struct {
	ActiveReferralDiscount string       `json:"activeReferralDiscount"`
	DailyUserVolume        []UserVolume `json:"dailyUserVlm"`
	FeeSchedule            FeeSchedule  `json:"feeSchedule"`
	UserAddRate            string       `json:"userAddRate"`
	UserCrossRate          string       `json:"userCrossRate"`
	UserSpotCrossRate      string       `json:"userSpotCrossRate"`
	UserSpotAddRate        string       `json:"userSpotAddRate"`
}

func (UserFees) MarshalEasyJSON added in v0.2.0

func (v UserFees) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserFees) MarshalJSON added in v0.2.0

func (v UserFees) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserFees) UnmarshalEasyJSON added in v0.2.0

func (v *UserFees) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserFees) UnmarshalJSON added in v0.2.0

func (v *UserFees) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserFillsParams added in v0.28.0

type UserFillsParams struct {
	Address         string
	AggregateByTime *bool
}

func (UserFillsParams) MarshalEasyJSON added in v0.28.0

func (v UserFillsParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserFillsParams) MarshalJSON added in v0.28.0

func (v UserFillsParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserFillsParams) UnmarshalEasyJSON added in v0.28.0

func (v *UserFillsParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserFillsParams) UnmarshalJSON added in v0.28.0

func (v *UserFillsParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserFundingHistory

type UserFundingHistory struct {
	Delta Delta  `json:"delta"`
	Hash  string `json:"hash"`
	Time  int64  `json:"time"`
}

func (UserFundingHistory) MarshalEasyJSON added in v0.2.0

func (v UserFundingHistory) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserFundingHistory) MarshalJSON added in v0.2.0

func (v UserFundingHistory) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserFundingHistory) UnmarshalEasyJSON added in v0.2.0

func (v *UserFundingHistory) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserFundingHistory) UnmarshalJSON added in v0.2.0

func (v *UserFundingHistory) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserNonFundingLedgerUpdates added in v0.29.0

type UserNonFundingLedgerUpdates struct {
	Delta LedgerDelta `json:"delta"`
	Hash  string      `json:"hash"`
	Time  int64       `json:"time"`
}

func (UserNonFundingLedgerUpdates) MarshalEasyJSON added in v0.29.0

func (v UserNonFundingLedgerUpdates) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserNonFundingLedgerUpdates) MarshalJSON added in v0.29.0

func (v UserNonFundingLedgerUpdates) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserNonFundingLedgerUpdates) UnmarshalEasyJSON added in v0.29.0

func (v *UserNonFundingLedgerUpdates) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserNonFundingLedgerUpdates) UnmarshalJSON added in v0.29.0

func (v *UserNonFundingLedgerUpdates) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserSignedActionSigner added in v0.34.0

type UserSignedActionSigner interface {
	SignUserSignedAction(
		ctx context.Context,
		action map[string]any,
		payloadTypes []apitypes.Type,
		primaryType string,
		isMainnet bool,
	) (SignatureResult, error)
}

UserSignedActionSigner signs direct EIP-712 user-signed actions. When nil on Exchange, the default ECDSA implementation is used.

func ECDSAUserSignedSigner added in v0.34.0

func ECDSAUserSignedSigner(pk *ecdsa.PrivateKey) UserSignedActionSigner

ECDSAUserSignedSigner implements UserSignedActionSigner using an ECDSA private key.

type UserState

type UserState struct {
	AssetPositions     []AssetPosition `json:"assetPositions"`
	CrossMarginSummary MarginSummary   `json:"crossMarginSummary"`
	MarginSummary      MarginSummary   `json:"marginSummary"`
	Withdrawable       string          `json:"withdrawable"`
}

func (UserState) MarshalEasyJSON added in v0.2.0

func (v UserState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserState) MarshalJSON added in v0.2.0

func (v UserState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserState) UnmarshalEasyJSON added in v0.2.0

func (v *UserState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserState) UnmarshalJSON added in v0.2.0

func (v *UserState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserVolume

type UserVolume struct {
	Date      string `json:"date"`
	Exchange  string `json:"exchange"`
	UserAdd   string `json:"userAdd"`
	UserCross string `json:"userCross"`
}

func (UserVolume) MarshalEasyJSON added in v0.2.0

func (v UserVolume) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserVolume) MarshalJSON added in v0.2.0

func (v UserVolume) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserVolume) UnmarshalEasyJSON added in v0.2.0

func (v *UserVolume) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserVolume) UnmarshalJSON added in v0.2.0

func (v *UserVolume) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type VIPTier

type VIPTier struct {
	Add       string `json:"add"`
	Cross     string `json:"cross"`
	NtlCutoff string `json:"ntlCutoff"`
}

func (VIPTier) MarshalEasyJSON added in v0.2.0

func (v VIPTier) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (VIPTier) MarshalJSON added in v0.2.0

func (v VIPTier) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*VIPTier) UnmarshalEasyJSON added in v0.2.0

func (v *VIPTier) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*VIPTier) UnmarshalJSON added in v0.2.0

func (v *VIPTier) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) MarshalEasyJSON added in v0.6.0

func (v ValidationError) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ValidationError) MarshalJSON added in v0.6.0

func (v ValidationError) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ValidationError) UnmarshalEasyJSON added in v0.6.0

func (v *ValidationError) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ValidationError) UnmarshalJSON added in v0.6.0

func (v *ValidationError) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ValidatorResponse added in v0.4.1

type ValidatorResponse struct {
	Status string `json:"status"`
	TxHash string `json:"txHash,omitempty"`
	Error  string `json:"error,omitempty"`
}

func (ValidatorResponse) MarshalEasyJSON added in v0.4.1

func (v ValidatorResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ValidatorResponse) MarshalJSON added in v0.4.1

func (v ValidatorResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ValidatorResponse) UnmarshalEasyJSON added in v0.4.1

func (v *ValidatorResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ValidatorResponse) UnmarshalJSON added in v0.4.1

func (v *ValidatorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type VaultDistributeAction added in v0.6.0

type VaultDistributeAction struct {
	Type         string `json:"type"         msgpack:"type"`
	VaultAddress string `json:"vaultAddress" msgpack:"vaultAddress"`
	Usd          int    `json:"usd"          msgpack:"usd"`
}

VaultDistributeAction represents vault distribute action

func (VaultDistributeAction) MarshalEasyJSON added in v0.6.0

func (v VaultDistributeAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (VaultDistributeAction) MarshalJSON added in v0.6.0

func (v VaultDistributeAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*VaultDistributeAction) UnmarshalEasyJSON added in v0.6.0

func (v *VaultDistributeAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*VaultDistributeAction) UnmarshalJSON added in v0.6.0

func (v *VaultDistributeAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type VaultModifyAction added in v0.6.0

type VaultModifyAction struct {
	Type                  string `json:"type"                  msgpack:"type"`
	VaultAddress          string `json:"vaultAddress"          msgpack:"vaultAddress"`
	AllowDeposits         bool   `json:"allowDeposits"         msgpack:"allowDeposits"`
	AlwaysCloseOnWithdraw bool   `json:"alwaysCloseOnWithdraw" msgpack:"alwaysCloseOnWithdraw"`
}

VaultModifyAction represents vault modify action

func (VaultModifyAction) MarshalEasyJSON added in v0.6.0

func (v VaultModifyAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (VaultModifyAction) MarshalJSON added in v0.6.0

func (v VaultModifyAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*VaultModifyAction) UnmarshalEasyJSON added in v0.6.0

func (v *VaultModifyAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*VaultModifyAction) UnmarshalJSON added in v0.6.0

func (v *VaultModifyAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type VaultUsdTransferAction added in v0.4.5

type VaultUsdTransferAction struct {
	Type         string `json:"type"         msgpack:"type"`
	VaultAddress string `json:"vaultAddress" msgpack:"vaultAddress"`
	IsDeposit    bool   `json:"isDeposit"    msgpack:"isDeposit"`
	Usd          int    `json:"usd"          msgpack:"usd"`
}

VaultUsdTransferAction represents vault USD transfer

func (VaultUsdTransferAction) MarshalEasyJSON added in v0.6.0

func (v VaultUsdTransferAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (VaultUsdTransferAction) MarshalJSON added in v0.6.0

func (v VaultUsdTransferAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*VaultUsdTransferAction) UnmarshalEasyJSON added in v0.6.0

func (v *VaultUsdTransferAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*VaultUsdTransferAction) UnmarshalJSON added in v0.6.0

func (v *VaultUsdTransferAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WebData2 added in v0.8.0

type WebData2 struct {
	ClearinghouseState     *ClearinghouseState `json:"clearinghouseState,omitempty"`
	LeadingVaults          []any               `json:"leadingVaults,omitempty"`
	TotalVaultEquity       string              `json:"totalVaultEquity,omitempty"`
	OpenOrders             []WsBasicOrder      `json:"openOrders,omitempty"`
	AgentAddress           *string             `json:"agentAddress,omitempty"`
	AgentValidUntil        *int64              `json:"agentValidUntil,omitempty"`
	CumLedger              string              `json:"cumLedger,omitempty"`
	Meta                   *WebData2Meta       `json:"meta,omitempty"`
	AssetCtxs              []AssetCtx          `json:"assetCtxs,omitempty"`
	ServerTime             int64               `json:"serverTime,omitempty"`
	IsVault                bool                `json:"isVault,omitempty"`
	User                   string              `json:"user,omitempty"`
	TwapStates             []any               `json:"twapStates,omitempty"`
	SpotState              *SpotState          `json:"spotState,omitempty"`
	SpotAssetCtxs          []SpotAssetCtx      `json:"spotAssetCtxs,omitempty"`
	PerpsAtOpenInterestCap []string            `json:"perpsAtOpenInterestCap,omitempty"`
}

func (WebData2) Key added in v0.8.0

func (w WebData2) Key() string

type WebData2AssetInfo added in v0.8.0

type WebData2AssetInfo struct {
	SzDecimals    int    `json:"szDecimals,omitempty"`
	Name          string `json:"name,omitempty"`
	MaxLeverage   int    `json:"maxLeverage,omitempty"`
	MarginTableID int    `json:"marginTableId,omitempty"`
	IsDelisted    bool   `json:"isDelisted,omitempty"`
	OnlyIsolated  bool   `json:"onlyIsolated,omitempty"`
}

func (WebData2AssetInfo) MarshalEasyJSON added in v0.8.0

func (v WebData2AssetInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WebData2AssetInfo) MarshalJSON added in v0.8.0

func (v WebData2AssetInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WebData2AssetInfo) UnmarshalEasyJSON added in v0.8.0

func (v *WebData2AssetInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WebData2AssetInfo) UnmarshalJSON added in v0.8.0

func (v *WebData2AssetInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WebData2MarginTable added in v0.8.0

type WebData2MarginTable struct {
	Description string               `json:"description,omitempty"`
	MarginTiers []WebData2MarginTier `json:"marginTiers,omitempty"`
}

func (WebData2MarginTable) MarshalEasyJSON added in v0.8.0

func (v WebData2MarginTable) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WebData2MarginTable) MarshalJSON added in v0.8.0

func (v WebData2MarginTable) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WebData2MarginTable) UnmarshalEasyJSON added in v0.8.0

func (v *WebData2MarginTable) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WebData2MarginTable) UnmarshalJSON added in v0.8.0

func (v *WebData2MarginTable) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WebData2MarginTier added in v0.8.0

type WebData2MarginTier struct {
	LowerBound  string `json:"lowerBound,omitempty"`
	MaxLeverage int    `json:"maxLeverage,omitempty"`
}

func (WebData2MarginTier) MarshalEasyJSON added in v0.8.0

func (v WebData2MarginTier) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WebData2MarginTier) MarshalJSON added in v0.8.0

func (v WebData2MarginTier) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WebData2MarginTier) UnmarshalEasyJSON added in v0.8.0

func (v *WebData2MarginTier) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WebData2MarginTier) UnmarshalJSON added in v0.8.0

func (v *WebData2MarginTier) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WebData2Meta added in v0.8.0

type WebData2Meta struct {
	Universe     []WebData2AssetInfo                `json:"universe,omitempty"`
	MarginTables []Tuple2[int, WebData2MarginTable] `json:"marginTables,omitempty"`
}

type WebData2SubscriptionParams added in v0.8.0

type WebData2SubscriptionParams struct {
	User string
}

type WebData3 added in v0.25.0

type WebData3 struct {
	UserState     WebData3UserState `json:"userState"`
	PerpDexStates []PerpDexState    `json:"perpDexStates"`
}

func (WebData3) Key added in v0.25.0

func (w WebData3) Key() string

type WebData3SubscriptionParams added in v0.25.0

type WebData3SubscriptionParams struct {
	User string
	Dex  *string
}

type WebData3UserState added in v0.25.0

type WebData3UserState struct {
	AgentAddress          *string `json:"agentAddress,omitempty"`
	AgentValidUntil       *int64  `json:"agentValidUntil,omitempty"`
	ServerTime            int64   `json:"serverTime"`
	CumLedger             float64 `json:"cumLedger,string"`
	IsVault               bool    `json:"isVault"`
	User                  string  `json:"user"`
	OptOutOfSpotDusting   *bool   `json:"optOutOfSpotDusting,omitempty"`
	DexAbstractionEnabled *bool   `json:"dexAbstractionEnabled,omitempty"`
}

func (WebData3UserState) MarshalEasyJSON added in v0.25.0

func (v WebData3UserState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WebData3UserState) MarshalJSON added in v0.25.0

func (v WebData3UserState) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WebData3UserState) UnmarshalEasyJSON added in v0.25.0

func (v *WebData3UserState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WebData3UserState) UnmarshalJSON added in v0.25.0

func (v *WebData3UserState) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WebsocketClient

type WebsocketClient struct {
	// contains filtered or unexported fields
}

func NewWebsocketClient

func NewWebsocketClient(baseURL string, opts ...WsOpt) *WebsocketClient

func (*WebsocketClient) ActiveAssetCtx added in v0.20.0

func (w *WebsocketClient) ActiveAssetCtx(
	params ActiveAssetCtxSubscriptionParams,
	callback func(ActiveAssetCtx, error),
) (*Subscription, error)

func (*WebsocketClient) AllMids added in v0.8.0

func (w *WebsocketClient) AllMids(
	params AllMidsSubscriptionParams,
	callback func(AllMids, error),
) (*Subscription, error)

func (*WebsocketClient) Bbo added in v0.10.0

func (w *WebsocketClient) Bbo(
	params BboSubscriptionParams,
	callback func(Bbo, error),
) (*Subscription, error)

func (*WebsocketClient) Candles added in v0.7.0

func (w *WebsocketClient) Candles(
	params CandlesSubscriptionParams,
	callback func(Candle, error),
) (*Subscription, error)

func (*WebsocketClient) ClearinghouseState added in v0.25.0

func (w *WebsocketClient) ClearinghouseState(
	params ClearinghouseStateSubscriptionParams,
	callback func(ClearinghouseState, error),
) (*Subscription, error)

func (*WebsocketClient) Close

func (w *WebsocketClient) Close() error

func (*WebsocketClient) Connect

func (w *WebsocketClient) Connect(ctx context.Context) error

func (*WebsocketClient) L2Book added in v0.7.0

func (w *WebsocketClient) L2Book(
	params L2BookSubscriptionParams,
	callback func(L2Book, error),
) (*Subscription, error)

func (*WebsocketClient) Notification added in v0.8.0

func (w *WebsocketClient) Notification(
	params NotificationSubscriptionParams,
	callback func(Notification, error),
) (*Subscription, error)

func (*WebsocketClient) OpenOrders added in v0.25.0

func (w *WebsocketClient) OpenOrders(
	params OpenOrdersSubscriptionParams,
	callback func(OpenOrders, error),
) (*Subscription, error)

func (*WebsocketClient) OrderFills added in v0.15.0

func (w *WebsocketClient) OrderFills(
	params OrderFillsSubscriptionParams,
	callback func(WsOrderFills, error),
) (*Subscription, error)

func (*WebsocketClient) OrderUpdates added in v0.8.0

func (w *WebsocketClient) OrderUpdates(
	params OrderUpdatesSubscriptionParams,
	callback func([]WsOrder, error),
) (*Subscription, error)

func (*WebsocketClient) Trades added in v0.7.0

func (w *WebsocketClient) Trades(
	params TradesSubscriptionParams,
	callback func([]Trade, error),
) (*Subscription, error)

func (*WebsocketClient) TwapStates added in v0.25.0

func (w *WebsocketClient) TwapStates(
	params TwapStatesSubscriptionParams,
	callback func(TwapStates, error),
) (*Subscription, error)

func (*WebsocketClient) WebData2 added in v0.8.0

func (w *WebsocketClient) WebData2(
	params WebData2SubscriptionParams,
	callback func(WebData2, error),
) (*Subscription, error)

func (*WebsocketClient) WebData3 added in v0.25.0

func (w *WebsocketClient) WebData3(
	params WebData3SubscriptionParams,
	callback func(WebData3, error),
) (*Subscription, error)

type WithdrawFromBridgeAction added in v0.4.5

type WithdrawFromBridgeAction struct {
	Type        string `json:"type"        msgpack:"type"`
	Destination string `json:"destination" msgpack:"destination"`
	Amount      string `json:"amount"      msgpack:"amount"`
	Time        int64  `json:"time"        msgpack:"time"`
}

WithdrawFromBridgeAction represents withdraw from bridge action

func (WithdrawFromBridgeAction) MarshalEasyJSON added in v0.6.0

func (v WithdrawFromBridgeAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WithdrawFromBridgeAction) MarshalJSON added in v0.6.0

func (v WithdrawFromBridgeAction) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WithdrawFromBridgeAction) UnmarshalEasyJSON added in v0.6.0

func (v *WithdrawFromBridgeAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WithdrawFromBridgeAction) UnmarshalJSON added in v0.6.0

func (v *WithdrawFromBridgeAction) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsBasicOrder added in v0.8.0

type WsBasicOrder struct {
	Coin      string  `json:"coin"`
	Side      string  `json:"side"`
	LimitPx   string  `json:"limitPx"`
	Sz        string  `json:"sz"`
	Oid       int64   `json:"oid"`
	Timestamp int64   `json:"timestamp"`
	OrigSz    string  `json:"origSz"`
	Cloid     *string `json:"cloid"`
}

func (WsBasicOrder) MarshalEasyJSON added in v0.8.0

func (v WsBasicOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WsBasicOrder) MarshalJSON added in v0.8.0

func (v WsBasicOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WsBasicOrder) UnmarshalEasyJSON added in v0.8.0

func (v *WsBasicOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WsBasicOrder) UnmarshalJSON added in v0.8.0

func (v *WsBasicOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsMsg

type WsMsg struct {
	Channel string         `json:"channel"`
	Data    map[string]any `json:"data"`
}

WsMsg represents a WebSocket message with a channel and data payload.

func (WsMsg) MarshalEasyJSON added in v0.2.0

func (v WsMsg) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WsMsg) MarshalJSON added in v0.2.0

func (v WsMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WsMsg) UnmarshalEasyJSON added in v0.2.0

func (v *WsMsg) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WsMsg) UnmarshalJSON added in v0.2.0

func (v *WsMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsOpt added in v0.9.0

type WsOpt = Opt[WebsocketClient]

func WsOptDebugMode added in v0.9.0

func WsOptDebugMode() WsOpt

func WsOptDialer added in v0.30.0

func WsOptDialer(dialer *websocket.Dialer) WsOpt

WsOptDialer allows setting a custom websocket.Dialer

func WsOptReadTimeout added in v0.31.0

func WsOptReadTimeout(timeout time.Duration) WsOpt

WsOptReadTimeout sets the maximum duration to wait for a single read from the server. If no message is received within the timeout the connection is closed and a reconnection is attempted. Must exceed the internal ping interval (50 s). Defaults to 90 s.

type WsOrder added in v0.8.0

type WsOrder struct {
	Order           WsBasicOrder     `json:"order"`
	Status          OrderStatusValue `json:"status"`
	StatusTimestamp int64            `json:"statusTimestamp"`
}

func (WsOrder) MarshalEasyJSON added in v0.8.0

func (v WsOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WsOrder) MarshalJSON added in v0.8.0

func (v WsOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WsOrder) UnmarshalEasyJSON added in v0.8.0

func (v *WsOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WsOrder) UnmarshalJSON added in v0.8.0

func (v *WsOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsOrderFill added in v0.15.0

type WsOrderFill struct {
	Coin          string           `json:"coin"`
	Px            string           `json:"px"` // price
	Sz            string           `json:"sz"` // size
	Side          string           `json:"side"`
	Time          int64            `json:"time"`
	StartPosition string           `json:"startPosition"`
	Dir           string           `json:"dir"` // used for frontend display
	ClosedPnl     string           `json:"closedPnl"`
	Hash          string           `json:"hash"`    // L1 transaction hash
	Oid           int64            `json:"oid"`     // order id
	Crossed       bool             `json:"crossed"` // whether order crossed the spread (was taker)
	Fee           string           `json:"fee"`     // negative means rebate
	Tid           int64            `json:"tid"`     // unique trade id
	Liquidation   *FillLiquidation `json:"liquidation,omitempty"`
	FeeToken      string           `json:"feeToken"`             // the token the fee was paid in
	BuilderFee    *string          `json:"builderFee,omitempty"` // amount paid to builder, also included in fee
}

func (WsOrderFill) MarshalEasyJSON added in v0.15.0

func (v WsOrderFill) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WsOrderFill) MarshalJSON added in v0.15.0

func (v WsOrderFill) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WsOrderFill) UnmarshalEasyJSON added in v0.15.0

func (v *WsOrderFill) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WsOrderFill) UnmarshalJSON added in v0.15.0

func (v *WsOrderFill) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsOrderFills added in v0.15.0

type WsOrderFills struct {
	IsSnapshot bool          `json:"isSnapshot"`
	User       string        `json:"user"`
	Fills      []WsOrderFill `json:"fills"`
}

func (WsOrderFills) Key added in v0.15.0

func (w WsOrderFills) Key() string

func (WsOrderFills) MarshalEasyJSON added in v0.15.0

func (v WsOrderFills) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WsOrderFills) MarshalJSON added in v0.15.0

func (v WsOrderFills) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WsOrderFills) UnmarshalEasyJSON added in v0.15.0

func (v *WsOrderFills) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WsOrderFills) UnmarshalJSON added in v0.15.0

func (v *WsOrderFills) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WsOrders added in v0.8.0

type WsOrders []WsOrder

func (WsOrders) Key added in v0.8.0

func (w WsOrders) Key() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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