provider

package
v0.5.1 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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canton

type Canton struct {
	// contains filtered or unexported fields
}

Canton implements token.Provider using the Canton token client.

func NewCanton

func NewCanton(client cantontoken.Token) *Canton

NewCanton creates a Canton-backed token provider.

func (*Canton) GetBalance

func (p *Canton) GetBalance(ctx context.Context, tokenSymbol, partyID string) (string, error)

GetBalance returns token balance by token symbol and Canton party ID.

func (*Canton) GetTotalSupply

func (p *Canton) GetTotalSupply(ctx context.Context, tokenSymbol string) (string, error)

GetTotalSupply returns token total supply by token symbol.

type Indexer

type Indexer struct {
	// contains filtered or unexported fields
}

Indexer implements token.Provider using the indexer's HTTP client.

Unlike the Canton provider — which issues live gRPC ACS scans for every balanceOf/totalSupply call — the Indexer provider reads from pre-materialized PostgreSQL tables kept current by the indexer's streaming processor.

It is a thin adapter: symbol → admin lookup is handled here; all HTTP concerns live in the indexer client.

func NewIndexer

func NewIndexer(client indexerclient.Client, instruments map[string]string) *Indexer

NewIndexer creates an Indexer-backed token provider.

instruments maps each supported token symbol to its Canton instrument admin party string, e.g. map[string]string{"DEMO": "admin::abc123@domain"}.

func (*Indexer) GetBalance

func (p *Indexer) GetBalance(ctx context.Context, tokenSymbol, partyID string) (string, error)

GetBalance returns the token balance for the given Canton party ID. The partyID is resolved upstream in the service layer (from the user record), so no additional lookup is needed here. A not-found response from the indexer means the party holds zero of this token.

func (*Indexer) GetTotalSupply

func (p *Indexer) GetTotalSupply(ctx context.Context, tokenSymbol string) (string, error)

GetTotalSupply returns total supply for tokenSymbol via the indexer client.

Jump to

Keyboard shortcuts

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