Skip to content

Latest commit

 

History

History
512 lines (330 loc) · 13.5 KB

ValidatorAPI.md

File metadata and controls

512 lines (330 loc) · 13.5 KB

\ValidatorAPI

All URIs are relative to https://api-mainnet.celenium.io/v1

Method HTTP request Description
GetValidator Get /validators/{id} Get validator info
GetValidatorBlocks Get /validators/{id}/blocks Get blocks which was proposed by validator
GetValidatorUptime Get /validators/{id}/uptime Get validator's uptime and history of signed block
ListValidator Get /validators List validators
ValidatorCount Get /validators/count Get validator's count by status
ValidatorDelegators Get /validators/{id}/delegators Get validator's delegators
ValidatorJails Get /validators/{id}/jails Get validator's jails

GetValidator

ResponsesValidator GetValidator(ctx, id).Execute()

Get validator info

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	id := int32(56) // int32 | Internal validator id

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32 Internal validator id

Other Parameters

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

Name Type Description Notes

Return type

ResponsesValidator

Authorization

No authorization required

HTTP request headers

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

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

GetValidatorBlocks

ResponsesBlock GetValidatorBlocks(ctx, id).Limit(limit).Offset(offset).Execute()

Get blocks which was proposed by validator

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	id := int32(56) // int32 | Internal validator id
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ValidatorAPI.GetValidatorBlocks(context.Background(), id).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ValidatorAPI.GetValidatorBlocks``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetValidatorBlocks`: ResponsesBlock
	fmt.Fprintf(os.Stdout, "Response from `ValidatorAPI.GetValidatorBlocks`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32 Internal validator id

Other Parameters

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

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset |

Return type

ResponsesBlock

Authorization

No authorization required

HTTP request headers

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

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

GetValidatorUptime

ResponsesValidatorUptime GetValidatorUptime(ctx, id).Limit(limit).Execute()

Get validator's uptime and history of signed block

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	id := int32(56) // int32 | Internal validator id
	limit := int32(56) // int32 | Count of requested blocks (optional)

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32 Internal validator id

Other Parameters

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

Name Type Description Notes

limit | int32 | Count of requested blocks |

Return type

ResponsesValidatorUptime

Authorization

No authorization required

HTTP request headers

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

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

ListValidator

[]ResponsesValidator ListValidator(ctx).Limit(limit).Offset(offset).Jailed(jailed).Execute()

List validators

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)
	jailed := true // bool | Return only jailed validators (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ValidatorAPI.ListValidator(context.Background()).Limit(limit).Offset(offset).Jailed(jailed).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ValidatorAPI.ListValidator``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListValidator`: []ResponsesValidator
	fmt.Fprintf(os.Stdout, "Response from `ValidatorAPI.ListValidator`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
limit int32 Count of requested entities
offset int32 Offset
jailed bool Return only jailed validators

Return type

[]ResponsesValidator

Authorization

No authorization required

HTTP request headers

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

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

ValidatorCount

ResponsesValidatorCount ValidatorCount(ctx).Execute()

Get validator's count by status

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {

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

Path Parameters

This endpoint does not need any parameter.

Other Parameters

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

Return type

ResponsesValidatorCount

Authorization

No authorization required

HTTP request headers

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

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

ValidatorDelegators

[]ResponsesDelegation ValidatorDelegators(ctx, id).Limit(limit).Offset(offset).ShowZero(showZero).Execute()

Get validator's delegators

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	id := int32(56) // int32 | Internal validator id
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)
	showZero := true // bool | Show zero delegations (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ValidatorAPI.ValidatorDelegators(context.Background(), id).Limit(limit).Offset(offset).ShowZero(showZero).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ValidatorAPI.ValidatorDelegators``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ValidatorDelegators`: []ResponsesDelegation
	fmt.Fprintf(os.Stdout, "Response from `ValidatorAPI.ValidatorDelegators`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32 Internal validator id

Other Parameters

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

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset | showZero | bool | Show zero delegations |

Return type

[]ResponsesDelegation

Authorization

No authorization required

HTTP request headers

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

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

ValidatorJails

[]ResponsesJail ValidatorJails(ctx, id).Limit(limit).Offset(offset).Execute()

Get validator's jails

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	id := int32(56) // int32 | Internal validator id
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ValidatorAPI.ValidatorJails(context.Background(), id).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ValidatorAPI.ValidatorJails``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ValidatorJails`: []ResponsesJail
	fmt.Fprintf(os.Stdout, "Response from `ValidatorAPI.ValidatorJails`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32 Internal validator id

Other Parameters

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

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset |

Return type

[]ResponsesJail

Authorization

No authorization required

HTTP request headers

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

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