forked from libsv/payd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
txo.go
50 lines (44 loc) · 1.44 KB
/
txo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package gopayd
import (
"context"
"time"
)
// TxoCreate is used when creating outputs as part of a paymentRequest
// the script keys created are stored and later picked up
// and validated when the user sends a payment.
//
// These are partial txos and will be further hydrated when a transaction
// is sent spending them.
type TxoCreate struct {
KeyName string
DerivationPath string
LockingScript string
Satoshis uint64
}
// UnspentTxoArgs are used to located an unfulfilled txo.
type UnspentTxoArgs struct {
Keyname string `db:"keyname"`
LockingScript string `db:"lockingscript"`
Satoshis uint64 `db:"satoshis"`
}
// UnspentTxo is an unfulfilled txo not yet linked to a transaction.
type UnspentTxo struct {
KeyName string
DerivationPath string
LockingScript string
Satoshis uint64
CreatedAt time.Time
ModifiedAt time.Time
}
// TxoWriter is used to add transaction information to a data store.
type TxoWriter interface {
// TxoCreate will add a partial txo to a data store.
TxoCreate(ctx context.Context, req TxoCreate) error
// TxosCreate will add an array of partial txos to a data store.
TxosCreate(ctx context.Context, req []*TxoCreate) error
}
// TxoReader is used to read tx information from a data store.
type TxoReader interface {
// PartialTxo will return a txo that has not tet been assigned to a transaction.
PartialTxo(ctx context.Context, args UnspentTxoArgs) (*UnspentTxo, error)
}