client

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package client provides the high-level Canton SDK client.

It exposes a unified interface for interacting with a Canton ledger, including identity, token, and optional bridge operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Ledger   ledger.Ledger
	Identity identity.Identity
	Token    token.Token
	Bridge   bridge.Bridge // optional; nil when disabled
}

Client is the SDK facade.

func New

func New(ctx context.Context, cfg *Config, opts ...Option) (*Client, error)

New creates an SDK client from SDK-native config.

func (*Client) Close

func (c *Client) Close() error

Close closes the underlying ledger connection.

type Config

type Config struct {
	// Common fields propagated to all sub-components by New().
	DomainID    string `yaml:"domain_id" validate:"required"`
	IssuerParty string `yaml:"issuer_party" validate:"required"` // maps to IssuerParty (identity/token) and OperatorParty (bridge)

	// Sub-component configs. Each only carries its unique fields in YAML.
	Ledger   *ledger.Config   `yaml:"ledger" validate:"required"`
	Identity *identity.Config `yaml:"identity" validate:"required"`
	Token    *token.Config    `yaml:"token" validate:"required"`
	Bridge   *bridge.Config   `yaml:"bridge" default:"-"` // nil = bridge disabled
}

Config is the top-level Canton SDK config; YAML-importable directly into app configs.

type Option

type Option func(*settings)

Option configures client settings using the functional options pattern.

func WithBridgeConfig

func WithBridgeConfig(cfg *bridge.Config) Option

WithBridgeConfig enables and configures the optional bridge client. If nil, the bridge client is not initialized.

func WithGRPCDialOptions

func WithGRPCDialOptions(opts ...grpc.DialOption) Option

WithGRPCDialOptions appends additional gRPC dial options to the underlying ledger connection. Use this to inject interceptors, custom credentials, etc.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets a custom HTTP client for the SDK client.

func WithKeyResolver

func WithKeyResolver(kr token.KeyResolver) Option

WithKeyResolver provides a function to look up signing keys by party ID. Required for transfers involving external parties (Interactive Submission).

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger sets a custom logger for the SDK client.

func WithPrometheusRegisterer

func WithPrometheusRegisterer(reg sharedmetrics.NamespacedRegisterer) Option

WithPrometheusRegisterer enables Canton client metrics and registers them against the provided NamespacedRegisterer. When set, a gRPC unary interceptor is automatically installed that records <namespace>_client_rpc_duration_seconds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL