Files
sdk/docs/MarketAPI.md

9.9 KiB

\MarketAPI

All URIs are relative to https://api.hanzo.ai

Method HTTP request Description
GetMarketChains Get /v1/market/chains Answers every chain this deployment can read, what is deployed on each, and what its automated market maker amounts to.
GetMarketPools Get /v1/market/pools Answers the automated market makers on one chain: their two tokens, their fee tier, and what has moved through each.
GetMarketSurvey Get /v1/market/survey Answers which of the four settlement precompiles carry code on one chain.
GetMarketToken Get /v1/market/token Answers one token's daily history — open, high, low, close, price and volume per UTC day, oldest first.
GetMarketTokens Get /v1/market/tokens Answers the tokens one chain's indexer has seen, with the decimals a caller needs to read any amount of one correctly.

GetMarketChains

MarketRoster GetMarketChains(ctx).Execute()

Answers every chain this deployment can read, what is deployed on each, and what its automated market maker amounts to.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MarketAPI.GetMarketChains(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MarketAPI.GetMarketChains``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMarketChains`: MarketRoster
	fmt.Fprintf(os.Stdout, "Response from `MarketAPI.GetMarketChains`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetMarketChainsRequest struct via the builder pattern

Return type

MarketRoster

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMarketPools

MarketPools GetMarketPools(ctx).Chain(chain).Execute()

Answers the automated market makers on one chain: their two tokens, their fee tier, and what has moved through each.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	chain := "chain_example" // string | Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MarketAPI.GetMarketPools(context.Background()).Chain(chain).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MarketAPI.GetMarketPools``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMarketPools`: MarketPools
	fmt.Fprintf(os.Stdout, "Response from `MarketAPI.GetMarketPools`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetMarketPoolsRequest struct via the builder pattern

Name Type Description Notes
chain string Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing.

Return type

MarketPools

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMarketSurvey

MarketSurvey GetMarketSurvey(ctx).Chain(chain).Execute()

Answers which of the four settlement precompiles carry code on one chain.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	chain := "chain_example" // string | Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MarketAPI.GetMarketSurvey(context.Background()).Chain(chain).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MarketAPI.GetMarketSurvey``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMarketSurvey`: MarketSurvey
	fmt.Fprintf(os.Stdout, "Response from `MarketAPI.GetMarketSurvey`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetMarketSurveyRequest struct via the builder pattern

Name Type Description Notes
chain string Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing.

Return type

MarketSurvey

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMarketToken

MarketHistory GetMarketToken(ctx).Chain(chain).At(at).Execute()

Answers one token's daily history — open, high, low, close, price and volume per UTC day, oldest first.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	chain := "chain_example" // string |  (optional)
	at := "at_example" // string | At is the token's contract address. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MarketAPI.GetMarketToken(context.Background()).Chain(chain).At(at).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MarketAPI.GetMarketToken``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMarketToken`: MarketHistory
	fmt.Fprintf(os.Stdout, "Response from `MarketAPI.GetMarketToken`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetMarketTokenRequest struct via the builder pattern

Name Type Description Notes
chain string
at string At is the token's contract address.

Return type

MarketHistory

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMarketTokens

MarketTokens GetMarketTokens(ctx).Chain(chain).Execute()

Answers the tokens one chain's indexer has seen, with the decimals a caller needs to read any amount of one correctly.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	chain := "chain_example" // string | Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.MarketAPI.GetMarketTokens(context.Background()).Chain(chain).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MarketAPI.GetMarketTokens``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMarketTokens`: MarketTokens
	fmt.Fprintf(os.Stdout, "Response from `MarketAPI.GetMarketTokens`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetMarketTokensRequest struct via the builder pattern

Name Type Description Notes
chain string Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing.

Return type

MarketTokens

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]