service

package
v0.0.0-...-c3a2cad Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB map[string]*blockchain.BlockChain = make(map[string]*blockchain.BlockChain) // in-memory database

)

Functions

This section is empty.

Types

type BlockChainService

type BlockChainService interface {
	CreateTransaction(ctx context.Context, t transaction.Request) error
	UpdateTransaction(t transaction.Request) error
	ListTransactions() ([]*transaction.Transaction, int)
	DeleteTransactions() error
	Consensus() error
	Run()
	GetBlockChain() []*blockchain.Block
	GetWalletBalance(blockchainAddress string) float32
}

func NewBlockChainServiceImpl

func NewBlockChainServiceImpl(port uint16) BlockChainService

type BlockChainServiceImpl

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

func (*BlockChainServiceImpl) Consensus

func (b *BlockChainServiceImpl) Consensus() error

func (*BlockChainServiceImpl) CreateTransaction

func (b *BlockChainServiceImpl) CreateTransaction(ctx context.Context, t transaction.Request) error

func (*BlockChainServiceImpl) DeleteTransactions

func (b *BlockChainServiceImpl) DeleteTransactions() error

func (*BlockChainServiceImpl) GetBlockChain

func (b *BlockChainServiceImpl) GetBlockChain() []*blockchain.Block

func (*BlockChainServiceImpl) GetWalletBalance

func (b *BlockChainServiceImpl) GetWalletBalance(blockchainAddress string) float32

func (*BlockChainServiceImpl) ListTransactions

func (b *BlockChainServiceImpl) ListTransactions() ([]*transaction.Transaction, int)

func (*BlockChainServiceImpl) Run

func (b *BlockChainServiceImpl) Run()

func (*BlockChainServiceImpl) UpdateTransaction

func (b *BlockChainServiceImpl) UpdateTransaction(t transaction.Request) error

type WalletService

type WalletService interface {
	CreateTransaction(ctx context.Context, tr wallet.TransactionRequest) error
	CreateWallet() (*wallet.Wallet, error)
	GetWalletBalance(ctx context.Context, blockchainAddress string) (float32, error)
}

func NewWalletServiceImpl

func NewWalletServiceImpl(port uint16, gateway string) (WalletService, error)

type WalletServiceImpl

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

func (*WalletServiceImpl) CreateTransaction

func (w *WalletServiceImpl) CreateTransaction(ctx context.Context, tr wallet.TransactionRequest) error

func (*WalletServiceImpl) CreateWallet

func (w *WalletServiceImpl) CreateWallet() (*wallet.Wallet, error)

func (*WalletServiceImpl) GetWalletBalance

func (w *WalletServiceImpl) GetWalletBalance(ctx context.Context, blockchainAddress string) (float32, error)

Jump to

Keyboard shortcuts

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