Documentation
¶
Index ¶
- Constants
- type BatchSwept
- type Event
- type EventRepository
- type EventType
- type ForfeitTx
- type Intent
- type Intents
- type IntentsRegistered
- type MarketHour
- type MarketHourRepo
- type OffchainTx
- func (s *OffchainTx) Accept(finalArkTx string, signedCheckpointTxs map[string]string, ...) (Event, error)
- func (s *OffchainTx) CommitmentTxidsList() []string
- func (s *OffchainTx) Events() []Event
- func (s *OffchainTx) Fail(err error) Event
- func (s *OffchainTx) Finalize(finalCheckpointTxs map[string]string) (Event, error)
- func (s *OffchainTx) IsAccepted() bool
- func (s *OffchainTx) IsFailed() bool
- func (s *OffchainTx) IsFinalized() bool
- func (s *OffchainTx) IsRequested() bool
- func (s *OffchainTx) Request(arkTxid, arkTx string, unsignedCheckpointTxs map[string]string) (Event, error)
- type OffchainTxAccepted
- type OffchainTxEvent
- type OffchainTxFailed
- type OffchainTxFinalized
- type OffchainTxRepository
- type OffchainTxRequested
- type OffchainTxStage
- type Outpoint
- type Receiver
- type Round
- func (r *Round) EndFinalization(forfeitTxs []ForfeitTx, finalCommitmentTx string) ([]Event, error)
- func (r *Round) Events() []Event
- func (r *Round) ExpiryTimestamp() int64
- func (r *Round) Fail(err error) []Event
- func (r *Round) IsEnded() bool
- func (r *Round) IsFailed() bool
- func (r *Round) IsStarted() bool
- func (r *Round) RegisterIntents(intents []Intent) ([]Event, error)
- func (r *Round) StartFinalization(connectorAddress string, connectors tree.FlatTxTree, vtxoTree tree.FlatTxTree, ...) ([]Event, error)
- func (r *Round) StartRegistration() ([]Event, error)
- func (r *Round) Sweep(vtxos []Outpoint, txid, tx string) ([]Event, error)
- type RoundEvent
- type RoundFailed
- type RoundFinalizationStarted
- type RoundFinalized
- type RoundRepository
- type RoundStage
- type RoundStarted
- type RoundStats
- type Stage
- type Tx
- type Vtxo
- type VtxoRepository
Constants ¶
View Source
const OffchainTxTopic = "offchain_tx"
View Source
const RoundTopic = "round"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchSwept ¶
type BatchSwept struct { RoundEvent Vtxos []Outpoint Txid string Tx string FullySwept bool }
type EventRepository ¶
type Intent ¶
func (*Intent) AddReceivers ¶
func (Intent) TotalInputAmount ¶
func (Intent) TotalOutputAmount ¶
type Intents ¶
type Intents []Intent
func (Intents) CountSpentVtxos ¶
func (Intents) HaveOnlyOnchainOutput ¶
type IntentsRegistered ¶
type IntentsRegistered struct { RoundEvent Intents []Intent }
type MarketHour ¶
type MarketHour struct { StartTime time.Time EndTime time.Time Period time.Duration RoundInterval time.Duration UpdatedAt time.Time }
func NewMarketHour ¶
func NewMarketHour(startTime, endTime time.Time, period, roundInterval time.Duration) *MarketHour
type MarketHourRepo ¶
type MarketHourRepo interface { Get(ctx context.Context) (*MarketHour, error) Upsert(ctx context.Context, marketHour MarketHour) error Close() }
type OffchainTx ¶
type OffchainTx struct { Stage Stage StartingTimestamp int64 EndingTimestamp int64 ArkTxid string ArkTx string CheckpointTxs map[string]string CommitmentTxids map[string]string RootCommitmentTxId string ExpiryTimestamp int64 FailReason string Version uint // contains filtered or unexported fields }
func NewOffchainTx ¶
func NewOffchainTx() *OffchainTx
func NewOffchainTxFromEvents ¶
func NewOffchainTxFromEvents(events []Event) *OffchainTx
func (*OffchainTx) CommitmentTxidsList ¶
func (s *OffchainTx) CommitmentTxidsList() []string
func (*OffchainTx) Events ¶
func (s *OffchainTx) Events() []Event
func (*OffchainTx) Fail ¶
func (s *OffchainTx) Fail(err error) Event
func (*OffchainTx) Finalize ¶
func (s *OffchainTx) Finalize(finalCheckpointTxs map[string]string) (Event, error)
func (*OffchainTx) IsAccepted ¶
func (s *OffchainTx) IsAccepted() bool
func (*OffchainTx) IsFailed ¶
func (s *OffchainTx) IsFailed() bool
func (*OffchainTx) IsFinalized ¶
func (s *OffchainTx) IsFinalized() bool
func (*OffchainTx) IsRequested ¶
func (s *OffchainTx) IsRequested() bool
type OffchainTxAccepted ¶
type OffchainTxEvent ¶
func (OffchainTxEvent) GetTopic ¶
func (s OffchainTxEvent) GetTopic() string
func (OffchainTxEvent) GetType ¶
func (s OffchainTxEvent) GetType() EventType
type OffchainTxFailed ¶
type OffchainTxFailed struct { OffchainTxEvent Reason string Timestamp int64 }
type OffchainTxFinalized ¶
type OffchainTxFinalized struct { OffchainTxEvent FinalCheckpointTxs map[string]string Timestamp int64 }
type OffchainTxRepository ¶
type OffchainTxRepository interface { AddOrUpdateOffchainTx(ctx context.Context, offchainTx *OffchainTx) error GetOffchainTx(ctx context.Context, txid string) (*OffchainTx, error) Close() }
type OffchainTxRequested ¶
type OffchainTxRequested struct { OffchainTxEvent ArkTx string UnsignedCheckpointTxs map[string]string StartingTimestamp int64 }
type OffchainTxStage ¶
type OffchainTxStage int
const ( OffchainTxUndefinedStage OffchainTxStage = iota OffchainTxRequestedStage OffchainTxAcceptedStage OffchainTxFinalizedStage )
func (OffchainTxStage) String ¶
func (s OffchainTxStage) String() string
type Round ¶
type Round struct { Id string StartingTimestamp int64 EndingTimestamp int64 Stage Stage Intents map[string]Intent CommitmentTxid string CommitmentTx string ForfeitTxs []ForfeitTx VtxoTree tree.FlatTxTree Connectors tree.FlatTxTree ConnectorAddress string Version uint Swept bool VtxoTreeExpiration int64 SweepTxs map[string]string FailReason string Changes []Event }
func NewRoundFromEvents ¶
func (*Round) EndFinalization ¶
func (*Round) ExpiryTimestamp ¶
func (*Round) StartFinalization ¶
func (r *Round) StartFinalization( connectorAddress string, connectors tree.FlatTxTree, vtxoTree tree.FlatTxTree, commitmentTxid, commitmentTx string, vtxoTreeExpiration int64, ) ([]Event, error)
func (*Round) StartRegistration ¶
type RoundEvent ¶
func (RoundEvent) GetTopic ¶
func (r RoundEvent) GetTopic() string
func (RoundEvent) GetType ¶
func (r RoundEvent) GetType() EventType
type RoundFailed ¶
type RoundFailed struct { RoundEvent Reason string Timestamp int64 }
type RoundFinalizationStarted ¶
type RoundFinalizationStarted struct { RoundEvent VtxoTree tree.FlatTxTree Connectors tree.FlatTxTree ConnectorAddress string CommitmentTxid string CommitmentTx string VtxoTreeExpiration int64 }
type RoundFinalized ¶
type RoundFinalized struct { RoundEvent ForfeitTxs []ForfeitTx FinalCommitmentTx string Timestamp int64 }
type RoundRepository ¶
type RoundRepository interface { AddOrUpdateRound(ctx context.Context, round Round) error GetRoundWithId(ctx context.Context, id string) (*Round, error) GetRoundWithCommitmentTxid(ctx context.Context, txid string) (*Round, error) GetRoundStats(ctx context.Context, commitmentTxid string) (*RoundStats, error) GetRoundForfeitTxs(ctx context.Context, commitmentTxid string) ([]ForfeitTx, error) GetRoundConnectorTree(ctx context.Context, commitmentTxid string) (tree.FlatTxTree, error) GetRoundVtxoTree(ctx context.Context, txid string) (tree.FlatTxTree, error) GetSweepableRounds(ctx context.Context) ([]string, error) GetRoundIds(ctx context.Context, startedAfter int64, startedBefore int64) ([]string, error) GetSweptRoundsConnectorAddress(ctx context.Context) ([]string, error) GetTxsWithTxids(ctx context.Context, txids []string) ([]string, error) GetRoundsWithCommitmentTxids(ctx context.Context, txids []string) (map[string]any, error) Close() }
type RoundStage ¶
type RoundStage int
const ( RoundUndefinedStage RoundStage = iota RoundRegistrationStage RoundFinalizationStage )
func (RoundStage) String ¶
func (s RoundStage) String() string
type RoundStarted ¶
type RoundStarted struct { RoundEvent Timestamp int64 }
type RoundStats ¶
type Vtxo ¶
type Vtxo struct { Outpoint Amount uint64 PubKey string CommitmentTxids []string RootCommitmentTxid string SettledBy string // commitment txid SpentBy string // forfeit txid or checkpoint txid ArkTxid string // the link to the ark txid that spent the vtxos Spent bool Unrolled bool Swept bool Preconfirmed bool ExpiresAt int64 CreatedAt int64 }
func (Vtxo) RequiresForfeit ¶
type VtxoRepository ¶
type VtxoRepository interface { AddVtxos(ctx context.Context, vtxos []Vtxo) error SettleVtxos(ctx context.Context, spentVtxos map[Outpoint]string, commitmentTxid string) error SpendVtxos(ctx context.Context, spentVtxos map[Outpoint]string, arkTxid string) error UnrollVtxos(ctx context.Context, outpoints []Outpoint) error SweepVtxos(ctx context.Context, outpoints []Outpoint) error GetVtxos(ctx context.Context, outpoints []Outpoint) ([]Vtxo, error) GetVtxosForRound(ctx context.Context, txid string) ([]Vtxo, error) GetAllNonUnrolledVtxos(ctx context.Context, pubkey string) ([]Vtxo, []Vtxo, error) GetAllSweepableVtxos(ctx context.Context) ([]Vtxo, error) GetAllVtxos(ctx context.Context) ([]Vtxo, error) GetAllVtxosWithPubKeys(ctx context.Context, pubkeys []string) ([]Vtxo, error) UpdateVtxosExpiration(ctx context.Context, outpoints []Outpoint, expiresAt int64) error GetLeafVtxosForBatch(ctx context.Context, txid string) ([]Vtxo, error) Close() }
Click to show internal directories.
Click to hide internal directories.