interfaces

package
v0.0.0-...-a65acaf Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountRepository

type AccountRepository interface {

	// GetAccountAlias returns the alias info of the account if exists. The same accountId is returned if the account
	// doesn't have an alias
	GetAccountAlias(ctx context.Context, accountId types.AccountId) (types.AccountId, *rTypes.Error)

	// GetAccountId returns the `shard.realm.num` format of the account from its alias if exists
	GetAccountId(ctx context.Context, accountId types.AccountId) (types.AccountId, *rTypes.Error)

	// RetrieveBalanceAtBlock returns the hbar balance and token balances of the account at a given block (provided by
	// consensusEnd timestamp).
	// balance = balanceAtLatestBalanceSnapshot + balanceChangeBetweenSnapshotAndBlock
	// if the account is deleted at T1 and T1 <= consensusEnd, the balance is calculated as
	// balance = balanceAtLatestBalanceSnapshotBeforeT1 + balanceChangeBetweenSnapshotAndT1
	RetrieveBalanceAtBlock(ctx context.Context, accountId types.AccountId, consensusEnd int64) (
		types.AmountSlice,
		string,
		*rTypes.Error,
	)
}

AccountRepository Interface that all AccountRepository structs must implement

type AddressBookEntryRepository

type AddressBookEntryRepository interface {

	// Entries return all current address book Entries
	Entries(ctx context.Context) (*types.AddressBookEntries, *rTypes.Error)
}

AddressBookEntryRepository Interface that all AddressBookEntryRepository structs must implement

type BlockRepository

type BlockRepository interface {

	// FindByHash retrieves a block by a given Hash
	FindByHash(ctx context.Context, hash string) (*types.Block, *rTypes.Error)

	// FindByIdentifier retrieves a block by index and hash
	FindByIdentifier(ctx context.Context, index int64, hash string) (*types.Block, *rTypes.Error)

	// FindByIndex retrieves a block by given index
	FindByIndex(ctx context.Context, index int64) (*types.Block, *rTypes.Error)

	// RetrieveGenesis retrieves the genesis block
	RetrieveGenesis(ctx context.Context) (*types.Block, *rTypes.Error)

	// RetrieveLatest retrieves the second-latest block. It's required to hide the latest block so account service can
	// add 0-amount genesis token balance to a block for tokens with first transfer to the account in the next block
	RetrieveLatest(ctx context.Context) (*types.Block, *rTypes.Error)
}

BlockRepository Interface that all BlockRepository structs must implement

type DbClient

type DbClient interface {

	// GetDb returns the gorm.DB instance
	GetDb() *gorm.DB

	// GetDbWithContext returns the gorm.DB instance with the context and the cancel function
	GetDbWithContext(ctx context.Context) (*gorm.DB, context.CancelFunc)
}

DbClient Interface that all db clients must implement

type Transaction

type Transaction interface {

	// Execute submits the Transaction to the network using client
	Execute(client *hedera.Client) (hedera.TransactionResponse, error)

	// IsFrozen returns if the transaction is frozen
	IsFrozen() bool

	// GetDefaultMaxTransactionFee returns the default max transaction fee set for the Transaction
	GetDefaultMaxTransactionFee() hedera.Hbar

	// GetNodeAccountIDs returns the node accounts ids set for the Transaction
	GetNodeAccountIDs() []hedera.AccountID

	// GetSignatures returns the signatures of the Transaction
	GetSignatures() (map[hedera.AccountID]map[*hedera.PublicKey][]byte, error)

	// GetTransactionHash returns the transaction hash
	GetTransactionHash() ([]byte, error)

	// GetTransactionID returns the transaction id
	GetTransactionID() hedera.TransactionID

	// GetTransactionMemo returns the transaction memo
	GetTransactionMemo() string

	// GetTransactionValidDuration returns the transaction valid duration
	GetTransactionValidDuration() time.Duration

	// String encodes the Transaction to a string
	String() string

	// ToBytes serializes the Transaction to a byte slice
	ToBytes() ([]byte, error)
}

Transaction defines the transaction methods used by constructor service

type TransactionRepository

type TransactionRepository interface {

	// FindBetween retrieves all Transaction between the provided start and end timestamp inclusively
	FindBetween(ctx context.Context, start, end int64) ([]*types.Transaction, *rTypes.Error)

	// FindByHashInBlock retrieves a transaction by its hash in the block identified by [consensusStart, consensusEnd]
	FindByHashInBlock(ctx context.Context, hash string, consensusStart, consensusEnd int64) (
		*types.Transaction,
		*rTypes.Error,
	)
}

TransactionRepository Interface that all TransactionRepository structs must implement

Jump to

Keyboard shortcuts

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