1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-02 11:43:42 +02:00

src/api: change v1 and v2 constructor to not expose eosapi package structs.

This commit is contained in:
Henrik Hautakoski 2022-08-16 19:46:39 +02:00
parent 303995ffda
commit 5d27bf0ad2
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
3 changed files with 12 additions and 7 deletions

View file

@ -13,9 +13,12 @@ type EosioV1 struct {
block_time float64 block_time float64
} }
func NewEosioV1(params eosapi.ReqParams, block_time float64) EosioV1 { func NewEosioV1(url string, host string, block_time float64) EosioV1 {
return EosioV1{ return EosioV1{
params: params, params: eosapi.ReqParams{
Url: url,
Host: host,
},
block_time: block_time, block_time: block_time,
} }
} }

View file

@ -13,9 +13,12 @@ type EosioV2 struct {
offset int64 offset int64
} }
func NewEosioV2(params eosapi.ReqParams, offset int64) EosioV2 { func NewEosioV2(url string, host string, offset int64) EosioV2 {
return EosioV2{ return EosioV2{
params: params, params: eosapi.ReqParams{
Url: url,
Host: host,
},
offset: offset, offset: offset,
} }
} }

View file

@ -5,7 +5,6 @@ import (
"strings" "strings"
"strconv" "strconv"
"github.com/eosswedenorg/eosio-api-healthcheck/src/api" "github.com/eosswedenorg/eosio-api-healthcheck/src/api"
"github.com/eosswedenorg-go/eosapi"
"github.com/eosswedenorg-go/haproxy/agentcheck" "github.com/eosswedenorg-go/haproxy/agentcheck"
"github.com/eosswedenorg-go/tcp_server" "github.com/eosswedenorg-go/tcp_server"
) )
@ -21,9 +20,9 @@ func createApi(a *arguments) (api.ApiInterface, error) {
switch a.api { switch a.api {
case "v1": case "v1":
return api.NewEosioV1(eosapi.ReqParams{Url: a.url, Host: a.host}, float64(a.num_blocks / 2)), nil return api.NewEosioV1(a.url, a.host, float64(a.num_blocks / 2)), nil
case "v2": case "v2":
return api.NewEosioV2(eosapi.ReqParams{Url: a.url, Host: a.host}, int64(a.num_blocks)), nil return api.NewEosioV2(a.url, a.host, int64(a.num_blocks)), nil
case "contract": case "contract":
return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil
case "test": case "test":