-
Notifications
You must be signed in to change notification settings - Fork 5
/
paymail.go
65 lines (54 loc) · 1.67 KB
/
paymail.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package payd
import (
"context"
"github.com/libsv/go-bt/v2"
)
// P2PTransactionArgs is used to get a transaction.
type P2PTransactionArgs struct {
Alias string
Domain string
PaymentID string
TxHex string
}
// P2PTransaction defines a peer to peer transaction.
type P2PTransaction struct {
TxHex string
Metadata P2PTransactionMetadata
}
// P2PTransactionMetadata contains potentially optional
// metadata that can be sent along with a p2p payment.
type P2PTransactionMetadata struct {
Note string // A human readable bit of information about the payment
PubKey string // Public key to validate the signature (if signature is given)
Sender string // The paymail of the person that originated the transaction
Signature string
}
// P2PCapabilityArgs is used to retrieve information from a
// p2p server.
// https://bsvalias.org/02-02-capability-discovery.html
type P2PCapabilityArgs struct {
Domain string
BrfcID string
}
// P2POutputCreateArgs is used to locate a `signer when sending a p2p payment.
type P2POutputCreateArgs struct {
Domain string
Alias string
}
// P2PPayment contains the amount of satoshis to send peer to peer.
type P2PPayment struct {
Satoshis uint64
}
// PaymailReader reads paymail information from a datastore.
type PaymailReader interface {
Capability(ctx context.Context, args P2PCapabilityArgs) (string, error)
}
// PaymailWriter writes to a paymail datastore.
type PaymailWriter interface {
OutputsCreate(ctx context.Context, args P2POutputCreateArgs, req P2PPayment) ([]*bt.Output, error)
}
// PaymailReaderWriter combines the reader and writer interfaces.
type PaymailReaderWriter interface {
PaymailReader
PaymailWriter
}