Files
ark/server/internal/core/ports/wallet.go
Louis Singer 066e8eeabb Prevent getting cheated by broadcasting forfeit transactions (#123)
* broadcast forfeit transaction in case the user is trying the cheat the ASP

* fix connector input + --cheat flag in CLI

* WIP

* cleaning and fixes

* add TODO

* sweeper.go: mark round swept if vtxo are redeemed

* fixes after reviews

* revert "--cheat" flag in client

* revert redeem.go

* optimization

* update account.go according to ocean ListUtxos new spec

* WaitForSync implementation

* ocean-wallet/service.go: remove go rountine while writing to notification channel
2024-03-04 13:58:36 +01:00

42 lines
1.4 KiB
Go

package ports
import (
"context"
"github.com/decred/dcrd/dcrec/secp256k1/v4"
)
type WalletService interface {
BlockchainScanner
Status(ctx context.Context) (WalletStatus, error)
GetPubkey(ctx context.Context) (*secp256k1.PublicKey, error)
DeriveConnectorAddress(ctx context.Context) (string, error)
DeriveAddresses(ctx context.Context, num int) ([]string, error)
SignPset(
ctx context.Context, pset string, extractRawTx bool,
) (string, error)
SelectUtxos(ctx context.Context, asset string, amount uint64) ([]TxInput, uint64, error)
BroadcastTransaction(ctx context.Context, txHex string) (string, error)
SignPsetWithKey(ctx context.Context, pset string, inputIndexes []int) (string, error) // inputIndexes == nil means sign all inputs
IsTransactionConfirmed(ctx context.Context, txid string) (isConfirmed bool, blocktime int64, err error)
WaitForSync(ctx context.Context, txid string) error
EstimateFees(ctx context.Context, pset string) (uint64, error)
SignConnectorInput(ctx context.Context, pset string, inputIndexes []int, extract bool) (string, error)
ListConnectorUtxos(ctx context.Context, connectorAddress string) ([]TxInput, error)
Close()
}
type WalletStatus interface {
IsInitialized() bool
IsUnlocked() bool
IsSynced() bool
}
type TxInput interface {
GetTxid() string
GetIndex() uint32
GetScript() string
GetAsset() string
GetValue() uint64
}