Skip to content

[Feature Request]: Simplify client setup #4672

@Ferret-san

Description

@Ferret-san

Implementation ideas

In most networks, setting up a connection to a client in order to submit a transaction requires a URL and private key (optionally an api token). For comparison, the celestia client setup is as follows (from the docs)

keyname := "my_celes_key"

	// Initialize keyring
	kr, err := client.KeyringWithNewKey(client.KeyringConfig{
		KeyName:     keyname,
		BackendName: keyring.BackendTest,
	}, "./keys")
	if err != nil {
		panic(err)
	}

	// Configure client (replace with your actual values)
	cfg := client.Config{
		ReadConfig: client.ReadConfig{
			BridgeDAAddr: "https://your-quicknode-url.celestia-mocha.quiknode.pro/<your-api-token>",
			EnableDATLS:  true,
		},
		SubmitConfig: client.SubmitConfig{
			DefaultKeyName: keyname,
			Network:        "mocha-4",
			CoreGRPCConfig: client.CoreGRPCConfig{
				Addr:       "your-quicknode-url:9090",
				TLSEnabled: true,
				AuthToken:  "<your-api-token>",
			},
		},
	}

	// Create client
	c, err := client.New(ctx, cfg, kr)
	if err != nil {
		panic(err)
	}

It would greatly improve the overall devex of the client if the config and setup where simplified such that things like keyname, path, network name, etc. where not required. A good reference to follow is how Ethereum clients only require a URL for reads:

package main

import (
	"fmt"
	"log"
	"github.com/ethereum/go-ethereum/ethclient"
)

func main() {

	_, err := ethclient.Dial("ADD_YOUR_ETHEREUM_NODE_URL")

	if err != nil {
		log.Fatalf("Oops! There was a problem", err)
	} else {
		fmt.Println("Success! you are connected to the Ethereum Network")
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexternalIssues created by non node team members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions