This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
generated from mrz1836/go-template
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
interface.go
83 lines (76 loc) · 3.37 KB
/
interface.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package bux
import (
"context"
"net/http"
"time"
"github.com/BuxOrg/bux/cachestore"
"github.com/BuxOrg/bux/chainstate"
"github.com/BuxOrg/bux/datastore"
"github.com/BuxOrg/bux/taskmanager"
"github.com/BuxOrg/bux/utils"
"github.com/tonicpow/go-paymail"
"github.com/tonicpow/go-paymail/server"
"gorm.io/gorm/logger"
)
// TransactionService is the transaction related requests
type TransactionService interface {
GetTransaction(ctx context.Context, rawXpubKey, txID string) (*Transaction, error)
GetTransactions(ctx context.Context, rawXpubKey string, metadata *Metadata, conditions *map[string]interface{}) ([]*Transaction, error)
NewTransaction(ctx context.Context, rawXpubKey string, config *TransactionConfig,
metadata map[string]interface{}, opts ...ModelOps) (*DraftTransaction, error)
RecordTransaction(ctx context.Context, xPubKey, txHex, draftID string,
opts ...ModelOps) (*Transaction, error)
}
// DestinationService is the destination related requests
type DestinationService interface {
GetDestinationByAddress(ctx context.Context, xPubKey, address string) (*Destination, error)
GetDestinationByLockingScript(ctx context.Context, xPubKey, lockingScript string) (*Destination, error)
GetDestinations(ctx context.Context, xPubKey string, usingMetadata *Metadata) ([]*Destination, error)
NewDestination(ctx context.Context, xPubKey string, chain uint32, destinationType string,
metadata *map[string]interface{}) (*Destination, error)
NewDestinationForLockingScript(ctx context.Context, xPubID, lockingScript, destinationType string,
metadata map[string]interface{}) (*Destination, error)
}
// UTXOService is the utxo related requests
type UTXOService interface {
GetUtxo(ctx context.Context, xPubKey, txID string, outputIndex uint32) (*Utxo, error)
GetUtxos(ctx context.Context, xPubKey string) ([]*Utxo, error)
}
// XPubService is the xPub related requests
type XPubService interface {
GetXpub(ctx context.Context, xPubKey string) (*Xpub, error)
GetXpubByID(ctx context.Context, xPubID string) (*Xpub, error)
ImportXpub(ctx context.Context, xPubKey string, opts ...ModelOps) (*ImportResults, error)
NewXpub(ctx context.Context, xPubKey string, opts ...ModelOps) (*Xpub, error)
}
// ClientInterface is the client (bux engine) interface
type ClientInterface interface {
DestinationService
TransactionService
UTXOService
XPubService
AddModels(ctx context.Context, autoMigrate bool, models ...interface{}) error
AuthenticateRequest(ctx context.Context, req *http.Request, adminXPubs []string, adminRequired, requireSigning, signingDisabled bool) (*http.Request, error)
Cachestore() cachestore.ClientInterface
Chainstate() chainstate.ClientInterface
Close(ctx context.Context) error
Datastore() datastore.ClientInterface
Debug(on bool)
DefaultModelOptions(opts ...ModelOps) []ModelOps
EnableNewRelic()
GetFeeUnit(_ context.Context, _ string) *utils.FeeUnit
GetOrStartTxn(ctx context.Context, name string) context.Context
GetTaskPeriod(name string) time.Duration
IsDebug() bool
IsITCEnabled() bool
IsIUCEnabled() bool
IsNewRelicEnabled() bool
Logger() logger.Interface
ModifyPaymailConfig(config *server.Configuration, defaultFromPaymail, defaultNote string)
ModifyTaskPeriod(name string, period time.Duration) error
PaymailClient() paymail.ClientInterface
PaymailServerConfig() *paymailServerOptions
Taskmanager() taskmanager.ClientInterface
UserAgent() string
Version() string
}