internal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package internal provides private utilities for the client CLI application.

nolint

Index

Constants

This section is empty.

Variables

View Source
var StorageContracts fs.FS

StorageContracts contains the pre-compiled smart contracts to support AlgoDID's on-chain storage.

Functions

func CreateApp added in v1.0.0

func CreateApp(
	algodClient *algod.Client,
	contract *abi.Contract,
	sender types.Address,
	signer transaction.TransactionSigner,
) (uint64, error)

CreateApp is used to deploy the AlgoDID storage smart contract to the Algorand network.

func LoadContract added in v1.0.0

func LoadContract() *abi.Contract

LoadContract loads the AlgoDID smart contract ABI from JSON file.

func ResolveDID added in v1.0.0

func ResolveDID(appID uint64, pubKey []byte, algodClient *algod.Client, network string) ([]byte, error)

ResolveDID is used to read the DID document from the AlgoDID storage smart contract.

Types

type AlgoDIDClient added in v1.0.0

type AlgoDIDClient struct {
	Networks map[string]*NetworkClient
	// contains filtered or unexported fields
}

AlgoDIDClient provides a simplified interface to interact with the Algorand network.

func NewAlgoClient added in v1.0.0

func NewAlgoClient(profiles []*NetworkProfile, log xlog.Logger) (*AlgoDIDClient, error)

NewAlgoClient creates a new instance of the AlgoClient.

func (*AlgoDIDClient) DeleteDID added in v1.0.0

func (c *AlgoDIDClient) DeleteDID(id *did.Identifier, sender *crypto.Account) error

DeleteDID removes a DID document from the network.

func (*AlgoDIDClient) PublishDID added in v1.0.0

func (c *AlgoDIDClient) PublishDID(id *did.Identifier, sender *crypto.Account) error

PublishDID sends a new DID document to the network fot on-chain storage.

func (*AlgoDIDClient) Read added in v1.0.0

Read a DID document from the Algorand network. The method complies with the `resolver.Provider` interface.

func (*AlgoDIDClient) Resolve added in v1.0.0

func (c *AlgoDIDClient) Resolve(id string) (*did.Document, error)

Resolve retrieves a DID document from the network.

type ClientSettings

type ClientSettings struct {
	Profiles []*NetworkProfile `json:"profiles" yaml:"profiles" mapstructure:"profiles"`
}

ClientSettings defines the configuration options available when interacting with an AlgoDID network agent.

type NetworkClient added in v1.0.0

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

NetworkClient is an interface for easily interacting with algod.

func (*NetworkClient) AccountInformation added in v1.0.0

func (c *NetworkClient) AccountInformation(address string) (models.Account, error)

AccountInformation returns the account information for the given address.

func (*NetworkClient) DeployContract added in v1.0.0

func (c *NetworkClient) DeployContract(sender *crypto.Account) (uint64, error)

DeployContract creates a new instance of the AlgoDID storage smart contract on the network.

func (*NetworkClient) Ready added in v1.0.0

func (c *NetworkClient) Ready() bool

Ready returns true if the network is available.

func (*NetworkClient) StorageAppID added in v1.0.0

func (c *NetworkClient) StorageAppID() uint

StorageAppID returns the application ID for the AlgoDID storage.

func (*NetworkClient) SubmitTx added in v1.0.0

func (c *NetworkClient) SubmitTx(stx []byte) (string, error)

SubmitTx sends a raw signed transaction to the network.

func (*NetworkClient) SuggestedParams added in v1.0.0

func (c *NetworkClient) SuggestedParams() (types.SuggestedParams, error)

SuggestedParams returns the suggested transaction parameters.

type NetworkProfile added in v1.0.0

type NetworkProfile struct {
	// Profile name.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Algod node address.
	Node string `json:"node" yaml:"node" mapstructure:"node"`

	// Algod node access token.
	NodeToken string `json:"node_token,omitempty" yaml:"node_token,omitempty" mapstructure:"node_token"`

	// Application ID for the AlgoDID storage smart contract.
	AppID uint `json:"app_id" yaml:"app_id" mapstructure:"app_id"`

	// Storage contract provider server, if any.
	StoreProvider string `json:"store_provider,omitempty" yaml:"store_provider,omitempty" mapstructure:"store_provider"`
}

NetworkProfile defines the configuration options to connect to a specific AlgoDID network agent.

Jump to

Keyboard shortcuts

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