\InfoAPI
July 14, 2024 ยท View on GitHub
| Method | HTTP request | Description |
|---|---|---|
| GetCoreApiInfo | Get /v2/info | Get Core API info |
| GetNetworkBlockTimeByNetwork | Get /extended/v1/info/network_block_time/{network} | Get a given network's target block time |
| GetNetworkBlockTimes | Get /extended/v1/info/network_block_times | Get the network target block time |
| GetPoxInfo | Get /v2/pox | Get Proof-of-Transfer details |
| GetStatus | Get /extended | API status |
| GetStxSupply | Get /extended/v1/stx_supply | Get total and unlocked STX supply |
| GetStxSupplyCirculatingPlain | Get /extended/v1/stx_supply/circulating/plain | Get circulating STX supply in plain text format |
| GetStxSupplyTotalSupplyPlain | Get /extended/v1/stx_supply/total/plain | Get total STX supply in plain text format |
| GetTotalStxSupplyLegacyFormat | Get /extended/v1/stx_supply/legacy_format | Get total and unlocked STX supply (results formatted the same as the legacy 1.0 API) |
GetCoreApiInfo
CoreNodeInfoResponse GetCoreApiInfo(ctx).Execute()
Get Core API info
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetCoreApiInfo(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetCoreApiInfo``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCoreApiInfo`: CoreNodeInfoResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetCoreApiInfo`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetCoreApiInfoRequest struct via the builder pattern
Return type
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]
GetNetworkBlockTimeByNetwork
TargetBlockTime GetNetworkBlockTimeByNetwork(ctx, network).Execute()
Get a given network's target block time
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
network := "mainnet" // string | the target block time for a given network (testnet, mainnet).
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetNetworkBlockTimeByNetwork(context.Background(), network).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetNetworkBlockTimeByNetwork``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetNetworkBlockTimeByNetwork`: TargetBlockTime
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetNetworkBlockTimeByNetwork`: %v\n", resp)
}
Path Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| network | string | the target block time for a given network (testnet, mainnet). |
Other Parameters
Other parameters are passed through a pointer to a apiGetNetworkBlockTimeByNetworkRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
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]
GetNetworkBlockTimes
NetworkBlockTimesResponse GetNetworkBlockTimes(ctx).Execute()
Get the network target block time
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetNetworkBlockTimes(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetNetworkBlockTimes``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetNetworkBlockTimes`: NetworkBlockTimesResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetNetworkBlockTimes`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetNetworkBlockTimesRequest struct via the builder pattern
Return type
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]
GetPoxInfo
CoreNodePoxResponse GetPoxInfo(ctx).Execute()
Get Proof-of-Transfer details
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetPoxInfo(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetPoxInfo``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPoxInfo`: CoreNodePoxResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetPoxInfo`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetPoxInfoRequest struct via the builder pattern
Return type
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]
GetStatus
ServerStatusResponse GetStatus(ctx).Execute()
API status
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetStatus(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetStatus``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetStatus`: ServerStatusResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetStatus`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetStatusRequest struct via the builder pattern
Return type
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]
GetStxSupply
GetStxSupplyResponse GetStxSupply(ctx).Height(height).Execute()
Get total and unlocked STX supply
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
height := float32(200) // float32 | Supply details are queried from specified block height. If the block height is not specified, the latest block height is taken as default value. Note that the `block height` is referred to the stacks blockchain. (optional)
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetStxSupply(context.Background()).Height(height).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetStxSupply``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetStxSupply`: GetStxSupplyResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetStxSupply`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiGetStxSupplyRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| height | float32 | Supply details are queried from specified block height. If the block height is not specified, the latest block height is taken as default value. Note that the `block height` is referred to the stacks blockchain. |
Return type
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]
GetStxSupplyCirculatingPlain
string GetStxSupplyCirculatingPlain(ctx).Execute()
Get circulating STX supply in plain text format
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetStxSupplyCirculatingPlain(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetStxSupplyCirculatingPlain``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetStxSupplyCirculatingPlain`: string
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetStxSupplyCirculatingPlain`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetStxSupplyCirculatingPlainRequest struct via the builder pattern
Return type
string
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetStxSupplyTotalSupplyPlain
string GetStxSupplyTotalSupplyPlain(ctx).Execute()
Get total STX supply in plain text format
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetStxSupplyTotalSupplyPlain(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetStxSupplyTotalSupplyPlain``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetStxSupplyTotalSupplyPlain`: string
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetStxSupplyTotalSupplyPlain`: %v\n", resp)
}
Path Parameters
This endpoint does not need any parameter.
Other Parameters
Other parameters are passed through a pointer to a apiGetStxSupplyTotalSupplyPlainRequest struct via the builder pattern
Return type
string
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetTotalStxSupplyLegacyFormat
GetStxSupplyLegacyFormatResponse GetTotalStxSupplyLegacyFormat(ctx).Height(height).Execute()
Get total and unlocked STX supply (results formatted the same as the legacy 1.0 API)
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cbadawi/go-stacks"
)
func main() {
height := float32(200) // float32 | Supply details are queried from specified block height. If the block height is not specified, the latest block height is taken as default value. (optional)
configuration :=config.NewConfiguration()
apiClient := NewAPIClient(configuration)
resp, r, err := apiClient.InfoAPI.GetTotalStxSupplyLegacyFormat(context.Background()).Height(height).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `InfoAPI.GetTotalStxSupplyLegacyFormat``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTotalStxSupplyLegacyFormat`: GetStxSupplyLegacyFormatResponse
fmt.Fprintf(os.Stdout, "Response from `InfoAPI.GetTotalStxSupplyLegacyFormat`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiGetTotalStxSupplyLegacyFormatRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| height | float32 | Supply details are queried from specified block height. If the block height is not specified, the latest block height is taken as default value. |
Return type
GetStxSupplyLegacyFormatResponse
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]