Skip to content

Files

Latest commit

 

History

History
81 lines (52 loc) · 2.48 KB

ChainsAPI.md

File metadata and controls

81 lines (52 loc) · 2.48 KB

\ChainsAPI

All URIs are relative to https://svc.blockdaemon.com

Method HTTP request Description
GetChains Get /chains Get supported blockchain networks with metadata

GetChains

Chains GetChains(ctx).ChainID(chainID).ChainName(chainName).NetworkType(networkType).ChainType(chainType).Execute()

Get supported blockchain networks with metadata

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/Blockdaemon/defi-api-go-sdk"
)

func main() {
	chainID := "eip155:1" // string | The CAIP-2 identifier for a blockchain. (optional)
	chainName := "Ethereum" // string | The name of a blockchain. (optional)
	networkType := openapiclient.NetworkType("mainnet") // NetworkType | The type of network (mainnet, testnet, or devnet). (optional)
	chainType := openapiclient.ChainType("evm") // ChainType | The type of chain (e.g evm, or aptos). (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ChainsAPI.GetChains(context.Background()).ChainID(chainID).ChainName(chainName).NetworkType(networkType).ChainType(chainType).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ChainsAPI.GetChains``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetChains`: Chains
	fmt.Fprintf(os.Stdout, "Response from `ChainsAPI.GetChains`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
chainID string The CAIP-2 identifier for a blockchain.
chainName string The name of a blockchain.
networkType NetworkType The type of network (mainnet, testnet, or devnet).
chainType ChainType The type of chain (e.g evm, or aptos).

Return type

Chains

Authorization

apiKeyAuthHeader, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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