sonr/app/local.go

38 lines
754 B
Go
Raw Normal View History

package app
2024-07-05 22:20:13 -04:00
import (
"github.com/ipfs/kubo/client/rpc"
)
var (
ChainID = "testnet"
ValAddr = "val1"
)
// Initialize initializes the local configuration values
func init() {
2024-09-05 14:18:22 -04:00
2024-07-05 22:20:13 -04:00
}
// SetLocalContextSessionID sets the session ID for the local context
func SetLocalValidatorAddress(address string) {
ValAddr = address
}
// SetLocalContextChainID sets the chain ID for the local
func SetLocalChainID(id string) {
ChainID = id
}
// IPFSClient is an interface for interacting with an IPFS node.
type IPFSClient = *rpc.HttpApi
// NewLocalClient creates a new IPFS client that connects to the local IPFS node.
func GetIPFSClient() (IPFSClient, error) {
rpcClient, err := rpc.NewLocalApi()
if err != nil {
return nil, err
}
return rpcClient, nil
}