Documentation
¶
Index ¶
- Variables
- type Alerts
- type BatchFinalizedAlert
- type BlockTimestamp
- type BlockchainScanner
- type BoardingInput
- type BoardingInputsStore
- type ConfirmationSessions
- type ConfirmationSessionsStore
- type CurrentRoundStore
- type FeeManager
- type ForfeitTxsStore
- type Input
- type IntentStore
- type LiveStore
- type MusigSigningSession
- type Notifier
- type OffChainTxStore
- type RepoManager
- type SchedulerService
- type SignedBoardingInput
- type SignerService
- type Tapscript
- type TimeUnit
- type TimedIntent
- type Topic
- type TreeSigningSessionsStore
- type TxBuilder
- type TxDecoder
- type TxIn
- type TxInput
- type TxOut
- type Unlocker
- type ValidForfeitTx
- type VtxoWithValue
- type WalletService
- type WalletStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNonFinalBIP68 is returned when a transaction spending a CSV-locked output is not final. ErrNonFinalBIP68 = errors.New("non-final BIP68 sequence") )
Functions ¶
This section is empty.
Types ¶
type BatchFinalizedAlert ¶ added in v0.8.8
type BatchFinalizedAlert struct {
Id string
CommitmentTxid string
Duration string
LiquidityProviderInputAmount uint64
LiquidityProviderConfirmedBalance uint64
LiquidityProviderUnconfirmedBalance uint64
LiquidityCost string
LiquidityProvided uint64
BoardingInputCount int
BoardingInputAmount uint64
IntentsCount int
LeafCount int
LeafAmount uint64
ConnectorsCount int
ConnectorsAmount uint64
ExitCount int
ExitAmount uint64
ForfeitCount int
ForfeitAmount uint64
OnchainFees uint64
CollectedFees uint64
}
type BlockTimestamp ¶
type BlockchainScanner ¶
type BlockchainScanner interface {
WatchScripts(ctx context.Context, scripts []string) error
UnwatchScripts(ctx context.Context, scripts []string) error
GetNotificationChannel(ctx context.Context) <-chan map[string][]VtxoWithValue
IsTransactionConfirmed(
ctx context.Context, txid string,
) (isConfirmed bool, blockTimestamp *BlockTimestamp, err error)
RescanUtxos(ctx context.Context, outpoints []wire.OutPoint) error
}
type BoardingInput ¶
type BoardingInputsStore ¶
type BoardingInputsStore interface {
Set(ctx context.Context, numOfInputs int) error
Get(ctx context.Context) (int, error)
AddSignatures(
ctx context.Context, batchId string, inputSigs map[uint32]SignedBoardingInput,
) error
GetSignatures(ctx context.Context, batchId string) (map[uint32]SignedBoardingInput, error)
DeleteSignatures(ctx context.Context, batchId string) error
}
type ConfirmationSessions ¶
type ConfirmationSessionsStore ¶
type ConfirmationSessionsStore interface {
Init(ctx context.Context, intentIDsHashes [][32]byte) error
Confirm(ctx context.Context, intentId string) error
Get(ctx context.Context) (*ConfirmationSessions, error)
Reset(ctx context.Context) error
Initialized(ctx context.Context) bool
SessionCompleted() <-chan struct{}
}
type CurrentRoundStore ¶
type FeeManager ¶ added in v0.8.11
type ForfeitTxsStore ¶
type ForfeitTxsStore interface {
Init(ctx context.Context, connectors tree.FlatTxTree, intents []domain.Intent) error
Sign(ctx context.Context, txs []string) error
Reset(ctx context.Context) error
Pop(ctx context.Context) ([]string, error)
AllSigned(ctx context.Context) (bool, error)
GetUnsignedInputs(ctx context.Context) ([]domain.Outpoint, error)
Len(ctx context.Context) (int, error)
GetConnectorsIndexes(ctx context.Context) (map[string]domain.Outpoint, error)
}
type Input ¶
func (Input) OutputScript ¶ added in v0.8.0
type IntentStore ¶
type IntentStore interface {
Len(ctx context.Context) (int64, error)
Push(
ctx context.Context, intent domain.Intent, boardingInputs []BoardingInput, cosignersPublicKeys []string,
) error
Pop(ctx context.Context, num int64) ([]TimedIntent, error)
GetSelectedIntents(ctx context.Context) ([]TimedIntent, error)
// TODO uncomment when we have a way to register outputs outside of intent proof
// Update(intent domain.Intent, cosignersPublicKeys []string) error
Delete(ctx context.Context, ids []string) error
DeleteAll(ctx context.Context) error
DeleteVtxos(ctx context.Context) error
ViewAll(ctx context.Context, ids []string) ([]TimedIntent, error)
IncludesAny(ctx context.Context, outpoints []domain.Outpoint) (bool, string)
}
type LiveStore ¶
type LiveStore interface {
Intents() IntentStore
ForfeitTxs() ForfeitTxsStore
OffchainTxs() OffChainTxStore
CurrentRound() CurrentRoundStore
ConfirmationSessions() ConfirmationSessionsStore
TreeSigingSessions() TreeSigningSessionsStore
BoardingInputs() BoardingInputsStore
}
type MusigSigningSession ¶
type MusigSigningSession struct {
NbCosigners int
Cosigners map[string]struct{}
Nonces map[string]tree.TreeNonces
Signatures map[string]tree.TreePartialSigs
}
MusigSigningSession holds the state of ephemeral nonces and signatures in order to coordinate the signing of the tree
type OffChainTxStore ¶
type RepoManager ¶
type RepoManager interface {
Events() domain.EventRepository
Rounds() domain.RoundRepository
Vtxos() domain.VtxoRepository
ScheduledSession() domain.ScheduledSessionRepo
OffchainTxs() domain.OffchainTxRepository
Convictions() domain.ConvictionRepository
Assets() domain.AssetRepository
Fees() domain.FeeRepository
Close()
}
type SchedulerService ¶
type SignedBoardingInput ¶ added in v0.8.7
type SignedBoardingInput struct {
Signatures []*psbt.TaprootScriptSpendSig
LeafScript *psbt.TaprootTapLeafScript
}
type SignerService ¶ added in v0.7.1
type SignerService interface {
IsReady(ctx context.Context) (bool, error)
GetPubkey(ctx context.Context) (*btcec.PublicKey, error)
SignTransaction(ctx context.Context, partialTx string, extractRawTx bool) (string, error)
SignTransactionTapscript(
ctx context.Context, partialTx string, inputIndexes []int,
) (string, error)
}
type TimedIntent ¶
type TimedIntent struct {
domain.Intent
BoardingInputs []BoardingInput
Timestamp time.Time
CosignersPublicKeys []string
}
func (TimedIntent) HashID ¶
func (t TimedIntent) HashID() [32]byte
type TreeSigningSessionsStore ¶
type TreeSigningSessionsStore interface {
New(ctx context.Context, roundId string, uniqueSignersPubKeys map[string]struct{}) error
Get(ctx context.Context, roundId string) (*MusigSigningSession, error)
Delete(ctx context.Context, roundId string) error
AddNonces(ctx context.Context, roundId string, pubkey string, nonces tree.TreeNonces) error
AddSignatures(
ctx context.Context, roundId, pubkey string, nonces tree.TreePartialSigs,
) error
NoncesCollected(roundId string) <-chan struct{}
SignaturesCollected(roundId string) <-chan struct{}
}
type TxBuilder ¶
type TxBuilder interface {
// BuildCommitmentTx builds a commitment tx for the given intents and boarding inputs
// It expects an optional list of connector addresses of expired batches from which selecting
// utxos as inputs of the transaction.
// Returns the commitment tx, the vtxo tree, the connector tree and its root address.
BuildCommitmentTx(
signerPubkey *btcec.PublicKey, intents domain.Intents,
boardingInputs []BoardingInput, cosigners [][]string,
) (
commitmentTx string, vtxoTree *tree.TxTree,
connectorAddress string, connectors *tree.TxTree, err error,
)
// VerifyForfeitTxs verifies a list of forfeit txs against a set of VTXOs and
// connectors.
VerifyForfeitTxs(
vtxos []domain.Vtxo, connectors tree.FlatTxTree, txs []string,
) (valid map[domain.Outpoint]ValidForfeitTx, err error)
BuildSweepTx(inputs []TxInput) (txid string, signedSweepTx string, err error)
GetSweepableBatchOutputs(vtxoTree *tree.TxTree) (
vtxoTreeExpiry *arklib.RelativeLocktime, batchOutputs *TxInput, err error,
)
FinalizeAndExtract(tx string) (txhex string, err error)
VerifyVtxoTapscriptSigs(
tx string, mustIncludeSignerSig bool,
) (valid bool, ptx *psbt.Packet, err error)
VerifyBoardingTapscriptSigs(
signedTx string, commitmentTx string,
) (map[uint32]SignedBoardingInput, error)
}
type ValidForfeitTx ¶
type VtxoWithValue ¶
type WalletService ¶
type WalletService interface {
BlockchainScanner
GetReadyUpdate(ctx context.Context) (<-chan bool, error)
GenSeed(ctx context.Context) (string, error)
Create(ctx context.Context, seed, password string) error
Restore(ctx context.Context, seed, password string) error
Unlock(ctx context.Context, password string) error
Lock(ctx context.Context) error
Status(ctx context.Context) (WalletStatus, error)
GetNetwork(ctx context.Context) (*arklib.Network, error)
GetForfeitPubkey(ctx context.Context) (*btcec.PublicKey, error)
DeriveConnectorAddress(ctx context.Context) (string, error)
DeriveAddresses(ctx context.Context, num int) ([]string, error)
SignTransaction(ctx context.Context, partialTx string, extractRawTx bool) (string, error)
SignTransactionTapscript(
ctx context.Context, partialTx string, inputIndexes []int,
) (string, error)
SelectUtxos(
ctx context.Context, asset string, amount uint64, confirmedOnly bool,
) ([]TxInput, uint64, error)
BroadcastTransaction(ctx context.Context, txs ...string) (string, error)
EstimateFees(ctx context.Context, psbt string) (uint64, error)
FeeRate(ctx context.Context) (uint64, error)
ListConnectorUtxos(ctx context.Context, connectorAddress string) ([]TxInput, error)
MainAccountBalance(ctx context.Context) (uint64, uint64, error)
ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error)
LockConnectorUtxos(ctx context.Context, utxos []domain.Outpoint) error
GetDustAmount(ctx context.Context) (uint64, error)
GetTransaction(ctx context.Context, txid string) (string, error)
GetOutpointStatus(ctx context.Context, outpoint domain.Outpoint) (spent bool, err error)
GetCurrentBlockTime(ctx context.Context) (*BlockTimestamp, error)
Withdraw(ctx context.Context, address string, amount uint64, all bool) (string, error)
LoadSignerKey(ctx context.Context, prvkey string) error
Close()
}
type WalletStatus ¶
Click to show internal directories.
Click to hide internal directories.