Documentation ¶
Index ¶
- Variables
- func NewMarketRepositoryImpl(store *marketInmemoryStore) domain.MarketRepository
- func NewRepoManager() ports.RepoManager
- func NewTradeRepositoryImpl(store *tradeInmemoryStore) domain.TradeRepository
- func NewUnspentRepositoryImpl(store *unspentInmemoryStore) domain.UnspentRepository
- func NewVaultRepositoryImpl(store *vaultInmemoryStore) domain.VaultRepository
- type InmemoryTx
- type MarketRepositoryImpl
- func (r MarketRepositoryImpl) CloseMarket(_ context.Context, quoteAsset string) error
- func (r *MarketRepositoryImpl) DeleteMarket(_ context.Context, accountIndex int) error
- func (r MarketRepositoryImpl) GetAllMarkets(_ context.Context) ([]domain.Market, error)
- func (r MarketRepositoryImpl) GetLatestMarket(_ context.Context) (market *domain.Market, accountIndex int, err error)
- func (r MarketRepositoryImpl) GetMarketByAccount(_ context.Context, accountIndex int) (*domain.Market, error)
- func (r MarketRepositoryImpl) GetMarketByAsset(_ context.Context, quoteAsset string) (market *domain.Market, accountIndex int, err error)
- func (r MarketRepositoryImpl) GetOrCreateMarket(_ context.Context, market *domain.Market) (*domain.Market, error)
- func (r MarketRepositoryImpl) GetTradableMarkets(_ context.Context) (tradableMarkets []domain.Market, err error)
- func (r MarketRepositoryImpl) OpenMarket(_ context.Context, quoteAsset string) error
- func (r MarketRepositoryImpl) UpdateMarket(_ context.Context, accountIndex int, ...) error
- func (r *MarketRepositoryImpl) UpdatePrices(_ context.Context, accountIndex int, prices domain.Prices) error
- type RepoManager
- func (d *RepoManager) Close()
- func (d *RepoManager) MarketRepository() domain.MarketRepository
- func (db *RepoManager) NewPricesTransaction() ports.Transaction
- func (db *RepoManager) NewTransaction() ports.Transaction
- func (db *RepoManager) NewUnspentsTransaction() ports.Transaction
- func (db *RepoManager) RunPricesTransaction(ctx context.Context, readOnly bool, ...) (interface{}, error)
- func (db *RepoManager) RunTransaction(ctx context.Context, _ bool, ...) (interface{}, error)
- func (db *RepoManager) RunUnspentsTransaction(ctx context.Context, readOnly bool, ...) (interface{}, error)
- func (d *RepoManager) TradeRepository() domain.TradeRepository
- func (d *RepoManager) UnspentRepository() domain.UnspentRepository
- func (d *RepoManager) VaultRepository() domain.VaultRepository
- type UnspentRepositoryImpl
- func (r UnspentRepositoryImpl) AddUnspents(_ context.Context, unspents []domain.Unspent) error
- func (r UnspentRepositoryImpl) ConfirmUnspents(ctx context.Context, unspentKeys []domain.UnspentKey) (int, error)
- func (r UnspentRepositoryImpl) GetAllUnspents(_ context.Context) []domain.Unspent
- func (r UnspentRepositoryImpl) GetAllUnspentsForAddresses(ctx context.Context, addresses []string) ([]domain.Unspent, error)
- func (r UnspentRepositoryImpl) GetAvailableUnspents(_ context.Context) ([]domain.Unspent, error)
- func (r UnspentRepositoryImpl) GetAvailableUnspentsForAddresses(_ context.Context, addresses []string) ([]domain.Unspent, error)
- func (r UnspentRepositoryImpl) GetBalance(_ context.Context, addresses []string, assetHash string) (uint64, error)
- func (r UnspentRepositoryImpl) GetUnlockedBalance(_ context.Context, addresses []string, assetHash string) (uint64, error)
- func (r UnspentRepositoryImpl) GetUnspentWithKey(_ context.Context, unspentKey domain.UnspentKey) (*domain.Unspent, error)
- func (r UnspentRepositoryImpl) GetUnspentsForAddresses(_ context.Context, addresses []string) ([]domain.Unspent, error)
- func (r UnspentRepositoryImpl) LockUnspents(_ context.Context, unspentKeys []domain.UnspentKey, tradeID uuid.UUID) (int, error)
- func (r UnspentRepositoryImpl) SpendUnspents(ctx context.Context, unspentKeys []domain.UnspentKey) (int, error)
- func (r UnspentRepositoryImpl) UnlockUnspents(_ context.Context, unspentKeys []domain.UnspentKey) (int, error)
- type VaultRepositoryImpl
- func (r VaultRepositoryImpl) GetAccountByAddress(ctx context.Context, addr string) (*domain.Account, int, error)
- func (r VaultRepositoryImpl) GetAccountByIndex(ctx context.Context, accountIndex int) (*domain.Account, error)
- func (r VaultRepositoryImpl) GetAllDerivedAddressesInfoForAccount(ctx context.Context, accountIndex int) (domain.AddressesInfo, error)
- func (r VaultRepositoryImpl) GetAllDerivedExternalAddressesInfoForAccount(ctx context.Context, accountIndex int) (domain.AddressesInfo, error)
- func (r VaultRepositoryImpl) GetDerivationPathByScript(ctx context.Context, accountIndex int, scripts []string) (map[string]string, error)
- func (r VaultRepositoryImpl) GetOrCreateVault(ctx context.Context, mnemonic []string, passphrase string, ...) (*domain.Vault, error)
- func (r VaultRepositoryImpl) UpdateVault(ctx context.Context, updateFn func(*domain.Vault) (*domain.Vault, error)) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMarketNotExist ... ErrMarketNotExist = errors.New("market does not exists") // ErrMarketNotFound ... ErrMarketNotFound = errors.New("market not found") // ErrMarketInvalidRequest ... ErrMarketInvalidRequest = errors.New("requested market is null") )
Market errors
var ( // ErrTradeNotFound ... ErrTradeNotFound = errors.New("trade not found") )
Trade errors
var ( // ErrVaultNotFound ... ErrVaultNotFound = errors.New("vault not found") )
Vault errors
Functions ¶
func NewMarketRepositoryImpl ¶
func NewMarketRepositoryImpl(store *marketInmemoryStore) domain.MarketRepository
NewMarketRepositoryImpl returns a new empty MarketRepositoryImpl
func NewRepoManager ¶ added in v0.3.1
func NewRepoManager() ports.RepoManager
func NewTradeRepositoryImpl ¶
func NewTradeRepositoryImpl(store *tradeInmemoryStore) domain.TradeRepository
NewTradeRepositoryImpl returns a new inmemory TradeRepository implementation.
func NewUnspentRepositoryImpl ¶
func NewUnspentRepositoryImpl(store *unspentInmemoryStore) domain.UnspentRepository
NewUnspentRepositoryImpl returns a new empty MarketRepositoryImpl
func NewVaultRepositoryImpl ¶
func NewVaultRepositoryImpl(store *vaultInmemoryStore) domain.VaultRepository
NewVaultRepositoryImpl returns a new empty VaultRepositoryImpl
Types ¶
type InmemoryTx ¶ added in v0.1.0
type InmemoryTx struct {
// contains filtered or unexported fields
}
func (*InmemoryTx) Commit ¶ added in v0.1.0
func (tx *InmemoryTx) Commit() error
func (*InmemoryTx) Discard ¶ added in v0.1.0
func (tx *InmemoryTx) Discard()
type MarketRepositoryImpl ¶
type MarketRepositoryImpl struct {
// contains filtered or unexported fields
}
MarketRepositoryImpl represents an in memory storage
func (MarketRepositoryImpl) CloseMarket ¶
func (r MarketRepositoryImpl) CloseMarket(_ context.Context, quoteAsset string) error
CloseMarket makes a market found with the given quote asset hash as NOT available for trading
func (*MarketRepositoryImpl) DeleteMarket ¶ added in v0.3.0
func (r *MarketRepositoryImpl) DeleteMarket( _ context.Context, accountIndex int, ) error
func (MarketRepositoryImpl) GetAllMarkets ¶
GetAllMarkets returns all the markets either tradable or not.
func (MarketRepositoryImpl) GetLatestMarket ¶
func (r MarketRepositoryImpl) GetLatestMarket(_ context.Context) (market *domain.Market, accountIndex int, err error)
GetLatestMarket returns the latest stored market (either funded or not)
func (MarketRepositoryImpl) GetMarketByAccount ¶ added in v0.1.0
func (r MarketRepositoryImpl) GetMarketByAccount(_ context.Context, accountIndex int) (*domain.Market, error)
GetMarketByAccount return the market for the account index given as parameter
func (MarketRepositoryImpl) GetMarketByAsset ¶
func (r MarketRepositoryImpl) GetMarketByAsset(_ context.Context, quoteAsset string) (market *domain.Market, accountIndex int, err error)
GetMarketByAsset returns a funded market using the quote asset hash
func (MarketRepositoryImpl) GetOrCreateMarket ¶
func (r MarketRepositoryImpl) GetOrCreateMarket(_ context.Context, market *domain.Market) (*domain.Market, error)
GetOrCreateMarket gets a market with a given account index. If not found, a new entry is inserted
func (MarketRepositoryImpl) GetTradableMarkets ¶
func (r MarketRepositoryImpl) GetTradableMarkets(_ context.Context) (tradableMarkets []domain.Market, err error)
GetTradableMarkets returns all the markets available for trading
func (MarketRepositoryImpl) OpenMarket ¶
func (r MarketRepositoryImpl) OpenMarket(_ context.Context, quoteAsset string) error
OpenMarket makes a market found with the given quote asset hash as available for trading
func (MarketRepositoryImpl) UpdateMarket ¶
func (r MarketRepositoryImpl) UpdateMarket( _ context.Context, accountIndex int, updateFn func(m *domain.Market) (*domain.Market, error), ) error
UpdateMarket updates data to a market identified by the account index passing an update function
func (*MarketRepositoryImpl) UpdatePrices ¶ added in v0.1.0
type RepoManager ¶ added in v0.3.1
type RepoManager struct {
// contains filtered or unexported fields
}
func (*RepoManager) Close ¶ added in v0.3.1
func (d *RepoManager) Close()
func (*RepoManager) MarketRepository ¶ added in v0.3.1
func (d *RepoManager) MarketRepository() domain.MarketRepository
func (*RepoManager) NewPricesTransaction ¶ added in v0.3.1
func (db *RepoManager) NewPricesTransaction() ports.Transaction
func (*RepoManager) NewTransaction ¶ added in v0.3.1
func (db *RepoManager) NewTransaction() ports.Transaction
func (*RepoManager) NewUnspentsTransaction ¶ added in v0.3.1
func (db *RepoManager) NewUnspentsTransaction() ports.Transaction
func (*RepoManager) RunPricesTransaction ¶ added in v0.3.1
func (*RepoManager) RunTransaction ¶ added in v0.3.1
func (*RepoManager) RunUnspentsTransaction ¶ added in v0.3.1
func (*RepoManager) TradeRepository ¶ added in v0.3.1
func (d *RepoManager) TradeRepository() domain.TradeRepository
func (*RepoManager) UnspentRepository ¶ added in v0.3.1
func (d *RepoManager) UnspentRepository() domain.UnspentRepository
func (*RepoManager) VaultRepository ¶ added in v0.3.1
func (d *RepoManager) VaultRepository() domain.VaultRepository
type UnspentRepositoryImpl ¶
type UnspentRepositoryImpl struct {
// contains filtered or unexported fields
}
UnspentRepositoryImpl represents an in memory storage
func (UnspentRepositoryImpl) AddUnspents ¶
AddUnspents method is used by crawler to add unspent's to the memory, it assumes that all unspent's belongs to the same address, it assumes that each time it is invoked by crawler, it assumes that it will receive all unspent's for specific address it adds non exiting unspent's to the memory in case that unspent's, passed to the function, are not already in memory it will mark unspent in memory, as spent
func (UnspentRepositoryImpl) ConfirmUnspents ¶ added in v0.1.0
func (r UnspentRepositoryImpl) ConfirmUnspents( ctx context.Context, unspentKeys []domain.UnspentKey, ) (int, error)
ConfirmUnspents ...
func (UnspentRepositoryImpl) GetAllUnspents ¶
func (r UnspentRepositoryImpl) GetAllUnspents(_ context.Context) []domain.Unspent
GetAllUnspents returns all the unspents stored
func (UnspentRepositoryImpl) GetAllUnspentsForAddresses ¶ added in v0.1.0
func (r UnspentRepositoryImpl) GetAllUnspentsForAddresses( ctx context.Context, addresses []string, ) ([]domain.Unspent, error)
GetAllUnspentsForAddresses ...
func (UnspentRepositoryImpl) GetAvailableUnspents ¶
GetAvailableUnspents ...
func (UnspentRepositoryImpl) GetAvailableUnspentsForAddresses ¶
func (r UnspentRepositoryImpl) GetAvailableUnspentsForAddresses( _ context.Context, addresses []string, ) ([]domain.Unspent, error)
GetAvailableUnspentsForAddresses ...
func (UnspentRepositoryImpl) GetBalance ¶
func (r UnspentRepositoryImpl) GetBalance( _ context.Context, addresses []string, assetHash string, ) (uint64, error)
GetBalance ...
func (UnspentRepositoryImpl) GetUnlockedBalance ¶
func (r UnspentRepositoryImpl) GetUnlockedBalance( _ context.Context, addresses []string, assetHash string, ) (uint64, error)
GetUnlockedBalance ...
func (UnspentRepositoryImpl) GetUnspentWithKey ¶ added in v0.3.0
func (r UnspentRepositoryImpl) GetUnspentWithKey( _ context.Context, unspentKey domain.UnspentKey, ) (*domain.Unspent, error)
GetUnspentWithKey ...
func (UnspentRepositoryImpl) GetUnspentsForAddresses ¶ added in v0.1.0
func (r UnspentRepositoryImpl) GetUnspentsForAddresses( _ context.Context, addresses []string, ) ([]domain.Unspent, error)
GetUnspentsForAddresses ...
func (UnspentRepositoryImpl) LockUnspents ¶
func (r UnspentRepositoryImpl) LockUnspents( _ context.Context, unspentKeys []domain.UnspentKey, tradeID uuid.UUID, ) (int, error)
LockUnspents ...
func (UnspentRepositoryImpl) SpendUnspents ¶ added in v0.1.0
func (r UnspentRepositoryImpl) SpendUnspents( ctx context.Context, unspentKeys []domain.UnspentKey, ) (int, error)
SpendUnspents ...
func (UnspentRepositoryImpl) UnlockUnspents ¶
func (r UnspentRepositoryImpl) UnlockUnspents( _ context.Context, unspentKeys []domain.UnspentKey, ) (int, error)
UnlockUnspents ...
type VaultRepositoryImpl ¶
type VaultRepositoryImpl struct {
// contains filtered or unexported fields
}
VaultRepositoryImpl represents an in memory storage
func (VaultRepositoryImpl) GetAccountByAddress ¶
func (VaultRepositoryImpl) GetAccountByIndex ¶
func (VaultRepositoryImpl) GetAllDerivedAddressesInfoForAccount ¶ added in v0.3.0
func (r VaultRepositoryImpl) GetAllDerivedAddressesInfoForAccount( ctx context.Context, accountIndex int, ) (domain.AddressesInfo, error)
func (VaultRepositoryImpl) GetAllDerivedExternalAddressesInfoForAccount ¶ added in v0.3.0
func (r VaultRepositoryImpl) GetAllDerivedExternalAddressesInfoForAccount( ctx context.Context, accountIndex int, ) (domain.AddressesInfo, error)