Skip to content

Discover DeFi with Trader Joe, a leading decentralized exchange. Trade a wide variety of tokens, earn rewards, and engage in secure, peer-to-peer transactions. Trader Joe makes DeFi easy and accessible.

Notifications You must be signed in to change notification settings

Cajun-Pro-LLC/traderjoesdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for traderjoesdk

Discover DeFi with Trader Joe, a leading decentralized exchange. Trade a wide variety of tokens, earn rewards, and engage in secure, peer-to-peer transactions. Trader Joe makes DeFi easy and accessible.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://api.traderjoexyz.dev

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import traderjoesdk "github.com/cajun-pro-llc/traderjoesdk"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value traderjoesdk.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), traderjoesdk.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value traderjoesdk.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), traderjoesdk.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using traderjoesdk.ContextOperationServerIndices and traderjoesdk.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), traderjoesdk.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), traderjoesdk.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.traderjoexyz.dev

Class Method HTTP request Description
DefaultAPI HealthCheck Get /health-check Health Check
DexAnalyticsAPI DailyDexAnalytics Get /v1/dex/analytics/{chain} Daily Dex Analytics
PoolsAPI GetHistoricalLiquidityProviders Get /v1/pools/historical-liquidity-providers/{chain}/{address} Get Historical Liquidity Providers
PoolsAPI GetPool Get /v1/pools/{chain}/{address} Get Pool
PoolsAPI ListPools Get /v1/pools/{chain} List Pools
RewardsAPI GetProof Get /v1/rewards/{chain}/{user_address} Get Proof
RewardsAPI GetUserClaimableRewards Get /v1/rewards/claimable/{chain}/{user_address} Get User Claimable Rewards
RewardsAPI GetUserProofs Post /v1/rewards/batch-proof/{chain}/{user_address} Get User Proofs
RewardsAPI GetUserRewardHistory Get /v1/rewards/history/{chain}/{user_address} Get User Reward History
UserAPI GetUserFarmPosition Get /v1/user/{chain}/{user_address}/farms/{vault_id} Get User Farm Position
UserAPI GetUserFarmPositions Get /v1/user/{chain}/{user_address}/farms Get User Farm Positions
UserAPI GetUserPoolIds Get /v1/user/pool-ids/{user_address}/{chain} Get User Pool Ids
UserAPI UserCurrentBinIds Get /v1/user/bin-ids/{user_address}/{chain}/{pool_address} User Current Bin Ids
UserAPI UserEarnedFeesPerBin Get /v1/user/fees-earned/{chain}/{user_address}/{pool_address} User Earned Fees Per Bin
UserAPI UserHistoricalPosition Get /v1/user/{chain}/history/{user_address}/{pool_address} User Historical Position
VaultsAPI GetVault Get /v1/vaults/{chain}/{vault_address} Get Vault
VaultsAPI GetVaultRecentActivity Get /v1/vaults/{chain}/{vault_address}/recent-activity Get Vault Recent Activity
VaultsAPI GetVaultSharePrice Get /v1/vaults/{chain}/{vault_address}/share-price Get Vault Share Price
VaultsAPI GetVaultTvlHistory Get /v1/vaults/{chain}/{vault_address}/tvl-history Get Vault Tvl History
VaultsAPI GetVaultWithdrawalsByUser Get /v1/vaults/{chain}/withdrawals/{user_address} Get Vault Withdrawals By User
VaultsAPI GetVaultWithdrawalsByUserAndVault Get /v1/vaults/{chain}/{vault_address}/withdrawals/{user_address} Get Vault Withdrawals By User And Vault
VaultsAPI ListVaultsByChain Get /v1/vaults/{chain} List Vaults By Chain
VaultsAPI ListVaultsV1VaultsGet Get /v1/vaults List Vaults

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: x-traderjoe-api-key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: x-traderjoe-api-key and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		traderjoesdk.ContextAPIKeys,
		map[string]traderjoesdk.APIKey{
			"x-traderjoe-api-key": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

Discover DeFi with Trader Joe, a leading decentralized exchange. Trade a wide variety of tokens, earn rewards, and engage in secure, peer-to-peer transactions. Trader Joe makes DeFi easy and accessible.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages