Documentation
¶
Index ¶
- Variables
- func AddressTypeByBlockchain(blockchain wconstants.BlockchainType) (string, error)
- type CheckWalletResult
- type ColdWallets
- func (s *ColdWallets) BatchAttachColdWallets(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) error
- func (s *ColdWallets) Create(ctx context.Context, params CreateColdWalletParams, opts ...repos.Option) (*models.ColdWallet, error)
- func (s *ColdWallets) DeleteAllByBlockchainAndOwnerID(ctx context.Context, params DeleteAllColdWalletsParams, opts ...repos.Option) error
- func (s *ColdWallets) Find(ctx context.Context, params FindColdWalletsParams) (*storecmn.FindResponse[*models.ColdWallet], error)
- func (s *ColdWallets) Get(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) (*models.ColdWallet, error)
- func (s *ColdWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.ColdWallet, error)
- func (s *ColdWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ColdWallet, error)
- type CreateColdWalletParams
- type CreateHotWalletParams
- type CreateProcessingWalletParams
- type DeleteAllColdWalletsParams
- type FindColdWalletsParams
- type FindHotWalletsParams
- type FindProcessingWalletsParams
- type GetAllPrivateKeysResponse
- type GetPrivateKeysByIDParams
- type HotWallets
- func (s *HotWallets) ActivateWallet(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) error
- func (s *HotWallets) Create(ctx context.Context, params CreateHotWalletParams, opts ...repos.Option) (*models.HotWallet, error)
- func (s *HotWallets) Find(ctx context.Context, params FindHotWalletsParams) (*storecmn.FindResponse[*models.HotWallet], error)
- func (s *HotWallets) Get(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) (*models.HotWallet, error)
- func (s *HotWallets) GetAll(ctx context.Context) ([]*models.HotWallet, error)
- func (s *HotWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.HotWallet, error)
- func (s *HotWallets) GetAllPrivateKeys(ctx context.Context, ownerID uuid.UUID, mnemonic, passPhrase string) (*GetAllPrivateKeysResponse, error)
- func (s *HotWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.HotWallet, error)
- func (s *HotWallets) GetPrivateKeysByIDs(ctx context.Context, params *GetPrivateKeysByIDParams) (*GetAllPrivateKeysResponse, error)
- func (s *HotWallets) MarkDirty(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) error
- type PrivateKeysItem
- type ProcessingWallets
- func (s *ProcessingWallets) Create(ctx context.Context, params CreateProcessingWalletParams, opts ...repos.Option) (*models.ProcessingWallet, error)
- func (s *ProcessingWallets) Find(ctx context.Context, params FindProcessingWalletsParams) (*storecmn.FindResponse[*models.ProcessingWallet], error)
- func (s *ProcessingWallets) Get(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ProcessingWallet, error)
- func (s *ProcessingWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.ProcessingWallet, error)
- func (s *ProcessingWallets) GetAllNotCreatedWallets(ctx context.Context) ([]*repo_wallets_processing.GetAllNotCreatedWalletsRow, error)
- func (s *ProcessingWallets) GetAllPrivateKeys(ctx context.Context, ownerID uuid.UUID, mnemonic, passPhrase string) (*GetAllPrivateKeysResponse, error)
- func (s *ProcessingWallets) GetByBlockchain(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType) (*models.ProcessingWallet, error)
- func (s *ProcessingWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ProcessingWallet, error)
- func (s *ProcessingWallets) GetByOwnerID(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, ...) (*models.ProcessingWallet, error)
- type Service
- func (s *Service) CheckWallet(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*CheckWalletResult, error)
- func (s *Service) Cold() *ColdWallets
- func (s *Service) GetSequenceByWalletType(ctx context.Context, walletType constants.WalletType, ownerID uuid.UUID, ...) (int32, error)
- func (s *Service) Hot() *HotWallets
- func (s *Service) Name() string
- func (s *Service) Processing() *ProcessingWallets
- func (s *Service) SDK() *walletsdk.SDK
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(_ context.Context) error
- func (s *Service) ValidateTransferDestination(ctx context.Context, transfer *models.Transfer) error
Constants ¶
This section is empty.
Variables ¶
var ErrAddressNotFound = fmt.Errorf("address not found")
Functions ¶
func AddressTypeByBlockchain ¶
func AddressTypeByBlockchain(blockchain wconstants.BlockchainType) (string, error)
AddressTypeByBlockchain returns the default address type by blockchain type.
Types ¶
type CheckWalletResult ¶
type CheckWalletResult struct {
WalletType constants.WalletType
OwnerID uuid.UUID
ExternalWalletID *string
IsActivated *bool
}
func (*CheckWalletResult) Activated ¶
func (s *CheckWalletResult) Activated() bool
type ColdWallets ¶
type ColdWallets struct {
// contains filtered or unexported fields
}
func (*ColdWallets) BatchAttachColdWallets ¶
func (s *ColdWallets) BatchAttachColdWallets(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, params []CreateColdWalletParams) error
BatchAttachColdWallets creates cold wallets in batch.
func (*ColdWallets) Create ¶
func (s *ColdWallets) Create(ctx context.Context, params CreateColdWalletParams, opts ...repos.Option) (*models.ColdWallet, error)
Create creates a cold wallet
func (*ColdWallets) DeleteAllByBlockchainAndOwnerID ¶
func (s *ColdWallets) DeleteAllByBlockchainAndOwnerID(ctx context.Context, params DeleteAllColdWalletsParams, opts ...repos.Option) error
DeleteAllByBlockchainAndOwnerID deletes cold wallets by params.
func (*ColdWallets) Find ¶
func (s *ColdWallets) Find(ctx context.Context, params FindColdWalletsParams) (*storecmn.FindResponse[*models.ColdWallet], error)
Find returns cold wallets filtered by params.
func (*ColdWallets) Get ¶
func (s *ColdWallets) Get(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string) (*models.ColdWallet, error)
Get returns a cold wallet by ownerID, address and blockchain.
func (*ColdWallets) GetAllByOwnerID ¶
func (s *ColdWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.ColdWallet, error)
GetAllByOwnerID returns all hot wallets for the owner.
func (*ColdWallets) GetByBlockchainAndAddress ¶
func (s *ColdWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ColdWallet, error)
GetByBlockchainAndAddress returns a cold wallet by blockchain and address.
type CreateColdWalletParams ¶
type CreateColdWalletParams struct {
Blockchain wconstants.BlockchainType
Address string
OwnerID uuid.UUID
}
type CreateHotWalletParams ¶
type CreateHotWalletParams struct {
OwnerID uuid.UUID `validate:"required,uuid4"`
Blockchain wconstants.BlockchainType `validate:"required"`
AddressType string `validate:"required"`
Mnemonic string `validate:"required"`
Passphrase string
ExternalWalletID string `validate:"required"`
}
type CreateProcessingWalletParams ¶
type CreateProcessingWalletParams struct {
OwnerID uuid.UUID
Blockchain wconstants.BlockchainType
Mnemonic string
Passphrase string
}
func (CreateProcessingWalletParams) Validate ¶
func (p CreateProcessingWalletParams) Validate() error
Validate validates the CreateProcessingWalletParams fields.
type DeleteAllColdWalletsParams ¶
type DeleteAllColdWalletsParams = repo_wallets_cold.DeleteAllByOwnerIDParams
type FindColdWalletsParams ¶
type FindColdWalletsParams = repo_wallets_cold.FindParams
type FindHotWalletsParams ¶
type FindHotWalletsParams = repo_wallets_hot.FindParams
type FindProcessingWalletsParams ¶
type FindProcessingWalletsParams = repo_wallets_processing.FindParams
type GetAllPrivateKeysResponse ¶
type GetAllPrivateKeysResponse map[wconstants.BlockchainType][]PrivateKeysItem
type HotWallets ¶
type HotWallets struct {
// contains filtered or unexported fields
}
func (*HotWallets) ActivateWallet ¶
func (s *HotWallets) ActivateWallet(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string, opts ...repos.Option) error
ActivateWallet activates the hot wallet.
func (*HotWallets) Create ¶
func (s *HotWallets) Create(ctx context.Context, params CreateHotWalletParams, opts ...repos.Option) (*models.HotWallet, error)
Create creates a hot wallet
func (*HotWallets) Find ¶
func (s *HotWallets) Find(ctx context.Context, params FindHotWalletsParams) (*storecmn.FindResponse[*models.HotWallet], error)
Find returns hot wallets filtered by params.
func (*HotWallets) Get ¶
func (s *HotWallets) Get(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string) (*models.HotWallet, error)
Get returns the hot wallet by ownerID, blockchain and address.
func (*HotWallets) GetAllByOwnerID ¶
func (s *HotWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.HotWallet, error)
GetAllByOwnerID returns all hot wallets for the owner.
func (*HotWallets) GetAllPrivateKeys ¶
func (s *HotWallets) GetAllPrivateKeys(ctx context.Context, ownerID uuid.UUID, mnemonic, passPhrase string) (*GetAllPrivateKeysResponse, error)
GetAllPrivateKeys returns all private keys for the owner.
func (*HotWallets) GetByBlockchainAndAddress ¶
func (s *HotWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.HotWallet, error)
GetByBlockchainAndAddress returns a hot wallet by blockchain and address.
func (*HotWallets) GetPrivateKeysByIDs ¶
func (s *HotWallets) GetPrivateKeysByIDs(ctx context.Context, params *GetPrivateKeysByIDParams) (*GetAllPrivateKeysResponse, error)
func (*HotWallets) MarkDirty ¶
func (s *HotWallets) MarkDirty(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string) error
MarkDirty marks the hot wallet as dirty.
type PrivateKeysItem ¶
type PrivateKeysItem struct {
PublicKey string
PrivateKey string
Address string
Kind constants.WalletType
}
type ProcessingWallets ¶
type ProcessingWallets struct {
// contains filtered or unexported fields
}
func (*ProcessingWallets) Create ¶
func (s *ProcessingWallets) Create(ctx context.Context, params CreateProcessingWalletParams, opts ...repos.Option) (*models.ProcessingWallet, error)
Create creates a processing wallet
func (*ProcessingWallets) Find ¶
func (s *ProcessingWallets) Find(ctx context.Context, params FindProcessingWalletsParams) (*storecmn.FindResponse[*models.ProcessingWallet], error)
Find returns processing wallets filtered by params.
func (*ProcessingWallets) Get ¶
func (s *ProcessingWallets) Get(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ProcessingWallet, error)
Get returns the processing wallet by blockchain and address.
func (*ProcessingWallets) GetAllByOwnerID ¶
func (s *ProcessingWallets) GetAllByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]*models.ProcessingWallet, error)
GetAllByOwnerID returns all processing wallets for the owner.
func (*ProcessingWallets) GetAllNotCreatedWallets ¶
func (s *ProcessingWallets) GetAllNotCreatedWallets(ctx context.Context) ([]*repo_wallets_processing.GetAllNotCreatedWalletsRow, error)
GetAllNotCreatedWallets returns all not created wallets.
func (*ProcessingWallets) GetAllPrivateKeys ¶
func (s *ProcessingWallets) GetAllPrivateKeys(ctx context.Context, ownerID uuid.UUID, mnemonic, passPhrase string) (*GetAllPrivateKeysResponse, error)
GetAllPrivateKeys returns all private keys for the owner.
func (*ProcessingWallets) GetByBlockchain ¶
func (s *ProcessingWallets) GetByBlockchain(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType) (*models.ProcessingWallet, error)
GetByBlockchain
func (*ProcessingWallets) GetByBlockchainAndAddress ¶
func (s *ProcessingWallets) GetByBlockchainAndAddress(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*models.ProcessingWallet, error)
GetByBlockchainAndAddress returns a processing wallet by blockchain and address.
func (*ProcessingWallets) GetByOwnerID ¶
func (s *ProcessingWallets) GetByOwnerID(ctx context.Context, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string) (*models.ProcessingWallet, error)
GetByOwnerID returns the processing wallet by ownerID, blockchain and address.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CheckWallet ¶
func (s *Service) CheckWallet(ctx context.Context, blockchain wconstants.BlockchainType, address string) (*CheckWalletResult, error)
CheckWallet - determines whether the address belongs to us or not. checks hot, cold, and processing wallets. returns the wallet type and the owner id
func (*Service) Cold ¶
func (s *Service) Cold() *ColdWallets
func (*Service) GetSequenceByWalletType ¶
func (s *Service) GetSequenceByWalletType( ctx context.Context, walletType constants.WalletType, ownerID uuid.UUID, blockchain wconstants.BlockchainType, address string, ) (int32, error)
func (*Service) Hot ¶
func (s *Service) Hot() *HotWallets
func (*Service) Processing ¶
func (s *Service) Processing() *ProcessingWallets
func (*Service) ValidateTransferDestination ¶ added in v0.9.13
ValidateTransferDestination checks the destination of a transfer from a hot wallet.
Regular transfers are allowed to the owner's cold and processing wallets only. Withdrawals and refunds are allowed to external addresses, which do not belong to any wallet, and must be confirmed by 2FA or, for refunds, delayed by the cooldown.