Versions in this module Expand all Collapse all v0 v0.6.0 Dec 17, 2023 Changes in this version + const EntityTypeSystem + type Balances map[EntityType][]*Balance + type ListAllBalancesOpts struct + HideEmpty bool + WithSystemBalances bool + WithUSD bool type Service + func (s *Service) ListAllBalances(ctx context.Context, opts ListAllBalancesOpts) (Balances, error) v0.5.6 Dec 16, 2023 v0.5.5 Dec 8, 2023 v0.5.4 Sep 28, 2023 v0.5.3 Sep 27, 2023 v0.5.2 Sep 5, 2023 v0.5.1 Aug 17, 2023 v0.5.0 Jul 29, 2023 v0.4.0 Jul 27, 2023 v0.3.1 Jul 25, 2023 v0.3.0 Jul 23, 2023 Changes in this version type Balance + func (b *Balance) Blockchain() money.Blockchain v0.2.0 Jul 9, 2023 v0.1.3 Jul 2, 2023 v0.1.2 Jul 2, 2023 v0.1.1 Jul 2, 2023 v0.1.0 Jun 25, 2023 Changes in this version + const EntityTypeMerchant + const EntityTypeWallet + const MetaAmountFormatted + const MetaAmountRaw + const MetaOperation + const MetaRecipientWalletID + const MetaSenderWalletID + const MetaTransactionID + const OperationDecrement + const OperationIncrement + var ErrBalanceNotFound = errors.New("balance not found") + var ErrInsufficienceMerchantBalance = errors.Wrap(ErrInsufficientBalance, "merchant") + var ErrInsufficientBalance = errors.New("insufficient balance") + var ErrInvalidBlockchain = errors.New("invalid blockchain provided") + var ErrInvalidType = errors.New("invalid type provided") + var ErrNotFound = errors.New("wallet not found") + var ErrTxConfirm = errors.New("nothing to confirm") + var ErrTxRollback = errors.New("nothing to rollback") + func ReleaseLock(ctx context.Context, q repository.Querier, walletID int64, ...) error + type Balance struct + Amount money.Money + CreatedAt time.Time + Currency string + CurrencyType money.CryptoCurrencyType + EntityID int64 + EntityType EntityType + ID int64 + Network string + NetworkID string + UUID uuid.UUID + UpdatedAt time.Time + UsdAmount *money.Money + func UpdateBalance(ctx context.Context, q repository.Querier, params UpdateBalanceQuery) (*Balance, error) + func (b *Balance) Covers(expenses ...money.Money) error + type BalanceOperation string + type BlockchainService interface + type EntityType string + type MetaData map[MetaDataKey]string + func (m MetaData) ToJSONB() pgtype.JSONB + type MetaDataKey string + type Pagination struct + FilterByBlockchain kmswallet.Blockchain + FilterByType Type + Limit int64 + Start int64 + type Service struct + func New(kmsClient kmsclient.ClientService, blockchainService BlockchainService, ...) *Service + func (s *Service) AcquireLock(ctx context.Context, merchantID int64, currency money.CryptoCurrency, ...) (*Wallet, error) + func (s *Service) BulkCreateWallets(ctx context.Context, bc kmswallet.Blockchain, amount int64) ([]*Wallet, error) + func (s *Service) Create(ctx context.Context, bc kmswallet.Blockchain, walletType Type) (*Wallet, error) + func (s *Service) CreateSignedTransaction(ctx context.Context, sender *Wallet, recipient string, ...) (string, error) + func (s *Service) DecrementPendingTransaction(ctx context.Context, walletID int64, isTest bool) error + func (s *Service) EnsureBalance(ctx context.Context, entityType EntityType, entityID int64, ...) (*Balance, error) + func (s *Service) EnsureOutboundWallet(ctx context.Context, bc kmswallet.Blockchain) (*Wallet, bool, error) + func (s *Service) GetBalanceByID(ctx context.Context, entityType EntityType, entityID, balanceID int64) (*Balance, error) + func (s *Service) GetBalanceByUUID(ctx context.Context, entityType EntityType, entityID int64, ...) (*Balance, error) + func (s *Service) GetByID(ctx context.Context, id int64) (*Wallet, error) + func (s *Service) GetByUUID(ctx context.Context, id uuid.UUID) (*Wallet, error) + func (s *Service) GetMerchantBalance(ctx context.Context, merchantID int64, currency, networkID string) (*Balance, error) + func (s *Service) GetMerchantBalanceByUUID(ctx context.Context, merchantID int64, balanceID uuid.UUID) (*Balance, error) + func (s *Service) GetWalletsBalance(ctx context.Context, walletID int64, currency, networkID string) (*Balance, error) + func (s *Service) IncrementConfirmedTransaction(ctx context.Context, walletID int64, isTest bool) error + func (s *Service) IncrementPendingTransaction(ctx context.Context, walletID int64, isTest bool) (int, error) + func (s *Service) List(ctx context.Context, pagination Pagination) ([]*Wallet, *int64, error) + func (s *Service) ListBalances(ctx context.Context, entityType EntityType, entityID int64, withUSD bool) ([]*Balance, error) + func (s *Service) ReleaseLock(ctx context.Context, walletID int64, currency, networkID string) error + func (s *Service) UpdateBalanceByID(ctx context.Context, id int64, params UpdateBalanceByIDQuery) (*Balance, error) + func (s *Service) UpdateBalancesForWithdrawal(ctx context.Context, params UpdateBalancesForWithdrawal) error + func (s *Service) UpdateTatumSubscription(ctx context.Context, wallet *Wallet, subscription TatumSubscription) error + type TatumSubscription struct + MainnetSubscriptionID string + TestnetSubscriptionID string + type Type string + const TypeInbound + const TypeOutbound + type UpdateBalanceByIDQuery struct + Amount money.Money + Comment string + MetaData MetaData + Operation BalanceOperation + type UpdateBalanceQuery struct + Amount money.Money + Comment string + Currency money.CryptoCurrency + EntityID int64 + EntityType EntityType + IsTest bool + MetaData MetaData + Operation BalanceOperation + type UpdateBalancesForWithdrawal struct + Amount money.Money + Comment string + Merchant *Balance + Operation BalanceOperation + ServiceFee money.Money + System *Balance + TransactionID int64 + type Wallet struct + Address string + Blockchain kmswallet.Blockchain + ConfirmedMainnetTransactions int64 + ConfirmedTestnetTransactions int64 + CreatedAt time.Time + ID int64 + PendingMainnetTransactions int64 + PendingTestnetTransactions int64 + TatumSubscription TatumSubscription + Type Type + UUID uuid.UUID