Documentation
¶
Index ¶
- type CheckRefundResult
- type CreateTransferRequest
- type FindParams
- type Service
- func (s *Service) Cancel(ctx context.Context, ownerID uuid.UUID, requestID string, ...) (*models.Transfer, error)
- func (s *Service) CheckRefund(ctx context.Context, req CreateTransferRequest) (*CheckRefundResult, error)
- func (s *Service) ClearBroadcastAt(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) error
- func (s *Service) Create(ctx context.Context, req CreateTransferRequest) (*models.Transfer, error)
- func (s *Service) ExecuteNow(ctx context.Context, ownerID uuid.UUID, requestID string, totp string) (*models.Transfer, error)
- func (s *Service) ExistsByTxHashAndOwnerID(ctx context.Context, txHash string, ownerID uuid.UUID) (bool, error)
- func (s *Service) Find(ctx context.Context, params FindParams) ([]*models.Transfer, error)
- func (s *Service) FindAllNewTransfers(ctx context.Context) ([]*models.Transfer, error)
- func (s *Service) GetActiveTronTransfersBurn(ctx context.Context) (*repo_transfers.GetActiveTronTransfersBurnRow, error)
- func (s *Service) GetActiveTronTransfersResources(ctx context.Context) (*repo_transfers.GetActiveTronTransfersResourcesRow, error)
- func (s *Service) GetByID(ctx context.Context, transferID uuid.UUID) (*models.Transfer, error)
- func (s *Service) GetByRequestID(ctx context.Context, requestID string) (*models.Transfer, error)
- func (s *Service) GetByTxHashAndOwnerID(ctx context.Context, txHash string, ownerID uuid.UUID) (*models.Transfer, error)
- func (s *Service) GetStateData(ctx context.Context, transferID uuid.UUID) (map[string]any, error)
- func (s *Service) GetSystemTransactionsByTransfer(ctx context.Context, transferID uuid.UUID) ([]*models.TransferTransaction, error)
- func (s *Service) GetWorkflowSnapshot(ctx context.Context, transferID uuid.UUID) (*workflow.Snapshot, error)
- func (s *Service) SetBroadcastAt(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) error
- func (s *Service) SetProcessingIfNew(ctx context.Context, transferID uuid.UUID, opts ...repos.Option) (bool, error)
- func (s *Service) SetStateData(ctx context.Context, transferID uuid.UUID, stateData map[string]any, ...) error
- func (s *Service) SetStatus(ctx context.Context, transferID uuid.UUID, status constants.TransferStatus, ...) error
- func (s *Service) SetTxHash(ctx context.Context, transferID uuid.UUID, txHash string, opts ...repos.Option) (*models.Transfer, error)
- func (s *Service) SetWorkflowSnapshot(ctx context.Context, transferID uuid.UUID, snapshot workflow.Snapshot, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckRefundResult ¶ added in v0.9.13
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 (*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) 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) FindAllNewTransfers ¶
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) GetByRequestID ¶
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 ¶
GetStateData returns the state data for the transfer.
func (*Service) GetSystemTransactionsByTransfer ¶
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.