diff --git a/cmd/send_tx/main.go b/cmd/send_tx/main.go index a430280..7f5b91d 100644 --- a/cmd/send_tx/main.go +++ b/cmd/send_tx/main.go @@ -43,8 +43,8 @@ func main() { blockrazorClient, err := swqos.NewSWQoSClient( context.Background(), - enum.SWQoSAgentBlockRazor, &swqos.SWQoSClientConfig{ + Name: enum.SWQoSAgentBlockRazor, SendTxUrl: "frankfurt.solana-grpc.blockrazor.xyz:80", }) if err != nil { diff --git a/pkg/swqos/factory.go b/pkg/swqos/factory.go index 03f15ec..4c722bc 100644 --- a/pkg/swqos/factory.go +++ b/pkg/swqos/factory.go @@ -8,10 +8,10 @@ import ( "github.com/samlior/libsam/pkg/swqos/clients" ) -func NewSWQoSClient(ctx context.Context, agent string, config *SWQoSClientConfig) (SWQoSClient, error) { +func NewSWQoSClient(ctx context.Context, config *SWQoSClientConfig) (SWQoSClient, error) { var err error var client SWQoSClient - switch agent { + switch config.Name { case enum.SWQoSAgentBlockRazor: client, err = clients.NewBlockRazorClient(ctx, config.SendTxUrl) case enum.SWQoSAgentNextBlock: @@ -27,7 +27,7 @@ func NewSWQoSClient(ctx context.Context, agent string, config *SWQoSClientConfig case enum.SWQoSAgent0slot, enum.SWQoSAgentJito, enum.SWQoSAgentHelius, enum.SWQoSAgentNozomi, enum.SWQoSAgentStellium: client = clients.NewHttpClient(config.SendTxUrl, config.SendBundleUrl) default: - return nil, fmt.Errorf("invalid agent: %s", agent) + return nil, fmt.Errorf("invalid agent: %s", config.Name) } if err != nil { return nil, err diff --git a/pkg/swqos/types.go b/pkg/swqos/types.go index faca444..19899ce 100644 --- a/pkg/swqos/types.go +++ b/pkg/swqos/types.go @@ -7,6 +7,7 @@ import ( ) type SWQoSClientConfig struct { + Name string `json:"name"` SendTxUrl string `json:"sendTxUrl"` SendBundleUrl string `json:"sendBundleUrl"` KeepAliveUrl string `json:"keepAliveUrl"`