ports

package
v1.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v1.0.0

type Account interface {
	CreateAccount(
		ctx context.Context, accountName string, isMarket bool,
	) (WalletAccount, error)
	DeriveAddresses(
		ctx context.Context, accountName string, num int,
	) ([]string, error)
	DeriveChangeAddresses(
		ctx context.Context, accountName string, num int,
	) ([]string, error)
	ListAddresses(ctx context.Context, accountName string) ([]string, error)
	GetBalance(
		ctx context.Context, accountName string,
	) (map[string]Balance, error)
	ListUtxos(
		ctx context.Context, accountName string,
	) ([]Utxo, []Utxo, error)
	DeleteAccount(ctx context.Context, accountName string) error
}

type Balance added in v1.0.0

type Balance interface {
	GetConfirmedBalance() uint64
	GetUnconfirmedBalance() uint64
	GetLockedBalance() uint64
	GetTotalBalance() uint64
}

type BlockInfo added in v1.0.0

type BlockInfo interface {
	GetHash() string
	GetHeight() uint64
	GetTimestamp() int64
}

type BuildData added in v1.0.0

type BuildData interface {
	GetVersion() string
	GetCommit() string
	GetDate() string
}

type CustomPeriod added in v1.0.0

type CustomPeriod interface {
	GetStartDate() string
	GetEndDate() string
}

type Deposit added in v1.0.0

type Deposit interface {
	GetTxid() string
	GetTotalAmountPerAsset() map[string]uint64
	GetTimestamp() int64
}

type FragmenterReply added in v1.0.0

type FragmenterReply interface {
	GetMessage() string
	GetError() error
}

type Market added in v1.0.0

type Market interface {
	GetBaseAsset() string
	GetQuoteAsset() string
}

type MarketCollectedFees added in v1.0.0

type MarketCollectedFees interface {
	GetBaseAmount() uint64
	GetQuoteAmount() uint64
	GetTradeFeeInfo() []TradeFeeInfo
	GetStartDate() string
	GetEndDate() string
}

type MarketFee added in v1.0.0

type MarketFee interface {
	GetPercentageFee() uint32
	GetFixedBaseFee() uint64
	GetFixedQuoteFee() uint64
}

type MarketInfo added in v1.0.0

type MarketInfo interface {
	GetMarket() Market
	GetAccountName() string
	IsTradable() bool
	GetStrategyType() MarketStartegy
	GetBalance() map[string]Balance
	GetFee() MarketFee
	GetPrice() MarketPrice
}

type MarketPrice added in v1.0.0

type MarketPrice interface {
	GetBasePrice() decimal.Decimal
	GetQuotePrice() decimal.Decimal
}

type MarketReport added in v1.0.0

type MarketReport interface {
	GetMarket() Market
	GetCollectedFees() MarketCollectedFees
	GetTotalVolume() MarketVolume
	GetVolumesPerFrame() []MarketVolume
}

type MarketStartegy

type MarketStartegy interface {
	IsBalanced() bool
	IsPluggable() bool
}

type MarketVolume added in v1.0.0

type MarketVolume interface {
	GetBaseVolume() uint64
	GetQuoteVolume() uint64
	GetStartDate() string
	GetEndDate() string
}

type Notification added in v1.0.0

type Notification interface {
	GetTxNotifications() chan WalletTxNotification
	GetUtxoNotifications() chan WalletUtxoNotification
}

type Page added in v1.0.0

type Page interface {
	GetNumber() int64
	GetSize() int64
}

type PredefinedPeriod added in v1.0.0

type PredefinedPeriod interface {
	IsLastHour() bool
	IsLastDay() bool
	IsLastWeek() bool
	IsLastMonth() bool
	IsLastThreeMonths() bool
	IsYearToDate() bool
	IsLastYear() bool
	IsAll() bool
}

type PubSubStore added in v0.4.0

type PubSubStore interface {
	// Init initialize the store with an optional encryption password.
	Init(password string) error
	// IsLocked returns whether the store is locked.
	IsLocked() bool
	// Lock locks the store.
	Lock()
	// UnlockStore unlocks the internal store.
	Unlock(password string) error
	// ChangePassword allows to change the encryption password.
	ChangePassword(oldPwd, newPwd string) error
	// Close should be used to gracefully close the connection with the store.
	Close() error
}

PubSubStore defines the methods to manage the internal store of a SecurePubSub service.

type RepoManager added in v0.3.1

type RepoManager interface {
	MarketRepository() domain.MarketRepository
	TradeRepository() domain.TradeRepository
	DepositRepository() domain.DepositRepository
	WithdrawalRepository() domain.WithdrawalRepository

	Close()
}

RepoManager interface defines the methods for swap, price and unspent.

type SecurePubSub added in v0.4.0

type SecurePubSub interface {
	// Store returns the internal store.
	Store() PubSubStore
	// Subscribes some client for a topic.
	Subscribe(topic string, args ...interface{}) (string, error)
	// Unsubscribe removes some client defined by its id for a topic.
	Unsubscribe(topic, id string) error
	// ListSubscriptionsForTopic returns the info of all clients subscribed for
	// a certain topic.
	ListSubscriptionsForTopic(topic string) []Subscription
	// Publish publishes a message for a certain topic. All clients subscribed
	// for such topic will receive the message.
	Publish(topic string, message string) error
	// TopicsByCode returns the all the topics supported by the service mapped by their
	// code.
	TopicsByCode() map[int]Topic
	// TopicsByLabel returns the all the topics supported by the service mapped by their
	// label.
	TopicsByLabel() map[string]Topic
}

SecurePubSub defines the methods of a pubsub service and its internal store. This service might need to store some data in memory or on the disk, for this reason along with the typical methods of a pubsub service, allows to manage an internal optionally encrypted storage.

type Subscription added in v0.4.0

type Subscription interface {
	Topic() Topic
	Id() string
	IsSecured() bool
	NotifyAt() string
}

type SwapAccept added in v1.0.0

type SwapAccept interface {
	GetId() string
	GetRequestId() string
	GetTransaction() string
	GetUnblindedInputs() []UnblindedInput
}

type SwapComplete added in v1.0.0

type SwapComplete interface {
	GetId() string
	GetAcceptId() string
	GetTransaction() string
}

type SwapFail added in v1.0.0

type SwapFail interface {
	GetId() string
	GetMessageId() string
	GetFailureCode() uint32
	GetFailureMessage() string
}

type SwapRequest added in v1.0.0

type SwapRequest interface {
	GetId() string
	GetAssetP() string
	GetAmountP() uint64
	GetAssetR() string
	GetAmountR() uint64
	GetTransaction() string
	GetUnblindedInputs() []UnblindedInput
}

type TimeRange added in v1.0.0

type TimeRange interface {
	GetPredefinedPeriod() PredefinedPeriod
	GetCustomPeriod() CustomPeriod
}

type Topic added in v0.4.0

type Topic interface {
	Code() int
	Label() string
}

type Trade added in v1.0.0

type Trade interface {
	GetId() string
	GetStatus() TradeStatus
	GetSwapInfo() SwapRequest
	GetSwapFailInfo() SwapFail
	GetRequestTimestamp() int64
	GetAcceptTimestamp() int64
	GetCompleteTimestamp() int64
	GetSettleTimestamp() int64
	GetExpiryTimestamp() int64
	GetMarket() Market
	GetMarketFee() MarketFee
	GetMarketPrice() MarketPrice
}

type TradeFeeInfo added in v1.0.0

type TradeFeeInfo interface {
	GetTradeId() string
	GetPercentageFee() uint64
	GetFeeAsset() string
	GetPercentageFeeAmount() uint64
	GetFixedFeeAmount() uint64
	GetMarketPrice() decimal.Decimal
	GetTimestamp() int64
}

type TradePreview added in v1.0.0

type TradePreview interface {
	GetAmount() uint64
	GetAsset() string
	GetMarketFee() MarketFee
	GetMarketPrice() MarketPrice
	GetMarketBalance() map[string]Balance
}

type TradeStatus added in v1.0.0

type TradeStatus interface {
	IsRequest() bool
	IsAccept() bool
	IsComplete() bool
	IsSettled() bool
	IsExpired() bool
	IsFailed() bool
}

type TradeType added in v1.0.0

type TradeType interface {
	IsBuy() bool
	IsSell() bool
}

type Transaction

type Transaction interface {
	GetTransaction(ctx context.Context, txid string) (string, error)
	EstimateFees(
		ctx context.Context, ins []TxInput, outs []TxOutput,
	) (uint64, error)
	SelectUtxos(
		ctx context.Context, accountName, asset string, amount uint64,
	) ([]Utxo, uint64, int64, error)
	CreatePset(
		ctx context.Context, ins []TxInput, outs []TxOutput,
	) (string, error)
	UpdatePset(
		ctx context.Context, pset string,
		ins []TxInput, outs []TxOutput,
	) (string, error)
	BlindPset(
		ctx context.Context, pset string, extraUnblindedIns []UnblindedInput,
	) (string, error)
	SignPset(
		ctx context.Context, pset string, extractRawTx bool,
	) (string, error)
	Transfer(
		ctx context.Context,
		accountName string, outs []TxOutput, millisatsPerByte uint64,
	) (string, error)
	BroadcastTransaction(ctx context.Context, txHex string) (string, error)
}

type TxInput added in v1.0.0

type TxInput interface {
	UtxoKey
	GetScript() string
	GetScriptSigSize() int
	GetWitnessSize() int
}

type TxOutput added in v1.0.0

type TxOutput interface {
	GetAsset() string
	GetAmount() uint64
	GetScript() string
	GetBlindingKey() string
}

type UnblindedInput added in v1.0.0

type UnblindedInput interface {
	GetIndex() uint32
	GetAsset() string
	GetAmount() uint64
	GetAssetBlinder() string
	GetAmountBlinder() string
}

type Utxo added in v1.0.0

type Utxo interface {
	UtxoKey
	GetAsset() string
	GetValue() uint64
	GetScript() string
	GetAssetBlinder() string
	GetValueBlinder() string
	GetConfirmedStatus() UtxoStatus
	GetSpentStatus() UtxoStatus
	GetRedeemScript() string
}

type UtxoKey added in v1.0.0

type UtxoKey interface {
	GetTxid() string
	GetIndex() uint32
}

type UtxoStatus added in v1.0.0

type UtxoStatus interface {
	GetTxid() string
	GetBlockInfo() BlockInfo
}

type Wallet added in v1.0.0

type Wallet interface {
	GenSeed(ctx context.Context) ([]string, error)
	InitWallet(ctx context.Context, mnemonic []string, password string) error
	RestoreWallet(ctx context.Context, mnemonic []string, password string) error
	Unlock(ctx context.Context, password string) error
	Lock(ctx context.Context, password string) error
	ChangePassword(ctx context.Context, oldPwd, newPwd string) error
	Status(ctx context.Context) (WalletStatus, error)
	Info(ctx context.Context) (WalletInfo, error)
}

type WalletAccount added in v1.0.0

type WalletAccount interface {
	GetName() string
	GetDerivationPath() string
	GetXpubs() []string
}

type WalletInfo added in v1.0.0

type WalletInfo interface {
	GetNetwork() string
	GetNativeAsset() string
	GetRootPath() string
	GetMasterBlindingKey() string
	GetBirthdayBlockHash() string
	GetBirthdayBlockHeight() uint32
	GetAccounts() []WalletAccount
}

type WalletService added in v1.0.0

type WalletService interface {
	Wallet() Wallet
	Account() Account
	Transaction() Transaction
	Notification() Notification
	Close()
}

type WalletStatus added in v1.0.0

type WalletStatus interface {
	IsInitialized() bool
	IsUnlocked() bool
	IsSynced() bool
}

type WalletTxEventType added in v1.0.0

type WalletTxEventType interface {
	IsUnconfirmed() bool
	IsConfirmed() bool
	IsBroadcasted() bool
}

type WalletTxNotification added in v1.0.0

type WalletTxNotification interface {
	GetEventType() WalletTxEventType
	GetAccountNames() []string
	GetTxHex() string
	GetBlockDetails() BlockInfo
}

type WalletUtxoEventType added in v1.0.0

type WalletUtxoEventType interface {
	IsUnconfirmed() bool
	IsConfirmed() bool
	IsLocked() bool
	IsUnlocked() bool
	IsSpent() bool
}

type WalletUtxoNotification added in v1.0.0

type WalletUtxoNotification interface {
	GetEventType() WalletUtxoEventType
	GetUtxos() []Utxo
}

type Webhook added in v1.0.0

type Webhook interface {
	GetActionType() int
	GetEndpoint() string
	GetSecret() string
}

type WebhookInfo added in v1.0.0

type WebhookInfo interface {
	GetId() string
	GetActionType() int
	GetEndpoint() string
	IsSecured() bool
}

type Withdrawal added in v1.0.0

type Withdrawal interface {
	GetTxid() string
	GetTotalAmountPerAsset() map[string]uint64
	GetTimestamp() int64
}

Jump to

Keyboard shortcuts

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