wallets

package
v0.9.14-RC02 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

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 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 GetPrivateKeysByIDParams

type GetPrivateKeysByIDParams struct {
	OwnerID    uuid.UUID
	Addresses  []string
	Mnemonic   string
	Passphrase string
}

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

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) GetAll

func (s *HotWallets) GetAll(ctx context.Context) ([]*models.HotWallet, error)

GetAll returns all hot wallets

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

Create creates a processing wallet

func (*ProcessingWallets) Find

Find returns processing wallets filtered by params.

func (*ProcessingWallets) Get

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

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 New

func New(
	logger logger.Logger,
	conf *config.Config,
	st store.IStore,
	publisher dispatcher.IService,
	sdk *walletsdk.SDK,
) *Service

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) Name

func (s *Service) Name() string

Name

func (*Service) Processing

func (s *Service) Processing() *ProcessingWallets

func (*Service) SDK

func (s *Service) SDK() *walletsdk.SDK

SDK

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start

func (*Service) Stop

func (s *Service) Stop(_ context.Context) error

Stop

func (*Service) ValidateTransferDestination added in v0.9.13

func (s *Service) ValidateTransferDestination(ctx context.Context, transfer *models.Transfer) error

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.

Jump to

Keyboard shortcuts

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