types

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EIP712_TYPES = apitypes.Types{
	"EIP712Domain": {
		{
			Name: "name",
			Type: "string",
		},
		{
			Name: "version",
			Type: "string",
		},
		{
			Name: "chainId",
			Type: "uint256",
		},
		{
			Name: "verifyingContract",
			Type: "address",
		},
	},
	"LoginMessage": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "message",
			Type: "string",
		},
		{
			Name: "timestamp",
			Type: "uint64",
		},
	},
	"Order": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
		{
			Name: "isBuy",
			Type: "bool",
		},
		{
			Name: "orderType",
			Type: "uint8",
		},
		{
			Name: "timeInForce",
			Type: "uint8",
		},
		{
			Name: "expiration",
			Type: "uint64",
		},
		{
			Name: "price",
			Type: "uint128",
		},
		{
			Name: "quantity",
			Type: "uint128",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"CancelOrders": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
	},
	"CancelOrder": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
		{
			Name: "orderId",
			Type: "string",
		},
	},
	"ApproveSigner": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "approvedSigner",
			Type: "address",
		},
		{
			Name: "isApproved",
			Type: "bool",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"Deposit": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "asset",
			Type: "address",
		},
		{
			Name: "quantity",
			Type: "uint256",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"Withdraw": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "asset",
			Type: "address",
		},
		{
			Name: "quantity",
			Type: "uint128",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"SignedAuthentication": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
	},
	"Referral": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "code",
			Type: "string",
		},
	},
}

Functions

This section is empty.

Types

type APIEndpoint

type APIEndpoint string

type ApproveRevokeSignerRequest

type ApproveRevokeSignerRequest struct {
	ApprovedSigner string // The address of the account that will be an approvedSigner on the given subaccount.
	Nonce          int64  // The nonce. Suggest using the current UNIX timestamp in milliseconds.
}

type CancelOrderAndReplaceRequest

type CancelOrderAndReplaceRequest struct {
	IdToCancel string           // ID of the order to be replaced.
	NewOrder   *NewOrderRequest // The new order details to be used in the replacement.
}

type CancelOrderRequest

type CancelOrderRequest struct {
	Product    *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`.
	IdToCancel string   // The unique ID of the order you wish to cancel.
}

type Environment

type Environment string

type IEthClient

type IEthClient interface {
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
	NetworkID(ctx context.Context) (*big.Int, error)
	SendTransaction(ctx context.Context, tx *types.Transaction) error
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
}

type IHTTPClient

type IHTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type IWSConnection

type IWSConnection interface {
	WriteMessage(messageType int, body []byte) error
}

type Interval

type Interval string

type KlineDataRequest

type KlineDataRequest struct {
	Product   *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`.
	Interval  Interval // The interval. Can be `constants.INTERVAL_M1`, `constants.INTERVAL_5M`, `constants.INTERVAL_15M`, `constants.INTERVAL_30M`, `constants.INTERVAL_1H`, `constants.INTERVAL_2H`, `constants.INTERVAL_4H`, `constants.INTERVAL_8H`, `constants.INTERVAL_1D`, `constants.INTERVAL_3D` or `constants.INTERVAL_1W`.
	StartTime int64    // Start timestamp in ms.
	EndTime   int64    // End timestamp in ms.
	Limit     int64    // Number of values to retrieve (max 1000).
}

type Limit

type Limit int64

type ListOrdersRequest

type ListOrdersRequest struct {
	Product   *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`.
	Ids       []string // IDs of specific orders you would like to retrieve.
	StartTime int64    // The start time. Ignored for REST api requests.
	EndTime   int64    // The end time. Ignored for REST api requests.
	Limit     int64    // The limit. Ignored for REST api requests.
}

type MarginAsset

type MarginAsset string

type NewOrderRequest

type NewOrderRequest struct {
	Product     *Product    // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`.
	IsBuy       bool        // Whether the account is buying or selling.
	OrderType   OrderType   // The order type. Can be `constants.ORDER_TYPE_LIMIT`, `constants.ORDER_TYPE_LIMIT_MAKER`, `constants.ORDER_TYPE_MARKET`, `constants.ORDER_TYPE_STOP_LOSS`, `constants.ORDER_TYPE_STOP_LOSS_LIMIT`, `constants.ORDER_TYPE_TAKE_PROFIT` or `constants.ORDER_TYPE_TAKE_PROFIT_LIMIT`.
	TimeInForce TimeInForce // Order time in force. Can be `constants.TIME_IN_FORCE_GTC`, `constants.TIME_IN_FORCE_FOK` or `constants.TIME_IN_FORCE_IOC`.
	Price       string      // Price in wei (e18).
	Quantity    string      // Quantity in wei (e18).
	Expiration  int64       // UNIX timestamp (in ms) after which the order is no longer active.
	Nonce       int64       // The nonce. Suggest using the current UNIX timestamp in milliseconds.
}

type OrderBookRequest

type OrderBookRequest struct {
	Product     *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`.
	Granularity int64    // The number of decimals to remove from prices.
	Limit       Limit    // The number of bids and asks to retrieve. Can be `constants.FIVE`, `constants.TEN` or `constants.TWENTY`.
}

type OrderType

type OrderType int64

type PrimaryType

type PrimaryType string

type Product

type Product struct {
	Symbol string // `constants.PRODUCT_ETH_PERP.Symbol`, `constants.PRODUCT_BTC_PERP.Symbol`.
	Id     int64  // `constants.PRODUCT_ETH_PERP.Id`, `constants.PRODUCT_BTC_PERP.Id`.
}

type TimeInForce

type TimeInForce int64

type WSMethod

type WSMethod string

type WebsocketError

type WebsocketError struct {
	Code    int         `json:"code,omitempty" binding:"required"`
	Message string      `json:"message,omitempty" binding:"required"`
	Data    interface{} `json:"data,omitempty"`
}

type WebsocketRequest

type WebsocketRequest struct {
	JsonRPC string      `json:"jsonrpc"`
	ID      string      `json:"id"`
	Method  WSMethod    `json:"method"`
	Params  interface{} `json:"params"`
}

type WebsocketResponse

type WebsocketResponse struct {
	JsonRPC string          `json:"jsonrpc"`
	ID      string          `json:"id" binding:"required"`
	Success bool            `json:"success" binding:"required"`
	Result  interface{}     `json:"result,omitempty"`
	Error   *WebsocketError `json:"error,omitempty"`
}

type WithdrawRequest

type WithdrawRequest struct {
	Quantity string // Quantity in wei (e18).
	Nonce    int64  // The nonce. Suggest using the current UNIX timestamp in milliseconds.
}

Jump to

Keyboard shortcuts

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