Documentation ¶
Index ¶
- Constants
- Variables
- type AllTickerResponse
- type Ask
- type BalancePayload
- type BalanceResponse
- type BaseURL
- type Bid
- type CandleStickOptions
- type CandleStickResponse
- type Client
- func (c *Client) AllTickers(ctx context.Context) (AllTickerResponse, error)
- func (c *Client) Balance(ctx context.Context, currency Currency) (BalanceResponse, error)
- func (c *Client) CandleStick(ctx context.Context, market string, options CandleStickOptions) (CandleStickResponse, error)
- func (c *Client) CheckAuth() error
- func (c *Client) CompleteNormalWithdrawal(ctx context.Context, rpcURL string, ethPrivateKey string, ...) (string, error)
- func (c *Client) CrossChainDepositStart(ctx context.Context, crossChainDepositRequest CrossChainDepositRequest) (CryptoDepositResponse, error)
- func (c *Client) DepositFromEthereumNetwork(ctx context.Context, rpcURL string, ethAddress string, ethPrivateKey string, ...) (CryptoDepositResponse, error)
- func (c *Client) DepositFromPolygonNetwork(ctx context.Context, rpcURL string, ethAddress string, ethPrivateKey string, ...) (CryptoDepositResponse, error)
- func (c *Client) FastWithdrawal(ctx context.Context, starkPrivateKey string, amount float64, currency Currency, ...) (ValidateWithdrawalResponse, error)
- func (c *Client) GetNetworkConfig(ctx context.Context) (NetworkConfigResponse, error)
- func (c *Client) GetPendingNormalWithdrawalAmountByCoin(ctx context.Context, rpcURL string, userPublicEthAddress string, ...) (string, error)
- func (c *Client) Health(ctx context.Context) (HealthResponse, error)
- func (c *Client) InitiateNormalWithdrawal(ctx context.Context, starkPrivateKey string, amount float64, currency Currency) (ValidateWithdrawalResponse, error)
- func (c *Client) InternalTransferCreate(ctx context.Context, starkPrivateKey string, ...) (InternalTransferProcessResponse, error)
- func (c *Client) InternalTransferGet(ctx context.Context, clientReferenceId string) (InternalTransferGetResponse, error)
- func (c *Client) InternalTransferList(ctx context.Context, opt InternalTransferListRequest) (InternalTransferListResponse, error)
- func (c *Client) InternalTransferUser(ctx context.Context, opt InternalTransferUserRequest) (InternalTransferUserResponse, error)
- func (c *Client) ListAllDeposits(ctx context.Context) (ListDepositsResponse, error)
- func (c *Client) ListFastWithdrawal(ctx context.Context, opt ListWithdrawalRequest) (ListWithdrawalResponse, error)
- func (c *Client) ListNormalWithdrawal(ctx context.Context, opt ListWithdrawalRequest) (ListWithdrawalResponse, error)
- func (c *Client) Login(ctx context.Context, ethAddress string, privateKey string) (JWTResponse, error)
- func (c *Client) Nonce(ctx context.Context, ethAddress string) (NonceResponse, error)
- func (c *Client) OrderBook(ctx context.Context, market string, options OrderBookOptions) (OrderBookResponse, error)
- func (c *Client) OrderCancel(ctx context.Context, orderID int) (OrderCancelResponse, error)
- func (c *Client) OrderCreate(ctx context.Context, starkPrivateKey string, opt OrderNonceRequest) (OrderCreateResponse, error)
- func (c *Client) OrderGet(ctx context.Context, id int) (OrderGetResponse, error)
- func (c *Client) OrdersList(ctx context.Context, opt OrderListOptions) (OrdersListResponse, error)
- func (c *Client) PNL(ctx context.Context) (PNLResponse, error)
- func (c *Client) Profile(ctx context.Context) (ProfileResponse, error)
- func (c *Client) RefreshTokens(ctx context.Context) (RefreshTokenResponse, error)
- func (c *Client) SetEthereumAllowance(ctx context.Context, rpcURL string, ethPrivateKey string, currency Currency, ...) error
- func (c *Client) SetPolygonAllowance(ctx context.Context, rpcURL string, ethPrivateKey string, currency Currency, ...) error
- func (c *Client) Ticker(ctx context.Context, market string) (TickerResponse, error)
- func (c *Client) Trades(ctx context.Context, market string, options TradesOptions) (TradesResponse, error)
- func (c *Client) TradesList(ctx context.Context, opt TradesListOptions) (TradesListResponse, error)
- type CoinStatusPayload
- type CoinStatusResponse
- type CoinToken
- type CrossChainDepositRequest
- type CryptoDepositRequest
- type CryptoDepositResponse
- type Currency
- type ErrClient
- type ErrInsufficientAllowance
- type ErrJSONDecoding
- type ErrServer
- type HealthResponse
- type InternalTransferGetResponse
- type InternalTransferInitiatePayload
- type InternalTransferInitiateRequest
- type InternalTransferInitiateResponse
- type InternalTransferListRequest
- type InternalTransferListResponse
- type InternalTransferProcessRequest
- type InternalTransferProcessResponse
- type InternalTransferUserRequest
- type InternalTransferUserResponse
- type JWTPayload
- type JWTRequest
- type JWTResponse
- type ListDepositsResponse
- type ListNormalWithdrawalPayload
- type ListWithdrawalRequest
- type ListWithdrawalResponse
- type Network
- type NetworkConfigData
- type NetworkConfigResponse
- type NonceRequest
- type NonceResponse
- type OrderBookOptions
- type OrderBookPayload
- type OrderBookResponse
- type OrderBy
- type OrderCancelRequest
- type OrderCancelResponse
- type OrderCreateRequest
- type OrderCreateResponse
- type OrderCreateSignature
- type OrderGetResponse
- type OrderListOptions
- type OrderNoncePayload
- type OrderNonceRequest
- type OrderNonceResponse
- type OrderPayload
- type OrdersListResponse
- type PNLPayload
- type PNLResponse
- type Period
- type PolygonContract
- type ProcessFastWithdrawalRequest
- type ProfilePayload
- type ProfileResponse
- type RefreshTokenPayload
- type RefreshTokenRequest
- type RefreshTokenResponse
- type Signature
- type StarkexContract
- type StartFastWithdrawalRequest
- type StartFastWithdrawalResponse
- type StartNormalWithdrawalPaylaod
- type StartNormalWithdrawalRequest
- type StartNormalWithdrawalResponse
- type Status
- type Ticker
- type TickerPayload
- type TickerResponse
- type Token
- type TradePayload
- type TradesListOptions
- type TradesListResponse
- type TradesOptions
- type TradesPayload
- type TradesResponse
- type ValidateNormalWithdrawalRequest
- type ValidateWithdrawalResponse
- type VaultRequest
- type VaultResponse
- type WSignature
Constants ¶
const ( HEALTH_ENDPOINT = "/sapi/v1/health/" TICKER_ENDPOINT = "/sapi/v1/market/tickers/" CANDLESTICK_ENDPOINT = "/sapi/v1/market/kline/" ORDERBOOK_ENDPOINT = "/sapi/v1/market/orderbook/" TRADES_ENDPOINT = "/sapi/v1/market/trades/" NONCE_ENDPOINT = "/sapi/v2/auth/nonce/" LOGIN_ENDPOINT = "/sapi/v2/auth/login/" REFRESH_TOKEN_ENDPOINT = "/sapi/v1/auth/token/refresh/" PROFILE_ENDPOINT = "/sapi/v1/user/profile/" BALANCE_ENDPOINT = "/sapi/v1/user/balance/" PNL_ENDPOINT = "/sapi/v1/user/pnl/" ORDER_BASE_ENDPOINT = "/sapi/v1/orders/" ORDER_NONCE_ENDPOINT = "/sapi/v1/orders/nonce/" ORDER_CREATE_ENDPOINT = "/sapi/v1/orders/create/" ORDER_CANCEL_ENDPOINT = "/sapi/v1/orders/cancel/" TRADES_LIST_ENDPOINT = "/sapi/v1/trades/" COIN_ENDPOINT = "/main/stat/v2/coins/" VAULTID_ENDPOINT = "/main/user/create_vault/" NETWORK_CONFIG_ENDPOINT = "/main/stat/v2/app-and-markets/" CRYPTO_DEPOSIT_START_ENDPOINT = "/sapi/v1/payment/stark/start/" CROSS_CHAIN_DEPOSIT_START_ENDPOINT = "/sapi/v1/deposits/crosschain/create/" LIST_DEPOSITS_ENDPOINT = "/sapi/v1/deposits/all/" INTERNAL_TRANSFER_INITIATE_ENDPOINT = "/sapi/v1/internal_transfers/v2/initiate/" INTERNAL_TRANSFER_PROCESS_ENDPOINT = "/sapi/v1/internal_transfers/v2/process/" INTERNAL_TRANSFER_GET_ENDPOINT = "/sapi/v1/internal_transfers/v2/" INTERNAL_TRANSFER_USER_ENDPOINT = "/sapi/v1/internal_transfers/v2/check_user_exists/" INTERNAL_TRANSFER_LIST_ENDPOINT = "/sapi/v1/internal_transfers/v2/" START_NORMAL_WITHDRAWAL_ENDPOINT = "/sapi/v1/payment/withdrawals/v1/initiate/" VALIDATE_NORMAL_WITHDRAWAL_ENDPOINT = "/sapi/v1/payment/withdrawals/v1/validate/" START_FAST_WITHDRAWAL_ENDPOINT = "/sapi/v1/payment/fast-withdrawals/v2/initiate/" PROCESS_FAST_WITHDRAWAL_ENDPOINT = "/sapi/v1/payment/fast-withdrawals/v2/process/" LIST_NORMAL_WITHDRAWALS_ENDPOINT = "/sapi/v1/payment/withdrawals/" LIST_FAST_WITHDRAWALS_ENDPOINT = "/sapi/v1/payment/fast-withdrawals/" MAINET_STARK_CONTRACT = "0x1390f521A79BaBE99b69B37154D63D431da27A07" TESTNET_STARK_CONTRACT = "0xA2eC709125Ea693f5522aEfBBC3cb22fb9146B52" )
endpoints
Variables ¶
var ( ErrMarketNotProvided = fmt.Errorf("provide a market") ErrInvalidAmount = fmt.Errorf("amount should be greater than 0") ErrNotLoggedIn = fmt.Errorf("not logged in, please login first as this is a protected endpoint") ErrCoinNotFound = fmt.Errorf("coin not found") ErrInvalidNetwork = fmt.Errorf("invalid network") ErrAlreadyLoggedIn = fmt.Errorf("already logged in") )
Functions ¶
This section is empty.
Types ¶
type AllTickerResponse ¶
type AllTickerResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload map[string]TickerPayload `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": { "ethusdc": { "at": "1660636224", "ticker": { "at": "1660636224", "avg_price": "0.0", "high": "0.0", "last": "1697.0", "low": "0.0", "open": "0.0", "price_change_percent": "+0.00%", "volume": "0.0", "amount": "0.0" } } } }
type Ask ¶
type Ask struct { ID int `json:"id"` UUID string `json:"uuid"` Side string `json:"side"` OrdType string `json:"ord_type"` Price string `json:"price"` AvgPrice string `json:"avg_price"` State string `json:"state"` Market string `json:"market"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` OriginVolume string `json:"origin_volume"` RemainingVolume string `json:"remaining_volume"` ExecutedVolume string `json:"executed_volume"` MakerFee string `json:"maker_fee"` TakerFee string `json:"taker_fee"` TradesCount int `json:"trades_count"` }
type BalancePayload ¶
type BalanceResponse ¶
type BalanceResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload BalancePayload `json:"payload"` }
{ "status": "success", "message": "Retrieved Successfully", "payload": { "currency": "eth", "balance": "0.1959644", "locked": "0.0", "deposit_address": null } }
type Bid ¶
type Bid struct { ID int `json:"id"` UUID string `json:"uuid"` Side string `json:"side"` OrdType string `json:"ord_type"` Price string `json:"price"` AvgPrice string `json:"avg_price"` State string `json:"state"` Market string `json:"market"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` OriginVolume string `json:"origin_volume"` RemainingVolume string `json:"remaining_volume"` ExecutedVolume string `json:"executed_volume"` MakerFee string `json:"maker_fee"` TakerFee string `json:"taker_fee"` TradesCount int `json:"trades_count"` }
type CandleStickOptions ¶
type CandleStickResponse ¶
type CandleStickResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload [][]float64 `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": [ [1660634520, 1697, 1697, 1697, 1697, 0], [1660634520, 1697, 1697, 1697, 1697, 0], [1660634520, 1697, 1697, 1697, 1697, 0] ] }
Note: Kline payload item as array of numbers
Example: [1660634520, 0.0839, 0.0921, 0.0781, 0.0845, 0.5895]
1. Timestamp.
2. Open price.
3. Max price.
4. Min price.
5. Last price.
6. Period volume
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AllTickers ¶
func (c *Client) AllTickers(ctx context.Context) (AllTickerResponse, error)
Track 24 hour rolling window price changes to receive stats about all markets.
func (*Client) Balance ¶
Retrieve details of a specific user’s balance. Please note that this is a Private 🔒 route which means it needs to be authorized by the account initiating this request.
func (*Client) CandleStick ¶
func (c *Client) CandleStick(ctx context.Context, market string, options CandleStickOptions) (CandleStickResponse, error)
Retrieve K-line/Candlestick data for the specified by making use of this endpoint. You can define the limit, period, start time and end time for the same.
func (*Client) CompleteNormalWithdrawal ¶
func (c *Client) CompleteNormalWithdrawal(ctx context.Context, rpcURL string, ethPrivateKey string, userPublicEthAddress string, currency Currency) (string, error)
In the final step, if you find the balance is more than 0, you can use the "CompleteNormalWithdrawal" function to withdraw the cumulative amount to your ETH wallet.
func (*Client) CrossChainDepositStart ¶
func (c *Client) CrossChainDepositStart(ctx context.Context, crossChainDepositRequest CrossChainDepositRequest) (CryptoDepositResponse, error)
func (*Client) DepositFromEthereumNetwork ¶
func (c *Client) DepositFromEthereumNetwork( ctx context.Context, rpcURL string, ethAddress string, ethPrivateKey string, starkPublicKey string, amount float64, currency Currency, ) (CryptoDepositResponse, error)
In this method, you will use an ETH private key, stark public key and an RPC URL to execute a deposit. You'll also need to create an RPC URL using services like Infura, Alchemy, etc.
func (*Client) DepositFromPolygonNetwork ¶
func (c *Client) DepositFromPolygonNetwork( ctx context.Context, rpcURL string, ethAddress string, ethPrivateKey string, starkPublicKey string, currency Currency, amount float64, ) (CryptoDepositResponse, error)
In this method, you will use an ETH private key, stark public key and an RPC URL to execute a Cross-Chain deposit. You'll also need to create an RPC URL using services like Infura, Alchemy, etc.
func (*Client) FastWithdrawal ¶
func (c *Client) FastWithdrawal(ctx context.Context, starkPrivateKey string, amount float64, currency Currency, network Network) (ValidateWithdrawalResponse, error)
With Fast Withdrawal, your funds will be processed in an expedited timeframe, often within a few minutes. This mode is ideal for users who require immediate access to their funds and are comfortable with paying a fee.
On the cross-chain withdrawal network, we only support fast withdrawals.
func (*Client) GetNetworkConfig ¶
func (c *Client) GetNetworkConfig(ctx context.Context) (NetworkConfigResponse, error)
func (*Client) GetPendingNormalWithdrawalAmountByCoin ¶
func (c *Client) GetPendingNormalWithdrawalAmountByCoin(ctx context.Context, rpcURL string, userPublicEthAddress string, currency Currency) (string, error)
WAIT for up to 24 hours. Check whether the withdrawn balance is pending by calling the "GetPendingNormalWithdrawalAmountByCoin" function with the required parameters.
func (*Client) Health ¶
func (c *Client) Health(ctx context.Context) (HealthResponse, error)
To get started with integrating tanX for your Dapp, we suggest you test your connectivity to our REST APIs. Health endpoint can be used to check the status of the API.
func (*Client) InitiateNormalWithdrawal ¶
func (c *Client) InitiateNormalWithdrawal(ctx context.Context, starkPrivateKey string, amount float64, currency Currency) (ValidateWithdrawalResponse, error)
With Normal Withdrawal, your requested funds will be processed within a standard time frame (24 hours). This mode is suitable for users who are not in a rush to access their funds and are comfortable with the regular processing time
func (*Client) InternalTransferCreate ¶
func (c *Client) InternalTransferCreate(ctx context.Context, starkPrivateKey string, opt InternalTransferInitiateRequest) (InternalTransferProcessResponse, error)
Process an internal transfer between two users. Please note that this is a private 🔒 route, which means it needs to be authorized by the account initiating this request.
func (*Client) InternalTransferGet ¶
func (c *Client) InternalTransferGet(ctx context.Context, clientReferenceId string) (InternalTransferGetResponse, error)
etrieve details of a single transfer using this endpoint. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.
func (*Client) InternalTransferList ¶
func (c *Client) InternalTransferList(ctx context.Context, opt InternalTransferListRequest) (InternalTransferListResponse, error)
Retrieve details of all transfers for a user using this endpoint. Please note that this is a Private 🔒 route which means it needs to be authorized by the account initiating this request.
func (*Client) InternalTransferUser ¶
func (c *Client) InternalTransferUser(ctx context.Context, opt InternalTransferUserRequest) (InternalTransferUserResponse, error)
Retrieve details on whether a user exists at the specified destination address using this endpoint. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.
func (*Client) ListAllDeposits ¶
func (c *Client) ListAllDeposits(ctx context.Context) (ListDepositsResponse, error)
list all the deposits
func (*Client) ListFastWithdrawal ¶
func (c *Client) ListFastWithdrawal(ctx context.Context, opt ListWithdrawalRequest) (ListWithdrawalResponse, error)
list all your fast withdrawals
func (*Client) ListNormalWithdrawal ¶
func (c *Client) ListNormalWithdrawal(ctx context.Context, opt ListWithdrawalRequest) (ListWithdrawalResponse, error)
list all your normal withdrawals
func (*Client) Login ¶
func (c *Client) Login(ctx context.Context, ethAddress string, privateKey string) (JWTResponse, error)
Steps followed for login process:-
Step 1: A Nonce is a variable that is generated just once and can be used only one time. Generation of a Nonce is the first step of the login process. The payload received in this step will be required in the next one.
Step 2: Payload is signed using the user's private key.
Step 3: The signed payload is sent to the server along with the user's ethereum address. This basically logs the user in and returns a JWT token.
Note: jwt token along with the refresh token are already stored in the client object for future use. So you don't need to store or pass it to any other function separately.
func (*Client) Nonce ¶
A nonce is a variable that is generated just once and can be used only one time. Generation of a nonce is the first step of the login process. The payload received in this step will be required in the next one.
func (*Client) OrderBook ¶
func (c *Client) OrderBook(ctx context.Context, market string, options OrderBookOptions) (OrderBookResponse, error)
Retrieve the latest asks and bids created within the tanX orderbook in a specific market using this endpoint
func (*Client) OrderCancel ¶
This endpoint is used to cancel a limit order which hasn’t already been executed at a given time. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.
func (*Client) OrderCreate ¶
func (c *Client) OrderCreate(ctx context.Context, starkPrivateKey string, opt OrderNonceRequest) (OrderCreateResponse, error)
Create a new order
func (*Client) OrderGet ¶
Retrieve a single order’s details using this endpoint. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.
func (*Client) OrdersList ¶
func (c *Client) OrdersList(ctx context.Context, opt OrderListOptions) (OrdersListResponse, error)
Retrieve details of all orders for a user using this endpoint. Please note that this is a Private 🔒 route which means it needs to be authorized by the account initiating this request.
func (*Client) PNL ¶
func (c *Client) PNL(ctx context.Context) (PNLResponse, error)
Retrieve details of a user’s portfolio i.e., the profit and loss incurred in the various markets. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.
func (*Client) Profile ¶
func (c *Client) Profile(ctx context.Context) (ProfileResponse, error)
Retrieve details of a user’s portfolio i.e., the profit and loss incurred in the various markets. Please note that this is a Private 🔒 rroute which means it needs to be authorized by the account initiating this request.
func (*Client) RefreshTokens ¶
func (c *Client) RefreshTokens(ctx context.Context) (RefreshTokenResponse, error)
refresh tokens when expired
func (*Client) SetEthereumAllowance ¶
func (c *Client) SetEthereumAllowance(ctx context.Context, rpcURL string, ethPrivateKey string, currency Currency, amount float64) error
Granting permission for token spending enables transactions on Ethereum.
Supported EVM cross-chain networks: 'ETHEREUM', 'POLYGON', 'OPTIMISM', 'ARBITRUM', 'LINEA', 'SCROLL', 'MODE'.
func (*Client) SetPolygonAllowance ¶
func (c *Client) SetPolygonAllowance(ctx context.Context, rpcURL string, ethPrivateKey string, currency Currency, amount float64) error
Granting permission for token spending enables transactions on Polygon.
func (*Client) Ticker ¶
Track 24 hour rolling window price changes to receive stats about a certain market. For example 24 hour low, high, average price, price change and more.
func (*Client) Trades ¶
func (c *Client) Trades(ctx context.Context, market string, options TradesOptions) (TradesResponse, error)
Retrieve the list of recent market trades placed successfully for a specific market using this endpoint
func (*Client) TradesList ¶
func (c *Client) TradesList(ctx context.Context, opt TradesListOptions) (TradesListResponse, error)
Retrieve details of all trades executed for a user by making use of certain filters. Please note that this is a Private 🔒 route which means it needs to be authorized by the account initiating this request.
type CoinStatusPayload ¶
type CoinStatusResponse ¶
type CoinStatusResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload map[string]CoinStatusPayload `json:"payload"` }
type CryptoDepositRequest ¶
type CryptoDepositRequest struct { Amount string `json:"amount"` StarkAssetID string `json:"token_id"` StarkPublicKey string `json:"stark_key"` DepositBlockchainHash string `json:"deposit_blockchain_hash"` DepositBlockchainNonce string `json:"deposit_blockchain_nonce"` VaultID int `json:"vault_id"` }
type CryptoDepositResponse ¶
type ErrInsufficientAllowance ¶
ErrInsufficientAllowance error
func (*ErrInsufficientAllowance) Error ¶
func (e *ErrInsufficientAllowance) Error() string
type ErrJSONDecoding ¶
type ErrJSONDecoding struct {
Err error
}
json decoding error
func (*ErrJSONDecoding) Error ¶
func (e *ErrJSONDecoding) Error() string
type HealthResponse ¶
type HealthResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload string `json:"payload"` }
success response
{ "status": "success", "message": "Working fine!", "payload": "" }
error response
{ "status": "error", "message": "Invalid symbol.", "payload": {} }
type InternalTransferGetResponse ¶
type InternalTransferGetResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload struct { ClientReferenceId string `json:"client_reference_id"` Amount string `json:"amount"` Currency string `json:"currency"` FromAddress string `json:"from_address"` DestinationAddress string `json:"destination_address"` Status string `json:"status"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } `json:"payload"` }
{ "status": "success", "message": "Fetched internal transfer successfully", "payload": { "client_reference_id": "18713401936769560", "amount": "1", "currency": "usdc", "from_address": "0xF", "destination_address": "0x4", "status": "success", "created_at": "2023-07-10T11:36:57.820203Z", "updated_at": "2023-07-10T11:51:54.937498Z" } }
type InternalTransferInitiateRequest ¶
type InternalTransferInitiateRequest struct { OrganizationKey string `json:"organization_key"` // required ApiKey string `json:"api_key"` // required ClientReferenceId string `json:"client_reference_id"` // optional Currency Currency `json:"currency"` // required Amount float64 `json:"amount"` // required DestinationAddress string `json:"destination_address"` // required }
type InternalTransferInitiateResponse ¶
type InternalTransferInitiateResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload InternalTransferInitiatePayload `json:"payload"` }
type InternalTransferListResponse ¶
type InternalTransferListResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload struct { InternalTransfers []struct { ClientReferenceId string `json:"client_reference_id"` Amount string `json:"amount"` Currency string `json:"currency"` FromAddress string `json:"from_address"` DestinationAddress string `json:"destination_address"` Status string `json:"status"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } `json:"internal_transfers"` } `json:"payload"` }
{ "status": "success", "message": "Fetched internal transfers successfully", "payload": { "internal_transfers": [ { "client_reference_id": "18713401936769560", "amount": "10", "currency": "usdc", "from_address": "0xF", "destination_address": "0x4", "status": "success", "created_at": "2023-07-10T11:36:57.820203Z", "updated_at": "2023-07-10T11:51:54.937498Z" }, { "client_reference_id": "3904693199068586", "amount": "1", "currency": "usdc", "from_address": "0xF", "destination_address": "0x5", "status": "pending", "created_at": "2023-07-10T07:32:32.933317Z", "updated_at": "2023-07-10T07:32:32.933340Z" } ], "total_count": 2, "limit": 20, "offset": 1 } }
type InternalTransferProcessResponse ¶
type InternalTransferProcessResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload struct { ClientReferenceId string `json:"client_reference_id"` Amount string `json:"amount"` Currency string `json:"currency"` FromAddress string `json:"from_address"` DestinationAddress string `json:"destination_address"` Status string `json:"status"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } `json:"payload"` }
{ "status": "success", "message": "Internal transfer processed successfully", "payload": { "client_reference_id": "795278363509343", "amount": "1", "currency": "usdc", "from_address": "0x1234", "destination_address": "0x1234", "status": "success", "created_at": "2023-07-12T04:42:22.639933Z", "updated_at": "2023-07-12T04:43:37.373071Z" } }
type InternalTransferUserResponse ¶
type InternalTransferUserResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload struct { DestinationAddress string `json:"destination_address"` Exists bool `json:"exists"` } `json:"payload"` }
{ "status": "success", "message": "User exists", "payload": { "destination_address": "0x4", "exists": true } }
type JWTPayload ¶
type JWTRequest ¶
type JWTResponse ¶
type JWTResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload JWTPayload `json:"payload"` Token Token `json:"token"` }
{ status: 'success', message: 'Login Successful', payload: { uid: 'IDDAF4F5E3C7', signature: '' }, token: { refresh: '', access: '' } }
type ListDepositsResponse ¶
type ListDepositsResponse struct { Status string `json:"status"` Message string `json:"message"` Payload struct { Count int `json:"count"` Next interface{} `json:"next"` Previous interface{} `json:"previous"` Results []struct { TokenID string `json:"token_id"` Network string `json:"network"` Amount string `json:"amount"` CreatedAt string `json:"created_at"` BlockchainDepositHash string `json:"deposit_blockchain_hash"` } `json:"results"` } `json:"payload"` }
type ListNormalWithdrawalPayload ¶
type ListNormalWithdrawalPayload struct { Count int `json:"count"` Next string `json:"next"` Previous string `json:"previous"` Results []struct { ID int `json:"id"` Amount string `json:"amount"` TokenID string `json:"token_id"` CreatedAt string `json:"created_at"` TransactionStatus string `json:"transaction_status"` Extras struct { Errors []interface{} `json:"errors"` ExpTimestamp int `json:"exp_timestamp"` QuantisedAmount int `json:"quantised_amount"` } `json:"extras"` } `json:"results"` }
type ListWithdrawalRequest ¶
type ListWithdrawalResponse ¶
type ListWithdrawalResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload ListNormalWithdrawalPayload `json:"payload"` }
type NetworkConfigData ¶
type NetworkConfigData struct { DepositContract string `json:"deposit_contract"` Tokens map[Currency]CoinToken `json:"tokens"` AllowedTokensForDeposit []Currency `json:"allowed_tokens_for_deposit"` AllowedTokensForDepositFrontend []Currency `json:"allowed_tokens_for_deposit_frontend"` AllowedTokensForFastWd []Currency `json:"allowed_tokens_for_fast_wd"` AllowedTokensForFastWdFrontend []Currency `json:"allowed_tokens_for_fast_wd_frontend"` }
type NetworkConfigResponse ¶
type NetworkConfigResponse struct { Status string `json:"status"` Message string `json:"message"` Payload struct { NetworkConfig map[Network]NetworkConfigData `json:"network_config"` } `json:"payload"` }
type NonceRequest ¶
type NonceRequest struct {
EthAddress string `json:"eth_address"`
}
type NonceResponse ¶
type NonceResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload string `json:"payload"` }
{ "status": "success", "message": "Cached Nonce Acquired", "payload": "You’re now signing into TanX, make sure the origin is https://testnet.tanx.fi (Login-code:Yvw9FHZ4JwyhuVobAZAWjd)" }
type OrderBookOptions ¶
type OrderBookPayload ¶
type OrderBookResponse ¶
type OrderBookResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload OrderBookPayload `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": { "asks": [ { "id": 7495410, "uuid": "5c30a97a-39b1-4289-b119-5d0ffd96aaa5", "side": "sell", "ord_type": "market", "price": null, "avg_price": "0.0", "state": "wait", "market": "btcusdc", "created_at": "2022-07-20T04:14:08+02:00", "updated_at": "2022-07-20T04:14:08+02:00", "origin_volume": "0.0006", "remaining_volume": "0.0006", "executed_volume": "0.0", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 0 } ], "bids": [ { "id": 7470160, "uuid": "795cfe5d-06ab-4150-8f44-06dc2b0e88f8", "side": "buy", "ord_type": "limit", "price": "23490.0", "avg_price": "23489.7", "state": "wait", "market": "btcusdc", "created_at": "2022-07-20T00:59:57+02:00", "updated_at": "2022-07-20T01:47:44+02:00", "origin_volume": "2.1772", "remaining_volume": "0.0083", "executed_volume": "2.1689", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 22 } ] } }
type OrderCancelRequest ¶
type OrderCancelRequest struct {
OrderID int `json:"order_id"`
}
type OrderCancelResponse ¶
type OrderCancelResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload OrderPayload `json:"payload"` }
{ "status": "success", "message": "Cancelled Order Successfully", "payload": { "order_id": 3, "uuid": "3626e3a1-c15f-4979-97f2-30ce8845578d", "side": "buy", "ord_type": "limit", "price": "1663.0", "avg_price": "1663.0", "state": "wait", "market": "ethusdc", "created_at": "2022-08-05T12:20:22+02:00", "updated_at": "2022-08-05T12:21:28+02:00", "origin_volume": "0.003", "remaining_volume": "0.0021", "executed_volume": "0.0009", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 3 } }
type OrderCreateRequest ¶
type OrderCreateRequest struct { MsgHash string `json:"msg_hash"` Signature OrderCreateSignature `json:"signature"` Nonce int `json:"nonce"` }
type OrderCreateResponse ¶
type OrderCreateResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload OrderPayload `json:"payload"` }
{ "status": "success", "message": "Created Order Successfully", "payload": { "id": 904, "uuid": "6c79cde4-1e8f-4446-9b4a-ba176d50f08b", "side": "sell", "ord_type": "limit", "price": "29580.51", "avg_price": "0.0", "state": "pending", "market": "btcusdt", "created_at": "2022-05-27T12:36:57+02:00", "updated_at": "2022-05-27T12:36:57+02:00", "origin_volume": "0.015", "remaining_volume": "0.015", "executed_volume": "0.0", "maker_fee": "0.0", "taker_fee": "0.0", "trades_count": 0 } }
type OrderCreateSignature ¶
type OrderGetResponse ¶
type OrderGetResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload OrderPayload `json:"payload"` }
{ "status": "success", "message": "Order Retrieved Successfully", "payload": { "id": 23157052, "uuid": "a0b17d1f-0f2c-4c93-ad40-2e71077de499", "side": "buy", "ord_type": "market", "price": null, "avg_price": "0.0", "state": "cancel", "market": "btcusdc", "created_at": "2022-11-08T11:53:09+01:00", "updated_at": "2022-11-08T11:53:14+01:00", "origin_volume": "0.0051", "remaining_volume": "0.0051", "executed_volume": "0.0", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 0, "trades": [] } }
type OrderListOptions ¶
type OrderListOptions struct { Limit int `json:"limit"` Page int `json:"page"` Market string `json:"market"` OrdType string `json:"ord_type"` State string `json:"state"` BaseUnit string `json:"base_unit"` QuoteUnit string `json:"quote_unit"` StartTime int `json:"start_time"` EndTime int `json:"end_time"` Side string `json:"side"` }
type OrderNoncePayload ¶
type OrderNonceRequest ¶
type OrderNonceResponse ¶
type OrderNonceResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload OrderNoncePayload `json:"payload"` }
type OrderPayload ¶
type OrderPayload struct { ID int `json:"id"` OrderID int `json:"order_id"` UUID string `json:"uuid"` Side string `json:"side"` OrdType string `json:"ord_type"` Price string `json:"price"` AvgPrice string `json:"avg_price"` State string `json:"state"` Market string `json:"market"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` OriginVolume string `json:"origin_volume"` RemainingVolume string `json:"remaining_volume"` ExecutedVolume string `json:"executed_volume"` MakerFee string `json:"maker_fee"` TakerFee string `json:"taker_fee"` TradesCount int `json:"trades_count"` }
type OrdersListResponse ¶
type OrdersListResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload []OrderPayload `json:"payload"` }
{ "status": "success", "message": "Orders Retrieved Successfully", "payload": [ { "id": 1739939, "uuid": "b658b41f-fe68-4561-801d-dfa94c3ca1b5", "side": "buy", "ord_type": "limit", "price": "450.0", "avg_price": "0.0", "state": "cancel", "market": "ethusdc", "created_at": "2022-06-16T22:41:14+02:00", "updated_at": "2022-06-16T22:43:30+02:00", "origin_volume": "0.001", "remaining_volume": "0.001", "executed_volume": "0.0", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 0 }, { "id": 1739940, "uuid": "19bce015-c143-449f-af2b-fdcfa6384015", "side": "buy", "ord_type": "limit", "price": "1134.0", "avg_price": "1134.0", "state": "done", "market": "ethusdc", "created_at": "2022-06-16T22:41:24+02:00", "updated_at": "2022-06-16T22:41:49+02:00", "origin_volume": "0.001", "remaining_volume": "0.0", "executed_volume": "0.001", "maker_fee": "0.001", "taker_fee": "0.001", "trades_count": 1 } ] }
type PNLPayload ¶
type PNLPayload struct { Currency string `json:"currency"` PnlCurrency string `json:"pnl_currency"` TotalCredit string `json:"total_credit"` TotalDebit string `json:"total_debit"` TotalCreditValue string `json:"total_credit_value"` TotalDebitValue string `json:"total_debit_value"` AverageBuyPrice string `json:"average_buy_price"` AverageSellPrice string `json:"average_sell_price"` AverageBalancePrice string `json:"average_balance_price"` TotalBalanceValue string `json:"total_balance_value"` }
type PNLResponse ¶
type PNLResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload []PNLPayload `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": [ { "currency": "btc", "pnl_currency": "usdc", "total_credit": "30.2311686", "total_debit": "8.6779552", "total_credit_value": "951376.399690608", "total_debit_value": "263030.247889309", "average_buy_price": "31470.05040653995757213302", "average_sell_price": "30310.16429876349211851197", "average_balance_price": "31446.4028484392969497", "total_balance_value": "677771.031254780024102" }, { "currency": "eth", "pnl_currency": "usdc", "total_credit": "30.2311686", "total_debit": "8.6779552", "total_credit_value": "951376.399690608", "total_debit_value": "263030.247889309", "average_buy_price": "31470.05040653995757213302", "average_sell_price": "30310.16429876349211851197", "average_balance_price": "31446.4028484392969497", "total_balance_value": "677771.031254780024102" } ] }
type PolygonContract ¶
type PolygonContract interface { DepositNative(opts *bind.TransactOpts) (*types.Transaction, error) Deposit(opts *bind.TransactOpts, token common.Address, amount *big.Int) (*types.Transaction, error) }
type ProcessFastWithdrawalRequest ¶
type ProcessFastWithdrawalRequest struct { MsgHash string `json:"msg_hash"` Signature WSignature `json:"signature"` FastWithdrawalID int `json:"fastwithdrawal_withdrawal_id"` }
type ProfilePayload ¶
type ProfileResponse ¶
type ProfileResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload ProfilePayload `json:"payload"` }
{ "status": "success", "message": "Successful", "payload": { "name": "USER NAME", "customer_id": "27", "img": null, "username": "guthal", "stark_key": "0x70f41ce6797eb444c9dc95a907....8aa592adf8f1fe3ab75317f7096d38" } }
type RefreshTokenPayload ¶
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
Refresh string `json:"refresh"`
}
type RefreshTokenResponse ¶
type RefreshTokenResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload RefreshTokenPayload `json:"payload"` }
{ "status": "success", "message": "", "payload": { "access": "eybdgyr0iOi....gVbdghy7g_Pn3QCU", "refresh": "eyJ0eXAiOi....mVeL25ytndhltJL4" } }
type StarkexContract ¶
type StarkexContract interface { DepositEth(opts *bind.TransactOpts, starkKey *big.Int, assetType *big.Int, vaultId *big.Int) (*types.Transaction, error) DepositERC20(opts *bind.TransactOpts, starkKey *big.Int, assetType *big.Int, vaultId *big.Int, quantizedAmount *big.Int) (*types.Transaction, error) GetWithdrawalBalance(opts *bind.CallOpts, ownerKey *big.Int, assetId *big.Int) (*big.Int, error) Withdraw(opts *bind.TransactOpts, ownerKey *big.Int, assetType *big.Int) (*types.Transaction, error) }
type StartNormalWithdrawalResponse ¶
type StartNormalWithdrawalResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload StartNormalWithdrawalPaylaod `json:"payload"` }
type Ticker ¶
type Ticker struct { Low string `json:"low"` High string `json:"high"` Open string `json:"open"` Last string `json:"last"` Volume string `json:"volume"` Amount string `json:"amount"` Vol string `json:"vol"` AvgPrice string `json:"avg_price"` PriceChangePercent string `json:"price_change_percent"` At string `json:"at"` }
type TickerPayload ¶
type TickerResponse ¶
type TickerResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload TickerPayload `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": { "ethusdc": { "at": "1660636224", "ticker": { "at": "1660636224", "avg_price": "0.0", "high": "0.0", "last": "1697.0", "low": "0.0", "open": "0.0", "price_change_percent": "+0.00%", "volume": "0.0", "amount": "0.0" } } } }
type TradePayload ¶
type TradePayload struct { ID int `json:"id"` Price string `json:"price"` Amount string `json:"amount"` Total string `json:"total"` FeeCurrency string `json:"fee_currency"` Fee string `json:"fee"` FeeAmount string `json:"fee_amount"` Market string `json:"market"` CreatedAt string `json:"created_at"` TakerType string `json:"taker_type"` Side string `json:"side"` OrderID int `json:"order_id"` }
type TradesListOptions ¶
type TradesListResponse ¶
type TradesListResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload []TradePayload `json:"payload"` }
{ "status": "success", "message": "Trades Retrieved Successfully", "payload": [ { "id": 7281, "price": "1134.0", "amount": "0.001", "total": "1.134", "fee_currency": "eth", "fee": "0.001", "fee_amount": "0.000001", "market": "ethusdc", "created_at": "2022-06-16T22:41:49+02:00", "taker_type": "sell", "side": "buy", "order_id": 1739940 }, { "id": 7280, "price": "1134.0", "amount": "0.001", "total": "1.134", "fee_currency": "eth", "fee": "0.001", "fee_amount": "0.000001", "market": "ethusdc", "created_at": "2022-06-16T22:37:56+02:00", "taker_type": "sell", "side": "buy", "order_id": 1739937 } ] }
type TradesOptions ¶
type TradesPayload ¶
type TradesResponse ¶
type TradesResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload []TradesPayload `json:"payload"` }
{ "status": "success", "message": "Retrieval Successful", "payload": [ { "id": 456142, "price": 1336.63, "amount": 0.0375, "total": 50.123625, "market": "ethusdc", "created_at": 1667855520, "taker_type": "sell" }, { "id": 456116, "price": 1336.63, "amount": 0.075, "total": 100.24725, "market": "ethusdc", "created_at": 1667850041, "taker_type": "sell" } ] }
type ValidateNormalWithdrawalRequest ¶
type ValidateNormalWithdrawalRequest struct { MessageHash string `json:"msg_hash"` Signature WSignature `json:"signature"` Nonce int `json:"nonce"` }
type ValidateWithdrawalResponse ¶
type ValidateWithdrawalResponse struct { Status Status `json:"status"` Message string `json:"message"` Payload struct { ID int `json:"id"` Amount string `json:"amount"` TokenID string `json:"token_id"` CreatedAt string `json:"created_at"` TransactionStatus string `json:"transaction_status"` Extras struct { Errors []interface{} `json:"errors"` ExpTimestamp int `json:"exp_timestamp"` QuantisedAmount int `json:"quantised_amount"` } `json:"extras"` } `json:"payload"` }
type VaultRequest ¶
type VaultRequest struct {
Coin Currency `json:"coin"`
}