transfers

package
v0.9.13-RC03 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRefundResult added in v0.9.13

type CheckRefundResult struct {
	// EstimatedFee is nil for btc like blockchains: the fee is calculated only on sending
	EstimatedFee  *decimal.Decimal
	FeeFromAmount bool
	ToSender      bool
}

type CreateTransferRequest

type CreateTransferRequest struct {
	OwnerID         uuid.UUID                 `json:"owner_id"`
	RequestID       string                    `json:"request_id"`
	Blockchain      wconstants.BlockchainType `json:"blockchain"`
	FromAddresses   []string                  `json:"from_addresses"`
	ToAddresses     []string                  `json:"to_addresses"`
	AssetIdentifier string                    `json:"asset_identifier"`
	Kind            *string                   `json:"kind"`
	WholeAmount     bool                      `json:"whole_amount"`
	Amount          decimal.NullDecimal       `json:"amount"`
	Fee             decimal.NullDecimal       `json:"fee"`
	FeeMax          decimal.NullDecimal       `json:"fee_max"`

	Purpose      constants.TransferPurpose `json:"purpose"`
	SourceTxHash *string                   `json:"source_tx_hash"`
	TOTP         string                    `json:"-"`
	// contains filtered or unexported fields
}

type FindParams

type FindParams = repo_transfers.FindParams

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(
	l logger.Logger,
	conf *config.Config,
	st store.IStore,
	walletsSvc *wallets.Service,
	eproxySvc *eproxy.Service,
	blockchains *blockchains.Blockchains,
	rmanager *rmanager.Service,
	ownersSvc *owners.Service,
) *Service

func (*Service) Cancel added in v0.9.13

func (s *Service) Cancel(
	ctx context.Context,
	ownerID uuid.UUID,
	requestID string,
	onCanceled func(ctx context.Context, transfer *models.Transfer, opts ...repos.Option) error,
) (*models.Transfer, error)

Cancel cancels a scheduled transfer which has not been picked up for execution yet. onCanceled is called in the same db transaction, e.g. to create the status webhook.

func (*Service) CheckRefund added in v0.9.13

func (s *Service) CheckRefund(ctx context.Context, req CreateTransferRequest) (*CheckRefundResult, error)

CheckRefund runs all checks of a refund without creating it: the deposit, the destination and that the hot wallet pays the network fee by itself. TOTP is not checked.

func (*Service) ClearBroadcastAt added in v0.9.13

func (s *Service) ClearBroadcastAt(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) error

ClearBroadcastAt resets broadcast_at when the node rejected the transfer transaction

func (*Service) Create

Create transfer

func (*Service) ExecuteNow added in v0.9.13

func (s *Service) ExecuteNow(ctx context.Context, ownerID uuid.UUID, requestID string, totp string) (*models.Transfer, error)

ExecuteNow confirms a scheduled transfer by the owner's TOTP and makes it due immediately.

func (*Service) ExistsByTxHashAndOwnerID

func (s *Service) ExistsByTxHashAndOwnerID(ctx context.Context, txHash string, ownerID uuid.UUID) (bool, error)

ExistsByTxHashAndOwnerID checks if the transfer with the specified txHash and ownerID exists.

func (*Service) Find

func (s *Service) Find(ctx context.Context, params FindParams) ([]*models.Transfer, error)

Find

func (*Service) FindAllNewTransfers

func (s *Service) FindAllNewTransfers(ctx context.Context) ([]*models.Transfer, error)

FindAllNewTransfers returns all new transfers.

func (*Service) GetActiveTronTransfersBurn

func (s *Service) GetActiveTronTransfersBurn(ctx context.Context) (*repo_transfers.GetActiveTronTransfersBurnRow, error)

GetActiveTronTransfersBurn

func (*Service) GetActiveTronTransfersResources

func (s *Service) GetActiveTronTransfersResources(ctx context.Context) (*repo_transfers.GetActiveTronTransfersResourcesRow, error)

GetActiveTronTransfersResources

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, transferID uuid.UUID) (*models.Transfer, error)

GetByID returns the transfer by the ID.

func (*Service) GetByRequestID

func (s *Service) GetByRequestID(ctx context.Context, requestID string) (*models.Transfer, error)

func (*Service) GetByTxHashAndOwnerID

func (s *Service) GetByTxHashAndOwnerID(ctx context.Context, txHash string, ownerID uuid.UUID) (*models.Transfer, error)

GetByTxHashAndOwnerID returns the transfer by the txHash and ownerID.

func (*Service) GetStateData

func (s *Service) GetStateData(ctx context.Context, transferID uuid.UUID) (map[string]any, error)

GetStateData returns the state data for the transfer.

func (*Service) GetSystemTransactionsByTransfer

func (s *Service) GetSystemTransactionsByTransfer(ctx context.Context, transferID uuid.UUID) ([]*models.TransferTransaction, error)

func (*Service) GetWorkflowSnapshot

func (s *Service) GetWorkflowSnapshot(ctx context.Context, transferID uuid.UUID) (*workflow.Snapshot, error)

GetWorkflowSnapshot returns the workflow snapshot for the transfer.

func (*Service) SetBroadcastAt added in v0.9.13

func (s *Service) SetBroadcastAt(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) error

SetBroadcastAt marks that the transfer transaction is being sent to the network. A failed refund with broadcast_at keeps the refunded deposit locked, see transfers_refund_source_uniq_idx.

func (*Service) SetProcessingIfNew added in v0.9.13

func (s *Service) SetProcessingIfNew(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) (bool, error)

SetProcessingIfNew sets the processing status if the transfer is still new. Returns false if the transfer was already taken or canceled.

func (*Service) SetStateData

func (s *Service) SetStateData(ctx context.Context, transferID uuid.UUID, stateData map[string]any, opts ...repos.Option) error

SetStateData sets the state data for the transfer.

func (*Service) SetStatus

func (s *Service) SetStatus(ctx context.Context, transferID uuid.UUID, status constants.TransferStatus, opts ...repos.Option) error

SetStatus sets the status for the transfer.

func (*Service) SetTxHash

func (s *Service) SetTxHash(ctx context.Context, transferID uuid.UUID, txHash string, opts ...repos.Option) (*models.Transfer, error)

SetTxHash sets the txHash for the transfer.

func (*Service) SetWorkflowSnapshot

func (s *Service) SetWorkflowSnapshot(ctx context.Context, transferID uuid.UUID, snapshot workflow.Snapshot, opts ...repos.Option) error

SetWorkflowSnapshot sets the workflow snapshot for the transfer.

Jump to

Keyboard shortcuts

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