Documentation
¶
Index ¶
- Constants
- func IsAPIError(e error) bool
- type APIError
- type Client
- func (c *Client) GetAuthError() error
- func (c *Client) GetChainID() int64
- func (c *Client) GetHttpClient() *resty.Client
- func (c *Client) GetLogger() log.Logger
- func (c *Client) GetOrderCount() OrderCount
- func (c *Client) GetPrivateKeyHex() string
- func (c *Client) GetRecvWindow() int64
- func (c *Client) GetSignFn() SignFn
- func (c *Client) GetSignerAddress() string
- func (c *Client) GetSignerPrivateKey() *ecdsa.PrivateKey
- func (c *Client) GetTimeOffsetMs() int64
- func (c *Client) GetUsedWeight() UsedWeight
- func (c *Client) GetUserAddress() string
- func (c *Client) NextNonce() int64
- func (c *Client) SetOrderCount(count10s, count1d *int64)
- func (c *Client) SetTimeOffset(offsetMs int64)
- func (c *Client) SetUsedWeight(used, used1m *int64)
- type Option
- type Options
- func WithAuth(userAddress, signerPrivateKeyHex string) Options
- func WithLogger(logger log.Logger) Options
- func WithNetwork(network asterCommon.Network) Options
- func WithProxy(proxyURL string) Options
- func WithRecvWindow(recvWindow int64) Options
- func WithSignRequestFn(signFn SignFn) Options
- func WithTEEAuth(userAddress, signerAddress string) Options
- func WithTimeOffset(timeOffsetMs int64) Options
- type OrderCount
- type Product
- type SignFn
- type UsedWeight
- type WebSocketClient
- type WebSocketOption
- type WebSocketOptions
Constants ¶
const (
DEFAULT_RECV_WINDOW = 5000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
UsedWeight UsedWeight
OrderCount OrderCount
// contains filtered or unexported fields
}
func (*Client) GetAuthError ¶
func (*Client) GetChainID ¶
func (*Client) GetHttpClient ¶
func (*Client) GetOrderCount ¶
func (c *Client) GetOrderCount() OrderCount
func (*Client) GetPrivateKeyHex ¶
func (*Client) GetRecvWindow ¶
func (*Client) GetSignerAddress ¶
func (*Client) GetSignerPrivateKey ¶
func (c *Client) GetSignerPrivateKey() *ecdsa.PrivateKey
func (*Client) GetTimeOffsetMs ¶
func (*Client) GetUsedWeight ¶
func (c *Client) GetUsedWeight() UsedWeight
func (*Client) GetUserAddress ¶
func (*Client) NextNonce ¶
NextNonce returns a microsecond-precision nonce that is monotonically increasing across concurrent calls. The local clock is adjusted by timeOffsetMs to compensate for client-server time drift.
func (*Client) SetOrderCount ¶
func (*Client) SetTimeOffset ¶
func (*Client) SetUsedWeight ¶
type Options ¶
type Options func(*Option)
func WithAuth ¶
WithAuth configures the credentials used for V3 signed requests. userAddress is the main wallet address (may be empty when not required by the endpoint). signerPrivateKeyHex is the API wallet private key in hex (with or without the "0x" prefix); the signer address is derived from it.
func WithLogger ¶
func WithNetwork ¶
func WithNetwork(network asterCommon.Network) Options
WithNetwork selects the Aster network. The REST base URL and the EIP-712 chainId are both derived from this value. Defaults to common.Mainnet.
func WithProxy ¶
WithProxy routes all REST traffic through the given proxy. Supported schemes: http, https, socks5, socks5h. Pass userinfo in the URL for authenticated proxies, e.g. "http://user:pass@host:8080" or "socks5://user:pass@host:1080". Invalid URLs are logged and skipped.
func WithRecvWindow ¶
func WithSignRequestFn ¶
WithSignRequestFn replaces the default EIP-712 + ECDSA signer with a custom implementation (e.g. for HSM, TEE, or a remote signing service).
func WithTEEAuth ¶
WithTEEAuth configures credentials for TEE / HSM / remote-signer mode where the signer's private key never leaves the enclave. Pass the main wallet address and the API-wallet (signer) address; no local private key is required. Must be combined with WithSignRequestFn, which is what actually performs the EIP-712 signing -- typically by shelling out to the TEE binary.
func WithTimeOffset ¶
type OrderCount ¶
type Product ¶
type Product int
Product distinguishes the spot and futures REST endpoints. It is supplied by the spot/futures package wrappers; end users do not pass this directly.
type SignFn ¶
SignFn signs an EIP-712 typed-data payload using the signer's private key. The msg argument is the URL-encoded query string of the request parameters (placed inside Message.msg). The function returns a hex-encoded signature (with the leading "0x" omitted, matching eth_account.sign_message output).
type UsedWeight ¶
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
func NewWebSocketClient ¶
func NewWebSocketClient(product Product, options ...WebSocketOptions) *WebSocketClient
func (*WebSocketClient) GetBaseURL ¶
func (c *WebSocketClient) GetBaseURL() string
func (*WebSocketClient) GetDialer ¶
func (c *WebSocketClient) GetDialer() *websocket.Dialer
func (*WebSocketClient) GetHttpClient ¶
func (c *WebSocketClient) GetHttpClient() *resty.Client
func (*WebSocketClient) GetLogger ¶
func (c *WebSocketClient) GetLogger() log.Logger
type WebSocketOption ¶
type WebSocketOption struct {
// contains filtered or unexported fields
}
type WebSocketOptions ¶
type WebSocketOptions func(*WebSocketOption)
func WithWebSocketLogger ¶
func WithWebSocketLogger(logger log.Logger) WebSocketOptions
func WithWebSocketNetwork ¶
func WithWebSocketNetwork(network asterCommon.Network) WebSocketOptions
WithWebSocketNetwork selects the Aster network for the WebSocket client. Defaults to common.Mainnet.
func WithWebSocketProxy ¶
func WithWebSocketProxy(proxyURL string) WebSocketOptions
WithWebSocketProxy routes the WebSocket dial through the given proxy. Supported schemes: http, https, socks5, socks5h. Behaves like WithProxy: userinfo in the URL is passed through for auth, invalid URLs are logged and skipped.