github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/apis/configuration/get.go (about) 1 package configuration 2 3 import ( 4 "context" 5 6 "github.com/machinefi/w3bstream/pkg/depends/kit/httptransport/httpx" 7 "github.com/machinefi/w3bstream/pkg/types" 8 ) 9 10 type EthClientRsp struct { 11 Clients string `json:"clients"` 12 } 13 14 type EthClient struct { 15 httpx.MethodGet 16 } 17 18 func (r *EthClient) Path() string { return "/eth_client" } 19 20 func (r *EthClient) Output(ctx context.Context) (interface{}, error) { 21 ethcli := types.MustETHClientConfigFromContext(ctx) 22 return &EthClientRsp{ 23 Clients: ethcli.Endpoints, 24 }, nil 25 } 26 27 type ChainConfigResp struct { 28 Chains string `json:"chains"` 29 } 30 31 type ChainConfig struct { 32 httpx.MethodGet 33 } 34 35 func (r *ChainConfig) Path() string { return "/chain_config" } 36 37 func (r *ChainConfig) Output(ctx context.Context) (interface{}, error) { 38 c := types.MustChainConfigFromContext(ctx) 39 return &ChainConfigResp{ 40 Chains: c.Configs, 41 }, nil 42 }