services

package
v0.0.0-...-2b2340b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCustodialGroupServiceParams

type CreateCustodialGroupServiceParams struct {
	Name           string   `json:"name"`
	Quorum         uint     `json:"quorum"`
	CustodialNames []string `json:"custodial_names"`
}

type CreateCustodialServiceParams

type CreateCustodialServiceParams struct {
	Name            string `json:"name"`
	BtcPublicKeyHex string `json:"btc_public_key_hex"`
}

type DAppServiceParams

type DAppServiceParams struct {
	ID                   string // TODO: change to ObjectID
	ChainName            string
	BtcAddressHex        string
	PublicKeyHex         string
	SmartContractAddress string
	ChainID              string
	ChainEndpoint        string
	RpcUrl               string
	AccessToken          string
	TokenContractAddress string
	CustodialGroupID     uint
}

type GlobalParamsPublic

type GlobalParamsPublic struct {
	Versions []VersionedGlobalParamsPublic `json:"versions"`
}

type Services

type Services struct {
	GmpClient    gmp.GmpClient
	VaultClient  vault.VaultClient
	ScalarClient postgres.ScalarClient
	// contains filtered or unexported fields
}

Service layer contains the business logic and is used to interact with the database and other external clients (if any).

func New

func New(
	ctx context.Context,
	cfg *config.Config,
	globalParams *types.GlobalParams,
	finalityProviders []types.FinalityProviderDetails,
) (*Services, error)

func (*Services) CreateCustodial

func (s *Services) CreateCustodial(ctx context.Context, params CreateCustodialServiceParams) *types.Error

func (*Services) CreateCustodialGroup

func (s *Services) CreateCustodialGroup(ctx context.Context, params CreateCustodialGroupServiceParams) *types.Error

func (*Services) CreateDApp

func (s *Services) CreateDApp(ctx context.Context, params DAppServiceParams) *types.Error

func (*Services) DeleteDApp

func (s *Services) DeleteDApp(ctx context.Context, ID string) *types.Error

func (*Services) GMPSearch

func (s *Services) GMPSearch(ctx context.Context, payload *types.GmpPayload) ([]*gmp.GMPDocument, int, *types.Error)

func (*Services) GetCustodialByName

func (s *Services) GetCustodialByName(ctx context.Context, name string) (*models.Custodial, *types.Error)

func (*Services) GetCustodialGroupByName

func (s *Services) GetCustodialGroupByName(ctx context.Context, name string) (*models.CustodialGroup, *types.Error)

func (*Services) GetCustodialGroups

func (s *Services) GetCustodialGroups(ctx context.Context) ([]*models.CustodialGroup, *types.Error)

func (*Services) GetCustodials

func (s *Services) GetCustodials(ctx context.Context) ([]*models.Custodial, *types.Error)

func (*Services) GetDApp

func (s *Services) GetDApp(ctx context.Context) ([]*models.DApp, *types.Error)

func (*Services) GetGlobalParamsPublic

func (s *Services) GetGlobalParamsPublic() *GlobalParamsPublic

func (*Services) GetShortenCustodialGroups

func (s *Services) GetShortenCustodialGroups(ctx context.Context) ([]*models.ShortenCustodialGroup, *types.Error)

func (*Services) GetVersionedGlobalParamsByHeight

func (s *Services) GetVersionedGlobalParamsByHeight(height uint64) *types.VersionedGlobalParams

GetVersionedGlobalParamsByHeight returns the versioned global params for a particular bitcoin height

func (*Services) ToggleDApp

func (s *Services) ToggleDApp(ctx context.Context, ID string) *types.Error

func (*Services) UpdateDApp

func (s *Services) UpdateDApp(ctx context.Context, params DAppServiceParams) *types.Error

func (*Services) VaultSearch

func (s *Services) VaultSearch(ctx context.Context, payload *types.VaultPayload) ([]*vault.VaultDocument, *types.Error)

type VersionedGlobalParamsPublic

type VersionedGlobalParamsPublic struct {
	Version           uint64   `json:"version"`
	ActivationHeight  uint64   `json:"activation_height"`
	StakingCap        uint64   `json:"staking_cap"`
	CapHeight         uint64   `json:"cap_height"`
	Tag               string   `json:"tag"`
	CovenantPks       []string `json:"covenant_pks"`
	CovenantQuorum    uint64   `json:"covenant_quorum"`
	UnbondingTime     uint64   `json:"unbonding_time"`
	UnbondingFee      uint64   `json:"unbonding_fee"`
	MaxStakingAmount  uint64   `json:"max_staking_amount"`
	MinStakingAmount  uint64   `json:"min_staking_amount"`
	MaxStakingTime    uint64   `json:"max_staking_time"`
	MinStakingTime    uint64   `json:"min_staking_time"`
	ConfirmationDepth uint64   `json:"confirmation_depth"`
}

Jump to

Keyboard shortcuts

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