Documentation ¶
Index ¶
Constants ¶
const Version = "0.6.3"
SDK Version
Variables ¶
var DefaultRpcAddrs = func(cfg *Config) error { rpcAddrs := []string{ "wss://testnet-rpc.cess.network/ws/", } return cfg.Apply(ConnectRpcAddrs(rpcAddrs)) }
DefaultRpcAddrs configures the default rpc address
var DefaultTimeout = func(cfg *Config) error { return cfg.Apply(TransactionTimeout(time.Second * 30)) }
DefaultTimeout configures the default transaction waiting timeout
Functions ¶
func New ¶
New constructs a new sdk client with the given options, falling back on reasonable defaults. The defaults are:
- If no rpc address is provided, the sdk client uses the default address "wss://testnet-rpc.cess.network/ws/"
- If no transaction timeout is provided, the sdk client uses the default timeout: time.Duration(time.Second * 6)
- The serviceName is used to specify the name of your service
func NewWithoutDefaults ¶
NewWithoutDefaults constructs a new client with the given options but *without* falling back on reasonable defaults.
Warning: This function should not be considered a stable interface. We may choose to add required services at any time and, by using this function, you opt-out of any defaults we may provide.
Types ¶
type Config ¶
Config describes a set of settings for a client
type Option ¶
Option is a client config option that can be given to the client constructor
var FallbackDefaults Option = func(cfg *Config) error { for _, def := range defaults { if !def.fallback(cfg) { continue } if err := cfg.Apply(def.opt); err != nil { return err } } return nil }
FallbackDefaults applies default options to the libp2p node if and only if no other relevant options have been applied. will be appended to the options passed into New.
func ConnectRpcAddrs ¶
ConnectRpcAddrs configuration rpc address
func TransactionTimeout ¶
TransactionTimeout configures the waiting timeout for a transaction